File indexing completed on 2024-04-06 11:58:05
0001 #ifndef HcalPedestalAnalysis_H
0002 #define HcalPedestalAnalysis_H
0003
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0007 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0008
0009 #include "CondFormats/HcalObjects/interface/AllObjects.h"
0010
0011 #include "TH1F.h"
0012 #include "TF1.h"
0013
0014 #include <memory>
0015
0016 #include <fstream>
0017 #include <vector>
0018 #include <string>
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 class HcalDbService;
0029 class TFile;
0030
0031 class HcalPedestalAnalysis {
0032 public:
0033
0034 HcalPedestalAnalysis(const edm::ParameterSet& ps);
0035
0036 ~HcalPedestalAnalysis();
0037
0038 void setup(const std::string& m_outputFileROOT);
0039
0040 void SampleAnalysis();
0041
0042 void setTopology(const HcalTopology* htopo) { fTopology = htopo; }
0043
0044 int done(const HcalPedestals* fInputPedestals,
0045 const HcalPedestalWidths* fInputWidths,
0046 HcalPedestals* fOutputPedestals,
0047 HcalPedestalWidths* fOutputWidths);
0048
0049 void processEvent(const HBHEDigiCollection& hbhe,
0050 const HODigiCollection& ho,
0051 const HFDigiCollection& hf,
0052 const HcalDbService& cond);
0053
0054
0055
0056
0057
0058 static int HcalPedVal(int nstat[4],
0059 const HcalPedestals* fRefPedestals,
0060 const HcalPedestalWidths* fRefPedestalWidths,
0061 HcalPedestals* fRawPedestals,
0062 HcalPedestalWidths* fRawPedestalWidths,
0063 HcalPedestals* fValPedestals,
0064 HcalPedestalWidths* fValPedestalWidths);
0065
0066 protected:
0067 private:
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082 typedef std::pair<TH1F*, std::pair<std::map<int, std::vector<double> >, std::vector<TH1F*> > > PEDBUNCH;
0083
0084 void per2CapsHists(int flag,
0085 int id,
0086 const HcalDetId detid,
0087 const HcalQIESample& qie1,
0088 const HcalQIESample& qie2,
0089 std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT,
0090 const HcalDbService& cond);
0091
0092 void GetPedConst(std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT, TH1F* PedMeans, TH1F* PedWidths);
0093
0094 void Trendings(std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT, TH1F* Chi2, TH1F* CapidAverage, TH1F* CapidChi2);
0095
0096 void AllChanHists(const HcalDetId detid,
0097 const HcalQIESample& qie0,
0098 const HcalQIESample& qie1,
0099 const HcalQIESample& qie2,
0100 const HcalQIESample& qie3,
0101 const HcalQIESample& qie4,
0102 const HcalQIESample& qie5,
0103 std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT);
0104
0105 TFile* m_file;
0106
0107 std::string m_outputFileROOT;
0108 std::string m_outputFileMean;
0109 std::string m_outputFileWidth;
0110
0111 int m_startTS;
0112 int m_endTS;
0113 int m_nevtsample;
0114 int m_pedsinADC;
0115 int m_hiSaveflag;
0116 int m_pedValflag;
0117 int m_AllPedsOK;
0118
0119 const HcalQIEShape* m_shape;
0120 const HcalQIECoder* m_coder;
0121 struct {
0122 std::map<HcalDetId, std::map<int, PEDBUNCH> > PEDTRENDS;
0123 TH1F* ALLPEDS;
0124 TH1F* PEDRMS;
0125 TH1F* PEDMEAN;
0126 TH1F* CHI2;
0127 TH1F* CAPID_AVERAGE;
0128 TH1F* CAPID_CHI2;
0129 } hbHists, hfHists, hoHists;
0130 std::map<HcalDetId, std::map<int, PEDBUNCH> >::iterator _meot;
0131 const HcalPedestals* fRefPedestals;
0132 const HcalPedestalWidths* fRefPedestalWidths;
0133 HcalPedestals* fRawPedestals;
0134 HcalPedestalWidths* fRawPedestalWidths;
0135 HcalPedestals* fValPedestals;
0136 HcalPedestalWidths* fValPedestalWidths;
0137 int evt;
0138 int sample;
0139 int evt_curr;
0140 float m_stat[4];
0141 std::vector<bool> state;
0142 const HcalTopology* fTopology;
0143
0144 static const int fitflag = 0;
0145 };
0146
0147 #endif