12 : castorDigiCollectionTag(ps.getParameter<
edm::
InputTag>(
"castorDigiCollectionTag")) {
28 std::cout <<
"Calculating Pedestal constants...\n";
29 std::vector<NewPedBunch>::iterator bunch_it;
30 for (bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); ++bunch_it) {
31 if (bunch_it->usedflag) {
33 std::cout <<
"Analyzing channel sector= " << bunch_it->detid.sector()
34 <<
" module = " << bunch_it->detid.module() << std::endl;
36 bunch_it->cap[0] /= bunch_it->num[0][0];
37 bunch_it->cap[1] /= bunch_it->num[1][1];
38 bunch_it->cap[2] /= bunch_it->num[2][2];
39 bunch_it->cap[3] /= bunch_it->num[3][3];
40 bunch_it->capfc[0] /= bunch_it->num[0][0];
41 bunch_it->capfc[1] /= bunch_it->num[1][1];
42 bunch_it->capfc[2] /= bunch_it->num[2][2];
43 bunch_it->capfc[3] /= bunch_it->num[3][3];
45 bunch_it->sig[0][0] = (bunch_it->prod[0][0] / bunch_it->num[0][0]) - (bunch_it->cap[0] * bunch_it->cap[0]);
46 bunch_it->sig[0][1] = (bunch_it->prod[0][1] / bunch_it->num[0][1]) - (bunch_it->cap[0] * bunch_it->cap[1]);
47 bunch_it->sig[0][2] = (bunch_it->prod[0][2] / bunch_it->num[0][2]) - (bunch_it->cap[0] * bunch_it->cap[2]);
48 bunch_it->sig[0][3] = (bunch_it->prod[0][3] / bunch_it->num[0][3]) - (bunch_it->cap[0] * bunch_it->cap[3]);
49 bunch_it->sig[1][0] = (bunch_it->prod[1][0] / bunch_it->num[1][0]) - (bunch_it->cap[1] * bunch_it->cap[0]);
50 bunch_it->sig[1][1] = (bunch_it->prod[1][1] / bunch_it->num[1][1]) - (bunch_it->cap[1] * bunch_it->cap[1]);
51 bunch_it->sig[1][2] = (bunch_it->prod[1][2] / bunch_it->num[1][2]) - (bunch_it->cap[1] * bunch_it->cap[2]);
52 bunch_it->sig[1][3] = (bunch_it->prod[1][3] / bunch_it->num[1][3]) - (bunch_it->cap[1] * bunch_it->cap[3]);
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[2][2] = (bunch_it->prod[2][2] / bunch_it->num[2][2]) - (bunch_it->cap[2] * bunch_it->cap[2]);
56 bunch_it->sig[2][3] = (bunch_it->prod[2][3] / bunch_it->num[2][3]) - (bunch_it->cap[2] * bunch_it->cap[3]);
57 bunch_it->sig[3][0] = (bunch_it->prod[3][0] / bunch_it->num[3][0]) - (bunch_it->cap[3] * bunch_it->cap[0]);
58 bunch_it->sig[3][1] = (bunch_it->prod[3][1] / bunch_it->num[3][1]) - (bunch_it->cap[3] * bunch_it->cap[1]);
59 bunch_it->sig[3][2] = (bunch_it->prod[3][2] / bunch_it->num[3][2]) - (bunch_it->cap[3] * bunch_it->cap[2]);
60 bunch_it->sig[3][3] = (bunch_it->prod[3][3] / bunch_it->num[3][3]) - (bunch_it->cap[3] * bunch_it->cap[3]);
62 bunch_it->sigfc[0][0] =
63 (bunch_it->prodfc[0][0] / bunch_it->num[0][0]) - (bunch_it->capfc[0] * bunch_it->capfc[0]);
64 bunch_it->sigfc[0][1] =
65 (bunch_it->prodfc[0][1] / bunch_it->num[0][1]) - (bunch_it->capfc[0] * bunch_it->capfc[1]);
66 bunch_it->sigfc[0][2] =
67 (bunch_it->prodfc[0][2] / bunch_it->num[0][2]) - (bunch_it->capfc[0] * bunch_it->capfc[2]);
68 bunch_it->sigfc[0][3] =
69 (bunch_it->prodfc[0][3] / bunch_it->num[0][3]) - (bunch_it->capfc[0] * bunch_it->capfc[3]);
70 bunch_it->sigfc[1][0] =
71 (bunch_it->prodfc[1][0] / bunch_it->num[1][0]) - (bunch_it->capfc[1] * bunch_it->capfc[0]);
72 bunch_it->sigfc[1][1] =
73 (bunch_it->prodfc[1][1] / bunch_it->num[1][1]) - (bunch_it->capfc[1] * bunch_it->capfc[1]);
74 bunch_it->sigfc[1][2] =
75 (bunch_it->prodfc[1][2] / bunch_it->num[1][2]) - (bunch_it->capfc[1] * bunch_it->capfc[2]);
76 bunch_it->sigfc[1][3] =
77 (bunch_it->prodfc[1][3] / bunch_it->num[1][3]) - (bunch_it->capfc[1] * bunch_it->capfc[3]);
78 bunch_it->sigfc[2][0] =
79 (bunch_it->prodfc[2][0] / bunch_it->num[2][0]) - (bunch_it->capfc[2] * bunch_it->capfc[0]);
80 bunch_it->sigfc[2][1] =
81 (bunch_it->prodfc[2][1] / bunch_it->num[2][1]) - (bunch_it->capfc[2] * bunch_it->capfc[1]);
82 bunch_it->sigfc[2][2] =
83 (bunch_it->prodfc[2][2] / bunch_it->num[2][2]) - (bunch_it->capfc[2] * bunch_it->capfc[2]);
84 bunch_it->sigfc[2][3] =
85 (bunch_it->prodfc[2][3] / bunch_it->num[2][3]) - (bunch_it->capfc[2] * bunch_it->capfc[3]);
86 bunch_it->sigfc[3][0] =
87 (bunch_it->prodfc[3][0] / bunch_it->num[3][0]) - (bunch_it->capfc[3] * bunch_it->capfc[0]);
88 bunch_it->sigfc[3][1] =
89 (bunch_it->prodfc[3][1] / bunch_it->num[3][1]) - (bunch_it->capfc[3] * bunch_it->capfc[1]);
90 bunch_it->sigfc[3][2] =
91 (bunch_it->prodfc[3][2] / bunch_it->num[3][2]) - (bunch_it->capfc[3] * bunch_it->capfc[2]);
92 bunch_it->sigfc[3][3] =
93 (bunch_it->prodfc[3][3] / bunch_it->num[3][3]) - (bunch_it->capfc[3] * bunch_it->capfc[3]);
95 for (
int i = 0;
i != 3;
i++) {
102 int fillphi = bunch_it->detid.sector();
107 dephist->Fill(bunch_it->detid.module(),
109 (bunch_it->cap[0] + bunch_it->cap[1] + bunch_it->cap[2] + bunch_it->cap[3]) / 4);
119 bunch_it->sig[3][3]);
122 widthsp.
setSigma(0, 0, bunch_it->sig[0][0]);
123 widthsp.
setSigma(0, 1, bunch_it->sig[0][1]);
124 widthsp.
setSigma(0, 2, bunch_it->sig[0][2]);
125 widthsp.
setSigma(0, 3, bunch_it->sig[0][3]);
126 widthsp.
setSigma(1, 0, bunch_it->sig[1][0]);
127 widthsp.
setSigma(1, 1, bunch_it->sig[1][1]);
128 widthsp.
setSigma(1, 2, bunch_it->sig[1][2]);
129 widthsp.
setSigma(1, 3, bunch_it->sig[1][3]);
130 widthsp.
setSigma(2, 0, bunch_it->sig[2][0]);
131 widthsp.
setSigma(2, 1, bunch_it->sig[2][1]);
132 widthsp.
setSigma(2, 2, bunch_it->sig[2][2]);
133 widthsp.
setSigma(2, 3, bunch_it->sig[2][3]);
134 widthsp.
setSigma(3, 0, bunch_it->sig[3][0]);
135 widthsp.
setSigma(3, 1, bunch_it->sig[3][1]);
136 widthsp.
setSigma(3, 2, bunch_it->sig[3][2]);
137 widthsp.
setSigma(3, 3, bunch_it->sig[3][3]);
145 bunch_it->sigfc[0][0],
146 bunch_it->sigfc[1][1],
147 bunch_it->sigfc[2][2],
148 bunch_it->sigfc[3][3]);
151 widthspfc.
setSigma(0, 0, bunch_it->sigfc[0][0]);
152 widthspfc.
setSigma(0, 1, bunch_it->sigfc[0][1]);
153 widthspfc.
setSigma(0, 2, bunch_it->sigfc[0][2]);
154 widthspfc.
setSigma(0, 3, bunch_it->sigfc[0][3]);
155 widthspfc.
setSigma(1, 0, bunch_it->sigfc[1][0]);
156 widthspfc.
setSigma(1, 1, bunch_it->sigfc[1][1]);
157 widthspfc.
setSigma(1, 2, bunch_it->sigfc[1][2]);
158 widthspfc.
setSigma(1, 3, bunch_it->sigfc[1][3]);
159 widthspfc.
setSigma(2, 0, bunch_it->sigfc[2][0]);
160 widthspfc.
setSigma(2, 1, bunch_it->sigfc[2][1]);
161 widthspfc.
setSigma(2, 2, bunch_it->sigfc[2][2]);
162 widthspfc.
setSigma(2, 3, bunch_it->sigfc[2][3]);
163 widthspfc.
setSigma(3, 0, bunch_it->sigfc[3][0]);
164 widthspfc.
setSigma(3, 1, bunch_it->sigfc[3][1]);
165 widthspfc.
setSigma(3, 2, bunch_it->sigfc[3][2]);
166 widthspfc.
setSigma(3, 3, bunch_it->sigfc[3][3]);
197 dephist->SetDrawOption(
"colz");
198 dephist->GetXaxis()->SetTitle(
"module");
199 dephist->GetYaxis()->SetTitle(
"sector");
209 std::stringstream tempstringout;
211 std::string name1 = tempstringout.str() +
"_pedplots_1d.png";
214 TStyle* theStyle =
new TStyle(
"style",
"null");
215 theStyle->SetPalette(1,
nullptr);
216 theStyle->SetCanvasDefH(1200);
217 theStyle->SetCanvasDefW(1600);
267 std::stringstream tempstringout;
269 runnum_string = tempstringout.str();
275 XMLfilename = runnum_string +
"-peds_ADC_complete.xml";
276 XMLtag =
"Castor_pedestals_" + runnum_string;
284 CASTORMeans =
new TH1F(
"All Ped Means CASTOR",
"All Ped Means CASTOR", 100, 0, 9);
285 CASTORWidths =
new TH1F(
"All Ped Widths CASTOR",
"All Ped Widths CASTOR", 100, 0, 3);
287 dephist =
new TH2F(
"Pedestals (ADC)",
"All Castor", 14, 0., 14.5, 16, .5, 16.5);
296 std::vector<HcalGenericDetId> listEMap = myRefEMap->
allPrecisionId();
297 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); ++it) {
299 if (mygenid.isHcalCastorDetId()) {
306 for (
int i = 0;
i != 4;
i++) {
309 for (
int j = 0;
j != 4;
j++) {
323 std::vector<NewPedBunch>::iterator bunch_it;
327 for (bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); ++bunch_it)
328 if (bunch_it->detid.rawId() == digi.
id().
rawId())
330 bunch_it->usedflag =
true;
336 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
340 if ((ts + 1 < digi.
size()) && (ts + 1 <
lastTS)) {
347 if ((ts + 2 < digi.
size()) && (ts + 2 <
lastTS)) {
354 if ((ts + 3 < digi.
size()) && (ts + 3 <
lastTS)) {