CMS 3D CMS Logo

CastorLedAnalysis.h
Go to the documentation of this file.
1 #ifndef CastorLedAnalysis_H
2 #define CastorLedAnalysis_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 CastorPedestal;
25 class CastorDbService;
26 class CastorQIEShape;
27 class CastorQIECoder;
28 class TFile;
29 
31 public:
37  //void doPeds(const CastorPedestals* fInputPedestals);
38  void LedSampleAnalysis();
39  void LedDone();
41 
42 protected:
43 private:
44  //###
45  //# LEDBUNCH is used in map<HcalDetId,map<int, LEDBUNCH > > LEDTRENDS;
46  //# For each HcalDetId (channel) a map<int, LEDBUNCH> is associated;
47  //# int was originally cap-id and now is just dummy;
48  //# LEDBUNCH is a pair - first element is the main
49  //# histo with the ADC values and second one is another pair;
50  //# this pair contains map<int, std::vector<double> > as a first element;
51  //# vector contains some useful variables;
52  //# the second element is a vector of histos (pointers);
53  //# for the "trend" analysis the main histo (with ADC values) is reset every
54  //# m_nevtsample events and info is put in the other part of the LEDBUNCH;
55  //# so at the end we have the trends for the variables in concern
56  //# which are written in THE vector<TH1F*>;
57  //###
58  typedef std::pair<TH1F*, std::pair<std::map<int, std::vector<double> >, std::vector<TH1F*> > > LEDBUNCH;
59  typedef struct {
60  TProfile* avePulse[3];
61  TH1F* thisPulse[3];
62  TH1F* integPulse[3];
63  } CALIBBUNCH;
64  TFile* m_file;
65  void LedCastorHists(const HcalDetId& detid,
66  const CastorDataFrame& ledDigi,
67  std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT,
68  const CastorDbService& cond);
69  void SetupLEDHists(int id, const HcalDetId detid, std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
70  void GetLedConst(std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
71  void LedTrendings(std::map<HcalDetId, std::map<int, LEDBUNCH> >& toolT);
72  float BinsizeCorr(float time);
73 
77  std::ofstream m_outFile;
78  std::ofstream m_logFile;
79  std::ofstream m_outputFileXML;
80 
81  int m_startTS;
82  int m_endTS;
85  bool m_usecalib;
86  // analysis flag:
87  // m_fitflag = 0 - take mean TS value of averaged pulse shape
88  // 1 - take peak from landau fit to averaged pulse shape
89  // 2 - take average of mean TS values per event
90  // (preferred for laser & HF LED)
91  // 3 - take average of peaks from landau fits per event
92  // (preferred for LED)
93  // 4 - 0+1+2+3 REMOVED in 1_6
94  int m_fitflag;
95 
99  struct {
100  std::map<HcalDetId, std::map<int, LEDBUNCH> > LEDTRENDS;
101  TH1F* ALLLEDS;
102  TH1F* LEDRMS;
103  TH1F* LEDMEAN;
104  TH1F* CHI2;
105  } castorHists;
106  std::map<HcalDetId, std::map<int, LEDBUNCH> >::iterator _meol;
107  std::map<HcalDetId, std::map<int, float> > m_AllPedVals;
108  std::map<HcalDetId, std::map<int, float> >::iterator _meee;
109 
110  std::map<HcalCalibDetId, CALIBBUNCH>::iterator _meca;
111 
112  //const CastorPedestal* pedCan;
113  int evt;
114  int sample;
115  int evt_curr;
116  std::vector<bool> state;
117 };
118 
119 #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
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)
struct CastorLedAnalysis::@40 castorHists
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
Definition: plugin.cc:23
std::map< HcalDetId, std::map< int, LEDBUNCH > > LEDTRENDS
std::pair< TH1F *, std::pair< std::map< int, std::vector< double > >, std::vector< TH1F * > > > LEDBUNCH