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

Public Member Functions

 ESOccupancyTask (const edm::ParameterSet &ps)
 
virtual ~ESOccupancyTask ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void endJob (void)
 

Private Attributes

edm::InputTag digilabel_
 
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::InputTag rechitlabel_
 
int runNum_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 11 of file ESOccupancyTask.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file ESOccupancyTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), interpolateCardsSimple::histo, i, j, and cppFunctionSkipper::operator.

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

Definition at line 114 of file ESOccupancyTask.cc.

114  {
115 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 123 of file ESOccupancyTask.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file ESOccupancyTask.cc.

117  {
118 }
void ESOccupancyTask::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 120 of file ESOccupancyTask.cc.

120  {
121 }

Member Data Documentation

edm::InputTag ESOccupancyTask::digilabel_
private

Definition at line 26 of file ESOccupancyTask.h.

DQMStore* ESOccupancyTask::dqmStore_
private

Definition at line 29 of file ESOccupancyTask.h.

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 27 of file ESOccupancyTask.h.

edm::InputTag ESOccupancyTask::rechitlabel_
private

Definition at line 25 of file ESOccupancyTask.h.

int ESOccupancyTask::runNum_
private

Definition at line 41 of file ESOccupancyTask.h.