CMS 3D CMS Logo

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