CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HcalCollapseAnalyzer Class Reference

#include <HcalCollapseAnalyzer.cc>

Inheritance diagram for HcalCollapseAnalyzer:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 HcalCollapseAnalyzer (const edm::ParameterSet &)
 
 ~HcalCollapseAnalyzer () override
 
- 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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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 &)
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

const bool doHB_
 
const bool doHE_
 
MonitorElementh_balance
 
MonitorElementh_depth
 
MonitorElementh_frac
 
MonitorElementh_merge
 
MonitorElementh_sfrac
 
MonitorElementh_size
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordhcalTopologyToken_
 
const edm::InputTag preRecHitHBHE_
 
const edm::InputTag recHitHBHE_
 
const HcalTopologytheHBHETopology = nullptr
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
edm::EDGetTokenT< HBHERecHitCollectiontok_prehbhe_
 
const std::string topFolderName_
 
const int verbosity_
 

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 >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

DQMOffline/Hcal/src/HcalCollapseAnalyzer.cc

Description: Studies the collapsing of HcalRecHits

Implementation: <Notes on="" implementation>="">

Definition at line 47 of file HcalCollapseAnalyzer.cc.

Constructor & Destructor Documentation

◆ HcalCollapseAnalyzer()

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

Definition at line 73 of file HcalCollapseAnalyzer.cc.

74  : topFolderName_(iConfig.getParameter<std::string>("topFolderName")),
75  verbosity_(iConfig.getUntrackedParameter<int>("verbosity", 0)),
76  recHitHBHE_(iConfig.getUntrackedParameter<edm::InputTag>("recHitHBHE", edm::InputTag("hbhereco"))),
77  preRecHitHBHE_(iConfig.getUntrackedParameter<edm::InputTag>("preRecHitHBHE", edm::InputTag("hbheprereco"))),
78  doHE_(iConfig.getUntrackedParameter<bool>("doHE", true)),
79  doHB_(iConfig.getUntrackedParameter<bool>("doHB", false)),
80  hcalTopologyToken_{esConsumes<HcalTopology, HcalRecNumberingRecord>()} {
81  // define tokens for access
82  tok_hbhe_ = consumes<HBHERecHitCollection>(recHitHBHE_);
83  tok_prehbhe_ = consumes<HBHERecHitCollection>(preRecHitHBHE_);
84 
85  edm::LogVerbatim("Collapse") << "Verbosity " << verbosity_ << " with tags " << recHitHBHE_ << " and "
86  << preRecHitHBHE_ << " and Do " << doHB_ << ":" << doHE_;
87 }

◆ ~HcalCollapseAnalyzer()

HcalCollapseAnalyzer::~HcalCollapseAnalyzer ( )
inlineoverride

Definition at line 50 of file HcalCollapseAnalyzer.cc.

50 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 100 of file HcalCollapseAnalyzer.cc.

100  {
101  if (verbosity_ > 0)
102  edm::LogVerbatim("Collapse") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event()
103  << " starts ==============";
104 
105  theHBHETopology = &iSetup.getData(hcalTopologyToken_);
106 
108  iEvent.getByToken(tok_hbhe_, hbhereco);
110  iEvent.getByToken(tok_prehbhe_, hbheprereco);
111  if (verbosity_ > 0) {
112  edm::LogVerbatim("Collapse") << "Handle Reco " << hbhereco << " Size " << hbhereco->size();
113  edm::LogVerbatim("Collapse") << "Handle PreReco " << hbheprereco << " Size " << hbheprereco->size();
114  }
115  if (hbhereco.isValid() && hbheprereco.isValid()) {
116  const HBHERecHitCollection *recohbhe = hbhereco.product();
117  const HBHERecHitCollection *prerecohbhe = hbheprereco.product();
118  if (verbosity_ > 0)
119  edm::LogVerbatim("Collapse") << "Size of hbhereco: " << recohbhe->size()
120  << " and hbheprereco: " << prerecohbhe->size();
121  double sfrac = (prerecohbhe->empty()) ? 1 : ((double)(recohbhe->size())) / ((double)(prerecohbhe->size()));
122  h_sfrac->Fill(sfrac);
123  h_size->Fill(recohbhe->size());
124  for (const auto &hit : (*recohbhe)) {
125  HcalDetId id = hit.id();
126  if (((id.subdet() == HcalEndcap) && doHE_) || ((id.subdet() == HcalBarrel) && doHB_)) {
127  h_depth->Fill(id.depth());
128  std::vector<HcalDetId> ids;
130  if (verbosity_ > 0) {
131  edm::LogVerbatim("Collapse") << id << " is derived from " << ids.size() << " components";
132  for (unsigned int k = 0; k < ids.size(); ++k)
133  edm::LogVerbatim("Collapse") << "[" << k << "] " << ids[k];
134  }
135  h_merge->Fill(ids.size());
136  double energy = hit.energy();
137  double etot(0);
138  unsigned int k(0);
139  for (const auto phit : (*prerecohbhe)) {
140  if (std::find(ids.begin(), ids.end(), phit.id()) != ids.end()) {
141  etot += phit.energy();
142  double frac = (energy > 0) ? phit.energy() / energy : 1.0;
143  h_frac->Fill(frac);
144  if (verbosity_ > 0)
145  edm::LogVerbatim("Collapse") << "Frac[" << k << "] " << frac << " for " << phit.id();
146  ++k;
147  }
148  }
149  double frac = (energy > 0) ? etot / energy : 1.0;
150  h_balance->Fill(frac);
151  if (verbosity_ > 0)
152  edm::LogVerbatim("Collapse") << "Total energy " << energy << ":" << etot << ":" << frac;
153  }
154  }
155  }
156 }

References LEDCalibrationChannels::depth, doHB_, doHE_, edm::SortedCollection< T, SORT >::empty(), HCALHighEnergyHPDFilter_cfi::energy, dqm::impl::MonitorElement::Fill(), spr::find(), DivergingColor::frac, edm::EventSetup::getData(), h_balance, h_depth, h_frac, h_merge, h_sfrac, h_size, hcalLocalReco_cff::hbheprereco, hcalcalib_dqm_sourceclient-live_cfg::hbhereco, HcalBarrel, HcalEndcap, hcalTopologyToken_, hit::id, iEvent, dqmdumpme::k, edm::SortedCollection< T, SORT >::size(), theHBHETopology, tok_hbhe_, tok_prehbhe_, HcalTopology::unmergeDepthDetId(), and verbosity_.

◆ bookHistograms()

void HcalCollapseAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 158 of file HcalCollapseAnalyzer.cc.

158  {
159  // Book histograms
161  h_merge = ibooker.book1D("h_merge", "Number of hits merged", 10, 0.0, 10.0);
162  h_size = ibooker.book1D("h_size", "Size of the RecHit collection", 100, 500.0, 1500.0);
163  h_depth = ibooker.book1D("h_depth", "Depth of the Id's used", 10, 0.0, 10.0);
164  h_sfrac = ibooker.book1D("h_sfrac", "Ratio of sizes of preRecHit and RecHit collections", 150, 0.0, 1.5);
165  h_frac = ibooker.book1D("h_frac", "Fraction of energy before collapse", 150, 0.0, 1.5);
166  h_balance = ibooker.book1D("h_balance", "Balance of energy between pre- and post-collapse", 100, 0.5, 1.5);
167 }

References dqm::implementation::IBooker::book1D(), h_balance, h_depth, h_frac, h_merge, h_sfrac, h_size, dqm::implementation::NavigatorBase::setCurrentFolder(), and topFolderName_.

◆ fillDescriptions()

void HcalCollapseAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 89 of file HcalCollapseAnalyzer.cc.

89  {
91  desc.add<std::string>("topFolderName", "HcalCollapse");
92  desc.addUntracked<int>("verbosity", 0);
93  desc.addUntracked<edm::InputTag>("recHitHBHE", edm::InputTag("hbhereco"));
94  desc.addUntracked<edm::InputTag>("preRecHitHBHE", edm::InputTag("hbheprereco"));
95  desc.addUntracked<bool>("doHE", true);
96  desc.addUntracked<bool>("doHB", false);
97  descriptions.add("hcalCollapseAnalyzer", desc);
98 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ doHB_

const bool HcalCollapseAnalyzer::doHB_
private

Definition at line 62 of file HcalCollapseAnalyzer.cc.

Referenced by analyze().

◆ doHE_

const bool HcalCollapseAnalyzer::doHE_
private

Definition at line 62 of file HcalCollapseAnalyzer.cc.

Referenced by analyze().

◆ h_balance

MonitorElement * HcalCollapseAnalyzer::h_balance
private

Definition at line 70 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

◆ h_depth

MonitorElement * HcalCollapseAnalyzer::h_depth
private

Definition at line 69 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

◆ h_frac

MonitorElement * HcalCollapseAnalyzer::h_frac
private

Definition at line 70 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

◆ h_merge

MonitorElement* HcalCollapseAnalyzer::h_merge
private

Definition at line 69 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

◆ h_sfrac

MonitorElement* HcalCollapseAnalyzer::h_sfrac
private

Definition at line 70 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

◆ h_size

MonitorElement * HcalCollapseAnalyzer::h_size
private

Definition at line 69 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

◆ hcalTopologyToken_

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> HcalCollapseAnalyzer::hcalTopologyToken_
private

Definition at line 67 of file HcalCollapseAnalyzer.cc.

Referenced by analyze().

◆ preRecHitHBHE_

const edm::InputTag HcalCollapseAnalyzer::preRecHitHBHE_
private

Definition at line 61 of file HcalCollapseAnalyzer.cc.

◆ recHitHBHE_

const edm::InputTag HcalCollapseAnalyzer::recHitHBHE_
private

Definition at line 61 of file HcalCollapseAnalyzer.cc.

◆ theHBHETopology

const HcalTopology* HcalCollapseAnalyzer::theHBHETopology = nullptr
private

Definition at line 63 of file HcalCollapseAnalyzer.cc.

Referenced by analyze().

◆ tok_hbhe_

edm::EDGetTokenT<HBHERecHitCollection> HcalCollapseAnalyzer::tok_hbhe_
private

Definition at line 65 of file HcalCollapseAnalyzer.cc.

Referenced by analyze().

◆ tok_prehbhe_

edm::EDGetTokenT<HBHERecHitCollection> HcalCollapseAnalyzer::tok_prehbhe_
private

Definition at line 66 of file HcalCollapseAnalyzer.cc.

Referenced by analyze().

◆ topFolderName_

const std::string HcalCollapseAnalyzer::topFolderName_
private

Definition at line 59 of file HcalCollapseAnalyzer.cc.

Referenced by bookHistograms().

◆ verbosity_

const int HcalCollapseAnalyzer::verbosity_
private

Definition at line 60 of file HcalCollapseAnalyzer.cc.

Referenced by analyze().

hcalcalib_dqm_sourceclient-live_cfg.hbhereco
hbhereco
Definition: hcalcalib_dqm_sourceclient-live_cfg.py:104
HcalCollapseAnalyzer::h_balance
MonitorElement * h_balance
Definition: HcalCollapseAnalyzer.cc:70
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
HcalCollapseAnalyzer::doHB_
const bool doHB_
Definition: HcalCollapseAnalyzer.cc:62
HcalCollapseAnalyzer::h_size
MonitorElement * h_size
Definition: HcalCollapseAnalyzer.cc:69
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::SortedCollection
Definition: SortedCollection.h:49
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
HcalCollapseAnalyzer::h_sfrac
MonitorElement * h_sfrac
Definition: HcalCollapseAnalyzer.cc:70
HcalCollapseAnalyzer::verbosity_
const int verbosity_
Definition: HcalCollapseAnalyzer.cc:60
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HcalCollapseAnalyzer::h_merge
MonitorElement * h_merge
Definition: HcalCollapseAnalyzer.cc:69
HcalBarrel
Definition: HcalAssistant.h:33
HcalCollapseAnalyzer::hcalTopologyToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > hcalTopologyToken_
Definition: HcalCollapseAnalyzer.cc:67
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
HcalCollapseAnalyzer::recHitHBHE_
const edm::InputTag recHitHBHE_
Definition: HcalCollapseAnalyzer.cc:61
DivergingColor.frac
float frac
Definition: DivergingColor.py:175
HcalCollapseAnalyzer::doHE_
const bool doHE_
Definition: HcalCollapseAnalyzer.cc:62
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
hcalLocalReco_cff.hbheprereco
hbheprereco
Definition: hcalLocalReco_cff.py:9
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
HcalCollapseAnalyzer::h_depth
MonitorElement * h_depth
Definition: HcalCollapseAnalyzer.cc:69
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
dqmdumpme.k
k
Definition: dqmdumpme.py:60
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HcalCollapseAnalyzer::preRecHitHBHE_
const edm::InputTag preRecHitHBHE_
Definition: HcalCollapseAnalyzer.cc:61
HcalCollapseAnalyzer::tok_hbhe_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
Definition: HcalCollapseAnalyzer.cc:65
HcalDetId
Definition: HcalDetId.h:12
iEvent
int iEvent
Definition: GenABIO.cc:224
HcalCollapseAnalyzer::topFolderName_
const std::string topFolderName_
Definition: HcalCollapseAnalyzer.cc:59
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HcalEndcap
Definition: HcalAssistant.h:34
HcalCollapseAnalyzer::theHBHETopology
const HcalTopology * theHBHETopology
Definition: HcalCollapseAnalyzer.cc:63
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HcalCollapseAnalyzer::tok_prehbhe_
edm::EDGetTokenT< HBHERecHitCollection > tok_prehbhe_
Definition: HcalCollapseAnalyzer.cc:66
HcalTopology::unmergeDepthDetId
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:168
HcalCollapseAnalyzer::h_frac
MonitorElement * h_frac
Definition: HcalCollapseAnalyzer.cc:70
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
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
edm::SortedCollection::empty
bool empty() const
Definition: SortedCollection.h:210