10 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
11 #include "StEEmcUtil/StEEmcSmd/EEmcSmdGeom.h"
12 #include "StGammaEEmcLeakage.h"
14 #include "StGammaCandidate.h"
23 StGammaCandidate::StGammaCandidate()
33 SetMomentum( TVector3(0.,0.,0.) );
34 SetPosition( TVector3(0.,0.,0.) );
48 StGammaCandidate::~StGammaCandidate()
57 Float_t StGammaCandidate::sumPt(Float_t radius, Float_t threshold, thresholdCut cut)
59 Float_t sumTracks = sumTrackPt(radius, threshold, cut);
60 Float_t sumTowers = sumTowerPt(radius, threshold, cut);
61 return sumTracks + sumTowers;
70 Float_t StGammaCandidate::sumTrackPt(Float_t radius, Float_t threshold, thresholdCut cut)
77 for(Int_t i = 0; i < numberOfTracks(); i++)
82 Float_t dEta = myEta - t->
eta();
83 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->
phi());
84 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
86 if(cut == kMagnitude)
if(r <= radius && t->momentum.Mag() > threshold) sum += t->
pt();
87 if(cut == kTransverse)
if(r <= radius && t->pt() > threshold) sum += t->
pt();
101 Float_t StGammaCandidate::sumTowerPt(Float_t radius, Float_t threshold, thresholdCut cut)
108 for(Int_t i = 0; i < numberOfTowers(); i++)
112 if(t->fail)
continue;
114 Float_t dEta = myEta - t->eta;
115 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
116 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
118 if(cut == kMagnitude)
if(r <= radius && t->energy > threshold) sum += t->pt();
119 if(cut == kTransverse)
if(r <= radius && t->pt() > threshold) sum += t->pt();
133 Float_t StGammaCandidate::sumPreshower1(Float_t radius, Float_t threshold)
140 for(Int_t i = 0; i < numberOfPreshower1(); i++)
144 if(t->fail)
continue;
146 Float_t dEta = myEta - t->eta;
147 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
148 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
150 if(r <= radius && t->energy > threshold) sum += t->pt();
164 Float_t StGammaCandidate::sumPreshower2(Float_t radius, Float_t threshold)
171 for(Int_t i = 0; i < numberOfPreshower2(); i++)
175 if(t->fail)
continue;
177 Float_t dEta = myEta - t->eta;
178 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
179 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
181 if(r <= radius && t->energy > threshold) sum += t->pt();
195 Float_t StGammaCandidate::sumPostshower(Float_t radius, Float_t threshold)
202 for(Int_t i = 0; i < numberOfPostshower(); i++)
206 if (t->fail)
continue;
208 Float_t dEta = myEta - t->eta;
209 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
210 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
212 if (r <= radius && t->energy > threshold) sum += t->pt();
226 Int_t StGammaCandidate::numberOfTracks(Float_t radius, Float_t threshold, thresholdCut cut)
233 for (Int_t i = 0; i < numberOfTracks(); i++)
238 Float_t dEta = myEta - t->
eta();
239 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->
phi());
240 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
242 if(cut == kMagnitude)
if(r <= radius && t->momentum.Mag() > threshold) ++count;
243 if(cut == kTransverse)
if(r <= radius && t->pt() > threshold) ++count;
257 Int_t StGammaCandidate::numberOfTowers(Float_t radius, Float_t threshold, thresholdCut cut)
264 for(Int_t i = 0; i < numberOfTowers(); i++)
268 if(t->fail)
continue;
270 Float_t dEta = myEta - t->eta;
271 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
272 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
274 if(cut == kMagnitude)
if(r <= radius && t->energy > threshold) ++count;
275 if(cut == kTransverse)
if(r <= radius && t->pt() > threshold) ++count;
289 Int_t StGammaCandidate::numberOfPreshower1(Float_t radius, Float_t threshold)
296 for(Int_t i = 0; i < numberOfPreshower1(); i++)
301 Float_t dEta = myEta - t->eta;
302 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
303 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
305 if(r <= radius && t->energy > threshold) ++count;
319 Int_t StGammaCandidate::numberOfPreshower2(Float_t radius, Float_t threshold)
326 for(Int_t i = 0; i < numberOfPreshower2(); i++)
331 Float_t dEta = myEta - t->eta;
332 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
333 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
335 if(r <= radius && t->energy > threshold) ++count;
349 Int_t StGammaCandidate::numberOfPostshower(Float_t radius, Float_t threshold)
356 for(Int_t i = 0; i < numberOfPostshower(); i++)
361 Float_t dEta = myEta - t->eta;
362 Float_t dPhi = TVector2::Phi_mpi_pi(myPhi - t->phi);
363 Float_t r = TMath::Sqrt(dEta * dEta + dPhi * dPhi);
365 if(r <= radius && t->energy > threshold) ++count;
377 Float_t StGammaCandidate::pre1Energy(Float_t threshold)
382 for(Int_t i = 0; i < numberOfMyPreshower1(); i++)
386 if(t->fail)
continue;
388 if(t->energy > threshold)
mPre1Energy += t->energy;
401 Float_t StGammaCandidate::pre2Energy(Float_t threshold)
406 for(Int_t i = 0; i < numberOfMyPreshower2(); i++)
410 if(t->fail)
continue;
412 if(t->energy > threshold)
mPre2Energy += t->energy;
425 Float_t StGammaCandidate::postEnergy(Float_t threshold)
430 for(Int_t i = 0; i < numberOfMyPostshower(); i++)
434 if(t->fail)
continue;
436 if(t->energy > threshold)
mPostEnergy += t->energy;
449 Float_t StGammaCandidate::smduEnergy(Float_t threshold)
454 for(Int_t i = 0; i < numberOfSmdu(); i++)
458 if(t->fail)
continue;
460 if(t->energy > threshold)
mSmduEnergy += t->energy;
473 Float_t StGammaCandidate::smdvEnergy(Float_t threshold)
478 for(Int_t i = 0; i < numberOfSmdv(); i++)
482 if(t->fail)
continue;
484 if(t->energy > threshold)
mSmdvEnergy += t->energy;
502 Bool_t SortDistance(
const Tower& t1,
const Tower& t2)
504 return (t1.dR < t2.dR);
513 void StGammaCandidate::recluster(TVector3
vertex, Float_t threshold, thresholdCut cut)
519 for(Int_t i = 0; i < numberOfMyTowers(); ++i)
526 if(cut == kMagnitude)
if(t->energy < threshold)
continue;
527 if(cut == kTransverse)
if(t->pt() < threshold)
continue;
530 tower.SetPtEtaPhi(t->pt(), t->eta, t->phi);
549 TVector3 StGammaCandidate::momentum1x1()
558 TVector3 StGammaCandidate::momentum1x1c()
562 if(detectorId() == kEEmc)
569 if(!geom.
getTower( position(), sec, sub, eta ))
return TVector3(0.0, 0.0, -999.0);
571 TVector3 tower = geom.
getTowerCenter( (UInt_t)sec, (UInt_t)sub, (UInt_t)eta );
574 TVector3 p=momentum1x1();
585 return momentum1x1();
594 TVector3 StGammaCandidate::momentum2x1()
601 std::vector<Tower> listOfTowers;
602 for(Int_t i = 0; i < numberOfMyTowers(); i++)
606 Float_t deta = eta - t->eta;
607 Float_t dphi = TVector2::Phi_mpi_pi(phi - t->phi);
608 Float_t dR = TMath::Sqrt(deta * deta + dphi * dphi);
610 listOfTowers.push_back(T);
615 std::sort(listOfTowers.begin(), listOfTowers.end(), SortDistance);
616 std::vector<Tower>::iterator iter;
618 Float_t energy_sum = 0.0;
622 for(iter=listOfTowers.begin(); iter != listOfTowers.end(); iter++)
624 if(count < 2) energy_sum += (*iter).tower->energy;
629 p.SetMag(energy_sum);
TVector3 getTowerCenter(const UInt_t sec, const UInt_t sub, const UInt_t etabin) const
Float_t mPostEnergy
Energy deposited in epre2 (possibly tof?)
Float_t mSeedEnergy
Energy of the gamma candidate.
static EEmcGeomSimple & Instance()
returns a reference to a static instance of EEmcGeomSimple
Float_t mPre1Energy
Energy of the seed tower.
TVector3 mPosition
Momentum of the gamma candidate.
Float_t mSmduEnergy
Energy deposited in epost.
Float_t mSmdvEnergy
Energy deposited in esmdu (or bsmd eta)
Float_t mEnergy
Position of the gamma at z (r) = SMD.
Float_t pt() const
Referencing candidates.
Float_t phi() const
eta at vertex
TVector3 mMomentum
0=EEMC 1=BEMC
bool getTower(const TVector3 &r, int &sec, int &sub, int &etabin, Float_t &dphi, Float_t &deta) const
Float_t mPre2Energy
Energy deposited in epre1 (or bprs)
Float_t eta() const
pz at vertex
Float_t expectation(const TVector3 &gamma)