CMS 3D CMS Logo

SeedGeneratorForCRack.cc
Go to the documentation of this file.
5 void
7  const SiStripRecHit2DCollection &collrphi ,
8  const SiStripMatchedRecHit2DCollection &collmatched,
9  const edm::EventSetup& iSetup)
10 {
11  iSetup.get<IdealMagneticFieldRecord>().get(magfield);
12  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
15  theUpdator= new KFUpdator();
16 
17  // get the transient builder
18 
20 
21  iSetup.get<TransientRecHitRecord>().get(builderName,theBuilder);
22  TTTRHBuilder = theBuilder.product();
23  CosmicLayerPairs cosmiclayers(geometry);
24  cosmiclayers.init(collstereo,collrphi,collmatched,iSetup);
25  thePairGenerator=new CosmicHitPairGenerator(cosmiclayers,iSetup);
26  HitPairs.clear();
28  LogDebug("CosmicSeedFinder") <<"Initialized with " << HitPairs.size() << " hit pairs" << std::endl;
29 }
30 
32  conf_(conf), region(conf.getParameter<double>("ptMin")
33  ,conf.getParameter<double>("originRadius")
34  ,conf.getParameter<double>("originHalfLength")
35  ,conf.getParameter<double>("originZPosition")
36  )
37 {
38  seedpt = conf_.getParameter<double>("SeedPt");
39  builderName = conf_.getParameter<std::string>("TTRHBuilder");
40  geometry=conf_.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
41  multipleScatteringFactor=conf_.getUntrackedParameter<double>("multipleScatteringFactor", 1.0);
42  seedMomentum =conf_.getUntrackedParameter<double>("SeedMomentum",1);
43 }
44 
46  seeds(output,iSetup,region);
47  delete thePairGenerator;
48  delete thePropagatorAl;
49  delete thePropagatorOp;
50  delete theUpdator;
51 }
52 
54  const edm::EventSetup& iSetup,
55  const TrackingRegion& region){
56  for(unsigned int is=0;is<HitPairs.size();is++){
57 
58  GlobalPoint inner = tracker->idToDet((*(HitPairs[is].inner())).geographicalId())->surface().toGlobal((*(HitPairs[is].inner())).localPosition());
59  GlobalPoint outer = tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface().toGlobal((*(HitPairs[is].outer())).localPosition());
60 
61  LogDebug("CosmicSeedFinder") <<"inner point of the seed "<<inner <<" outer point of the seed "<<outer;
62  SeedingHitSet::ConstRecHitPointer inrhit= HitPairs[is].inner();
63  SeedingHitSet::ConstRecHitPointer outrhit = HitPairs[is].outer();
64 
66  hits.push_back(HitPairs[is].outer()->hit()->clone());
67 
68  for (int i=0;i<2;i++){
69  //FIRST STATE IS CALCULATED CONSIDERING THAT THE CHARGE CAN BE POSITIVE OR NEGATIVE
70  int predsign=(2*i)-1;
71  if((outer.y()-inner.y())>0){
72  GlobalVector momentum = GlobalVector(inner-outer);
73  momentum = momentum.unit()*seedMomentum;
75  momentum,
76  predsign,
77  &(*magfield));
78  AlgebraicSymMatrix55 errMatrix = ROOT::Math::SMatrixIdentity();
79  TSOS innerState = TSOS(Gtp, CurvilinearTrajectoryError(errMatrix), tracker->idToDet((HitPairs[is].inner()->hit())->geographicalId())->surface());
80  const TSOS innerUpdated = theUpdator->update(innerState, *inrhit);
81  //Cosmic Seed update inner...
82  LogDebug("CosmicSeedFinder") << " FirstTSOS " << innerUpdated;
83 
84  //First propagation
85  const TSOS outerState =
86  thePropagatorOp->propagate(innerUpdated,
87  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
88  if ( outerState.isValid()) {
89  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
90  TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
91  //fudge factor for multiple scattering
93  if ( outerUpdated.isValid()) {
94  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
95 
96  PTrajectoryStateOnDet PTraj=
97  trajectoryStateTransform::persistentState(outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
98  output.push_back(TrajectorySeed(PTraj,hits,alongMomentum));
99 
100  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
101  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
102 
103 
104  }
105  else{
106  GlobalVector momentum= GlobalVector(outer-inner);
107  momentum=momentum.unit()*seedMomentum;
108  GlobalTrajectoryParameters Gtp(inner,
109  momentum,
110  predsign,
111  &(*magfield));
112  AlgebraicSymMatrix55 errMatrix = ROOT::Math::SMatrixIdentity();
113  TSOS innerState = TSOS(Gtp, CurvilinearTrajectoryError(errMatrix), tracker->idToDet((HitPairs[is].inner()->hit())->geographicalId())->surface());
114  const TSOS innerUpdated = theUpdator->update(innerState, *inrhit);
115  LogDebug("CosmicSeedFinder") << " FirstTSOS "<< innerState;
116 
117  //First propagation
118  const TSOS outerState =
119  thePropagatorOp->propagate(innerUpdated,
120  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
121  if ( outerState.isValid()) {
122 
123  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
124  TSOS outerUpdated = theUpdator->update( outerState,*outrhit);
125  //fudge factor for multiple scattering
126  outerUpdated.rescaleError( multipleScatteringFactor);
127  if ( outerUpdated.isValid()) {
128  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
129  PTrajectoryStateOnDet PTraj=
130  trajectoryStateTransform::persistentState(outerUpdated,(*(HitPairs[is].outer())).geographicalId().rawId());
131  output.push_back(TrajectorySeed(PTraj,hits,oppositeToMomentum));
132 
133  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
134  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
135  }
136  }
137  }
138 }
139 
#define LogDebug(id)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const TransientTrackingRecHitBuilder * TTTRHBuilder
void seeds(TrajectorySeedCollection &output, const edm::EventSetup &c, const TrackingRegion &region)
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
T y() const
Definition: PV3DBase.h:63
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
SeedGeneratorForCRack(const edm::ParameterSet &conf)
TrajectoryStateOnSurface TSOS
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
void hitPairs(const TrackingRegion &reg, OrderedHitPairs &prs, const edm::EventSetup &iSetup)
form base class
void push_back(D *&d)
Definition: OwnVector.h:290
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:75
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
std::vector< TrajectorySeed > TrajectorySeedCollection
PropagatorWithMaterial * thePropagatorAl
unsigned int size() const override
edm::ESHandle< MagneticField > magfield
void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &iSetup)
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const T & get() const
Definition: EventSetup.h:59
PropagatorWithMaterial * thePropagatorOp
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c)
GlobalTrackingRegion region
void run(TrajectorySeedCollection &, const edm::EventSetup &c)
const TrackerGeomDet * idToDet(DetId) const override
CosmicHitPairGenerator * thePairGenerator
T const * product() const
Definition: ESHandle.h:86
Global3DVector GlobalVector
Definition: GlobalVector.h:10
edm::ESHandle< TrackerGeometry > tracker