CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 // $Id: SiPixelOfflineCalibAnalysisBase.h,v 1.16 2010/01/13 09:35:58 ursl Exp $
18 //
19 //
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 //#include "FWCore/Framework/interface/EventSetup.h"
33 
36 
39 
42 
46 
49 
50 #include "TF1.h"
51 
58 
59 #include <map>
60 #include <vector>
61 #include <iostream>
62 #include <string>
63 //
64 // class decleration
65 //
66 
67 
69 public:
72 
73  //no argument constructor only used to throw exception in the case of derived
74  //class constructor not calling SiPixelOfflineCalibAnalysisBase(const edm::ParameterSet&)
76 
77  //pure virtual function, called after each DetID loaded
78  virtual bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix);
79 
80 
81  //translate DetID to human readable string
82  std::string translateDetIdToString(uint32_t detid);
83 
84  //booking DQM histograms (for dynamic histogram creation)
85 
86  MonitorElement* bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX);
87  MonitorElement* bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, float *xbinsize); //variable size bins
88  MonitorElement* bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY);
89 
90  MonitorElement* bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name,std::string title); // take the detid to determine the size of rows and columns, this saves looking up everything in the cabling map by the user.
91  void addTF1ToDQMMonitoringElement(MonitorElement *ele, TF1 *func);
92 
93  bool setDQMDirectory(std::string dirName);
94  bool setDQMDirectory(uint32_t detID); //automatically create directory hierachy based on DetID
95  static TF1* fitFunction_;
96  static const std::vector<short>* getVcalValues();
97  std::vector<uint32_t> & getRunNumbers() { return runnumbers_;}
98 
99 protected:
100 
101  //calibration parameters from calib.dat/DB
105 
106  std::string calibrationMode_;
107  short nTriggers_;
108  static std::vector<short> vCalValues_;
109  uint32_t & EventNumber() { return eventCounter_;}
110 
111 
112 private:
113 
117  std::string outputFileName_;
119 
120  std::vector<uint32_t> runnumbers_;
121  uint32_t eventCounter_;
122 
123  //store set of detIDs that have been encountered
124  //second int argument can be a derived class result flag
125  std::map<uint32_t, int> detIdsEntered_;
126  std::map<uint32_t, std::string> detIdNames_;
127 
129 
130  //the beginJob is used to load the calib database. It then calls the pure
131  //virtual calibrationSetup() function. Derived classes should put beginJob functionality there.
132  virtual void beginRun(const edm::Run &, const edm::EventSetup &);
133  void beginRun(const edm::EventSetup& iSetup);
134  void beginJob();
135 
136  //calibrationSetup will be used by derived classes
137  virtual void calibrationSetup(const edm::EventSetup& iSetup);
138 
139  // 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.
140  virtual bool checkCorrectCalibrationType();
141 
142  //called when new DetID discovered
143  virtual void newDetID(uint32_t detid);
144 
145  void analyze(const edm::Event&, const edm::EventSetup&);
146  // the endJob method is used to save things like histograms etc.
147  // for additional actions derived classes should use the calibrationEnd() method for endJob functionality.
148  void endJob() ;
149  // calibrationEnd() will be used by derived classes
150  virtual void calibrationEnd() ;
151 
152  // checkPixel returns whether a particular pixel is to be expected during the entire run..
153  bool checkPixel(uint32_t detid, short row, short column);
154 };
155 
edm::ESHandle< SiPixelCalibConfiguration > calib_
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
std::map< uint32_t, std::string > detIdNames_
std::string translateDetIdToString(uint32_t detid)
MonitorElement * bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name, std::string title)
edm::ESHandle< TrackerGeometry > geom_
virtual void calibrationSetup(const edm::EventSetup &iSetup)
MonitorElement * bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX)
virtual bool doFits(uint32_t detid, std::vector< SiPixelCalibDigi >::const_iterator ipix)
void analyze(const edm::Event &, const edm::EventSetup &)
static const std::vector< short > * getVcalValues()
bool checkPixel(uint32_t detid, short row, short column)
void addTF1ToDQMMonitoringElement(MonitorElement *ele, TF1 *func)
edm::ESHandle< SiPixelFedCablingMap > theCablingMap_
MonitorElement * bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: Run.h:32