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
CastorDigiMonitor Class Reference

#include <CastorDigiMonitor.h>

Inheritance diagram for CastorDigiMonitor:
CastorBaseMonitor

Public Member Functions

void beginRun (const edm::EventSetup &iSetup)
 
 CastorDigiMonitor ()
 
void done ()
 
void processEvent (const CastorDigiCollection &cast, const CastorDbService &cond)
 
void reset ()
 
void setup (const edm::ParameterSet &ps, DQMStore *dbe)
 
 ~CastorDigiMonitor ()
 
- Public Member Functions inherited from CastorBaseMonitor
 CastorBaseMonitor ()
 
virtual void clearME ()
 
bool getDiagnostics () const
 
int getVerbosity () const
 
void setDiagnostics (bool myval)
 
void setVerbosity (int verb)
 
bool vetoCell (HcalCastorDetId id)
 
virtual ~CastorBaseMonitor ()
 

Private Member Functions

void perChanHists (const std::vector< HcalCastorDetId > &detID, const std::vector< int > &capID, const std::vector< float > &peds, std::map< HcalCastorDetId, std::map< int, MonitorElement * > > &toolP, std::string baseFolder)
 

Private Attributes

std::vector< int > capID_
 
struct {
   MonitorElement *   ALLPEDS
 
   MonitorElement *   PEDESTAL_REFS
 
   MonitorElement *   PEDRMS
 
   std::map< HcalCastorDetId,
std::map< int, MonitorElement * > >   PEDVALS
 
   std::map< HcalCastorDetId,
std::map< int, MonitorElement * > >   SUBVALS
 
   MonitorElement *   WIDTH_REFS
 
castHists
 
const CastorQIECoderchannelCoder_
 
std::vector< HcalCastorDetIddetID_
 
bool doFCpeds_
 
bool doPerChannel_
 
MonitorElementh2digierr
 
int ievt_
 
MonitorElementmeEVT_
 
std::map< HcalCastorDetId,
std::map< int, MonitorElement * >
>::iterator 
meo_
 
std::string outputFile_
 
MonitorElementPEDESTAL_REFS
 
std::vector< float > pedVals_
 
std::map< HcalCastorDetId, bool > REG
 
const CastorQIEShapeshape_
 
MonitorElementWIDTH_REFS
 

Additional Inherited Members

- Protected Attributes inherited from CastorBaseMonitor
std::string baseFolder_
 
edm::CPUTimer cpu_timer
 
int fVerbosity
 
DQMStorem_dbe
 
bool makeDiagnostics
 
std::string rootFolder_
 
bool showTiming
 

Detailed Description

Definition at line 15 of file CastorDigiMonitor.h.

Constructor & Destructor Documentation

CastorDigiMonitor::CastorDigiMonitor ( )

Definition at line 17 of file CastorDigiMonitor.cc.

References doPerChannel_.

18  {
19 
20  doPerChannel_ = false;
21 
22  }
CastorDigiMonitor::~CastorDigiMonitor ( )

Definition at line 28 of file CastorDigiMonitor.cc.

29  {
30 
31  }

Member Function Documentation

void CastorDigiMonitor::beginRun ( const edm::EventSetup iSetup)

Definition at line 76 of file CastorDigiMonitor.cc.

References CastorBaseMonitor::baseFolder_, DQMStore::book1D(), DQMStore::book2DD(), DQMStore::bookInt(), castHists, gather_cfg::cout, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, h2digierr, ievt_, CastorBaseMonitor::m_dbe, meEVT_, NULL, indexGen::s2, DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CastorMonitorModule::beginRun().

77  {
78  if(fVerbosity>0) std::cout << "CastorDigiMonitor::beginRun (start)" << std::endl;
79 
80  if ( m_dbe !=NULL )
81  {
83  meEVT_ = m_dbe->bookInt("Digi Task Event Number");
84  meEVT_->Fill(ievt_);
85 
87 
89  std::string type = "Castor Digis ADC counts";
90  castHists.ALLPEDS = m_dbe->book1D(type,type,130,0,130);
91 
93  //type = "Castor Pedestal Mean Reference Values - from CondDB";
94  //castHists.PEDESTAL_REFS = m_dbe->book1D(type,type,50,0,50);
95  //type = "Castor Pedestal RMS Reference Values - from CondDB";
96  //castHists.WIDTH_REFS = m_dbe->book1D(type,type,20,0,10);
102 
103  std::string s2 = "QIE_capID+er+dv";
104  std::string s3 = "qieError2D";
105  h2digierr = m_dbe->book2DD(s3,s2,16,0.5,16.5, 14,0.5,14.5);
106  }
107  else
108  {
109  if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup - NO DQMStore service" << std::endl;
110  }
111 
112 
113  if(fVerbosity>0) std::cout << "CastorDigiMonitor::beginRun (end)" << std::endl;
114 
115  return;
116 }
type
Definition: HCALResponse.h:21
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
MonitorElement * book2DD(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D double histogram.
Definition: DQMStore.cc:1114
#define NULL
Definition: scimark2.h:8
tuple s2
Definition: indexGen.py:106
void Fill(long long x)
MonitorElement * h2digierr
std::string baseFolder_
MonitorElement * meEVT_
struct CastorDigiMonitor::@253 castHists
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:849
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void CastorDigiMonitor::done ( )
virtual

Reimplemented from CastorBaseMonitor.

Definition at line 239 of file CastorDigiMonitor.cc.

References gather_cfg::cout, CastorBaseMonitor::fVerbosity, MonitorElement::getEntries(), h2digierr, CastorBaseMonitor::m_dbe, and NULL.

Referenced by CastorMonitorModule::endJob().

240 {
241  if(m_dbe!=NULL && h2digierr!=NULL)
242  {
243  if(fVerbosity>0)
244  {
245  long int hdigierrEntr = h2digierr->getEntries();
246  std::cout << "CastorDigiMonitor: capId,er,dv summary (entries=" << hdigierrEntr << "):" << std::endl;
247  }
248  }
249  else
250  edm::LogWarning("CastorDigiMonitor") << "DQMStore or histogram not available";
251 
252  return;
253 }
#define NULL
Definition: scimark2.h:8
double getEntries(void) const
get # of entries
MonitorElement * h2digierr
tuple cout
Definition: gather_cfg.py:121
void CastorDigiMonitor::perChanHists ( const std::vector< HcalCastorDetId > &  detID,
const std::vector< int > &  capID,
const std::vector< float > &  peds,
std::map< HcalCastorDetId, std::map< int, MonitorElement * > > &  toolP,
std::string  baseFolder 
)
private
Parameters
baseFolder/// std::map<HcalCastorDetId, std::map<int, MonitorElement*> > &toolS,

Definition at line 260 of file CastorDigiMonitor.cc.

References DQMStore::book1D(), gather_cfg::cout, cond::rpcobgas::detid, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, i, CastorBaseMonitor::m_dbe, mergeVDriftHistosByStation::name, NULL, REG, and DQMStore::setCurrentFolder().

Referenced by processEvent().

264  {
265 
266  if(m_dbe) m_dbe->setCurrentFolder(baseFolder);
267 
269  for(unsigned int d=0; d<detID.size(); d++){
270  HcalCastorDetId detid = detID[d];
271  int capid = capID[d];
272  float pedVal = peds[d];
274  bool gotit=false;
275  if(REG[detid]) gotit=true;
276 
277  if(gotit){
279  std::map<int, MonitorElement*> _mei = toolP[detid];
280  if(_mei[capid]==NULL){
281  if(fVerbosity>0) std::cout<<"CastorDigiMonitor::perChanHists This histo is NULL!!??"<< std::endl;
282  }
283  else _mei[capid]->Fill(pedVal);
284 
290  }
291  else{
292  if(m_dbe){
293  std::map<int,MonitorElement*> insertP; //-- Pedestal values in ADC
295 
297  for(int i=0; i<4; i++){
298  char name[1024];
299  sprintf(name,"Castor Digi Value (ADC) zside=%d module=%d sector=%d CAPID=%d",
300  detid.zside(),detid.module(),detid.sector(),i);
301  insertP[i] = m_dbe->book1D(name,name,10,-0.5,9.5);
302 
306  }
307 
308  insertP[capid]->Fill(pedVal);
310  toolP[detid] = insertP;
312  }
313  REG[detid] = true;
314  }
315  }
316 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
#define NULL
Definition: scimark2.h:8
void Fill(long long x)
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
std::map< HcalCastorDetId, bool > REG
void CastorDigiMonitor::processEvent ( const CastorDigiCollection cast,
const CastorDbService cond 
)

Definition at line 122 of file CastorDigiMonitor.cc.

References HcalQIESample::adc(), CastorBaseMonitor::baseFolder_, edm::SortedCollection< T, SORT >::begin(), HcalQIESample::capid(), capID_, castHists, gather_cfg::cout, CastorBaseMonitor::cpu_timer, edm::CPUTimer::cpuTime(), detID_, doFCpeds_, doPerChannel_, HcalQIESample::dv(), edm::SortedCollection< T, SORT >::end(), HcalQIESample::er(), MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, h2digierr, i, CastorDataFrame::id(), ievt_, j, CastorBaseMonitor::m_dbe, meEVT_, HcalCastorDetId::module(), pedVals_, perChanHists(), edm::CPUTimer::reset(), CastorDataFrame::sample(), HcalCastorDetId::sector(), CastorBaseMonitor::showTiming, CastorDataFrame::size(), edm::SortedCollection< T, SORT >::size(), edm::CPUTimer::start(), and edm::CPUTimer::stop().

Referenced by CastorMonitorModule::analyze().

123  {
124  if(fVerbosity>0) std::cout << "CastorDigiMonitor::processEvent (begin)"<< std::endl;
125 
126  if(!m_dbe) {
127  if(fVerbosity>0) std::cout<<"CastorDigiMonitor::processEvent DQMStore is not instantiated!!!"<<std::endl;
128  return;
129  }
130 
131  //if(!shape_) shape_ = cond.getCastorShape(); // this one is generic
132 
133  meEVT_->Fill(ievt_);
134 
135  CaloSamples tool;
136 
137  if(castorDigis.size()>0) {
138 
140  const CastorDataFrame digi = (const CastorDataFrame)(*j);
141 
142 
143  detID_.clear(); capID_.clear(); pedVals_.clear();
144 
145 
147 
148  // const CastorCalibrations& calibrations = cond.getCastorCalibrations(digi.id().rawId());
149  // const CastorPedestal* ped = cond.getPedestal(digi.id());
150  // const CastorPedestalWidth* pedw = cond.getPedestalWidth(digi.id());
153  // const CastorPedestal* ped = cond.getPedestal(digi.id());
154  // const CastorPedestalWidth* pedw = cond.getPedestalWidth(digi.id());
155 
156  /*
158  if(doFCpeds_){
159  channelCoder_ = cond.getCastorCoder(digi.id());
160  CastorCoderDb coderDB(*channelCoder_, *shape_);
161  coderDB.adc2fC(digi,tool);
162  }
163 
164 
166  for(int capID=0; capID<4; capID++){
168  float pedvalue=0;
169  if(ped) pedvalue=ped->getValue(capID);
170  castHists.PEDESTAL_REFS->Fill(pedvalue);
171  PEDESTAL_REFS->Fill(pedvalue);
175  float width=0;
176  if(pedw) width = pedw->getWidth(capID);
177  castHists.WIDTH_REFS->Fill(width);
178  WIDTH_REFS->Fill(width);
179  }
180  */
181 
182 
184 
185  // if(ievt_ %1000 == 0 ) // PK: skip limited number of events
186  // {
187  for (int i=0; i<digi.size(); i++) {
188  if(doFCpeds_) pedVals_.push_back(tool[i]); // default is FALSE
189  else pedVals_.push_back(digi.sample(i).adc());
190  detID_.push_back(digi.id());
191  capID_.push_back(digi.sample(i).capid());
192  castHists.ALLPEDS->Fill(pedVals_[i]);
193  }
194 
195  // }
196 
198  // if( ievt_%100 == 0 && doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_);
199  if( doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_); // PK: no special event selection done
200  int capid1 = digi.sample(0).capid();
201  for (int i=1; i<digi.size(); i++) {
202  int module = digi.id().module();
203  int sector = digi.id().sector();
204  if(capid1 < 3) capid1++;
205  else capid1 = 0;
206  int capid = digi.sample(i).capid();
207  int dv = digi.sample(i).dv();
208  int er = digi.sample(i).er();
209  int err = (capid != capid1) | er<<1 | (!dv)<<2; // =0
210  if(err !=0) h2digierr->Fill(sector,module);
211 // if(err != 0 && fVerbosity>0)
212 // std::cout<<"event/idigi=" <<ievt_<<"/" <<i<< " cap_cap1_dv_er: " <<
213 // capid <<"="<< capid1 <<" "<< dv <<" "<< er<<" "<< err << std::endl;
214  capid1 = capid;
215  }
216  }
217  }
218  else {
219  if(fVerbosity>0) std::cout << "CastorPSMonitor::processEvent NO Castor Digis !!!" << std::endl;
220  }
221 
222  if (showTiming) {
223  cpu_timer.stop(); std::cout << " TIMER::CastorDigi -> " << cpu_timer.cpuTime() << std::endl;
225  }
226 
227  ievt_++;
228 
229  if(fVerbosity>0) std::cout << "CastorDigiMonitor::processEvent (end)"<< std::endl;
230 
231 
232  return;
233  }
int i
Definition: DBlmapReader.cc:9
edm::CPUTimer cpu_timer
void start()
Definition: CPUTimer.cc:74
int sector() const
get the sector (1-16)
int adc() const
get the ADC sample
Definition: HcalQIESample.h:22
const HcalQIESample & sample(int i) const
access a sample
std::vector< CastorDataFrame >::const_iterator const_iterator
bool dv() const
is the Data Valid bit set?
Definition: HcalQIESample.h:28
void reset()
Definition: CPUTimer.cc:107
int module() const
get the module (1-2 for EM, 1-12 for HAD)
void perChanHists(const std::vector< HcalCastorDetId > &detID, const std::vector< int > &capID, const std::vector< float > &peds, std::map< HcalCastorDetId, std::map< int, MonitorElement * > > &toolP, std::string baseFolder)
void Fill(long long x)
MonitorElement * h2digierr
std::string baseFolder_
int j
Definition: DBlmapReader.cc:9
MonitorElement * meEVT_
Times stop()
Definition: CPUTimer.cc:94
double cpuTime() const
Definition: CPUTimer.cc:158
int capid() const
get the Capacitor id
Definition: HcalQIESample.h:26
struct CastorDigiMonitor::@253 castHists
std::vector< float > pedVals_
std::vector< HcalCastorDetId > detID_
std::vector< int > capID_
tuple cout
Definition: gather_cfg.py:121
const HcalCastorDetId & id() const
int size() const
total number of samples in the digi
Definition: vlib.h:208
bool er() const
is the error bit set?
Definition: HcalQIESample.h:30
void CastorDigiMonitor::reset ( void  )

Definition at line 37 of file CastorDigiMonitor.cc.

Referenced by CastorMonitorModule::reset().

38  {
39 
40  }
void CastorDigiMonitor::setup ( const edm::ParameterSet ps,
DQMStore dbe 
)
virtual

Reimplemented from CastorBaseMonitor.

Definition at line 45 of file CastorDigiMonitor.cc.

References CastorBaseMonitor::baseFolder_, gather_cfg::cout, doFCpeds_, doPerChannel_, CastorBaseMonitor::fVerbosity, edm::ParameterSet::getUntrackedParameter(), ievt_, outputFile_, CastorBaseMonitor::rootFolder_, CastorBaseMonitor::setup(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CastorMonitorModule::CastorMonitorModule().

46  {
47 
49 
50  if(fVerbosity>0) { std::cout << "CastorDigiMonitor::setup (start)" << std::endl; }
51 
52  //set base folder
53  baseFolder_ = rootFolder_+"CastorDigiMonitor";
54 
55  doPerChannel_ = ps.getUntrackedParameter<bool>("DigiPerChannel", false);
56  doFCpeds_ = ps.getUntrackedParameter<bool>("DigiInFC", true);
57 
58  ievt_=0;
59 
60  outputFile_ = ps.getUntrackedParameter<std::string>("PedestalFile", "");
61  if ( outputFile_.size() != 0 )
62  {
63  if(fVerbosity>0) { std::cout << "Castor Pedestal Calibrations will be saved to " << outputFile_.c_str() << std::endl; }
64  }
65 
66 
67  if(fVerbosity>0) { std::cout << "CastorDigiMonitor::setup (end)" << std::endl; }
68 
69  return;
70 }
T getUntrackedParameter(std::string const &, T const &) const
virtual void setup(const edm::ParameterSet &ps, DQMStore *dbe)
std::string baseFolder_
std::string rootFolder_
std::string outputFile_
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

MonitorElement* CastorDigiMonitor::ALLPEDS

Definition at line 61 of file CastorDigiMonitor.h.

std::vector<int> CastorDigiMonitor::capID_
private

Definition at line 38 of file CastorDigiMonitor.h.

Referenced by processEvent().

struct { ... } CastorDigiMonitor::castHists

Referenced by beginRun(), and processEvent().

const CastorQIECoder* CastorDigiMonitor::channelCoder_
private

Definition at line 44 of file CastorDigiMonitor.h.

std::vector<HcalCastorDetId> CastorDigiMonitor::detID_
private

Definition at line 37 of file CastorDigiMonitor.h.

Referenced by processEvent().

bool CastorDigiMonitor::doFCpeds_
private

Definition at line 35 of file CastorDigiMonitor.h.

Referenced by processEvent(), and setup().

bool CastorDigiMonitor::doPerChannel_
private

Definition at line 34 of file CastorDigiMonitor.h.

Referenced by CastorDigiMonitor(), processEvent(), and setup().

MonitorElement* CastorDigiMonitor::h2digierr
private

Definition at line 55 of file CastorDigiMonitor.h.

Referenced by beginRun(), done(), and processEvent().

int CastorDigiMonitor::ievt_
private

Definition at line 49 of file CastorDigiMonitor.h.

Referenced by beginRun(), processEvent(), and setup().

MonitorElement* CastorDigiMonitor::meEVT_
private

Definition at line 48 of file CastorDigiMonitor.h.

Referenced by beginRun(), and processEvent().

std::map<HcalCastorDetId, std::map<int,MonitorElement*> >::iterator CastorDigiMonitor::meo_
private

Definition at line 36 of file CastorDigiMonitor.h.

std::string CastorDigiMonitor::outputFile_
private

Definition at line 41 of file CastorDigiMonitor.h.

Referenced by setup().

MonitorElement* CastorDigiMonitor::PEDESTAL_REFS
private

Definition at line 52 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::PEDRMS

Definition at line 62 of file CastorDigiMonitor.h.

std::map<HcalCastorDetId,std::map<int, MonitorElement*> > CastorDigiMonitor::PEDVALS

Definition at line 58 of file CastorDigiMonitor.h.

std::vector<float> CastorDigiMonitor::pedVals_
private

Definition at line 39 of file CastorDigiMonitor.h.

Referenced by processEvent().

std::map<HcalCastorDetId,bool> CastorDigiMonitor::REG
private

Definition at line 51 of file CastorDigiMonitor.h.

Referenced by perChanHists().

const CastorQIEShape* CastorDigiMonitor::shape_
private

Definition at line 43 of file CastorDigiMonitor.h.

std::map<HcalCastorDetId,std::map<int, MonitorElement*> > CastorDigiMonitor::SUBVALS

Definition at line 59 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::WIDTH_REFS
private

Definition at line 53 of file CastorDigiMonitor.h.