CMS 3D CMS Logo

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