CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

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 &)
 
 ~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
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void FillDaughters (const reco::GenParticle *p)
 

Private Attributes

std::vector< ParticleMonitordaughters
 
edm::InputTag genparticleCollection_
 
edm::EDGetTokenT
< reco::GenParticleCollection
genparticleCollectionToken_
 
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::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

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 getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
ParticleMonitor particle
edm::InputTag genparticleCollection_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 &  iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 38 of file BPhysicsValidation.cc.

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

38  {
40  iEvent.getByToken(genparticleCollectionToken_, genParticles);
41  for (reco::GenParticleCollection::const_iterator iter = genParticles->begin(); iter != genParticles->end(); ++iter) {
42  if (abs(iter->pdgId()) == abs(particle.PDGID())) {
43  Nobj->Fill(0.5, 1.0);
44  particle.Fill(&(*iter), 1.0);
45  FillDaughters(&(*iter));
46  }
47  }
48 }
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 28 of file BPhysicsValidation.cc.

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

28  {
29  DQMHelper dqm(&i);
30  i.setCurrentFolder("Generator/BPhysics");
31  Nobj = dqm.book1dHisto("N" + name, "N" + name, 1, 0., 1, "bin", "Number of " + name);
33  for (unsigned int j = 0; j < daughters.size(); j++) {
34  daughters[j].Configure(i);
35  }
36 }
void Configure(DQMStore::IBooker &i)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * Nobj
ParticleMonitor particle
std::vector< ParticleMonitor > daughters
void BPhysicsValidation::FillDaughters ( const reco::GenParticle p)
private

Definition at line 50 of file BPhysicsValidation.cc.

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

Referenced by analyze().

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

Member Data Documentation

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

Definition at line 86 of file BPhysicsValidation.h.

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

edm::InputTag BPhysicsValidation::genparticleCollection_
private

Definition at line 82 of file BPhysicsValidation.h.

Referenced by BPhysicsValidation().

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

Definition at line 83 of file BPhysicsValidation.h.

Referenced by analyze(), and BPhysicsValidation().

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

Definition at line 87 of file BPhysicsValidation.h.

Referenced by analyze(), and bookHistograms().

ParticleMonitor BPhysicsValidation::particle
private

Definition at line 85 of file BPhysicsValidation.h.

Referenced by analyze(), and bookHistograms().