CMS 3D CMS Logo

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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Classes

struct  ModMEs
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup) override
 
 SiStripMonitorPedestals (const edm::ParameterSet &)
 
 ~SiStripMonitorPedestals () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

void createMEs (DQMStore::IBooker &, 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
 
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
 
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"
 

Detailed Description

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

Usage: <usage>

Definition at line 56 of file SiStripMonitorPedestals.h.

Constructor & Destructor Documentation

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

Definition at line 53 of file SiStripMonitorPedestals.cc.

References conf_, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::digiProducer, digiToken_, edm::ParameterSet::getParameter(), NumCMstripsInGroup_, pedsPSet_, runTypeFlag_, AlCaHLTBitMon_QueryRunRegistry::string, theEventInitNumber_, and theEventIterNumber_.

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_(nullptr),
63  m_cacheID_(0)
64 {
65  // retrieve producer name of input StripDigiCollection
67  std::string digiType = "VirginRaw";
68  digiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(digiProducer,digiType) );
69 
70  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals "
71  << " Constructing....... ";
72 
73  theEventInitNumber_ = pedsPSet_.getParameter<int>("NumberOfEventsForInit");
74  theEventIterNumber_ = pedsPSet_.getParameter<int>("NumberOfEventsForIteration");
75  NumCMstripsInGroup_ = pedsPSet_.getParameter<int>("NumCMstripsInGroup");
76  runTypeFlag_ = conf_.getParameter<std::string>("RunTypeFlag");
77 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
ApvAnalysisFactory * apvFactory_
SiStripMonitorPedestals::~SiStripMonitorPedestals ( )
override

Definition at line 81 of file SiStripMonitorPedestals.cc.

References apvFactory_.

82 {
83  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals "
84  << " Destructing...... ";
85  if (apvFactory_) {delete apvFactory_;}
86 }
ApvAnalysisFactory * apvFactory_

Member Function Documentation

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

Definition at line 271 of file SiStripMonitorPedestals.cc.

References apvFactory_, SiStripMonitorPedestals::ModMEs::CMDistribution, SiStripMonitorPedestals::ModMEs::CMSlopeDistribution, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStrip, SiStripMonitorPedestals::ModMEs::CMSubNoiseProfile, gather_cfg::cout, detcabling, digiToken_, edm::EventID::event(), HcalObjRepresent::Fill(), firstEvent, edm::EventSetup::get(), edm::Event::getByToken(), ApvAnalysisFactory::getCommonMode(), ApvAnalysisFactory::getCommonModeSlope(), SiStripDetCabling::getConnections(), ApvAnalysisFactory::getMask(), ApvAnalysisFactory::getNoise(), ApvAnalysisFactory::getPedestal(), ApvAnalysisFactory::getRawNoise(), mps_fire::i, edm::EventBase::id(), createfilelist::int, gen::k, nEvTot_, nIteration_, SiStripMonitorPedestals::ModMEs::NoisyStripDistribution, SiStripMonitorPedestals::ModMEs::NoisyStrips, NumCMstripsInGroup_, PedMEs, SiStripMonitorPedestals::ModMEs::PedsDistribution, SiStripMonitorPedestals::ModMEs::PedsEvolution, SiStripMonitorPedestals::ModMEs::PedsPerStrip, SiStripMonitorPedestals::ModMEs::RawNoisePerStrip, SiStripMonitorPedestals::ModMEs::RawNoiseProfile, edm::EventID::run(), RunMode2, RunMode3, runTypeFlag_, 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  // get DigiCollection object from Event
287  //you have a collection as there are all the digis for the event for every detector
288  iEvent.getByToken(digiToken_, digi_collection);
289 
290  //Increase the number of iterations ...
292 
293 
294  // loop over all MEs
295  for (std::map<uint32_t, ModMEs >::const_iterator i = PedMEs.begin() ; i!=PedMEs.end() ; i++) {
296  uint32_t detid = i->first; ModMEs local_modmes = i->second;
297  // get iterators for digis belonging to one DetId, it is an iterator, i.e. one element of the vector
298  std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( detid );
299  if (digis == digi_collection->end() ||
300  digis->data.empty() ||
301  digis->data.size() > 768) {
302  if (digis == digi_collection->end()) {
303  edm::LogError("SiStripMonitorPedestals") << " SiStripMonitorPedestals::analyze: Event " << nEvTot_
304  << " DetId " << detid << " at the end of Digi Collection!!!";
305  } else {
306  edm::LogError("SiStripMonitorPedestals") << " [SiStripMonitorPedestals::analyze: Event " << nEvTot_
307  << " DetId " << detid << " # of Digis " << digis->data.size() ;
308  }
309  std::vector<const FedChannelConnection *> fed_conns = detcabling->getConnections(detid);
310  bool firstchannel(true);
311  for (unsigned int k = 0; k < fed_conns.size() ; k++) {
312  if(fed_conns[k] && fed_conns[k]->isConnected()) {
313  if (firstchannel) {
314  edm::LogError("SiStripMonitorPedestals") <<" SiStripMonitorPedestals::analyze: Fed Id " <<
315  fed_conns[k]->fedId() << " Channel " << fed_conns[k]->fedCh();
316  firstchannel=false;
317  }
318  else edm::LogError("SiStripMonitorPedestals") <<" SiStripMonitorPedestals::analyze: Channel " <<
319  fed_conns[k]->fedCh();
320  }
321  }
322  std::cout << std::endl;
323  continue;
324  }
325 
326  if ( digis->data.empty() ) {
327  edm::LogError("MonitorDigi_tmp") << "[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
328  }
329  uint32_t id = detid;
330  // cout <<"Data size "<<digis->data.size()<<endl;
331  apvFactory_->update(id, (*digis));
332 
334  if(local_modmes.CMDistribution != nullptr){
335  std::vector<float> tmp;
336  tmp.clear();
337  apvFactory_->getCommonMode(id, tmp);
338  //unpacking the info looking at the right topology
339  int numberCMBlocks = int(128. / NumCMstripsInGroup_);
340  int ibin=0;
341  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
342  int iapv = int (ibin/numberCMBlocks);
343  (local_modmes.CMDistribution)->Fill(iapv,static_cast<float>(*iped));
344  ibin++;
345 
346  }
347  }
348  if(local_modmes.CMSlopeDistribution != nullptr){
349  std::vector<float> tmp;
350  tmp.clear();
351  int iapv = 0;
353  for (std::vector<float>::const_iterator it=tmp.begin(); it!=tmp.end();it++) {
354  (local_modmes.CMSlopeDistribution)->Fill(iapv,static_cast<float>(*it));
355  iapv++;
356  }
357  }
358  }
359 
360  //asking for the status
362  {
363 
364  std::vector<float> tmp;
365  tmp.clear();
366  apvFactory_->getPedestal(id, tmp);
367  if(local_modmes.PedsPerStrip != nullptr){
368  int numberOfApvs = int(tmp.size()/128.);
369  for(int i=0; i<numberOfApvs;i++){
370  std::vector<float> myPedPerApv;
371  apvFactory_->getPedestal(id, i, myPedPerApv);
372  float avarage = 0;
373  avarage = std::accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
374  avarage = avarage/128.;
375  (local_modmes.PedsEvolution)->setBinContent(i+1,nIteration_,avarage);
376 
377  }
378  int ibin=0;
379 
380  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
381  int napv = int(ibin / 128.);
382  ibin++;
383  float last_value = (local_modmes.PedsPerStrip)->getBinContent(ibin);
384  if(last_value != 0.){
385  (local_modmes.PedsPerStrip)->setBinContent(ibin,(static_cast<float>(*iped) + last_value)/2.);
386  }else{
387  (local_modmes.PedsPerStrip)->setBinContent(ibin,static_cast<float>(*iped));
388  }
389  (local_modmes.PedsDistribution)->Fill(napv,static_cast<float>(*iped));
390  }
391  }
392 
393  if(local_modmes.CMSubNoisePerStrip != nullptr && local_modmes.CMSubNoiseProfile != nullptr){
394  tmp.clear();
395  apvFactory_->getNoise(id, tmp);
396  int ibin=0;
397  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
398  ibin++;
399  (local_modmes.CMSubNoiseProfile)->Fill(static_cast<double>(ibin*1.),static_cast<float>(*iped));
400 
401  float last_value = (local_modmes.CMSubNoisePerStrip)->getBinContent(ibin);
402  if(last_value != 0.){
403  (local_modmes.CMSubNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
404  }else{
405  (local_modmes.CMSubNoisePerStrip)->setBinContent(ibin,static_cast<float>(*iped));
406  }
407  }
408  }
409 
410 
411  if(local_modmes.RawNoisePerStrip != nullptr && local_modmes.RawNoiseProfile != nullptr){
412  tmp.clear();
413  apvFactory_->getRawNoise(id, tmp);
414  int ibin=0;
415  for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
416  ibin++;
417  (local_modmes.RawNoiseProfile)->Fill(static_cast<double>(ibin*1.),static_cast<float>(*iped));
418  float last_value = (local_modmes.RawNoisePerStrip)->getBinContent(ibin);
419  if(last_value != 0.){
420  (local_modmes.RawNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
421  }else{
422  (local_modmes.RawNoisePerStrip)->setBinContent(ibin,static_cast<float>(*iped));
423  }
424  }
425  }
426 
427  if(local_modmes.NoisyStrips != nullptr){
429  apvFactory_->getMask(id, temp);
430  int ibin=0;
431  for (TkApvMask::MaskType::const_iterator iped=temp.begin(); iped!=temp.end();iped++) {
432  ibin++;
433 
434  if(nIteration_ <2){
435  if(*iped == 1)
436  (local_modmes.NoisyStrips)->Fill(ibin,3.);
437  if(*iped == 2)
438  (local_modmes.NoisyStrips)->Fill(ibin,4.);
439  if(*iped == 0)
440  (local_modmes.NoisyStrips)->Fill(ibin,0.);
441  }else{
442  (local_modmes.NoisyStrips)->Fill(ibin,static_cast<float>(*iped));
443  (local_modmes.NoisyStripDistribution)->Fill(static_cast<float>(*iped));
444  }
445  }
446  }
447 
448 
449  }
450  }
451  if (firstEvent) firstEvent=false;
452 }
std::vector< StripMaskType > MaskType
Definition: TkApvMask.h:17
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
edm::ESHandle< SiStripDetCabling > detcabling
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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)
void getRawNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static const std::string RunMode3
ApvAnalysisFactory * apvFactory_
void getCommonMode(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
int k[5][pyjets_maxn]
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::EventID id() const
Definition: EventBase.h:60
T get() const
Definition: EventSetup.h:68
static const std::string RunMode2
std::map< uint32_t, ModMEs > PedMEs
void SiStripMonitorPedestals::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 91 of file SiStripMonitorPedestals.cc.

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

92 {
93 
94  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
95  if (m_cacheID_ != cacheID) {
96  m_cacheID_ = cacheID;
97  eSetup.get<SiStripDetCablingRcd>().get( detcabling );
98  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::bookHistograms: "
99  << " Creating MEs for new Cabling ";
100  createMEs( ibooker , eSetup);
101  }
102 
104 }
void fillCondDBMEs(edm::EventSetup const &eSetup)
edm::ESHandle< SiStripDetCabling > detcabling
static const std::string RunMode1
static const std::string RunMode3
void createMEs(DQMStore::IBooker &, edm::EventSetup const &eSetup)
void SiStripMonitorPedestals::createMEs ( DQMStore::IBooker ,
edm::EventSetup const &  eSetup 
)
private

Definition at line 110 of file SiStripMonitorPedestals.cc.

References SiStripDetCabling::addActiveDetectorsRawIds(), apvFactory_, SiStripMonitorPedestals::ModMEs::BadStripsDB, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DQMStore::IBooker::bookProfile(), SiStripMonitorPedestals::ModMEs::CMDistribution, SiStripMonitorPedestals::ModMEs::CMSlopeDistribution, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStrip, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStripDB, SiStripMonitorPedestals::ModMEs::CMSubNoiseProfile, SiStripHistoId::createHistoId(), detcabling, edm::EventSetup::get(), ApvAnalysisFactory::instantiateApvs(), SiStripDetCabling::nApvPairs(), SiStripMonitorPedestals::ModMEs::NoisyStripDistribution, SiStripMonitorPedestals::ModMEs::NoisyStrips, PedMEs, SiStripMonitorPedestals::ModMEs::PedsDistribution, SiStripMonitorPedestals::ModMEs::PedsEvolution, SiStripMonitorPedestals::ModMEs::PedsPerStrip, SiStripMonitorPedestals::ModMEs::PedsPerStripDB, pedsPSet_, edm::ESHandle< T >::product(), SiStripMonitorPedestals::ModMEs::RawNoisePerStrip, SiStripMonitorPedestals::ModMEs::RawNoiseProfile, resetMEs(), RunMode1, RunMode2, RunMode3, runTypeFlag_, SiStripFolderOrganizer::setDetectorFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and DQMStore::IBooker::tag().

Referenced by bookHistograms().

110  {
111 
112  //Retrieve tracker topology from geometry
113  edm::ESHandle<TrackerTopology> tTopoHandle;
114  es.get<TrackerTopologyRcd>().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 = nullptr;
160  local_modmes.PedsDistribution = nullptr;
161  local_modmes.PedsEvolution = nullptr;
162  local_modmes.CMSubNoisePerStrip = nullptr;
163  local_modmes.RawNoisePerStrip = nullptr;
164  local_modmes.CMSubNoiseProfile = nullptr;
165  local_modmes.RawNoiseProfile = nullptr;
166  local_modmes.NoisyStrips = nullptr;
167  local_modmes.NoisyStripDistribution = nullptr;
168  local_modmes.CMDistribution = nullptr;
169  local_modmes.CMSlopeDistribution = nullptr;
170  local_modmes.PedsPerStripDB = nullptr;
171  local_modmes.CMSubNoisePerStripDB = nullptr;
172  local_modmes.BadStripsDB = nullptr;
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 = ibooker.book1D(hid, hid, nStrip,0.5,nStrip+0.5); //to modify the size binning
185  ibooker.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 = ibooker.book1D(hid, hid, nStrip,0.5,nStrip+0.5);
190  ibooker.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 = ibooker.book2D(hid, hid, nStrip,0.5,nStrip+0.5,6,-0.5,5.5);
195  ibooker.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 = ibooker.book1D(hid, hid, nStrip,0.5,nStrip+0.5); //to modify the size binning
202  ibooker.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 = ibooker.book2D(hid, hid, napvs,-0.5,napvs-0.5, 300, 200, 500); //to modify the size binning
207  ibooker.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 = ibooker.book2D(hid, hid, napvs,-0.5,napvs-0.5, 50, 0., 50.); //to modify the size binning
213  ibooker.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 = ibooker.book1D(hid, hid, nStrip,0.5,nStrip+0.5);
220  ibooker.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 = ibooker.book1D(hid, hid, nStrip,0.5,nStrip+0.5);
225  ibooker.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 = ibooker.bookProfile(hid, hid, nStrip,0.5,nStrip+0.5, 100, 0., 100.);
230  ibooker.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 = ibooker.bookProfile(hid, hid, nStrip,0.5,nStrip+0.5, 100, 0., 100.);
235  ibooker.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 = ibooker.book2D(hid, hid, nStrip,0.5,nStrip+0.5,6,-0.5,5.5);
240  ibooker.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 = ibooker.book1D(hid, hid, 11, -0.5,10.5);
246  ibooker.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 = ibooker.book2D(hid, hid, napvs,-0.5,napvs-0.5, 150, -15., 15.);
252  ibooker.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 = ibooker.book2D(hid, hid, napvs,-0.5,napvs-0.5, 100, -0.05, 0.05);
257  ibooker.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
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
static const std::string RunMode1
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
static const std::string RunMode3
bool instantiateApvs(uint32_t det_id, int numberOfApvs)
ApvAnalysisFactory * apvFactory_
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
const uint16_t nApvPairs(uint32_t det_id) const
static const std::string RunMode2
T const * product() const
Definition: ESHandle.h:84
std::map< uint32_t, ModMEs > PedMEs
void SiStripMonitorPedestals::endJob ( void  )
override

Definition at line 467 of file SiStripMonitorPedestals.cc.

467  {
468  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::EndJob: "
469  << " Finishing!! ";
470 }
void SiStripMonitorPedestals::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
override

Definition at line 456 of file SiStripMonitorPedestals.cc.

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

456  {
457  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
458  if (outputMEsInRootFile) {
460 // dqmStore_->showDirStructure();
461  dqmStore_->save(outPutFileName);
462  }
463 }
T getParameter(std::string const &) const
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
Definition: DQMStore.cc:2443
void SiStripMonitorPedestals::fillCondDBMEs ( edm::EventSetup const &  eSetup)
private

Definition at line 501 of file SiStripMonitorPedestals.cc.

References SiStripMonitorPedestals::ModMEs::BadStripsDB, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStripDB, conf_, DEFINE_FWK_MODULE, detcabling, MillePedeFileConverter_cfg::e, HcalObjRepresent::Fill(), edm::EventSetup::get(), SiStripNoises::getNoise(), edm::ParameterSet::getParameter(), SiStripPedestals::getPed(), SiStripNoises::getRange(), SiStripPedestals::getRange(), SiStripBadStrip::getRange(), mps_fire::i, SiStripQuality::IsStripBad(), SiStripDetCabling::nApvPairs(), PedMEs, SiStripMonitorPedestals::ModMEs::PedsPerStripDB, AlCaHLTBitMon_QueryRunRegistry::string, and cms::Exception::what().

Referenced by bookHistograms().

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

Definition at line 474 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, SiStripMonitorPedestals::ModMEs::RawNoisePerStrip, SiStripMonitorPedestals::ModMEs::RawNoiseProfile, MonitorElement::Reset(), RunMode1, RunMode2, RunMode3, and runTypeFlag_.

Referenced by createMEs().

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

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

Definition at line 98 of file SiStripMonitorPedestals.h.

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

edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > SiStripMonitorPedestals::digiToken_
private

Definition at line 67 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and SiStripMonitorPedestals().

DQMStore* SiStripMonitorPedestals::dqmStore_
private

Definition at line 95 of file SiStripMonitorPedestals.h.

Referenced by endRun().

bool SiStripMonitorPedestals::firstEvent
private
unsigned long long SiStripMonitorPedestals::m_cacheID_
private

Definition at line 115 of file SiStripMonitorPedestals.h.

Referenced by bookHistograms().

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 SiStripMonitorPedestals().

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(), createMEs(), fillCondDBMEs(), and resetMEs().

edm::ParameterSet SiStripMonitorPedestals::pedsPSet_
private

Definition at line 99 of file SiStripMonitorPedestals.h.

Referenced by createMEs(), and SiStripMonitorPedestals().

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

Definition at line 117 of file SiStripMonitorPedestals.h.

Referenced by bookHistograms(), 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(), bookHistograms(), createMEs(), and resetMEs().

std::string SiStripMonitorPedestals::runTypeFlag_
private
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 SiStripMonitorPedestals().

int SiStripMonitorPedestals::theEventIterNumber_
private

Definition at line 111 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and SiStripMonitorPedestals().