Go to the documentation of this file.00001 #ifndef CastorPedestalAnalysis_H
00002 #define CastorPedestalAnalysis_H
00003
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/Framework/interface/EDAnalyzer.h"
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "FWCore/Framework/interface/MakerMacros.h"
00008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00009 #include "FWCore/ServiceRegistry/interface/Service.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00012 #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h"
00013 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00014
00015
00016 #include "TH1F.h"
00017 #include "TF1.h"
00018
00019 #include <memory>
00020
00021 #include <fstream>
00022 #include <vector>
00023 #include <string>
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class CastorPedestals;
00034 class CastorPedestalWidths;
00035 class CastorDbService;
00036 class CastorQIEShape;
00037 class CastorQIECoder;
00038 class TFile;
00039 class CastorPedestalAnalysis{
00040
00041 public:
00042
00044 CastorPedestalAnalysis(const edm::ParameterSet& ps);
00046 ~CastorPedestalAnalysis();
00047
00048 void setup(const std::string& m_outputFileROOT);
00049
00050 void SampleAnalysis();
00051
00052 int done(const CastorPedestals* fInputPedestals,
00053 const CastorPedestalWidths* fInputWidths,
00054 CastorPedestals* fOutputPedestals,
00055 CastorPedestalWidths* fOutputWidths);
00056
00057 void processEvent(const CastorDigiCollection& castor,
00058 const CastorDbService& cond);
00059
00060
00061
00062
00063
00064 static int CastorPedVal(int nstat[4], const CastorPedestals* fRefPedestals,
00065 const CastorPedestalWidths* fRefPedestalWidths,
00066 CastorPedestals* fRawPedestals,
00067 CastorPedestalWidths* fRawPedestalWidths,
00068 CastorPedestals* fValPedestals,
00069 CastorPedestalWidths* fValPedestalWidths);
00070
00071 protected:
00072
00073
00074 private:
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 typedef std::pair<TH1F*,std::pair<std::map<int, std::vector<double> >,std::vector<TH1F*> > > PEDBUNCH;
00090
00091 void per2CapsHists(int flag, int id, const HcalDetId detid, const HcalQIESample& qie1, const HcalQIESample& qie2, std::map<HcalDetId, std::map<int,PEDBUNCH> > &toolT,const CastorDbService& cond);
00092
00093 void GetPedConst(std::map<HcalDetId,std::map<int, PEDBUNCH > > &toolT, TH1F* PedMeans, TH1F* PedWidths);
00094
00095 void Trendings(std::map<HcalDetId,std::map<int, PEDBUNCH > > &toolT, TH1F* Chi2, TH1F* CapidAverage, TH1F* CapidChi2);
00096
00097 void AllChanHists(const HcalDetId detid, const HcalQIESample& qie0, const HcalQIESample& qie1, const HcalQIESample& qie2, const HcalQIESample& qie3, const HcalQIESample& qie4, const HcalQIESample& qie5, std::map<HcalDetId, std::map<int,PEDBUNCH> > &toolT);
00098
00099 TFile* m_file;
00100
00101 std::string m_outputFileROOT;
00102 std::string m_outputFileMean;
00103 std::string m_outputFileWidth;
00104 std::ofstream m_logFile;
00105 int m_startTS;
00106 int m_endTS;
00107 int m_nevtsample;
00108 int m_pedsinADC;
00109 int m_hiSaveflag;
00110 int m_pedValflag;
00111 int m_AllPedsOK;
00112
00113 const CastorQIEShape* m_shape;
00114 const CastorQIECoder* m_coder;
00115 struct{
00116 std::map<HcalDetId,std::map<int, PEDBUNCH > > PEDTRENDS;
00117 TH1F* ALLPEDS;
00118 TH1F* PEDRMS;
00119 TH1F* PEDMEAN;
00120 TH1F* CHI2;
00121 TH1F* CAPID_AVERAGE;
00122 TH1F* CAPID_CHI2;
00123 } castorHists;
00124 std::map<HcalDetId,std::map<int, PEDBUNCH > >::iterator _meot;
00125 const CastorPedestals* fRefPedestals;
00126 const CastorPedestalWidths* fRefPedestalWidths;
00127 CastorPedestals* fRawPedestals;
00128 CastorPedestalWidths* fRawPedestalWidths;
00129 CastorPedestals* fValPedestals;
00130 CastorPedestalWidths* fValPedestalWidths;
00131 int evt;
00132 int sample;
00133 int evt_curr;
00134 float m_stat[4];
00135 std::vector<bool> state;
00136
00137
00138 static const int fitflag=0;
00139 };
00140
00141 #endif