CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SeedGeneratorForCRack.cc
Go to the documentation of this file.
11 void
13  const SiStripRecHit2DCollection &collrphi ,
14  const SiStripMatchedRecHit2DCollection &collmatched,
15  const edm::EventSetup& iSetup)
16 {
17  iSetup.get<IdealMagneticFieldRecord>().get(magfield);
18  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
21  theUpdator= new KFUpdator();
22 
23  // get the transient builder
24 
26 
27  iSetup.get<TransientRecHitRecord>().get(builderName,theBuilder);
28  TTTRHBuilder = theBuilder.product();
29  CosmicLayerPairs cosmiclayers(geometry);
30  cosmiclayers.init(collstereo,collrphi,collmatched,iSetup);
31  thePairGenerator=new CosmicHitPairGenerator(cosmiclayers,iSetup);
32  HitPairs.clear();
34  LogDebug("CosmicSeedFinder") <<"Initialized with " << HitPairs.size() << " hit pairs" << std::endl;
35 }
36 
38  conf_(conf)
39 {
40  float ptmin=conf_.getParameter<double>("ptMin");
41  float originradius=conf_.getParameter<double>("originRadius");
42  float halflength=conf_.getParameter<double>("originHalfLength");
43  float originz=conf_.getParameter<double>("originZPosition");
44  seedpt = conf_.getParameter<double>("SeedPt");
45 
46  builderName = conf_.getParameter<std::string>("TTRHBuilder");
47  geometry=conf_.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
48  region=GlobalTrackingRegion(ptmin,originradius,
49  halflength,originz);
50  multipleScatteringFactor=conf_.getUntrackedParameter<double>("multipleScatteringFactor", 1.0);
51  seedMomentum =conf_.getUntrackedParameter<double>("SeedMomentum",1);
52  edm::LogInfo("SeedGeneratorForCRack")<<" PtMin of track is "<<ptmin<<
53  " The Radius of the cylinder for seeds is "<<originradius <<"cm" << " The set Seed Momentum" << seedpt;
54 }
55 
57  seeds(output,iSetup,region);
58  delete thePairGenerator;
59  delete thePropagatorAl;
60  delete thePropagatorOp;
61  delete theUpdator;
62 }
63 
65  const edm::EventSetup& iSetup,
66  const TrackingRegion& region){
67  for(unsigned int is=0;is<HitPairs.size();is++){
68 
69  GlobalPoint inner = tracker->idToDet((*(HitPairs[is].inner())).geographicalId())->surface().toGlobal((*(HitPairs[is].inner())).localPosition());
70  GlobalPoint outer = tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface().toGlobal((*(HitPairs[is].outer())).localPosition());
71 
72  LogDebug("CosmicSeedFinder") <<"inner point of the seed "<<inner <<" outer point of the seed "<<outer;
75 
77  hits.push_back(HitPairs[is].outer()->hit()->clone());
78 
79  for (int i=0;i<2;i++){
80  //FIRST STATE IS CALCULATED CONSIDERING THAT THE CHARGE CAN BE POSITIVE OR NEGATIVE
81  int predsign=(2*i)-1;
82  if((outer.y()-inner.y())>0){
83  GlobalVector momentum = GlobalVector(inner-outer);
84  momentum = momentum.unit()*seedMomentum;
86  momentum,
87  predsign,
88  &(*magfield));
89  AlgebraicSymMatrix errMatrix = AlgebraicSymMatrix(5,1);
90  TSOS innerState = TSOS(Gtp, CurvilinearTrajectoryError(errMatrix), tracker->idToDet((HitPairs[is].inner()->hit())->geographicalId())->surface());
91  const TSOS innerUpdated = theUpdator->update(innerState, *inrhit);
92  //Cosmic Seed update inner...
93  LogDebug("CosmicSeedFinder") << " FirstTSOS " << innerUpdated;
94 
95  //First propagation
96  const TSOS outerState =
97  thePropagatorOp->propagate(innerUpdated,
98  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
99  if ( outerState.isValid()) {
100  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
101  TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
102  //fudge factor for multiple scattering
103  outerUpdated.rescaleError( multipleScatteringFactor);
104  if ( outerUpdated.isValid()) {
105  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
106 
107  PTrajectoryStateOnDet *PTraj=
108  transformer.persistentState(outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
109  output.push_back(TrajectorySeed(*PTraj,hits,alongMomentum));
110  delete PTraj;
111 
112  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
113  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
114 
115 
116  }
117  else{
118  GlobalVector momentum= GlobalVector(outer-inner);
119  momentum=momentum.unit()*seedMomentum;
120  GlobalTrajectoryParameters Gtp(inner,
121  momentum,
122  predsign,
123  &(*magfield));
124  AlgebraicSymMatrix errMatrix = AlgebraicSymMatrix(5,1);
125  TSOS innerState = TSOS(Gtp, CurvilinearTrajectoryError(errMatrix), tracker->idToDet((HitPairs[is].inner()->hit())->geographicalId())->surface());
126  const TSOS innerUpdated = theUpdator->update(innerState, *inrhit);
127  LogDebug("CosmicSeedFinder") << " FirstTSOS "<< innerState;
128 
129  //First propagation
130  const TSOS outerState =
131  thePropagatorOp->propagate(innerUpdated,
132  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
133  if ( outerState.isValid()) {
134 
135  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
136  TSOS outerUpdated = theUpdator->update( outerState,*outrhit);
137  //fudge factor for multiple scattering
138  outerUpdated.rescaleError( multipleScatteringFactor);
139  if ( outerUpdated.isValid()) {
140  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
141  PTrajectoryStateOnDet *PTraj=
142  transformer.persistentState(outerUpdated,(*(HitPairs[is].outer())).geographicalId().rawId());
143  output.push_back(TrajectorySeed(*PTraj,hits,oppositeToMomentum));
144  delete PTraj;
145 
146  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
147  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
148  }
149  }
150  }
151 }
152 
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
const TransientTrackingRecHitBuilder * TTTRHBuilder
void seeds(TrajectorySeedCollection &output, const edm::EventSetup &c, const TrackingRegion &region)
T y() const
Definition: PV3DBase.h:57
virtual unsigned int size() const
SeedGeneratorForCRack(const edm::ParameterSet &conf)
TrajectoryStateOnSurface TSOS
virtual void hitPairs(const TrackingRegion &reg, OrderedHitPairs &prs, const edm::EventSetup &iSetup)
form base class
void push_back(D *&d)
Definition: OwnVector.h:288
std::vector< TrajectorySeed > TrajectorySeedCollection
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
PropagatorWithMaterial * thePropagatorAl
edm::ESHandle< MagneticField > magfield
PTrajectoryStateOnDet * persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid) const
TrajectoryStateTransform transformer
void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &iSetup)
tuple conf
Definition: dbtoconf.py:185
virtual TrajectoryStateOnSurface propagate(const TrajectoryStateOnSurface &tsos, const Plane &plane) const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
T * clone(const T *tp)
Definition: Ptr.h:42
const T & get() const
Definition: EventSetup.h:55
PropagatorWithMaterial * thePropagatorOp
T const * product() const
Definition: ESHandle.h:62
void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c)
double ptmin
Definition: HydjetWrapper.h:86
GlobalTrackingRegion region
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
void run(TrajectorySeedCollection &, const edm::EventSetup &c)
CLHEP::HepSymMatrix AlgebraicSymMatrix
CosmicHitPairGenerator * thePairGenerator
Global3DVector GlobalVector
Definition: GlobalVector.h:10
edm::ESHandle< TrackerGeometry > tracker