CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 SeedForPhotonConversion1Leg (const std::string &propagator="PropagatorWithMaterial", double seedMomentumForBOFF=-5.0)
 
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
 

Protected Attributes

TkClonerImpl cloner
 
PrintRecoObjects po
 
std::stringstream * pss
 
double theBOFFMomentum
 
std::string thePropagatorLabel
 

Detailed Description

Definition at line 22 of file SeedForPhotonConversion1Leg.h.

Constructor & Destructor Documentation

SeedForPhotonConversion1Leg::SeedForPhotonConversion1Leg ( const edm::ParameterSet cfg)
inline

Definition at line 26 of file SeedForPhotonConversion1Leg.h.

26  :
27  thePropagatorLabel(cfg.getParameter<std::string>("propagator")),
28  theBOFFMomentum(cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
29  {}
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
SeedForPhotonConversion1Leg::SeedForPhotonConversion1Leg ( const std::string &  propagator = "PropagatorWithMaterial",
double  seedMomentumForBOFF = -5.0 
)
inline

Definition at line 31 of file SeedForPhotonConversion1Leg.h.

33  : thePropagatorLabel(propagator), theBOFFMomentum(seedMomentumForBOFF) { }
SeedForPhotonConversion1Leg::~SeedForPhotonConversion1Leg ( )
inline

Definition at line 36 of file SeedForPhotonConversion1Leg.h.

36 {}

Member Function Documentation

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

Definition at line 134 of file SeedForPhotonConversion1Leg.cc.

References alongMomentum, checkHit(), cloner, cond::rpcobgas::detid, TrackingRecHit::geographicalId(), edm::EventSetup::get(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::isValid(), TrackingRecHit::localPosition(), PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), po, PrintRecoObjects::print(), edm::ESHandle< class >::product(), Propagator::propagate(), edm::OwnVector< T, P >::push_back(), DetId::rawId(), refitHit(), SeedingHitSet::size(), thePropagatorLabel, patCandidatesForDimuonsSequences_cff::tracker, MixedLayerPairs_cfi::TTRHBuilder, and KFUpdator::update().

Referenced by trajectorySeed().

139 {
140  // get tracker
142  es.get<TrackerDigiGeometryRecord>().get(tracker);
143 
144  // get propagator
145  edm::ESHandle<Propagator> propagatorHandle;
146  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
147  const Propagator* propagator = &(*propagatorHandle);
148 
149  // get cloner (FIXME: add to config)
150  try {
151  auto TTRHBuilder = "WithTrackAngle";
153  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
154  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
155  cloner = (*builder).cloner();
156  } catch(...) {
157  auto TTRHBuilder = "hltESPTTRHBWithTrackAngle";
159  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
160  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
161  cloner = (*builder).cloner();
162  }
163 
164  // get updator
165  KFUpdator updator;
166 
167  // Now update initial state track using information from seed hits.
168 
169  TrajectoryStateOnSurface updatedState;
171 
172  const TrackingRecHit* hit = 0;
173  for ( unsigned int iHit = 0; iHit < hits.size() && iHit<1; iHit++) {
174  hit = hits[iHit];
175  TrajectoryStateOnSurface state = (iHit==0) ?
176  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
177  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
178  if (!state.isValid()) return 0;
179 
180  SeedingHitSet::ConstRecHitPointer tth = hits[iHit];
181 
182  std::unique_ptr<BaseTrackerRecHit> newtth(refitHit( tth, state));
183 
184 
185  if (!checkHit(state,&*newtth,es)) return 0;
186 
187  updatedState = updator.update(state, *newtth);
188  if (!updatedState.isValid()) return 0;
189 
190  seedHits.push_back(newtth.release());
191 #ifdef mydebug_seed
192  uint32_t detid = hit->geographicalId().rawId();
193  (*pss) << "\n[SeedForPhotonConversion1Leg] hit " << iHit;
194  po.print(*pss, detid);
195  (*pss) << " " << detid << "\t lp " << hit->localPosition()
196  << " tth " << tth->localPosition() << " newtth " << newtth->localPosition() << " state " << state.globalMomentum().perp();
197 #endif
198  }
199 
200 
201  PTrajectoryStateOnDet const & PTraj =
203 
204  seedCollection.push_back( TrajectorySeed(PTraj,seedHits,alongMomentum));
205  return &seedCollection.back();
206 }
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:72
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void push_back(D *&d)
Definition: OwnVector.h:280
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:75
void print(std::stringstream &ss, const SiStripCluster &clus)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
GlobalVector globalMomentum() const
unsigned int size() const
Definition: SeedingHitSet.h:44
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state) const
DetId geographicalId() const
bool checkHit(const TrajectoryStateOnSurface &, const SeedingHitSet::ConstRecHitPointer &hit, const edm::EventSetup &es) const
virtual LocalPoint localPosition() const =0
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().

53  { return true; }
CurvilinearTrajectoryError SeedForPhotonConversion1Leg::initialError ( const GlobalVector vertexBounds,
float  ptMin,
float  sinTheta 
) const
protected

Definition at line 105 of file SeedForPhotonConversion1Leg.cc.

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

Referenced by trajectorySeed().

109 {
110  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
111  // information.
112  GlobalError vertexErr( sqr(vertexBounds.x()), 0,
113  sqr(vertexBounds.y()), 0, 0,
114  sqr(vertexBounds.z())
115  );
116 
117 
118  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
119 
120 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
121 // to avoid instabilities.
122 // N.B. This parameter needs optimising ...
123  float sin2th = sqr(sinTheta);
124  float minC00 = 1.0;
125  C[0][0] = std::max(sin2th/sqr(ptMin), minC00);
126  float zErr = vertexErr.czz();
127  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
128  C[3][3] = transverseErr;
129  C[4][4] = zErr*sin2th + transverseErr*(1-sin2th);
130 
131  return CurvilinearTrajectoryError(C);
132 }
T y() const
Definition: PV3DBase.h:63
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
T z() const
Definition: PV3DBase.h:64
Square< F >::type sqr(const F &f)
Definition: Square.h:13
T x() const
Definition: PV3DBase.h:62
GlobalTrajectoryParameters SeedForPhotonConversion1Leg::initialKinematic ( const SeedingHitSet hits,
const GlobalPoint vertexPos,
const edm::EventSetup es,
const float  cotTheta 
) const
protected

Definition at line 46 of file SeedForPhotonConversion1Leg.cc.

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

Referenced by trajectorySeed().

51 {
53 
54  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
55  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
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)
67  kine = GlobalTrajectoryParameters(kine.position(),
68  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta),
69  kine.charge(),
70  & kine.magneticField()
71  );
72  else
74  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta_Max),
75  kine.charge(),
76  & kine.magneticField()
77  );
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()
89  << "\nhelix momentum " << kine.momentum() << " pt " << kine.momentum().perp() << " radius " << 1/kine.transverseCurvature();
90 #endif
91 
92  bool isBOFF =(0==nomField);;
93  if (isBOFF && (theBOFFMomentum > 0)) {
95  kine.momentum().unit() * theBOFFMomentum,
96  kine.charge(),
97  &*bfield);
98  }
99  return kine;
100 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:72
T y() const
Definition: PV3DBase.h:63
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
void print(std::stringstream &ss, const SiStripCluster &clus)
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const T & get() const
Definition: EventSetup.h:55
const MagneticField & magneticField() const
T x() const
Definition: PV3DBase.h:62
Global3DVector GlobalVector
Definition: GlobalVector.h:10
SeedingHitSet::RecHitPointer SeedForPhotonConversion1Leg::refitHit ( SeedingHitSet::ConstRecHitPointer  hit,
const TrajectoryStateOnSurface state 
) const
protected

Definition at line 208 of file SeedForPhotonConversion1Leg.cc.

References cloner.

Referenced by buildSeed().

211 {
212  //const TransientTrackingRecHit* a= hit.get();
213  //return const_cast<TransientTrackingRecHit*> (a);
214  //This was modified otherwise the rechit will have just the local x component and local y=0
215  // To understand how to modify for pixels
216 
217  //const TSiStripRecHit2DLocalPos* b = dynamic_cast<const TSiStripRecHit2DLocalPos*>(a);
218  //return const_cast<TSiStripRecHit2DLocalPos*>(b);
219  return (SeedingHitSet::RecHitPointer)(cloner(*hit,state));
220 }
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 24 of file SeedForPhotonConversion1Leg.cc.

References buildSeed(), relativeConstraints::error, initialError(), initialKinematic(), GlobalTrajectoryParameters::momentum(), funct::sin(), SeedingHitSet::size(), contentValuesCheck::ss, and PV3DBase< T, PVType, FrameType >::theta().

32 {
33  pss = &ss;
34  if ( hits.size() < 2) return 0;
35 
36  GlobalTrajectoryParameters kine = initialKinematic(hits, vertex, es, cotTheta);
37  float sinTheta = sin(kine.momentum().theta());
38 
39  CurvilinearTrajectoryError error = initialError(vertexBounds, ptmin, sinTheta);
40  FreeTrajectoryState fts(kine, error);
41 
42  return buildSeed(seedCollection,hits,fts,es);
43 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
const TrajectorySeed * buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
GlobalTrajectoryParameters initialKinematic(const SeedingHitSet &hits, const GlobalPoint &vertexPos, const edm::EventSetup &es, const float cotTheta) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
double ptmin
Definition: HydjetWrapper.h:85
unsigned int size() const
Definition: SeedingHitSet.h:44
CurvilinearTrajectoryError initialError(const GlobalVector &vertexBounds, float ptMin, float sinTheta) const

Member Data Documentation

TkClonerImpl SeedForPhotonConversion1Leg::cloner
mutableprotected

Definition at line 80 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed(), and refitHit().

const int SeedForPhotonConversion1Leg::cotTheta_Max =99999
static

Definition at line 24 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

PrintRecoObjects SeedForPhotonConversion1Leg::po
protected

Definition at line 83 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed(), and initialKinematic().

std::stringstream* SeedForPhotonConversion1Leg::pss
protected

Definition at line 82 of file SeedForPhotonConversion1Leg.h.

double SeedForPhotonConversion1Leg::theBOFFMomentum
protected

Definition at line 77 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

std::string SeedForPhotonConversion1Leg::thePropagatorLabel
protected

Definition at line 76 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().