Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:34

0001 // -*- C++ -*-
0002 //
0003 // Package:    SiPixelGainCalibrationAnalysis
0004 // Class:      SiPixelGainCalibrationAnalysis
0005 //
0006 /**\class SiPixelGainCalibrationAnalysis SiPixelGainCalibrationAnalysis.h CalibTracker/SiPixelGainCalibrationAnalysis/interface/SiPixelGainCalibrationAnalysis.h
0007 
0008 Description: <one line class summary>
0009 
0010 Implementation:
0011 <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Freya Blekman
0015 //         Created:  Wed Nov 14 15:02:06 CET 2007
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 
0031 #include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h"
0032 //#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibration.h"
0033 //#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationOffline.h"
0034 //#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h"
0035 
0036 //#include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationService.h"
0037 
0038 #include "DQMServices/Core/interface/DQMStore.h"
0039 #include "TLinearFitter.h"
0040 #include "TGraphErrors.h"
0041 #include <fstream>
0042 //
0043 // class decleration
0044 //
0045 
0046 class SiPixelGainCalibrationAnalysis : public SiPixelOfflineCalibAnalysisBase {
0047 public:
0048   explicit SiPixelGainCalibrationAnalysis(const edm::ParameterSet &iConfig);
0049   ~SiPixelGainCalibrationAnalysis() override;
0050 
0051   void doSetup(const edm::ParameterSet &);
0052   bool doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix) override;
0053 
0054   bool checkCorrectCalibrationType() override;
0055 
0056 private:
0057   void calibrationSetup(const edm::EventSetup &iSetup) override;
0058 
0059   void calibrationEnd() override;
0060   void newDetID(uint32_t detid) override;
0061   void fillDatabase();
0062   void printSummary();
0063   std::vector<float> CalculateAveragePerColumn(uint32_t detid, std::string label);
0064   // ----------member data ---------------------------
0065   edm::ParameterSet conf_;
0066   // more class members used to keep track of the histograms
0067   std::map<uint32_t, std::map<std::string, MonitorElement *> > bookkeeper_;
0068   std::map<uint32_t, std::map<std::string, MonitorElement *> > bookkeeper_pixels_;
0069 
0070   // fitter
0071   int nfitparameters_;
0072   std::string fitfunction_;
0073   TF1 *func_;
0074   TGraphErrors *graph_;
0075 
0076   std::vector<uint32_t> listofdetids_;
0077   bool ignoreMode_;
0078   // flags
0079 
0080   bool reject_badpoints_;
0081   bool reject_plateaupoints_;
0082   bool reject_single_entries_;
0083   double plateau_max_slope_;
0084   bool reject_first_point_;
0085   double reject_badpoints_frac_;
0086   bool bookBIGCalibPayload_;
0087   bool savePixelHists_;
0088   double chi2Threshold_;
0089   double chi2ProbThreshold_;
0090   double maxGainInHist_;
0091   double maxChi2InHist_;
0092   bool saveALLHistograms_;
0093   bool sum_ped_cols_;
0094   bool sum_gain_cols_;
0095   bool filldb_;
0096   bool writeSummary_;
0097 
0098   // parameters for database output
0099   std::string recordName_;
0100   bool appendMode_;
0101   /*SiPixelGainCalibration *theGainCalibrationDbInput_;
0102   SiPixelGainCalibrationOffline *theGainCalibrationDbInputOffline_;
0103   SiPixelGainCalibrationForHLT *theGainCalibrationDbInputHLT_;
0104   SiPixelGainCalibrationService theGainCalibrationDbInputService_;*/
0105 
0106   // keep track of lowest and highest vals for range
0107   float gainlow_;
0108   float gainhi_;
0109   float pedlow_;
0110   float pedhi_;
0111   uint16_t min_nentries_;
0112   bool useVcalHigh_;
0113   double scalarVcalHigh_VcalLow_;
0114 
0115   //Summary
0116   std::ofstream summary_;
0117   uint32_t currentDetID_;
0118   int *statusNumbers_;
0119 };