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);
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");
82 bool triggerPassed =
true;
88 event.getByToken(ht_token, hltR);
97 if (theService->magneticField()->inTesla(gpZero).mag2() < 0.1) {
108 event.getByLabel(muonTag_,
muons);
111 event.getByLabel(
"offlineBeamSpot", beamSpotHandle);
114 std::vector<reco::MuonCollection::const_iterator> goodMuons_it;
115 unsigned int nPositiveZ = 0;
116 unsigned int nNegativeZ = 0;
117 float muonOuterZPosition = -99999.;
125 <<
" pt = " <<
muon->pt() <<
" eta = " <<
muon->eta() <<
" phi = " <<
muon->phi()
126 <<
" matches = " <<
muon->matches().size()
128 <<
" GLB/TR/STA = " <<
muon->isGlobalMuon() <<
"/" <<
muon->isTrackerMuon() <<
"/" 129 <<
muon->isStandAloneMuon() << std::endl;
131 if (!(
muon->isTrackerMuon() &&
muon->isGlobalMuon())) {
136 (
muon->isolationR03().sumPt +
muon->isolationR03().emEt +
muon->isolationR03().hadEt) /
muon->track()->pt();
138 std::cout <<
" relISO = " << relISO <<
" emVetoEt = " <<
muon->isolationR03().emVetoEt
140 <<
" dxy = " << fabs(
muon->track()->dxy(vertexBeamSpot.
position())) << std::endl;
144 fabs(
muon->track()->dxy(vertexBeamSpot.
position())) > 0.2 ||
muon->pt() < 6.) {
148 if (
muon->track()->hitPattern().numberOfValidPixelHits() < 1 ||
149 muon->track()->hitPattern().numberOfValidTrackerHits() < 11 ||
150 muon->combinedMuon()->hitPattern().numberOfValidMuonHits() < 1 ||
151 muon->combinedMuon()->normalizedChi2() > 10. ||
muon->numberOfMatches() < 2) {
155 float zOuter =
muon->combinedMuon()->outerPosition().z();
156 float rhoOuter =
muon->combinedMuon()->outerPosition().rho();
157 bool passDepth =
true;
160 if (fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 540.) {
165 else if (fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.) {
170 else if (fabs(zOuter) > 680. && fabs(zOuter) < 880. && rhoOuter < 540.) {
177 goodMuons_it.push_back(
muon);
178 if (
muon->track()->momentum().z() > 0.) {
181 if (
muon->track()->momentum().z() < 0.) {
197 std::cout <<
" nNegativeZ = " << nNegativeZ <<
" nPositiveZ = " << nPositiveZ << std::endl;
199 if (nNegativeZ > 1 || nPositiveZ > 1) {
202 bool trackOK =
false;
204 std::cout <<
" goodMuons_it.size() = " << goodMuons_it.size() << std::endl;
206 for (
size_t iM = 0; iM < goodMuons_it.size(); ++iM) {
210 float deltaR =
pow(
track->phi() - goodMuons_it[iM]->track()->phi(), 2) +
211 pow(
track->eta() - goodMuons_it[iM]->track()->eta(), 2);
215 <<
" dPt = " <<
track->pt() - goodMuons_it[iM]->track()->pt() << std::endl;
217 if (
deltaR > 0.01 || fabs(
track->pt() - goodMuons_it[iM]->track()->pt()) > 0.1) {
224 muonOuterZPosition = goodMuons_it[iM]->combinedMuon()->outerPosition().z();
231 std::cout <<
" failed: trackOK " << std::endl;
251 std::cout <<
"i track = " <<
i <<
" P = " <<
track->p() <<
" chi2/ndf = " <<
track->normalizedChi2()
252 <<
" nSeg = " << segments->size() << std::endl;
259 <<
track->qoverpError() << std::endl;
262 <<
" outer position = " <<
track->outerPosition() << std::endl;
263 std::cout <<
"track eta (outer) = " <<
track->outerPosition().eta()
264 <<
" phi (outer) = " <<
track->outerPosition().phi() << std::endl;
265 if (fabs(
track->innerPosition().z()) > 500.) {
267 std::cout <<
" dump inner state MUON detid = " <<
debug.dumpMuonId(innerDetId) << std::endl;
269 if (fabs(
track->outerPosition().z()) > 500.) {
271 std::cout <<
" dump outer state MUON detid = " <<
debug.dumpMuonId(outerDetId) << std::endl;
287 float dpT_ov_pT = 0.;
288 if (fabs(
track->pt()) > 0.001) {
300 if (!segments->size()) {
308 if (magField && (dpT_ov_pT > 0.5)) {
316 CLHEP::Hep3Vector r3T_inner(
track->innerPosition().x(),
track->innerPosition().y(),
track->innerPosition().z());
317 CLHEP::Hep3Vector r3T(
track->outerPosition().x(),
track->outerPosition().y(),
track->outerPosition().z());
318 chooseDirection(r3T_inner, r3T);
320 CLHEP::Hep3Vector p3T(
track->outerMomentum().x(),
track->outerMomentum().y(),
track->outerMomentum().z());
321 CLHEP::Hep3Vector p3_propagated, r3_propagated;
324 cov_propagated *= 1
e-20;
328 std::cout <<
" p = " <<
track->p() <<
" norm chi2 = " <<
track->normalizedChi2() << std::endl;
329 std::cout <<
" dump the very first FTS = " <<
debug.dumpFTS(ftsStart) << std::endl;
334 if (
track->outerPosition().z() > 0) {
341 std::vector<CSCDetId> refME;
342 for (
int iS = 1; iS < 5; ++iS) {
343 for (
int iR = 1; iR < 4; ++iR) {
344 if (1 != iS && iR > 2) {
346 }
else if (4 == iS && iR > 1) {
353 for (
size_t iSt = 0; iSt < refME.size(); ++iSt) {
355 std::cout <<
"loop iStatation = " << iSt << std::endl;
356 std::cout <<
"refME[iSt]: st = " << refME[iSt].station() <<
" rg = " << refME[iSt].ring() << std::endl;
358 std::map<std::string, bool> chamberTypes;
359 chamberTypes[
"ME11"] =
false;
360 chamberTypes[
"ME12"] =
false;
361 chamberTypes[
"ME13"] =
false;
362 chamberTypes[
"ME21"] =
false;
363 chamberTypes[
"ME22"] =
false;
364 chamberTypes[
"ME31"] =
false;
365 chamberTypes[
"ME32"] =
false;
366 chamberTypes[
"ME41"] =
false;
373 std::cout <<
" dump base iStation detid = " <<
debug.dumpMuonId(detId) << std::endl;
374 std::cout <<
" dump FTS start = " <<
debug.dumpFTS(ftsStart) << std::endl;
377 tSOSDest = propagate(ftsStart, cscGeom->
idToDet(detId)->
surface());
381 std::cout <<
" dump FTS end = " <<
debug.dumpFTS(ftsStart) << std::endl;
382 getFromFTS(ftsStart, p3_propagated, r3_propagated,
charge, cov_propagated);
383 float feta = fabs(r3_propagated.eta());
384 float phi = r3_propagated.phi();
386 ringCandidates(refME[iSt].
station(),
feta, chamberTypes);
388 map<std::string, bool>::iterator iter;
391 for (iter = chamberTypes.begin(); iter != chamberTypes.end(); iter++) {
394 if (iter->second && (iterations - 1) ==
int(iSt)) {
396 std::cout <<
" Chamber type " << iter->first <<
" is a candidate..." << std::endl;
397 std::cout <<
" station() = " << refME[iSt].station() <<
" ring() = " << refME[iSt].ring()
398 <<
" iSt = " << iSt << std::endl;
400 std::vector<int> coupleOfChambers;
402 chamberCandidates(refME[iSt].
station(), refME[iSt].
ring(), phi, coupleOfChambers);
404 for (
size_t iCh = 0; iCh < coupleOfChambers.size(); ++iCh) {
407 std::cout <<
" Check chamber N = " << coupleOfChambers.at(iCh) << std::endl;
409 if ((!getAbsoluteEfficiency) &&
410 (
true == emptyChambers[refME[iSt].
endcap() - 1][refME[iSt].
station() - 1][refME[iSt].
ring() - 1]
411 [coupleOfChambers.at(iCh) -
FirstCh])) {
416 const BoundPlane bpCh = cscGeom->
idToDet(cscChamber->geographicalId())->surface();
418 float dz = fabs(bpCh.position().z() - zFTS);
419 float zDistInner =
track->innerPosition().z() - bpCh.position().z();
420 float zDistOuter =
track->outerPosition().z() - bpCh.position().z();
423 std::cout <<
" zIn = " <<
track->innerPosition().z() <<
" zOut = " <<
track->outerPosition().z()
424 <<
" zSurf = " << bpCh.position().z() << std::endl;
426 if (!isIPdata && (zDistInner * zDistOuter > 0. || fabs(zDistInner) < 15. ||
427 fabs(zDistOuter) < 15.)) {
429 std::cout <<
" Not an intermediate (as defined) point... Skip." << std::endl;
433 if (isIPdata && fabs(
track->eta()) < 1.8) {
434 if (fabs(muonOuterZPosition) - fabs(bpCh.position().z()) < 0 ||
435 fabs(muonOuterZPosition - bpCh.position().z()) < 15.) {
443 tSOSDest = propagate(ftsStart, cscGeom->
idToDet(cscChamber->geographicalId())->surface());
448 std::cout <<
"TSOS not valid! Break." << std::endl;
453 std::cout <<
" info: dz<0.1" << std::endl;
457 bool inDeadZone =
false;
459 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
460 bool extrapolationPassed =
true;
462 std::cout <<
" iLayer = " << iLayer <<
" dump FTS init = " <<
debug.dumpFTS(ftsInit) << std::endl;
463 std::cout <<
" dump detid = " <<
debug.dumpMuonId(cscChamber->geographicalId()) << std::endl;
464 std::cout <<
"Surface to propagate to: pos = " << cscChamber->layer(iLayer + 1)->surface().position()
465 <<
" eta = " << cscChamber->layer(iLayer + 1)->surface().position().eta()
466 <<
" phi = " << cscChamber->layer(iLayer + 1)->surface().position().phi() << std::endl;
469 tSOSDest = propagate(ftsInit, cscChamber->layer(iLayer + 1)->surface());
473 std::cout <<
" Propagation between layers successful: dump FTS end = " <<
debug.dumpFTS(ftsInit)
475 getFromFTS(ftsInit, p3_propagated, r3_propagated,
charge, cov_propagated);
478 std::cout <<
"Propagation between layers not successful - notValid TSOS" << std::endl;
479 extrapolationPassed =
false;
484 if (extrapolationPassed) {
485 GlobalPoint theExtrapolationPoint(r3_propagated.x(), r3_propagated.y(), r3_propagated.z());
486 LocalPoint theLocalPoint = cscChamber->layer(iLayer + 1)->toLocal(theExtrapolationPoint);
488 inDeadZone = (inDeadZone ||
489 !inSensitiveLocalRegion(
490 theLocalPoint.x(), theLocalPoint.y(), refME[iSt].station(), refME[iSt].ring()));
492 std::cout <<
" Candidate chamber: extrapolated LocalPoint = " << theLocalPoint
493 <<
"inDeadZone = " << inDeadZone << std::endl;
508 std::cout <<
"Do efficiencies..." << std::endl;
511 bool angle_flag =
true;
512 angle_flag = efficienciesPerChamber(theCSCId, cscChamber, ftsStart);
513 if (useDigis && angle_flag) {
514 stripWire_Efficiencies(theCSCId, ftsStart);
517 recHitSegment_Efficiencies(theCSCId, cscChamber, ftsStart);
519 recSimHitEfficiency(theCSCId, ftsStart);
524 std::cout <<
" Not in active area for all layers" << std::endl;
534 std::cout <<
" TSOS not valid..." << std::endl;
540 printf(
"==exit===CSCEfficiency===== run %u\tevent %llu\n\n", iRun,
iEvent);
548 std::vector<double> chamberBounds(3);
549 float y_center = 99999.;
553 chamberBounds[0] = 66.46 / 2;
554 chamberBounds[1] = 127.15 / 2;
555 chamberBounds[2] = 323.06 / 2;
559 chamberBounds[0] = 54.00 / 2;
560 chamberBounds[1] = 125.71 / 2;
561 chamberBounds[2] = 189.66 / 2;
564 chamberBounds[0] = 61.40 / 2;
565 chamberBounds[1] = 125.71 / 2;
566 chamberBounds[2] = 169.70 / 2;
569 chamberBounds[0] = 69.01 / 2;
570 chamberBounds[1] = 125.65 / 2;
571 chamberBounds[2] = 149.42 / 2;
577 chamberBounds[0] = 63.40 / 2;
578 chamberBounds[1] = 92.10 / 2;
579 chamberBounds[2] = 164.16 / 2;
581 }
else if (2 ==
ring) {
582 chamberBounds[0] = 51.00 / 2;
583 chamberBounds[1] = 83.74 / 2;
584 chamberBounds[2] = 174.49 / 2;
587 chamberBounds[0] = 30. / 2;
588 chamberBounds[1] = 60. / 2;
589 chamberBounds[2] = 160. / 2;
593 double yUp = chamberBounds[2] + y_center;
594 double yDown = -chamberBounds[2] + y_center;
595 double xBound1Shifted = chamberBounds[0] - distanceFromDeadZone;
596 double xBound2Shifted = chamberBounds[1] - distanceFromDeadZone;
597 double lineSlope = (yUp - yDown) / (xBound2Shifted - xBound1Shifted);
598 double lineConst = yUp - lineSlope * xBound2Shifted;
599 double yBoundary = lineSlope *
abs(xLocal) + lineConst;
600 pass = checkLocal(yLocal, yBoundary,
station,
ring);
607 std::vector<float> deadZoneCenter(6);
608 const float deadZoneHalf = 0.32 * 7 / 2;
609 float cutZone = deadZoneHalf + distanceFromDeadZone;
613 deadZoneCenter[0] = -162.48;
614 deadZoneCenter[1] = -81.8744;
615 deadZoneCenter[2] = -21.18165;
616 deadZoneCenter[3] = 39.51105;
617 deadZoneCenter[4] = 100.2939;
618 deadZoneCenter[5] = 160.58;
620 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
621 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
622 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone) ||
623 (yLocal > deadZoneCenter[3] + cutZone && yLocal < deadZoneCenter[4] - cutZone) ||
624 (yLocal > deadZoneCenter[4] + cutZone && yLocal < deadZoneCenter[5] - cutZone))) {
627 }
else if (1 ==
ring) {
629 deadZoneCenter[0] = -95.94;
630 deadZoneCenter[1] = -27.47;
631 deadZoneCenter[2] = 33.67;
632 deadZoneCenter[3] = 93.72;
634 deadZoneCenter[0] = -85.97;
635 deadZoneCenter[1] = -36.21;
636 deadZoneCenter[2] = 23.68;
637 deadZoneCenter[3] = 84.04;
639 deadZoneCenter[0] = -75.82;
640 deadZoneCenter[1] = -26.14;
641 deadZoneCenter[2] = 23.85;
642 deadZoneCenter[3] = 73.91;
644 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
645 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
646 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
652 deadZoneCenter[0] = -83.155;
653 deadZoneCenter[1] = -22.7401;
654 deadZoneCenter[2] = 27.86665;
655 deadZoneCenter[3] = 81.005;
656 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
657 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
658 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
661 }
else if (2 ==
ring) {
662 deadZoneCenter[0] = -86.285;
663 deadZoneCenter[1] = -32.88305;
664 deadZoneCenter[2] = 32.867423;
665 deadZoneCenter[3] = 88.205;
666 if (yLocal > (yBoundary) && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
667 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
668 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
672 deadZoneCenter[0] = -81.0;
673 deadZoneCenter[1] = 81.0;
674 if (yLocal > (yBoundary) && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone))) {
691 for (
int iE = 0; iE < 2; iE++) {
692 for (
int iS = 0; iS < 4; iS++) {
693 for (
int iR = 0; iR < 4; iR++) {
694 for (
int iC = 0; iC <
NumCh; iC++) {
695 allSegments[iE][iS][iR][iC].clear();
696 allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] =
false;
697 for (
int iL = 0; iL < 6; iL++) {
698 allStrips[iE][iS][iR][iC][iL].clear();
699 allWG[iE][iS][iR][iC][iL].clear();
700 allRechits[iE][iS][iR][iC][iL].clear();
701 allSimhits[iE][iS][iR][iC][iL].clear();
709 fillLCT_info(alcts, clcts, correlatedlcts);
710 fillWG_info(
wires, cscGeom);
713 fillRechitsSegments_info(
rechits, segments, cscGeom);
730 if ((*digiIt).isValid()) {
731 allALCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
735 ALCTPerEvent->Fill(nSize);
741 std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
742 std::vector<CSCCLCTDigi>::const_iterator
last = (*j).second.second;
743 for (; digiIt !=
last; ++digiIt) {
745 if ((*digiIt).isValid()) {
746 allCLCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
750 CLCTPerEvent->Fill(nSize);
754 std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
755 std::vector<CSCCorrelatedLCTDigi>::const_iterator
last = (*j).second.second;
756 for (; digiIt !=
last; ++digiIt) {
758 if ((*digiIt).isValid()) {
759 allCorrLCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
772 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
773 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
775 for (; digiItr !=
last; ++digiItr) {
776 std::pair<int, float> WG_pos(digiItr->getWireGroup(), layerGeom->
yOfWireGroup(digiItr->getWireGroup()));
777 std::pair<std::pair<int, float>,
int> LayerSignal(WG_pos, digiItr->getTimeBin());
780 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]);
804 float peakADC = -1000.;
805 for (
int myADCVal : myADCVals) {
806 float diff = (
float)myADCVal - thisPedestal;
808 if (myADCVal > largestADCValue)
809 largestADCValue = myADCVal;
814 if (largestADCValue > maxADC) {
815 std::pair<int, float> LayerSignal(myStrip, peakADC);
818 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].clear();
819 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].push_back(
827 edm::PSimHitContainer::const_iterator dSHsimIter;
828 for (dSHsimIter =
simhits->begin(); dSHsimIter !=
simhits->end(); dSHsimIter++) {
831 std::pair<LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
844 printf(
" The size of the rechit collection is %i\n",
int(
rechits->size()));
847 recHitsPerEvent->Fill(
rechits->size());
850 for (recIt =
rechits->begin(); recIt !=
rechits->end(); recIt++) {
855 LocalPoint rhitlocal = (*recIt).localPosition();
856 LocalError rerrlocal = (*recIt).localPositionError();
858 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
864 printf(
"\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
875 std::pair<LocalPoint, bool> recHitPos((*recIt).localPosition(),
false);
876 allRechits[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][
id.layer() - 1].push_back(
880 for (
int iE = 0; iE < 2; iE++) {
881 for (
int iS = 0; iS < 4; iS++) {
882 for (
int iR = 0; iR < 4; iR++) {
883 for (
int iC = 0; iC <
NumCh; iC++) {
885 for (
int iL = 0; iL < 6; iL++) {
886 if (!allRechits[iE][iS][iR][iC][iL].
empty()) {
891 emptyChambers[iE][iS][iR][iC] =
false;
893 emptyChambers[iE][iS][iR][iC] =
true;
902 printf(
" The size of the segment collection is %i\n",
int(segments->size()));
905 segmentsPerEvent->Fill(segments->size());
908 StHist[
id.endcap() - 1][
id.station() - 1].segmentChi2_ndf->Fill((*it).chi2() / (*it).degreesOfFreedom());
909 StHist[
id.endcap() - 1][
id.station() - 1].hitsInSegment->Fill((*it).nRecHits());
912 std::cout <<
"\tposition(loc) = " << (*it).localPosition() <<
" error(loc) = " << (*it).localPositionError()
914 std::cout <<
"\t chi2/ndf = " << (*it).chi2() / (*it).degreesOfFreedom() <<
" nhits = " << (*it).nRecHits()
917 allSegments[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh].push_back(
918 make_pair((*it).localPosition(), (*it).localDirection()));
922 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
923 int nRH = (*it).nRecHits();
925 printf(
"\tGet the recHits for this segment.\t");
926 printf(
" nRH = %i\n", nRH);
930 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
934 printf(
"\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
947 float xDiff = iRH->localPosition().x() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
950 float yDiff = iRH->localPosition().y() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
953 if (fabs(xDiff) < 0.0001 && fabs(yDiff) < 0.0001) {
954 std::pair<LocalPoint, bool> recHitPos(allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
961 std::cout <<
" number of the rechit (from zero) in the segment = " << jRH << std::endl;
975 chamberTypes[
"ME13"] =
true;
978 chamberTypes[
"ME12"] =
true;
981 chamberTypes[
"ME11"] =
true;
986 chamberTypes[
"ME22"] =
true;
989 chamberTypes[
"ME21"] =
true;
994 chamberTypes[
"ME32"] =
true;
997 chamberTypes[
"ME31"] =
true;
1002 chamberTypes[
"ME41"] =
true;
1011 coupleOfChambers.clear();
1013 float phi_zero = 0.;
1014 float phi_const = 2. *
M_PI / 36.;
1015 int last_chamber = 36;
1016 int first_chamber = 1;
1023 std::cout <<
" info: negative phi = " << phi << std::endl;
1026 float chamber_float = (phi - phi_zero) / phi_const;
1027 int chamber_int =
int(chamber_float);
1028 if (chamber_float -
float(chamber_int) - 0.5 < 0.) {
1029 if (0 != chamber_int) {
1030 coupleOfChambers.push_back(chamber_int);
1032 coupleOfChambers.push_back(last_chamber);
1034 coupleOfChambers.push_back(chamber_int + 1);
1037 coupleOfChambers.push_back(chamber_int + 1);
1038 if (last_chamber != chamber_int + 1) {
1039 coupleOfChambers.push_back(chamber_int + 2);
1041 coupleOfChambers.push_back(first_chamber);
1045 std::cout <<
" phi = " << phi <<
" phi_zero = " << phi_zero <<
" phi_const = " << phi_const
1046 <<
" candidate chambers: first ch = " << coupleOfChambers[0] <<
" second ch = " << coupleOfChambers[1]
1054 int ec, st, rg, ch, secondRing;
1055 returnTypes(
id, ec, st, rg, ch, secondRing);
1060 std::cout <<
" local dir = " << localDir << std::endl;
1063 float dxdz = localDir.
x() / localDir.
z();
1064 float dydz = localDir.
y() / localDir.
z();
1065 if (2 == st || 3 == st) {
1067 std::cout <<
"st 3 or 4 ... flip dy/dz" << std::endl;
1076 if (applyIPangleCuts) {
1077 if (
dydz > local_DY_DZ_Max ||
dydz < local_DY_DZ_Min || fabs(
dxdz) > local_DX_DZ_Max) {
1083 bool firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1084 bool secondCondition =
false;
1086 if (secondRing > -1) {
1087 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1089 if (firstCondition || secondCondition) {
1091 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1095 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1101 firstCondition = allALCT[ec][st][rg][ch];
1102 secondCondition =
false;
1103 if (secondRing > -1) {
1104 secondCondition = allALCT[ec][st][secondRing][ch];
1106 if (firstCondition || secondCondition) {
1108 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1111 if (fabs(
dxdz) < local_DX_DZ_Max) {
1112 StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1113 ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(
dydz);
1117 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1119 if (fabs(
dxdz) < local_DX_DZ_Max) {
1120 StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1121 ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(
dydz);
1125 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1130 firstCondition = allCLCT[ec][st][rg][ch];
1131 secondCondition =
false;
1132 if (secondRing > -1) {
1133 secondCondition = allCLCT[ec][st][secondRing][ch];
1135 if (firstCondition || secondCondition) {
1137 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1139 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1140 StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1141 ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(
dxdz);
1145 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1147 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1148 StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1149 ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(
dxdz);
1153 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1158 firstCondition = allCorrLCT[ec][st][rg][ch];
1159 secondCondition =
false;
1160 if (secondRing > -1) {
1161 secondCondition = allCorrLCT[ec][st][secondRing][ch];
1163 if (firstCondition || secondCondition) {
1164 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1166 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1175 int ec, st, rg, ch, secondRing;
1176 returnTypes(
id, ec, st, rg, ch, secondRing);
1178 bool firstCondition, secondCondition;
1179 int missingLayers_s = 0;
1180 int missingLayers_wg = 0;
1181 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1184 printf(
"\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1192 << allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1194 << allWG[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1197 firstCondition = !allStrips[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1199 secondCondition =
false;
1200 if (secondRing > -1) {
1201 secondCondition = !allStrips[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1203 if (firstCondition || secondCondition) {
1204 ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer + 1);
1208 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1217 firstCondition = !allWG[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1218 secondCondition =
false;
1219 if (secondRing > -1) {
1220 secondCondition = !allWG[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1222 if (firstCondition || secondCondition) {
1223 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer + 1);
1227 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1237 if (6 != missingLayers_s) {
1238 ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1240 if (6 != missingLayers_wg) {
1241 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1243 ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1244 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1246 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1247 if (missingLayers_s != missingLayers_wg) {
1248 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1249 if (6 == missingLayers_wg) {
1250 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1251 ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.
momentum().
theta());
1253 if (6 == missingLayers_s) {
1254 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1255 ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.
momentum().
theta());
1257 }
else if (6 == missingLayers_s) {
1258 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1265 int ec, st, rg, ch, secondRing;
1266 returnTypes(
id, ec, st, rg, ch, secondRing);
1267 bool firstCondition, secondCondition;
1268 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1269 firstCondition = !allSimhits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1270 secondCondition =
false;
1272 if (secondRing > -1) {
1273 secondCondition = !allSimhits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1274 if (secondCondition) {
1275 thisRing = secondRing;
1278 if (firstCondition || secondCondition) {
1279 for (
size_t iSH = 0; iSH < allSimhits[ec][st][thisRing][ch][iLayer].size(); ++iSH) {
1280 if (13 == fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].
second)) {
1281 ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer + 1);
1282 if (!allRechits[ec][st][thisRing][ch][iLayer].
empty()) {
1283 ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer + 1);
1311 int ec, st, rg, ch, secondRing;
1312 returnTypes(
id, ec, st, rg, ch, secondRing);
1313 bool firstCondition, secondCondition;
1315 std::vector<bool> missingLayers_rh(6);
1316 std::vector<int> usedInSegment(6);
1319 std::cout <<
"RecHits eff" << std::endl;
1320 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1321 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1322 secondCondition =
false;
1324 if (secondRing > -1) {
1325 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1326 if (secondCondition) {
1327 thisRing = secondRing;
1330 if (firstCondition || secondCondition) {
1331 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer + 1);
1332 for (
size_t iR = 0; iR < allRechits[ec][st][thisRing][ch][iLayer].size(); ++iR) {
1333 if (allRechits[ec][st][thisRing][ch][iLayer][iR].
second) {
1334 usedInSegment[iLayer] = 1;
1337 usedInSegment[iLayer] = -1;
1341 missingLayers_rh[iLayer] =
true;
1344 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1356 firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1357 secondCondition =
false;
1360 if (secondRing > -1) {
1361 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1362 secondSize = allSegments[ec][st][secondRing][ch].size();
1363 if (secondCondition) {
1364 thisRing = secondRing;
1367 if (firstCondition || secondCondition) {
1369 std::cout <<
"segments - start ec = " << ec <<
" st = " << st <<
" rg = " << rg <<
" ch = " << ch << std::endl;
1370 StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1371 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1372 globalDir = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
second);
1373 globalPos = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
first);
1374 StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1379 std::cout <<
" fts.position() = " << ftsChamber.
position() <<
" segPos = " << globalPos <<
" res = " << residual
1381 StHist[ec][st].ResidualSegments->Fill(residual);
1383 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1385 std::cout <<
" iLayer = " << iLayer <<
" usedInSegment = " << usedInSegment[iLayer] << std::endl;
1386 if (0 != usedInSegment[iLayer]) {
1387 if (-1 == usedInSegment[iLayer]) {
1388 ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer + 1);
1390 ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer + 1);
1392 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1393 secondCondition =
false;
1394 if (secondRing > -1) {
1395 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1397 float stripAngle = 99999.;
1398 std::vector<float> posXY(2);
1399 bool oneSegment =
false;
1400 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1403 linearExtrapolation(globalPos, globalDir, bp.position().z(), posXY);
1404 GlobalPoint gp_extrapol(posXY.at(0), posXY.at(1), bp.position().z());
1406 posXY.at(0) = lp_extrapol.
x();
1407 posXY.at(1) = lp_extrapol.y();
1411 if (firstCondition || secondCondition) {
1412 ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer + 1);
1414 ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1415 ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1419 ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1420 ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1425 StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1427 std::cout <<
"missing segment " << std::endl;
1433 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1434 if (allSegments[ec][st][rg][ch].
size() + secondSize < 2) {
1435 StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1437 ChHist[ec][st][rg][
id.chamber() -
FirstCh].EfficientRechits_inSegment->Fill(9);
1443 ec =
id.endcap() - 1;
1444 st =
id.station() - 1;
1456 CLHEP::Hep3Vector &
p3,
1457 CLHEP::Hep3Vector &r3,
1463 p3.set(p3GV.
x(), p3GV.
y(), p3GV.
z());
1464 r3.set(r3GP.
x(), r3GP.
y(), r3GP.
z());
1471 const CLHEP::Hep3Vector &r3,
1487 std::vector<float> &posZY) {
1488 double paramLine = lineParameter(initialPosition.
z(), zSurface, initialDirection.
z());
1489 double xPosition = extrapolate1D(initialPosition.
x(), initialDirection.
x(), paramLine);
1490 double yPosition = extrapolate1D(initialPosition.
y(), initialDirection.
y(), paramLine);
1492 posZY.push_back(xPosition);
1493 posZY.push_back(yPosition);
1497 double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine;
1498 return extrapolatedPosition;
1502 double paramLine = (destZPosition - initZPosition) / initZDirection;
1509 float dy = outerPosition.y() - innerPosition.y();
1510 float dz = outerPosition.z() - innerPosition.z();
1561 bool triggerPassed =
true;
1562 std::vector<std::string> hlNames =
triggerNames.triggerNames();
1563 pointToTriggers.clear();
1564 for (
size_t imyT = 0; imyT < myTriggers.size(); ++imyT) {
1565 for (
size_t iT = 0; iT < hlNames.size(); ++iT) {
1572 TriggersFired->Fill(iT);
1575 if (hlNames[iT] == myTriggers[imyT]) {
1576 pointToTriggers.push_back(iT);
1583 if (pointToTriggers.size() != myTriggers.size()) {
1584 pointToTriggers.clear();
1586 std::cout <<
" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!" 1590 if (!pointToTriggers.empty()) {
1592 std::cout <<
"The following triggers will be required in the event: " << std::endl;
1593 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1594 std::cout <<
" " << hlNames[pointToTriggers[imyT]];
1603 if (pointToTriggers.empty()) {
1606 <<
" No triggers specified in the configuration or all ignored - no trigger information will be considered" 1610 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1611 if (hltR->
wasrun(pointToTriggers[imyT]) && hltR->
accept(pointToTriggers[imyT]) &&
1612 !hltR->
error(pointToTriggers[imyT])) {
1613 triggerPassed =
true;
1618 triggerPassed =
false;
1620 triggerPassed =
false;
1627 std::cout <<
" TriggerResults handle returns invalid state?! No trigger information will be considered" 1632 std::cout <<
" Trigger passed: " << triggerPassed << std::endl;
1634 return triggerPassed;
1643 const float Ymin = -165;
1644 const float Ymax = 165;
1645 const int nYbins =
int((Ymax - Ymin) / 2);
1646 const float Layer_min = -0.5;
1647 const float Layer_max = 9.5;
1648 const int nLayer_bins =
int(Layer_max - Layer_min);
1652 printout_NEvents =
pset.getUntrackedParameter<
unsigned int>(
"printout_NEvents", 0);
1653 rootFileName =
pset.getUntrackedParameter<
string>(
"rootFileName",
"cscHists.root");
1655 isData =
pset.getUntrackedParameter<
bool>(
"runOnData",
true);
1656 isIPdata =
pset.getUntrackedParameter<
bool>(
"IPdata",
false);
1657 isBeamdata =
pset.getUntrackedParameter<
bool>(
"Beamdata",
false);
1658 getAbsoluteEfficiency =
pset.getUntrackedParameter<
bool>(
"getAbsoluteEfficiency",
true);
1659 useDigis =
pset.getUntrackedParameter<
bool>(
"useDigis",
true);
1660 distanceFromDeadZone =
pset.getUntrackedParameter<
double>(
"distanceFromDeadZone", 10.);
1661 minP =
pset.getUntrackedParameter<
double>(
"minP", 20.);
1662 maxP =
pset.getUntrackedParameter<
double>(
"maxP", 100.);
1664 minTrackHits =
pset.getUntrackedParameter<
unsigned int>(
"minTrackHits", 10);
1666 applyIPangleCuts =
pset.getUntrackedParameter<
bool>(
"applyIPangleCuts",
false);
1667 local_DY_DZ_Max =
pset.getUntrackedParameter<
double>(
"local_DY_DZ_Max", -0.1);
1668 local_DY_DZ_Min =
pset.getUntrackedParameter<
double>(
"local_DY_DZ_Min", -0.8);
1669 local_DX_DZ_Max =
pset.getUntrackedParameter<
double>(
"local_DX_DZ_Max", 0.2);
1671 sd_token = consumes<CSCStripDigiCollection>(
pset.getParameter<
edm::InputTag>(
"stripDigiTag"));
1672 wd_token = consumes<CSCWireDigiCollection>(
pset.getParameter<
edm::InputTag>(
"wireDigiTag"));
1673 al_token = consumes<CSCALCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"alctDigiTag"));
1674 cl_token = consumes<CSCCLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"clctDigiTag"));
1675 co_token = consumes<CSCCorrelatedLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"corrlctDigiTag"));
1676 rh_token = consumes<CSCRecHit2DCollection>(
pset.getParameter<
edm::InputTag>(
"rechitTag"));
1677 se_token = consumes<CSCSegmentCollection>(
pset.getParameter<
edm::InputTag>(
"segmentTag"));
1678 tk_token = consumes<edm::View<reco::Track> >(
pset.getParameter<
edm::InputTag>(
"tracksTag"));
1679 sh_token = consumes<edm::PSimHitContainer>(
pset.getParameter<
edm::InputTag>(
"simHitTag"));
1681 geomToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
1688 useTrigger =
pset.getUntrackedParameter<
bool>(
"useTrigger",
false);
1690 ht_token = consumes<edm::TriggerResults>(
pset.getParameter<
edm::InputTag>(
"HLTriggerResults"));
1692 myTriggers =
pset.getParameter<std::vector<std::string> >(
"myTriggers");
1693 andOr =
pset.getUntrackedParameter<
bool>(
"andOr");
1694 pointToTriggers.clear();
1697 nEventsAnalyzed = 0;
1709 sprintf(SpecName,
"DataFlow");
1710 DataFlow =
new TH1F(SpecName,
"Data flow;condition number;entries", 40, -0.5, 39.5);
1712 sprintf(SpecName,
"TriggersFired");
1713 TriggersFired =
new TH1F(SpecName,
"Triggers fired;trigger number;entries", 140, -0.5, 139.5);
1716 float minChan = -0.5;
1717 float maxChan = 49.5;
1719 sprintf(SpecName,
"ALCTPerEvent");
1720 ALCTPerEvent =
new TH1F(SpecName,
"ALCTs per event;N digis;entries", Chan, minChan, maxChan);
1722 sprintf(SpecName,
"CLCTPerEvent");
1723 CLCTPerEvent =
new TH1F(SpecName,
"CLCTs per event;N digis;entries", Chan, minChan, maxChan);
1725 sprintf(SpecName,
"recHitsPerEvent");
1726 recHitsPerEvent =
new TH1F(SpecName,
"RecHits per event;N digis;entries", 150, -0.5, 149.5);
1728 sprintf(SpecName,
"segmentsPerEvent");
1729 segmentsPerEvent =
new TH1F(SpecName,
"segments per event;N digis;entries", Chan, minChan, maxChan);
1733 map<std::string, bool>::iterator iter;
1734 for (
int ec = 0; ec < 2; ++ec) {
1735 for (
int st = 0; st < 4; ++st) {
1737 sprintf(SpecName,
"Stations__E%d_S%d", ec + 1, st + 1);
1742 sprintf(SpecName,
"segmentChi2_ndf_St%d", st + 1);
1743 StHist[ec][st].segmentChi2_ndf =
new TH1F(SpecName,
"Chi2/ndf of a segment;chi2/ndf;entries", 100, 0., 20.);
1745 sprintf(SpecName,
"hitsInSegment_St%d", st + 1);
1746 StHist[ec][st].hitsInSegment =
new TH1F(SpecName,
"Number of hits in a segment;nHits;entries", 7, -0.5, 6.5);
1752 sprintf(SpecName,
"AllSegments_eta_St%d", st + 1);
1753 StHist[ec][st].AllSegments_eta =
new TH1F(SpecName,
"All segments in eta;eta;entries", Chan, minChan, maxChan);
1755 sprintf(SpecName,
"EfficientSegments_eta_St%d", st + 1);
1756 StHist[ec][st].EfficientSegments_eta =
1757 new TH1F(SpecName,
"Efficient segments in eta;eta;entries", Chan, minChan, maxChan);
1759 sprintf(SpecName,
"ResidualSegments_St%d", st + 1);
1760 StHist[ec][st].ResidualSegments =
new TH1F(SpecName,
"Residual (segments);residual,cm;entries", 75, 0., 15.);
1766 float minChan2 = -800.;
1767 float maxChan2 = 800.;
1769 sprintf(SpecName,
"EfficientSegments_XY_St%d", st + 1);
1770 StHist[ec][st].EfficientSegments_XY =
1771 new TH2F(SpecName,
"Efficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1772 sprintf(SpecName,
"InefficientSegments_XY_St%d", st + 1);
1773 StHist[ec][st].InefficientSegments_XY =
1774 new TH2F(SpecName,
"Inefficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1779 sprintf(SpecName,
"EfficientALCT_momTheta_St%d", st + 1);
1780 StHist[ec][st].EfficientALCT_momTheta =
1781 new TH1F(SpecName,
"Efficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1783 sprintf(SpecName,
"InefficientALCT_momTheta_St%d", st + 1);
1784 StHist[ec][st].InefficientALCT_momTheta =
1785 new TH1F(SpecName,
"Inefficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1790 sprintf(SpecName,
"EfficientCLCT_momPhi_St%d", st + 1);
1791 StHist[ec][st].EfficientCLCT_momPhi =
1792 new TH1F(SpecName,
"Efficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1794 sprintf(SpecName,
"InefficientCLCT_momPhi_St%d", st + 1);
1795 StHist[ec][st].InefficientCLCT_momPhi =
1796 new TH1F(SpecName,
"Inefficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1799 for (
int rg = 0; rg < 3; ++rg) {
1800 if (0 != st && rg > 1) {
1802 }
else if (1 == rg && 3 == st) {
1806 if (0 != st && 0 == rg && iChamber > 18) {
1810 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
1815 sprintf(SpecName,
"EfficientRechits_inSegment_Ch%d", iChamber);
1816 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment =
new TH1F(
1817 SpecName,
"Existing RecHit given a segment;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1819 sprintf(SpecName,
"InefficientSingleHits_Ch%d", iChamber);
1820 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits =
new TH1F(
1821 SpecName,
"Single RecHits not in the segment;layers (1-6);entries ", nLayer_bins, Layer_min, Layer_max);
1823 sprintf(SpecName,
"AllSingleHits_Ch%d", iChamber);
1824 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits =
new TH1F(
1825 SpecName,
"Single RecHits given a segment; layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1827 sprintf(SpecName,
"digiAppearanceCount_Ch%d", iChamber);
1828 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount =
1830 "Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1838 sprintf(SpecName,
"EfficientALCT_dydz_Ch%d", iChamber);
1839 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz =
1840 new TH1F(SpecName,
"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1842 sprintf(SpecName,
"InefficientALCT_dydz_Ch%d", iChamber);
1843 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz =
1844 new TH1F(SpecName,
"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1849 sprintf(SpecName,
"EfficientCLCT_dxdz_Ch%d", iChamber);
1850 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz =
1851 new TH1F(SpecName,
"Efficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1853 sprintf(SpecName,
"InefficientCLCT_dxdz_Ch%d", iChamber);
1854 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz =
1855 new TH1F(SpecName,
"Inefficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1857 sprintf(SpecName,
"EfficientRechits_good_Ch%d", iChamber);
1858 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good =
new TH1F(
1859 SpecName,
"Existing RecHit - sensitive area only;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1861 sprintf(SpecName,
"EfficientStrips_Ch%d", iChamber);
1862 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips =
1863 new TH1F(SpecName,
"Existing strip;layer (1-6); entries", nLayer_bins, Layer_min, Layer_max);
1865 sprintf(SpecName,
"EfficientWireGroups_Ch%d", iChamber);
1866 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups =
1867 new TH1F(SpecName,
"Existing WireGroups;layer (1-6); entries ", nLayer_bins, Layer_min, Layer_max);
1869 sprintf(SpecName,
"StripWiresCorrelations_Ch%d", iChamber);
1870 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations =
1871 new TH1F(SpecName,
"StripWire correlations;; entries ", 5, 0.5, 5.5);
1876 sprintf(SpecName,
"NoWires_momTheta_Ch%d", iChamber);
1877 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta =
1879 "No wires (all strips present) - in theta (momentum);theta, rad;entries",
1887 sprintf(SpecName,
"NoStrips_momPhi_Ch%d", iChamber);
1888 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi =
new TH1F(
1889 SpecName,
"No strips (all wires present) - in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1891 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1892 sprintf(SpecName,
"Y_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1893 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment.push_back(
1895 "Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1900 sprintf(SpecName,
"Y_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1901 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment.push_back(
1903 "Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole " 1904 "chamber);Y, cm; entries",
1912 sprintf(SpecName,
"Phi_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1913 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment.push_back(
1915 "Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1920 sprintf(SpecName,
"Phi_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1921 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment.push_back(
1923 "Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, " 1930 sprintf(SpecName,
"Sim_Rechits_Ch%d", iChamber);
1931 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits =
1932 new TH1F(SpecName,
"Existing RecHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1934 sprintf(SpecName,
"Sim_Simhits_Ch%d", iChamber);
1935 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits =
1936 new TH1F(SpecName,
"Existing SimHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1963 std::vector<float> eff(2);
1966 std::map<std::string, bool> chamberTypes;
1967 chamberTypes[
"ME11"] =
false;
1968 chamberTypes[
"ME12"] =
false;
1969 chamberTypes[
"ME13"] =
false;
1970 chamberTypes[
"ME21"] =
false;
1971 chamberTypes[
"ME22"] =
false;
1972 chamberTypes[
"ME31"] =
false;
1973 chamberTypes[
"ME32"] =
false;
1974 chamberTypes[
"ME41"] =
false;
1976 map<std::string, bool>::iterator iter;
1977 std::cout <<
" Writing proper histogram structure (patience)..." << std::endl;
1978 for (
int ec = 0; ec < 2; ++ec) {
1979 for (
int st = 0; st < 4; ++st) {
1980 snprintf(SpecName,
sizeof(SpecName),
"Stations__E%d_S%d", ec + 1, st + 1);
1982 StHist[ec][st].segmentChi2_ndf->Write();
1983 StHist[ec][st].hitsInSegment->Write();
1984 StHist[ec][st].AllSegments_eta->Write();
1985 StHist[ec][st].EfficientSegments_eta->Write();
1986 StHist[ec][st].ResidualSegments->Write();
1987 StHist[ec][st].EfficientSegments_XY->Write();
1988 StHist[ec][st].InefficientSegments_XY->Write();
1989 StHist[ec][st].EfficientALCT_momTheta->Write();
1990 StHist[ec][st].InefficientALCT_momTheta->Write();
1991 StHist[ec][st].EfficientCLCT_momPhi->Write();
1992 StHist[ec][st].InefficientCLCT_momPhi->Write();
1993 for (
int rg = 0; rg < 3; ++rg) {
1994 if (0 != st && rg > 1) {
1996 }
else if (1 == rg && 3 == st) {
2000 if (0 != st && 0 == rg && iChamber > 18) {
2003 snprintf(SpecName,
sizeof(SpecName),
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
2006 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment->Write();
2007 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits->Write();
2008 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount->Write();
2009 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz->Write();
2010 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz->Write();
2011 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz->Write();
2012 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz->Write();
2013 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits->Write();
2014 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good->Write();
2015 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips->Write();
2016 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations->Write();
2017 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta->Write();
2018 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi->Write();
2019 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups->Write();
2020 for (
unsigned int iLayer = 0; iLayer < 6; iLayer++) {
2021 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
2022 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
2023 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2024 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2026 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits->Write();
2027 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits->Write();
2040 snprintf(SpecName,
sizeof(SpecName),
"AllChambers");
2044 TriggersFired->Write();
2045 ALCTPerEvent->Write();
2046 CLCTPerEvent->Write();
2047 recHitsPerEvent->Write();
2048 segmentsPerEvent->Write();
bool accept() const
Has at least one path accepted the event?
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
CartesianTrajectoryError cartesianError() const
bool error() const
Has any path encountered an error (exception)
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
const math::XYZPoint & outerPosition() const
position of the outermost hit
const Point & position() const
position
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
int nearestStrip(const LocalPoint &lp) const
void fillWG_info(edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
void ringCandidates(int station, float absEta, std::map< std::string, bool > &chamberTypes)
Geom::Phi< T > phi() const
double lineParameter(double initZPosition, double destZPosition, double initZDirection)
T const * product() const
unsigned long long EventNumber_t
const Propagator * propagator(std::string propagatorName) const
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
float stripAngle(int strip) const
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
float caloCompatibility(const reco::Muon &muon)
const CSCLayerGeometry * geometry() const
bool wasrun() const
Was at least one path run?
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)
GlobalPoint position() const
U second(std::pair< T, U > const &p)
C::const_iterator const_iterator
constant access iterator type
TrackCharge charge() const
GlobalVector momentum() const
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
float yOfWireGroup(int wireGroup, float x=0.) const
void getFromFTS(const FreeTrajectoryState &fts, CLHEP::Hep3Vector &p3, CLHEP::Hep3Vector &r3, int &charge, AlgebraicSymMatrix66 &cov)
DetId geographicalId() const
The label of this GeomDet.
bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
void chamberCandidates(int station, int ring, float phi, std::vector< int > &coupleOfChambers)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
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)
bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
const Plane & surface() const
The nominal surface of the GeomDet.
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 PositionType & position() const
bool filter(edm::Event &event, const edm::EventSetup &eventSetup) override
std::pair< const_iterator, const_iterator > Range
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
std::vector< DigiType >::const_iterator const_iterator
~CSCEfficiency() override
Destructor.
bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring)
bool checkLocal(double yLocal, double yBoundary, int station, int ring)
const AlgebraicSymMatrix66 & matrix() const
FreeTrajectoryState const * freeState(bool withErrors=true) const
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
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
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Power< A, B >::type pow(const A &a, const B &b)
Geom::Theta< T > theta() const
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
const GeomDet * idToDet(DetId) const override
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)