CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PresampleTask.cc
Go to the documentation of this file.
1 #include "../interface/PresampleTask.h"
2 
5 
6 namespace ecaldqm {
7 
9  DQWorkerTask(_params, _paths, "PresampleTask")
10  {
12  (0x1 << kEBDigi) |
13  (0x1 << kEEDigi);
14  }
15 
17  {
18  }
19 
20  bool
21  PresampleTask::filterRunType(const std::vector<short>& _runType)
22  {
23  for(int iFED(0); iFED < 54; iFED++){
24  if ( _runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
25  _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
26  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
27  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
28  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
29  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) return true;
30  }
31 
32  return false;
33  }
34 
35  void
37  {
38  for(EcalDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
39  DetId id(digiItr->id());
40 
41  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
42  EcalDataFrame dataFrame(*digiItr);
43 
44  float mean(0.);
45  bool gainSwitch(false);
46 
47  for(int iSample(0); iSample < 3; iSample++){
48  if(dataFrame.sample(iSample).gainId() != 1){
49  gainSwitch = true;
50  break;
51  }
52 
53  mean += dataFrame.sample(iSample).adc();
54  }
55  if(gainSwitch) continue;
56 
57  mean /= 3.;
58 
59  MEs_[kPedestal]->fill(id, mean);
60  }
61  }
62 
63  /*static*/
64  void
65  PresampleTask::setMEData(std::vector<MEData>& _data)
66  {
68  axis.low = 160.;
69  axis.high = 240.;
71  }
72 
74 }
75 
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:93
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const_iterator begin() const
void runOnDigis(const EcalDigiCollection &)
static void setMEData(std::vector< MEData > &)
PresampleTask(const edm::ParameterSet &, const edm::ParameterSet &)
Definition: PresampleTask.cc:8
bool filterRunType(const std::vector< short > &)
Definition: DetId.h:20
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
const_iterator end() const