CMS 3D CMS Logo

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

void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 
 MCDijetResonance (const edm::ParameterSet &)
 
 ~MCDijetResonance () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 39 of file MCDijetResonance.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file MCDijetResonance.cc.

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

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

Definition at line 28 of file MCDijetResonance.cc.

28  {
29  // do anything here that needs to be done at desctruction time
30  // (e.g. close files, deallocate resources etc.)
31 }

Member Function Documentation

void MCDijetResonance::endJob ( void  )
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 33 of file MCDijetResonance.cc.

References nAccepted, and nEvents.

33  {
34  edm::LogVerbatim("MCDijetResonanceInfo")
35  << "================MCDijetResonance report========================================\n"
36  << "Events read " << nEvents << " Events accepted " << nAccepted << "\nEfficiency "
37  << ((double)nAccepted) / ((double)nEvents)
38  << "\n====================================================================" << std::endl;
39 }
unsigned int nAccepted
unsigned int nEvents
bool MCDijetResonance::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 42 of file MCDijetResonance.cc.

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

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

Member Data Documentation

int MCDijetResonance::bosonID
private

Definition at line 54 of file MCDijetResonance.h.

Referenced by filter(), and MCDijetResonance().

std::string MCDijetResonance::dijetProcess
private

Definition at line 50 of file MCDijetResonance.h.

Referenced by filter(), and MCDijetResonance().

int MCDijetResonance::maxQuarkID
private

Definition at line 53 of file MCDijetResonance.h.

Referenced by filter(), and MCDijetResonance().

unsigned int MCDijetResonance::nAccepted
private

Definition at line 52 of file MCDijetResonance.h.

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

unsigned int MCDijetResonance::nEvents
private

Definition at line 51 of file MCDijetResonance.h.

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

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

Definition at line 49 of file MCDijetResonance.h.

Referenced by filter().