Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

NtpSRTrack.cxx

Go to the documentation of this file.
00001 
00002 // NtpSRTrack
00003 //
00004 // NtpSRTrack is an ntuple class to hold 3-d track data
00005 //
00007 
00008 #include <iostream>
00009 using namespace std;
00010 
00011 #include "MessageService/MsgService.h"
00012 #include "CandNtupleSR/NtpSRTrack.h"
00013 
00014 ClassImp(NtpSRTrack)
00015 
00016 std::ostream& operator << (std::ostream& os, const NtpSRTrack& ntp) 
00017                                      { return ntp.Print(os); }
00018 
00019 CVSID("$Id: NtpSRTrack.cxx,v 1.18 2006/08/03 18:14:19 musser Exp $");
00020 
00021 NtpSRTrack::NtpSRTrack(Int_t nstripinit) : index(0),slc(0),ndigit(0),
00022                  nstpcnt(nstripinit),nstrip(nstripinit),
00023                  stp(0),stpfit(0),stpu(0),stpv(0),stpx(0),stpy(0),stpz(0),
00024                  stpds(0),stpfitchi2(0),stpfitprechi2(0),stpfitqp(0),
00025                  stpph0sigmap(0),stpph0mip(0),stpph0gev(0),stpph1sigmap(0),
00026                  stpph1mip(0),stpph1gev(0),stpattn0c0(0),stpattn1c0(0),
00027                  stpt0(0),stpt1(0),stptcal0t0(0),stptcal1t0(0),ds(0),range(0),
00028                  cputime(0),contained(0) {
00029   //
00030   // Purpose: Normal constructor
00031   //
00032 
00033   if ( nstrip ) {
00034     stp           = new Int_t[nstrip]; 
00035     stpfit        = new Byte_t[nstrip]; 
00036     stpu          = new Float_t[nstrip]; 
00037     stpv          = new Float_t[nstrip]; 
00038     stpx          = new Float_t[nstrip]; 
00039     stpy          = new Float_t[nstrip]; 
00040     stpz          = new Float_t[nstrip]; 
00041     stpds         = new Float_t[nstrip]; 
00042     stpfitchi2    = new Float_t[nstrip]; 
00043     stpfitprechi2 = new Float_t[nstrip]; 
00044     stpfitqp      = new Float_t[nstrip]; 
00045     stpph0sigmap  = new Float_t[nstrip]; 
00046     stpph0mip     = new Float_t[nstrip]; 
00047     stpph0gev     = new Float_t[nstrip]; 
00048     stpph1sigmap  = new Float_t[nstrip]; 
00049     stpph1mip     = new Float_t[nstrip]; 
00050     stpph1gev     = new Float_t[nstrip]; 
00051     stpattn0c0    = new Float_t[nstrip]; 
00052     stpattn1c0    = new Float_t[nstrip]; 
00053     stpt0         = new Double_t[nstrip]; 
00054     stpt1         = new Double_t[nstrip]; 
00055     stptcal0t0    = new Double_t[nstrip]; 
00056     stptcal1t0    = new Double_t[nstrip]; 
00057   }
00058   else {
00059     MSG("NtpSR",Msg::kWarning) 
00060       << "NtpSRTrack constructor called with nstrip = 0" << endl;
00061   }
00062   
00063   for (Int_t i = 0; i < nstrip; i++ ) {
00064        stp[i] = -1;
00065        stpfit[i] = 1;
00066        stpu[i] = -999999;
00067        stpv[i] = -999999;
00068        stpx[i] = -999999;
00069        stpy[i] = -999999;
00070        stpz[i] = -999999;
00071        stpds[i] = -999999;
00072        stpfitchi2[i] = 0;
00073        stpfitprechi2[i] = 0;
00074        stpfitqp[i] = 0;
00075        stpph0sigmap[i] = 0.;
00076        stpph0mip[i] = 0.;
00077        stpph0gev[i] = 0.;
00078        stpph1sigmap[i] = 0.;
00079        stpph1mip[i] = 0.;
00080        stpph1gev[i] = 0.;
00081        stpattn0c0[i] = -999999;
00082        stpattn1c0[i] = -999999;
00083        stpt0[i] = -999999;
00084        stpt1[i] = -999999;
00085        stptcal0t0[i] = -999999;
00086        stptcal1t0[i] = -999999;
00087   }
00088 
00089 }
00090 
00091 NtpSRTrack::NtpSRTrack(const NtpSRTrack& o) // copy ctor
00092   : TObject(o),
00093     index(o.index),
00094     slc(o.slc),
00095     ndigit(o.ndigit),
00096     nstpcnt(o.nstpcnt),
00097     nstrip(o.nstrip),
00098     stp(0),stpfit(0),stpu(0),stpv(0),stpx(0),stpy(0),stpz(0),
00099     stpds(0),stpfitchi2(0),stpfitprechi2(0),stpfitqp(0),
00100     stpph0sigmap(0),stpph0mip(0),stpph0gev(0),stpph1sigmap(0),
00101     stpph1mip(0),stpph1gev(0),stpattn0c0(0),stpattn1c0(0),
00102     stpt0(0),stpt1(0),stptcal0t0(0),stptcal1t0(0),ds(0),range(0),
00103     cputime(0),contained(0) 
00104 {
00105   //
00106   // Purpose: Copy constructor
00107   //
00108   if ( nstrip ) {
00109     stp           = new Int_t[nstrip]; 
00110     stpfit        = new Byte_t[nstrip]; 
00111     stpu          = new Float_t[nstrip]; 
00112     stpv          = new Float_t[nstrip]; 
00113     stpx          = new Float_t[nstrip]; 
00114     stpy          = new Float_t[nstrip]; 
00115     stpz          = new Float_t[nstrip]; 
00116     stpds         = new Float_t[nstrip]; 
00117     stpfitchi2    = new Float_t[nstrip]; 
00118     stpfitprechi2 = new Float_t[nstrip]; 
00119     stpfitqp      = new Float_t[nstrip]; 
00120     stpph0sigmap  = new Float_t[nstrip]; 
00121     stpph0mip     = new Float_t[nstrip]; 
00122     stpph0gev     = new Float_t[nstrip]; 
00123     stpph1sigmap  = new Float_t[nstrip]; 
00124     stpph1mip     = new Float_t[nstrip]; 
00125     stpph1gev     = new Float_t[nstrip]; 
00126     stpattn0c0    = new Float_t[nstrip]; 
00127     stpattn1c0    = new Float_t[nstrip]; 
00128     stpt0         = new Double_t[nstrip]; 
00129     stpt1         = new Double_t[nstrip]; 
00130     stptcal0t0    = new Double_t[nstrip]; 
00131     stptcal1t0    = new Double_t[nstrip]; 
00132   }
00133 
00134   for (Int_t i = 0; i < nstrip; i++ ) {
00135        stp[i] = o.stp[i];
00136        stpfit[i] = o.stpfit[i];
00137        stpu[i] = o.stpu[i];
00138        stpv[i] = o.stpv[i];
00139        stpx[i] = o.stpx[i];
00140        stpy[i] = o.stpy[i];
00141        stpz[i] = o.stpz[i];
00142        stpds[i] = o.stpds[i];
00143        stpfitchi2[i] = o.stpfitchi2[i];
00144        stpfitprechi2[i] = o.stpfitprechi2[i];
00145        stpfitqp[i] = o.stpfitqp[i];
00146        stpph0sigmap[i] = o.stpph0sigmap[i];
00147        stpph0mip[i]    = o.stpph0mip[i];   
00148        stpph0gev[i]    = o.stpph0gev[i]; 
00149        stpph1sigmap[i] = o.stpph1sigmap[i]; 
00150        stpph1mip[i]    = o.stpph1mip[i];
00151        stpph1gev[i]    = o.stpph1gev[i];
00152        stpattn0c0[i]   = o.stpattn0c0[i];
00153        stpattn1c0[i]   = o.stpattn1c0[i];
00154        stpt0[i]        = o.stpt0[i]; 
00155        stpt1[i]        = o.stpt1[i]; 
00156        stptcal0t0[i]   = o.stptcal0t0[i];
00157        stptcal1t0[i]   = o.stptcal1t0[i];
00158   }
00159   ds       = o.ds;
00160   range    = o.range;
00161   cputime  = o.cputime;
00162   ph       = o.ph;
00163   plane    = o.plane;
00164   vtx      = o.vtx;             
00165   end      = o.end;             
00166   lin      = o.lin;             
00167   fidvtx   = o.fidvtx;   
00168   fidend   = o.fidend;   
00169   fidall   = o.fidall;   
00170   time     = o.time;     
00171   momentum = o.momentum; 
00172   fit      = o.fit;
00173   cr       = o.cr;
00174   
00175 }
00176 
00177 void NtpSRTrack::AddStripAt(Int_t stripindex, Int_t ind) {
00178   //
00179   //  Purpose:  Add stripindex to stp array at position ind.
00180   //
00181   //  Arguments: stripindex: index of strip in assoc stp TClonesArray. 
00182   //             ind: index in stp array, cannot exceed bounds
00183   //                  0->nstrip-1.
00184   //
00185   //  Return:  none.
00186   //
00187   //  Contact:   S. Kasahara
00188   // 
00189 
00190   if ( ind < 0 || ind >= nstrip ) {
00191     MSG("NtpSR",Msg::kWarning)
00192       << "Attempt to add strip at index " << ind
00193       << " outside of array size " << nstrip << " ignored." << endl;
00194     return;  
00195   }
00196 
00197   stp[ind] = stripindex;
00198   return;
00199     
00200 }
00201 
00202 void NtpSRTrack::ClearStrips() {
00203   //
00204   //  Purpose:  Clear allocated strip memory. 
00205   //
00206 
00207   nstrip = 0;
00208   if ( stp ) delete [] stp; stp = 0;
00209   if ( stpfit ) delete [] stpfit; stpfit = 0;
00210   if ( stpu ) delete [] stpu; stpu = 0;
00211   if ( stpv ) delete [] stpv; stpv = 0;
00212   if ( stpx ) delete [] stpx; stpx = 0;
00213   if ( stpy ) delete [] stpy; stpy = 0;
00214   if ( stpz ) delete [] stpz; stpz = 0;
00215   if ( stpds ) delete [] stpds; stpds = 0;
00216   if ( stpfitchi2 ) delete [] stpfitchi2; stpfitchi2 = 0;
00217   if ( stpfitprechi2 ) delete [] stpfitprechi2; stpfitprechi2 = 0;
00218   if ( stpfitqp ) delete [] stpfitqp; stpfitqp = 0;
00219   if ( stpph0sigmap ) delete [] stpph0sigmap; stpph0sigmap = 0;
00220   if ( stpph0mip ) delete [] stpph0mip; stpph0mip = 0;
00221   if ( stpph0gev ) delete [] stpph0gev; stpph0gev = 0;
00222   if ( stpph1sigmap ) delete [] stpph1sigmap; stpph1sigmap = 0;
00223   if ( stpph1mip ) delete [] stpph1mip; stpph1mip = 0;
00224   if ( stpph1gev ) delete [] stpph1gev; stpph1gev = 0;
00225   if ( stpattn0c0 ) delete [] stpattn0c0; stpattn0c0 = 0;
00226   if ( stpattn1c0 ) delete [] stpattn1c0; stpattn1c0 = 0;
00227   if ( stpt0 ) delete [] stpt0; stpt0 = 0;
00228   if ( stpt1 ) delete [] stpt1; stpt1 = 0;
00229   if ( stptcal0t0 ) delete [] stptcal0t0; stptcal0t0 = 0;
00230   if ( stptcal1t0 ) delete [] stptcal1t0; stptcal1t0 = 0;
00231   
00232   return;
00233     
00234 }
00235 
00236 std::ostream& NtpSRTrack::Print(std::ostream& os) const {
00237   //
00238   //  Purpose:  Print track data on ostream.
00239   //
00240 
00241   os << "NtpSRTrack::Print" << endl;
00242   os << "index " << index << " slc " << slc << " ndigit " << ndigit
00243      << " nstpcnt " << nstpcnt << " nstrip " << nstrip  << " ds(m) " 
00244      << ds << " range(g/cm^2) " 
00245      << range << " cpu(sec) " << cputime << endl;
00246   os << plane << ph;
00247   os << "vtx " << vtx << "end " << end << "lin " << lin;
00248   os << "fidvtx " << fidvtx << "fidend " << fidend << "fidall " << fidall;
00249   os << time << momentum << fit << cr << endl;
00250   
00251   return os;
00252 
00253 }
00254 
00255 void NtpSRTrack::Print(Option_t* /* option */) const {
00256   //
00257   //  Purpose:  Print track in form supported by TObject::Print.
00258   //
00259   //  Arguments: option (not used)
00260   //
00261 
00262   Print(std::cout);
00263   return;
00264 
00265 }
00266 

Generated on Mon Feb 15 11:07:07 2010 for loon by  doxygen 1.3.9.1