CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
SeedGeneratorForCosmics Class Reference

#include <SeedGeneratorForCosmics.h>

Public Types

typedef TrajectoryStateOnSurface TSOS
 

Public Member Functions

void init (const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const edm::EventSetup &c)
 
void run (TrajectorySeedCollection &, const edm::EventSetup &c)
 
 SeedGeneratorForCosmics (const edm::ParameterSet &conf)
 
bool seeds (TrajectorySeedCollection &output, const edm::EventSetup &c, const TrackingRegion &region)
 
virtual ~SeedGeneratorForCosmics ()
 

Private Attributes

std::string builderName
 
std::string geometry
 
OrderedHitPairs HitPairs
 
std::string hitsforseeds
 
OrderedHitTriplets HitTriplets
 
edm::ESHandle< MagneticFieldmagfield
 
int32_t maxSeeds_
 
bool negativeYOnly
 
bool positiveYOnly
 
GlobalTrackingRegion region
 
float seedpt
 
CosmicHitPairGeneratorthePairGenerator
 
PropagatorWithMaterialthePropagatorAl
 
PropagatorWithMaterialthePropagatorOp
 
CosmicHitTripletGeneratortheTripletGenerator
 
KFUpdatortheUpdator
 
edm::ESHandle< TrackerGeometrytracker
 
const TransientTrackingRecHitBuilderTTTRHBuilder
 

Detailed Description

Definition at line 26 of file SeedGeneratorForCosmics.h.

Member Typedef Documentation

Definition at line 28 of file SeedGeneratorForCosmics.h.

Constructor & Destructor Documentation

SeedGeneratorForCosmics::SeedGeneratorForCosmics ( const edm::ParameterSet conf)

Definition at line 46 of file SeedGeneratorForCosmics.cc.

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

46  :
47  maxSeeds_(conf.getParameter<int32_t>("maxSeeds"))
48 {
49 
50  float ptmin=conf.getParameter<double>("ptMin");
51  float originradius=conf.getParameter<double>("originRadius");
52  float halflength=conf.getParameter<double>("originHalfLength");
53  float originz=conf.getParameter<double>("originZPosition");
54  seedpt = conf.getParameter<double>("SeedPt");
55 
56  builderName = conf.getParameter<std::string>("TTRHBuilder");
57  geometry=conf.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
58  region=GlobalTrackingRegion(ptmin,originradius,
59  halflength,originz);
60  hitsforseeds=conf.getUntrackedParameter<std::string>("HitsForSeeds","pairs");
61  edm::LogInfo("SeedGeneratorForCosmics")<<" PtMin of track is "<<ptmin<<
62  " The Radius of the cylinder for seeds is "<<originradius <<"cm" << " The set Seed Momentum" << seedpt;
63 
64  //***top-bottom
65  positiveYOnly=conf.getParameter<bool>("PositiveYOnly");
66  negativeYOnly=conf.getParameter<bool>("NegativeYOnly");
67  //***
68 
69 
70 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual SeedGeneratorForCosmics::~SeedGeneratorForCosmics ( )
inlinevirtual

Definition at line 30 of file SeedGeneratorForCosmics.h.

References EnergyCorrector::c, init(), convertSQLitetoXML_cfg::output, region, run(), and seeds().

30 {};

Member Function Documentation

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

Definition at line 8 of file SeedGeneratorForCosmics.cc.

References alongMomentum, builderName, edm::EventSetup::get(), CosmicHitPairGenerator::hitPairs(), HitPairs, hitsforseeds, CosmicHitTripletGenerator::hitTriplets(), HitTriplets, CosmicLayerPairs::init(), CosmicLayerTriplets::init(), LogDebug, magfield, oppositeToMomentum, edm::ESHandle< T >::product(), region, thePairGenerator, thePropagatorAl, thePropagatorOp, theTripletGenerator, theUpdator, tracker, and TTTRHBuilder.

Referenced by CosmicSeedGenerator::produce(), and ~SeedGeneratorForCosmics().

12 {
13  iSetup.get<IdealMagneticFieldRecord>().get(magfield);
14  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
17  theUpdator= new KFUpdator();
18 
19  // get the transient builder
20  //
21 
23 
24  iSetup.get<TransientRecHitRecord>().get(builderName,theBuilder);
25  TTTRHBuilder = theBuilder.product();
26  LogDebug("CosmicSeedFinder")<<" Hits built with "<<hitsforseeds<<" hits";
27 
28  CosmicLayerPairs cosmiclayers(geometry);
29 
30  cosmiclayers.init(collstereo,collrphi,collmatched,iSetup);
31  thePairGenerator=new CosmicHitPairGenerator(cosmiclayers,iSetup);
32  HitPairs.clear();
33  if ((hitsforseeds=="pairs")||(hitsforseeds=="pairsandtriplets")){
35  }
36 
37  CosmicLayerTriplets cosmiclayers2;
38  cosmiclayers2.init(collstereo,collrphi,collmatched,geometry,iSetup);
39  theTripletGenerator=new CosmicHitTripletGenerator(cosmiclayers2,iSetup);
40  HitTriplets.clear();
41  if ((hitsforseeds=="triplets")||(hitsforseeds=="pairsandtriplets")){
43  }
44 }
#define LogDebug(id)
edm::ESHandle< TrackerGeometry > tracker
void hitPairs(const TrackingRegion &reg, OrderedHitPairs &prs, const edm::EventSetup &iSetup)
form base class
PropagatorWithMaterial * thePropagatorOp
CosmicHitTripletGenerator * theTripletGenerator
void init(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, std::string geometry, const edm::EventSetup &iSetup)
void hitTriplets(const TrackingRegion &reg, OrderedHitTriplets &prs, const edm::EventSetup &iSetup)
CosmicHitPairGenerator * thePairGenerator
PropagatorWithMaterial * thePropagatorAl
const TransientTrackingRecHitBuilder * TTTRHBuilder
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< MagneticField > magfield
void SeedGeneratorForCosmics::run ( TrajectorySeedCollection output,
const edm::EventSetup c 
)

Definition at line 72 of file SeedGeneratorForCosmics.cc.

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

Referenced by CosmicSeedGenerator::produce(), and ~SeedGeneratorForCosmics().

72  {
73  seeds(output,iSetup,region);
74  delete thePairGenerator;
75  delete theTripletGenerator;
76  delete thePropagatorAl;
77  delete thePropagatorOp;
78  delete theUpdator;
79 }
PropagatorWithMaterial * thePropagatorOp
CosmicHitTripletGenerator * theTripletGenerator
CosmicHitPairGenerator * thePairGenerator
PropagatorWithMaterial * thePropagatorAl
bool seeds(TrajectorySeedCollection &output, const edm::EventSetup &c, const TrackingRegion &region)
bool SeedGeneratorForCosmics::seeds ( TrajectorySeedCollection output,
const edm::EventSetup c,
const TrackingRegion region 
)

Definition at line 80 of file SeedGeneratorForCosmics.cc.

References alongMomentum, clone(), HitPairs, hfClusterShapes_cfi::hits, HitTriplets, mps_fire::i, TrackerGeometry::idToDet(), SurfaceOrientation::inner, edm::detail::isnan(), TrajectoryStateOnSurface::isValid(), LogDebug, mag(), magfield, maxSeeds_, negativeYOnly, MagneticField::nominalValue(), oppositeToMomentum, SurfaceOrientation::outer, trajectoryStateTransform::persistentState(), positiveYOnly, Propagator::propagate(), edm::OwnVector< T, P >::push_back(), seedpt, OrderedHitPairs::size(), OrderedHitTriplets::size(), mathSSE::sqrt(), GeomDet::surface(), thePropagatorAl, thePropagatorOp, theUpdator, Surface::toGlobal(), tracker, KFUpdator::update(), and PV3DBase< T, PVType, FrameType >::y().

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

82  {
83  LogDebug("CosmicSeedFinder")<<"Number of triplets "<<HitTriplets.size();
84  LogDebug("CosmicSeedFinder")<<"Number of pairs "<<HitPairs.size();
85 
86  for (unsigned int it=0;it<HitTriplets.size();it++){
87 
88  //const TrackingRecHit *hit = &(
89  // const TrackingRecHit* hit = it->hits();
90 
91  // GlobalPoint inner = tracker->idToDet(HitTriplets[it].inner().RecHit()->
92 // geographicalId())->surface().
93 // toGlobal(HitTriplets[it].inner().RecHit()->localPosition());
94  //const TrackingRecHit *innerhit = &(*HitTriplets[it].inner());
95  //const TrackingRecHit *middlehit = &(*HitTriplets[it].middle());
96 
97  GlobalPoint inner = tracker->idToDet((*(HitTriplets[it].inner())).geographicalId())->surface().
98  toGlobal((*(HitTriplets[it].inner())).localPosition());
99 
100  GlobalPoint middle = tracker->idToDet((*(HitTriplets[it].middle())).geographicalId())->surface().
101  toGlobal((*(HitTriplets[it].middle())).localPosition());
102 
103  GlobalPoint outer = tracker->idToDet((*(HitTriplets[it].outer())).geographicalId())->surface().
104  toGlobal((*(HitTriplets[it].outer())).localPosition());
105 
106  // SeedingHitSet::ConstRecHitPointer outrhit=TTTRHBuilder->build(HitPairs[is].outer())
107 
108  SeedingHitSet::ConstRecHitPointer outrhit= HitTriplets[it].outer();
109  //***top-bottom
110  SeedingHitSet::ConstRecHitPointer innrhit = HitTriplets[it].inner();
111  if (positiveYOnly && (outrhit->globalPosition().y()<0 || innrhit->globalPosition().y()<0
112  || outrhit->globalPosition().y() < innrhit->globalPosition().y()
113  ) ) continue;
114  if (negativeYOnly && (outrhit->globalPosition().y()>0 || innrhit->globalPosition().y()>0
115  || outrhit->globalPosition().y() > innrhit->globalPosition().y()
116  ) ) continue;
117  //***
118 
120  hits.push_back(HitTriplets[it].outer()->hit()->clone());
121  FastHelix helix(inner, middle, outer, magfield->nominalValue(), &(*magfield));
122  GlobalVector gv=helix.stateAtVertex().momentum();
123  float ch=helix.stateAtVertex().charge();
124  float Mom = sqrt( gv.x()*gv.x() + gv.y()*gv.y() + gv.z()*gv.z() );
125  if(Mom > 1000 || std::isnan(Mom)) continue; // ChangedByDaniele
126 
127  if (gv.y()>0){
128  gv=-1.*gv;
129  ch=-1.*ch;
130  }
131 
132  GlobalTrajectoryParameters Gtp(outer,
133  gv,int(ch),
134  &(*magfield));
135  FreeTrajectoryState CosmicSeed(Gtp,
137  if((outer.y()-inner.y())>0){
138  const TSOS outerState =
139  thePropagatorAl->propagate(CosmicSeed,
140  tracker->idToDet((*(HitTriplets[it].outer())).geographicalId())->surface());
141  if ( outerState.isValid()) {
142  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
143  const TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
144  if ( outerUpdated.isValid()) {
145  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
146 
147  output.push_back(TrajectorySeed(trajectoryStateTransform::persistentState(outerUpdated,(*(HitTriplets[it].outer())).geographicalId().rawId())
148  ,hits,alongMomentum));
149 
150  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
151  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
152  output.clear();
153  return false;
154  }
155  }
156  }
157  } else {
158  const TSOS outerState =
159  thePropagatorOp->propagate(CosmicSeed,
160  tracker->idToDet((*(HitTriplets[it].outer())).geographicalId())->surface());
161  if ( outerState.isValid()) {
162  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
163  const TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
164  if ( outerUpdated.isValid()) {
165  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
166 
168  (*(HitTriplets[it].outer())).geographicalId().rawId()),hits,oppositeToMomentum));
169 
170  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
171  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
172  output.clear();
173  return false;
174  }
175  }
176  }
177  }
178  }
179 
180 
181  for(unsigned int is=0;is<HitPairs.size();is++){
182 
183 
184 
185  GlobalPoint inner = tracker->idToDet((*(HitPairs[is].inner())).geographicalId())->surface().toGlobal((*(HitPairs[is].inner())).localPosition());
186  GlobalPoint outer = tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface().toGlobal((*(HitPairs[is].outer())).localPosition());
187 
188  LogDebug("CosmicSeedFinder") <<"inner point of the seed "<<inner <<" outer point of the seed "<<outer;
189  //RC const TransientTrackingRecHit* outrhit=TTTRHBuilder->build(HitPairs[is].outer().RecHit());
190  SeedingHitSet::ConstRecHitPointer outrhit = HitPairs[is].outer();
191  //***top-bottom
192  SeedingHitSet::ConstRecHitPointer innrhit = HitPairs[is].inner();
193  if (positiveYOnly && (outrhit->globalPosition().y()<0 || innrhit->globalPosition().y()<0
194  || outrhit->globalPosition().y() < innrhit->globalPosition().y()
195  ) ) continue;
196  if (negativeYOnly && (outrhit->globalPosition().y()>0 || innrhit->globalPosition().y()>0
197  || outrhit->globalPosition().y() > innrhit->globalPosition().y()
198  ) ) continue;
199  //***
200 
202  hits.push_back(HitPairs[is].outer()->hit()->clone());
203  // hits.push_back(HitPairs[is].inner()->clone());
204 
205  for (int i=0;i<2;i++){
206  //FIRST STATE IS CALCULATED CONSIDERING THAT THE CHARGE CAN BE POSITIVE OR NEGATIVE
207  int predsign=(2*i)-1;
208  if((outer.y()-inner.y())>0){
209  GlobalTrajectoryParameters Gtp(outer,
210  (inner-outer)*(seedpt/(inner-outer).mag()),
211  predsign,
212  &(*magfield));
213 
214  FreeTrajectoryState CosmicSeed(Gtp,
216 
217 
218  LogDebug("CosmicSeedFinder") << " FirstTSOS "<<CosmicSeed;
219  //First propagation
220  const TSOS outerState =
221  thePropagatorAl->propagate(CosmicSeed,
222  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
223  if ( outerState.isValid()) {
224  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
225  const TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
226  if ( outerUpdated.isValid()) {
227  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
228 
229  PTrajectoryStateOnDet const & PTraj =
230  trajectoryStateTransform::persistentState(outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId());
231 
232  output.push_back( TrajectorySeed(PTraj,hits,alongMomentum));
233 
234  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
235  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
236  output.clear();
237  return false;
238  }
239 
240  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
241  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
242 
243 
244  }
245  else{
246  GlobalTrajectoryParameters Gtp(outer,
247  (outer-inner)*(seedpt/(outer-inner).mag()),
248  predsign,
249  &(*magfield));
250  FreeTrajectoryState CosmicSeed(Gtp,
252  LogDebug("CosmicSeedFinder") << " FirstTSOS "<<CosmicSeed;
253  //First propagation
254  const TSOS outerState =
255  thePropagatorAl->propagate(CosmicSeed,
256  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
257  if ( outerState.isValid()) {
258 
259  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
260  const TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
261  if ( outerUpdated.isValid()) {
262  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
263 
264  PTrajectoryStateOnDet const & PTraj =
265  trajectoryStateTransform::persistentState(outerUpdated,(*(HitPairs[is].outer())).geographicalId().rawId());
266 
267  output.push_back(TrajectorySeed(PTraj,hits,oppositeToMomentum));
268 
269  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
270  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
271  output.clear();
272  return false;
273  }
274 
275  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
276  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
277  }
278 
279  }
280  }
281  return true;
282 }
#define LogDebug(id)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
edm::ESHandle< TrackerGeometry > tracker
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:56
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:63
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
virtual unsigned int size() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
PropagatorWithMaterial * thePropagatorOp
void push_back(D *&d)
Definition: OwnVector.h:290
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
PropagatorWithMaterial * thePropagatorAl
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:75
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:18
unsigned int size() const override
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
const TrackerGeomDet * idToDet(DetId) const override
edm::ESHandle< MagneticField > magfield

Member Data Documentation

std::string SeedGeneratorForCosmics::builderName
private

Definition at line 55 of file SeedGeneratorForCosmics.h.

Referenced by init(), and SeedGeneratorForCosmics().

std::string SeedGeneratorForCosmics::geometry
private
OrderedHitPairs SeedGeneratorForCosmics::HitPairs
private

Definition at line 59 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

std::string SeedGeneratorForCosmics::hitsforseeds
private

Definition at line 57 of file SeedGeneratorForCosmics.h.

Referenced by init(), and SeedGeneratorForCosmics().

OrderedHitTriplets SeedGeneratorForCosmics::HitTriplets
private

Definition at line 60 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

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

Definition at line 48 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

int32_t SeedGeneratorForCosmics::maxSeeds_
private

Definition at line 44 of file SeedGeneratorForCosmics.h.

Referenced by seeds().

bool SeedGeneratorForCosmics::negativeYOnly
private

Definition at line 64 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

bool SeedGeneratorForCosmics::positiveYOnly
private

Definition at line 63 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

GlobalTrackingRegion SeedGeneratorForCosmics::region
private
float SeedGeneratorForCosmics::seedpt
private

Definition at line 58 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

CosmicHitPairGenerator* SeedGeneratorForCosmics::thePairGenerator
private

Definition at line 46 of file SeedGeneratorForCosmics.h.

Referenced by init(), and run().

PropagatorWithMaterial* SeedGeneratorForCosmics::thePropagatorAl
private

Definition at line 52 of file SeedGeneratorForCosmics.h.

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

PropagatorWithMaterial* SeedGeneratorForCosmics::thePropagatorOp
private

Definition at line 53 of file SeedGeneratorForCosmics.h.

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

CosmicHitTripletGenerator* SeedGeneratorForCosmics::theTripletGenerator
private

Definition at line 47 of file SeedGeneratorForCosmics.h.

Referenced by init(), and run().

KFUpdator* SeedGeneratorForCosmics::theUpdator
private

Definition at line 51 of file SeedGeneratorForCosmics.h.

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

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

Definition at line 49 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

const TransientTrackingRecHitBuilder* SeedGeneratorForCosmics::TTTRHBuilder
private

Definition at line 54 of file SeedGeneratorForCosmics.h.

Referenced by init().