19 getAllProvenances(
false),
20 printProvenanceInfo(
false),
22 theCSCStripPedestalSum(0),
23 theCSCStripPedestalCount(0),
25 std::string MsgLoggerCat =
"GlobalDigisAnalyzer_GlobalDigisAnalyzer";
79 edm::LogInfo(MsgLoggerCat) <<
"\n===============================\n"
80 <<
"Initialized as EDAnalyzer with parameter values:\n"
81 <<
" Name = " <<
fName <<
"\n"
99 <<
"===============================\n";
144 for (
int i = 0;
i < 19; ++
i) {
151 for (
int amend = 0; amend < 19; ++amend) {
152 hcharname =
"hSiStripn_" + SiStripString[amend];
153 hchartitle = SiStripString[amend] +
" Digis";
158 hcharname =
"hSiStripADC_" + SiStripString[amend];
159 hchartitle = SiStripString[amend] +
" ADC";
164 hcharname =
"hSiStripStripADC_" + SiStripString[amend];
165 hchartitle = SiStripString[amend] +
" Strip";
172 std::string HCalString[4] = {
"HB",
"HE",
"HO",
"HF"};
173 float calnUpper[4] = {30000., 30000., 30000., 20000.};
174 float calnLower[4] = {0., 0., 0., 0.};
175 float SHEUpper[4] = {1., 1., 1., 1.};
176 float SHEvAEEUpper[4] = {5000, 5000, 5000, 5000};
177 float SHEvAEELower[4] = {-5000, -5000, -5000, -5000};
178 int SHEvAEEnBins[4] = {200, 200, 200, 200};
179 double ProfileUpper[4] = {1., 1., 1., 1.};
181 for (
int i = 0;
i < 4; ++
i) {
190 for (
int amend = 0; amend < 4; ++amend) {
191 hcharname =
"hHcaln_" + HCalString[amend];
192 hchartitle = HCalString[amend] +
" digis";
193 mehHcaln[amend] = iBooker.
book1D(hcharname, hchartitle, 10000, calnLower[amend], calnUpper[amend]);
197 hcharname =
"hHcalAEE_" + HCalString[amend];
198 hchartitle = HCalString[amend] +
"Cal AEE";
203 hcharname =
"hHcalSHE_" + HCalString[amend];
204 hchartitle = HCalString[amend] +
"Cal SHE";
205 mehHcalSHE[amend] = iBooker.
book1D(hcharname, hchartitle, 1000, 0.0, SHEUpper[amend]);
209 hcharname =
"hHcalAEESHE_" + HCalString[amend];
210 hchartitle = HCalString[amend] +
"Cal AEE/SHE";
212 iBooker.
book1D(hcharname, hchartitle, SHEvAEEnBins[amend], SHEvAEELower[amend], SHEvAEEUpper[amend]);
216 hcharname =
"hHcalSHEvAEE_" + HCalString[amend];
217 hchartitle = HCalString[amend] +
"Cal SHE vs. AEE";
219 iBooker.
bookProfile(hcharname, hchartitle, 60, -10., 50., 100, 0., (
float)ProfileUpper[amend],
"");
227 for (
int i = 0;
i < 2; ++
i) {
237 for (
int amend = 0; amend < 2; ++amend) {
238 hcharname =
"hEcaln_" + ECalString[amend];
239 hchartitle = ECalString[amend] +
" digis";
240 mehEcaln[amend] = iBooker.
book1D(hcharname, hchartitle, 3000, 0., 40000.);
244 hcharname =
"hEcalAEE_" + ECalString[amend];
245 hchartitle = ECalString[amend] +
"Cal AEE";
250 hcharname =
"hEcalSHE_" + ECalString[amend];
251 hchartitle = ECalString[amend] +
"Cal SHE";
256 hcharname =
"hEcalMaxPos_" + ECalString[amend];
257 hchartitle = ECalString[amend] +
"Cal MaxPos";
262 hcharname =
"hEcalSHEvAEESHE_" + ECalString[amend];
263 hchartitle = ECalString[amend] +
"Cal SHE vs. AEE/SHE";
268 hcharname =
"hEcalMultvAEE_" + ECalString[amend];
269 hchartitle = ECalString[amend] +
"Cal Multi vs. AEE";
276 hcharname =
"hEcaln_ES";
277 hchartitle =
"ESCAL digis";
283 for (
int i = 0;
i < 3; ++
i) {
285 hcharname =
"hEcalADC" + ADCNumber[
i] +
"_ES";
286 hchartitle =
"ESCAL ADC" + ADCNumber[
i];
293 std::string SiPixelString[7] = {
"BRL1",
"BRL2",
"BRL3",
"FWD1n",
"FWD1p",
"FWD2n",
"FWD2p"};
294 for (
int j = 0;
j < 7; ++
j) {
302 for (
int amend = 0; amend < 7; ++amend) {
303 hcharname =
"hSiPixeln_" + SiPixelString[amend];
304 hchartitle = SiPixelString[amend] +
" Digis";
312 hcharname =
"hSiPixelADC_" + SiPixelString[amend];
313 hchartitle = SiPixelString[amend] +
" ADC";
318 hcharname =
"hSiPixelRow_" + SiPixelString[amend];
319 hchartitle = SiPixelString[amend] +
" Row";
324 hcharname =
"hSiPixelColumn_" + SiPixelString[amend];
325 hchartitle = SiPixelString[amend] +
" Column";
335 std::string MuonString[4] = {
"MB1",
"MB2",
"MB3",
"MB4"};
337 for (
int i = 0;
i < 4; ++
i) {
344 for (
int j = 0;
j < 4; ++
j) {
345 hcharname =
"hDtMuonn_" + MuonString[
j];
346 hchartitle = MuonString[
j] +
" digis";
351 hcharname =
"hDtLayer_" + MuonString[
j];
352 hchartitle = MuonString[
j] +
" Layer";
357 hcharname =
"hDtMuonTime_" + MuonString[
j];
358 hchartitle = MuonString[
j] +
" Time";
363 hcharname =
"hDtMuonTimevLayer_" + MuonString[
j];
364 hchartitle = MuonString[
j] +
" Time vs. Layer";
372 hcharname =
"hCSCStripn";
373 hchartitle =
"CSC Strip digis";
379 hcharname =
"hCSCStripADC";
380 hchartitle =
"CSC Strip ADC";
386 hcharname =
"hCSCWiren";
387 hchartitle =
"CSC Wire digis";
393 hcharname =
"hCSCWireTime";
394 hchartitle =
"CSC Wire Time";
401 hcharname =
"hRPCMuonn";
402 hchartitle =
"RPC digis";
407 std::string MuonRPCString[5] = {
"Wmin2",
"Wmin1",
"W0",
"Wpu1",
"Wpu2"};
408 for (
int i = 0;
i < 5; ++
i) {
412 for (
int j = 0;
j < 5; ++
j) {
413 hcharname =
"hRPCRes_" + MuonRPCString[
j];
414 hchartitle = MuonRPCString[
j] +
" Digi - Sim";
422 std::string MsgLoggerCat =
"GlobalDigisAnalyzer_analyze";
444 edm::LogInfo(MsgLoggerCat) <<
"Processing run " << nrun <<
", event " <<
nevt <<
" (" <<
count <<
" events total)";
454 std::vector<const edm::StableProvenance *> AllProv;
455 iEvent.getAllStableProvenance(AllProv);
458 edm::LogInfo(MsgLoggerCat) <<
"Number of Provenances = " << AllProv.size();
461 TString eventout(
"\nProvenance info:\n");
463 for (
unsigned int i = 0;
i < AllProv.size(); ++
i) {
464 eventout +=
"\n ******************************";
465 eventout +=
"\n Module : ";
466 eventout += AllProv[
i]->moduleLabel();
467 eventout +=
"\n ProductID : ";
468 eventout += AllProv[
i]->productID().id();
469 eventout +=
"\n ClassName : ";
470 eventout += AllProv[
i]->className();
471 eventout +=
"\n InstanceName : ";
472 eventout += AllProv[
i]->productInstanceName();
473 eventout +=
"\n BranchName : ";
474 eventout += AllProv[
i]->branchName();
476 eventout +=
"\n ******************************\n";
494 edm::LogInfo(MsgLoggerCat) <<
"Done gathering data from event.";
503 std::string MsgLoggerCat =
"GlobalDigisAnalyzer_fillECal";
507 eventout =
"\nGathering info:";
518 bool validDigiEB =
true;
520 LogDebug(MsgLoggerCat) <<
"Unable to find EcalDigiEB in event!";
524 if (EcalDigiEB->
empty())
531 bool validXFrame =
true;
532 if (!crossingFrame.
isValid()) {
533 LogDebug(MsgLoggerCat) <<
"Unable to find cal barrel crossingFrame in event!";
543 uint32_t crystid = ebid.
rawId();
544 ebSimMap[crystid] += iHit.energy();
551 std::vector<double> ebAnalogSignal;
552 std::vector<double> ebADCCounts;
553 std::vector<double> ebADCGains;
559 for (
unsigned int digis = 0; digis < EcalDigiEB->
size(); ++digis) {
563 int nrSamples = ebdf.
size();
569 double pedestalPreSample = 0.;
570 double pedestalPreSampleAnalog = 0.;
573 ebAnalogSignal[
sample] = 0.;
581 ebADCCounts[
sample] = (thisSample.
adc());
584 if (Emax < ebAnalogSignal[
sample]) {
585 Emax = ebAnalogSignal[
sample];
589 pedestalPreSample += ebADCCounts[
sample];
590 pedestalPreSampleAnalog +=
594 pedestalPreSample /= 3.;
595 pedestalPreSampleAnalog /= 3.;
605 if (ebSimMap[ebid.
rawId()] != 0) {
617 eventout +=
"\n Number of EBDigis collected:.............. ";
627 bool isEndCap =
true;
630 bool validDigiEE =
true;
632 LogDebug(MsgLoggerCat) <<
"Unable to find EcalDigiEE in event!";
636 if (EcalDigiEE->
empty())
643 bool validXFrame =
true;
644 if (!crossingFrame.
isValid()) {
645 LogDebug(MsgLoggerCat) <<
"Unable to find cal endcap crossingFrame in event!";
655 uint32_t crystid = eeid.
rawId();
656 eeSimMap[crystid] += iHit.energy();
663 std::vector<double> eeAnalogSignal;
664 std::vector<double> eeADCCounts;
665 std::vector<double> eeADCGains;
671 for (
unsigned int digis = 0; digis < EcalDigiEE->
size(); ++digis) {
675 int nrSamples = eedf.
size();
681 double pedestalPreSample = 0.;
682 double pedestalPreSampleAnalog = 0.;
685 eeAnalogSignal[
sample] = 0.;
694 eeADCCounts[
sample] = (thisSample.
adc());
697 if (Emax < eeAnalogSignal[
sample]) {
698 Emax = eeAnalogSignal[
sample];
702 pedestalPreSample += eeADCCounts[
sample];
703 pedestalPreSampleAnalog +=
707 pedestalPreSample /= 3.;
708 pedestalPreSampleAnalog /= 3.;
718 if (eeSimMap[eeid.
rawId()] != 0) {
729 eventout +=
"\n Number of EEDigis collected:.............. ";
740 bool isPreshower =
true;
743 bool validDigiES =
true;
745 LogDebug(MsgLoggerCat) <<
"Unable to find EcalDigiES in event!";
753 if (EcalDigiES->
empty())
759 bool validXFrame =
true;
760 if (!crossingFrame.
isValid()) {
761 LogDebug(MsgLoggerCat) <<
"Unable to find cal preshower crossingFrame in event!";
772 uint32_t crystid = esid.
rawId();
773 esSimMap[crystid] += iHit.energy();
780 std::vector<double> esADCCounts;
784 for (
unsigned int digis = 0; digis < EcalDigiES->
size(); ++digis) {
788 int nrSamples = esdf.
size();
797 esADCCounts[
sample] = (thisSample.
adc());
806 eventout +=
"\n Number of ESDigis collected:.............. ";
820 std::string MsgLoggerCat =
"GlobalDigisAnalyzer_fillHCal";
824 eventout =
"\nGathering info:";
829 if (!HCalconditions.
isValid()) {
830 edm::LogWarning(MsgLoggerCat) <<
"Unable to find HCalconditions in event!";
841 bool validhcalHits =
true;
843 LogDebug(MsgLoggerCat) <<
"Unable to find hcalHits in event!";
844 validhcalHits =
false;
853 for (std::vector<PCaloHit>::const_iterator
simhits = simhitResult->begin();
simhits != simhitResult->end();
856 uint32_t cellid = detId.
rawId();
859 fHBEnergySimHits[cellid] +=
simhits->energy();
862 fHEEnergySimHits[cellid] +=
simhits->energy();
865 fHOEnergySimHits[cellid] +=
simhits->energy();
868 fHFEnergySimHits[cellid] +=
simhits->energy();
878 bool validHBHE =
true;
879 if (!
hbhe.isValid()) {
880 LogDebug(MsgLoggerCat) <<
"Unable to find HBHEDataFrame in event!";
889 for (ihbhe =
hbhe->begin(); ihbhe !=
hbhe->end(); ++ihbhe) {
898 coder.
adc2fC(*ihbhe, tool);
903 float fDigiSum = 0.0;
906 int capid = (*ihbhe)[
ii].capid();
913 if (fHFEnergySimHits[cell.rawId()] != 0) {
926 float fDigiSum = 0.0;
928 int capid = (*ihbhe)[
ii].capid();
935 if (fHFEnergySimHits[cell.rawId()] != 0) {
948 eventout +=
"\n Number of HBDigis collected:.............. ";
954 eventout +=
"\n Number of HEDigis collected:.............. ";
967 LogDebug(MsgLoggerCat) <<
"Unable to find HODataFrame in event!";
974 for (iho =
ho->begin(); iho !=
ho->end(); ++iho) {
986 float fDigiSum = 0.0;
989 int capid = (*iho)[
ii].capid();
996 if (fHFEnergySimHits[cell.rawId()] != 0) {
1008 eventout +=
"\n Number of HODigis collected:.............. ";
1019 bool validHF =
true;
1020 if (!
hf.isValid()) {
1021 LogDebug(MsgLoggerCat) <<
"Unable to find HFDataFrame in event!";
1040 float fDigiSum = 0.0;
1043 int capid = (*ihf)[
ii].capid();
1050 if (fHFEnergySimHits[cell.rawId()] != 0) {
1062 eventout +=
"\n Number of HFDigis collected:.............. ";
1080 std::string MsgLoggerCat =
"GlobalDigisAnalyzer_fillTrk";
1084 eventout =
"\nGathering info:";
1089 bool validstripDigis =
true;
1091 LogDebug(MsgLoggerCat) <<
"Unable to find stripDigis in event!";
1092 validstripDigis =
false;
1095 if (validstripDigis) {
1096 int nStripBrl = 0, nStripFwd = 0;
1098 for (DSViter = stripDigis->begin(); DSViter != stripDigis->end(); ++DSViter) {
1099 unsigned int id = DSViter->id;
1107 for (iter =
begin; iter !=
end; ++iter) {
1130 for (iter =
begin; iter !=
end; ++iter) {
1153 for (iter =
begin; iter !=
end; ++iter) {
1172 for (iter =
begin; iter !=
end; ++iter) {
1211 eventout +=
"\n Number of BrlStripDigis collected:........ ";
1212 eventout += nStripBrl;
1214 for (
int i = 0;
i < 8; ++
i) {
1219 eventout +=
"\n Number of FrwdStripDigis collected:....... ";
1220 eventout += nStripFwd;
1222 for (
int i = 8;
i < 19; ++
i) {
1230 bool validpixelDigis =
true;
1232 LogDebug(MsgLoggerCat) <<
"Unable to find pixelDigis in event!";
1233 validpixelDigis =
false;
1235 if (validpixelDigis) {
1236 int nPxlBrl = 0, nPxlFwd = 0;
1238 for (DPViter = pixelDigis->begin(); DPViter != pixelDigis->end(); ++DPViter) {
1239 unsigned int id = DPViter->id;
1247 for (iter =
begin; iter !=
end; ++iter) {
1269 for (iter =
begin; iter !=
end; ++iter) {
1271 if (tTopo->
pxfDisk(
id) == 1) {
1272 if (tTopo->
pxfSide(
id) == 1) {
1277 if (tTopo->
pxfSide(
id) == 2) {
1283 if (tTopo->
pxfDisk(
id) == 2) {
1284 if (tTopo->
pxfSide(
id) == 1) {
1289 if (tTopo->
pxfSide(
id) == 2) {
1300 eventout +=
"\n Number of BrlPixelDigis collected:........ ";
1301 eventout += nPxlBrl;
1303 for (
int i = 0;
i < 3; ++
i) {
1308 eventout +=
"\n Number of FrwdPixelDigis collected:....... ";
1309 eventout += nPxlFwd;
1312 for (
int i = 3;
i < 7; ++
i) {
1324 std::string MsgLoggerCat =
"GlobalDigisAnalyzer_fillMuon";
1328 eventout =
"\nGathering info:";
1333 bool validdtDigis =
true;
1335 LogDebug(MsgLoggerCat) <<
"Unable to find dtDigis in event!";
1336 validdtDigis =
false;
1345 for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end(); ++detUnitIt) {
1346 const DTLayerId &
id = (*detUnitIt).first;
1351 DTWireId wireId(
id, (*digiIt).wire());
1352 if (wireId.station() == 1) {
1358 if (wireId.station() == 2) {
1364 if (wireId.station() == 3) {
1370 if (wireId.station() == 4) {
1384 eventout +=
"\n Number of DtMuonDigis collected:.......... ";
1392 bool validstrips =
true;
1394 LogDebug(MsgLoggerCat) <<
"Unable to find muon strips in event!";
1395 validstrips =
false;
1401 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
1402 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
1404 for (; digiItr !=
last; ++digiItr) {
1408 std::vector<int> adcCounts = digiItr->getADCCounts();
1416 if (adcCounts[5] > (
pedestal + 100))
1423 eventout +=
"\n Number of CSCStripDigis collected:........ ";
1432 bool validwires =
true;
1433 if (!
wires.isValid()) {
1434 LogDebug(MsgLoggerCat) <<
"Unable to find muon wires in event!";
1441 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
1442 std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
1444 for (; digiItr != endDigi; ++digiItr) {
1451 eventout +=
"\n Number of CSCWireDigis collected:......... ";
1462 edm::LogWarning(MsgLoggerCat) <<
"Unable to find RPCGeometryRecord in event!";
1468 bool validrpcsim =
true;
1470 LogDebug(MsgLoggerCat) <<
"Unable to find rpcsimHit in event!";
1471 validrpcsim =
false;
1476 bool validrpcdigi =
true;
1478 LogDebug(MsgLoggerCat) <<
"Unable to find rpcDigis in event!";
1479 validrpcdigi =
false;
1483 validrpcdigi =
false;
1486 edm::PSimHitContainer::const_iterator rpcsimIt;
1487 std::map<RPCDetId, std::vector<double>> allsims;
1490 for (rpcsimIt = rpcsimHit->begin(); rpcsimIt != rpcsimHit->end(); rpcsimIt++) {
1492 int ptype = rpcsimIt->particleType();
1495 std::vector<double> buff;
1496 if (allsims.find(Rsid) != allsims.end()) {
1497 buff = allsims[Rsid];
1499 buff.push_back(rpcsimIt->localPosition().x());
1500 allsims[Rsid] = buff;
1510 for (rpcdetUnitIt = rpcDigis->begin(); rpcdetUnitIt != rpcDigis->end(); ++rpcdetUnitIt) {
1511 const RPCDetId Rsid = (*rpcdetUnitIt).first;
1512 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->
roll(Rsid));
1515 std::vector<double> sims;
1516 if (allsims.find(Rsid) != allsims.end()) {
1517 sims = allsims[Rsid];
1526 if (sims.size() == 1 && ndigi == 1) {
1529 if (Rsid.
region() == 0) {
1530 if (Rsid.
ring() == -2)
1532 else if (Rsid.
ring() == -1)
1534 else if (Rsid.
ring() == 0)
1536 else if (Rsid.
ring() == 1)
1538 else if (Rsid.
ring() == 2)
1545 eventout +=
"\n Number of RPCDigis collected:.............. ";