CMS 3D CMS Logo

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