CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PatMCMatching Class Reference
Inheritance diagram for PatMCMatching:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 PatMCMatching (const edm::ParameterSet &)
 default constructor More...
 
 ~PatMCMatching () override
 default destructor More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

std::map< std::string, TH1F * > histContainer_
 
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 16 of file PatMCMatching.cc.

Constructor & Destructor Documentation

◆ PatMCMatching()

PatMCMatching::PatMCMatching ( const edm::ParameterSet iConfig)
explicit

default constructor

Definition at line 37 of file PatMCMatching.cc.

References TFileService::kSharedResource.

38  : histContainer_(),
40  usesResource(TFileService::kSharedResource);
41 }
static const std::string kSharedResource
Definition: TFileService.h:76
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, TH1F * > histContainer_
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_

◆ ~PatMCMatching()

PatMCMatching::~PatMCMatching ( )
override

default destructor

Definition at line 43 of file PatMCMatching.cc.

43 {}

Member Function Documentation

◆ analyze()

void PatMCMatching::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 45 of file PatMCMatching.cc.

References electronAnalyzer_cfi::DeltaR, histContainer_, mps_fire::i, iEvent, HLT_2022v11_cff::muon, PDWG_BPHSkim_cff::muons, and muonSrcToken_.

45  {
46  // get muon collection
48  iEvent.getByToken(muonSrcToken_, muons);
49 
50  for (edm::View<pat::Muon>::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
51  for (unsigned int i = 0; i < muon->genParticleRefs().size(); ++i) {
52  switch (muon->genParticle(i)->status()) {
53  case 1:
54  histContainer_["DR_status1Match"]->Fill(
55  ROOT::Math::VectorUtil::DeltaR(muon->p4(), muon->genParticle(i)->p4()));
56  break;
57  case 3:
58  histContainer_["DR_status3Match"]->Fill(
59  ROOT::Math::VectorUtil::DeltaR(muon->p4(), muon->genParticle(i)->p4()));
60  break;
61  default:
62  histContainer_["DR_defaultMatch"]->Fill(
63  ROOT::Math::VectorUtil::DeltaR(muon->p4(), muon->genParticle(i)->p4()));
64  break;
65  }
66  }
67  }
68 }
int iEvent
Definition: GenABIO.cc:224
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
std::map< std::string, TH1F * > histContainer_
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_

◆ beginJob()

void PatMCMatching::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 70 of file PatMCMatching.cc.

References compareTotals::fs, and histContainer_.

70  {
71  // register to the TFileService
73 
74  // book histograms:
75  histContainer_["DR_defaultMatch"] = fs->make<TH1F>("DR_defaultMatch", "DR_defaultMatch", 100, 0., 0.02);
76  histContainer_["DR_status1Match"] = fs->make<TH1F>("DR_status1Match", "DR_status1Match", 100, 0., 0.02);
77  histContainer_["DR_status3Match"] = fs->make<TH1F>("DR_status3Match", "DR_status3Match", 100, 0., 0.02);
78 }
std::map< std::string, TH1F * > histContainer_

◆ endJob()

void PatMCMatching::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 80 of file PatMCMatching.cc.

80 {}

Member Data Documentation

◆ histContainer_

std::map<std::string, TH1F*> PatMCMatching::histContainer_
private

Definition at line 31 of file PatMCMatching.cc.

Referenced by analyze(), and beginJob().

◆ muonSrcToken_

edm::EDGetTokenT<edm::View<pat::Muon> > PatMCMatching::muonSrcToken_
private

Definition at line 34 of file PatMCMatching.cc.

Referenced by analyze().