00001
00002
00003
00004
00005 #include "stdlib.h"
00006 #include "math.h"
00007 #include <iostream>
00008 #include <fstream>
00009
00010 #include "StHighPtFilter.h"
00011 #include "StGenParticle.h"
00012
00013 using namespace std;
00014
00020
00021 static StHighPtFilter particleFilter;
00022
00084
00085 StHighPtFilter::StHighPtFilter():StMCFilter("highpt")
00086 {
00087
00088 mPtCut = 2.5;
00089 mEtaCut = 1.2;
00090 readConfig();
00091 std::cout << "======================================================" << std::endl;
00092 std::cout << "highpt hadron filter initialized" << std::endl;
00093 std::cout << "PtCUT: " << mPtCut << std::endl;
00094 std::cout << "EtaCUT: " << mEtaCut << std::endl;
00095 std::cout << "======================================================" << std::endl;
00096 };
00097
00098 void StHighPtFilter::readConfig()
00099 {
00100 ifstream cfile("highpt.cnf");
00101 while (1) {
00102 string key;
00103 double value;
00104 cfile >> key >> value;
00105 if ( !cfile.good() ) break;
00106 parseConfig( key, value );
00107 }
00108 }
00109
00110 void StHighPtFilter::parseConfig(string key, double value)
00111 {
00112 if ( key=="PtCUT" ){ mPtCut = value; }
00113 if ( key=="EtaCUT" ){ mEtaCut = value; }
00114 return;
00115 }
00116
00117
00118
00119 int StHighPtFilter::RejectEG(const StGenParticleMaster &ptl) const
00120 {
00121
00122
00123 return 0;
00124 }
00125
00126 int StHighPtFilter::RejectGT(const StGenParticleMaster &ptl) const
00127 {
00128
00129 const StGenParticle *tk=0;
00130 int n = ptl.Size();
00131
00132
00133
00134
00135
00136
00137
00138 float maxPt = 0.;
00139
00140 for (int i=0;i<n;i++) {
00141
00142 tk = ptl(i); if (!tk) continue;
00143 if (tk->GetStatusCode()!=1) continue;
00144 if( fabs(tk->Eta())> mEtaCut ) continue;
00145
00146 if ( tk->Pt() < mPtCut ) continue;
00147
00148 if( (fabs(tk->GetPdgCode())==211 ||
00149 fabs(tk->GetPdgCode())==321 ||
00150 fabs(tk->GetPdgCode())==2212) ) return 0;
00151
00152 }
00153
00154 return 1;
00155
00156
00157 }
00158
00159 int StHighPtFilter::RejectGE(const StGenParticleMaster &ptl) const
00160 {
00161
00162 return 0;
00163 }