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.
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)
33 {
34  float ptmin=conf_.getParameter<double>("ptMin");
35  float originradius=conf_.getParameter<double>("originRadius");
36  float halflength=conf_.getParameter<double>("originHalfLength");
37  float originz=conf_.getParameter<double>("originZPosition");
38  seedpt = conf_.getParameter<double>("SeedPt");
39 
40  builderName = conf_.getParameter<std::string>("TTRHBuilder");
41  geometry=conf_.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
42  region=GlobalTrackingRegion(ptmin,originradius,
43  halflength,originz);
44  multipleScatteringFactor=conf_.getUntrackedParameter<double>("multipleScatteringFactor", 1.0);
45  seedMomentum =conf_.getUntrackedParameter<double>("SeedMomentum",1);
46  edm::LogInfo("SeedGeneratorForCRack")<<" PtMin of track is "<<ptmin<<
47  " The Radius of the cylinder for seeds is "<<originradius <<"cm" << " The set Seed Momentum" << seedpt;
48 }
49 
51  seeds(output,iSetup,region);
52  delete thePairGenerator;
53  delete thePropagatorAl;
54  delete thePropagatorOp;
55  delete theUpdator;
56 }
57 
59  const edm::EventSetup& iSetup,
60  const TrackingRegion& region){
61  for(unsigned int is=0;is<HitPairs.size();is++){
62 
63  GlobalPoint inner = tracker->idToDet((*(HitPairs[is].inner())).geographicalId())->surface().toGlobal((*(HitPairs[is].inner())).localPosition());
64  GlobalPoint outer = tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface().toGlobal((*(HitPairs[is].outer())).localPosition());
65 
66  LogDebug("CosmicSeedFinder") <<"inner point of the seed "<<inner <<" outer point of the seed "<<outer;
69 
71  hits.push_back(HitPairs[is].outer()->hit()->clone());
72 
73  for (int i=0;i<2;i++){
74  //FIRST STATE IS CALCULATED CONSIDERING THAT THE CHARGE CAN BE POSITIVE OR NEGATIVE
75  int predsign=(2*i)-1;
76  if((outer.y()-inner.y())>0){
77  GlobalVector momentum = GlobalVector(inner-outer);
78  momentum = momentum.unit()*seedMomentum;
80  momentum,
81  predsign,
82  &(*magfield));
83  AlgebraicSymMatrix55 errMatrix = ROOT::Math::SMatrixIdentity();
84  TSOS innerState = TSOS(Gtp, CurvilinearTrajectoryError(errMatrix), tracker->idToDet((HitPairs[is].inner()->hit())->geographicalId())->surface());
85  const TSOS innerUpdated = theUpdator->update(innerState, *inrhit);
86  //Cosmic Seed update inner...
87  LogDebug("CosmicSeedFinder") << " FirstTSOS " << innerUpdated;
88 
89  //First propagation
90  const TSOS outerState =
91  thePropagatorOp->propagate(innerUpdated,
92  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
93  if ( outerState.isValid()) {
94  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
95  TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
96  //fudge factor for multiple scattering
98  if ( outerUpdated.isValid()) {
99  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
100 
101  PTrajectoryStateOnDet PTraj=
102  trajectoryStateTransform::persistentState(outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
103  output.push_back(TrajectorySeed(PTraj,hits,alongMomentum));
104 
105  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
106  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
107 
108 
109  }
110  else{
111  GlobalVector momentum= GlobalVector(outer-inner);
112  momentum=momentum.unit()*seedMomentum;
113  GlobalTrajectoryParameters Gtp(inner,
114  momentum,
115  predsign,
116  &(*magfield));
117  AlgebraicSymMatrix55 errMatrix = ROOT::Math::SMatrixIdentity();
118  TSOS innerState = TSOS(Gtp, CurvilinearTrajectoryError(errMatrix), tracker->idToDet((HitPairs[is].inner()->hit())->geographicalId())->surface());
119  const TSOS innerUpdated = theUpdator->update(innerState, *inrhit);
120  LogDebug("CosmicSeedFinder") << " FirstTSOS "<< innerState;
121 
122  //First propagation
123  const TSOS outerState =
124  thePropagatorOp->propagate(innerUpdated,
125  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
126  if ( outerState.isValid()) {
127 
128  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
129  TSOS outerUpdated = theUpdator->update( outerState,*outrhit);
130  //fudge factor for multiple scattering
131  outerUpdated.rescaleError( multipleScatteringFactor);
132  if ( outerUpdated.isValid()) {
133  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
134  PTrajectoryStateOnDet PTraj=
135  trajectoryStateTransform::persistentState(outerUpdated,(*(HitPairs[is].outer())).geographicalId().rawId());
136  output.push_back(TrajectorySeed(PTraj,hits,oppositeToMomentum));
137 
138  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
139  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
140  }
141  }
142  }
143 }
144 
#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)
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
T y() const
Definition: PV3DBase.h:62
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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:273
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
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
const T & get() const
Definition: EventSetup.h:55
PropagatorWithMaterial * thePropagatorOp
T const * product() const
Definition: ESHandle.h:62
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
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)
CosmicHitPairGenerator * thePairGenerator
Global3DVector GlobalVector
Definition: GlobalVector.h:10
edm::ESHandle< TrackerGeometry > tracker