CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ESOccupancyTask Class Reference

#include <ESOccupancyTask.h>

Inheritance diagram for ESOccupancyTask:
DQMOneEDAnalyzer<> edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args...> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ESOccupancyTask (const edm::ParameterSet &ps)
 
 ~ESOccupancyTask () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer<>
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
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::Accumulator, Args...>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
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
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

int eCount_
 
MonitorElementhE1E2_ [2]
 
MonitorElementhEnDensity_ [2][2]
 
MonitorElementhEng_ [2][2]
 
MonitorElementhEvEng_ [2][2]
 
MonitorElementhGoodRecNHit_ [2][2]
 
MonitorElementhRecNHit_ [2][2]
 
MonitorElementhRecOCC_ [2][2]
 
MonitorElementhSelEnDensity_ [2][2]
 
MonitorElementhSelEng_ [2][2]
 
MonitorElementhSelOCC_ [2][2]
 
std::string prefixME_
 
edm::EDGetTokenT
< ESRecHitCollection
rechittoken_
 
int runNum_
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer<>
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
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from DQMOneEDAnalyzer<>
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
- 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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMOneEDAnalyzer<>
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 10 of file ESOccupancyTask.h.

Constructor & Destructor Documentation

ESOccupancyTask::ESOccupancyTask ( const edm::ParameterSet ps)

Definition at line 24 of file ESOccupancyTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, and dqmiolumiharvest::j.

24  {
25  rechittoken_ = consumes<ESRecHitCollection>(ps.getParameter<InputTag>("RecHitLabel"));
26  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
27 
28  eCount_ = 0;
29 
30  //Histogram init
31  for (int i = 0; i < 2; ++i)
32  for (int j = 0; j < 2; ++j) {
33  hRecOCC_[i][j] = nullptr;
34  hRecNHit_[i][j] = nullptr;
35  hEng_[i][j] = nullptr;
36  hEvEng_[i][j] = nullptr;
37  hEnDensity_[i][i] = nullptr;
38  hGoodRecNHit_[i][j] = nullptr;
39 
40  hSelEng_[i][j] = nullptr;
41  hSelOCC_[i][j] = nullptr;
42  hSelEnDensity_[i][j] = nullptr;
43  }
44 
45  for (int i = 0; i < 2; ++i)
46  hE1E2_[i] = nullptr;
47 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * hSelOCC_[2][2]
MonitorElement * hSelEng_[2][2]
MonitorElement * hRecOCC_[2][2]
MonitorElement * hEvEng_[2][2]
MonitorElement * hEng_[2][2]
std::string prefixME_
MonitorElement * hE1E2_[2]
MonitorElement * hSelEnDensity_[2][2]
MonitorElement * hEnDensity_[2][2]
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * hGoodRecNHit_[2][2]
MonitorElement * hRecNHit_[2][2]
edm::EDGetTokenT< ESRecHitCollection > rechittoken_
ESOccupancyTask::~ESOccupancyTask ( )
inlineoverride

Definition at line 13 of file ESOccupancyTask.h.

13 {}

Member Function Documentation

void ESOccupancyTask::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 110 of file ESOccupancyTask.cc.

References edm::Event::getByToken(), mps_fire::i, edm::EventBase::id(), dqmiolumiharvest::j, edm::EventID::run(), ESDetId::zside(), and ecaldqm::zside().

110  {
111  runNum_ = e.id().run();
112  eCount_++;
113 
114  // RecHits
115  int zside, plane, ix, iy;
116  int sum_RecHits[2][2], sum_GoodRecHits[2][2];
117  float sum_Energy[2][2];
118 
119  for (int i = 0; i < 2; ++i)
120  for (int j = 0; j < 2; ++j) {
121  sum_RecHits[i][j] = 0;
122  sum_GoodRecHits[i][j] = 0;
123  sum_Energy[i][j] = 0;
124  }
125 
127  if (e.getByToken(rechittoken_, ESRecHit)) {
128  for (ESRecHitCollection::const_iterator hitItr = ESRecHit->begin(); hitItr != ESRecHit->end(); ++hitItr) {
129  ESDetId id = ESDetId(hitItr->id());
130 
131  zside = id.zside();
132  plane = id.plane();
133  ix = id.six();
134  iy = id.siy();
135 
136  int i = (zside == 1) ? 0 : 1;
137  int j = plane - 1;
138 
139  sum_RecHits[i][j]++;
140  sum_Energy[i][j] += hitItr->energy();
141  hRecOCC_[i][j]->Fill(ix, iy);
142  if (hitItr->energy() != 0) {
143  hEng_[i][j]->Fill(hitItr->energy());
144  hEnDensity_[i][j]->Fill(ix, iy, hitItr->energy());
145 
146  if (hitItr->recoFlag() == 14 || hitItr->recoFlag() == 1 ||
147  (hitItr->recoFlag() <= 10 && hitItr->recoFlag() >= 5))
148  continue;
149  sum_GoodRecHits[i][j]++;
150  hSelEng_[i][j]->Fill(hitItr->energy());
151  hSelEnDensity_[i][j]->Fill(ix, iy, hitItr->energy());
152  hSelOCC_[i][j]->Fill(ix, iy);
153  }
154  }
155  } else {
156  LogWarning("ESOccupancyTask") << "RecHitCollection not available";
157  }
158 
159  //Fill histograms after a event
160  for (int i = 0; i < 2; ++i)
161  for (int j = 0; j < 2; ++j) {
162  hRecNHit_[i][j]->Fill(sum_RecHits[i][j]);
163  hGoodRecNHit_[i][j]->Fill(sum_GoodRecHits[i][j]);
164  hEvEng_[i][j]->Fill(sum_Energy[i][j]);
165 
166  //Save eCount_ for Scaling
167  hRecOCC_[i][j]->setBinContent(40, 40, eCount_);
168  hEnDensity_[i][j]->setBinContent(40, 40, eCount_);
169 
170  hSelOCC_[i][j]->setBinContent(40, 40, eCount_);
171  hSelEnDensity_[i][j]->setBinContent(40, 40, eCount_);
172  }
173 
174  hE1E2_[0]->Fill(sum_Energy[0][0], sum_Energy[0][1]);
175  hE1E2_[1]->Fill(sum_Energy[1][0], sum_Energy[1][1]);
176 }
RunNumber_t run() const
Definition: EventID.h:38
MonitorElement * hSelOCC_[2][2]
MonitorElement * hSelEng_[2][2]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
MonitorElement * hRecOCC_[2][2]
MonitorElement * hEvEng_[2][2]
MonitorElement * hEng_[2][2]
std::vector< EcalRecHit >::const_iterator const_iterator
int zside(DetId const &)
void Fill(long long x)
MonitorElement * hE1E2_[2]
int zside() const
Definition: ESDetId.h:39
MonitorElement * hSelEnDensity_[2][2]
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * hEnDensity_[2][2]
MonitorElement * hGoodRecNHit_[2][2]
MonitorElement * hRecNHit_[2][2]
edm::EventID id() const
Definition: EventBase.h:59
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< ESRecHitCollection > rechittoken_
void ESOccupancyTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMOneEDAnalyzer<>.

Definition at line 49 of file ESOccupancyTask.cc.

References dqm::implementation::IBooker::book1DD(), dqm::implementation::IBooker::book2D(), timingPdfMaker::histo, mps_fire::i, dqmiolumiharvest::j, dqm::impl::MonitorElement::setAxisTitle(), and dqm::implementation::NavigatorBase::setCurrentFolder().

49  {
50  iBooker.setCurrentFolder(prefixME_ + "/ESOccupancyTask");
51 
52  //Booking Histograms
53  //Notice: Change ESRenderPlugin under DQM/RenderPlugins/src if you change this histogram name.
54  char histo[200];
55  for (int i = 0; i < 2; ++i)
56  for (int j = 0; j < 2; ++j) {
57  int iz = (i == 0) ? 1 : -1;
58  sprintf(histo, "ES RecHit 2D Occupancy Z %d P %d", iz, j + 1);
59  hRecOCC_[i][j] = iBooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
60  hRecOCC_[i][j]->setAxisTitle("Si X", 1);
61  hRecOCC_[i][j]->setAxisTitle("Si Y", 2);
62 
63  //Bin 40,40 is used to save eumber of event for scaling.
64  sprintf(histo, "ES Energy Density Z %d P %d", iz, j + 1);
65  hEnDensity_[i][j] = iBooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
66  hEnDensity_[i][j]->setAxisTitle("Si X", 1);
67  hEnDensity_[i][j]->setAxisTitle("Si Y", 2);
68 
69  sprintf(histo, "ES Num of RecHits Z %d P %d", iz, j + 1);
70  hRecNHit_[i][j] = iBooker.book1DD(histo, histo, 60, 0, 1920);
71  hRecNHit_[i][j]->setAxisTitle("# of RecHits", 1);
72  hRecNHit_[i][j]->setAxisTitle("Num of Events", 2);
73 
74  sprintf(histo, "ES Num of Good RecHits Z %d P %d", iz, j + 1);
75  hGoodRecNHit_[i][j] = iBooker.book1DD(histo, histo, 60, 0, 1920);
76  hGoodRecNHit_[i][j]->setAxisTitle("# of good RecHits", 1);
77  hGoodRecNHit_[i][j]->setAxisTitle("Num of Events", 2);
78 
79  sprintf(histo, "ES RecHit Energy Z %d P %d", iz, j + 1);
80  hEng_[i][j] = iBooker.book1DD(histo, histo, 50, 0, 0.001);
81  hEng_[i][j]->setAxisTitle("RecHit Energy", 1);
82  hEng_[i][j]->setAxisTitle("Num of ReHits", 2);
83 
84  sprintf(histo, "ES Event Energy Z %d P %d", iz, j + 1);
85  hEvEng_[i][j] = iBooker.book1DD(histo, histo, 50, 0, 0.1);
86  hEvEng_[i][j]->setAxisTitle("Event Energy", 1);
87  hEvEng_[i][j]->setAxisTitle("Num of Events", 2);
88 
89  // histograms with selected hits
90  sprintf(histo, "ES RecHit Energy with selected hits Z %d P %d", iz, j + 1);
91  hSelEng_[i][j] = iBooker.book1DD(histo, histo, 50, 0, 0.001);
92  hSelEng_[i][j]->setAxisTitle("RecHit Energy", 1);
93  hSelEng_[i][j]->setAxisTitle("Num of ReHits", 2);
94 
95  sprintf(histo, "ES Occupancy with selected hits Z %d P %d", iz, j + 1);
96  hSelOCC_[i][j] = iBooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
97  hSelOCC_[i][j]->setAxisTitle("Si X", 1);
98  hSelOCC_[i][j]->setAxisTitle("Si Y", 2);
99 
100  sprintf(histo, "ES Energy Density with selected hits Z %d P %d", iz, j + 1);
101  hSelEnDensity_[i][j] = iBooker.book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
102  hSelEnDensity_[i][j]->setAxisTitle("Si X", 1);
103  hSelEnDensity_[i][j]->setAxisTitle("Si Y", 2);
104  }
105 
106  hE1E2_[0] = iBooker.book2D("ES+ EP1 vs EP2", "ES+ EP1 vs EP2", 50, 0, 0.1, 50, 0, 0.1);
107  hE1E2_[1] = iBooker.book2D("ES- EP1 vs EP2", "ES- EP1 vs EP2", 50, 0, 0.1, 50, 0, 0.1);
108 }
MonitorElement * hSelOCC_[2][2]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * hSelEng_[2][2]
MonitorElement * hRecOCC_[2][2]
MonitorElement * hEvEng_[2][2]
MonitorElement * hEng_[2][2]
std::string prefixME_
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
MonitorElement * hE1E2_[2]
MonitorElement * hSelEnDensity_[2][2]
MonitorElement * hEnDensity_[2][2]
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
MonitorElement * hGoodRecNHit_[2][2]
MonitorElement * hRecNHit_[2][2]
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

Member Data Documentation

int ESOccupancyTask::eCount_
private

Definition at line 34 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hE1E2_[2]
private

Definition at line 32 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hEnDensity_[2][2]
private

Definition at line 26 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hEng_[2][2]
private

Definition at line 30 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hEvEng_[2][2]
private

Definition at line 31 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hGoodRecNHit_[2][2]
private

Definition at line 28 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hRecNHit_[2][2]
private

Definition at line 25 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hRecOCC_[2][2]
private

Definition at line 23 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hSelEnDensity_[2][2]
private

Definition at line 27 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hSelEng_[2][2]
private

Definition at line 29 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hSelOCC_[2][2]
private

Definition at line 24 of file ESOccupancyTask.h.

std::string ESOccupancyTask::prefixME_
private

Definition at line 21 of file ESOccupancyTask.h.

edm::EDGetTokenT<ESRecHitCollection> ESOccupancyTask::rechittoken_
private

Definition at line 20 of file ESOccupancyTask.h.

int ESOccupancyTask::runNum_
private

Definition at line 34 of file ESOccupancyTask.h.