CMS 3D CMS Logo

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

#include <BPhysicsValidation.h>

Inheritance diagram for BPhysicsValidation:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  ParticleMonitor
 

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 BPhysicsValidation (const edm::ParameterSet &)
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 
 ~BPhysicsValidation () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () 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 Member Functions

void FillDaughters (const reco::GenParticle *p)
 

Private Attributes

std::vector< ParticleMonitordaughters
 
edm::InputTag genparticleCollection_
 
edm::EDGetTokenT< reco::GenParticleCollectiongenparticleCollectionToken_
 
std::string name
 
MonitorElementNobj
 
ParticleMonitor particle
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase 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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 34 of file BPhysicsValidation.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file BPhysicsValidation.cc.

References daughters, genparticleCollection_, genparticleCollectionToken_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, name, and AlCaHLTBitMon_QueryRunRegistry::string.

14  : genparticleCollection_(iPSet.getParameter<edm::InputTag>("genparticleCollection")),
15  // do not include weights right now to allow for running on aod
16  name(iPSet.getParameter<std::string>("name")),
17  particle(name, iPSet) {
18  genparticleCollectionToken_ = consumes<reco::GenParticleCollection>(genparticleCollection_);
19  std::vector<std::string> daughterNames = iPSet.getParameter<std::vector<std::string> >("daughters");
20  for (unsigned int i = 0; i < daughterNames.size(); i++) {
21  std::string curSet = daughterNames[i];
22  daughters.push_back(ParticleMonitor(name + curSet, iPSet.getUntrackedParameter<ParameterSet>(curSet)));
23  }
24 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
ParticleMonitor particle
edm::InputTag genparticleCollection_
std::vector< ParticleMonitor > daughters
BPhysicsValidation::~BPhysicsValidation ( )
override

Definition at line 26 of file BPhysicsValidation.cc.

26 {}

Member Function Documentation

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

Reimplemented from DQMEDAnalyzer.

Definition at line 40 of file BPhysicsValidation.cc.

References funct::abs(), BPhysicsValidation::ParticleMonitor::Fill(), dqm::impl::MonitorElement::Fill(), FillDaughters(), genparticleCollectionToken_, genParticles2HepMC_cfi::genParticles, edm::Event::getByToken(), Nobj, particle, and BPhysicsValidation::ParticleMonitor::PDGID().

40  {
42  iEvent.getByToken(genparticleCollectionToken_, genParticles);
43  for (reco::GenParticleCollection::const_iterator iter = genParticles->begin(); iter != genParticles->end(); ++iter) {
44  if (abs(iter->pdgId()) == abs(particle.PDGID())) {
45  Nobj->Fill(0.5, 1.0);
46  particle.Fill(&(*iter), 1.0);
47  FillDaughters(&(*iter));
48  }
49  }
50 }
MonitorElement * Nobj
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
ParticleMonitor particle
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void FillDaughters(const reco::GenParticle *p)
void Fill(const reco::GenParticle *p, double weight)
void BPhysicsValidation::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 30 of file BPhysicsValidation.cc.

References DQMHelper::book1dHisto(), BPhysicsValidation::ParticleMonitor::Configure(), daughters, dqmiolumiharvest::j, name, Nobj, particle, and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

30  {
31  DQMHelper dqm(&i);
32  i.setCurrentFolder("Generator/BPhysics");
33  Nobj = dqm.book1dHisto("N" + name, "N" + name, 1, 0., 1, "bin", "Number of " + name);
35  for (unsigned int j = 0; j < daughters.size(); j++) {
36  daughters[j].Configure(i);
37  }
38 }
void Configure(DQMStore::IBooker &i)
MonitorElement * Nobj
ParticleMonitor particle
std::vector< ParticleMonitor > daughters
void BPhysicsValidation::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
override

Definition at line 28 of file BPhysicsValidation.cc.

28 {}
void BPhysicsValidation::FillDaughters ( const reco::GenParticle p)
private

Definition at line 52 of file BPhysicsValidation.cc.

References funct::abs(), reco::CompositeRefCandidateT< D >::daughter(), daughters, HcalObjRepresent::Fill(), mps_fire::i, reco::CompositeRefCandidateT< D >::numberOfDaughters(), EgammaValidation_cff::pdgid, and reco::LeafCandidate::pdgId().

Referenced by analyze().

52  {
53  int mpdgid = p->pdgId();
54  for (unsigned int i = 0; i < p->numberOfDaughters(); i++) {
55  const reco::GenParticle* dau = static_cast<const reco::GenParticle*>(p->daughter(i));
56  int pdgid = dau->pdgId();
57  for (unsigned int i = 0; i < daughters.size(); i++) {
58  if (abs(mpdgid) != abs(daughters[i].PDGID()) && daughters[i].PDGID() == pdgid)
59  daughters[i].Fill(dau, 1.0);
60  // note: use abs when comparing to mother to avoid mixing
61  }
62  FillDaughters(dau);
63  }
64 }
int pdgId() const final
PDG identifier.
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
size_t numberOfDaughters() const override
number of daughters
void FillDaughters(const reco::GenParticle *p)
std::vector< ParticleMonitor > daughters

Member Data Documentation

std::vector<ParticleMonitor> BPhysicsValidation::daughters
private

Definition at line 87 of file BPhysicsValidation.h.

Referenced by bookHistograms(), BPhysicsValidation(), and FillDaughters().

edm::InputTag BPhysicsValidation::genparticleCollection_
private

Definition at line 83 of file BPhysicsValidation.h.

Referenced by BPhysicsValidation().

edm::EDGetTokenT<reco::GenParticleCollection> BPhysicsValidation::genparticleCollectionToken_
private

Definition at line 84 of file BPhysicsValidation.h.

Referenced by analyze(), and BPhysicsValidation().

std::string BPhysicsValidation::name
private
MonitorElement* BPhysicsValidation::Nobj
private

Definition at line 88 of file BPhysicsValidation.h.

Referenced by analyze(), and bookHistograms().

ParticleMonitor BPhysicsValidation::particle
private

Definition at line 86 of file BPhysicsValidation.h.

Referenced by analyze(), and bookHistograms().