CMS 3D CMS Logo

HcalLedAnalysis.h
Go to the documentation of this file.
1 #ifndef HcalLedAnalysis_H
2 #define HcalLedAnalysis_H
3 
4 
12 
14 
15 
16 #include "TH1F.h"
17 #include "TF1.h"
18 #include "TProfile.h"
19 
20 #include <memory>
21 //#include <iostream>
22 #include <fstream>
23 #include <vector>
24 #include <string>
25 
26 class HcalPedestal;
27 class HcalDbService;
28 class HcalQIEShape;
29 class HcalQIECoder;
30 class TFile;
31 
33 
34 public:
35 
41  //void doPeds(const HcalPedestals* fInputPedestals);
42  void LedSampleAnalysis();
43  void LedDone();
45  const HODigiCollection& ho,
46  const HFDigiCollection& hf,
48  const HcalDbService& cond);
49 
50 protected:
51 
52 
53 private:
54  //###
55  //# LEDBUNCH is used in map<HcalDetId,map<int, LEDBUNCH > > LEDTRENDS;
56  //# For each HcalDetId (channel) a map<int, LEDBUNCH> is associated;
57  //# int was originally cap-id and now is just dummy;
58  //# LEDBUNCH is a pair - first element is the main
59  //# histo with the ADC values and second one is another pair;
60  //# this pair contains map<int, std::vector<double> > as a first element;
61  //# vector contains some useful variables;
62  //# the second element is a vector of histos (pointers);
63  //# for the "trend" analysis the main histo (with ADC values) is reset every
64  //# m_nevtsample events and info is put in the other part of the LEDBUNCH;
65  //# so at the end we have the trends for the variables in concern
66  //# which are written in THE vector<TH1F*>;
67  //###
68  typedef std::pair<TH1F*,std::pair<std::map<int, std::vector<double> >,std::vector<TH1F*> > > LEDBUNCH;
69  typedef struct{
70  TProfile* avePulse;
71  TH1F* thisPulse;
72  TH1F* integPulse;
73  } CALIBBUNCH;
74  TFile* m_file;
75  void LedHBHEHists(const HcalDetId& detid, const HBHEDataFrame& ledDigi, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT, const HcalDbService& cond);
76  void LedHOHists(const HcalDetId& detid, const HODataFrame& ledDigi, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT, const HcalDbService& cond);
77  void LedHFHists(const HcalDetId& detid, const HFDataFrame& ledDigi, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT, const HcalDbService& cond);
78  void SetupLEDHists(int id, const HcalDetId detid, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT);
79  void GetLedConst(std::map<HcalDetId,std::map<int, LEDBUNCH > > &toolT);
80  void LedTrendings(std::map<HcalDetId,std::map<int, LEDBUNCH > > &toolT);
81  void ProcessCalibEvent(int fiberChan,HcalCalibDetId calibId, const HcalCalibDataFrame& digi);
82  float BinsizeCorr(float time);
83 
87  std::ofstream m_outFile;
88  std::ofstream m_logFile;
89  std::ofstream m_outputFileXML;
90 
91  int m_startTS;
92  int m_endTS;
95  bool m_usecalib;
96 // analysis flag:
97 // m_fitflag = 0 - take mean TS value of averaged pulse shape
98 // 1 - take peak from landau fit to averaged pulse shape
99 // 2 - take average of mean TS values per event
100 // (preferred for laser & HF LED)
101 // 3 - take average of peaks from landau fits per event
102 // (preferred for LED)
103 // 4 - 0+1+2+3 REMOVED in 1_6
105 
109  struct{
110  std::map<HcalDetId,std::map<int, LEDBUNCH > > LEDTRENDS;
111  TH1F* ALLLEDS;
112  TH1F* LEDRMS;
113  TH1F* LEDMEAN;
114  TH1F* CHI2;
115  } hbHists, hfHists, hoHists;
116  std::map<HcalDetId,std::map<int, LEDBUNCH > >::iterator _meol;
117  std::map<HcalDetId,std::map<int,float> > m_AllPedVals;
118  std::map<HcalDetId,std::map<int,float> >::iterator _meee;
119 
120  std::map<HcalCalibDetId,CALIBBUNCH> calibHists;
121  std::map<HcalCalibDetId,CALIBBUNCH>::iterator _meca;
122 
123  //const HcalPedestal* pedCan;
124  int evt;
125  int sample;
126  int evt_curr;
127  std::vector<bool> state;
128 
129 };
130 
131 #endif
void LedHBHEHists(const HcalDetId &detid, const HBHEDataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const HcalDbService &cond)
std::vector< bool > state
void LedSetup(const std::string &m_outputFileROOT)
std::map< HcalCalibDetId, CALIBBUNCH > calibHists
void processLedEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalCalibDigiCollection &calib, const HcalDbService &cond)
std::ofstream m_logFile
~HcalLedAnalysis()
Destructor.
std::string m_outputFileROOT
HcalLedAnalysis(const edm::ParameterSet &ps)
Constructor.
const HcalPedestal * m_ped
struct HcalLedAnalysis::@56 hbHists
void SetupLEDHists(int id, const HcalDetId detid, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
std::map< HcalCalibDetId, CALIBBUNCH >::iterator _meca
void GetLedConst(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
std::string m_outputFileX
void ProcessCalibEvent(int fiberChan, HcalCalibDetId calibId, const HcalCalibDataFrame &digi)
const HcalQIECoder * m_coder
struct HcalLedAnalysis::@56 hoHists
std::ofstream m_outputFileXML
float BinsizeCorr(float time)
std::ofstream m_outFile
void LedHFHists(const HcalDetId &detid, const HFDataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const HcalDbService &cond)
std::map< HcalDetId, std::map< int, float > >::iterator _meee
std::pair< TH1F *, std::pair< std::map< int, std::vector< double > >, std::vector< TH1F * > > > LEDBUNCH
const HcalQIEShape * m_shape
Definition: plugin.cc:24
struct HcalLedAnalysis::@56 hfHists
void LedTrendings(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
std::string m_outputFileText
void LedHOHists(const HcalDetId &detid, const HODataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const HcalDbService &cond)
std::map< HcalDetId, std::map< int, LEDBUNCH > > LEDTRENDS
std::map< HcalDetId, std::map< int, float > > m_AllPedVals
std::map< HcalDetId, std::map< int, LEDBUNCH > >::iterator _meol