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);
91 triggerPassed = applyTrigger(hltR, triggerNames);
98 if (theService->magneticField()->inTesla(gpZero).mag2() < 0.1) {
105 fillDigiInfo(alcts, clcts, correlatedlcts, wires, strips, simhits, rechits, segments, cscGeom);
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.;
121 std::cout <<
" muons.size() = " << muons->size() << std::endl;
122 for (reco::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end(); ++
muon) {
125 std::cout <<
" iMuon = " <<
muon - muons->begin() <<
" charge = " <<
muon->charge() <<
" p = " <<
muon->p()
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.) {
191 std::cout <<
"Start track loop over " << trackCollection.
size() <<
" tracks" << std::endl;
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);
213 deltaR =
sqrt(deltaR);
215 std::cout <<
" TR mu match to a tr: deltaR = " << deltaR
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;
238 if (trackCollection.
size() > 2) {
242 if (!
i && 2 == trackCollection.
size()) {
253 <<
" nSeg = " << segments->size() << std::endl;
263 <<
" outer position = " << track->
outerPosition() << std::endl;
265 <<
" phi (outer) = " << track->
outerPosition().phi() << std::endl;
268 std::cout <<
" dump inner state MUON detid = " << debug.
dumpMuonId(innerDetId) << std::endl;
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) {
290 dpT_ov_pT = track->
ptError() / track->
pt();
297 if (track->
found() < minTrackHits) {
301 if (!segments->size()) {
309 if (
magField && (dpT_ov_pT > 0.5)) {
319 chooseDirection(r3T_inner, r3T);
322 CLHEP::Hep3Vector p3_propagated, r3_propagated;
325 cov_propagated *= 1
e-20;
327 FreeTrajectoryState ftsStart = getFromCLHEP(p3T, r3T, charge, covT, &*(theService->magneticField()));
330 std::cout <<
" dump the very first FTS = " << debug.
dumpFTS(ftsStart) << std::endl;
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) {
350 refME.push_back(
CSCDetId(endcap, iS, iR, chamber));
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;
368 const CSCChamber *cscChamber_base = cscGeom->chamber(refME[iSt].chamberId());
371 std::cout <<
" base iStation : eta = " << cscGeom->idToDet(detId)->surface().position().eta()
372 <<
" phi = " << cscGeom->idToDet(detId)->surface().position().phi()
373 <<
" y = " << cscGeom->idToDet(detId)->surface().position().y() << std::endl;
378 tSOSDest = propagate(ftsStart, cscGeom->idToDet(detId)->surface());
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])) {
416 const CSCChamber *cscChamber = cscGeom->chamber(theCSCId.chamberId());
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();
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.;
552 if (station > 1 && station < 5) {
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;
564 }
else if (3 == station) {
565 chamberBounds[0] = 61.40 / 2;
566 chamberBounds[1] = 125.71 / 2;
567 chamberBounds[2] = 169.70 / 2;
569 }
else if (4 == station) {
570 chamberBounds[0] = 69.01 / 2;
571 chamberBounds[1] = 125.65 / 2;
572 chamberBounds[2] = 149.42 / 2;
576 }
else if (1 == station) {
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;
612 if (station > 1 && station < 5) {
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;
634 }
else if (3 == station) {
635 deadZoneCenter[0] = -85.97;
636 deadZoneCenter[1] = -36.21;
637 deadZoneCenter[2] = 23.68;
638 deadZoneCenter[3] = 84.04;
639 }
else if (4 == station) {
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))) {
651 }
else if (1 == station) {
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);
712 fillStrips_info(strips);
714 fillRechitsSegments_info(rechits, segments, cscGeom);
716 fillSimhit_info(simhits);
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;
770 const CSCLayer *layer_p = cscGeom->layer(
id);
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(
797 int largestADCValue = -1;
798 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
799 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
800 for (; digiItr !=
last; ++digiItr) {
801 int maxADC = largestADCValue;
802 int myStrip = digiItr->getStrip();
803 std::vector<int> myADCVals = digiItr->getADCCounts();
804 float thisPedestal = 0.5 * (float)(myADCVals[0] + myADCVals[1]);
805 float peakADC = -1000.;
806 for (
int myADCVal : myADCVals) {
807 float diff = (float)myADCVal - thisPedestal;
808 if (diff > threshold) {
809 if (myADCVal > largestADCValue)
810 largestADCValue = myADCVal;
815 if (largestADCValue > maxADC) {
816 std::pair<int, float> LayerSignal(myStrip, peakADC);
819 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].clear();
820 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].push_back(
828 edm::PSimHitContainer::const_iterator dSHsimIter;
829 for (dSHsimIter = simhits->begin(); dSHsimIter != simhits->end(); dSHsimIter++) {
832 std::pair<LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
845 printf(
" The size of the rechit collection is %i\n",
int(rechits->size()));
848 recHitsPerEvent->Fill(rechits->size());
851 for (recIt = rechits->begin(); recIt != rechits->end(); recIt++) {
855 const CSCLayer *csclayer = cscGeom->layer(
id);
856 LocalPoint rhitlocal = (*recIt).localPosition();
857 LocalError rerrlocal = (*recIt).localPositionError();
859 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
865 printf(
"\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
876 std::pair<LocalPoint, bool> recHitPos((*recIt).localPosition(),
false);
877 allRechits[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][
id.layer() - 1].push_back(
881 for (
int iE = 0; iE < 2; iE++) {
882 for (
int iS = 0; iS < 4; iS++) {
883 for (
int iR = 0; iR < 4; iR++) {
884 for (
int iC = 0; iC <
NumCh; iC++) {
886 for (
int iL = 0; iL < 6; iL++) {
887 if (!allRechits[iE][iS][iR][iC][iL].
empty()) {
892 emptyChambers[iE][iS][iR][iC] =
false;
894 emptyChambers[iE][iS][iR][iC] =
true;
903 printf(
" The size of the segment collection is %i\n",
int(segments->size()));
906 segmentsPerEvent->Fill(segments->size());
909 StHist[
id.endcap() - 1][
id.station() - 1].segmentChi2_ndf->Fill((*it).chi2() / (*it).degreesOfFreedom());
910 StHist[
id.endcap() - 1][
id.station() - 1].hitsInSegment->Fill((*it).nRecHits());
913 std::cout <<
"\tposition(loc) = " << (*it).localPosition() <<
" error(loc) = " << (*it).localPositionError()
915 std::cout <<
"\t chi2/ndf = " << (*it).chi2() / (*it).degreesOfFreedom() <<
" nhits = " << (*it).nRecHits()
918 allSegments[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh].push_back(
919 make_pair((*it).localPosition(), (*it).localDirection()));
923 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
924 int nRH = (*it).nRecHits();
926 printf(
"\tGet the recHits for this segment.\t");
927 printf(
" nRH = %i\n", nRH);
931 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
935 printf(
"\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
948 float xDiff = iRH->localPosition().x() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
951 float yDiff = iRH->localPosition().y() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
954 if (fabs(xDiff) < 0.0001 && fabs(yDiff) < 0.0001) {
955 std::pair<LocalPoint, bool> recHitPos(allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
962 std::cout <<
" number of the rechit (from zero) in the segment = " << jRH << std::endl;
975 if (feta > 0.85 && feta < 1.18) {
976 chamberTypes[
"ME13"] =
true;
978 if (feta > 1.18 && feta < 1.7) {
979 chamberTypes[
"ME12"] =
true;
981 if (feta > 1.5 && feta < 2.45) {
982 chamberTypes[
"ME11"] =
true;
986 if (feta > 0.95 && feta < 1.6) {
987 chamberTypes[
"ME22"] =
true;
989 if (feta > 1.55 && feta < 2.45) {
990 chamberTypes[
"ME21"] =
true;
994 if (feta > 1.08 && feta < 1.72) {
995 chamberTypes[
"ME32"] =
true;
997 if (feta > 1.69 && feta < 2.45) {
998 chamberTypes[
"ME31"] =
true;
1002 if (feta > 1.78 && feta < 2.45) {
1003 chamberTypes[
"ME41"] =
true;
1012 coupleOfChambers.clear();
1014 float phi_zero = 0.;
1015 float phi_const = 2. *
M_PI / 36.;
1016 int last_chamber = 36;
1017 int first_chamber = 1;
1018 if (1 != station && 1 == ring) {
1024 std::cout <<
" info: negative phi = " << phi << std::endl;
1027 float chamber_float = (phi - phi_zero) / phi_const;
1028 int chamber_int = int(chamber_float);
1029 if (chamber_float -
float(chamber_int) - 0.5 < 0.) {
1030 if (0 != chamber_int) {
1031 coupleOfChambers.push_back(chamber_int);
1033 coupleOfChambers.push_back(last_chamber);
1035 coupleOfChambers.push_back(chamber_int + 1);
1038 coupleOfChambers.push_back(chamber_int + 1);
1039 if (last_chamber != chamber_int + 1) {
1040 coupleOfChambers.push_back(chamber_int + 2);
1042 coupleOfChambers.push_back(first_chamber);
1046 std::cout <<
" phi = " << phi <<
" phi_zero = " << phi_zero <<
" phi_const = " << phi_const
1047 <<
" candidate chambers: first ch = " << coupleOfChambers[0] <<
" second ch = " << coupleOfChambers[1]
1055 int ec, st, rg, ch, secondRing;
1056 returnTypes(
id, ec, st, rg, ch, secondRing);
1061 std::cout <<
" local dir = " << localDir << std::endl;
1064 float dxdz = localDir.
x() / localDir.
z();
1065 float dydz = localDir.
y() / localDir.
z();
1066 if (2 == st || 3 == st) {
1068 std::cout <<
"st 3 or 4 ... flip dy/dz" << std::endl;
1073 std::cout <<
"dy/dz = " << dydz << std::endl;
1077 if (applyIPangleCuts) {
1078 if (dydz > local_DY_DZ_Max || dydz < local_DY_DZ_Min || fabs(dxdz) > local_DX_DZ_Max) {
1084 bool firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1085 bool secondCondition =
false;
1087 if (secondRing > -1) {
1088 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1090 if (firstCondition || secondCondition) {
1092 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1096 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1102 firstCondition = allALCT[ec][st][rg][ch];
1103 secondCondition =
false;
1104 if (secondRing > -1) {
1105 secondCondition = allALCT[ec][st][secondRing][ch];
1107 if (firstCondition || secondCondition) {
1109 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1112 if (fabs(dxdz) < local_DX_DZ_Max) {
1113 StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1114 ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(dydz);
1118 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1120 if (fabs(dxdz) < local_DX_DZ_Max) {
1121 StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1122 ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(dydz);
1125 std::cout <<
" missing ALCT (dy/dz = " << dydz <<
")";
1126 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1131 firstCondition = allCLCT[ec][st][rg][ch];
1132 secondCondition =
false;
1133 if (secondRing > -1) {
1134 secondCondition = allCLCT[ec][st][secondRing][ch];
1136 if (firstCondition || secondCondition) {
1138 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1140 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1141 StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1142 ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(dxdz);
1146 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1148 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1149 StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1150 ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(dxdz);
1153 std::cout <<
" missing CLCT (dx/dz = " << dxdz <<
")";
1154 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1159 firstCondition = allCorrLCT[ec][st][rg][ch];
1160 secondCondition =
false;
1161 if (secondRing > -1) {
1162 secondCondition = allCorrLCT[ec][st][secondRing][ch];
1164 if (firstCondition || secondCondition) {
1165 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1167 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1176 int ec, st, rg, ch, secondRing;
1177 returnTypes(
id, ec, st, rg, ch, secondRing);
1179 bool firstCondition, secondCondition;
1180 int missingLayers_s = 0;
1181 int missingLayers_wg = 0;
1182 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1185 printf(
"\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1193 << allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1195 << allWG[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1198 firstCondition = !allStrips[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1200 secondCondition =
false;
1201 if (secondRing > -1) {
1202 secondCondition = !allStrips[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1204 if (firstCondition || secondCondition) {
1205 ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer + 1);
1209 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1218 firstCondition = !allWG[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1219 secondCondition =
false;
1220 if (secondRing > -1) {
1221 secondCondition = !allWG[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1223 if (firstCondition || secondCondition) {
1224 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer + 1);
1228 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1238 if (6 != missingLayers_s) {
1239 ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1241 if (6 != missingLayers_wg) {
1242 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1244 ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1245 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1247 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1248 if (missingLayers_s != missingLayers_wg) {
1249 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1250 if (6 == missingLayers_wg) {
1251 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1252 ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.
momentum().
theta());
1254 if (6 == missingLayers_s) {
1255 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1256 ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.
momentum().
theta());
1258 }
else if (6 == missingLayers_s) {
1259 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1266 int ec, st, rg, ch, secondRing;
1267 returnTypes(
id, ec, st, rg, ch, secondRing);
1268 bool firstCondition, secondCondition;
1269 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1270 firstCondition = !allSimhits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1271 secondCondition =
false;
1273 if (secondRing > -1) {
1274 secondCondition = !allSimhits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1275 if (secondCondition) {
1276 thisRing = secondRing;
1279 if (firstCondition || secondCondition) {
1280 for (
size_t iSH = 0; iSH < allSimhits[ec][st][thisRing][ch][iLayer].size(); ++iSH) {
1281 if (13 == fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].
second)) {
1282 ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer + 1);
1283 if (!allRechits[ec][st][thisRing][ch][iLayer].
empty()) {
1284 ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer + 1);
1312 int ec, st, rg, ch, secondRing;
1313 returnTypes(
id, ec, st, rg, ch, secondRing);
1314 bool firstCondition, secondCondition;
1316 std::vector<bool> missingLayers_rh(6);
1317 std::vector<int> usedInSegment(6);
1320 std::cout <<
"RecHits eff" << std::endl;
1321 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1322 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1323 secondCondition =
false;
1325 if (secondRing > -1) {
1326 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1327 if (secondCondition) {
1328 thisRing = secondRing;
1331 if (firstCondition || secondCondition) {
1332 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer + 1);
1333 for (
size_t iR = 0; iR < allRechits[ec][st][thisRing][ch][iLayer].size(); ++iR) {
1334 if (allRechits[ec][st][thisRing][ch][iLayer][iR].
second) {
1335 usedInSegment[iLayer] = 1;
1338 usedInSegment[iLayer] = -1;
1342 missingLayers_rh[iLayer] =
true;
1345 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1357 firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1358 secondCondition =
false;
1361 if (secondRing > -1) {
1362 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1363 secondSize = allSegments[ec][st][secondRing][ch].size();
1364 if (secondCondition) {
1365 thisRing = secondRing;
1368 if (firstCondition || secondCondition) {
1370 std::cout <<
"segments - start ec = " << ec <<
" st = " << st <<
" rg = " << rg <<
" ch = " << ch << std::endl;
1371 StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1372 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1373 globalDir = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
second);
1374 globalPos = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
first);
1375 StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1380 std::cout <<
" fts.position() = " << ftsChamber.
position() <<
" segPos = " << globalPos <<
" res = " << residual
1382 StHist[ec][st].ResidualSegments->Fill(residual);
1384 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1386 std::cout <<
" iLayer = " << iLayer <<
" usedInSegment = " << usedInSegment[iLayer] << std::endl;
1387 if (0 != usedInSegment[iLayer]) {
1388 if (-1 == usedInSegment[iLayer]) {
1389 ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer + 1);
1391 ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer + 1);
1393 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1394 secondCondition =
false;
1395 if (secondRing > -1) {
1396 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1398 float stripAngle = 99999.;
1399 std::vector<float> posXY(2);
1400 bool oneSegment =
false;
1401 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1404 linearExtrapolation(globalPos, globalDir, bp.position().z(), posXY);
1405 GlobalPoint gp_extrapol(posXY.at(0), posXY.at(1), bp.position().z());
1407 posXY.at(0) = lp_extrapol.
x();
1408 posXY.at(1) = lp_extrapol.y();
1412 if (firstCondition || secondCondition) {
1413 ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer + 1);
1415 ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1416 ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1420 ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1421 ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1426 StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1428 std::cout <<
"missing segment " << std::endl;
1434 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1435 if (allSegments[ec][st][rg][ch].
size() + secondSize < 2) {
1436 StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1438 ChHist[ec][st][rg][
id.chamber() -
FirstCh].EfficientRechits_inSegment->Fill(9);
1444 ec =
id.endcap() - 1;
1445 st =
id.station() - 1;
1457 CLHEP::Hep3Vector &p3,
1458 CLHEP::Hep3Vector &r3,
1464 p3.set(p3GV.
x(), p3GV.
y(), p3GV.
z());
1465 r3.set(r3GP.
x(), r3GP.
y(), r3GP.
z());
1472 const CLHEP::Hep3Vector &r3,
1488 std::vector<float> &posZY) {
1489 double paramLine = lineParameter(initialPosition.
z(), zSurface, initialDirection.
z());
1490 double xPosition = extrapolate1D(initialPosition.
x(), initialDirection.
x(), paramLine);
1491 double yPosition = extrapolate1D(initialPosition.
y(), initialDirection.
y(), paramLine);
1493 posZY.push_back(xPosition);
1494 posZY.push_back(yPosition);
1498 double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine;
1499 return extrapolatedPosition;
1503 double paramLine = (destZPosition - initZPosition) / initZDirection;
1510 float dy = outerPosition.y() - innerPosition.y();
1511 float dz = outerPosition.z() - innerPosition.z();
1529 return &*theService->propagator(propagatorName);
1556 propagatorName =
"SteppingHelixPropagatorAny";
1557 tSOSDest =
propagator(propagatorName)->propagate(ftsStart, bpDest);
1562 bool triggerPassed =
true;
1563 std::vector<std::string> hlNames = triggerNames.
triggerNames();
1564 pointToTriggers.clear();
1565 for (
size_t imyT = 0; imyT < myTriggers.size(); ++imyT) {
1566 for (
size_t iT = 0; iT < hlNames.size(); ++iT) {
1572 if (hltR->wasrun(iT) && hltR->accept(iT) && !hltR->error(iT)) {
1573 TriggersFired->Fill(iT);
1576 if (hlNames[iT] == myTriggers[imyT]) {
1577 pointToTriggers.push_back(iT);
1584 if (pointToTriggers.size() != myTriggers.size()) {
1585 pointToTriggers.clear();
1587 std::cout <<
" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"
1591 if (!pointToTriggers.empty()) {
1593 std::cout <<
"The following triggers will be required in the event: " << std::endl;
1594 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1595 std::cout <<
" " << hlNames[pointToTriggers[imyT]];
1604 if (pointToTriggers.empty()) {
1607 <<
" No triggers specified in the configuration or all ignored - no trigger information will be considered"
1611 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1612 if (hltR->wasrun(pointToTriggers[imyT]) && hltR->accept(pointToTriggers[imyT]) &&
1613 !hltR->error(pointToTriggers[imyT])) {
1614 triggerPassed =
true;
1619 triggerPassed =
false;
1621 triggerPassed =
false;
1628 std::cout <<
" TriggerResults handle returns invalid state?! No trigger information will be considered"
1633 std::cout <<
" Trigger passed: " << triggerPassed << std::endl;
1635 return triggerPassed;
1644 const float Ymin = -165;
1645 const float Ymax = 165;
1646 const int nYbins = int((Ymax - Ymin) / 2);
1647 const float Layer_min = -0.5;
1648 const float Layer_max = 9.5;
1649 const int nLayer_bins = int(Layer_max - Layer_min);
1682 geomToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
1693 myTriggers = pset.
getParameter<std::vector<std::string> >(
"myTriggers");
1695 pointToTriggers.clear();
1698 nEventsAnalyzed = 0;
1705 theFile =
new TFile(rootFileName.c_str(),
"RECREATE");
1710 sprintf(SpecName,
"DataFlow");
1711 DataFlow =
new TH1F(SpecName,
"Data flow;condition number;entries", 40, -0.5, 39.5);
1713 sprintf(SpecName,
"TriggersFired");
1714 TriggersFired =
new TH1F(SpecName,
"Triggers fired;trigger number;entries", 140, -0.5, 139.5);
1717 float minChan = -0.5;
1718 float maxChan = 49.5;
1720 sprintf(SpecName,
"ALCTPerEvent");
1721 ALCTPerEvent =
new TH1F(SpecName,
"ALCTs per event;N digis;entries", Chan, minChan, maxChan);
1723 sprintf(SpecName,
"CLCTPerEvent");
1724 CLCTPerEvent =
new TH1F(SpecName,
"CLCTs per event;N digis;entries", Chan, minChan, maxChan);
1726 sprintf(SpecName,
"recHitsPerEvent");
1727 recHitsPerEvent =
new TH1F(SpecName,
"RecHits per event;N digis;entries", 150, -0.5, 149.5);
1729 sprintf(SpecName,
"segmentsPerEvent");
1730 segmentsPerEvent =
new TH1F(SpecName,
"segments per event;N digis;entries", Chan, minChan, maxChan);
1734 map<std::string, bool>::iterator iter;
1735 for (
int ec = 0; ec < 2; ++ec) {
1736 for (
int st = 0; st < 4; ++st) {
1738 sprintf(SpecName,
"Stations__E%d_S%d", ec + 1, st + 1);
1743 sprintf(SpecName,
"segmentChi2_ndf_St%d", st + 1);
1744 StHist[ec][st].segmentChi2_ndf =
new TH1F(SpecName,
"Chi2/ndf of a segment;chi2/ndf;entries", 100, 0., 20.);
1746 sprintf(SpecName,
"hitsInSegment_St%d", st + 1);
1747 StHist[ec][st].hitsInSegment =
new TH1F(SpecName,
"Number of hits in a segment;nHits;entries", 7, -0.5, 6.5);
1753 sprintf(SpecName,
"AllSegments_eta_St%d", st + 1);
1754 StHist[ec][st].AllSegments_eta =
new TH1F(SpecName,
"All segments in eta;eta;entries", Chan, minChan, maxChan);
1756 sprintf(SpecName,
"EfficientSegments_eta_St%d", st + 1);
1757 StHist[ec][st].EfficientSegments_eta =
1758 new TH1F(SpecName,
"Efficient segments in eta;eta;entries", Chan, minChan, maxChan);
1760 sprintf(SpecName,
"ResidualSegments_St%d", st + 1);
1761 StHist[ec][st].ResidualSegments =
new TH1F(SpecName,
"Residual (segments);residual,cm;entries", 75, 0., 15.);
1767 float minChan2 = -800.;
1768 float maxChan2 = 800.;
1770 sprintf(SpecName,
"EfficientSegments_XY_St%d", st + 1);
1771 StHist[ec][st].EfficientSegments_XY =
1772 new TH2F(SpecName,
"Efficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1773 sprintf(SpecName,
"InefficientSegments_XY_St%d", st + 1);
1774 StHist[ec][st].InefficientSegments_XY =
1775 new TH2F(SpecName,
"Inefficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1780 sprintf(SpecName,
"EfficientALCT_momTheta_St%d", st + 1);
1781 StHist[ec][st].EfficientALCT_momTheta =
1782 new TH1F(SpecName,
"Efficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1784 sprintf(SpecName,
"InefficientALCT_momTheta_St%d", st + 1);
1785 StHist[ec][st].InefficientALCT_momTheta =
1786 new TH1F(SpecName,
"Inefficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1791 sprintf(SpecName,
"EfficientCLCT_momPhi_St%d", st + 1);
1792 StHist[ec][st].EfficientCLCT_momPhi =
1793 new TH1F(SpecName,
"Efficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1795 sprintf(SpecName,
"InefficientCLCT_momPhi_St%d", st + 1);
1796 StHist[ec][st].InefficientCLCT_momPhi =
1797 new TH1F(SpecName,
"Inefficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1800 for (
int rg = 0; rg < 3; ++rg) {
1801 if (0 != st && rg > 1) {
1803 }
else if (1 == rg && 3 == st) {
1807 if (0 != st && 0 == rg && iChamber > 18) {
1811 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
1816 sprintf(SpecName,
"EfficientRechits_inSegment_Ch%d", iChamber);
1817 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment =
new TH1F(
1818 SpecName,
"Existing RecHit given a segment;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1820 sprintf(SpecName,
"InefficientSingleHits_Ch%d", iChamber);
1821 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits =
new TH1F(
1822 SpecName,
"Single RecHits not in the segment;layers (1-6);entries ", nLayer_bins, Layer_min, Layer_max);
1824 sprintf(SpecName,
"AllSingleHits_Ch%d", iChamber);
1825 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits =
new TH1F(
1826 SpecName,
"Single RecHits given a segment; layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1828 sprintf(SpecName,
"digiAppearanceCount_Ch%d", iChamber);
1829 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount =
1831 "Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1839 sprintf(SpecName,
"EfficientALCT_dydz_Ch%d", iChamber);
1840 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz =
1841 new TH1F(SpecName,
"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1843 sprintf(SpecName,
"InefficientALCT_dydz_Ch%d", iChamber);
1844 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz =
1845 new TH1F(SpecName,
"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1850 sprintf(SpecName,
"EfficientCLCT_dxdz_Ch%d", iChamber);
1851 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz =
1852 new TH1F(SpecName,
"Efficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1854 sprintf(SpecName,
"InefficientCLCT_dxdz_Ch%d", iChamber);
1855 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz =
1856 new TH1F(SpecName,
"Inefficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1858 sprintf(SpecName,
"EfficientRechits_good_Ch%d", iChamber);
1859 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good =
new TH1F(
1860 SpecName,
"Existing RecHit - sensitive area only;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1862 sprintf(SpecName,
"EfficientStrips_Ch%d", iChamber);
1863 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips =
1864 new TH1F(SpecName,
"Existing strip;layer (1-6); entries", nLayer_bins, Layer_min, Layer_max);
1866 sprintf(SpecName,
"EfficientWireGroups_Ch%d", iChamber);
1867 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups =
1868 new TH1F(SpecName,
"Existing WireGroups;layer (1-6); entries ", nLayer_bins, Layer_min, Layer_max);
1870 sprintf(SpecName,
"StripWiresCorrelations_Ch%d", iChamber);
1871 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations =
1872 new TH1F(SpecName,
"StripWire correlations;; entries ", 5, 0.5, 5.5);
1877 sprintf(SpecName,
"NoWires_momTheta_Ch%d", iChamber);
1878 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta =
1880 "No wires (all strips present) - in theta (momentum);theta, rad;entries",
1888 sprintf(SpecName,
"NoStrips_momPhi_Ch%d", iChamber);
1889 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi =
new TH1F(
1890 SpecName,
"No strips (all wires present) - in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1892 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1893 sprintf(SpecName,
"Y_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1894 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment.push_back(
1896 "Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1901 sprintf(SpecName,
"Y_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1902 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment.push_back(
1904 "Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole "
1905 "chamber);Y, cm; entries",
1913 sprintf(SpecName,
"Phi_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1914 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment.push_back(
1916 "Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1921 sprintf(SpecName,
"Phi_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1922 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment.push_back(
1924 "Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, "
1931 sprintf(SpecName,
"Sim_Rechits_Ch%d", iChamber);
1932 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits =
1933 new TH1F(SpecName,
"Existing RecHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1935 sprintf(SpecName,
"Sim_Simhits_Ch%d", iChamber);
1936 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits =
1937 new TH1F(SpecName,
"Existing SimHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1963 std::vector<float> bins,
Efficiency, EffError;
1964 std::vector<float> eff(2);
1967 std::map<std::string, bool> chamberTypes;
1968 chamberTypes[
"ME11"] =
false;
1969 chamberTypes[
"ME12"] =
false;
1970 chamberTypes[
"ME13"] =
false;
1971 chamberTypes[
"ME21"] =
false;
1972 chamberTypes[
"ME22"] =
false;
1973 chamberTypes[
"ME31"] =
false;
1974 chamberTypes[
"ME32"] =
false;
1975 chamberTypes[
"ME41"] =
false;
1977 map<std::string, bool>::iterator iter;
1978 std::cout <<
" Writing proper histogram structure (patience)..." << std::endl;
1979 for (
int ec = 0; ec < 2; ++ec) {
1980 for (
int st = 0; st < 4; ++st) {
1981 snprintf(SpecName,
sizeof(SpecName),
"Stations__E%d_S%d", ec + 1, st + 1);
1983 StHist[ec][st].segmentChi2_ndf->Write();
1984 StHist[ec][st].hitsInSegment->Write();
1985 StHist[ec][st].AllSegments_eta->Write();
1986 StHist[ec][st].EfficientSegments_eta->Write();
1987 StHist[ec][st].ResidualSegments->Write();
1988 StHist[ec][st].EfficientSegments_XY->Write();
1989 StHist[ec][st].InefficientSegments_XY->Write();
1990 StHist[ec][st].EfficientALCT_momTheta->Write();
1991 StHist[ec][st].InefficientALCT_momTheta->Write();
1992 StHist[ec][st].EfficientCLCT_momPhi->Write();
1993 StHist[ec][st].InefficientCLCT_momPhi->Write();
1994 for (
int rg = 0; rg < 3; ++rg) {
1995 if (0 != st && rg > 1) {
1997 }
else if (1 == rg && 3 == st) {
2001 if (0 != st && 0 == rg && iChamber > 18) {
2004 snprintf(SpecName,
sizeof(SpecName),
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
2007 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment->Write();
2008 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits->Write();
2009 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount->Write();
2010 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz->Write();
2011 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz->Write();
2012 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz->Write();
2013 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz->Write();
2014 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits->Write();
2015 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good->Write();
2016 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips->Write();
2017 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations->Write();
2018 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta->Write();
2019 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi->Write();
2020 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups->Write();
2021 for (
unsigned int iLayer = 0; iLayer < 6; iLayer++) {
2022 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
2023 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
2024 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2025 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2027 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits->Write();
2028 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits->Write();
2041 snprintf(SpecName,
sizeof(SpecName),
"AllChambers");
2045 TriggersFired->Write();
2046 ALCTPerEvent->Write();
2047 CLCTPerEvent->Write();
2048 recHitsPerEvent->Write();
2049 segmentsPerEvent->Write();
double qoverp() const
q / p
double p() const
momentum vector magnitude
T getUntrackedParameter(std::string const &, T const &) const
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
CartesianTrajectoryError cartesianError() const
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
void fillWG_info(edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
#define DEFINE_FWK_MODULE(type)
void ringCandidates(int station, float absEta, std::map< std::string, bool > &chamberTypes)
double lineParameter(double initZPosition, double destZPosition, double initZDirection)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
unsigned long long EventNumber_t
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
double phi() const
azimuthal angle of momentum vector
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
TrackCharge charge() const
const math::XYZPoint & outerPosition() const
position of the outermost hit
const Plane & surface() const
The nominal surface of the GeomDet.
Strings const & triggerNames() const
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
float yOfWireGroup(int wireGroup, float x=0.) const
float caloCompatibility(const reco::Muon &muon)
constexpr std::array< uint8_t, layerIndexSize > layer
FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3, const CLHEP::Hep3Vector &r3, int charge, const AlgebraicSymMatrix66 &cov, const MagneticField *field)
const uint16_t range(const Frame &aFrame)
std::string dumpMuonId(const DetId &id) const
Geom::Theta< T > theta() const
std::string dumpFTS(const FreeTrajectoryState &fts) const
const math::XYZPoint & innerPosition() const
position of the innermost hit
U second(std::pair< T, U > const &p)
C::const_iterator const_iterator
constant access iterator type
double eta() const
pseudorapidity of momentum vector
tuple strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
double pt() const
track transverse momentum
FreeTrajectoryState const * freeState(bool withErrors=true) const
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Abs< T >::type abs(const T &t)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
DetId geographicalId() const
The label of this GeomDet.
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
void getFromFTS(const FreeTrajectoryState &fts, CLHEP::Hep3Vector &p3, CLHEP::Hep3Vector &r3, int &charge, AlgebraicSymMatrix66 &cov)
bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
GlobalVector momentum() const
void chamberCandidates(int station, int ring, float phi, std::vector< int > &coupleOfChambers)
const AlgebraicSymMatrix66 & matrix() const
void fillLCT_info(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts)
void fillRechitsSegments_info(edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
double qoverpError() const
error on signed transverse curvature
bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
int nearestStrip(const LocalPoint &lp) const
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
GlobalPoint position() const
void fillDigiInfo(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts, edm::Handle< CSCWireDigiCollection > &wires, edm::Handle< CSCStripDigiCollection > &strips, edm::Handle< edm::PSimHitContainer > &simhits, edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
T const * product() const
bool filter(edm::Event &event, const edm::EventSetup &eventSetup) override
const Propagator * propagator(std::string propagatorName) const
std::pair< const_iterator, const_iterator > Range
T getParameter(std::string const &) const
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
std::vector< DigiType >::const_iterator const_iterator
bool quality(const TrackQuality) const
Track quality.
~CSCEfficiency() override
Destructor.
bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring)
bool checkLocal(double yLocal, double yBoundary, int station, int ring)
unsigned short found() const
Number of valid hits on track.
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
int charge() const
track electric charge
const Point & position() const
position
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
float stripAngle(int strip) const
const CSCLayerGeometry * geometry() const
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)