00001 #ifndef HcalLedAnalysis_H
00002 #define HcalLedAnalysis_H
00003
00004
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/MakerMacros.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/ServiceRegistry/interface/Service.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012
00013 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00014
00015
00016 #include "TH1F.h"
00017 #include "TF1.h"
00018 #include "TProfile.h"
00019
00020 #include <memory>
00021
00022 #include <fstream>
00023 #include <vector>
00024 #include <string>
00025
00026 class HcalPedestal;
00027 class HcalDbService;
00028 class HcalQIEShape;
00029 class HcalQIECoder;
00030 class TFile;
00031
00032 class HcalLedAnalysis{
00033
00034 public:
00035
00037 HcalLedAnalysis(const edm::ParameterSet& ps);
00039 ~HcalLedAnalysis();
00040 void LedSetup(const std::string& m_outputFileROOT);
00041
00042 void LedSampleAnalysis();
00043 void LedDone();
00044 void processLedEvent(const HBHEDigiCollection& hbhe,
00045 const HODigiCollection& ho,
00046 const HFDigiCollection& hf,
00047 const HcalCalibDigiCollection calib,
00048 const HcalDbService& cond);
00049
00050 protected:
00051
00052
00053 private:
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 typedef std::pair<TH1F*,std::pair<std::map<int, std::vector<double> >,std::vector<TH1F*> > > LEDBUNCH;
00069 typedef struct{
00070 TProfile* avePulse;
00071 TH1F* thisPulse;
00072 TH1F* integPulse;
00073 } CALIBBUNCH;
00074 TFile* m_file;
00075 void LedHBHEHists(const HcalDetId& detid, const HBHEDataFrame& ledDigi, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT, const HcalDbService& cond);
00076 void LedHOHists(const HcalDetId& detid, const HODataFrame& ledDigi, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT, const HcalDbService& cond);
00077 void LedHFHists(const HcalDetId& detid, const HFDataFrame& ledDigi, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT, const HcalDbService& cond);
00078 void SetupLEDHists(int id, const HcalDetId detid, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT);
00079 void GetLedConst(std::map<HcalDetId,std::map<int, LEDBUNCH > > &toolT);
00080 void LedTrendings(std::map<HcalDetId,std::map<int, LEDBUNCH > > &toolT);
00081 void ProcessCalibEvent(int fiberChan,HcalCalibDetId calibId, const HcalCalibDataFrame digi);
00082 float BinsizeCorr(float time);
00083
00084 std::string m_outputFileROOT;
00085 std::string m_outputFileText;
00086 std::string m_outputFileX;
00087 std::ofstream m_outFile;
00088 std::ofstream m_logFile;
00089 std::ofstream m_outputFileXML;
00090 char output[100];
00091
00092 int m_startTS;
00093 int m_endTS;
00094 int m_nevtsample;
00095 int m_hiSaveflag;
00096 bool m_usecalib;
00097
00098
00099
00100
00101
00102
00103
00104
00105 int m_fitflag;
00106
00107 const HcalQIEShape* m_shape;
00108 const HcalQIECoder* m_coder;
00109 const HcalPedestal* m_ped;
00110 struct{
00111 std::map<HcalDetId,std::map<int, LEDBUNCH > > LEDTRENDS;
00112 TH1F* ALLLEDS;
00113 TH1F* LEDRMS;
00114 TH1F* LEDMEAN;
00115 TH1F* CHI2;
00116 } hbHists, hfHists, hoHists;
00117 std::map<HcalDetId,std::map<int, LEDBUNCH > >::iterator _meol;
00118 std::map<HcalDetId,std::map<int,float> > m_AllPedVals;
00119 std::map<HcalDetId,std::map<int,float> >::iterator _meee;
00120
00121 std::map<HcalCalibDetId,CALIBBUNCH> calibHists;
00122 std::map<HcalCalibDetId,CALIBBUNCH>::iterator _meca;
00123
00124
00125 int evt;
00126 int sample;
00127 int evt_curr;
00128 std::vector<bool> state;
00129
00130 };
00131
00132 #endif