CMS 3D CMS Logo

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