12 : castorDigiCollectionTag(ps.getParameter<
edm::
InputTag>(
"castorDigiCollectionTag")) {
20 tok_cond_ = esConsumes<CastorDbService, CastorDbRecord>();
21 tok_map_ = esConsumes<CastorElectronicsMap, CastorElectronicsMapRcd>();
31 std::cout <<
"Calculating Pedestal constants...\n";
32 std::vector<NewPedBunch>::iterator bunch_it;
33 for (bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); ++bunch_it) {
34 if (bunch_it->usedflag) {
36 std::cout <<
"Analyzing channel sector= " << bunch_it->detid.sector()
37 <<
" module = " << bunch_it->detid.module() << std::endl;
39 bunch_it->cap[0] /= bunch_it->num[0][0];
40 bunch_it->cap[1] /= bunch_it->num[1][1];
41 bunch_it->cap[2] /= bunch_it->num[2][2];
42 bunch_it->cap[3] /= bunch_it->num[3][3];
43 bunch_it->capfc[0] /= bunch_it->num[0][0];
44 bunch_it->capfc[1] /= bunch_it->num[1][1];
45 bunch_it->capfc[2] /= bunch_it->num[2][2];
46 bunch_it->capfc[3] /= bunch_it->num[3][3];
48 bunch_it->sig[0][0] = (bunch_it->prod[0][0] / bunch_it->num[0][0]) - (bunch_it->cap[0] * bunch_it->cap[0]);
49 bunch_it->sig[0][1] = (bunch_it->prod[0][1] / bunch_it->num[0][1]) - (bunch_it->cap[0] * bunch_it->cap[1]);
50 bunch_it->sig[0][2] = (bunch_it->prod[0][2] / bunch_it->num[0][2]) - (bunch_it->cap[0] * bunch_it->cap[2]);
51 bunch_it->sig[0][3] = (bunch_it->prod[0][3] / bunch_it->num[0][3]) - (bunch_it->cap[0] * 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[1][1] = (bunch_it->prod[1][1] / bunch_it->num[1][1]) - (bunch_it->cap[1] * bunch_it->cap[1]);
54 bunch_it->sig[1][2] = (bunch_it->prod[1][2] / bunch_it->num[1][2]) - (bunch_it->cap[1] * bunch_it->cap[2]);
55 bunch_it->sig[1][3] = (bunch_it->prod[1][3] / bunch_it->num[1][3]) - (bunch_it->cap[1] * bunch_it->cap[3]);
56 bunch_it->sig[2][0] = (bunch_it->prod[2][0] / bunch_it->num[2][0]) - (bunch_it->cap[2] * bunch_it->cap[0]);
57 bunch_it->sig[2][1] = (bunch_it->prod[2][1] / bunch_it->num[2][1]) - (bunch_it->cap[2] * bunch_it->cap[1]);
58 bunch_it->sig[2][2] = (bunch_it->prod[2][2] / bunch_it->num[2][2]) - (bunch_it->cap[2] * bunch_it->cap[2]);
59 bunch_it->sig[2][3] = (bunch_it->prod[2][3] / bunch_it->num[2][3]) - (bunch_it->cap[2] * bunch_it->cap[3]);
60 bunch_it->sig[3][0] = (bunch_it->prod[3][0] / bunch_it->num[3][0]) - (bunch_it->cap[3] * bunch_it->cap[0]);
61 bunch_it->sig[3][1] = (bunch_it->prod[3][1] / bunch_it->num[3][1]) - (bunch_it->cap[3] * bunch_it->cap[1]);
62 bunch_it->sig[3][2] = (bunch_it->prod[3][2] / bunch_it->num[3][2]) - (bunch_it->cap[3] * bunch_it->cap[2]);
63 bunch_it->sig[3][3] = (bunch_it->prod[3][3] / bunch_it->num[3][3]) - (bunch_it->cap[3] * bunch_it->cap[3]);
65 bunch_it->sigfc[0][0] =
66 (bunch_it->prodfc[0][0] / bunch_it->num[0][0]) - (bunch_it->capfc[0] * bunch_it->capfc[0]);
67 bunch_it->sigfc[0][1] =
68 (bunch_it->prodfc[0][1] / bunch_it->num[0][1]) - (bunch_it->capfc[0] * bunch_it->capfc[1]);
69 bunch_it->sigfc[0][2] =
70 (bunch_it->prodfc[0][2] / bunch_it->num[0][2]) - (bunch_it->capfc[0] * bunch_it->capfc[2]);
71 bunch_it->sigfc[0][3] =
72 (bunch_it->prodfc[0][3] / bunch_it->num[0][3]) - (bunch_it->capfc[0] * bunch_it->capfc[3]);
73 bunch_it->sigfc[1][0] =
74 (bunch_it->prodfc[1][0] / bunch_it->num[1][0]) - (bunch_it->capfc[1] * bunch_it->capfc[0]);
75 bunch_it->sigfc[1][1] =
76 (bunch_it->prodfc[1][1] / bunch_it->num[1][1]) - (bunch_it->capfc[1] * bunch_it->capfc[1]);
77 bunch_it->sigfc[1][2] =
78 (bunch_it->prodfc[1][2] / bunch_it->num[1][2]) - (bunch_it->capfc[1] * bunch_it->capfc[2]);
79 bunch_it->sigfc[1][3] =
80 (bunch_it->prodfc[1][3] / bunch_it->num[1][3]) - (bunch_it->capfc[1] * bunch_it->capfc[3]);
81 bunch_it->sigfc[2][0] =
82 (bunch_it->prodfc[2][0] / bunch_it->num[2][0]) - (bunch_it->capfc[2] * bunch_it->capfc[0]);
83 bunch_it->sigfc[2][1] =
84 (bunch_it->prodfc[2][1] / bunch_it->num[2][1]) - (bunch_it->capfc[2] * bunch_it->capfc[1]);
85 bunch_it->sigfc[2][2] =
86 (bunch_it->prodfc[2][2] / bunch_it->num[2][2]) - (bunch_it->capfc[2] * bunch_it->capfc[2]);
87 bunch_it->sigfc[2][3] =
88 (bunch_it->prodfc[2][3] / bunch_it->num[2][3]) - (bunch_it->capfc[2] * bunch_it->capfc[3]);
89 bunch_it->sigfc[3][0] =
90 (bunch_it->prodfc[3][0] / bunch_it->num[3][0]) - (bunch_it->capfc[3] * bunch_it->capfc[0]);
91 bunch_it->sigfc[3][1] =
92 (bunch_it->prodfc[3][1] / bunch_it->num[3][1]) - (bunch_it->capfc[3] * bunch_it->capfc[1]);
93 bunch_it->sigfc[3][2] =
94 (bunch_it->prodfc[3][2] / bunch_it->num[3][2]) - (bunch_it->capfc[3] * bunch_it->capfc[2]);
95 bunch_it->sigfc[3][3] =
96 (bunch_it->prodfc[3][3] / bunch_it->num[3][3]) - (bunch_it->capfc[3] * bunch_it->capfc[3]);
98 for (
int i = 0;
i != 3;
i++) {
105 int fillphi = bunch_it->detid.sector();
110 dephist->Fill(bunch_it->detid.module(),
112 (bunch_it->cap[0] + bunch_it->cap[1] + bunch_it->cap[2] + bunch_it->cap[3]) / 4);
122 bunch_it->sig[3][3]);
125 widthsp.
setSigma(0, 0, bunch_it->sig[0][0]);
126 widthsp.
setSigma(0, 1, bunch_it->sig[0][1]);
127 widthsp.
setSigma(0, 2, bunch_it->sig[0][2]);
128 widthsp.
setSigma(0, 3, bunch_it->sig[0][3]);
129 widthsp.
setSigma(1, 0, bunch_it->sig[1][0]);
130 widthsp.
setSigma(1, 1, bunch_it->sig[1][1]);
131 widthsp.
setSigma(1, 2, bunch_it->sig[1][2]);
132 widthsp.
setSigma(1, 3, bunch_it->sig[1][3]);
133 widthsp.
setSigma(2, 0, bunch_it->sig[2][0]);
134 widthsp.
setSigma(2, 1, bunch_it->sig[2][1]);
135 widthsp.
setSigma(2, 2, bunch_it->sig[2][2]);
136 widthsp.
setSigma(2, 3, bunch_it->sig[2][3]);
137 widthsp.
setSigma(3, 0, bunch_it->sig[3][0]);
138 widthsp.
setSigma(3, 1, bunch_it->sig[3][1]);
139 widthsp.
setSigma(3, 2, bunch_it->sig[3][2]);
140 widthsp.
setSigma(3, 3, bunch_it->sig[3][3]);
148 bunch_it->sigfc[0][0],
149 bunch_it->sigfc[1][1],
150 bunch_it->sigfc[2][2],
151 bunch_it->sigfc[3][3]);
154 widthspfc.
setSigma(0, 0, bunch_it->sigfc[0][0]);
155 widthspfc.
setSigma(0, 1, bunch_it->sigfc[0][1]);
156 widthspfc.
setSigma(0, 2, bunch_it->sigfc[0][2]);
157 widthspfc.
setSigma(0, 3, bunch_it->sigfc[0][3]);
158 widthspfc.
setSigma(1, 0, bunch_it->sigfc[1][0]);
159 widthspfc.
setSigma(1, 1, bunch_it->sigfc[1][1]);
160 widthspfc.
setSigma(1, 2, bunch_it->sigfc[1][2]);
161 widthspfc.
setSigma(1, 3, bunch_it->sigfc[1][3]);
162 widthspfc.
setSigma(2, 0, bunch_it->sigfc[2][0]);
163 widthspfc.
setSigma(2, 1, bunch_it->sigfc[2][1]);
164 widthspfc.
setSigma(2, 2, bunch_it->sigfc[2][2]);
165 widthspfc.
setSigma(2, 3, bunch_it->sigfc[2][3]);
166 widthspfc.
setSigma(3, 0, bunch_it->sigfc[3][0]);
167 widthspfc.
setSigma(3, 1, bunch_it->sigfc[3][1]);
168 widthspfc.
setSigma(3, 2, bunch_it->sigfc[3][2]);
169 widthspfc.
setSigma(3, 3, bunch_it->sigfc[3][3]);
200 dephist->SetDrawOption(
"colz");
201 dephist->GetXaxis()->SetTitle(
"module");
202 dephist->GetYaxis()->SetTitle(
"sector");
212 std::stringstream tempstringout;
214 std::string name1 = tempstringout.str() +
"_pedplots_1d.png";
217 TStyle* theStyle =
new TStyle(
"style",
"null");
218 theStyle->SetPalette(1,
nullptr);
219 theStyle->SetCanvasDefH(1200);
220 theStyle->SetCanvasDefW(1600);
265 std::stringstream tempstringout;
267 runnum_string = tempstringout.str();
273 XMLfilename = runnum_string +
"-peds_ADC_complete.xml";
274 XMLtag =
"Castor_pedestals_" + runnum_string;
282 CASTORMeans =
new TH1F(
"All Ped Means CASTOR",
"All Ped Means CASTOR", 100, 0, 9);
283 CASTORWidths =
new TH1F(
"All Ped Widths CASTOR",
"All Ped Widths CASTOR", 100, 0, 3);
285 dephist =
new TH2F(
"Pedestals (ADC)",
"All Castor", 14, 0., 14.5, 16, .5, 16.5);
292 std::vector<HcalGenericDetId> listEMap = myRefEMap->
allPrecisionId();
293 for (std::vector<HcalGenericDetId>::const_iterator it = listEMap.begin(); it != listEMap.end(); ++it) {
295 if (mygenid.isHcalCastorDetId()) {
301 for (
int i = 0;
i != 4;
i++) {
304 for (
int j = 0;
j != 4;
j++) {
318 std::vector<NewPedBunch>::iterator bunch_it;
322 for (bunch_it =
Bunches.begin(); bunch_it !=
Bunches.end(); ++bunch_it)
323 if (bunch_it->detid.rawId() == digi.
id().
rawId())
325 bunch_it->usedflag =
true;
331 bunch_it->capfc[digi.
sample(ts).
capid()] += charge1;
335 if ((ts + 1 < digi.
size()) && (ts + 1 <
lastTS)) {
342 if ((ts + 2 < digi.
size()) && (ts + 2 <
lastTS)) {
349 if ((ts + 3 < digi.
size()) && (ts + 3 <
lastTS)) {