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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 16 of file PatMCMatchingExtended.cc.

Constructor & Destructor Documentation

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

default constructor

Definition at line 49 of file PatMCMatchingExtended.cc.

50  : histContainer_(),
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, TH1F * > histContainer_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
PatMCMatchingExtended::~PatMCMatchingExtended ( )
override

default destructor

Definition at line 53 of file PatMCMatchingExtended.cc.

53 {}

Member Function Documentation

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

Definition at line 55 of file PatMCMatchingExtended.cc.

References gather_cfg::cout, decayInFlight, electronAnalyzer_cfi::DeltaR, diffCharge, edm::Event::getByToken(), histContainer_, HLT_2018_cff::muon, PDWG_BPHSkim_cff::muons, muonSrcToken_, noMatch, numberMuons, p4, and DiDispStaMuonMonitor_cfi::pt.

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 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::map< std::string, TH1F * > histContainer_
double p4[4]
Definition: TauolaWrapper.h:92
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
void PatMCMatchingExtended::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file PatMCMatchingExtended.cc.

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

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 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::map< std::string, TH1F * > histContainer_
void PatMCMatchingExtended::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file PatMCMatchingExtended.cc.

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

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 }

Member Data Documentation

unsigned int PatMCMatchingExtended::decayInFlight
private

Definition at line 43 of file PatMCMatchingExtended.cc.

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

unsigned int PatMCMatchingExtended::diffCharge
private

Definition at line 37 of file PatMCMatchingExtended.cc.

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

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

Definition at line 31 of file PatMCMatchingExtended.cc.

Referenced by analyze(), and beginJob().

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

Definition at line 34 of file PatMCMatchingExtended.cc.

Referenced by analyze().

unsigned int PatMCMatchingExtended::noMatch
private

Definition at line 40 of file PatMCMatchingExtended.cc.

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

unsigned int PatMCMatchingExtended::numberMuons
private

Definition at line 46 of file PatMCMatchingExtended.cc.

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