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

 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 (std::vector< HcalCastorDetId > detID, std::vector< int > capID, 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_.

16 { doPerChannel_ = false; }
CastorDigiMonitor::~CastorDigiMonitor ( )

Definition at line 22 of file CastorDigiMonitor.cc.

22  {
23 }

Member Function Documentation

void CastorDigiMonitor::done ( )
virtual

Reimplemented from CastorBaseMonitor.

Definition at line 188 of file CastorDigiMonitor.cc.

Referenced by CastorMonitorModule::endJob().

188  {
189  return;
190 }
void CastorDigiMonitor::perChanHists ( std::vector< HcalCastorDetId detID,
std::vector< int >  capID,
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 197 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().

201  {
202 
203  if(m_dbe) m_dbe->setCurrentFolder(baseFolder);
204 
206  for(unsigned int d=0; d<detID.size(); d++){
207  HcalCastorDetId detid = detID[d];
208  int capid = capID[d];
209  float pedVal = peds[d];
211  bool gotit=false;
212  if(REG[detid]) gotit=true;
213 
214  if(gotit){
216  std::map<int, MonitorElement*> _mei = toolP[detid];
217  if(_mei[capid]==NULL){
218  if(fVerbosity>0) std::cout<<"CastorDigiMonitor::perChanHists This histo is NULL!!??"<< std::endl;
219  }
220  else _mei[capid]->Fill(pedVal);
221 
227  }
228  else{
229  if(m_dbe){
230  std::map<int,MonitorElement*> insertP; //-- Pedestal values in ADC
232 
234  for(int i=0; i<4; i++){
235  char name[1024];
236  sprintf(name,"Castor Digi Value (ADC) zside=%d module=%d sector=%d CAPID=%d",
237  detid.zside(),detid.module(),detid.sector(),i);
238  insertP[i] = m_dbe->book1D(name,name,10,-0.5,9.5);
239 
243  }
244 
245  insertP[capid]->Fill(pedVal);
247  toolP[detid] = insertP;
249  }
250  REG[detid] = true;
251  }
252  }
253 }
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:717
#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:429
std::map< HcalCastorDetId, bool > REG
void CastorDigiMonitor::processEvent ( const CastorDigiCollection cast,
const CastorDbService cond 
)

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

91 {
92 
93  if(fVerbosity>0) std::cout << "==>CastorDigiMonitor::processEvent !!!"<< std::endl;
94 
95 
96  meEVT_->Fill(ievt_);
97 
98  //if(!shape_) shape_ = cond.getCastorShape(); // this one is generic
99 
100 
101  if(!m_dbe) {
102  if(fVerbosity>0) std::cout<<"CastorDigiMonitor::processEvent DQMStore is not instantiated!!!"<<std::endl;
103  return;
104  }
105 
106 
107  CaloSamples tool;
108 
109  if(castorDigis.size()>0) {
110 
112  const CastorDataFrame digi = (const CastorDataFrame)(*j);
113 
114 
115  detID_.clear(); capID_.clear(); pedVals_.clear();
116 
117 
119 
120  // const CastorCalibrations& calibrations = cond.getCastorCalibrations(digi.id().rawId());
121  // const CastorPedestal* ped = cond.getPedestal(digi.id());
122  // const CastorPedestalWidth* pedw = cond.getPedestalWidth(digi.id());
125  // const CastorPedestal* ped = cond.getPedestal(digi.id());
126  // const CastorPedestalWidth* pedw = cond.getPedestalWidth(digi.id());
127 
128  /*
130  if(doFCpeds_){
131  channelCoder_ = cond.getCastorCoder(digi.id());
132  CastorCoderDb coderDB(*channelCoder_, *shape_);
133  coderDB.adc2fC(digi,tool);
134  }
135 
136 
138  for(int capID=0; capID<4; capID++){
140  float pedvalue=0;
141  if(ped) pedvalue=ped->getValue(capID);
142  castHists.PEDESTAL_REFS->Fill(pedvalue);
143  PEDESTAL_REFS->Fill(pedvalue);
147  float width=0;
148  if(pedw) width = pedw->getWidth(capID);
149  castHists.WIDTH_REFS->Fill(width);
150  WIDTH_REFS->Fill(width);
151  }
152  */
153 
154 
156 
157  // if(ievt_ %1000 == 0 ) // PK: skip limited number of events
158  // {
159  for (int i=0; i<digi.size(); i++) {
160  if(doFCpeds_) pedVals_.push_back(tool[i]); // default is FALSE
161  else pedVals_.push_back(digi.sample(i).adc());
162  detID_.push_back(digi.id());
163  capID_.push_back(digi.sample(i).capid());
164  castHists.ALLPEDS->Fill(pedVals_[i]);
165  }
166 
167  // }
168 
170  // if( ievt_%100 == 0 && doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_);
171  if( doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_); // PK: no special event selection done
172 
173  }
174  }
175  else {
176  if(fVerbosity>0) std::cout << "CastorPSMonitor::processEvent NO Castor Digis !!!" << std::endl;
177  }
178 
179  if (showTiming) {
180  cpu_timer.stop(); std::cout << " TIMER::CastorDigi -> " << cpu_timer.cpuTime() << std::endl;
182  }
183 
184  ievt_++;
185  return;
186 }
int i
Definition: DBlmapReader.cc:9
edm::CPUTimer cpu_timer
void start()
Definition: CPUTimer.cc:74
void perChanHists(std::vector< HcalCastorDetId > detID, std::vector< int > capID, std::vector< float > peds, std::map< HcalCastorDetId, std::map< int, MonitorElement * > > &toolP, std::string baseFolder)
int adc() const
get the ADC sample
Definition: HcalQIESample.h:24
const HcalQIESample & sample(int i) const
access a sample
std::vector< T >::const_iterator const_iterator
void reset()
Definition: CPUTimer.cc:107
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:157
int capid() const
get the Capacitor id
Definition: HcalQIESample.h:28
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
struct CastorDigiMonitor::@167 castHists
void CastorDigiMonitor::reset ( void  )

Definition at line 29 of file CastorDigiMonitor.cc.

Referenced by CastorMonitorModule::reset().

29  {
30 }
void CastorDigiMonitor::setup ( const edm::ParameterSet ps,
DQMStore dbe 
)
virtual

Reimplemented from CastorBaseMonitor.

Definition at line 35 of file CastorDigiMonitor.cc.

References CastorBaseMonitor::baseFolder_, DQMStore::book1D(), DQMStore::bookInt(), castHists, gather_cfg::cout, doFCpeds_, doPerChannel_, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, edm::ParameterSet::getUntrackedParameter(), ievt_, CastorBaseMonitor::m_dbe, meEVT_, NULL, outputFile_, CastorBaseMonitor::rootFolder_, DQMStore::setCurrentFolder(), and CastorBaseMonitor::setup().

Referenced by CastorMonitorModule::CastorMonitorModule().

35  {
37  baseFolder_ = rootFolder_+"CastorDigiMonitor";
38 
39  if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup (start)" << std::endl;
40 
41  doPerChannel_ = ps.getUntrackedParameter<bool>("DigiPerChannel", false);
42  doFCpeds_ = ps.getUntrackedParameter<bool>("DigiInFC", true);
43 
44  ievt_=0;
45 
46  if ( m_dbe !=NULL ) {
48  meEVT_ = m_dbe->bookInt("Digi Task Event Number");
49  meEVT_->Fill(ievt_);
50 
52 
54  std::string type = "Castor Digis ADC counts";
55  castHists.ALLPEDS = m_dbe->book1D(type,type,130,0,130);
56 
58  //type = "Castor Pedestal Mean Reference Values - from CondDB";
59  //castHists.PEDESTAL_REFS = m_dbe->book1D(type,type,50,0,50);
60  //type = "Castor Pedestal RMS Reference Values - from CondDB";
61  //castHists.WIDTH_REFS = m_dbe->book1D(type,type,20,0,10);
67 
68 }
69 
70  else{
71  if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup - NO DQMStore service" << std::endl;
72  }
73 
74 
75  outputFile_ = ps.getUntrackedParameter<std::string>("PedestalFile", "");
76  if ( outputFile_.size() != 0 ) { if(fVerbosity>0) std::cout << "Castor Pedestal Calibrations will be saved to " << outputFile_.c_str() << std::endl;}
77 
78 
79  if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup (end)" << std::endl;
80 
81  return;
82 }
type
Definition: HCALResponse.h:22
T getUntrackedParameter(std::string const &, T const &) const
virtual void setup(const edm::ParameterSet &ps, DQMStore *dbe)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
#define NULL
Definition: scimark2.h:8
void Fill(long long x)
std::string baseFolder_
MonitorElement * meEVT_
std::string rootFolder_
std::string outputFile_
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:624
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
struct CastorDigiMonitor::@167 castHists

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 processEvent(), and setup().

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 processEvent(), and setup().

MonitorElement* CastorDigiMonitor::meEVT_
private

Definition at line 48 of file CastorDigiMonitor.h.

Referenced by processEvent(), and setup().

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.