CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
60 class SiPixelOfflineCalibAnalysisBase : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
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 endRun(const edm::Run&, const edm::EventSetup&) override;
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 };
void beginRun(const edm::Run &, const edm::EventSetup &) override
void endRun(const edm::Run &, const edm::EventSetup &) override
edm::ESHandle< SiPixelCalibConfiguration > calib_
std::map< uint32_t, std::string > detIdNames_
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
std::string translateDetIdToString(uint32_t detid)
edm::ESGetToken< SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd > calibToken_
MonitorElement * bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX)
edm::ESHandle< TrackerGeometry > geom_
virtual void calibrationSetup(const edm::EventSetup &iSetup)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
MonitorElement * bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name, std::string title)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
edm::ESGetToken< SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd > calibTokenBeginRun_
virtual bool doFits(uint32_t detid, std::vector< SiPixelCalibDigi >::const_iterator ipix)
static const std::vector< short > * getVcalValues()
bool checkPixel(uint32_t detid, short row, short column)
MonitorElement * bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
void addTF1ToDQMMonitoringElement(MonitorElement *ele, TF1 *func)
edm::ESHandle< SiPixelFedCablingMap > theCablingMap_
edm::EDGetTokenT< edm::DetSetVector< SiPixelCalibDigi > > tPixelCalibDigi
Definition: Run.h:45