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:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ESOccupancyTask (const edm::ParameterSet &ps)
 
virtual ~ESOccupancyTask ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 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
 
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 &)
 
virtual void beginJob (void)
 
virtual void endJob (void)
 

Private Attributes

DQMStoredqmStore_
 
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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 13 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(), timingPdfMaker::histo, i, j, and cppFunctionSkipper::operator.

25  {
26 
27  rechittoken_ = consumes<ESRecHitCollection>(ps.getParameter<InputTag>("RecHitLabel"));
28  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "EcalPreshower");
29 
31  eCount_ = 0;
32 
33  //Histogram init
34  for (int i = 0; i < 2; ++i)
35  for (int j = 0; j < 2; ++j) {
36  hRecOCC_[i][j] = 0;
37  hRecNHit_[i][j] = 0;
38  hEng_[i][j] = 0;
39  hEvEng_[i][j] = 0;
40  hEnDensity_[i][i] = 0;
41  hDigiNHit_[i][j] = 0;
42 
43  hSelEng_[i][j] = 0;
44  hSelOCC_[i][j] = 0;
45  hSelEnDensity_[i][j] = 0;
46  }
47 
48  for (int i = 0; i<2; ++i)
49  hE1E2_[i]=0;
50 
51  dqmStore_->setCurrentFolder(prefixME_ + "/ESOccupancyTask");
52 
53  //Booking Histograms
54  //Notice: Change ESRenderPlugin under DQM/RenderPlugins/src if you change this histogram name.
55  char histo[200];
56  for (int i=0 ; i<2; ++i)
57  for (int j=0 ; j<2; ++j) {
58  int iz = (i==0)? 1:-1;
59  sprintf(histo, "ES RecHit 2D Occupancy Z %d P %d", iz, j+1);
60  hRecOCC_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
61  hRecOCC_[i][j]->setAxisTitle("Si X", 1);
62  hRecOCC_[i][j]->setAxisTitle("Si Y", 2);
63 
64  //Bin 40,40 is used to save eumber of event for scaling.
65  sprintf(histo, "ES Energy Density Z %d P %d", iz, j+1);
66  hEnDensity_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
67  hEnDensity_[i][j]->setAxisTitle("Si X", 1);
68  hEnDensity_[i][j]->setAxisTitle("Si Y", 2);
69 
70  sprintf(histo, "ES Num of RecHits Z %d P %d", iz, j+1);
71  hRecNHit_[i][j] = dqmStore_->book1DD(histo, histo, 60, 0, 1920);
72  hRecNHit_[i][j]->setAxisTitle("# of RecHits", 1);
73  hRecNHit_[i][j]->setAxisTitle("Num of Events", 2);
74 
75  sprintf(histo, "ES Num of Good RecHits Z %d P %d", iz, j+1);
76  hDigiNHit_[i][j] = dqmStore_->book1DD(histo, histo, 60, 0, 1920);
77  hDigiNHit_[i][j]->setAxisTitle("# of good RecHits", 1);
78  hDigiNHit_[i][j]->setAxisTitle("Num of Events", 2);
79 
80  sprintf(histo, "ES RecHit Energy Z %d P %d", iz, j+1);
81  hEng_[i][j] = dqmStore_->book1DD(histo, histo, 50, 0, 0.001);
82  hEng_[i][j]->setAxisTitle("RecHit Energy", 1);
83  hEng_[i][j]->setAxisTitle("Num of ReHits", 2);
84 
85  sprintf(histo, "ES Event Energy Z %d P %d", iz, j+1);
86  hEvEng_[i][j] = dqmStore_->book1DD(histo, histo, 50, 0, 0.1);
87  hEvEng_[i][j]->setAxisTitle("Event Energy", 1);
88  hEvEng_[i][j]->setAxisTitle("Num of Events", 2);
89 
90  // histograms with selected hits
91  sprintf(histo, "ES RecHit Energy with selected hits Z %d P %d", iz, j+1);
92  hSelEng_[i][j] = dqmStore_->book1DD(histo, histo, 50, 0, 0.001);
93  hSelEng_[i][j]->setAxisTitle("RecHit Energy", 1);
94  hSelEng_[i][j]->setAxisTitle("Num of ReHits", 2);
95 
96  sprintf(histo, "ES Occupancy with selected hits Z %d P %d", iz, j+1);
97  hSelOCC_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
98  hSelOCC_[i][j]->setAxisTitle("Si X", 1);
99  hSelOCC_[i][j]->setAxisTitle("Si Y", 2);
100 
101  sprintf(histo, "ES Energy Density with selected hits Z %d P %d", iz, j+1);
102  hSelEnDensity_[i][j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
103  hSelEnDensity_[i][j]->setAxisTitle("Si X", 1);
104  hSelEnDensity_[i][j]->setAxisTitle("Si Y", 2);
105  }
106 
107  hE1E2_[0] = dqmStore_->book2D("ES+ EP1 vs EP2", "ES+ EP1 vs EP2", 50, 0, 0.1, 50, 0, 0.1);
108  hE1E2_[1] = dqmStore_->book2D("ES- EP1 vs EP2", "ES- EP1 vs EP2", 50, 0, 0.1, 50, 0, 0.1);
109 
110 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
DQMStore * dqmStore_
MonitorElement * hSelOCC_[2][2]
MonitorElement * hSelEng_[2][2]
MonitorElement * hRecOCC_[2][2]
MonitorElement * hDigiNHit_[2][2]
MonitorElement * hEvEng_[2][2]
MonitorElement * hEng_[2][2]
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:904
std::string prefixME_
int j
Definition: DBlmapReader.cc:9
MonitorElement * hE1E2_[2]
MonitorElement * hSelEnDensity_[2][2]
MonitorElement * hEnDensity_[2][2]
MonitorElement * hRecNHit_[2][2]
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
edm::EDGetTokenT< ESRecHitCollection > rechittoken_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
ESOccupancyTask::~ESOccupancyTask ( )
virtual

Definition at line 112 of file ESOccupancyTask.cc.

112  {
113 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 121 of file ESOccupancyTask.cc.

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

121  {
122 
123  runNum_ = e.id().run();
124  eCount_++;
125 
126  // RecHits
127  int zside, plane, ix, iy;
128  int sum_RecHits[2][2], sum_DigiHits[2][2];
129  float sum_Energy[2][2];
130 
131  for (int i = 0; i < 2; ++i)
132  for (int j = 0; j < 2; ++j) {
133  sum_RecHits[i][j] = 0;
134  sum_DigiHits[i][j] = 0;
135  sum_Energy[i][j] = 0;
136  }
137 
139  if ( e.getByToken(rechittoken_, ESRecHit) ) {
140 
141  for (ESRecHitCollection::const_iterator hitItr = ESRecHit->begin(); hitItr != ESRecHit->end(); ++hitItr) {
142 
143  ESDetId id = ESDetId(hitItr->id());
144 
145  zside = id.zside();
146  plane = id.plane();
147  ix = id.six();
148  iy = id.siy();
149 
150  int i = (zside==1)? 0:1;
151  int j = plane-1;
152 
153  sum_RecHits[i][j]++;
154  sum_Energy[i][j] += hitItr->energy();
155  hRecOCC_[i][j]->Fill(ix, iy);
156  if (hitItr->energy() != 0) {
157  hEng_[i][j]->Fill(hitItr->energy());
158  hEnDensity_[i][j]->Fill(ix, iy, hitItr->energy());
159 
160  if (hitItr->recoFlag()==14 || hitItr->recoFlag()==1 || (hitItr->recoFlag()<=10 && hitItr->recoFlag()>=5)) continue;
161  hSelEng_[i][j]->Fill(hitItr->energy());
162  hSelEnDensity_[i][j]->Fill(ix, iy, hitItr->energy());
163  hSelOCC_[i][j]->Fill(ix, iy);
164  }
165 
166  }
167  } else {
168  LogWarning("ESOccupancyTask") << "RecHitCollection not available";
169  }
170 
171  //Fill histograms after a event
172  for (int i = 0; i < 2; ++i)
173  for (int j = 0; j < 2; ++j) {
174 
175  hRecNHit_[i][j]->Fill(sum_RecHits[i][j]);
176  hDigiNHit_[i][j]->Fill(sum_DigiHits[i][j]);
177  hEvEng_[i][j]->Fill(sum_Energy[i][j]);
178 
179  //Save eCount_ for Scaling
180  hRecOCC_[i][j]->setBinContent(40,40,eCount_);
181  hEnDensity_[i][j]->setBinContent(40,40,eCount_);
182 
183  hSelOCC_[i][j]->setBinContent(40,40,eCount_);
185  }
186 
187  hE1E2_[0]->Fill(sum_Energy[0][0], sum_Energy[0][1]);
188  hE1E2_[1]->Fill(sum_Energy[1][0], sum_Energy[1][1]);
189 
190 }
RunNumber_t run() const
Definition: EventID.h:42
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:434
MonitorElement * hRecOCC_[2][2]
MonitorElement * hDigiNHit_[2][2]
MonitorElement * hEvEng_[2][2]
MonitorElement * hEng_[2][2]
std::vector< EcalRecHit >::const_iterator const_iterator
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:56
edm::EDGetTokenT< ESRecHitCollection > rechittoken_
void ESOccupancyTask::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file ESOccupancyTask.cc.

115  {
116 }
void ESOccupancyTask::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file ESOccupancyTask.cc.

118  {
119 }

Member Data Documentation

DQMStore* ESOccupancyTask::dqmStore_
private

Definition at line 30 of file ESOccupancyTask.h.

int ESOccupancyTask::eCount_
private

Definition at line 42 of file ESOccupancyTask.h.

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

Definition at line 36 of file ESOccupancyTask.h.

MonitorElement* ESOccupancyTask::hE1E2_[2]
private

Definition at line 40 of file ESOccupancyTask.h.

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

Definition at line 34 of file ESOccupancyTask.h.

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

Definition at line 38 of file ESOccupancyTask.h.

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

Definition at line 39 of file ESOccupancyTask.h.

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

Definition at line 33 of file ESOccupancyTask.h.

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

Definition at line 31 of file ESOccupancyTask.h.

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

Definition at line 35 of file ESOccupancyTask.h.

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

Definition at line 37 of file ESOccupancyTask.h.

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

Definition at line 32 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 42 of file ESOccupancyTask.h.