90 hOWires =
new TH2I(
"hOWires",
"Wire Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
91 hOStrips =
new TH2I(
"hOStrips",
"Strip Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
92 hORecHits =
new TH2I(
"hORecHits",
"RecHit Occupancy",36,0.5,36.5,20,0.5,20.5);
93 hOSegments =
new TH2I(
"hOSegments",
"Segments Occupancy",36,0.5,36.5,20,0.5,20.5);
96 hSSTE =
new TH1F(
"hSSTE",
"hSSTE",40,0,40);
97 hRHSTE =
new TH1F(
"hRHSTE",
"hRHSTE",40,0,40);
98 hSEff =
new TH1F(
"hSEff",
"Segment Efficiency",20,0.5,20.5);
99 hRHEff =
new TH1F(
"hRHEff",
"recHit Efficiency",20,0.5,20.5);
101 const int nChambers = 36;
102 const int nTypes = 18;
104 float nCh_max = float(nChambers) + 0.5;
106 float nT_max = float(nTypes) + 0.5;
108 hSSTE2 =
new TH2F(
"hSSTE2",
"hSSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
109 hRHSTE2 =
new TH2F(
"hRHSTE2",
"hRHSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
110 hStripSTE2 =
new TH2F(
"hStripSTE2",
"hStripSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
111 hWireSTE2 =
new TH2F(
"hWireSTE2",
"hWireSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
114 hEffDenominator =
new TH2F(
"hEffDenominator",
"hEffDenominator",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
115 hSEff2 =
new TH2F(
"hSEff2",
"Segment Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
116 hRHEff2 =
new TH2F(
"hRHEff2",
"recHit Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
118 hStripEff2 =
new TH2F(
"hStripEff2",
"strip Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
119 hWireEff2 =
new TH2F(
"hWireEff2",
"wire Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
121 hSensitiveAreaEvt =
new TH2F(
"hSensitiveAreaEvt",
"events in sensitive area",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
124 if (writeTreeToFile)
histos->setupTrees();
135 histoEfficiency(hRHSTE,hRHEff);
136 histoEfficiency(hSSTE,hSEff);
137 hSEff2->Divide(hSSTE2,hEffDenominator,1.,1.,
"B");
138 hRHEff2->Divide(hRHSTE2,hEffDenominator,1.,1.,
"B");
139 hStripEff2->Divide(hStripSTE2,hEffDenominator,1.,1.,
"B");
140 hWireEff2->Divide(hWireSTE2,hEffDenominator,1.,1.,
"B");
142 histos->insertPlot(hRHSTE,
"hRHSTE",
"Efficiency");
143 histos->insertPlot(hSSTE,
"hSSTE",
"Efficiency");
144 histos->insertPlot(hSSTE2,
"hSSTE2",
"Efficiency");
145 histos->insertPlot(hEffDenominator,
"hEffDenominator",
"Efficiency");
146 histos->insertPlot(hRHSTE2,
"hRHSTE2",
"Efficiency");
147 histos->insertPlot(hStripSTE2,
"hStripSTE2",
"Efficiency");
148 histos->insertPlot(hWireSTE2,
"hWireSTE2",
"Efficiency");
151 histos->insertPlot(hSEff,
"hSEff",
"Efficiency");
152 histos->insertPlot(hRHEff,
"hRHEff",
"Efficiency");
154 histos->insertPlot(hSEff2,
"hSEff2",
"Efficiency");
155 histos->insertPlot(hRHEff2,
"hRHEff2",
"Efficiency");
156 histos->insertPlot(hStripEff2,
"hStripff2",
"Efficiency");
157 histos->insertPlot(hWireEff2,
"hWireff2",
"Efficiency");
159 histos->insertPlot(hSensitiveAreaEvt,
"",
"Efficiency");
162 histos->insertPlot(hOWires,
"hOWires",
"Digis");
163 histos->insertPlot(hOStrips,
"hOStrips",
"Digis");
164 histos->insertPlot(hORecHits,
"hORecHits",
"recHits");
165 histos->insertPlot(hOSegments,
"hOSegments",
"Segments");
193 event.getByLabel(stripDigiTag,strips);
194 event.getByLabel(wireDigiTag,wires);
195 event.getByLabel(compDigiTag,compars);
196 event.getByLabel(alctDigiTag, alcts);
197 event.getByLabel(clctDigiTag, clcts);
198 event.getByLabel(corrlctDigiTag, correlatedlcts);
207 event.getByLabel(cscRecHitTag,recHits);
217 if (isSimulation)
event.getByLabel(simHitTag, simHits);
221 event.getByLabel(cscSegTag, cscSegments);
225 if (makeTriggerPlots || useTriggerFilter || (useDigis && makeTimeMonitorPlots)){
226 event.getByLabel(l1aTag,pCollection);
229 if (makeHLTPlots)
event.getByLabel(
hltTag,hlt);
233 if (makeStandalonePlots || useQualityFilter)
event.getByLabel(saMuonTag,saMuons);
243 if (nEventsAnalyzed == 1 && makeCalibPlots) doCalibrations(eventSetup);
248 if (makeTriggerPlots || useTriggerFilter) CSCL1A = doTrigger(pCollection);
249 if (!useTriggerFilter) CSCL1A =
true;
253 if (makeStandalonePlots || useQualityFilter) cleanEvent = filterEvents(recHits,cscSegments,saMuons);
254 if (!useQualityFilter) cleanEvent =
true;
259 if (makeOccupancyPlots && CSCL1A) doOccupancies(strips,wires,recHits,cscSegments);
262 if (makeHLTPlots) doHLT(hlt);
265 if (cleanEvent && CSCL1A){
268 if (makeStripPlots && useDigis) doStripDigis(strips);
271 if (makeWirePlots && useDigis) doWireDigis(wires);
275 if (makeRecHitPlots) doRecHits(recHits,cscGeom);
278 if (isSimulation && makeSimHitPlots) doSimHits(recHits,simHits);
281 if (makeSegmentPlots) doSegments(cscSegments,cscGeom);
284 if (makeResolutionPlots) doResolution(cscSegments,cscGeom);
288 if (makePedNoisePlots && useDigis) doPedestalNoise(strips);
291 if (makeEfficiencyPlots) doEfficiencies(wires,strips, recHits, cscSegments,cscGeom);
294 if (makeGasGainPlots && useDigis) doGasGain(*wires,*strips,*recHits);
298 if (makeAFEBTimingPlots && useDigis) doAFEBTiming(*wires);
301 if (makeCompTimingPlots && useDigis) doCompTiming(*compars);
304 if (makeADCTimingPlots) doADCTiming(*recHits);
309 if (makeRHNoisePlots && useDigis) doNoiseHits(recHits,cscSegments,cscGeom,strips);
312 if (makeStandalonePlots) doStandalone(saMuons);
315 if (makeTimeMonitorPlots) doTimeMonitoring(recHits,cscSegments, alcts, clcts, correlatedlcts, pCollection,cscGeom, eventSetup, event);
334 if (recHits->size() < 4 || recHits->size() > 100)
return false;
335 if (cscSegments->size() < 1 || cscSegments->size() > 15)
return false;
411 bool wireo[2][4][4][36];
412 bool stripo[2][4][4][36];
413 bool rechito[2][4][4][36];
414 bool segmento[2][4][4][36];
416 bool hasWires =
false;
417 bool hasStrips =
false;
418 bool hasRecHits =
false;
419 bool hasSegments =
false;
421 for (
int e = 0;
e < 2;
e++){
422 for (
int s = 0;
s < 4;
s++){
423 for (
int r = 0;
r < 4;
r++){
424 for (
int c = 0;
c < 36;
c++){
425 wireo[
e][
s][
r][
c] =
false;
426 stripo[
e][
s][
r][
c] =
false;
427 rechito[
e][
s][
r][
c] =
false;
428 segmento[
e][
s][
r][
c] =
false;
438 int kEndcap =
id.
endcap();
439 int kRing =
id.ring();
440 int kStation =
id.station();
441 int kChamber =
id.chamber();
442 std::vector<CSCWireDigi>::const_iterator wireIt = (*wi).second.first;
443 std::vector<CSCWireDigi>::const_iterator lastWire = (*wi).second.second;
444 for( ; wireIt != lastWire; ++wireIt){
445 if (!wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
446 wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1] =
true;
447 hOWires->Fill(kChamber,typeIndex(
id));
448 histos->fill1DHist(chamberSerial(
id),
"hOWireSerial",
"Wire Occupancy by Chamber Serial",601,-0.5,600.5,
"Digis");
457 int kEndcap =
id.
endcap();
458 int kRing =
id.ring();
459 int kStation =
id.station();
460 int kChamber =
id.chamber();
461 std::vector<CSCStripDigi>::const_iterator stripIt = (*si).second.first;
462 std::vector<CSCStripDigi>::const_iterator lastStrip = (*si).second.second;
463 for( ; stripIt != lastStrip; ++stripIt) {
464 std::vector<int> myADCVals = stripIt->getADCCounts();
465 bool thisStripFired =
false;
466 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
469 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
470 diff = (float)myADCVals[iCount]-thisPedestal;
471 if (diff > threshold) { thisStripFired =
true; }
473 if (thisStripFired) {
474 if (!stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
475 stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1] =
true;
476 hOStrips->Fill(kChamber,typeIndex(
id));
477 histos->fill1DHist(chamberSerial(
id),
"hOStripSerial",
"Strip Occupancy by Chamber Serial",601,-0.5,600.5,
"Digis");
487 for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
489 int kEndcap = idrec.
endcap();
490 int kRing = idrec.
ring();
491 int kStation = idrec.
station();
492 int kChamber = idrec.
chamber();
493 if (!rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
494 rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1] =
true;
495 histos->fill1DHist(chamberSerial(idrec),
"hORecHitsSerial",
"RecHit Occupancy by Chamber Serial",601,-0.5,600.5,
"recHits");
496 hORecHits->Fill(kChamber,typeIndex(idrec));
504 int kEndcap =
id.
endcap();
505 int kRing =
id.ring();
506 int kStation =
id.station();
507 int kChamber =
id.chamber();
508 if (!segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
509 segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1] =
true;
510 histos->fill1DHist(chamberSerial(
id),
"hOSegmentsSerial",
"Segment Occupancy by Chamber Serial",601,-0.5,600.5,
"Segments");
511 hOSegments->Fill(kChamber,typeIndex(
id));
517 histos->fill1DHist(1,
"hCSCOccupancy",
"overall CSC occupancy",15,-0.5,14.5,
"GeneralHists");
518 if (hasWires)
histos->fill1DHist(3,
"hCSCOccupancy",
"overall CSC occupancy",15,-0.5,14.5,
"GeneralHists");
519 if (hasStrips)
histos->fill1DHist(5,
"hCSCOccupancy",
"overall CSC occupancy",15,-0.5,14.5,
"GeneralHists");
520 if (hasWires && hasStrips)
histos->fill1DHist(7,
"hCSCOccupancy",
"overall CSC occupancy",15,-0.5,14.5,
"GeneralHists");
521 if (hasRecHits)
histos->fill1DHist(9,
"hCSCOccupancy",
"overall CSC occupancy",15,-0.5,14.5,
"GeneralHists");
522 if (hasSegments)
histos->fill1DHist(11,
"hCSCOccupancy",
"overall CSC occupancy",15,-0.5,14.5,
"GeneralHists");
523 if (!cleanEvent)
histos->fill1DHist(13,
"hCSCOccupancy",
"overall CSC occupancy",15,-0.5,14.5,
"GeneralHists");
535 std::vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->getRecords();
536 std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
538 bool csc_l1a =
false;
540 bool rpcf_l1a =
false;
541 bool rpcb_l1a =
false;
542 bool beamHaloTrigger =
false;
544 int myBXNumber = -1000;
546 for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
547 std::vector<L1MuRegionalCand>::const_iterator iter1;
548 std::vector<L1MuRegionalCand> rmc;
552 rmc = igmtrr->getCSCCands();
553 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
554 if ( !(*iter1).empty() ) {
556 int kQuality = (*iter1).quality();
557 if (kQuality == 1) beamHaloTrigger =
true;
560 if (igmtrr->getBxInEvent() == 0 && icsc>0) csc_l1a =
true;
561 if (igmtrr->getBxInEvent() == 0 ) { myBXNumber = igmtrr->getBxNr(); }
565 rmc = igmtrr->getDTBXCands();
566 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
567 if ( !(*iter1).empty() ) {
571 if(igmtrr->getBxInEvent()==0 && idt>0) dt_l1a =
true;
575 rmc = igmtrr->getBrlRPCCands();
576 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
577 if ( !(*iter1).empty() ) {
581 if(igmtrr->getBxInEvent()==0 && irpcb>0) rpcb_l1a =
true;
585 rmc = igmtrr->getFwdRPCCands();
586 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
587 if ( !(*iter1).empty() ) {
591 if(igmtrr->getBxInEvent()==0 && irpcf>0) rpcf_l1a =
true;
596 if (csc_l1a)
histos->fill1DHist(myBXNumber,
"vtBXNumber",
"BX Number",4001,-0.5,4000.5,
"Trigger");
597 if (csc_l1a)
histos->fill1DHist(1,
"vtBits",
"trigger bits",11,-0.5,10.5,
"Trigger");
598 if (dt_l1a)
histos->fill1DHist(2,
"vtBits",
"trigger bits",11,-0.5,10.5,
"Trigger");
599 if (rpcb_l1a)
histos->fill1DHist(3,
"vtBits",
"trigger bits",11,-0.5,10.5,
"Trigger");
600 if (rpcf_l1a)
histos->fill1DHist(4,
"vtBits",
"trigger bits",11,-0.5,10.5,
"Trigger");
601 if (beamHaloTrigger)
histos->fill1DHist(8,
"vtBits",
"trigger bits",11,-0.5,10.5,
"Trigger");
604 histos->fill1DHist(1,
"vtCSCY",
"trigger bits",11,-0.5,10.5,
"Trigger");
605 if (dt_l1a)
histos->fill1DHist(2,
"vtCSCY",
"trigger bits",11,-0.5,10.5,
"Trigger");
606 if (rpcb_l1a)
histos->fill1DHist(3,
"vtCSCY",
"trigger bits",11,-0.5,10.5,
"Trigger");
607 if (rpcf_l1a)
histos->fill1DHist(4,
"vtCSCY",
"trigger bits",11,-0.5,10.5,
"Trigger");
608 if ( dt_l1a || rpcb_l1a || rpcf_l1a)
histos->fill1DHist(5,
"vtCSCY",
"trigger bits",11,-0.5,10.5,
"Trigger");
609 if (!(dt_l1a || rpcb_l1a || rpcf_l1a))
histos->fill1DHist(6,
"vtCSCY",
"trigger bits",11,-0.5,10.5,
"Trigger");
611 histos->fill1DHist(1,
"vtCSCN",
"trigger bits",11,-0.5,10.5,
"Trigger");
612 if (dt_l1a)
histos->fill1DHist(2,
"vtCSCN",
"trigger bits",11,-0.5,10.5,
"Trigger");
613 if (rpcb_l1a)
histos->fill1DHist(3,
"vtCSCN",
"trigger bits",11,-0.5,10.5,
"Trigger");
614 if (rpcf_l1a)
histos->fill1DHist(4,
"vtCSCN",
"trigger bits",11,-0.5,10.5,
"Trigger");
615 if ( dt_l1a || rpcb_l1a || rpcf_l1a)
histos->fill1DHist(5,
"vtCSCN",
"trigger bits",11,-0.5,10.5,
"Trigger");
616 if (!(dt_l1a || rpcb_l1a || rpcf_l1a))
histos->fill1DHist(6,
"vtCSCN",
"trigger bits",11,-0.5,10.5,
"Trigger");
621 if (csc_l1a)
return true;
636 int hltSize = hlt->size();
637 for (
int i = 0;
i < hltSize; ++
i){
638 if (hlt->accept(
i))
histos->fill1DHist(
i,
"hltBits",
"HLT Trigger Bits",hltSize+1,-0.5,(
float)hltSize+0.5,
"Trigger");
654 if (nEventsAnalyzed == 1){
656 LogDebug(
"Calibrations") <<
"Loading Calibrations...";
675 LogDebug(
"Calibrations") <<
"Calibrations Loaded!";
677 for (
int i = 0;
i < 400;
i++){
679 histos->fillCalibHist(pGains->
gains[
i].gain_slope,
"hCalibGainsS",
"Gains Slope",400,0,400,bin,
"Calib");
680 histos->fillCalibHist(pCrosstalk->
crosstalk[
i].xtalk_slope_left,
"hCalibXtalkSL",
"Xtalk Slope Left",400,0,400,bin,
"Calib");
681 histos->fillCalibHist(pCrosstalk->
crosstalk[
i].xtalk_slope_right,
"hCalibXtalkSR",
"Xtalk Slope Right",400,0,400,bin,
"Calib");
682 histos->fillCalibHist(pCrosstalk->
crosstalk[
i].xtalk_intercept_left,
"hCalibXtalkIL",
"Xtalk Intercept Left",400,0,400,bin,
"Calib");
683 histos->fillCalibHist(pCrosstalk->
crosstalk[
i].xtalk_intercept_right,
"hCalibXtalkIR",
"Xtalk Intercept Right",400,0,400,bin,
"Calib");
684 histos->fillCalibHist(pPedestals->
pedestals[
i].ped,
"hCalibPedsP",
"Peds",400,0,400,bin,
"Calib");
685 histos->fillCalibHist(pPedestals->
pedestals[
i].rms,
"hCalibPedsR",
"Peds RMS",400,0,400,bin,
"Calib");
686 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem33,
"hCalibNoise33",
"Noise Matrix 33",400,0,400,bin,
"Calib");
687 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem34,
"hCalibNoise34",
"Noise Matrix 34",400,0,400,bin,
"Calib");
688 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem35,
"hCalibNoise35",
"Noise Matrix 35",400,0,400,bin,
"Calib");
689 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem44,
"hCalibNoise44",
"Noise Matrix 44",400,0,400,bin,
"Calib");
690 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem45,
"hCalibNoise45",
"Noise Matrix 45",400,0,400,bin,
"Calib");
691 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem46,
"hCalibNoise46",
"Noise Matrix 46",400,0,400,bin,
"Calib");
692 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem55,
"hCalibNoise55",
"Noise Matrix 55",400,0,400,bin,
"Calib");
693 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem56,
"hCalibNoise56",
"Noise Matrix 56",400,0,400,bin,
"Calib");
694 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem57,
"hCalibNoise57",
"Noise Matrix 57",400,0,400,bin,
"Calib");
695 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem66,
"hCalibNoise66",
"Noise Matrix 66",400,0,400,bin,
"Calib");
696 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem67,
"hCalibNoise67",
"Noise Matrix 67",400,0,400,bin,
"Calib");
697 histos->fillCalibHist(pNoiseMatrix->
matrix[
i].elem77,
"hCalibNoise77",
"Noise Matrix 77",400,0,400,bin,
"Calib");
716 int nWireGroupsTotal = 0;
719 std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
720 std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
721 for( ; wireIter != lWire; ++wireIter) {
722 int myWire = wireIter->getWireGroup();
723 int myTBin = wireIter->getTimeBin();
725 histos->fill1DHistByType(myWire,
"hWireWire",
"Wiregroup Numbers Fired",
id,113,-0.5,112.5,
"Digis");
726 histos->fill1DHistByType(myTBin,
"hWireTBin",
"Wire TimeBin Fired",
id,17,-0.5,16.5,
"Digis");
727 histos->fillProfile(chamberSerial(
id),myTBin,
"hWireTBinProfile",
"Wire TimeBin Fired",601,-0.5,600.5,-0.5,16.5,
"Digis");
728 if (detailedAnalysis){
729 histos->fill1DHistByLayer(myWire,
"hWireWire",
"Wiregroup Numbers Fired",
id,113,-0.5,112.5,
"WireNumberByLayer");
730 histos->fill1DHistByLayer(myTBin,
"hWireTBin",
"Wire TimeBin Fired",
id,17,-0.5,16.5,
"WireTimeByLayer");
736 if (nWireGroupsTotal == 0) nWireGroupsTotal = -1;
738 histos->fill1DHist(nWireGroupsTotal,
"hWirenGroupsTotal",
"Wires Fired Per Event",151,-0.5,150.5,
"Digis");
750 int nStripsFired = 0;
753 std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
754 std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
755 for( ; stripIter != lStrip; ++stripIter) {
756 int myStrip = stripIter->getStrip();
757 std::vector<int> myADCVals = stripIter->getADCCounts();
758 bool thisStripFired =
false;
759 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
762 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
763 diff = (float)myADCVals[iCount]-thisPedestal;
764 if (diff > threshold) { thisStripFired =
true; }
766 if (thisStripFired) {
769 histos->fill1DHistByType(myStrip,
"hStripStrip",
"Strip Number",
id,81,-0.5,80.5,
"Digis");
770 if (detailedAnalysis){
771 histos->fill1DHistByLayer(myStrip,
"hStripStrip",
"Strip Number",
id,81,-0.5,80.5,
"StripNumberByLayer");
777 if (nStripsFired == 0) nStripsFired = -1;
779 histos->fill1DHist(nStripsFired,
"hStripNFired",
"Fired Strips per Event",251,-0.5,250.5,
"Digis");
793 std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
794 std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
795 for( ; pedIt != lStrip; ++pedIt) {
796 int myStrip = pedIt->getStrip();
797 std::vector<int> myADCVals = pedIt->getADCCounts();
798 float TotalADC = getSignal(*strips,
id, myStrip);
799 bool thisStripFired =
false;
800 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
801 float thisSignal = (1./6)*(myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
803 if(
id.
station() == 1 &&
id.ring() == 4)
805 if(myStrip <= 16) myStrip += 64;
807 if (TotalADC > threshold) { thisStripFired =
true;}
808 if (!thisStripFired){
809 float ADC = thisSignal - thisPedestal;
810 histos->fill1DHist(ADC,
"hStripPed",
"Pedestal Noise Distribution",50,-25.,25.,
"PedestalNoise");
811 histos->fill1DHistByType(ADC,
"hStripPedME",
"Pedestal Noise Distribution",
id,50,-25.,25.,
"PedestalNoise");
812 histos->fillProfile(chamberSerial(
id),ADC,
"hStripPedMEProfile",
"Wire TimeBin Fired",601,-0.5,600.5,-25,25,
"PedestalNoise");
813 if (detailedAnalysis){
814 histos->fill1DHistByLayer(ADC,
"hStripPedME",
"Pedestal Noise Distribution",
id,50,-25.,25.,
"PedestalNoiseByLayer");
832 int nRecHits = recHits->size();
841 for (dRHIter = recHits->begin(); dRHIter != recHits->end(); dRHIter++) {
846 int kEndcap = idrec.
endcap();
847 int kRing = idrec.
ring();
848 int kStation = idrec.
station();
849 int kChamber = idrec.
chamber();
853 LocalPoint rhitlocal = (*dRHIter).localPosition();
854 float xreco = rhitlocal.
x();
855 float yreco = rhitlocal.
y();
856 LocalError rerrlocal = (*dRHIter).localPositionError();
858 float xxerr = rerrlocal.
xx();
859 float yyerr = rerrlocal.
yy();
860 float xyerr = rerrlocal.
xy();
862 float stpos = (*dRHIter).positionWithinStrip();
863 float sterr = (*dRHIter).errorWithinStrip();
868 int adcsize=dRHIter->nStrips()*dRHIter->nTimeBins();
869 for (
unsigned int i=0;
i< dRHIter->nStrips();
i++) {
870 for (
unsigned int j=0;
j< dRHIter->nTimeBins()-1;
j++) {
871 rHSumQ+=dRHIter->adcs(
i,
j);
872 if (
i!=1) sumsides+=dRHIter->adcs(
i,
j);
876 float rHratioQ = sumsides/rHSumQ;
877 if (adcsize != 12) rHratioQ = -99;
881 rHtime = (*dRHIter).tpeak()/50.;
884 const CSCLayer* csclayer = cscGeom->layer( idrec );
888 float grecx = rhitglobal.
x();
889 float grecy = rhitglobal.
y();
892 if (writeTreeToFile && rhTreeCount < 1500000){
893 histos->fillRechitTree(xreco, yreco, grecx, grecy, kEndcap, kStation, kRing, kChamber, kLayer);
899 histos->fill2DHistByStation(grecx,grecy,
"hRHGlobal",
"recHit Global Position",idrec,100,-800.,800.,100,-800.,800.,
"recHits");
900 if (kStation == 1 && (kRing == 1 || kRing == 4))
histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge",idrec,125,0,4000,
"recHits");
901 else histos->fill1DHistByType(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge",idrec,125,0,2000,
"recHits");
902 histos->fill1DHistByType(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt",idrec,120,-0.1,1.1,
"recHits");
903 histos->fill1DHistByType(rHtime,
"hRHTiming",
"recHit Timing",idrec,200,-10,10,
"recHits");
904 histos->fill1DHistByType(
sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X",idrec,100,-0.1,2,
"recHits");
905 histos->fill1DHistByType(
sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y",idrec,100,-0.1,2,
"recHits");
906 histos->fill1DHistByType(xyerr,
"hRHxyerr",
"Corr. RecHit XY Error",idrec,100,-1,2,
"recHits");
907 if (adcsize == 12)
histos->fill1DHistByType(stpos,
"hRHstpos",
"Reconstructed Position on Strip",idrec,120,-0.6,0.6,
"recHits");
908 histos->fill1DHistByType(sterr,
"hRHsterr",
"Estimated Error on Strip Measurement",idrec,120,-0.05,0.25,
"recHits");
909 histos->fillProfile(chamberSerial(idrec),rHSumQ,
"hRHSumQProfile",
"Sum 3x3 recHit Charge",601,-0.5,600.5,0,4000,
"recHits");
910 histos->fillProfile(chamberSerial(idrec),rHtime,
"hRHTimingProfile",
"recHit Timing",601,-0.5,600.5,-11,11,
"recHits");
911 if (detailedAnalysis){
912 if (kStation == 1 && (kRing == 1 || kRing == 4))
histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge",idrec,125,0,4000,
"RHQByLayer");
913 else histos->fill1DHistByLayer(rHSumQ,
"hRHSumQ",
"Sum 3x3 recHit Charge",idrec,125,0,2000,
"RHQByLayer");
914 histos->fill1DHistByLayer(rHratioQ,
"hRHRatioQ",
"Charge Ratio (Ql+Qr)/Qt",idrec,120,-0.1,1.1,
"RHQByLayer");
915 histos->fill1DHistByLayer(rHtime,
"hRHTiming",
"recHit Timing",idrec,200,-10,10,
"RHTimingByLayer");
916 histos->fill2DHistByLayer(xreco,yreco,
"hRHLocalXY",
"recHit Local Position",idrec,50,-100.,100.,75,-150.,150.,
"RHLocalXYByLayer");
917 histos->fill1DHistByLayer(
sqrt(xxerr),
"hRHxerr",
"RecHit Error on Local X",idrec,100,-0.1,2,
"RHErrorsByLayer");
918 histos->fill1DHistByLayer(
sqrt(yyerr),
"hRHyerr",
"RecHit Error on Local Y",idrec,100,-0.1,2,
"RHErrorsByLayer");
919 histos->fill1DHistByType(stpos,
"hRHstpos",
"Reconstructed Position on Strip",idrec,120,-0.6,0.6,
"RHStripPosByLayer");
920 histos->fill1DHistByType(sterr,
"hRHsterr",
"Estimated Error on Strip Measurement",idrec,120,-0.05,0.25,
"RHStripPosByLayer");
925 if (nRecHits == 0) nRecHits = -1;
927 histos->fill1DHist(nRecHits,
"hRHnrechits",
"recHits per Event (all chambers)",151,-0.5,150.5,
"recHits");
940 for (dSHrecIter = recHits->begin(); dSHrecIter != recHits->end(); dSHrecIter++) {
943 LocalPoint rhitlocal = (*dSHrecIter).localPosition();
944 float xreco = rhitlocal.
x();
945 float yreco = rhitlocal.
y();
946 float xError =
sqrt((*dSHrecIter).localPositionError().xx());
947 float yError =
sqrt((*dSHrecIter).localPositionError().yy());
948 float simHitXres = -99;
949 float simHitYres = -99;
955 PSimHitContainer::const_iterator dSHsimIter;
956 for (dSHsimIter = simHits->begin(); dSHsimIter != simHits->end(); dSHsimIter++){
961 if (sId == idrec &&
abs((*dSHsimIter).particleType()) == 13){
963 LocalPoint sHitlocal = (*dSHsimIter).localPosition();
966 if ((sHitlocal.
x() - xreco) < mindiffX && (sHitlocal.
y() - yreco) < mindiffY){
967 simHitXres = (sHitlocal.
x() - xreco);
968 simHitYres = (sHitlocal.
y() - yreco);
969 mindiffX = (sHitlocal.
x() - xreco);
970 xPull = simHitXres/xError;
971 yPull = simHitYres/yError;
976 histos->fill1DHistByType(simHitXres,
"hSimXResid",
"SimHitX - Reconstructed X",idrec,100,-1.0,1.0,
"Resolution");
977 histos->fill1DHistByType(simHitYres,
"hSimYResid",
"SimHitY - Reconstructed Y",idrec,100,-5.0,5.0,
"Resolution");
978 histos->fill1DHistByType(xPull,
"hSimXPull",
"Local X Pulls",idrec,100,-5.0,5.0,
"Resolution");
979 histos->fill1DHistByType(yPull,
"hSimYPull",
"Local Y Pulls",idrec,100,-5.0,5.0,
"Resolution");
994 int nSegments = cscSegments->size();
1004 int kEndcap =
id.
endcap();
1005 int kRing =
id.ring();
1006 int kStation =
id.station();
1007 int kChamber =
id.chamber();
1010 float chisq = (*dSiter).chi2();
1011 int nhits = (*dSiter).nRecHits();
1012 int nDOF = 2*nhits-4;
1014 LocalPoint localPos = (*dSiter).localPosition();
1015 float segX = localPos.
x();
1016 float segY = localPos.
y();
1023 float globTheta = 0.;
1025 const CSCChamber* cscchamber = cscGeom->chamber(
id);
1028 globX = globalPosition.
x();
1029 globY = globalPosition.
y();
1031 globTheta = globalDirection.
theta();
1032 globPhi = globalDirection.
phi();
1037 if (writeTreeToFile && segTreeCount < 1500000){
1038 histos->fillSegmentTree(segX, segY, globX, globY, kEndcap, kStation, kRing, kChamber);
1043 histos->fill2DHistByStation(globX,globY,
"hSGlobal",
"Segment Global Positions;global x (cm)",
id,100,-800.,800.,100,-800.,800.,
"Segments");
1044 histos->fill1DHistByType(nhits,
"hSnHits",
"N hits on Segments",
id,8,-0.5,7.5,
"Segments");
1045 histos->fill1DHistByType(theta,
"hSTheta",
"local theta segments",
id,128,-3.2,3.2,
"Segments");
1046 histos->fill1DHistByType((chisq/nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id,110,-0.05,10.5,
"Segments");
1047 histos->fill1DHistByType(chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id,110,-0.05,1.05,
"Segments");
1048 histos->fill1DHist(globTheta,
"hSGlobalTheta",
"segment global theta",128,0,3.2,
"Segments");
1049 histos->fill1DHist(globPhi,
"hSGlobalPhi",
"segment global phi",128,-3.2,3.2,
"Segments");
1050 histos->fillProfile(chamberSerial(
id),nhits,
"hSnHitsProfile",
"N hits on Segments",601,-0.5,600.5,-0.5,7.5,
"Segments");
1051 if (detailedAnalysis){
1052 histos->fill1DHistByChamber(nhits,
"hSnHits",
"N hits on Segments",
id,8,-0.5,7.5,
"HitsOnSegmentByChamber");
1053 histos->fill1DHistByChamber(theta,
"hSTheta",
"local theta segments",
id,128,-3.2,3.2,
"DetailedSegments");
1054 histos->fill1DHistByChamber((chisq/nDOF),
"hSChiSq",
"segments chi-squared/ndof",
id,110,-0.05,10.5,
"SegChi2ByChamber");
1055 histos->fill1DHistByChamber(chisqProb,
"hSChiSqProb",
"segments chi-squared probability",
id,110,-0.05,1.05,
"SegChi2ByChamber");
1060 if (nSegments == 0) nSegments = -1;
1062 histos->fill1DHist(nSegments,
"hSnSegments",
"Segments per Event",31,-0.5,30.5,
"Segments");
1081 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1082 int nRH = (*dSiter).nRecHits();
1084 CLHEP::HepMatrix sp(6,1);
1085 CLHEP::HepMatrix se(6,1);
1086 for ( std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1089 int kRing = idRH.
ring();
1090 int kStation = idRH.
station();
1094 int centerid = iRH->nStrips()/2;
1095 int centerStrip = iRH->channels(centerid);
1099 float stpos = (*iRH).positionWithinStrip();
1100 se(kLayer,1) = (*iRH).errorWithinStrip();
1102 if (kStation == 1 && (kRing == 1 || kRing == 4)) sp(kLayer,1) = stpos + centerStrip;
1104 if (kLayer == 1 || kLayer == 3 || kLayer == 5) sp(kLayer,1) = stpos + centerStrip;
1105 if (kLayer == 2 || kLayer == 4 || kLayer == 6) sp(kLayer,1) = stpos - 0.5 + centerStrip;
1111 float residual = -99;
1115 float expected = fitX(sp,se);
1116 residual = expected - sp(3,1);
1117 pull = residual/se(3,1);
1121 histos->fill1DHistByType(residual,
"hSResid",
"Fitted Position on Strip - Reconstructed for Layer 3",
id,100,-0.5,0.5,
"Resolution");
1122 histos->fill1DHistByType(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id,100,-5.0,5.0,
"Resolution");
1123 histos->fillProfile(chamberSerial(
id),residual,
"hSResidProfile",
"Fitted Position on Strip - Reconstructed for Layer 3",601,-0.5,600.5,-0.5,0.5,
"Resolution");
1124 if (detailedAnalysis){
1125 histos->fill1DHistByChamber(residual,
"hSResid",
"Fitted Position on Strip - Reconstructed for Layer 3",
id,100,-0.5,0.5,
"DetailedResolution");
1126 histos->fill1DHistByChamber(pull,
"hSStripPosPull",
"Strip Measurement Pulls",
id,100,-5.0,5.0,
"Resolution");
1142 int nSAMuons = saMuons->size();
1143 histos->fill1DHist(nSAMuons,
"trNSAMuons",
"N Standalone Muons per Event",6,-0.5,5.5,
"STAMuons");
1145 for(reco::TrackCollection::const_iterator
muon = saMuons->begin();
muon != saMuons->end(); ++
muon ) {
1146 float preco =
muon->p();
1147 float ptreco =
muon->pt();
1148 int n =
muon->recHitsSize();
1149 float chi2 =
muon->chi2();
1150 float normchi2 =
muon->normalizedChi2();
1162 std::vector<CSCDetId> staChambers;
1164 const DetId detId( (*hit)->geographicalId() );
1169 if (rpcId.region() == 1){ nRPCHitsp++; np++;}
1170 if (rpcId.region() == -1){ nRPCHitsm++; nm++;}
1177 staChambers.push_back(detId.rawId());
1179 if (cscId.endcap() == 1){ nCSCHitsp++; np++;}
1180 if (cscId.endcap() == 2){ nCSCHitsm++; nm++;}
1190 double crudeLength = deltaPnt.
mag();
1191 double deltaPhi = innerPnt.phi() - outerPnt.phi();
1192 double innerGlobalPolarAngle = innerKin.theta();
1193 double outerGlobalPolarAngle = outerKin.theta();
1197 histos->fill1DHist(n,
"trN",
"N hits on a STA Muon Track",51,-0.5,50.5,
"STAMuons");
1198 if (np != 0)
histos->fill1DHist(np,
"trNp",
"N hits on a STA Muon Track (plus endcap)",51,-0.5,50.5,
"STAMuons");
1199 if (nm != 0)
histos->fill1DHist(nm,
"trNm",
"N hits on a STA Muon Track (minus endcap)",51,-0.5,50.5,
"STAMuons");
1200 histos->fill1DHist(nDTHits,
"trNDT",
"N DT hits on a STA Muon Track",51,-0.5,50.5,
"STAMuons");
1201 histos->fill1DHist(nCSCHits,
"trNCSC",
"N CSC hits on a STA Muon Track",51,-0.5,50.5,
"STAMuons");
1202 if (nCSCHitsp != 0)
histos->fill1DHist(nCSCHitsp,
"trNCSCp",
"N CSC hits on a STA Muon Track (+ endcap)",51,-0.5,50.5,
"STAMuons");
1203 if (nCSCHitsm != 0)
histos->fill1DHist(nCSCHitsm,
"trNCSCm",
"N CSC hits on a STA Muon Track (- endcap)",51,-0.5,50.5,
"STAMuons");
1204 histos->fill1DHist(nRPCHits,
"trNRPC",
"N RPC hits on a STA Muon Track",51,-0.5,50.5,
"STAMuons");
1205 if (nRPCHitsp != 0)
histos->fill1DHist(nRPCHitsp,
"trNRPCp",
"N RPC hits on a STA Muon Track (+ endcap)",51,-0.5,50.5,
"STAMuons");
1206 if (nRPCHitsm != 0)
histos->fill1DHist(nRPCHitsm,
"trNRPCm",
"N RPC hits on a STA Muon Track (- endcap)",51,-0.5,50.5,
"STAMuons");
1207 histos->fill1DHist(preco,
"trP",
"STA Muon Momentum",100,0,300,
"STAMuons");
1208 histos->fill1DHist(ptreco,
"trPT",
"STA Muon pT",100,0,40,
"STAMuons");
1209 histos->fill1DHist(chi2,
"trChi2",
"STA Muon Chi2",100,0,200,
"STAMuons");
1210 histos->fill1DHist(normchi2,
"trNormChi2",
"STA Muon Normalized Chi2",100,0,10,
"STAMuons");
1211 histos->fill1DHist(crudeLength,
"trLength",
"Straight Line Length of STA Muon",120,0.,2400.,
"STAMuons");
1212 histos->fill1DHist(deltaPhi,
"trDeltaPhi",
"Delta-Phi Between Inner and Outer STA Muon Pos.",100,-0.5,0.5,
"STAMuons");
1213 histos->fill1DHist(innerGlobalPolarAngle,
"trInnerPolar",
"Polar Angle of Inner P Vector (STA muons)",128,0,3.2,
"STAMuons");
1214 histos->fill1DHist(outerGlobalPolarAngle,
"trOuterPolar",
"Polar Angle of Outer P Vector (STA muons)",128,0,3.2,
"STAMuons");
1215 histos->fill1DHist(innerPnt.phi(),
"trInnerPhi",
"Phi of Inner Position (STA muons)",256,-3.2,3.2,
"STAMuons");
1216 histos->fill1DHist(outerPnt.phi(),
"trOuterPhi",
"Phi of Outer Position (STA muons)",256,-3.2,3.2,
"STAMuons");
1228 int st =
id.station();
1230 int ch =
id.chamber();
1231 int ec =
id.endcap();
1233 if (st == 1 && ri == 1) kSerial = ch;
1234 if (st == 1 && ri == 2) kSerial = ch + 36;
1235 if (st == 1 && ri == 3) kSerial = ch + 72;
1236 if (st == 1 && ri == 4) kSerial = ch;
1237 if (st == 2 && ri == 1) kSerial = ch + 108;
1238 if (st == 2 && ri == 2) kSerial = ch + 126;
1239 if (st == 3 && ri == 1) kSerial = ch + 162;
1240 if (st == 3 && ri == 2) kSerial = ch + 180;
1241 if (st == 4 && ri == 1) kSerial = ch + 216;
1242 if (st == 4 && ri == 2) kSerial = ch + 234;
1243 if (ec == 2) kSerial = kSerial + 300;
1252 int st =
id.station();
1254 int ec =
id.endcap();
1256 if (st == 1 && ri == 1) kSerial = ri;
1257 if (st == 1 && ri == 2) kSerial = ri ;
1258 if (st == 1 && ri == 3) kSerial = ri ;
1259 if (st == 1 && ri == 4) kSerial = 1;
1260 if (st == 2 ) kSerial = ri + 3;
1261 if (st == 3 ) kSerial = ri + 5;
1262 if (st == 4 ) kSerial = ri + 7;
1263 if (ec == 2) kSerial = kSerial * (-1);
1281 for (
int i=1;
i<7;
i++){
1285 Sy = Sy + (points(
i,1)/sigma2);
1286 Sx = Sx + ((
i)/sigma2);
1287 Sxx = Sxx + (
i*
i)/sigma2;
1288 Sxy = Sxy + (((
i)*points(
i,1))/sigma2);
1292 float delta = S*Sxx - Sx*Sx;
1293 float intercept = (Sxx*Sy - Sx*Sxy)/delta;
1294 float slope = (S*Sxy - Sx*Sy)/delta;
1305 return (intercept + slope*3);
1319 bool allWires[2][4][4][36][6];
1320 bool allStrips[2][4][4][36][6];
1321 bool AllRecHits[2][4][4][36][6];
1322 bool AllSegments[2][4][4][36];
1325 for(
int iE = 0;iE<2;iE++){
1326 for(
int iS = 0;iS<4;iS++){
1327 for(
int iR = 0; iR<4;iR++){
1328 for(
int iC =0;iC<36;iC++){
1329 AllSegments[iE][iS][iR][iC] =
false;
1331 for(
int iL=0;iL<6;iL++){
1332 allWires[iE][iS][iR][iC][iL] =
false;
1333 allStrips[iE][iS][iR][iC][iL] =
false;
1334 AllRecHits[iE][iS][iR][iC][iL] =
false;
1345 std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
1346 std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
1347 for( ; wireIter != lWire; ++wireIter) {
1356 std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
1357 std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
1358 for( ; stripIter != lStrip; ++stripIter) {
1359 std::vector<int> myADCVals = stripIter->getADCCounts();
1360 bool thisStripFired =
false;
1361 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1364 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
1365 diff = (float)myADCVals[iCount]-thisPedestal;
1366 if (diff > threshold) {
1367 thisStripFired =
true;
1387 std::vector <unsigned int> seg_ME2(2,0) ;
1388 std::vector <unsigned int> seg_ME3(2,0) ;
1389 std::vector < std::pair <CSCDetId, CSCSegment> > theSegments(4);
1401 unsigned int seg_tmp ;
1403 ++seg_ME2[idseg.
endcap() -1];
1404 seg_tmp = seg_ME2[idseg.
endcap() -1];
1407 ++seg_ME3[idseg.
endcap() -1];
1408 seg_tmp = seg_ME3[idseg.
endcap() -1];
1411 if(1== seg_tmp&& 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1412 std::pair <CSCDetId, CSCSegment> specSeg = make_pair( (
CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1413 theSegments[2*(idseg.
endcap()-1)+(idseg.
station() -2)] = specSeg;
1435 for(
int iE = 0;iE<2;iE++){
1436 for(
int iS = 0;iS<4;iS++){
1437 for(
int iR = 0; iR<4;iR++){
1438 for(
int iC =0;iC<36;iC++){
1439 int NumberOfLayers = 0;
1440 for(
int iL=0;iL<6;iL++){
1441 if(AllRecHits[iE][iS][iR][iC][iL]){
1446 if (iS==0) bin = iR+1+(iE*10);
1447 else bin = (iS+1)*2 + (iR+1) + (iE*10);
1448 if(NumberOfLayers>1){
1450 if(AllSegments[iE][iS][iR][iC]){
1452 hSSTE->AddBinContent(bin);
1455 hSSTE->AddBinContent(20+bin);
1458 if(AllSegments[iE][iS][iR][iC]){
1459 if(NumberOfLayers==6){
1461 hRHSTE->AddBinContent(bin);;
1464 hRHSTE->AddBinContent(20+bin);;
1472 std::vector < std::pair <CSCDetId, CSCSegment> * > theSeg;
1473 if(1==seg_ME2[0]) theSeg.push_back(&theSegments[0]);
1474 if(1==seg_ME3[0]) theSeg.push_back(&theSegments[1]);
1475 if(1==seg_ME2[1]) theSeg.push_back(&theSegments[2]);
1476 if(1==seg_ME3[1]) theSeg.push_back(&theSegments[3]);
1481 std::map <std::string, float> chamberTypes;
1482 chamberTypes[
"ME1/a"] = 0.5;
1483 chamberTypes[
"ME1/b"] = 1.5;
1484 chamberTypes[
"ME1/2"] = 2.5;
1485 chamberTypes[
"ME1/3"] = 3.5;
1486 chamberTypes[
"ME2/1"] = 4.5;
1487 chamberTypes[
"ME2/2"] = 5.5;
1488 chamberTypes[
"ME3/1"] = 6.5;
1489 chamberTypes[
"ME3/2"] = 7.5;
1490 chamberTypes[
"ME4/1"] = 8.5;
1493 std::map <int , GlobalPoint> extrapolatedPoint;
1494 std::map <int , GlobalPoint>::iterator it;
1495 const std::vector<CSCChamber*> ChamberContainer = cscGeom->chambers();
1497 for(
size_t nCh=0;nCh<ChamberContainer.size();nCh++){
1498 const CSCChamber *cscchamber = ChamberContainer[nCh];
1499 std::pair <CSCDetId, CSCSegment> * thisSegment = 0;
1500 for(
size_t iSeg =0;iSeg<theSeg.size();++iSeg ){
1501 if(cscchamber->
id().
endcap() == theSeg[iSeg]->first.endcap()){
1503 if(2==theSeg[iSeg]->
first.station()){
1504 thisSegment = theSeg[iSeg];
1508 if(3==theSeg[iSeg]->
first.station()){
1509 thisSegment = theSeg[iSeg];
1517 const CSCChamber *segChamber = cscGeom->chamber(thisSegment->first);
1521 it = extrapolatedPoint.find(
int(cscchamberCenter.
z()));
1522 if(it==extrapolatedPoint.end()){
1525 double paramaterLine = lineParametrization(segPos.
z(),cscchamberCenter.
z() , segDir.
z());
1526 double xExtrapolated = extrapolate1D(segPos.
x(),segDir.
x(), paramaterLine);
1527 double yExtrapolated = extrapolate1D(segPos.
y(),segDir.
y(), paramaterLine);
1528 GlobalPoint globP (xExtrapolated, yExtrapolated, cscchamberCenter.
z());
1529 extrapolatedPoint[int(cscchamberCenter.
z())] = globP;
1532 LocalPoint extrapolatedPointLocal = cscchamber->
toLocal(extrapolatedPoint[
int(cscchamberCenter.
z())]);
1535 const std::array<const float, 4> & layerBounds = layerGeom->
parameters ();
1536 float shiftFromEdge = 15.;
1537 float shiftFromDeadZone = 10.;
1539 bool pass = withinSensitiveRegion(extrapolatedPointLocal, layerBounds,
1541 shiftFromEdge, shiftFromDeadZone);
1549 for(
int iL =0;iL<6;++iL){
1550 if(AllRecHits[cscchamber->
id().
endcap()-1]
1558 if(cscchamberCenter.
z()<0){
1559 verticalScale = - verticalScale;
1561 verticalScale +=9.5;
1562 hSensitiveAreaEvt->Fill(
float(cscchamber->
id().
chamber()),verticalScale);
1568 hEffDenominator->Fill(
float(cscchamber->
id().
chamber()),verticalScale);
1570 if(AllSegments[cscchamber->
id().
endcap()-1]
1573 hSSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale));
1576 for(
int iL =0;iL<6;++iL){
1580 if(AllRecHits[cscchamber->
id().
endcap()-1]
1583 hRHSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1587 if(allWires[cscchamber->
id().
endcap()-1]
1591 hWireSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1594 if(allStrips[cscchamber->
id().
endcap()-1]
1598 hStripSTE2->Fill(
float(cscchamber->
id().
chamber()),
float(verticalScale),
weight);
1614 float Efficiency = 0.;
1615 float EffError = 0.;
1616 if(fabs(Norm)>0.000000001){
1617 Efficiency = bin/Norm;
1619 EffError =
sqrt( (1.-Efficiency)*Efficiency/Norm );
1622 eff[0] = Efficiency;
1627 std::vector<float> eff(2);
1628 int Nbins = readHisto->GetSize()-2;
1629 std::vector<float> bins(Nbins);
1630 std::vector<float> Efficiency(Nbins);
1631 std::vector<float> EffError(Nbins);
1634 for (
int i=0;
i<20;
i++){
1635 Num = readHisto->GetBinContent(
i+1);
1636 Den = readHisto->GetBinContent(
i+21);
1637 getEfficiency(Num, Den, eff);
1638 Efficiency[
i] = eff[0];
1639 EffError[
i] = eff[1];
1640 writeHisto->SetBinContent(
i+1, Efficiency[
i]);
1641 writeHisto->SetBinError(i+1, EffError[i]);
1649 float y_center = 0.;
1650 double yUp = layerBounds[3] + y_center;
1651 double yDown = - layerBounds[3] + y_center;
1652 double xBound1Shifted = layerBounds[0] - shiftFromEdge;
1653 double xBound2Shifted = layerBounds[1] - shiftFromEdge;
1654 double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
1655 double lineConst = yUp - lineSlope*xBound2Shifted;
1656 double yBorder = lineSlope*
abs(localPos.
x()) + lineConst;
1659 std::vector <float> deadZoneCenter(6);
1660 float cutZone = shiftFromDeadZone;
1662 if(station>1 && station<5){
1664 deadZoneCenter[0]= -162.48 ;
1665 deadZoneCenter[1] = -81.8744;
1666 deadZoneCenter[2] = -21.18165;
1667 deadZoneCenter[3] = 39.51105;
1668 deadZoneCenter[4] = 100.2939;
1669 deadZoneCenter[5] = 160.58;
1671 if(localPos.
y() >yBorder &&
1672 ((localPos.
y()> deadZoneCenter[0] + cutZone && localPos.
y()< deadZoneCenter[1] - cutZone) ||
1673 (localPos.
y()> deadZoneCenter[1] + cutZone && localPos.
y()< deadZoneCenter[2] - cutZone) ||
1674 (localPos.
y()> deadZoneCenter[2] + cutZone && localPos.
y()< deadZoneCenter[3] - cutZone) ||
1675 (localPos.
y()> deadZoneCenter[3] + cutZone && localPos.
y()< deadZoneCenter[4] - cutZone) ||
1676 (localPos.
y()> deadZoneCenter[4] + cutZone && localPos.
y()< deadZoneCenter[5] - cutZone))){
1682 deadZoneCenter[0]= -95.80 ;
1683 deadZoneCenter[1] = -27.47;
1684 deadZoneCenter[2] = 33.67;
1685 deadZoneCenter[3] = 90.85;
1687 else if(3==station){
1688 deadZoneCenter[0]= -89.305 ;
1689 deadZoneCenter[1] = -39.705;
1690 deadZoneCenter[2] = 20.195;
1691 deadZoneCenter[3] = 77.395;
1693 else if(4==station){
1694 deadZoneCenter[0]= -75.645;
1695 deadZoneCenter[1] = -26.055;
1696 deadZoneCenter[2] = 23.855;
1697 deadZoneCenter[3] = 70.575;
1699 if(localPos.
y() >yBorder &&
1700 ((localPos.
y()> deadZoneCenter[0] + cutZone && localPos.
y()< deadZoneCenter[1] - cutZone) ||
1701 (localPos.
y()> deadZoneCenter[1] + cutZone && localPos.
y()< deadZoneCenter[2] - cutZone) ||
1702 (localPos.
y()> deadZoneCenter[2] + cutZone && localPos.
y()< deadZoneCenter[3] - cutZone))){
1707 else if(1==station){
1709 deadZoneCenter[0]= -83.155 ;
1710 deadZoneCenter[1] = -22.7401;
1711 deadZoneCenter[2] = 27.86665;
1712 deadZoneCenter[3] = 81.005;
1713 if(localPos.
y() > yBorder &&
1714 ((localPos.
y()> deadZoneCenter[0] + cutZone && localPos.
y()< deadZoneCenter[1] - cutZone) ||
1715 (localPos.
y()> deadZoneCenter[1] + cutZone && localPos.
y()< deadZoneCenter[2] - cutZone) ||
1716 (localPos.
y()> deadZoneCenter[2] + cutZone && localPos.
y()< deadZoneCenter[3] - cutZone))){
1721 deadZoneCenter[0]= -86.285 ;
1722 deadZoneCenter[1] = -32.88305;
1723 deadZoneCenter[2] = 32.867423;
1724 deadZoneCenter[3] = 88.205;
1725 if(localPos.
y() > (yBorder) &&
1726 ((localPos.
y()> deadZoneCenter[0] + cutZone && localPos.
y()< deadZoneCenter[1] - cutZone) ||
1727 (localPos.
y()> deadZoneCenter[1] + cutZone && localPos.
y()< deadZoneCenter[2] - cutZone) ||
1728 (localPos.
y()> deadZoneCenter[2] + cutZone && localPos.
y()< deadZoneCenter[3] - cutZone))){
1733 deadZoneCenter[0]= -81.0;
1734 deadZoneCenter[1] = 81.0;
1735 if(localPos.
y() > (yBorder) &&
1736 (localPos.
y()> deadZoneCenter[0] + cutZone && localPos.
y()< deadZoneCenter[1] - cutZone )){
1767 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
1772 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
1773 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
1774 for ( ; digiItr !=
last; ++digiItr ) {
1775 int thisStrip = digiItr->getStrip();
1776 if (thisStrip == (centerStrip)){
1777 std::vector<int> myADCVals = digiItr->getADCCounts();
1778 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1779 float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1780 SigADC[0] = thisSignal - 6*thisPedestal;
1783 if (thisStrip == (centerStrip+1)){
1784 std::vector<int> myADCVals = digiItr->getADCCounts();
1785 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1786 float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1787 SigADC[1] = thisSignal - 6*thisPedestal;
1789 if (thisStrip == (centerStrip+2)){
1790 std::vector<int> myADCVals = digiItr->getADCCounts();
1791 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1792 float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1793 SigADC[2] = thisSignal - 6*thisPedestal;
1795 if (thisStrip == (centerStrip-1)){
1796 std::vector<int> myADCVals = digiItr->getADCCounts();
1797 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1798 float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1799 SigADC[3] = thisSignal - 6*thisPedestal;
1801 if (thisStrip == (centerStrip-2)){
1802 std::vector<int> myADCVals = digiItr->getADCCounts();
1803 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1804 float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1805 SigADC[4] = thisSignal - 6*thisPedestal;
1808 TotalADC = 0.2*(SigADC[0]+SigADC[1]+SigADC[2]+SigADC[3]+SigADC[4]);
1823 for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
1828 AllRechits.insert(std::pair<CSCDetId , CSCRecHit2D>(idrec,*recIt));
1831 int centerid = recIt->nStrips()/2;
1832 int centerStrip = recIt->channels(centerid);
1834 float rHsignal = getthisSignal(*strips, idrec, centerStrip);
1835 histos->fill1DHist(rHsignal,
"hrHSignal",
"Signal in the 4th time bin for centre strip",1100,-99,1000,
"recHits");
1841 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
1842 for ( std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1845 float xrec = lpRH.
x();
1846 float yrec = lpRH.
y();
1847 float zrec = lpRH.
z();
1848 bool RHalreadyinMap =
false;
1850 multimap<CSCDetId , CSCRecHit2D>::iterator segRHit;
1851 segRHit = SegRechits.find(idRH);
1852 if (segRHit != SegRechits.end()){
1853 for( ; segRHit != SegRechits.upper_bound(idRH); ++segRHit){
1855 LocalPoint lposRH = (segRHit->second).localPosition();
1856 float xpos = lposRH.
x();
1857 float ypos = lposRH.
y();
1858 float zpos = lposRH.
z();
1859 if ( xrec == xpos && yrec == ypos && zrec == zpos){
1860 RHalreadyinMap =
true;
1865 if(!RHalreadyinMap){ SegRechits.insert(std::pair<CSCDetId , CSCRecHit2D>(idRH,*iRH));}
1869 findNonAssociatedRecHits(cscGeom,strips);
1881 for(std::multimap<CSCDetId , CSCRecHit2D>::iterator allRHiter = AllRechits.begin();allRHiter != AllRechits.end(); ++allRHiter){
1883 LocalPoint lpRH = (allRHiter->second).localPosition();
1884 float xrec = lpRH.
x();
1885 float yrec = lpRH.
y();
1886 float zrec = lpRH.
z();
1888 bool foundmatch =
false;
1889 multimap<CSCDetId , CSCRecHit2D>::iterator segRHit;
1890 segRHit = SegRechits.find(idRH);
1891 if (segRHit != SegRechits.end()){
1892 for( ; segRHit != SegRechits.upper_bound(idRH); ++segRHit){
1894 LocalPoint lposRH = (segRHit->second).localPosition();
1895 float xpos = lposRH.
x();
1896 float ypos = lposRH.
y();
1897 float zpos = lposRH.
z();
1899 if ( xrec == xpos && yrec == ypos && zrec == zpos){
1903 float dclose =1000.;
1907 d =
sqrt(
pow(xrec-xpos,2)+
pow(yrec-ypos,2)+
pow(zrec-zpos,2));
1910 if( distRHmap.find((allRHiter->second)) == distRHmap.end() ) {
1911 distRHmap.insert(make_pair(allRHiter->second,dclose) );
1915 distRHmap.erase(allRHiter->second);
1916 distRHmap.insert(make_pair(allRHiter->second,dclose));
1922 if(!foundmatch){NonAssociatedRechits.insert(std::pair<CSCDetId , CSCRecHit2D>(idRH,allRHiter->second));}
1925 for(std::map<CSCRecHit2D,float,ltrh>::iterator iter = distRHmap.begin();iter != distRHmap.end(); ++iter){
1926 histos->fill1DHist(iter->second,
"hdistRH",
"Distance of Non Associated RecHit from closest Segment RecHit",500,0.,100.,
"NonAssociatedRechits");
1929 for(std::multimap<CSCDetId , CSCRecHit2D>::iterator iter = NonAssociatedRechits.begin();iter != NonAssociatedRechits.end(); ++iter){
1931 int kEndcap = idrec.
endcap();
1932 int cEndcap = idrec.
endcap();
1933 if (kEndcap == 2)cEndcap = -1;
1934 int kRing = idrec.
ring();
1935 int kStation = idrec.
station();
1936 int kChamber = idrec.
chamber();
1940 LocalPoint rhitlocal = (iter->second).localPosition();
1941 float xreco = rhitlocal.
x();
1942 float yreco = rhitlocal.
y();
1945 int centerid = (iter->second).nStrips()/2;
1946 int centerStrip = (iter->second).channels(centerid);
1951 int adcsize=(iter->second).nStrips()*(iter->second).nTimeBins();
1952 for (
unsigned int i=0;
i< (iter->second).nStrips();
i++) {
1953 for (
unsigned int j=0;
j< (iter->second).nTimeBins()-1;
j++) {
1954 rHSumQ+=(iter->second).adcs(
i,
j);
1955 if (
i!=1) sumsides+=(iter->second).adcs(
i,
j);
1959 float rHratioQ = sumsides/rHSumQ;
1960 if (adcsize != 12) rHratioQ = -99;
1963 float rHtime = (iter->second).tpeak()/50;
1966 int rHwidth = getWidth(*strips, idrec, centerStrip);
1970 const CSCLayer* csclayer = cscGeom->layer( idrec );
1974 float grecx = rhitglobal.
x();
1975 float grecy = rhitglobal.
y();
1980 int kCodeBroad = cEndcap * ( 4*(kStation-1) + kRing) ;
1981 int kCodeNarrow = cEndcap * ( 100*(kRing-1) + kChamber) ;
1984 histos->fill1DHist(kCodeBroad,
"hNARHCodeBroad",
"broad scope code for recHits",33,-16.5,16.5,
"NonAssociatedRechits");
1985 if (kStation == 1)
histos->fill1DHist(kCodeNarrow,
"hNARHCodeNarrow1",
"narrow scope recHit code station 1",801,-400.5,400.5,
"NonAssociatedRechits");
1986 if (kStation == 2)
histos->fill1DHist(kCodeNarrow,
"hNARHCodeNarrow2",
"narrow scope recHit code station 2",801,-400.5,400.5,
"NonAssociatedRechits");
1987 if (kStation == 3)
histos->fill1DHist(kCodeNarrow,
"hNARHCodeNarrow3",
"narrow scope recHit code station 3",801,-400.5,400.5,
"NonAssociatedRechits");
1988 if (kStation == 4)
histos->fill1DHist(kCodeNarrow,
"hNARHCodeNarrow4",
"narrow scope recHit code station 4",801,-400.5,400.5,
"NonAssociatedRechits");
1989 histos->fill1DHistByType(kLayer,
"hNARHLayer",
"RecHits per Layer",idrec,8,-0.5,7.5,
"NonAssociatedRechits");
1990 histos->fill1DHistByType(xreco,
"hNARHX",
"Local X of recHit",idrec,160,-80.,80.,
"NonAssociatedRechits");
1991 histos->fill1DHistByType(yreco,
"hNARHY",
"Local Y of recHit",idrec,60,-180.,180.,
"NonAssociatedRechits");
1992 if (kStation == 1 && (kRing == 1 || kRing == 4))
histos->fill1DHistByType(rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge",idrec,250,0,4000,
"NonAssociatedRechits");
1993 else histos->fill1DHistByType(rHSumQ,
"hNARHSumQ",
"Sum 3x3 recHit Charge",idrec,250,0,2000,
"NonAssociatedRechits");
1994 histos->fill1DHistByType(rHratioQ,
"hNARHRatioQ",
"Ratio (Ql+Qr)/Qt)",idrec,120,-0.1,1.1,
"NonAssociatedRechits");
1995 histos->fill1DHistByType(rHtime,
"hNARHTiming",
"recHit Timing",idrec,200,-10,10,
"NonAssociatedRechits");
1996 histos->fill2DHistByStation(grecx,grecy,
"hNARHGlobal",
"recHit Global Position",idrec,400,-800.,800.,400,-800.,800.,
"NonAssociatedRechits");
1997 histos->fill1DHistByType(rHwidth,
"hNARHwidth",
"width for Non associated recHit",idrec,21,-0.5,20.5,
"NonAssociatedRechits");
2001 for(std::multimap<CSCDetId , CSCRecHit2D>::iterator iter = SegRechits.begin();iter != SegRechits.end(); ++iter){
2003 int kEndcap = idrec.
endcap();
2004 int cEndcap = idrec.
endcap();
2005 if (kEndcap == 2)cEndcap = -1;
2006 int kRing = idrec.
ring();
2007 int kStation = idrec.
station();
2008 int kChamber = idrec.
chamber();
2012 LocalPoint rhitlocal = (iter->second).localPosition();
2013 float xreco = rhitlocal.
x();
2014 float yreco = rhitlocal.
y();
2017 int centerid = (iter->second).nStrips()/2;
2018 int centerStrip = (iter->second).channels(centerid);
2024 int adcsize=(iter->second).nStrips()*(iter->second).nTimeBins();
2025 for (
unsigned int i=0;
i< (iter->second).nStrips();
i++) {
2026 for (
unsigned int j=0;
j< (iter->second).nTimeBins()-1;
j++) {
2027 rHSumQ+=(iter->second).adcs(
i,
j);
2028 if (
i!=1) sumsides+=(iter->second).adcs(
i,
j);
2032 float rHratioQ = sumsides/rHSumQ;
2033 if (adcsize != 12) rHratioQ = -99;
2036 float rHtime = (iter->second).tpeak()/50;
2039 int rHwidth = getWidth(*strips, idrec, centerStrip);
2043 const CSCLayer* csclayer = cscGeom->layer( idrec );
2047 float grecx = rhitglobal.
x();
2048 float grecy = rhitglobal.
y();
2051 int kCodeBroad = cEndcap * ( 4*(kStation-1) + kRing) ;
2052 int kCodeNarrow = cEndcap * ( 100*(kRing-1) + kChamber) ;
2055 histos->fill1DHist(kCodeBroad,
"hSegRHCodeBroad",
"broad scope code for recHits",33,-16.5,16.5,
"AssociatedRechits");
2056 if (kStation == 1)
histos->fill1DHist(kCodeNarrow,
"hSegRHCodeNarrow1",
"narrow scope recHit code station 1",801,-400.5,400.5,
"AssociatedRechits");
2057 if (kStation == 2)
histos->fill1DHist(kCodeNarrow,
"hSegRHCodeNarrow2",
"narrow scope recHit code station 2",801,-400.5,400.5,
"AssociatedRechits");
2058 if (kStation == 3)
histos->fill1DHist(kCodeNarrow,
"hSegRHCodeNarrow3",
"narrow scope recHit code station 3",801,-400.5,400.5,
"AssociatedRechits");
2059 if (kStation == 4)
histos->fill1DHist(kCodeNarrow,
"hSegRHCodeNarrow4",
"narrow scope recHit code station 4",801,-400.5,400.5,
"AssociatedRechits");
2060 histos->fill1DHistByType(kLayer,
"hSegRHLayer",
"RecHits per Layer",idrec,8,-0.5,7.5,
"AssociatedRechits");
2061 histos->fill1DHistByType(xreco,
"hSegRHX",
"Local X of recHit",idrec,160,-80.,80.,
"AssociatedRechits");
2062 histos->fill1DHistByType(yreco,
"hSegRHY",
"Local Y of recHit",idrec,60,-180.,180.,
"AssociatedRechits");
2063 if (kStation == 1 && (kRing == 1 || kRing == 4))
histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge",idrec,250,0,4000,
"AssociatedRechits");
2064 else histos->fill1DHistByType(rHSumQ,
"hSegRHSumQ",
"Sum 3x3 recHit Charge",idrec,250,0,2000,
"AssociatedRechits");
2065 histos->fill1DHistByType(rHratioQ,
"hSegRHRatioQ",
"Ratio (Ql+Qr)/Qt)",idrec,120,-0.1,1.1,
"AssociatedRechits");
2066 histos->fill1DHistByType(rHtime,
"hSegRHTiming",
"recHit Timing",idrec,200,-10,10,
"AssociatedRechits");
2067 histos->fill2DHistByStation(grecx,grecy,
"hSegRHGlobal",
"recHit Global Position",idrec,400,-800.,800.,400,-800.,800.,
"AssociatedRechits");
2068 histos->fill1DHistByType(rHwidth,
"hSegRHwidth",
"width for Non associated recHit",idrec,21,-0.5,20.5,
"AssociatedRechits");
2075 NonAssociatedRechits.clear();
2086 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
2091 vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2092 vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2095 int Rg = idRH.
ring();
2096 if (St == 1 && Rg == 4){
2097 while(centerStrip> 16) centerStrip -= 16;
2099 for ( ; digiItr !=
last; ++digiItr ) {
2100 int thisStrip = digiItr->getStrip();
2102 std::vector<int> myADCVals = digiItr->getADCCounts();
2103 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2104 float Signal = (float) myADCVals[3];
2105 if (thisStrip == (centerStrip)){
2106 thisADC = Signal-thisPedestal;
2112 if (thisStrip == (centerStrip+1)){
2113 std::vector<int> myADCVals = digiItr->getADCCounts();
2115 if (thisStrip == (centerStrip-1)){
2116 std::vector<int> myADCVals = digiItr->getADCCounts();
2140 for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
2143 std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2144 std::vector<CSCStripDigi>::const_iterator
first = (*sIt).second.first;
2145 std::vector<CSCStripDigi>::const_iterator
last = (*sIt).second.second;
2146 std::vector<CSCStripDigi>::const_iterator it = (*sIt).second.first;
2147 std::vector<CSCStripDigi>::const_iterator itr = (*sIt).second.first;
2150 int Rg = idRH.
ring();
2151 if (St == 1 && Rg == 4){
2152 while(centerStrip> 16) centerStrip -= 16;
2154 for ( ; digiItr !=
last; ++digiItr ) {
2155 int thisStrip = digiItr->getStrip();
2156 if (thisStrip == (centerStrip)){
2158 for( ; it !=
last; ++it ) {
2159 int strip = it->getStrip();
2160 std::vector<int> myADCVals = it->getADCCounts();
2161 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2162 if(((
float)myADCVals[3]-thisPedestal) < 6 || widthpos == 10 || it==
last){
break;}
2163 if(strip != centerStrip){ widthpos += 1;
2167 for( ; itr !=
first; --itr) {
2168 int strip = itr->getStrip();
2169 std::vector<int> myADCVals = itr->getADCCounts();
2170 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2171 if(((
float)myADCVals[3]-thisPedestal) < 6 || widthneg == 10 || itr==
first){
break;}
2172 if(strip != centerStrip) {widthneg += 1 ;
2180 width = width + widthneg + widthpos ;
2195 int channel=0,
mult,wire,layer,idlayer,idchamber,
ring;
2196 int wire_strip_rechit_present;
2200 std::map<int,int>::iterator intIt;
2202 m_single_wire_layer.clear();
2208 m_wire_hvsegm.clear();
2209 std::map<int,std::vector<int> >::iterator intvecIt;
2211 int csctype[10]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
2212 int hvsegm_layer[10]={1, 1, 3, 3, 3, 5, 3, 5, 3, 5};
2215 for(
int i=0;
i<10;
i++) nmbhvsegm.push_back(hvsegm_layer[
i]);
2217 std::vector<int> zer_1_1a(49,0);
2219 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_1_1a;
2220 intvecIt=m_wire_hvsegm.find(
id);
2221 for(
int wire=1;wire<=48;wire++) intvecIt->second[wire]=1;
2224 std::vector<int> zer_1_1b(49,0);
2226 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_1_1b;
2227 intvecIt=m_wire_hvsegm.find(
id);
2228 for(
int wire=1;wire<=48;wire++) intvecIt->second[wire]=1;
2231 std::vector<int> zer_1_2(65,0);
2233 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_1_2;
2234 intvecIt=m_wire_hvsegm.find(
id);
2235 for(
int wire=1;wire<=24;wire++) intvecIt->second[wire]=1;
2236 for(
int wire=25;wire<=48;wire++) intvecIt->second[wire]=2;
2237 for(
int wire=49;wire<=64;wire++) intvecIt->second[wire]=3;
2240 std::vector<int> zer_1_3(33,0);
2242 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_1_3;
2243 intvecIt=m_wire_hvsegm.find(
id);
2244 for(
int wire=1;wire<=12;wire++) intvecIt->second[wire]=1;
2245 for(
int wire=13;wire<=22;wire++) intvecIt->second[wire]=2;
2246 for(
int wire=23;wire<=32;wire++) intvecIt->second[wire]=3;
2249 std::vector<int> zer_2_1(113,0);
2251 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_2_1;
2252 intvecIt=m_wire_hvsegm.find(
id);
2253 for(
int wire=1;wire<=44;wire++) intvecIt->second[wire]=1;
2254 for(
int wire=45;wire<=80;wire++) intvecIt->second[wire]=2;
2255 for(
int wire=81;wire<=112;wire++) intvecIt->second[wire]=3;
2258 std::vector<int> zer_2_2(65,0);
2260 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_2_2;
2261 intvecIt=m_wire_hvsegm.find(
id);
2262 for(
int wire=1;wire<=16;wire++) intvecIt->second[wire]=1;
2263 for(
int wire=17;wire<=28;wire++) intvecIt->second[wire]=2;
2264 for(
int wire=29;wire<=40;wire++) intvecIt->second[wire]=3;
2265 for(
int wire=41;wire<=52;wire++) intvecIt->second[wire]=4;
2266 for(
int wire=53;wire<=64;wire++) intvecIt->second[wire]=5;
2269 std::vector<int> zer_3_1(97,0);
2271 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_3_1;
2272 intvecIt=m_wire_hvsegm.find(
id);
2273 for(
int wire=1;wire<=32;wire++) intvecIt->second[wire]=1;
2274 for(
int wire=33;wire<=64;wire++) intvecIt->second[wire]=2;
2275 for(
int wire=65;wire<=96;wire++) intvecIt->second[wire]=3;
2278 std::vector<int> zer_3_2(65,0);
2280 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_3_2;
2281 intvecIt=m_wire_hvsegm.find(
id);
2282 for(
int wire=1;wire<=16;wire++) intvecIt->second[wire]=1;
2283 for(
int wire=17;wire<=28;wire++) intvecIt->second[wire]=2;
2284 for(
int wire=29;wire<=40;wire++) intvecIt->second[wire]=3;
2285 for(
int wire=41;wire<=52;wire++) intvecIt->second[wire]=4;
2286 for(
int wire=53;wire<=64;wire++) intvecIt->second[wire]=5;
2289 std::vector<int> zer_4_1(97,0);
2291 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_4_1;
2292 intvecIt=m_wire_hvsegm.find(
id);
2293 for(
int wire=1;wire<=32;wire++) intvecIt->second[wire]=1;
2294 for(
int wire=33;wire<=64;wire++) intvecIt->second[wire]=2;
2295 for(
int wire=65;wire<=96;wire++) intvecIt->second[wire]=3;
2298 std::vector<int> zer_4_2(65,0);
2300 if(m_wire_hvsegm.find(
id) == m_wire_hvsegm.end()) m_wire_hvsegm[
id]=zer_4_2;
2301 intvecIt=m_wire_hvsegm.find(
id);
2302 for(
int wire=1;wire<=16;wire++) intvecIt->second[wire]=1;
2303 for(
int wire=17;wire<=28;wire++) intvecIt->second[wire]=2;
2304 for(
int wire=29;wire<=40;wire++) intvecIt->second[wire]=3;
2305 for(
int wire=41;wire<=52;wire++) intvecIt->second[wire]=4;
2306 for(
int wire=53;wire<=64;wire++) intvecIt->second[wire]=5;
2312 wire_strip_rechit_present=0;
2313 if(wirecltn.begin() != wirecltn.end())
2314 wire_strip_rechit_present= wire_strip_rechit_present+1;
2315 if(strpcltn.begin() != strpcltn.end())
2316 wire_strip_rechit_present= wire_strip_rechit_present+2;
2317 if(rechitcltn.begin() != rechitcltn.end())
2318 wire_strip_rechit_present= wire_strip_rechit_present+4;
2320 if(wire_strip_rechit_present==7) {
2328 for(wiredetUnitIt=wirecltn.begin();wiredetUnitIt!=wirecltn.end();
2330 const CSCDetId id = (*wiredetUnitIt).first;
2331 idlayer=indexer.
dbIndex(
id, channel);
2332 idchamber=idlayer/10;
2338 range.first; digiIt!=range.second; ++digiIt){
2339 wire=(*digiIt).getWireGroup();
2345 if(m_single_wire_layer.find(idlayer) == m_single_wire_layer.end())
2346 m_single_wire_layer[idlayer]=wire;
2352 CSCRecHit2D::ADCContainer m_adc;
2354 for(recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2356 idlayer=indexer.
dbIndex(
id, channel);
2357 idchamber=idlayer/10;
2360 if(m_single_wire_layer.find(idlayer) != m_single_wire_layer.end()) {
2362 if(recIt->nStrips()==3) {
2364 unsigned int binmx=0;
2367 for(
unsigned int i=0;
i<recIt->nStrips();
i++)
2368 for(
unsigned int j=0;
j<recIt->nTimeBins();
j++)
2369 if(recIt->adcs(
i,
j)>adcmax) {
2370 adcmax=recIt->adcs(
i,
j);
2374 float adc_3_3_sum=0.0;
2376 for(
unsigned int i=0;
i<recIt->nStrips();
i++)
2377 for(
unsigned int j=binmx-1;
j<=binmx+1;
j++)
2378 adc_3_3_sum+=recIt->adcs(
i,
j);
2381 if(adc_3_3_sum > 0.0 && adc_3_3_sum < 2000.0) {
2385 if(
id.
station()==1 &&
id.
ring()==4 && recIt->channels(1)>16) flag=1;
2389 wire= m_single_wire_layer[idlayer];
2390 int chambertype=
id.iChamberType(
id.
station(),
id.
ring());
2391 int hvsgmtnmb=m_wire_hvsegm[chambertype][wire];
2392 int nmbofhvsegm=nmbhvsegm[chambertype-1];
2393 int location= (layer-1)*nmbofhvsegm+hvsgmtnmb;
2396 ss<<
"gas_gain_rechit_adc_3_3_sum_location_ME_"<<idchamber;
2397 name=ss.str(); ss.str(
"");
2398 if(
id.
endcap()==1) endcapstr =
"+";
2401 if(
id.
endcap()==2) endcapstr =
"-";
2402 ss<<
"Gas Gain Rechit ADC3X3 Sum ME"<<endcapstr<<
2403 id.station()<<
"/"<<ring<<
"/"<<
id.chamber();
2404 title=ss.str(); ss.str(
"");
2407 histos->fill2DHist(x,y,name.c_str(),title.c_str(),30,1.0,31.0,50,0.0,2000.0,
"GasGain");
2432 int wire,wiretbin,nmbwiretbin,layer,afeb,idlayer,idchamber;
2436 if(wirecltn.begin() != wirecltn.end()) {
2444 for(wiredetUnitIt=wirecltn.begin();wiredetUnitIt!=wirecltn.end();
2446 const CSCDetId id = (*wiredetUnitIt).first;
2447 idlayer=indexer.
dbIndex(
id, channel);
2448 idchamber=idlayer/10;
2451 if (
id.
endcap() == 1) endcapstr =
"+";
2452 if (
id.
endcap() == 2) endcapstr =
"-";
2458 range.first; digiIt!=range.second; ++digiIt){
2459 wire=(*digiIt).getWireGroup();
2460 wiretbin=(*digiIt).getTimeBin();
2461 nmbwiretbin=(*digiIt).getTimeBinsOn().size();
2462 afeb=3*((wire-1)/8)+(layer+1)/2;
2467 ss<<
"afeb_time_bin_vs_afeb_occupancy_ME_"<<idchamber;
2468 name=ss.str(); ss.str(
"");
2469 ss<<
"Time Bin vs AFEB Occupancy ME"<<endcapstr<<
id.station()<<
"/"<<
id.ring()<<
"/"<<
id.chamber();
2470 title=ss.str(); ss.str(
"");
2471 histos->fill2DHist(x,y,name.c_str(),title.c_str(),42,1.,43.,16,0.,16.,
"AFEBTiming");
2476 ss<<
"nmb_afeb_time_bins_vs_afeb_ME_"<<idchamber;
2477 name=ss.str(); ss.str(
"");
2478 ss<<
"Number of Time Bins vs AFEB ME"<<endcapstr<<
id.station()<<
"/"<<
id.ring()<<
"/"<<
id.chamber();
2481 histos->fill2DHist(x,y,name.c_str(),title.c_str(),42,1.,43.,16,0.,16.,
"AFEBTiming");
2497 int strip,tbin,cfeb,idlayer,idchamber;
2501 if(compars.begin() != compars.end()) {
2509 for(compdetUnitIt=compars.begin();compdetUnitIt!=compars.end();
2511 const CSCDetId id = (*compdetUnitIt).first;
2512 idlayer=indexer.
dbIndex(
id, channel);
2513 idchamber=idlayer/10;
2515 if (
id.
endcap() == 1) endcap =
"+";
2516 if (
id.
endcap() == 2) endcap =
"-";
2519 (*compdetUnitIt).second;
2521 range.first; digiIt!=range.second; ++digiIt){
2522 strip=(*digiIt).getStrip();
2530 tbin=(*digiIt).getTimeBin();
2531 cfeb=(strip-1)/16+1;
2537 ss<<
"comp_time_bin_vs_cfeb_occupancy_ME_"<<idchamber;
2538 name=ss.str(); ss.str(
"");
2539 ss<<
"Comparator Time Bin vs CFEB Occupancy ME"<<endcap<<
2540 id.station()<<
"/"<<
id.ring()<<
"/"<<
id.chamber();
2541 title=ss.str(); ss.str(
"");
2542 histos->fill2DHist(x,y,name.c_str(),title.c_str(),5,1.,6.,16,0.,16.,
"CompTiming");
2555 float adc_3_3_sum,adc_3_3_wtbin,
x,
y;
2556 int cfeb,idchamber,
ring;
2560 std::vector<float> zer(6,0.0);
2563 std::map<int,int>::iterator intIt;
2565 if(rechitcltn.begin() != rechitcltn.end()) {
2571 CSCRecHit2D::ADCContainer m_adc;
2572 for(recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2575 if(recIt->nStrips()==3) {
2578 unsigned int binmx=0;
2581 for(
unsigned int i=0;
i<recIt->nStrips();
i++)
2582 for(
unsigned int j=0;
j<recIt->nTimeBins();
j++)
2583 if(recIt->adcs(
i,
j)>adcmax) {
2584 adcmax=recIt->adcs(
i,
j);
2590 for(
unsigned int i=0;
i<recIt->nStrips();
i++)
2591 for(
unsigned int j=binmx-1;
j<=binmx+1;
j++)
2592 adc_3_3_sum+=recIt->adcs(
i,
j);
2596 if(adc_3_3_sum > 100.0) {
2599 int centerStrip=recIt->channels(1);
2602 if(
id.
station()==1 &&
id.
ring()==4 && centerStrip>16) flag=1;
2605 adc_3_3_wtbin=(*recIt).tpeak()/50;
2606 idchamber=indexer.
dbIndex(
id, centerStrip)/10;
2614 ss<<
"adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_"<<idchamber;
2615 name=ss.str(); ss.str(
"");
2618 if(
id.
endcap() == 1) endcapstr =
"+";
2619 if(
id.
endcap() == 2) endcapstr =
"-";
2620 ring=
id.ring();
if(
id.
ring()==4) ring=1;
2621 ss<<
"ADC 3X3 Weighted Time Bin vs CFEB Occupancy ME"
2622 <<endcapstr<<
id.station()<<
"/"<<ring<<
"/"<<
id.chamber();
2623 title=ss.str(); ss.str(
"");
2625 cfeb=(centerStrip-1)/16+1;
2626 x=cfeb; y=adc_3_3_wtbin;
2627 histos->fill2DHist(x,y,name.c_str(),title.c_str(),5,1.,6.,80,-8.,8.,
"ADCTiming");
2646 map<CSCDetId, float > segment_median_map;
2647 map<CSCDetId, GlobalPoint > segment_position_map;
2657 LocalPoint localPos = (*dSiter).localPosition();
2659 const CSCChamber* cscchamber = cscGeom->chamber(
id);
2661 globalPosition = cscchamber->
toGlobal(localPos);
2665 std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
2666 int nRH = (*dSiter).nRecHits();
2667 if (nRH < 4 )
continue;
2670 vector<float> non_zero;
2672 for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2673 non_zero.push_back( iRH->tpeak());
2678 sort(non_zero.begin(),non_zero.end());
2679 int middle_index = non_zero.size()/2;
2680 float average_two = (non_zero.at(middle_index-1) + non_zero.at(middle_index))/2.;
2681 if(non_zero.size()%2)
2682 average_two = non_zero.at(middle_index);
2685 segment_median_map[id]=average_two;
2686 segment_position_map[id]=globalPosition;
2688 double distToIP =
sqrt(globalPosition.
x()*globalPosition.
x()+globalPosition.
y()*globalPosition.
y()+globalPosition.
z()*globalPosition.
z());
2690 histos->fillProfile(chamberSerial(
id),average_two,
"timeChamber",
"Segment mean time",601,-0.5,600.5,-400.,400.,
"TimeMonitoring");
2691 histos->fillProfileByType(
id.chamber(),average_two,
"timeChamberByType",
"Segment mean time by chamber",
id,36,0.5,36.5,-400,400.,
"TimeMonitoring");
2692 histos->fill2DHist(distToIP,average_two,
"seg_time_vs_distToIP",
"Segment time vs. Distance to IP",80,600.,1400.,800,-400,400.,
"TimeMonitoring");
2693 histos->fill2DHist(globalPosition.
z(),average_two,
"seg_time_vs_globZ",
"Segment time vs. z position",240,-1200,1200,800,-400.,400.,
"TimeMonitoring");
2694 histos->fill2DHist(fabs(globalPosition.
z()),average_two,
"seg_time_vs_absglobZ",
"Segment time vs. abs(z position)",120,0.,1200.,800,-400.,400.,
"TimeMonitoring");
2699 map<CSCDetId, float >::const_iterator it_outer;
2700 map<CSCDetId, float >::const_iterator it_inner;
2701 for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++){
2703 CSCDetId id_outer = it_outer->first;
2704 float t_outer = it_outer->second;
2707 for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++){
2709 CSCDetId id_inner = it_inner->first;
2710 float t_inner = it_inner->second;
2715 if (chamberSerial(id_outer) == chamberSerial(id_inner))
continue;
2725 histos->fill1DHist(t_outer-t_inner,
"diff_opposite_endcaps",
"#Delta t [ME+]-[ME-] for chambers in same station and ring",800,-400.,400.,
"TimeMonitoring");
2726 histos->fill1DHistByType(t_outer-t_inner,
"diff_opposite_endcaps_byType",
"#Delta t [ME+]-[ME-] for chambers in same station and ring",id_outer,800,-400.,400.,
"TimeMonitoring");
2733 if( !useDigis )
return;
2736 vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->getRecords();
2737 vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
2738 int L1GMT_BXN = -100;
2739 bool has_CSCTrigger =
false;
2740 bool has_beamHaloTrigger =
false;
2741 for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
2742 std::vector<L1MuRegionalCand>::const_iterator iter1;
2743 std::vector<L1MuRegionalCand> rmc;
2746 rmc = igmtrr->getCSCCands();
2747 for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
2748 if ( !(*iter1).empty() ) {
2750 int kQuality = (*iter1).quality();
2751 if (kQuality == 1) has_beamHaloTrigger =
true;
2754 if (igmtrr->getBxInEvent() == 0 && icsc>0){
2756 L1GMT_BXN = igmtrr->getBxNr();
2757 has_CSCTrigger =
true;
2759 else if (igmtrr->getBxInEvent() == 0 ) {
2761 L1GMT_BXN = igmtrr->getBxNr();
2770 map<CSCDetId, int > ALCT_KeyWG_map;
2773 const CSCDetId& idALCT = (*j).first;
2776 if((*digiIt).isValid()){
2778 histos->fill1DHist( (*digiIt).getBX(),
"ALCT_getBX",
"ALCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2779 histos->fill1DHist( (*digiIt).getFullBX(),
"ALCT_getFullBX",
"ALCT.getFullBX()",3601,-0.5,3600.5,
"TimeMonitoring");
2781 if (ALCT_KeyWG_map.find(idALCT.
chamberId()) == ALCT_KeyWG_map.end()){
2782 ALCT_KeyWG_map[idALCT.
chamberId()] = (*digiIt).getKeyWG();
2794 map<CSCDetId, int > CLCT_getFullBx_map;
2797 const CSCDetId& idCLCT = (*j).first;
2800 if((*digiIt).isValid()){
2802 histos->fill1DHist( (*digiIt).getBX(),
"CLCT_getBX",
"CLCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2803 histos->fill1DHist( (*digiIt).getFullBX(),
"CLCT_getFullBX",
"CLCT.getFullBX()",3601,-0.5,3600.5,
"TimeMonitoring");
2805 if (CLCT_getFullBx_map.find(idCLCT.
chamberId()) == CLCT_getFullBx_map.end()){
2806 CLCT_getFullBx_map[idCLCT.
chamberId()] = (*digiIt).getFullBX();
2816 int n_correlatedlcts = 0;
2820 if((*digiIt).isValid()){
2822 histos->fill1DHist( (*digiIt).getBX(),
"CorrelatedLCTS_getBX",
"CorrelatedLCT.getBX()",11,-0.5,10.5,
"TimeMonitoring");
2828 int nRecHits = recHits->size();
2829 int nSegments = cscSegments->size();
2830 if (has_CSCTrigger){
2831 histos->fill1DHist(L1GMT_BXN,
"BX_L1CSCCand",
"BX of L1 CSC Cand",4001,-0.5,4000.5,
"TimeMonitoring");
2832 histos->fill2DHist(L1GMT_BXN,n_alcts,
"n_ALCTs_v_BX_L1CSCCand",
"Number of ALCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2833 histos->fill2DHist(L1GMT_BXN,n_clcts,
"n_CLCTs_v_BX_L1CSCCand",
"Number of CLCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2834 histos->fill2DHist(L1GMT_BXN,n_correlatedlcts,
"n_CorrelatedLCTs_v_BX_L1CSCCand",
"Number of CorrelatedLCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2835 histos->fill2DHist(L1GMT_BXN,nRecHits,
"n_RecHits_v_BX_L1CSCCand",
"Number of RecHits vs. BX of L1 CSC Cand",4001,-0.5,4000.5,101,-0.5,100.5,
"TimeMonitoring");
2836 histos->fill2DHist(L1GMT_BXN,nSegments,
"n_Segments_v_BX_L1CSCCand",
"Number of Segments vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2838 if (has_CSCTrigger && has_beamHaloTrigger){
2839 histos->fill1DHist(L1GMT_BXN,
"BX_L1CSCCand_w_beamHalo",
"BX of L1 CSC (w beamHalo bit)",4001,-0.5,4000.5,
"TimeMonitoring");
2840 histos->fill2DHist(L1GMT_BXN,n_alcts,
"n_ALCTs_v_BX_L1CSCCand_w_beamHalo",
"Number of ALCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2841 histos->fill2DHist(L1GMT_BXN,n_clcts,
"n_CLCTs_v_BX_L1CSCCand_w_beamHalo",
"Number of CLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2842 histos->fill2DHist(L1GMT_BXN,n_correlatedlcts,
"n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo",
"Number of CorrelatedLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2843 histos->fill2DHist(L1GMT_BXN,nRecHits,
"n_RecHits_v_BX_L1CSCCand_w_beamHalo",
"Number of RecHits vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,101,-0.5,100.5,
"TimeMonitoring");
2844 histos->fill2DHist(L1GMT_BXN,nSegments,
"n_Segments_v_BX_L1CSCCand_w_beamHalo",
"Number of Segments vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,
"TimeMonitoring");
2859 event.getByLabel(
"source", rawdata);
2860 bool goodEvent =
false;
2864 unsigned long dccBinCheckMask = 0x06080016;
2865 unsigned int examinerMask = 0x1FEBF3F6;
2866 unsigned int errorMask = 0x0;
2874 const FEDRawData& fedData = rawdata->FEDData(
id);
2875 unsigned long length = fedData.
size();
2879 std::stringstream examiner_out, examiner_err;
2886 if( examinerMask&0x40000 ) examiner->
crcCFEB(1);
2887 if( examinerMask&0x8000 ) examiner->
crcTMB (1);
2888 if( examinerMask&0x0400 ) examiner->
crcALCT(1);
2891 examiner->
setMask(examinerMask);
2892 const short unsigned int *
data = (
short unsigned int *)fedData.
data();
2894 if( examiner->
check(data,
long(fedData.
size()/2)) < 0 ) {
2898 goodEvent=!(examiner->
errors()&dccBinCheckMask);
2907 const std::vector<CSCDDUEventData> & dduData = dccData.
dduData();
2912 for (
unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) {
2915 if (dduData[iDDU].trailer().errorstat()&errorMask) {
2916 LogTrace(
"CSCDCCUnpacker|CSCRawToDigi") <<
"DDU# " << iDDU <<
" has serious error - no digis unpacked! " <<
2917 std::hex << dduData[iDDU].trailer().errorstat();
2922 const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
2923 for (
unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) {
2925 int vmecrate = cscData[iCSC].dmbHeader()->crateID();
2926 int dmb = cscData[iCSC].dmbHeader()->dmbID();
2934 if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6)) {
2935 layer = pcrate->
detId(vmecrate, dmb,icfeb,ilayer );
2938 LogTrace (
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") <<
" detID input out of range!!! ";
2939 LogTrace (
"CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
2940 <<
" skipping chamber vme= " << vmecrate <<
" dmb= " << dmb;
2945 int nalct = cscData[iCSC].dmbHeader()->nalct();
2946 bool goodALCT=
false;
2948 if (nalct&&cscData[iCSC].alctHeader()) {
2949 if (cscData[iCSC].alctHeader()->
check()){
2955 int nclct = cscData[iCSC].dmbHeader()->nclct();
2957 if (nclct&&cscData[iCSC].tmbData()) {
2958 if (cscData[iCSC].tmbHeader()->
check()){
2959 if (cscData[iCSC].clctData()->
check()) goodTMB=
true;
2963 if (goodTMB && goodALCT) {
2965 if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
2969 if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
2973 int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
2974 int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
2978 const CSCTMBHeader *tmbHead = cscData[iCSC].tmbHeader();
2980 histos->fill1DHistByStation(tmbHead->
BXNCount(),
"TMB_BXNCount" ,
"TMB_BXNCount" , layer.
chamberId(),3601,-0.5,3600.5,
"TimeMonitoring");
2981 histos->fill1DHistByStation(tmbHead->
ALCTMatchTime(),
"TMB_ALCTMatchTime",
"TMB_ALCTMatchTime", layer.
chamberId(),7,-0.5,6.5,
"TimeMonitoring");
2983 histos->fill1DHist(tmbHead->
BXNCount(),
"TMB_BXNCount" ,
"TMB_BXNCount" , 3601,-0.5,3600.5,
"TimeMonitoring");
2984 histos->fill1DHist(tmbHead->
ALCTMatchTime(),
"TMB_ALCTMatchTime",
"TMB_ALCTMatchTime", 7,-0.5,6.5,
"TimeMonitoring");
2986 histos->fill1DHistByType(tmbHead->
ALCTMatchTime(),
"TMB_ALCTMatchTime",
"TMB_ALCTMatchTime",layer.
chamberId(), 7,-0.5,6.5,
"TimeMonitoring");
2988 histos->fillProfile( chamberSerial(layer.
chamberId()),tmbHead->
ALCTMatchTime(),
"prof_TMB_ALCTMatchTime",
"prof_TMB_ALCTMatchTime", 601,-0.5,600.5,-0.5,7.5,
"TimeMonitoring");
2989 histos->fillProfile(ALCT0Key,tmbHead->
ALCTMatchTime(),
"prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",
"prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",128,-0.5,127.5,0,7,
"TimeMonitoring");
2990 histos->fillProfileByType(ALCT0Key,tmbHead->
ALCTMatchTime(),
"prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",
"prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",layer.
chamberId(),128,-0.5,127.5,0,7,
"TimeMonitoring");
2995 if (TMB_ALCT_rel_L1A > 3563)
2996 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
2997 if (TMB_ALCT_rel_L1A < 0)
2998 TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
3001 histos->fill1DHist(TMB_ALCT_rel_L1A,
"h1D_TMB_ALCT_rel_L1A",
"h1D_TMB_ALCT_rel_L1A",11,144.5,155.5,
"TimeMonitoring");
3002 histos->fill2DHist( chamberSerial(layer.
chamberId()),TMB_ALCT_rel_L1A,
"h2D_TMB_ALCT_rel_L1A",
"h2D_TMB_ALCT_rel_L1A", 601,-0.5,600.5,11,144.5,155.5,
"TimeMonitoring");
3003 histos->fill2DHist( ringSerial(layer.
chamberId()),TMB_ALCT_rel_L1A,
"h2D_TMB_ALCT_rel_L1A_by_ring",
"h2D_TMB_ALCT_rel_L1A_by_ring",19,-9.5,9.5,11,144.5,155.5,
"TimeMonitoring");
3004 histos->fillProfile( chamberSerial(layer.
chamberId()),TMB_ALCT_rel_L1A,
"prof_TMB_ALCT_rel_L1A",
"prof_TMB_ALCT_rel_L1A", 601,-0.5,600.5,145,155,
"TimeMonitoring");
3005 histos->fillProfile( ringSerial(layer.
chamberId()),TMB_ALCT_rel_L1A,
"prof_TMB_ALCT_rel_L1A_by_ring",
"prof_TMB_ALCT_rel_L1A_by_ring",19,-9.5,9.5,145,155,
"TimeMonitoring");
3007 histos->fill2DHist (ALCT0Key,TMB_ALCT_rel_L1A,
"h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
"h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG", 128,-0.5,127.5,11,144.5,155.5,
"TimeMonitoring");
3008 histos->fillProfile(ALCT0Key,TMB_ALCT_rel_L1A,
"prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
"prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",128,-0.5,127.5,145,155,
"TimeMonitoring");
3009 histos->fillProfileByType(ALCT0Key,TMB_ALCT_rel_L1A,
"prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",
"prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",layer.
chamberId(),128,-0.5,127.5,145,155,
"TimeMonitoring");
3015 if (examiner!=
NULL)
delete examiner;
3024 std::cout<<
"Events in "<<nEventsAnalyzed<<std::endl;
float getthisSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
T getParameter(std::string const &) const
void crcCFEB(bool enable)
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
Perform the analysis.
virtual const std::array< const float, 4 > parameters() const
CSCDetId id() const
Get the (concrete) DetId.
#define DEFINE_FWK_MODULE(type)
static const double slope[3]
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
const std::vector< CSCDDUEventData > & dduData() const
accessor to dduData
Geom::Theta< T > theta() const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
void doNoiseHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
void redirect(std::ostream &str)
ExaminerStatusType errors(void) const
void crcALCT(bool enable)
void doRecHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::ESHandle< CSCGeometry > cscGeom)
void doEfficiencies(edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
size_t size() const
Lenght of the data buffer in bytes.
bool withinSensitiveRegion(LocalPoint localPos, const std::array< const float, 4 > &layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)
bool doTrigger(edm::Handle< L1MuGMTReadoutCollection > pCollection)
Geom::Theta< T > theta() const
std::string chamberTypeName() const
C::const_iterator const_iterator
constant access iterator type
void doCompTiming(const CSCComparatorDigiCollection &)
void doPedestalNoise(edm::Handle< CSCStripDigiCollection > strips)
int dbIndex(const CSCDetId &id, int &channel)
const CSCChamberSpecs * specs() const
void doStripDigis(edm::Handle< CSCStripDigiCollection > strips)
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
int getWidth(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
void histoEfficiency(TH1F *readHisto, TH1F *writeHisto)
int ringSerial(CSCDetId id)
CSCDetId chamberId() const
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
bool filterEvents(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::Handle< reco::TrackCollection > saMuons)
bool doHLT(edm::Handle< edm::TriggerResults > hltResults)
float ChiSquaredProbability(double chiSquared, double nrDOF)
float fitX(CLHEP::HepMatrix sp, CLHEP::HepMatrix ep)
static const std::string kLayer("layer")
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void doSimHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< edm::PSimHitContainer > simHits)
void doGasGain(const CSCWireDigiCollection &, const CSCStripDigiCollection &, const CSCRecHit2DCollection &)
void getEfficiency(float bin, float Norm, std::vector< float > &eff)
void doResolution(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
void findNonAssociatedRecHits(edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
T const * product() const
std::vector< DigiType >::const_iterator const_iterator
int32_t check(const uint16_t *&buffer, int32_t length)
void doAFEBTiming(const CSCWireDigiCollection &)
void doTimeMonitoring(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::Handle< CSCALCTDigiCollection > alcts, edm::Handle< CSCCLCTDigiCollection > clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > correlatedlcts, edm::Handle< L1MuGMTReadoutCollection > pCollection, edm::ESHandle< CSCGeometry > cscGeom, const edm::EventSetup &eventSetup, const edm::Event &event)
float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
PedestalContainer pedestals
char data[epos_bytes_allocation]
void doStandalone(edm::Handle< reco::TrackCollection > saMuons)
int chamberSerial(CSCDetId id)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void doWireDigis(edm::Handle< CSCWireDigiCollection > wires)
std::pair< const_iterator, const_iterator > Range
void doADCTiming(const CSCRecHit2DCollection &)
CrosstalkContainer crosstalk
NoiseMatrixContainer matrix
CSCValidation(const edm::ParameterSet &pset)
Constructor.
void doSegments(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
void doOccupancies(edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments)
const CSCLayerGeometry * geometry() const
void setMask(ExaminerMaskType mask)
virtual ~CSCValidation()
Destructor.
Power< A, B >::type pow(const A &a, const B &b)
void doCalibrations(const edm::EventSetup &eventSetup)