Go to the documentation of this file.00001 #include "FastSimulation/Event/interface/KineParticleFilter.h"
00002
00003
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005
00006 #include <vector>
00007 #include <iterator>
00008
00009 KineParticleFilter::KineParticleFilter(const edm::ParameterSet& kine)
00010 : BaseRawParticleFilter()
00011 {
00012
00013
00014
00015 etaMax = kine.getParameter<double>("etaMax");
00016
00017 pTMin = kine.getParameter<double>("pTMin");
00018
00019 EMin = kine.getParameter<double>("EMin");
00020
00021 EMax = kine.getParameter<double>("EProton");
00022
00023
00024
00025 std::vector<int> tmpcodes
00026 = kine.getUntrackedParameter< std::vector<int> >
00027 ("forbiddenPdgCodes", std::vector<int>() );
00028
00029 std::copy(tmpcodes.begin(),
00030 tmpcodes.end(),
00031 std::insert_iterator< std::set<int> >(forbiddenPdgCodes,
00032 forbiddenPdgCodes.begin() ));
00033
00034 if( !forbiddenPdgCodes.empty() ) {
00035 std::cout<<"KineParticleFilter : Forbidden PDG codes : ";
00036 copy(forbiddenPdgCodes.begin(), forbiddenPdgCodes.end(),
00037 std::ostream_iterator<int>(std::cout, " "));
00038 }
00039
00040
00041 if ( etaMax > 20. ) etaMax = 20.;
00042 double cosMax = (std::exp(2.*etaMax)-1.) / (std::exp(2.*etaMax)+1.);
00043 cos2Max = cosMax*cosMax;
00044
00045 double etaPreshMin = 1.479;
00046 double etaPreshMax = 1.594;
00047 double cosPreshMin = (std::exp(2.*etaPreshMin)-1.) / (std::exp(2.*etaPreshMin)+1.);
00048 double cosPreshMax = (std::exp(2.*etaPreshMax)-1.) / (std::exp(2.*etaPreshMax)+1.);
00049 cos2PreshMin = cosPreshMin*cosPreshMin;
00050 cos2PreshMax = cosPreshMax*cosPreshMax;
00051
00052
00053 pTMin *= pTMin;
00054
00055 }
00056
00057 bool KineParticleFilter::isOKForMe(const RawParticle* p) const
00058 {
00059
00060
00061
00062 int pId = abs(p->pid());
00063
00064
00065 if ( pId != 0 ) {
00066 bool particleCut = ( pId > 10 && pId != 12 && pId != 14 &&
00067 pId != 16 && pId != 18 && pId != 21 &&
00068 (pId < 23 || pId > 40 ) &&
00069 (pId < 81 || pId > 100 ) && pId != 2101 &&
00070 pId != 3101 && pId != 3201 && pId != 1103 &&
00071 pId != 2103 && pId != 2203 && pId != 3103 &&
00072 pId != 3203 && pId != 3303 );
00073
00074
00075
00076 if ( !particleCut ) return false;
00077
00078
00079 bool protonTaggers = (pId == 2212 && p->E() >= EMax) ;
00080 if ( protonTaggers ) return true;
00081
00082 std::set<int>::iterator is = forbiddenPdgCodes.find(pId);
00083 if( is != forbiddenPdgCodes.end() ) return false;
00084
00085
00086
00087
00088 bool eneCut = p->E() >= EMin;
00089 if (!eneCut) return false;
00090
00091
00092 bool pTCut = p->charge()==0 || p->Perp2()>=pTMin;
00093 if (!pTCut) return false;
00094
00095
00096
00097 bool etaCut = (p->vertex()-mainVertex).Perp2()>25. || p->cos2Theta()<= cos2Max;
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 if (!etaCut) return false;
00108
00109
00110
00111 double radius2 = p->R2();
00112 double zed = fabs(p->Z());
00113 double cos2Tet = p->cos2ThetaV();
00114
00115 bool ecalAcc = ( (radius2<129.01*129.01 && zed<317.01) ||
00116 (cos2Tet>cos2PreshMin && cos2Tet<cos2PreshMax
00117 && radius2<171.11*171.11 && zed<317.01) );
00118
00119 return ecalAcc;
00120
00121 } else {
00122
00123 double radius2 = p->Perp2();
00124 double zed = fabs(p->Pz());
00125 double cos2Tet = p->cos2Theta();
00126
00127
00128 bool ecalAcc = ( (radius2<129.01*129.01 && zed<317.01) ||
00129 (cos2Tet>cos2PreshMin && cos2Tet<cos2PreshMax
00130 && radius2<171.11*171.11 && zed<317.01) );
00131
00132 return ecalAcc;
00133
00134 }
00135
00136 }