File indexing completed on 2024-04-06 11:57:33
0001 #ifndef CastorLedAnalysis_H
0002 #define CastorLedAnalysis_H
0003
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ServiceRegistry/interface/Service.h"
0009
0010 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0011
0012 #include "TH1F.h"
0013 #include "TF1.h"
0014 #include "TProfile.h"
0015
0016 #include <memory>
0017
0018 #include <fstream>
0019 #include <vector>
0020 #include <string>
0021
0022 class CastorPedestal;
0023 class CastorDbService;
0024 class CastorQIEShape;
0025 class CastorQIECoder;
0026 class TFile;
0027
0028 class CastorLedAnalysis {
0029 public:
0030
0031 CastorLedAnalysis(const edm::ParameterSet& ps);
0032
0033 ~CastorLedAnalysis();
0034 void LedSetup(const std::string& m_outputFileROOT);
0035
0036 void LedSampleAnalysis();
0037 void LedDone();
0038 void processLedEvent(const CastorDigiCollection& castor, const CastorDbService& cond);
0039
0040 protected:
0041 private:
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056 typedef std::pair<TH1F*, std::pair<std::map<int, std::vector<double> >, std::vector<TH1F*> > > LEDBUNCH;
0057 typedef struct {
0058 TProfile* avePulse[3];
0059 TH1F* thisPulse[3];
0060 TH1F* integPulse[3];
0061 } CALIBBUNCH;
0062 TFile* m_file;
0063 void LedCastorHists(const HcalDetId& detid,
0064 const CastorDataFrame& ledDigi,
0065 std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT,
0066 const CastorDbService& cond);
0067 void SetupLEDHists(int id, const HcalDetId detid, std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
0068 void GetLedConst(std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
0069 void LedTrendings(std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
0070 float BinsizeCorr(float time);
0071
0072 std::string m_outputFileROOT;
0073 std::string m_outputFileText;
0074 std::string m_outputFileX;
0075 std::ofstream m_outFile;
0076 std::ofstream m_logFile;
0077 std::ofstream m_outputFileXML;
0078
0079 int m_startTS;
0080 int m_endTS;
0081 int m_nevtsample;
0082 int m_hiSaveflag;
0083 bool m_usecalib;
0084
0085
0086
0087
0088
0089
0090
0091
0092 int m_fitflag;
0093
0094 const CastorQIEShape* m_shape;
0095 const CastorQIECoder* m_coder;
0096 const CastorPedestal* m_ped;
0097 struct {
0098 std::map<HcalDetId, std::map<int, LEDBUNCH> > LEDTRENDS;
0099 TH1F* ALLLEDS;
0100 TH1F* LEDRMS;
0101 TH1F* LEDMEAN;
0102 TH1F* CHI2;
0103 } castorHists;
0104 std::map<HcalDetId, std::map<int, LEDBUNCH> >::iterator _meol;
0105 std::map<HcalDetId, std::map<int, float> > m_AllPedVals;
0106 std::map<HcalDetId, std::map<int, float> >::iterator _meee;
0107
0108 std::map<HcalCalibDetId, CALIBBUNCH>::iterator _meca;
0109
0110
0111 int evt;
0112 int sample;
0113 int evt_curr;
0114 std::vector<bool> state;
0115 };
0116
0117 #endif