StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHighPtFilter.cxx
1 // @(#)root/eg:$Id: StHighPtFilter.cxx,v 1.1 2011/01/25 20:06:53 jwebb Exp $
2 // Author: Victor Perev 17/03/2009
3 
4 //______________________________________________________________________________
5 #include "stdlib.h"
6 #include "math.h"
7 #include <iostream>
8 #include <fstream>
9 
10 #include "StHighPtFilter.h"
11 #include "StGenParticle.h"
12 
13 using namespace std;
14 
20 
21 static StHighPtFilter particleFilter;
22 
84 
86 {
87 
88  mPtCut = 2.5;
89  mEtaCut = 1.2;
90  readConfig();
91  std::cout << "======================================================" << std::endl;
92  std::cout << "highpt hadron filter initialized" << std::endl;
93  std::cout << "PtCUT: " << mPtCut << std::endl;
94  std::cout << "EtaCUT: " << mEtaCut << std::endl;
95  std::cout << "======================================================" << std::endl;
96 };
97 
98 void StHighPtFilter::readConfig()
99 {
100  ifstream cfile("highpt.cnf");
101  while (1) {
102  string key;
103  double value;
104  cfile >> key >> value;
105  if ( !cfile.good() ) break; // EOF or no file
106  parseConfig( key, value );
107  }
108 }
109 
110 void StHighPtFilter::parseConfig(string key, double value)
111 {
112  if ( key=="PtCUT" ){ mPtCut = value; }
113  if ( key=="EtaCUT" ){ mEtaCut = value; }
114  return;
115 }
116 
117 
118 //______________________________________________________________________________
120 {
121  //ptl.Print("************** In RejectEG ************** ");
122  //cout<<"********************** In RejectEG ******************"<<endl;
123  return 0;
124 }
125 //______________________________________________________________________________
127 {
128 
129  const StGenParticle *tk=0;
130  int n = ptl.Size();
131 
132  //
133  // Loop over all particles and accept events with high pT
134  // charged hadrons (pi+/-, K+/- and p/pbar) within |y|<1.2
135  // and with pT > 2.5 GeV. The |y|<1.2 cut is consistent
136  // with vertex cuts of |z|<100 cm.
137  //
138  float maxPt = 0.;
139 
140  for (int i=0;i<n;i++) {
141 
142  tk = ptl(i); if (!tk) continue;
143  if (tk->GetStatusCode()!=1) continue;
144  if( fabs(tk->Eta())> mEtaCut ) continue; //Jason's suggestion@Jan13th2011
145 
146  if ( tk->Pt() < mPtCut ) continue;
147 
148  if( (fabs(tk->GetPdgCode())==211 ||
149  fabs(tk->GetPdgCode())==321 ||
150  fabs(tk->GetPdgCode())==2212) ) return 0; // accept on any charged hadron with pT > threshold
151 
152  }
153 
154  return 1; // No charged tracks with pT > threshold
155 
156 
157 }
158 //______________________________________________________________________________
160 {
161  //ptl.Print("************** In RejectGE ************** ");
162  return 0;
163 }
int RejectGT(const StGenParticleMaster &ptl) const
Abstract base class for particles related to common /HEPEVT/.
int RejectEG(const StGenParticleMaster &ptl) const
int RejectGE(const StGenParticleMaster &ptl) const