CMS 3D CMS Logo

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