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>

Inheritance diagram for SeedForPhotonConversion1Leg:
SeedCreator

Public Member Functions

 SeedForPhotonConversion1Leg (const edm::ParameterSet &cfg)
 
 SeedForPhotonConversion1Leg (const std::string &propagator="PropagatorWithMaterial", double seedMomentumForBOFF=-5.0)
 
virtual const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const GlobalPoint &vertex, const GlobalVector &vertexBounds, float ptmin, const edm::EventSetup &es, float cotTheta, std::stringstream &ss)
 
virtual const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter)
 
virtual ~SeedForPhotonConversion1Leg ()
 
- Public Member Functions inherited from SeedCreator
virtual ~SeedCreator ()
 

Static Public Attributes

static const int cotTheta_Max =99999
 

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Definition at line 9 of file SeedForPhotonConversion1Leg.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file SeedForPhotonConversion1Leg.h.

13  :
14  thePropagatorLabel(cfg.getParameter<std::string>("propagator")),
15  theBOFFMomentum(cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
16  {}
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:187
SeedForPhotonConversion1Leg::SeedForPhotonConversion1Leg ( const std::string &  propagator = "PropagatorWithMaterial",
double  seedMomentumForBOFF = -5.0 
)
inline
virtual SeedForPhotonConversion1Leg::~SeedForPhotonConversion1Leg ( )
inlinevirtual

Definition at line 23 of file SeedForPhotonConversion1Leg.h.

23 {}

Member Function Documentation

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

Definition at line 130 of file SeedForPhotonConversion1Leg.cc.

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

Referenced by trajectorySeed().

135 {
136  // get tracker
138  es.get<TrackerDigiGeometryRecord>().get(tracker);
139 
140  // get propagator
141  edm::ESHandle<Propagator> propagatorHandle;
142  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
143  const Propagator* propagator = &(*propagatorHandle);
144 
145  // get updator
146  KFUpdator updator;
147 
148  // Now update initial state track using information from seed hits.
149 
150  TrajectoryStateOnSurface updatedState;
152 
153  const TrackingRecHit* hit = 0;
154  for ( unsigned int iHit = 0; iHit < hits.size() && iHit<1; iHit++) {
155  hit = hits[iHit]->hit();
156  TrajectoryStateOnSurface state = (iHit==0) ?
157  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
158  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
159  if (!state.isValid()) return 0;
160 
162 
163  TransientTrackingRecHit::RecHitPointer newtth = refitHit( tth, state);
164 
165 
166  if (!checkHit(state,newtth,es)) return 0;
167 
168  updatedState = updator.update(state, *newtth);
169  if (!updatedState.isValid()) return 0;
170 
171  seedHits.push_back(newtth->hit()->clone());
172 #ifdef mydebug_seed
173  uint32_t detid = hit->geographicalId().rawId();
174  (*pss) << "\n[SeedForPhotonConversion1Leg] hit " << iHit;
175  po.print(*pss, detid);
176  (*pss) << " " << detid << "\t lp " << hit->localPosition()
177  << " tth " << tth->localPosition() << " newtth " << newtth->localPosition() << " state " << state.globalMomentum().perp();
178 #endif
179  }
180 
181 
182  PTrajectoryStateOnDet const & PTraj =
184 
185  seedCollection.push_back( TrajectorySeed(PTraj,seedHits,alongMomentum));
186  return &seedCollection.back();
187 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:71
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void push_back(D *&d)
Definition: OwnVector.h:273
void print(std::stringstream &ss, const SiStripCluster &clus)
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
const T & get() const
Definition: EventSetup.h:55
char state
Definition: procUtils.cc:75
GlobalVector globalMomentum() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
virtual TransientTrackingRecHit::RecHitPointer refitHit(const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrajectoryStateOnSurface &state) const
unsigned int size() const
Definition: SeedingHitSet.h:31
DetId geographicalId() const
virtual bool checkHit(const TrajectoryStateOnSurface &, const TransientTrackingRecHit::ConstRecHitPointer &hit, const edm::EventSetup &es) const
virtual LocalPoint localPosition() const =0
virtual bool SeedForPhotonConversion1Leg::checkHit ( const TrajectoryStateOnSurface ,
const TransientTrackingRecHit::ConstRecHitPointer hit,
const edm::EventSetup es 
) const
inlineprotectedvirtual

Definition at line 43 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().

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

Definition at line 101 of file SeedForPhotonConversion1Leg.cc.

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

Referenced by trajectorySeed().

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

Definition at line 44 of file SeedForPhotonConversion1Leg.cc.

References abs, GlobalTrajectoryParameters::charge(), cotTheta_Max, cond::rpcobgas::detid, alignCSCRings::e, 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().

49 {
51 
54 
55 
56  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, es, vertexPos);
57  kine = helix.stateAtVertex().parameters();
58 
59  //force the pz/pt equal to the measured one
60  if(fabs(cotTheta)<cotTheta_Max)
61  kine = GlobalTrajectoryParameters(kine.position(),
62  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta),
63  kine.charge(),
64  & kine.magneticField()
65  );
66  else
68  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta_Max),
69  kine.charge(),
70  & kine.magneticField()
71  );
72 
73 #ifdef mydebug_seed
74  uint32_t detid;
75  (*pss) << "[SeedForPhotonConversion1Leg] initialKinematic tth1 " ;
76  detid=tth1->geographicalId().rawId();
77  po.print(*pss, detid );
78  (*pss) << " \t " << detid << " " << tth1->localPosition() << " " << tth1->globalPosition() ;
79  detid= tth2->geographicalId().rawId();
80  (*pss) << " \n\t tth2 ";
81  po.print(*pss, detid );
82  (*pss) << " \t " << detid << " " << tth2->localPosition() << " " << tth2->globalPosition()
83  << "\nhelix momentum " << kine.momentum() << " pt " << kine.momentum().perp() << " radius " << 1/kine.transverseCurvature();
84 #endif
85 
87  es.get<IdealMagneticFieldRecord>().get(bfield);
88  bool isBOFF = ( std::abs(bfield->inTesla(GlobalPoint(0,0,0)).z()) < 1e-3 );
89  if (isBOFF && (theBOFFMomentum > 0)) {
91  kine.momentum().unit() * theBOFFMomentum,
92  kine.charge(),
93  &*bfield);
94  }
95  return kine;
96 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:71
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
void print(std::stringstream &ss, const SiStripCluster &clus)
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const MagneticField & magneticField() const
T x() const
Definition: PV3DBase.h:61
Global3DVector GlobalVector
Definition: GlobalVector.h:10
TransientTrackingRecHit::RecHitPointer SeedForPhotonConversion1Leg::refitHit ( const TransientTrackingRecHit::ConstRecHitPointer hit,
const TrajectoryStateOnSurface state 
) const
protectedvirtual

Definition at line 189 of file SeedForPhotonConversion1Leg.cc.

Referenced by buildSeed().

192 {
193  //const TransientTrackingRecHit* a= hit.get();
194  //return const_cast<TransientTrackingRecHit*> (a);
195  //This was modified otherwise the rechit will have just the local x component and local y=0
196  // To understand how to modify for pixels
197 
198  //const TSiStripRecHit2DLocalPos* b = dynamic_cast<const TSiStripRecHit2DLocalPos*>(a);
199  //return const_cast<TSiStripRecHit2DLocalPos*>(b);
200  return hit->clone(state);
201 }
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 
)
virtual

Definition at line 22 of file SeedForPhotonConversion1Leg.cc.

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

Referenced by PhotonConversionTrajectorySeedProducerFromSingleLegAlgo::inspectTrack().

30 {
31  pss = &ss;
32  if ( hits.size() < 2) return 0;
33 
34  GlobalTrajectoryParameters kine = initialKinematic(hits, vertex, es, cotTheta);
35  float sinTheta = sin(kine.momentum().theta());
36 
37  CurvilinearTrajectoryError error = initialError(vertexBounds, ptmin, sinTheta);
38  FreeTrajectoryState fts(kine, error);
39 
40  return buildSeed(seedCollection,hits,fts,es);
41 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
virtual const TrajectorySeed * buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
virtual 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:74
double ptmin
Definition: HydjetWrapper.h:86
unsigned int size() const
Definition: SeedingHitSet.h:31
virtual CurvilinearTrajectoryError initialError(const GlobalVector &vertexBounds, float ptMin, float sinTheta) const
virtual const TrajectorySeed* SeedForPhotonConversion1Leg::trajectorySeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
inlinevirtual

Implements SeedCreator.

Definition at line 34 of file SeedForPhotonConversion1Leg.h.

39  { return 0;}

Member Data Documentation

const int SeedForPhotonConversion1Leg::cotTheta_Max =99999
static

Definition at line 11 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

PrintRecoObjects SeedForPhotonConversion1Leg::po
protected

Definition at line 74 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed(), and initialKinematic().

std::stringstream* SeedForPhotonConversion1Leg::pss
protected

Definition at line 73 of file SeedForPhotonConversion1Leg.h.

double SeedForPhotonConversion1Leg::theBOFFMomentum
protected

Definition at line 71 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

std::string SeedForPhotonConversion1Leg::thePropagatorLabel
protected

Definition at line 70 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().