37 #include <unordered_set>
48 testBeamspotCompatibility(
false),
50 testPrimaryVertexCompatibility(
false),
54 produces<TrajectorySeedCollection>();
60 simTrack_pTMin = simTrackSelectionConfig.getParameter<
double>(
"pTMin");
61 simTrack_maxD0 = simTrackSelectionConfig.getParameter<
double>(
"maxD0");
62 simTrack_maxZ0 = simTrackSelectionConfig.getParameter<
double>(
"maxZ0");
64 std::vector<edm::InputTag> skipSimTrackTags = simTrackSelectionConfig.getParameter<std::vector<edm::InputTag> >(
"skipSimTrackIds");
66 for (
unsigned int k=0;
k<skipSimTrackTags.size(); ++
k)
76 if (beamSpotTag.label()!=
"")
82 if (primaryVertexTag.
label()!=
"")
91 throw cms::Exception(
"FastSimulation/Tracking/TrajectorySeedProducer: bad configuration",
"Either 'beamSpot' or 'primaryVertex' compatiblity should be configured; not both");
96 recHitToken = consumes<SiTrackerGSMatchedRecHit2DCollection>(recHitTag);
99 std::vector<std::string> layerStringList = conf.
getParameter<std::vector<std::string>>(
"layerList");
100 for(
auto it=layerStringList.cbegin(); it < layerStringList.cend(); ++it)
102 std::vector<TrackingLayer> trackingLayerList;
105 while (pos != std::string::npos)
111 trackingLayerList.push_back(layerSpec);
112 line=line.substr(pos+1,std::string::npos);
124 if (originHalfLength>=0 && nSigmaZ>=0)
126 throw cms::Exception(
"FastSimulation/Tracking/TrajectorySeedProducer: bad configuration",
"Either 'originHalfLength' or 'nSigmaZ' selection should be configured; not both. Deactivate one (or both) by setting it to <0.");
130 if ((ptMin>=0 && simTrack_pTMin>=0) && (ptMin<simTrack_pTMin))
132 throw cms::Exception(
"FastSimulation/Tracking/TrajectorySeedProducer: bad configuration",
"Performance cut on SimTrack pT is tighter than cut on pT estimate from seed.");
134 if ((originHalfLength>=0 && simTrack_maxZ0>=0) && (originHalfLength>simTrack_maxZ0))
136 throw cms::Exception(
"FastSimulation/Tracking/TrajectorySeedProducer: bad configuration",
"Performance cut on SimTrack dz is tighter than cut on dz estimate from seed.");
140 throw cms::Exception(
"FastSimulation/Tracking/TrajectorySeedProducer: bad configuration",
"Performance cut on SimTrack dxy is tighter than cut on dxy estimate from seed.");
201 std::vector<const math::XYZPoint*> origins;
215 for (
unsigned int i = 0;
i < origins.size(); ++
i)
254 const std::vector<TrajectorySeedHitCandidate>& trackerRecHits,
255 std::vector<int>& hitIndicesInTree,
261 if (hitIndicesInTree[node->
getIndex()]<0)
272 hitIndicesInTree[node->
getIndex()]=trackerHit;
281 for (
unsigned int ichild = 0; ichild<node->
getChildrenSize(); ++ichild)
297 const std::vector<TrajectorySeedHitCandidate>& trackerRecHits,
298 std::vector<int> hitIndicesInTree,
299 bool processSkippedHits
302 for (
unsigned int irecHit = start; irecHit<trackerRecHits.size(); ++irecHit)
304 unsigned int currentHitIndex=irecHit;
306 for (
unsigned int inext=currentHitIndex+1; inext< trackerRecHits.size(); ++inext)
309 if (trackerRecHits[currentHitIndex].getTrackingLayer()==trackerRecHits[inext].getTrackingLayer())
311 if (processSkippedHits)
320 if (seedHits.size()>0)
333 processSkippedHits=
true;
342 std::vector<unsigned int> seedIndices(seedNode->
getDepth()+1);
353 return std::vector<unsigned int>();
363 std::unordered_set<unsigned int> skipSimTrackIds;
368 skipSimTrackIds.insert(skipSimTrackIds_temp->begin(),skipSimTrackIds_temp->end());
400 if(theGSRecHits->size() == 0)
408 const unsigned int currentSimTrackId = *itSimTrackId;
410 if(skipSimTrackIds.find(currentSimTrackId)!=skipSimTrackIds.end())
415 const SimTrack& theSimTrack = (*theSimTracks)[currentSimTrackId];
417 int vertexIndex = theSimTrack.
vertIndex();
423 const SimVertex& theSimVertex = (*theSimVtx)[vertexIndex];
433 unsigned int layersCrossed=0;
435 std::vector<TrajectorySeedHitCandidate> trackerRecHits;
439 previousTrackerHit=currentTrackerHit;
450 trackerRecHits.push_back(std::move(currentTrackerHit));
473 std::vector<unsigned int> seedHitNumbers =
iterateHits(0,trackerRecHits,hitIndicesInTree,
true);
475 if (seedHitNumbers.size()>0)
478 for (
unsigned ihit=0; ihit<seedHitNumbers.size(); ++ihit )
484 (*theSimVtx)[vertexIndex].
position().
y(),
485 (*theSimVtx)[vertexIndex].
position().
z());
493 if(trackerRecHits[seedHitNumbers[0]].
subDetId() !=1 ||trackerRecHits[seedHitNumbers[0]].
subDetId() !=2)
495 errorMatrix = errorMatrix * 0.0000001;
510 float localErrors[15];
512 for (
int i=0;
i<dim; ++
i)
514 for (
int j=0;
j<=
i; ++
j)
516 localErrors[k++] =
m(
i,
j);
519 int surfaceSide =
static_cast<int>(initialTSOS.
surfaceSide());
579 if ((zConstraint>0) && ( fabs(myPart.
Z()-
beamSpot->
position().Z()) > zConstraint ))
602 for (
unsigned iv=0; iv<nVertices; ++iv )
607 double xV = vertex.
x();
608 double yV = vertex.
y();
609 double zV = vertex.
z();
612 double R1 =
std::sqrt ( (gpos1.
x()-xV)*(gpos1.
x()-xV) + (gpos1.
y()-yV)*(gpos1.
y()-yV) );
613 double R2 =
std::sqrt ( (gpos2.
x()-xV)*(gpos2.
x()-xV) + (gpos2.
y()-yV)*(gpos2.
y()-yV) );
618 double checkRZ1 = forward ?
619 (gpos1.
z()-zV+zConstraint) / (gpos2.
z()-zV+zConstraint) * R2 :
620 -zConstraint + R1/R2*(gpos2.
z()-zV+zConstraint);
621 double checkRZ2 = forward ?
622 (gpos1.
z()-zV-zConstraint)/(gpos2.
z()-zV-zConstraint) * R2 :
623 +zConstraint + R1/R2*(gpos2.
z()-zV-zConstraint);
627 bool compatible = forward ?
628 checkRZmin < R1 && R1 < checkRZmax :
629 checkRZmin < gpos1.
z()-zV && gpos1.
z()-zV < checkRZmax;
const double Z[kNumberCalorimeter]
bool passHitTuplesCuts(const SeedingNode< TrackingLayer > &seedingNode, const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, const std::vector< int > &hitIndicesInTree, const TrajectorySeedHitCandidate ¤tTrackerHit) const
method checks if a TrajectorySeedHitCandidate fulfills the quality requirements.
void setCharge(float q)
set the MEASURED charge
T getParameter(std::string const &) const
tuple start
Check for commandline option errors.
const MagneticField * magneticField
std::pair< const_iterator, const_iterator > range
iterator range
double zImpactParameter(double x0=0, double y0=0.) const
Longitudinal impact parameter.
bool compatibleWithBeamSpot(const GlobalPoint &gpos1, const GlobalPoint &gpos2, double error, bool forward) const
TrajectorySeedProducer(const edm::ParameterSet &conf)
const LocalTrajectoryParameters & localParameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double zError() const
error on z
double y() const
y coordinate
const SingleSet & getSingleSet() const
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
bool isForward() const
Is it a forward hit ?
double largerError() const
bool propagateToBeamCylinder(const XYZTLorentzVector &v, double radius=0.)
virtual void produce(edm::Event &e, const edm::EventSetup &es)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
GlobalPoint globalPosition() const
The global position.
const DATA & getData() const
float charge() const
charge
unsigned int getChildrenSize() const
const Plane & surface() const
The nominal surface of the GeomDet.
edm::EDGetTokenT< SiTrackerGSMatchedRecHit2DCollection > recHitToken
unsigned int getDepth() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const reco::BeamSpot * beamSpot
std::vector< edm::EDGetTokenT< std::vector< unsigned int > > > skipSimTrackIdTokens
uint32_t rawId() const
get the raw id
const SeedingNode * getParent() const
bool insert(const std::vector< DATA > &dataList)
unsigned int numberOfNodes() const
C::const_iterator const_iterator
constant access iterator type
unsigned int numberOfRoots() const
const TrackerTopology * trackerTopology
std::vector< TrajectorySeed > TrajectorySeedCollection
bool testPrimaryVertexCompatibility
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
unsigned int subDetId[18]
SurfaceSide surfaceSide() const
Position relative to material, defined relative to momentum vector.
const reco::VertexCollection * primaryVertices
virtual std::vector< unsigned int > iterateHits(unsigned int start, const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > hitIndicesInTree, bool processSkippedHits) const
method tries to insert all hits into the tree structure.
double Z() const
z of vertex
double z() const
y coordinate
virtual void beginRun(edm::Run const &run, const edm::EventSetup &es)
static TrackingLayer createFromString(std::string layerSpecification)
const AlgebraicSymMatrix55 & matrix() const
const math::XYZTLorentzVectorD & position() const
const LocalTrajectoryError & localError() const
edm::EDGetTokenT< edm::SimVertexContainer > simVertexToken
bool isHitOnLayer(const TrajectorySeedHitCandidate &trackerRecHit, const TrackingLayer &layer) const
bool pass2HitsCuts(const TrajectorySeedHitCandidate &hit1, const TrajectorySeedHitCandidate &hit2) const
virtual TrackingRecHit * clone() const =0
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
edm::EDGetTokenT< edm::SimTrackContainer > simTrackToken
virtual bool passSimTrackQualityCuts(const SimTrack &theSimTrack, const SimVertex &theSimVertex) const
method checks if a SimTrack fulfills the quality requirements.
virtual TrackingRecHit const * hit() const
double x() const
x coordinate
T const * product() const
double sigmaZ() const
sigma z
std::vector< std::vector< TrackingLayer > > seedingLayers
const SeedingNode< DATA > * getRoot(unsigned int i) const
unsigned int minLayersCrossed
GlobalVector globalMomentum() const
const math::XYZTLorentzVectorD & momentum() const
static int position[264][3]
edm::EDGetTokenT< reco::VertexCollection > recoVertexToken
const TrackerGeometry * trackerGeometry
const SeedingNode< TrackingLayer > * insertHit(const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > &hitIndicesInTree, const SeedingNode< TrackingLayer > *node, unsigned int trackerHit) const
method inserts hit into the tree structure at an empty position.
std::shared_ptr< PropagatorWithMaterial > thePropagator
const Point & position() const
position
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
unsigned int getIndex() const
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
const TrackingLayer & getTrackingLayer() const
SeedingTree< TrackingLayer > _seedingTree
bool compatibleWithPrimaryVertex(const GlobalPoint &gpos1, const GlobalPoint &gpos2, double error, bool forward) const
bool isOnTheSameLayer(const TrajectorySeedHitCandidate &other) const
Check if two hits are on the same layer of the same subdetector.
const MagneticFieldMap * magneticFieldMap
bool testBeamspotCompatibility
double xyImpactParameter(double x0=0., double y0=0.) const
Transverse impact parameter.
const SeedingNode< DATA > * getChild(unsigned int ichild) const
math::XYZTLorentzVector XYZTLorentzVector
virtual const TrackerGeomDet * idToDet(DetId) const