6 #include "StMCFilter/StGenParticle.h"
7 #include "StMCFilter/StMCCaloFilter.h"
19 static int gKeepEvent;
36 gInpEvent=gKeepEvent=0;
37 cout<<GetName() <<
" tuned W-filter over barrel & endcap \n params:"
56 if(attr ==
"ConeRadius")
58 cout <<
"StMCCaloFilter::parseConfig() - Setting mConeRadius to " << val << endl;
61 else if(attr ==
"SeedThreshold")
63 cout <<
"StMCCaloFilter::parseConfig() - Setting mSeedThreshold to " << val << endl;
66 else if(attr ==
"ClusterThreshold")
68 cout <<
"StMCCaloFilter::parseConfig() - Setting mClusterThreshold to " << val << endl;
71 else if(attr ==
"EtaLow")
73 cout <<
"StMCCaloFilter::parseConfig() - Setting mEtaLow to " << val << endl;
76 else if(attr ==
"EtaHigh")
78 cout <<
"StMCCaloFilter::parseConfig() - Setting mEtaHigh to " << val << endl;
81 else if(attr ==
"MaxVertex")
83 cout <<
"StMCCaloFilter::parseConfig() - Setting mMaxVertex to " << val << endl;
86 else if ( attr ==
"HadronEfract" )
88 cout <<
"StMCCaloFilter::parseConfig() - Setting mHadronEfract to " << val << endl;
93 cout <<
"StMCCaloFilter::parseConfig() - " << attr <<
" is not an existing parameter!" << endl;
110 double p[4] = {0, 0, 0, 0};
111 double v[3] = {0, 0, 0};
122 double particleEt = 0;
123 double detectorEt = 0;
124 double detectorEta = 0;
125 double detectorPhi = 0;
130 double rSmd = 230.705;
131 double rSmd2 = rSmd * rSmd;
139 double pi = 3.141592653589793;
141 map<double, kinematics> seedTracks;
142 map<double, kinematics> eventTracks;
145 for(
int i = 0; i < ptl.Size(); ++i)
152 if(track->GetStatusCode() != 1)
continue;
154 id = track->GetPdgCode();
162 hadronFlag = TMath::Abs(
id) != 22 && TMath::Abs(
id) != 111 && TMath::Abs(
id) != 221 && TMath::Abs(
id) != 11;
163 hadronFlag &=
id != -2212 &&
id != -2112;
171 pT2 = p[0] * p[0] + p[1] * p[1];
172 particleEt = E * TMath::Sqrt( pT2 / (pT2 + p[2] * p[2]) );
175 pdotv = p[0] * v[0] + p[1] + v[1];
176 pcrossv = p[0] * v[1] - p[1] * v[0];
177 N = ( - pdotv + TMath::Sqrt( pT2 * rSmd2 - pcrossv ) ) / pT2;
179 for(
unsigned int j = 0; j < 3; ++j) p[j] = N * p[j] + v[j];
181 rho2 = p[0] * p[0] + p[1] * p[1];
183 detectorEt = E * TMath::Sqrt( rho2 / (rho2 + p[2] * p[2] ) );
184 detectorEta = - log( TMath::Sqrt(rho2) / ( TMath::Sqrt( rho2 + p[2] * p[2] ) + p[2] ) );
185 detectorPhi = atan2(p[1], p[0]);
188 if(detectorEta <
mEtaLow)
continue;
189 if(detectorEta >
mEtaHigh)
continue;
195 eventTracks[detectorPhi] =
kinematics(particleEt, detectorEta, detectorPhi);
203 map<double, kinematics>::iterator itSeed;
204 map<double, kinematics>::iterator itEvent;
215 itEvent = eventTracks.begin();
217 for(itSeed = seedTracks.begin(); itSeed != seedTracks.end(); ++itSeed)
228 while(itEvent != eventTracks.begin())
230 if(itEvent->first > phiLeft) --itEvent;
239 map<double, kinematics>::reverse_iterator rit = eventTracks.rbegin();
240 if(rit->first > phiLeft + 2 * pi)
244 phiLeft = phiLeft + 2 * pi;
245 phiRight = phiRight + 2 * pi;
248 while(rit->first > phiLeft) ++rit;
253 itEvent = (++rit).base();
260 while(itEvent->first < phiLeft) ++itEvent;
265 while(itEvent->first < phiRight)
268 dEta = itSeed->second.eta - itEvent->second.eta;
269 dPhi = acos( cos( itSeed->first - itEvent->first) );
270 R = TMath::Sqrt( dEta * dEta + dPhi * dPhi );
278 if(itEvent == eventTracks.end())
282 phiLeft = phiLeft - 2 * pi;
283 phiRight = phiRight - 2 * pi;
285 itEvent = eventTracks.begin();
293 cout << Form(
"Filter Found EtSum=%f inpEve=%d",EtSum,gInpEvent) << endl;
296 cout << Form(
"Filter Accept %d eve of %d tried, Etsum=%.1f\n",gKeepEvent,gInpEvent,EtSum) << endl;
void parseConfig(std::string, float)
double mClusterThreshold
Cluster E_{T} threshold for clustering finding.
Abstract base class for particles related to common /HEPEVT/.
double mConeRadius
Cone radius of cluster.
double mSeedThreshold
Seed energy threshold for cluster finding.
double mEtaLow
Minimum detector eta.
StMCCaloFilter()
Constructor.
Sparse class to hold track kinematics.
int RejectGT(const StGenParticleMaster &ptl) const
double mEtaHigh
Maximum detector eta.
double mHadronEfract
Attenuation factor for hadron energy.
double mMaxVertex
Maximum vertex magnitude in cm.