CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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();
44  void processLedEvent(const HBHEDigiCollection& hbhe,
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  char output[100];
91 
92  int m_startTS;
93  int m_endTS;
96  bool m_usecalib;
97 // analysis flag:
98 // m_fitflag = 0 - take mean TS value of averaged pulse shape
99 // 1 - take peak from landau fit to averaged pulse shape
100 // 2 - take average of mean TS values per event
101 // (preferred for laser & HF LED)
102 // 3 - take average of peaks from landau fits per event
103 // (preferred for LED)
104 // 4 - 0+1+2+3 REMOVED in 1_6
106 
110  struct{
111  std::map<HcalDetId,std::map<int, LEDBUNCH > > LEDTRENDS;
112  TH1F* ALLLEDS;
113  TH1F* LEDRMS;
114  TH1F* LEDMEAN;
115  TH1F* CHI2;
116  } hbHists, hfHists, hoHists;
117  std::map<HcalDetId,std::map<int, LEDBUNCH > >::iterator _meol;
118  std::map<HcalDetId,std::map<int,float> > m_AllPedVals;
119  std::map<HcalDetId,std::map<int,float> >::iterator _meee;
120 
121  std::map<HcalCalibDetId,CALIBBUNCH> calibHists;
122  std::map<HcalCalibDetId,CALIBBUNCH>::iterator _meca;
123 
124  //const HcalPedestal* pedCan;
125  int evt;
126  int sample;
127  int evt_curr;
128  std::vector<bool> state;
129 
130 };
131 
132 #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
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
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
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
struct HcalLedAnalysis::@51 hfHists
struct HcalLedAnalysis::@51 hbHists
const HcalQIEShape * m_shape
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
struct HcalLedAnalysis::@51 hoHists
std::map< HcalDetId, std::map< int, LEDBUNCH > >::iterator _meol