202 combinatorialTracks_token_(
208 digisCol_token_(consumes(conf.getParameter<
edm::
InputTag>(
"siStripDigis"))),
209 digisVec_token_(consumes(conf.getParameter<
edm::
InputTag>(
"siStripDigis"))),
219 tkDetMapToken_(esConsumes<edm::Transition::BeginRun>()),
221 layers_(conf.getParameter<
int>(
"Layer")),
222 DEBUG_(conf.getUntrackedParameter<
bool>(
"Debug",
false)),
223 addLumi_(conf.getUntrackedParameter<
bool>(
"addLumi",
false)),
224 addCommonMode_(conf.getUntrackedParameter<
bool>(
"addCommonMode",
false)),
225 cutOnTracks_(conf.getParameter<
bool>(
"cutOnTracks")),
226 trackMultiplicityCut_(conf.getParameter<
unsigned int>(
"trackMultiplicity")),
227 useFirstMeas_(conf.getParameter<
bool>(
"useFirstMeas")),
228 useLastMeas_(conf.getParameter<
bool>(
"useLastMeas")),
229 useAllHitsFromTracksWithMissingHits_(conf.getParameter<
bool>(
"useAllHitsFromTracksWithMissingHits")),
230 doMissingHitsRecovery_(conf.getParameter<
bool>(
"doMissingHitsRecovery")),
231 clusterMatchingMethod_(conf.getParameter<
int>(
"ClusterMatchingMethod")),
232 resXSig_(conf.getParameter<
double>(
"ResXSig")),
233 clusterTracjDist_(conf.getParameter<
double>(
"ClusterTrajDist")),
234 stripsApvEdge_(conf.getParameter<
double>(
"StripsApvEdge")),
235 useOnlyHighPurityTracks_(conf.getParameter<
bool>(
"UseOnlyHighPurityTracks")),
236 bunchX_(conf.getUntrackedParameter<
int>(
"BunchCrossing", 0)),
237 showRings_(conf.getUntrackedParameter<
bool>(
"ShowRings",
false)),
238 showTOB6TEC9_(conf.getUntrackedParameter<
bool>(
"ShowTOB6TEC9",
false)) {
239 hitRecoveryCounters.resize(k_END_OF_LAYERS, 0);
240 hitTotalCounters.resize(k_END_OF_LAYERS, 0);
241 missHitPerLayer.resize(k_END_OF_LAYERS, 0);
244 nTEClayers_ = (showRings_ ? 7 : 9);
247 if (!badModulesFile.empty()) {
248 std::ifstream badModules_file(badModulesFile);
249 uint32_t badmodule_detid;
250 int mods, fiber1, fiber2, fiber3;
251 if (badModules_file.is_open()) {
253 while (getline(badModules_file,
line)) {
254 if (badModules_file.eof())
256 std::stringstream
ss(
line);
257 ss >> badmodule_detid >>
mods >> fiber1 >> fiber2 >> fiber3;
258 if (badmodule_detid != 0 &&
mods == 1 && (fiber1 == 1 || fiber2 == 1 || fiber3 == 1))
259 badModules_.insert(badmodule_detid);
261 badModules_file.close();
264 if (!badModules_.empty())
265 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Remove additionnal bad modules from the analysis: ";
266 for (
const auto badMod : badModules_) {
267 LogDebug(
"SiStripHitEfficiencyWorker") <<
" " << badMod;
275 h_bx = booker.
book1D(
"bx",
"bx", 3600, 0, 3600);
277 h_PU = booker.
book1D(
"PU",
"PU", 200, 0, 200);
278 h_nTracks = booker.
book1D(
"ntracks",
"n.tracks;n. tracks;n.events", 500, -0.5, 499.5);
288 booker.
book1D(
"goodlayer_found",
"goodlayer_found", 35, 0., 35.));
290 booker.
book1D(
"alllayer_found",
"alllayer_found", 35, 0., 35.));
294 "layer_found",
"layer_found", bounds::k_END_OF_LAYERS, 0., static_cast<float>(bounds::k_END_OF_LAYERS)),
296 "layer_total",
"layer_total", bounds::k_END_OF_LAYERS, 0., static_cast<float>(bounds::k_END_OF_LAYERS)));
303 auto ihres = booker.
book1D(Form(
"resol_layer_%i",
layer), lyrName, 125, -125., 125.);
310 booker.
book1D(Form(
"layerfound_vsLumi_layer_%i",
layer), lyrName, 100, 0, 25000)));
315 booker.
book1D(Form(
"layerfound_vsPU_layer_%i",
layer), lyrName, 45, 0, 90)));
320 booker.
book1D(Form(
"layerfound_vsCM_layer_%i",
layer), lyrName, 20, 0, 400)));
326 booker.
book1D(Form(
"totalVsBx_layer%i",
layer), Form(
"layer %i (%s)",
layer, lyrName.c_str()), 3565, 0, 3565),
327 booker.
book1D(Form(
"foundVsBx_layer%i",
layer), Form(
"layer %i (%s)",
layer, lyrName.c_str()), 3565, 0, 3565)));
331 if (
layer <= bounds::k_LayersAtTOBEnd) {
332 const bool isTIB =
layer <= bounds::k_LayersAtTIBEnd;
333 const auto partition = (isTIB ?
"TIB" :
"TOB");
334 const auto yMax = (isTIB ? 100 : 120);
337 Form(
"%s%i: Map of missing hits",
partition, (isTIB ?
layer :
layer - bounds::k_LayersAtTIBEnd));
342 ::replaceInString(
name,
":",
"");
346 ihhotcold->setBinLabel(1,
"360", 1);
347 ihhotcold->setBinLabel(50,
"180", 1);
348 ihhotcold->setBinLabel(100,
"0", 1);
349 ihhotcold->setAxisTitle(
"Global Z [cm]", 2);
350 ihhotcold->setOption(
"colz");
353 const bool isTID =
layer <= bounds::k_LayersAtTIDEnd;
355 (isTID ? std::vector<std::string>{
"TIDplus",
"TIDminus"} : std::vector<std::string>{
"TECplus",
"TECminus"});
356 const auto axMax = (isTID ? 100 : 120);
360 ::replaceInString(forTitle,
"minus",
"-");
361 ::replaceInString(forTitle,
"plus",
"+");
365 const auto&
name = Form(
"%s %i Map of Missing Hits",
367 (isTID ?
layer - bounds::k_LayersAtTOBEnd :
layer - bounds::k_LayersAtTIDEnd));
368 const auto& tit = Form(
"%s%i: Map of Missing Hits",
370 (isTID ?
layer - bounds::k_LayersAtTOBEnd :
layer - bounds::k_LayersAtTIDEnd));
372 auto ihhotcold = booker.
book2D(
name, tit, 100, -axMax, axMax, 100, -axMax, axMax);
374 ihhotcold->setBinLabel(1,
"+Y", 1);
375 ihhotcold->setBinLabel(50,
"0", 1);
376 ihhotcold->setBinLabel(100,
"-Y", 1);
377 ihhotcold->setAxisTitle(
"Global X", 2);
378 ihhotcold->setBinLabel(1,
"-X", 2);
379 ihhotcold->setBinLabel(50,
"0", 2);
380 ihhotcold->setBinLabel(100,
"+X", 2);
381 ihhotcold->setOption(
"colz");
393 EffTkMap(std::make_unique<TkHistoMap>(tkDetMap, booker, tkDetMapFolder,
"perModule_total", 0,
false,
true),
394 std::make_unique<TkHistoMap>(tkDetMap, booker, tkDetMapFolder,
"perModule_found", 0,
false,
true));
400 std::make_unique<TkHistoMap>(tkDetMap, booker, FEDErrorMapFolder,
"perModule_FEDErrors", 0,
false,
true);
408 LogDebug(
"SiStripHitEfficiencyWorker") <<
"beginning analyze from HitEff";
424 }
else if (metaData.
isValid()) {
428 edm::LogWarning(
"SiStripHitEfficiencyWorker") <<
"could not find a source for the Luminosity and PU";
460 if (not fedErrorIdsCol_h.isValid() and not fedErrorIdsVec_h.isValid()) {
462 <<
"no valid product for SiStrip DetIds with FED errors (see parameter \"siStripDigis\"), " 463 "neither for new format (DetIdVector) nor old format (DetIdCollection)";
465 auto const& fedErrorIds = fedErrorIdsVec_h.isValid() ? *fedErrorIdsVec_h : fedErrorIdsCol_h->as_vector();
468 for (
const auto& fedErr : fedErrorIds) {
492 LogDebug(
"SiStripHitEfficiencyWorker") <<
"number ckf tracks found = " << tracksCKF->size();
502 if (!tracksCKF->empty()) {
506 LogDebug(
"SiStripHitEfficiencyWorker")
512 for (
const auto& trajTrack : *trajTrackAssociationHandle) {
516 auto TMeas = trajTrack.key->measurements();
526 bool hasMissingHits{
false};
527 int previous_layer{999};
528 std::vector<unsigned int> missedLayers;
530 for (
const auto& itm : TMeas) {
531 auto theHit = itm.recHit();
532 unsigned int iidd = theHit->geographicalId().rawId();
533 int layer = ::checkLayer(iidd, tTopo);
534 int missedLayer =
layer + 1;
535 int diffPreviousLayer = (
layer - previous_layer);
538 if (diffPreviousLayer == -2 && missedLayer > k_LayersStart && missedLayer < k_LayersAtTOBEnd) {
540 hasMissingHits =
true;
543 else if (diffPreviousLayer == -2 && (missedLayer > k_LayersAtTOBEnd + 1 && missedLayer <= k_LayersAtTIDEnd)) {
545 hasMissingHits =
true;
548 else if (diffPreviousLayer == -2 && missedLayer > k_LayersAtTIDEnd && missedLayer <= k_LayersAtTECEnd) {
550 hasMissingHits =
true;
554 if ((
layer > k_LayersStart &&
layer <= k_LayersAtTIBEnd) && (previous_layer == 12)) {
556 hasMissingHits =
true;
560 if ((
layer > k_LayersAtTIBEnd &&
layer <= k_LayersAtTOBEnd) && (previous_layer == 15)) {
562 hasMissingHits =
true;
566 hasMissingHits =
true;
569 missedLayers.push_back(
layer);
570 previous_layer =
layer;
575 unsigned int prev_TKlayers = 0;
576 for (
auto itm = TMeas.cbegin(); itm != TMeas.cend(); ++itm) {
577 const auto theInHit = (*itm).recHit();
582 LogDebug(
"SiStripHitEfficiencyWorker") <<
"theInHit is valid = " << theInHit->isValid();
584 unsigned int iidd = theInHit->geographicalId().rawId();
586 unsigned int TKlayers = ::checkLayer(iidd, tTopo);
592 LogDebug(
"SiStripHitEfficiencyWorker") <<
"TKlayer from trajectory: " << TKlayers <<
" from module = " << iidd
593 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" 594 << ((iidd & 0x3) == 1) <<
"/" << ((iidd & 0x3) == 2);
598 bool isFirstMeas = (itm == (TMeas.end() - 1));
599 bool isLastMeas = (itm == (TMeas.begin()));
612 if (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd) {
613 LogDebug(
"SiStripHitEfficiencyWorker") <<
"skipping original TM for TOB 6 or TEC 9";
617 std::vector<TrajectoryAtInvalidHit> TMs;
625 if (::isDoubleSided(iidd, tTopo) && ((iidd & 0x3) == 0)) {
628 TMs.emplace_back(*itm, tTopo, tkgeom,
propagator, 1);
629 TMs.emplace_back(*itm, tTopo, tkgeom,
propagator, 2);
630 }
else if (::isDoubleSided(iidd, tTopo) && (!::check2DPartner(iidd, TMeas))) {
633 TMs.emplace_back(*itm, tTopo, tkgeom,
propagator, 1);
634 TMs.emplace_back(*itm, tTopo, tkgeom,
propagator, 2);
635 LogDebug(
"SiStripHitEfficiencyWorker") <<
" found a hit with a missing partner";
638 TMs.emplace_back(*itm, tTopo, tkgeom,
propagator);
641 bool missingHitAdded{
false};
642 std::vector<TrajectoryMeasurement> tmpTmeas;
643 unsigned int misLayer = TKlayers + 1;
646 if (
int(TKlayers) -
int(prev_TKlayers) == -2) {
647 const DetLayer* detlayer = itm->layer();
650 std::vector<DetLayer::DetWithState> compatDets = detlayer->
compatibleDets(tsos, prop, chi2Estimator);
652 if (misLayer > k_LayersAtTIDEnd && misLayer < k_LayersAtTECEnd) {
653 std::vector<ForwardDetLayer const*> negTECLayers = measTracker.geometricSearchTracker()->negTecLayers();
654 std::vector<ForwardDetLayer const*> posTECLayers = measTracker.geometricSearchTracker()->posTecLayers();
655 const DetLayer* tecLayerneg = negTECLayers[misLayer - k_LayersAtTIDEnd - 1];
656 const DetLayer* tecLayerpos = posTECLayers[misLayer - k_LayersAtTIDEnd - 1];
657 if (tTopo->tecSide(iidd) == 1) {
658 tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, prop, chi2Estimator);
659 }
else if (tTopo->tecSide(iidd) == 2) {
660 tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, prop, chi2Estimator);
664 else if (misLayer == (k_LayersAtTIDEnd - 1) ||
665 misLayer == k_LayersAtTIDEnd) {
666 std::vector<ForwardDetLayer const*> negTIDLayers = measTracker.geometricSearchTracker()->negTidLayers();
667 std::vector<ForwardDetLayer const*> posTIDLayers = measTracker.geometricSearchTracker()->posTidLayers();
668 const DetLayer* tidLayerneg = negTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
669 const DetLayer* tidLayerpos = posTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
671 if (tTopo->tidSide(iidd) == 1) {
672 tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, prop, chi2Estimator);
673 }
else if (tTopo->tidSide(iidd) == 2) {
674 tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, prop, chi2Estimator);
678 if (misLayer > k_LayersStart && misLayer < k_LayersAtTOBEnd) {
680 std::vector<BarrelDetLayer const*> barrelTIBLayers = measTracker.geometricSearchTracker()->tibLayers();
681 std::vector<BarrelDetLayer const*> barrelTOBLayers = measTracker.geometricSearchTracker()->tobLayers();
683 if (misLayer > k_LayersStart && misLayer <= k_LayersAtTIBEnd) {
684 const DetLayer* tibLayer = barrelTIBLayers[misLayer - k_LayersStart - 1];
685 tmpTmeas = layerMeasurements.measurements(*tibLayer, tsos, prop, chi2Estimator);
686 }
else if (misLayer > k_LayersAtTIBEnd && misLayer < k_LayersAtTOBEnd) {
687 const DetLayer* tobLayer = barrelTOBLayers[misLayer - k_LayersAtTIBEnd - 1];
688 tmpTmeas = layerMeasurements.measurements(*tobLayer, tsos, prop, chi2Estimator);
692 if ((
int(TKlayers) > k_LayersStart &&
int(TKlayers) <= k_LayersAtTIBEnd) &&
int(prev_TKlayers) == 12) {
693 const DetLayer* detlayer = itm->layer();
696 std::vector<DetLayer::DetWithState> compatDets = detlayer->
compatibleDets(tsos, prop, chi2Estimator);
697 std::vector<ForwardDetLayer const*> negTIDLayers = measTracker.geometricSearchTracker()->negTidLayers();
698 std::vector<ForwardDetLayer const*> posTIDLayers = measTracker.geometricSearchTracker()->posTidLayers();
700 const DetLayer* tidLayerneg = negTIDLayers[k_LayersStart];
701 const DetLayer* tidLayerpos = posTIDLayers[k_LayersStart];
702 if (tTopo->tidSide(iidd) == 1) {
703 tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, prop, chi2Estimator);
704 }
else if (tTopo->tidSide(iidd) == 2) {
705 tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, prop, chi2Estimator);
709 if ((
int(TKlayers) > k_LayersAtTIBEnd &&
int(TKlayers) <= k_LayersAtTOBEnd) &&
int(prev_TKlayers) == 15) {
710 const DetLayer* detlayer = itm->layer();
713 std::vector<DetLayer::DetWithState> compatDets = detlayer->
compatibleDets(tsos, prop, chi2Estimator);
715 std::vector<ForwardDetLayer const*> negTECLayers = measTracker.geometricSearchTracker()->negTecLayers();
716 std::vector<ForwardDetLayer const*> posTECLayers = measTracker.geometricSearchTracker()->posTecLayers();
718 const DetLayer* tecLayerneg = negTECLayers[k_LayersStart];
719 const DetLayer* tecLayerpos = posTECLayers[k_LayersStart];
720 if (tTopo->tecSide(iidd) == 1) {
721 tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, prop, chi2Estimator);
722 }
else if (tTopo->tecSide(iidd) == 2) {
723 tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, prop, chi2Estimator);
727 if (!tmpTmeas.empty()) {
729 unsigned int iidd_tmp = TM_tmp.
recHit()->geographicalId().rawId();
731 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" hit actually being added to TM vector";
734 if (::isDoubleSided(iidd_tmp, tTopo)) {
739 missingHitAdded =
true;
745 prev_TKlayers = TKlayers;
750 bool hitsWithBias =
false;
751 for (
auto ilayer : missedLayers) {
752 if (ilayer < TKlayers)
765 const auto nextId = (itm + 1 != TMeas.end()) ? (itm + 1)->recHit()->geographicalId() :
DetId{};
767 if (TKlayers == 9 && theInHit->isValid() && !((!nextId.null()) && (::checkLayer(nextId.rawId(), tTopo) == 9))) {
770 const DetLayer* tob6 = measTracker.geometricSearchTracker()->tobLayers().back();
773 const auto tmp = theLayerMeasurements.measurements(*tob6, tsosTOB5, prop, chi2Estimator);
776 LogDebug(
"SiStripHitEfficiencyWorker") <<
"size of TM from propagation = " <<
tmp.size();
781 const auto& tob6TM =
tmp.back();
782 const auto& tob6Hit = tob6TM.recHit();
783 if (tob6Hit->geographicalId().rawId() != 0) {
784 LogDebug(
"SiStripHitEfficiencyWorker") <<
"tob6 hit actually being added to TM vector";
785 TMs.emplace_back(tob6TM, tTopo, tkgeom,
propagator);
791 if (TKlayers == 21 && theInHit->isValid() &&
792 !((!nextId.null()) && (::checkLayer(nextId.rawId(), tTopo) == 21))) {
793 const DetLayer* tec9pos = measTracker.geometricSearchTracker()->posTecLayers().back();
794 const DetLayer* tec9neg = measTracker.geometricSearchTracker()->negTecLayers().back();
801 LogDebug(
"SiStripHitEfficiencyWorker") <<
"there is a problem with TEC 9 extrapolation";
804 std::vector<TrajectoryMeasurement>
tmp;
805 if (tTopo->tecSide(iidd) == 1) {
806 tmp = theLayerMeasurements.measurements(*tec9neg, tsosTEC9, prop, chi2Estimator);
809 if (tTopo->tecSide(iidd) == 2) {
810 tmp = theLayerMeasurements.measurements(*tec9pos, tsosTEC9, prop, chi2Estimator);
818 const auto& tec9TM =
tmp.back();
819 const auto& tec9Hit = tec9TM.recHit();
821 const unsigned int tec9id = tec9Hit->geographicalId().rawId();
822 LogDebug(
"SiStripHitEfficiencyWorker")
823 <<
"tec9id = " << tec9id <<
" is Double sided = " << ::isDoubleSided(tec9id, tTopo)
824 <<
" and 0x3 = " << (tec9id & 0x3);
826 if (tec9Hit->geographicalId().rawId() != 0) {
827 LogDebug(
"SiStripHitEfficiencyWorker") <<
"tec9 hit actually being added to TM vector";
830 if (::isDoubleSided(tec9id, tTopo)) {
831 TMs.emplace_back(tec9TM, tTopo, tkgeom,
propagator, 1);
832 TMs.emplace_back(tec9TM, tTopo, tkgeom,
propagator, 2);
834 TMs.emplace_back(tec9TM, tTopo, tkgeom,
propagator);
839 for (
const auto& tm : TMs) {
853 LogDebug(
"SiStripHitEfficiencyWorker") <<
"After looping over TrajAtValidHit list";
855 LogDebug(
"SiStripHitEfficiencyWorker") <<
"end TMeasurement loop";
857 LogDebug(
"SiStripHitEfficiencyWorker") <<
"end of trajectories loop";
875 LogDebug(
"SiStripHitEfficiencyWorker") <<
"setting iidd = " << iidd <<
" before checking efficiency and ";
877 const auto xloc = tm.
localX();
878 const auto yloc = tm.
localY();
886 const auto TKlayers = ::checkLayer(iidd, tTopo);
888 const bool withinAcceptance =
889 tm.
withinAcceptance() && (!::isInBondingExclusionZone(iidd, TKlayers, yloc, yErr, tTopo));
893 (
layers_ == bounds::k_LayersStart))) {
894 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Looking at layer under study";
895 unsigned int ModIsBad = 2;
896 unsigned int SiStripQualBad = 0;
897 float commonMode = -100;
901 if (!theClusters.
empty()) {
902 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Checking clusters with size = " << theClusters.
size();
903 std::vector<::ClusterInfo> VCluster_info;
904 const auto idsv = theClusters.
find(iidd);
905 if (idsv != theClusters.
end()) {
907 LogDebug(
"SiStripHitEfficiencyWorker")
908 <<
"found (ClusterId == iidd) with ClusterId = " << idsv->id() <<
" and iidd = " << iidd;
917 if (TKlayers > bounds::k_LayersAtTOBEnd) {
918 const BoundPlane& plane = stripdet->surface();
920 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
921 std::array<const float, 4>
const& parameterTrap = (*trapezoidalBounds).
parameters();
922 hbedge = parameterTrap[0];
923 htedge = parameterTrap[1];
924 hapoth = parameterTrap[3];
925 uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
926 uxlden = 1 + yloc * uylfac;
930 if (TrajStrip == -1) {
932 float pitch = stripdet->surface().bounds().width() / nstrips;
933 TrajStrip = xloc / pitch + nstrips / 2.0;
935 if (TKlayers > bounds::k_LayersAtTOBEnd) {
936 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
938 TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
943 for (
const auto& clus : *idsv) {
946 float sigma = ::checkConsistency(
parameters, xloc, xErr);
953 if (TKlayers > bounds::k_LayersAtTOBEnd) {
956 yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
959 VCluster_info.emplace_back(
res, sigma,
parameters.first.x());
961 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Have ID match. residual = " <<
res <<
" res sigma = " << sigma;
964 LogDebug(
"SiStripHitEfficiencyWorker")
966 <<
" trajectory position = " << xloc <<
" traj error = " << xErr;
969 ::ClusterInfo finalCluster{1000.0, 1000.0, 0.0};
970 if (!VCluster_info.empty()) {
971 LogDebug(
"SiStripHitEfficiencyWorker") <<
"found clusters > 0";
972 if (VCluster_info.size() > 1) {
974 for (
const auto&
res : VCluster_info) {
978 LogDebug(
"SiStripHitEfficiencyWorker")
979 <<
"iresidual = " <<
res.xResidual <<
" isigma = " <<
res.xResidualPull
980 <<
" and FinalRes = " << finalCluster.xResidual;
983 finalCluster = VCluster_info[0];
985 VCluster_info.clear();
988 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Final residual in X = " << finalCluster.xResidual <<
"+-" 989 << (finalCluster.xResidual / finalCluster.xResidualPull);
990 LogDebug(
"SiStripHitEfficiencyWorker")
991 <<
"Checking location of trajectory: abs(yloc) = " <<
abs(yloc) <<
" abs(xloc) = " <<
abs(xloc);
999 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is bad from SiStripQuality";
1002 LogDebug(
"SiStripHitEfficiencyWorker") <<
"strip is good from SiStripQuality";
1006 for (
unsigned int ii = 0;
ii < fedErrorIds.size();
ii++) {
1007 if (iidd == fedErrorIds[
ii].
rawId())
1013 if (commonModeDigis.isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
1014 const auto digiframe = commonModeDigis->find(iidd);
1015 if (digiframe != commonModeDigis->end())
1020 LogDebug(
"SiStripHitEfficiencyWorker") <<
"before check good";
1022 if (finalCluster.xResidualPull < 999.0) {
1024 LogDebug(
"SiStripHitEfficiencyWorker")
1025 <<
"hit being counted as good " << finalCluster.xResidual <<
" FinalRecHit " << iidd <<
" TKlayers " 1026 << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc <<
" module " << iidd
1027 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1) <<
"/" 1028 << ((iidd & 0x3) == 2);
1031 LogDebug(
"SiStripHitEfficiencyWorker")
1032 <<
"hit being counted as bad ######### Invalid RPhi FinalResX " << finalCluster.xResidual
1033 <<
" FinalRecHit " << iidd <<
" TKlayers " << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc
1034 <<
" module " << iidd <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1)
1035 <<
"/" << ((iidd & 0x3) == 2);
1037 LogDebug(
"SiStripHitEfficiencyWorker")
1038 <<
" RPhi Error " <<
sqrt(xErr * xErr + yErr * yErr) <<
" ErrorX " << xErr <<
" yErr " << yErr;
1041 LogDebug(
"SiStripHitEfficiencyWorker")
1042 <<
"To avoid them staying unused: ModIsBad=" << ModIsBad <<
", SiStripQualBad=" << SiStripQualBad
1043 <<
", commonMode=" << commonMode <<
", highPurity=" <<
highPurity 1044 <<
", withinAcceptance=" << withinAcceptance;
1046 unsigned int layer = TKlayers;
1048 if (
layer <= bounds::k_LayersAtTIDEnd) {
1049 layer = bounds::k_LayersAtTOBEnd +
1052 layer = bounds::k_LayersAtTIDEnd + tTopo->
tecRing(iidd);
1055 unsigned int layerWithSide =
layer;
1056 if (
layer > bounds::k_LayersAtTOBEnd &&
layer <= bounds::k_LayersAtTIDEnd) {
1057 const auto side = tTopo->
tidSide(iidd);
1059 layerWithSide =
layer + 3;
1060 }
else if (
layer > bounds::k_LayersAtTIDEnd) {
1061 const auto side = tTopo->
tecSide(iidd);
1063 layerWithSide =
layer + 3;
1064 }
else if (side == 2) {
1069 if ((
bunchX_ > 0 &&
bunchX_ != bunchCrossing) || (!withinAcceptance) ||
1071 (!
showTOB6TEC9_ && (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd)) ||
1075 const bool badquality = (SiStripQualBad == 1);
1080 bool badflag =
false;
1085 if (ModIsBad == 1 || finalCluster.xResidualPull >
resXSig_)
1093 if (finalCluster.xResidualPull ==
1103 double stripTrajMid = xloc / Pitch + nstrips / 2.0;
1104 double stripCluster = finalCluster.xLocal / Pitch + nstrips / 2.0;
1107 if (stripdet &&
layer > bounds::k_LayersAtTOBEnd) {
1109 std::array<const float, 4>
const&
parameters = trapezoidalBounds.parameters();
1113 const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
1115 stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
1119 LogDebug(
"SiStripHitEfficiencyWorker")
1120 <<
"layer " <<
layer <<
" vector index " <<
layer - 1 <<
" before filling h_resolution" << std::endl;
1127 if (finalCluster.xResidualPull == 1000.0) {
1128 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for resxsig=1000";
1134 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for cluster-to-traj distance";
1144 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Too close to the edge: " << stripInAPV;
1148 LogDebug(
"SiStripHitEfficiencyWorker") <<
"Marking bad for tapv!=capv";
1155 LogDebug(
"SiStripHitEfficiencyWorker")
1156 <<
"Filling measurement for " << iidd <<
" in layer " <<
layer <<
" histograms with bx=" << bunchCrossing
1157 <<
", lumi=" <<
instLumi <<
", PU=" <<
PU <<
"; bad flag=" << badflag;
1161 if (
layer > bounds::k_LayersStart &&
layer <= bounds::k_LayersAtTIBEnd) {
1165 }
else if (
layer > bounds::k_LayersAtTIBEnd &&
layer <= bounds::k_LayersAtTOBEnd) {
1169 }
else if (
layer > bounds::k_LayersAtTOBEnd &&
layer <= bounds::k_LayersAtTIDEnd) {
1172 int side = tTopo->
tidSide(iidd);
1177 }
else if (
layer > bounds::k_LayersAtTIDEnd) {
1180 int side = tTopo->
tecSide(iidd);
1188 LogDebug(
"SiStripHitEfficiencyWorker")
1189 <<
"layer " <<
layer <<
" vector index " <<
layer - 1 <<
" before filling h_layer_vsSmthg" << std::endl;
1230 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after good location check";
1232 LogDebug(
"SiStripHitEfficiencyWorker") <<
"after list of clusters";
1234 LogDebug(
"SiStripHitEfficiencyWorker") <<
"After layers=TKLayers if with TKlayers=" << TKlayers
1241 desc.add<
bool>(
"UseOnlyHighPurityTracks",
true);
1242 desc.add<
bool>(
"cutOnTracks",
false);
1243 desc.add<
bool>(
"doMissingHitsRecovery",
false);
1244 desc.add<
bool>(
"useAllHitsFromTracksWithMissingHits",
false);
1245 desc.add<
bool>(
"useFirstMeas",
false);
1246 desc.add<
bool>(
"useLastMeas",
false);
1247 desc.add<
double>(
"ClusterTrajDist", 64.0);
1248 desc.add<
double>(
"ResXSig", -1);
1249 desc.add<
double>(
"StripsApvEdge", 10.0);
1258 desc.add<
int>(
"ClusterMatchingMethod", 0);
1259 desc.add<
int>(
"Layer", 0);
1260 desc.add<
unsigned int>(
"trackMultiplicity", 100);
1261 desc.addUntracked<
bool>(
"Debug",
false);
1262 desc.addUntracked<
bool>(
"ShowRings",
false);
1263 desc.addUntracked<
bool>(
"ShowTOB6TEC9",
false);
1264 desc.addUntracked<
bool>(
"addCommonMode",
false);
1265 desc.addUntracked<
bool>(
"addLumi",
true);
1266 desc.addUntracked<
int>(
"BunchCrossing", 0);
std::pair< LocalPoint, LocalError > LocalValues
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measTrackerToken_
const edm::EDGetTokenT< DetIdVector > digisVec_token_
MonitorElement * h_nTracksVsPU
virtual int nstrips() const =0
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void fill(double x, bool found, float weight=1.)
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< EffME1 > h_layer_vsPU
std::vector< MonitorElement * > h_resolution
MonitorElement * h_instLumi
bool useOnlyHighPurityTracks_
virtual void setCurrentFolder(std::string const &fullpath)
EffME1(MonitorElement *total, MonitorElement *found)
std::vector< EffME1 > h_layer_vsBx
void fillForTraj(const TrajectoryAtInvalidHit &tm, const TrackerTopology *tTopo, const TrackerGeometry *tkgeom, const StripClusterParameterEstimator &stripCPE, const SiStripQuality &stripQuality, const DetIdVector &fedErrorIds, const edm::Handle< edm::DetSetVector< SiStripRawDigi >> &commonModeDigis, const edmNew::DetSetVector< SiStripCluster > &theClusters, int bunchCrossing, float instLumi, float PU, bool highPurity)
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
std::vector< MonitorElement * > h_hotcold
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters <p) const
void bookHistograms(DQMStore::IBooker &booker, const edm::Run &run, const edm::EventSetup &setup) override
unsigned int tidSide(const DetId &id) const
Class to contain the online luminosity from soft FED 1022.
std::vector< Track > TrackCollection
collection of Tracks
unsigned int monodet_id() const
std::vector< EffME1 > h_layer_vsCM
std::vector< int > missHitPerLayer
float instLumi() const
Return the luminosity for the current nibble.
std::unordered_map< uint32_t, int > fedErrorCounts
unsigned int tecRing(const DetId &id) const
ring id
std::unique_ptr< TkHistoMap > FEDErrorOccupancy
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
const_iterator end(bool update=false) const
~SiStripHitEfficiencyWorker() override=default
const edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
std::unique_ptr< TkHistoMap > hTotal
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > stripCPEToken_
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
const edm::EDGetTokenT< OnlineLuminosityRecord > metaDataToken_
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > chi2EstimatorToken_
double localErrorX() const
unsigned int tecSide(const DetId &id) const
EffTkMap(std::unique_ptr< TkHistoMap > &&total, std::unique_ptr< TkHistoMap > &&found)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
unsigned int clusterMatchingMethod_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
unsigned int trackMultiplicityCut_
#define DEFINE_FWK_MODULE(type)
bool useAllHitsFromTracksWithMissingHits_
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::set< uint32_t > badModules_
dqm::reco::MonitorElement * EventStats
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
SiStripHitEfficiencyWorker(const edm::ParameterSet &conf)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::vector< DetId > DetIdVector
std::vector< unsigned int > hitTotalCounters
SiStripHitEffData calibData_
const Plane & surface() const
The nominal surface of the GeomDet.
const edm::EDGetTokenT< TrajTrackAssociationCollection > trajTrackAsso_token_
Constants and enumerated types for FED/FEC systems.
double localErrorY() const
virtual const std::array< const float, 4 > parameters() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
const edm::EDGetTokenT< DetIdCollection > digisCol_token_
std::unique_ptr< TkHistoMap > hFound
MonitorElement * h_nTracks
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
const_iterator find(id_type i, bool update=false) const
static const uint16_t STRIPS_PER_APV
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
std::vector< unsigned int > hitRecoveryCounters
unsigned int tidRing(const DetId &id) const
std::vector< LumiScalers > LumiScalersCollection
void fill(uint32_t id, bool found, float weight=1.)
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
virtual float width() const =0
std::vector< EffME1 > h_layer_vsLumi
MonitorElement * book2I(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
float avgPileUp() const
Return the average pileup for th current nibble.
ConstRecHitPointer const & recHit() const
bool doMissingHitsRecovery_
bool withinAcceptance() const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
short getBadApvs(uint32_t detid) const
const Bounds & bounds() const