19 isSimulation =
pset.getUntrackedParameter<
bool>(
"isSimulation",
false);
20 writeTreeToFile =
pset.getUntrackedParameter<
bool>(
"writeTreeToFile",
true);
22 useDigis =
pset.getUntrackedParameter<
bool>(
"useDigis",
true);
25 useQualityFilter =
pset.getUntrackedParameter<
bool>(
"useQualityFilter",
false);
26 pMin =
pset.getUntrackedParameter<
double>(
"pMin", 4.);
27 chisqMax =
pset.getUntrackedParameter<
double>(
"chisqMax", 20.);
28 nCSCHitsMin =
pset.getUntrackedParameter<
int>(
"nCSCHitsMin", 10);
29 nCSCHitsMax =
pset.getUntrackedParameter<
int>(
"nCSCHitsMax", 25);
30 lengthMin =
pset.getUntrackedParameter<
double>(
"lengthMin", 140.);
31 lengthMax =
pset.getUntrackedParameter<
double>(
"lengthMax", 600.);
32 deltaPhiMax =
pset.getUntrackedParameter<
double>(
"deltaPhiMax", 0.2);
33 polarMax =
pset.getUntrackedParameter<
double>(
"polarMax", 0.7);
34 polarMin =
pset.getUntrackedParameter<
double>(
"polarMin", 0.3);
37 useTriggerFilter =
pset.getUntrackedParameter<
bool>(
"useTriggerFilter",
false);
40 rd_token = consumes<FEDRawDataCollection>(
pset.getParameter<
edm::InputTag>(
"rawDataTag"));
41 sd_token = consumes<CSCStripDigiCollection>(
pset.getParameter<
edm::InputTag>(
"stripDigiTag"));
42 wd_token = consumes<CSCWireDigiCollection>(
pset.getParameter<
edm::InputTag>(
"wireDigiTag"));
43 cd_token = consumes<CSCComparatorDigiCollection>(
pset.getParameter<
edm::InputTag>(
"compDigiTag"));
44 al_token = consumes<CSCALCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"alctDigiTag"));
45 cl_token = consumes<CSCCLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"clctDigiTag"));
46 co_token = consumes<CSCCorrelatedLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"corrlctDigiTag"));
47 rh_token = consumes<CSCRecHit2DCollection>(
pset.getParameter<
edm::InputTag>(
"cscRecHitTag"));
48 se_token = consumes<CSCSegmentCollection>(
pset.getParameter<
edm::InputTag>(
"cscSegTag"));
49 sa_token = consumes<reco::TrackCollection>(
pset.getParameter<
edm::InputTag>(
"saMuonTag"));
50 l1_token = consumes<L1MuGMTReadoutCollection>(
pset.getParameter<
edm::InputTag>(
"l1aTag"));
52 sh_token = consumes<PSimHitContainer>(
pset.getParameter<
edm::InputTag>(
"simHitTag"));
55 makeOccupancyPlots =
pset.getUntrackedParameter<
bool>(
"makeOccupancyPlots",
true);
56 makeTriggerPlots =
pset.getUntrackedParameter<
bool>(
"makeTriggerPlots",
false);
57 makeStripPlots =
pset.getUntrackedParameter<
bool>(
"makeStripPlots",
true);
58 makeWirePlots =
pset.getUntrackedParameter<
bool>(
"makeWirePlots",
true);
59 makeRecHitPlots =
pset.getUntrackedParameter<
bool>(
"makeRecHitPlots",
true);
60 makeSimHitPlots =
pset.getUntrackedParameter<
bool>(
"makeSimHitPlots",
true);
61 makeSegmentPlots =
pset.getUntrackedParameter<
bool>(
"makeSegmentPlots",
true);
62 makeResolutionPlots =
pset.getUntrackedParameter<
bool>(
"makeResolutionPlots",
true);
63 makePedNoisePlots =
pset.getUntrackedParameter<
bool>(
"makePedNoisePlots",
true);
64 makeEfficiencyPlots =
pset.getUntrackedParameter<
bool>(
"makeEfficiencyPlots",
true);
65 makeGasGainPlots =
pset.getUntrackedParameter<
bool>(
"makeGasGainPlots",
true);
66 makeAFEBTimingPlots =
pset.getUntrackedParameter<
bool>(
"makeAFEBTimingPlots",
true);
67 makeCompTimingPlots =
pset.getUntrackedParameter<
bool>(
"makeCompTimingPlots",
true);
68 makeADCTimingPlots =
pset.getUntrackedParameter<
bool>(
"makeADCTimingPlots",
true);
69 makeRHNoisePlots =
pset.getUntrackedParameter<
bool>(
"makeRHNoisePlots",
false);
70 makeCalibPlots =
pset.getUntrackedParameter<
bool>(
"makeCalibPlots",
false);
71 makeStandalonePlots =
pset.getUntrackedParameter<
bool>(
"makeStandalonePlots",
false);
72 makeTimeMonitorPlots =
pset.getUntrackedParameter<
bool>(
"makeTimeMonitorPlots",
false);
73 makeHLTPlots =
pset.getUntrackedParameter<
bool>(
"makeHLTPlots",
false);
89 hOWires =
new TH2I(
"hOWires",
"Wire Digi Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
90 hOStrips =
new TH2I(
"hOStrips",
"Strip Digi Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
91 hORecHits =
new TH2I(
"hORecHits",
"RecHit Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
92 hOSegments =
new TH2I(
"hOSegments",
"Segments Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
95 hSSTE =
new TH1F(
"hSSTE",
"hSSTE", 40, 0, 40);
96 hRHSTE =
new TH1F(
"hRHSTE",
"hRHSTE", 40, 0, 40);
97 hSEff =
new TH1F(
"hSEff",
"Segment Efficiency", 20, 0.5, 20.5);
98 hRHEff =
new TH1F(
"hRHEff",
"recHit Efficiency", 20, 0.5, 20.5);
100 const int nChambers = 36;
101 const int nTypes = 18;
103 float nCh_max =
float(nChambers) + 0.5;
105 float nT_max =
float(nTypes) + 0.5;
107 hSSTE2 =
new TH2F(
"hSSTE2",
"hSSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
108 hRHSTE2 =
new TH2F(
"hRHSTE2",
"hRHSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
109 hStripSTE2 =
new TH2F(
"hStripSTE2",
"hStripSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
110 hWireSTE2 =
new TH2F(
"hWireSTE2",
"hWireSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
112 hEffDenominator =
new TH2F(
"hEffDenominator",
"hEffDenominator", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
113 hSEff2 =
new TH2F(
"hSEff2",
"Segment Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
114 hRHEff2 =
new TH2F(
"hRHEff2",
"recHit Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
116 hStripEff2 =
new TH2F(
"hStripEff2",
"strip Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
117 hWireEff2 =
new TH2F(
"hWireEff2",
"wire Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
120 new TH2F(
"hSensitiveAreaEvt",
"events in sensitive area", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
132 histoEfficiency(hRHSTE, hRHEff);
133 histoEfficiency(hSSTE, hSEff);
134 hSEff2->Divide(hSSTE2, hEffDenominator, 1., 1.,
"B");
135 hRHEff2->Divide(hRHSTE2, hEffDenominator, 1., 1.,
"B");
136 hStripEff2->Divide(hStripSTE2, hEffDenominator, 1., 1.,
"B");
137 hWireEff2->Divide(hWireSTE2, hEffDenominator, 1., 1.,
"B");
139 histos->insertPlot(hRHSTE,
"hRHSTE",
"Efficiency");
140 histos->insertPlot(hSSTE,
"hSSTE",
"Efficiency");
141 histos->insertPlot(hSSTE2,
"hSSTE2",
"Efficiency");
142 histos->insertPlot(hEffDenominator,
"hEffDenominator",
"Efficiency");
143 histos->insertPlot(hRHSTE2,
"hRHSTE2",
"Efficiency");
144 histos->insertPlot(hStripSTE2,
"hStripSTE2",
"Efficiency");
145 histos->insertPlot(hWireSTE2,
"hWireSTE2",
"Efficiency");
148 histos->insertPlot(hSEff,
"hSEff",
"Efficiency");
149 histos->insertPlot(hRHEff,
"hRHEff",
"Efficiency");
151 histos->insertPlot(hSEff2,
"hSEff2",
"Efficiency");
152 histos->insertPlot(hRHEff2,
"hRHEff2",
"Efficiency");
153 histos->insertPlot(hStripEff2,
"hStripff2",
"Efficiency");
154 histos->insertPlot(hWireEff2,
"hWireff2",
"Efficiency");
156 histos->insertPlot(hSensitiveAreaEvt,
"",
"Efficiency");
159 histos->insertPlot(hOWires,
"hOWires",
"Digis");
160 histos->insertPlot(hOStrips,
"hOStrips",
"Digis");
161 histos->insertPlot(hORecHits,
"hORecHits",
"recHits");
162 histos->insertPlot(hOSegments,
"hOSegments",
"Segments");
189 event.getByToken(sd_token,
strips);
190 event.getByToken(wd_token,
wires);
191 event.getByToken(cd_token, compars);
192 event.getByToken(al_token, alcts);
193 event.getByToken(cl_token, clcts);
194 event.getByToken(co_token, correlatedlcts);
203 event.getByToken(rh_token,
recHits);
213 event.getByToken(sh_token,
simHits);
221 if (makeTriggerPlots || useTriggerFilter || (useDigis && makeTimeMonitorPlots)) {
222 event.getByToken(l1_token, pCollection);
226 event.getByToken(tr_token,
hlt);
231 if (makeStandalonePlots || useQualityFilter) {
232 event.getByToken(sa_token, saMuons);
241 if (nEventsAnalyzed == 1 && makeCalibPlots)
246 if (makeTriggerPlots || useTriggerFilter)
247 CSCL1A = doTrigger(pCollection);
248 if (!useTriggerFilter)
252 if (makeStandalonePlots || useQualityFilter)
254 if (!useQualityFilter)
259 if (makeOccupancyPlots && CSCL1A)
265 if (cleanEvent && CSCL1A) {
267 if (makeStripPlots && useDigis)
271 if (makeWirePlots && useDigis)
279 if (isSimulation && makeSimHitPlots)
283 if (makeSegmentPlots)
287 if (makeResolutionPlots)
291 if (makePedNoisePlots && useDigis)
295 if (makeEfficiencyPlots)
299 if (makeGasGainPlots && useDigis)
303 if (makeAFEBTimingPlots && useDigis)
304 doAFEBTiming(*
wires);
307 if (makeCompTimingPlots && useDigis)
308 doCompTiming(*compars);
311 if (makeADCTimingPlots)
315 if (makeRHNoisePlots && useDigis)
319 if (makeStandalonePlots)
320 doStandalone(saMuons);
323 if (makeTimeMonitorPlots)
421 bool wireo[2][4][4][36];
422 bool stripo[2][4][4][36];
423 bool rechito[2][4][4][36];
424 bool segmento[2][4][4][36];
426 bool hasWires =
false;
427 bool hasStrips =
false;
428 bool hasRecHits =
false;
429 bool hasSegments =
false;
431 for (
int e = 0;
e < 2;
e++) {
432 for (
int s = 0;
s < 4;
s++) {
433 for (
int r = 0;
r < 4;
r++) {
434 for (
int c = 0;
c < 36;
c++) {
435 wireo[
e][
s][
r][
c] =
false;
436 stripo[
e][
s][
r][
c] =
false;
437 rechito[
e][
s][
r][
c] =
false;
438 segmento[
e][
s][
r][
c] =
false;
448 int kEndcap =
id.
endcap();
449 int kRing =
id.ring();
450 int kStation =
id.station();
451 int kChamber =
id.chamber();
452 std::vector<CSCWireDigi>::const_iterator wireIt = (*wi).second.first;
453 std::vector<CSCWireDigi>::const_iterator lastWire = (*wi).second.second;
454 for (; wireIt != lastWire; ++wireIt) {
455 if (!wireo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
456 wireo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
457 hOWires->Fill(kChamber, typeIndex(
id));
459 chamberSerial(
id),
"hOWireSerial",
"Wire Occupancy by Chamber Serial", 601, -0.5, 600.5,
"Digis");
468 int kEndcap =
id.
endcap();
469 int kRing =
id.ring();
470 int kStation =
id.station();
471 int kChamber =
id.chamber();
472 std::vector<CSCStripDigi>::const_iterator stripIt = (*si).second.first;
473 std::vector<CSCStripDigi>::const_iterator lastStrip = (*si).second.second;
474 for (; stripIt != lastStrip; ++stripIt) {
475 std::vector<int> myADCVals = stripIt->getADCCounts();
476 bool thisStripFired =
false;
477 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
480 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
481 diff = (
float)myADCVals[iCount] - thisPedestal;
483 thisStripFired =
true;
486 if (thisStripFired) {
487 if (!stripo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
488 stripo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
489 hOStrips->Fill(kChamber, typeIndex(
id));
491 chamberSerial(
id),
"hOStripSerial",
"Strip Occupancy by Chamber Serial", 601, -0.5, 600.5,
"Digis");
501 for (recIt =
recHits->begin(); recIt !=
recHits->end(); recIt++) {
503 int kEndcap = idrec.
endcap();
504 int kRing = idrec.
ring();
505 int kStation = idrec.
station();
506 int kChamber = idrec.
chamber();
507 if (!rechito[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
508 rechito[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
510 chamberSerial(idrec),
"hORecHitsSerial",
"RecHit Occupancy by Chamber Serial", 601, -0.5, 600.5,
"recHits");
511 hORecHits->Fill(kChamber, typeIndex(idrec));
519 int kEndcap =
id.
endcap();
520 int kRing =
id.ring();
521 int kStation =
id.station();
522 int kChamber =
id.chamber();
523 if (!segmento[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
524 segmento[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
526 chamberSerial(
id),
"hOSegmentsSerial",
"Segment Occupancy by Chamber Serial", 601, -0.5, 600.5,
"Segments");
527 hOSegments->Fill(kChamber, typeIndex(
id));
533 histos->fill1DHist(1,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
535 histos->fill1DHist(3,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
537 histos->fill1DHist(5,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
538 if (hasWires && hasStrips)
539 histos->fill1DHist(7,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
541 histos->fill1DHist(9,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
543 histos->fill1DHist(11,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
545 histos->fill1DHist(13,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
555 std::vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->
getRecords();
556 std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
558 bool csc_l1a =
false;
560 bool rpcf_l1a =
false;
561 bool rpcb_l1a =
false;
562 bool beamHaloTrigger =
false;
564 int myBXNumber = -1000;
566 for (igmtrr = L1Mrec.begin(); igmtrr != L1Mrec.end(); igmtrr++) {
567 std::vector<L1MuRegionalCand>::const_iterator iter1;
568 std::vector<L1MuRegionalCand> rmc;
572 rmc = igmtrr->getCSCCands();
573 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
574 if (!(*iter1).empty()) {
576 int kQuality = (*iter1).quality();
578 beamHaloTrigger =
true;
581 if (igmtrr->getBxInEvent() == 0 && icsc > 0)
583 if (igmtrr->getBxInEvent() == 0) {
584 myBXNumber = igmtrr->getBxNr();
589 rmc = igmtrr->getDTBXCands();
590 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
591 if (!(*iter1).empty()) {
595 if (igmtrr->getBxInEvent() == 0 && idt > 0)
600 rmc = igmtrr->getBrlRPCCands();
601 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
602 if (!(*iter1).empty()) {
606 if (igmtrr->getBxInEvent() == 0 && irpcb > 0)
611 rmc = igmtrr->getFwdRPCCands();
612 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
613 if (!(*iter1).empty()) {
617 if (igmtrr->getBxInEvent() == 0 && irpcf > 0)
623 histos->fill1DHist(myBXNumber,
"vtBXNumber",
"BX Number", 4001, -0.5, 4000.5,
"Trigger");
625 histos->fill1DHist(1,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
627 histos->fill1DHist(2,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
629 histos->fill1DHist(3,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
631 histos->fill1DHist(4,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
633 histos->fill1DHist(8,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
636 histos->fill1DHist(1,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
638 histos->fill1DHist(2,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
640 histos->fill1DHist(3,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
642 histos->fill1DHist(4,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
643 if (dt_l1a || rpcb_l1a || rpcf_l1a)
644 histos->fill1DHist(5,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
645 if (!(dt_l1a || rpcb_l1a || rpcf_l1a))
646 histos->fill1DHist(6,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
648 histos->fill1DHist(1,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
650 histos->fill1DHist(2,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
652 histos->fill1DHist(3,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
654 histos->fill1DHist(4,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
655 if (dt_l1a || rpcb_l1a || rpcf_l1a)
656 histos->fill1DHist(5,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
657 if (!(dt_l1a || rpcb_l1a || rpcf_l1a))
658 histos->fill1DHist(6,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
677 int hltSize =
hlt->size();
678 for (
int i = 0;
i < hltSize; ++
i) {
680 histos->fill1DHist(
i,
"hltBits",
"HLT Trigger Bits", hltSize + 1, -0.5, (
float)hltSize + 0.5,
"Trigger");
694 if (nEventsAnalyzed == 1) {
695 LogDebug(
"Calibrations") <<
"Loading Calibrations...";
714 LogDebug(
"Calibrations") <<
"Calibrations Loaded!";
716 for (
int i = 0;
i < 400;
i++) {
718 histos->fillCalibHist(pGains->
gains[
i].gain_slope,
"hCalibGainsS",
"Gains Slope", 400, 0, 400,
bin,
"Calib");
720 pCrosstalk->
crosstalk[
i].xtalk_slope_left,
"hCalibXtalkSL",
"Xtalk Slope Left", 400, 0, 400,
bin,
"Calib");
722 pCrosstalk->
crosstalk[
i].xtalk_slope_right,
"hCalibXtalkSR",
"Xtalk Slope Right", 400, 0, 400,
bin,
"Calib");
725 "Xtalk Intercept Left",
733 "Xtalk Intercept Right",
739 histos->fillCalibHist(pPedestals->
pedestals[
i].ped,
"hCalibPedsP",
"Peds", 400, 0, 400,
bin,
"Calib");
740 histos->fillCalibHist(pPedestals->
pedestals[
i].rms,
"hCalibPedsR",
"Peds RMS", 400, 0, 400,
bin,
"Calib");
742 pNoiseMatrix->
matrix[
i].elem33,
"hCalibNoise33",
"Noise Matrix 33", 400, 0, 400,
bin,
"Calib");
744 pNoiseMatrix->
matrix[
i].elem34,
"hCalibNoise34",
"Noise Matrix 34", 400, 0, 400,
bin,
"Calib");
746 pNoiseMatrix->
matrix[
i].elem35,
"hCalibNoise35",
"Noise Matrix 35", 400, 0, 400,
bin,
"Calib");
748 pNoiseMatrix->
matrix[
i].elem44,
"hCalibNoise44",
"Noise Matrix 44", 400, 0, 400,
bin,
"Calib");
750 pNoiseMatrix->
matrix[
i].elem45,
"hCalibNoise45",
"Noise Matrix 45", 400, 0, 400,
bin,
"Calib");
752 pNoiseMatrix->
matrix[
i].elem46,
"hCalibNoise46",
"Noise Matrix 46", 400, 0, 400,
bin,
"Calib");
754 pNoiseMatrix->
matrix[
i].elem55,
"hCalibNoise55",
"Noise Matrix 55", 400, 0, 400,
bin,
"Calib");
756 pNoiseMatrix->
matrix[
i].elem56,
"hCalibNoise56",
"Noise Matrix 56", 400, 0, 400,
bin,
"Calib");
758 pNoiseMatrix->
matrix[
i].elem57,
"hCalibNoise57",
"Noise Matrix 57", 400, 0, 400,
bin,
"Calib");
760 pNoiseMatrix->
matrix[
i].elem66,
"hCalibNoise66",
"Noise Matrix 66", 400, 0, 400,
bin,
"Calib");
762 pNoiseMatrix->
matrix[
i].elem67,
"hCalibNoise67",
"Noise Matrix 67", 400, 0, 400,
bin,
"Calib");
764 pNoiseMatrix->
matrix[
i].elem77,
"hCalibNoise77",
"Noise Matrix 77", 400, 0, 400,
bin,
"Calib");
776 int nWireGroupsTotal = 0;
779 std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
780 std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
781 for (; wireIter != lWire; ++wireIter) {
782 int myWire = wireIter->getWireGroup();
783 int myTBin = wireIter->getTimeBin();
785 histos->fill1DHistByType(myWire,
"hWireWire",
"Wiregroup Numbers Fired",
id, 113, -0.5, 112.5,
"Digis");
786 histos->fill1DHistByType(myTBin,
"hWireTBin",
"Wire TimeBin Fired",
id, 17, -0.5, 16.5,
"Digis");
788 chamberSerial(
id), myTBin,
"hWireTBinProfile",
"Wire TimeBin Fired", 601, -0.5, 600.5, -0.5, 16.5,
"Digis");
790 histos->fill1DHistByLayer(
791 myWire,
"hWireWire",
"Wiregroup Numbers Fired",
id, 113, -0.5, 112.5,
"WireNumberByLayer");
792 histos->fill1DHistByLayer(myTBin,
"hWireTBin",
"Wire TimeBin Fired",
id, 17, -0.5, 16.5,
"WireTimeByLayer");
798 if (nWireGroupsTotal == 0)
799 nWireGroupsTotal = -1;
801 histos->fill1DHist(nWireGroupsTotal,
"hWirenGroupsTotal",
"Wires Fired Per Event", 151, -0.5, 150.5,
"Digis");
811 int nStripsFired = 0;
814 std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
815 std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
816 for (; stripIter != lStrip; ++stripIter) {
817 int myStrip = stripIter->getStrip();
818 std::vector<int> myADCVals = stripIter->getADCCounts();
819 bool thisStripFired =
false;
820 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
823 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
824 diff = (
float)myADCVals[iCount] - thisPedestal;
826 thisStripFired =
true;
829 if (thisStripFired) {
832 histos->fill1DHistByType(myStrip,
"hStripStrip",
"Strip Number",
id, 81, -0.5, 80.5,
"Digis");
834 histos->fill1DHistByLayer(myStrip,
"hStripStrip",
"Strip Number",
id, 81, -0.5, 80.5,
"StripNumberByLayer");
840 if (nStripsFired == 0)
843 histos->fill1DHist(nStripsFired,
"hStripNFired",
"Fired Strips per Event", 251, -0.5, 250.5,
"Digis");
855 std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
856 std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
857 for (; pedIt != lStrip; ++pedIt) {
858 int myStrip = pedIt->getStrip();
859 std::vector<int> myADCVals = pedIt->getADCCounts();
860 float TotalADC = getSignal(*
strips,
id, myStrip);
861 bool thisStripFired =
false;
862 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
864 (1. / 6) * (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
866 if (
id.
station() == 1 &&
id.ring() == 4) {
871 thisStripFired =
true;
873 if (!thisStripFired) {
874 float ADC = thisSignal - thisPedestal;
875 histos->fill1DHist(
ADC,
"hStripPed",
"Pedestal Noise Distribution", 50, -25., 25.,
"PedestalNoise");
876 histos->fill1DHistByType(
ADC,
"hStripPedME",
"Pedestal Noise Distribution",
id, 50, -25., 25.,
"PedestalNoise");
877 histos->fillProfile(chamberSerial(
id),
879 "hStripPedMEProfile",
880 "Wire TimeBin Fired",
888 histos->fill1DHistByLayer(
889 ADC,
"hStripPedME",
"Pedestal Noise Distribution",
id, 50, -25., 25.,
"PedestalNoiseByLayer");
904 int nRecHits =
recHits->size();
913 for (dRHIter =
recHits->begin(); dRHIter !=
recHits->end(); dRHIter++) {
918 int kEndcap = idrec.
endcap();
919 int kRing = idrec.
ring();
920 int kStation = idrec.
station();
921 int kChamber = idrec.
chamber();
925 LocalPoint rhitlocal = (*dRHIter).localPosition();
926 float xreco = rhitlocal.
x();
927 float yreco = rhitlocal.
y();
928 LocalError rerrlocal = (*dRHIter).localPositionError();
930 float xxerr = rerrlocal.
xx();
931 float yyerr = rerrlocal.
yy();
932 float xyerr = rerrlocal.
xy();
934 float stpos = (*dRHIter).positionWithinStrip();
935 float sterr = (*dRHIter).errorWithinStrip();
940 int adcsize = dRHIter->nStrips() * dRHIter->nTimeBins();
941 for (
unsigned int i = 0;
i < dRHIter->nStrips();
i++) {
942 for (
unsigned int j = 0;
j < dRHIter->nTimeBins() - 1;
j++) {
943 rHSumQ += dRHIter->adcs(
i,
j);
945 sumsides += dRHIter->adcs(
i,
j);
949 float rHratioQ = sumsides / rHSumQ;
955 rHtime = (*dRHIter).tpeak() / 50.;
962 float grecx = rhitglobal.
x();
963 float grecy = rhitglobal.
y();
966 if (writeTreeToFile && rhTreeCount < 1500000) {
967 histos->fillRechitTree(xreco, yreco, grecx, grecy, kEndcap, kStation, kRing, kChamber,
kLayer);
973 histos->fill2DHistByStation(
974 grecx, grecy,
"hRHGlobal",
"recHit Global Position", idrec, 100, -800., 800., 100, -800., 800.,
"recHits");
975 if (kStation == 1 && (kRing == 1 || kRing == 4))
976 histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 4000,
"recHits");
978 histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 2000,
"recHits");
979 histos->fill1DHistByType(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt", idrec, 120, -0.1, 1.1,
"recHits");
980 histos->fill1DHistByType(rHtime,
"hRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"recHits");
981 histos->fill1DHistByType(
sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X", idrec, 100, -0.1, 2,
"recHits");
982 histos->fill1DHistByType(
sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y", idrec, 100, -0.1, 2,
"recHits");
983 histos->fill1DHistByType(xyerr,
"hRHxyerr",
"Corr. RecHit XY Error", idrec, 100, -1, 2,
"recHits");
985 histos->fill1DHistByType(stpos,
"hRHstpos",
"Reconstructed Position on Strip", idrec, 120, -0.6, 0.6,
"recHits");
987 sterr,
"hRHsterr",
"Estimated Error on Strip Measurement", idrec, 120, -0.05, 0.25,
"recHits");
989 chamberSerial(idrec), rHSumQ,
"hRHSumQProfile",
"Sum 3x3 recHit Charge", 601, -0.5, 600.5, 0, 4000,
"recHits");
991 chamberSerial(idrec), rHtime,
"hRHTimingProfile",
"recHit Timing", 601, -0.5, 600.5, -11, 11,
"recHits");
993 if (kStation == 1 && (kRing == 1 || kRing == 4))
994 histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 4000,
"RHQByLayer");
996 histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 2000,
"RHQByLayer");
997 histos->fill1DHistByLayer(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt", idrec, 120, -0.1, 1.1,
"RHQByLayer");
998 histos->fill1DHistByLayer(rHtime,
"hRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"RHTimingByLayer");
999 histos->fill2DHistByLayer(xreco,
1002 "recHit Local Position",
1010 "RHLocalXYByLayer");
1011 histos->fill1DHistByLayer(
1012 sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X", idrec, 100, -0.1, 2,
"RHErrorsByLayer");
1013 histos->fill1DHistByLayer(
1014 sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y", idrec, 100, -0.1, 2,
"RHErrorsByLayer");
1015 histos->fill1DHistByType(
1016 stpos,
"hRHstpos",
"Reconstructed Position on Strip", idrec, 120, -0.6, 0.6,
"RHStripPosByLayer");
1017 histos->fill1DHistByType(
1018 sterr,
"hRHsterr",
"Estimated Error on Strip Measurement", idrec, 120, -0.05, 0.25,
"RHStripPosByLayer");
1026 histos->fill1DHist(nRecHits,
"hRHnrechits",
"recHits per Event (all chambers)", 151, -0.5, 150.5,
"recHits");
1037 for (dSHrecIter =
recHits->begin(); dSHrecIter !=
recHits->end(); dSHrecIter++) {
1039 LocalPoint rhitlocal = (*dSHrecIter).localPosition();
1040 float xreco = rhitlocal.
x();
1041 float yreco = rhitlocal.
y();
1042 float xError =
sqrt((*dSHrecIter).localPositionError().xx());
1043 float yError =
sqrt((*dSHrecIter).localPositionError().yy());
1044 float simHitXres = -99;
1045 float simHitYres = -99;
1048 float mindiffX = 99;
1049 float mindiffY = 10;
1051 PSimHitContainer::const_iterator dSHsimIter;
1052 for (dSHsimIter =
simHits->begin(); dSHsimIter !=
simHits->end(); dSHsimIter++) {
1057 if (sId == idrec &&
abs((*dSHsimIter).particleType()) == 13) {
1059 LocalPoint sHitlocal = (*dSHsimIter).localPosition();
1062 if ((sHitlocal.
x() - xreco) < mindiffX && (sHitlocal.
y() - yreco) < mindiffY) {
1063 simHitXres = (sHitlocal.
x() - xreco);
1064 simHitYres = (sHitlocal.
y() - yreco);
1065 mindiffX = (sHitlocal.
x() - xreco);
1066 xPull = simHitXres / xError;
1067 yPull = simHitYres / yError;
1072 histos->fill1DHistByType(
1073 simHitXres,
"hSimXResid",
"SimHitX - Reconstructed X", idrec, 100, -1.0, 1.0,
"Resolution");
1074 histos->fill1DHistByType(
1075 simHitYres,
"hSimYResid",
"SimHitY - Reconstructed Y", idrec, 100, -5.0, 5.0,
"Resolution");
1076 histos->fill1DHistByType(xPull,
"hSimXPull",
"Local X Pulls", idrec, 100, -5.0, 5.0,
"Resolution");
1077 histos->fill1DHistByType(yPull,
"hSimYPull",
"Local Y Pulls", idrec, 100, -5.0, 5.0,
"Resolution");
1099 int kEndcap =
id.
endcap();
1100 int kRing =
id.ring();
1101 int kStation =
id.station();
1102 int kChamber =
id.chamber();
1105 float chisq = (*dSiter).chi2();
1106 int nhits = (*dSiter).nRecHits();
1107 int nDOF = 2 *
nhits - 4;
1109 LocalPoint localPos = (*dSiter).localPosition();
1110 float segX = localPos.
x();
1111 float segY = localPos.
y();
1118 float globTheta = 0.;
1123 globX = globalPosition.
x();
1124 globY = globalPosition.
y();
1126 globTheta = globalDirection.
theta();
1127 globPhi = globalDirection.
phi();
1131 if (writeTreeToFile && segTreeCount < 1500000) {
1132 histos->fillSegmentTree(segX, segY, globX, globY, kEndcap, kStation, kRing, kChamber);
1137 histos->fill2DHistByStation(globX,
1140 "Segment Global Positions;global x (cm)",
1149 histos->fill1DHistByType(
nhits,
"hSnHits",
"N hits on Segments",
id, 8, -0.5, 7.5,
"Segments");
1150 histos->fill1DHistByType(
theta,
"hSTheta",
"local theta segments",
id, 128, -3.2, 3.2,
"Segments");
1151 histos->fill1DHistByType((chisq / nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id, 110, -0.05, 10.5,
"Segments");
1152 histos->fill1DHistByType(
1153 chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id, 110, -0.05, 1.05,
"Segments");
1154 histos->fill1DHist(globTheta,
"hSGlobalTheta",
"segment global theta", 128, 0, 3.2,
"Segments");
1155 histos->fill1DHist(globPhi,
"hSGlobalPhi",
"segment global phi", 128, -3.2, 3.2,
"Segments");
1157 chamberSerial(
id),
nhits,
"hSnHitsProfile",
"N hits on Segments", 601, -0.5, 600.5, -0.5, 7.5,
"Segments");
1159 histos->fill1DHistByChamber(
nhits,
"hSnHits",
"N hits on Segments",
id, 8, -0.5, 7.5,
"HitsOnSegmentByChamber");
1160 histos->fill1DHistByChamber(
theta,
"hSTheta",
"local theta segments",
id, 128, -3.2, 3.2,
"DetailedSegments");
1161 histos->fill1DHistByChamber(
1162 (chisq / nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id, 110, -0.05, 10.5,
"SegChi2ByChamber");
1163 histos->fill1DHistByChamber(
1164 chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id, 110, -0.05, 1.05,
"SegChi2ByChamber");
1172 histos->fill1DHist(nSegments,
"hSnSegments",
"Segments per Event", 31, -0.5, 30.5,
"Segments");
1187 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1188 int nRH = (*dSiter).nRecHits();
1190 CLHEP::HepMatrix sp(6, 1);
1191 CLHEP::HepMatrix se(6, 1);
1192 for (std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1195 int kRing = idRH.
ring();
1196 int kStation = idRH.
station();
1200 int centerid = iRH->nStrips() / 2;
1201 int centerStrip = iRH->channels(centerid);
1205 float stpos = (*iRH).positionWithinStrip();
1206 se(
kLayer, 1) = (*iRH).errorWithinStrip();
1208 if (kStation == 1 && (kRing == 1 || kRing == 4))
1209 sp(
kLayer, 1) = stpos + centerStrip;
1212 sp(
kLayer, 1) = stpos + centerStrip;
1214 sp(
kLayer, 1) = stpos - 0.5 + centerStrip;
1219 float residual = -99;
1223 float expected = fitX(sp, se);
1224 residual = expected - sp(3, 1);
1225 pull = residual / se(3, 1);
1229 histos->fill1DHistByType(
1230 residual,
"hSResid",
"Fitted Position on Strip - Reconstructed for Layer 3",
id, 100, -0.5, 0.5,
"Resolution");
1231 histos->fill1DHistByType(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id, 100, -5.0, 5.0,
"Resolution");
1232 histos->fillProfile(chamberSerial(
id),
1235 "Fitted Position on Strip - Reconstructed for Layer 3",
1243 histos->fill1DHistByChamber(residual,
1245 "Fitted Position on Strip - Reconstructed for Layer 3",
1250 "DetailedResolution");
1251 histos->fill1DHistByChamber(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id, 100, -5.0, 5.0,
"Resolution");
1263 int nSAMuons = saMuons->size();
1264 histos->fill1DHist(nSAMuons,
"trNSAMuons",
"N Standalone Muons per Event", 6, -0.5, 5.5,
"STAMuons");
1266 for (reco::TrackCollection::const_iterator
muon = saMuons->begin();
muon != saMuons->end(); ++
muon) {
1267 float preco =
muon->p();
1268 float ptreco =
muon->pt();
1269 int n =
muon->recHitsSize();
1271 float normchi2 =
muon->normalizedChi2();
1283 std::vector<CSCDetId> staChambers;
1285 const DetId detId((*hit)->geographicalId());
1290 if (rpcId.region() == 1) {
1294 if (rpcId.region() == -1) {
1303 staChambers.push_back(detId.rawId());
1305 if (cscId.endcap() == 1) {
1309 if (cscId.endcap() == 2) {
1322 double crudeLength = deltaPnt.
mag();
1323 double deltaPhi = innerPnt.phi() - outerPnt.phi();
1324 double innerGlobalPolarAngle = innerKin.theta();
1325 double outerGlobalPolarAngle = outerKin.theta();
1328 histos->fill1DHist(
n,
"trN",
"N hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1330 histos->fill1DHist(
np,
"trNp",
"N hits on a STA Muon Track (plus endcap)", 51, -0.5, 50.5,
"STAMuons");
1332 histos->fill1DHist(nm,
"trNm",
"N hits on a STA Muon Track (minus endcap)", 51, -0.5, 50.5,
"STAMuons");
1333 histos->fill1DHist(nDTHits,
"trNDT",
"N DT hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1334 histos->fill1DHist(nCSCHits,
"trNCSC",
"N CSC hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1336 histos->fill1DHist(nCSCHitsp,
"trNCSCp",
"N CSC hits on a STA Muon Track (+ endcap)", 51, -0.5, 50.5,
"STAMuons");
1338 histos->fill1DHist(nCSCHitsm,
"trNCSCm",
"N CSC hits on a STA Muon Track (- endcap)", 51, -0.5, 50.5,
"STAMuons");
1339 histos->fill1DHist(nRPCHits,
"trNRPC",
"N RPC hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1341 histos->fill1DHist(nRPCHitsp,
"trNRPCp",
"N RPC hits on a STA Muon Track (+ endcap)", 51, -0.5, 50.5,
"STAMuons");
1343 histos->fill1DHist(nRPCHitsm,
"trNRPCm",
"N RPC hits on a STA Muon Track (- endcap)", 51, -0.5, 50.5,
"STAMuons");
1344 histos->fill1DHist(preco,
"trP",
"STA Muon Momentum", 100, 0, 300,
"STAMuons");
1345 histos->fill1DHist(ptreco,
"trPT",
"STA Muon pT", 100, 0, 40,
"STAMuons");
1346 histos->fill1DHist(
chi2,
"trChi2",
"STA Muon Chi2", 100, 0, 200,
"STAMuons");
1347 histos->fill1DHist(normchi2,
"trNormChi2",
"STA Muon Normalized Chi2", 100, 0, 10,
"STAMuons");
1348 histos->fill1DHist(crudeLength,
"trLength",
"Straight Line Length of STA Muon", 120, 0., 2400.,
"STAMuons");
1350 deltaPhi,
"trDeltaPhi",
"Delta-Phi Between Inner and Outer STA Muon Pos.", 100, -0.5, 0.5,
"STAMuons");
1352 innerGlobalPolarAngle,
"trInnerPolar",
"Polar Angle of Inner P Vector (STA muons)", 128, 0, 3.2,
"STAMuons");
1354 outerGlobalPolarAngle,
"trOuterPolar",
"Polar Angle of Outer P Vector (STA muons)", 128, 0, 3.2,
"STAMuons");
1355 histos->fill1DHist(innerPnt.phi(),
"trInnerPhi",
"Phi of Inner Position (STA muons)", 256, -3.2, 3.2,
"STAMuons");
1356 histos->fill1DHist(outerPnt.phi(),
"trOuterPhi",
"Phi of Outer Position (STA muons)", 256, -3.2, 3.2,
"STAMuons");
1365 int st =
id.station();
1367 int ch =
id.chamber();
1368 int ec =
id.endcap();
1370 if (st == 1 && ri == 1)
1372 if (st == 1 && ri == 2)
1374 if (st == 1 && ri == 3)
1376 if (st == 1 && ri == 4)
1378 if (st == 2 && ri == 1)
1380 if (st == 2 && ri == 2)
1382 if (st == 3 && ri == 1)
1384 if (st == 3 && ri == 2)
1386 if (st == 4 && ri == 1)
1388 if (st == 4 && ri == 2)
1391 kSerial = kSerial + 300;
1400 int st =
id.station();
1402 int ec =
id.endcap();
1404 if (st == 1 && ri == 1)
1406 if (st == 1 && ri == 2)
1408 if (st == 1 && ri == 3)
1410 if (st == 1 && ri == 4)
1419 kSerial = kSerial * (-1);
1436 for (
int i = 1;
i < 7;
i++) {
1439 S =
S + (1 / sigma2);
1440 Sy = Sy + (
points(
i, 1) / sigma2);
1441 Sx = Sx + ((
i) / sigma2);
1442 Sxx = Sxx + (
i *
i) / sigma2;
1443 Sxy = Sxy + (((
i)*
points(
i, 1)) / sigma2);
1447 float delta =
S * Sxx - Sx * Sx;
1448 float intercept = (Sxx * Sy - Sx * Sxy) /
delta;
1460 return (intercept +
slope * 3);
1473 bool allWires[2][4][4][36][6];
1474 bool allStrips[2][4][4][36][6];
1475 bool AllRecHits[2][4][4][36][6];
1476 bool AllSegments[2][4][4][36];
1479 for (
int iE = 0; iE < 2; iE++) {
1480 for (
int iS = 0; iS < 4; iS++) {
1481 for (
int iR = 0; iR < 4; iR++) {
1482 for (
int iC = 0; iC < 36; iC++) {
1483 AllSegments[iE][iS][iR][iC] =
false;
1485 for (
int iL = 0; iL < 6; iL++) {
1486 allWires[iE][iS][iR][iC][iL] =
false;
1487 allStrips[iE][iS][iR][iC][iL] =
false;
1488 AllRecHits[iE][iS][iR][iC][iL] =
false;
1499 std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
1500 std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
1501 for (; wireIter != lWire; ++wireIter) {
1511 std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
1512 std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
1513 for (; stripIter != lStrip; ++stripIter) {
1514 std::vector<int> myADCVals = stripIter->getADCCounts();
1515 bool thisStripFired =
false;
1516 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1519 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
1520 diff = (
float)myADCVals[iCount] - thisPedestal;
1522 thisStripFired =
true;
1526 if (thisStripFired) {
1543 std::vector<unsigned int> seg_ME2(2, 0);
1544 std::vector<unsigned int> seg_ME3(2, 0);
1545 std::vector<std::pair<CSCDetId, CSCSegment> > theSegments(4);
1558 unsigned int seg_tmp;
1560 ++seg_ME2[idseg.
endcap() - 1];
1561 seg_tmp = seg_ME2[idseg.
endcap() - 1];
1563 ++seg_ME3[idseg.
endcap() - 1];
1564 seg_tmp = seg_ME3[idseg.
endcap() - 1];
1567 if (1 == seg_tmp && 6 == (*segEffIt).nRecHits() && (*segEffIt).chi2() / (*segEffIt).degreesOfFreedom() < 3.) {
1568 std::pair<CSCDetId, CSCSegment> specSeg = make_pair((
CSCDetId)(*segEffIt).cscDetId(), *segEffIt);
1569 theSegments[2 * (idseg.
endcap() - 1) + (idseg.
station() - 2)] = specSeg;
1590 for (
int iE = 0; iE < 2; iE++) {
1591 for (
int iS = 0; iS < 4; iS++) {
1592 for (
int iR = 0; iR < 4; iR++) {
1593 for (
int iC = 0; iC < 36; iC++) {
1594 int NumberOfLayers = 0;
1595 for (
int iL = 0; iL < 6; iL++) {
1596 if (AllRecHits[iE][iS][iR][iC][iL]) {
1602 bin = iR + 1 + (iE * 10);
1604 bin = (iS + 1) * 2 + (iR + 1) + (iE * 10);
1605 if (NumberOfLayers > 1) {
1607 if (AllSegments[iE][iS][iR][iC]) {
1609 hSSTE->AddBinContent(
bin);
1612 hSSTE->AddBinContent(20 +
bin);
1615 if (AllSegments[iE][iS][iR][iC]) {
1616 if (NumberOfLayers == 6) {
1618 hRHSTE->AddBinContent(
bin);
1622 hRHSTE->AddBinContent(20 +
bin);
1631 std::vector<std::pair<CSCDetId, CSCSegment>*> theSeg;
1632 if (1 == seg_ME2[0])
1633 theSeg.push_back(&theSegments[0]);
1634 if (1 == seg_ME3[0])
1635 theSeg.push_back(&theSegments[1]);
1636 if (1 == seg_ME2[1])
1637 theSeg.push_back(&theSegments[2]);
1638 if (1 == seg_ME3[1])
1639 theSeg.push_back(&theSegments[3]);
1644 std::map<std::string, float> chamberTypes;
1645 chamberTypes[
"ME1/a"] = 0.5;
1646 chamberTypes[
"ME1/b"] = 1.5;
1647 chamberTypes[
"ME1/2"] = 2.5;
1648 chamberTypes[
"ME1/3"] = 3.5;
1649 chamberTypes[
"ME2/1"] = 4.5;
1650 chamberTypes[
"ME2/2"] = 5.5;
1651 chamberTypes[
"ME3/1"] = 6.5;
1652 chamberTypes[
"ME3/2"] = 7.5;
1653 chamberTypes[
"ME4/1"] = 8.5;
1655 if (!theSeg.empty()) {
1656 std::map<int, GlobalPoint> extrapolatedPoint;
1657 std::map<int, GlobalPoint>::iterator it;
1660 for (
size_t nCh = 0; nCh < ChamberContainer.size(); nCh++) {
1661 const CSCChamber* cscchamber = ChamberContainer[nCh];
1662 std::pair<CSCDetId, CSCSegment>* thisSegment =
nullptr;
1663 for (
size_t iSeg = 0; iSeg < theSeg.size(); ++iSeg) {
1664 if (cscchamber->
id().
endcap() == theSeg[iSeg]->first.endcap()) {
1666 if (2 == theSeg[iSeg]->
first.station()) {
1667 thisSegment = theSeg[iSeg];
1670 if (3 == theSeg[iSeg]->
first.station()) {
1671 thisSegment = theSeg[iSeg];
1683 it = extrapolatedPoint.find(
int(cscchamberCenter.
z()));
1684 if (it == extrapolatedPoint.end()) {
1687 double paramaterLine = lineParametrization(segPos.
z(), cscchamberCenter.
z(), segDir.
z());
1688 double xExtrapolated = extrapolate1D(segPos.
x(), segDir.
x(), paramaterLine);
1689 double yExtrapolated = extrapolate1D(segPos.
y(), segDir.
y(), paramaterLine);
1690 GlobalPoint globP(xExtrapolated, yExtrapolated, cscchamberCenter.
z());
1691 extrapolatedPoint[
int(cscchamberCenter.
z())] = globP;
1694 LocalPoint extrapolatedPointLocal = cscchamber->
toLocal(extrapolatedPoint[
int(cscchamberCenter.
z())]);
1697 const std::array<const float, 4>& layerBounds = layerGeom->
parameters();
1698 float shiftFromEdge = 15.;
1699 float shiftFromDeadZone = 10.;
1701 bool pass = withinSensitiveRegion(extrapolatedPointLocal,
1714 for (
int iL = 0; iL < 6; ++iL) {
1722 if (cscchamberCenter.
z() < 0) {
1723 verticalScale = -verticalScale;
1725 verticalScale += 9.5;
1726 hSensitiveAreaEvt->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1727 if (nRHLayers > 1) {
1732 hEffDenominator->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1736 hSSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale));
1739 for (
int iL = 0; iL < 6; ++iL) {
1745 hRHSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1752 hWireSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1758 hStripSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1773 float EffError = 0.;
1774 if (fabs(Norm) > 0.000000001) {
1785 std::vector<float> eff(2);
1786 int Nbins = readHisto->GetSize() - 2;
1789 std::vector<float> EffError(
Nbins);
1792 for (
int i = 0;
i < 20;
i++) {
1793 Num = readHisto->GetBinContent(
i + 1);
1794 Den = readHisto->GetBinContent(
i + 21);
1795 getEfficiency(Num, Den, eff);
1797 EffError[
i] = eff[1];
1799 writeHisto->SetBinError(
i + 1, EffError[
i]);
1804 const std::array<const float, 4>& layerBounds,
1807 float shiftFromEdge,
1808 float shiftFromDeadZone) {
1812 float y_center = 0.;
1813 double yUp = layerBounds[3] + y_center;
1814 double yDown = -layerBounds[3] + y_center;
1815 double xBound1Shifted = layerBounds[0] - shiftFromEdge;
1816 double xBound2Shifted = layerBounds[1] - shiftFromEdge;
1817 double lineSlope = (yUp - yDown) / (xBound2Shifted - xBound1Shifted);
1818 double lineConst = yUp - lineSlope * xBound2Shifted;
1819 double yBorder = lineSlope *
abs(localPos.
x()) + lineConst;
1822 std::vector<float> deadZoneCenter(6);
1823 float cutZone = shiftFromDeadZone;
1827 deadZoneCenter[0] = -162.48;
1828 deadZoneCenter[1] = -81.8744;
1829 deadZoneCenter[2] = -21.18165;
1830 deadZoneCenter[3] = 39.51105;
1831 deadZoneCenter[4] = 100.2939;
1832 deadZoneCenter[5] = 160.58;
1834 if (localPos.
y() > yBorder &&
1835 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1836 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1837 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone) ||
1838 (localPos.
y() > deadZoneCenter[3] + cutZone && localPos.
y() < deadZoneCenter[4] - cutZone) ||
1839 (localPos.
y() > deadZoneCenter[4] + cutZone && localPos.
y() < deadZoneCenter[5] - cutZone))) {
1842 }
else if (1 ==
ring) {
1844 deadZoneCenter[0] = -95.80;
1845 deadZoneCenter[1] = -27.47;
1846 deadZoneCenter[2] = 33.67;
1847 deadZoneCenter[3] = 90.85;
1849 deadZoneCenter[0] = -89.305;
1850 deadZoneCenter[1] = -39.705;
1851 deadZoneCenter[2] = 20.195;
1852 deadZoneCenter[3] = 77.395;
1854 deadZoneCenter[0] = -75.645;
1855 deadZoneCenter[1] = -26.055;
1856 deadZoneCenter[2] = 23.855;
1857 deadZoneCenter[3] = 70.575;
1859 if (localPos.
y() > yBorder &&
1860 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1861 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1862 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1868 deadZoneCenter[0] = -83.155;
1869 deadZoneCenter[1] = -22.7401;
1870 deadZoneCenter[2] = 27.86665;
1871 deadZoneCenter[3] = 81.005;
1872 if (localPos.
y() > yBorder &&
1873 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1874 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1875 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1878 }
else if (2 ==
ring) {
1879 deadZoneCenter[0] = -86.285;
1880 deadZoneCenter[1] = -32.88305;
1881 deadZoneCenter[2] = 32.867423;
1882 deadZoneCenter[3] = 88.205;
1883 if (localPos.
y() > (yBorder) &&
1884 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1885 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1886 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1890 deadZoneCenter[0] = -81.0;
1891 deadZoneCenter[1] = 81.0;
1892 if (localPos.
y() > (yBorder) &&
1893 (localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone)) {
1920 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
1924 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
1925 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
1926 for (; digiItr !=
last; ++digiItr) {
1927 int thisStrip = digiItr->getStrip();
1928 if (thisStrip == (centerStrip)) {
1929 std::vector<int> myADCVals = digiItr->getADCCounts();
1930 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1931 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1932 SigADC[0] = thisSignal - 6 * thisPedestal;
1935 if (thisStrip == (centerStrip + 1)) {
1936 std::vector<int> myADCVals = digiItr->getADCCounts();
1937 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1938 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1939 SigADC[1] = thisSignal - 6 * thisPedestal;
1941 if (thisStrip == (centerStrip + 2)) {
1942 std::vector<int> myADCVals = digiItr->getADCCounts();
1943 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1944 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1945 SigADC[2] = thisSignal - 6 * thisPedestal;
1947 if (thisStrip == (centerStrip - 1)) {
1948 std::vector<int> myADCVals = digiItr->getADCCounts();
1949 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1950 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1951 SigADC[3] = thisSignal - 6 * thisPedestal;
1953 if (thisStrip == (centerStrip - 2)) {
1954 std::vector<int> myADCVals = digiItr->getADCCounts();
1955 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1956 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1957 SigADC[4] = thisSignal - 6 * thisPedestal;
1960 TotalADC = 0.2 * (SigADC[0] + SigADC[1] + SigADC[2] + SigADC[3] + SigADC[4]);
1976 for (recIt =
recHits->begin(); recIt !=
recHits->end(); recIt++) {
1980 AllRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idrec, *recIt));
1983 int centerid = recIt->nStrips() / 2;
1984 int centerStrip = recIt->channels(centerid);
1986 float rHsignal = getthisSignal(*
strips, idrec, centerStrip);
1988 rHsignal,
"hrHSignal",
"Signal in the 4th time bin for centre strip", 1100, -99, 1000,
"recHits");
1992 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
1993 for (std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1996 float xrec = lpRH.
x();
1997 float yrec = lpRH.
y();
1998 float zrec = lpRH.
z();
1999 bool RHalreadyinMap =
false;
2001 multimap<CSCDetId, CSCRecHit2D>::iterator segRHit;
2002 segRHit = SegRechits.find(idRH);
2003 if (segRHit != SegRechits.end()) {
2004 for (; segRHit != SegRechits.upper_bound(idRH); ++segRHit) {
2006 LocalPoint lposRH = (segRHit->second).localPosition();
2007 float xpos = lposRH.
x();
2008 float ypos = lposRH.
y();
2009 float zpos = lposRH.
z();
2010 if (xrec == xpos && yrec == ypos && zrec == zpos) {
2011 RHalreadyinMap =
true;
2017 if (!RHalreadyinMap) {
2018 SegRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idRH, *iRH));
2023 findNonAssociatedRecHits(cscGeom,
strips);
2034 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator allRHiter = AllRechits.begin(); allRHiter != AllRechits.end();
2037 LocalPoint lpRH = (allRHiter->second).localPosition();
2038 float xrec = lpRH.
x();
2039 float yrec = lpRH.
y();
2040 float zrec = lpRH.
z();
2042 bool foundmatch =
false;
2043 multimap<CSCDetId, CSCRecHit2D>::iterator segRHit;
2044 segRHit = SegRechits.find(idRH);
2045 if (segRHit != SegRechits.end()) {
2046 for (; segRHit != SegRechits.upper_bound(idRH); ++segRHit) {
2047 LocalPoint lposRH = (segRHit->second).localPosition();
2048 float xpos = lposRH.
x();
2049 float ypos = lposRH.
y();
2050 float zpos = lposRH.
z();
2052 if (xrec == xpos && yrec == ypos && zrec == zpos) {
2057 float dclose = 1000.;
2060 d =
sqrt(
pow(xrec - xpos, 2) +
pow(yrec - ypos, 2) +
pow(zrec - zpos, 2));
2063 if (distRHmap.find((allRHiter->second)) ==
2065 distRHmap.insert(make_pair(allRHiter->second, dclose));
2068 distRHmap.erase(allRHiter->second);
2070 make_pair(allRHiter->second, dclose));
2077 NonAssociatedRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idRH, allRHiter->second));
2081 for (std::map<CSCRecHit2D, float, ltrh>::iterator iter = distRHmap.begin(); iter != distRHmap.end(); ++iter) {
2082 histos->fill1DHist(iter->second,
2084 "Distance of Non Associated RecHit from closest Segment RecHit",
2088 "NonAssociatedRechits");
2091 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator iter = NonAssociatedRechits.begin();
2092 iter != NonAssociatedRechits.end();
2095 int kEndcap = idrec.
endcap();
2096 int cEndcap = idrec.
endcap();
2099 int kRing = idrec.
ring();
2100 int kStation = idrec.
station();
2101 int kChamber = idrec.
chamber();
2105 LocalPoint rhitlocal = (iter->second).localPosition();
2106 float xreco = rhitlocal.
x();
2107 float yreco = rhitlocal.
y();
2110 int centerid = (iter->second).
nStrips() / 2;
2111 int centerStrip = (iter->second).
channels(centerid);
2115 float sumsides = 0.;
2117 for (
unsigned int i = 0;
i < (iter->second).
nStrips();
i++) {
2118 for (
unsigned int j = 0;
j < (iter->second).
nTimeBins() - 1;
j++) {
2119 rHSumQ += (iter->second).adcs(
i,
j);
2121 sumsides += (iter->second).adcs(
i,
j);
2125 float rHratioQ = sumsides / rHSumQ;
2130 float rHtime = (iter->second).tpeak() / 50;
2133 int rHwidth = getWidth(*
strips, idrec, centerStrip);
2140 float grecx = rhitglobal.
x();
2141 float grecy = rhitglobal.
y();
2144 int kCodeBroad = cEndcap * (4 * (kStation - 1) + kRing);
2145 int kCodeNarrow = cEndcap * (100 * (kRing - 1) + kChamber);
2149 kCodeBroad,
"hNARHCodeBroad",
"broad scope code for recHits", 33, -16.5, 16.5,
"NonAssociatedRechits");
2151 histos->fill1DHist(kCodeNarrow,
2153 "narrow scope recHit code station 1",
2157 "NonAssociatedRechits");
2159 histos->fill1DHist(kCodeNarrow,
2161 "narrow scope recHit code station 2",
2165 "NonAssociatedRechits");
2167 histos->fill1DHist(kCodeNarrow,
2169 "narrow scope recHit code station 3",
2173 "NonAssociatedRechits");
2175 histos->fill1DHist(kCodeNarrow,
2177 "narrow scope recHit code station 4",
2181 "NonAssociatedRechits");
2182 histos->fill1DHistByType(
kLayer,
"hNARHLayer",
"RecHits per Layer", idrec, 8, -0.5, 7.5,
"NonAssociatedRechits");
2183 histos->fill1DHistByType(xreco,
"hNARHX",
"Local X of recHit", idrec, 160, -80., 80.,
"NonAssociatedRechits");
2184 histos->fill1DHistByType(yreco,
"hNARHY",
"Local Y of recHit", idrec, 60, -180., 180.,
"NonAssociatedRechits");
2185 if (kStation == 1 && (kRing == 1 || kRing == 4))
2186 histos->fill1DHistByType(
2187 rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 4000,
"NonAssociatedRechits");
2189 histos->fill1DHistByType(
2190 rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 2000,
"NonAssociatedRechits");
2191 histos->fill1DHistByType(
2192 rHratioQ,
"hNARHRatioQ",
"Ratio (Ql+Qr)/Qt)", idrec, 120, -0.1, 1.1,
"NonAssociatedRechits");
2193 histos->fill1DHistByType(rHtime,
"hNARHTiming",
"recHit Timing", idrec, 200, -10, 10,
"NonAssociatedRechits");
2194 histos->fill2DHistByStation(grecx,
2197 "recHit Global Position",
2205 "NonAssociatedRechits");
2206 histos->fill1DHistByType(
2207 rHwidth,
"hNARHwidth",
"width for Non associated recHit", idrec, 21, -0.5, 20.5,
"NonAssociatedRechits");
2210 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator iter = SegRechits.begin(); iter != SegRechits.end(); ++iter) {
2212 int kEndcap = idrec.
endcap();
2213 int cEndcap = idrec.
endcap();
2216 int kRing = idrec.
ring();
2217 int kStation = idrec.
station();
2218 int kChamber = idrec.
chamber();
2222 LocalPoint rhitlocal = (iter->second).localPosition();
2223 float xreco = rhitlocal.
x();
2224 float yreco = rhitlocal.
y();
2227 int centerid = (iter->second).
nStrips() / 2;
2228 int centerStrip = (iter->second).
channels(centerid);
2233 float sumsides = 0.;
2235 for (
unsigned int i = 0;
i < (iter->second).
nStrips();
i++) {
2236 for (
unsigned int j = 0;
j < (iter->second).
nTimeBins() - 1;
j++) {
2237 rHSumQ += (iter->second).adcs(
i,
j);
2239 sumsides += (iter->second).adcs(
i,
j);
2243 float rHratioQ = sumsides / rHSumQ;
2248 float rHtime = (iter->second).tpeak() / 50;
2251 int rHwidth = getWidth(*
strips, idrec, centerStrip);
2258 float grecx = rhitglobal.
x();
2259 float grecy = rhitglobal.
y();
2262 int kCodeBroad = cEndcap * (4 * (kStation - 1) + kRing);
2263 int kCodeNarrow = cEndcap * (100 * (kRing - 1) + kChamber);
2267 kCodeBroad,
"hSegRHCodeBroad",
"broad scope code for recHits", 33, -16.5, 16.5,
"AssociatedRechits");
2269 histos->fill1DHist(kCodeNarrow,
2270 "hSegRHCodeNarrow1",
2271 "narrow scope recHit code station 1",
2275 "AssociatedRechits");
2277 histos->fill1DHist(kCodeNarrow,
2278 "hSegRHCodeNarrow2",
2279 "narrow scope recHit code station 2",
2283 "AssociatedRechits");
2285 histos->fill1DHist(kCodeNarrow,
2286 "hSegRHCodeNarrow3",
2287 "narrow scope recHit code station 3",
2291 "AssociatedRechits");
2293 histos->fill1DHist(kCodeNarrow,
2294 "hSegRHCodeNarrow4",
2295 "narrow scope recHit code station 4",
2299 "AssociatedRechits");
2300 histos->fill1DHistByType(
kLayer,
"hSegRHLayer",
"RecHits per Layer", idrec, 8, -0.5, 7.5,
"AssociatedRechits");
2301 histos->fill1DHistByType(xreco,
"hSegRHX",
"Local X of recHit", idrec, 160, -80., 80.,
"AssociatedRechits");
2302 histos->fill1DHistByType(yreco,
"hSegRHY",
"Local Y of recHit", idrec, 60, -180., 180.,
"AssociatedRechits");
2303 if (kStation == 1 && (kRing == 1 || kRing == 4))
2304 histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 4000,
"AssociatedRechits");
2306 histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 2000,
"AssociatedRechits");
2307 histos->fill1DHistByType(rHratioQ,
"hSegRHRatioQ",
"Ratio (Ql+Qr)/Qt)", idrec, 120, -0.1, 1.1,
"AssociatedRechits");
2308 histos->fill1DHistByType(rHtime,
"hSegRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"AssociatedRechits");
2309 histos->fill2DHistByStation(grecx,
2312 "recHit Global Position",
2320 "AssociatedRechits");
2321 histos->fill1DHistByType(
2322 rHwidth,
"hSegRHwidth",
"width for Non associated recHit", idrec, 21, -0.5, 20.5,
"AssociatedRechits");
2328 NonAssociatedRechits.clear();
2337 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
2342 vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2343 vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2347 if (St == 1 &&
Rg == 4) {
2348 while (centerStrip > 16)
2351 for (; digiItr !=
last; ++digiItr) {
2352 int thisStrip = digiItr->getStrip();
2354 std::vector<int> myADCVals = digiItr->getADCCounts();
2355 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2357 if (thisStrip == (centerStrip)) {
2358 thisADC =
Signal - thisPedestal;
2364 if (thisStrip == (centerStrip + 1)) {
2365 std::vector<int> myADCVals = digiItr->getADCCounts();
2367 if (thisStrip == (centerStrip - 1)) {
2368 std::vector<int> myADCVals = digiItr->getADCCounts();
2391 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
2394 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2395 std::vector<CSCStripDigi>::const_iterator
first = (*sIt).second.first;
2396 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2397 std::vector<CSCStripDigi>::const_iterator it = (*sIt).second.first;
2398 std::vector<CSCStripDigi>::const_iterator
itr = (*sIt).second.first;
2402 if (St == 1 &&
Rg == 4) {
2403 while (centerStrip > 16)
2406 for (; digiItr !=
last; ++digiItr) {
2407 int thisStrip = digiItr->getStrip();
2408 if (thisStrip == (centerStrip)) {
2410 for (; it !=
last; ++it) {
2411 int strip = it->getStrip();
2412 std::vector<int> myADCVals = it->getADCCounts();
2413 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2414 if (((
float)myADCVals[3] - thisPedestal) < 6 || widthpos == 10 || it ==
last) {
2417 if (
strip != centerStrip) {
2424 std::vector<int> myADCVals =
itr->getADCCounts();
2425 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2426 if (((
float)myADCVals[3] - thisPedestal) < 6 || widthneg == 10 ||
itr ==
first) {
2429 if (
strip != centerStrip) {
2451 int channel = 0,
mult, wire, layer, idlayer, idchamber,
ring;
2452 int wire_strip_rechit_present;
2456 std::map<int, int>::iterator intIt;
2458 m_single_wire_layer.clear();
2463 m_wire_hvsegm.clear();
2464 std::map<int, std::vector<int> >::iterator intvecIt;
2466 int csctype[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
2467 int hvsegm_layer[10] = {1, 1, 3, 3, 3, 5, 3, 5, 3, 5};
2470 for (
int i = 0;
i < 10;
i++)
2471 nmbhvsegm.push_back(hvsegm_layer[
i]);
2473 std::vector<int> zer_1_1a(49, 0);
2475 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2476 m_wire_hvsegm[
id] = zer_1_1a;
2477 intvecIt = m_wire_hvsegm.find(
id);
2478 for (
int wire = 1; wire <= 48; wire++)
2479 intvecIt->second[wire] = 1;
2482 std::vector<int> zer_1_1b(49, 0);
2484 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2485 m_wire_hvsegm[
id] = zer_1_1b;
2486 intvecIt = m_wire_hvsegm.find(
id);
2487 for (
int wire = 1; wire <= 48; wire++)
2488 intvecIt->second[wire] = 1;
2491 std::vector<int> zer_1_2(65, 0);
2493 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2494 m_wire_hvsegm[
id] = zer_1_2;
2495 intvecIt = m_wire_hvsegm.find(
id);
2496 for (
int wire = 1; wire <= 24; wire++)
2497 intvecIt->second[wire] = 1;
2498 for (
int wire = 25; wire <= 48; wire++)
2499 intvecIt->second[wire] = 2;
2500 for (
int wire = 49; wire <= 64; wire++)
2501 intvecIt->second[wire] = 3;
2504 std::vector<int> zer_1_3(33, 0);
2506 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2507 m_wire_hvsegm[
id] = zer_1_3;
2508 intvecIt = m_wire_hvsegm.find(
id);
2509 for (
int wire = 1; wire <= 12; wire++)
2510 intvecIt->second[wire] = 1;
2511 for (
int wire = 13; wire <= 22; wire++)
2512 intvecIt->second[wire] = 2;
2513 for (
int wire = 23; wire <= 32; wire++)
2514 intvecIt->second[wire] = 3;
2517 std::vector<int> zer_2_1(113, 0);
2519 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2520 m_wire_hvsegm[
id] = zer_2_1;
2521 intvecIt = m_wire_hvsegm.find(
id);
2522 for (
int wire = 1; wire <= 44; wire++)
2523 intvecIt->second[wire] = 1;
2524 for (
int wire = 45; wire <= 80; wire++)
2525 intvecIt->second[wire] = 2;
2526 for (
int wire = 81; wire <= 112; wire++)
2527 intvecIt->second[wire] = 3;
2530 std::vector<int> zer_2_2(65, 0);
2532 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2533 m_wire_hvsegm[
id] = zer_2_2;
2534 intvecIt = m_wire_hvsegm.find(
id);
2535 for (
int wire = 1; wire <= 16; wire++)
2536 intvecIt->second[wire] = 1;
2537 for (
int wire = 17; wire <= 28; wire++)
2538 intvecIt->second[wire] = 2;
2539 for (
int wire = 29; wire <= 40; wire++)
2540 intvecIt->second[wire] = 3;
2541 for (
int wire = 41; wire <= 52; wire++)
2542 intvecIt->second[wire] = 4;
2543 for (
int wire = 53; wire <= 64; wire++)
2544 intvecIt->second[wire] = 5;
2547 std::vector<int> zer_3_1(97, 0);
2549 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2550 m_wire_hvsegm[
id] = zer_3_1;
2551 intvecIt = m_wire_hvsegm.find(
id);
2552 for (
int wire = 1; wire <= 32; wire++)
2553 intvecIt->second[wire] = 1;
2554 for (
int wire = 33; wire <= 64; wire++)
2555 intvecIt->second[wire] = 2;
2556 for (
int wire = 65; wire <= 96; wire++)
2557 intvecIt->second[wire] = 3;
2560 std::vector<int> zer_3_2(65, 0);
2562 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2563 m_wire_hvsegm[
id] = zer_3_2;
2564 intvecIt = m_wire_hvsegm.find(
id);
2565 for (
int wire = 1; wire <= 16; wire++)
2566 intvecIt->second[wire] = 1;
2567 for (
int wire = 17; wire <= 28; wire++)
2568 intvecIt->second[wire] = 2;
2569 for (
int wire = 29; wire <= 40; wire++)
2570 intvecIt->second[wire] = 3;
2571 for (
int wire = 41; wire <= 52; wire++)
2572 intvecIt->second[wire] = 4;
2573 for (
int wire = 53; wire <= 64; wire++)
2574 intvecIt->second[wire] = 5;
2577 std::vector<int> zer_4_1(97, 0);
2579 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2580 m_wire_hvsegm[
id] = zer_4_1;
2581 intvecIt = m_wire_hvsegm.find(
id);
2582 for (
int wire = 1; wire <= 32; wire++)
2583 intvecIt->second[wire] = 1;
2584 for (
int wire = 33; wire <= 64; wire++)
2585 intvecIt->second[wire] = 2;
2586 for (
int wire = 65; wire <= 96; wire++)
2587 intvecIt->second[wire] = 3;
2590 std::vector<int> zer_4_2(65, 0);
2592 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2593 m_wire_hvsegm[
id] = zer_4_2;
2594 intvecIt = m_wire_hvsegm.find(
id);
2595 for (
int wire = 1; wire <= 16; wire++)
2596 intvecIt->second[wire] = 1;
2597 for (
int wire = 17; wire <= 28; wire++)
2598 intvecIt->second[wire] = 2;
2599 for (
int wire = 29; wire <= 40; wire++)
2600 intvecIt->second[wire] = 3;
2601 for (
int wire = 41; wire <= 52; wire++)
2602 intvecIt->second[wire] = 4;
2603 for (
int wire = 53; wire <= 64; wire++)
2604 intvecIt->second[wire] = 5;
2609 wire_strip_rechit_present = 0;
2610 if (wirecltn.begin() != wirecltn.end())
2611 wire_strip_rechit_present = wire_strip_rechit_present + 1;
2612 if (strpcltn.begin() != strpcltn.end())
2613 wire_strip_rechit_present = wire_strip_rechit_present + 2;
2614 if (rechitcltn.begin() != rechitcltn.end())
2615 wire_strip_rechit_present = wire_strip_rechit_present + 4;
2617 if (wire_strip_rechit_present == 7) {
2624 for (wiredetUnitIt = wirecltn.begin(); wiredetUnitIt != wirecltn.end(); ++wiredetUnitIt) {
2625 const CSCDetId id = (*wiredetUnitIt).first;
2626 idlayer = indexer.
dbIndex(
id, channel);
2627 idchamber = idlayer / 10;
2634 wire = (*digiIt).getWireGroup();
2640 if (m_single_wire_layer.find(idlayer) == m_single_wire_layer.end())
2641 m_single_wire_layer[idlayer] = wire;
2649 for (recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2651 idlayer = indexer.
dbIndex(
id, channel);
2652 idchamber = idlayer / 10;
2655 if (m_single_wire_layer.find(idlayer) != m_single_wire_layer.end()) {
2656 if (recIt->nStrips() == 3) {
2658 unsigned int binmx = 0;
2661 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2662 for (
unsigned int j = 0;
j < recIt->nTimeBins();
j++)
2663 if (recIt->adcs(
i,
j) > adcmax) {
2664 adcmax = recIt->adcs(
i,
j);
2668 float adc_3_3_sum = 0.0;
2670 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2671 for (
unsigned int j = binmx - 1;
j <= binmx + 1;
j++)
2672 adc_3_3_sum += recIt->adcs(
i,
j);
2674 if (adc_3_3_sum > 0.0 && adc_3_3_sum < 2000.0) {
2677 if (
id.
station() == 1 &&
id.
ring() == 4 && recIt->channels(1) > 16)
2681 wire = m_single_wire_layer[idlayer];
2682 int chambertype =
id.iChamberType(
id.
station(),
id.
ring());
2683 int hvsgmtnmb = m_wire_hvsegm[chambertype][wire];
2684 int nmbofhvsegm = nmbhvsegm[chambertype - 1];
2685 int location = (layer - 1) * nmbofhvsegm + hvsgmtnmb;
2687 ss <<
"gas_gain_rechit_adc_3_3_sum_location_ME_" << idchamber;
2697 ss <<
"Gas Gain Rechit ADC3X3 Sum ME" << endcapstr <<
id.station() <<
"/" <<
ring <<
"/" <<
id.chamber();
2701 float y = adc_3_3_sum;
2702 histos->fill2DHist(x, y,
name,
title, 30, 1.0, 31.0, 50, 0.0, 2000.0,
"GasGain");
2727 int wire, wiretbin, nmbwiretbin, layer, afeb, idlayer, idchamber;
2731 if (wirecltn.begin() != wirecltn.end()) {
2738 for (wiredetUnitIt = wirecltn.begin(); wiredetUnitIt != wirecltn.end(); ++wiredetUnitIt) {
2739 const CSCDetId id = (*wiredetUnitIt).first;
2740 idlayer = indexer.
dbIndex(
id, channel);
2741 idchamber = idlayer / 10;
2753 wire = (*digiIt).getWireGroup();
2754 wiretbin = (*digiIt).getTimeBin();
2755 nmbwiretbin = (*digiIt).getTimeBinsOn().size();
2756 afeb = 3 * ((wire - 1) / 8) + (layer + 1) / 2;
2761 ss <<
"afeb_time_bin_vs_afeb_occupancy_ME_" << idchamber;
2764 ss <<
"Time Bin vs AFEB Occupancy ME" << endcapstr <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
2767 histos->fill2DHist(x, y,
name,
title, 42, 1., 43., 16, 0., 16.,
"AFEBTiming");
2772 ss <<
"nmb_afeb_time_bins_vs_afeb_ME_" << idchamber;
2775 ss <<
"Number of Time Bins vs AFEB ME" << endcapstr <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
2778 histos->fill2DHist(x, y,
name,
title, 42, 1., 43., 16, 0., 16.,
"AFEBTiming");
2794 int strip, tbin, cfeb, idlayer, idchamber;
2798 if (compars.begin() != compars.end()) {
2805 for (compdetUnitIt = compars.begin(); compdetUnitIt != compars.end(); ++compdetUnitIt) {
2806 const CSCDetId id = (*compdetUnitIt).first;
2807 idlayer = indexer.
dbIndex(
id, channel);
2808 idchamber = idlayer / 10;
2817 strip = (*digiIt).getStrip();
2825 tbin = (*digiIt).getTimeBin();
2826 cfeb = (
strip - 1) / 16 + 1;
2832 ss <<
"comp_time_bin_vs_cfeb_occupancy_ME_" << idchamber;
2835 ss <<
"Comparator Time Bin vs CFEB Occupancy ME" <<
endcap <<
id.station() <<
"/" <<
id.ring() <<
"/"
2839 histos->fill2DHist(x, y,
name,
title, 5, 1., 6., 16, 0., 16.,
"CompTiming");
2852 float adc_3_3_sum, adc_3_3_wtbin, x, y;
2853 int cfeb, idchamber,
ring;
2857 std::vector<float> zer(6, 0.0);
2860 std::map<int, int>::iterator intIt;
2862 if (rechitcltn.begin() != rechitcltn.end()) {
2868 for (recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2871 if (recIt->nStrips() == 3) {
2874 unsigned int binmx = 0;
2877 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2878 for (
unsigned int j = 0;
j < recIt->nTimeBins();
j++)
2879 if (recIt->adcs(
i,
j) > adcmax) {
2880 adcmax = recIt->adcs(
i,
j);
2886 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2887 for (
unsigned int j = binmx - 1;
j <= binmx + 1;
j++)
2888 adc_3_3_sum += recIt->adcs(
i,
j);
2891 if (adc_3_3_sum > 100.0) {
2892 int centerStrip = recIt->channels(1);
2895 if (
id.
station() == 1 &&
id.
ring() == 4 && centerStrip > 16)
2899 adc_3_3_wtbin = (*recIt).tpeak() / 50;
2900 idchamber = indexer.
dbIndex(
id, centerStrip) / 10;
2908 ss <<
"adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_" << idchamber;
2920 ss <<
"ADC 3X3 Weighted Time Bin vs CFEB Occupancy ME" << endcapstr <<
id.station() <<
"/" <<
ring <<
"/"
2925 cfeb = (centerStrip - 1) / 16 + 1;
2928 histos->fill2DHist(x, y,
name,
title, 5, 1., 6., 80, -8., 8.,
"ADCTiming");
2950 map<CSCDetId, float> segment_median_map;
2951 map<CSCDetId, GlobalPoint> segment_position_map;
2961 LocalPoint localPos = (*dSiter).localPosition();
2965 globalPosition = cscchamber->
toGlobal(localPos);
2969 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
2970 int nRH = (*dSiter).nRecHits();
2975 vector<float> non_zero;
2977 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2978 non_zero.push_back(iRH->tpeak());
2983 sort(non_zero.begin(), non_zero.end());
2984 int middle_index = non_zero.size() / 2;
2985 float average_two = (non_zero.at(middle_index - 1) + non_zero.at(middle_index)) / 2.;
2986 if (non_zero.size() % 2)
2987 average_two = non_zero.at(middle_index);
2990 segment_median_map[
id] = average_two;
2991 segment_position_map[
id] = globalPosition;
2993 double distToIP =
sqrt(globalPosition.
x() * globalPosition.
x() + globalPosition.
y() * globalPosition.
y() +
2994 globalPosition.
z() * globalPosition.
z());
2996 histos->fillProfile(chamberSerial(
id),
2999 "Segment mean time",
3008 "timeChamberByType",
3009 "Segment mean time by chamber",
3017 histos->fill2DHist(distToIP,
3019 "seg_time_vs_distToIP",
3020 "Segment time vs. Distance to IP",
3028 histos->fill2DHist(globalPosition.
z(),
3030 "seg_time_vs_globZ",
3031 "Segment time vs. z position",
3039 histos->fill2DHist(fabs(globalPosition.
z()),
3041 "seg_time_vs_absglobZ",
3042 "Segment time vs. abs(z position)",
3054 map<CSCDetId, float>::const_iterator it_outer;
3055 map<CSCDetId, float>::const_iterator it_inner;
3056 for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++) {
3057 CSCDetId id_outer = it_outer->first;
3058 float t_outer = it_outer->second;
3061 for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++) {
3062 CSCDetId id_inner = it_inner->first;
3063 float t_inner = it_inner->second;
3068 if (chamberSerial(id_outer) == chamberSerial(id_inner))
3079 id_outer.
ring() == id_inner.
ring()) {
3080 histos->fill1DHist(t_outer - t_inner,
3081 "diff_opposite_endcaps",
3082 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3087 histos->fill1DHistByType(t_outer - t_inner,
3088 "diff_opposite_endcaps_byType",
3089 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3105 vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->
getRecords();
3106 vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
3107 int L1GMT_BXN = -100;
3108 bool has_CSCTrigger =
false;
3109 bool has_beamHaloTrigger =
false;
3110 for (igmtrr = L1Mrec.begin(); igmtrr != L1Mrec.end(); igmtrr++) {
3111 std::vector<L1MuRegionalCand>::const_iterator iter1;
3112 std::vector<L1MuRegionalCand> rmc;
3115 rmc = igmtrr->getCSCCands();
3116 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
3117 if (!(*iter1).empty()) {
3119 int kQuality = (*iter1).quality();
3121 has_beamHaloTrigger =
true;
3124 if (igmtrr->getBxInEvent() == 0 && icsc > 0) {
3126 L1GMT_BXN = igmtrr->getBxNr();
3127 has_CSCTrigger =
true;
3128 }
else if (igmtrr->getBxInEvent() == 0) {
3130 L1GMT_BXN = igmtrr->getBxNr();
3139 map<CSCDetId, int> ALCT_KeyWG_map;
3142 const CSCDetId& idALCT = (*j).first;
3145 if ((*digiIt).isValid()) {
3147 histos->fill1DHist((*digiIt).getBX(),
"ALCT_getBX",
"ALCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3149 (*digiIt).getFullBX(),
"ALCT_getFullBX",
"ALCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3151 if (ALCT_KeyWG_map.find(idALCT.
chamberId()) == ALCT_KeyWG_map.end()) {
3152 ALCT_KeyWG_map[idALCT.
chamberId()] = (*digiIt).getKeyWG();
3163 map<CSCDetId, int> CLCT_getFullBx_map;
3166 const CSCDetId& idCLCT = (*j).first;
3169 if ((*digiIt).isValid()) {
3171 histos->fill1DHist((*digiIt).getBX(),
"CLCT_getBX",
"CLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3173 (*digiIt).getFullBX(),
"CLCT_getFullBX",
"CLCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3175 if (CLCT_getFullBx_map.find(idCLCT.
chamberId()) == CLCT_getFullBx_map.end()) {
3176 CLCT_getFullBx_map[idCLCT.
chamberId()] = (*digiIt).getFullBX();
3186 int n_correlatedlcts = 0;
3190 if ((*digiIt).isValid()) {
3193 (*digiIt).getBX(),
"CorrelatedLCTS_getBX",
"CorrelatedLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3198 int nRecHits =
recHits->size();
3200 if (has_CSCTrigger) {
3201 histos->fill1DHist(L1GMT_BXN,
"BX_L1CSCCand",
"BX of L1 CSC Cand", 4001, -0.5, 4000.5,
"TimeMonitoring");
3202 histos->fill2DHist(L1GMT_BXN,
3204 "n_ALCTs_v_BX_L1CSCCand",
3205 "Number of ALCTs vs. BX of L1 CSC Cand",
3213 histos->fill2DHist(L1GMT_BXN,
3215 "n_CLCTs_v_BX_L1CSCCand",
3216 "Number of CLCTs vs. BX of L1 CSC Cand",
3224 histos->fill2DHist(L1GMT_BXN,
3226 "n_CorrelatedLCTs_v_BX_L1CSCCand",
3227 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand",
3235 histos->fill2DHist(L1GMT_BXN,
3237 "n_RecHits_v_BX_L1CSCCand",
3238 "Number of RecHits vs. BX of L1 CSC Cand",
3246 histos->fill2DHist(L1GMT_BXN,
3248 "n_Segments_v_BX_L1CSCCand",
3249 "Number of Segments vs. BX of L1 CSC Cand",
3258 if (has_CSCTrigger && has_beamHaloTrigger) {
3260 L1GMT_BXN,
"BX_L1CSCCand_w_beamHalo",
"BX of L1 CSC (w beamHalo bit)", 4001, -0.5, 4000.5,
"TimeMonitoring");
3261 histos->fill2DHist(L1GMT_BXN,
3263 "n_ALCTs_v_BX_L1CSCCand_w_beamHalo",
3264 "Number of ALCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3272 histos->fill2DHist(L1GMT_BXN,
3274 "n_CLCTs_v_BX_L1CSCCand_w_beamHalo",
3275 "Number of CLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3283 histos->fill2DHist(L1GMT_BXN,
3285 "n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo",
3286 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3294 histos->fill2DHist(L1GMT_BXN,
3296 "n_RecHits_v_BX_L1CSCCand_w_beamHalo",
3297 "Number of RecHits vs. BX of L1 CSC Cand (w beamHalo bit)",
3305 histos->fill2DHist(L1GMT_BXN,
3307 "n_Segments_v_BX_L1CSCCand_w_beamHalo",
3308 "Number of Segments vs. BX of L1 CSC Cand (w beamHalo bit)",
3330 event.getByToken(rd_token, rawdata);
3331 bool goodEvent =
false;
3335 unsigned long dccBinCheckMask = 0x06080016;
3336 unsigned int examinerMask = 0x1FEBF3F6;
3337 unsigned int errorMask = 0x0;
3346 unsigned long length = fedData.
size();
3350 std::stringstream examiner_out, examiner_err;
3355 if (examinerMask & 0x40000)
3357 if (examinerMask & 0x8000)
3359 if (examinerMask & 0x0400)
3361 examiner->
setMask(examinerMask);
3362 const short unsigned int*
data = (
short unsigned int*)fedData.
data();
3367 goodEvent = !(examiner->
errors() & dccBinCheckMask);
3376 const std::vector<CSCDDUEventData>& dduData = dccData.
dduData();
3381 for (
unsigned int iDDU = 0; iDDU < dduData.size(); ++iDDU) {
3384 if (dduData[iDDU].trailer().errorstat() & errorMask) {
3385 LogTrace(
"CSCDCCUnpacker|CSCRawToDigi") <<
"DDU# " << iDDU <<
" has serious error - no digis unpacked! "
3386 << std::hex << dduData[iDDU].trailer().errorstat();
3391 const std::vector<CSCEventData>& cscData = dduData[iDDU].cscData();
3392 for (
unsigned int iCSC = 0; iCSC < cscData.size(); ++iCSC) {
3394 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
3395 int dmb = cscData[iCSC].dmbHeader()->dmbID();
3403 if ((vmecrate >= 1) && (vmecrate <= 60) && (dmb >= 1) && (dmb <= 10) && (dmb != 6)) {
3404 layer = pcrate->
detId(vmecrate, dmb, icfeb, ilayer);
3406 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") <<
" detID input out of range!!! ";
3407 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
3408 <<
" skipping chamber vme= " << vmecrate <<
" dmb= " << dmb;
3413 int nalct = cscData[iCSC].dmbHeader()->nalct();
3414 bool goodALCT =
false;
3416 if (nalct && cscData[iCSC].alctHeader()) {
3417 if (cscData[iCSC].alctHeader()->
check()) {
3423 int nclct = cscData[iCSC].dmbHeader()->nclct();
3424 bool goodTMB =
false;
3425 if (nclct && cscData[iCSC].tmbData()) {
3426 if (cscData[iCSC].tmbHeader()->
check()) {
3427 if (cscData[iCSC].clctData()->
check())
3432 if (goodTMB && goodALCT) {
3433 if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
3434 printf(
"no ALCT info for Chamber %d %d %d %d \n",
3441 if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
3442 printf(
"no CLCT info for Chamber %d %d %d %d \n",
3449 int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
3450 int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
3452 const CSCTMBHeader* tmbHead = cscData[iCSC].tmbHeader();
3463 "TMB_ALCTMatchTime",
3464 "TMB_ALCTMatchTime",
3472 tmbHead->
BXNCount(),
"TMB_BXNCount",
"TMB_BXNCount", 3601, -0.5, 3600.5,
"TimeMonitoring");
3474 tmbHead->
ALCTMatchTime(),
"TMB_ALCTMatchTime",
"TMB_ALCTMatchTime", 7, -0.5, 6.5,
"TimeMonitoring");
3477 "TMB_ALCTMatchTime",
3478 "TMB_ALCTMatchTime",
3487 "prof_TMB_ALCTMatchTime",
3488 "prof_TMB_ALCTMatchTime",
3495 histos->fillProfile(ALCT0Key,
3497 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3498 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3505 histos->fillProfileByType(ALCT0Key,
3507 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3508 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3520 if (TMB_ALCT_rel_L1A > 3563)
3521 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
3522 if (TMB_ALCT_rel_L1A < 0)
3523 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
3527 TMB_ALCT_rel_L1A,
"h1D_TMB_ALCT_rel_L1A",
"h1D_TMB_ALCT_rel_L1A", 11, 144.5, 155.5,
"TimeMonitoring");
3530 "h2D_TMB_ALCT_rel_L1A",
3531 "h2D_TMB_ALCT_rel_L1A",
3541 "h2D_TMB_ALCT_rel_L1A_by_ring",
3542 "h2D_TMB_ALCT_rel_L1A_by_ring",
3552 "prof_TMB_ALCT_rel_L1A",
3553 "prof_TMB_ALCT_rel_L1A",
3562 "prof_TMB_ALCT_rel_L1A_by_ring",
3563 "prof_TMB_ALCT_rel_L1A_by_ring",
3571 histos->fill2DHist(ALCT0Key,
3573 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3574 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3582 histos->fillProfile(ALCT0Key,
3584 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3585 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3592 histos->fillProfileByType(ALCT0Key,
3594 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3595 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3608 if (examiner !=
nullptr)