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;
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;
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();
934 for (dRHIter =
recHits->begin(); dRHIter !=
recHits->end(); dRHIter++) {
937 int kEndcap = idrec.
endcap();
938 int kRing = idrec.
ring();
939 int kStation = idrec.
station();
940 int kChamber = idrec.
chamber();
944 LocalPoint rhitlocal = (*dRHIter).localPosition();
945 float xreco = rhitlocal.
x();
946 float yreco = rhitlocal.
y();
947 LocalError rerrlocal = (*dRHIter).localPositionError();
949 float xxerr = rerrlocal.
xx();
950 float yyerr = rerrlocal.
yy();
951 float xyerr = rerrlocal.
xy();
953 float stpos = (*dRHIter).positionWithinStrip();
954 float sterr = (*dRHIter).errorWithinStrip();
959 int adcsize = dRHIter->nStrips() * dRHIter->nTimeBins();
960 for (
unsigned int i = 0;
i < dRHIter->nStrips();
i++) {
961 for (
unsigned int j = 0;
j < dRHIter->nTimeBins() - 1;
j++) {
962 rHSumQ += dRHIter->adcs(
i,
j);
964 sumsides += dRHIter->adcs(
i,
j);
968 float rHratioQ = sumsides / rHSumQ;
974 rHtime = (*dRHIter).tpeak() / 50.;
981 float grecx = rhitglobal.
x();
982 float grecy = rhitglobal.
y();
985 if (writeTreeToFile && rhTreeCount < 1500000) {
986 histos->fillRechitTree(xreco, yreco, grecx, grecy, kEndcap, kStation, kRing, kChamber,
kLayer);
992 histos->fill2DHistByStation(
993 grecx, grecy,
"hRHGlobal",
"recHit Global Position", idrec, 100, -800., 800., 100, -800., 800.,
"recHits");
994 if (kStation == 1 && (kRing == 1 || kRing == 4))
995 histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 4000,
"recHits");
997 histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 2000,
"recHits");
998 histos->fill1DHistByType(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt", idrec, 120, -0.1, 1.1,
"recHits");
999 histos->fill1DHistByType(rHtime,
"hRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"recHits");
1000 histos->fill1DHistByType(
sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X", idrec, 100, -0.1, 2,
"recHits");
1001 histos->fill1DHistByType(
sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y", idrec, 100, -0.1, 2,
"recHits");
1002 histos->fill1DHistByType(xyerr,
"hRHxyerr",
"Corr. RecHit XY Error", idrec, 100, -1, 2,
"recHits");
1004 histos->fill1DHistByType(stpos,
"hRHstpos",
"Reconstructed Position on Strip", idrec, 120, -0.6, 0.6,
"recHits");
1005 histos->fill1DHistByType(
1006 sterr,
"hRHsterr",
"Estimated Error on Strip Measurement", idrec, 120, -0.05, 0.25,
"recHits");
1008 chamberSerial(idrec), rHSumQ,
"hRHSumQProfile",
"Sum 3x3 recHit Charge", 601, -0.5, 600.5, 0, 4000,
"recHits");
1010 chamberSerial(idrec), rHtime,
"hRHTimingProfile",
"recHit Timing", 601, -0.5, 600.5, -11, 11,
"recHits");
1012 if (kStation == 1 && (kRing == 1 || kRing == 4))
1013 histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 4000,
"RHQByLayer");
1015 histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge", idrec, 125, 0, 2000,
"RHQByLayer");
1016 histos->fill1DHistByLayer(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt", idrec, 120, -0.1, 1.1,
"RHQByLayer");
1017 histos->fill1DHistByLayer(rHtime,
"hRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"RHTimingByLayer");
1018 histos->fill2DHistByLayer(xreco,
1021 "recHit Local Position",
1029 "RHLocalXYByLayer");
1030 histos->fill1DHistByLayer(
1031 sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X", idrec, 100, -0.1, 2,
"RHErrorsByLayer");
1032 histos->fill1DHistByLayer(
1033 sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y", idrec, 100, -0.1, 2,
"RHErrorsByLayer");
1034 histos->fill1DHistByType(
1035 stpos,
"hRHstpos",
"Reconstructed Position on Strip", idrec, 120, -0.6, 0.6,
"RHStripPosByLayer");
1036 histos->fill1DHistByType(
1037 sterr,
"hRHsterr",
"Estimated Error on Strip Measurement", idrec, 120, -0.05, 0.25,
"RHStripPosByLayer");
1045 histos->fill1DHist(nRecHits,
"hRHnrechits",
"recHits per Event (all chambers)", 201, -0.5, 200.5,
"recHits");
1056 for (dSHrecIter =
recHits->begin(); dSHrecIter !=
recHits->end(); dSHrecIter++) {
1058 LocalPoint rhitlocal = (*dSHrecIter).localPosition();
1059 float xreco = rhitlocal.
x();
1060 float yreco = rhitlocal.
y();
1061 float xError =
sqrt((*dSHrecIter).localPositionError().xx());
1062 float yError =
sqrt((*dSHrecIter).localPositionError().yy());
1063 float simHitXres = -99;
1064 float simHitYres = -99;
1067 float mindiffX = 99;
1068 float mindiffY = 10;
1070 PSimHitContainer::const_iterator dSHsimIter;
1071 for (dSHsimIter =
simHits->begin(); dSHsimIter !=
simHits->end(); dSHsimIter++) {
1076 if (sId == idrec &&
abs((*dSHsimIter).particleType()) == 13) {
1078 LocalPoint sHitlocal = (*dSHsimIter).localPosition();
1081 if ((sHitlocal.
x() - xreco) < mindiffX && (sHitlocal.
y() - yreco) < mindiffY) {
1082 simHitXres = (sHitlocal.
x() - xreco);
1083 simHitYres = (sHitlocal.
y() - yreco);
1084 mindiffX = (sHitlocal.
x() - xreco);
1085 xPull = simHitXres /
xError;
1086 yPull = simHitYres /
yError;
1091 histos->fill1DHistByType(
1092 simHitXres,
"hSimXResid",
"SimHitX - Reconstructed X", idrec, 100, -1.0, 1.0,
"Resolution");
1093 histos->fill1DHistByType(
1094 simHitYres,
"hSimYResid",
"SimHitY - Reconstructed Y", idrec, 100, -5.0, 5.0,
"Resolution");
1095 histos->fill1DHistByType(xPull,
"hSimXPull",
"Local X Pulls", idrec, 100, -5.0, 5.0,
"Resolution");
1096 histos->fill1DHistByType(yPull,
"hSimYPull",
"Local Y Pulls", idrec, 100, -5.0, 5.0,
"Resolution");
1116 int kEndcap =
id.
endcap();
1117 int kRing =
id.ring();
1118 int kStation =
id.station();
1119 int kChamber =
id.chamber();
1122 float chisq = (*dSiter).chi2();
1123 int nhits = (*dSiter).nRecHits();
1124 int nDOF = 2 *
nhits - 4;
1126 LocalPoint localPos = (*dSiter).localPosition();
1127 float segX = localPos.
x();
1128 float segY = localPos.
y();
1135 float globTheta = 0.;
1140 globX = globalPosition.
x();
1141 globY = globalPosition.
y();
1143 globTheta = globalDirection.
theta();
1144 globPhi = globalDirection.
phi();
1148 if (writeTreeToFile && segTreeCount < 1500000) {
1149 histos->fillSegmentTree(segX, segY, globX, globY, kEndcap, kStation, kRing, kChamber);
1154 histos->fill2DHistByStation(globX,
1157 "Segment Global Positions;global x (cm)",
1166 histos->fill1DHistByType(
nhits,
"hSnHits",
"N hits on Segments",
id, 8, -0.5, 7.5,
"Segments");
1167 histos->fill1DHistByType(
theta,
"hSTheta",
"local theta segments",
id, 128, -3.2, 3.2,
"Segments");
1168 histos->fill1DHistByType((chisq / nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id, 110, -0.05, 10.5,
"Segments");
1169 histos->fill1DHistByType(
1170 chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id, 110, -0.05, 1.05,
"Segments");
1171 histos->fill1DHist(globTheta,
"hSGlobalTheta",
"segment global theta", 128, 0, 3.2,
"Segments");
1172 histos->fill1DHist(globPhi,
"hSGlobalPhi",
"segment global phi", 128, -3.2, 3.2,
"Segments");
1174 chamberSerial(
id),
nhits,
"hSnHitsProfile",
"N hits on Segments", 601, -0.5, 600.5, -0.5, 7.5,
"Segments");
1176 histos->fill1DHistByChamber(
nhits,
"hSnHits",
"N hits on Segments",
id, 8, -0.5, 7.5,
"HitsOnSegmentByChamber");
1177 histos->fill1DHistByChamber(
theta,
"hSTheta",
"local theta segments",
id, 128, -3.2, 3.2,
"DetailedSegments");
1178 histos->fill1DHistByChamber(
1179 (chisq / nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id, 110, -0.05, 10.5,
"SegChi2ByChamber");
1180 histos->fill1DHistByChamber(
1181 chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id, 110, -0.05, 1.05,
"SegChi2ByChamber");
1189 histos->fill1DHist(nSegments,
"hSnSegments",
"Segments per Event", 31, -0.5, 30.5,
"Segments");
1204 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1205 int nRH = (*dSiter).nRecHits();
1206 CLHEP::HepMatrix sp(6, 1);
1207 CLHEP::HepMatrix se(6, 1);
1208 for (std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1210 int kRing = idRH.
ring();
1211 int kStation = idRH.
station();
1215 int centerid = iRH->nStrips() / 2;
1216 int centerStrip = iRH->channels(centerid);
1220 float stpos = (*iRH).positionWithinStrip();
1221 se(
kLayer, 1) = (*iRH).errorWithinStrip();
1223 if (kStation == 1 && (kRing == 1 || kRing == 4))
1224 sp(
kLayer, 1) = stpos + centerStrip;
1227 sp(
kLayer, 1) = stpos + centerStrip;
1229 sp(
kLayer, 1) = stpos - 0.5 + centerStrip;
1234 float residual = -99;
1238 float expected = fitX(sp, se);
1239 residual = expected - sp(3, 1);
1240 pull = residual / se(3, 1);
1244 histos->fill1DHistByType(
1245 residual,
"hSResid",
"Fitted Position on Strip - Reconstructed for Layer 3",
id, 100, -0.5, 0.5,
"Resolution");
1246 histos->fill1DHistByType(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id, 100, -5.0, 5.0,
"Resolution");
1247 histos->fillProfile(chamberSerial(
id),
1250 "Fitted Position on Strip - Reconstructed for Layer 3",
1258 histos->fill1DHistByChamber(residual,
1260 "Fitted Position on Strip - Reconstructed for Layer 3",
1265 "DetailedResolution");
1266 histos->fill1DHistByChamber(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id, 100, -5.0, 5.0,
"Resolution");
1278 int nSAMuons = saMuons->size();
1279 histos->fill1DHist(nSAMuons,
"trNSAMuons",
"N Standalone Muons per Event", 6, -0.5, 5.5,
"STAMuons");
1281 for (reco::TrackCollection::const_iterator
muon = saMuons->begin();
muon != saMuons->end(); ++
muon) {
1282 float preco =
muon->p();
1283 float ptreco =
muon->pt();
1284 int n =
muon->recHitsSize();
1298 std::vector<CSCDetId> staChambers;
1305 if (rpcId.region() == 1) {
1309 if (rpcId.region() == -1) {
1318 staChambers.push_back(
detId.rawId());
1320 if (cscId.endcap() == 1) {
1324 if (cscId.endcap() == 2) {
1337 double crudeLength = deltaPnt.
mag();
1338 double deltaPhi = innerPnt.phi() - outerPnt.phi();
1339 double innerGlobalPolarAngle = innerKin.theta();
1340 double outerGlobalPolarAngle = outerKin.theta();
1343 histos->fill1DHist(
n,
"trN",
"N hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1345 histos->fill1DHist(
np,
"trNp",
"N hits on a STA Muon Track (plus endcap)", 51, -0.5, 50.5,
"STAMuons");
1347 histos->fill1DHist(nm,
"trNm",
"N hits on a STA Muon Track (minus endcap)", 51, -0.5, 50.5,
"STAMuons");
1348 histos->fill1DHist(nDTHits,
"trNDT",
"N DT hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1349 histos->fill1DHist(nCSCHits,
"trNCSC",
"N CSC hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1351 histos->fill1DHist(nCSCHitsp,
"trNCSCp",
"N CSC hits on a STA Muon Track (+ endcap)", 51, -0.5, 50.5,
"STAMuons");
1353 histos->fill1DHist(nCSCHitsm,
"trNCSCm",
"N CSC hits on a STA Muon Track (- endcap)", 51, -0.5, 50.5,
"STAMuons");
1354 histos->fill1DHist(nRPCHits,
"trNRPC",
"N RPC hits on a STA Muon Track", 51, -0.5, 50.5,
"STAMuons");
1356 histos->fill1DHist(nRPCHitsp,
"trNRPCp",
"N RPC hits on a STA Muon Track (+ endcap)", 51, -0.5, 50.5,
"STAMuons");
1358 histos->fill1DHist(nRPCHitsm,
"trNRPCm",
"N RPC hits on a STA Muon Track (- endcap)", 51, -0.5, 50.5,
"STAMuons");
1359 histos->fill1DHist(preco,
"trP",
"STA Muon Momentum", 100, 0, 300,
"STAMuons");
1360 histos->fill1DHist(ptreco,
"trPT",
"STA Muon pT", 100, 0, 40,
"STAMuons");
1361 histos->fill1DHist(
chi2,
"trChi2",
"STA Muon Chi2", 100, 0, 200,
"STAMuons");
1362 histos->fill1DHist(
normchi2,
"trNormChi2",
"STA Muon Normalized Chi2", 100, 0, 10,
"STAMuons");
1363 histos->fill1DHist(crudeLength,
"trLength",
"Straight Line Length of STA Muon", 120, 0., 2400.,
"STAMuons");
1365 deltaPhi,
"trDeltaPhi",
"Delta-Phi Between Inner and Outer STA Muon Pos.", 100, -0.5, 0.5,
"STAMuons");
1367 innerGlobalPolarAngle,
"trInnerPolar",
"Polar Angle of Inner P Vector (STA muons)", 128, 0, 3.2,
"STAMuons");
1369 outerGlobalPolarAngle,
"trOuterPolar",
"Polar Angle of Outer P Vector (STA muons)", 128, 0, 3.2,
"STAMuons");
1370 histos->fill1DHist(innerPnt.phi(),
"trInnerPhi",
"Phi of Inner Position (STA muons)", 256, -3.2, 3.2,
"STAMuons");
1371 histos->fill1DHist(outerPnt.phi(),
"trOuterPhi",
"Phi of Outer Position (STA muons)", 256, -3.2, 3.2,
"STAMuons");
1379 int CSCValidation::chamberSerial(
CSCDetId id) {
1380 int st =
id.station();
1382 int ch =
id.chamber();
1383 int ec =
id.endcap();
1385 if (st == 1 && ri == 1)
1387 if (st == 1 && ri == 2)
1389 if (st == 1 && ri == 3)
1391 if (st == 1 && ri == 4)
1393 if (st == 2 && ri == 1)
1395 if (st == 2 && ri == 2)
1397 if (st == 3 && ri == 1)
1399 if (st == 3 && ri == 2)
1401 if (st == 4 && ri == 1)
1403 if (st == 4 && ri == 2)
1406 kSerial = kSerial + 300;
1414 int CSCValidation::ringSerial(
CSCDetId id) {
1415 int st =
id.station();
1417 int ec =
id.endcap();
1419 if (st == 1 && ri == 1)
1421 if (st == 1 && ri == 2)
1423 if (st == 1 && ri == 3)
1425 if (st == 1 && ri == 4)
1434 kSerial = kSerial * (-1);
1443 float CSCValidation::fitX(
const CLHEP::HepMatrix&
points,
const CLHEP::HepMatrix&
errors) {
1451 for (
int i = 1;
i < 7;
i++) {
1454 S =
S + (1 / sigma2);
1455 Sy = Sy + (
points(
i, 1) / sigma2);
1456 Sx = Sx + ((
i) / sigma2);
1457 Sxx = Sxx + (
i *
i) / sigma2;
1458 Sxy = Sxy + (((
i)*
points(
i, 1)) / sigma2);
1462 float delta =
S * Sxx - Sx * Sx;
1463 float intercept = (Sxx * Sy - Sx * Sxy) /
delta;
1475 return (intercept +
slope * 3);
1488 bool allWires[2][4][4][36][6];
1489 bool allStrips[2][4][4][36][6];
1490 bool AllRecHits[2][4][4][36][6];
1491 bool AllSegments[2][4][4][36];
1494 for (
int iE = 0; iE < 2; iE++) {
1495 for (
int iS = 0; iS < 4; iS++) {
1496 for (
int iR = 0; iR < 4; iR++) {
1497 for (
int iC = 0; iC < 36; iC++) {
1498 AllSegments[iE][iS][iR][iC] =
false;
1500 for (
int iL = 0; iL < 6; iL++) {
1501 allWires[iE][iS][iR][iC][iL] =
false;
1502 allStrips[iE][iS][iR][iC][iL] =
false;
1503 AllRecHits[iE][iS][iR][iC][iL] =
false;
1514 std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
1515 std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
1516 for (; wireIter != lWire; ++wireIter) {
1526 std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
1527 std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
1528 for (; stripIter != lStrip; ++stripIter) {
1529 std::vector<int> myADCVals = stripIter->getADCCounts();
1530 bool thisStripFired =
false;
1531 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1534 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
1535 diff = (
float)myADCVals[iCount] - thisPedestal;
1537 thisStripFired =
true;
1541 if (thisStripFired) {
1558 std::vector<unsigned int> seg_ME2(2, 0);
1559 std::vector<unsigned int> seg_ME3(2, 0);
1560 std::vector<std::pair<CSCDetId, CSCSegment> > theSegments(4);
1573 unsigned int seg_tmp;
1575 ++seg_ME2[idseg.
endcap() - 1];
1576 seg_tmp = seg_ME2[idseg.
endcap() - 1];
1578 ++seg_ME3[idseg.
endcap() - 1];
1579 seg_tmp = seg_ME3[idseg.
endcap() - 1];
1582 if (1 == seg_tmp && 6 == (*segEffIt).nRecHits() && (*segEffIt).chi2() / (*segEffIt).degreesOfFreedom() < 3.) {
1583 std::pair<CSCDetId, CSCSegment> specSeg = make_pair((
CSCDetId)(*segEffIt).cscDetId(), *segEffIt);
1584 theSegments[2 * (idseg.
endcap() - 1) + (idseg.
station() - 2)] = specSeg;
1605 for (
int iE = 0; iE < 2; iE++) {
1606 for (
int iS = 0; iS < 4; iS++) {
1607 for (
int iR = 0; iR < 4; iR++) {
1608 for (
int iC = 0; iC < 36; iC++) {
1609 int NumberOfLayers = 0;
1610 for (
int iL = 0; iL < 6; iL++) {
1611 if (AllRecHits[iE][iS][iR][iC][iL]) {
1617 bin = iR + 1 + (iE * 10);
1619 bin = (iS + 1) * 2 + (iR + 1) + (iE * 10);
1620 if (NumberOfLayers > 1) {
1622 if (AllSegments[iE][iS][iR][iC]) {
1625 hSSTE->Fill(
bin - 0.5);
1626 if (NumberOfLayers > 3)
1627 hSSTETight->Fill(
bin - 0.5);
1631 hSSTE->Fill(20 +
bin - 0.5);
1632 if (NumberOfLayers > 3)
1633 hSSTETight->Fill(20 +
bin - 0.5);
1636 if (AllSegments[iE][iS][iR][iC]) {
1637 if (NumberOfLayers == 6) {
1640 hRHSTE->Fill(
bin - 0.5);
1641 hRHSTETight->Fill(
bin - 0.5);
1646 hRHSTE->Fill(20 +
bin - 0.5);
1647 if (NumberOfLayers > 3)
1648 hRHSTETight->Fill(20 +
bin - 0.5);
1657 std::vector<std::pair<CSCDetId, CSCSegment>*> theSeg;
1658 if (1 == seg_ME2[0])
1659 theSeg.push_back(&theSegments[0]);
1660 if (1 == seg_ME3[0])
1661 theSeg.push_back(&theSegments[1]);
1662 if (1 == seg_ME2[1])
1663 theSeg.push_back(&theSegments[2]);
1664 if (1 == seg_ME3[1])
1665 theSeg.push_back(&theSegments[3]);
1670 std::map<std::string, float> chamberTypes;
1671 chamberTypes[
"ME1/a"] = 0.5;
1672 chamberTypes[
"ME1/b"] = 1.5;
1673 chamberTypes[
"ME1/2"] = 2.5;
1674 chamberTypes[
"ME1/3"] = 3.5;
1675 chamberTypes[
"ME2/1"] = 4.5;
1676 chamberTypes[
"ME2/2"] = 5.5;
1677 chamberTypes[
"ME3/1"] = 6.5;
1678 chamberTypes[
"ME3/2"] = 7.5;
1679 chamberTypes[
"ME4/1"] = 8.5;
1680 chamberTypes[
"ME4/2"] = 9.5;
1682 if (!theSeg.empty()) {
1683 std::map<int, GlobalPoint> extrapolatedPoint;
1684 std::map<int, GlobalPoint>::iterator
it;
1687 for (
size_t nCh = 0;
nCh < ChamberContainer.size();
nCh++) {
1689 std::pair<CSCDetId, CSCSegment>* thisSegment =
nullptr;
1690 for (
size_t iSeg = 0; iSeg < theSeg.size(); ++iSeg) {
1691 if (cscchamber->
id().
endcap() == theSeg[iSeg]->first.endcap()) {
1693 if (2 == theSeg[iSeg]->
first.station()) {
1694 thisSegment = theSeg[iSeg];
1697 if (3 == theSeg[iSeg]->
first.station()) {
1698 thisSegment = theSeg[iSeg];
1710 it = extrapolatedPoint.find(
int(cscchamberCenter.
z()));
1711 if (
it == extrapolatedPoint.end()) {
1714 double paramaterLine = lineParametrization(segPos.
z(), cscchamberCenter.
z(), segDir.
z());
1715 double xExtrapolated = extrapolate1D(segPos.
x(), segDir.
x(), paramaterLine);
1716 double yExtrapolated = extrapolate1D(segPos.
y(), segDir.
y(), paramaterLine);
1717 GlobalPoint globP(xExtrapolated, yExtrapolated, cscchamberCenter.
z());
1718 extrapolatedPoint[
int(cscchamberCenter.
z())] = globP;
1721 LocalPoint extrapolatedPointLocal = cscchamber->
toLocal(extrapolatedPoint[
int(cscchamberCenter.
z())]);
1724 const std::array<const float, 4>& layerBounds = layerGeom->
parameters();
1725 float shiftFromEdge = 15.;
1726 float shiftFromDeadZone = 10.;
1728 bool pass = withinSensitiveRegion(extrapolatedPointLocal,
1741 for (
int iL = 0; iL < 6; ++iL) {
1749 if (cscchamberCenter.
z() < 0) {
1750 verticalScale = -verticalScale;
1752 verticalScale += 10.5;
1753 hSensitiveAreaEvt->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1754 if (nRHLayers > 1) {
1759 hEffDenominator->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1761 hEffDenominatorTight->Fill(
float(cscchamber->
id().
chamber()), verticalScale);
1765 hSSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale));
1767 hSSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale));
1770 for (
int iL = 0; iL < 6; ++iL) {
1776 hRHSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1778 hRHSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1785 hWireSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1787 hWireSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1793 hStripSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1795 hStripSTE2Tight->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1807 void CSCValidation::getEfficiency(
float bin,
float Norm, std::vector<float>& eff) {
1810 float EffError = 0.;
1811 if (fabs(Norm) > 0.000000001) {
1821 void CSCValidation::histoEfficiency(TH1F* readHisto, TH1F* writeHisto) {
1822 std::vector<float> eff(2);
1823 int Nbins = readHisto->GetSize() - 2;
1826 std::vector<float> EffError(
Nbins);
1829 for (
int i = 0;
i < 20;
i++) {
1830 Num = readHisto->GetBinContent(
i + 1);
1831 Den = readHisto->GetBinContent(
i + 21);
1832 getEfficiency(Num, Den, eff);
1834 EffError[
i] = eff[1];
1836 writeHisto->SetBinError(
i + 1, EffError[
i]);
1840 bool CSCValidation::withinSensitiveRegion(
LocalPoint localPos,
1841 const std::array<const float, 4>& layerBounds,
1844 float shiftFromEdge,
1845 float shiftFromDeadZone) {
1849 float y_center = 0.;
1850 double yUp = layerBounds[3] + y_center;
1851 double yDown = -layerBounds[3] + y_center;
1852 double xBound1Shifted = layerBounds[0] - shiftFromEdge;
1853 double xBound2Shifted = layerBounds[1] - shiftFromEdge;
1854 double lineSlope = (yUp - yDown) / (xBound2Shifted - xBound1Shifted);
1855 double lineConst = yUp - lineSlope * xBound2Shifted;
1856 double yBorder = lineSlope *
abs(localPos.
x()) + lineConst;
1859 std::vector<float> deadZoneCenter(6);
1860 float cutZone = shiftFromDeadZone;
1864 deadZoneCenter[0] = -162.48;
1865 deadZoneCenter[1] = -81.8744;
1866 deadZoneCenter[2] = -21.18165;
1867 deadZoneCenter[3] = 39.51105;
1868 deadZoneCenter[4] = 100.2939;
1869 deadZoneCenter[5] = 160.58;
1871 if (localPos.
y() > yBorder &&
1872 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1873 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1874 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone) ||
1875 (localPos.
y() > deadZoneCenter[3] + cutZone && localPos.
y() < deadZoneCenter[4] - cutZone) ||
1876 (localPos.
y() > deadZoneCenter[4] + cutZone && localPos.
y() < deadZoneCenter[5] - cutZone))) {
1879 }
else if (1 ==
ring) {
1881 deadZoneCenter[0] = -95.80;
1882 deadZoneCenter[1] = -27.47;
1883 deadZoneCenter[2] = 33.67;
1884 deadZoneCenter[3] = 90.85;
1886 deadZoneCenter[0] = -89.305;
1887 deadZoneCenter[1] = -39.705;
1888 deadZoneCenter[2] = 20.195;
1889 deadZoneCenter[3] = 77.395;
1891 deadZoneCenter[0] = -75.645;
1892 deadZoneCenter[1] = -26.055;
1893 deadZoneCenter[2] = 23.855;
1894 deadZoneCenter[3] = 70.575;
1896 if (localPos.
y() > yBorder &&
1897 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1898 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1899 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1905 deadZoneCenter[0] = -83.155;
1906 deadZoneCenter[1] = -22.7401;
1907 deadZoneCenter[2] = 27.86665;
1908 deadZoneCenter[3] = 81.005;
1909 if (localPos.
y() > yBorder &&
1910 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1911 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1912 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1915 }
else if (2 ==
ring) {
1916 deadZoneCenter[0] = -86.285;
1917 deadZoneCenter[1] = -32.88305;
1918 deadZoneCenter[2] = 32.867423;
1919 deadZoneCenter[3] = 88.205;
1920 if (localPos.
y() > (yBorder) &&
1921 ((localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1] - cutZone) ||
1922 (localPos.
y() > deadZoneCenter[1] + cutZone && localPos.
y() < deadZoneCenter[2] - cutZone) ||
1923 (localPos.
y() > deadZoneCenter[2] + cutZone && localPos.
y() < deadZoneCenter[3] - cutZone))) {
1926 }
else if (1 ==
ring) {
1927 deadZoneCenter[0] = -31.5;
1928 deadZoneCenter[1] = 86.0;
1929 if (localPos.
y() > (yBorder) &&
1930 (localPos.
y() > deadZoneCenter[0] && localPos.
y() < deadZoneCenter[1] - cutZone)) {
1933 }
else if (4 ==
ring) {
1934 deadZoneCenter[0] = -86.0;
1935 deadZoneCenter[1] = -31.5;
1936 if (localPos.
y() > (yBorder) &&
1937 (localPos.
y() > deadZoneCenter[0] + cutZone && localPos.
y() < deadZoneCenter[1])) {
1964 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
1968 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
1969 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
1970 for (; digiItr !=
last; ++digiItr) {
1971 int thisStrip = digiItr->getStrip();
1972 if (thisStrip == (centerStrip)) {
1973 std::vector<int> myADCVals = digiItr->getADCCounts();
1974 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1975 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1976 SigADC[0] = thisSignal - 6 * thisPedestal;
1979 if (thisStrip == (centerStrip + 1)) {
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[1] = thisSignal - 6 * thisPedestal;
1985 if (thisStrip == (centerStrip + 2)) {
1986 std::vector<int> myADCVals = digiItr->getADCCounts();
1987 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1988 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1989 SigADC[2] = thisSignal - 6 * thisPedestal;
1991 if (thisStrip == (centerStrip - 1)) {
1992 std::vector<int> myADCVals = digiItr->getADCCounts();
1993 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
1994 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
1995 SigADC[3] = thisSignal - 6 * thisPedestal;
1997 if (thisStrip == (centerStrip - 2)) {
1998 std::vector<int> myADCVals = digiItr->getADCCounts();
1999 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2000 float thisSignal = (myADCVals[2] + myADCVals[3] + myADCVals[4] + myADCVals[5] + myADCVals[6] + myADCVals[7]);
2001 SigADC[4] = thisSignal - 6 * thisPedestal;
2004 TotalADC = 0.2 * (SigADC[0] + SigADC[1] + SigADC[2] + SigADC[3] + SigADC[4]);
2020 for (recIt =
recHits->begin(); recIt !=
recHits->end(); recIt++) {
2024 AllRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idrec, *recIt));
2027 int centerid = recIt->nStrips() / 2;
2028 int centerStrip = recIt->channels(centerid);
2030 float rHsignal = getthisSignal(*
strips, idrec, centerStrip);
2032 rHsignal,
"hrHSignal",
"Signal in the 4th time bin for centre strip", 1100, -99, 1000,
"recHits");
2036 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
2037 for (std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2040 float xrec = lpRH.
x();
2041 float yrec = lpRH.
y();
2042 float zrec = lpRH.
z();
2043 bool RHalreadyinMap =
false;
2045 multimap<CSCDetId, CSCRecHit2D>::iterator segRHit;
2046 segRHit = SegRechits.find(idRH);
2047 if (segRHit != SegRechits.end()) {
2048 for (; segRHit != SegRechits.upper_bound(idRH); ++segRHit) {
2050 LocalPoint lposRH = (segRHit->second).localPosition();
2051 float xpos = lposRH.
x();
2052 float ypos = lposRH.
y();
2053 float zpos = lposRH.
z();
2054 if (xrec == xpos && yrec == ypos && zrec == zpos) {
2055 RHalreadyinMap =
true;
2061 if (!RHalreadyinMap) {
2062 SegRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idRH, *iRH));
2067 findNonAssociatedRecHits(cscGeom,
strips);
2078 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator allRHiter = AllRechits.begin(); allRHiter != AllRechits.end();
2081 LocalPoint lpRH = (allRHiter->second).localPosition();
2082 float xrec = lpRH.
x();
2083 float yrec = lpRH.
y();
2084 float zrec = lpRH.
z();
2086 bool foundmatch =
false;
2087 multimap<CSCDetId, CSCRecHit2D>::iterator segRHit;
2088 segRHit = SegRechits.find(idRH);
2089 if (segRHit != SegRechits.end()) {
2090 for (; segRHit != SegRechits.upper_bound(idRH); ++segRHit) {
2091 LocalPoint lposRH = (segRHit->second).localPosition();
2092 float xpos = lposRH.
x();
2093 float ypos = lposRH.
y();
2094 float zpos = lposRH.
z();
2096 if (xrec == xpos && yrec == ypos && zrec == zpos) {
2101 float dclose = 1000.;
2104 d =
sqrt(
pow(xrec - xpos, 2) +
pow(yrec - ypos, 2) +
pow(zrec - zpos, 2));
2107 if (distRHmap.find((allRHiter->second)) ==
2109 distRHmap.insert(make_pair(allRHiter->second, dclose));
2112 distRHmap.erase(allRHiter->second);
2114 make_pair(allRHiter->second, dclose));
2121 NonAssociatedRechits.insert(std::pair<CSCDetId, CSCRecHit2D>(idRH, allRHiter->second));
2125 for (std::map<CSCRecHit2D, float, ltrh>::iterator iter = distRHmap.begin(); iter != distRHmap.end(); ++iter) {
2126 histos->fill1DHist(iter->second,
2128 "Distance of Non Associated RecHit from closest Segment RecHit",
2132 "NonAssociatedRechits");
2135 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator iter = NonAssociatedRechits.begin();
2136 iter != NonAssociatedRechits.end();
2139 int kEndcap = idrec.
endcap();
2140 int cEndcap = idrec.
endcap();
2143 int kRing = idrec.
ring();
2144 int kStation = idrec.
station();
2145 int kChamber = idrec.
chamber();
2149 LocalPoint rhitlocal = (iter->second).localPosition();
2150 float xreco = rhitlocal.
x();
2151 float yreco = rhitlocal.
y();
2154 int centerid = (iter->second).
nStrips() / 2;
2155 int centerStrip = (iter->second).
channels(centerid);
2159 float sumsides = 0.;
2161 for (
unsigned int i = 0;
i < (iter->second).
nStrips();
i++) {
2162 for (
unsigned int j = 0;
j < (iter->second).
nTimeBins() - 1;
j++) {
2163 rHSumQ += (iter->second).adcs(
i,
j);
2165 sumsides += (iter->second).adcs(
i,
j);
2169 float rHratioQ = sumsides / rHSumQ;
2174 float rHtime = (iter->second).tpeak() / 50;
2177 int rHwidth = getWidth(*
strips, idrec, centerStrip);
2184 float grecx = rhitglobal.
x();
2185 float grecy = rhitglobal.
y();
2188 int kCodeBroad = cEndcap * (4 * (kStation - 1) + kRing);
2189 int kCodeNarrow = cEndcap * (100 * (kRing - 1) + kChamber);
2193 kCodeBroad,
"hNARHCodeBroad",
"broad scope code for recHits", 33, -16.5, 16.5,
"NonAssociatedRechits");
2195 histos->fill1DHist(kCodeNarrow,
2197 "narrow scope recHit code station 1",
2201 "NonAssociatedRechits");
2203 histos->fill1DHist(kCodeNarrow,
2205 "narrow scope recHit code station 2",
2209 "NonAssociatedRechits");
2211 histos->fill1DHist(kCodeNarrow,
2213 "narrow scope recHit code station 3",
2217 "NonAssociatedRechits");
2219 histos->fill1DHist(kCodeNarrow,
2221 "narrow scope recHit code station 4",
2225 "NonAssociatedRechits");
2226 histos->fill1DHistByType(
kLayer,
"hNARHLayer",
"RecHits per Layer", idrec, 8, -0.5, 7.5,
"NonAssociatedRechits");
2227 histos->fill1DHistByType(xreco,
"hNARHX",
"Local X of recHit", idrec, 160, -80., 80.,
"NonAssociatedRechits");
2228 histos->fill1DHistByType(yreco,
"hNARHY",
"Local Y of recHit", idrec, 60, -180., 180.,
"NonAssociatedRechits");
2229 if (kStation == 1 && (kRing == 1 || kRing == 4))
2230 histos->fill1DHistByType(
2231 rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 4000,
"NonAssociatedRechits");
2233 histos->fill1DHistByType(
2234 rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 2000,
"NonAssociatedRechits");
2235 histos->fill1DHistByType(
2236 rHratioQ,
"hNARHRatioQ",
"Ratio (Ql+Qr)/Qt)", idrec, 120, -0.1, 1.1,
"NonAssociatedRechits");
2237 histos->fill1DHistByType(rHtime,
"hNARHTiming",
"recHit Timing", idrec, 200, -10, 10,
"NonAssociatedRechits");
2238 histos->fill2DHistByStation(grecx,
2241 "recHit Global Position",
2249 "NonAssociatedRechits");
2250 histos->fill1DHistByType(
2251 rHwidth,
"hNARHwidth",
"width for Non associated recHit", idrec, 21, -0.5, 20.5,
"NonAssociatedRechits");
2254 for (std::multimap<CSCDetId, CSCRecHit2D>::iterator iter = SegRechits.begin(); iter != SegRechits.end(); ++iter) {
2256 int kEndcap = idrec.
endcap();
2257 int cEndcap = idrec.
endcap();
2260 int kRing = idrec.
ring();
2261 int kStation = idrec.
station();
2262 int kChamber = idrec.
chamber();
2266 LocalPoint rhitlocal = (iter->second).localPosition();
2267 float xreco = rhitlocal.
x();
2268 float yreco = rhitlocal.
y();
2271 int centerid = (iter->second).
nStrips() / 2;
2272 int centerStrip = (iter->second).
channels(centerid);
2277 float sumsides = 0.;
2279 for (
unsigned int i = 0;
i < (iter->second).
nStrips();
i++) {
2280 for (
unsigned int j = 0;
j < (iter->second).
nTimeBins() - 1;
j++) {
2281 rHSumQ += (iter->second).adcs(
i,
j);
2283 sumsides += (iter->second).adcs(
i,
j);
2287 float rHratioQ = sumsides / rHSumQ;
2292 float rHtime = (iter->second).tpeak() / 50;
2295 int rHwidth = getWidth(*
strips, idrec, centerStrip);
2302 float grecx = rhitglobal.
x();
2303 float grecy = rhitglobal.
y();
2306 int kCodeBroad = cEndcap * (4 * (kStation - 1) + kRing);
2307 int kCodeNarrow = cEndcap * (100 * (kRing - 1) + kChamber);
2311 kCodeBroad,
"hSegRHCodeBroad",
"broad scope code for recHits", 33, -16.5, 16.5,
"AssociatedRechits");
2313 histos->fill1DHist(kCodeNarrow,
2314 "hSegRHCodeNarrow1",
2315 "narrow scope recHit code station 1",
2319 "AssociatedRechits");
2321 histos->fill1DHist(kCodeNarrow,
2322 "hSegRHCodeNarrow2",
2323 "narrow scope recHit code station 2",
2327 "AssociatedRechits");
2329 histos->fill1DHist(kCodeNarrow,
2330 "hSegRHCodeNarrow3",
2331 "narrow scope recHit code station 3",
2335 "AssociatedRechits");
2337 histos->fill1DHist(kCodeNarrow,
2338 "hSegRHCodeNarrow4",
2339 "narrow scope recHit code station 4",
2343 "AssociatedRechits");
2344 histos->fill1DHistByType(
kLayer,
"hSegRHLayer",
"RecHits per Layer", idrec, 8, -0.5, 7.5,
"AssociatedRechits");
2345 histos->fill1DHistByType(xreco,
"hSegRHX",
"Local X of recHit", idrec, 160, -80., 80.,
"AssociatedRechits");
2346 histos->fill1DHistByType(yreco,
"hSegRHY",
"Local Y of recHit", idrec, 60, -180., 180.,
"AssociatedRechits");
2347 if (kStation == 1 && (kRing == 1 || kRing == 4))
2348 histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 4000,
"AssociatedRechits");
2350 histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge", idrec, 250, 0, 2000,
"AssociatedRechits");
2351 histos->fill1DHistByType(rHratioQ,
"hSegRHRatioQ",
"Ratio (Ql+Qr)/Qt)", idrec, 120, -0.1, 1.1,
"AssociatedRechits");
2352 histos->fill1DHistByType(rHtime,
"hSegRHTiming",
"recHit Timing", idrec, 200, -10, 10,
"AssociatedRechits");
2353 histos->fill2DHistByStation(grecx,
2356 "recHit Global Position",
2364 "AssociatedRechits");
2365 histos->fill1DHistByType(
2366 rHwidth,
"hSegRHwidth",
"width for Non associated recHit", idrec, 21, -0.5, 20.5,
"AssociatedRechits");
2372 NonAssociatedRechits.clear();
2381 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
2386 vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2387 vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2391 if (St == 1 &&
Rg == 4) {
2392 while (centerStrip > 16)
2395 for (; digiItr !=
last; ++digiItr) {
2396 int thisStrip = digiItr->getStrip();
2398 std::vector<int> myADCVals = digiItr->getADCCounts();
2399 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2401 if (thisStrip == (centerStrip)) {
2402 thisADC =
Signal - thisPedestal;
2408 if (thisStrip == (centerStrip + 1)) {
2409 std::vector<int> myADCVals = digiItr->getADCCounts();
2411 if (thisStrip == (centerStrip - 1)) {
2412 std::vector<int> myADCVals = digiItr->getADCCounts();
2435 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++) {
2438 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2439 std::vector<CSCStripDigi>::const_iterator
first = (*sIt).second.first;
2440 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2441 std::vector<CSCStripDigi>::const_iterator
it = (*sIt).second.first;
2442 std::vector<CSCStripDigi>::const_iterator itr = (*sIt).second.first;
2446 if (St == 1 &&
Rg == 4) {
2447 while (centerStrip > 16)
2450 for (; digiItr !=
last; ++digiItr) {
2451 int thisStrip = digiItr->getStrip();
2452 if (thisStrip == (centerStrip)) {
2456 std::vector<int> myADCVals =
it->getADCCounts();
2457 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2458 if (((
float)myADCVals[3] - thisPedestal) < 6 || widthpos == 10 ||
it ==
last) {
2461 if (
strip != centerStrip) {
2466 for (; itr !=
first; --itr) {
2467 int strip = itr->getStrip();
2468 std::vector<int> myADCVals = itr->getADCCounts();
2469 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
2470 if (((
float)myADCVals[3] - thisPedestal) < 6 || widthneg == 10 || itr ==
first) {
2473 if (
strip != centerStrip) {
2496 int wire_strip_rechit_present;
2500 std::map<int, int>::iterator intIt;
2502 m_single_wire_layer.clear();
2507 m_wire_hvsegm.clear();
2508 std::map<int, std::vector<int> >::iterator intvecIt;
2510 int csctype[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
2511 int hvsegm_layer[10] = {1, 1, 3, 3, 3, 5, 3, 5, 3, 5};
2514 for (
int i = 0;
i < 10;
i++)
2515 nmbhvsegm.push_back(hvsegm_layer[
i]);
2517 std::vector<int> zer_1_1a(49, 0);
2519 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2520 m_wire_hvsegm[
id] = zer_1_1a;
2521 intvecIt = m_wire_hvsegm.find(
id);
2523 intvecIt->second[
wire] = 1;
2526 std::vector<int> zer_1_1b(49, 0);
2528 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2529 m_wire_hvsegm[
id] = zer_1_1b;
2530 intvecIt = m_wire_hvsegm.find(
id);
2532 intvecIt->second[
wire] = 1;
2535 std::vector<int> zer_1_2(65, 0);
2537 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2538 m_wire_hvsegm[
id] = zer_1_2;
2539 intvecIt = m_wire_hvsegm.find(
id);
2541 intvecIt->second[
wire] = 1;
2543 intvecIt->second[
wire] = 2;
2545 intvecIt->second[
wire] = 3;
2548 std::vector<int> zer_1_3(33, 0);
2550 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2551 m_wire_hvsegm[
id] = zer_1_3;
2552 intvecIt = m_wire_hvsegm.find(
id);
2554 intvecIt->second[
wire] = 1;
2556 intvecIt->second[
wire] = 2;
2558 intvecIt->second[
wire] = 3;
2561 std::vector<int> zer_2_1(113, 0);
2563 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2564 m_wire_hvsegm[
id] = zer_2_1;
2565 intvecIt = m_wire_hvsegm.find(
id);
2567 intvecIt->second[
wire] = 1;
2569 intvecIt->second[
wire] = 2;
2571 intvecIt->second[
wire] = 3;
2574 std::vector<int> zer_2_2(65, 0);
2576 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2577 m_wire_hvsegm[
id] = zer_2_2;
2578 intvecIt = m_wire_hvsegm.find(
id);
2580 intvecIt->second[
wire] = 1;
2582 intvecIt->second[
wire] = 2;
2584 intvecIt->second[
wire] = 3;
2586 intvecIt->second[
wire] = 4;
2588 intvecIt->second[
wire] = 5;
2591 std::vector<int> zer_3_1(97, 0);
2593 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2594 m_wire_hvsegm[
id] = zer_3_1;
2595 intvecIt = m_wire_hvsegm.find(
id);
2597 intvecIt->second[
wire] = 1;
2599 intvecIt->second[
wire] = 2;
2601 intvecIt->second[
wire] = 3;
2604 std::vector<int> zer_3_2(65, 0);
2606 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2607 m_wire_hvsegm[
id] = zer_3_2;
2608 intvecIt = m_wire_hvsegm.find(
id);
2610 intvecIt->second[
wire] = 1;
2612 intvecIt->second[
wire] = 2;
2614 intvecIt->second[
wire] = 3;
2616 intvecIt->second[
wire] = 4;
2618 intvecIt->second[
wire] = 5;
2621 std::vector<int> zer_4_1(97, 0);
2623 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2624 m_wire_hvsegm[
id] = zer_4_1;
2625 intvecIt = m_wire_hvsegm.find(
id);
2627 intvecIt->second[
wire] = 1;
2629 intvecIt->second[
wire] = 2;
2631 intvecIt->second[
wire] = 3;
2634 std::vector<int> zer_4_2(65, 0);
2636 if (m_wire_hvsegm.find(
id) == m_wire_hvsegm.end())
2637 m_wire_hvsegm[
id] = zer_4_2;
2638 intvecIt = m_wire_hvsegm.find(
id);
2640 intvecIt->second[
wire] = 1;
2642 intvecIt->second[
wire] = 2;
2644 intvecIt->second[
wire] = 3;
2646 intvecIt->second[
wire] = 4;
2648 intvecIt->second[
wire] = 5;
2653 wire_strip_rechit_present = 0;
2654 if (wirecltn.begin() != wirecltn.end())
2655 wire_strip_rechit_present = wire_strip_rechit_present + 1;
2656 if (strpcltn.begin() != strpcltn.end())
2657 wire_strip_rechit_present = wire_strip_rechit_present + 2;
2658 if (rechitcltn.begin() != rechitcltn.end())
2659 wire_strip_rechit_present = wire_strip_rechit_present + 4;
2661 if (wire_strip_rechit_present == 7) {
2668 for (wiredetUnitIt = wirecltn.begin(); wiredetUnitIt != wirecltn.end(); ++wiredetUnitIt) {
2669 const CSCDetId id = (*wiredetUnitIt).first;
2670 idlayer = indexer.
dbIndex(
id, channel);
2676 wire = (*digiIt).getWireGroup();
2682 if (m_single_wire_layer.find(idlayer) == m_single_wire_layer.end())
2683 m_single_wire_layer[idlayer] =
wire;
2691 for (recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2693 idlayer = indexer.
dbIndex(
id, channel);
2694 idchamber = idlayer / 10;
2697 if (m_single_wire_layer.find(idlayer) != m_single_wire_layer.end()) {
2698 if (recIt->nStrips() == 3) {
2700 unsigned int binmx = 0;
2703 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2704 for (
unsigned int j = 0;
j < recIt->nTimeBins();
j++)
2705 if (recIt->adcs(
i,
j) > adcmax) {
2706 adcmax = recIt->adcs(
i,
j);
2710 float adc_3_3_sum = 0.0;
2712 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2713 for (
unsigned int j = binmx - 1;
j <= binmx + 1;
j++)
2714 adc_3_3_sum += recIt->adcs(
i,
j);
2716 if (adc_3_3_sum > 0.0 && adc_3_3_sum < 2000.0) {
2719 if (
id.
station() == 1 &&
id.
ring() == 4 && recIt->channels(1) > 16)
2723 wire = m_single_wire_layer[idlayer];
2724 int chambertype =
id.iChamberType(
id.
station(),
id.
ring());
2725 int hvsgmtnmb = m_wire_hvsegm[chambertype][
wire];
2726 int nmbofhvsegm = nmbhvsegm[chambertype - 1];
2729 ss <<
"gas_gain_rechit_adc_3_3_sum_location_ME_" << idchamber;
2739 ss <<
"Gas Gain Rechit ADC3X3 Sum ME" << endcapstr <<
id.station() <<
"/" <<
ring <<
"/" <<
id.chamber();
2743 float y = adc_3_3_sum;
2744 histos->fill2DHist(x, y,
name,
title, 30, 1.0, 31.0, 50, 0.0, 2000.0,
"GasGain");
2769 int wire, wiretbin, nmbwiretbin,
layer, afeb, idlayer, idchamber;
2773 if (wirecltn.begin() != wirecltn.end()) {
2780 for (wiredetUnitIt = wirecltn.begin(); wiredetUnitIt != wirecltn.end(); ++wiredetUnitIt) {
2781 const CSCDetId id = (*wiredetUnitIt).first;
2782 idlayer = indexer.
dbIndex(
id, channel);
2783 idchamber = idlayer / 10;
2795 wire = (*digiIt).getWireGroup();
2796 wiretbin = (*digiIt).getTimeBin();
2797 nmbwiretbin = (*digiIt).getTimeBinsOn().size();
2798 afeb = 3 * ((
wire - 1) / 8) + (
layer + 1) / 2;
2803 ss <<
"afeb_time_bin_vs_afeb_occupancy_ME_" << idchamber;
2806 ss <<
"Time Bin vs AFEB Occupancy ME" << endcapstr <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
2809 histos->fill2DHist(x, y,
name,
title, 42, 1., 43., 16, 0., 16.,
"AFEBTiming");
2814 ss <<
"nmb_afeb_time_bins_vs_afeb_ME_" << idchamber;
2817 ss <<
"Number of Time Bins vs AFEB ME" << endcapstr <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
2820 histos->fill2DHist(x, y,
name,
title, 42, 1., 43., 16, 0., 16.,
"AFEBTiming");
2836 int strip, tbin, cfeb, idlayer, idchamber;
2840 if (compars.begin() != compars.end()) {
2847 for (compdetUnitIt = compars.begin(); compdetUnitIt != compars.end(); ++compdetUnitIt) {
2848 const CSCDetId id = (*compdetUnitIt).first;
2849 idlayer = indexer.
dbIndex(
id, channel);
2850 idchamber = idlayer / 10;
2859 strip = (*digiIt).getStrip();
2867 tbin = (*digiIt).getTimeBin();
2868 cfeb = (
strip - 1) / 16 + 1;
2874 ss <<
"comp_time_bin_vs_cfeb_occupancy_ME_" << idchamber;
2877 ss <<
"Comparator Time Bin vs CFEB Occupancy ME" <<
endcap <<
id.station() <<
"/" <<
id.ring() <<
"/" 2881 histos->fill2DHist(x, y,
name,
title, 5, 1., 6., 16, 0., 16.,
"CompTiming");
2894 float adc_3_3_sum, adc_3_3_wtbin,
x,
y;
2895 int cfeb, idchamber,
ring;
2899 std::vector<float> zer(6, 0.0);
2902 std::map<int, int>::iterator intIt;
2904 if (rechitcltn.begin() != rechitcltn.end()) {
2910 for (recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2913 if (recIt->nStrips() == 3) {
2916 unsigned int binmx = 0;
2919 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2920 for (
unsigned int j = 0;
j < recIt->nTimeBins();
j++)
2921 if (recIt->adcs(
i,
j) > adcmax) {
2922 adcmax = recIt->adcs(
i,
j);
2928 for (
unsigned int i = 0;
i < recIt->nStrips();
i++)
2929 for (
unsigned int j = binmx - 1;
j <= binmx + 1;
j++)
2930 adc_3_3_sum += recIt->adcs(
i,
j);
2933 if (adc_3_3_sum > 100.0) {
2934 int centerStrip = recIt->channels(1);
2937 if (
id.
station() == 1 &&
id.
ring() == 4 && centerStrip > 16)
2941 adc_3_3_wtbin = (*recIt).tpeak() / 50;
2942 idchamber = indexer.
dbIndex(
id, centerStrip) / 10;
2950 ss <<
"adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_" << idchamber;
2962 ss <<
"ADC 3X3 Weighted Time Bin vs CFEB Occupancy ME" << endcapstr <<
id.station() <<
"/" <<
ring <<
"/" 2967 cfeb = (centerStrip - 1) / 16 + 1;
2970 histos->fill2DHist(x, y,
name,
title, 5, 1., 6., 80, -8., 8.,
"ADCTiming");
2992 map<CSCDetId, float> segment_median_map;
2993 map<CSCDetId, GlobalPoint> segment_position_map;
3000 LocalPoint localPos = (*dSiter).localPosition();
3004 globalPosition = cscchamber->
toGlobal(localPos);
3008 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
3009 int nRH = (*dSiter).nRecHits();
3014 vector<float> non_zero;
3016 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
3017 non_zero.push_back(iRH->tpeak());
3022 sort(non_zero.begin(), non_zero.end());
3023 int middle_index = non_zero.size() / 2;
3024 float average_two = (non_zero.at(middle_index - 1) + non_zero.at(middle_index)) / 2.;
3025 if (non_zero.size() % 2)
3026 average_two = non_zero.at(middle_index);
3029 segment_median_map[
id] = average_two;
3030 segment_position_map[
id] = globalPosition;
3032 double distToIP =
sqrt(globalPosition.
x() * globalPosition.
x() + globalPosition.
y() * globalPosition.
y() +
3033 globalPosition.
z() * globalPosition.
z());
3035 histos->fillProfile(chamberSerial(
id),
3038 "Segment mean time",
3047 "timeChamberByType",
3048 "Segment mean time by chamber",
3056 histos->fill2DHist(distToIP,
3058 "seg_time_vs_distToIP",
3059 "Segment time vs. Distance to IP",
3067 histos->fill2DHist(globalPosition.
z(),
3069 "seg_time_vs_globZ",
3070 "Segment time vs. z position",
3078 histos->fill2DHist(fabs(globalPosition.
z()),
3080 "seg_time_vs_absglobZ",
3081 "Segment time vs. abs(z position)",
3093 map<CSCDetId, float>::const_iterator it_outer;
3094 map<CSCDetId, float>::const_iterator it_inner;
3095 for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++) {
3096 CSCDetId id_outer = it_outer->first;
3097 float t_outer = it_outer->second;
3100 for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++) {
3101 CSCDetId id_inner = it_inner->first;
3102 float t_inner = it_inner->second;
3107 if (chamberSerial(id_outer) == chamberSerial(id_inner))
3118 id_outer.
ring() == id_inner.
ring()) {
3119 histos->fill1DHist(t_outer - t_inner,
3120 "diff_opposite_endcaps",
3121 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3126 histos->fill1DHistByType(t_outer - t_inner,
3127 "diff_opposite_endcaps_byType",
3128 "#Delta t [ME+]-[ME-] for chambers in same station and ring",
3144 vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->
getRecords();
3145 vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
3146 int L1GMT_BXN = -100;
3147 bool has_CSCTrigger =
false;
3148 bool has_beamHaloTrigger =
false;
3149 for (igmtrr = L1Mrec.begin(); igmtrr != L1Mrec.end(); igmtrr++) {
3150 std::vector<L1MuRegionalCand>::const_iterator iter1;
3151 std::vector<L1MuRegionalCand> rmc;
3154 rmc = igmtrr->getCSCCands();
3155 for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
3156 if (!(*iter1).empty()) {
3158 int kQuality = (*iter1).quality();
3160 has_beamHaloTrigger =
true;
3163 if (igmtrr->getBxInEvent() == 0 && icsc > 0) {
3165 L1GMT_BXN = igmtrr->getBxNr();
3166 has_CSCTrigger =
true;
3167 }
else if (igmtrr->getBxInEvent() == 0) {
3169 L1GMT_BXN = igmtrr->getBxNr();
3178 map<CSCDetId, int> ALCT_KeyWG_map;
3181 const CSCDetId& idALCT = (*j).first;
3184 if ((*digiIt).isValid()) {
3186 histos->fill1DHist((*digiIt).getBX(),
"ALCT_getBX",
"ALCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3188 (*digiIt).getFullBX(),
"ALCT_getFullBX",
"ALCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3190 if (ALCT_KeyWG_map.find(idALCT.
chamberId()) == ALCT_KeyWG_map.end()) {
3191 ALCT_KeyWG_map[idALCT.
chamberId()] = (*digiIt).getKeyWG();
3202 map<CSCDetId, int> CLCT_getFullBx_map;
3205 const CSCDetId& idCLCT = (*j).first;
3208 if ((*digiIt).isValid()) {
3210 histos->fill1DHist((*digiIt).getBX(),
"CLCT_getBX",
"CLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3212 (*digiIt).getFullBX(),
"CLCT_getFullBX",
"CLCT.getFullBX()", 3601, -0.5, 3600.5,
"TimeMonitoring");
3214 if (CLCT_getFullBx_map.find(idCLCT.
chamberId()) == CLCT_getFullBx_map.end()) {
3215 CLCT_getFullBx_map[idCLCT.
chamberId()] = (*digiIt).getFullBX();
3225 int n_correlatedlcts = 0;
3229 if ((*digiIt).isValid()) {
3232 (*digiIt).getBX(),
"CorrelatedLCTS_getBX",
"CorrelatedLCT.getBX()", 11, -0.5, 10.5,
"TimeMonitoring");
3237 int nRecHits =
recHits->size();
3239 if (has_CSCTrigger) {
3240 histos->fill1DHist(L1GMT_BXN,
"BX_L1CSCCand",
"BX of L1 CSC Cand", 4001, -0.5, 4000.5,
"TimeMonitoring");
3241 histos->fill2DHist(L1GMT_BXN,
3243 "n_ALCTs_v_BX_L1CSCCand",
3244 "Number of ALCTs vs. BX of L1 CSC Cand",
3252 histos->fill2DHist(L1GMT_BXN,
3254 "n_CLCTs_v_BX_L1CSCCand",
3255 "Number of CLCTs vs. BX of L1 CSC Cand",
3263 histos->fill2DHist(L1GMT_BXN,
3265 "n_CorrelatedLCTs_v_BX_L1CSCCand",
3266 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand",
3274 histos->fill2DHist(L1GMT_BXN,
3276 "n_RecHits_v_BX_L1CSCCand",
3277 "Number of RecHits vs. BX of L1 CSC Cand",
3285 histos->fill2DHist(L1GMT_BXN,
3287 "n_Segments_v_BX_L1CSCCand",
3288 "Number of Segments vs. BX of L1 CSC Cand",
3297 if (has_CSCTrigger && has_beamHaloTrigger) {
3299 L1GMT_BXN,
"BX_L1CSCCand_w_beamHalo",
"BX of L1 CSC (w beamHalo bit)", 4001, -0.5, 4000.5,
"TimeMonitoring");
3300 histos->fill2DHist(L1GMT_BXN,
3302 "n_ALCTs_v_BX_L1CSCCand_w_beamHalo",
3303 "Number of ALCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3311 histos->fill2DHist(L1GMT_BXN,
3313 "n_CLCTs_v_BX_L1CSCCand_w_beamHalo",
3314 "Number of CLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3322 histos->fill2DHist(L1GMT_BXN,
3324 "n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo",
3325 "Number of CorrelatedLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",
3333 histos->fill2DHist(L1GMT_BXN,
3335 "n_RecHits_v_BX_L1CSCCand_w_beamHalo",
3336 "Number of RecHits vs. BX of L1 CSC Cand (w beamHalo bit)",
3344 histos->fill2DHist(L1GMT_BXN,
3346 "n_Segments_v_BX_L1CSCCand_w_beamHalo",
3347 "Number of Segments vs. BX of L1 CSC Cand (w beamHalo bit)",
3368 event.getByToken(rd_token, rawdata);
3372 unsigned long dccBinCheckMask = 0x06080016;
3373 unsigned int examinerMask = 0x1FEBF3F6;
3374 unsigned int errorMask = 0x0;
3383 unsigned long length = fedData.
size();
3386 std::stringstream examiner_out, examiner_err;
3389 if (examinerMask & 0x40000)
3391 if (examinerMask & 0x8000)
3393 if (examinerMask & 0x0400)
3395 examiner->
setMask(examinerMask);
3396 const short unsigned int*
data = (
short unsigned int*)fedData.
data();
3402 goodEvent = !(examiner->
errors() & dccBinCheckMask);
3411 const std::vector<CSCDDUEventData>& dduData = dccData.
dduData();
3416 for (
unsigned int iDDU = 0; iDDU < dduData.size(); ++iDDU) {
3419 if (dduData[iDDU].trailer().errorstat() & errorMask) {
3420 LogTrace(
"CSCDCCUnpacker|CSCRawToDigi") <<
"DDU# " << iDDU <<
" has serious error - no digis unpacked! " 3421 << std::hex << dduData[iDDU].trailer().errorstat();
3426 const std::vector<CSCEventData>& cscData = dduData[iDDU].cscData();
3427 for (
unsigned int iCSC = 0; iCSC < cscData.size(); ++iCSC) {
3429 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
3430 int dmb = cscData[iCSC].dmbHeader()->dmbID();
3438 if ((vmecrate >= 1) && (vmecrate <= 60) && (dmb >= 1) && (dmb <= 10) && (dmb != 6)) {
3439 layer = pcrate->
detId(vmecrate, dmb, icfeb, ilayer);
3441 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") <<
" detID input out of range!!! ";
3442 LogTrace(
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
3443 <<
" skipping chamber vme= " << vmecrate <<
" dmb= " << dmb;
3448 int nalct = cscData[iCSC].dmbHeader()->nalct();
3449 bool goodALCT =
false;
3451 if (nalct && cscData[iCSC].alctHeader()) {
3452 if (cscData[iCSC].alctHeader()->
check()) {
3458 int nclct = cscData[iCSC].dmbHeader()->nclct();
3459 bool goodTMB =
false;
3460 if (nclct && cscData[iCSC].tmbData()) {
3461 if (cscData[iCSC].tmbHeader()->
check()) {
3462 if (cscData[iCSC].comparatorData()->
check())
3467 if (goodTMB && goodALCT) {
3468 if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
3469 printf(
"no ALCT info for Chamber %d %d %d %d \n",
3476 if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
3477 printf(
"no CLCT info for Chamber %d %d %d %d \n",
3484 int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
3485 int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
3487 const CSCTMBHeader* tmbHead = cscData[iCSC].tmbHeader();
3498 "TMB_ALCTMatchTime",
3499 "TMB_ALCTMatchTime",
3507 tmbHead->
BXNCount(),
"TMB_BXNCount",
"TMB_BXNCount", 3601, -0.5, 3600.5,
"TimeMonitoring");
3509 tmbHead->
ALCTMatchTime(),
"TMB_ALCTMatchTime",
"TMB_ALCTMatchTime", 7, -0.5, 6.5,
"TimeMonitoring");
3512 "TMB_ALCTMatchTime",
3513 "TMB_ALCTMatchTime",
3520 histos->fillProfile(chamberSerial(
layer.chamberId()),
3522 "prof_TMB_ALCTMatchTime",
3523 "prof_TMB_ALCTMatchTime",
3530 histos->fillProfile(ALCT0Key,
3532 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3533 "prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3540 histos->fillProfileByType(ALCT0Key,
3542 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3543 "prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
3555 if (TMB_ALCT_rel_L1A > 3563)
3556 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
3557 if (TMB_ALCT_rel_L1A < 0)
3558 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
3562 TMB_ALCT_rel_L1A,
"h1D_TMB_ALCT_rel_L1A",
"h1D_TMB_ALCT_rel_L1A", 11, 144.5, 155.5,
"TimeMonitoring");
3563 histos->fill2DHist(chamberSerial(
layer.chamberId()),
3565 "h2D_TMB_ALCT_rel_L1A",
3566 "h2D_TMB_ALCT_rel_L1A",
3576 "h2D_TMB_ALCT_rel_L1A_by_ring",
3577 "h2D_TMB_ALCT_rel_L1A_by_ring",
3585 histos->fillProfile(chamberSerial(
layer.chamberId()),
3587 "prof_TMB_ALCT_rel_L1A",
3588 "prof_TMB_ALCT_rel_L1A",
3595 histos->fillProfile(ringSerial(
layer.chamberId()),
3597 "prof_TMB_ALCT_rel_L1A_by_ring",
3598 "prof_TMB_ALCT_rel_L1A_by_ring",
3606 histos->fill2DHist(ALCT0Key,
3608 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3609 "h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3617 histos->fillProfile(ALCT0Key,
3619 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3620 "prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3627 histos->fillProfileByType(ALCT0Key,
3629 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3630 "prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
3643 if (examiner !=
nullptr)
3651 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
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
constexpr std::size_t typeIndex
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
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
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.