CMS 3D CMS Logo

SeedForPhotonConversion1Leg.cc
Go to the documentation of this file.
2 
18 
19 //#define mydebug_seed
20 namespace {
21  template <class T>
22  T sqr(T t) {
23  return t * t;
24  }
25 } // namespace
26 
28  const SeedingHitSet& hits,
29  const GlobalPoint& vertex,
30  const GlobalVector& vertexBounds,
31  float ptmin,
32  const edm::EventSetup& es,
33  float cotTheta,
34  std::stringstream& ss) {
35  pss = &ss;
36  if (hits.size() < 2)
37  return nullptr;
38 
40  float sinTheta = sin(kine.momentum().theta());
41 
42  CurvilinearTrajectoryError error = initialError(vertexBounds, ptmin, sinTheta);
43  FreeTrajectoryState fts(kine, error);
44 
45  return buildSeed(seedCollection, hits, fts, es);
46 }
47 
49  const GlobalPoint& vertexPos,
50  const edm::EventSetup& es,
51  const float cotTheta) const {
53 
56 
57  // FIXME optimize: move outside loop
59  es.get<IdealMagneticFieldRecord>().get(bfield);
60  float nomField = bfield->nominalValue();
61 
62  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, &*bfield, vertexPos);
63  kine = helix.stateAtVertex();
64 
65  //force the pz/pt equal to the measured one
66  if (fabs(cotTheta) < cotTheta_Max)
68  kine.position(),
69  GlobalVector(kine.momentum().x(), kine.momentum().y(), kine.momentum().perp() * cotTheta),
70  kine.charge(),
71  &kine.magneticField());
72  else
74  kine.position(),
75  GlobalVector(kine.momentum().x(), kine.momentum().y(), kine.momentum().perp() * cotTheta_Max),
76  kine.charge(),
77  &kine.magneticField());
78 
79 #ifdef mydebug_seed
80  uint32_t detid;
81  (*pss) << "[SeedForPhotonConversion1Leg] initialKinematic tth1 ";
82  detid = tth1->geographicalId().rawId();
83  po.print(*pss, detid);
84  (*pss) << " \t " << detid << " " << tth1->localPosition() << " " << tth1->globalPosition();
85  detid = tth2->geographicalId().rawId();
86  (*pss) << " \n\t tth2 ";
87  po.print(*pss, detid);
88  (*pss) << " \t " << detid << " " << tth2->localPosition() << " " << tth2->globalPosition() << "\nhelix momentum "
89  << kine.momentum() << " pt " << kine.momentum().perp() << " radius " << 1 / kine.transverseCurvature();
90 #endif
91 
92  bool isBOFF = (0 == nomField);
93  ;
94  if (isBOFF && (theBOFFMomentum > 0)) {
95  kine =
96  GlobalTrajectoryParameters(kine.position(), kine.momentum().unit() * theBOFFMomentum, kine.charge(), &*bfield);
97  }
98  return kine;
99 }
100 
102  float ptMin,
103  float sinTheta) const {
104  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
105  // information.
106  GlobalError vertexErr(sqr(vertexBounds.x()), 0, sqr(vertexBounds.y()), 0, 0, sqr(vertexBounds.z()));
107 
108  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
109 
110  // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
111  // to avoid instabilities.
112  // N.B. This parameter needs optimising ...
113  float sin2th = sqr(sinTheta);
114  float minC00 = 1.0;
115  C[0][0] = std::max(sin2th / sqr(ptMin), minC00);
116  float zErr = vertexErr.czz();
117  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
118  C[3][3] = transverseErr;
119  C[4][4] = zErr * sin2th + transverseErr * (1 - sin2th);
120 
122 }
123 
125  const SeedingHitSet& hits,
126  const FreeTrajectoryState& fts,
127  const edm::EventSetup& es) const {
128  // FIXME all this stuff shoould go in an initialized...
129 
130  // get tracker
133 
134  // get propagator
135  edm::ESHandle<Propagator> propagatorHandle;
136  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
137  const Propagator* propagator = &(*propagatorHandle);
138 
140  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
141  auto builder = (TkTransientTrackingRecHitBuilder const*)(builderH.product());
142  auto cloner = (*builder).cloner();
143 
144  // get updator
146 
147  // Now update initial state track using information from seed hits.
148 
149  TrajectoryStateOnSurface updatedState;
151 
152  const TrackingRecHit* hit = nullptr;
153  for (unsigned int iHit = 0; iHit < hits.size() && iHit < 1; iHit++) {
154  hit = hits[iHit];
156  (iHit == 0) ? propagator->propagate(fts, tracker->idToDet(hit->geographicalId())->surface())
157  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
158  if (!state.isValid())
159  return nullptr;
160 
162 
163  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit(tth, state, cloner));
164 
165  if (!checkHit(state, &*newtth, es))
166  return nullptr;
167 
168  updatedState = updator.update(state, *newtth);
169  if (!updatedState.isValid())
170  return nullptr;
171 
172  seedHits.push_back(newtth.release());
173 #ifdef mydebug_seed
174  uint32_t detid = hit->geographicalId().rawId();
175  (*pss) << "\n[SeedForPhotonConversion1Leg] hit " << iHit;
176  po.print(*pss, detid);
177  (*pss) << " " << detid << "\t lp " << hit->localPosition() << " tth " << tth->localPosition() << " newtth "
178  << newtth->localPosition() << " state " << state.globalMomentum().perp();
179 #endif
180  }
181 
182  if (!hit)
183  return nullptr;
184 
185  PTrajectoryStateOnDet const& PTraj =
186  trajectoryStateTransform::persistentState(updatedState, hit->geographicalId().rawId());
187 
188  seedCollection.push_back(TrajectorySeed(PTraj, seedHits, alongMomentum));
189  return &seedCollection.back();
190 }
191 
194  const TkClonerImpl& cloner) const {
195  //const TransientTrackingRecHit* a= hit.get();
196  //return const_cast<TransientTrackingRecHit*> (a);
197  //This was modified otherwise the rechit will have just the local x component and local y=0
198  // To understand how to modify for pixels
199 
200  //const TSiStripRecHit2DLocalPos* b = dynamic_cast<const TSiStripRecHit2DLocalPos*>(a);
201  //return const_cast<TSiStripRecHit2DLocalPos*>(b);
202  return (SeedingHitSet::RecHitPointer)(cloner(*hit, state));
203 }
Vector3DBase
Definition: Vector3DBase.h:8
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SeedForPhotonConversion1Leg::thePropagatorLabel
std::string thePropagatorLabel
Definition: SeedForPhotonConversion1Leg.h:65
TrajectoryStateOnSurface.h
SeedForPhotonConversion1Leg::initialKinematic
GlobalTrajectoryParameters initialKinematic(const SeedingHitSet &hits, const GlobalPoint &vertexPos, const edm::EventSetup &es, const float cotTheta) const
Definition: SeedForPhotonConversion1Leg.cc:48
MessageLogger.h
TrackerGeometry.h
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
FastHelix.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ESHandle.h
PrintRecoObjects::print
void print(std::stringstream &ss, const SiStripCluster &clus)
Definition: PrintRecoObjects.cc:5
SeedingHitSet
Definition: SeedingHitSet.h:6
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
FastHelix
Definition: FastHelix.h:26
SeedForPhotonConversion1Leg::trajectorySeed
const TrajectorySeed * trajectorySeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const GlobalPoint &vertex, const GlobalVector &vertexBounds, float ptmin, const edm::EventSetup &es, float cotTheta, std::stringstream &ss)
Definition: SeedForPhotonConversion1Leg.cc:27
pss
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:25
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
TransientRecHitRecord.h
SeedForPhotonConversion1Leg::refitHit
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state, const TkClonerImpl &cloner) const
Definition: SeedForPhotonConversion1Leg.cc:192
SeedingHitSet::ConstRecHitPointer
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
GlobalTrajectoryParameters::charge
TrackCharge charge() const
Definition: GlobalTrajectoryParameters.h:72
sqr
int sqr(const T &t)
Definition: pfalgo_common_ref.h:9
SeedForPhotonConversion1Leg::checkHit
bool checkHit(const TrajectoryStateOnSurface &, const SeedingHitSet::ConstRecHitPointer &hit, const edm::EventSetup &es) const
Definition: SeedForPhotonConversion1Leg.h:42
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
SeedForPhotonConversion1Leg.h
relativeConstraints.error
error
Definition: relativeConstraints.py:53
TkTransientTrackingRecHitBuilder
Definition: TkTransientTrackingRecHitBuilder.h:15
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
SeedForPhotonConversion1Leg::TTRHBuilder
std::string TTRHBuilder
Definition: SeedForPhotonConversion1Leg.h:67
BaseTrackerRecHit
Definition: BaseTrackerRecHit.h:15
ElectronSeedTrackRefFix_cfi.seedCollection
seedCollection
Definition: ElectronSeedTrackRefFix_cfi.py:9
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
IdealMagneticFieldRecord.h
edm::ESHandle< MagneticField >
MagneticField::nominalValue
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
SeedForPhotonConversion1Leg::buildSeed
const TrajectorySeed * buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
Definition: SeedForPhotonConversion1Leg.cc:124
Point3DBase< float, GlobalTag >
GlobalErrorBase::cxx
T cxx() const
Definition: GlobalErrorBase.h:97
GlobalTrajectoryParameters::momentum
GlobalVector momentum() const
Definition: GlobalTrajectoryParameters.h:65
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
HLT_FULL_cff.updator
updator
Definition: HLT_FULL_cff.py:123
TrackerDigiGeometryRecord.h
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
KFUpdator.h
GlobalTrajectoryParameters::transverseCurvature
float transverseCurvature() const
Definition: GlobalTrajectoryParameters.h:89
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PropagatorWithMaterial.h
SeedForPhotonConversion1Leg::theBOFFMomentum
double theBOFFMomentum
Definition: SeedForPhotonConversion1Leg.h:66
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GlobalErrorBase< double, ErrorMatrixTag >
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
SeedForPhotonConversion1Leg::po
PrintRecoObjects po
Definition: SeedForPhotonConversion1Leg.h:70
TrackingRecHit
Definition: TrackingRecHit.h:21
TkClonerImpl
Definition: TkClonerImpl.h:12
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
gen::C
C
Definition: PomwigHadronizer.cc:78
T
long double T
Definition: Basic3DVectorLD.h:48
TrackingComponentsRecord.h
ptmin
double ptmin
Definition: HydjetWrapper.h:84
TrajectorySeed
Definition: TrajectorySeed.h:18
TrajectoryStateTransform.h
GlobalTrajectoryParameters::magneticField
const MagneticField & magneticField() const
Definition: GlobalTrajectoryParameters.h:106
SeedForPhotonConversion1Leg::initialError
CurvilinearTrajectoryError initialError(const GlobalVector &vertexBounds, float ptMin, float sinTheta) const
Definition: SeedForPhotonConversion1Leg.cc:101
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
GlobalErrorBase::czz
T czz() const
Definition: GlobalErrorBase.h:107
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
SeedForPhotonConversion1Leg::cotTheta_Max
static const int cotTheta_Max
Definition: SeedForPhotonConversion1Leg.h:22
PropagationExceptions.h
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
alongMomentum
Definition: PropagationDirection.h:4
KFUpdator
Definition: KFUpdator.h:32
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector< TrackingRecHit >
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12