1 #include "./StEpdFastSim.h"
2 #include "TClonesArray.h"
4 #include "../StEpdGeom.h"
8 #include "StRoot/StPicoEvent/StPicoEpdHit.h"
11 StEpdFastSim::StEpdFastSim(
double WID){
12 mRan =
new TRandom3();
15 mTheHits =
new TClonesArray(
"StPicoEpdHit",1000);
22 double xcorner[5],ycorner[5];
25 mGeom->GetCorners(1,1,0,&ncorners,xcorner,ycorner);
28 mGeom->GetCorners(1,1,0,&ncorners,xcorner,ycorner);
29 for (
int icorn=0; icorn<ncorners; icorn++){
30 double rad = sqrt(pow(xcorner[icorn],2)+pow(ycorner[icorn],2));
31 if (rad<rmin) rmin=rad;
35 for (
int Ring=1; Ring<=16; Ring++){
37 mGeom->GetCorners(1,TT,0,&ncorners,xcorner,ycorner);
39 for (
int icorn=0; icorn<ncorners; icorn++){
40 double rad = sqrt(pow(xcorner[icorn],2)+pow(ycorner[icorn],2));
41 if (rad>rmax) rmax=rad;
49 StEpdFastSim::~StEpdFastSim(){
55 TClonesArray* StEpdFastSim::GetPicoHits(TClonesArray* momenta, TVector3 PrimVertex){
57 if (fabs(PrimVertex.Z()>zEPD) || fabs(PrimVertex.X()>0.5) || fabs(PrimVertex.Y()>0.5)){
58 std::cout <<
"Invalid vertex --- I'm giving you an empty event - Tchau!\n";
63 for (
int uniqueID=101; uniqueID<1232; uniqueID++){
64 mHitsEast[uniqueID] = 0;
65 mHitsWest[uniqueID] = 0;
72 for (
int itrk=0; itrk<momenta->GetEntries(); itrk++){
74 TVector3* mom = (TVector3*)momenta->At(itrk);
75 int EW = (mom->Z()<0.0)?0:1;
76 double zWheel = (mom->Z()<0.0)?-zEPD:zEPD;
77 double deltaZ = abs(zWheel-PrimVertex.Z());
79 double xHit = PrimVertex.X() + deltaZ*fabs(tan(mom->Theta()))*cos(mom->Phi());
80 double yHit = PrimVertex.Y() + deltaZ*fabs(tan(mom->Theta()))*sin(mom->Phi());
81 TVector3 xyHit(xHit,yHit,zWheel);
83 short UniqueID = FindStruckTile(xyHit);
90 float dE = mRan->Landau(1.0,mWID);
94 if (mHitsEast[abs(UniqueID)]!=0){
95 theHit = mHitsEast[abs(UniqueID)];
96 float nMIP = theHit->
nMIP() + dE;
100 theHit = (
StPicoEpdHit*)mTheHits->ConstructedAt(mTheHits->GetEntriesFast());
101 theHit->
setId(UniqueID);
104 mHitsEast[abs(UniqueID)] = theHit;
108 if (mHitsWest[abs(UniqueID)]!=0){
109 theHit = mHitsWest[abs(UniqueID)];
110 float nMIP = theHit->
nMIP() + dE;
114 theHit = (
StPicoEpdHit*)mTheHits->ConstructedAt(mTheHits->GetEntriesFast());
115 theHit->
setId(UniqueID);
118 mHitsWest[abs(UniqueID)] = theHit;
132 short StEpdFastSim::FindStruckTile(TVector3 xyHit){
133 int PPmapWest[12] = {10,11,12,1,2,3,4,5,6,7,8,9};
134 int PPmapEast[12] = {3,2,1,12,11,10,9,8,7,6,5,4};
135 double PhiCenterWest[12] = {1.8326,2.35619,2.87979,3.40339,3.92699,4.45059,4.97419,5.49779,6.02139,0.261799,0.785398,1.309};
136 double PhiCenterEast[12] = {1.309,0.785398,0.261799,6.02139,5.49779,4.97419,4.45059,3.92699,3.40339,2.87979,2.35619,1.8326};
138 int EW = (xyHit.Z()<0)?0:1;
141 double rHit = xyHit.Perp();
142 if (rHit<RingRadii[0])
return 0;
143 if (rHit>RingRadii[16])
return 0;
145 for (iRing=1; iRing<=16; iRing++){
146 if (rHit<RingRadii[iRing])
break;
150 double phiHit = xyHit.Phi();
151 if (phiHit<0.0) phiHit += 2.0*TMath::Pi();
152 int iphi = (int)(phiHit/(2.0*TMath::Pi()/12.0));
153 int PP = (EW<=0)?PPmapEast[iphi]:PPmapWest[iphi];
162 if (phiHit>PhiCenterEast[PP-1]) {TT=2*(iRing-1) + 1;}
163 else {TT=2*(iRing-1);}
166 if (phiHit>PhiCenterWest[PP-1]) {TT=2*(iRing-1);}
167 else {TT=2*(iRing-1) + 1;}
173 int uniqueID = 100*PP+TT;
174 if (EW<=0) uniqueID*=-1;
void setnMIP(Float_t nMIP)
void setQTdata(Int_t packedData)