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

NtpSREvent.cxx

Go to the documentation of this file.
00001 
00002 // NtpSREvent
00003 //
00004 // NtpSREvent is an ntuple class to hold the event data
00005 //
00007 
00008 #include <iostream>
00009 using namespace std;
00010 
00011 #include "MessageService/MsgService.h"
00012 #include "CandNtupleSR/NtpSREvent.h"
00013 
00014 ClassImp(NtpSREvent)
00015 
00016 std::ostream& operator << (std::ostream& os, const NtpSREvent& ntp) 
00017                                      { return ntp.Print(os); }
00018 
00019 CVSID("$Id: NtpSREvent.cxx,v 1.13 2007/09/11 21:01:19 schubert Exp $");
00020 
00021 NtpSREvent::NtpSREvent(Int_t nstripinit, Int_t nshowerinit, Int_t ntrackinit): 
00022   index(0),slc(0),ndigit(0),nstpcnt(nstripinit),nstrip(nstripinit),stp(0),
00023   stpph0sigmap(0),stpph0mip(0),stpph0gev(0),stpph1sigmap(0),stpph1mip(0),
00024   stpph1gev(0),nshower(nshowerinit),shw(0),ntrack(ntrackinit),trk(0),
00025   primshw(-1),primtrk(-1), contained(1) {
00026 
00027   // Normal constructor
00028 
00029   if ( nstrip ) {
00030     stp = new Int_t[nstrip];
00031     stpph0sigmap = new Float_t[nstrip];
00032     stpph0mip    = new Float_t[nstrip];
00033     stpph0gev    = new Float_t[nstrip];
00034     stpph1sigmap = new Float_t[nstrip];
00035     stpph1mip    = new Float_t[nstrip];
00036     stpph1gev    = new Float_t[nstrip];
00037     
00038     // Initialize all indices to -1
00039     for (Int_t i = 0; i < nstrip; i++ ) { 
00040       stp[i] = -1;
00041       stpph0sigmap[i] = -1;
00042       stpph0mip[i]    = -1;
00043       stpph0gev[i]    = -1;
00044       stpph1sigmap[i] = -1;
00045       stpph1mip[i]    = -1;
00046       stpph1gev[i]    = -1;
00047     }
00048     
00049   }
00050 
00051   if ( nshower ) {
00052     shw = new Int_t[nshower];
00053     // Initialize all indices to -1
00054     for (Int_t i = 0; i < nshower; i++ ) shw[i] = -1;
00055   }
00056 
00057   if ( ntrack ) {
00058     trk = new Int_t[ntrack];
00059     // Initialize all indices to -1
00060     for (Int_t i = 0; i < ntrack; i++ ) trk[i] = -1;
00061   }
00062 
00063 
00064 
00065 }
00066 
00067 void NtpSREvent::AddTrackAt(Int_t trackindex, Int_t ind) {
00068   //
00069   //  Purpose:  Add trackindex to trk array at position ind.
00070   //
00071   //  Arguments: trackindex: index of track in assoc trk TClonesArray. 
00072   //             ind: index in trk array, cannot exceed bounds
00073   //                  0->ntrack-1.
00074   //
00075   //  Return:  none.
00076   //
00077   //  Contact:   S. Kasahara
00078   // 
00079 
00080   if ( ind < 0 || ind >= ntrack ) {
00081     MSG("NtpSR",Msg::kWarning)
00082       << "Attempt to add track at index " << ind
00083       << " outside of array size " << ntrack << " ignored." << endl;
00084     return;  
00085   }
00086 
00087   trk[ind] = trackindex;
00088   return;
00089     
00090 }
00091 
00092 void NtpSREvent::AddShowerAt(Int_t showerindex, Int_t ind) {
00093   //
00094   //  Purpose:  Add showerindex to shw array at position ind.
00095   //
00096   //  Arguments: showerindex: index of shower in assoc shw TClonesArray. 
00097   //             ind: index in shw array, cannot exceed bounds
00098   //                  0->nshower-1.
00099   //
00100   //  Return:  none.
00101   //
00102   //  Contact:   S. Kasahara
00103   // 
00104 
00105   if ( ind < 0 || ind >= nshower ) {
00106     MSG("NtpSR",Msg::kWarning)
00107       << "Attempt to add shower at index " << ind
00108       << " outside of array size " << nshower << " ignored." << endl;
00109     return;  
00110   }
00111 
00112   shw[ind] = showerindex;
00113   return;
00114     
00115 }
00116 
00117 void NtpSREvent::AddStripAt(Int_t stripindex, Int_t ind) {
00118   //
00119   //  Purpose:  Add stripindex to stp array at position ind.
00120   //
00121   //  Arguments: stripindex: index of strip in assoc stp TClonesArray. 
00122   //             ind: index in stp array, cannot exceed bounds
00123   //                  0->nstrip-1.
00124   //
00125   //  Return:  none.
00126   //
00127   //  Contact:   S. Kasahara
00128   // 
00129 
00130   if ( ind < 0 || ind >= nstrip ) {
00131     MSG("NtpSR",Msg::kWarning)
00132       << "Attempt to add strip at index " << ind
00133       << " outside of array size " << nstrip << " ignored." << endl;
00134     return;  
00135   }
00136 
00137   stp[ind] = stripindex;
00138   return;
00139     
00140 }
00141 
00142 
00143 std::ostream& NtpSREvent::Print(std::ostream& os) const {
00144   //
00145   //  Purpose:  Print event data on ostream.
00146   //
00147 
00148   os << "NtpSREvent::Print" << endl;
00149   os << "index " << index << " slc " << slc << " ndigit " << ndigit 
00150      << " nstpcnt " << nstpcnt << " nstrip " << nstrip << " pln " << plane;
00151   os << "Event has " << nshower << " shower";
00152   if ( nshower > 1 ) {
00153     os << "s w/indices ";
00154     for ( int is = 0; is < nshower-1; is++ ) os << shw[is] << ",";
00155     os << shw[nshower-1] << " and ";
00156   }
00157   else if ( nshower == 1 ) {
00158     os << " w/index " << shw[nshower-1] << " and ";
00159   }
00160   else {
00161     os << "s and ";
00162   }
00163   
00164   os << ntrack << " track";
00165   if ( ntrack > 1 ) {
00166     os << "s w/indices ";
00167     for ( int it = 0; it < ntrack-1; it++ ) os << trk[it] << ",";
00168     os << trk[ntrack-1];
00169   }
00170   else if ( ntrack == 1 ) {
00171     os << " w/index " << trk[ntrack-1];
00172   }
00173   else {
00174     os << "s";
00175   }
00176   os << endl;
00177   os << ph << "vtx " << vtx << "end " << end;
00178   os << bleach;
00179   os << win;
00180   return os;
00181 
00182 }
00183 
00184 void NtpSREvent::Print(Option_t* /* option */) const {
00185   //
00186   //  Purpose:  Print event in form supported by TObject::Print.
00187   //
00188   //  Arguments: option (not used)
00189   //
00190 
00191   Print(std::cout);
00192   return;
00193 
00194 }

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