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

NtpSRShower.cxx

Go to the documentation of this file.
00001 
00002 // NtpSRShower
00003 //
00004 // NtpSRShower is an ntuple class to hold the shower data
00005 //
00007 
00008 #include <iostream>
00009 using namespace std;
00010 
00011 #include "MessageService/MsgService.h"
00012 #include "CandNtupleSR/NtpSRShower.h"
00013 
00014 ClassImp(NtpSRShower)
00015 
00016 std::ostream& operator << (std::ostream& os, const NtpSRShower& ntp) 
00017                                      { return ntp.Print(os); }
00018 
00019 CVSID("$Id: NtpSRShower.cxx,v 1.15 2006/08/12 11:14:27 cbs Exp $");
00020 
00021 //_____________________________________________________________________________
00022 void NtpSRShower::AddStripAt(Int_t stripindex, Int_t ind) {
00023   //
00024   //  Purpose:  Add stripindex to fStripInd array at position ind.
00025   //
00026   //  Arguments: stripindex: index of strip in assoc fStrips TClonesArray. 
00027   //             ind: index in fStripInd array, cannot exceed bounds
00028   //                  0->fNStrip-1.
00029   //
00030   //  Return:  none.
00031   //
00032   //  Contact:   S. Kasahara
00033   // 
00034 
00035   if ( ind < 0 || ind >= nstrip ) {
00036     MSG("NtpSR",Msg::kWarning) 
00037       << "Attempt to add strip at index " << ind
00038       << " outside of array size " << nstrip << " ignored." << endl;
00039     return;
00040   }
00041     
00042   stp[ind] = stripindex;
00043   return;
00044     
00045 }
00046 
00047 //_____________________________________________________________________________
00048 void NtpSRShower::AddClusterAt(Int_t clusterindex, Int_t ind) {
00049   //
00050   //  Purpose:  Add clusterindex to clu array at position ind.
00051   //
00052   //  Arguments: clusterindex: index of cluster in assoc cluster TClonesArray. 
00053   //             ind: index in cluster array, cannot exceed bounds
00054   //                  0->ncluster-1. 
00055   // 
00056   //  Return:  none.
00057   //
00058   //  Contact:   S. Kasahara
00059   //
00060 
00061   if ( ind < 0 || ind >= ncluster ) {
00062     MSG("NtpSR",Msg::kWarning)
00063       << "Attempt to add cluster at index " << ind
00064       << " outside of array size " << ncluster << " ignored." << endl;
00065     return;
00066   }
00067 
00068   clu[ind] = clusterindex;
00069   return;
00070 
00071 }
00072 
00073 //_____________________________________________________________________________
00074 NtpSRShower::NtpSRShower(Int_t nstripinit,Int_t nclusterinit): 
00075   index(0),slc(0),ndigit(0),nstpcnt(nstripinit),nstrip(nstripinit),
00076   stp(0),stpu(0),stpv(0),stpx(0),stpy(0),stpz(0),
00077   stpph0sigmap(0),stpph0mip(0),stpph0gev(0),stpph1sigmap(0),stpph1mip(0),stpph1gev(0),
00078   stpattn0c0(0),stpattn1c0(0),stpt0(0),stpt1(0),stptcal0t0(0),stptcal1t0(0),
00079   nUcluster(0),nVcluster(0),ncluster(nclusterinit),clu(0) {
00080   // Normal constructor
00081 
00082   if ( nstrip ) {
00083     stp           = new Int_t[nstrip];
00084     stpu          = new Float_t[nstrip]; 
00085     stpv          = new Float_t[nstrip]; 
00086     stpx          = new Float_t[nstrip]; 
00087     stpy          = new Float_t[nstrip]; 
00088     stpz          = new Float_t[nstrip]; 
00089     stpph0sigmap  = new Float_t[nstrip]; 
00090     stpph0mip     = new Float_t[nstrip]; 
00091     stpph0gev     = new Float_t[nstrip]; 
00092     stpph1sigmap  = new Float_t[nstrip]; 
00093     stpph1mip     = new Float_t[nstrip]; 
00094     stpph1gev     = new Float_t[nstrip]; 
00095     stpattn0c0    = new Float_t[nstrip]; 
00096     stpattn1c0    = new Float_t[nstrip]; 
00097     stpt0         = new Double_t[nstrip]; 
00098     stpt1         = new Double_t[nstrip]; 
00099     stptcal0t0    = new Double_t[nstrip]; 
00100     stptcal1t0    = new Double_t[nstrip]; 
00101     for ( Int_t i = 0; i < nstrip; i++ ) {
00102       stp[i] = -1;
00103       stpu[i] = -999999;
00104       stpv[i] = -999999;
00105       stpx[i] = -999999;
00106       stpy[i] = -999999;
00107       stpz[i] = -999999;
00108       stpph0sigmap[i] = 0.;
00109       stpph0mip[i] = 0.;
00110       stpph0gev[i] = 0.;
00111       stpph1sigmap[i] = 0.;
00112       stpph1mip[i] = 0.;
00113       stpph1gev[i] = 0.;
00114       stpattn0c0[i] = -999999;
00115       stpattn1c0[i] = -999999;
00116       stpt0[i] = -999999;
00117       stpt1[i] = -999999;
00118       stptcal0t0[i] = -999999;
00119       stptcal1t0[i] = -999999;
00120     }
00121   }
00122   else {
00123     MSG("NtpSR",Msg::kWarning) << "NtpSRShower called with nstrip = 0" << endl;
00124   }
00125 
00126   if ( ncluster ) {
00127     clu = new Int_t[ncluster];
00128     for ( Int_t i = 0; i < ncluster; i++ ) clu[i] = -1;
00129   }
00130   else {
00131     MSG("NtpSR",Msg::kWarning) << "NtpSRShower called with ncluster = 0" 
00132                                << endl;
00133   }
00134 }
00135 
00136 //_____________________________________________________________________________
00137 std::ostream& NtpSRShower::Print(std::ostream& os) const {
00138   //
00139   //  Purpose:  Print strip data on ostream.
00140   //
00141 
00142   os << "NtpSRShower::Print" << endl;
00143   os << "index " << index << " slc " << slc << " ndigit " << ndigit
00144      << " nstpcnt " << nstpcnt << " nstrip " << nstrip  
00145      << " ncluster(all,u,v)(" 
00146      << ncluster << "," << nUcluster << "," << nVcluster << ") "
00147      << "\npln" << plane << ph << vtx << sss;
00148 
00149   return os;
00150 
00151 }
00152 
00153 //_____________________________________________________________________________
00154 void NtpSRShower::Print(Option_t* /* option */) const {
00155   //
00156   //  Purpose:  Print strip in form supported by TObject::Print.
00157   //
00158   //  Arguments: option (not used)
00159   //
00160 
00161   Print(std::cout);
00162   return;
00163 
00164 }
00165 
00166 //_____________________________________________________________________________
00167 void NtpSRShower::ClearStrips() {
00168   // Purpose: Clear allocated strip memory.
00169 
00170   nstrip = 0;
00171   if ( stp ) delete [] stp; stp = 0;
00172   if ( stpu ) delete [] stpu; stpu = 0;
00173   if ( stpv ) delete [] stpv; stpv = 0;
00174   if ( stpx ) delete [] stpx; stpx = 0;
00175   if ( stpy ) delete [] stpy; stpy = 0;
00176   if ( stpz ) delete [] stpz; stpz = 0;
00177   if ( stpph0sigmap ) delete [] stpph0sigmap; stpph0sigmap = 0;
00178   if ( stpph0mip ) delete [] stpph0mip; stpph0mip = 0;
00179   if ( stpph0gev ) delete [] stpph0gev; stpph0gev = 0;
00180   if ( stpph1sigmap ) delete [] stpph1sigmap; stpph1sigmap = 0;
00181   if ( stpph1mip ) delete [] stpph1mip; stpph1mip = 0;
00182   if ( stpph1gev ) delete [] stpph1gev; stpph1gev = 0;
00183   if ( stpattn0c0 ) delete [] stpattn0c0; stpattn0c0 = 0;
00184   if ( stpattn1c0 ) delete [] stpattn1c0; stpattn1c0 = 0;
00185   if ( stpt0 ) delete [] stpt0; stpt0 = 0;
00186   if ( stpt1 ) delete [] stpt1; stpt1 = 0;
00187   if ( stptcal0t0 ) delete [] stptcal0t0; stptcal0t0 = 0;
00188   if ( stptcal1t0 ) delete [] stptcal1t0; stptcal1t0 = 0;
00189   
00190 }
00191 
00192   

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