173 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"beginning analyze from HitEff" << endl;
176 using namespace reco;
179 int run_nr =
e.id().run();
180 int ev_nr =
e.id().event();
181 int bunch_nr =
e.bunchCrossing();
279 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"number ckf tracks found = " << tracksCKF->size() << endl;
281 if (!tracksCKF->empty()) {
285 LogDebug(
"SiStripHitEfficiency:HitEff")
290 #ifdef ExtendedCALIBTree 293 if (
e.getByLabel(
"dedxMedianCTF", dEdxUncalibHandle)) {
297 dedx = dEdxTrackUncalib[itTrack].dEdx();
298 dedxNOM = dEdxTrackUncalib[itTrack].numberOfMeasurements();
306 if (
e.getByLabel(
"muonsWitht0Correction", muH)) {
308 if (!muonsT0.empty()) {
312 timeDTDOF = mt0.
nDof;
314 bool hasCaloEnergyInfo = muonsT0[0].isEnergyValid();
315 if (hasCaloEnergyInfo)
316 timeECAL = muonsT0[0].calEnergy().ecal_time;
330 it != trajTrackAssociationHandle->
end();
336 nHits = itraj->foundHits();
337 #ifdef ExtendedCALIBTree 338 nLostHits = itraj->lostHits();
339 chi2 = (itraj->chiSquared() / itraj->ndof());
340 p = itraj->lastMeasurement().updatedState().globalMomentum().mag();
342 pT =
sqrt((itraj->lastMeasurement().updatedState().globalMomentum().x() *
343 itraj->lastMeasurement().updatedState().globalMomentum().x()) +
344 (itraj->lastMeasurement().updatedState().globalMomentum().y() *
345 itraj->lastMeasurement().updatedState().globalMomentum().y()));
350 std::vector<TrajectoryMeasurement> TMeas = itraj->measurements();
351 vector<TrajectoryMeasurement>::iterator itm;
356 double angleX = -999.;
357 double angleY = -999.;
358 double xglob, yglob, zglob;
361 bool hasMissingHits =
false;
362 for (itm = TMeas.begin(); itm != TMeas.end(); itm++) {
363 auto theHit = (*itm).recHit();
365 hasMissingHits =
true;
371 for (itm = TMeas.begin(); itm != TMeas.end(); itm++) {
372 auto theInHit = (*itm).recHit();
374 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"theInHit is valid = " << theInHit->isValid() << endl;
376 unsigned int iidd = theInHit->geographicalId().rawId();
378 unsigned int TKlayers = ::checkLayer(iidd, tTopo);
379 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"TKlayer from trajectory: " << TKlayers <<
" from module = " << iidd
380 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" 381 << ((iidd & 0x3) == 1) <<
"/" << ((iidd & 0x3) == 2) << endl;
385 bool isFirstMeas = (itm == (TMeas.end() - 1));
386 bool isLastMeas = (itm == (TMeas.begin()));
399 if (TKlayers == 10 || TKlayers == 22) {
400 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"skipping original TM for TOB 6 or TEC 9" << endl;
405 std::vector<TrajectoryAtInvalidHit> TMs;
413 if (::isDoubleSided(iidd, tTopo) && ((iidd & 0x3) == 0)) {
418 }
else if (::isDoubleSided(iidd, tTopo) && (!::check2DPartner(iidd, TMeas))) {
423 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" found a hit with a missing partner" << endl;
435 bool isValid = theInHit->isValid();
436 bool isLast = (itm == (TMeas.end() - 1));
437 bool isLastTOB5 =
true;
439 if (::checkLayer((++itm)->recHit()->geographicalId().rawId(), tTopo) == 9)
446 if (TKlayers == 9 &&
isValid && isLastTOB5) {
449 std::vector<BarrelDetLayer const*> barrelTOBLayers =
450 measurementTrackerHandle->geometricSearchTracker()->tobLayers();
451 const DetLayer* tob6 = barrelTOBLayers[barrelTOBLayers.size() - 1];
454 auto tmp = layerMeasurements.measurements(*tob6, tsosTOB5, *thePropagator, *
estimator);
457 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"size of TM from propagation = " <<
tmp.size() << endl;
463 const auto& tob6Hit = tob6TM.
recHit();
465 if (tob6Hit->geographicalId().rawId() != 0) {
466 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"tob6 hit actually being added to TM vector" << endl;
472 bool isLastTEC8 =
true;
474 if (::checkLayer((++itm)->
recHit()->geographicalId().rawId(), tTopo) == 21)
481 if (TKlayers == 21 &&
isValid && isLastTEC8) {
482 std::vector<const ForwardDetLayer*> posTecLayers =
483 measurementTrackerHandle->geometricSearchTracker()->posTecLayers();
484 const DetLayer* tec9pos = posTecLayers[posTecLayers.size() - 1];
485 std::vector<const ForwardDetLayer*> negTecLayers =
486 measurementTrackerHandle->geometricSearchTracker()->negTecLayers();
487 const DetLayer* tec9neg = negTecLayers[negTecLayers.size() - 1];
493 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"there is a problem with TEC 9 extrapolation" << endl;
496 vector<TrajectoryMeasurement>
tmp;
497 if (tTopo->
tecSide(iidd) == 1) {
498 tmp = layerMeasurements.measurements(*tec9neg, tsosTEC9, *thePropagator, *
estimator);
501 if (tTopo->
tecSide(iidd) == 2) {
502 tmp = layerMeasurements.measurements(*tec9pos, tsosTEC9, *thePropagator, *
estimator);
511 const auto& tec9Hit = tec9TM.
recHit();
513 unsigned int tec9id = tec9Hit->geographicalId().rawId();
514 LogDebug(
"SiStripHitEfficiency:HitEff")
515 <<
"tec9id = " << tec9id <<
" is Double sided = " << ::isDoubleSided(tec9id, tTopo)
516 <<
" and 0x3 = " << (tec9id & 0x3) << endl;
518 if (tec9Hit->geographicalId().rawId() != 0) {
519 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"tec9 hit actually being added to TM vector" << endl;
522 if (::isDoubleSided(tec9id, tTopo)) {
535 for (std::vector<TrajectoryAtInvalidHit>::const_iterator TM = TMs.begin(); TM != TMs.end(); ++TM) {
537 iidd = TM->monodet_id();
538 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"setting iidd = " << iidd <<
" before checking efficiency and ";
543 angleX = atan(TM->localDxDz());
544 angleY = atan(TM->localDyDz());
549 xglob = TM->globalX();
550 yglob = TM->globalY();
551 zglob = TM->globalZ();
552 xErr = TM->localErrorX();
553 yErr = TM->localErrorY();
564 TKlayers = ::checkLayer(iidd, tTopo);
568 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Looking at layer under study" << endl;
590 if (!
input.empty()) {
591 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Checking clusters with size = " <<
input.size() << endl;
593 std::vector<std::vector<float> >
599 unsigned int ClusterId = DSViter->id();
600 if (ClusterId == iidd) {
601 LogDebug(
"SiStripHitEfficiency:HitEff")
602 <<
"found (ClusterId == iidd) with ClusterId = " << ClusterId <<
" and iidd = " << iidd << endl;
603 DetId ClusterDetId(ClusterId);
612 if (TKlayers >= 11) {
615 dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
616 std::array<const float, 4>
const& parameterTrap =
618 hbedge = parameterTrap[0];
619 htedge = parameterTrap[1];
620 hapoth = parameterTrap[3];
621 uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
622 uxlden = 1 + yloc * uylfac;
626 if (TrajStrip == -1) {
629 TrajStrip = xloc / pitch + nstrips / 2.0;
631 if (TKlayers >= 11) {
632 float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
634 TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
644 float sigma = ::checkConsistency(
parameters, xloc, xErr);
651 if (TKlayers >= 11) {
655 yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
662 std::vector<float> cluster_info;
663 cluster_info.push_back(
res);
664 cluster_info.push_back(sigma);
670 VCluster_info.push_back(cluster_info);
672 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Have ID match. residual = " << VCluster_info.back()[0]
673 <<
" res sigma = " << VCluster_info.back()[1] << endl;
674 LogDebug(
"SiStripHitEfficiency:HitEff")
675 <<
"trajectory measurement compatability estimate = " << (*itm).estimate() << endl;
676 LogDebug(
"SiStripHitEfficiency:HitEff")
678 <<
" trajectory position = " << xloc <<
" traj error = " << xErr << endl;
682 float FinalResSig = 1000.0;
683 float FinalCluster[7] = {1000.0, 1000.0, 0.0, 0.0, 0.0, 0.0, 0.0};
685 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"found clusters > 0" << endl;
688 vector<vector<float> >::iterator ires;
689 for (ires = VCluster_info.begin(); ires != VCluster_info.end(); ires++) {
690 if (
abs((*ires)[1]) <
abs(FinalResSig)) {
691 FinalResSig = (*ires)[1];
692 for (
unsigned int i = 0;
i < ires->size();
i++) {
693 LogDebug(
"SiStripHitEfficiency:HitEff")
694 <<
"filling final cluster. i = " <<
i <<
" before fill FinalCluster[i]=" << FinalCluster[
i]
695 <<
" and (*ires)[i] =" << (*ires)[
i] << endl;
696 FinalCluster[
i] = (*ires)[
i];
697 LogDebug(
"SiStripHitEfficiency:HitEff")
698 <<
"filling final cluster. i = " <<
i <<
" after fill FinalCluster[i]=" << FinalCluster[
i]
699 <<
" and (*ires)[i] =" << (*ires)[
i] << endl;
702 LogDebug(
"SiStripHitEfficiency:HitEff")
703 <<
"iresidual = " << (*ires)[0] <<
" isigma = " << (*ires)[1]
704 <<
" and FinalRes = " << FinalCluster[0] << endl;
707 FinalResSig = VCluster_info.at(0)[1];
708 for (
unsigned int i = 0;
i < VCluster_info.at(0).size();
i++) {
709 FinalCluster[
i] = VCluster_info.at(0)[
i];
712 VCluster_info.clear();
715 LogDebug(
"SiStripHitEfficiency:HitEff")
716 <<
"Final residual in X = " << FinalCluster[0] <<
"+-" << (FinalCluster[0] / FinalResSig) << endl;
717 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Checking location of trajectory: abs(yloc) = " <<
abs(yloc)
718 <<
" abs(xloc) = " <<
abs(xloc) << endl;
719 LogDebug(
"SiStripHitEfficiency:HitEff")
720 <<
"Checking location of cluster hit: yloc = " << FinalCluster[4] <<
"+-" << FinalCluster[5]
721 <<
" xloc = " << FinalCluster[2] <<
"+-" << FinalCluster[3] << endl;
722 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"Final cluster signal to noise = " << FinalCluster[6] << endl;
724 float exclusionWidth = 0.4;
725 float TOBexclusion = 0.0;
726 float TECexRing5 = -0.89;
727 float TECexRing6 = -0.56;
728 float TECexRing7 = 0.60;
731 int ringnumber = ((iidd >> 5) & 0x7);
734 if ((TKlayers >= 5 && TKlayers < 11) ||
735 ((
subdetector == 6) && ((ringnumber >= 5) && (ringnumber <= 7)))) {
737 float highzone = 0.0;
739 float higherr = yloc + 5.0 * yErr;
740 float lowerr = yloc - 5.0 * yErr;
741 if (TKlayers >= 5 && TKlayers < 11) {
743 highzone = TOBexclusion + exclusionWidth;
744 lowzone = TOBexclusion - exclusionWidth;
745 }
else if (ringnumber == 5) {
747 highzone = TECexRing5 + exclusionWidth;
748 lowzone = TECexRing5 - exclusionWidth;
749 }
else if (ringnumber == 6) {
751 highzone = TECexRing6 + exclusionWidth;
752 lowzone = TECexRing6 - exclusionWidth;
753 }
else if (ringnumber == 7) {
755 highzone = TECexRing7 + exclusionWidth;
756 lowzone = TECexRing7 - exclusionWidth;
759 if ((highzone <= higherr) && (highzone >= lowerr))
761 if ((lowzone >= lowerr) && (lowzone <= higherr))
763 if ((higherr <= highzone) && (higherr >= lowzone))
765 if ((lowerr >= lowzone) && (lowerr <= highzone))
785 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"strip is bad from SiStripQuality" << endl;
788 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"strip is good from SiStripQuality" << endl;
792 for (
unsigned int ii = 0;
ii < fedErrorIds->
size();
ii++) {
793 if (iidd == (*fedErrorIds)[
ii].rawId())
801 ResX = FinalCluster[0];
803 if (FinalResSig != FinalCluster[1])
804 LogDebug(
"SiStripHitEfficiency:HitEff")
805 <<
"Problem with best cluster selection because FinalResSig = " << FinalResSig
806 <<
" and FinalCluster[1] = " << FinalCluster[1] << endl;
815 if (commonModeDigis.
isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
817 if (digiframe != commonModeDigis->end())
818 if ((
unsigned)TrajStrip / 128 < digiframe->data.
size())
819 commonMode = digiframe->data.at(TrajStrip / 128).adc();
822 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"before check good" << endl;
824 if (FinalResSig < 999.0) {
826 LogDebug(
"SiStripHitEfficiency:HitEff")
827 <<
"hit being counted as good " << FinalCluster[0] <<
" FinalRecHit " << iidd <<
" TKlayers " 828 << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc <<
" module " << iidd
829 <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" << ((iidd & 0x3) == 1) <<
"/" 830 << ((iidd & 0x3) == 2) << endl;
834 LogDebug(
"SiStripHitEfficiency:HitEff")
835 <<
"hit being counted as bad ######### Invalid RPhi FinalResX " << FinalCluster[0]
836 <<
" FinalRecHit " << iidd <<
" TKlayers " << TKlayers <<
" xloc " << xloc <<
" yloc " << yloc
837 <<
" module " << iidd <<
" matched/stereo/rphi = " << ((iidd & 0x3) == 0) <<
"/" 838 << ((iidd & 0x3) == 1) <<
"/" << ((iidd & 0x3) == 2) << endl;
842 LogDebug(
"SiStripHitEfficiency:HitEff") <<
" RPhi Error " <<
sqrt(xErr * xErr + yErr * yErr)
843 <<
" ErrorX " << xErr <<
" yErr " << yErr << endl;
845 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"after good location check" << endl;
847 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"after list of clusters" << endl;
849 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"After layers=TKLayers if" << endl;
851 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"After looping over TrajAtValidHit list" << endl;
853 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"end TMeasurement loop" << endl;
855 LogDebug(
"SiStripHitEfficiency:HitEff") <<
"end of trajectories loop" << endl;
std::pair< LocalPoint, LocalError > LocalValues
static constexpr auto TEC
virtual int nstrips() const =0
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
void setCluster(const SiStripCluster &cluster, int detId)
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
bool useAllHitsFromTracksWithMissingHits_
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
SiStripClusterInfo siStripClusterInfo_
data_type const * const_iterator
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
key_type key() const
Accessor for product key.
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
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_
const edm::EDGetTokenT< DetIdCollection > digis_token_
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
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTkToken_
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > chi2MeasurementEstimatorToken_
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_
void initEvent(const edm::EventSetup &iSetup)
collection_type::const_iterator const_iterator
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
virtual float width() const =0
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
ConstRecHitPointer const & recHit() const
short getBadApvs(uint32_t detid) const
const Bounds & bounds() const