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 edm::EDConsumerBase

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 ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void createMEs (edm::EventSetup const &eSetup)
 
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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 271 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_, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, theEventInitNumber_, theEventIterNumber_, tmp, and ApvAnalysisFactory::update().

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

Referenced by beginRun().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 464 of file SiStripMonitorPedestals.cc.

464  {
465  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::EndJob: "
466  << " Finishing!! ";
467 }
void SiStripMonitorPedestals::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 453 of file SiStripMonitorPedestals.cc.

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

453  {
454  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
455  if (outputMEsInRootFile) {
457 // dqmStore_->showDirStructure();
458  dqmStore_->save(outPutFileName);
459  }
460 }
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:2118
void SiStripMonitorPedestals::fillCondDBMEs ( edm::EventSetup const &  eSetup)
private

Definition at line 498 of file SiStripMonitorPedestals.cc.

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

Referenced by beginRun().

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

471  {
472  std::map<uint32_t, ModMEs >::iterator pos = PedMEs.find(idet);
473  if (pos != PedMEs.end()) {
474  ModMEs mod_me = pos->second;
475 
476  if (runTypeFlag_ == RunMode1 || runTypeFlag_ == RunMode3 ) {
477  mod_me.PedsPerStripDB->Reset();
478  mod_me.CMSubNoisePerStripDB->Reset();
479  mod_me.BadStripsDB->Reset();
480  }
481  if (runTypeFlag_ == RunMode2 || runTypeFlag_ == RunMode3 ) {
482  mod_me.PedsPerStrip->Reset();
483  mod_me.PedsDistribution->Reset();
484  mod_me.PedsEvolution->Reset();
485  mod_me.CMSubNoisePerStrip->Reset();
486  mod_me.RawNoisePerStrip->Reset();
487  mod_me.CMSubNoiseProfile->Reset();
488  mod_me.RawNoiseProfile->Reset();
489  mod_me.NoisyStrips->Reset();
490  mod_me.CMDistribution->Reset();
491  mod_me.CMSlopeDistribution->Reset();
492  }
493  }
494 }
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().