CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
SiPixelPhase1Summary Class Reference

#include <SiPixelPhase1Summary.h>

Inheritance diagram for SiPixelPhase1Summary:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiPixelPhase1Summary (const edm::ParameterSet &conf)
 
 ~SiPixelPhase1Summary ()
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
 DQMEDHarvester (void)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::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
 
 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 & itemsToGetFromEvent () 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)
 

Protected Member Functions

void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
void dqmEndJob (DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c) override
 
- 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)
 

Protected Attributes

bool runOnEndJob_
 
bool runOnEndLumi_
 
std::string topFolderName_
 

Private Member Functions

void bookSummaries (DQMStore::IBooker &iBooker)
 
void fillSummaries (DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
 

Private Attributes

edm::ParameterSet conf_
 
bool firstLumi
 
edm::InputTag src_
 
std::map< std::string, MonitorElement * > summaryMap_
 
std::map< std::string, std::string > summaryPlotName_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Description: Summary map generation for the Phase 1 pixel

Usage: <usage>

Definition at line 43 of file SiPixelPhase1Summary.h.

Constructor & Destructor Documentation

SiPixelPhase1Summary::SiPixelPhase1Summary ( const edm::ParameterSet conf)
explicit

Definition at line 49 of file SiPixelPhase1Summary.cc.

References conf_, edm::ParameterSet::getParameter(), runOnEndJob_, runOnEndLumi_, AlCaHLTBitMon_QueryRunRegistry::string, summaryPlotName_, and topFolderName_.

49  :
50  conf_(iConfig),
51  firstLumi(true)
52 {
53 
54  LogInfo ("PixelDQM") << "SiPixelPhase1Summary::SiPixelPhase1Summary: Got DQM BackEnd interface"<<endl;
55  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
56  runOnEndLumi_ = conf_.getParameter<bool>("RunOnEndLumi");
57  runOnEndJob_ = conf_.getParameter<bool>("RunOnEndJob");
58 
59  std::vector<edm::ParameterSet> mapPSets = conf_.getParameter<std::vector<edm::ParameterSet> >("SummaryMaps");
60 
61  //Go through the configuration file and add in
62  for (auto const mapPSet : mapPSets){
63  summaryPlotName_[mapPSet.getParameter<std::string>("MapName")] = mapPSet.getParameter<std::string>("MapHist");
64  }
65 
66 }
T getParameter(std::string const &) const
std::map< std::string, std::string > summaryPlotName_
edm::ParameterSet conf_
SiPixelPhase1Summary::~SiPixelPhase1Summary ( )

Definition at line 68 of file SiPixelPhase1Summary.cc.

69 {
70  // do anything here that needs to be done at desctruction time
71  // (e.g. close files, deallocate resources etc.)
72  LogInfo ("PixelDQM") << "SiPixelPhase1Summary::~SiPixelPhase1Summary: Destructor"<<endl;
73 }

Member Function Documentation

void SiPixelPhase1Summary::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 75 of file SiPixelPhase1Summary.cc.

75  {
76 }
void SiPixelPhase1Summary::bookSummaries ( DQMStore::IBooker iBooker)
private

Definition at line 102 of file SiPixelPhase1Summary.cc.

References DQMStore::IBooker::book2D(), mps_fire::i, dataset::name, DQMStore::IBooker::setCurrentFolder(), summaryMap_, and summaryPlotName_.

Referenced by dqmEndLuminosityBlock().

102  {
103  iBooker.setCurrentFolder("PixelPhase1/Summary");
104 
105  std::vector<std::string> xAxisLabels_ = {"BMO","BMI","BPO ","BPI","HCMO_1","HCMO_2","HCMI_1","HCMI_2","HCPO_1","HCPO_2","HCPI_1","HCPI_2"}; // why not having a global variable !?!?!?!
106  std::vector<std::string> yAxisLabels_ = {"1","2","3","4"}; // why not having a global variable ?!?!?!!?
107 
108  for (auto mapInfo: summaryPlotName_){
109  auto name = mapInfo.first;
110  summaryMap_[name] = iBooker.book2D("pixel"+name+"Summary","Pixel "+name+" Summary",12,0,12,4,0,4);
111  for (unsigned int i = 0; i < xAxisLabels_.size(); i++){
112  summaryMap_[name]->setBinLabel(i+1, xAxisLabels_[i],1);
113  }
114  for (unsigned int i = 0; i < yAxisLabels_.size(); i++){
115  summaryMap_[name]->setBinLabel(i+1,yAxisLabels_[i],2);
116  }
117  summaryMap_[name]->setAxisTitle("Subdetector",1);
118  summaryMap_[name]->setAxisTitle("Layer/disk",2);
119  for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?!
120  for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?!
121  summaryMap_[name]->Fill(i,j,-1.);
122  }
123  }
124  }
125 }
std::map< std::string, std::string > summaryPlotName_
std::map< std::string, MonitorElement * > summaryMap_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void SiPixelPhase1Summary::dqmEndJob ( DQMStore::IBooker iBooker,
DQMStore::IGetter iGetter 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 93 of file SiPixelPhase1Summary.cc.

References fillSummaries(), and runOnEndJob_.

94 {
95  if (runOnEndJob_) fillSummaries(iBooker,iGetter);
96 
97 }
void fillSummaries(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
void SiPixelPhase1Summary::dqmEndLuminosityBlock ( DQMStore::IBooker iBooker,
DQMStore::IGetter iGetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

Reimplemented from DQMEDHarvester.

Definition at line 78 of file SiPixelPhase1Summary.cc.

References bookSummaries(), fillSummaries(), firstLumi, and runOnEndLumi_.

78  {
79  if (firstLumi){
80  bookSummaries(iBooker);
81  firstLumi = false;
82  }
83 
84  if (runOnEndLumi_) fillSummaries(iBooker,iGetter);
85 
86  // iBooker.cd();
87 
88 }
void fillSummaries(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
void bookSummaries(DQMStore::IBooker &iBooker)
void SiPixelPhase1Summary::fillSummaries ( DQMStore::IBooker iBooker,
DQMStore::IGetter iGetter 
)
private

Definition at line 130 of file SiPixelPhase1Summary.cc.

References DEFINE_FWK_MODULE, DQMStore::IGetter::get(), MonitorElement::hasError(), MonitorElement::hasWarning(), mps_fire::i, reco::HaloData::minus, dataset::name, SurfaceOrientation::outer, AlCaHLTBitMon_QueryRunRegistry::string, summaryMap_, summaryPlotName_, and topFolderName_.

Referenced by dqmEndJob(), and dqmEndLuminosityBlock().

130  {
131  //Firstly, we will fill the regular summary maps.
132  for (auto mapInfo: summaryPlotName_){
133  auto name = mapInfo.first;
134  if (name == "Grand") continue;
135  std::ostringstream histNameStream;
136  std::string histName;
137 
138  for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?!
139  for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?!
140  if (i > 3 && j == 3) continue;
141  bool minus = i < 2 || (i > 3 && i < 8); // bleah !
142  int iOver2 = floor(i/2.);
143  bool outer = (i > 3)?iOver2%2==0:i%2==0;
144  //Complicated expression that creates the name of the histogram we are interested in.
145  histNameStream.str("");
146  histNameStream << topFolderName_.c_str() << "PX" << ((i > 3)?"Forward":"Barrel") << "/" << ((i > 3)?"HalfCylinder":"Shell") << "_" << (minus?"m":"p") << ((outer)?"O":"I") << "/" << ((i > 3)?((i%2 == 0)?"PXRing_1/":"PXRing_2/"):"") << summaryPlotName_[name].c_str() << "_PX" << ((i > 3)?"Disk":"Layer") << "_" << ((i>3)?((minus)?"-":"+"):"") << (j+1);
147  histName = histNameStream.str();
148  MonitorElement * me = iGetter.get(histName);
149 
150  if (!me) {
151  edm::LogWarning("SiPixelPhase1Summary") << "ME " << histName << " is not available !!";
152  continue; // Ignore non-existing MEs, as this can cause the whole thing to crash
153  }
154 
155  if (me->hasError()) {
156  //If there is an error, fill with 0
157  summaryMap_[name]->setBinContent(i+1,j+1,0);
158  } //Do we want to include warnings here?
159  else if (me->hasWarning()){
160  summaryMap_[name]->setBinContent(i+1,j+1,0.5);
161  }
162  else summaryMap_[name]->setBinContent(i+1,j+1,1);
163  }
164  }
165  }
166  //Now we will use the other summary maps to create the overall map.
167  for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?!
168  for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?!
169  summaryMap_["Grand"]->setBinContent(i+1,j+1,1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries.
170  for (auto const mapInfo: summaryPlotName_){ //Check summary maps
171  auto name = mapInfo.first;
172  if (name == "Grand") continue;
173  if (summaryMap_[name]->getBinContent(i+1,j+1) < 0.9 && summaryMap_["Grand"]->getBinContent(i+1,j+1) > summaryMap_[name]->getBinContent(i+1,j+1)) summaryMap_["Grand"]->setBinContent(i+1,j+1,summaryMap_[name]->getBinContent(i+1,j+1)); // This could be changed to include warnings if we want?
174  }
175  }
176  }
177 
178 }
std::map< std::string, std::string > summaryPlotName_
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
bool hasError(void) const
true if at least of one of the quality tests returned an error
std::map< std::string, MonitorElement * > summaryMap_
bool hasWarning(void) const
true if at least of one of the quality tests returned a warning

Member Data Documentation

edm::ParameterSet SiPixelPhase1Summary::conf_
private

Definition at line 64 of file SiPixelPhase1Summary.h.

Referenced by SiPixelPhase1Summary().

bool SiPixelPhase1Summary::firstLumi
private

Definition at line 66 of file SiPixelPhase1Summary.h.

Referenced by dqmEndLuminosityBlock().

bool SiPixelPhase1Summary::runOnEndJob_
protected

Definition at line 61 of file SiPixelPhase1Summary.h.

Referenced by dqmEndJob(), and SiPixelPhase1Summary().

bool SiPixelPhase1Summary::runOnEndLumi_
protected

Definition at line 60 of file SiPixelPhase1Summary.h.

Referenced by dqmEndLuminosityBlock(), and SiPixelPhase1Summary().

edm::InputTag SiPixelPhase1Summary::src_
private

Definition at line 65 of file SiPixelPhase1Summary.h.

std::map<std::string,MonitorElement*> SiPixelPhase1Summary::summaryMap_
private

Definition at line 68 of file SiPixelPhase1Summary.h.

Referenced by bookSummaries(), and fillSummaries().

std::map<std::string,std::string> SiPixelPhase1Summary::summaryPlotName_
private

Definition at line 70 of file SiPixelPhase1Summary.h.

Referenced by bookSummaries(), fillSummaries(), and SiPixelPhase1Summary().

std::string SiPixelPhase1Summary::topFolderName_
protected

Definition at line 59 of file SiPixelPhase1Summary.h.

Referenced by fillSummaries(), and SiPixelPhase1Summary().