25 isSimulation =
pset.getUntrackedParameter<
bool>(
"isSimulation",
false);
26 writeTreeToFile =
pset.getUntrackedParameter<
bool>(
"writeTreeToFile",
true);
28 useDigis =
pset.getUntrackedParameter<
bool>(
"useDigis",
true);
31 useQualityFilter =
pset.getUntrackedParameter<
bool>(
"useQualityFilter",
false);
32 pMin =
pset.getUntrackedParameter<
double>(
"pMin", 4.);
33 chisqMax =
pset.getUntrackedParameter<
double>(
"chisqMax", 20.);
34 nCSCHitsMin =
pset.getUntrackedParameter<
int>(
"nCSCHitsMin", 10);
35 nCSCHitsMax =
pset.getUntrackedParameter<
int>(
"nCSCHitsMax", 25);
36 lengthMin =
pset.getUntrackedParameter<
double>(
"lengthMin", 140.);
37 lengthMax =
pset.getUntrackedParameter<
double>(
"lengthMax", 600.);
38 deltaPhiMax =
pset.getUntrackedParameter<
double>(
"deltaPhiMax", 0.2);
39 polarMax =
pset.getUntrackedParameter<
double>(
"polarMax", 0.7);
40 polarMin =
pset.getUntrackedParameter<
double>(
"polarMin", 0.3);
43 useTriggerFilter =
pset.getUntrackedParameter<
bool>(
"useTriggerFilter",
false);
46 rd_token = consumes<FEDRawDataCollection>(
pset.getParameter<
edm::InputTag>(
"rawDataTag"));
47 sd_token = consumes<CSCStripDigiCollection>(
pset.getParameter<
edm::InputTag>(
"stripDigiTag"));
48 wd_token = consumes<CSCWireDigiCollection>(
pset.getParameter<
edm::InputTag>(
"wireDigiTag"));
49 cd_token = consumes<CSCComparatorDigiCollection>(
pset.getParameter<
edm::InputTag>(
"compDigiTag"));
50 al_token = consumes<CSCALCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"alctDigiTag"));
51 cl_token = consumes<CSCCLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"clctDigiTag"));
52 co_token = consumes<CSCCorrelatedLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"corrlctDigiTag"));
53 rh_token = consumes<CSCRecHit2DCollection>(
pset.getParameter<
edm::InputTag>(
"cscRecHitTag"));
54 se_token = consumes<CSCSegmentCollection>(
pset.getParameter<
edm::InputTag>(
"cscSegTag"));
55 sa_token = consumes<reco::TrackCollection>(
pset.getParameter<
edm::InputTag>(
"saMuonTag"));
56 l1_token = consumes<L1MuGMTReadoutCollection>(
pset.getParameter<
edm::InputTag>(
"l1aTag"));
58 sh_token = consumes<PSimHitContainer>(
pset.getParameter<
edm::InputTag>(
"simHitTag"));
60 pedestalsToken_ = esConsumes<CSCDBPedestals, CSCDBPedestalsRcd>();
61 gainsToken_ = esConsumes<CSCDBGains, CSCDBGainsRcd>();
62 noiseToken_ = esConsumes<CSCDBNoiseMatrix, CSCDBNoiseMatrixRcd>();
63 crosstalkToken_ = esConsumes<CSCDBCrosstalk, CSCDBCrosstalkRcd>();
65 crateToken_ = esConsumes<CSCCrateMap, CSCCrateMapRcd>();
68 makeOccupancyPlots =
pset.getUntrackedParameter<
bool>(
"makeOccupancyPlots",
true);
69 makeTriggerPlots =
pset.getUntrackedParameter<
bool>(
"makeTriggerPlots",
false);
70 makeStripPlots =
pset.getUntrackedParameter<
bool>(
"makeStripPlots",
true);
71 makeWirePlots =
pset.getUntrackedParameter<
bool>(
"makeWirePlots",
true);
72 makeRecHitPlots =
pset.getUntrackedParameter<
bool>(
"makeRecHitPlots",
true);
73 makeSimHitPlots =
pset.getUntrackedParameter<
bool>(
"makeSimHitPlots",
true);
74 makeSegmentPlots =
pset.getUntrackedParameter<
bool>(
"makeSegmentPlots",
true);
75 makeResolutionPlots =
pset.getUntrackedParameter<
bool>(
"makeResolutionPlots",
true);
76 makePedNoisePlots =
pset.getUntrackedParameter<
bool>(
"makePedNoisePlots",
true);
77 makeEfficiencyPlots =
pset.getUntrackedParameter<
bool>(
"makeEfficiencyPlots",
true);
78 makeGasGainPlots =
pset.getUntrackedParameter<
bool>(
"makeGasGainPlots",
true);
79 makeAFEBTimingPlots =
pset.getUntrackedParameter<
bool>(
"makeAFEBTimingPlots",
true);
80 makeCompTimingPlots =
pset.getUntrackedParameter<
bool>(
"makeCompTimingPlots",
true);
81 makeADCTimingPlots =
pset.getUntrackedParameter<
bool>(
"makeADCTimingPlots",
true);
82 makeRHNoisePlots =
pset.getUntrackedParameter<
bool>(
"makeRHNoisePlots",
false);
83 makeCalibPlots =
pset.getUntrackedParameter<
bool>(
"makeCalibPlots",
false);
84 makeStandalonePlots =
pset.getUntrackedParameter<
bool>(
"makeStandalonePlots",
false);
85 makeTimeMonitorPlots =
pset.getUntrackedParameter<
bool>(
"makeTimeMonitorPlots",
false);
86 makeHLTPlots =
pset.getUntrackedParameter<
bool>(
"makeHLTPlots",
false);
102 hOWires =
new TH2I(
"hOWires",
"Wire Digi Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
103 hOStrips =
new TH2I(
"hOStrips",
"Strip Digi Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
104 hORecHits =
new TH2I(
"hORecHits",
"RecHit Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
105 hOSegments =
new TH2I(
"hOSegments",
"Segments Occupancy", 36, 0.5, 36.5, 20, 0.5, 20.5);
108 hSSTE =
new TH1F(
"hSSTE",
"hSSTE", 40, 0, 40);
109 hRHSTE =
new TH1F(
"hRHSTE",
"hRHSTE", 40, 0, 40);
110 hSEff =
new TH1F(
"hSEff",
"Segment Efficiency", 20, 0.5, 20.5);
111 hRHEff =
new TH1F(
"hRHEff",
"recHit Efficiency", 20, 0.5, 20.5);
113 const int nChambers = 36;
114 const int nTypes = 20;
116 float nCh_max =
float(nChambers) + 0.5;
118 float nT_max =
float(nTypes) + 0.5;
120 hSSTE2 =
new TH2F(
"hSSTE2",
"hSSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
121 hRHSTE2 =
new TH2F(
"hRHSTE2",
"hRHSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
122 hStripSTE2 =
new TH2F(
"hStripSTE2",
"hStripSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
123 hWireSTE2 =
new TH2F(
"hWireSTE2",
"hWireSTE2", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
125 hEffDenominator =
new TH2F(
"hEffDenominator",
"hEffDenominator", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
126 hSEff2 =
new TH2F(
"hSEff2",
"Segment Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
127 hRHEff2 =
new TH2F(
"hRHEff2",
"recHit Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
129 hStripEff2 =
new TH2F(
"hStripEff2",
"strip Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
130 hWireEff2 =
new TH2F(
"hWireEff2",
"wire Efficiency 2D", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
133 new TH2F(
"hSensitiveAreaEvt",
"events in sensitive area", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
135 hSSTETight =
new TH1F(
"hSSTETight",
"hSSTE Tight", 40, 0, 40);
136 hRHSTETight =
new TH1F(
"hRHSTETight",
"hRHSTE Tight", 40, 0, 40);
138 hSSTE2Tight =
new TH2F(
"hSSTE2Tight",
"hSSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
139 hRHSTE2Tight =
new TH2F(
"hRHSTE2Tight",
"hRHSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
141 new TH2F(
"hStripSTE2Tight",
"hStripSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
142 hWireSTE2Tight =
new TH2F(
"hWireSTE2Tight",
"hWireSTE2 Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
143 hEffDenominatorTight =
144 new TH2F(
"hEffDenominatorTight",
"hEffDenominator Tight", nChambers, nCH_min, nCh_max, nTypes, nT_min, nT_max);
150 geomToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
156 CSCValidation::~CSCValidation() {
158 histoEfficiency(hRHSTE, hRHEff);
159 histoEfficiency(hSSTE, hSEff);
160 hSEff2->Divide(hSSTE2, hEffDenominator, 1., 1.,
"B");
161 hRHEff2->Divide(hRHSTE2, hEffDenominator, 1., 1.,
"B");
162 hStripEff2->Divide(hStripSTE2, hEffDenominator, 1., 1.,
"B");
163 hWireEff2->Divide(hWireSTE2, hEffDenominator, 1., 1.,
"B");
165 histos->insertPlot(hRHSTETight,
"hRHSTETight",
"Efficiency");
166 histos->insertPlot(hSSTETight,
"hSSTETight",
"Efficiency");
167 histos->insertPlot(hStripSTE2Tight,
"hStripSTE2Tight",
"Efficiency");
168 histos->insertPlot(hWireSTE2Tight,
"hWireSTE2Tight",
"Efficiency");
169 histos->insertPlot(hRHSTE2Tight,
"hRHSTE2Tight",
"Efficiency");
170 histos->insertPlot(hSSTE2Tight,
"hSSTE2Tight",
"Efficiency");
171 histos->insertPlot(hEffDenominatorTight,
"hEffDenominatorTight",
"Efficiency");
173 histos->insertPlot(hRHSTE,
"hRHSTE",
"Efficiency");
174 histos->insertPlot(hSSTE,
"hSSTE",
"Efficiency");
175 histos->insertPlot(hSSTE2,
"hSSTE2",
"Efficiency");
176 histos->insertPlot(hEffDenominator,
"hEffDenominator",
"Efficiency");
177 histos->insertPlot(hRHSTE2,
"hRHSTE2",
"Efficiency");
178 histos->insertPlot(hStripSTE2,
"hStripSTE2",
"Efficiency");
179 histos->insertPlot(hWireSTE2,
"hWireSTE2",
"Efficiency");
182 histos->insertPlot(hSEff,
"hSEff",
"Efficiency");
183 histos->insertPlot(hRHEff,
"hRHEff",
"Efficiency");
185 histos->insertPlot(hSEff2,
"hSEff2",
"Efficiency");
186 histos->insertPlot(hRHEff2,
"hRHEff2",
"Efficiency");
187 histos->insertPlot(hStripEff2,
"hStripff2",
"Efficiency");
188 histos->insertPlot(hWireEff2,
"hWireff2",
"Efficiency");
190 histos->insertPlot(hSensitiveAreaEvt,
"",
"Efficiency");
193 histos->insertPlot(hOWires,
"hOWires",
"Digis");
194 histos->insertPlot(hOStrips,
"hOStrips",
"Digis");
195 histos->insertPlot(hORecHits,
"hORecHits",
"recHits");
196 histos->insertPlot(hOSegments,
"hOSegments",
"Segments");
223 event.getByToken(sd_token,
strips);
224 event.getByToken(wd_token,
wires);
225 event.getByToken(cd_token, compars);
226 event.getByToken(al_token, alcts);
227 event.getByToken(cl_token, clcts);
228 event.getByToken(co_token, correlatedlcts);
236 event.getByToken(rh_token,
recHits);
246 event.getByToken(sh_token,
simHits);
254 if (makeTriggerPlots || useTriggerFilter || (useDigis && makeTimeMonitorPlots)) {
255 event.getByToken(l1_token, pCollection);
259 event.getByToken(tr_token,
hlt);
264 if (makeStandalonePlots || useQualityFilter) {
265 event.getByToken(sa_token, saMuons);
274 if (nEventsAnalyzed == 1 && makeCalibPlots)
279 if (makeTriggerPlots || useTriggerFilter)
280 CSCL1A = doTrigger(pCollection);
281 if (!useTriggerFilter)
285 if (makeStandalonePlots || useQualityFilter)
287 if (!useQualityFilter)
292 if (makeOccupancyPlots && CSCL1A)
298 if (cleanEvent && CSCL1A) {
300 if (makeStripPlots && useDigis)
304 if (makeWirePlots && useDigis)
312 if (isSimulation && makeSimHitPlots)
316 if (makeSegmentPlots)
320 if (makeResolutionPlots)
324 if (makePedNoisePlots && useDigis)
328 if (makeEfficiencyPlots)
332 if (makeGasGainPlots && useDigis)
336 if (makeAFEBTimingPlots && useDigis)
337 doAFEBTiming(*
wires);
340 if (makeCompTimingPlots && useDigis)
341 doCompTiming(*compars);
344 if (makeADCTimingPlots)
348 if (makeRHNoisePlots && useDigis)
352 if (makeStandalonePlots)
353 doStandalone(saMuons);
356 if (makeTimeMonitorPlots)
454 bool wireo[2][4][4][36];
455 bool stripo[2][4][4][36];
456 bool rechito[2][4][4][36];
457 bool segmento[2][4][4][36];
459 bool hasWires =
false;
460 bool hasStrips =
false;
461 bool hasRecHits =
false;
462 bool hasSegments =
false;
464 for (
int e = 0;
e < 2;
e++) {
465 for (
int s = 0;
s < 4;
s++) {
466 for (
int r = 0;
r < 4;
r++) {
467 for (
int c = 0;
c < 36;
c++) {
468 wireo[
e][
s][
r][
c] =
false;
469 stripo[
e][
s][
r][
c] =
false;
470 rechito[
e][
s][
r][
c] =
false;
471 segmento[
e][
s][
r][
c] =
false;
481 int kEndcap =
id.
endcap();
482 int kRing =
id.ring();
483 int kStation =
id.station();
484 int kChamber =
id.chamber();
485 std::vector<CSCWireDigi>::const_iterator wireIt = (*wi).second.first;
486 std::vector<CSCWireDigi>::const_iterator lastWire = (*wi).second.second;
487 for (; wireIt != lastWire; ++wireIt) {
488 if (!wireo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
489 wireo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
490 hOWires->Fill(kChamber, typeIndex(
id));
492 chamberSerial(
id),
"hOWireSerial",
"Wire Occupancy by Chamber Serial", 601, -0.5, 600.5,
"Digis");
501 int kEndcap =
id.
endcap();
502 int kRing =
id.ring();
503 int kStation =
id.station();
504 int kChamber =
id.chamber();
505 std::vector<CSCStripDigi>::const_iterator stripIt = (*si).second.first;
506 std::vector<CSCStripDigi>::const_iterator lastStrip = (*si).second.second;
507 for (; stripIt != lastStrip; ++stripIt) {
508 std::vector<int> myADCVals = stripIt->getADCCounts();
509 bool thisStripFired =
false;
510 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
513 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
514 diff = (
float)myADCVals[iCount] - thisPedestal;
516 thisStripFired =
true;
519 if (thisStripFired) {
520 if (!stripo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
521 stripo[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
522 hOStrips->Fill(kChamber, typeIndex(
id));
524 chamberSerial(
id),
"hOStripSerial",
"Strip Occupancy by Chamber Serial", 601, -0.5, 600.5,
"Digis");
534 for (recIt =
recHits->begin(); recIt !=
recHits->end(); recIt++) {
536 int kEndcap = idrec.
endcap();
537 int kRing = idrec.
ring();
538 int kStation = idrec.
station();
539 int kChamber = idrec.
chamber();
540 if (!rechito[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
541 rechito[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
543 chamberSerial(idrec),
"hORecHitsSerial",
"RecHit Occupancy by Chamber Serial", 601, -0.5, 600.5,
"recHits");
544 hORecHits->Fill(kChamber, typeIndex(idrec));
552 int kEndcap =
id.
endcap();
553 int kRing =
id.ring();
554 int kStation =
id.station();
555 int kChamber =
id.chamber();
556 if (!segmento[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1]) {
557 segmento[kEndcap - 1][kStation - 1][kRing - 1][kChamber - 1] =
true;
559 chamberSerial(
id),
"hOSegmentsSerial",
"Segment Occupancy by Chamber Serial", 601, -0.5, 600.5,
"Segments");
560 hOSegments->Fill(kChamber, typeIndex(
id));
566 histos->fill1DHist(1,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
568 histos->fill1DHist(3,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
570 histos->fill1DHist(5,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
571 if (hasWires && hasStrips)
572 histos->fill1DHist(7,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
574 histos->fill1DHist(9,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
576 histos->fill1DHist(11,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
578 histos->fill1DHist(13,
"hCSCOccupancy",
"overall CSC occupancy", 15, -0.5, 14.5,
"GeneralHists");
588 std::vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->
getRecords();
589 std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
591 bool csc_l1a =
false;
593 bool rpcf_l1a =
false;
594 bool rpcb_l1a =
false;
595 bool beamHaloTrigger =
false;
597 int myBXNumber = -1000;
599 for (igmtrr = L1Mrec.begin(); igmtrr != L1Mrec.end(); igmtrr++) {
600 std::vector<L1MuRegionalCand>::const_iterator iter1;
601 std::vector<L1MuRegionalCand> rmc;
605 rmc = igmtrr->getCSCCands();
606 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
607 if (!(*iter1).empty()) {
609 int kQuality = (*iter1).quality();
611 beamHaloTrigger =
true;
614 if (igmtrr->getBxInEvent() == 0 && icsc > 0)
616 if (igmtrr->getBxInEvent() == 0) {
617 myBXNumber = igmtrr->getBxNr();
622 rmc = igmtrr->getDTBXCands();
623 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
624 if (!(*iter1).empty()) {
628 if (igmtrr->getBxInEvent() == 0 && idt > 0)
633 rmc = igmtrr->getBrlRPCCands();
634 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
635 if (!(*iter1).empty()) {
639 if (igmtrr->getBxInEvent() == 0 && irpcb > 0)
644 rmc = igmtrr->getFwdRPCCands();
645 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
646 if (!(*iter1).empty()) {
650 if (igmtrr->getBxInEvent() == 0 && irpcf > 0)
656 histos->fill1DHist(myBXNumber,
"vtBXNumber",
"BX Number", 4001, -0.5, 4000.5,
"Trigger");
658 histos->fill1DHist(1,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
660 histos->fill1DHist(2,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
662 histos->fill1DHist(3,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
664 histos->fill1DHist(4,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
666 histos->fill1DHist(8,
"vtBits",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
669 histos->fill1DHist(1,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
671 histos->fill1DHist(2,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
673 histos->fill1DHist(3,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
675 histos->fill1DHist(4,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
676 if (dt_l1a || rpcb_l1a || rpcf_l1a)
677 histos->fill1DHist(5,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
678 if (!(dt_l1a || rpcb_l1a || rpcf_l1a))
679 histos->fill1DHist(6,
"vtCSCY",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
681 histos->fill1DHist(1,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
683 histos->fill1DHist(2,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
685 histos->fill1DHist(3,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
687 histos->fill1DHist(4,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
688 if (dt_l1a || rpcb_l1a || rpcf_l1a)
689 histos->fill1DHist(5,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
690 if (!(dt_l1a || rpcb_l1a || rpcf_l1a))
691 histos->fill1DHist(6,
"vtCSCN",
"trigger bits", 11, -0.5, 10.5,
"Trigger");
710 int hltSize =
hlt->size();
711 for (
int i = 0;
i < hltSize; ++
i) {
713 histos->fill1DHist(
i,
"hltBits",
"HLT Trigger Bits", hltSize + 1, -0.5, (
float)hltSize + 0.5,
"Trigger");
727 if (nEventsAnalyzed == 1) {
728 LogDebug(
"Calibrations") <<
"Loading Calibrations...";
743 LogDebug(
"Calibrations") <<
"Calibrations Loaded!";
745 for (
int i = 0;
i < 400;
i++) {
747 histos->fillCalibHist(pGains->
gains[
i].gain_slope,
"hCalibGainsS",
"Gains Slope", 400, 0, 400,
bin,
"Calib");
749 pCrosstalk->
crosstalk[
i].xtalk_slope_left,
"hCalibXtalkSL",
"Xtalk Slope Left", 400, 0, 400,
bin,
"Calib");
751 pCrosstalk->
crosstalk[
i].xtalk_slope_right,
"hCalibXtalkSR",
"Xtalk Slope Right", 400, 0, 400,
bin,
"Calib");
754 "Xtalk Intercept Left",
762 "Xtalk Intercept Right",
768 histos->fillCalibHist(pPedestals->
pedestals[
i].ped,
"hCalibPedsP",
"Peds", 400, 0, 400,
bin,
"Calib");
769 histos->fillCalibHist(pPedestals->
pedestals[
i].rms,
"hCalibPedsR",
"Peds RMS", 400, 0, 400,
bin,
"Calib");
771 pNoiseMatrix->
matrix[
i].elem33,
"hCalibNoise33",
"Noise Matrix 33", 400, 0, 400,
bin,
"Calib");
773 pNoiseMatrix->
matrix[
i].elem34,
"hCalibNoise34",
"Noise Matrix 34", 400, 0, 400,
bin,
"Calib");
775 pNoiseMatrix->
matrix[
i].elem35,
"hCalibNoise35",
"Noise Matrix 35", 400, 0, 400,
bin,
"Calib");
777 pNoiseMatrix->
matrix[
i].elem44,
"hCalibNoise44",
"Noise Matrix 44", 400, 0, 400,
bin,
"Calib");
779 pNoiseMatrix->
matrix[
i].elem45,
"hCalibNoise45",
"Noise Matrix 45", 400, 0, 400,
bin,
"Calib");
781 pNoiseMatrix->
matrix[
i].elem46,
"hCalibNoise46",
"Noise Matrix 46", 400, 0, 400,
bin,
"Calib");
783 pNoiseMatrix->
matrix[
i].elem55,
"hCalibNoise55",
"Noise Matrix 55", 400, 0, 400,
bin,
"Calib");
785 pNoiseMatrix->
matrix[
i].elem56,
"hCalibNoise56",
"Noise Matrix 56", 400, 0, 400,
bin,
"Calib");
787 pNoiseMatrix->
matrix[
i].elem57,
"hCalibNoise57",
"Noise Matrix 57", 400, 0, 400,
bin,
"Calib");
789 pNoiseMatrix->
matrix[
i].elem66,
"hCalibNoise66",
"Noise Matrix 66", 400, 0, 400,
bin,
"Calib");
791 pNoiseMatrix->
matrix[
i].elem67,
"hCalibNoise67",
"Noise Matrix 67", 400, 0, 400,
bin,
"Calib");
793 pNoiseMatrix->
matrix[
i].elem77,
"hCalibNoise77",
"Noise Matrix 77", 400, 0, 400,
bin,
"Calib");
805 int nWireGroupsTotal = 0;
808 std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
809 std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
810 for (; wireIter != lWire; ++wireIter) {
811 int myWire = wireIter->getWireGroup();
812 int myTBin = wireIter->getTimeBin();
814 histos->fill1DHistByType(myWire,
"hWireWire",
"Wiregroup Numbers Fired",
id, 113, -0.5, 112.5,
"Digis");
815 histos->fill1DHistByType(myTBin,
"hWireTBin",
"Wire TimeBin Fired",
id, 17, -0.5, 16.5,
"Digis");
817 chamberSerial(
id), myTBin,
"hWireTBinProfile",
"Wire TimeBin Fired", 601, -0.5, 600.5, -0.5, 16.5,
"Digis");
819 histos->fill1DHistByLayer(
820 myWire,
"hWireWire",
"Wiregroup Numbers Fired",
id, 113, -0.5, 112.5,
"WireNumberByLayer");
821 histos->fill1DHistByLayer(myTBin,
"hWireTBin",
"Wire TimeBin Fired",
id, 17, -0.5, 16.5,
"WireTimeByLayer");
827 if (nWireGroupsTotal == 0)
828 nWireGroupsTotal = -1;
830 histos->fill1DHist(nWireGroupsTotal,
"hWirenGroupsTotal",
"Wires Fired Per Event", 251, -0.5, 250.5,
"Digis");
840 int nStripsFired = 0;
843 std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
844 std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
845 for (; stripIter != lStrip; ++stripIter) {
846 int myStrip = stripIter->getStrip();
847 std::vector<int> myADCVals = stripIter->getADCCounts();
848 bool thisStripFired =
false;
849 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
852 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
853 diff = (
float)myADCVals[iCount] - thisPedestal;
855 thisStripFired =
true;
858 if (thisStripFired) {
861 histos->fill1DHistByType(myStrip,
"hStripStrip",
"Strip Number",
id, 81, -0.5, 80.5,
"Digis");
863 histos->fill1DHistByLayer(myStrip,
"hStripStrip",
"Strip Number",
id, 81, -0.5, 80.5,
"StripNumberByLayer");
869 if (nStripsFired == 0)
872 histos->fill1DHist(nStripsFired,
"hStripNFired",
"Fired Strips per Event", 351, -0.5, 350.5,
"Digis");
885 std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
886 std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
887 for (; pedIt != lStrip; ++pedIt) {
888 int myStrip = pedIt->getStrip();
889 std::vector<int> myADCVals = pedIt->getADCCounts();
890 float TotalADC = getSignal(*
strips,
id, myStrip);
891 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
893 (1. / 6) * (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
894 bool thisStripFired = TotalADC >
threshold;
895 if (!thisStripFired) {
896 float ADC = thisSignal - thisPedestal;
897 histos->fill1DHist(
ADC,
"hStripPed",
"Pedestal Noise Distribution", 50, -25., 25.,
"PedestalNoise");
898 histos->fill1DHistByType(
ADC,
"hStripPedME",
"Pedestal Noise Distribution",
id, 50, -25., 25.,
"PedestalNoise");
899 histos->fillProfile(chamberSerial(
id),
901 "hStripPedMEProfile",
902 "Wire TimeBin Fired",
910 histos->fill1DHistByLayer(
911 ADC,
"hStripPedME",
"Pedestal Noise Distribution",
id, 50, -25., 25.,
"PedestalNoiseByLayer");
926 int nRecHits =
recHits->size();
935 for (dRHIter =
recHits->begin(); dRHIter !=
recHits->end(); dRHIter++) {
940 int kEndcap = idrec.
endcap();
941 int kRing = idrec.
ring();
942 int kStation = idrec.
station();
943 int kChamber = idrec.
chamber();
947 LocalPoint rhitlocal = (*dRHIter).localPosition();
948 float xreco = rhitlocal.
x();
949 float yreco = rhitlocal.
y();
950 LocalError rerrlocal = (*dRHIter).localPositionError();
952 float xxerr = rerrlocal.
xx();
953 float yyerr = rerrlocal.
yy();
954 float xyerr = rerrlocal.
xy();
956 float stpos = (*dRHIter).positionWithinStrip();
957 float sterr = (*dRHIter).errorWithinStrip();
962 int adcsize = dRHIter->nStrips() * dRHIter->nTimeBins();
963 for (
unsigned int i = 0;
i < dRHIter->nStrips();
i++) {
964 for (
unsigned int j = 0;
j < dRHIter->nTimeBins() - 1;
j++) {
965 rHSumQ += dRHIter->adcs(
i,
j);
967 sumsides += dRHIter->adcs(
i,
j);
971 float rHratioQ = sumsides / rHSumQ;
977 rHtime = (*dRHIter).tpeak() / 50.;
984 float grecx = rhitglobal.
x();
985 float grecy = rhitglobal.
y();
988 if (writeTreeToFile && rhTreeCount < 1500000) {
989 histos->fillRechitTree(xreco, yreco, grecx, grecy, kEndcap, kStation, kRing, kChamber,
kLayer);
995 histos->fill2DHistByStation(
996 grecx, grecy,
"hRHGlobal",
"recHit Global Position", idrec, 100, -800., 800., 100, -800., 800.,
"recHits");
997 if (kStation == 1 && (kRing == 1 || kRing == 4))
998 histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 4000,
"recHits");
1000 histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 2000,
"recHits");
1001 histos->fill1DHistByType(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt", idrec, 120, -0.1, 1.1,
"recHits");
1002 histos->fill1DHistByType(rHtime,
"hRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"recHits");
1003 histos->fill1DHistByType(
sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X", idrec, 100, -0.1, 2,
"recHits");
1004 histos->fill1DHistByType(
sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y", idrec, 100, -0.1, 2,
"recHits");
1005 histos->fill1DHistByType(xyerr,
"hRHxyerr",
"Corr. RecHit XY Error", idrec, 100, -1, 2,
"recHits");
1007 histos->fill1DHistByType(stpos,
"hRHstpos",
"Reconstructed Position on Strip", idrec, 120, -0.6, 0.6,
"recHits");
1008 histos->fill1DHistByType(
1009 sterr,
"hRHsterr",
"Estimated Error on Strip Measurement", idrec, 120, -0.05, 0.25,
"recHits");
1011 chamberSerial(idrec), rHSumQ,
"hRHSumQProfile",
"Sum 3x3 recHit Charge", 601, -0.5, 600.5, 0, 4000,
"recHits");
1013 chamberSerial(idrec), rHtime,
"hRHTimingProfile",
"recHit Timing", 601, -0.5, 600.5, -11, 11,
"recHits");
1015 if (kStation == 1 && (kRing == 1 || kRing == 4))
1016 histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 4000,
"RHQByLayer");
1018 histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 2000,
"RHQByLayer");
1019 histos->fill1DHistByLayer(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt", idrec, 120, -0.1, 1.1,
"RHQByLayer");
1020 histos->fill1DHistByLayer(rHtime,
"hRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"RHTimingByLayer");
1021 histos->fill2DHistByLayer(xreco,
1024 "recHit Local Position",
1032 "RHLocalXYByLayer");
1033 histos->fill1DHistByLayer(
1034 sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X", idrec, 100, -0.1, 2,
"RHErrorsByLayer");
1035 histos->fill1DHistByLayer(
1036 sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y", idrec, 100, -0.1, 2,
"RHErrorsByLayer");
1037 histos->fill1DHistByType(
1038 stpos,
"hRHstpos",
"Reconstructed Position on Strip", idrec, 120, -0.6, 0.6,
"RHStripPosByLayer");
1039 histos->fill1DHistByType(
1040 sterr,
"hRHsterr",
"Estimated Error on Strip Measurement", idrec, 120, -0.05, 0.25,
"RHStripPosByLayer");
1048 histos->fill1DHist(nRecHits,
"hRHnrechits",
"recHits per Event (all chambers)", 201, -0.5, 200.5,
"recHits");
1059 for (dSHrecIter =
recHits->begin(); dSHrecIter !=
recHits->end(); dSHrecIter++) {
1061 LocalPoint rhitlocal = (*dSHrecIter).localPosition();
1062 float xreco = rhitlocal.
x();
1063 float yreco = rhitlocal.
y();
1064 float xError =
sqrt((*dSHrecIter).localPositionError().xx());
1065 float yError =
sqrt((*dSHrecIter).localPositionError().yy());
1066 float simHitXres = -99;
1067 float simHitYres = -99;
1070 float mindiffX = 99;
1071 float mindiffY = 10;
1073 PSimHitContainer::const_iterator dSHsimIter;
1074 for (dSHsimIter =
simHits->begin(); dSHsimIter !=
simHits->end(); dSHsimIter++) {
1079 if (sId == idrec &&
abs((*dSHsimIter).particleType()) == 13) {
1081 LocalPoint sHitlocal = (*dSHsimIter).localPosition();
1084 if ((sHitlocal.
x() - xreco) < mindiffX && (sHitlocal.
y() - yreco) < mindiffY) {
1085 simHitXres = (sHitlocal.
x() - xreco);
1086 simHitYres = (sHitlocal.
y() - yreco);
1087 mindiffX = (sHitlocal.
x() - xreco);
1088 xPull = simHitXres / xError;
1089 yPull = simHitYres / yError;
1094 histos->fill1DHistByType(
1095 simHitXres,
"hSimXResid",
"SimHitX - Reconstructed X", idrec, 100, -1.0, 1.0,
"Resolution");
1096 histos->fill1DHistByType(
1097 simHitYres,
"hSimYResid",
"SimHitY - Reconstructed Y", idrec, 100, -5.0, 5.0,
"Resolution");
1098 histos->fill1DHistByType(xPull,
"hSimXPull",
"Local X Pulls", idrec, 100, -5.0, 5.0,
"Resolution");
1099 histos->fill1DHistByType(yPull,
"hSimYPull",
"Local Y Pulls", idrec, 100, -5.0, 5.0,
"Resolution");
1121 int kEndcap =
id.
endcap();
1122 int kRing =
id.ring();
1123 int kStation =
id.station();
1124 int kChamber =
id.chamber();
1127 float chisq = (*dSiter).chi2();
1128 int nhits = (*dSiter).nRecHits();
1129 int nDOF = 2 *
nhits - 4;
1131 LocalPoint localPos = (*dSiter).localPosition();
1132 float segX = localPos.
x();
1133 float segY = localPos.
y();
1140 float globTheta = 0.;
1145 globX = globalPosition.
x();
1146 globY = globalPosition.
y();
1148 globTheta = globalDirection.
theta();
1149 globPhi = globalDirection.
phi();
1153 if (writeTreeToFile && segTreeCount < 1500000) {
1154 histos->fillSegmentTree(segX, segY, globX, globY, kEndcap, kStation, kRing, kChamber);
1159 histos->fill2DHistByStation(globX,
1162 "Segment Global Positions;global x (cm)",
1171 histos->fill1DHistByType(
nhits,
"hSnHits",
"N hits on Segments",
id, 8, -0.5, 7.5,
"Segments");
1172 histos->fill1DHistByType(
theta,
"hSTheta",
"local theta segments",
id, 128, -3.2, 3.2,
"Segments");
1173 histos->fill1DHistByType((chisq / nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id, 110, -0.05, 10.5,
"Segments");
1174 histos->fill1DHistByType(
1175 chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id, 110, -0.05, 1.05,
"Segments");
1176 histos->fill1DHist(globTheta,
"hSGlobalTheta",
"segment global theta", 128, 0, 3.2,
"Segments");
1177 histos->fill1DHist(globPhi,
"hSGlobalPhi",
"segment global phi", 128, -3.2, 3.2,
"Segments");
1179 chamberSerial(
id),
nhits,
"hSnHitsProfile",
"N hits on Segments", 601, -0.5, 600.5, -0.5, 7.5,
"Segments");
1181 histos->fill1DHistByChamber(
nhits,
"hSnHits",
"N hits on Segments",
id, 8, -0.5, 7.5,
"HitsOnSegmentByChamber");
1182 histos->fill1DHistByChamber(
theta,
"hSTheta",
"local theta segments",
id, 128, -3.2, 3.2,
"DetailedSegments");
1183 histos->fill1DHistByChamber(
1184 (chisq / nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id, 110, -0.05, 10.5,
"SegChi2ByChamber");
1185 histos->fill1DHistByChamber(
1186 chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id, 110, -0.05, 1.05,
"SegChi2ByChamber");
1194 histos->fill1DHist(nSegments,
"hSnSegments",
"Segments per Event", 31, -0.5, 30.5,
"Segments");
1209 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1210 int nRH = (*dSiter).nRecHits();
1212 CLHEP::HepMatrix sp(6, 1);
1213 CLHEP::HepMatrix se(6, 1);
1214 for (std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1217 int kRing = idRH.
ring();
1218 int kStation = idRH.
station();
1222 int centerid = iRH->nStrips() / 2;
1223 int centerStrip = iRH->channels(centerid);
1227 float stpos = (*iRH).positionWithinStrip();
1228 se(
kLayer, 1) = (*iRH).errorWithinStrip();
1230 if (kStation == 1 && (kRing == 1 || kRing == 4))
1231 sp(
kLayer, 1) = stpos + centerStrip;
1234 sp(
kLayer, 1) = stpos + centerStrip;
1236 sp(
kLayer, 1) = stpos - 0.5 + centerStrip;
1241 float residual = -99;
1245 float expected = fitX(sp, se);
1246 residual = expected - sp(3, 1);
1247 pull = residual / se(3, 1);
1251 histos->fill1DHistByType(
1252 residual,
"hSResid",
"Fitted Position on Strip - Reconstructed for Layer 3",
id, 100, -0.5, 0.5,
"Resolution");
1253 histos->fill1DHistByType(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id, 100, -5.0, 5.0,
"Resolution");
1254 histos->fillProfile(chamberSerial(
id),
1257 "Fitted Position on Strip - Reconstructed for Layer 3",
1265 histos->fill1DHistByChamber(residual,
1267 "Fitted Position on Strip - Reconstructed for Layer 3",
1272 "DetailedResolution");
1273 histos->fill1DHistByChamber(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id, 100, -5.0, 5.0,
"Resolution");
1285 int nSAMuons = saMuons->size();
1286 histos->fill1DHist(nSAMuons,
"trNSAMuons",
"N Standalone Muons per Event", 6, -0.5, 5.5,
"STAMuons");
1288 for (reco::TrackCollection::const_iterator
muon = saMuons->begin();
muon != saMuons->end(); ++
muon) {
1289 float preco =
muon->p();
1290 float ptreco =
muon->pt();
1291 int n =
muon->recHitsSize();
1293 float normchi2 =
muon->normalizedChi2();
1305 std::vector<CSCDetId> staChambers;
1307 const DetId detId((*hit)->geographicalId());
1312 if (rpcId.region() == 1) {
1316 if (rpcId.region() == -1) {
1325 staChambers.push_back(detId.rawId());
1327 if (cscId.endcap() == 1) {
1331 if (cscId.endcap() == 2) {
1344 double crudeLength = deltaPnt.
mag();
1345 double deltaPhi = innerPnt.phi() - outerPnt.phi();
1346 double innerGlobalPolarAngle = innerKin.theta();
1347 double outerGlobalPolarAngle = outerKin.theta();
1350 histos->fill1DHist(
n,
"trN",
"N hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1352 histos->fill1DHist(
np,
"trNp",
"N hits on a STA Muon Track (plus endcap)", 51, -0.5, 50.5,
"STAMuons");
1354 histos->fill1DHist(nm,
"trNm",
"N hits on a STA Muon Track (minus endcap)", 51, -0.5, 50.5,
"STAMuons");
1355 histos->fill1DHist(nDTHits,
"trNDT",
"N DT hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1356 histos->fill1DHist(nCSCHits,
"trNCSC",
"N CSC hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1358 histos->fill1DHist(nCSCHitsp,
"trNCSCp",
"N CSC hits on a STA Muon Track (+ endcap)", 51, -0.5, 50.5,
"STAMuons");
1360 histos->fill1DHist(nCSCHitsm,
"trNCSCm",
"N CSC hits on a STA Muon Track (- endcap)", 51, -0.5, 50.5,
"STAMuons");
1361 histos->fill1DHist(nRPCHits,
"trNRPC",
"N RPC hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1363 histos->fill1DHist(nRPCHitsp,
"trNRPCp",
"N RPC hits on a STA Muon Track (+ endcap)", 51, -0.5, 50.5,
"STAMuons");
1365 histos->fill1DHist(nRPCHitsm,
"trNRPCm",
"N RPC hits on a STA Muon Track (- endcap)", 51, -0.5, 50.5,
"STAMuons");
1366 histos->fill1DHist(preco,
"trP",
"STA Muon Momentum", 100, 0, 300,
"STAMuons");
1367 histos->fill1DHist(ptreco,
"trPT",
"STA Muon pT", 100, 0, 40,
"STAMuons");
1368 histos->fill1DHist(
chi2,
"trChi2",
"STA Muon Chi2", 100, 0, 200,
"STAMuons");
1369 histos->fill1DHist(normchi2,
"trNormChi2",
"STA Muon Normalized Chi2", 100, 0, 10,
"STAMuons");
1370 histos->fill1DHist(crudeLength,
"trLength",
"Straight Line Length of STA Muon", 120, 0., 2400.,
"STAMuons");
1372 deltaPhi,
"trDeltaPhi",
"Delta-Phi Between Inner and Outer STA Muon Pos.", 100, -0.5, 0.5,
"STAMuons");
1374 innerGlobalPolarAngle,
"trInnerPolar",
"Polar Angle of Inner P Vector (STA muons)", 128, 0, 3.2,
"STAMuons");
1376 outerGlobalPolarAngle,
"trOuterPolar",
"Polar Angle of Outer P Vector (STA muons)", 128, 0, 3.2,
"STAMuons");
1377 histos->fill1DHist(innerPnt.phi(),
"trInnerPhi",
"Phi of Inner Position (STA muons)", 256, -3.2, 3.2,
"STAMuons");
1378 histos->fill1DHist(outerPnt.phi(),
"trOuterPhi",
"Phi of Outer Position (STA muons)", 256, -3.2, 3.2,
"STAMuons");
1386 int CSCValidation::chamberSerial(
CSCDetId id) {
1387 int st =
id.station();
1389 int ch =
id.chamber();
1390 int ec =
id.endcap();
1392 if (st == 1 && ri == 1)
1394 if (st == 1 && ri == 2)
1396 if (st == 1 && ri == 3)
1398 if (st == 1 && ri == 4)
1400 if (st == 2 && ri == 1)
1402 if (st == 2 && ri == 2)
1404 if (st == 3 && ri == 1)
1406 if (st == 3 && ri == 2)
1408 if (st == 4 && ri == 1)
1410 if (st == 4 && ri == 2)
1413 kSerial = kSerial + 300;
1421 int CSCValidation::ringSerial(
CSCDetId id) {
1422 int st =
id.station();
1424 int ec =
id.endcap();
1426 if (st == 1 && ri == 1)
1428 if (st == 1 && ri == 2)
1430 if (st == 1 && ri == 3)
1432 if (st == 1 && ri == 4)
1441 kSerial = kSerial * (-1);
1450 float CSCValidation::fitX(
const CLHEP::HepMatrix&
points,
const CLHEP::HepMatrix&
errors) {
1458 for (
int i = 1;
i < 7;
i++) {
1461 S =
S + (1 / sigma2);
1462 Sy = Sy + (
points(
i, 1) / sigma2);
1463 Sx = Sx + ((
i) / sigma2);
1464 Sxx = Sxx + (
i *
i) / sigma2;
1465 Sxy = Sxy + (((
i)*
points(
i, 1)) / sigma2);
1469 float delta =
S * Sxx - Sx * Sx;
1470 float intercept = (Sxx * Sy - Sx * Sxy) /
delta;
1482 return (intercept +
slope * 3);
1495 bool allWires[2][4][4][36][6];
1496 bool allStrips[2][4][4][36][6];
1497 bool AllRecHits[2][4][4][36][6];
1498 bool AllSegments[2][4][4][36];
1501 for (
int iE = 0; iE < 2; iE++) {
1502 for (
int iS = 0; iS < 4; iS++) {
1503 for (
int iR = 0; iR < 4; iR++) {
1504 for (
int iC = 0; iC < 36; iC++) {
1505 AllSegments[iE][iS][iR][iC] =
false;
1507 for (
int iL = 0; iL < 6; iL++) {
1508 allWires[iE][iS][iR][iC][iL] =
false;
1509 allStrips[iE][iS][iR][iC][iL] =
false;
1510 AllRecHits[iE][iS][iR][iC][iL] =
false;
1521 std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
1522 std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
1523 for (; wireIter != lWire; ++wireIter) {
1533 std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
1534 std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
1535 for (; stripIter != lStrip; ++stripIter) {
1536 std::vector<int> myADCVals = stripIter->getADCCounts();
1537 bool thisStripFired =
false;
1538 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1541 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
1542 diff = (
float)myADCVals[iCount] - thisPedestal;
1544 thisStripFired =
true;
1548 if (thisStripFired) {
1565 std::vector<unsigned int> seg_ME2(2, 0);
1566 std::vector<unsigned int> seg_ME3(2, 0);
1567 std::vector<std::pair<CSCDetId, CSCSegment> > theSegments(4);
1580 unsigned int seg_tmp;
1582 ++seg_ME2[idseg.
endcap() - 1];
1583 seg_tmp = seg_ME2[idseg.
endcap() - 1];
1585 ++seg_ME3[idseg.
endcap() - 1];
1586 seg_tmp = seg_ME3[idseg.
endcap() - 1];
1589 if (1 == seg_tmp && 6 == (*segEffIt).nRecHits() && (*segEffIt).chi2() / (*segEffIt).degreesOfFreedom() < 3.) {
1590 std::pair<CSCDetId, CSCSegment> specSeg = make_pair((
CSCDetId)(*segEffIt).cscDetId(), *segEffIt);
1591 theSegments[2 * (idseg.
endcap() - 1) + (idseg.
station() - 2)] = specSeg;
1612 for (
int iE = 0; iE < 2; iE++) {
1613 for (
int iS = 0; iS < 4; iS++) {
1614 for (
int iR = 0; iR < 4; iR++) {
1615 for (
int iC = 0; iC < 36; iC++) {
1616 int NumberOfLayers = 0;
1617 for (
int iL = 0; iL < 6; iL++) {
1618 if (AllRecHits[iE][iS][iR][iC][iL]) {
1624 bin = iR + 1 + (iE * 10);
1626 bin = (iS + 1) * 2 + (iR + 1) + (iE * 10);
1627 if (NumberOfLayers > 1) {
1629 if (AllSegments[iE][iS][iR][iC]) {
1632 hSSTE->Fill(
bin - 0.5);
1633 if (NumberOfLayers > 3)
1634 hSSTETight->Fill(
bin - 0.5);
1638 hSSTE->Fill(20 +
bin - 0.5);
1639 if (NumberOfLayers > 3)
1640 hSSTETight->Fill(20 +
bin - 0.5);
1643 if (AllSegments[iE][iS][iR][iC]) {
1644 if (NumberOfLayers == 6) {
1647 hRHSTE->Fill(
bin - 0.5);
1648 hRHSTETight->Fill(
bin - 0.5);
1653 hRHSTE->Fill(20 +
bin - 0.5);
1654 if (NumberOfLayers > 3)
1655 hRHSTETight->Fill(20 +
bin - 0.5);
1664 std::vector<std::pair<CSCDetId, CSCSegment>*> theSeg;
1665 if (1 == seg_ME2[0])
1666 theSeg.push_back(&theSegments[0]);
1667 if (1 == seg_ME3[0])
1668 theSeg.push_back(&theSegments[1]);
1669 if (1 == seg_ME2[1])
1670 theSeg.push_back(&theSegments[2]);
1671 if (1 == seg_ME3[1])
1672 theSeg.push_back(&theSegments[3]);
1677 std::map<std::string, float> chamberTypes;
1678 chamberTypes[
"ME1/a"] = 0.5;
1679 chamberTypes[
"ME1/b"] = 1.5;
1680 chamberTypes[
"ME1/2"] = 2.5;
1681 chamberTypes[
"ME1/3"] = 3.5;
1682 chamberTypes[
"ME2/1"] = 4.5;
1683 chamberTypes[
"ME2/2"] = 5.5;
1684 chamberTypes[
"ME3/1"] = 6.5;
1685 chamberTypes[
"ME3/2"] = 7.5;
1686 chamberTypes[
"ME4/1"] = 8.5;
1687 chamberTypes[
"ME4/2"] = 9.5;
1689 if (!theSeg.empty()) {
1690 std::map<int, GlobalPoint> extrapolatedPoint;
1691 std::map<int, GlobalPoint>::iterator it;
1694 for (
size_t nCh = 0; nCh < ChamberContainer.size(); nCh++) {
1695 const CSCChamber* cscchamber = ChamberContainer[nCh];
1696 std::pair<CSCDetId, CSCSegment>* thisSegment =
nullptr;
1697 for (
size_t iSeg = 0; iSeg < theSeg.size(); ++iSeg) {
1698 if (cscchamber->
id().
endcap() == theSeg[iSeg]->first.endcap()) {
1700 if (2 == theSeg[iSeg]->
first.station()) {
1701 thisSegment = theSeg[iSeg];
1704 if (3 == theSeg[iSeg]->
first.station()) {
1705 thisSegment = theSeg[iSeg];
1717 it = extrapolatedPoint.find(
int(cscchamberCenter.
z()));
1718 if (it == extrapolatedPoint.end()) {
1721 double paramaterLine = lineParametrization(segPos.
z(), cscchamberCenter.
z(), segDir.
z());
1722 double xExtrapolated = extrapolate1D(segPos.
x(), segDir.
x(), paramaterLine);
1723 double yExtrapolated = extrapolate1D(segPos.
y(), segDir.
y(), paramaterLine);
1724 GlobalPoint globP(xExtrapolated, yExtrapolated, cscchamberCenter.
z());
1725 extrapolatedPoint[
int(cscchamberCenter.
z())] = globP;
1728 LocalPoint extrapolatedPointLocal = cscchamber->
toLocal(extrapolatedPoint[
int(cscchamberCenter.
z())]);
1731 const std::array<const float, 4>& layerBounds = layerGeom->
parameters();
1732 float shiftFromEdge = 15.;
1733 float shiftFromDeadZone = 10.;
1735 bool pass = withinSensitiveRegion(extrapolatedPointLocal,
1748 for (
int iL = 0; iL < 6; ++iL) {
1756 if (cscchamberCenter.
z() < 0) {
1757 verticalScale = -verticalScale;
1759 verticalScale += 10.5;
1760 hSensitiveAreaEvt->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1761 if (nRHLayers > 1) {
1766 hEffDenominator->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1768 hEffDenominatorTight->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1772 hSSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale));
1774 hSSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale));
1777 for (
int iL = 0; iL < 6; ++iL) {
1783 hRHSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1785 hRHSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1792 hWireSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1794 hWireSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1800 hStripSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1802 hStripSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1814 void CSCValidation::getEfficiency(
float bin,
float Norm, std::vector<float>& eff) {
1817 float EffError = 0.;
1818 if (fabs(Norm) > 0.000000001) {
1828 void CSCValidation::histoEfficiency(TH1F* readHisto, TH1F* writeHisto) {
1829 std::vector<float> eff(2);
1830 int Nbins = readHisto->GetSize() - 2;
1833 std::vector<float> EffError(
Nbins);
1836 for (
int i = 0;
i < 20;
i++) {
1837 Num = readHisto->GetBinContent(
i + 1);
1838 Den = readHisto->GetBinContent(
i + 21);
1839 getEfficiency(Num, Den, eff);
1841 EffError[
i] = eff[1];
1843 writeHisto->SetBinError(
i + 1, EffError[
i]);
1847 bool CSCValidation::withinSensitiveRegion(
LocalPoint localPos,
1848 const std::array<const float, 4>& layerBounds,
1851 float shiftFromEdge,
1852 float shiftFromDeadZone) {
1856 float y_center = 0.;
1857 double yUp = layerBounds[3] + y_center;
1858 double yDown = -layerBounds[3] + y_center;
1859 double xBound1Shifted = layerBounds[0] - shiftFromEdge;
1860 double xBound2Shifted = layerBounds[1] - shiftFromEdge;
1861 double lineSlope = (yUp - yDown) / (xBound2Shifted - xBound1Shifted);
1862 double lineConst = yUp - lineSlope * xBound2Shifted;
1863 double yBorder = lineSlope *
abs(localPos.
x()) + lineConst;
1866 std::vector<float> deadZoneCenter(6);
1867 float cutZone = shiftFromDeadZone;
1871 deadZoneCenter[0] = -162.48;
1872 deadZoneCenter[1] = -81.8744;
1873 deadZoneCenter[2] = -21.18165;
1874 deadZoneCenter[3] = 39.51105;
1875 deadZoneCenter[4] = 100.2939;
1876 deadZoneCenter[5] = 160.58;
1878 if (localPos.
y() > yBorder &&
1879 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1880 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1881 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone) ||
1882 (localPos.
y() > deadZoneCenter[3] + cutZone && localPos.
y() < deadZoneCenter[4] - cutZone) ||
1883 (localPos.
y() > deadZoneCenter[4] + cutZone && localPos.
y() < deadZoneCenter[5] - cutZone))) {
1886 }
else if (1 ==
ring) {
1888 deadZoneCenter[0] = -95.80;
1889 deadZoneCenter[1] = -27.47;
1890 deadZoneCenter[2] = 33.67;
1891 deadZoneCenter[3] = 90.85;
1893 deadZoneCenter[0] = -89.305;
1894 deadZoneCenter[1] = -39.705;
1895 deadZoneCenter[2] = 20.195;
1896 deadZoneCenter[3] = 77.395;
1898 deadZoneCenter[0] = -75.645;
1899 deadZoneCenter[1] = -26.055;
1900 deadZoneCenter[2] = 23.855;
1901 deadZoneCenter[3] = 70.575;
1903 if (localPos.
y() > yBorder &&
1904 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1905 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1906 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1912 deadZoneCenter[0] = -83.155;
1913 deadZoneCenter[1] = -22.7401;
1914 deadZoneCenter[2] = 27.86665;
1915 deadZoneCenter[3] = 81.005;
1916 if (localPos.
y() > yBorder &&
1917 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1918 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1919 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1922 }
else if (2 ==
ring) {
1923 deadZoneCenter[0] = -86.285;
1924 deadZoneCenter[1] = -32.88305;
1925 deadZoneCenter[2] = 32.867423;
1926 deadZoneCenter[3] = 88.205;
1927 if (localPos.
y() > (yBorder) &&
1928 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1929 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1930 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1933 }
else if (1 ==
ring) {
1934 deadZoneCenter[0] = -31.5;
1935 deadZoneCenter[1] = 86.0;
1936 if (localPos.
y() > (yBorder) &&
1937 (localPos.
y() > deadZoneCenter[0] && localPos.
y() < deadZoneCenter[1] - cutZone)) {
1940 }
else if (4 ==
ring) {
1941 deadZoneCenter[0] = -86.0;
1942 deadZoneCenter[1] = -31.5;
1943 if (localPos.
y() > (yBorder) &&
1944 (localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1])) {
1971 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
1975 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
1976 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
1977 for (; digiItr !=
last; ++digiItr) {
1978 int thisStrip = digiItr->getStrip();
1979 if (thisStrip == (centerStrip)) {
1980 std::vector<int> myADCVals = digiItr->getADCCounts();
1981 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1982 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1983 SigADC[0] = thisSignal - 6 * thisPedestal;
1986 if (thisStrip == (centerStrip + 1)) {
1987 std::vector<int> myADCVals = digiItr->getADCCounts();
1988 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1989 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1990 SigADC[1] = thisSignal - 6 * thisPedestal;
1992 if (thisStrip == (centerStrip + 2)) {
1993 std::vector<int> myADCVals = digiItr->getADCCounts();
1994 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1995 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1996 SigADC[2] = thisSignal - 6 * thisPedestal;
1998 if (thisStrip == (centerStrip - 1)) {
1999 std::vector<int> myADCVals = digiItr->getADCCounts();
2000 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2001 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
2002 SigADC[3] = thisSignal - 6 * thisPedestal;
2004 if (thisStrip == (centerStrip - 2)) {
2005 std::vector<int> myADCVals = digiItr->getADCCounts();
2006 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2007 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
2008 SigADC[4] = thisSignal - 6 * thisPedestal;
2011 TotalADC = 0.2 * (SigADC[0] + SigADC[1] + SigADC[2] + SigADC[3] + SigADC[4]);
2027 for (recIt =
recHits->begin(); recIt !=
recHits->end(); recIt++) {
2031 AllRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idrec, *recIt));
2034 int centerid = recIt->nStrips() / 2;
2035 int centerStrip = recIt->channels(centerid);
2037 float rHsignal = getthisSignal(*
strips, idrec, centerStrip);
2039 rHsignal,
"hrHSignal",
"Signal in the 4th time bin for centre strip", 1100, -99, 1000,
"recHits");
2043 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
2044 for (std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2047 float xrec = lpRH.
x();
2048 float yrec = lpRH.
y();
2049 float zrec = lpRH.
z();
2050 bool RHalreadyinMap =
false;
2052 multimap<CSCDetId, CSCRecHit2D>::iterator segRHit;
2053 segRHit = SegRechits.find(idRH);
2054 if (segRHit != SegRechits.end()) {
2055 for (; segRHit != SegRechits.upper_bound(idRH); ++segRHit) {
2057 LocalPoint lposRH = (segRHit->second).localPosition();
2058 float xpos = lposRH.
x();
2059 float ypos = lposRH.
y();
2060 float zpos = lposRH.
z();
2061 if (xrec == xpos && yrec == ypos && zrec == zpos) {
2062 RHalreadyinMap =
true;
2068 if (!RHalreadyinMap) {
2069 SegRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idRH, *iRH));
2074 findNonAssociatedRecHits(cscGeom,
strips);
2085 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator allRHiter = AllRechits.begin(); allRHiter != AllRechits.end();
2088 LocalPoint lpRH = (allRHiter->second).localPosition();
2089 float xrec = lpRH.
x();
2090 float yrec = lpRH.
y();
2091 float zrec = lpRH.
z();
2093 bool foundmatch =
false;
2094 multimap<CSCDetId, CSCRecHit2D>::iterator segRHit;
2095 segRHit = SegRechits.find(idRH);
2096 if (segRHit != SegRechits.end()) {
2097 for (; segRHit != SegRechits.upper_bound(idRH); ++segRHit) {
2098 LocalPoint lposRH = (segRHit->second).localPosition();
2099 float xpos = lposRH.
x();
2100 float ypos = lposRH.
y();
2101 float zpos = lposRH.
z();
2103 if (xrec == xpos && yrec == ypos && zrec == zpos) {
2108 float dclose = 1000.;
2111 d =
sqrt(
pow(xrec - xpos, 2) +
pow(yrec - ypos, 2) +
pow(zrec - zpos, 2));
2114 if (distRHmap.find((allRHiter->second)) ==
2116 distRHmap.insert(make_pair(allRHiter->second, dclose));
2119 distRHmap.erase(allRHiter->second);
2121 make_pair(allRHiter->second, dclose));
2128 NonAssociatedRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idRH, allRHiter->second));
2132 for (std::map<CSCRecHit2D, float, ltrh>::iterator iter = distRHmap.begin(); iter != distRHmap.end(); ++iter) {
2133 histos->fill1DHist(iter->second,
2135 "Distance of Non Associated RecHit from closest Segment RecHit",
2139 "NonAssociatedRechits");
2142 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator iter = NonAssociatedRechits.begin();
2143 iter != NonAssociatedRechits.end();
2146 int kEndcap = idrec.
endcap();
2147 int cEndcap = idrec.
endcap();
2150 int kRing = idrec.
ring();
2151 int kStation = idrec.
station();
2152 int kChamber = idrec.
chamber();
2156 LocalPoint rhitlocal = (iter->second).localPosition();
2157 float xreco = rhitlocal.
x();
2158 float yreco = rhitlocal.
y();
2161 int centerid = (iter->second).
nStrips() / 2;
2162 int centerStrip = (iter->second).
channels(centerid);
2166 float sumsides = 0.;
2168 for (
unsigned int i = 0;
i < (iter->second).
nStrips();
i++) {
2169 for (
unsigned int j = 0;
j < (iter->second).
nTimeBins() - 1;
j++) {
2170 rHSumQ += (iter->second).adcs(
i,
j);
2172 sumsides += (iter->second).adcs(
i,
j);
2176 float rHratioQ = sumsides / rHSumQ;
2181 float rHtime = (iter->second).tpeak() / 50;
2184 int rHwidth = getWidth(*
strips, idrec, centerStrip);
2191 float grecx = rhitglobal.
x();
2192 float grecy = rhitglobal.
y();
2195 int kCodeBroad = cEndcap * (4 * (kStation - 1) + kRing);
2196 int kCodeNarrow = cEndcap * (100 * (kRing - 1) + kChamber);
2200 kCodeBroad,
"hNARHCodeBroad",
"broad scope code for recHits", 33, -16.5, 16.5,
"NonAssociatedRechits");
2202 histos->fill1DHist(kCodeNarrow,
2204 "narrow scope recHit code station 1",
2208 "NonAssociatedRechits");
2210 histos->fill1DHist(kCodeNarrow,
2212 "narrow scope recHit code station 2",
2216 "NonAssociatedRechits");
2218 histos->fill1DHist(kCodeNarrow,
2220 "narrow scope recHit code station 3",
2224 "NonAssociatedRechits");
2226 histos->fill1DHist(kCodeNarrow,
2228 "narrow scope recHit code station 4",
2232 "NonAssociatedRechits");
2233 histos->fill1DHistByType(
kLayer,
"hNARHLayer",
"RecHits per Layer", idrec, 8, -0.5, 7.5,
"NonAssociatedRechits");
2234 histos->fill1DHistByType(xreco,
"hNARHX",
"Local X of recHit", idrec, 160, -80., 80.,
"NonAssociatedRechits");
2235 histos->fill1DHistByType(yreco,
"hNARHY",
"Local Y of recHit", idrec, 60, -180., 180.,
"NonAssociatedRechits");
2236 if (kStation == 1 && (kRing == 1 || kRing == 4))
2237 histos->fill1DHistByType(
2238 rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 4000,
"NonAssociatedRechits");
2240 histos->fill1DHistByType(
2241 rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 2000,
"NonAssociatedRechits");
2242 histos->fill1DHistByType(
2243 rHratioQ,
"hNARHRatioQ",
"Ratio (Ql+Qr)/Qt)", idrec, 120, -0.1, 1.1,
"NonAssociatedRechits");
2244 histos->fill1DHistByType(rHtime,
"hNARHTiming",
"recHit Timing", idrec, 200, -10, 10,
"NonAssociatedRechits");
2245 histos->fill2DHistByStation(grecx,
2248 "recHit Global Position",
2256 "NonAssociatedRechits");
2257 histos->fill1DHistByType(
2258 rHwidth,
"hNARHwidth",
"width for Non associated recHit", idrec, 21, -0.5, 20.5,
"NonAssociatedRechits");
2261 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator iter = SegRechits.begin(); iter != SegRechits.end(); ++iter) {
2263 int kEndcap = idrec.
endcap();
2264 int cEndcap = idrec.
endcap();
2267 int kRing = idrec.
ring();
2268 int kStation = idrec.
station();
2269 int kChamber = idrec.
chamber();
2273 LocalPoint rhitlocal = (iter->second).localPosition();
2274 float xreco = rhitlocal.
x();
2275 float yreco = rhitlocal.
y();
2278 int centerid = (iter->second).
nStrips() / 2;
2279 int centerStrip = (iter->second).
channels(centerid);
2284 float sumsides = 0.;
2286 for (
unsigned int i = 0;
i < (iter->second).
nStrips();
i++) {
2287 for (
unsigned int j = 0;
j < (iter->second).
nTimeBins() - 1;
j++) {
2288 rHSumQ += (iter->second).adcs(
i,
j);
2290 sumsides += (iter->second).adcs(
i,
j);
2294 float rHratioQ = sumsides / rHSumQ;
2299 float rHtime = (iter->second).tpeak() / 50;
2302 int rHwidth = getWidth(*
strips, idrec, centerStrip);
2309 float grecx = rhitglobal.
x();
2310 float grecy = rhitglobal.
y();
2313 int kCodeBroad = cEndcap * (4 * (kStation - 1) + kRing);
2314 int kCodeNarrow = cEndcap * (100 * (kRing - 1) + kChamber);
2318 kCodeBroad,
"hSegRHCodeBroad",
"broad scope code for recHits", 33, -16.5, 16.5,
"AssociatedRechits");
2320 histos->fill1DHist(kCodeNarrow,
2321 "hSegRHCodeNarrow1",
2322 "narrow scope recHit code station 1",
2326 "AssociatedRechits");
2328 histos->fill1DHist(kCodeNarrow,
2329 "hSegRHCodeNarrow2",
2330 "narrow scope recHit code station 2",
2334 "AssociatedRechits");
2336 histos->fill1DHist(kCodeNarrow,
2337 "hSegRHCodeNarrow3",
2338 "narrow scope recHit code station 3",
2342 "AssociatedRechits");
2344 histos->fill1DHist(kCodeNarrow,
2345 "hSegRHCodeNarrow4",
2346 "narrow scope recHit code station 4",
2350 "AssociatedRechits");
2351 histos->fill1DHistByType(
kLayer,
"hSegRHLayer",
"RecHits per Layer", idrec, 8, -0.5, 7.5,
"AssociatedRechits");
2352 histos->fill1DHistByType(xreco,
"hSegRHX",
"Local X of recHit", idrec, 160, -80., 80.,
"AssociatedRechits");
2353 histos->fill1DHistByType(yreco,
"hSegRHY",
"Local Y of recHit", idrec, 60, -180., 180.,
"AssociatedRechits");
2354 if (kStation == 1 && (kRing == 1 || kRing == 4))
2355 histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 4000,
"AssociatedRechits");
2357 histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 2000,
"AssociatedRechits");
2358 histos->fill1DHistByType(rHratioQ,
"hSegRHRatioQ",
"Ratio (Ql+Qr)/Qt)", idrec, 120, -0.1, 1.1,
"AssociatedRechits");
2359 histos->fill1DHistByType(rHtime,
"hSegRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"AssociatedRechits");
2360 histos->fill2DHistByStation(grecx,
2363 "recHit Global Position",
2371 "AssociatedRechits");
2372 histos->fill1DHistByType(
2373 rHwidth,
"hSegRHwidth",
"width for Non associated recHit", idrec, 21, -0.5, 20.5,
"AssociatedRechits");
2379 NonAssociatedRechits.clear();
2388 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
2393 vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2394 vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2398 if (St == 1 &&
Rg == 4) {
2399 while (centerStrip > 16)
2402 for (; digiItr !=
last; ++digiItr) {
2403 int thisStrip = digiItr->getStrip();
2405 std::vector<int> myADCVals = digiItr->getADCCounts();
2406 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2408 if (thisStrip == (centerStrip)) {
2409 thisADC =
Signal - thisPedestal;
2415 if (thisStrip == (centerStrip + 1)) {
2416 std::vector<int> myADCVals = digiItr->getADCCounts();
2418 if (thisStrip == (centerStrip - 1)) {
2419 std::vector<int> myADCVals = digiItr->getADCCounts();
2442 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
2445 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2446 std::vector<CSCStripDigi>::const_iterator
first = (*sIt).second.first;
2447 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2448 std::vector<CSCStripDigi>::const_iterator it = (*sIt).second.first;
2449 std::vector<CSCStripDigi>::const_iterator itr = (*sIt).second.first;
2453 if (St == 1 &&
Rg == 4) {
2454 while (centerStrip > 16)
2457 for (; digiItr !=
last; ++digiItr) {
2458 int thisStrip = digiItr->getStrip();
2459 if (thisStrip == (centerStrip)) {
2461 for (; it !=
last; ++it) {
2462 int strip = it->getStrip();
2463 std::vector<int> myADCVals = it->getADCCounts();
2464 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2465 if (((
float)myADCVals[3] - thisPedestal) < 6 || widthpos == 10 || it ==
last) {
2468 if (
strip != centerStrip) {
2473 for (; itr !=
first; --itr) {
2474 int strip = itr->getStrip();
2475 std::vector<int> myADCVals = itr->getADCCounts();
2476 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2477 if (((
float)myADCVals[3] - thisPedestal) < 6 || widthneg == 10 || itr ==
first) {
2480 if (
strip != centerStrip) {
2502 int channel = 0,
mult, wire,
layer, idlayer, idchamber,
ring;
2503 int wire_strip_rechit_present;
2507 std::map<int, int>::iterator intIt;
2509 m_single_wire_layer.clear();
2514 m_wire_hvsegm.clear();
2515 std::map<int, std::vector<int> >::iterator intvecIt;
2517 int csctype[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
2518 int hvsegm_layer[10] = {1, 1, 3, 3, 3, 5, 3, 5, 3, 5};
2521 for (
int i = 0;
i < 10;
i++)
2522 nmbhvsegm.push_back(hvsegm_layer[
i]);
2524 std::vector<int> zer_1_1a(49, 0);
2526 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2527 m_wire_hvsegm[
id] = zer_1_1a;
2528 intvecIt = m_wire_hvsegm.find(
id);
2529 for (
int wire = 1; wire <= 48; wire++)
2530 intvecIt->second[wire] = 1;
2533 std::vector<int> zer_1_1b(49, 0);
2535 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2536 m_wire_hvsegm[
id] = zer_1_1b;
2537 intvecIt = m_wire_hvsegm.find(
id);
2538 for (
int wire = 1; wire <= 48; wire++)
2539 intvecIt->second[wire] = 1;
2542 std::vector<int> zer_1_2(65, 0);
2544 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2545 m_wire_hvsegm[
id] = zer_1_2;
2546 intvecIt = m_wire_hvsegm.find(
id);
2547 for (
int wire = 1; wire <= 24; wire++)
2548 intvecIt->second[wire] = 1;
2549 for (
int wire = 25; wire <= 48; wire++)
2550 intvecIt->second[wire] = 2;
2551 for (
int wire = 49; wire <= 64; wire++)
2552 intvecIt->second[wire] = 3;
2555 std::vector<int> zer_1_3(33, 0);
2557 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2558 m_wire_hvsegm[
id] = zer_1_3;
2559 intvecIt = m_wire_hvsegm.find(
id);
2560 for (
int wire = 1; wire <= 12; wire++)
2561 intvecIt->second[wire] = 1;
2562 for (
int wire = 13; wire <= 22; wire++)
2563 intvecIt->second[wire] = 2;
2564 for (
int wire = 23; wire <= 32; wire++)
2565 intvecIt->second[wire] = 3;
2568 std::vector<int> zer_2_1(113, 0);
2570 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2571 m_wire_hvsegm[
id] = zer_2_1;
2572 intvecIt = m_wire_hvsegm.find(
id);
2573 for (
int wire = 1; wire <= 44; wire++)
2574 intvecIt->second[wire] = 1;
2575 for (
int wire = 45; wire <= 80; wire++)
2576 intvecIt->second[wire] = 2;
2577 for (
int wire = 81; wire <= 112; wire++)
2578 intvecIt->second[wire] = 3;
2581 std::vector<int> zer_2_2(65, 0);
2583 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2584 m_wire_hvsegm[
id] = zer_2_2;
2585 intvecIt = m_wire_hvsegm.find(
id);
2586 for (
int wire = 1; wire <= 16; wire++)
2587 intvecIt->second[wire] = 1;
2588 for (
int wire = 17; wire <= 28; wire++)
2589 intvecIt->second[wire] = 2;
2590 for (
int wire = 29; wire <= 40; wire++)
2591 intvecIt->second[wire] = 3;
2592 for (
int wire = 41; wire <= 52; wire++)
2593 intvecIt->second[wire] = 4;
2594 for (
int wire = 53; wire <= 64; wire++)
2595 intvecIt->second[wire] = 5;
2598 std::vector<int> zer_3_1(97, 0);
2600 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2601 m_wire_hvsegm[
id] = zer_3_1;
2602 intvecIt = m_wire_hvsegm.find(
id);
2603 for (
int wire = 1; wire <= 32; wire++)
2604 intvecIt->second[wire] = 1;
2605 for (
int wire = 33; wire <= 64; wire++)
2606 intvecIt->second[wire] = 2;
2607 for (
int wire = 65; wire <= 96; wire++)
2608 intvecIt->second[wire] = 3;
2611 std::vector<int> zer_3_2(65, 0);
2613 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2614 m_wire_hvsegm[
id] = zer_3_2;
2615 intvecIt = m_wire_hvsegm.find(
id);
2616 for (
int wire = 1; wire <= 16; wire++)
2617 intvecIt->second[wire] = 1;
2618 for (
int wire = 17; wire <= 28; wire++)
2619 intvecIt->second[wire] = 2;
2620 for (
int wire = 29; wire <= 40; wire++)
2621 intvecIt->second[wire] = 3;
2622 for (
int wire = 41; wire <= 52; wire++)
2623 intvecIt->second[wire] = 4;
2624 for (
int wire = 53; wire <= 64; wire++)
2625 intvecIt->second[wire] = 5;
2628 std::vector<int> zer_4_1(97, 0);
2630 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2631 m_wire_hvsegm[
id] = zer_4_1;
2632 intvecIt = m_wire_hvsegm.find(
id);
2633 for (
int wire = 1; wire <= 32; wire++)
2634 intvecIt->second[wire] = 1;
2635 for (
int wire = 33; wire <= 64; wire++)
2636 intvecIt->second[wire] = 2;
2637 for (
int wire = 65; wire <= 96; wire++)
2638 intvecIt->second[wire] = 3;
2641 std::vector<int> zer_4_2(65, 0);
2643 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2644 m_wire_hvsegm[
id] = zer_4_2;
2645 intvecIt = m_wire_hvsegm.find(
id);
2646 for (
int wire = 1; wire <= 16; wire++)
2647 intvecIt->second[wire] = 1;
2648 for (
int wire = 17; wire <= 28; wire++)
2649 intvecIt->second[wire] = 2;
2650 for (
int wire = 29; wire <= 40; wire++)
2651 intvecIt->second[wire] = 3;
2652 for (
int wire = 41; wire <= 52; wire++)
2653 intvecIt->second[wire] = 4;
2654 for (
int wire = 53; wire <= 64; wire++)
2655 intvecIt->second[wire] = 5;
2660 wire_strip_rechit_present = 0;
2661 if (wirecltn.begin() != wirecltn.end())
2662 wire_strip_rechit_present = wire_strip_rechit_present + 1;
2663 if (strpcltn.begin() != strpcltn.end())
2664 wire_strip_rechit_present = wire_strip_rechit_present + 2;
2665 if (rechitcltn.begin() != rechitcltn.end())
2666 wire_strip_rechit_present = wire_strip_rechit_present + 4;
2668 if (wire_strip_rechit_present == 7) {
2675 for (wiredetUnitIt = wirecltn.begin(); wiredetUnitIt != wirecltn.end(); ++wiredetUnitIt) {
2676 const CSCDetId id = (*wiredetUnitIt).first;
2677 idlayer = indexer.
dbIndex(
id, channel);
2683 wire = (*digiIt).getWireGroup();
2689 if (m_single_wire_layer.find(idlayer) == m_single_wire_layer.end())
2690 m_single_wire_layer[idlayer] = wire;
2698 for (recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2700 idlayer = indexer.
dbIndex(
id, channel);
2701 idchamber = idlayer / 10;
2704 if (m_single_wire_layer.find(idlayer) != m_single_wire_layer.end()) {
2705 if (recIt->nStrips() == 3) {
2707 unsigned int binmx = 0;
2710 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2711 for (
unsigned int j = 0;
j < recIt->nTimeBins();
j++)
2712 if (recIt->adcs(
i,
j) > adcmax) {
2713 adcmax = recIt->adcs(
i,
j);
2717 float adc_3_3_sum = 0.0;
2719 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2720 for (
unsigned int j = binmx - 1;
j <= binmx + 1;
j++)
2721 adc_3_3_sum += recIt->adcs(
i,
j);
2723 if (adc_3_3_sum > 0.0 && adc_3_3_sum < 2000.0) {
2726 if (
id.
station() == 1 &&
id.
ring() == 4 && recIt->channels(1) > 16)
2730 wire = m_single_wire_layer[idlayer];
2731 int chambertype =
id.iChamberType(
id.
station(),
id.
ring());
2732 int hvsgmtnmb = m_wire_hvsegm[chambertype][wire];
2733 int nmbofhvsegm = nmbhvsegm[chambertype - 1];
2736 ss <<
"gas_gain_rechit_adc_3_3_sum_location_ME_" << idchamber;
2746 ss <<
"Gas Gain Rechit ADC3X3 Sum ME" << endcapstr <<
id.station() <<
"/" <<
ring <<
"/" <<
id.chamber();
2750 float y = adc_3_3_sum;
2751 histos->fill2DHist(x, y,
name,
title, 30, 1.0, 31.0, 50, 0.0, 2000.0,
"GasGain");
2776 int wire, wiretbin, nmbwiretbin,
layer, afeb, idlayer, idchamber;
2780 if (wirecltn.begin() != wirecltn.end()) {
2787 for (wiredetUnitIt = wirecltn.begin(); wiredetUnitIt != wirecltn.end(); ++wiredetUnitIt) {
2788 const CSCDetId id = (*wiredetUnitIt).first;
2789 idlayer = indexer.
dbIndex(
id, channel);
2790 idchamber = idlayer / 10;
2802 wire = (*digiIt).getWireGroup();
2803 wiretbin = (*digiIt).getTimeBin();
2804 nmbwiretbin = (*digiIt).getTimeBinsOn().size();
2805 afeb = 3 * ((wire - 1) / 8) + (
layer + 1) / 2;
2810 ss <<
"afeb_time_bin_vs_afeb_occupancy_ME_" << idchamber;
2813 ss <<
"Time Bin vs AFEB Occupancy ME" << endcapstr <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
2816 histos->fill2DHist(x, y,
name,
title, 42, 1., 43., 16, 0., 16.,
"AFEBTiming");
2821 ss <<
"nmb_afeb_time_bins_vs_afeb_ME_" << idchamber;
2824 ss <<
"Number of Time Bins vs AFEB ME" << endcapstr <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
2827 histos->fill2DHist(x, y,
name,
title, 42, 1., 43., 16, 0., 16.,
"AFEBTiming");
2843 int strip, tbin, cfeb, idlayer, idchamber;
2847 if (compars.begin() != compars.end()) {
2854 for (compdetUnitIt = compars.begin(); compdetUnitIt != compars.end(); ++compdetUnitIt) {
2855 const CSCDetId id = (*compdetUnitIt).first;
2856 idlayer = indexer.
dbIndex(
id, channel);
2857 idchamber = idlayer / 10;
2866 strip = (*digiIt).getStrip();
2874 tbin = (*digiIt).getTimeBin();
2875 cfeb = (
strip - 1) / 16 + 1;
2881 ss <<
"comp_time_bin_vs_cfeb_occupancy_ME_" << idchamber;
2884 ss <<
"Comparator Time Bin vs CFEB Occupancy ME" <<
endcap <<
id.station() <<
"/" <<
id.ring() <<
"/" 2888 histos->fill2DHist(x, y,
name,
title, 5, 1., 6., 16, 0., 16.,
"CompTiming");
2901 float adc_3_3_sum, adc_3_3_wtbin,
x,
y;
2902 int cfeb, idchamber,
ring;
2906 std::vector<float> zer(6, 0.0);
2909 std::map<int, int>::iterator intIt;
2911 if (rechitcltn.begin() != rechitcltn.end()) {
2917 for (recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2920 if (recIt->nStrips() == 3) {
2923 unsigned int binmx = 0;
2926 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2927 for (
unsigned int j = 0;
j < recIt->nTimeBins();
j++)
2928 if (recIt->adcs(
i,
j) > adcmax) {
2929 adcmax = recIt->adcs(
i,
j);
2935 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2936 for (
unsigned int j = binmx - 1;
j <= binmx + 1;
j++)
2937 adc_3_3_sum += recIt->adcs(
i,
j);
2940 if (adc_3_3_sum > 100.0) {
2941 int centerStrip = recIt->channels(1);
2944 if (
id.
station() == 1 &&
id.
ring() == 4 && centerStrip > 16)
2948 adc_3_3_wtbin = (*recIt).tpeak() / 50;
2949 idchamber = indexer.
dbIndex(
id, centerStrip) / 10;
2957 ss <<
"adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_" << idchamber;
2969 ss <<
"ADC 3X3 Weighted Time Bin vs CFEB Occupancy ME" << endcapstr <<
id.station() <<
"/" <<
ring <<
"/" 2974 cfeb = (centerStrip - 1) / 16 + 1;
2977 histos->fill2DHist(x, y,
name,
title, 5, 1., 6., 80, -8., 8.,
"ADCTiming");
2999 map<CSCDetId, float> segment_median_map;
3000 map<CSCDetId, GlobalPoint> segment_position_map;
3010 LocalPoint localPos = (*dSiter).localPosition();
3014 globalPosition = cscchamber->
toGlobal(localPos);
3018 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
3019 int nRH = (*dSiter).nRecHits();
3024 vector<float> non_zero;
3026 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
3027 non_zero.push_back(iRH->tpeak());
3032 sort(non_zero.begin(), non_zero.end());
3033 int middle_index = non_zero.size() / 2;
3034 float average_two = (non_zero.at(middle_index - 1) + non_zero.at(middle_index)) / 2.;
3035 if (non_zero.size() % 2)
3036 average_two = non_zero.at(middle_index);
3039 segment_median_map[
id] = average_two;
3040 segment_position_map[
id] = globalPosition;
3042 double distToIP =
sqrt(globalPosition.
x() * globalPosition.
x() + globalPosition.
y() * globalPosition.
y() +
3043 globalPosition.
z() * globalPosition.
z());
3045 histos->fillProfile(chamberSerial(
id),
3048 "Segment mean time",
3057 "timeChamberByType",
3058 "Segment mean time by chamber",
3066 histos->fill2DHist(distToIP,
3068 "seg_time_vs_distToIP",
3069 "Segment time vs. Distance to IP",
3077 histos->fill2DHist(globalPosition.
z(),
3079 "seg_time_vs_globZ",
3080 "Segment time vs. z position",
3088 histos->fill2DHist(fabs(globalPosition.
z()),
3090 "seg_time_vs_absglobZ",
3091 "Segment time vs. abs(z position)",
3103 map<CSCDetId, float>::const_iterator it_outer;
3104 map<CSCDetId, float>::const_iterator it_inner;
3105 for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++) {
3106 CSCDetId id_outer = it_outer->first;
3107 float t_outer = it_outer->second;
3110 for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++) {
3111 CSCDetId id_inner = it_inner->first;
3112 float t_inner = it_inner->second;
3117 if (chamberSerial(id_outer) == chamberSerial(id_inner))
3128 id_outer.
ring() == id_inner.
ring()) {
3129 histos->fill1DHist(t_outer - t_inner,
3130 "diff_opposite_endcaps",
3131 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3136 histos->fill1DHistByType(t_outer - t_inner,
3137 "diff_opposite_endcaps_byType",
3138 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3154 vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->
getRecords();
3155 vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
3156 int L1GMT_BXN = -100;
3157 bool has_CSCTrigger =
false;
3158 bool has_beamHaloTrigger =
false;
3159 for (igmtrr = L1Mrec.begin(); igmtrr != L1Mrec.end(); igmtrr++) {
3160 std::vector<L1MuRegionalCand>::const_iterator iter1;
3161 std::vector<L1MuRegionalCand> rmc;
3164 rmc = igmtrr->getCSCCands();
3165 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
3166 if (!(*iter1).empty()) {
3168 int kQuality = (*iter1).quality();
3170 has_beamHaloTrigger =
true;
3173 if (igmtrr->getBxInEvent() == 0 && icsc > 0) {
3175 L1GMT_BXN = igmtrr->getBxNr();
3176 has_CSCTrigger =
true;
3177 }
else if (igmtrr->getBxInEvent() == 0) {
3179 L1GMT_BXN = igmtrr->getBxNr();
3188 map<CSCDetId, int> ALCT_KeyWG_map;
3191 const CSCDetId& idALCT = (*j).first;
3194 if ((*digiIt).isValid()) {
3196 histos->fill1DHist((*digiIt).getBX(),
"ALCT_getBX",
"ALCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3198 (*digiIt).getFullBX(),
"ALCT_getFullBX",
"ALCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3200 if (ALCT_KeyWG_map.find(idALCT.
chamberId()) == ALCT_KeyWG_map.end()) {
3201 ALCT_KeyWG_map[idALCT.
chamberId()] = (*digiIt).getKeyWG();
3212 map<CSCDetId, int> CLCT_getFullBx_map;
3215 const CSCDetId& idCLCT = (*j).first;
3218 if ((*digiIt).isValid()) {
3220 histos->fill1DHist((*digiIt).getBX(),
"CLCT_getBX",
"CLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3222 (*digiIt).getFullBX(),
"CLCT_getFullBX",
"CLCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3224 if (CLCT_getFullBx_map.find(idCLCT.
chamberId()) == CLCT_getFullBx_map.end()) {
3225 CLCT_getFullBx_map[idCLCT.
chamberId()] = (*digiIt).getFullBX();
3235 int n_correlatedlcts = 0;
3239 if ((*digiIt).isValid()) {
3242 (*digiIt).getBX(),
"CorrelatedLCTS_getBX",
"CorrelatedLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3247 int nRecHits =
recHits->size();
3249 if (has_CSCTrigger) {
3250 histos->fill1DHist(L1GMT_BXN,
"BX_L1CSCCand",
"BX of L1 CSC Cand", 4001, -0.5, 4000.5,
"TimeMonitoring");
3251 histos->fill2DHist(L1GMT_BXN,
3253 "n_ALCTs_v_BX_L1CSCCand",
3254 "Number of ALCTs vs. BX of L1 CSC Cand",
3262 histos->fill2DHist(L1GMT_BXN,
3264 "n_CLCTs_v_BX_L1CSCCand",
3265 "Number of CLCTs vs. BX of L1 CSC Cand",
3273 histos->fill2DHist(L1GMT_BXN,
3275 "n_CorrelatedLCTs_v_BX_L1CSCCand",
3276 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand",
3284 histos->fill2DHist(L1GMT_BXN,
3286 "n_RecHits_v_BX_L1CSCCand",
3287 "Number of RecHits vs. BX of L1 CSC Cand",
3295 histos->fill2DHist(L1GMT_BXN,
3297 "n_Segments_v_BX_L1CSCCand",
3298 "Number of Segments vs. BX of L1 CSC Cand",
3307 if (has_CSCTrigger && has_beamHaloTrigger) {
3309 L1GMT_BXN,
"BX_L1CSCCand_w_beamHalo",
"BX of L1 CSC (w beamHalo bit)", 4001, -0.5, 4000.5,
"TimeMonitoring");
3310 histos->fill2DHist(L1GMT_BXN,
3312 "n_ALCTs_v_BX_L1CSCCand_w_beamHalo",
3313 "Number of ALCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3321 histos->fill2DHist(L1GMT_BXN,
3323 "n_CLCTs_v_BX_L1CSCCand_w_beamHalo",
3324 "Number of CLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3332 histos->fill2DHist(L1GMT_BXN,
3334 "n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo",
3335 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3343 histos->fill2DHist(L1GMT_BXN,
3345 "n_RecHits_v_BX_L1CSCCand_w_beamHalo",
3346 "Number of RecHits vs. BX of L1 CSC Cand (w beamHalo bit)",
3354 histos->fill2DHist(L1GMT_BXN,
3356 "n_Segments_v_BX_L1CSCCand_w_beamHalo",
3357 "Number of Segments vs. BX of L1 CSC Cand (w beamHalo bit)",
3378 event.getByToken(rd_token, rawdata);
3382 unsigned long dccBinCheckMask = 0x06080016;
3383 unsigned int examinerMask = 0x1FEBF3F6;
3384 unsigned int errorMask = 0x0;
3393 unsigned long length = fedData.
size();
3396 std::stringstream examiner_out, examiner_err;
3399 if (examinerMask & 0x40000)
3401 if (examinerMask & 0x8000)
3403 if (examinerMask & 0x0400)
3405 examiner->
setMask(examinerMask);
3406 const short unsigned int*
data = (
short unsigned int*)fedData.
data();
3412 goodEvent = !(examiner->
errors() & dccBinCheckMask);
3421 const std::vector<CSCDDUEventData>& dduData = dccData.
dduData();
3426 for (
unsigned int iDDU = 0; iDDU < dduData.size(); ++iDDU) {
3429 if (dduData[iDDU].trailer().errorstat() & errorMask) {
3430 LogTrace(
"CSCDCCUnpacker|CSCRawToDigi") <<
"DDU# " << iDDU <<
" has serious error - no digis unpacked! " 3431 << std::hex << dduData[iDDU].trailer().errorstat();
3436 const std::vector<CSCEventData>& cscData = dduData[iDDU].cscData();
3437 for (
unsigned int iCSC = 0; iCSC < cscData.size(); ++iCSC) {
3439 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
3440 int dmb = cscData[iCSC].dmbHeader()->dmbID();
3448 if ((vmecrate >= 1) && (vmecrate <= 60) && (dmb >= 1) && (dmb <= 10) && (dmb != 6)) {
3449 layer = pcrate->
detId(vmecrate, dmb, icfeb, ilayer);
3451 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") <<
" detID input out of range!!! ";
3452 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
3453 <<
" skipping chamber vme= " << vmecrate <<
" dmb= " << dmb;
3458 int nalct = cscData[iCSC].dmbHeader()->nalct();
3459 bool goodALCT =
false;
3461 if (nalct && cscData[iCSC].alctHeader()) {
3462 if (cscData[iCSC].alctHeader()->
check()) {
3468 int nclct = cscData[iCSC].dmbHeader()->nclct();
3469 bool goodTMB =
false;
3470 if (nclct && cscData[iCSC].tmbData()) {
3471 if (cscData[iCSC].tmbHeader()->
check()) {
3472 if (cscData[iCSC].comparatorData()->
check())
3477 if (goodTMB && goodALCT) {
3478 if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
3479 printf(
"no ALCT info for Chamber %d %d %d %d \n",
3486 if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
3487 printf(
"no CLCT info for Chamber %d %d %d %d \n",
3494 int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
3495 int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
3497 const CSCTMBHeader* tmbHead = cscData[iCSC].tmbHeader();
3508 "TMB_ALCTMatchTime",
3509 "TMB_ALCTMatchTime",
3517 tmbHead->
BXNCount(),
"TMB_BXNCount",
"TMB_BXNCount", 3601, -0.5, 3600.5,
"TimeMonitoring");
3519 tmbHead->
ALCTMatchTime(),
"TMB_ALCTMatchTime",
"TMB_ALCTMatchTime", 7, -0.5, 6.5,
"TimeMonitoring");
3522 "TMB_ALCTMatchTime",
3523 "TMB_ALCTMatchTime",
3530 histos->fillProfile(chamberSerial(
layer.chamberId()),
3532 "prof_TMB_ALCTMatchTime",
3533 "prof_TMB_ALCTMatchTime",
3540 histos->fillProfile(ALCT0Key,
3542 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3543 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3550 histos->fillProfileByType(ALCT0Key,
3552 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3553 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3565 if (TMB_ALCT_rel_L1A > 3563)
3566 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
3567 if (TMB_ALCT_rel_L1A < 0)
3568 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
3572 TMB_ALCT_rel_L1A,
"h1D_TMB_ALCT_rel_L1A",
"h1D_TMB_ALCT_rel_L1A", 11, 144.5, 155.5,
"TimeMonitoring");
3573 histos->fill2DHist(chamberSerial(
layer.chamberId()),
3575 "h2D_TMB_ALCT_rel_L1A",
3576 "h2D_TMB_ALCT_rel_L1A",
3586 "h2D_TMB_ALCT_rel_L1A_by_ring",
3587 "h2D_TMB_ALCT_rel_L1A_by_ring",
3595 histos->fillProfile(chamberSerial(
layer.chamberId()),
3597 "prof_TMB_ALCT_rel_L1A",
3598 "prof_TMB_ALCT_rel_L1A",
3605 histos->fillProfile(ringSerial(
layer.chamberId()),
3607 "prof_TMB_ALCT_rel_L1A_by_ring",
3608 "prof_TMB_ALCT_rel_L1A_by_ring",
3616 histos->fill2DHist(ALCT0Key,
3618 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3619 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3627 histos->fillProfile(ALCT0Key,
3629 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3630 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3637 histos->fillProfileByType(ALCT0Key,
3639 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3640 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3653 if (examiner !=
nullptr)
3661 void CSCValidation::endJob() {
std::cout <<
"CSCValidation: Events analyzed " << nEventsAnalyzed << std::endl; }
void crcCFEB(bool enable)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
LocalPoint localPosition() const override
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
Geom::Phi< T > phi() const
static const double slope[3]
Global3DPoint GlobalPoint
size_t size() const
Lenght of the data buffer in bytes.
std::string chamberTypeName() const
void crcALCT(bool enable)
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
const CSCLayerGeometry * geometry() const
constexpr std::array< uint8_t, layerIndexSize > layer
LocalVector localDirection() const override
Local direction.
C::const_iterator const_iterator
constant access iterator type
const std::vector< CSCDDUEventData > & dduData() const
accessor to dduData
T const * product() const
int dbIndex(const CSCDetId &id, int &channel)
Abs< T >::type abs(const T &t)
float ChiSquaredProbability(double chiSquared, double nrDOF)
#define DEFINE_FWK_MODULE(type)
static const std::string kLayer("layer")
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
CSCDetId chamberId() const
virtual const std::array< const float, 4 > parameters() const
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
int32_t check(const uint16_t *&buffer, int32_t length)
std::vector< const CSCChamber * > ChamberContainer
PedestalContainer pedestals
char data[epos_bytes_allocation]
ExaminerStatusType errors(void) const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
CrosstalkContainer crosstalk
NoiseMatrixContainer matrix
const ChamberContainer & chambers() const
Return a vector of all chambers.
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Geom::Theta< T > theta() const
const CSCChamberSpecs * specs() const
void setMask(ExaminerMaskType mask)
Power< A, B >::type pow(const A &a, const B &b)
Geom::Theta< T > theta() const
CSCDetId id() const
Get the (concrete) DetId.