@@ -8,33 +8,14 @@ using namespace std;
88
99PhotonGenFilter::PhotonGenFilter (const edm::ParameterSet &iConfig)
1010 : token_(consumes<edm::HepMCProduct>(
11- edm::InputTag (iConfig.getUntrackedParameter(" moduleLabel" , std::string(" generator" )), "unsmeared"))),
12- betaBoost(iConfig.getUntrackedParameter(" BetaBoost" , 0 .)) {
11+ edm::InputTag (iConfig.getUntrackedParameter(" moduleLabel" , std::string(" generator" )), "unsmeared"))) {
1312 // Constructor implementation
14- vector<int > defpid;
15- defpid.push_back (0 );
16- particleID = iConfig.getUntrackedParameter <vector<int >>(" ParticleID" , defpid);
17- vector<double > defptmin;
18- defptmin.push_back (0 .);
19- ptMin = iConfig.getUntrackedParameter <vector<double >>(" MinPt" , defptmin);
13+ ptMin = iConfig.getUntrackedParameter <double >(" MinPt" , 20 .);
14+ etaMin = iConfig.getUntrackedParameter <double >(" MinEta" , -2.4 );
15+ etaMax = iConfig.getUntrackedParameter <double >(" MaxEta" , 2.4 );
16+ drMin = iConfig.getUntrackedParameter <double >(" drMin" , 0.1 );
17+ ptThreshold = iConfig.getUntrackedParameter <double >(" ptThreshold" , 2 .);
2018
21- vector<double > defetamin;
22- defetamin.push_back (-10 .);
23- etaMin = iConfig.getUntrackedParameter <vector<double >>(" MinEta" , defetamin);
24- vector<double > defetamax;
25- defetamax.push_back (10 .);
26- etaMax = iConfig.getUntrackedParameter <vector<double >>(" MaxEta" , defetamax);
27- vector<int > defstat;
28- defstat.push_back (0 );
29- status = iConfig.getUntrackedParameter <vector<int >>(" Status" , defstat);
30- vector<double > defdrmin;
31- defdrmin.push_back (0 .);
32- drMin = iConfig.getUntrackedParameter <vector<double >>(" drMin" , defdrmin);
33-
34- // check if beta is smaller than 1
35- if (std::abs (betaBoost) >= 1 ) {
36- edm::LogError (" PhotonGenFilter" ) << " Input beta boost is >= 1 !" ;
37- }
3819}
3920
4021PhotonGenFilter::~PhotonGenFilter () {
@@ -49,40 +30,34 @@ bool PhotonGenFilter::filter(edm::StreamID, edm::Event &iEvent, const edm::Event
4930
5031 for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin (); p != myGenEvent->particles_end ();
5132 ++p) {
52- for (unsigned int i = 0 ; i < particleID.size (); i++) {
53- if (particleID[i] == (*p)->pdg_id () || particleID[i] == 0 ) {
54- if ((*p)->momentum ().perp () > ptMin[i] && ((*p)->status () == status[i] || status[i] == 0 )) {
55- HepMC::FourVector mom = MCFilterZboostHelper::zboost ((*p)->momentum (), betaBoost);
56- if (mom.eta () > etaMin[i] && mom.eta () < etaMax[i]) {
33+ if ((*p)->pdg_id () == 22 ) {
34+ if ((*p)->momentum ().perp () > ptMin && (*p)->status () == 1 && (*p)->momentum ().eta () > etaMin &&
35+ (*p)->momentum ().eta () < etaMax) {
5736 bool accepted_photon = true ;
5837 double phi = (*p)->momentum ().phi ();
59- double eta = mom.eta ();
60- for (HepMC::GenEvent::particle_const_iterator q = myGenEvent->particles_begin ();
61- q != myGenEvent->particles_end ();
62- ++q) {
38+ double eta = (*p)->momentum ().eta ();
39+ for (HepMC::GenEvent::particle_const_iterator q = myGenEvent->particles_begin (); q != myGenEvent->particles_end (); ++q) {
6340 if (&p != &q) {
64- if ((*q)->momentum ().perp () > 2 && (*q)->pdg_id () != 22 &&
41+ if ((*q)->momentum ().perp () > ptThreshold && (*q)->pdg_id () != 22 &&
6542 (*q)->status () == 1 ) // && abs((*q)->charge()) > 0)
6643 {
6744 double phi2 = (*p)->momentum ().phi ();
6845 double deltaphi = fabs (phi - phi2);
6946 if (deltaphi > M_PI)
7047 deltaphi = 2 . * M_PI - deltaphi;
71- HepMC::FourVector mom2 = MCFilterZboostHelper::zboost ((*q)->momentum (), betaBoost);
72- double eta2 = mom2.eta ();
48+ double eta2 = (*p)->momentum ().eta ();
7349 double deltaeta = fabs (eta - eta2);
7450 double deltaR = sqrt (deltaeta * deltaeta + deltaphi * deltaphi);
75- if (deltaR < 0.1 )
51+ if (deltaR < drMin )
7652 accepted_photon = false ;
7753 }
7854 }
7955 }
8056 if (accepted_photon)
8157 return true ;
82- }
8358 }
8459 }
85- }
60+
8661 }
8762
8863 // Implementation for event filtering
@@ -94,9 +69,8 @@ void PhotonGenFilter::fillDescriptions(edm::ConfigurationDescriptions &descripti
9469 desc.addUntracked <double >(" MaxEta" , 2.4 );
9570 desc.addUntracked <double >(" MinEta" , -2.4 );
9671 desc.addUntracked <double >(" MinPt" , 20 .);
97- desc.addUntracked <int >(" Status" , 1 );
98- desc.addUntracked <int >(" ParticleID" , 22 );
9972 desc.addUntracked <double >(" drMin" , 0.1 );
73+ desc.addUntracked <double >(" ptThreshold" , 2 .);
10074
10175 descriptions.add (" PhotonGenFilter" , desc);
10276}
0 commit comments