26 std::cout <<
"Calculating Pedestal constants...\n";
27 std::vector<NewPedBunchVal>::iterator bunch_it;
30 if(bunch_it->usedflag){
32 bunch_it->cap[0] /= bunch_it->num[0][0];
33 bunch_it->cap[1] /= bunch_it->num[1][1];
34 bunch_it->cap[2] /= bunch_it->num[2][2];
35 bunch_it->cap[3] /= bunch_it->num[3][3];
36 bunch_it->capfc[0] /= bunch_it->num[0][0];
37 bunch_it->capfc[1] /= bunch_it->num[1][1];
38 bunch_it->capfc[2] /= bunch_it->num[2][2];
39 bunch_it->capfc[3] /= bunch_it->num[3][3];
41 bunch_it->sig[0][0] = (bunch_it->prod[0][0]/bunch_it->num[0][0])-(bunch_it->cap[0])*(bunch_it->cap[0]);
42 bunch_it->sig[1][1] = (bunch_it->prod[1][1]/bunch_it->num[1][1])-(bunch_it->cap[1])*(bunch_it->cap[1]);
43 bunch_it->sig[2][2] = (bunch_it->prod[2][2]/bunch_it->num[2][2])-(bunch_it->cap[2])*(bunch_it->cap[2]);
44 bunch_it->sig[3][3] = (bunch_it->prod[3][3]/bunch_it->num[3][3])-(bunch_it->cap[3])*(bunch_it->cap[3]);
45 bunch_it->sig[0][1] = (bunch_it->prod[0][1])/(bunch_it->num[0][1])-(bunch_it->cap[0]*bunch_it->cap[1]);
46 bunch_it->sig[0][2] = (bunch_it->prod[0][2])/(bunch_it->num[0][2])-(bunch_it->cap[0]*bunch_it->cap[2]);
47 bunch_it->sig[0][3] = (bunch_it->prod[0][3])/(bunch_it->num[0][3])-(bunch_it->cap[0]*bunch_it->cap[3]);
48 bunch_it->sig[1][2] = (bunch_it->prod[1][2])/(bunch_it->num[1][2])-(bunch_it->cap[1]*bunch_it->cap[2]);
49 bunch_it->sig[1][3] = (bunch_it->prod[1][3])/(bunch_it->num[1][3])-(bunch_it->cap[1]*bunch_it->cap[3]);
50 bunch_it->sig[2][3] = (bunch_it->prod[2][3])/(bunch_it->num[2][3])-(bunch_it->cap[2]*bunch_it->cap[3]);
52 bunch_it->sig[1][0] = (bunch_it->prod[1][0]/bunch_it->num[1][0])-(bunch_it->cap[1])*(bunch_it->cap[0]);
53 bunch_it->sig[2][0] = (bunch_it->prod[2][0]/bunch_it->num[2][0])-(bunch_it->cap[2])*(bunch_it->cap[0]);
54 bunch_it->sig[2][1] = (bunch_it->prod[2][1]/bunch_it->num[2][1])-(bunch_it->cap[2])*(bunch_it->cap[1]);
55 bunch_it->sig[3][0] = (bunch_it->prod[3][0]/bunch_it->num[3][0])-(bunch_it->cap[3])*(bunch_it->cap[0]);
56 bunch_it->sig[3][1] = (bunch_it->prod[3][1]/bunch_it->num[3][1])-(bunch_it->cap[3])*(bunch_it->cap[1]);
57 bunch_it->sig[3][2] = (bunch_it->prod[3][2]/bunch_it->num[3][2])-(bunch_it->cap[3])*(bunch_it->cap[2]);
61 bunch_it->sigfc[0][0] = (bunch_it->prodfc[0][0]/bunch_it->num[0][0])-(bunch_it->capfc[0])*(bunch_it->capfc[0]);
62 bunch_it->sigfc[1][1] = (bunch_it->prodfc[1][1]/bunch_it->num[1][1])-(bunch_it->capfc[1])*(bunch_it->capfc[1]);
63 bunch_it->sigfc[2][2] = (bunch_it->prodfc[2][2]/bunch_it->num[2][2])-(bunch_it->capfc[2])*(bunch_it->capfc[2]);
64 bunch_it->sigfc[3][3] = (bunch_it->prodfc[3][3]/bunch_it->num[3][3])-(bunch_it->capfc[3])*(bunch_it->capfc[3]);
65 bunch_it->sigfc[0][1] = (bunch_it->prodfc[0][1]/(bunch_it->num[0][1]))-(bunch_it->capfc[0]*bunch_it->capfc[1]);
66 bunch_it->sigfc[0][2] = (bunch_it->prodfc[0][2]/(bunch_it->num[0][2]))-(bunch_it->capfc[0]*bunch_it->capfc[2]);
67 bunch_it->sigfc[0][3] = (bunch_it->prodfc[0][3]/(bunch_it->num[0][3]))-(bunch_it->capfc[0]*bunch_it->capfc[3]);
68 bunch_it->sigfc[1][2] = (bunch_it->prodfc[1][2]/(bunch_it->num[1][2]))-(bunch_it->capfc[1]*bunch_it->capfc[2]);
69 bunch_it->sigfc[1][3] = (bunch_it->prodfc[1][3]/(bunch_it->num[1][3]))-(bunch_it->capfc[1]*bunch_it->capfc[3]);
70 bunch_it->sigfc[2][3] = (bunch_it->prodfc[2][3]/(bunch_it->num[2][3]))-(bunch_it->capfc[2]*bunch_it->capfc[3]);
72 bunch_it->sigfc[1][0] = (bunch_it->prodfc[1][0]/(bunch_it->num[1][0]))-(bunch_it->capfc[1]*bunch_it->capfc[0]);
73 bunch_it->sigfc[2][0] = (bunch_it->prodfc[2][0]/(bunch_it->num[2][0]))-(bunch_it->capfc[2]*bunch_it->capfc[0]);
74 bunch_it->sigfc[2][1] = (bunch_it->prodfc[2][1]/(bunch_it->num[2][1]))-(bunch_it->capfc[2]*bunch_it->capfc[1]);
75 bunch_it->sigfc[3][0] = (bunch_it->prodfc[3][0]/(bunch_it->num[3][0]))-(bunch_it->capfc[3]*bunch_it->capfc[0]);
76 bunch_it->sigfc[3][1] = (bunch_it->prodfc[3][1]/(bunch_it->num[3][1]))-(bunch_it->capfc[3]*bunch_it->capfc[1]);
77 bunch_it->sigfc[3][2] = (bunch_it->prodfc[3][2]/(bunch_it->num[3][2]))-(bunch_it->capfc[3]*bunch_it->capfc[2]);
79 for(
int i = 0;
i != 4;
i++){
80 for(
int j = 0;
j != 4;
j++){
81 bunch_it->covarhistADC->Fill(
i,
j,bunch_it->sig[
i][
j]);
82 bunch_it->covarhistfC->Fill(
i,j,bunch_it->sigfc[
i][j]);
86 if(bunch_it->detid.subdet() == 1){
88 bunch_it->covarhistADC->Write();
89 bunch_it->covarhistfC->Write();
90 for(
int i = 0;
i != 4;
i++){
91 bunch_it->hist[
i]->Write();
96 if(bunch_it->detid.subdet() == 2){
98 bunch_it->covarhistADC->Write();
99 bunch_it->covarhistfC->Write();
100 for(
int i = 0;
i != 4;
i++){
101 bunch_it->hist[
i]->Write();
106 if(bunch_it->detid.subdet() == 3){
108 bunch_it->covarhistADC->Write();
109 bunch_it->covarhistfC->Write();
110 for(
int i = 0;
i != 4;
i++){
111 bunch_it->hist[
i]->Write();
116 if(bunch_it->detid.subdet() == 4){
118 bunch_it->covarhistADC->Write();
119 bunch_it->covarhistfC->Write();
120 for(
int i = 0;
i != 4;
i++){
121 bunch_it->hist[
i]->Write();
129 const HcalPedestal item(bunch_it->detid, bunch_it->cap[0], bunch_it->cap[1], bunch_it->cap[2], bunch_it->cap[3]);
132 widthsp.
setSigma(0,0,bunch_it->sig[0][0]);
133 widthsp.
setSigma(0,1,bunch_it->sig[0][1]);
134 widthsp.
setSigma(0,2,bunch_it->sig[0][2]);
135 widthsp.
setSigma(0,3,bunch_it->sig[0][3]);
136 widthsp.
setSigma(1,1,bunch_it->sig[1][1]);
137 widthsp.
setSigma(1,2,bunch_it->sig[1][2]);
138 widthsp.
setSigma(1,3,bunch_it->sig[1][3]);
139 widthsp.
setSigma(2,2,bunch_it->sig[2][2]);
140 widthsp.
setSigma(2,3,bunch_it->sig[2][3]);
141 widthsp.
setSigma(3,3,bunch_it->sig[3][3]);
144 const HcalPedestal itemfc(bunch_it->detid, bunch_it->capfc[0], bunch_it->capfc[1],
145 bunch_it->capfc[2], bunch_it->capfc[3]);
148 widthspfc.
setSigma(0,0,bunch_it->sigfc[0][0]);
149 widthspfc.
setSigma(0,1,bunch_it->sigfc[0][1]);
150 widthspfc.
setSigma(0,2,bunch_it->sigfc[0][2]);
151 widthspfc.
setSigma(0,3,bunch_it->sigfc[0][3]);
152 widthspfc.
setSigma(1,1,bunch_it->sigfc[1][1]);
153 widthspfc.
setSigma(1,2,bunch_it->sigfc[1][2]);
154 widthspfc.
setSigma(1,3,bunch_it->sigfc[1][3]);
155 widthspfc.
setSigma(2,2,bunch_it->sigfc[2][2]);
156 widthspfc.
setSigma(2,3,bunch_it->sigfc[2][3]);
157 widthspfc.
setSigma(3,3,bunch_it->sigfc[3][3]);
216 std::string runnum_string;
217 std::stringstream tempstringout;
219 runnum_string = tempstringout.str();
235 HBMeans =
new TH1F(
"All Ped Means HB",
"All Ped Means HB", 100, 0, 9);
236 HBWidths =
new TH1F(
"All Ped Widths HB",
"All Ped Widths HB", 100, 0, 3);
237 HEMeans =
new TH1F(
"All Ped Means HE",
"All Ped Means HE", 100, 0, 9);
238 HEWidths =
new TH1F(
"All Ped Widths HE",
"All Ped Widths HE", 100, 0, 3);
239 HFMeans =
new TH1F(
"All Ped Means HF",
"All Ped Means HF", 100, 0, 9);
240 HFWidths =
new TH1F(
"All Ped Widths HF",
"All Ped Widths HF", 100, 0, 3);
241 HOMeans =
new TH1F(
"All Ped Means HO",
"All Ped Means HO", 100, 0, 9);
242 HOWidths =
new TH1F(
"All Ped Widths HO",
"All Ped Widths HO", 100, 0, 3);
247 std::vector<HcalGenericDetId> listEMap = myRefEMap->
allPrecisionId();
248 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); it++)
251 if(mygenid.isHcalDetId())
257 std::ostringstream s1;
259 std::string histname = s1.str();
260 histname +=
" Covariance Matrix";
261 a.
covarhistADC =
new TH2F(histname.c_str(), histname.c_str(), 4, -.5, 3.5, 4, -.5, 3.5);
265 a.
covarhistfC =
new TH2F(histname.c_str(), histname.c_str(), 4, -.5, 3.5, 4, -.5, 3.5);
268 for(
int i = 0;
i != 4;
i++)
272 std::ostringstream s3;
274 std::string histname = s3.str() +
" Cap ";
275 std::ostringstream s4;
277 histname += s4.str();
278 std::ostringstream s5;
279 s5 << std::hex << (mygenid.rawId()) << std::dec;
280 std::string histnamedetid = s5.str();
281 a.
hist[
i] =
new TH1F(histname.c_str(), histnamedetid.c_str(), 16, -.5, 15.5);
282 for(
int j = 0;
j != 4;
j++)
298 std::vector<NewPedBunchVal>::iterator bunch_it;
304 if(bunch_it->detid.rawId() == digi.
id().
rawId())
break;
305 bunch_it->usedflag =
true;
314 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
318 if(digi.
sample(ts+1).
adc() > 15)
continue;
325 if(digi.
sample(ts+2).
adc() > 15)
continue;
332 if(digi.
sample(ts+3).
adc() > 15)
continue;
345 if(bunch_it->detid.rawId() == digi.
id().
rawId())
break;
346 bunch_it->usedflag =
true;
355 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
359 if(digi.
sample(ts+1).
adc() > 15)
continue;
366 if(digi.
sample(ts+2).
adc() > 15)
continue;
373 if(digi.
sample(ts+3).
adc() > 15)
continue;
386 if(bunch_it->detid.rawId() == digi.
id().
rawId())
break;
387 bunch_it->usedflag =
true;
396 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
400 if(digi.
sample(ts+1).
adc() > 15)
continue;
407 if(digi.
sample(ts+2).
adc() > 15)
continue;
414 if(digi.
sample(ts+3).
adc() > 15)
continue;
std::string widthsADCfilename
T getUntrackedParameter(std::string const &, T const &) const
bool addValues(const Item &myItem, bool h2mode_=false)
HcalPedestalWidths * rawWidthsItem
HcalPedestals * rawPedsItemfc
#define DEFINE_FWK_MODULE(type)
int adc() const
get the ADC sample
int size() const
total number of samples in the digi
std::string pedsADCfilename
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
std::vector< T >::const_iterator const_iterator
bool getByType(Handle< PROD > &result) const
const HcalQIESample & sample(int i) const
access a sample
const HcalDetId & id() const
uint32_t rawId() const
get the raw id
HcalPedestals * rawPedsItem
int size() const
total number of samples in the digi
const HcalQIESample & sample(int i) const
access a sample
std::vector< HcalGenericDetId > allPrecisionId() const
std::string widthsfCfilename
std::vector< NewPedBunchVal > BunchVales
HcalPedestalWidthsValidation(const edm::ParameterSet &ps)
HcalPedestalWidths * rawWidthsItemfc
virtual ~HcalPedestalWidthsValidation()
int size() const
total number of samples in the digi
int capid() const
get the Capacitor id
const HcalQIESample & sample(int i) const
access a sample
T const * product() const
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
const HcalDetId & id() const
std::string pedsfCfilename
const HcalDetId & id() const
void setSigma(int fCapId1, int fCapId2, float fSigma)
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.