Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-11 16:23:18

0001 #include "SeedFromConsecutiveHitsTripletOnlyCreator.h"
0002 
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include "MagneticField/Engine/interface/MagneticField.h"
0005 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
0009 #include "RecoTracker/TkSeedGenerator/interface/FastHelix.h"
0010 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
0011 #include "FWCore/Utilities/interface/Likely.h"
0012 
0013 bool SeedFromConsecutiveHitsTripletOnlyCreator::initialKinematic(GlobalTrajectoryParameters& kine,
0014                                                                  const SeedingHitSet& hits) const {
0015   SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
0016   SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
0017 
0018   if (hits.size() == 3 &&
0019       !(trackerHitRTTI::isSingleType(*hits[2]) && (hits[2]->geographicalId().subdetId() == SiStripDetId::TID ||
0020                                                    hits[2]->geographicalId().subdetId() == SiStripDetId::TEC))) {
0021     //if 3rd hit is mono and endcap pT is not well defined so take initial state from pair
0022     SeedingHitSet::ConstRecHitPointer tth3 = hits[2];
0023     FastHelix helix(tth3->globalPosition(),
0024                     tth2->globalPosition(),
0025                     tth1->globalPosition(),
0026                     nomField,
0027                     magneticField_,
0028                     tth1->globalPosition());
0029     kine = helix.stateAtVertex();
0030     if UNLIKELY (isBOFF && (theBOFFMomentum > 0)) {
0031       kine = GlobalTrajectoryParameters(
0032           kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), magneticField_);
0033     }
0034     return (filter ? filter->compatible(hits, kine, helix) : true);
0035   }
0036 
0037   const GlobalPoint& vertexPos = region->origin();
0038 
0039   FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, magneticField_);
0040   if (helix.isValid()) {
0041     kine = helix.stateAtVertex();
0042   } else {
0043     GlobalVector initMomentum(tth2->globalPosition() - vertexPos);
0044     initMomentum *= (100. / initMomentum.perp());
0045     kine = GlobalTrajectoryParameters(vertexPos, initMomentum, 1, magneticField_);
0046   }
0047 
0048   if UNLIKELY (isBOFF && (theBOFFMomentum > 0)) {
0049     kine = GlobalTrajectoryParameters(
0050         kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), magneticField_);
0051   }
0052   return (filter ? filter->compatible(hits, kine, helix) : true);
0053 }