test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
MCDijetResonance Class Reference

#include <MCDijetResonance.h>

Inheritance diagram for MCDijetResonance:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 MCDijetResonance (const edm::ParameterSet &)
 
 ~MCDijetResonance ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

int bosonID
 
std::string dijetProcess
 
int maxQuarkID
 
unsigned int nAccepted
 
unsigned int nEvents
 
edm::EDGetTokenT
< edm::HepMCProduct
token_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 41 of file MCDijetResonance.h.

Constructor & Destructor Documentation

MCDijetResonance::MCDijetResonance ( const edm::ParameterSet iConfig)
explicit

Definition at line 12 of file MCDijetResonance.cc.

References bosonID, gather_cfg::cout, dijetProcess, edm::ParameterSet::getUntrackedParameter(), maxQuarkID, nAccepted, and nEvents.

12  :
13  token_(consumes<edm::HepMCProduct>(edm::InputTag(iConfig.getUntrackedParameter("moduleLabel",std::string("generator")),"unsmeared")))
14 {
15  //here do whatever other initialization is needed
16 
17  //Get dijet process type we will select
18  dijetProcess = iConfig.getUntrackedParameter<string>( "dijetProcess" );
19  cout << "Dijet Resonance Filter Selecting Process = " << dijetProcess << endl;
20 
21  maxQuarkID = 4; //Maximum |ID| of Light Quark = charm quark gives u, d, s, and c decays of Zprime.
22  bosonID = 21; //Gluon
23 
24  //Number of events and Number Accepted
25  nEvents = 0;
26  nAccepted = 0;
27 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > token_
unsigned int nAccepted
std::string dijetProcess
unsigned int nEvents
tuple cout
Definition: gather_cfg.py:121
MCDijetResonance::~MCDijetResonance ( )

Definition at line 30 of file MCDijetResonance.cc.

31 {
32 
33  // do anything here that needs to be done at desctruction time
34  // (e.g. close files, deallocate resources etc.)
35 
36 }

Member Function Documentation

void MCDijetResonance::endJob ( void  )
virtual

Reimplemented from edm::EDFilter.

Definition at line 38 of file MCDijetResonance.cc.

References nAccepted, and nEvents.

39 {
40  edm::LogVerbatim("MCDijetResonanceInfo") << "================MCDijetResonance report========================================\n"
41  << "Events read " << nEvents << " Events accepted " << nAccepted << "\nEfficiency " << ((double)nAccepted)/((double)nEvents)
42  << "\n====================================================================" << std::endl;
43 }
unsigned int nAccepted
unsigned int nEvents
bool MCDijetResonance::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDFilter.

Definition at line 46 of file MCDijetResonance.cc.

References funct::abs(), bosonID, gather_cfg::cout, dijetProcess, edm::Event::getByToken(), maxQuarkID, nAccepted, nEvents, AlCaHLTBitMon_ParallelJobs::p, and token_.

47 {
48  nEvents++;
49  cout << endl << "Event=" << nEvents << endl;
50  using namespace edm;
52  iEvent.getByToken(token_, evt);
53  const HepMC::GenEvent * myGenEvent = evt->GetEvent();
54 
55  //If process is not the desired primary process, cleanup and reject the event.
56  if (dijetProcess == "ZprimeLightQuarks" && myGenEvent->signal_process_id() != 141){
57  // Wanted a Z' but didn't find it, so reject event.
58  delete myGenEvent;
59  return false;
60  }
61  if (dijetProcess == "QstarQuarkGluon" && myGenEvent->signal_process_id() != 147 && myGenEvent->signal_process_id() != 148){
62  // Wanted a q* but didn't find it, so reject event.
63  delete myGenEvent;
64  return false;
65  }
66 
67  //found a dijet resonance
68 
69  //debug
70  // int count = 0;
71  //for ( HepMC::GenEvent::particle_iterator p = myGenEvent->particles_begin();
72  // p != myGenEvent->particles_end() & count<13; ++p )
73  // {
74  //std::cout << count << ": ID=" << (*p)->pdg_id() << ", status=" << (*p)->status() << ", mass=" << (*p)->momentum().invariantMass() << ", pt=" <<(*p)->momentum().perp() << std::endl;
75  //count++;
76  //}
77 
78  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
79  p != myGenEvent->particles_end(); ++p )
80  {
81  //Find resonance particle and check that it is part of hard collision
82  if ( (*p)->status() == 3 && ( (dijetProcess == "ZprimeLightQuarks" && (*p)->pdg_id() == 32) ||
83  (dijetProcess == "QstarQuarkGluon" && abs((*p)->pdg_id()) == 4000001) ||
84  (dijetProcess == "QstarQuarkGluon" && abs((*p)->pdg_id()) == 4000002) ) )
85  {
86  // The next two particles are the outgoing particles from the resonance decay
87  p++;
88  int ID1 = (*p)->pdg_id();
89  p++;
90  int ID2 = (*p)->pdg_id();
91 
92  //Check for the process we want
93  if( (dijetProcess == "ZprimeLightQuarks" && abs(ID1) <= maxQuarkID && abs(ID2) <= maxQuarkID ) ||
94  (dijetProcess == "QstarQuarkGluon" && ( ID1 == bosonID || ID2 == bosonID ) ) )
95  {
96  //cout << "dijet resonance " << dijetProcess << " found " << endl;
97  nAccepted++;
98  delete myGenEvent;
99  return true;
100  }
101  else
102  {
103  delete myGenEvent;
104  return false;
105  }
106  }
107 
108  }
109 
110  delete myGenEvent;
111  return false;
112 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::EDGetTokenT< edm::HepMCProduct > token_
unsigned int nAccepted
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::string dijetProcess
unsigned int nEvents
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

int MCDijetResonance::bosonID
private

Definition at line 55 of file MCDijetResonance.h.

Referenced by filter(), and MCDijetResonance().

std::string MCDijetResonance::dijetProcess
private

Definition at line 51 of file MCDijetResonance.h.

Referenced by filter(), and MCDijetResonance().

int MCDijetResonance::maxQuarkID
private

Definition at line 54 of file MCDijetResonance.h.

Referenced by filter(), and MCDijetResonance().

unsigned int MCDijetResonance::nAccepted
private

Definition at line 53 of file MCDijetResonance.h.

Referenced by endJob(), filter(), and MCDijetResonance().

unsigned int MCDijetResonance::nEvents
private

Definition at line 52 of file MCDijetResonance.h.

Referenced by endJob(), filter(), looper.Looper::loop(), and MCDijetResonance().

edm::EDGetTokenT<edm::HepMCProduct> MCDijetResonance::token_
private

Definition at line 50 of file MCDijetResonance.h.

Referenced by filter().