CMS 3D CMS Logo

SiPixelOfflineCalibAnalysisBase.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelOfflineCalibAnalysisBase
4 // Class: SiPixelOfflineCalibAnalysisBase
5 //
13 //
14 // Original Author: Evan Klose Friis
15 // additions by: Freya Blekman
16 // Created: Tue Nov 6 17:27:19 CET 2007
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
32 
35 
39 
42 
43 #include "TF1.h"
44 
51 
52 #include <map>
53 #include <vector>
54 #include <iostream>
55 #include <string>
56 //
57 // class decleration
58 //
59 
61 public:
66 
67  //no argument constructor only used to throw exception in the case of derived
68  //class constructor not calling SiPixelOfflineCalibAnalysisBase(const edm::ParameterSet&)
70 
71  //pure virtual function, called after each DetID loaded
72  virtual bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix);
73 
74  //translate DetID to human readable string
75  std::string translateDetIdToString(uint32_t detid);
76 
77  //booking DQM histograms (for dynamic histogram creation)
78 
80  uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX);
82  uint32_t detid, std::string name, std::string title, int nchX, float* xbinsize); //variable size bins
83  MonitorElement* bookDQMHistogram2D(uint32_t detid,
86  int nchX,
87  double lowX,
88  double highX,
89  int nchY,
90  double lowY,
91  double highY);
92 
94  uint32_t detid,
97  title); // take the detid to determine the size of rows and columns, this saves looking up everything in the cabling map by the user.
99 
101  bool setDQMDirectory(uint32_t detID); //automatically create directory hierachy based on DetID
102  static TF1* fitFunction_;
103  static const std::vector<short>* getVcalValues();
104  std::vector<uint32_t>& getRunNumbers() { return runnumbers_; }
105 
106 protected:
107  //calibration parameters from calib.dat/DB
111 
116 
118  short nTriggers_;
119  static std::vector<short> vCalValues_;
120  uint32_t& EventNumber() { return eventCounter_; }
121 
122 private:
128 
129  std::vector<uint32_t> runnumbers_;
130  uint32_t eventCounter_;
131 
132  //store set of detIDs that have been encountered
133  //second int argument can be a derived class result flag
134  std::map<uint32_t, int> detIdsEntered_;
135  std::map<uint32_t, std::string> detIdNames_;
136 
138 
140 
141  //the beginJob is used to load the calib database. It then calls the pure
142  //virtual calibrationSetup() function. Derived classes should put beginJob functionality there.
143  void beginRun(const edm::Run&, const edm::EventSetup&) override;
144  void beginRun(const edm::EventSetup& iSetup);
145  void beginJob() override;
146 
147  //calibrationSetup will be used by derived classes
148  virtual void calibrationSetup(const edm::EventSetup& iSetup);
149 
150  // pure virtual function, checks if the calibration analyzer is of the right type wrt the calibration information in the database (as defined in the calibrationMode_ variable). Should be implemented in each analyzer, if false will not do anything in analyze loop. default returns true.
151  virtual bool checkCorrectCalibrationType();
152 
153  //called when new DetID discovered
154  virtual void newDetID(uint32_t detid);
155 
156  void analyze(const edm::Event&, const edm::EventSetup&) override;
157  // the endJob method is used to save things like histograms etc.
158  // for additional actions derived classes should use the calibrationEnd() method for endJob functionality.
159  void endJob() override;
160  // calibrationEnd() will be used by derived classes
161  virtual void calibrationEnd();
162 
163  // checkPixel returns whether a particular pixel is to be expected during the entire run..
164  bool checkPixel(uint32_t detid, short row, short column);
165 };
SiPixelOfflineCalibAnalysisBase::tPixelCalibDigi
edm::EDGetTokenT< edm::DetSetVector< SiPixelCalibDigi > > tPixelCalibDigi
Definition: SiPixelOfflineCalibAnalysisBase.h:139
SiPixelOfflineCalibAnalysisBase::outputFileName_
std::string outputFileName_
Definition: SiPixelOfflineCalibAnalysisBase.h:126
SiPixelOfflineCalibAnalysisBase::nTriggers_
short nTriggers_
Definition: SiPixelOfflineCalibAnalysisBase.h:118
SiPixelOfflineCalibAnalysisBase::addTF1ToDQMMonitoringElement
void addTF1ToDQMMonitoringElement(MonitorElement *ele, TF1 *func)
Definition: SiPixelOfflineCalibAnalysisBase.cc:302
SiPixelOfflineCalibAnalysisBase::translateDetIdToString
std::string translateDetIdToString(uint32_t detid)
Definition: SiPixelOfflineCalibAnalysisBase.cc:151
SiPixelOfflineCalibAnalysisBase::doFits
virtual bool doFits(uint32_t detid, std::vector< SiPixelCalibDigi >::const_iterator ipix)
Definition: SiPixelOfflineCalibAnalysisBase.cc:226
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
PixelBarrelName.h
SiPixelOfflineCalibAnalysisBase::calib_
edm::ESHandle< SiPixelCalibConfiguration > calib_
Definition: SiPixelOfflineCalibAnalysisBase.h:108
TrackerGeometry.h
SiPixelOfflineCalibAnalysisBase::calibrationMode_
std::string calibrationMode_
Definition: SiPixelOfflineCalibAnalysisBase.h:117
SiPixelOfflineCalibAnalysisBase::beginJob
void beginJob() override
Definition: SiPixelOfflineCalibAnalysisBase.cc:134
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
SiPixelOfflineCalibAnalysisBase::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: SiPixelOfflineCalibAnalysisBase.h:63
SiPixelOfflineCalibAnalysisBase::fitFunction_
static TF1 * fitFunction_
Definition: SiPixelOfflineCalibAnalysisBase.h:102
SiPixelOfflineCalibAnalysisBase::detIdNames_
std::map< uint32_t, std::string > detIdNames_
Definition: SiPixelOfflineCalibAnalysisBase.h:135
SiPixelOfflineCalibAnalysisBase::getRunNumbers
std::vector< uint32_t > & getRunNumbers()
Definition: SiPixelOfflineCalibAnalysisBase.h:104
SiPixelOfflineCalibAnalysisBase::SiPixelOfflineCalibAnalysisBase
SiPixelOfflineCalibAnalysisBase()
Definition: SiPixelOfflineCalibAnalysisBase.cc:53
SiPixelFedCablingMap.h
DQMStore.h
SiPixelHistogramId.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
SiPixelOfflineCalibAnalysisBase::bookDQMHistogram1D
MonitorElement * bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX)
Definition: SiPixelOfflineCalibAnalysisBase.cc:177
EDAnalyzer.h
SiPixelOfflineCalibAnalysisBase::calibrationSetup
virtual void calibrationSetup(const edm::EventSetup &iSetup)
Definition: SiPixelOfflineCalibAnalysisBase.cc:244
SiPixelCalibDigifwd.h
SiPixelOfflineCalibAnalysisBase::folderMaker_
SiPixelFolderOrganizer * folderMaker_
Definition: SiPixelOfflineCalibAnalysisBase.h:123
SiPixelOfflineCalibAnalysisBase::vCalValues_
static std::vector< short > vCalValues_
Definition: SiPixelOfflineCalibAnalysisBase.h:119
SiPixelCalibConfiguration.h
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
SiPixelOfflineCalibAnalysisBase::daqBE_
DQMStore * daqBE_
Definition: SiPixelOfflineCalibAnalysisBase.h:124
dqm::legacy::DQMStore
Definition: DQMStore.h:728
Service.h
edm::ESHandle< SiPixelCalibConfiguration >
SiPixelOfflineCalibAnalysisBase::geom_
edm::ESHandle< TrackerGeometry > geom_
Definition: SiPixelOfflineCalibAnalysisBase.h:109
SiPixelOfflineCalibAnalysisBase::bookDQMHistoPlaquetteSummary2D
MonitorElement * bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name, std::string title)
Definition: SiPixelOfflineCalibAnalysisBase.cc:202
SiPixelOfflineCalibAnalysisBase::trackerGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
Definition: SiPixelOfflineCalibAnalysisBase.h:114
SiPixelOfflineCalibAnalysisBase::eventCounter_
uint32_t eventCounter_
Definition: SiPixelOfflineCalibAnalysisBase.h:130
TrackerDigiGeometryRecord.h
SiPixelHistogramId
Definition: SiPixelHistogramId.h:25
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
SiPixelCalibConfigurationRcd.h
SiPixelFedCablingMapRcd.h
SiPixelOfflineCalibAnalysisBase::calibrationEnd
virtual void calibrationEnd()
Definition: SiPixelOfflineCalibAnalysisBase.cc:248
SiPixelOfflineCalibAnalysisBase::calibToken_
edm::ESGetToken< SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd > calibToken_
Definition: SiPixelOfflineCalibAnalysisBase.h:113
SiPixelOfflineCalibAnalysisBase::setDQMDirectory
bool setDQMDirectory(std::string dirName)
Definition: SiPixelOfflineCalibAnalysisBase.cc:214
SiPixelCalibDigi.h
SiPixelOfflineCalibAnalysisBase::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiPixelOfflineCalibAnalysisBase.cc:67
edm::EventSetup
Definition: EventSetup.h:58
DetSetVector.h
SiPixelOfflineCalibAnalysisBase::cablingMapToken_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
Definition: SiPixelOfflineCalibAnalysisBase.h:115
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
edm::ESGetToken< SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelOfflineCalibAnalysisBase::createOutputFile_
bool createOutputFile_
Definition: SiPixelOfflineCalibAnalysisBase.h:127
SiPixelOfflineCalibAnalysisBase::runnumbers_
std::vector< uint32_t > runnumbers_
Definition: SiPixelOfflineCalibAnalysisBase.h:129
SiPixelOfflineCalibAnalysisBase::siPixelCalibDigiProducer_
edm::InputTag siPixelCalibDigiProducer_
Definition: SiPixelOfflineCalibAnalysisBase.h:137
DetId.h
Frameworkfwd.h
SiPixelOfflineCalibAnalysisBase::newDetID
virtual void newDetID(uint32_t detid)
Definition: SiPixelOfflineCalibAnalysisBase.cc:251
SiPixelOfflineCalibAnalysisBase
Definition: SiPixelOfflineCalibAnalysisBase.h:60
SiPixelFolderOrganizer
Definition: SiPixelFolderOrganizer.h:26
SiPixelOfflineCalibAnalysisBase::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiPixelOfflineCalibAnalysisBase.h:62
TrackerOfflineValidation_Dqm_cff.dirName
dirName
Definition: TrackerOfflineValidation_Dqm_cff.py:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
SiPixelOfflineCalibAnalysisBase::checkCorrectCalibrationType
virtual bool checkCorrectCalibrationType()
Definition: SiPixelOfflineCalibAnalysisBase.cc:224
SiPixelOfflineCalibAnalysisBase::theCablingMap_
edm::ESHandle< SiPixelFedCablingMap > theCablingMap_
Definition: SiPixelOfflineCalibAnalysisBase.h:110
SiPixelFolderOrganizer.h
SiPixelOfflineCalibAnalysisBase::getVcalValues
static const std::vector< short > * getVcalValues()
Definition: SiPixelOfflineCalibAnalysisBase.cc:149
SiPixelOfflineCalibAnalysisBase::checkPixel
bool checkPixel(uint32_t detid, short row, short column)
Definition: SiPixelOfflineCalibAnalysisBase.cc:257
SiPixelOfflineCalibAnalysisBase::detIdsEntered_
std::map< uint32_t, int > detIdsEntered_
Definition: SiPixelOfflineCalibAnalysisBase.h:134
edm::Event
Definition: Event.h:73
SiPixelOfflineCalibAnalysisBase::bookDQMHistogram2D
MonitorElement * bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: SiPixelOfflineCalibAnalysisBase.cc:189
edm::InputTag
Definition: InputTag.h:15
SiPixelOfflineCalibAnalysisBase::EventNumber
uint32_t & EventNumber()
Definition: SiPixelOfflineCalibAnalysisBase.h:120
SiPixelOfflineCalibAnalysisBase::calibTokenBeginRun_
edm::ESGetToken< SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd > calibTokenBeginRun_
Definition: SiPixelOfflineCalibAnalysisBase.h:112
SiPixelOfflineCalibAnalysisBase::endJob
void endJob() override
Definition: SiPixelOfflineCalibAnalysisBase.cc:138
SiPixelOfflineCalibAnalysisBase::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: SiPixelOfflineCalibAnalysisBase.cc:119
SiPixelOfflineCalibAnalysisBase::theHistogramIdWorker_
SiPixelHistogramId * theHistogramIdWorker_
Definition: SiPixelOfflineCalibAnalysisBase.h:125
PixelEndcapName.h
SiPixelOfflineCalibAnalysisBase::~SiPixelOfflineCalibAnalysisBase
~SiPixelOfflineCalibAnalysisBase() override
Definition: SiPixelOfflineCalibAnalysisBase.cc:60