CMS 3D CMS Logo

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

#include <ESOccupancyTask.h>

Inheritance diagram for ESOccupancyTask:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 ESOccupancyTask (const edm::ParameterSet &ps)
 
virtual ~ESOccupancyTask ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

int eCount_
 
MonitorElementhDigiNHit_ [2][2]
 
MonitorElementhE1E2_ [2]
 
MonitorElementhEnDensity_ [2][2]
 
MonitorElementhEng_ [2][2]
 
MonitorElementhEvEng_ [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 edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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 14 of file ESOccupancyTask.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file ESOccupancyTask.cc.

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

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

Definition at line 19 of file ESOccupancyTask.h.

19 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 114 of file ESOccupancyTask.cc.

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

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

Implements DQMEDAnalyzer.

Definition at line 52 of file ESOccupancyTask.cc.

References DQMStore::IBooker::book1DD(), DQMStore::IBooker::book2D(), timingPdfMaker::histo, i, j, MonitorElement::setAxisTitle(), and DQMStore::IBooker::setCurrentFolder().

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

Member Data Documentation

int ESOccupancyTask::eCount_
private

Definition at line 41 of file ESOccupancyTask.h.

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

Definition at line 35 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hE1E2_[2]
private

Definition at line 39 of file ESOccupancyTask.h.

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

Definition at line 33 of file ESOccupancyTask.h.

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

Definition at line 37 of file ESOccupancyTask.h.

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

Definition at line 38 of file ESOccupancyTask.h.

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

Definition at line 32 of file ESOccupancyTask.h.

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

Definition at line 30 of file ESOccupancyTask.h.

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

Definition at line 34 of file ESOccupancyTask.h.

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

Definition at line 36 of file ESOccupancyTask.h.

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

Definition at line 31 of file ESOccupancyTask.h.

std::string ESOccupancyTask::prefixME_
private

Definition at line 28 of file ESOccupancyTask.h.

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

Definition at line 27 of file ESOccupancyTask.h.

int ESOccupancyTask::runNum_
private

Definition at line 41 of file ESOccupancyTask.h.