00001
00002
00003
00004
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
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
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
00054 for (Int_t i = 0; i < nshower; i++ ) shw[i] = -1;
00055 }
00056
00057 if ( ntrack ) {
00058 trk = new Int_t[ntrack];
00059
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
00070
00071
00072
00073
00074
00075
00076
00077
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
00095
00096
00097
00098
00099
00100
00101
00102
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
00120
00121
00122
00123
00124
00125
00126
00127
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
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* ) const {
00185
00186
00187
00188
00189
00190
00191 Print(std::cout);
00192 return;
00193
00194 }