CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
PFCandidateAnalyzerDQM Class Reference
Inheritance diagram for PFCandidateAnalyzerDQM:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 PFCandidateAnalyzerDQM (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Attributes

std::vector< double > etabins
 
std::map< std::string, MonitorElement * > me
 
std::map< uint32_t, std::string > pdgMap
 
edm::InputTag PFCandTag
 
edm::EDGetTokenT< edm::View< pat::PackedCandidate > > PFCandToken
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 35 of file PFCandidateAnalyzerDQM.cc.

Constructor & Destructor Documentation

◆ PFCandidateAnalyzerDQM()

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

Definition at line 54 of file PFCandidateAnalyzerDQM.cc.

54  {
55  PFCandTag = iConfig.getParameter<edm::InputTag>("PFCandType");
56  PFCandToken = consumes<edm::View<pat::PackedCandidate>>(PFCandTag);
57  etabins = iConfig.getParameter<std::vector<double>>("etabins");
58 
59  //create map of pdgId
60  std::vector<uint32_t> pdgKeys = iConfig.getParameter<std::vector<uint32_t>>("pdgKeys");
61  std::vector<std::string> pdgStrs = iConfig.getParameter<std::vector<std::string>>("pdgStrs");
62  for (int i = 0, n = pdgKeys.size(); i < n; i++)
63  pdgMap[pdgKeys[i]] = pdgStrs[i];
64 }

References etabins, edm::ParameterSet::getParameter(), mps_fire::i, dqmiodumpmetadata::n, offsetAnalyzerDQM_cff::pdgKeys, pdgMap, offsetAnalyzerDQM_cff::pdgStrs, PFCandTag, and PFCandToken.

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 111 of file PFCandidateAnalyzerDQM.cc.

111  {
112  //retrieve
114  iEvent.getByToken(PFCandToken, pfHandle);
115 
116  if (!pfHandle.isValid()) {
117  edm::LogInfo("OutputInfo") << " failed to retrieve data required by ParticleFlow Task";
118  edm::LogInfo("OutputInfo") << " ParticleFlow Task cannot continue...!";
119  return;
120  } else {
121  //Analyze
122  // Loop Over Particle Flow Candidates
123 
124  for (unsigned int i = 0; i < pfHandle->size(); i++) {
125  // Fill Histograms for Candidate Methods
126  // all candidates
127  me["AllCandidateLog10Pt"]->Fill(log10(pfHandle->at(i).pt()));
128  me["AllCandidateEta"]->Fill(pfHandle->at(i).eta());
129  me["AllCandidatePhi"]->Fill(pfHandle->at(i).phi());
130  me["AllCandidateCharge"]->Fill(pfHandle->at(i).charge());
131  me["AllCandidatePtLow"]->Fill(pfHandle->at(i).pt());
132  me["AllCandidatePtMid"]->Fill(pfHandle->at(i).pt());
133  me["AllCandidatePtHigh"]->Fill(pfHandle->at(i).pt());
134 
135  int pdgId = abs(pfHandle->at(i).pdgId());
136  if (pdgMap.find(pdgId) != pdgMap.end()) {
137  me[pdgMap[pdgId] + "Log10Pt"]->Fill(log10(pfHandle->at(i).pt()));
138  me[pdgMap[pdgId] + "Eta"]->Fill(pfHandle->at(i).eta());
139  me[pdgMap[pdgId] + "Phi"]->Fill(pfHandle->at(i).phi());
140  me[pdgMap[pdgId] + "Charge"]->Fill(pfHandle->at(i).charge());
141  me[pdgMap[pdgId] + "PtLow"]->Fill(pfHandle->at(i).pt());
142  me[pdgMap[pdgId] + "PtMid"]->Fill(pfHandle->at(i).pt());
143  me[pdgMap[pdgId] + "PtHigh"]->Fill(pfHandle->at(i).pt());
144  }
145  }
146  }
147 }

References funct::abs(), mps_fire::i, iEvent, edm::HandleBase::isValid(), me, EgammaValidation_cff::pdgId, pdgMap, and PFCandToken.

◆ bookHistograms()

void PFCandidateAnalyzerDQM::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 66 of file PFCandidateAnalyzerDQM.cc.

66  {
67  // all candidate
68  booker.setCurrentFolder("ParticleFlow/PackedCandidates/AllCandidate");
69 
70  // for eta binning
71  int n = etabins.size() - 1;
72  float etabinArray[etabins.size()];
73  std::copy(etabins.begin(), etabins.end(), etabinArray);
74 
75  //eta has variable bin sizes, use 4th def of TH1F constructor
76  TH1F* etaHist = new TH1F("AllCandidateEta", "AllCandidateEta", n, etabinArray);
77  me["AllCandidateEta"] = booker.book1D("AllCandidateEta", etaHist);
78 
79  me["AllCandidateLog10Pt"] = booker.book1D("AllCandidateLog10Pt", "AllCandidateLog10Pt", 120, -2, 4);
80 
81  //for phi binnings
82  double nPhiBins = 73;
83  double phiBinWidth = M_PI / (nPhiBins - 1) * 2.;
84  me["AllCandidatePhi"] = booker.book1D(
85  "AllCandidatePhi", "AllCandidatePhi", nPhiBins, -M_PI - 0.25 * phiBinWidth, +M_PI + 0.75 * phiBinWidth);
86 
87  me["AllCandidateCharge"] = booker.book1D("AllCandidateCharge", "AllCandidateCharge", 3, -1.5, 1.5);
88  me["AllCandidatePtLow"] = booker.book1D("AllCandidatePtLow", "AllCandidatePtLow", 100, 0., 5.);
89  me["AllCandidatePtMid"] = booker.book1D("AllCandidatePtMid", "AllCandidatePtMid", 100, 0., 200.);
90  me["AllCandidatePtHigh"] = booker.book1D("AllCandidatePtHigh", "AllCandidatePtHigh", 100, 0., 1000.);
91 
92  std::string etaHistName;
93  for (auto& pair : pdgMap) {
94  booker.setCurrentFolder("ParticleFlow/PackedCandidates/" + pair.second);
95 
96  //TH1F only takes char*, so have to do conversions for histogram name
97  etaHistName = pair.second + "Eta";
98  TH1F* etaHist = new TH1F(etaHistName.c_str(), etaHistName.c_str(), n, etabinArray);
99  me[pair.second + "Eta"] = booker.book1D(pair.second + "Eta", etaHist);
100 
101  me[pair.second + "Log10Pt"] = booker.book1D(pair.second + "Log10Pt", pair.second + "Log10Pt", 120, -2, 4);
102  me[pair.second + "Phi"] = booker.book1D(
103  pair.second + "Phi", pair.second + "Phi", nPhiBins, -M_PI - 0.25 * phiBinWidth, +M_PI + 0.75 * phiBinWidth);
104  me[pair.second + "Charge"] = booker.book1D(pair.second + "Charge", pair.second + "Charge", 3, -1.5, 1.5);
105  me[pair.second + "PtLow"] = booker.book1D(pair.second + "PtLow", pair.second + "PtLow", 100, 0., 5.);
106  me[pair.second + "PtMid"] = booker.book1D(pair.second + "PtMid", pair.second + "PtMid", 100, 0., 200.);
107  me[pair.second + "PtHigh"] = booker.book1D(pair.second + "PtHigh", pair.second + "PtHigh", 100, 0., 1000.);
108  }
109 }

References dqm::implementation::IBooker::book1D(), filterCSVwithJSON::copy, etabins, M_PI, me, dqmiodumpmetadata::n, ecaldqm::binning::nPhiBins, pdgMap, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ etabins

std::vector<double> PFCandidateAnalyzerDQM::etabins
private

Definition at line 47 of file PFCandidateAnalyzerDQM.cc.

Referenced by bookHistograms(), and PFCandidateAnalyzerDQM().

◆ me

std::map<std::string, MonitorElement*> PFCandidateAnalyzerDQM::me
private

Definition at line 48 of file PFCandidateAnalyzerDQM.cc.

Referenced by analyze(), and bookHistograms().

◆ pdgMap

std::map<uint32_t, std::string> PFCandidateAnalyzerDQM::pdgMap
private

Definition at line 50 of file PFCandidateAnalyzerDQM.cc.

Referenced by analyze(), bookHistograms(), and PFCandidateAnalyzerDQM().

◆ PFCandTag

edm::InputTag PFCandidateAnalyzerDQM::PFCandTag
private

Definition at line 45 of file PFCandidateAnalyzerDQM.cc.

Referenced by PFCandidateAnalyzerDQM().

◆ PFCandToken

edm::EDGetTokenT<edm::View<pat::PackedCandidate> > PFCandidateAnalyzerDQM::PFCandToken
private

Definition at line 46 of file PFCandidateAnalyzerDQM.cc.

Referenced by analyze(), and PFCandidateAnalyzerDQM().

mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
offsetAnalyzerDQM_cff.pdgKeys
pdgKeys
Definition: offsetAnalyzerDQM_cff.py:70
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
PFCandidateAnalyzerDQM::pdgMap
std::map< uint32_t, std::string > pdgMap
Definition: PFCandidateAnalyzerDQM.cc:50
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
PFCandidateAnalyzerDQM::me
std::map< std::string, MonitorElement * > me
Definition: PFCandidateAnalyzerDQM.cc:48
PFCandidateAnalyzerDQM::PFCandToken
edm::EDGetTokenT< edm::View< pat::PackedCandidate > > PFCandToken
Definition: PFCandidateAnalyzerDQM.cc:46
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
iEvent
int iEvent
Definition: GenABIO.cc:224
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
offsetAnalyzerDQM_cff.pdgStrs
pdgStrs
Definition: offsetAnalyzerDQM_cff.py:71
PFCandidateAnalyzerDQM::PFCandTag
edm::InputTag PFCandTag
Definition: PFCandidateAnalyzerDQM.cc:45
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ecaldqm::binning::nPhiBins
Definition: MESetBinningUtils.h:70
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PFCandidateAnalyzerDQM::etabins
std::vector< double > etabins
Definition: PFCandidateAnalyzerDQM.cc:47
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98