CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SeedGeneratorForCosmics Class Reference

#include <SeedGeneratorForCosmics.h>

Public Types

typedef TrajectoryStateOnSurface TSOS
 

Public Member Functions

void run (const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c, TrajectorySeedCollection &)
 
 SeedGeneratorForCosmics (const edm::ParameterSet &conf, edm::ConsumesCollector)
 

Private Member Functions

void init (const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c)
 
bool seeds (TrajectorySeedCollection &output, const TrackingRegion &region)
 

Private Attributes

std::string geometry
 
OrderedHitPairs HitPairs
 
std::string hitsforseeds
 
OrderedHitTriplets HitTriplets
 
edm::ESHandle< MagneticFieldmagfield
 
int32_t maxSeeds_
 
bool negativeYOnly
 
bool positiveYOnly
 
GlobalTrackingRegion region
 
float seedpt
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
theMagfieldToken
 
CosmicHitPairGeneratorthePairGenerator
 
PropagatorWithMaterialthePropagatorAl
 
PropagatorWithMaterialthePropagatorOp
 
const edm::ESGetToken
< GeometricSearchTracker,
TrackerRecoGeometryRecord
theSearchTrackerToken
 
const edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
theTrackerToken
 
CosmicHitTripletGeneratortheTripletGenerator
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
theTTopoToken
 
KFUpdatortheUpdator
 
edm::ESHandle< TrackerGeometrytracker
 

Detailed Description

Definition at line 29 of file SeedGeneratorForCosmics.h.

Member Typedef Documentation

Definition at line 31 of file SeedGeneratorForCosmics.h.

Constructor & Destructor Documentation

SeedGeneratorForCosmics::SeedGeneratorForCosmics ( const edm::ParameterSet conf,
edm::ConsumesCollector  iCC 
)

Definition at line 40 of file SeedGeneratorForCosmics.cc.

References geometry, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitsforseeds, negativeYOnly, positiveYOnly, ptmin, region, seedpt, and AlCaHLTBitMon_QueryRunRegistry::string.

41  : maxSeeds_(conf.getParameter<int32_t>("maxSeeds")),
45  theTTopoToken(iCC.esConsumes()) {
46  float ptmin = conf.getParameter<double>("ptMin");
47  float originradius = conf.getParameter<double>("originRadius");
48  float halflength = conf.getParameter<double>("originHalfLength");
49  float originz = conf.getParameter<double>("originZPosition");
50  seedpt = conf.getParameter<double>("SeedPt");
51 
52  geometry = conf.getUntrackedParameter<std::string>("GeometricStructure", "STANDARD");
53  region = GlobalTrackingRegion(ptmin, originradius, halflength, originz);
54  hitsforseeds = conf.getUntrackedParameter<std::string>("HitsForSeeds", "pairs");
55  edm::LogInfo("SeedGeneratorForCosmics")
56  << " PtMin of track is " << ptmin << " The Radius of the cylinder for seeds is " << originradius << "cm"
57  << " The set Seed Momentum" << seedpt;
58 
59  //***top-bottom
60  positiveYOnly = conf.getParameter<bool>("PositiveYOnly");
61  negativeYOnly = conf.getParameter<bool>("NegativeYOnly");
62  //***
63 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theMagfieldToken
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
Log< level::Info, false > LogInfo
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theSearchTrackerToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double ptmin
Definition: HydjetWrapper.h:84
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken

Member Function Documentation

void SeedGeneratorForCosmics::init ( const SiStripRecHit2DCollection collstereo,
const SiStripRecHit2DCollection collrphi,
const SiStripMatchedRecHit2DCollection collmatched,
const edm::EventSetup c 
)
private

Definition at line 9 of file SeedGeneratorForCosmics.cc.

References alongMomentum, geometry, edm::EventSetup::getData(), edm::EventSetup::getHandle(), CosmicHitPairGenerator::hitPairs(), HitPairs, hitsforseeds, CosmicHitTripletGenerator::hitTriplets(), HitTriplets, LogDebug, magfield, oppositeToMomentum, region, theMagfieldToken, thePairGenerator, thePropagatorAl, thePropagatorOp, theSearchTrackerToken, theTrackerToken, theTripletGenerator, theTTopoToken, theUpdator, HLT_FULL_cff::track, and tracker.

Referenced by run().

12  {
13  magfield = iSetup.getHandle(theMagfieldToken);
14  tracker = iSetup.getHandle(theTrackerToken);
17  theUpdator = new KFUpdator();
18 
19  LogDebug("CosmicSeedFinder") << " Hits built with " << hitsforseeds << " hits";
20 
21  GeometricSearchTracker const& track = iSetup.getData(theSearchTrackerToken);
22  TrackerTopology const& ttopo = iSetup.getData(theTTopoToken);
23 
24  CosmicLayerPairs cosmiclayers(geometry, collrphi, collmatched, track, ttopo);
25 
26  thePairGenerator = new CosmicHitPairGenerator(cosmiclayers, *tracker);
27  HitPairs.clear();
28  if ((hitsforseeds == "pairs") || (hitsforseeds == "pairsandtriplets")) {
30  }
31 
32  CosmicLayerTriplets cosmiclayers2(geometry, collrphi, track, ttopo);
34  HitTriplets.clear();
35  if ((hitsforseeds == "triplets") || (hitsforseeds == "pairsandtriplets")) {
37  }
38 }
void hitTriplets(const TrackingRegion &reg, OrderedHitTriplets &prs)
edm::ESHandle< TrackerGeometry > tracker
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theMagfieldToken
PropagatorWithMaterial * thePropagatorOp
CosmicHitTripletGenerator * theTripletGenerator
CosmicHitPairGenerator * thePairGenerator
PropagatorWithMaterial * thePropagatorAl
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTTopoToken
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > theSearchTrackerToken
void hitPairs(const TrackingRegion &reg, OrderedHitPairs &pr)
form base class
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
edm::ESHandle< MagneticField > magfield
#define LogDebug(id)
void SeedGeneratorForCosmics::run ( const SiStripRecHit2DCollection collstereo,
const SiStripRecHit2DCollection collrphi,
const SiStripMatchedRecHit2DCollection collmatched,
const edm::EventSetup c,
TrajectorySeedCollection output 
)

Definition at line 65 of file SeedGeneratorForCosmics.cc.

References init(), region, seeds(), thePairGenerator, thePropagatorAl, thePropagatorOp, theTripletGenerator, and theUpdator.

Referenced by CosmicSeedGenerator::produce().

69  {
70  init(collstereo, collrphi, collmatched, c);
72  delete thePairGenerator;
73  delete theTripletGenerator;
74  delete thePropagatorAl;
75  delete thePropagatorOp;
76  delete theUpdator;
77 }
PropagatorWithMaterial * thePropagatorOp
CosmicHitTripletGenerator * theTripletGenerator
CosmicHitPairGenerator * thePairGenerator
PropagatorWithMaterial * thePropagatorAl
bool seeds(TrajectorySeedCollection &output, const TrackingRegion &region)
void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c)
bool SeedGeneratorForCosmics::seeds ( TrajectorySeedCollection output,
const TrackingRegion region 
)
private

Definition at line 78 of file SeedGeneratorForCosmics.cc.

References alongMomentum, clone(), HitPairs, HitTriplets, mps_fire::i, SurfaceOrientation::inner, edm::isNotFinite(), TrajectoryStateOnSurface::isValid(), LogDebug, mag(), magfield, maxSeeds_, negativeYOnly, oppositeToMomentum, SurfaceOrientation::outer, trajectoryStateTransform::persistentState(), positiveYOnly, Propagator::propagate(), edm::OwnVector< T, P >::push_back(), seedpt, OrderedHitPairs::size(), OrderedHitTriplets::size(), thePropagatorAl, thePropagatorOp, theUpdator, tracker, KFUpdator::update(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by run().

78  {
79  LogDebug("CosmicSeedFinder") << "Number of triplets " << HitTriplets.size();
80  LogDebug("CosmicSeedFinder") << "Number of pairs " << HitPairs.size();
81 
82  for (unsigned int it = 0; it < HitTriplets.size(); it++) {
83  //const TrackingRecHit *hit = &(
84  // const TrackingRecHit* hit = it->hits();
85 
86  // GlobalPoint inner = tracker->idToDet(HitTriplets[it].inner().RecHit()->
87  // geographicalId())->surface().
88  // toGlobal(HitTriplets[it].inner().RecHit()->localPosition());
89  //const TrackingRecHit *innerhit = &(*HitTriplets[it].inner());
90  //const TrackingRecHit *middlehit = &(*HitTriplets[it].middle());
91 
92  GlobalPoint inner = tracker->idToDet((*(HitTriplets[it].inner())).geographicalId())
93  ->surface()
94  .toGlobal((*(HitTriplets[it].inner())).localPosition());
95 
96  GlobalPoint middle = tracker->idToDet((*(HitTriplets[it].middle())).geographicalId())
97  ->surface()
98  .toGlobal((*(HitTriplets[it].middle())).localPosition());
99 
100  GlobalPoint outer = tracker->idToDet((*(HitTriplets[it].outer())).geographicalId())
101  ->surface()
102  .toGlobal((*(HitTriplets[it].outer())).localPosition());
103 
104  SeedingHitSet::ConstRecHitPointer outrhit = HitTriplets[it].outer();
105  //***top-bottom
106  SeedingHitSet::ConstRecHitPointer innrhit = HitTriplets[it].inner();
107  if (positiveYOnly && (outrhit->globalPosition().y() < 0 || innrhit->globalPosition().y() < 0 ||
108  outrhit->globalPosition().y() < innrhit->globalPosition().y()))
109  continue;
110  if (negativeYOnly && (outrhit->globalPosition().y() > 0 || innrhit->globalPosition().y() > 0 ||
111  outrhit->globalPosition().y() > innrhit->globalPosition().y()))
112  continue;
113  //***
114 
116  hits.push_back(HitTriplets[it].outer()->hit()->clone());
117  FastHelix helix(inner, middle, outer, magfield->nominalValue(), &(*magfield));
118  GlobalVector gv = helix.stateAtVertex().momentum();
119  float ch = helix.stateAtVertex().charge();
120  float mom2 = gv.x() * gv.x() + gv.y() * gv.y() + gv.z() * gv.z();
121  if (mom2 > 1e06f || edm::isNotFinite(mom2))
122  continue; // ChangedByDaniele
123 
124  if (gv.y() > 0) {
125  gv = -1. * gv;
126  ch = -1. * ch;
127  }
128 
129  GlobalTrajectoryParameters Gtp(outer, gv, int(ch), &(*magfield));
131  if ((outer.y() - inner.y()) > 0) {
132  const TSOS outerState = thePropagatorAl->propagate(
133  CosmicSeed, tracker->idToDet((*(HitTriplets[it].outer())).geographicalId())->surface());
134  if (outerState.isValid()) {
135  LogDebug("CosmicSeedFinder") << "outerState " << outerState;
136  const TSOS outerUpdated = theUpdator->update(outerState, *outrhit);
137  if (outerUpdated.isValid()) {
138  LogDebug("CosmicSeedFinder") << "outerUpdated " << outerUpdated;
139 
141  outerUpdated, (*(HitTriplets[it].outer())).geographicalId().rawId()),
142  hits,
143  alongMomentum));
144 
145  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
146  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
147  output.clear();
148  return false;
149  }
150  }
151  }
152  } else {
153  const TSOS outerState = thePropagatorOp->propagate(
154  CosmicSeed, tracker->idToDet((*(HitTriplets[it].outer())).geographicalId())->surface());
155  if (outerState.isValid()) {
156  LogDebug("CosmicSeedFinder") << "outerState " << outerState;
157  const TSOS outerUpdated = theUpdator->update(outerState, *outrhit);
158  if (outerUpdated.isValid()) {
159  LogDebug("CosmicSeedFinder") << "outerUpdated " << outerUpdated;
160 
162  outerUpdated, (*(HitTriplets[it].outer())).geographicalId().rawId()),
163  hits,
165 
166  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
167  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
168  output.clear();
169  return false;
170  }
171  }
172  }
173  }
174  }
175 
176  for (unsigned int is = 0; is < HitPairs.size(); is++) {
177  GlobalPoint inner = tracker->idToDet((*(HitPairs[is].inner())).geographicalId())
178  ->surface()
179  .toGlobal((*(HitPairs[is].inner())).localPosition());
180  GlobalPoint outer = tracker->idToDet((*(HitPairs[is].outer())).geographicalId())
181  ->surface()
182  .toGlobal((*(HitPairs[is].outer())).localPosition());
183 
184  LogDebug("CosmicSeedFinder") << "inner point of the seed " << inner << " outer point of the seed " << outer;
185  SeedingHitSet::ConstRecHitPointer outrhit = HitPairs[is].outer();
186  //***top-bottom
187  SeedingHitSet::ConstRecHitPointer innrhit = HitPairs[is].inner();
188  if (positiveYOnly && (outrhit->globalPosition().y() < 0 || innrhit->globalPosition().y() < 0 ||
189  outrhit->globalPosition().y() < innrhit->globalPosition().y()))
190  continue;
191  if (negativeYOnly && (outrhit->globalPosition().y() > 0 || innrhit->globalPosition().y() > 0 ||
192  outrhit->globalPosition().y() > innrhit->globalPosition().y()))
193  continue;
194  //***
195 
197  hits.push_back(HitPairs[is].outer()->hit()->clone());
198  // hits.push_back(HitPairs[is].inner()->clone());
199 
200  for (int i = 0; i < 2; i++) {
201  //FIRST STATE IS CALCULATED CONSIDERING THAT THE CHARGE CAN BE POSITIVE OR NEGATIVE
202  int predsign = (2 * i) - 1;
203  if ((outer.y() - inner.y()) > 0) {
205  outer, (inner - outer) * (seedpt / (inner - outer).mag()), predsign, &(*magfield));
206 
208 
209  LogDebug("CosmicSeedFinder") << " FirstTSOS " << CosmicSeed;
210  //First propagation
211  const TSOS outerState = thePropagatorAl->propagate(
212  CosmicSeed, tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
213  if (outerState.isValid()) {
214  LogDebug("CosmicSeedFinder") << "outerState " << outerState;
215  const TSOS outerUpdated = theUpdator->update(outerState, *outrhit);
216  if (outerUpdated.isValid()) {
217  LogDebug("CosmicSeedFinder") << "outerUpdated " << outerUpdated;
218 
220  outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
221 
222  output.push_back(TrajectorySeed(PTraj, hits, alongMomentum));
223 
224  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
225  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
226  output.clear();
227  return false;
228  }
229 
230  } else
231  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
232  } else
233  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
234 
235  } else {
237  outer, (outer - inner) * (seedpt / (outer - inner).mag()), predsign, &(*magfield));
239  LogDebug("CosmicSeedFinder") << " FirstTSOS " << CosmicSeed;
240  //First propagation
241  const TSOS outerState = thePropagatorAl->propagate(
242  CosmicSeed, tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
243  if (outerState.isValid()) {
244  LogDebug("CosmicSeedFinder") << "outerState " << outerState;
245  const TSOS outerUpdated = theUpdator->update(outerState, *outrhit);
246  if (outerUpdated.isValid()) {
247  LogDebug("CosmicSeedFinder") << "outerUpdated " << outerUpdated;
248 
250  outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
251 
252  output.push_back(TrajectorySeed(PTraj, hits, oppositeToMomentum));
253 
254  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
255  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
256  output.clear();
257  return false;
258  }
259 
260  } else
261  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
262  } else
263  edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
264  }
265  }
266  }
267  return true;
268 }
edm::ESHandle< TrackerGeometry > tracker
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
T y() const
Definition: PV3DBase.h:60
Log< level::Error, false > LogError
PropagatorWithMaterial * thePropagatorOp
void push_back(D *&d)
Definition: OwnVector.h:326
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
PropagatorWithMaterial * thePropagatorAl
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
unsigned int size() const override
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
Log< level::Warning, false > LogWarning
T x() const
Definition: PV3DBase.h:59
unsigned int size() const override
edm::ESHandle< MagneticField > magfield
#define LogDebug(id)

Member Data Documentation

std::string SeedGeneratorForCosmics::geometry
private

Definition at line 63 of file SeedGeneratorForCosmics.h.

Referenced by init(), and SeedGeneratorForCosmics().

OrderedHitPairs SeedGeneratorForCosmics::HitPairs
private

Definition at line 66 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

std::string SeedGeneratorForCosmics::hitsforseeds
private

Definition at line 64 of file SeedGeneratorForCosmics.h.

Referenced by init(), and SeedGeneratorForCosmics().

OrderedHitTriplets SeedGeneratorForCosmics::HitTriplets
private

Definition at line 67 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

edm::ESHandle<MagneticField> SeedGeneratorForCosmics::magfield
private

Definition at line 52 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

int32_t SeedGeneratorForCosmics::maxSeeds_
private

Definition at line 48 of file SeedGeneratorForCosmics.h.

Referenced by seeds().

bool SeedGeneratorForCosmics::negativeYOnly
private

Definition at line 71 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

bool SeedGeneratorForCosmics::positiveYOnly
private

Definition at line 70 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

GlobalTrackingRegion SeedGeneratorForCosmics::region
private

Definition at line 49 of file SeedGeneratorForCosmics.h.

Referenced by init(), run(), and SeedGeneratorForCosmics().

float SeedGeneratorForCosmics::seedpt
private

Definition at line 65 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SeedGeneratorForCosmics::theMagfieldToken
private

Definition at line 55 of file SeedGeneratorForCosmics.h.

Referenced by init().

CosmicHitPairGenerator* SeedGeneratorForCosmics::thePairGenerator
private

Definition at line 50 of file SeedGeneratorForCosmics.h.

Referenced by init(), and run().

PropagatorWithMaterial* SeedGeneratorForCosmics::thePropagatorAl
private

Definition at line 61 of file SeedGeneratorForCosmics.h.

Referenced by init(), run(), and seeds().

PropagatorWithMaterial* SeedGeneratorForCosmics::thePropagatorOp
private

Definition at line 62 of file SeedGeneratorForCosmics.h.

Referenced by init(), run(), and seeds().

const edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> SeedGeneratorForCosmics::theSearchTrackerToken
private

Definition at line 57 of file SeedGeneratorForCosmics.h.

Referenced by init().

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SeedGeneratorForCosmics::theTrackerToken
private

Definition at line 56 of file SeedGeneratorForCosmics.h.

Referenced by init().

CosmicHitTripletGenerator* SeedGeneratorForCosmics::theTripletGenerator
private

Definition at line 51 of file SeedGeneratorForCosmics.h.

Referenced by init(), and run().

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SeedGeneratorForCosmics::theTTopoToken
private

Definition at line 58 of file SeedGeneratorForCosmics.h.

Referenced by init().

KFUpdator* SeedGeneratorForCosmics::theUpdator
private

Definition at line 60 of file SeedGeneratorForCosmics.h.

Referenced by init(), run(), and seeds().

edm::ESHandle<TrackerGeometry> SeedGeneratorForCosmics::tracker
private

Definition at line 53 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().