00001 // -*- C++ -*- 00002 // 00003 // Package: SiPixelGainCalibrationAnalysis 00004 // Class: SiPixelGainCalibrationAnalysis 00005 // 00013 // 00014 // Original Author: Freya Blekman 00015 // Created: Wed Nov 14 15:02:06 CET 2007 00016 // $Id: SiPixelGainCalibrationAnalysis.h,v 1.23 2009/07/07 15:52:36 rougny Exp $ 00017 // 00018 // 00019 00020 00021 // system include files 00022 #include <memory> 00023 00024 // user include files 00025 #include "FWCore/Framework/interface/Frameworkfwd.h" 00026 #include "FWCore/Framework/interface/EDAnalyzer.h" 00027 #include "CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h" 00028 00029 #include "FWCore/Framework/interface/Event.h" 00030 #include "FWCore/Framework/interface/MakerMacros.h" 00031 00032 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00033 00034 #include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h" 00035 //#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibration.h" 00036 //#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationOffline.h" 00037 //#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h" 00038 00039 //#include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationService.h" 00040 00041 #include "DQMServices/Core/interface/MonitorElement.h" 00042 #include "TLinearFitter.h" 00043 #include "TGraphErrors.h" 00044 #include <fstream> 00045 // 00046 // class decleration 00047 // 00048 00049 class SiPixelGainCalibrationAnalysis : public SiPixelOfflineCalibAnalysisBase { 00050 public: 00051 explicit SiPixelGainCalibrationAnalysis(const edm::ParameterSet& iConfig); 00052 ~SiPixelGainCalibrationAnalysis(); 00053 00054 void doSetup(const edm::ParameterSet&); 00055 virtual bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix); 00056 00057 virtual bool checkCorrectCalibrationType(); 00058 00059 private: 00060 00061 virtual void calibrationSetup(const edm::EventSetup& iSetup); 00062 00063 virtual void calibrationEnd(); 00064 virtual void newDetID(uint32_t detid); 00065 void fillDatabase(); 00066 void printSummary(); 00067 std::vector<float> CalculateAveragePerColumn(uint32_t detid, std::string label); 00068 // ----------member data --------------------------- 00069 edm::ParameterSet conf_; 00070 // more class members used to keep track of the histograms 00071 std::map<uint32_t,std::map<std::string, MonitorElement *> > bookkeeper_; 00072 std::map<uint32_t,std::map<std::string, MonitorElement *> > bookkeeper_pixels_; 00073 00074 // fitter 00075 int nfitparameters_; 00076 std::string fitfunction_; 00077 TF1 *func_; 00078 TGraphErrors *graph_; 00079 00080 std::vector<uint32_t> listofdetids_; 00081 bool ignoreMode_; 00082 // flags 00083 00084 bool reject_badpoints_; 00085 bool reject_plateaupoints_; 00086 bool reject_single_entries_; 00087 double plateau_max_slope_; 00088 bool reject_first_point_; 00089 double reject_badpoints_frac_; 00090 bool bookBIGCalibPayload_; 00091 bool savePixelHists_; 00092 double chi2Threshold_; 00093 double chi2ProbThreshold_; 00094 double maxGainInHist_; 00095 double maxChi2InHist_; 00096 bool saveALLHistograms_; 00097 bool sum_ped_cols_; 00098 bool sum_gain_cols_; 00099 bool filldb_; 00100 bool writeSummary_; 00101 00102 // parameters for database output 00103 std::string recordName_; 00104 bool appendMode_; 00105 /*SiPixelGainCalibration *theGainCalibrationDbInput_; 00106 SiPixelGainCalibrationOffline *theGainCalibrationDbInputOffline_; 00107 SiPixelGainCalibrationForHLT *theGainCalibrationDbInputHLT_; 00108 SiPixelGainCalibrationService theGainCalibrationDbInputService_;*/ 00109 00110 // keep track of lowest and highest vals for range 00111 float gainlow_; 00112 float gainhi_; 00113 float pedlow_; 00114 float pedhi_; 00115 uint16_t min_nentries_; 00116 bool useVcalHigh_; 00117 double scalarVcalHigh_VcalLow_; 00118 00119 //Summary 00120 ofstream summary_; 00121 uint32_t currentDetID_; 00122 int* statusNumbers_; 00123 00124 };