CMS 3D CMS Logo

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

Public Member Functions

 PatMCMatchingExtended (const edm::ParameterSet &)
 default constructor More...
 
 ~PatMCMatchingExtended () override
 default destructor More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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

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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

◆ ~PatMCMatchingExtended()

PatMCMatchingExtended::~PatMCMatchingExtended ( )
override

default destructor

Definition at line 53 of file PatMCMatchingExtended.cc.

53 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 55 of file PatMCMatchingExtended.cc.

55  {
56  // get muon collection
58  iEvent.getByToken(muonSrcToken_, muons);
59 
60  for (edm::View<pat::Muon>::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
61  if (muon->genParticleById(0, 1).isNonnull()) {
62  histContainer_["DR_status1Match"]->Fill(
63  ROOT::Math::VectorUtil::DeltaR(muon->p4(), (muon->genParticleById(0, 1))->p4()));
64  histContainer_["DPt_status1Match"]->Fill(muon->pt() - (muon->genParticleById(0, 1))->pt());
65  }
66  if (muon->genParticleById(0, 3).isNonnull()) {
67  histContainer_["DR_status3Match"]->Fill(
68  ROOT::Math::VectorUtil::DeltaR(muon->p4(), (muon->genParticleById(0, 3))->p4()));
69  histContainer_["DPt_status3Match"]->Fill(muon->pt() - (muon->genParticleById(0, 3))->pt());
70  }
71  if (muon->genParticleById(0, -1).isNonnull()) {
72  histContainer_["DR_defaultMatch"]->Fill(
73  ROOT::Math::VectorUtil::DeltaR(muon->p4(), (muon->genParticleById(0, -1))->p4()));
74  histContainer_["DPt_defaultMatch"]->Fill(muon->pt() - (muon->genParticleById(0, -1))->pt());
75  }
76  if (muon->genParticleById(0, 1).isNull() && muon->genParticleById(0, 3).isNull() &&
77  muon->genParticleById(0, -1).isNull())
78  noMatch++;
79  if (muon->genParticleById(0, 1).isNull() && muon->genParticleById(0, 3).isNull() &&
80  muon->genParticleById(0, -1).isNonnull())
81  decayInFlight++;
82 
83  if (muon->genParticleById(-13, 0, 1).isNonnull()) {
84  diffCharge++;
85  std::cout << " DIFF CHARGE!!! charge gen: " << muon->genParticleById(-13, 0, true)->charge()
86  << " charge reco: " << muon->charge() << std::endl;
87  }
88  numberMuons++;
89  }
90 }

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

◆ beginJob()

void PatMCMatchingExtended::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file PatMCMatchingExtended.cc.

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

References decayInFlight, diffCharge, histContainer_, TFileService::make(), noMatch, and numberMuons.

◆ endJob()

void PatMCMatchingExtended::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file PatMCMatchingExtended.cc.

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

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

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().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
PatMCMatchingExtended::noMatch
unsigned int noMatch
Definition: PatMCMatchingExtended.cc:40
muon
Definition: MuonCocktails.h:17
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
PatMCMatchingExtended::muonSrcToken_
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
Definition: PatMCMatchingExtended.cc:34
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11710
edm::View
Definition: CaloClusterFwd.h:14
PatMCMatchingExtended::numberMuons
unsigned int numberMuons
Definition: PatMCMatchingExtended.cc:46
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
PatMCMatchingExtended::decayInFlight
unsigned int decayInFlight
Definition: PatMCMatchingExtended.cc:43
PatMCMatchingExtended::histContainer_
std::map< std::string, TH1F * > histContainer_
Definition: PatMCMatchingExtended.cc:31
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
PatMCMatchingExtended::diffCharge
unsigned int diffCharge
Definition: PatMCMatchingExtended.cc:37
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64