CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
SiStripMonitorPedestals Class Reference

#include <SiStripMonitorPedestals.h>

Inheritance diagram for SiStripMonitorPedestals:
edm::EDAnalyzer

Classes

struct  ModMEs
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
virtual void endJob ()
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
 SiStripMonitorPedestals (const edm::ParameterSet &)
 
 ~SiStripMonitorPedestals ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void createMEs ()
 
void fillCondDBMEs (edm::EventSetup const &eSetup)
 
void resetMEs (uint32_t idet)
 

Private Attributes

bool analyzed
 
ApvAnalysisFactoryapvFactory_
 
edm::ParameterSet conf_
 
edm::ESHandle< SiStripDetCablingdetcabling
 
DQMStoredqmStore_
 
bool firstEvent
 
unsigned long long m_cacheID_
 
int16_t nEvInit_
 
int16_t nEvTot_
 
int16_t nEvUpdate_
 
int nIteration_
 
int NumCMstripsInGroup_
 
std::string outPutFileName
 
std::map< uint32_t, ModMEsPedMEs
 
edm::ParameterSet pedsPSet_
 
std::string runTypeFlag_
 
int16_t signalCutPeds_
 
int theEventInitNumber_
 
int theEventIterNumber_
 

Static Private Attributes

static const std::string RunMode1 = "ConDBPlotsOnly"
 
static const std::string RunMode2 = "CalculatedPlotsOnly"
 
static const std::string RunMode3 = "AllPlots"
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 55 of file SiStripMonitorPedestals.h.

Constructor & Destructor Documentation

SiStripMonitorPedestals::SiStripMonitorPedestals ( const edm::ParameterSet iConfig)
explicit

Definition at line 53 of file SiStripMonitorPedestals.cc.

53  :
55  conf_(iConfig),
56  pedsPSet_(iConfig.getParameter<edm::ParameterSet>("PedestalsPSet")),
57  analyzed(false),
58  firstEvent(true),
59  signalCutPeds_(4),
60  nEvTot_(0),
61  nIteration_(0),
62  apvFactory_(0),
63  m_cacheID_(0)
64 {
65  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals "
66  << " Constructing....... ";
67 }
T getParameter(std::string const &) const
ApvAnalysisFactory * apvFactory_
SiStripMonitorPedestals::~SiStripMonitorPedestals ( )

Definition at line 71 of file SiStripMonitorPedestals.cc.

References apvFactory_.

72 {
73  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals "
74  << " Destructing...... ";
75  if (apvFactory_) {delete apvFactory_;}
76 }
ApvAnalysisFactory * apvFactory_

Member Function Documentation

void SiStripMonitorPedestals::analyze ( const edm::Event iEvent,
const edm::EventSetup eSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 265 of file SiStripMonitorPedestals.cc.

References apvFactory_, SiStripMonitorPedestals::ModMEs::CMDistribution, SiStripMonitorPedestals::ModMEs::CMSlopeDistribution, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStrip, SiStripMonitorPedestals::ModMEs::CMSubNoiseProfile, conf_, gather_cfg::cout, detcabling, cond::rpcobgas::detid, EcnaSystemPythonModuleInsert_2::digiProducer, edm::EventID::event(), HcalObjRepresent::Fill(), firstEvent, edm::EventSetup::get(), edm::Event::getByLabel(), ApvAnalysisFactory::getCommonMode(), ApvAnalysisFactory::getCommonModeSlope(), ApvAnalysisFactory::getMask(), ApvAnalysisFactory::getNoise(), edm::ParameterSet::getParameter(), ApvAnalysisFactory::getPedestal(), ApvAnalysisFactory::getRawNoise(), i, edm::EventBase::id(), gen::k, nEvTot_, nIteration_, SiStripMonitorPedestals::ModMEs::NoisyStripDistribution, SiStripMonitorPedestals::ModMEs::NoisyStrips, NULL, NumCMstripsInGroup_, PedMEs, SiStripMonitorPedestals::ModMEs::PedsDistribution, SiStripMonitorPedestals::ModMEs::PedsEvolution, SiStripMonitorPedestals::ModMEs::PedsPerStrip, SiStripMonitorPedestals::ModMEs::RawNoisePerStrip, SiStripMonitorPedestals::ModMEs::RawNoiseProfile, edm::EventID::run(), RunMode2, RunMode3, runTypeFlag_, cond::rpcobtemp::temp, theEventInitNumber_, theEventIterNumber_, tmp, and ApvAnalysisFactory::update().

266 {
267 
268  edm::LogInfo("SiStripMonitorPedestals") <<
269  "SiStripMonitorPedestals::analyze: Run " <<
270  iEvent.id().run() << " Event " << iEvent.id().event();
271 
272  eSetup.get<SiStripDetCablingRcd>().get( detcabling );
273 
274  if (runTypeFlag_ != RunMode2 && runTypeFlag_ != RunMode3 ) return;
275 
276  //Increment # of Events
277  nEvTot_++;
278 
279  // retrieve producer name of input StripDigiCollection
280  std::string digiProducer = conf_.getParameter<std::string>("DigiProducer");
281  // get DigiCollection object from Event
283  std::string digiType = "VirginRaw";
284  //you have a collection as there are all the digis for the event for every detector
285  iEvent.getByLabel(digiProducer, digiType, digi_collection);
286 
287  //Increase the number of iterations ...
289 
290 
291  // loop over all MEs
292  for (std::map<uint32_t, ModMEs >::const_iterator i = PedMEs.begin() ; i!=PedMEs.end() ; i++) {
293  uint32_t detid = i->first; ModMEs local_modmes = i->second;
294  // get iterators for digis belonging to one DetId, it is an iterator, i.e. one element of the vector
295  std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( detid );
296  if (digis == digi_collection->end() ||
297  digis->data.size() == 0 ||
298  digis->data.size() > 768) {
299  if (digis == digi_collection->end()) {
300  edm::LogError("SiStripMonitorPedestals") << " SiStripMonitorPedestals::analyze: Event " << nEvTot_
301  << " DetId " << detid << " at the end of Digi Collection!!!";
302  } else {
303  edm::LogError("SiStripMonitorPedestals") << " [SiStripMonitorPedestals::analyze: Event " << nEvTot_
304  << " DetId " << detid << " # of Digis " << digis->data.size() ;
305  }
306  std::vector<FedChannelConnection> fed_conns = detcabling->getConnections(detid);
307  for (unsigned int k = 0; k < fed_conns.size() ; k++) {
308  if (k==0) edm::LogError("SiStripMonitorPedestals") <<" SiStripMonitorPedestals::analyze: Fed Id " <<
309  fed_conns[k].fedId() << " Channel " << fed_conns[k].fedCh();
310  else edm::LogError("SiStripMonitorPedestals") <<" SiStripMonitorPedestals::analyze: Channel " <<
311  fed_conns[k].fedCh();
312  }
313  std::cout << std::endl;
314  continue;
315  }
316 
317  if ( digis->data.empty() ) {
318  edm::LogError("MonitorDigi_tmp") << "[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
319  }
320  uint32_t id = detid;
321  // cout <<"Data size "<<digis->data.size()<<endl;
322  apvFactory_->update(id, (*digis));
323 
325  if(local_modmes.CMDistribution != NULL){
326  std::vector<float> tmp;
327  tmp.clear();
328  apvFactory_->getCommonMode(id, tmp);
329  //unpacking the info looking at the right topology
330  int numberCMBlocks = int(128. / NumCMstripsInGroup_);
331  int ibin=0;
332  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
333  int iapv = int (ibin/numberCMBlocks);
334  (local_modmes.CMDistribution)->Fill(iapv,static_cast<float>(*iped));
335  ibin++;
336 
337  }
338  }
339  if(local_modmes.CMSlopeDistribution != NULL){
340  std::vector<float> tmp;
341  tmp.clear();
342  int iapv = 0;
344  for (std::vector<float>::const_iterator it=tmp.begin(); it!=tmp.end();it++) {
345  (local_modmes.CMSlopeDistribution)->Fill(iapv,static_cast<float>(*it));
346  iapv++;
347  }
348  }
349  }
350 
351  //asking for the status
353  {
354 
355  std::vector<float> tmp;
356  tmp.clear();
357  apvFactory_->getPedestal(id, tmp);
358  if(local_modmes.PedsPerStrip != NULL){
359  int numberOfApvs = int(tmp.size()/128.);
360  for(int i=0; i<numberOfApvs;i++){
361  std::vector<float> myPedPerApv;
362  apvFactory_->getPedestal(id, i, myPedPerApv);
363  float avarage = 0;
364  avarage = accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
365  avarage = avarage/128.;
366  (local_modmes.PedsEvolution)->setBinContent(i+1,nIteration_,avarage);
367 
368  }
369  int ibin=0;
370 
371  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
372  int napv = int(ibin / 128.);
373  ibin++;
374  float last_value = (local_modmes.PedsPerStrip)->getBinContent(ibin);
375  if(last_value != 0.){
376  (local_modmes.PedsPerStrip)->setBinContent(ibin,(static_cast<float>(*iped) + last_value)/2.);
377  }else{
378  (local_modmes.PedsPerStrip)->setBinContent(ibin,static_cast<float>(*iped));
379  }
380  (local_modmes.PedsDistribution)->Fill(napv,static_cast<float>(*iped));
381  }
382  }
383 
384  if(local_modmes.CMSubNoisePerStrip != NULL && local_modmes.CMSubNoiseProfile != NULL){
385  tmp.clear();
386  apvFactory_->getNoise(id, tmp);
387  int ibin=0;
388  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
389  ibin++;
390  (local_modmes.CMSubNoiseProfile)->Fill(static_cast<double>(ibin*1.),static_cast<float>(*iped));
391 
392  float last_value = (local_modmes.CMSubNoisePerStrip)->getBinContent(ibin);
393  if(last_value != 0.){
394  (local_modmes.CMSubNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
395  }else{
396  (local_modmes.CMSubNoisePerStrip)->setBinContent(ibin,static_cast<float>(*iped));
397  }
398  }
399  }
400 
401 
402  if(local_modmes.RawNoisePerStrip != NULL && local_modmes.RawNoiseProfile != NULL){
403  tmp.clear();
404  apvFactory_->getRawNoise(id, tmp);
405  int ibin=0;
406  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
407  ibin++;
408  (local_modmes.RawNoiseProfile)->Fill(static_cast<double>(ibin*1.),static_cast<float>(*iped));
409  float last_value = (local_modmes.RawNoisePerStrip)->getBinContent(ibin);
410  if(last_value != 0.){
411  (local_modmes.RawNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
412  }else{
413  (local_modmes.RawNoisePerStrip)->setBinContent(ibin,static_cast<float>(*iped));
414  }
415  }
416  }
417 
418  if(local_modmes.NoisyStrips != NULL){
420  apvFactory_->getMask(id, temp);
421  int ibin=0;
422  for (TkApvMask::MaskType::const_iterator iped=temp.begin(); iped!=temp.end();iped++) {
423  ibin++;
424 
425  if(nIteration_ <2){
426  if(*iped == 1)
427  (local_modmes.NoisyStrips)->Fill(ibin,3.);
428  if(*iped == 2)
429  (local_modmes.NoisyStrips)->Fill(ibin,4.);
430  if(*iped == 0)
431  (local_modmes.NoisyStrips)->Fill(ibin,0.);
432  }else{
433  (local_modmes.NoisyStrips)->Fill(ibin,static_cast<float>(*iped));
434  (local_modmes.NoisyStripDistribution)->Fill(static_cast<float>(*iped));
435  }
436  }
437  }
438 
439 
440  }
441  }
442  if (firstEvent) firstEvent=false;
443 }
std::vector< StripMaskType > MaskType
Definition: TkApvMask.h:15
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< SiStripDetCabling > detcabling
void getPedestal(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &peds)
void getCommonModeSlope(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
void getNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void update(uint32_t det_id, const edm::DetSet< SiStripRawDigi > &in)
void getMask(uint32_t det_id, TkApvMask::MaskType &tmp)
#define NULL
Definition: scimark2.h:8
void getRawNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static const std::string RunMode3
ApvAnalysisFactory * apvFactory_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
void getCommonMode(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
int k[5][pyjets_maxn]
const T & get() const
Definition: EventSetup.h:55
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::EventID id() const
Definition: EventBase.h:56
static const std::string RunMode2
tuple cout
Definition: gather_cfg.py:41
std::map< uint32_t, ModMEs > PedMEs
void SiStripMonitorPedestals::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 80 of file SiStripMonitorPedestals.cc.

References conf_, edm::ParameterSet::getParameter(), NumCMstripsInGroup_, pedsPSet_, runTypeFlag_, theEventInitNumber_, and theEventIterNumber_.

80  {
81  theEventInitNumber_ = pedsPSet_.getParameter<int>("NumberOfEventsForInit");
82  theEventIterNumber_ = pedsPSet_.getParameter<int>("NumberOfEventsForIteration");
83  NumCMstripsInGroup_ = pedsPSet_.getParameter<int>("NumCMstripsInGroup");
84  runTypeFlag_ = conf_.getParameter<std::string>("RunTypeFlag");
85 }
T getParameter(std::string const &) const
void SiStripMonitorPedestals::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file SiStripMonitorPedestals.cc.

References createMEs(), detcabling, fillCondDBMEs(), edm::EventSetup::get(), m_cacheID_, PedMEs, resetMEs(), RunMode1, RunMode3, and runTypeFlag_.

89  {
90 
91  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
92  if (m_cacheID_ != cacheID) {
93  m_cacheID_ = cacheID;
94  eSetup.get<SiStripDetCablingRcd>().get( detcabling );
95  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::beginRun: "
96  << " Creating MEs for new Cabling ";
97  createMEs();
98  } else {
99  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::beginRun: "
100  << " Resetting MEs ";
101  for (std::map<uint32_t, ModMEs >::const_iterator idet = PedMEs.begin() ; idet!=PedMEs.end() ; idet++) {
102  resetMEs(idet->first);
103  }
104  }
106 }
void fillCondDBMEs(edm::EventSetup const &eSetup)
edm::ESHandle< SiStripDetCabling > detcabling
static const std::string RunMode1
static const std::string RunMode3
std::map< uint32_t, ModMEs > PedMEs
void SiStripMonitorPedestals::createMEs ( )
private

Definition at line 110 of file SiStripMonitorPedestals.cc.

References apvFactory_, SiStripMonitorPedestals::ModMEs::BadStripsDB, DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile(), SiStripMonitorPedestals::ModMEs::CMDistribution, SiStripMonitorPedestals::ModMEs::CMSlopeDistribution, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStrip, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStripDB, SiStripMonitorPedestals::ModMEs::CMSubNoiseProfile, SiStripHistoId::createHistoId(), detcabling, cond::rpcobgas::detid, dqmStore_, ApvAnalysisFactory::instantiateApvs(), SiStripMonitorPedestals::ModMEs::NoisyStripDistribution, SiStripMonitorPedestals::ModMEs::NoisyStrips, PedMEs, SiStripMonitorPedestals::ModMEs::PedsDistribution, SiStripMonitorPedestals::ModMEs::PedsEvolution, SiStripMonitorPedestals::ModMEs::PedsPerStrip, SiStripMonitorPedestals::ModMEs::PedsPerStripDB, pedsPSet_, SiStripMonitorPedestals::ModMEs::RawNoisePerStrip, SiStripMonitorPedestals::ModMEs::RawNoiseProfile, resetMEs(), RunMode1, RunMode2, RunMode3, runTypeFlag_, SiStripFolderOrganizer::setDetectorFolder(), and DQMStore::tag().

Referenced by beginRun().

110  {
111  std::vector<uint32_t> SelectedDetIds;
112 
113  //ApvAnalysisFactory
114  if (apvFactory_) {delete apvFactory_;}
116 
117  detcabling->addActiveDetectorsRawIds(SelectedDetIds);
118 
119  // use SistripHistoId for producing histogram id (and title)
120  SiStripHistoId hidmanager;
121  // create SiStripFolderOrganizer
122  SiStripFolderOrganizer folder_organizer;
123 
124  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::createMEs: "
125  << "Number of Detector Present in cabling " << SelectedDetIds.size();
126 
127  for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(), iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
128 
129  uint32_t detid = *idetid;
130 
131  // Check consistency in DetId
132  if (detid == 0 || detid == 0xFFFFFFFF){
133  edm::LogError("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::createMEs: "
134  << "Wrong DetId !!!!!! " << detid << " Neglecting !!!!!! ";
135  continue;
136  }
137 
138  unsigned int apv_pairs = detcabling->nApvPairs(detid);
139 
140  // Check consistency in Apv numbers
141  if (apv_pairs < 1 || apv_pairs > 3) {
142  edm::LogError("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::createMEs: Wrong APV Pairs => detId "
143  << detid << " APV pairs " << apv_pairs << " Neglecting !!!!!! ";
144  continue;
145  }
146  unsigned int napvs = apv_pairs * 2;
147  unsigned int nStrip = napvs * 128;
148 
149  bool newDetId = apvFactory_->instantiateApvs(detid,napvs);
150 
151  if( newDetId ) {
152  ModMEs local_modmes;
153  local_modmes.PedsPerStrip = 0;
154  local_modmes.PedsDistribution = 0;
155  local_modmes.PedsEvolution = 0;
156  local_modmes.CMSubNoisePerStrip = 0;
157  local_modmes.RawNoisePerStrip = 0;
158  local_modmes.CMSubNoiseProfile = 0;
159  local_modmes.RawNoiseProfile = 0;
160  local_modmes.NoisyStrips = 0;
161  local_modmes.NoisyStripDistribution = 0;
162  local_modmes.CMDistribution = 0;
163  local_modmes.CMSlopeDistribution = 0;
164  local_modmes.PedsPerStripDB = 0;
165  local_modmes.CMSubNoisePerStripDB = 0;
166  local_modmes.BadStripsDB = 0;
167 
168  std::string hid;
169  // set appropriate folder using SiStripFolderOrganizer
170  folder_organizer.setDetectorFolder(detid); // pass the detid to this method
171 
172  // if the deid already exists in the map, then reset MEs otherwise create them
173  resetMEs(detid);
174 
175  if (runTypeFlag_ == RunMode1 || runTypeFlag_ == RunMode3 ) {
176  //Pedestals histos
177  hid = hidmanager.createHistoId("PedestalFromCondDB","det", detid);
178  local_modmes.PedsPerStripDB = dqmStore_->book1D(hid, hid, nStrip,0.5,nStrip+0.5); //to modify the size binning
179  dqmStore_->tag(local_modmes.PedsPerStripDB, detid);
180  (local_modmes.PedsPerStripDB)->setAxisTitle("Pedestal from CondDB(ADC) vs Strip Number",1);
181 
182  hid = hidmanager.createHistoId("NoiseFromCondDB","det", detid);
183  local_modmes.CMSubNoisePerStripDB = dqmStore_->book1D(hid, hid, nStrip,0.5,nStrip+0.5);
184  dqmStore_->tag(local_modmes.CMSubNoisePerStripDB, detid);
185  (local_modmes.CMSubNoisePerStripDB)->setAxisTitle("CMSubNoise from CondDB(ADC) vs Strip Number",1);
186 
187  hid = hidmanager.createHistoId("BadStripFlagCondDB","det", detid);
188  local_modmes.BadStripsDB = dqmStore_->book2D(hid, hid, nStrip,0.5,nStrip+0.5,6,-0.5,5.5);
189  dqmStore_->tag(local_modmes.BadStripsDB, detid);
190  (local_modmes.BadStripsDB)->setAxisTitle("Strip Flag from CondDB(ADC) vs Strip Number",1);
191  }
192  if (runTypeFlag_ == RunMode2 || runTypeFlag_ == RunMode3 ) {
193  //Pedestals histos
194  hid = hidmanager.createHistoId("PedsPerStrip","det", detid);
195  local_modmes.PedsPerStrip = dqmStore_->book1D(hid, hid, nStrip,0.5,nStrip+0.5); //to modify the size binning
196  dqmStore_->tag(local_modmes.PedsPerStrip, detid);
197  (local_modmes.PedsPerStrip)->setAxisTitle("Pedestal (ADC) vs Strip Number ",1);
198 
199  hid = hidmanager.createHistoId("PedsDistribution","det", detid);
200  local_modmes.PedsDistribution = dqmStore_->book2D(hid, hid, napvs,-0.5,napvs-0.5, 300, 200, 500); //to modify the size binning
201  dqmStore_->tag(local_modmes.PedsDistribution, detid);
202  (local_modmes.PedsDistribution)->setAxisTitle("Apv Number",1);
203  (local_modmes.PedsDistribution)->setAxisTitle("Mean Pedestal Value (ADC)",2);
204 
205  hid = hidmanager.createHistoId("PedsEvolution","det", detid);
206  local_modmes.PedsEvolution = dqmStore_->book2D(hid, hid, napvs,-0.5,napvs-0.5, 50, 0., 50.); //to modify the size binning
207  dqmStore_->tag(local_modmes.PedsEvolution, detid);
208  (local_modmes.PedsEvolution)->setAxisTitle("Apv Number",1);
209  (local_modmes.PedsEvolution)->setAxisTitle("Iteration Number",2);
210 
211  //Noise histos
212  hid = hidmanager.createHistoId("CMSubNoisePerStrip","det", detid);
213  local_modmes.CMSubNoisePerStrip = dqmStore_->book1D(hid, hid, nStrip,0.5,nStrip+0.5);
214  dqmStore_->tag(local_modmes.CMSubNoisePerStrip, detid);
215  (local_modmes.CMSubNoisePerStrip)->setAxisTitle("CMSubNoise (ADC) vs Strip Number",1);
216 
217  hid = hidmanager.createHistoId("RawNoisePerStrip","det", detid);
218  local_modmes.RawNoisePerStrip = dqmStore_->book1D(hid, hid, nStrip,0.5,nStrip+0.5);
219  dqmStore_->tag(local_modmes.RawNoisePerStrip, detid);
220  (local_modmes.RawNoisePerStrip)->setAxisTitle("RawNoise(ADC) vs Strip Number",1);
221 
222  hid = hidmanager.createHistoId("CMSubNoiseProfile","det", detid);
223  local_modmes.CMSubNoiseProfile = dqmStore_->bookProfile(hid, hid, nStrip,0.5,nStrip+0.5, 100, 0., 100.);
224  dqmStore_->tag(local_modmes.CMSubNoiseProfile, detid);
225  (local_modmes.CMSubNoiseProfile)->setAxisTitle("Mean of CMSubNoise (ADC) vs Strip Number",1);
226 
227  hid = hidmanager.createHistoId("RawNoiseProfile","det", detid);
228  local_modmes.RawNoiseProfile = dqmStore_->bookProfile(hid, hid, nStrip,0.5,nStrip+0.5, 100, 0., 100.);
229  dqmStore_->tag(local_modmes.RawNoiseProfile, detid);
230  (local_modmes.RawNoiseProfile)->setAxisTitle("Mean of RawNoise (ADC) vs Strip Number",1);
231 
232  hid = hidmanager.createHistoId("NoisyStrips","det", detid);
233  local_modmes.NoisyStrips = dqmStore_->book2D(hid, hid, nStrip,0.5,nStrip+0.5,6,-0.5,5.5);
234  dqmStore_->tag(local_modmes.NoisyStrips, detid);
235  (local_modmes.NoisyStrips)->setAxisTitle("Strip Number",1);
236  (local_modmes.NoisyStrips)->setAxisTitle("Flag Value",2);
237 
238  hid = hidmanager.createHistoId("NoisyStripDistribution","det", detid);
239  local_modmes.NoisyStripDistribution = dqmStore_->book1D(hid, hid, 11, -0.5,10.5);
240  dqmStore_->tag(local_modmes.NoisyStripDistribution, detid);
241  (local_modmes.NoisyStripDistribution)->setAxisTitle("Flag Value",1);
242 
243  //Common Mode histos
244  hid = hidmanager.createHistoId("CMDistribution","det", detid);
245  local_modmes.CMDistribution = dqmStore_->book2D(hid, hid, napvs,-0.5,napvs-0.5, 150, -15., 15.);
246  dqmStore_->tag(local_modmes.CMDistribution, detid);
247  (local_modmes.CMDistribution)->setAxisTitle("Common Mode (ADC) vs APV Number",1);
248 
249  hid = hidmanager.createHistoId("CMSlopeDistribution","det", detid);
250  local_modmes.CMSlopeDistribution = dqmStore_->book2D(hid, hid, napvs,-0.5,napvs-0.5, 100, -0.05, 0.05);
251  dqmStore_->tag(local_modmes.CMSlopeDistribution, detid);
252  (local_modmes.CMSlopeDistribution)->setAxisTitle("Common Mode Slope vs APV Number",1);
253 
254  }
255  // data from CondDB
256  // append to PedMEs
257  PedMEs.insert( std::make_pair(detid, local_modmes));
258  } //newDetId
259 
260  }
261  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::createMEs: Number of DETS used "
262  <<PedMEs.size();
263 }
edm::ESHandle< SiStripDetCabling > detcabling
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
static const std::string RunMode1
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1151
static const std::string RunMode3
bool instantiateApvs(uint32_t det_id, int numberOfApvs)
ApvAnalysisFactory * apvFactory_
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:828
void setDetectorFolder(uint32_t rawdetid=0)
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
static const std::string RunMode2
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:642
std::map< uint32_t, ModMEs > PedMEs
void SiStripMonitorPedestals::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 458 of file SiStripMonitorPedestals.cc.

458  {
459  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::EndJob: "
460  << " Finishing!! ";
461 }
void SiStripMonitorPedestals::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 447 of file SiStripMonitorPedestals.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), outPutFileName, and DQMStore::save().

447  {
448  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
449  if (outputMEsInRootFile) {
450  std::string outPutFileName = conf_.getParameter<std::string>("OutPutFileName");
451 // dqmStore_->showDirStructure();
452  dqmStore_->save(outPutFileName);
453  }
454 }
T getParameter(std::string const &) const
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1898
void SiStripMonitorPedestals::fillCondDBMEs ( edm::EventSetup const &  eSetup)
private

Definition at line 492 of file SiStripMonitorPedestals.cc.

References SiStripMonitorPedestals::ModMEs::BadStripsDB, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStripDB, conf_, detcabling, cond::rpcobgas::detid, HcalObjRepresent::Fill(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), i, PedMEs, SiStripMonitorPedestals::ModMEs::PedsPerStripDB, and cms::Exception::what().

Referenced by beginRun().

492  {
493  //get Pedestal and Noise ES handle
494  edm::ESHandle<SiStripPedestals> pedestalHandle;
495  edm::ESHandle<SiStripNoises> noiseHandle;
496  edm::ESHandle<SiStripQuality> qualityHandle;
497 
498  eSetup.get<SiStripPedestalsRcd>().get(pedestalHandle);
499  eSetup.get<SiStripNoisesRcd>().get(noiseHandle);
500  std::string quality_label = conf_.getParameter<std::string>("StripQualityLabel");
501  eSetup.get<SiStripQualityRcd>().get(quality_label, qualityHandle);
502 
503  for (std::map<uint32_t, ModMEs >::const_iterator i = PedMEs.begin() ; i!=PedMEs.end() ; i++) {
504  uint32_t detid = i->first;
505  ModMEs local_modmes = i->second;
506  edm::LogInfo("SiStripMonitorPedestals") <<" SiStripMonitorPedestals::analyze: " <<
507  " Get Ped/Noise/Bad Strips from CondDb for DetId " << detid;
508  int nStrip = detcabling->nApvPairs(detid) * 256;
509  // Get range of pedestal and noise for the detid
510  SiStripNoises::Range noiseRange = noiseHandle->getRange(detid);
511  SiStripPedestals::Range pedRange = pedestalHandle->getRange(detid);
512  SiStripQuality::Range qualityRange = qualityHandle->getRange(detid);
513 
514  for(int istrip=0;istrip<nStrip;++istrip){
515  try{
516  //Fill Pedestals
517  (local_modmes.PedsPerStripDB)->Fill(istrip+1,pedestalHandle->getPed(istrip,pedRange));
518  }
519  catch(cms::Exception& e){
520  edm::LogError("SiStripMonitorPedestals") << "[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripPedestalsService_.getPedestal("<<detid<<","<<istrip<<") : " << " " << e.what() ;
521  }
522  try{
523  //Fill Noises
524  (local_modmes.CMSubNoisePerStripDB)->Fill(istrip+1,noiseHandle->getNoise(istrip,noiseRange));
525 
526  }
527  catch(cms::Exception& e){
528  edm::LogError("SiStripMonitorPedestals") << "[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripNoiseService_.getNoise("<<detid<<","<<istrip<<") : " << " " << e.what() ;
529  }
530  try{
531  //Fill BadStripsNoise
532  (local_modmes.BadStripsDB)->Fill(istrip+1,qualityHandle->IsStripBad(qualityRange,istrip)?1.:0.);
533 
534 
535  }
536  catch(cms::Exception& e){
537  edm::LogError("SiStripMonitorPedestals") << "[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripNoiseService_.getDisable("<<detid<<","<<istrip<<") : " << " " << e.what() ;
538  }
539  }//close istrip loop
540  }
541 }
virtual char const * what() const
Definition: Exception.cc:97
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< SiStripDetCabling > detcabling
std::pair< ContainerIterator, ContainerIterator > Range
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::pair< ContainerIterator, ContainerIterator > Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:41
std::map< uint32_t, ModMEs > PedMEs
void SiStripMonitorPedestals::resetMEs ( uint32_t  idet)
private

Definition at line 465 of file SiStripMonitorPedestals.cc.

References SiStripMonitorPedestals::ModMEs::BadStripsDB, SiStripMonitorPedestals::ModMEs::CMDistribution, SiStripMonitorPedestals::ModMEs::CMSlopeDistribution, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStrip, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStripDB, SiStripMonitorPedestals::ModMEs::CMSubNoiseProfile, SiStripMonitorPedestals::ModMEs::NoisyStrips, PedMEs, SiStripMonitorPedestals::ModMEs::PedsDistribution, SiStripMonitorPedestals::ModMEs::PedsEvolution, SiStripMonitorPedestals::ModMEs::PedsPerStrip, SiStripMonitorPedestals::ModMEs::PedsPerStripDB, pos, SiStripMonitorPedestals::ModMEs::RawNoisePerStrip, SiStripMonitorPedestals::ModMEs::RawNoiseProfile, MonitorElement::Reset(), RunMode1, RunMode2, RunMode3, and runTypeFlag_.

Referenced by beginRun(), and createMEs().

465  {
466  std::map<uint32_t, ModMEs >::iterator pos = PedMEs.find(idet);
467  if (pos != PedMEs.end()) {
468  ModMEs mod_me = pos->second;
469 
470  if (runTypeFlag_ == RunMode1 || runTypeFlag_ == RunMode3 ) {
471  mod_me.PedsPerStripDB->Reset();
472  mod_me.CMSubNoisePerStripDB->Reset();
473  mod_me.BadStripsDB->Reset();
474  }
475  if (runTypeFlag_ == RunMode2 || runTypeFlag_ == RunMode3 ) {
476  mod_me.PedsPerStrip->Reset();
477  mod_me.PedsDistribution->Reset();
478  mod_me.PedsEvolution->Reset();
479  mod_me.CMSubNoisePerStrip->Reset();
480  mod_me.RawNoisePerStrip->Reset();
481  mod_me.CMSubNoiseProfile->Reset();
482  mod_me.RawNoiseProfile->Reset();
483  mod_me.NoisyStrips->Reset();
484  mod_me.CMDistribution->Reset();
485  mod_me.CMSlopeDistribution->Reset();
486  }
487  }
488 }
static const std::string RunMode1
static const std::string RunMode3
static const std::string RunMode2
std::map< uint32_t, ModMEs > PedMEs

Member Data Documentation

bool SiStripMonitorPedestals::analyzed
private

Definition at line 100 of file SiStripMonitorPedestals.h.

ApvAnalysisFactory* SiStripMonitorPedestals::apvFactory_
private

Definition at line 109 of file SiStripMonitorPedestals.h.

Referenced by analyze(), createMEs(), and ~SiStripMonitorPedestals().

edm::ParameterSet SiStripMonitorPedestals::conf_
private

Definition at line 96 of file SiStripMonitorPedestals.h.

Referenced by analyze(), beginJob(), endRun(), and fillCondDBMEs().

edm::ESHandle<SiStripDetCabling> SiStripMonitorPedestals::detcabling
private

Definition at line 98 of file SiStripMonitorPedestals.h.

Referenced by analyze(), beginRun(), createMEs(), and fillCondDBMEs().

DQMStore* SiStripMonitorPedestals::dqmStore_
private

Definition at line 95 of file SiStripMonitorPedestals.h.

Referenced by createMEs(), and endRun().

bool SiStripMonitorPedestals::firstEvent
private

Definition at line 101 of file SiStripMonitorPedestals.h.

Referenced by analyze().

unsigned long long SiStripMonitorPedestals::m_cacheID_
private

Definition at line 115 of file SiStripMonitorPedestals.h.

Referenced by beginRun().

int16_t SiStripMonitorPedestals::nEvInit_
private

Definition at line 107 of file SiStripMonitorPedestals.h.

int16_t SiStripMonitorPedestals::nEvTot_
private

Definition at line 106 of file SiStripMonitorPedestals.h.

Referenced by analyze().

int16_t SiStripMonitorPedestals::nEvUpdate_
private

Definition at line 104 of file SiStripMonitorPedestals.h.

int SiStripMonitorPedestals::nIteration_
private

Definition at line 108 of file SiStripMonitorPedestals.h.

Referenced by analyze().

int SiStripMonitorPedestals::NumCMstripsInGroup_
private

Definition at line 112 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and beginJob().

std::string SiStripMonitorPedestals::outPutFileName
private

Definition at line 114 of file SiStripMonitorPedestals.h.

Referenced by endRun().

std::map<uint32_t, ModMEs> SiStripMonitorPedestals::PedMEs
private

Definition at line 97 of file SiStripMonitorPedestals.h.

Referenced by analyze(), beginRun(), createMEs(), fillCondDBMEs(), and resetMEs().

edm::ParameterSet SiStripMonitorPedestals::pedsPSet_
private

Definition at line 99 of file SiStripMonitorPedestals.h.

Referenced by beginJob(), and createMEs().

const std::string SiStripMonitorPedestals::RunMode1 = "ConDBPlotsOnly"
staticprivate

Definition at line 117 of file SiStripMonitorPedestals.h.

Referenced by beginRun(), createMEs(), and resetMEs().

const std::string SiStripMonitorPedestals::RunMode2 = "CalculatedPlotsOnly"
staticprivate

Definition at line 118 of file SiStripMonitorPedestals.h.

Referenced by analyze(), createMEs(), and resetMEs().

const std::string SiStripMonitorPedestals::RunMode3 = "AllPlots"
staticprivate

Definition at line 119 of file SiStripMonitorPedestals.h.

Referenced by analyze(), beginRun(), createMEs(), and resetMEs().

std::string SiStripMonitorPedestals::runTypeFlag_
private

Definition at line 113 of file SiStripMonitorPedestals.h.

Referenced by analyze(), beginJob(), beginRun(), createMEs(), and resetMEs().

int16_t SiStripMonitorPedestals::signalCutPeds_
private

Definition at line 105 of file SiStripMonitorPedestals.h.

int SiStripMonitorPedestals::theEventInitNumber_
private

Definition at line 110 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and beginJob().

int SiStripMonitorPedestals::theEventIterNumber_
private

Definition at line 111 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and beginJob().