CMS 3D CMS Logo

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

Public Member Functions

 PatMCMatchingExtended (const edm::ParameterSet &)
 default constructor More...
 
 ~PatMCMatchingExtended () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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

unsigned int decayInFlight
 
unsigned int diffCharge
 
std::map< std::string, TH1F * > histContainer_
 
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
 
unsigned int noMatch
 
unsigned int numberMuons
 

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 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 PatMCMatchingExtended.cc.

Constructor & Destructor Documentation

◆ PatMCMatchingExtended()

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

default constructor

Definition at line 49 of file PatMCMatchingExtended.cc.

References TFileService::kSharedResource.

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

◆ ~PatMCMatchingExtended()

PatMCMatchingExtended::~PatMCMatchingExtended ( )
override

default destructor

Definition at line 55 of file PatMCMatchingExtended.cc.

55 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 57 of file PatMCMatchingExtended.cc.

References gather_cfg::cout, decayInFlight, electronAnalyzer_cfi::DeltaR, diffCharge, histContainer_, iEvent, HLT_2024v11_cff::muon, DiMuonV_cfg::muons, muonSrcToken_, noMatch, numberMuons, and DiDispStaMuonMonitor_cfi::pt.

57  {
58  // get muon collection
60  iEvent.getByToken(muonSrcToken_, muons);
61 
62  for (edm::View<pat::Muon>::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
63  if (muon->genParticleById(0, 1).isNonnull()) {
64  histContainer_["DR_status1Match"]->Fill(
65  ROOT::Math::VectorUtil::DeltaR(muon->p4(), (muon->genParticleById(0, 1))->p4()));
66  histContainer_["DPt_status1Match"]->Fill(muon->pt() - (muon->genParticleById(0, 1))->pt());
67  }
68  if (muon->genParticleById(0, 3).isNonnull()) {
69  histContainer_["DR_status3Match"]->Fill(
70  ROOT::Math::VectorUtil::DeltaR(muon->p4(), (muon->genParticleById(0, 3))->p4()));
71  histContainer_["DPt_status3Match"]->Fill(muon->pt() - (muon->genParticleById(0, 3))->pt());
72  }
73  if (muon->genParticleById(0, -1).isNonnull()) {
74  histContainer_["DR_defaultMatch"]->Fill(
75  ROOT::Math::VectorUtil::DeltaR(muon->p4(), (muon->genParticleById(0, -1))->p4()));
76  histContainer_["DPt_defaultMatch"]->Fill(muon->pt() - (muon->genParticleById(0, -1))->pt());
77  }
78  if (muon->genParticleById(0, 1).isNull() && muon->genParticleById(0, 3).isNull() &&
79  muon->genParticleById(0, -1).isNull())
80  noMatch++;
81  if (muon->genParticleById(0, 1).isNull() && muon->genParticleById(0, 3).isNull() &&
82  muon->genParticleById(0, -1).isNonnull())
83  decayInFlight++;
84 
85  if (muon->genParticleById(-13, 0, 1).isNonnull()) {
86  diffCharge++;
87  std::cout << " DIFF CHARGE!!! charge gen: " << muon->genParticleById(-13, 0, true)->charge()
88  << " charge reco: " << muon->charge() << std::endl;
89  }
90  numberMuons++;
91  }
92 }
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
std::map< std::string, TH1F * > histContainer_
int iEvent
Definition: GenABIO.cc:224
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_

◆ beginJob()

void PatMCMatchingExtended::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 94 of file PatMCMatchingExtended.cc.

References decayInFlight, diffCharge, compareTotals::fs, histContainer_, noMatch, and numberMuons.

94  {
95  // register to the TFileService
97 
98  // book histograms:
99  //DR
100  histContainer_["DR_defaultMatch"] = fs->make<TH1F>("DR_defaultMatch", "DR_defaultMatch", 100, 0, 0.02);
101  histContainer_["DR_status1Match"] = fs->make<TH1F>("DR_status1Match", "DR_status1Match", 100, 0, 0.02);
102  histContainer_["DR_status3Match"] = fs->make<TH1F>("DR_status3Match", "DR_status3Match", 100, 0, 0.02);
103  //DPT
104  histContainer_["DPt_defaultMatch"] = fs->make<TH1F>("DPt_defaultMatch", "DPt_defaultMatch", 10, 0, 1.2);
105  histContainer_["DPt_status1Match"] = fs->make<TH1F>("DPt_status1Match", "DPt_status1Match", 10, 0, 1.2);
106  histContainer_["DPt_status3Match"] = fs->make<TH1F>("DPt_status3Match", "DPt_status3Match", 10, 0, 1.2);
107  //some counters
108  diffCharge = 0;
109  noMatch = 0;
110  decayInFlight = 0;
111  numberMuons = 0;
112 }
std::map< std::string, TH1F * > histContainer_

◆ endJob()

void PatMCMatchingExtended::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 114 of file PatMCMatchingExtended.cc.

References gather_cfg::cout, decayInFlight, diffCharge, noMatch, and numberMuons.

114  {
115  std::cout << "diffcharge: " << diffCharge << std::endl;
116  std::cout << "noMatch: " << noMatch << std::endl;
117  std::cout << "decayInFlight: " << decayInFlight << std::endl;
118  std::cout << "numberMuons: " << numberMuons << std::endl;
119 }

Member Data Documentation

◆ decayInFlight

unsigned int PatMCMatchingExtended::decayInFlight
private

Definition at line 43 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ diffCharge

unsigned int PatMCMatchingExtended::diffCharge
private

Definition at line 37 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ histContainer_

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

Definition at line 31 of file PatMCMatchingExtended.cc.

Referenced by analyze(), and beginJob().

◆ muonSrcToken_

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

Definition at line 34 of file PatMCMatchingExtended.cc.

Referenced by analyze().

◆ noMatch

unsigned int PatMCMatchingExtended::noMatch
private

Definition at line 40 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ numberMuons

unsigned int PatMCMatchingExtended::numberMuons
private

Definition at line 46 of file PatMCMatchingExtended.cc.

Referenced by analyze(), beginJob(), and endJob().