12 #include "StMCFilter/StGenParticle.h"
13 #include "StMCFilter/StEemcGammaFilter.h"
15 #include "TLorentzVector.h"
29 const double StEemcGammaFilter::mConeRadius = 0.22;
32 const double StEemcGammaFilter::mSeedThreshold = 3.8;
35 const double StEemcGammaFilter::mClusterThreshold = 5.0;
38 const double StEemcGammaFilter::mEtaLow = 0.95;
41 const double StEemcGammaFilter::mEtaHigh =2.1;
44 const double StEemcGammaFilter::mMaxVertex = 120.0;
47 const double StEemcGammaFilter:: mCalDepth = 279.5;
52 const double StEemcGammaFilter:: mHadronScale = 1.0;
56 const double StEemcGammaFilter:: mMinPartEnergy = 0.00001;
59 bool operator>(
const TLorentzVector& v1,
const TLorentzVector& v2)
61 return v1.E() > v2.E();
69 StEemcGammaFilter::StEemcGammaFilter():
StMCFilter(
"eemcGammaFilter.1.00")
82 cout<<
"StEemcGammaFilter:: running the TEST mode (accepting all events). Set mFilterMode=1 to actually reject events"<< endl;
84 cout<<
"StEemcGammaFilter::"
85 <<
" mConeRadius "<<mConeRadius
86 <<
" mSeedThreshold "<< mSeedThreshold
87 <<
" mClusterThreshold "<< mClusterThreshold
88 <<
" mEtaLow "<<mEtaLow
89 <<
" mEtaHigh "<<mEtaHigh
90 <<
" mMaxVertex "<<mMaxVertex
92 cout<<
"StEemcGammaFilter::"
93 <<
" mCalDepth " << mCalDepth
94 <<
" mMinPartEnergy " <<mMinPartEnergy
95 <<
" mHadronScale " <<mHadronScale
96 <<
" mFilterMode " <<mFilterMode
97 <<
" mPrintLevel "<<mPrintLevel
113 vector<TLorentzVector> seedTracksDet;
114 vector<TLorentzVector> eventTracksDet;
124 for(
int i = 0; i < ptl.Size(); ++i)
131 if(track->GetStatusCode() != 1)
continue;
133 int id = track->GetPdgCode();
136 double p[4] = {0, 0, 0, 0};
137 double v[3] = {0, 0, 0};
143 if(fabs(v[2])>mMaxVertex)
145 if(mPrintLevel>=1) cout<<
"Rejecting event with extreme vertex of "<<v[2]<<endl;
146 if (mFilterMode==0 || mPrintLevel>=1)
147 if (acceptFlag==0) { cout<<
"StEemcGammaFilter::RejectGT() - Reject!"<<endl; acceptFlag = -1;}
148 if (mFilterMode)
return mFilterMode;
153 TLorentzVector particleV(p[0],p[1],p[2],p[3]);;
157 cout<<
"Particle vector px py pz E Et:\n";
158 cout<<particleV.Px()<<
" "<<particleV.Py()<<
" "<<particleV.Pz()
159 <<
" "<<particleV.E()<<
" "<<particleV.Et()<<endl;
165 double scale = (mCalDepth-v[2]) / fabs(p[2]);
166 for(
unsigned int j = 0; j < 3; ++j) p[j] = p[j] * scale + v[j];
168 TVector3 positionV(p[0],p[1],p[2]);
170 positionV.SetMag(particleV.P());
172 TLorentzVector detectorV(positionV,p[3]);
177 cout<<
"Detector vector px py pz E Et:\n";
178 cout<<detectorV.Px()<<
" "<<detectorV.Py()<<
" "<<detectorV.Pz()
179 <<
" "<<detectorV.E()<<
" "<<detectorV.Et()<<endl;
189 bool hadronFlag = abs(
id) != 22 && abs(
id) != 111 && abs(
id) != 221 && abs(
id) != 11;
192 hadronFlag &=
id != -2212 &&
id != -2112;
196 particleV*=mHadronScale;
197 detectorV*=mHadronScale;
199 cout<<
"Particle with id "<<
id<<
" is a hadron - E was "<<track->Energy()<<
" and is now "<<detectorV.Energy()<<endl;
207 if(particleV.E()<mMinPartEnergy){
209 cout<<
"Throwing out track with energy "<<particleV.E()
210 <<
" from particle with id "<<
id<<endl;
217 if(detectorV.Eta() < mEtaLow || detectorV.Eta() > mEtaHigh)
continue;
222 if(particleV.Energy() > mSeedThreshold)
224 seedTracksDet.push_back(detectorV);
227 cout<<
"Seed track stored with E "<<particleV.Energy()
228 <<
" et "<<particleV.Et()
229 <<
" detector eta "<<detectorV.Eta()
230 <<
" and detector phi "<<detectorV.Phi()<<endl;
231 cout<<
"StStRoot/StMCFilter/StGenParticle Print :"<<endl;
237 eventTracksDet.push_back(detectorV);
247 if(seedTracksDet.empty()){
249 cout<<
"Did not find any fiducial seed tracks passing the energy threshold.\n";
250 if (mFilterMode==0 || mPrintLevel>=1)
251 if(mPrintLevel>=1) {
if (acceptFlag==0) cout<<
"StEemcGammaFilter::RejectGT() - Reject!"<<endl;}
255 cout <<
"StEemcGammaFilter:: max clusters: seed: " << acceptFlag <<
" " << zVertex <<
" "
256 << 0.0 <<
" "<< 0.0<<
" "<<0.0<<
" "<<0.0<<
" "<<0.0
258 << 0.0 <<
" "<< 0.0<<
" "<<0.0<<
" "<<0.0<<
" "<<0.0<< endl;
278 sort(seedTracksDet.begin(),seedTracksDet.end(),greater<TLorentzVector>());
280 TLorentzVector maxSeedCluster(0.,0.,0.,0.);
281 TLorentzVector maxEtCluster(0.,0.,0.,0.);
282 float maxEtClusterValue = 0;
283 float maxSeedClusterSeedEnergy = 0;
284 float maxEtClusterSeedEnergy = 0;
286 for(
unsigned int iseed = 0; iseed<seedTracksDet.size(); iseed++)
290 cout<<
"Begin looping seed track with energy "<<seedTracksDet[iseed].Energy()
291 <<
" detector eta "<<seedTracksDet[iseed].Eta()
292 <<
" and detector phi "<<seedTracksDet[iseed].Phi()<<endl;
295 TLorentzVector clusterV(0.,0.,0.,0.);
299 for(
unsigned int ievent = 0; ievent<eventTracksDet.size(); ievent++)
303 double dEta = seedTracksDet[iseed].Eta()-eventTracksDet[ievent].Eta();
304 double dPhi = acos( cos( seedTracksDet[iseed].Phi() - eventTracksDet[ievent].Phi()) );
305 double R = sqrt( dEta * dEta + dPhi * dPhi );
309 TLorentzVector &trackV = eventTracksDet[ievent];
312 if(R <= mConeRadius) {
316 cout<<
"Track accepted with energy "<<trackV.Energy()
317 <<
" et "<<trackV.Et()
321 cout<<
"EtSum now "<<clusterV.Et()<<endl;
325 if (clusterV.Et() > maxEtClusterValue )
327 maxEtClusterValue = clusterV.Et();
328 maxEtCluster = clusterV;
329 maxEtClusterSeedEnergy = seedTracksDet[iseed].Energy();
333 maxSeedCluster = clusterV;
334 maxSeedClusterSeedEnergy = seedTracksDet[iseed].Energy();
340 if(clusterV.Et() > mClusterThreshold)
343 cout<<
"Cluster accepted with et "<<clusterV.Et()
344 <<
" eta "<<clusterV.Eta()<<
" and phi "<<clusterV.Phi()<<endl;
346 if (mFilterMode==0 || mPrintLevel>=1)
349 if(mPrintLevel>=1) cout <<
"StEemcGammaFilter::RejectGT() - Accept!" << endl;
352 if (mFilterMode)
return 0;
359 if (mFilterMode==0 || mPrintLevel>=1)
360 {
if (acceptFlag==0)
if(mPrintLevel>=1) cout <<
"StEemcGammaFilter::RejectGT() - Reject!" << endl;}
361 if (acceptFlag==0) acceptFlag = -100;
364 cout <<
"StEemcGammaFilter:: max clusters: seed: " << acceptFlag <<
" " << zVertex <<
" "
365 << maxSeedClusterSeedEnergy<<
" "<< maxSeedCluster.E()<<
" "<<maxSeedCluster.Et()<<
" "<<maxSeedCluster.Eta()<<
" "<<maxSeedCluster.Phi()
367 << maxEtClusterSeedEnergy<<
" "<<maxEtCluster.E()<<
" "<<maxEtCluster.Et()<<
" "<<maxEtCluster.Eta()<<
" "<<maxEtCluster.Phi()
int RejectGT(const StGenParticleMaster &ptl) const
Rejection of GEANT Tracking.
Pythia level Endcap EMC gamma filter.
Abstract base class for particles related to common /HEPEVT/.