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::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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
 
const edm::InputTag preRecHitHBHE_
 
const edm::InputTag recHitHBHE_
 
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::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 71 of file HcalCollapseAnalyzer.cc.

References doHB_, doHE_, preRecHitHBHE_, recHitHBHE_, tok_hbhe_, tok_prehbhe_, and verbosity_.

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

Definition at line 50 of file HcalCollapseAnalyzer.cc.

References analyze(), bookHistograms(), and fillDescriptions().

50 {}

Member Function Documentation

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

Reimplemented from DQMEDAnalyzer.

Definition at line 97 of file HcalCollapseAnalyzer.cc.

References LEDCalibrationChannels::depth, doHB_, doHE_, edm::SortedCollection< T, SORT >::empty(), HCALHighEnergyHPDFilter_cfi::energy, edm::EventID::event(), dqm::impl::MonitorElement::Fill(), spr::find(), cropTnPTrees::frac, edm::EventSetup::get(), edm::Event::getByToken(), h_balance, h_depth, h_frac, h_merge, h_sfrac, h_size, hcalLocalReco_cff::hbheprereco, hcalcalib_dqm_sourceclient-live_cfg::hbhereco, HcalBarrel, HcalEndcap, edm::EventBase::id(), hit::id, photons_cff::ids, edm::HandleBase::isValid(), dqmdumpme::k, edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::EventID::run(), edm::SortedCollection< T, SORT >::size(), tok_hbhe_, tok_prehbhe_, HcalTopology::unmergeDepthDetId(), and verbosity_.

Referenced by ~HcalCollapseAnalyzer().

97  {
98  if (verbosity_ > 0)
99  edm::LogVerbatim("Collapse") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event()
100  << " starts ==============";
101 
103  iSetup.get<HcalRecNumberingRecord>().get(htopo);
104  const HcalTopology *theHBHETopology = htopo.product();
105 
107  iEvent.getByToken(tok_hbhe_, hbhereco);
109  iEvent.getByToken(tok_prehbhe_, hbheprereco);
110  if (verbosity_ > 0) {
111  edm::LogVerbatim("Collapse") << "Handle Reco " << hbhereco << " Size " << hbhereco->size();
112  edm::LogVerbatim("Collapse") << "Handle PreReco " << hbheprereco << " Size " << hbheprereco->size();
113  }
114  if (hbhereco.isValid() && hbheprereco.isValid()) {
115  const HBHERecHitCollection *recohbhe = hbhereco.product();
116  const HBHERecHitCollection *prerecohbhe = hbheprereco.product();
117  if (verbosity_ > 0)
118  edm::LogVerbatim("Collapse") << "Size of hbhereco: " << recohbhe->size()
119  << " and hbheprereco: " << prerecohbhe->size();
120  double sfrac = (prerecohbhe->empty()) ? 1 : ((double)(recohbhe->size())) / ((double)(prerecohbhe->size()));
121  h_sfrac->Fill(sfrac);
122  h_size->Fill(recohbhe->size());
123  for (const auto &hit : (*recohbhe)) {
124  HcalDetId id = hit.id();
125  if (((id.subdet() == HcalEndcap) && doHE_) || ((id.subdet() == HcalBarrel) && doHB_)) {
126  h_depth->Fill(id.depth());
127  std::vector<HcalDetId> ids;
128  theHBHETopology->unmergeDepthDetId(id, ids);
129  if (verbosity_ > 0) {
130  edm::LogVerbatim("Collapse") << id << " is derived from " << ids.size() << " components";
131  for (unsigned int k = 0; k < ids.size(); ++k)
132  edm::LogVerbatim("Collapse") << "[" << k << "] " << ids[k];
133  }
134  h_merge->Fill(ids.size());
135  double energy = hit.energy();
136  double etot(0);
137  unsigned int k(0);
138  for (const auto phit : (*prerecohbhe)) {
139  if (std::find(ids.begin(), ids.end(), phit.id()) != ids.end()) {
140  etot += phit.energy();
141  double frac = (energy > 0) ? phit.energy() / energy : 1.0;
142  h_frac->Fill(frac);
143  if (verbosity_ > 0)
144  edm::LogVerbatim("Collapse") << "Frac[" << k << "] " << frac << " for " << phit.id();
145  ++k;
146  }
147  }
148  double frac = (energy > 0) ? etot / energy : 1.0;
149  h_balance->Fill(frac);
150  if (verbosity_ > 0)
151  edm::LogVerbatim("Collapse") << "Total energy " << energy << ":" << etot << ":" << frac;
152  }
153  }
154  }
155 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:168
bool isValid() const
Definition: HandleBase.h:70
unsigned int id
T const * product() const
Definition: Handle.h:69
edm::EDGetTokenT< HBHERecHitCollection > tok_prehbhe_
size_type size() const
MonitorElement * h_balance
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
void HcalCollapseAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 157 of file HcalCollapseAnalyzer.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), DEFINE_FWK_MODULE, h_balance, h_depth, h_frac, h_merge, h_sfrac, h_size, dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), and topFolderName_.

Referenced by ~HcalCollapseAnalyzer().

157  {
158  // Book histograms
159  ibooker.setCurrentFolder(topFolderName_);
160  h_merge = ibooker.book1D("h_merge", "Number of hits merged", 10, 0.0, 10.0);
161  h_size = ibooker.book1D("h_size", "Size of the RecHit collection", 100, 500.0, 1500.0);
162  h_depth = ibooker.book1D("h_depth", "Depth of the Id's used", 10, 0.0, 10.0);
163  h_sfrac = ibooker.book1D("h_sfrac", "Ratio of sizes of preRecHit and RecHit collections", 150, 0.0, 1.5);
164  h_frac = ibooker.book1D("h_frac", "Fraction of energy before collapse", 150, 0.0, 1.5);
165  h_balance = ibooker.book1D("h_balance", "Balance of energy between pre- and post-collapse", 100, 0.5, 1.5);
166 }
const std::string topFolderName_
MonitorElement * h_balance
void HcalCollapseAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 86 of file HcalCollapseAnalyzer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~HcalCollapseAnalyzer().

86  {
88  desc.add<std::string>("topFolderName", "HcalCollapse");
89  desc.addUntracked<int>("verbosity", 0);
90  desc.addUntracked<edm::InputTag>("recHitHBHE", edm::InputTag("hbhereco"));
91  desc.addUntracked<edm::InputTag>("preRecHitHBHE", edm::InputTag("hbheprereco"));
92  desc.addUntracked<bool>("doHE", true);
93  desc.addUntracked<bool>("doHB", false);
94  descriptions.add("hcalCollapseAnalyzer", desc);
95 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

const bool HcalCollapseAnalyzer::doHB_
private

Definition at line 62 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and HcalCollapseAnalyzer().

const bool HcalCollapseAnalyzer::doHE_
private

Definition at line 62 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and HcalCollapseAnalyzer().

MonitorElement * HcalCollapseAnalyzer::h_balance
private

Definition at line 68 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HcalCollapseAnalyzer::h_depth
private

Definition at line 67 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HcalCollapseAnalyzer::h_frac
private

Definition at line 68 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalCollapseAnalyzer::h_merge
private

Definition at line 67 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalCollapseAnalyzer::h_sfrac
private

Definition at line 68 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HcalCollapseAnalyzer::h_size
private

Definition at line 67 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and bookHistograms().

const edm::InputTag HcalCollapseAnalyzer::preRecHitHBHE_
private

Definition at line 61 of file HcalCollapseAnalyzer.cc.

Referenced by HcalCollapseAnalyzer().

const edm::InputTag HcalCollapseAnalyzer::recHitHBHE_
private

Definition at line 61 of file HcalCollapseAnalyzer.cc.

Referenced by HcalCollapseAnalyzer().

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

Definition at line 64 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and HcalCollapseAnalyzer().

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

Definition at line 65 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and HcalCollapseAnalyzer().

const std::string HcalCollapseAnalyzer::topFolderName_
private

Definition at line 59 of file HcalCollapseAnalyzer.cc.

Referenced by bookHistograms().

const int HcalCollapseAnalyzer::verbosity_
private

Definition at line 60 of file HcalCollapseAnalyzer.cc.

Referenced by analyze(), and HcalCollapseAnalyzer().