CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
SeedForPhotonConversion1Leg Class Reference

#include <SeedForPhotonConversion1Leg.h>

Public Member Functions

 SeedForPhotonConversion1Leg (const edm::ParameterSet &cfg, edm::ConsumesCollector iC)
 
const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const GlobalPoint &vertex, const GlobalVector &vertexBounds, float ptmin, const edm::EventSetup &es, float cotTheta, std::stringstream &ss)
 
 ~SeedForPhotonConversion1Leg ()
 

Static Public Attributes

static const int cotTheta_Max = 99999
 

Protected Member Functions

const TrajectorySeedbuildSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
 
bool checkHit (const TrajectoryStateOnSurface &, const SeedingHitSet::ConstRecHitPointer &hit, const edm::EventSetup &es) const
 
CurvilinearTrajectoryError initialError (const GlobalVector &vertexBounds, float ptMin, float sinTheta) const
 
GlobalTrajectoryParameters initialKinematic (const SeedingHitSet &hits, const GlobalPoint &vertexPos, const edm::EventSetup &es, const float cotTheta) const
 
SeedingHitSet::RecHitPointer refitHit (SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state, const TkClonerImpl &cloner) const
 

Protected Attributes

PrintRecoObjects po
 
std::stringstream * pss
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtheBfieldToken
 
double theBOFFMomentum
 
edm::ESGetToken< Propagator, TrackingComponentsRecordthePropagatorToken
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtheTrackerToken
 
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordtheTTRHBuilderToken
 

Detailed Description

Definition at line 26 of file SeedForPhotonConversion1Leg.h.

Constructor & Destructor Documentation

◆ SeedForPhotonConversion1Leg()

SeedForPhotonConversion1Leg::SeedForPhotonConversion1Leg ( const edm::ParameterSet cfg,
edm::ConsumesCollector  iC 
)
inline

Definition at line 30 of file SeedForPhotonConversion1Leg.h.

31  : theBfieldToken(iC.esConsumes()),
33  thePropagatorToken(iC.esConsumes(edm::ESInputTag("", cfg.getParameter<std::string>("propagator")))),
34  theTTRHBuilderToken(iC.esConsumes(edm::ESInputTag("", cfg.getParameter<std::string>("TTRHBuilder")))),
35  theBOFFMomentum(cfg.getParameter<double>("SeedMomentumForBOFF")) {}
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTTRHBuilderToken
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theBfieldToken

◆ ~SeedForPhotonConversion1Leg()

SeedForPhotonConversion1Leg::~SeedForPhotonConversion1Leg ( )
inline

Definition at line 38 of file SeedForPhotonConversion1Leg.h.

38 {}

Member Function Documentation

◆ buildSeed()

const TrajectorySeed * SeedForPhotonConversion1Leg::buildSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const FreeTrajectoryState fts,
const edm::EventSetup es 
) const
protected

Definition at line 115 of file SeedForPhotonConversion1Leg.cc.

References alongMomentum, checkHit(), runTheMatrix::const, edm::EventSetup::getData(), hfClusterShapes_cfi::hits, TrajectoryStateOnSurface::isValid(), trajectoryStateTransform::persistentState(), po, PrintRecoObjects::print(), TrackCandidateProducer_cfi::propagator, edm::OwnVector< T, P >::push_back(), refitHit(), ElectronSeedTrackRefFix_cfi::seedCollection, thePropagatorToken, theTrackerToken, theTTRHBuilderToken, PbPb_ZMuSkimMuonDPG_cff::tracker, and HLT_2022v12_cff::updator.

Referenced by trajectorySeed().

118  {
119  // FIXME all this stuff shoould go in an initialized...
120 
121  // get tracker
122  const auto* tracker = &es.getData(theTrackerToken);
123 
124  // get propagator
126 
127  auto builder = static_cast<TkTransientTrackingRecHitBuilder const*>(&es.getData(theTTRHBuilderToken));
128  auto cloner = (*builder).cloner();
129 
130  // get updator
132 
133  // Now update initial state track using information from seed hits.
134 
135  TrajectoryStateOnSurface updatedState;
137 
138  const TrackingRecHit* hit = nullptr;
139  for (unsigned int iHit = 0; iHit < hits.size() && iHit < 1; iHit++) {
140  hit = hits[iHit];
142  (iHit == 0) ? propagator->propagate(fts, tracker->idToDet(hit->geographicalId())->surface())
143  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
144  if (!state.isValid())
145  return nullptr;
146 
148 
149  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit(tth, state, cloner));
150 
151  if (!checkHit(state, &*newtth, es))
152  return nullptr;
153 
154  updatedState = updator.update(state, *newtth);
155  if (!updatedState.isValid())
156  return nullptr;
157 
158  seedHits.push_back(newtth.release());
159 #ifdef mydebug_seed
160  uint32_t detid = hit->geographicalId().rawId();
161  (*pss) << "\n[SeedForPhotonConversion1Leg] hit " << iHit;
162  po.print(*pss, detid);
163  (*pss) << " " << detid << "\t lp " << hit->localPosition() << " tth " << tth->localPosition() << " newtth "
164  << newtth->localPosition() << " state " << state.globalMomentum().perp();
165 #endif
166  }
167 
168  if (!hit)
169  return nullptr;
170 
171  PTrajectoryStateOnDet const& PTraj =
172  trajectoryStateTransform::persistentState(updatedState, hit->geographicalId().rawId());
173 
174  seedCollection.push_back(TrajectorySeed(PTraj, seedHits, alongMomentum));
175  return &seedCollection.back();
176 }
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state, const TkClonerImpl &cloner) const
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTTRHBuilderToken
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
void push_back(D *&d)
Definition: OwnVector.h:326
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
void print(std::stringstream &ss, const SiStripCluster &clus)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
bool checkHit(const TrajectoryStateOnSurface &, const SeedingHitSet::ConstRecHitPointer &hit, const edm::EventSetup &es) const
edm::ESGetToken< Propagator, TrackingComponentsRecord > thePropagatorToken

◆ checkHit()

bool SeedForPhotonConversion1Leg::checkHit ( const TrajectoryStateOnSurface ,
const SeedingHitSet::ConstRecHitPointer hit,
const edm::EventSetup es 
) const
inlineprotected

Definition at line 50 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().

52  {
53  return true;
54  }

◆ initialError()

CurvilinearTrajectoryError SeedForPhotonConversion1Leg::initialError ( const GlobalVector vertexBounds,
float  ptMin,
float  sinTheta 
) const
protected

Definition at line 92 of file SeedForPhotonConversion1Leg.cc.

References correctionTermsCaloMet_cff::C, GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::czz(), SiStripPI::max, ptMin, sqr(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by trajectorySeed().

94  {
95  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
96  // information.
97  GlobalError vertexErr(sqr(vertexBounds.x()), 0, sqr(vertexBounds.y()), 0, 0, sqr(vertexBounds.z()));
98 
99  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
100 
101  // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
102  // to avoid instabilities.
103  // N.B. This parameter needs optimising ...
104  float sin2th = sqr(sinTheta);
105  float minC00 = 1.0;
106  C[0][0] = std::max(sin2th / sqr(ptMin), minC00);
107  float zErr = vertexErr.czz();
108  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
109  C[3][3] = transverseErr;
110  C[4][4] = zErr * sin2th + transverseErr * (1 - sin2th);
111 
113 }
T z() const
Definition: PV3DBase.h:61
constexpr float ptMin
int sqr(const T &t)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55

◆ initialKinematic()

GlobalTrajectoryParameters SeedForPhotonConversion1Leg::initialKinematic ( const SeedingHitSet hits,
const GlobalPoint vertexPos,
const edm::EventSetup es,
const float  cotTheta 
) const
protected

Definition at line 40 of file SeedForPhotonConversion1Leg.cc.

References GlobalTrajectoryParameters::charge(), cotTheta_Max, edm::EventSetup::getData(), hfClusterShapes_cfi::hits, GlobalTrajectoryParameters::magneticField(), GlobalTrajectoryParameters::momentum(), PV3DBase< T, PVType, FrameType >::perp(), po, GlobalTrajectoryParameters::position(), PrintRecoObjects::print(), theBfieldToken, theBOFFMomentum, GlobalTrajectoryParameters::transverseCurvature(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by trajectorySeed().

43  {
45 
48 
49  // FIXME optimize: move outside loop
50  const auto& bfield = es.getData(theBfieldToken);
51  float nomField = bfield.nominalValue();
52 
53  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, &bfield, vertexPos);
54  kine = helix.stateAtVertex();
55 
56  //force the pz/pt equal to the measured one
57  if (fabs(cotTheta) < cotTheta_Max)
59  kine.position(),
60  GlobalVector(kine.momentum().x(), kine.momentum().y(), kine.momentum().perp() * cotTheta),
61  kine.charge(),
62  &kine.magneticField());
63  else
65  kine.position(),
66  GlobalVector(kine.momentum().x(), kine.momentum().y(), kine.momentum().perp() * cotTheta_Max),
67  kine.charge(),
68  &kine.magneticField());
69 
70 #ifdef mydebug_seed
71  uint32_t detid;
72  (*pss) << "[SeedForPhotonConversion1Leg] initialKinematic tth1 ";
73  detid = tth1->geographicalId().rawId();
74  po.print(*pss, detid);
75  (*pss) << " \t " << detid << " " << tth1->localPosition() << " " << tth1->globalPosition();
76  detid = tth2->geographicalId().rawId();
77  (*pss) << " \n\t tth2 ";
78  po.print(*pss, detid);
79  (*pss) << " \t " << detid << " " << tth2->localPosition() << " " << tth2->globalPosition() << "\nhelix momentum "
80  << kine.momentum() << " pt " << kine.momentum().perp() << " radius " << 1 / kine.transverseCurvature();
81 #endif
82 
83  bool isBOFF = (0 == nomField);
84  ;
85  if (isBOFF && (theBOFFMomentum > 0)) {
86  kine =
87  GlobalTrajectoryParameters(kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), &bfield);
88  }
89  return kine;
90 }
T perp() const
Definition: PV3DBase.h:69
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
void print(std::stringstream &ss, const SiStripCluster &clus)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const MagneticField & magneticField() const
Vector3DBase unit() const
Definition: Vector3DBase.h:54
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theBfieldToken
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ refitHit()

SeedingHitSet::RecHitPointer SeedForPhotonConversion1Leg::refitHit ( SeedingHitSet::ConstRecHitPointer  hit,
const TrajectoryStateOnSurface state,
const TkClonerImpl cloner 
) const
protected

Definition at line 178 of file SeedForPhotonConversion1Leg.cc.

Referenced by buildSeed().

180  {
181  //const TransientTrackingRecHit* a= hit.get();
182  //return const_cast<TransientTrackingRecHit*> (a);
183  //This was modified otherwise the rechit will have just the local x component and local y=0
184  // To understand how to modify for pixels
185 
186  //const TSiStripRecHit2DLocalPos* b = dynamic_cast<const TSiStripRecHit2DLocalPos*>(a);
187  //return const_cast<TSiStripRecHit2DLocalPos*>(b);
188  return (SeedingHitSet::RecHitPointer)(cloner(*hit, state));
189 }

◆ trajectorySeed()

const TrajectorySeed * SeedForPhotonConversion1Leg::trajectorySeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const GlobalPoint vertex,
const GlobalVector vertexBounds,
float  ptmin,
const edm::EventSetup es,
float  cotTheta,
std::stringstream &  ss 
)

Definition at line 19 of file SeedForPhotonConversion1Leg.cc.

References buildSeed(), relativeConstraints::error, hfClusterShapes_cfi::hits, initialError(), initialKinematic(), GlobalTrajectoryParameters::momentum(), ptmin, ElectronSeedTrackRefFix_cfi::seedCollection, funct::sin(), contentValuesCheck::ss, PV3DBase< T, PVType, FrameType >::theta(), and bphysicsOniaDQM_cfi::vertex.

26  {
27  pss = &ss;
28  if (hits.size() < 2)
29  return nullptr;
30 
32  float sinTheta = sin(kine.momentum().theta());
33 
34  CurvilinearTrajectoryError error = initialError(vertexBounds, ptmin, sinTheta);
35  FreeTrajectoryState fts(kine, error);
36 
37  return buildSeed(seedCollection, hits, fts, es);
38 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
CurvilinearTrajectoryError initialError(const GlobalVector &vertexBounds, float ptMin, float sinTheta) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
GlobalTrajectoryParameters initialKinematic(const SeedingHitSet &hits, const GlobalPoint &vertexPos, const edm::EventSetup &es, const float cotTheta) const
const TrajectorySeed * buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
double ptmin
Definition: HydjetWrapper.h:84
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72

Member Data Documentation

◆ cotTheta_Max

const int SeedForPhotonConversion1Leg::cotTheta_Max = 99999
static

Definition at line 28 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

◆ po

PrintRecoObjects SeedForPhotonConversion1Leg::po
protected

Definition at line 80 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed(), and initialKinematic().

◆ pss

std::stringstream* SeedForPhotonConversion1Leg::pss
protected

Definition at line 79 of file SeedForPhotonConversion1Leg.h.

◆ theBfieldToken

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SeedForPhotonConversion1Leg::theBfieldToken
protected

Definition at line 73 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

◆ theBOFFMomentum

double SeedForPhotonConversion1Leg::theBOFFMomentum
protected

Definition at line 77 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

◆ thePropagatorToken

edm::ESGetToken<Propagator, TrackingComponentsRecord> SeedForPhotonConversion1Leg::thePropagatorToken
protected

Definition at line 75 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().

◆ theTrackerToken

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SeedForPhotonConversion1Leg::theTrackerToken
protected

Definition at line 74 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().

◆ theTTRHBuilderToken

edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> SeedForPhotonConversion1Leg::theTTRHBuilderToken
protected

Definition at line 76 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().