CMS 3D CMS Logo

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

#include <EBStatusFlagsTask.h>

Inheritance diagram for EBStatusFlagsTask:
edm::EDAnalyzer

Public Member Functions

 EBStatusFlagsTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~EBStatusFlagsTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob (void)
 BeginJob. More...
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 BeginLuminosityBlock. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void cleanup (void)
 Cleanup. More...
 
void endJob (void)
 EndJob. More...
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 EndLuminosityBlock. More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun. More...
 
void reset (void)
 Reset. More...
 
void setup (void)
 Setup. More...
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

DQMStoredqmStore_
 
edm::InputTag EcalRawDataCollection_
 
bool enableCleanup_
 
int ievt_
 
bool init_
 
MonitorElementmeEvtType_ [36]
 
MonitorElementmeFEchErrors_ [36][3]
 
MonitorElementmeFEchErrorsByLumi_
 
bool mergeRuns_
 
std::string prefixME_
 
std::string subfolder_
 

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 &)
 

Detailed Description

Definition at line 20 of file EBStatusFlagsTask.h.

Constructor & Destructor Documentation

EBStatusFlagsTask::EBStatusFlagsTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 27 of file EBStatusFlagsTask.cc.

References dqmStore_, EcalRawDataCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, mergeRuns_, cppFunctionSkipper::operator, prefixME_, and subfolder_.

27  {
28 
29  init_ = false;
30 
32 
33  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
34 
35  subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");
36 
37  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
38 
39  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
40 
41  EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
42 
43  for (int i = 0; i < 36; i++) {
44  meEvtType_[i] = 0;
45 
46  meFEchErrors_[i][0] = 0;
47  meFEchErrors_[i][1] = 0;
48  meFEchErrors_[i][2] = 0;
49  }
50 
52 
53 }
MonitorElement * meFEchErrors_[36][3]
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::string subfolder_
edm::InputTag EcalRawDataCollection_
MonitorElement * meFEchErrorsByLumi_
MonitorElement * meEvtType_[36]
EBStatusFlagsTask::~EBStatusFlagsTask ( )
virtual

Destructor.

Definition at line 55 of file EBStatusFlagsTask.cc.

55  {
56 
57 }

Member Function Documentation

void EBStatusFlagsTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 244 of file EBStatusFlagsTask.cc.

References EcalBarrel, EcalRawDataCollection_, MonitorElement::Fill(), edm::Event::getByLabel(), ievt_, init_, ecalpyutils::ism(), Numbers::iSM(), meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, setup(), ntuplemaker::status, and Numbers::subDet().

244  {
245 
246  if ( ! init_ ) this->setup();
247 
248  ievt_++;
249 
250  // fill bin 0 with number of events in the lumi
252 
254 
255  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
256 
257  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
258 
259  if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue;
260 
261  int ism = Numbers::iSM( *dcchItr, EcalBarrel );
262  float xism = ism + 0.5;
263 
264  if ( meEvtType_[ism-1] ) meEvtType_[ism-1]->Fill(dcchItr->getRunType()+0.5);
265 
266  const std::vector<short> status = dcchItr->getFEStatus();
267 
268  for ( unsigned int itt=1; itt<=status.size(); itt++ ) {
269 
270  if ( itt > 70 ) continue;
271 
272  if ( itt >= 1 && itt <= 68 ) {
273 
274  int iet = (itt-1)/4 + 1;
275  int ipt = (itt-1)%4 + 1;
276 
277  float xiet = iet - 0.5;
278  float xipt = ipt - 0.5;
279 
280  if ( ! ( status[itt-1] == 0 || status[itt-1] == 1 || status[itt-1] == 7 || status[itt-1] == 8 || status[itt-1] == 12 || status[itt-1] == 15 ) ) {
281  if ( meFEchErrors_[ism-1][0] ) meFEchErrors_[ism-1][0]->Fill(xiet, xipt);
282  if ( meFEchErrorsByLumi_ ) meFEchErrorsByLumi_->Fill(xism, 1./68.);
283  }
284 
285  } else if ( itt == 69 || itt == 70 ) {
286 
287  if ( ! ( status[itt-1] == 0 || status[itt-1] == 1 || status[itt-1] == 7 || status[itt-1] == 8 || status[itt-1] == 12 || status[itt-1] == 15 ) ) {
288  if ( meFEchErrors_[ism-1][1] ) meFEchErrors_[ism-1][1]->Fill(itt-68-0.5, 0);
289  }
290 
291  }
292 
293  if ( meFEchErrors_[ism-1][2] ) meFEchErrors_[ism-1][2]->Fill(status[itt-1]+0.5);
294 
295  }
296 
297  }
298 
299  } else {
300 
301  edm::LogWarning("EBStatusFlagsTask") << EcalRawDataCollection_ << " not available";
302 
303  }
304 
305 }
MonitorElement * meFEchErrors_[36][3]
edm::InputTag EcalRawDataCollection_
std::vector< T >::const_iterator const_iterator
void Fill(long long x)
MonitorElement * meFEchErrorsByLumi_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * meEvtType_[36]
void setup(void)
Setup.
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:145
tuple status
Definition: ntuplemaker.py:245
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
void EBStatusFlagsTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file EBStatusFlagsTask.cc.

References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), DQMStore::setCurrentFolder(), and subfolder_.

59  {
60 
61  ievt_ = 0;
62 
63  if ( dqmStore_ ) {
64  dqmStore_->setCurrentFolder(prefixME_ + "/EBStatusFlagsTask");
65  if(subfolder_.size())
66  dqmStore_->setCurrentFolder(prefixME_ + "/EBStatusFlagsTask/" + subfolder_);
67  dqmStore_->rmdir(prefixME_ + "/EBStatusFlagsTask");
68  }
69 
70 }
std::string subfolder_
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void EBStatusFlagsTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
protectedvirtual

BeginLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file EBStatusFlagsTask.cc.

References meFEchErrorsByLumi_, and MonitorElement::Reset().

72  {
73 
75 
76 }
MonitorElement * meFEchErrorsByLumi_
void Reset(void)
reset ME (ie. contents, errors, etc)
void EBStatusFlagsTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file EBStatusFlagsTask.cc.

References Numbers::initGeometry(), mergeRuns_, and reset().

81  {
82 
83  Numbers::initGeometry(c, false);
84 
85  if ( ! mergeRuns_ ) this->reset();
86 
87 }
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
void reset(void)
Reset.
void EBStatusFlagsTask::cleanup ( void  )
protected

Cleanup.

Definition at line 199 of file EBStatusFlagsTask.cc.

References dir, dqmStore_, edm::getName(), MonitorElement::getName(), i, init_, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, prefixME_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), and subfolder_.

Referenced by endJob().

199  {
200 
201  if ( ! init_ ) return;
202 
203  if ( dqmStore_ ) {
204 
205  std::string dir = prefixME_ + "/EBStatusFlagsTask";
206  if(subfolder_.size())
207  dir = prefixME_ + "/EBStatusFlagsTask/" + subfolder_;
208 
209  dqmStore_->setCurrentFolder(dir + "");
210 
211  dqmStore_->setCurrentFolder(dir + "/EvtType");
212  for (int i = 0; i < 36; i++) {
214  meEvtType_[i] = 0;
215  }
216 
217  dqmStore_->setCurrentFolder(dir + "/FEStatus");
218  for (int i = 0; i < 36; i++) {
219  if ( meFEchErrors_[i][0] ) dqmStore_->removeElement( meFEchErrors_[i][0]->getName() );
220  meFEchErrors_[i][0] = 0;
221  if ( meFEchErrors_[i][1] ) dqmStore_->removeElement( meFEchErrors_[i][1]->getName() );
222  meFEchErrors_[i][1] = 0;
223  if ( meFEchErrors_[i][2] ) dqmStore_->removeElement( meFEchErrors_[i][2]->getName() );
224  meFEchErrors_[i][2] = 0;
225  }
226 
229 
230  }
231 
232  init_ = false;
233 
234 }
MonitorElement * meFEchErrors_[36][3]
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
std::string subfolder_
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
MonitorElement * meFEchErrorsByLumi_
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
MonitorElement * meEvtType_[36]
dbl *** dir
Definition: mlp_gen.cc:35
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void EBStatusFlagsTask::endJob ( void  )
protectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 236 of file EBStatusFlagsTask.cc.

References cleanup(), enableCleanup_, and ievt_.

236  {
237 
238  edm::LogInfo("EBStatusFlagsTask") << "analyzed " << ievt_ << " events";
239 
240  if ( enableCleanup_ ) this->cleanup();
241 
242 }
void cleanup(void)
Cleanup.
void EBStatusFlagsTask::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
protectedvirtual

EndLuminosityBlock.

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file EBStatusFlagsTask.cc.

78  {
79 }
void EBStatusFlagsTask::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file EBStatusFlagsTask.cc.

89  {
90 
91 }
void EBStatusFlagsTask::reset ( void  )
protected

Reset.

Definition at line 93 of file EBStatusFlagsTask.cc.

References i, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, and MonitorElement::Reset().

Referenced by beginRun().

93  {
94 
95  for (int i = 0; i < 36; i++) {
96  if ( meEvtType_[i] ) meEvtType_[i]->Reset();
97 
98  if ( meFEchErrors_[i][0] ) meFEchErrors_[i][0]->Reset();
99  if ( meFEchErrors_[i][1] ) meFEchErrors_[i][1]->Reset();
100  if ( meFEchErrors_[i][2] ) meFEchErrors_[i][2]->Reset();
101  }
103 }
MonitorElement * meFEchErrors_[36][3]
int i
Definition: DBlmapReader.cc:9
MonitorElement * meFEchErrorsByLumi_
MonitorElement * meEvtType_[36]
void Reset(void)
reset ME (ie. contents, errors, etc)
void EBStatusFlagsTask::setup ( void  )
protected

Setup.

Definition at line 105 of file EBStatusFlagsTask.cc.

References EcalDCCHeaderBlock::BEAMH2, EcalDCCHeaderBlock::BEAMH4, DQMStore::book1D(), DQMStore::book2D(), EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, dir, dqmStore_, EcalDCCHeaderBlock::HALO_GLOBAL, EcalDCCHeaderBlock::HALO_LOCAL, i, init_, EcalDCCHeaderBlock::LASER_DELAY_SCAN, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_POWER_SCAN, EcalDCCHeaderBlock::LASER_STD, EcalDCCHeaderBlock::LED_GAP, EcalDCCHeaderBlock::LED_STD, meEvtType_, meFEchErrors_, meFEchErrorsByLumi_, EcalDCCHeaderBlock::MTCC, mergeVDriftHistosByStation::name, EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, EcalDCCHeaderBlock::PEDESTAL_GAP, EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, EcalDCCHeaderBlock::PEDESTAL_STD, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), MonitorElement::setLumiFlag(), subfolder_, DQMStore::tag(), EcalDCCHeaderBlock::TESTPULSE_GAP, EcalDCCHeaderBlock::TESTPULSE_MGPA, and EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM.

Referenced by analyze().

105  {
106 
107  init_ = true;
108 
109  std::string name;
110  std::string dir;
111 
112  if ( dqmStore_ ) {
113  dir = prefixME_ + "/EBStatusFlagsTask";
114  if(subfolder_.size())
115  dir = prefixME_ + "/EBStatusFlagsTask/" + subfolder_;
116 
118 
119  dqmStore_->setCurrentFolder(dir + "/EvtType");
120  for (int i = 0; i < 36; i++) {
121  name = "EBSFT EVTTYPE " + Numbers::sEB(i+1);
122  meEvtType_[i] = dqmStore_->book1D(name, name, 31, -1., 30.);
123  meEvtType_[i]->setBinLabel(1, "UNKNOWN", 1);
129  meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
130  meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
131  meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
134  meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
135  meEvtType_[i]->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
147  dqmStore_->tag(meEvtType_[i], i+1);
148  }
149 
150  dqmStore_->setCurrentFolder(dir + "/FEStatus");
151  for (int i = 0; i < 36; i++) {
152  name = "EBSFT front-end status " + Numbers::sEB(i+1);
153  meFEchErrors_[i][0] = dqmStore_->book2D(name, name, 17, 0., 17., 4, 0., 4.);
154  meFEchErrors_[i][0]->setAxisTitle("ieta'", 1);
155  meFEchErrors_[i][0]->setAxisTitle("iphi'", 2);
156  dqmStore_->tag(meFEchErrors_[i][0], i+1);
157 
158  name = "EBSFT MEM front-end status " + Numbers::sEB(i+1);
159  meFEchErrors_[i][1] = dqmStore_->book2D(name, name, 2, 0., 2., 1, 0., 1.);
160  meFEchErrors_[i][1]->setAxisTitle("pseudo-strip", 1);
161  meFEchErrors_[i][1]->setAxisTitle("channel", 2);
162  dqmStore_->tag(meFEchErrors_[i][1], i+1);
163 
164  name = "EBSFT front-end status bits " + Numbers::sEB(i+1);
165  meFEchErrors_[i][2] = dqmStore_->book1D(name, name, 16, 0., 16.);
166  meFEchErrors_[i][2]->setBinLabel(1+0, "ACTIVE", 1);
167  meFEchErrors_[i][2]->setBinLabel(1+1, "DISABLED", 1);
168  meFEchErrors_[i][2]->setBinLabel(1+2, "TIMEOUT", 1);
169  meFEchErrors_[i][2]->setBinLabel(1+3, "HEADER", 1);
170  meFEchErrors_[i][2]->setBinLabel(1+4, "CHANNEL ID", 1);
171  meFEchErrors_[i][2]->setBinLabel(1+5, "LINK", 1);
172  meFEchErrors_[i][2]->setBinLabel(1+6, "BLOCKSIZE", 1);
173  meFEchErrors_[i][2]->setBinLabel(1+7, "SUPPRESSED", 1);
174  meFEchErrors_[i][2]->setBinLabel(1+8, "FORCED FS", 1);
175  meFEchErrors_[i][2]->setBinLabel(1+9, "L1A SYNC", 1);
176  meFEchErrors_[i][2]->setBinLabel(1+10, "BX SYNC", 1);
177  meFEchErrors_[i][2]->setBinLabel(1+11, "L1A+BX SYNC", 1);
178  meFEchErrors_[i][2]->setBinLabel(1+12, "FIFO FULL+L1A", 1);
179  meFEchErrors_[i][2]->setBinLabel(1+13, "H PARITY", 1);
180  meFEchErrors_[i][2]->setBinLabel(1+14, "V PARITY", 1);
181  meFEchErrors_[i][2]->setBinLabel(1+15, "FORCED ZS", 1);
182  dqmStore_->tag(meFEchErrors_[i][2], i+1);
183  }
184 
185  // checking the number of front-end errors in each DCC for each lumi
186  // tower error is weighted by 1/68
187  // bin 0 contains the number of processed events in the lumi (for normalization)
188  name = "EBSFT weighted frontend errors by lumi";
189  meFEchErrorsByLumi_ = dqmStore_->book1D(name, name, 36, 1., 37.);
191  for (int i = 0; i < 36; i++) {
193  }
194 
195  }
196 
197 }
MonitorElement * meFEchErrors_[36][3]
int i
Definition: DBlmapReader.cc:9
std::string subfolder_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
static std::string sEB(const unsigned ism)
Definition: Numbers.cc:94
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1354
MonitorElement * meFEchErrorsByLumi_
MonitorElement * meEvtType_[36]
dbl *** dir
Definition: mlp_gen.cc:35
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
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

Member Data Documentation

DQMStore* EBStatusFlagsTask::dqmStore_
private

Definition at line 66 of file EBStatusFlagsTask.h.

Referenced by beginJob(), cleanup(), EBStatusFlagsTask(), and setup().

edm::InputTag EBStatusFlagsTask::EcalRawDataCollection_
private

Definition at line 76 of file EBStatusFlagsTask.h.

Referenced by analyze(), and EBStatusFlagsTask().

bool EBStatusFlagsTask::enableCleanup_
private

Definition at line 72 of file EBStatusFlagsTask.h.

Referenced by EBStatusFlagsTask(), and endJob().

int EBStatusFlagsTask::ievt_
private

Definition at line 64 of file EBStatusFlagsTask.h.

Referenced by analyze(), beginJob(), and endJob().

bool EBStatusFlagsTask::init_
private

Definition at line 83 of file EBStatusFlagsTask.h.

Referenced by analyze(), cleanup(), EBStatusFlagsTask(), and setup().

MonitorElement* EBStatusFlagsTask::meEvtType_[36]
private

Definition at line 78 of file EBStatusFlagsTask.h.

Referenced by analyze(), cleanup(), EBStatusFlagsTask(), reset(), and setup().

MonitorElement* EBStatusFlagsTask::meFEchErrors_[36][3]
private

Definition at line 80 of file EBStatusFlagsTask.h.

Referenced by analyze(), cleanup(), EBStatusFlagsTask(), reset(), and setup().

MonitorElement* EBStatusFlagsTask::meFEchErrorsByLumi_
private
bool EBStatusFlagsTask::mergeRuns_
private

Definition at line 74 of file EBStatusFlagsTask.h.

Referenced by beginRun(), and EBStatusFlagsTask().

std::string EBStatusFlagsTask::prefixME_
private

Definition at line 68 of file EBStatusFlagsTask.h.

Referenced by beginJob(), cleanup(), EBStatusFlagsTask(), and setup().

std::string EBStatusFlagsTask::subfolder_
private

Definition at line 70 of file EBStatusFlagsTask.h.

Referenced by beginJob(), cleanup(), EBStatusFlagsTask(), and setup().