CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
HiggsValidation Class Reference

#include <HiggsValidation.h>

Inheritance diagram for HiggsValidation:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

class  MonitoredDecays
 

Public Member Functions

virtual void analyze (edm::Event const &, edm::EventSetup const &) override
 
virtual void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
virtual void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 
 HiggsValidation (const edm::ParameterSet &)
 
virtual ~HiggsValidation ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

std::string convert (int)
 
int findHiggsDecayChannel (const HepMC::GenParticle *, std::vector< HepMC::GenParticle * > &decayprod)
 

Private Attributes

edm::ESHandle< HepPDT::ParticleDataTablefPDGTable
 PDT table. More...
 
edm::InputTag hepmcCollection_
 
edm::EDGetTokenT< edm::HepMCProducthepmcCollectionToken_
 
MonitorElementHiggs_eta
 
MonitorElementHiggs_mass
 
MonitorElementHiggs_pt
 
MonitorElementHiggsDecayChannels
 
std::vector< MonitorElement * > HiggsDecayProd_eta
 
std::vector< MonitorElement * > HiggsDecayProd_pt
 
MonitoredDecaysmonitoredDecays
 
MonitorElementnEvt
 
int particle_id
 
std::string particle_name
 
WeightManager wmanager_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 37 of file HiggsValidation.h.

Constructor & Destructor Documentation

HiggsValidation::HiggsValidation ( const edm::ParameterSet iPSet)
explicit

Definition at line 21 of file HiggsValidation.cc.

References hepmcCollection_, hepmcCollectionToken_, and monitoredDecays.

21  :
23  hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")),
24  particle_id(iPSet.getParameter<int>("pdg_id")),
25  particle_name(iPSet.getParameter<std::string>("particleName"))
26 {
27  monitoredDecays = new MonitoredDecays(iPSet);
28  hepmcCollectionToken_=consumes<HepMCProduct>(hepmcCollection_);
29 }
T getParameter(std::string const &) const
MonitoredDecays * monitoredDecays
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
edm::InputTag hepmcCollection_
WeightManager wmanager_
std::string particle_name
HiggsValidation::~HiggsValidation ( )
virtual

Definition at line 31 of file HiggsValidation.cc.

31 {}

Member Function Documentation

void HiggsValidation::analyze ( edm::Event const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 72 of file HiggsValidation.cc.

References funct::abs(), MonitorElement::Fill(), findHiggsDecayChannel(), edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), hepmcCollectionToken_, Higgs_eta, Higgs_mass, Higgs_pt, HiggsDecayChannels, HiggsDecayProd_eta, HiggsDecayProd_pt, mps_fire::i, training_settings::idx, HiggsValidation::MonitoredDecays::isDecayParticle(), monitoredDecays, nEvt, particle_id, WeightManager::weight(), mps_merge::weight, and wmanager_.

73 {
74  double weight = wmanager_.weight(iEvent);
75  nEvt->Fill(0.5,weight);
76 
77  //Gathering the HepMCProduct information
79  iEvent.getByToken(hepmcCollectionToken_, evt);
80 
81  //Get EVENT
82  HepMC::GenEvent *myGenEvent = new HepMC::GenEvent(*(evt->GetEvent()));
83 
84  // loop over all particles
85  bool filled = false;
86  for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin();
87  iter!= myGenEvent->particles_end() && !filled; ++iter) {
88  if(particle_id == std::abs((*iter)->pdg_id())){
89  std::vector<HepMC::GenParticle*> decayprod;
90  int channel = findHiggsDecayChannel(*iter,decayprod);
91  HiggsDecayChannels->Fill(channel,weight);
92  Higgs_pt->Fill((*iter)->momentum().perp(),weight);
93  Higgs_eta->Fill((*iter)->momentum().eta(),weight);
94  Higgs_mass->Fill((*iter)->momentum().m(),weight);
95  for(unsigned int i=0;i<decayprod.size();i++){
96  int idx=monitoredDecays->isDecayParticle(decayprod.at(i)->pdg_id());
97  if(0<=idx && idx<=(int)HiggsDecayProd_pt.size()){
98  HiggsDecayProd_pt.at(idx)->Fill(decayprod.at(i)->momentum().perp(),weight);
99  HiggsDecayProd_eta.at(idx)->Fill(decayprod.at(i)->momentum().eta(),weight);
100  }
101  }
102  filled = true;
103  }
104  }
105 
106  delete myGenEvent;
107 
108 }//analyze
MonitorElement * Higgs_eta
Definition: weight.py:1
MonitorElement * nEvt
std::vector< MonitorElement * > HiggsDecayProd_pt
MonitoredDecays * monitoredDecays
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:230
int findHiggsDecayChannel(const HepMC::GenParticle *, std::vector< HepMC::GenParticle * > &decayprod)
std::vector< MonitorElement * > HiggsDecayProd_eta
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * Higgs_pt
MonitorElement * HiggsDecayChannels
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
WeightManager wmanager_
double weight(const edm::Event &)
MonitorElement * Higgs_mass
void HiggsValidation::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Setting the DQM top directories

Implements DQMEDAnalyzer.

Definition at line 37 of file HiggsValidation.cc.

References DQMHelper::book1dHisto(), HiggsValidation::MonitoredDecays::channel(), HiggsValidation::MonitoredDecays::ConvertIndex(), dir, Higgs_eta, Higgs_mass, Higgs_pt, HiggsDecayChannels, HiggsDecayProd_eta, HiggsDecayProd_pt, training_settings::idx, monitoredDecays, HiggsValidation::MonitoredDecays::NDecayParticles(), nEvt, particle_name, MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), HiggsValidation::MonitoredDecays::size(), and AlCaHLTBitMon_QueryRunRegistry::string.

37  {
38 
40  std::string dir="Generator/";
41  dir+=particle_name;
42  DQMHelper dqm(&i); i.setCurrentFolder(dir);
43 
44  // Number of analyzed events
45  nEvt = dqm.book1dHisto("nEvt", "n analyzed Events", 1, 0., 1.,"bin","Number of Events");
46 
47  //decay type
48 
49  std::string channel = particle_name+"_DecayChannels";
50  HiggsDecayChannels = dqm.book1dHisto(channel.c_str(),(particle_name+" decay channels").c_str(),monitoredDecays->size(),0,monitoredDecays->size(),"Decay Channels","Number of Events");
51 
52  for(size_t j = 0; j < monitoredDecays->size(); ++j){
54  }
55 
56 
57  //Kinematics
58  Higgs_pt = dqm.book1dHisto((particle_name+"_pt"),(particle_name+" p_{t}"),50,0,250,"P_{t}^{"+particle_name+"} (GeV)","Number of Events");
59  Higgs_eta = dqm.book1dHisto((particle_name+"_eta"),(particle_name+" #eta"),50,-5,5,"#eta^{"+particle_name+"}","Number of Events");
60  Higgs_mass = dqm.book1dHisto((particle_name+"_m"),(particle_name+" M"),500,0,500,"M^{"+particle_name+"}","Number of Events");
61 
62  int idx=0;
63  for(unsigned int j=0;j<monitoredDecays->NDecayParticles();j++){
64  HiggsDecayProd_pt.push_back(dqm.book1dHisto((monitoredDecays->ConvertIndex(idx)+"_pt"),(monitoredDecays->ConvertIndex(idx)+" p_{t}"),50,0,250,"P_{t}^{"+monitoredDecays->ConvertIndex(idx)+"} (GeV)","Number of Events"));
65  HiggsDecayProd_eta.push_back(dqm.book1dHisto((monitoredDecays->ConvertIndex(idx)+"_eta"),(monitoredDecays->ConvertIndex(idx)+" #eta"),50,-5,5,"#eta^{"+monitoredDecays->ConvertIndex(idx)+"}","Number of Events"));
66  idx++;
67  }
68 
69  return;
70 }
MonitorElement * Higgs_eta
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * nEvt
std::vector< MonitorElement * > HiggsDecayProd_pt
MonitoredDecays * monitoredDecays
std::vector< MonitorElement * > HiggsDecayProd_eta
MonitorElement * Higgs_pt
MonitorElement * HiggsDecayChannels
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
std::string ConvertIndex(int index)
std::string channel(size_t i)
dbl *** dir
Definition: mlp_gen.cc:35
std::string particle_name
MonitorElement * Higgs_mass
std::string HiggsValidation::convert ( int  )
private
void HiggsValidation::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Definition at line 33 of file HiggsValidation.cc.

References fPDGTable, and edm::EventSetup::getData().

33  {
34  c.getData( fPDGTable );
35 }
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
void getData(T &iHolder) const
Definition: EventSetup.h:79
int HiggsValidation::findHiggsDecayChannel ( const HepMC::GenParticle *  genParticle,
std::vector< HepMC::GenParticle * > &  decayprod 
)
private

Definition at line 110 of file HiggsValidation.cc.

References class-composition::children, monitoredDecays, parents, HiggsValidation::MonitoredDecays::position(), HiggsValidation::MonitoredDecays::stable(), and HiggsValidation::MonitoredDecays::undetermined().

Referenced by analyze().

110  {
111  if(genParticle->status() == 1) return monitoredDecays->stable();
112  std::vector<int> children;
113  if ( genParticle->end_vertex() ) {
114  HepMC::GenVertex::particle_iterator des;
115  for(des = genParticle->end_vertex()->particles_begin(HepMC::descendants);
116  des!= genParticle->end_vertex()->particles_end(HepMC::descendants);++des ) {
117 
118  if((*des)->pdg_id() == genParticle->pdg_id()) continue;
119 
120  HepMC::GenVertex::particle_iterator mother = (*des)->production_vertex()->particles_begin(HepMC::parents);
121  if((*mother)->pdg_id() == genParticle->pdg_id()){
122  children.push_back((*des)->pdg_id());
123  decayprod.push_back((*des));
124  }
125  }
126  }
127 
128  if(children.size() == 2 && children.at(0) != 0 && children.at(1) != 0){
129  return monitoredDecays->position(children.at(0),children.at(1));
130  }
131  return monitoredDecays->undetermined();
132 }
TPRegexp parents
Definition: eve_filter.cc:21
size_t position(int pid1, int pid2)
MonitoredDecays * monitoredDecays

Member Data Documentation

edm::ESHandle<HepPDT::ParticleDataTable> HiggsValidation::fPDGTable
private

PDT table.

Definition at line 166 of file HiggsValidation.h.

Referenced by dqmBeginRun().

edm::InputTag HiggsValidation::hepmcCollection_
private

Definition at line 158 of file HiggsValidation.h.

Referenced by HiggsValidation().

edm::EDGetTokenT<edm::HepMCProduct> HiggsValidation::hepmcCollectionToken_
private

Definition at line 178 of file HiggsValidation.h.

Referenced by analyze(), and HiggsValidation().

MonitorElement* HiggsValidation::Higgs_eta
private

Definition at line 172 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HiggsValidation::Higgs_mass
private

Definition at line 173 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HiggsValidation::Higgs_pt
private

Definition at line 171 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HiggsValidation::HiggsDecayChannels
private

Definition at line 169 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement*> HiggsValidation::HiggsDecayProd_eta
private

Definition at line 176 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement*> HiggsValidation::HiggsDecayProd_pt
private

Definition at line 175 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitoredDecays* HiggsValidation::monitoredDecays
private

Definition at line 163 of file HiggsValidation.h.

Referenced by analyze(), bookHistograms(), findHiggsDecayChannel(), and HiggsValidation().

MonitorElement* HiggsValidation::nEvt
private

Definition at line 168 of file HiggsValidation.h.

Referenced by analyze(), and bookHistograms().

int HiggsValidation::particle_id
private

Definition at line 160 of file HiggsValidation.h.

Referenced by analyze().

std::string HiggsValidation::particle_name
private

Definition at line 161 of file HiggsValidation.h.

Referenced by bookHistograms().

WeightManager HiggsValidation::wmanager_
private

Definition at line 47 of file HiggsValidation.h.

Referenced by analyze().