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 //#include "FWCore/Framework/interface/EventSetup.h"
32 
35 
38 
41 
45 
48 
49 #include "TF1.h"
50 
56 
57 #include <map>
58 #include <vector>
59 #include <iostream>
60 #include <string>
61 //
62 // class decleration
63 //
64 
66 public:
71 
72  //no argument constructor only used to throw exception in the case of derived
73  //class constructor not calling SiPixelOfflineCalibAnalysisBase(const edm::ParameterSet&)
75 
76  //pure virtual function, called after each DetID loaded
77  virtual bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix);
78 
79  //translate DetID to human readable string
80  std::string translateDetIdToString(uint32_t detid);
81 
82  //booking DQM histograms (for dynamic histogram creation)
83 
84  MonitorElement* bookDQMHistogram1D(
85  uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX);
86  MonitorElement* bookDQMHistogram1D(
87  uint32_t detid, std::string name, std::string title, int nchX, float* xbinsize); //variable size bins
88  MonitorElement* bookDQMHistogram2D(uint32_t detid,
91  int nchX,
92  double lowX,
93  double highX,
94  int nchY,
95  double lowY,
96  double highY);
97 
98  MonitorElement* bookDQMHistoPlaquetteSummary2D(
99  uint32_t detid,
102  title); // take the detid to determine the size of rows and columns, this saves looking up everything in the cabling map by the user.
103  void addTF1ToDQMMonitoringElement(MonitorElement* ele, TF1* func);
104 
106  bool setDQMDirectory(uint32_t detID); //automatically create directory hierachy based on DetID
107  static TF1* fitFunction_;
108  static const std::vector<short>* getVcalValues();
109  std::vector<uint32_t>& getRunNumbers() { return runnumbers_; }
110 
111 protected:
112  //calibration parameters from calib.dat/DB
116 
118  short nTriggers_;
119  static std::vector<short> vCalValues_;
120  uint32_t& EventNumber() { return eventCounter_; }
121 
122 private:
124  DQMStore* daqBE_;
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 };
void beginRun(const edm::Run &, const edm::EventSetup &) override
edm::ESHandle< SiPixelCalibConfiguration > calib_
std::map< uint32_t, std::string > detIdNames_
std::string translateDetIdToString(uint32_t detid)
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)
MonitorElement * bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name, std::string title)
void analyze(const edm::Event &, const edm::EventSetup &) override
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