67 #define LOGPRINT edm::LogPrint("SiStripHitEfficiency:HitEff") 78 siStripClusterInfo_(consumesCollector()),
79 combinatorialTracks_token_(
85 digisCol_token_(consumes(conf.getParameter<
edm::
InputTag>(
"siStripDigis"))),
86 digisVec_token_(consumes(conf.getParameter<
edm::
InputTag>(
"siStripDigis"))),
122 traj =
fs->make<TTree>(
"traj",
"tree of trajectory positions");
123 #ifdef ExtendedCALIBTree 124 traj->Branch(
"timeDT", &timeDT,
"timeDT/F");
125 traj->Branch(
"timeDTErr", &timeDTErr,
"timeDTErr/F");
126 traj->Branch(
"timeDTDOF", &timeDTDOF,
"timeDTDOF/I");
127 traj->Branch(
"timeECAL", &timeECAL,
"timeECAL/F");
128 traj->Branch(
"dedx", &dedx,
"dedx/F");
129 traj->Branch(
"dedxNOM", &dedxNOM,
"dedxNOM/I");
130 traj->Branch(
"nLostHits", &nLostHits,
"nLostHits/I");
131 traj->Branch(
"chi2", &
chi2,
"chi2/F");
132 traj->Branch(
"p", &
p,
"p/F");
148 traj->Branch(
"ResX", &
ResX,
"ResX/F");
153 traj->Branch(
"nHits", &
nHits,
"nHits/I");
154 traj->Branch(
"pT", &
pT,
"pT/F");
157 traj->Branch(
"Id", &
Id,
"Id/i");
158 traj->Branch(
"run", &
run,
"run/i");
159 traj->Branch(
"event", &
event,
"event/i");
165 traj->Branch(
"PU", &
PU,
"PU/F");
184 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"beginning analyze from HitEff" << endl;
187 using namespace reco;
190 int run_nr =
e.id().run();
191 int ev_nr =
e.id().event();
192 int bunch_nr =
e.bunchCrossing();
206 }
else if (metaData.
isValid()) {
210 edm::LogWarning(
"SiStripHitEfficiencyWorker") <<
"could not find a source for the Luminosity and PU";
259 if (not fedErrorIdsCol_h.isValid() and not fedErrorIdsVec_h.isValid()) {
261 <<
"no valid product for SiStrip DetIds with FED errors (see parameter \"siStripDigis\"), " 262 "neither for new format (DetIdVector) nor old format (DetIdCollection)";
264 auto const& fedErrorIds = fedErrorIdsVec_h.isValid() ? *fedErrorIdsVec_h : fedErrorIdsCol_h->as_vector();
308 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"number ckf tracks found = " << tracksCKF->size() << endl;
310 if (!tracksCKF->empty()) {
314 LogDebug(
"SiStripHitEfficiency:HitEff")
319 #ifdef ExtendedCALIBTree 322 if (
e.getByLabel(
"dedxMedianCTF", dEdxUncalibHandle)) {
326 dedx = dEdxTrackUncalib[itTrack].dEdx();
327 dedxNOM = dEdxTrackUncalib[itTrack].numberOfMeasurements();
335 if (
e.getByLabel(
"muonsWitht0Correction", muH)) {
337 if (!muonsT0.empty()) {
341 timeDTDOF = mt0.
nDof;
343 bool hasCaloEnergyInfo = muonsT0[0].isEnergyValid();
344 if (hasCaloEnergyInfo)
345 timeECAL = muonsT0[0].calEnergy().ecal_time;
359 it != trajTrackAssociationHandle->
end();
365 nHits = itraj->foundHits();
366 #ifdef ExtendedCALIBTree 367 nLostHits = itraj->lostHits();
368 chi2 = (itraj->chiSquared() / itraj->ndof());
369 p = itraj->lastMeasurement().updatedState().globalMomentum().mag();
371 pT =
sqrt((itraj->lastMeasurement().updatedState().globalMomentum().x() *
372 itraj->lastMeasurement().updatedState().globalMomentum().x()) +
373 (itraj->lastMeasurement().updatedState().globalMomentum().y() *
374 itraj->lastMeasurement().updatedState().globalMomentum().y()));
379 std::vector<TrajectoryMeasurement> TMeas = itraj->measurements();
381 vector<TrajectoryMeasurement>::iterator itm;
386 double angleX = -999.;
387 double angleY = -999.;
388 double xglob, yglob, zglob;
391 bool hasMissingHits =
false;
392 int previous_layer = 999;
393 vector<unsigned int> missedLayers;
394 for (
const auto& itm : TMeas) {
395 auto theHit = itm.recHit();
396 unsigned int iidd = theHit->geographicalId().rawId();
397 int layer = ::checkLayer(iidd, tTopo);
398 int missedLayer = (
layer + 1);
399 int previousMissedLayer = (
layer + 2);
400 int diffPreviousLayer = (
layer - previous_layer);
403 if (diffPreviousLayer == -2 && missedLayer > k_LayersStart && missedLayer < k_LayersAtTOBEnd) {
405 hasMissingHits =
true;
408 else if (diffPreviousLayer == -2 && (missedLayer > k_LayersAtTOBEnd + 1 && missedLayer <= k_LayersAtTIDEnd)) {
410 hasMissingHits =
true;
413 else if (diffPreviousLayer == -2 && missedLayer > k_LayersAtTIDEnd && missedLayer <= k_LayersAtTECEnd) {
415 hasMissingHits =
true;
419 if ((
layer > k_LayersStart &&
layer <= k_LayersAtTIBEnd) && (previous_layer == 12)) {
421 hasMissingHits =
true;
425 if ((
layer > k_LayersAtTIBEnd &&
layer <= k_LayersAtTOBEnd) && (previous_layer == 15)) {
427 hasMissingHits =
true;
433 if (diffPreviousLayer == -3 && missedLayer > k_LayersStart && missedLayer < k_LayersAtTOBEnd &&
434 previousMissedLayer > k_LayersStart && previousMissedLayer < k_LayersAtTOBEnd) {
437 hasMissingHits =
true;
441 else if (diffPreviousLayer == -3 && missedLayer > k_LayersAtTIDEnd && missedLayer <= k_LayersAtTECEnd &&
442 previousMissedLayer > k_LayersAtTIDEnd && previousMissedLayer <= k_LayersAtTECEnd) {
445 hasMissingHits =
true;
450 hasMissingHits =
true;
453 missedLayers.push_back(
layer);
454 previous_layer =
layer;
459 unsigned int prev_TKlayers = 0;
460 for (itm = TMeas.begin(); itm != TMeas.end(); itm++) {
461 auto theInHit = (*itm).recHit();
463 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"theInHit is valid = " << theInHit->isValid() << endl;
465 unsigned int iidd = theInHit->geographicalId().rawId();
466 bool foundConsMissingHits =
false;
467 unsigned int TKlayers = ::checkLayer(iidd, tTopo);
468 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"TKlayer from trajectory: " << TKlayers <<
" from module = " << iidd
469 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" 470 << ((iidd & 0x3) == 1) <<
"/" << ((iidd & 0x3) == 2) << endl;
474 bool isFirstMeas = (itm == (TMeas.end() - 1));
475 bool isLastMeas = (itm == (TMeas.begin()));
488 if (TKlayers == 10 || TKlayers == 22) {
489 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"skipping original TM for TOB 6 or TEC 9" << endl;
494 std::vector<TrajectoryAtInvalidHit> TMs;
502 if (::isDoubleSided(iidd, tTopo) && ((iidd & 0x3) == 0)) {
507 }
else if (::isDoubleSided(iidd, tTopo) && (!::check2DPartner(iidd, TMeas))) {
512 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" found a hit with a missing partner";
517 bool missingHitAdded =
false;
519 vector<TrajectoryMeasurement> tmpTmeas, prev_tmpTmeas;
520 unsigned int misLayer = TKlayers + 1;
521 unsigned int previousMisLayer = TKlayers + 2;
524 if (
int(TKlayers) -
int(prev_TKlayers) == -2) {
525 const DetLayer* detlayer = itm->layer();
530 if (misLayer > k_LayersAtTIDEnd && misLayer < k_LayersAtTECEnd) {
531 std::vector<ForwardDetLayer const*> negTECLayers =
532 measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
533 std::vector<ForwardDetLayer const*> posTECLayers =
534 measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
535 const DetLayer* tecLayerneg = negTECLayers[misLayer - k_LayersAtTIDEnd - 1];
536 const DetLayer* tecLayerpos = posTECLayers[misLayer - k_LayersAtTIDEnd - 1];
537 if (tTopo->
tecSide(iidd) == 1) {
538 tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, *thePropagator, *
estimator);
539 }
else if (tTopo->
tecSide(iidd) == 2) {
540 tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, *thePropagator, *
estimator);
544 else if (misLayer == (k_LayersAtTIDEnd - 1) ||
545 misLayer == k_LayersAtTIDEnd) {
547 std::vector<ForwardDetLayer const*> negTIDLayers =
548 measurementTrackerHandle->geometricSearchTracker()->negTidLayers();
549 std::vector<ForwardDetLayer const*> posTIDLayers =
550 measurementTrackerHandle->geometricSearchTracker()->posTidLayers();
551 const DetLayer* tidLayerneg = negTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
552 const DetLayer* tidLayerpos = posTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
554 if (tTopo->
tidSide(iidd) == 1) {
555 tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, *thePropagator, *
estimator);
556 }
else if (tTopo->
tidSide(iidd) == 2) {
557 tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, *thePropagator, *
estimator);
561 if (misLayer > k_LayersStart && misLayer < k_LayersAtTOBEnd) {
563 std::vector<BarrelDetLayer const*> barrelTIBLayers =
564 measurementTrackerHandle->geometricSearchTracker()->tibLayers();
565 std::vector<BarrelDetLayer const*> barrelTOBLayers =
566 measurementTrackerHandle->geometricSearchTracker()->tobLayers();
568 if (misLayer > k_LayersStart && misLayer <= k_LayersAtTIBEnd) {
569 const DetLayer* tibLayer = barrelTIBLayers[misLayer - k_LayersStart - 1];
570 tmpTmeas = layerMeasurements.measurements(*tibLayer, tsos, *thePropagator, *
estimator);
571 }
else if (misLayer > k_LayersAtTIBEnd && misLayer < k_LayersAtTOBEnd) {
572 const DetLayer* tobLayer = barrelTOBLayers[misLayer - k_LayersAtTIBEnd - 1];
573 tmpTmeas = layerMeasurements.measurements(*tobLayer, tsos, *thePropagator, *
estimator);
577 if ((
int(TKlayers) > k_LayersStart &&
int(TKlayers) <= k_LayersAtTIBEnd) &&
int(prev_TKlayers) == 12) {
578 const DetLayer* detlayer = itm->layer();
582 std::vector<ForwardDetLayer const*> negTIDLayers =
583 measurementTrackerHandle->geometricSearchTracker()->negTidLayers();
584 std::vector<ForwardDetLayer const*> posTIDLayers =
585 measurementTrackerHandle->geometricSearchTracker()->posTidLayers();
587 const DetLayer* tidLayerneg = negTIDLayers[k_LayersStart];
588 const DetLayer* tidLayerpos = posTIDLayers[k_LayersStart];
589 if (tTopo->
tidSide(iidd) == 1) {
590 tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, *thePropagator, *
estimator);
591 }
else if (tTopo->
tidSide(iidd) == 2) {
592 tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, *thePropagator, *
estimator);
596 if ((
int(TKlayers) > k_LayersAtTIBEnd &&
int(TKlayers) <= k_LayersAtTOBEnd) &&
int(prev_TKlayers) == 15) {
597 const DetLayer* detlayer = itm->layer();
602 std::vector<ForwardDetLayer const*> negTECLayers =
603 measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
604 std::vector<ForwardDetLayer const*> posTECLayers =
605 measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
607 const DetLayer* tecLayerneg = negTECLayers[k_LayersStart];
608 const DetLayer* tecLayerpos = posTECLayers[k_LayersStart];
609 if (tTopo->
tecSide(iidd) == 1) {
610 tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, *thePropagator, *
estimator);
611 }
else if (tTopo->
tecSide(iidd) == 2) {
612 tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, *thePropagator, *
estimator);
617 if (
int(TKlayers) -
int(prev_TKlayers) == -3) {
618 foundConsMissingHits =
true;
619 const DetLayer* detlayer = itm->layer();
624 if (misLayer > k_LayersStart && misLayer <= k_LayersAtTOBEnd && previousMisLayer > k_LayersStart &&
625 previousMisLayer <= k_LayersAtTOBEnd) {
626 std::vector<BarrelDetLayer const*> barrelTIBLayers =
627 measurementTrackerHandle->geometricSearchTracker()->tibLayers();
628 std::vector<BarrelDetLayer const*> barrelTOBLayers =
629 measurementTrackerHandle->geometricSearchTracker()->tobLayers();
630 if (misLayer > k_LayersStart && misLayer < k_LayersAtTIBEnd) {
631 const DetLayer* tibLayer = barrelTIBLayers[misLayer - k_LayersStart - 1];
632 const DetLayer* prevTibLayer = barrelTIBLayers[previousMisLayer - k_LayersStart - 1];
634 tmpTmeas = layerMeasurements.measurements(*tibLayer, tsos, *thePropagator, *
estimator);
635 prev_tmpTmeas = layerMeasurements.measurements(*prevTibLayer, tsos, *thePropagator, *
estimator);
636 }
else if (misLayer > k_LayersAtTIBEnd && misLayer < k_LayersAtTOBEnd) {
637 const DetLayer* tobLayer = barrelTOBLayers[misLayer - k_LayersAtTIBEnd - 1];
638 const DetLayer* prevTobLayer = barrelTOBLayers[previousMisLayer - k_LayersAtTIBEnd - 1];
639 tmpTmeas = layerMeasurements.measurements(*tobLayer, tsos, *thePropagator, *
estimator);
640 prev_tmpTmeas = layerMeasurements.measurements(*prevTobLayer, tsos, *thePropagator, *
estimator);
642 }
else if (misLayer > k_LayersAtTIDEnd && misLayer < k_LayersAtTECEnd &&
643 previousMisLayer > k_LayersAtTIDEnd && previousMisLayer < k_LayersAtTECEnd) {
644 std::vector<ForwardDetLayer const*> negTECLayers =
645 measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
646 std::vector<ForwardDetLayer const*> posTECLayers =
647 measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
649 const DetLayer* tecLayerneg = negTECLayers[misLayer - k_LayersAtTIDEnd - 1];
650 const DetLayer* prevTecLayerneg = negTECLayers[previousMisLayer - k_LayersAtTIDEnd - 1];
652 const DetLayer* tecLayerpos = posTECLayers[misLayer - k_LayersAtTIDEnd - 1];
653 const DetLayer* prevTecLayerpos = posTECLayers[previousMisLayer - k_LayersAtTIDEnd - 1];
655 if (tTopo->
tecSide(iidd) == 1) {
656 tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, *thePropagator, *
estimator);
657 prev_tmpTmeas = layerMeasurements.measurements(*prevTecLayerneg, tsos, *thePropagator, *
estimator);
658 }
else if (tTopo->
tecSide(iidd) == 2) {
659 tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, *thePropagator, *
estimator);
660 prev_tmpTmeas = layerMeasurements.measurements(*prevTecLayerpos, tsos, *thePropagator, *
estimator);
664 if (!tmpTmeas.empty() && !foundConsMissingHits) {
666 unsigned int iidd_tmp = TM_tmp.
recHit()->geographicalId().rawId();
668 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" hit actually being added to TM vector";
671 if (::isDoubleSided(iidd_tmp, tTopo)) {
676 missingHitAdded =
true;
681 if (!tmpTmeas.empty() && !prev_tmpTmeas.empty() &&
682 foundConsMissingHits) {
686 unsigned int modIdInner = TM_tmp1.
recHit()->geographicalId().rawId();
687 unsigned int modIdOuter = TM_tmp2.recHit()->geographicalId().rawId();
688 bool innerModInactive =
false, outerModInactive =
false;
689 for (
const auto& tm : tmpTmeas) {
690 unsigned int tmModId = tm.recHit()->geographicalId().rawId();
691 if (tmModId == modIdInner && tm.recHit()->getType() == 2) {
692 innerModInactive =
true;
696 for (
const auto& tm : prev_tmpTmeas) {
697 unsigned int tmModId = tm.recHit()->geographicalId().rawId();
698 if (tmModId == modIdOuter && tm.recHit()->getType() == 2) {
699 outerModInactive =
true;
704 if (outerModInactive) {
705 if (modIdInner != 0) {
706 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" hit actually being added to TM vector";
709 if (::isDoubleSided(modIdInner, tTopo)) {
714 missingHitAdded =
true;
718 if (innerModInactive) {
719 if (modIdOuter != 0) {
720 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" hit actually being added to TM vector";
723 if (::isDoubleSided(modIdOuter, tTopo)) {
728 missingHitAdded =
true;
735 prev_TKlayers = TKlayers;
740 bool hitsWithBias =
false;
741 for (
auto ilayer : missedLayers) {
742 if (ilayer < TKlayers)
755 bool isValid = theInHit->isValid();
756 bool isLast = (itm == (TMeas.end() - 1));
757 bool isLastTOB5 =
true;
759 if (::checkLayer((++itm)->recHit()->geographicalId().rawId(), tTopo) == 9)
766 if (TKlayers == 9 &&
isValid && isLastTOB5) {
769 std::vector<BarrelDetLayer const*> barrelTOBLayers =
770 measurementTrackerHandle->geometricSearchTracker()->tobLayers();
771 const DetLayer* tob6 = barrelTOBLayers[barrelTOBLayers.size() - 1];
774 auto tmp = layerMeasurements.measurements(*tob6, tsosTOB5, *thePropagator, *
estimator);
777 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"size of TM from propagation = " <<
tmp.size() << endl;
783 const auto& tob6Hit = tob6TM.
recHit();
785 if (tob6Hit->geographicalId().rawId() != 0) {
786 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"tob6 hit actually being added to TM vector" << endl;
792 bool isLastTEC8 =
true;
794 if (::checkLayer((++itm)->
recHit()->geographicalId().
rawId(), tTopo) == 21)
801 if (TKlayers == 21 &&
isValid && isLastTEC8) {
802 std::vector<const ForwardDetLayer*> posTecLayers =
803 measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
804 const DetLayer* tec9pos = posTecLayers[posTecLayers.size() - 1];
805 std::vector<const ForwardDetLayer*> negTecLayers =
806 measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
807 const DetLayer* tec9neg = negTecLayers[negTecLayers.size() - 1];
813 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"there is a problem with TEC 9 extrapolation" << endl;
816 vector<TrajectoryMeasurement>
tmp;
817 if (tTopo->
tecSide(iidd) == 1) {
818 tmp = layerMeasurements.measurements(*tec9neg, tsosTEC9, *thePropagator, *
estimator);
821 if (tTopo->
tecSide(iidd) == 2) {
822 tmp = layerMeasurements.measurements(*tec9pos, tsosTEC9, *thePropagator, *
estimator);
831 const auto& tec9Hit = tec9TM.
recHit();
833 unsigned int tec9id = tec9Hit->geographicalId().rawId();
834 LogDebug(
"SiStripHitEfficiency:HitEff")
835 <<
"tec9id = " << tec9id <<
" is Double sided = " << ::isDoubleSided(tec9id, tTopo)
836 <<
" and 0x3 = " << (tec9id & 0x3) << endl;
838 if (tec9Hit->geographicalId().rawId() != 0) {
839 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"tec9 hit actually being added to TM vector" << endl;
842 if (::isDoubleSided(tec9id, tTopo)) {
856 for (std::vector<TrajectoryAtInvalidHit>::const_iterator TM = TMs.begin(); TM != TMs.end(); ++TM) {
858 iidd = TM->monodet_id();
859 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"setting iidd = " << iidd <<
" before checking efficiency and ";
864 angleX = atan(TM->localDxDz());
865 angleY = atan(TM->localDyDz());
870 xglob = TM->globalX();
871 yglob = TM->globalY();
872 zglob = TM->globalZ();
873 xErr = TM->localErrorX();
874 yErr = TM->localErrorY();
885 TKlayers = ::checkLayer(iidd, tTopo);
889 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Looking at layer under study" << endl;
911 if (!
input.empty()) {
912 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Checking clusters with size = " <<
input.size() << endl;
914 std::vector<std::vector<float> >
920 unsigned int ClusterId = DSViter->id();
921 if (ClusterId == iidd) {
922 LogDebug(
"SiStripHitEfficiency:HitEff")
923 <<
"found (ClusterId == iidd) with ClusterId = " << ClusterId <<
" and iidd = " << iidd << endl;
924 DetId ClusterDetId(ClusterId);
933 if (TKlayers >= 11) {
936 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
937 std::array<const float, 4>
const& parameterTrap =
939 hbedge = parameterTrap[0];
940 htedge = parameterTrap[1];
941 hapoth = parameterTrap[3];
942 uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
943 uxlden = 1 + yloc * uylfac;
947 if (TrajStrip == -1) {
950 TrajStrip = xloc / pitch + nstrips / 2.0;
952 if (TKlayers >= 11) {
953 float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
955 TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
965 float sigma = ::checkConsistency(
parameters, xloc, xErr);
972 if (TKlayers >= 11) {
976 yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
983 std::vector<float> cluster_info;
984 cluster_info.push_back(
res);
985 cluster_info.push_back(sigma);
991 VCluster_info.push_back(cluster_info);
993 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Have ID match. residual = " << VCluster_info.back()[0]
994 <<
" res sigma = " << VCluster_info.back()[1] << endl;
995 LogDebug(
"SiStripHitEfficiency:HitEff")
996 <<
"trajectory measurement compatability estimate = " << (*itm).estimate() << endl;
997 LogDebug(
"SiStripHitEfficiency:HitEff")
999 <<
" trajectory position = " << xloc <<
" traj error = " << xErr << endl;
1003 float FinalResSig = 1000.0;
1004 float FinalCluster[7] = {1000.0, 1000.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1006 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"found clusters > 0" << endl;
1009 vector<vector<float> >::iterator ires;
1010 for (ires = VCluster_info.begin(); ires != VCluster_info.end(); ires++) {
1011 if (
abs((*ires)[1]) <
abs(FinalResSig)) {
1012 FinalResSig = (*ires)[1];
1013 for (
unsigned int i = 0;
i < ires->size();
i++) {
1014 LogDebug(
"SiStripHitEfficiency:HitEff")
1015 <<
"filling final cluster. i = " <<
i <<
" before fill FinalCluster[i]=" << FinalCluster[
i]
1016 <<
" and (*ires)[i] =" << (*ires)[
i] << endl;
1017 FinalCluster[
i] = (*ires)[
i];
1018 LogDebug(
"SiStripHitEfficiency:HitEff")
1019 <<
"filling final cluster. i = " <<
i <<
" after fill FinalCluster[i]=" << FinalCluster[
i]
1020 <<
" and (*ires)[i] =" << (*ires)[
i] << endl;
1023 LogDebug(
"SiStripHitEfficiency:HitEff")
1024 <<
"iresidual = " << (*ires)[0] <<
" isigma = " << (*ires)[1]
1025 <<
" and FinalRes = " << FinalCluster[0] << endl;
1028 FinalResSig = VCluster_info.at(0)[1];
1029 for (
unsigned int i = 0;
i < VCluster_info.at(0).size();
i++) {
1030 FinalCluster[
i] = VCluster_info.at(0)[
i];
1033 VCluster_info.clear();
1036 LogDebug(
"SiStripHitEfficiency:HitEff")
1037 <<
"Final residual in X = " << FinalCluster[0] <<
"+-" << (FinalCluster[0] / FinalResSig) << endl;
1038 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Checking location of trajectory: abs(yloc) = " <<
abs(yloc)
1039 <<
" abs(xloc) = " <<
abs(xloc) << endl;
1040 LogDebug(
"SiStripHitEfficiency:HitEff")
1041 <<
"Checking location of cluster hit: yloc = " << FinalCluster[4] <<
"+-" << FinalCluster[5]
1042 <<
" xloc = " << FinalCluster[2] <<
"+-" << FinalCluster[3] << endl;
1043 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Final cluster signal to noise = " << FinalCluster[6] << endl;
1045 float exclusionWidth = 0.4;
1046 float TOBexclusion = 0.0;
1047 float TECexRing5 = -0.89;
1048 float TECexRing6 = -0.56;
1049 float TECexRing7 = 0.60;
1052 int ringnumber = ((iidd >> 5) & 0x7);
1055 if ((TKlayers >= 5 && TKlayers < 11) ||
1056 ((
subdetector == 6) && ((ringnumber >= 5) && (ringnumber <= 7)))) {
1058 float highzone = 0.0;
1059 float lowzone = 0.0;
1060 float higherr = yloc + 5.0 * yErr;
1061 float lowerr = yloc - 5.0 * yErr;
1062 if (TKlayers >= 5 && TKlayers < 11) {
1064 highzone = TOBexclusion + exclusionWidth;
1065 lowzone = TOBexclusion - exclusionWidth;
1066 }
else if (ringnumber == 5) {
1068 highzone = TECexRing5 + exclusionWidth;
1069 lowzone = TECexRing5 - exclusionWidth;
1070 }
else if (ringnumber == 6) {
1072 highzone = TECexRing6 + exclusionWidth;
1073 lowzone = TECexRing6 - exclusionWidth;
1074 }
else if (ringnumber == 7) {
1076 highzone = TECexRing7 + exclusionWidth;
1077 lowzone = TECexRing7 - exclusionWidth;
1080 if ((highzone <= higherr) && (highzone >= lowerr))
1082 if ((lowzone >= lowerr) && (lowzone <= higherr))
1084 if ((higherr <= highzone) && (higherr >= lowzone))
1086 if ((lowerr >= lowzone) && (lowerr <= highzone))
1104 if (SiStripQuality_->
getBadApvs(iidd) != 0) {
1106 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"strip is bad from SiStripQuality" << endl;
1109 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"strip is good from SiStripQuality" << endl;
1113 for (
unsigned int ii = 0;
ii < fedErrorIds.size();
ii++) {
1114 if (iidd == fedErrorIds[
ii].
rawId())
1122 ResX = FinalCluster[0];
1124 if (FinalResSig != FinalCluster[1])
1125 LogDebug(
"SiStripHitEfficiency:HitEff")
1126 <<
"Problem with best cluster selection because FinalResSig = " << FinalResSig
1127 <<
" and FinalCluster[1] = " << FinalCluster[1] << endl;
1136 if (commonModeDigis.
isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
1138 if (digiframe != commonModeDigis->end())
1139 if ((
unsigned)TrajStrip / 128 < digiframe->data.
size())
1140 commonMode = digiframe->data.at(TrajStrip / 128).adc();
1143 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"before check good" << endl;
1145 if (FinalResSig < 999.0) {
1147 LogDebug(
"SiStripHitEfficiency:HitEff")
1148 <<
"hit being counted as good " << FinalCluster[0] <<
" FinalRecHit " << iidd <<
" TKlayers " 1149 << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc <<
" module " << iidd
1150 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1) <<
"/" 1151 << ((iidd & 0x3) == 2) << endl;
1155 LogDebug(
"SiStripHitEfficiency:HitEff")
1156 <<
"hit being counted as bad ######### Invalid RPhi FinalResX " << FinalCluster[0]
1157 <<
" FinalRecHit " << iidd <<
" TKlayers " << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc
1158 <<
" module " << iidd <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" 1159 << ((iidd & 0x3) == 1) <<
"/" << ((iidd & 0x3) == 2) << endl;
1163 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" RPhi Error " <<
sqrt(xErr * xErr + yErr * yErr)
1164 <<
" ErrorX " << xErr <<
" yErr " << yErr << endl;
1166 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"after good location check" << endl;
1168 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"after list of clusters" << endl;
1170 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"After layers=TKLayers if" << endl;
1172 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"After looping over TrajAtValidHit list" << endl;
1174 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"end TMeasurement loop" << endl;
1176 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"end of trajectories loop" << endl;
1181 traj->GetDirectory()->cd();
1184 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" Events Analysed " <<
events << endl;
1193 float totTIBrepro = 0.0;
1194 float totTOBrepro = 0.0;
1195 float totTIDrepro = 0.0;
1196 float totTECrepro = 0.0;
1198 edm::LogInfo(
"SiStripHitEfficiency:HitEff") <<
"Within TIB :";
1199 for (
int i = 0;
i <= k_LayersAtTIBEnd;
i++) {
1207 <<
" % of missing hit";
1211 <<
"TOTAL % of missing hits within TIB :" << (totTIB * 1.0 /
totalNbHits) * 100 <<
"%";
1213 <<
"AFTER repropagation :" << (totTIBrepro * 1.0 /
totalNbHits) * 100 <<
"%";
1215 edm::LogInfo(
"SiStripHitEfficiency:HitEff") <<
"Within TOB :";
1216 for (
int i = k_LayersAtTIBEnd + 1;
i <= k_LayersAtTOBEnd;
i++) {
1224 <<
" % of missing hit";
1228 <<
"TOTAL % of missing hits within TOB :" << (totTOB * 1.0 /
totalNbHits) * 100 <<
"%";
1230 <<
"AFTER repropagation :" << (totTOBrepro * 1.0 /
totalNbHits) * 100 <<
"%";
1232 edm::LogInfo(
"SiStripHitEfficiency:HitEff") <<
"Within TID :";
1233 for (
int i = k_LayersAtTOBEnd + 1;
i <= k_LayersAtTIDEnd;
i++) {
1241 <<
" % of missing hit";
1245 <<
"TOTAL % of missing hits within TID :" << (totTID * 1.0 /
totalNbHits) * 100 <<
"%";
1247 <<
"AFTER repropagation :" << (totTIDrepro * 1.0 /
totalNbHits) * 100 <<
"%";
1249 edm::LogInfo(
"SiStripHitEfficiency:HitEff") <<
"Within TEC :";
1250 for (
int i = k_LayersAtTIDEnd + 1;
i < k_END_OF_LAYERS;
i++) {
1258 <<
" % of missing hit";
1262 <<
"TOTAL % of missing hits within TEC :" << (totTEC * 1.0 /
totalNbHits) * 100 <<
"%";
1264 <<
"AFTER repropagation :" << (totTECrepro * 1.0 /
totalNbHits) * 100 <<
"%";
1266 edm::LogInfo(
"SiStripHitEfficiency:HitEff") <<
" Hit recovery summary:";
1268 for (
int ilayer = 0; ilayer < k_END_OF_LAYERS; ilayer++) {
std::pair< LocalPoint, LocalError > LocalValues
static const std::string kSharedResource
static constexpr auto TEC
virtual int nstrips() const =0
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
T getParameter(std::string const &) const
std::vector< unsigned int > hitRecoveryCounters
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const edm::EDGetTokenT< OnlineLuminosityRecord > metaDataToken_
void setCluster(const SiStripCluster &cluster, int detId)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::vector< unsigned int > hitTotalCounters
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
friend struct const_iterator
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters <p) const
bool useAllHitsFromTracksWithMissingHits_
unsigned int tidSide(const DetId &id) const
bool doMissingHitsRecovery_
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
T const * product() const
Class to contain the online luminosity from soft FED 1022.
std::vector< Track > TrackCollection
collection of Tracks
const edm::EDGetTokenT< DetIdVector > digisVec_token_
HitEff(const edm::ParameterSet &conf)
SiStripClusterInfo siStripClusterInfo_
data_type const * const_iterator
float instLumi() const
Return the luminosity for the current nibble.
const edm::EDGetTokenT< DetIdCollection > digisCol_token_
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
std::vector< Muon > MuonCollection
collection of Muon objects
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
static std::string const input
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
const_iterator end() const
last iterator over the map (read only)
float signalOverNoise() const
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
size_type size() const
Return the number of contained DetSets.
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
unsigned int tecSide(const DetId &id) const
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
int nDof
number of muon stations used
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
unsigned int trajHitValid
#define DEFINE_FWK_MODULE(type)
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTkToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > chi2MeasurementEstimatorToken_
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const Plane & surface() const
The nominal surface of the GeomDet.
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > cpeToken_
virtual const std::array< const float, 4 > parameters() const
unsigned int trackMultiplicityCut_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
unsigned int SiStripQualBad
const_iterator begin() const
first iterator over the map (read only)
const edm::EDGetTokenT< TrajTrackAssociationCollection > trajTrackAsso_token_
std::vector< LumiScalers > LumiScalersCollection
Log< level::Warning, false > LogWarning
void initEvent(const edm::EventSetup &iSetup)
collection_type::const_iterator const_iterator
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
virtual float width() const =0
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
float avgPileUp() const
Return the average pileup for th current nibble.
std::vector< int > missHitPerLayer
ConstRecHitPointer const & recHit() const
short getBadApvs(uint32_t detid) const
const Bounds & bounds() const