00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028
00029 #include <iostream>
00030
00031 #include "TMath.h"
00032
00033 #include "MINF_Classes/MINFast.h"
00034 #include "MINF_Classes/MINFLST.h"
00035
00036 #include "REROOT_Classes/REROOT_CellPos.h"
00037 #include "REROOT_Classes/REROOT_DigitPln.h"
00038 #include "REROOT_Classes/REROOT_Event.h"
00039 #include "REROOT_Classes/REROOT_Geom.h"
00040 #include "REROOT_Classes/REROOT_LSTHit.h"
00041 #include "REROOT_Classes/REROOT_LSTWire.h"
00042
00043 ClassImp(MINFLST)
00044
00045
00046 MINFLST::MINFLST()
00047 {
00048 fNV = 0;
00049 fNH = 0;
00050 fIshunt = 0;
00051 }
00052
00053
00054 MINFLST::MINFLST(const char *name, const char *title) :
00055 MINFDetector(name,title)
00056 {
00057
00058
00059
00060
00061
00062
00063
00064 fHits = new TClonesArray("MINFLSTHit", 405);
00065
00066 fNV = 1;
00067 fNH = 3;
00068 fIshunt = 0;
00069 }
00070
00071
00072 MINFLST::~MINFLST()
00073 {
00074 }
00075
00076
00077 void MINFLST::BookHits(REROOT_Event *revt)
00078 {
00079
00080
00081 REROOT_Geom *rgeo = REROOT_Geom::curgeom();
00082
00083
00084 Int_t det = (MINFast::DETTYPE) MINFast::LST;
00085
00086
00087 Int_t ntracks = gMINFast->GetNtrack();
00088 fTrkHits = new TObjArray(ntracks);
00089
00090
00091
00092
00093
00094
00095 for (Int_t itrk=0; itrk<ntracks; itrk++) {
00096 fTrkHits->Add(new TObjArray(50));
00097
00098
00099
00100
00101
00102 }
00103
00104 TClonesArray &lhits = *fHits;
00105 const TClonesArray *lsthits = revt->lsthits();
00106 REROOT_LSTHit *lsthit;
00107
00108 for (Int_t ihit=0; ihit<revt->n_lsthits(); ihit++) {
00109 lsthit = (REROOT_LSTHit *) lsthits->At(ihit);
00110 Int_t track = TMath::Abs(lsthit->ITrack());
00111
00112
00113
00114
00115
00116
00117 if (track >= ntracks)
00118 printf("MINFLST::BookHits: Track no. %d >= number of tracks %d\n",
00119 track, ntracks);
00120 track = TMath::Min(track, ntracks-1);
00121
00122
00123
00124
00125
00126
00127
00128
00129 const TClonesArray *cellposs = rgeo->cellposs();
00130 const TClonesArray *planeposs = rgeo->planeposs();
00131 const TClonesArray *planespecs = rgeo->planespecs();
00132 const TClonesArray *rotms = rgeo->rotms();
00133
00134
00135 if (!cellposs) {cout << "cellposs = 0" << endl; return;}
00136 if (!planeposs) {cout << "planeposs = 0" << endl; return;}
00137 if (!planespecs) {cout << "planespecs = 0" << endl; return;}
00138 if (!rotms) {cout << "rotms = 0" << endl; return;}
00139
00140
00141 REROOT_PlanePos *planepos =
00142 (REROOT_PlanePos *) planeposs->At(lsthit->IPln());
00143
00144
00145 REROOT_PlaneSpec *planespec =
00146 (REROOT_PlaneSpec *) planespecs->At(planepos->ActvSpec());
00147
00148
00149 REROOT_Rotm *rotm = (REROOT_Rotm *) rotms->At(planepos->RotmID());
00150
00151
00152 REROOT_CellPos *cellpos =
00153 (REROOT_CellPos *) cellposs->At(lsthit->CellPos());
00154
00155
00156 Float_t xyz_center[3];
00157 xyz_center[0] = planepos->XYActv()[0];
00158 xyz_center[1] = planepos->XYActv()[1];
00159 xyz_center[2] = planepos->ZFrntActv() + 0.5*planespec->Thickness();
00160
00161 Float_t xyz_inplane[3];
00162 xyz_inplane[0] = 0.5 * (lsthit->XEnd()+lsthit->XBegin()) +
00163 (cellpos->XYZCenter()[0]);
00164 xyz_inplane[1] = 0.5 * (lsthit->YEnd()+lsthit->YBegin()) +
00165 (cellpos->XYZCenter()[1]);
00166 xyz_inplane[2] = 0.5 * (lsthit->ZEnd()+lsthit->ZBegin()) +
00167 (cellpos->XYZCenter()[2]);
00168
00169 Float_t XYZGlobal[3];
00170 XYZGlobal[0] = xyz_inplane[0]*rotm->r11() +
00171 xyz_inplane[1]*rotm->r21() +
00172 xyz_inplane[2]*rotm->r31() + xyz_center[0];
00173 XYZGlobal[1] = xyz_inplane[0]*rotm->r12() +
00174 xyz_inplane[1]*rotm->r22() +
00175 xyz_inplane[2]*rotm->r32() + xyz_center[1];
00176 XYZGlobal[2] = xyz_inplane[0]*rotm->r13() +
00177 xyz_inplane[1]*rotm->r23() +
00178 xyz_inplane[2]*rotm->r33() + xyz_center[2];
00179
00180 Int_t *vol = 0;
00181 new(lhits[ihit]) MINFLSTHit(fIshunt,det,ihit,track,vol,XYZGlobal);
00182 fNhits++;
00183
00184
00185
00186
00187
00188
00189
00190
00191 ((TObjArray *) GetTrkHits(track))->Add(lhits[fNhits-1]);
00192
00193 }
00194 }
00195
00196
00197 Int_t MINFLST::DistancetoPrimitive(Int_t , Int_t )
00198 {
00199 return 9999;
00200 }
00201
00202
00203 void MINFLST::DumpHit(Int_t ihit)
00204 {
00205
00206
00207 printf("MINFLST::DumpHit number %d\n", ihit);
00208 const TClonesArray *lsthits = gMINFast->GetREROOTEvent()->lsthits();
00209 REROOT_LSTHit *lsthit = (REROOT_LSTHit *) lsthits->UncheckedAt(ihit);
00210 if (lsthit) {
00211 lsthit->printEvent(cout);
00212 lsthit->Dump();
00213 }
00214 }
00215
00216
00217 Float_t MINFLST::GetHitELOSS(Int_t ihit)
00218 {
00219
00220
00221 const TClonesArray *lsthits = gMINFast->GetREROOTEvent()->lsthits();
00222 REROOT_LSTHit *lsthit = (REROOT_LSTHit *) lsthits->UncheckedAt(ihit);
00223 if (!lsthit) return 0.;
00224 return (lsthit->ELoss());
00225 }
00226
00227
00228 Float_t MINFLST::GetHitPartMom(Int_t ihit)
00229 {
00230
00231
00232 const TClonesArray *lsthits = gMINFast->GetREROOTEvent()->lsthits();
00233 REROOT_LSTHit *lsthit = (REROOT_LSTHit *) lsthits->UncheckedAt(ihit);
00234 if (!lsthit) return 0.;
00235 return (lsthit->Ptot());
00236 }
00237
00238
00239 Int_t MINFLST::GetIPDG(Int_t ihit)
00240 {
00241
00242
00243 const TClonesArray *lsthits = gMINFast->GetREROOTEvent()->lsthits();
00244 REROOT_LSTHit *lsthit = (REROOT_LSTHit *) lsthits->UncheckedAt(ihit);
00245 if (lsthit) return (lsthit->IPDG());
00246 return 0;
00247 }
00248
00249
00250 void MINFLST::InspectHit(Int_t ihit)
00251 {
00252
00253
00254 const TClonesArray *lsthits = gMINFast->GetREROOTEvent()->lsthits();
00255 REROOT_LSTHit *lsthit = (REROOT_LSTHit *) lsthits->UncheckedAt(ihit);
00256 if (lsthit) lsthit->Inspect();
00257 }
00258
00259
00260 void MINFLST::Paint(Option_t *)
00261 {
00262 }
00263
00264 ClassImp(MINFLSTHit)
00265
00266
00267 MINFLSTHit::MINFLSTHit(Int_t shunt, Int_t det, Int_t idlsthit,
00268 Int_t track, Int_t * , Float_t *hits) :
00269 MINFHit(shunt, det, track)
00270 {
00271 fIDREROOTHit = idlsthit;
00272
00273 fX=hits[0];
00274 fY=hits[1];
00275 fZ=hits[2];
00276 }
00277
00278
00279 MINFLSTHit::MINFLSTHit()
00280 {
00281 }
00282
00283
00284 MINFLSTHit::~MINFLSTHit()
00285 {
00286 }