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:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  ModMEs
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
virtual void endJob ()
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
 SiStripMonitorPedestals (const edm::ParameterSet &)
 
 ~SiStripMonitorPedestals ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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"
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 56 of file SiStripMonitorPedestals.h.

Constructor & Destructor Documentation

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

Definition at line 52 of file SiStripMonitorPedestals.cc.

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

52  :
54  conf_(iConfig),
55  pedsPSet_(iConfig.getParameter<edm::ParameterSet>("PedestalsPSet")),
56  analyzed(false),
57  firstEvent(true),
58  signalCutPeds_(4),
59  nEvTot_(0),
60  nIteration_(0),
61  apvFactory_(0),
62  m_cacheID_(0)
63 {
64  // retrieve producer name of input StripDigiCollection
66  std::string digiType = "VirginRaw";
67  digiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(digiProducer,digiType) );
68 
69  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals "
70  << " Constructing....... ";
71 
72  theEventInitNumber_ = pedsPSet_.getParameter<int>("NumberOfEventsForInit");
73  theEventIterNumber_ = pedsPSet_.getParameter<int>("NumberOfEventsForIteration");
74  NumCMstripsInGroup_ = pedsPSet_.getParameter<int>("NumCMstripsInGroup");
75  runTypeFlag_ = conf_.getParameter<std::string>("RunTypeFlag");
76 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
ApvAnalysisFactory * apvFactory_
SiStripMonitorPedestals::~SiStripMonitorPedestals ( )

Definition at line 80 of file SiStripMonitorPedestals.cc.

References apvFactory_.

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

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 275 of file SiStripMonitorPedestals.cc.

References apvFactory_, SiStripMonitorPedestals::ModMEs::CMDistribution, SiStripMonitorPedestals::ModMEs::CMSlopeDistribution, SiStripMonitorPedestals::ModMEs::CMSubNoisePerStrip, SiStripMonitorPedestals::ModMEs::CMSubNoiseProfile, gather_cfg::cout, detcabling, cond::rpcobgas::detid, digiToken_, edm::EventID::event(), HcalObjRepresent::Fill(), firstEvent, edm::EventSetup::get(), edm::Event::getByToken(), ApvAnalysisFactory::getCommonMode(), ApvAnalysisFactory::getCommonModeSlope(), ApvAnalysisFactory::getMask(), ApvAnalysisFactory::getNoise(), ApvAnalysisFactory::getPedestal(), ApvAnalysisFactory::getRawNoise(), i, edm::EventBase::id(), relval_steps::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_, groupFilesInBlocks::temp, theEventInitNumber_, theEventIterNumber_, tmp, and ApvAnalysisFactory::update().

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

Definition at line 89 of file SiStripMonitorPedestals.cc.

89  {
90 }
void SiStripMonitorPedestals::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 95 of file SiStripMonitorPedestals.cc.

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

96 {
97 
98  unsigned long long cacheID = eSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
99  if (m_cacheID_ != cacheID) {
100  m_cacheID_ = cacheID;
101  eSetup.get<SiStripDetCablingRcd>().get( detcabling );
102  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::bookHistograms: "
103  << " Creating MEs for new Cabling ";
104  createMEs( ibooker , eSetup);
105  }
106 
108 }
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 ibooker,
edm::EventSetup const &  eSetup 
)
private

Definition at line 114 of file SiStripMonitorPedestals.cc.

References 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, cond::rpcobgas::detid, 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::IBooker::tag().

Referenced by bookHistograms().

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

Definition at line 471 of file SiStripMonitorPedestals.cc.

471  {
472  edm::LogInfo("SiStripMonitorPedestals") <<"SiStripMonitorPedestals::EndJob: "
473  << " Finishing!! ";
474 }
void SiStripMonitorPedestals::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
virtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 460 of file SiStripMonitorPedestals.cc.

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

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

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

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

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

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

ApvAnalysisFactory* SiStripMonitorPedestals::apvFactory_
private

Definition at line 110 of file SiStripMonitorPedestals.h.

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

edm::ParameterSet SiStripMonitorPedestals::conf_
private

Definition at line 97 of file SiStripMonitorPedestals.h.

Referenced by endRun(), fillCondDBMEs(), and SiStripMonitorPedestals().

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

Definition at line 99 of file SiStripMonitorPedestals.h.

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

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

Definition at line 68 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and SiStripMonitorPedestals().

DQMStore* SiStripMonitorPedestals::dqmStore_
private

Definition at line 96 of file SiStripMonitorPedestals.h.

Referenced by endRun().

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

Definition at line 116 of file SiStripMonitorPedestals.h.

Referenced by bookHistograms().

int16_t SiStripMonitorPedestals::nEvInit_
private

Definition at line 108 of file SiStripMonitorPedestals.h.

int16_t SiStripMonitorPedestals::nEvTot_
private

Definition at line 107 of file SiStripMonitorPedestals.h.

Referenced by analyze().

int16_t SiStripMonitorPedestals::nEvUpdate_
private

Definition at line 105 of file SiStripMonitorPedestals.h.

int SiStripMonitorPedestals::nIteration_
private

Definition at line 109 of file SiStripMonitorPedestals.h.

Referenced by analyze().

int SiStripMonitorPedestals::NumCMstripsInGroup_
private

Definition at line 113 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and SiStripMonitorPedestals().

std::string SiStripMonitorPedestals::outPutFileName
private

Definition at line 115 of file SiStripMonitorPedestals.h.

Referenced by endRun().

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

Definition at line 98 of file SiStripMonitorPedestals.h.

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

edm::ParameterSet SiStripMonitorPedestals::pedsPSet_
private

Definition at line 100 of file SiStripMonitorPedestals.h.

Referenced by createMEs(), and SiStripMonitorPedestals().

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

Definition at line 118 of file SiStripMonitorPedestals.h.

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

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

Definition at line 119 of file SiStripMonitorPedestals.h.

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

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

Definition at line 120 of file SiStripMonitorPedestals.h.

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

std::string SiStripMonitorPedestals::runTypeFlag_
private
int16_t SiStripMonitorPedestals::signalCutPeds_
private

Definition at line 106 of file SiStripMonitorPedestals.h.

int SiStripMonitorPedestals::theEventInitNumber_
private

Definition at line 111 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and SiStripMonitorPedestals().

int SiStripMonitorPedestals::theEventIterNumber_
private

Definition at line 112 of file SiStripMonitorPedestals.h.

Referenced by analyze(), and SiStripMonitorPedestals().