CMS 3D CMS Logo

CastorLEDMonitor.cc
Go to the documentation of this file.
3 
4 //***************************************************//
5 //********** CastorLEDMonitor ***********************//
6 //********** Author: Dmytro Volyanskyy ************//
7 //********** Date : 20.11.2008 (first version) ******//
8 //---------- last revision: 31.05.2011 (Panos Katsas)
9 //***************************************************//
10 //---- critical revision 26.06.2014 (Vladimir Popov)
11 //==================================================================//
12 
14  fVerbosity = ps.getUntrackedParameter<int>("debug", 0);
15  if (fVerbosity > 0)
16  std::cout << "CastorLEDMonitor Constructor: " << this << std::endl;
17  subsystemname = ps.getUntrackedParameter<std::string>("subSystemFolder", "Castor");
18  ievt_ = 0;
19 }
20 
22 
24  char s[60];
25 
26  ibooker.setCurrentFolder(subsystemname + "/CastorLEDMonitor");
27 
28  sprintf(s, "CastorLEDqMap(cumulative)");
29  h2qMap = ibooker.book2D(s, s, 14, 0, 14, 16, 0, 16);
30  h2qMap->setOption("colz");
31  sprintf(s, "CastorLED_QmeanMap");
32  h2meanMap = ibooker.book2D(s, s, 14, 0, 14, 16, 0, 16);
33  h2meanMap->setAxisTitle("moduleZ", /* axis */ 1);
34  h2meanMap->setAxisTitle("sectorPhi", /* axis */ 2);
35  h2meanMap->setOption("colz");
36 
37  ievt_ = 0;
38  return;
39 }
40 
42  if (fVerbosity > 0)
43  std::cout << "CastorLEDMonitor::processEvent (start)" << std::endl;
44 
45  /* be implemented
46  edm::Handle<HcalTBTriggerData> trigger_data;
47  iEvent.getByToken(tok_tb_, trigger_data);
48  if(trigger_data.isValid())
49  if(trigger_data->triggerWord()==6) LEDevent=true;
50  */
51 
52  if (castorDigis.empty()) {
53  if (fVerbosity > 0)
54  std::cout << "CastorLEDMonitor::processEvent NO Castor Digis" << std::endl;
55  return;
56  }
57 
58  for (CastorDigiCollection::const_iterator j = castorDigis.begin(); j != castorDigis.end(); j++) {
59  const CastorDataFrame digi = (const CastorDataFrame)(*j);
60  int module = digi.id().module() - 1;
61  int sector = digi.id().sector() - 1;
62  double qsum = 0.;
63  for (int i = 0; i < digi.size(); i++) {
64  int dig = digi.sample(i).adc() & 0x7f;
65  float ets = LedMonAdc2fc[dig] + 0.5;
66  // h2qts->Fill(i,ets);
67  qsum += ets;
68  }
69  // int ind = sector*14 + module;
70  // h2QvsPMT->Fill(ind,qsum);
71  h2qMap->Fill(module, sector, qsum);
72  } // end for(CastorDigiCollection::const_iterator j=castorDigis...
73 
74  ievt_++;
75  if (ievt_ % 100 == 0) {
76  for (int mod = 1; mod <= 14; mod++)
77  for (int sec = 1; sec <= 16; sec++) {
78  double a = h2qMap->getBinContent(mod, sec);
79  h2meanMap->setBinContent(mod, sec, a / double(ievt_));
80  }
81  }
82 
83  if (fVerbosity > 0)
84  std::cout << "CastorLEDMonitor::processEvent(end)" << std::endl;
85  return;
86 }
std::string subsystemname
MonitorElement * h2meanMap
const HcalQIESample & sample(int i) const
access a sample
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual void setOption(const char *option)
void bookHistograms(DQMStore::IBooker &, edm::Run const &)
std::vector< T >::const_iterator const_iterator
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
int size() const
total number of samples in the digi
int module() const
get the module (1-2 for EM, 1-12 for HAD)
void processEvent(const CastorDigiCollection &cast, const CastorDbService &cond)
int sector() const
get the sector (1-16)
CastorLEDMonitor(const edm::ParameterSet &ps)
const HcalCastorDetId & id() const
static const float LedMonAdc2fc[128]
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
Definition: plugin.cc:23
constexpr int adc() const
get the ADC sample
Definition: HcalQIESample.h:43
double a
Definition: hdecay.h:121
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
MonitorElement * h2qMap
Definition: Run.h:45
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)