00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023
00024
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDAnalyzer.h"
00027
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/ServiceRegistry/interface/Service.h"
00030
00031 #include "FWCore/Framework/interface/MakerMacros.h"
00032 #include "FWCore/Framework/interface/ESHandle.h"
00033
00034 #include "FWCore/ParameterSet/interface/InputTag.h"
00035 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00036
00037 #include "DataFormats/Common/interface/DetSetVector.h"
00038 #include "DataFormats/DetId/interface/DetId.h"
00039
00040 #include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigifwd.h"
00041 #include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigi.h"
00042
00043 #include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h"
00044 #include "CondFormats/DataRecord/interface/SiPixelCalibConfigurationRcd.h"
00045 #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
00046
00047 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00048 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00049
00050 #include "TF1.h"
00051
00052 #include "DQMServices/Core/interface/DQMStore.h"
00053 #include "DQMServices/Core/interface/MonitorElement.h"
00054 #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h"
00055 #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h"
00056 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00057 #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
00058
00059 #include <map>
00060 #include <vector>
00061 #include <iostream>
00062 #include <string>
00063
00064
00065
00066
00067
00068 class SiPixelOfflineCalibAnalysisBase : public edm::EDAnalyzer {
00069 public:
00070 explicit SiPixelOfflineCalibAnalysisBase(const edm::ParameterSet&);
00071 ~SiPixelOfflineCalibAnalysisBase();
00072
00073
00074
00075 SiPixelOfflineCalibAnalysisBase();
00076
00077
00078 virtual bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix);
00079
00080
00081
00082 std::string translateDetIdToString(uint32_t detid);
00083
00084
00085
00086 MonitorElement* bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX);
00087 MonitorElement* bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, float *xbinsize);
00088 MonitorElement* bookDQMHistogram2D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY);
00089
00090 MonitorElement* bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name,std::string title);
00091 void addTF1ToDQMMonitoringElement(MonitorElement *ele, TF1 *func);
00092
00093 bool setDQMDirectory(std::string dirName);
00094 bool setDQMDirectory(uint32_t detID);
00095 static TF1* fitFunction_;
00096 static const std::vector<short>* getVcalValues();
00097 std::vector<uint32_t> & getRunNumbers() { return runnumbers_;}
00098
00099 protected:
00100
00101
00102 edm::ESHandle<SiPixelCalibConfiguration> calib_;
00103 edm::ESHandle<TrackerGeometry> geom_;
00104 edm::ESHandle<SiPixelFedCablingMap> theCablingMap_;
00105
00106 std::string calibrationMode_;
00107 short nTriggers_;
00108 static std::vector<short> vCalValues_;
00109 uint32_t & EventNumber() { return eventCounter_;}
00110
00111
00112 private:
00113
00114 SiPixelFolderOrganizer* folderMaker_;
00115 DQMStore* daqBE_;
00116 SiPixelHistogramId * theHistogramIdWorker_;
00117 std::string outputFileName_;
00118 bool createOutputFile_;
00119
00120 std::vector<uint32_t> runnumbers_;
00121 uint32_t eventCounter_;
00122
00123
00124
00125 std::map<uint32_t, int> detIdsEntered_;
00126 std::map<uint32_t, std::string> detIdNames_;
00127
00128 edm::InputTag siPixelCalibDigiProducer_;
00129
00130
00131
00132 virtual void beginRun(const edm::Run &, const edm::EventSetup &);
00133 void beginRun(const edm::EventSetup& iSetup);
00134 void beginJob(const edm::EventSetup& iSetup);
00135
00136
00137 virtual void calibrationSetup(const edm::EventSetup& iSetup);
00138
00139
00140 virtual bool checkCorrectCalibrationType();
00141
00142
00143 virtual void newDetID(uint32_t detid);
00144
00145 void analyze(const edm::Event&, const edm::EventSetup&);
00146
00147
00148 void endJob() ;
00149
00150 virtual void calibrationEnd() ;
00151
00152
00153 bool checkPixel(uint32_t detid, short row, short column);
00154 };
00155