CMS 3D CMS Logo

SeedGeneratorForCRack.cc
Go to the documentation of this file.
7  const SiStripRecHit2DCollection& collrphi,
8  const SiStripMatchedRecHit2DCollection& collmatched,
9  const edm::EventSetup& iSetup) {
14  theUpdator = new KFUpdator();
15 
16  // get the transient builder
18 
20  TrackerTopology const& ttopo = iSetup.getData(theTTopoToken);
21 
22  CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, track, ttopo);
23  thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, *tracker);
24  HitPairs.clear();
26  LogDebug("CosmicSeedFinder") << "Initialized with " << HitPairs.size() << " hit pairs" << std::endl;
27 }
28 
30  : theMagfieldToken(iCC.esConsumes()),
31  theTrackerToken(iCC.esConsumes()),
32  theSearchTrackerToken(iCC.esConsumes()),
33  theTTopoToken(iCC.esConsumes()),
34  theTTRHToken(iCC.esConsumes(edm::ESInputTag("", conf.getParameter<std::string>("TTRHBuilder")))),
35  region(conf.getParameter<double>("ptMin"),
36  conf.getParameter<double>("originRadius"),
37  conf.getParameter<double>("originHalfLength"),
38  conf.getParameter<double>("originZPosition")) {
39  seedpt = conf.getParameter<double>("SeedPt");
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  GlobalPoint inner = tracker->idToDet((*(HitPairs[is].inner())).geographicalId())
58  ->surface()
59  .toGlobal((*(HitPairs[is].inner())).localPosition());
60  GlobalPoint outer = tracker->idToDet((*(HitPairs[is].outer())).geographicalId())
61  ->surface()
62  .toGlobal((*(HitPairs[is].outer())).localPosition());
63 
64  LogDebug("CosmicSeedFinder") << "inner point of the seed " << inner << " outer point of the seed " << outer;
65  SeedingHitSet::ConstRecHitPointer inrhit = HitPairs[is].inner();
66  SeedingHitSet::ConstRecHitPointer outrhit = HitPairs[is].outer();
67 
69  hits.push_back(HitPairs[is].outer()->hit()->clone());
70 
71  for (int i = 0; i < 2; i++) {
72  //FIRST STATE IS CALCULATED CONSIDERING THAT THE CHARGE CAN BE POSITIVE OR NEGATIVE
73  int predsign = (2 * i) - 1;
74  if ((outer.y() - inner.y()) > 0) {
75  GlobalVector momentum = GlobalVector(inner - outer);
76  momentum = momentum.unit() * seedMomentum;
77  GlobalTrajectoryParameters Gtp(inner, momentum, predsign, &(*magfield));
78  AlgebraicSymMatrix55 errMatrix = ROOT::Math::SMatrixIdentity();
79  TSOS innerState = TSOS(Gtp,
80  CurvilinearTrajectoryError(errMatrix),
81  tracker->idToDet((HitPairs[is].inner()->hit())->geographicalId())->surface());
82  const TSOS innerUpdated = theUpdator->update(innerState, *inrhit);
83  //Cosmic Seed update inner...
84  LogDebug("CosmicSeedFinder") << " FirstTSOS " << innerUpdated;
85 
86  //First propagation
87  const TSOS outerState = thePropagatorOp->propagate(
88  innerUpdated, tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
89  if (outerState.isValid()) {
90  LogDebug("CosmicSeedFinder") << "outerState " << outerState;
91  TSOS outerUpdated = theUpdator->update(outerState, *outrhit);
92  //fudge factor for multiple scattering
94  if (outerUpdated.isValid()) {
95  LogDebug("CosmicSeedFinder") << "outerUpdated " << outerUpdated;
96 
98  outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
99  output.push_back(TrajectorySeed(PTraj, hits, alongMomentum));
100 
101  } else
102  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
103  } else
104  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
105 
106  } else {
107  GlobalVector momentum = GlobalVector(outer - inner);
108  momentum = momentum.unit() * seedMomentum;
109  GlobalTrajectoryParameters Gtp(inner, momentum, predsign, &(*magfield));
110  AlgebraicSymMatrix55 errMatrix = ROOT::Math::SMatrixIdentity();
111  TSOS innerState = TSOS(Gtp,
112  CurvilinearTrajectoryError(errMatrix),
113  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 = thePropagatorOp->propagate(
119  innerUpdated, tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
120  if (outerState.isValid()) {
121  LogDebug("CosmicSeedFinder") << "outerState " << outerState;
122  TSOS outerUpdated = theUpdator->update(outerState, *outrhit);
123  //fudge factor for multiple scattering
125  if (outerUpdated.isValid()) {
126  LogDebug("CosmicSeedFinder") << "outerUpdated " << outerUpdated;
128  outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
129  output.push_back(TrajectorySeed(PTraj, hits, oppositeToMomentum));
130 
131  } else
132  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
133  } else
134  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
135  }
136  }
137  }
138 }
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTTRHToken
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const TransientTrackingRecHitBuilder * TTTRHBuilder
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void seeds(TrajectorySeedCollection &output, const edm::EventSetup &c, const TrackingRegion &region)
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
TrajectoryStateOnSurface TSOS
T getUntrackedParameter(std::string const &, T const &) const
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
std::vector< TrajectorySeed > TrajectorySeedCollection
PropagatorWithMaterial * thePropagatorAl
edm::ESHandle< MagneticField > magfield
SeedGeneratorForCRack(const edm::ParameterSet &conf, edm::ConsumesCollector)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const TrackerGeomDet * idToDet(DetId) const override
unsigned int size() const override
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theMagfieldToken
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
PropagatorWithMaterial * thePropagatorOp
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theSearchTrackerToken
HLT enums.
GlobalTrackingRegion region
void hitPairs(const TrackingRegion &reg, OrderedHitPairs &pr)
form base class
void run(TrajectorySeedCollection &, const edm::EventSetup &c)
CosmicHitPairGenerator * thePairGenerator
Vector3DBase unit() const
Definition: Vector3DBase.h:54
Log< level::Warning, false > LogWarning
Global3DVector GlobalVector
Definition: GlobalVector.h:10
#define LogDebug(id)
edm::ESHandle< TrackerGeometry > tracker