30 printalot = (nEventsAnalyzed <
int(printout_NEvents));
33 if (0 == fmod(
double(nEventsAnalyzed),
double(1000))) {
35 printf(
"\n==enter==CSCEfficiency===== run %u\tevent %llu\tn Analyzed %i\n", iRun,
iEvent, nEventsAnalyzed);
38 theService->update(eventSetup);
42 printf(
"\tget handles for digi collections\n");
48 printf(
"\tpass handles\n");
60 event.getByToken(wd_token,
wires);
61 event.getByToken(sd_token,
strips);
62 event.getByToken(al_token, alcts);
63 event.getByToken(cl_token, clcts);
64 event.getByToken(co_token, correlatedlcts);
67 event.getByToken(sh_token,
simhits);
69 event.getByToken(rh_token,
rechits);
70 event.getByToken(se_token, segments);
71 event.getByToken(tk_token, trackCollectionH);
76 printf(
"\tget the CSC geometry.\n");
83 bool triggerPassed =
true;
89 event.getByToken(ht_token, hltR);
98 if (theService->magneticField()->inTesla(gpZero).mag2() < 0.1) {
109 event.getByLabel(muonTag_,
muons);
112 event.getByLabel(
"offlineBeamSpot", beamSpotHandle);
115 std::vector<reco::MuonCollection::const_iterator> goodMuons_it;
116 unsigned int nPositiveZ = 0;
117 unsigned int nNegativeZ = 0;
118 float muonOuterZPosition = -99999.;
126 <<
" pt = " <<
muon->pt() <<
" eta = " <<
muon->eta() <<
" phi = " <<
muon->phi()
127 <<
" matches = " <<
muon->matches().size()
129 <<
" GLB/TR/STA = " <<
muon->isGlobalMuon() <<
"/" <<
muon->isTrackerMuon() <<
"/"
130 <<
muon->isStandAloneMuon() << std::endl;
132 if (!(
muon->isTrackerMuon() &&
muon->isGlobalMuon())) {
137 (
muon->isolationR03().sumPt +
muon->isolationR03().emEt +
muon->isolationR03().hadEt) /
muon->track()->pt();
139 std::cout <<
" relISO = " << relISO <<
" emVetoEt = " <<
muon->isolationR03().emVetoEt
141 <<
" dxy = " << fabs(
muon->track()->dxy(vertexBeamSpot.
position())) << std::endl;
145 fabs(
muon->track()->dxy(vertexBeamSpot.
position())) > 0.2 ||
muon->pt() < 6.) {
149 if (
muon->track()->hitPattern().numberOfValidPixelHits() < 1 ||
150 muon->track()->hitPattern().numberOfValidTrackerHits() < 11 ||
151 muon->combinedMuon()->hitPattern().numberOfValidMuonHits() < 1 ||
152 muon->combinedMuon()->normalizedChi2() > 10. ||
muon->numberOfMatches() < 2) {
156 float zOuter =
muon->combinedMuon()->outerPosition().z();
157 float rhoOuter =
muon->combinedMuon()->outerPosition().rho();
158 bool passDepth =
true;
161 if (fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 540.) {
166 else if (fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.) {
171 else if (fabs(zOuter) > 680. && fabs(zOuter) < 880. && rhoOuter < 540.) {
178 goodMuons_it.push_back(
muon);
179 if (
muon->track()->momentum().z() > 0.) {
182 if (
muon->track()->momentum().z() < 0.) {
198 std::cout <<
" nNegativeZ = " << nNegativeZ <<
" nPositiveZ = " << nPositiveZ << std::endl;
200 if (nNegativeZ > 1 || nPositiveZ > 1) {
203 bool trackOK =
false;
205 std::cout <<
" goodMuons_it.size() = " << goodMuons_it.size() << std::endl;
207 for (
size_t iM = 0; iM < goodMuons_it.size(); ++iM) {
211 float deltaR =
pow(
track->phi() - goodMuons_it[iM]->track()->phi(), 2) +
212 pow(
track->eta() - goodMuons_it[iM]->track()->eta(), 2);
216 <<
" dPt = " <<
track->pt() - goodMuons_it[iM]->track()->pt() << std::endl;
218 if (
deltaR > 0.01 || fabs(
track->pt() - goodMuons_it[iM]->track()->pt()) > 0.1) {
225 muonOuterZPosition = goodMuons_it[iM]->combinedMuon()->outerPosition().z();
232 std::cout <<
" failed: trackOK " << std::endl;
252 std::cout <<
"i track = " <<
i <<
" P = " <<
track->p() <<
" chi2/ndf = " <<
track->normalizedChi2()
253 <<
" nSeg = " << segments->size() << std::endl;
260 <<
track->qoverpError() << std::endl;
263 <<
" outer position = " <<
track->outerPosition() << std::endl;
264 std::cout <<
"track eta (outer) = " <<
track->outerPosition().eta()
265 <<
" phi (outer) = " <<
track->outerPosition().phi() << std::endl;
266 if (fabs(
track->innerPosition().z()) > 500.) {
268 std::cout <<
" dump inner state MUON detid = " <<
debug.dumpMuonId(innerDetId) << std::endl;
270 if (fabs(
track->outerPosition().z()) > 500.) {
272 std::cout <<
" dump outer state MUON detid = " <<
debug.dumpMuonId(outerDetId) << std::endl;
288 float dpT_ov_pT = 0.;
289 if (fabs(
track->pt()) > 0.001) {
301 if (!segments->size()) {
309 if (magField && (dpT_ov_pT > 0.5)) {
317 CLHEP::Hep3Vector r3T_inner(
track->innerPosition().x(),
track->innerPosition().y(),
track->innerPosition().z());
318 CLHEP::Hep3Vector r3T(
track->outerPosition().x(),
track->outerPosition().y(),
track->outerPosition().z());
319 chooseDirection(r3T_inner, r3T);
321 CLHEP::Hep3Vector p3T(
track->outerMomentum().x(),
track->outerMomentum().y(),
track->outerMomentum().z());
322 CLHEP::Hep3Vector p3_propagated, r3_propagated;
325 cov_propagated *= 1
e-20;
329 std::cout <<
" p = " <<
track->p() <<
" norm chi2 = " <<
track->normalizedChi2() << std::endl;
330 std::cout <<
" dump the very first FTS = " <<
debug.dumpFTS(ftsStart) << std::endl;
335 if (
track->outerPosition().z() > 0) {
342 std::vector<CSCDetId> refME;
343 for (
int iS = 1; iS < 5; ++iS) {
344 for (
int iR = 1; iR < 4; ++iR) {
345 if (1 != iS && iR > 2) {
347 }
else if (4 == iS && iR > 1) {
354 for (
size_t iSt = 0; iSt < refME.size(); ++iSt) {
356 std::cout <<
"loop iStatation = " << iSt << std::endl;
357 std::cout <<
"refME[iSt]: st = " << refME[iSt].station() <<
" rg = " << refME[iSt].ring() << std::endl;
359 std::map<std::string, bool> chamberTypes;
360 chamberTypes[
"ME11"] =
false;
361 chamberTypes[
"ME12"] =
false;
362 chamberTypes[
"ME13"] =
false;
363 chamberTypes[
"ME21"] =
false;
364 chamberTypes[
"ME22"] =
false;
365 chamberTypes[
"ME31"] =
false;
366 chamberTypes[
"ME32"] =
false;
367 chamberTypes[
"ME41"] =
false;
374 std::cout <<
" dump base iStation detid = " <<
debug.dumpMuonId(detId) << std::endl;
375 std::cout <<
" dump FTS start = " <<
debug.dumpFTS(ftsStart) << std::endl;
378 tSOSDest = propagate(ftsStart, cscGeom->
idToDet(detId)->
surface());
382 std::cout <<
" dump FTS end = " <<
debug.dumpFTS(ftsStart) << std::endl;
383 getFromFTS(ftsStart, p3_propagated, r3_propagated,
charge, cov_propagated);
384 float feta = fabs(r3_propagated.eta());
385 float phi = r3_propagated.phi();
387 ringCandidates(refME[iSt].
station(),
feta, chamberTypes);
389 map<std::string, bool>::iterator iter;
392 for (iter = chamberTypes.begin(); iter != chamberTypes.end(); iter++) {
395 if (iter->second && (iterations - 1) ==
int(iSt)) {
397 std::cout <<
" Chamber type " << iter->first <<
" is a candidate..." << std::endl;
398 std::cout <<
" station() = " << refME[iSt].station() <<
" ring() = " << refME[iSt].ring()
399 <<
" iSt = " << iSt << std::endl;
401 std::vector<int> coupleOfChambers;
403 chamberCandidates(refME[iSt].
station(), refME[iSt].
ring(), phi, coupleOfChambers);
405 for (
size_t iCh = 0; iCh < coupleOfChambers.size(); ++iCh) {
408 std::cout <<
" Check chamber N = " << coupleOfChambers.at(iCh) << std::endl;
410 if ((!getAbsoluteEfficiency) &&
411 (
true == emptyChambers[refME[iSt].
endcap() - 1][refME[iSt].
station() - 1][refME[iSt].
ring() - 1]
412 [coupleOfChambers.at(iCh) -
FirstCh])) {
417 const BoundPlane bpCh = cscGeom->
idToDet(cscChamber->geographicalId())->surface();
419 float dz = fabs(bpCh.position().z() - zFTS);
420 float zDistInner =
track->innerPosition().z() - bpCh.position().z();
421 float zDistOuter =
track->outerPosition().z() - bpCh.position().z();
424 std::cout <<
" zIn = " <<
track->innerPosition().z() <<
" zOut = " <<
track->outerPosition().z()
425 <<
" zSurf = " << bpCh.position().z() << std::endl;
427 if (!isIPdata && (zDistInner * zDistOuter > 0. || fabs(zDistInner) < 15. ||
428 fabs(zDistOuter) < 15.)) {
430 std::cout <<
" Not an intermediate (as defined) point... Skip." << std::endl;
434 if (isIPdata && fabs(
track->eta()) < 1.8) {
435 if (fabs(muonOuterZPosition) - fabs(bpCh.position().z()) < 0 ||
436 fabs(muonOuterZPosition - bpCh.position().z()) < 15.) {
444 tSOSDest = propagate(ftsStart, cscGeom->
idToDet(cscChamber->geographicalId())->surface());
449 std::cout <<
"TSOS not valid! Break." << std::endl;
454 std::cout <<
" info: dz<0.1" << std::endl;
458 bool inDeadZone =
false;
460 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
461 bool extrapolationPassed =
true;
463 std::cout <<
" iLayer = " << iLayer <<
" dump FTS init = " <<
debug.dumpFTS(ftsInit) << std::endl;
464 std::cout <<
" dump detid = " <<
debug.dumpMuonId(cscChamber->geographicalId()) << std::endl;
465 std::cout <<
"Surface to propagate to: pos = " << cscChamber->layer(iLayer + 1)->surface().position()
466 <<
" eta = " << cscChamber->layer(iLayer + 1)->surface().position().eta()
467 <<
" phi = " << cscChamber->layer(iLayer + 1)->surface().position().phi() << std::endl;
470 tSOSDest = propagate(ftsInit, cscChamber->layer(iLayer + 1)->surface());
474 std::cout <<
" Propagation between layers successful: dump FTS end = " <<
debug.dumpFTS(ftsInit)
476 getFromFTS(ftsInit, p3_propagated, r3_propagated,
charge, cov_propagated);
479 std::cout <<
"Propagation between layers not successful - notValid TSOS" << std::endl;
480 extrapolationPassed =
false;
485 if (extrapolationPassed) {
486 GlobalPoint theExtrapolationPoint(r3_propagated.x(), r3_propagated.y(), r3_propagated.z());
487 LocalPoint theLocalPoint = cscChamber->layer(iLayer + 1)->toLocal(theExtrapolationPoint);
489 inDeadZone = (inDeadZone ||
490 !inSensitiveLocalRegion(
491 theLocalPoint.x(), theLocalPoint.y(), refME[iSt].station(), refME[iSt].ring()));
493 std::cout <<
" Candidate chamber: extrapolated LocalPoint = " << theLocalPoint
494 <<
"inDeadZone = " << inDeadZone << std::endl;
509 std::cout <<
"Do efficiencies..." << std::endl;
512 bool angle_flag =
true;
513 angle_flag = efficienciesPerChamber(theCSCId, cscChamber, ftsStart);
514 if (useDigis && angle_flag) {
515 stripWire_Efficiencies(theCSCId, ftsStart);
518 recHitSegment_Efficiencies(theCSCId, cscChamber, ftsStart);
520 recSimHitEfficiency(theCSCId, ftsStart);
525 std::cout <<
" Not in active area for all layers" << std::endl;
535 std::cout <<
" TSOS not valid..." << std::endl;
541 printf(
"==exit===CSCEfficiency===== run %u\tevent %llu\n\n", iRun,
iEvent);
549 std::vector<double> chamberBounds(3);
550 float y_center = 99999.;
554 chamberBounds[0] = 66.46 / 2;
555 chamberBounds[1] = 127.15 / 2;
556 chamberBounds[2] = 323.06 / 2;
560 chamberBounds[0] = 54.00 / 2;
561 chamberBounds[1] = 125.71 / 2;
562 chamberBounds[2] = 189.66 / 2;
565 chamberBounds[0] = 61.40 / 2;
566 chamberBounds[1] = 125.71 / 2;
567 chamberBounds[2] = 169.70 / 2;
570 chamberBounds[0] = 69.01 / 2;
571 chamberBounds[1] = 125.65 / 2;
572 chamberBounds[2] = 149.42 / 2;
578 chamberBounds[0] = 63.40 / 2;
579 chamberBounds[1] = 92.10 / 2;
580 chamberBounds[2] = 164.16 / 2;
582 }
else if (2 ==
ring) {
583 chamberBounds[0] = 51.00 / 2;
584 chamberBounds[1] = 83.74 / 2;
585 chamberBounds[2] = 174.49 / 2;
588 chamberBounds[0] = 30. / 2;
589 chamberBounds[1] = 60. / 2;
590 chamberBounds[2] = 160. / 2;
594 double yUp = chamberBounds[2] + y_center;
595 double yDown = -chamberBounds[2] + y_center;
596 double xBound1Shifted = chamberBounds[0] - distanceFromDeadZone;
597 double xBound2Shifted = chamberBounds[1] - distanceFromDeadZone;
598 double lineSlope = (yUp - yDown) / (xBound2Shifted - xBound1Shifted);
599 double lineConst = yUp - lineSlope * xBound2Shifted;
600 double yBoundary = lineSlope *
abs(xLocal) + lineConst;
601 pass = checkLocal(yLocal, yBoundary,
station,
ring);
608 std::vector<float> deadZoneCenter(6);
609 const float deadZoneHalf = 0.32 * 7 / 2;
610 float cutZone = deadZoneHalf + distanceFromDeadZone;
614 deadZoneCenter[0] = -162.48;
615 deadZoneCenter[1] = -81.8744;
616 deadZoneCenter[2] = -21.18165;
617 deadZoneCenter[3] = 39.51105;
618 deadZoneCenter[4] = 100.2939;
619 deadZoneCenter[5] = 160.58;
621 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
622 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
623 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone) ||
624 (yLocal > deadZoneCenter[3] + cutZone && yLocal < deadZoneCenter[4] - cutZone) ||
625 (yLocal > deadZoneCenter[4] + cutZone && yLocal < deadZoneCenter[5] - cutZone))) {
628 }
else if (1 ==
ring) {
630 deadZoneCenter[0] = -95.94;
631 deadZoneCenter[1] = -27.47;
632 deadZoneCenter[2] = 33.67;
633 deadZoneCenter[3] = 93.72;
635 deadZoneCenter[0] = -85.97;
636 deadZoneCenter[1] = -36.21;
637 deadZoneCenter[2] = 23.68;
638 deadZoneCenter[3] = 84.04;
640 deadZoneCenter[0] = -75.82;
641 deadZoneCenter[1] = -26.14;
642 deadZoneCenter[2] = 23.85;
643 deadZoneCenter[3] = 73.91;
645 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
646 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
647 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
653 deadZoneCenter[0] = -83.155;
654 deadZoneCenter[1] = -22.7401;
655 deadZoneCenter[2] = 27.86665;
656 deadZoneCenter[3] = 81.005;
657 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
658 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
659 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
662 }
else if (2 ==
ring) {
663 deadZoneCenter[0] = -86.285;
664 deadZoneCenter[1] = -32.88305;
665 deadZoneCenter[2] = 32.867423;
666 deadZoneCenter[3] = 88.205;
667 if (yLocal > (yBoundary) && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
668 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
669 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
673 deadZoneCenter[0] = -81.0;
674 deadZoneCenter[1] = 81.0;
675 if (yLocal > (yBoundary) && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone))) {
692 for (
int iE = 0; iE < 2; iE++) {
693 for (
int iS = 0; iS < 4; iS++) {
694 for (
int iR = 0; iR < 4; iR++) {
695 for (
int iC = 0; iC <
NumCh; iC++) {
696 allSegments[iE][iS][iR][iC].clear();
697 allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] =
false;
698 for (
int iL = 0; iL < 6; iL++) {
699 allStrips[iE][iS][iR][iC][iL].clear();
700 allWG[iE][iS][iR][iC][iL].clear();
701 allRechits[iE][iS][iR][iC][iL].clear();
702 allSimhits[iE][iS][iR][iC][iL].clear();
710 fillLCT_info(alcts, clcts, correlatedlcts);
711 fillWG_info(
wires, cscGeom);
714 fillRechitsSegments_info(
rechits, segments, cscGeom);
731 if ((*digiIt).isValid()) {
732 allALCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
736 ALCTPerEvent->Fill(nSize);
742 std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
743 std::vector<CSCCLCTDigi>::const_iterator
last = (*j).second.second;
744 for (; digiIt !=
last; ++digiIt) {
746 if ((*digiIt).isValid()) {
747 allCLCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
751 CLCTPerEvent->Fill(nSize);
755 std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
756 std::vector<CSCCorrelatedLCTDigi>::const_iterator
last = (*j).second.second;
757 for (; digiIt !=
last; ++digiIt) {
759 if ((*digiIt).isValid()) {
760 allCorrLCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
773 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
774 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
776 for (; digiItr !=
last; ++digiItr) {
777 std::pair<int, float> WG_pos(digiItr->getWireGroup(), layerGeom->
yOfWireGroup(digiItr->getWireGroup()));
778 std::pair<std::pair<int, float>,
int> LayerSignal(WG_pos, digiItr->getTimeBin());
781 allWG[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][
id.layer() - 1].push_back(
796 int largestADCValue = -1;
797 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
798 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
799 for (; digiItr !=
last; ++digiItr) {
800 int maxADC = largestADCValue;
801 int myStrip = digiItr->getStrip();
802 std::vector<int> myADCVals = digiItr->getADCCounts();
803 float thisPedestal = 0.5 * (
float)(myADCVals[0] + myADCVals[1]);
806 float peakADC = -1000.;
807 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
808 diff = (
float)myADCVals[iCount] - thisPedestal;
810 if (myADCVals[iCount] > largestADCValue) {
811 largestADCValue = myADCVals[iCount];
818 if (largestADCValue > maxADC) {
819 maxADC = largestADCValue;
820 std::pair<int, float> LayerSignal(myStrip, peakADC);
824 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].clear();
825 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].push_back(
833 edm::PSimHitContainer::const_iterator dSHsimIter;
834 for (dSHsimIter =
simhits->begin(); dSHsimIter !=
simhits->end(); dSHsimIter++) {
837 std::pair<LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
850 printf(
" The size of the rechit collection is %i\n",
int(
rechits->size()));
853 recHitsPerEvent->Fill(
rechits->size());
856 for (recIt =
rechits->begin(); recIt !=
rechits->end(); recIt++) {
861 LocalPoint rhitlocal = (*recIt).localPosition();
862 LocalError rerrlocal = (*recIt).localPositionError();
864 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
870 printf(
"\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
881 std::pair<LocalPoint, bool> recHitPos((*recIt).localPosition(),
false);
882 allRechits[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][
id.layer() - 1].push_back(
886 for (
int iE = 0; iE < 2; iE++) {
887 for (
int iS = 0; iS < 4; iS++) {
888 for (
int iR = 0; iR < 4; iR++) {
889 for (
int iC = 0; iC <
NumCh; iC++) {
891 for (
int iL = 0; iL < 6; iL++) {
892 if (!allRechits[iE][iS][iR][iC][iL].
empty()) {
897 emptyChambers[iE][iS][iR][iC] =
false;
899 emptyChambers[iE][iS][iR][iC] =
true;
908 printf(
" The size of the segment collection is %i\n",
int(segments->size()));
911 segmentsPerEvent->Fill(segments->size());
914 StHist[
id.endcap() - 1][
id.station() - 1].segmentChi2_ndf->Fill((*it).chi2() / (*it).degreesOfFreedom());
915 StHist[
id.endcap() - 1][
id.station() - 1].hitsInSegment->Fill((*it).nRecHits());
918 std::cout <<
"\tposition(loc) = " << (*it).localPosition() <<
" error(loc) = " << (*it).localPositionError()
920 std::cout <<
"\t chi2/ndf = " << (*it).chi2() / (*it).degreesOfFreedom() <<
" nhits = " << (*it).nRecHits()
923 allSegments[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh].push_back(
924 make_pair((*it).localPosition(), (*it).localDirection()));
928 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
929 int nRH = (*it).nRecHits();
931 printf(
"\tGet the recHits for this segment.\t");
932 printf(
" nRH = %i\n", nRH);
936 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
940 printf(
"\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
953 float xDiff = iRH->localPosition().x() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
956 float yDiff = iRH->localPosition().y() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
959 if (fabs(xDiff) < 0.0001 && fabs(yDiff) < 0.0001) {
960 std::pair<LocalPoint, bool> recHitPos(allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
967 std::cout <<
" number of the rechit (from zero) in the segment = " << jRH << std::endl;
981 chamberTypes[
"ME13"] =
true;
984 chamberTypes[
"ME12"] =
true;
987 chamberTypes[
"ME11"] =
true;
992 chamberTypes[
"ME22"] =
true;
995 chamberTypes[
"ME21"] =
true;
1000 chamberTypes[
"ME32"] =
true;
1003 chamberTypes[
"ME31"] =
true;
1008 chamberTypes[
"ME41"] =
true;
1017 coupleOfChambers.clear();
1019 float phi_zero = 0.;
1020 float phi_const = 2. *
M_PI / 36.;
1021 int last_chamber = 36;
1022 int first_chamber = 1;
1029 std::cout <<
" info: negative phi = " << phi << std::endl;
1032 float chamber_float = (phi - phi_zero) / phi_const;
1033 int chamber_int =
int(chamber_float);
1034 if (chamber_float -
float(chamber_int) - 0.5 < 0.) {
1035 if (0 != chamber_int) {
1036 coupleOfChambers.push_back(chamber_int);
1038 coupleOfChambers.push_back(last_chamber);
1040 coupleOfChambers.push_back(chamber_int + 1);
1043 coupleOfChambers.push_back(chamber_int + 1);
1044 if (last_chamber != chamber_int + 1) {
1045 coupleOfChambers.push_back(chamber_int + 2);
1047 coupleOfChambers.push_back(first_chamber);
1051 std::cout <<
" phi = " << phi <<
" phi_zero = " << phi_zero <<
" phi_const = " << phi_const
1052 <<
" candidate chambers: first ch = " << coupleOfChambers[0] <<
" second ch = " << coupleOfChambers[1]
1060 int ec, st, rg, ch, secondRing;
1061 returnTypes(
id, ec, st, rg, ch, secondRing);
1066 std::cout <<
" local dir = " << localDir << std::endl;
1069 float dxdz = localDir.
x() / localDir.
z();
1070 float dydz = localDir.
y() / localDir.
z();
1071 if (2 == st || 3 == st) {
1073 std::cout <<
"st 3 or 4 ... flip dy/dz" << std::endl;
1082 if (applyIPangleCuts) {
1083 if (
dydz > local_DY_DZ_Max ||
dydz < local_DY_DZ_Min || fabs(
dxdz) > local_DX_DZ_Max) {
1089 bool firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1090 bool secondCondition =
false;
1092 if (secondRing > -1) {
1093 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1095 if (firstCondition || secondCondition) {
1097 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1101 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1107 firstCondition = allALCT[ec][st][rg][ch];
1108 secondCondition =
false;
1109 if (secondRing > -1) {
1110 secondCondition = allALCT[ec][st][secondRing][ch];
1112 if (firstCondition || secondCondition) {
1114 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1117 if (fabs(
dxdz) < local_DX_DZ_Max) {
1118 StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1119 ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(
dydz);
1123 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1125 if (fabs(
dxdz) < local_DX_DZ_Max) {
1126 StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1127 ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(
dydz);
1131 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1136 firstCondition = allCLCT[ec][st][rg][ch];
1137 secondCondition =
false;
1138 if (secondRing > -1) {
1139 secondCondition = allCLCT[ec][st][secondRing][ch];
1141 if (firstCondition || secondCondition) {
1143 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1145 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1146 StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1147 ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(
dxdz);
1151 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1153 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1154 StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1155 ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(
dxdz);
1159 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1164 firstCondition = allCorrLCT[ec][st][rg][ch];
1165 secondCondition =
false;
1166 if (secondRing > -1) {
1167 secondCondition = allCorrLCT[ec][st][secondRing][ch];
1169 if (firstCondition || secondCondition) {
1170 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1172 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1181 int ec, st, rg, ch, secondRing;
1182 returnTypes(
id, ec, st, rg, ch, secondRing);
1184 bool firstCondition, secondCondition;
1185 int missingLayers_s = 0;
1186 int missingLayers_wg = 0;
1187 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1190 printf(
"\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1198 << allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1200 << allWG[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1203 firstCondition = !allStrips[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1205 secondCondition =
false;
1206 if (secondRing > -1) {
1207 secondCondition = !allStrips[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1209 if (firstCondition || secondCondition) {
1210 ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer + 1);
1214 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1223 firstCondition = !allWG[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1224 secondCondition =
false;
1225 if (secondRing > -1) {
1226 secondCondition = !allWG[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1228 if (firstCondition || secondCondition) {
1229 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer + 1);
1233 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1243 if (6 != missingLayers_s) {
1244 ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1246 if (6 != missingLayers_wg) {
1247 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1249 ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1250 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1252 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1253 if (missingLayers_s != missingLayers_wg) {
1254 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1255 if (6 == missingLayers_wg) {
1256 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1257 ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.
momentum().
theta());
1259 if (6 == missingLayers_s) {
1260 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1261 ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.
momentum().
theta());
1263 }
else if (6 == missingLayers_s) {
1264 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1271 int ec, st, rg, ch, secondRing;
1272 returnTypes(
id, ec, st, rg, ch, secondRing);
1273 bool firstCondition, secondCondition;
1274 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1275 firstCondition = !allSimhits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1276 secondCondition =
false;
1278 if (secondRing > -1) {
1279 secondCondition = !allSimhits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1280 if (secondCondition) {
1281 thisRing = secondRing;
1284 if (firstCondition || secondCondition) {
1285 for (
size_t iSH = 0; iSH < allSimhits[ec][st][thisRing][ch][iLayer].size(); ++iSH) {
1286 if (13 == fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].
second)) {
1287 ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer + 1);
1288 if (!allRechits[ec][st][thisRing][ch][iLayer].
empty()) {
1289 ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer + 1);
1317 int ec, st, rg, ch, secondRing;
1318 returnTypes(
id, ec, st, rg, ch, secondRing);
1319 bool firstCondition, secondCondition;
1321 std::vector<bool> missingLayers_rh(6);
1322 std::vector<int> usedInSegment(6);
1325 std::cout <<
"RecHits eff" << std::endl;
1326 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1327 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1328 secondCondition =
false;
1330 if (secondRing > -1) {
1331 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1332 if (secondCondition) {
1333 thisRing = secondRing;
1336 if (firstCondition || secondCondition) {
1337 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer + 1);
1338 for (
size_t iR = 0; iR < allRechits[ec][st][thisRing][ch][iLayer].size(); ++iR) {
1339 if (allRechits[ec][st][thisRing][ch][iLayer][iR].
second) {
1340 usedInSegment[iLayer] = 1;
1343 usedInSegment[iLayer] = -1;
1347 missingLayers_rh[iLayer] =
true;
1350 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1362 firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1363 secondCondition =
false;
1366 if (secondRing > -1) {
1367 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1368 secondSize = allSegments[ec][st][secondRing][ch].size();
1369 if (secondCondition) {
1370 thisRing = secondRing;
1373 if (firstCondition || secondCondition) {
1375 std::cout <<
"segments - start ec = " << ec <<
" st = " << st <<
" rg = " << rg <<
" ch = " << ch << std::endl;
1376 StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1377 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1378 globalDir = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
second);
1379 globalPos = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
first);
1380 StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1385 std::cout <<
" fts.position() = " << ftsChamber.
position() <<
" segPos = " << globalPos <<
" res = " << residual
1387 StHist[ec][st].ResidualSegments->Fill(residual);
1389 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1391 std::cout <<
" iLayer = " << iLayer <<
" usedInSegment = " << usedInSegment[iLayer] << std::endl;
1392 if (0 != usedInSegment[iLayer]) {
1393 if (-1 == usedInSegment[iLayer]) {
1394 ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer + 1);
1396 ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer + 1);
1398 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1399 secondCondition =
false;
1400 if (secondRing > -1) {
1401 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1403 float stripAngle = 99999.;
1404 std::vector<float> posXY(2);
1405 bool oneSegment =
false;
1406 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1409 linearExtrapolation(globalPos, globalDir, bp.position().z(), posXY);
1410 GlobalPoint gp_extrapol(posXY.at(0), posXY.at(1), bp.position().z());
1412 posXY.at(0) = lp_extrapol.
x();
1413 posXY.at(1) = lp_extrapol.y();
1417 if (firstCondition || secondCondition) {
1418 ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer + 1);
1420 ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1421 ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1425 ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1426 ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1431 StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1433 std::cout <<
"missing segment " << std::endl;
1439 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1440 if (allSegments[ec][st][rg][ch].
size() + secondSize < 2) {
1441 StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1443 ChHist[ec][st][rg][
id.chamber() -
FirstCh].EfficientRechits_inSegment->Fill(9);
1449 ec =
id.endcap() - 1;
1450 st =
id.station() - 1;
1462 CLHEP::Hep3Vector &
p3,
1463 CLHEP::Hep3Vector &r3,
1469 p3.set(p3GV.
x(), p3GV.
y(), p3GV.
z());
1470 r3.set(r3GP.
x(), r3GP.
y(), r3GP.
z());
1477 const CLHEP::Hep3Vector &r3,
1493 std::vector<float> &posZY) {
1494 double paramLine = lineParameter(initialPosition.
z(), zSurface, initialDirection.
z());
1495 double xPosition = extrapolate1D(initialPosition.
x(), initialDirection.
x(), paramLine);
1496 double yPosition = extrapolate1D(initialPosition.
y(), initialDirection.
y(), paramLine);
1498 posZY.push_back(xPosition);
1499 posZY.push_back(yPosition);
1503 double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine;
1504 return extrapolatedPosition;
1508 double paramLine = (destZPosition - initZPosition) / initZDirection;
1515 float dy = outerPosition.y() - innerPosition.y();
1516 float dz = outerPosition.z() - innerPosition.z();
1567 bool triggerPassed =
true;
1568 std::vector<std::string> hlNames =
triggerNames.triggerNames();
1569 pointToTriggers.clear();
1570 for (
size_t imyT = 0; imyT < myTriggers.size(); ++imyT) {
1571 for (
size_t iT = 0; iT < hlNames.size(); ++iT) {
1578 TriggersFired->Fill(iT);
1581 if (hlNames[iT] == myTriggers[imyT]) {
1582 pointToTriggers.push_back(iT);
1589 if (pointToTriggers.size() != myTriggers.size()) {
1590 pointToTriggers.clear();
1592 std::cout <<
" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"
1596 if (!pointToTriggers.empty()) {
1598 std::cout <<
"The following triggers will be required in the event: " << std::endl;
1599 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1600 std::cout <<
" " << hlNames[pointToTriggers[imyT]];
1609 if (pointToTriggers.empty()) {
1612 <<
" No triggers specified in the configuration or all ignored - no trigger information will be considered"
1616 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1617 if (hltR->
wasrun(pointToTriggers[imyT]) && hltR->
accept(pointToTriggers[imyT]) &&
1618 !hltR->
error(pointToTriggers[imyT])) {
1619 triggerPassed =
true;
1624 triggerPassed =
false;
1626 triggerPassed =
false;
1633 std::cout <<
" TriggerResults handle returns invalid state?! No trigger information will be considered"
1638 std::cout <<
" Trigger passed: " << triggerPassed << std::endl;
1640 return triggerPassed;
1649 const float Ymin = -165;
1650 const float Ymax = 165;
1651 const int nYbins =
int((Ymax - Ymin) / 2);
1652 const float Layer_min = -0.5;
1653 const float Layer_max = 9.5;
1654 const int nLayer_bins =
int(Layer_max - Layer_min);
1658 printout_NEvents =
pset.getUntrackedParameter<
unsigned int>(
"printout_NEvents", 0);
1659 rootFileName =
pset.getUntrackedParameter<
string>(
"rootFileName",
"cscHists.root");
1661 isData =
pset.getUntrackedParameter<
bool>(
"runOnData",
true);
1662 isIPdata =
pset.getUntrackedParameter<
bool>(
"IPdata",
false);
1663 isBeamdata =
pset.getUntrackedParameter<
bool>(
"Beamdata",
false);
1664 getAbsoluteEfficiency =
pset.getUntrackedParameter<
bool>(
"getAbsoluteEfficiency",
true);
1665 useDigis =
pset.getUntrackedParameter<
bool>(
"useDigis",
true);
1666 distanceFromDeadZone =
pset.getUntrackedParameter<
double>(
"distanceFromDeadZone", 10.);
1667 minP =
pset.getUntrackedParameter<
double>(
"minP", 20.);
1668 maxP =
pset.getUntrackedParameter<
double>(
"maxP", 100.);
1670 minTrackHits =
pset.getUntrackedParameter<
unsigned int>(
"minTrackHits", 10);
1672 applyIPangleCuts =
pset.getUntrackedParameter<
bool>(
"applyIPangleCuts",
false);
1673 local_DY_DZ_Max =
pset.getUntrackedParameter<
double>(
"local_DY_DZ_Max", -0.1);
1674 local_DY_DZ_Min =
pset.getUntrackedParameter<
double>(
"local_DY_DZ_Min", -0.8);
1675 local_DX_DZ_Max =
pset.getUntrackedParameter<
double>(
"local_DX_DZ_Max", 0.2);
1677 sd_token = consumes<CSCStripDigiCollection>(
pset.getParameter<
edm::InputTag>(
"stripDigiTag"));
1678 wd_token = consumes<CSCWireDigiCollection>(
pset.getParameter<
edm::InputTag>(
"wireDigiTag"));
1679 al_token = consumes<CSCALCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"alctDigiTag"));
1680 cl_token = consumes<CSCCLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"clctDigiTag"));
1681 co_token = consumes<CSCCorrelatedLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"corrlctDigiTag"));
1682 rh_token = consumes<CSCRecHit2DCollection>(
pset.getParameter<
edm::InputTag>(
"rechitTag"));
1683 se_token = consumes<CSCSegmentCollection>(
pset.getParameter<
edm::InputTag>(
"segmentTag"));
1684 tk_token = consumes<edm::View<reco::Track> >(
pset.getParameter<
edm::InputTag>(
"tracksTag"));
1685 sh_token = consumes<edm::PSimHitContainer>(
pset.getParameter<
edm::InputTag>(
"simHitTag"));
1687 geomToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
1694 useTrigger =
pset.getUntrackedParameter<
bool>(
"useTrigger",
false);
1696 ht_token = consumes<edm::TriggerResults>(
pset.getParameter<
edm::InputTag>(
"HLTriggerResults"));
1698 myTriggers =
pset.getParameter<std::vector<std::string> >(
"myTriggers");
1699 andOr =
pset.getUntrackedParameter<
bool>(
"andOr");
1700 pointToTriggers.clear();
1703 nEventsAnalyzed = 0;
1715 sprintf(SpecName,
"DataFlow");
1716 DataFlow =
new TH1F(SpecName,
"Data flow;condition number;entries", 40, -0.5, 39.5);
1718 sprintf(SpecName,
"TriggersFired");
1719 TriggersFired =
new TH1F(SpecName,
"Triggers fired;trigger number;entries", 140, -0.5, 139.5);
1722 float minChan = -0.5;
1723 float maxChan = 49.5;
1725 sprintf(SpecName,
"ALCTPerEvent");
1726 ALCTPerEvent =
new TH1F(SpecName,
"ALCTs per event;N digis;entries", Chan, minChan, maxChan);
1728 sprintf(SpecName,
"CLCTPerEvent");
1729 CLCTPerEvent =
new TH1F(SpecName,
"CLCTs per event;N digis;entries", Chan, minChan, maxChan);
1731 sprintf(SpecName,
"recHitsPerEvent");
1732 recHitsPerEvent =
new TH1F(SpecName,
"RecHits per event;N digis;entries", 150, -0.5, 149.5);
1734 sprintf(SpecName,
"segmentsPerEvent");
1735 segmentsPerEvent =
new TH1F(SpecName,
"segments per event;N digis;entries", Chan, minChan, maxChan);
1739 map<std::string, bool>::iterator iter;
1740 for (
int ec = 0; ec < 2; ++ec) {
1741 for (
int st = 0; st < 4; ++st) {
1743 sprintf(SpecName,
"Stations__E%d_S%d", ec + 1, st + 1);
1748 sprintf(SpecName,
"segmentChi2_ndf_St%d", st + 1);
1749 StHist[ec][st].segmentChi2_ndf =
new TH1F(SpecName,
"Chi2/ndf of a segment;chi2/ndf;entries", 100, 0., 20.);
1751 sprintf(SpecName,
"hitsInSegment_St%d", st + 1);
1752 StHist[ec][st].hitsInSegment =
new TH1F(SpecName,
"Number of hits in a segment;nHits;entries", 7, -0.5, 6.5);
1758 sprintf(SpecName,
"AllSegments_eta_St%d", st + 1);
1759 StHist[ec][st].AllSegments_eta =
new TH1F(SpecName,
"All segments in eta;eta;entries", Chan, minChan, maxChan);
1761 sprintf(SpecName,
"EfficientSegments_eta_St%d", st + 1);
1762 StHist[ec][st].EfficientSegments_eta =
1763 new TH1F(SpecName,
"Efficient segments in eta;eta;entries", Chan, minChan, maxChan);
1765 sprintf(SpecName,
"ResidualSegments_St%d", st + 1);
1766 StHist[ec][st].ResidualSegments =
new TH1F(SpecName,
"Residual (segments);residual,cm;entries", 75, 0., 15.);
1772 float minChan2 = -800.;
1773 float maxChan2 = 800.;
1775 sprintf(SpecName,
"EfficientSegments_XY_St%d", st + 1);
1776 StHist[ec][st].EfficientSegments_XY =
1777 new TH2F(SpecName,
"Efficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1778 sprintf(SpecName,
"InefficientSegments_XY_St%d", st + 1);
1779 StHist[ec][st].InefficientSegments_XY =
1780 new TH2F(SpecName,
"Inefficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1785 sprintf(SpecName,
"EfficientALCT_momTheta_St%d", st + 1);
1786 StHist[ec][st].EfficientALCT_momTheta =
1787 new TH1F(SpecName,
"Efficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1789 sprintf(SpecName,
"InefficientALCT_momTheta_St%d", st + 1);
1790 StHist[ec][st].InefficientALCT_momTheta =
1791 new TH1F(SpecName,
"Inefficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1796 sprintf(SpecName,
"EfficientCLCT_momPhi_St%d", st + 1);
1797 StHist[ec][st].EfficientCLCT_momPhi =
1798 new TH1F(SpecName,
"Efficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1800 sprintf(SpecName,
"InefficientCLCT_momPhi_St%d", st + 1);
1801 StHist[ec][st].InefficientCLCT_momPhi =
1802 new TH1F(SpecName,
"Inefficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1805 for (
int rg = 0; rg < 3; ++rg) {
1806 if (0 != st && rg > 1) {
1808 }
else if (1 == rg && 3 == st) {
1812 if (0 != st && 0 == rg && iChamber > 18) {
1816 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
1821 sprintf(SpecName,
"EfficientRechits_inSegment_Ch%d", iChamber);
1822 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment =
new TH1F(
1823 SpecName,
"Existing RecHit given a segment;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1825 sprintf(SpecName,
"InefficientSingleHits_Ch%d", iChamber);
1826 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits =
new TH1F(
1827 SpecName,
"Single RecHits not in the segment;layers (1-6);entries ", nLayer_bins, Layer_min, Layer_max);
1829 sprintf(SpecName,
"AllSingleHits_Ch%d", iChamber);
1830 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits =
new TH1F(
1831 SpecName,
"Single RecHits given a segment; layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1833 sprintf(SpecName,
"digiAppearanceCount_Ch%d", iChamber);
1834 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount =
1836 "Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1844 sprintf(SpecName,
"EfficientALCT_dydz_Ch%d", iChamber);
1845 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz =
1846 new TH1F(SpecName,
"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1848 sprintf(SpecName,
"InefficientALCT_dydz_Ch%d", iChamber);
1849 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz =
1850 new TH1F(SpecName,
"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1855 sprintf(SpecName,
"EfficientCLCT_dxdz_Ch%d", iChamber);
1856 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz =
1857 new TH1F(SpecName,
"Efficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1859 sprintf(SpecName,
"InefficientCLCT_dxdz_Ch%d", iChamber);
1860 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz =
1861 new TH1F(SpecName,
"Inefficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1863 sprintf(SpecName,
"EfficientRechits_good_Ch%d", iChamber);
1864 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good =
new TH1F(
1865 SpecName,
"Existing RecHit - sensitive area only;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1867 sprintf(SpecName,
"EfficientStrips_Ch%d", iChamber);
1868 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips =
1869 new TH1F(SpecName,
"Existing strip;layer (1-6); entries", nLayer_bins, Layer_min, Layer_max);
1871 sprintf(SpecName,
"EfficientWireGroups_Ch%d", iChamber);
1872 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups =
1873 new TH1F(SpecName,
"Existing WireGroups;layer (1-6); entries ", nLayer_bins, Layer_min, Layer_max);
1875 sprintf(SpecName,
"StripWiresCorrelations_Ch%d", iChamber);
1876 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations =
1877 new TH1F(SpecName,
"StripWire correlations;; entries ", 5, 0.5, 5.5);
1882 sprintf(SpecName,
"NoWires_momTheta_Ch%d", iChamber);
1883 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta =
1885 "No wires (all strips present) - in theta (momentum);theta, rad;entries",
1893 sprintf(SpecName,
"NoStrips_momPhi_Ch%d", iChamber);
1894 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi =
new TH1F(
1895 SpecName,
"No strips (all wires present) - in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1897 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1898 sprintf(SpecName,
"Y_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1899 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment.push_back(
1901 "Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1906 sprintf(SpecName,
"Y_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1907 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment.push_back(
1909 "Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole "
1910 "chamber);Y, cm; entries",
1918 sprintf(SpecName,
"Phi_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1919 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment.push_back(
1921 "Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1926 sprintf(SpecName,
"Phi_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1927 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment.push_back(
1929 "Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, "
1936 sprintf(SpecName,
"Sim_Rechits_Ch%d", iChamber);
1937 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits =
1938 new TH1F(SpecName,
"Existing RecHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1940 sprintf(SpecName,
"Sim_Simhits_Ch%d", iChamber);
1941 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits =
1942 new TH1F(SpecName,
"Existing SimHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1969 std::vector<float> eff(2);
1972 std::map<std::string, bool> chamberTypes;
1973 chamberTypes[
"ME11"] =
false;
1974 chamberTypes[
"ME12"] =
false;
1975 chamberTypes[
"ME13"] =
false;
1976 chamberTypes[
"ME21"] =
false;
1977 chamberTypes[
"ME22"] =
false;
1978 chamberTypes[
"ME31"] =
false;
1979 chamberTypes[
"ME32"] =
false;
1980 chamberTypes[
"ME41"] =
false;
1982 map<std::string, bool>::iterator iter;
1983 std::cout <<
" Writing proper histogram structure (patience)..." << std::endl;
1984 for (
int ec = 0; ec < 2; ++ec) {
1985 for (
int st = 0; st < 4; ++st) {
1986 snprintf(SpecName,
sizeof(SpecName),
"Stations__E%d_S%d", ec + 1, st + 1);
1988 StHist[ec][st].segmentChi2_ndf->Write();
1989 StHist[ec][st].hitsInSegment->Write();
1990 StHist[ec][st].AllSegments_eta->Write();
1991 StHist[ec][st].EfficientSegments_eta->Write();
1992 StHist[ec][st].ResidualSegments->Write();
1993 StHist[ec][st].EfficientSegments_XY->Write();
1994 StHist[ec][st].InefficientSegments_XY->Write();
1995 StHist[ec][st].EfficientALCT_momTheta->Write();
1996 StHist[ec][st].InefficientALCT_momTheta->Write();
1997 StHist[ec][st].EfficientCLCT_momPhi->Write();
1998 StHist[ec][st].InefficientCLCT_momPhi->Write();
1999 for (
int rg = 0; rg < 3; ++rg) {
2000 if (0 != st && rg > 1) {
2002 }
else if (1 == rg && 3 == st) {
2006 if (0 != st && 0 == rg && iChamber > 18) {
2009 snprintf(SpecName,
sizeof(SpecName),
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
2012 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment->Write();
2013 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits->Write();
2014 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount->Write();
2015 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz->Write();
2016 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz->Write();
2017 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz->Write();
2018 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz->Write();
2019 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits->Write();
2020 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good->Write();
2021 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips->Write();
2022 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations->Write();
2023 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta->Write();
2024 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi->Write();
2025 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups->Write();
2026 for (
unsigned int iLayer = 0; iLayer < 6; iLayer++) {
2027 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
2028 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
2029 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2030 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2032 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits->Write();
2033 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits->Write();
2046 snprintf(SpecName,
sizeof(SpecName),
"AllChambers");
2050 TriggersFired->Write();
2051 ALCTPerEvent->Write();
2052 CLCTPerEvent->Write();
2053 recHitsPerEvent->Write();
2054 segmentsPerEvent->Write();