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:
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 &) override
 
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) override
 
 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (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::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 )
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_(0),
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 ( )

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 
)
overridevirtual

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

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

Definition at line 90 of file SiStripMonitorPedestals.cc.

90  {
91 }
void SiStripMonitorPedestals::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 96 of file SiStripMonitorPedestals.cc.

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

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

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

Definition at line 472 of file SiStripMonitorPedestals.cc.

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

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 461 of file SiStripMonitorPedestals.cc.

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

461  {
462  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
463  if (outputMEsInRootFile) {
465 // dqmStore_->showDirStructure();
466  dqmStore_->save(outPutFileName);
467  }
468 }
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:2650
void SiStripMonitorPedestals::fillCondDBMEs ( edm::EventSetup const &  eSetup)
private

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

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

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

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