CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

class  ParticleMonitor
 

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
 
 BPhysicsValidation (const edm::ParameterSet &)
 
virtual void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 
virtual ~BPhysicsValidation ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 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
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (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 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(), 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
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::GenParticleCollection > genparticleCollectionToken_
ParticleMonitor particle
edm::InputTag genparticleCollection_
std::vector< ParticleMonitor > daughters
BPhysicsValidation::~BPhysicsValidation ( )
virtual

Definition at line 27 of file BPhysicsValidation.cc.

27 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 38 of file BPhysicsValidation.cc.

References funct::abs(), BPhysicsValidation::ParticleMonitor::Fill(), 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:230
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 31 of file BPhysicsValidation.cc.

References DQMHelper::book1dHisto(), BPhysicsValidation::ParticleMonitor::Configure(), daughters, j, 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
ParticleMonitor particle
int j
Definition: DBlmapReader.cc:9
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
std::vector< ParticleMonitor > daughters
void BPhysicsValidation::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

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(), 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)daughters[i].Fill(dau,1.0);
57  // note: use abs when comparing to mother to avoid mixing
58  }
59  FillDaughters(dau);
60  }
61 }
int i
Definition: DBlmapReader.cc:9
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual size_t numberOfDaughters() const
number of daughters
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void FillDaughters(const reco::GenParticle *p)
virtual int pdgId() const final
PDG identifier.
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().