CMS 3D CMS Logo

HcalPedestalAnalysis.h
Go to the documentation of this file.
1 #ifndef HcalPedestalAnalysis_H
2 #define HcalPedestalAnalysis_H
3 
13 
15 
16 #include "TH1F.h"
17 #include "TF1.h"
18 
19 #include <memory>
20 //#include <iostream>
21 #include <fstream>
22 #include <vector>
23 #include <string>
24 
25 // User switches for HcalPedestalAnalysis to set in cfg are:
26 // nevtsample - number of events per sample in which data will be divided
27 // for stability checks (default: 0 = do not use),
28 // hiSaveflag - flag to save histos of charge per cap-id (default: 0),
29 // pedValflag - pedestal validation flag:
30 // 0 - write out current raw constants (default)
31 // 1 - write out validated constants
32 
33 class HcalDbService;
34 class TFile;
35 
37 public:
42 
43  void setup(const std::string& m_outputFileROOT);
44 
45  void SampleAnalysis();
46 
47  void setTopology(const HcalTopology* htopo) { fTopology = htopo; }
48 
49  int done(const HcalPedestals* fInputPedestals,
50  const HcalPedestalWidths* fInputWidths,
51  HcalPedestals* fOutputPedestals,
52  HcalPedestalWidths* fOutputWidths);
53 
55  const HODigiCollection& ho,
56  const HFDigiCollection& hf,
57  const HcalDbService& cond);
58 
59  // pedestal validation: HcalPedVal=-1 means not validated,
60  // 0 everything OK,
61  // N>0 : mod(N,100000) drifts + width changes
62  // int(N/100000) missing channels
63  static int HcalPedVal(int nstat[4],
70 
71 protected:
72 private:
73  //###
74  //# PEDBUNCH is used in map<HcalDetId,map<int, PEDBUNCH > > PEDTRENDS;
75  //# For each HcalDetId (channel) a map<int, PEDBUNCH> is associated;
76  //# int is cap-id (1-4);
77  //# PEDBUNCH is a pair - first element is the main
78  //# histo with the pedestal distribution and second one is another pair;
79  //# this pair contains map<int, std::vector<double> > as a first element;
80  //# int is cap-id, and vector contains some useful variables;
81  //# the second element is a vector of histos (pointers);
82  //# for the "trend" analysis the main histo (with pedestals) is reset every
83  //# nevt_ped events and info is put in the other part of the PEDBUNCH;
84  //# so at the end we have the trends for the variables in concern
85  //# which are written in THE vector<TH1F*>;
86  //###
87  typedef std::pair<TH1F*, std::pair<std::map<int, std::vector<double> >, std::vector<TH1F*> > > PEDBUNCH;
88 
89  void per2CapsHists(int flag,
90  int id,
91  const HcalDetId detid,
92  const HcalQIESample& qie1,
93  const HcalQIESample& qie2,
94  std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT,
95  const HcalDbService& cond);
96 
97  void GetPedConst(std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT, TH1F* PedMeans, TH1F* PedWidths);
98 
99  void Trendings(std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT, TH1F* Chi2, TH1F* CapidAverage, TH1F* CapidChi2);
100 
101  void AllChanHists(const HcalDetId detid,
102  const HcalQIESample& qie0,
103  const HcalQIESample& qie1,
104  const HcalQIESample& qie2,
105  const HcalQIESample& qie3,
106  const HcalQIESample& qie4,
107  const HcalQIESample& qie5,
108  std::map<HcalDetId, std::map<int, PEDBUNCH> >& toolT);
109 
110  TFile* m_file;
111 
115  std::ofstream m_logFile;
117  int m_endTS;
123 
126  struct {
127  std::map<HcalDetId, std::map<int, PEDBUNCH> > PEDTRENDS;
128  TH1F* ALLPEDS;
129  TH1F* PEDRMS;
130  TH1F* PEDMEAN;
131  TH1F* CHI2;
133  TH1F* CAPID_CHI2;
134  } hbHists, hfHists, hoHists;
135  std::map<HcalDetId, std::map<int, PEDBUNCH> >::iterator _meot;
142  int evt;
143  int sample;
144  int evt_curr;
145  float m_stat[4];
146  std::vector<bool> state;
148  // flag to make gaussian fits to charge dists
149  static const int fitflag = 0;
150 };
151 
152 #endif
HcalPedestalAnalysis::m_nevtsample
int m_nevtsample
Definition: HcalPedestalAnalysis.h:118
HcalPedestalAnalysis::m_pedValflag
int m_pedValflag
Definition: HcalPedestalAnalysis.h:121
HcalPedestalAnalysis::m_file
TFile * m_file
Definition: HcalPedestalAnalysis.h:110
HcalPedestalAnalysis::CAPID_AVERAGE
TH1F * CAPID_AVERAGE
Definition: HcalPedestalAnalysis.h:132
HcalPedestalAnalysis::processEvent
void processEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalDbService &cond)
Definition: HcalPedestalAnalysis.cc:131
ESHandle.h
HcalPedestalAnalysis::m_outputFileMean
std::string m_outputFileMean
Definition: HcalPedestalAnalysis.h:113
HcalPedestalAnalysis::PEDTRENDS
std::map< HcalDetId, std::map< int, PEDBUNCH > > PEDTRENDS
Definition: HcalPedestalAnalysis.h:127
HcalPedestalAnalysis::m_stat
float m_stat[4]
Definition: HcalPedestalAnalysis.h:145
AllObjects.h
HcalTopology
Definition: HcalTopology.h:26
HcalPedestalAnalysis::hoHists
struct HcalPedestalAnalysis::@57 hoHists
HcalPedestalAnalysis::evt
int evt
Definition: HcalPedestalAnalysis.h:142
HcalPedestalAnalysis::setup
void setup(const std::string &m_outputFileROOT)
Definition: HcalPedestalAnalysis.cc:119
HcalPedestalAnalysis::m_outputFileWidth
std::string m_outputFileWidth
Definition: HcalPedestalAnalysis.h:114
edm::SortedCollection
Definition: SortedCollection.h:49
EDAnalyzer.h
HcalPedestalAnalysis::GetPedConst
void GetPedConst(std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, TH1F *PedMeans, TH1F *PedWidths)
Definition: HcalPedestalAnalysis.cc:433
HcalQIESample
Definition: HcalQIESample.h:32
HcalPedestalAnalysis::fRefPedestals
const HcalPedestals * fRefPedestals
Definition: HcalPedestalAnalysis.h:136
Chi2
Definition: Chi2.h:15
HcalPedestalWidths
Definition: HcalPedestalWidths.h:17
HcalPedestals
Definition: HcalPedestals.h:20
MakerMacros.h
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
Service.h
HcalDigiCollections.h
HcalPedestalAnalysis::setTopology
void setTopology(const HcalTopology *htopo)
Definition: HcalPedestalAnalysis.h:47
HcalPedestalAnalysis::sample
int sample
Definition: HcalPedestalAnalysis.h:143
HcalPedestalAnalysis::per2CapsHists
void per2CapsHists(int flag, int id, const HcalDetId detid, const HcalQIESample &qie1, const HcalQIESample &qie2, std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, const HcalDbService &cond)
Definition: HcalPedestalAnalysis.cc:243
HcalPedestalAnalysis::AllChanHists
void AllChanHists(const HcalDetId detid, const HcalQIESample &qie0, const HcalQIESample &qie1, const HcalQIESample &qie2, const HcalQIESample &qie3, const HcalQIESample &qie4, const HcalQIESample &qie5, std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT)
Definition: HcalPedestalAnalysis.cc:392
HcalPedestalAnalysis::CHI2
TH1F * CHI2
Definition: HcalPedestalAnalysis.h:131
HcalPedestalAnalysis::Trendings
void Trendings(std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, TH1F *Chi2, TH1F *CapidAverage, TH1F *CapidChi2)
Definition: HcalPedestalAnalysis.cc:686
HcalPedestalAnalysis::m_AllPedsOK
int m_AllPedsOK
Definition: HcalPedestalAnalysis.h:122
HcalPedestalAnalysis::fRefPedestalWidths
const HcalPedestalWidths * fRefPedestalWidths
Definition: HcalPedestalAnalysis.h:137
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
HcalPedestalAnalysis::m_coder
const HcalQIECoder * m_coder
Definition: HcalPedestalAnalysis.h:125
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
HcalPedestalAnalysis::PEDMEAN
TH1F * PEDMEAN
Definition: HcalPedestalAnalysis.h:130
HcalPedestalAnalysis::m_endTS
int m_endTS
Definition: HcalPedestalAnalysis.h:117
HcalDetId.h
HcalPedestalAnalysis::_meot
std::map< HcalDetId, std::map< int, PEDBUNCH > >::iterator _meot
Definition: HcalPedestalAnalysis.h:135
HcalPedestalAnalysis::HcalPedestalAnalysis
HcalPedestalAnalysis(const edm::ParameterSet &ps)
Constructor.
Definition: HcalPedestalAnalysis.cc:16
HcalPedestalAnalysis::state
std::vector< bool > state
Definition: HcalPedestalAnalysis.h:146
HcalPedestalAnalysis::PEDRMS
TH1F * PEDRMS
Definition: HcalPedestalAnalysis.h:129
HcalDetId
Definition: HcalDetId.h:12
HcalPedestalAnalysis::m_pedsinADC
int m_pedsinADC
Definition: HcalPedestalAnalysis.h:119
photonIsolationHIProducer_cfi.ho
ho
Definition: photonIsolationHIProducer_cfi.py:10
HcalPedestalAnalysis::m_startTS
int m_startTS
Definition: HcalPedestalAnalysis.h:116
HcalPedestalAnalysis::fitflag
static const int fitflag
Definition: HcalPedestalAnalysis.h:149
HcalPedestalAnalysis::m_hiSaveflag
int m_hiSaveflag
Definition: HcalPedestalAnalysis.h:120
HcalPedestalAnalysis::ALLPEDS
TH1F * ALLPEDS
Definition: HcalPedestalAnalysis.h:128
HcalQIECoder
Definition: HcalQIECoder.h:20
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
HcalPedestalAnalysis::~HcalPedestalAnalysis
~HcalPedestalAnalysis()
Destructor.
Definition: HcalPedestalAnalysis.cc:89
HcalPedestalAnalysis::CAPID_CHI2
TH1F * CAPID_CHI2
Definition: HcalPedestalAnalysis.h:133
HcalPedestalAnalysis::fValPedestals
HcalPedestals * fValPedestals
Definition: HcalPedestalAnalysis.h:140
HcalPedestalAnalysis
Definition: HcalPedestalAnalysis.h:36
HcalDbService
Definition: HcalDbService.h:26
HcalPedestalAnalysis::HcalPedVal
static int HcalPedVal(int nstat[4], const HcalPedestals *fRefPedestals, const HcalPedestalWidths *fRefPedestalWidths, HcalPedestals *fRawPedestals, HcalPedestalWidths *fRawPedestalWidths, HcalPedestals *fValPedestals, HcalPedestalWidths *fValPedestalWidths)
Definition: HcalPedestalAnalysis.cc:846
Frameworkfwd.h
HcalPedestalAnalysis::m_logFile
std::ofstream m_logFile
Definition: HcalPedestalAnalysis.h:115
HcalPedestalAnalysis::hfHists
struct HcalPedestalAnalysis::@57 hfHists
HcalPedestalAnalysis::hbHists
struct HcalPedestalAnalysis::@57 hbHists
HcalPedestalAnalysis::m_outputFileROOT
std::string m_outputFileROOT
Definition: HcalPedestalAnalysis.h:112
HcalQIEShape
Definition: HcalQIEShape.h:17
HcalPedestalAnalysis::fValPedestalWidths
HcalPedestalWidths * fValPedestalWidths
Definition: HcalPedestalAnalysis.h:141
HcalPedestalAnalysis::fTopology
const HcalTopology * fTopology
Definition: HcalPedestalAnalysis.h:147
genParticles_cff.map
map
Definition: genParticles_cff.py:11
HcalPedestalAnalysis::evt_curr
int evt_curr
Definition: HcalPedestalAnalysis.h:144
ParameterSet.h
HcalPedestalAnalysis::m_shape
const HcalQIEShape * m_shape
Definition: HcalPedestalAnalysis.h:124
HcalPedestalAnalysis::fRawPedestalWidths
HcalPedestalWidths * fRawPedestalWidths
Definition: HcalPedestalAnalysis.h:139
HcalPedestalAnalysis::PEDBUNCH
std::pair< TH1F *, std::pair< std::map< int, std::vector< double > >, std::vector< TH1F * > > > PEDBUNCH
Definition: HcalPedestalAnalysis.h:87
HcalPedestalAnalysis::fRawPedestals
HcalPedestals * fRawPedestals
Definition: HcalPedestalAnalysis.h:138
HcalPedestalAnalysis::done
int done(const HcalPedestals *fInputPedestals, const HcalPedestalWidths *fInputWidths, HcalPedestals *fOutputPedestals, HcalPedestalWidths *fOutputWidths)
Definition: HcalPedestalAnalysis.cc:591
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
HcalPedestalAnalysis::SampleAnalysis
void SampleAnalysis()
Definition: HcalPedestalAnalysis.cc:410