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");
84 bool triggerPassed =
true;
90 event.getByToken(ht_token, hltR);
99 if (theService->magneticField()->inTesla(gpZero).mag2() < 0.1) {
110 event.getByLabel(muonTag_,
muons);
113 event.getByLabel(
"offlineBeamSpot", beamSpotHandle);
116 std::vector<reco::MuonCollection::const_iterator> goodMuons_it;
117 unsigned int nPositiveZ = 0;
118 unsigned int nNegativeZ = 0;
119 float muonOuterZPosition = -99999.;
127 <<
" pt = " <<
muon->pt() <<
" eta = " <<
muon->eta() <<
" phi = " <<
muon->phi()
128 <<
" matches = " <<
muon->matches().size()
130 <<
" GLB/TR/STA = " <<
muon->isGlobalMuon() <<
"/" <<
muon->isTrackerMuon() <<
"/"
131 <<
muon->isStandAloneMuon() << std::endl;
133 if (!(
muon->isTrackerMuon() &&
muon->isGlobalMuon())) {
138 (
muon->isolationR03().sumPt +
muon->isolationR03().emEt +
muon->isolationR03().hadEt) /
muon->track()->pt();
140 std::cout <<
" relISO = " << relISO <<
" emVetoEt = " <<
muon->isolationR03().emVetoEt
142 <<
" dxy = " << fabs(
muon->track()->dxy(vertexBeamSpot.
position())) << std::endl;
146 fabs(
muon->track()->dxy(vertexBeamSpot.
position())) > 0.2 ||
muon->pt() < 6.) {
150 if (
muon->track()->hitPattern().numberOfValidPixelHits() < 1 ||
151 muon->track()->hitPattern().numberOfValidTrackerHits() < 11 ||
152 muon->combinedMuon()->hitPattern().numberOfValidMuonHits() < 1 ||
153 muon->combinedMuon()->normalizedChi2() > 10. ||
muon->numberOfMatches() < 2) {
157 float zOuter =
muon->combinedMuon()->outerPosition().z();
158 float rhoOuter =
muon->combinedMuon()->outerPosition().rho();
159 bool passDepth =
true;
162 if (fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 540.) {
167 else if (fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.) {
172 else if (fabs(zOuter) > 680. && fabs(zOuter) < 880. && rhoOuter < 540.) {
179 goodMuons_it.push_back(
muon);
180 if (
muon->track()->momentum().z() > 0.) {
183 if (
muon->track()->momentum().z() < 0.) {
199 std::cout <<
" nNegativeZ = " << nNegativeZ <<
" nPositiveZ = " << nPositiveZ << std::endl;
201 if (nNegativeZ > 1 || nPositiveZ > 1) {
204 bool trackOK =
false;
206 std::cout <<
" goodMuons_it.size() = " << goodMuons_it.size() << std::endl;
208 for (
size_t iM = 0; iM < goodMuons_it.size(); ++iM) {
212 float deltaR =
pow(
track->phi() - goodMuons_it[iM]->track()->phi(), 2) +
213 pow(
track->eta() - goodMuons_it[iM]->track()->eta(), 2);
217 <<
" dPt = " <<
track->pt() - goodMuons_it[iM]->track()->pt() << std::endl;
219 if (
deltaR > 0.01 || fabs(
track->pt() - goodMuons_it[iM]->track()->pt()) > 0.1) {
226 muonOuterZPosition = goodMuons_it[iM]->combinedMuon()->outerPosition().z();
233 std::cout <<
" failed: trackOK " << std::endl;
253 std::cout <<
"i track = " <<
i <<
" P = " <<
track->p() <<
" chi2/ndf = " <<
track->normalizedChi2()
254 <<
" nSeg = " << segments->size() << std::endl;
261 <<
track->qoverpError() << std::endl;
264 <<
" outer position = " <<
track->outerPosition() << std::endl;
265 std::cout <<
"track eta (outer) = " <<
track->outerPosition().eta()
266 <<
" phi (outer) = " <<
track->outerPosition().phi() << std::endl;
267 if (fabs(
track->innerPosition().z()) > 500.) {
269 std::cout <<
" dump inner state MUON detid = " <<
debug.dumpMuonId(innerDetId) << std::endl;
271 if (fabs(
track->outerPosition().z()) > 500.) {
273 std::cout <<
" dump outer state MUON detid = " <<
debug.dumpMuonId(outerDetId) << std::endl;
289 float dpT_ov_pT = 0.;
290 if (fabs(
track->pt()) > 0.001) {
302 if (!segments->size()) {
310 if (magField && (dpT_ov_pT > 0.5)) {
318 CLHEP::Hep3Vector r3T_inner(
track->innerPosition().x(),
track->innerPosition().y(),
track->innerPosition().z());
319 CLHEP::Hep3Vector r3T(
track->outerPosition().x(),
track->outerPosition().y(),
track->outerPosition().z());
320 chooseDirection(r3T_inner, r3T);
322 CLHEP::Hep3Vector p3T(
track->outerMomentum().x(),
track->outerMomentum().y(),
track->outerMomentum().z());
323 CLHEP::Hep3Vector p3_propagated, r3_propagated;
326 cov_propagated *= 1
e-20;
330 std::cout <<
" p = " <<
track->p() <<
" norm chi2 = " <<
track->normalizedChi2() << std::endl;
331 std::cout <<
" dump the very first FTS = " <<
debug.dumpFTS(ftsStart) << std::endl;
336 if (
track->outerPosition().z() > 0) {
343 std::vector<CSCDetId> refME;
344 for (
int iS = 1; iS < 5; ++iS) {
345 for (
int iR = 1; iR < 4; ++iR) {
346 if (1 != iS && iR > 2) {
348 }
else if (4 == iS && iR > 1) {
355 for (
size_t iSt = 0; iSt < refME.size(); ++iSt) {
357 std::cout <<
"loop iStatation = " << iSt << std::endl;
358 std::cout <<
"refME[iSt]: st = " << refME[iSt].station() <<
" rg = " << refME[iSt].ring() << std::endl;
360 std::map<std::string, bool> chamberTypes;
361 chamberTypes[
"ME11"] =
false;
362 chamberTypes[
"ME12"] =
false;
363 chamberTypes[
"ME13"] =
false;
364 chamberTypes[
"ME21"] =
false;
365 chamberTypes[
"ME22"] =
false;
366 chamberTypes[
"ME31"] =
false;
367 chamberTypes[
"ME32"] =
false;
368 chamberTypes[
"ME41"] =
false;
375 std::cout <<
" dump base iStation detid = " <<
debug.dumpMuonId(detId) << std::endl;
376 std::cout <<
" dump FTS start = " <<
debug.dumpFTS(ftsStart) << std::endl;
379 tSOSDest = propagate(ftsStart, cscGeom->
idToDet(detId)->
surface());
383 std::cout <<
" dump FTS end = " <<
debug.dumpFTS(ftsStart) << std::endl;
384 getFromFTS(ftsStart, p3_propagated, r3_propagated,
charge, cov_propagated);
385 float feta = fabs(r3_propagated.eta());
386 float phi = r3_propagated.phi();
388 ringCandidates(refME[iSt].
station(),
feta, chamberTypes);
390 map<std::string, bool>::iterator iter;
393 for (iter = chamberTypes.begin(); iter != chamberTypes.end(); iter++) {
396 if (iter->second && (iterations - 1) ==
int(iSt)) {
398 std::cout <<
" Chamber type " << iter->first <<
" is a candidate..." << std::endl;
399 std::cout <<
" station() = " << refME[iSt].station() <<
" ring() = " << refME[iSt].ring()
400 <<
" iSt = " << iSt << std::endl;
402 std::vector<int> coupleOfChambers;
404 chamberCandidates(refME[iSt].
station(), refME[iSt].
ring(), phi, coupleOfChambers);
406 for (
size_t iCh = 0; iCh < coupleOfChambers.size(); ++iCh) {
409 std::cout <<
" Check chamber N = " << coupleOfChambers.at(iCh) << std::endl;
411 if ((!getAbsoluteEfficiency) &&
412 (
true == emptyChambers[refME[iSt].
endcap() - 1][refME[iSt].
station() - 1][refME[iSt].
ring() - 1]
413 [coupleOfChambers.at(iCh) -
FirstCh])) {
418 const BoundPlane bpCh = cscGeom->
idToDet(cscChamber->geographicalId())->surface();
420 float dz = fabs(bpCh.position().z() - zFTS);
421 float zDistInner =
track->innerPosition().z() - bpCh.position().z();
422 float zDistOuter =
track->outerPosition().z() - bpCh.position().z();
425 std::cout <<
" zIn = " <<
track->innerPosition().z() <<
" zOut = " <<
track->outerPosition().z()
426 <<
" zSurf = " << bpCh.position().z() << std::endl;
428 if (!isIPdata && (zDistInner * zDistOuter > 0. || fabs(zDistInner) < 15. ||
429 fabs(zDistOuter) < 15.)) {
431 std::cout <<
" Not an intermediate (as defined) point... Skip." << std::endl;
435 if (isIPdata && fabs(
track->eta()) < 1.8) {
436 if (fabs(muonOuterZPosition) - fabs(bpCh.position().z()) < 0 ||
437 fabs(muonOuterZPosition - bpCh.position().z()) < 15.) {
445 tSOSDest = propagate(ftsStart, cscGeom->
idToDet(cscChamber->geographicalId())->surface());
450 std::cout <<
"TSOS not valid! Break." << std::endl;
455 std::cout <<
" info: dz<0.1" << std::endl;
459 bool inDeadZone =
false;
461 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
462 bool extrapolationPassed =
true;
464 std::cout <<
" iLayer = " << iLayer <<
" dump FTS init = " <<
debug.dumpFTS(ftsInit) << std::endl;
465 std::cout <<
" dump detid = " <<
debug.dumpMuonId(cscChamber->geographicalId()) << std::endl;
466 std::cout <<
"Surface to propagate to: pos = " << cscChamber->layer(iLayer + 1)->surface().position()
467 <<
" eta = " << cscChamber->layer(iLayer + 1)->surface().position().eta()
468 <<
" phi = " << cscChamber->layer(iLayer + 1)->surface().position().phi() << std::endl;
471 tSOSDest = propagate(ftsInit, cscChamber->layer(iLayer + 1)->surface());
475 std::cout <<
" Propagation between layers successful: dump FTS end = " <<
debug.dumpFTS(ftsInit)
477 getFromFTS(ftsInit, p3_propagated, r3_propagated,
charge, cov_propagated);
480 std::cout <<
"Propagation between layers not successful - notValid TSOS" << std::endl;
481 extrapolationPassed =
false;
486 if (extrapolationPassed) {
487 GlobalPoint theExtrapolationPoint(r3_propagated.x(), r3_propagated.y(), r3_propagated.z());
488 LocalPoint theLocalPoint = cscChamber->layer(iLayer + 1)->toLocal(theExtrapolationPoint);
490 inDeadZone = (inDeadZone ||
491 !inSensitiveLocalRegion(
492 theLocalPoint.x(), theLocalPoint.y(), refME[iSt].station(), refME[iSt].ring()));
494 std::cout <<
" Candidate chamber: extrapolated LocalPoint = " << theLocalPoint
495 <<
"inDeadZone = " << inDeadZone << std::endl;
510 std::cout <<
"Do efficiencies..." << std::endl;
513 bool angle_flag =
true;
514 angle_flag = efficienciesPerChamber(theCSCId, cscChamber, ftsStart);
515 if (useDigis && angle_flag) {
516 stripWire_Efficiencies(theCSCId, ftsStart);
519 recHitSegment_Efficiencies(theCSCId, cscChamber, ftsStart);
521 recSimHitEfficiency(theCSCId, ftsStart);
526 std::cout <<
" Not in active area for all layers" << std::endl;
536 std::cout <<
" TSOS not valid..." << std::endl;
542 printf(
"==exit===CSCEfficiency===== run %u\tevent %llu\n\n", iRun,
iEvent);
550 std::vector<double> chamberBounds(3);
551 float y_center = 99999.;
555 chamberBounds[0] = 66.46 / 2;
556 chamberBounds[1] = 127.15 / 2;
557 chamberBounds[2] = 323.06 / 2;
561 chamberBounds[0] = 54.00 / 2;
562 chamberBounds[1] = 125.71 / 2;
563 chamberBounds[2] = 189.66 / 2;
566 chamberBounds[0] = 61.40 / 2;
567 chamberBounds[1] = 125.71 / 2;
568 chamberBounds[2] = 169.70 / 2;
571 chamberBounds[0] = 69.01 / 2;
572 chamberBounds[1] = 125.65 / 2;
573 chamberBounds[2] = 149.42 / 2;
579 chamberBounds[0] = 63.40 / 2;
580 chamberBounds[1] = 92.10 / 2;
581 chamberBounds[2] = 164.16 / 2;
583 }
else if (2 ==
ring) {
584 chamberBounds[0] = 51.00 / 2;
585 chamberBounds[1] = 83.74 / 2;
586 chamberBounds[2] = 174.49 / 2;
589 chamberBounds[0] = 30. / 2;
590 chamberBounds[1] = 60. / 2;
591 chamberBounds[2] = 160. / 2;
595 double yUp = chamberBounds[2] + y_center;
596 double yDown = -chamberBounds[2] + y_center;
597 double xBound1Shifted = chamberBounds[0] - distanceFromDeadZone;
598 double xBound2Shifted = chamberBounds[1] - distanceFromDeadZone;
599 double lineSlope = (yUp - yDown) / (xBound2Shifted - xBound1Shifted);
600 double lineConst = yUp - lineSlope * xBound2Shifted;
601 double yBoundary = lineSlope *
abs(xLocal) + lineConst;
602 pass = checkLocal(yLocal, yBoundary,
station,
ring);
609 std::vector<float> deadZoneCenter(6);
610 const float deadZoneHalf = 0.32 * 7 / 2;
611 float cutZone = deadZoneHalf + distanceFromDeadZone;
615 deadZoneCenter[0] = -162.48;
616 deadZoneCenter[1] = -81.8744;
617 deadZoneCenter[2] = -21.18165;
618 deadZoneCenter[3] = 39.51105;
619 deadZoneCenter[4] = 100.2939;
620 deadZoneCenter[5] = 160.58;
622 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
623 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
624 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone) ||
625 (yLocal > deadZoneCenter[3] + cutZone && yLocal < deadZoneCenter[4] - cutZone) ||
626 (yLocal > deadZoneCenter[4] + cutZone && yLocal < deadZoneCenter[5] - cutZone))) {
629 }
else if (1 ==
ring) {
631 deadZoneCenter[0] = -95.94;
632 deadZoneCenter[1] = -27.47;
633 deadZoneCenter[2] = 33.67;
634 deadZoneCenter[3] = 93.72;
636 deadZoneCenter[0] = -85.97;
637 deadZoneCenter[1] = -36.21;
638 deadZoneCenter[2] = 23.68;
639 deadZoneCenter[3] = 84.04;
641 deadZoneCenter[0] = -75.82;
642 deadZoneCenter[1] = -26.14;
643 deadZoneCenter[2] = 23.85;
644 deadZoneCenter[3] = 73.91;
646 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
647 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
648 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
654 deadZoneCenter[0] = -83.155;
655 deadZoneCenter[1] = -22.7401;
656 deadZoneCenter[2] = 27.86665;
657 deadZoneCenter[3] = 81.005;
658 if (yLocal > yBoundary && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
659 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
660 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
663 }
else if (2 ==
ring) {
664 deadZoneCenter[0] = -86.285;
665 deadZoneCenter[1] = -32.88305;
666 deadZoneCenter[2] = 32.867423;
667 deadZoneCenter[3] = 88.205;
668 if (yLocal > (yBoundary) && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone) ||
669 (yLocal > deadZoneCenter[1] + cutZone && yLocal < deadZoneCenter[2] - cutZone) ||
670 (yLocal > deadZoneCenter[2] + cutZone && yLocal < deadZoneCenter[3] - cutZone))) {
674 deadZoneCenter[0] = -81.0;
675 deadZoneCenter[1] = 81.0;
676 if (yLocal > (yBoundary) && ((yLocal > deadZoneCenter[0] + cutZone && yLocal < deadZoneCenter[1] - cutZone))) {
693 for (
int iE = 0; iE < 2; iE++) {
694 for (
int iS = 0; iS < 4; iS++) {
695 for (
int iR = 0; iR < 4; iR++) {
696 for (
int iC = 0; iC <
NumCh; iC++) {
697 allSegments[iE][iS][iR][iC].clear();
698 allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] =
false;
699 for (
int iL = 0; iL < 6; iL++) {
700 allStrips[iE][iS][iR][iC][iL].clear();
701 allWG[iE][iS][iR][iC][iL].clear();
702 allRechits[iE][iS][iR][iC][iL].clear();
703 allSimhits[iE][iS][iR][iC][iL].clear();
711 fillLCT_info(alcts, clcts, correlatedlcts);
712 fillWG_info(
wires, cscGeom);
715 fillRechitsSegments_info(
rechits, segments, cscGeom);
732 if ((*digiIt).isValid()) {
733 allALCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
737 ALCTPerEvent->Fill(nSize);
743 std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
744 std::vector<CSCCLCTDigi>::const_iterator
last = (*j).second.second;
745 for (; digiIt !=
last; ++digiIt) {
747 if ((*digiIt).isValid()) {
748 allCLCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
752 CLCTPerEvent->Fill(nSize);
756 std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
757 std::vector<CSCCorrelatedLCTDigi>::const_iterator
last = (*j).second.second;
758 for (; digiIt !=
last; ++digiIt) {
760 if ((*digiIt).isValid()) {
761 allCorrLCT[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh] =
true;
774 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
775 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
777 for (; digiItr !=
last; ++digiItr) {
778 std::pair<int, float> WG_pos(digiItr->getWireGroup(), layerGeom->
yOfWireGroup(digiItr->getWireGroup()));
779 std::pair<std::pair<int, float>,
int> LayerSignal(WG_pos, digiItr->getTimeBin());
782 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]);
807 float peakADC = -1000.;
808 for (
unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
809 diff = (
float)myADCVals[iCount] - thisPedestal;
811 if (myADCVals[iCount] > largestADCValue) {
812 largestADCValue = myADCVals[iCount];
819 if (largestADCValue > maxADC) {
820 maxADC = largestADCValue;
821 std::pair<int, float> LayerSignal(myStrip, peakADC);
825 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].clear();
826 allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() - 1][
id.layer() - 1].push_back(
834 edm::PSimHitContainer::const_iterator dSHsimIter;
835 for (dSHsimIter =
simhits->begin(); dSHsimIter !=
simhits->end(); dSHsimIter++) {
838 std::pair<LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
851 printf(
" The size of the rechit collection is %i\n",
int(
rechits->size()));
854 recHitsPerEvent->Fill(
rechits->size());
857 for (recIt =
rechits->begin(); recIt !=
rechits->end(); recIt++) {
862 LocalPoint rhitlocal = (*recIt).localPosition();
863 LocalError rerrlocal = (*recIt).localPositionError();
865 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
871 printf(
"\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
882 std::pair<LocalPoint, bool> recHitPos((*recIt).localPosition(),
false);
883 allRechits[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][
id.layer() - 1].push_back(
887 for (
int iE = 0; iE < 2; iE++) {
888 for (
int iS = 0; iS < 4; iS++) {
889 for (
int iR = 0; iR < 4; iR++) {
890 for (
int iC = 0; iC <
NumCh; iC++) {
892 for (
int iL = 0; iL < 6; iL++) {
893 if (!allRechits[iE][iS][iR][iC][iL].
empty()) {
898 emptyChambers[iE][iS][iR][iC] =
false;
900 emptyChambers[iE][iS][iR][iC] =
true;
909 printf(
" The size of the segment collection is %i\n",
int(segments->size()));
912 segmentsPerEvent->Fill(segments->size());
915 StHist[
id.endcap() - 1][
id.station() - 1].segmentChi2_ndf->Fill((*it).chi2() / (*it).degreesOfFreedom());
916 StHist[
id.endcap() - 1][
id.station() - 1].hitsInSegment->Fill((*it).nRecHits());
919 std::cout <<
"\tposition(loc) = " << (*it).localPosition() <<
" error(loc) = " << (*it).localPositionError()
921 std::cout <<
"\t chi2/ndf = " << (*it).chi2() / (*it).degreesOfFreedom() <<
" nhits = " << (*it).nRecHits()
924 allSegments[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh].push_back(
925 make_pair((*it).localPosition(), (*it).localDirection()));
929 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
930 int nRH = (*it).nRecHits();
932 printf(
"\tGet the recHits for this segment.\t");
933 printf(
" nRH = %i\n", nRH);
937 for (vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
941 printf(
"\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
954 float xDiff = iRH->localPosition().x() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
957 float yDiff = iRH->localPosition().y() - allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
960 if (fabs(xDiff) < 0.0001 && fabs(yDiff) < 0.0001) {
961 std::pair<LocalPoint, bool> recHitPos(allRechits[idRH.
endcap() - 1][idRH.
station() - 1][idRH.
ring() - 1]
968 std::cout <<
" number of the rechit (from zero) in the segment = " << jRH << std::endl;
982 chamberTypes[
"ME13"] =
true;
985 chamberTypes[
"ME12"] =
true;
988 chamberTypes[
"ME11"] =
true;
993 chamberTypes[
"ME22"] =
true;
996 chamberTypes[
"ME21"] =
true;
1001 chamberTypes[
"ME32"] =
true;
1004 chamberTypes[
"ME31"] =
true;
1009 chamberTypes[
"ME41"] =
true;
1018 coupleOfChambers.clear();
1020 float phi_zero = 0.;
1021 float phi_const = 2. *
M_PI / 36.;
1022 int last_chamber = 36;
1023 int first_chamber = 1;
1030 std::cout <<
" info: negative phi = " << phi << std::endl;
1033 float chamber_float = (phi - phi_zero) / phi_const;
1034 int chamber_int =
int(chamber_float);
1035 if (chamber_float -
float(chamber_int) - 0.5 < 0.) {
1036 if (0 != chamber_int) {
1037 coupleOfChambers.push_back(chamber_int);
1039 coupleOfChambers.push_back(last_chamber);
1041 coupleOfChambers.push_back(chamber_int + 1);
1044 coupleOfChambers.push_back(chamber_int + 1);
1045 if (last_chamber != chamber_int + 1) {
1046 coupleOfChambers.push_back(chamber_int + 2);
1048 coupleOfChambers.push_back(first_chamber);
1052 std::cout <<
" phi = " << phi <<
" phi_zero = " << phi_zero <<
" phi_const = " << phi_const
1053 <<
" candidate chambers: first ch = " << coupleOfChambers[0] <<
" second ch = " << coupleOfChambers[1]
1061 int ec, st, rg, ch, secondRing;
1062 returnTypes(
id, ec, st, rg, ch, secondRing);
1067 std::cout <<
" local dir = " << localDir << std::endl;
1070 float dxdz = localDir.
x() / localDir.
z();
1071 float dydz = localDir.
y() / localDir.
z();
1072 if (2 == st || 3 == st) {
1074 std::cout <<
"st 3 or 4 ... flip dy/dz" << std::endl;
1083 if (applyIPangleCuts) {
1084 if (
dydz > local_DY_DZ_Max ||
dydz < local_DY_DZ_Min || fabs(
dxdz) > local_DX_DZ_Max) {
1090 bool firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1091 bool secondCondition =
false;
1093 if (secondRing > -1) {
1094 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1096 if (firstCondition || secondCondition) {
1098 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1102 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1108 firstCondition = allALCT[ec][st][rg][ch];
1109 secondCondition =
false;
1110 if (secondRing > -1) {
1111 secondCondition = allALCT[ec][st][secondRing][ch];
1113 if (firstCondition || secondCondition) {
1115 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1118 if (fabs(
dxdz) < local_DX_DZ_Max) {
1119 StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1120 ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(
dydz);
1124 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1126 if (fabs(
dxdz) < local_DX_DZ_Max) {
1127 StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.
momentum().
theta());
1128 ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(
dydz);
1132 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1137 firstCondition = allCLCT[ec][st][rg][ch];
1138 secondCondition =
false;
1139 if (secondRing > -1) {
1140 secondCondition = allCLCT[ec][st][secondRing][ch];
1142 if (firstCondition || secondCondition) {
1144 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1146 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1147 StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1148 ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(
dxdz);
1152 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1154 if (dydz < local_DY_DZ_Max && dydz > local_DY_DZ_Min) {
1155 StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.
momentum().
phi());
1156 ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(
dxdz);
1160 printf(
"\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n", ec + 1, st + 1, rg + 1, ch + 1);
1165 firstCondition = allCorrLCT[ec][st][rg][ch];
1166 secondCondition =
false;
1167 if (secondRing > -1) {
1168 secondCondition = allCorrLCT[ec][st][secondRing][ch];
1170 if (firstCondition || secondCondition) {
1171 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1173 ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1182 int ec, st, rg, ch, secondRing;
1183 returnTypes(
id, ec, st, rg, ch, secondRing);
1185 bool firstCondition, secondCondition;
1186 int missingLayers_s = 0;
1187 int missingLayers_wg = 0;
1188 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1191 printf(
"\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1199 << allStrips[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1201 << allWG[
id.endcap() - 1][
id.station() - 1][
id.ring() - 1][
id.chamber() -
FirstCh][iLayer].size()
1204 firstCondition = !allStrips[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1206 secondCondition =
false;
1207 if (secondRing > -1) {
1208 secondCondition = !allStrips[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1210 if (firstCondition || secondCondition) {
1211 ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer + 1);
1215 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1224 firstCondition = !allWG[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1225 secondCondition =
false;
1226 if (secondRing > -1) {
1227 secondCondition = !allWG[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1229 if (firstCondition || secondCondition) {
1230 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer + 1);
1234 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1244 if (6 != missingLayers_s) {
1245 ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1247 if (6 != missingLayers_wg) {
1248 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1250 ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1251 ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1253 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1254 if (missingLayers_s != missingLayers_wg) {
1255 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1256 if (6 == missingLayers_wg) {
1257 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1258 ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.
momentum().
theta());
1260 if (6 == missingLayers_s) {
1261 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1262 ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.
momentum().
theta());
1264 }
else if (6 == missingLayers_s) {
1265 ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1272 int ec, st, rg, ch, secondRing;
1273 returnTypes(
id, ec, st, rg, ch, secondRing);
1274 bool firstCondition, secondCondition;
1275 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1276 firstCondition = !allSimhits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1277 secondCondition =
false;
1279 if (secondRing > -1) {
1280 secondCondition = !allSimhits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1281 if (secondCondition) {
1282 thisRing = secondRing;
1285 if (firstCondition || secondCondition) {
1286 for (
size_t iSH = 0; iSH < allSimhits[ec][st][thisRing][ch][iLayer].size(); ++iSH) {
1287 if (13 == fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].
second)) {
1288 ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer + 1);
1289 if (!allRechits[ec][st][thisRing][ch][iLayer].
empty()) {
1290 ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer + 1);
1318 int ec, st, rg, ch, secondRing;
1319 returnTypes(
id, ec, st, rg, ch, secondRing);
1320 bool firstCondition, secondCondition;
1322 std::vector<bool> missingLayers_rh(6);
1323 std::vector<int> usedInSegment(6);
1326 std::cout <<
"RecHits eff" << std::endl;
1327 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1328 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1329 secondCondition =
false;
1331 if (secondRing > -1) {
1332 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1333 if (secondCondition) {
1334 thisRing = secondRing;
1337 if (firstCondition || secondCondition) {
1338 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer + 1);
1339 for (
size_t iR = 0; iR < allRechits[ec][st][thisRing][ch][iLayer].size(); ++iR) {
1340 if (allRechits[ec][st][thisRing][ch][iLayer][iR].
second) {
1341 usedInSegment[iLayer] = 1;
1344 usedInSegment[iLayer] = -1;
1348 missingLayers_rh[iLayer] =
true;
1351 printf(
"\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1363 firstCondition = !allSegments[ec][st][rg][ch].empty() ?
true :
false;
1364 secondCondition =
false;
1367 if (secondRing > -1) {
1368 secondCondition = !allSegments[ec][st][secondRing][ch].empty() ?
true :
false;
1369 secondSize = allSegments[ec][st][secondRing][ch].size();
1370 if (secondCondition) {
1371 thisRing = secondRing;
1374 if (firstCondition || secondCondition) {
1376 std::cout <<
"segments - start ec = " << ec <<
" st = " << st <<
" rg = " << rg <<
" ch = " << ch << std::endl;
1377 StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1378 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1379 globalDir = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
second);
1380 globalPos = cscChamber->
toGlobal(allSegments[ec][st][thisRing][ch][0].
first);
1381 StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1386 std::cout <<
" fts.position() = " << ftsChamber.
position() <<
" segPos = " << globalPos <<
" res = " << residual
1388 StHist[ec][st].ResidualSegments->Fill(residual);
1390 for (
int iLayer = 0; iLayer < 6; ++iLayer) {
1392 std::cout <<
" iLayer = " << iLayer <<
" usedInSegment = " << usedInSegment[iLayer] << std::endl;
1393 if (0 != usedInSegment[iLayer]) {
1394 if (-1 == usedInSegment[iLayer]) {
1395 ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer + 1);
1397 ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer + 1);
1399 firstCondition = !allRechits[ec][st][rg][ch][iLayer].empty() ?
true :
false;
1400 secondCondition =
false;
1401 if (secondRing > -1) {
1402 secondCondition = !allRechits[ec][st][secondRing][ch][iLayer].empty() ?
true :
false;
1404 float stripAngle = 99999.;
1405 std::vector<float> posXY(2);
1406 bool oneSegment =
false;
1407 if (1 == allSegments[ec][st][rg][ch].
size() + secondSize) {
1410 linearExtrapolation(globalPos, globalDir, bp.position().z(), posXY);
1411 GlobalPoint gp_extrapol(posXY.at(0), posXY.at(1), bp.position().z());
1413 posXY.at(0) = lp_extrapol.
x();
1414 posXY.at(1) = lp_extrapol.y();
1418 if (firstCondition || secondCondition) {
1419 ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer + 1);
1421 ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1422 ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1426 ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1427 ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1432 StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.
position().
x(), ftsChamber.
position().
y());
1434 std::cout <<
"missing segment " << std::endl;
1440 ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1441 if (allSegments[ec][st][rg][ch].
size() + secondSize < 2) {
1442 StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.
position().
eta()));
1444 ChHist[ec][st][rg][
id.chamber() -
FirstCh].EfficientRechits_inSegment->Fill(9);
1450 ec =
id.endcap() - 1;
1451 st =
id.station() - 1;
1463 CLHEP::Hep3Vector &
p3,
1464 CLHEP::Hep3Vector &r3,
1470 p3.set(p3GV.
x(), p3GV.
y(), p3GV.
z());
1471 r3.set(r3GP.
x(), r3GP.
y(), r3GP.
z());
1478 const CLHEP::Hep3Vector &r3,
1494 std::vector<float> &posZY) {
1495 double paramLine = lineParameter(initialPosition.
z(), zSurface, initialDirection.
z());
1496 double xPosition = extrapolate1D(initialPosition.
x(), initialDirection.
x(), paramLine);
1497 double yPosition = extrapolate1D(initialPosition.
y(), initialDirection.
y(), paramLine);
1499 posZY.push_back(xPosition);
1500 posZY.push_back(yPosition);
1504 double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine;
1505 return extrapolatedPosition;
1509 double paramLine = (destZPosition - initZPosition) / initZDirection;
1516 float dy = outerPosition.y() - innerPosition.y();
1517 float dz = outerPosition.z() - innerPosition.z();
1568 bool triggerPassed =
true;
1569 std::vector<std::string> hlNames =
triggerNames.triggerNames();
1570 pointToTriggers.clear();
1571 for (
size_t imyT = 0; imyT < myTriggers.size(); ++imyT) {
1572 for (
size_t iT = 0; iT < hlNames.size(); ++iT) {
1579 TriggersFired->Fill(iT);
1582 if (hlNames[iT] == myTriggers[imyT]) {
1583 pointToTriggers.push_back(iT);
1590 if (pointToTriggers.size() != myTriggers.size()) {
1591 pointToTriggers.clear();
1593 std::cout <<
" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"
1597 if (!pointToTriggers.empty()) {
1599 std::cout <<
"The following triggers will be required in the event: " << std::endl;
1600 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1601 std::cout <<
" " << hlNames[pointToTriggers[imyT]];
1610 if (pointToTriggers.empty()) {
1613 <<
" No triggers specified in the configuration or all ignored - no trigger information will be considered"
1617 for (
size_t imyT = 0; imyT < pointToTriggers.size(); ++imyT) {
1618 if (hltR->
wasrun(pointToTriggers[imyT]) && hltR->
accept(pointToTriggers[imyT]) &&
1619 !hltR->
error(pointToTriggers[imyT])) {
1620 triggerPassed =
true;
1625 triggerPassed =
false;
1627 triggerPassed =
false;
1634 std::cout <<
" TriggerResults handle returns invalid state?! No trigger information will be considered"
1639 std::cout <<
" Trigger passed: " << triggerPassed << std::endl;
1641 return triggerPassed;
1650 const float Ymin = -165;
1651 const float Ymax = 165;
1652 const int nYbins =
int((Ymax - Ymin) / 2);
1653 const float Layer_min = -0.5;
1654 const float Layer_max = 9.5;
1655 const int nLayer_bins =
int(Layer_max - Layer_min);
1659 printout_NEvents =
pset.getUntrackedParameter<
unsigned int>(
"printout_NEvents", 0);
1660 rootFileName =
pset.getUntrackedParameter<
string>(
"rootFileName",
"cscHists.root");
1662 isData =
pset.getUntrackedParameter<
bool>(
"runOnData",
true);
1663 isIPdata =
pset.getUntrackedParameter<
bool>(
"IPdata",
false);
1664 isBeamdata =
pset.getUntrackedParameter<
bool>(
"Beamdata",
false);
1665 getAbsoluteEfficiency =
pset.getUntrackedParameter<
bool>(
"getAbsoluteEfficiency",
true);
1666 useDigis =
pset.getUntrackedParameter<
bool>(
"useDigis",
true);
1667 distanceFromDeadZone =
pset.getUntrackedParameter<
double>(
"distanceFromDeadZone", 10.);
1668 minP =
pset.getUntrackedParameter<
double>(
"minP", 20.);
1669 maxP =
pset.getUntrackedParameter<
double>(
"maxP", 100.);
1671 minTrackHits =
pset.getUntrackedParameter<
unsigned int>(
"minTrackHits", 10);
1673 applyIPangleCuts =
pset.getUntrackedParameter<
bool>(
"applyIPangleCuts",
false);
1674 local_DY_DZ_Max =
pset.getUntrackedParameter<
double>(
"local_DY_DZ_Max", -0.1);
1675 local_DY_DZ_Min =
pset.getUntrackedParameter<
double>(
"local_DY_DZ_Min", -0.8);
1676 local_DX_DZ_Max =
pset.getUntrackedParameter<
double>(
"local_DX_DZ_Max", 0.2);
1678 sd_token = consumes<CSCStripDigiCollection>(
pset.getParameter<
edm::InputTag>(
"stripDigiTag"));
1679 wd_token = consumes<CSCWireDigiCollection>(
pset.getParameter<
edm::InputTag>(
"wireDigiTag"));
1680 al_token = consumes<CSCALCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"alctDigiTag"));
1681 cl_token = consumes<CSCCLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"clctDigiTag"));
1682 co_token = consumes<CSCCorrelatedLCTDigiCollection>(
pset.getParameter<
edm::InputTag>(
"corrlctDigiTag"));
1683 rh_token = consumes<CSCRecHit2DCollection>(
pset.getParameter<
edm::InputTag>(
"rechitTag"));
1684 se_token = consumes<CSCSegmentCollection>(
pset.getParameter<
edm::InputTag>(
"segmentTag"));
1685 tk_token = consumes<edm::View<reco::Track> >(
pset.getParameter<
edm::InputTag>(
"tracksTag"));
1686 sh_token = consumes<edm::PSimHitContainer>(
pset.getParameter<
edm::InputTag>(
"simHitTag"));
1693 useTrigger =
pset.getUntrackedParameter<
bool>(
"useTrigger",
false);
1695 ht_token = consumes<edm::TriggerResults>(
pset.getParameter<
edm::InputTag>(
"HLTriggerResults"));
1697 myTriggers =
pset.getParameter<std::vector<std::string> >(
"myTriggers");
1698 andOr =
pset.getUntrackedParameter<
bool>(
"andOr");
1699 pointToTriggers.clear();
1702 nEventsAnalyzed = 0;
1714 sprintf(SpecName,
"DataFlow");
1715 DataFlow =
new TH1F(SpecName,
"Data flow;condition number;entries", 40, -0.5, 39.5);
1717 sprintf(SpecName,
"TriggersFired");
1718 TriggersFired =
new TH1F(SpecName,
"Triggers fired;trigger number;entries", 140, -0.5, 139.5);
1721 float minChan = -0.5;
1722 float maxChan = 49.5;
1724 sprintf(SpecName,
"ALCTPerEvent");
1725 ALCTPerEvent =
new TH1F(SpecName,
"ALCTs per event;N digis;entries", Chan, minChan, maxChan);
1727 sprintf(SpecName,
"CLCTPerEvent");
1728 CLCTPerEvent =
new TH1F(SpecName,
"CLCTs per event;N digis;entries", Chan, minChan, maxChan);
1730 sprintf(SpecName,
"recHitsPerEvent");
1731 recHitsPerEvent =
new TH1F(SpecName,
"RecHits per event;N digis;entries", 150, -0.5, 149.5);
1733 sprintf(SpecName,
"segmentsPerEvent");
1734 segmentsPerEvent =
new TH1F(SpecName,
"segments per event;N digis;entries", Chan, minChan, maxChan);
1738 map<std::string, bool>::iterator iter;
1739 for (
int ec = 0; ec < 2; ++ec) {
1740 for (
int st = 0; st < 4; ++st) {
1742 sprintf(SpecName,
"Stations__E%d_S%d", ec + 1, st + 1);
1747 sprintf(SpecName,
"segmentChi2_ndf_St%d", st + 1);
1748 StHist[ec][st].segmentChi2_ndf =
new TH1F(SpecName,
"Chi2/ndf of a segment;chi2/ndf;entries", 100, 0., 20.);
1750 sprintf(SpecName,
"hitsInSegment_St%d", st + 1);
1751 StHist[ec][st].hitsInSegment =
new TH1F(SpecName,
"Number of hits in a segment;nHits;entries", 7, -0.5, 6.5);
1757 sprintf(SpecName,
"AllSegments_eta_St%d", st + 1);
1758 StHist[ec][st].AllSegments_eta =
new TH1F(SpecName,
"All segments in eta;eta;entries", Chan, minChan, maxChan);
1760 sprintf(SpecName,
"EfficientSegments_eta_St%d", st + 1);
1761 StHist[ec][st].EfficientSegments_eta =
1762 new TH1F(SpecName,
"Efficient segments in eta;eta;entries", Chan, minChan, maxChan);
1764 sprintf(SpecName,
"ResidualSegments_St%d", st + 1);
1765 StHist[ec][st].ResidualSegments =
new TH1F(SpecName,
"Residual (segments);residual,cm;entries", 75, 0., 15.);
1771 float minChan2 = -800.;
1772 float maxChan2 = 800.;
1774 sprintf(SpecName,
"EfficientSegments_XY_St%d", st + 1);
1775 StHist[ec][st].EfficientSegments_XY =
1776 new TH2F(SpecName,
"Efficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1777 sprintf(SpecName,
"InefficientSegments_XY_St%d", st + 1);
1778 StHist[ec][st].InefficientSegments_XY =
1779 new TH2F(SpecName,
"Inefficient segments in XY;X;Y", Chan, minChan, maxChan, Chan2, minChan2, maxChan2);
1784 sprintf(SpecName,
"EfficientALCT_momTheta_St%d", st + 1);
1785 StHist[ec][st].EfficientALCT_momTheta =
1786 new TH1F(SpecName,
"Efficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1788 sprintf(SpecName,
"InefficientALCT_momTheta_St%d", st + 1);
1789 StHist[ec][st].InefficientALCT_momTheta =
1790 new TH1F(SpecName,
"Inefficient ALCT in theta (momentum);theta, rad;entries", Chan, minChan, maxChan);
1795 sprintf(SpecName,
"EfficientCLCT_momPhi_St%d", st + 1);
1796 StHist[ec][st].EfficientCLCT_momPhi =
1797 new TH1F(SpecName,
"Efficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1799 sprintf(SpecName,
"InefficientCLCT_momPhi_St%d", st + 1);
1800 StHist[ec][st].InefficientCLCT_momPhi =
1801 new TH1F(SpecName,
"Inefficient CLCT in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1804 for (
int rg = 0; rg < 3; ++rg) {
1805 if (0 != st && rg > 1) {
1807 }
else if (1 == rg && 3 == st) {
1811 if (0 != st && 0 == rg && iChamber > 18) {
1815 sprintf(SpecName,
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
1820 sprintf(SpecName,
"EfficientRechits_inSegment_Ch%d", iChamber);
1821 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment =
new TH1F(
1822 SpecName,
"Existing RecHit given a segment;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1824 sprintf(SpecName,
"InefficientSingleHits_Ch%d", iChamber);
1825 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits =
new TH1F(
1826 SpecName,
"Single RecHits not in the segment;layers (1-6);entries ", nLayer_bins, Layer_min, Layer_max);
1828 sprintf(SpecName,
"AllSingleHits_Ch%d", iChamber);
1829 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits =
new TH1F(
1830 SpecName,
"Single RecHits given a segment; layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1832 sprintf(SpecName,
"digiAppearanceCount_Ch%d", iChamber);
1833 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount =
1835 "Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1843 sprintf(SpecName,
"EfficientALCT_dydz_Ch%d", iChamber);
1844 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz =
1845 new TH1F(SpecName,
"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1847 sprintf(SpecName,
"InefficientALCT_dydz_Ch%d", iChamber);
1848 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz =
1849 new TH1F(SpecName,
"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries", Chan, minChan, maxChan);
1854 sprintf(SpecName,
"EfficientCLCT_dxdz_Ch%d", iChamber);
1855 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz =
1856 new TH1F(SpecName,
"Efficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1858 sprintf(SpecName,
"InefficientCLCT_dxdz_Ch%d", iChamber);
1859 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz =
1860 new TH1F(SpecName,
"Inefficient CLCT; local dxdz;entries", Chan, minChan, maxChan);
1862 sprintf(SpecName,
"EfficientRechits_good_Ch%d", iChamber);
1863 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good =
new TH1F(
1864 SpecName,
"Existing RecHit - sensitive area only;layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1866 sprintf(SpecName,
"EfficientStrips_Ch%d", iChamber);
1867 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips =
1868 new TH1F(SpecName,
"Existing strip;layer (1-6); entries", nLayer_bins, Layer_min, Layer_max);
1870 sprintf(SpecName,
"EfficientWireGroups_Ch%d", iChamber);
1871 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups =
1872 new TH1F(SpecName,
"Existing WireGroups;layer (1-6); entries ", nLayer_bins, Layer_min, Layer_max);
1874 sprintf(SpecName,
"StripWiresCorrelations_Ch%d", iChamber);
1875 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations =
1876 new TH1F(SpecName,
"StripWire correlations;; entries ", 5, 0.5, 5.5);
1881 sprintf(SpecName,
"NoWires_momTheta_Ch%d", iChamber);
1882 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta =
1884 "No wires (all strips present) - in theta (momentum);theta, rad;entries",
1892 sprintf(SpecName,
"NoStrips_momPhi_Ch%d", iChamber);
1893 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi =
new TH1F(
1894 SpecName,
"No strips (all wires present) - in phi (momentum);phi, rad;entries", Chan, minChan, maxChan);
1896 for (
int iLayer = 0; iLayer < 6; iLayer++) {
1897 sprintf(SpecName,
"Y_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1898 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment.push_back(
1900 "Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1905 sprintf(SpecName,
"Y_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1906 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment.push_back(
1908 "Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole "
1909 "chamber);Y, cm; entries",
1917 sprintf(SpecName,
"Phi_InefficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1918 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment.push_back(
1920 "Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1925 sprintf(SpecName,
"Phi_EfficientRecHits_inSegment_Ch%d_L%d", iChamber, iLayer);
1926 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment.push_back(
1928 "Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, "
1935 sprintf(SpecName,
"Sim_Rechits_Ch%d", iChamber);
1936 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits =
1937 new TH1F(SpecName,
"Existing RecHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1939 sprintf(SpecName,
"Sim_Simhits_Ch%d", iChamber);
1940 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits =
1941 new TH1F(SpecName,
"Existing SimHit (Sim);layers (1-6);entries", nLayer_bins, Layer_min, Layer_max);
1968 std::vector<float> eff(2);
1971 std::map<std::string, bool> chamberTypes;
1972 chamberTypes[
"ME11"] =
false;
1973 chamberTypes[
"ME12"] =
false;
1974 chamberTypes[
"ME13"] =
false;
1975 chamberTypes[
"ME21"] =
false;
1976 chamberTypes[
"ME22"] =
false;
1977 chamberTypes[
"ME31"] =
false;
1978 chamberTypes[
"ME32"] =
false;
1979 chamberTypes[
"ME41"] =
false;
1981 map<std::string, bool>::iterator iter;
1982 std::cout <<
" Writing proper histogram structure (patience)..." << std::endl;
1983 for (
int ec = 0; ec < 2; ++ec) {
1984 for (
int st = 0; st < 4; ++st) {
1985 snprintf(SpecName,
sizeof(SpecName),
"Stations__E%d_S%d", ec + 1, st + 1);
1987 StHist[ec][st].segmentChi2_ndf->Write();
1988 StHist[ec][st].hitsInSegment->Write();
1989 StHist[ec][st].AllSegments_eta->Write();
1990 StHist[ec][st].EfficientSegments_eta->Write();
1991 StHist[ec][st].ResidualSegments->Write();
1992 StHist[ec][st].EfficientSegments_XY->Write();
1993 StHist[ec][st].InefficientSegments_XY->Write();
1994 StHist[ec][st].EfficientALCT_momTheta->Write();
1995 StHist[ec][st].InefficientALCT_momTheta->Write();
1996 StHist[ec][st].EfficientCLCT_momPhi->Write();
1997 StHist[ec][st].InefficientCLCT_momPhi->Write();
1998 for (
int rg = 0; rg < 3; ++rg) {
1999 if (0 != st && rg > 1) {
2001 }
else if (1 == rg && 3 == st) {
2005 if (0 != st && 0 == rg && iChamber > 18) {
2008 snprintf(SpecName,
sizeof(SpecName),
"Chambers__E%d_S%d_R%d_Chamber_%d", ec + 1, st + 1, rg + 1, iChamber);
2011 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_inSegment->Write();
2012 ChHist[ec][st][rg][iChamber -
FirstCh].AllSingleHits->Write();
2013 ChHist[ec][st][rg][iChamber -
FirstCh].digiAppearanceCount->Write();
2014 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientALCT_dydz->Write();
2015 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientALCT_dydz->Write();
2016 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientCLCT_dxdz->Write();
2017 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientCLCT_dxdz->Write();
2018 ChHist[ec][st][rg][iChamber -
FirstCh].InefficientSingleHits->Write();
2019 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientRechits_good->Write();
2020 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientStrips->Write();
2021 ChHist[ec][st][rg][iChamber -
FirstCh].StripWiresCorrelations->Write();
2022 ChHist[ec][st][rg][iChamber -
FirstCh].NoWires_momTheta->Write();
2023 ChHist[ec][st][rg][iChamber -
FirstCh].NoStrips_momPhi->Write();
2024 ChHist[ec][st][rg][iChamber -
FirstCh].EfficientWireGroups->Write();
2025 for (
unsigned int iLayer = 0; iLayer < 6; iLayer++) {
2026 ChHist[ec][st][rg][iChamber -
FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
2027 ChHist[ec][st][rg][iChamber -
FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
2028 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2029 ChHist[ec][st][rg][iChamber -
FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2031 ChHist[ec][st][rg][iChamber -
FirstCh].SimRechits->Write();
2032 ChHist[ec][st][rg][iChamber -
FirstCh].SimSimhits->Write();
2045 snprintf(SpecName,
sizeof(SpecName),
"AllChambers");
2049 TriggersFired->Write();
2050 ALCTPerEvent->Write();
2051 CLCTPerEvent->Write();
2052 recHitsPerEvent->Write();
2053 segmentsPerEvent->Write();