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_
 
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 16 of file CastorDigiMonitor.cc.

References doPerChannel_.

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

Definition at line 27 of file CastorDigiMonitor.cc.

28  {
29 
30  }

Member Function Documentation

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

Definition at line 75 of file CastorDigiMonitor.cc.

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

Referenced by CastorMonitorModule::beginRun().

76  {
77  if(fVerbosity>0) std::cout << "CastorDigiMonitor::beginRun (start)" << std::endl;
78 
79  if ( m_dbe !=NULL )
80  {
82  meEVT_ = m_dbe->bookInt("Digi Task Event Number");
83  meEVT_->Fill(ievt_);
84 
86 
88  std::string type = "Castor Digis ADC counts";
89  castHists.ALLPEDS = m_dbe->book1D(type,type,130,0,130);
90 
92  //type = "Castor Pedestal Mean Reference Values - from CondDB";
93  //castHists.PEDESTAL_REFS = m_dbe->book1D(type,type,50,0,50);
94  //type = "Castor Pedestal RMS Reference Values - from CondDB";
95  //castHists.WIDTH_REFS = m_dbe->book1D(type,type,20,0,10);
101  }
102  else
103  {
104  if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup - NO DQMStore service" << std::endl;
105  }
106 
107 
108  if(fVerbosity>0) std::cout << "CastorDigiMonitor::beginRun (end)" << std::endl;
109 
110  return;
111 }
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:872
#define NULL
Definition: scimark2.h:8
void Fill(long long x)
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:779
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void CastorDigiMonitor::done ( )
virtual

Reimplemented from CastorBaseMonitor.

Definition at line 219 of file CastorDigiMonitor.cc.

Referenced by CastorMonitorModule::endJob().

220  {
221 
222  return;
223  }
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 230 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().

234  {
235 
236  if(m_dbe) m_dbe->setCurrentFolder(baseFolder);
237 
239  for(unsigned int d=0; d<detID.size(); d++){
240  HcalCastorDetId detid = detID[d];
241  int capid = capID[d];
242  float pedVal = peds[d];
244  bool gotit=false;
245  if(REG[detid]) gotit=true;
246 
247  if(gotit){
249  std::map<int, MonitorElement*> _mei = toolP[detid];
250  if(_mei[capid]==NULL){
251  if(fVerbosity>0) std::cout<<"CastorDigiMonitor::perChanHists This histo is NULL!!??"<< std::endl;
252  }
253  else _mei[capid]->Fill(pedVal);
254 
260  }
261  else{
262  if(m_dbe){
263  std::map<int,MonitorElement*> insertP; //-- Pedestal values in ADC
265 
267  for(int i=0; i<4; i++){
268  char name[1024];
269  sprintf(name,"Castor Digi Value (ADC) zside=%d module=%d sector=%d CAPID=%d",
270  detid.zside(),detid.module(),detid.sector(),i);
271  insertP[i] = m_dbe->book1D(name,name,10,-0.5,9.5);
272 
276  }
277 
278  insertP[capid]->Fill(pedVal);
280  toolP[detid] = insertP;
282  }
283  REG[detid] = true;
284  }
285  }
286 }
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:872
#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:584
std::map< HcalCastorDetId, bool > REG
void CastorDigiMonitor::processEvent ( const CastorDigiCollection cast,
const CastorDbService cond 
)

Definition at line 117 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_, edm::SortedCollection< T, SORT >::end(), MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, i, CastorDataFrame::id(), ievt_, j, CastorBaseMonitor::m_dbe, meEVT_, pedVals_, perChanHists(), edm::CPUTimer::reset(), CastorDataFrame::sample(), CastorBaseMonitor::showTiming, CastorDataFrame::size(), edm::SortedCollection< T, SORT >::size(), edm::CPUTimer::start(), and edm::CPUTimer::stop().

Referenced by CastorMonitorModule::analyze().

118  {
119  if(fVerbosity>0) std::cout << "CastorDigiMonitor::processEvent (begin)"<< std::endl;
120 
121  if(!m_dbe) {
122  if(fVerbosity>0) std::cout<<"CastorDigiMonitor::processEvent DQMStore is not instantiated!!!"<<std::endl;
123  return;
124  }
125 
126  //if(!shape_) shape_ = cond.getCastorShape(); // this one is generic
127 
128  meEVT_->Fill(ievt_);
129 
130  CaloSamples tool;
131 
132  if(castorDigis.size()>0) {
133 
135  const CastorDataFrame digi = (const CastorDataFrame)(*j);
136 
137 
138  detID_.clear(); capID_.clear(); pedVals_.clear();
139 
140 
142 
143  // const CastorCalibrations& calibrations = cond.getCastorCalibrations(digi.id().rawId());
144  // const CastorPedestal* ped = cond.getPedestal(digi.id());
145  // const CastorPedestalWidth* pedw = cond.getPedestalWidth(digi.id());
148  // const CastorPedestal* ped = cond.getPedestal(digi.id());
149  // const CastorPedestalWidth* pedw = cond.getPedestalWidth(digi.id());
150 
151  /*
153  if(doFCpeds_){
154  channelCoder_ = cond.getCastorCoder(digi.id());
155  CastorCoderDb coderDB(*channelCoder_, *shape_);
156  coderDB.adc2fC(digi,tool);
157  }
158 
159 
161  for(int capID=0; capID<4; capID++){
163  float pedvalue=0;
164  if(ped) pedvalue=ped->getValue(capID);
165  castHists.PEDESTAL_REFS->Fill(pedvalue);
166  PEDESTAL_REFS->Fill(pedvalue);
170  float width=0;
171  if(pedw) width = pedw->getWidth(capID);
172  castHists.WIDTH_REFS->Fill(width);
173  WIDTH_REFS->Fill(width);
174  }
175  */
176 
177 
179 
180  // if(ievt_ %1000 == 0 ) // PK: skip limited number of events
181  // {
182  for (int i=0; i<digi.size(); i++) {
183  if(doFCpeds_) pedVals_.push_back(tool[i]); // default is FALSE
184  else pedVals_.push_back(digi.sample(i).adc());
185  detID_.push_back(digi.id());
186  capID_.push_back(digi.sample(i).capid());
187  castHists.ALLPEDS->Fill(pedVals_[i]);
188  }
189 
190  // }
191 
193  // if( ievt_%100 == 0 && doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_);
194  if( doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_); // PK: no special event selection done
195 
196  }
197  }
198  else {
199  if(fVerbosity>0) std::cout << "CastorPSMonitor::processEvent NO Castor Digis !!!" << std::endl;
200  }
201 
202  if (showTiming) {
203  cpu_timer.stop(); std::cout << " TIMER::CastorDigi -> " << cpu_timer.cpuTime() << std::endl;
205  }
206 
207  ievt_++;
208 
209  if(fVerbosity>0) std::cout << "CastorDigiMonitor::processEvent (end)"<< std::endl;
210 
211 
212  return;
213  }
int i
Definition: DBlmapReader.cc:9
edm::CPUTimer cpu_timer
void start()
Definition: CPUTimer.cc:74
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
void reset()
Definition: CPUTimer.cc:107
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)
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
void CastorDigiMonitor::reset ( void  )

Definition at line 36 of file CastorDigiMonitor.cc.

Referenced by CastorMonitorModule::reset().

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

Reimplemented from CastorBaseMonitor.

Definition at line 44 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().

45  {
46 
48 
49  if(fVerbosity>0) { std::cout << "CastorDigiMonitor::setup (start)" << std::endl; }
50 
51  //set base folder
52  baseFolder_ = rootFolder_+"CastorDigiMonitor";
53 
54  doPerChannel_ = ps.getUntrackedParameter<bool>("DigiPerChannel", false);
55  doFCpeds_ = ps.getUntrackedParameter<bool>("DigiInFC", true);
56 
57  ievt_=0;
58 
59  outputFile_ = ps.getUntrackedParameter<std::string>("PedestalFile", "");
60  if ( outputFile_.size() != 0 )
61  {
62  if(fVerbosity>0) { std::cout << "Castor Pedestal Calibrations will be saved to " << outputFile_.c_str() << std::endl; }
63  }
64 
65 
66  if(fVerbosity>0) { std::cout << "CastorDigiMonitor::setup (end)" << std::endl; }
67 
68  return;
69 }
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 59 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().

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 60 of file CastorDigiMonitor.h.

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

Definition at line 56 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 57 of file CastorDigiMonitor.h.

MonitorElement* CastorDigiMonitor::WIDTH_REFS
private

Definition at line 53 of file CastorDigiMonitor.h.