CMS 3D CMS Logo

CastorLedAnalysis.h
Go to the documentation of this file.
1 #ifndef CastorLedAnalysis_H
2 #define CastorLedAnalysis_H
3 
9 
11 
12 #include "TH1F.h"
13 #include "TF1.h"
14 #include "TProfile.h"
15 
16 #include <memory>
17 //#include <iostream>
18 #include <fstream>
19 #include <vector>
20 #include <string>
21 
22 class CastorPedestal;
23 class CastorDbService;
24 class CastorQIEShape;
25 class CastorQIECoder;
26 class TFile;
27 
29 public:
35  //void doPeds(const CastorPedestals* fInputPedestals);
36  void LedSampleAnalysis();
37  void LedDone();
39 
40 protected:
41 private:
42  //###
43  //# LEDBUNCH is used in map<HcalDetId,map<int, LEDBUNCH > > LEDTRENDS;
44  //# For each HcalDetId (channel) a map<int, LEDBUNCH> is associated;
45  //# int was originally cap-id and now is just dummy;
46  //# LEDBUNCH is a pair - first element is the main
47  //# histo with the ADC values and second one is another pair;
48  //# this pair contains map<int, std::vector<double> > as a first element;
49  //# vector contains some useful variables;
50  //# the second element is a vector of histos (pointers);
51  //# for the "trend" analysis the main histo (with ADC values) is reset every
52  //# m_nevtsample events and info is put in the other part of the LEDBUNCH;
53  //# so at the end we have the trends for the variables in concern
54  //# which are written in THE vector<TH1F*>;
55  //###
56  typedef std::pair<TH1F*, std::pair<std::map<int, std::vector<double> >, std::vector<TH1F*> > > LEDBUNCH;
57  typedef struct {
58  TProfile* avePulse[3];
59  TH1F* thisPulse[3];
60  TH1F* integPulse[3];
61  } CALIBBUNCH;
62  TFile* m_file;
63  void LedCastorHists(const HcalDetId& detid,
64  const CastorDataFrame& ledDigi,
65  std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT,
66  const CastorDbService& cond);
67  void SetupLEDHists(int id, const HcalDetId detid, std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
68  void GetLedConst(std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
69  void LedTrendings(std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
70  float BinsizeCorr(float time);
71 
75  std::ofstream m_outFile;
76  std::ofstream m_logFile;
77  std::ofstream m_outputFileXML;
78 
79  int m_startTS;
80  int m_endTS;
83  bool m_usecalib;
84  // analysis flag:
85  // m_fitflag = 0 - take mean TS value of averaged pulse shape
86  // 1 - take peak from landau fit to averaged pulse shape
87  // 2 - take average of mean TS values per event
88  // (preferred for laser & HF LED)
89  // 3 - take average of peaks from landau fits per event
90  // (preferred for LED)
91  // 4 - 0+1+2+3 REMOVED in 1_6
92  int m_fitflag;
93 
97  struct {
98  std::map<HcalDetId, std::map<int, LEDBUNCH> > LEDTRENDS;
99  TH1F* ALLLEDS;
100  TH1F* LEDRMS;
101  TH1F* LEDMEAN;
102  TH1F* CHI2;
103  } castorHists;
104  std::map<HcalDetId, std::map<int, LEDBUNCH> >::iterator _meol;
105  std::map<HcalDetId, std::map<int, float> > m_AllPedVals;
106  std::map<HcalDetId, std::map<int, float> >::iterator _meee;
107 
108  std::map<HcalCalibDetId, CALIBBUNCH>::iterator _meca;
109 
110  //const CastorPedestal* pedCan;
111  int evt;
112  int sample;
113  int evt_curr;
114  std::vector<bool> state;
115 };
116 
117 #endif
std::map< HcalDetId, std::map< int, LEDBUNCH > >::iterator _meol
~CastorLedAnalysis()
Destructor.
std::ofstream m_logFile
std::vector< bool > state
void LedSetup(const std::string &m_outputFileROOT)
const CastorQIEShape * m_shape
void LedTrendings(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
std::ofstream m_outFile
void GetLedConst(std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
std::map< HcalCalibDetId, CALIBBUNCH >::iterator _meca
struct CastorLedAnalysis::@43 castorHists
CastorLedAnalysis(const edm::ParameterSet &ps)
Constructor.
std::string m_outputFileText
std::map< HcalDetId, std::map< int, float > >::iterator _meee
void LedCastorHists(const HcalDetId &detid, const CastorDataFrame &ledDigi, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT, const CastorDbService &cond)
std::map< HcalDetId, std::map< int, float > > m_AllPedVals
std::string m_outputFileX
float BinsizeCorr(float time)
const CastorPedestal * m_ped
std::ofstream m_outputFileXML
void SetupLEDHists(int id, const HcalDetId detid, std::map< HcalDetId, std::map< int, LEDBUNCH > > &toolT)
std::string m_outputFileROOT
void processLedEvent(const CastorDigiCollection &castor, const CastorDbService &cond)
const CastorQIECoder * m_coder
std::map< HcalDetId, std::map< int, LEDBUNCH > > LEDTRENDS
std::pair< TH1F *, std::pair< std::map< int, std::vector< double > >, std::vector< TH1F * > > > LEDBUNCH