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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

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 one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

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
 

Detailed Description

Definition at line 37 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.

13  :
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 {
19  genparticleCollectionToken_=consumes<reco::GenParticleCollection>(genparticleCollection_);
20  std::vector<std::string> daughterNames = iPSet.getParameter< std::vector<std::string> >("daughters");
21  for (unsigned int i=0; i<daughterNames.size();i++){
22  std::string curSet = daughterNames[i];
23  daughters.push_back(ParticleMonitor(name+curSet,iPSet.getUntrackedParameter< ParameterSet >(curSet)));
24  }
25 }
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 27 of file BPhysicsValidation.cc.

27 {}

Member Function Documentation

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

Definition at line 38 of file BPhysicsValidation.cc.

References funct::abs(), BPhysicsValidation::ParticleMonitor::Fill(), MonitorElement::Fill(), FillDaughters(), genparticleCollectionToken_, GenHFHadronMatcher_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 &   
)
override

Definition at line 31 of file BPhysicsValidation.cc.

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

31  {
32  DQMHelper dqm(&i); 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++){daughters[j].Configure(i);}
36 }
void Configure(DQMStore::IBooker &i)
MonitorElement * Nobj
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
ParticleMonitor particle
std::vector< ParticleMonitor > daughters
void BPhysicsValidation::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
override

Definition at line 29 of file BPhysicsValidation.cc.

29 {}
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(), BPhysicsValidation_cfi::pdgid, 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)daughters[i].Fill(dau,1.0);
57  // note: use abs when comparing to mother to avoid mixing
58  }
59  FillDaughters(dau);
60  }
61 }
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().