CMS 3D CMS Logo

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