CMS 3D CMS Logo

CastorLEDMonitor.cc
Go to the documentation of this file.
4 
5 //***************************************************//
6 //********** CastorLEDMonitor ***********************//
7 //********** Author: Dmytro Volyanskyy ************//
8 //********** Date : 20.11.2008 (first version) ******//
9 //---------- last revision: 31.05.2011 (Panos Katsas)
10 //***************************************************//
11 //---- critical revision 26.06.2014 (Vladimir Popov)
12 //==================================================================//
13 
15  fVerbosity = ps.getUntrackedParameter<int>("debug", 0);
16  if (fVerbosity > 0)
17  std::cout << "CastorLEDMonitor Constructor: " << this << std::endl;
19  ps.getUntrackedParameter<std::string>("subSystemFolder", "Castor");
20  ievt_ = 0;
21 }
22 
24 
26  const edm::Run& iRun,
27  const edm::EventSetup& iSetup) {
28  char s[60];
29 
30  ibooker.setCurrentFolder(subsystemname + "/CastorLEDMonitor");
31 
32  sprintf(s, "CastorLEDqMap(cumulative)");
33  h2qMap = ibooker.book2D(s, s, 14, 0, 14, 16, 0, 16);
34  h2qMap->getTH2F()->SetOption("colz");
35  sprintf(s, "CastorLED_QmeanMap");
36  h2meanMap = ibooker.book2D(s, s, 14, 0, 14, 16, 0, 16);
37  h2meanMap->getTH2F()->GetXaxis()->SetTitle("moduleZ");
38  h2meanMap->getTH2F()->GetYaxis()->SetTitle("sectorPhi");
39  h2meanMap->getTH2F()->SetOption("colz");
40 
41  ievt_ = 0;
42  return;
43 }
44 
46  const CastorDbService& cond) {
47  if (fVerbosity > 0)
48  std::cout << "CastorLEDMonitor::processEvent (start)" << std::endl;
49 
50  /* be implemented
51  edm::Handle<HcalTBTriggerData> trigger_data;
52  iEvent.getByToken(tok_tb_, trigger_data);
53  if(trigger_data.isValid())
54  if(trigger_data->triggerWord()==6) LEDevent=true;
55  */
56 
57  if (castorDigis.empty()) {
58  if (fVerbosity > 0)
59  std::cout << "CastorLEDMonitor::processEvent NO Castor Digis"
60  << std::endl;
61  return;
62  }
63 
64  for (CastorDigiCollection::const_iterator j = castorDigis.begin();
65  j != castorDigis.end(); j++) {
66  const CastorDataFrame digi = (const CastorDataFrame)(*j);
67  int module = digi.id().module() - 1;
68  int sector = digi.id().sector() - 1;
69  double qsum = 0.;
70  for (int i = 0; i < digi.size(); i++) {
71  int dig = digi.sample(i).adc() & 0x7f;
72  float ets = LedMonAdc2fc[dig] + 0.5;
73  // h2qts->Fill(i,ets);
74  qsum += ets;
75  }
76  // int ind = sector*14 + module;
77  // h2QvsPMT->Fill(ind,qsum);
78  h2qMap->Fill(module, sector, qsum);
79  } // end for(CastorDigiCollection::const_iterator j=castorDigis...
80 
81  ievt_++;
82  if (ievt_ % 100 == 0) {
83  for (int mod = 1; mod <= 14; mod++)
84  for (int sec = 1; sec <= 16; sec++) {
85  double a = h2qMap->getTH2F()->GetBinContent(mod, sec);
86  h2meanMap->getTH2F()->SetBinContent(mod, sec, a / double(ievt_));
87  }
88  }
89 
90  if (fVerbosity > 0)
91  std::cout << "CastorLEDMonitor::processEvent(end)" << std::endl;
92  return;
93 }
T getUntrackedParameter(std::string const &, T const &) const
std::string subsystemname
MonitorElement * h2meanMap
int sector() const
get the sector (1-16)
const HcalQIESample & sample(int i) const
access a sample
std::vector< CastorDataFrame >::const_iterator const_iterator
int module() const
get the module (1-2 for EM, 1-12 for HAD)
void Fill(long long x)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
void processEvent(const CastorDigiCollection &cast, const CastorDbService &cond)
constexpr int adc() const
get the ADC sample
Definition: HcalQIESample.h:59
TH2F * getTH2F() const
CastorLEDMonitor(const edm::ParameterSet &ps)
const_iterator end() const
static const float LedMonAdc2fc[128]
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
Definition: plugin.cc:24
double a
Definition: hdecay.h:121
const HcalCastorDetId & id() const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
int size() const
total number of samples in the digi
Definition: vlib.h:208
MonitorElement * h2qMap
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
const_iterator begin() const
Definition: Run.h:44