CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
edm::ParameterSet conf_
 
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
TransientTrackingRecHitBuilder
TTTRHBuilder
 

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, conf_, geometry, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitsforseeds, negativeYOnly, positiveYOnly, ptmin, region, and seedpt.

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

Definition at line 30 of file SeedGeneratorForCosmics.h.

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, geometry, edm::EventSetup::get(), CosmicHitPairGenerator::hitPairs(), HitPairs, hitsforseeds, CosmicHitTripletGenerator::hitTriplets(), HitTriplets, CosmicLayerPairs::init(), CosmicLayerTriplets::init(), LogDebug, magfield, oppositeToMomentum, edm::ESHandle< class >::product(), region, thePairGenerator, thePropagatorAl, thePropagatorOp, theTripletGenerator, theUpdator, tracker, and TTTRHBuilder.

Referenced by CosmicSeedGenerator::produce().

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
virtual 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)
virtual void hitTriplets(const TrackingRegion &reg, OrderedHitTriplets &prs, const edm::EventSetup &iSetup)
form base class
CosmicHitPairGenerator * thePairGenerator
PropagatorWithMaterial * thePropagatorAl
T const * product() const
Definition: ESHandle.h:62
const TransientTrackingRecHitBuilder * TTTRHBuilder
edm::ESHandle< MagneticField > magfield
void SeedGeneratorForCosmics::run ( TrajectorySeedCollection output,
const edm::EventSetup c 
)

Definition at line 73 of file SeedGeneratorForCosmics.cc.

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

Referenced by CosmicSeedGenerator::produce().

73  {
74  seeds(output,iSetup,region);
75  delete thePairGenerator;
76  delete theTripletGenerator;
77  delete thePropagatorAl;
78  delete thePropagatorOp;
79  delete theUpdator;
80 }
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 81 of file SeedGeneratorForCosmics.cc.

References alongMomentum, TransientTrackingRecHitBuilder::build(), GlobalTrajectoryParameters::charge(), clone(), HitPairs, HitTriplets, i, SurfaceOrientation::inner, edm::detail::isnan(), TrajectoryStateOnSurface::isValid(), LogDebug, mag(), magfield, maxSeeds_, GlobalTrajectoryParameters::momentum(), negativeYOnly, oppositeToMomentum, SurfaceOrientation::outer, FreeTrajectoryState::parameters(), trajectoryStateTransform::persistentState(), positiveYOnly, PropagatorWithMaterial::propagate(), edm::OwnVector< T, P >::push_back(), seedpt, OrderedHitPairs::size(), OrderedHitTriplets::size(), mathSSE::sqrt(), FastHelix::stateAtVertex(), thePropagatorAl, thePropagatorOp, theUpdator, tracker, TTTRHBuilder, KFUpdator::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by run().

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

Member Data Documentation

std::string SeedGeneratorForCosmics::builderName
private

Definition at line 56 of file SeedGeneratorForCosmics.h.

Referenced by init(), and SeedGeneratorForCosmics().

edm::ParameterSet SeedGeneratorForCosmics::conf_
private

Definition at line 44 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics().

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

Definition at line 60 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

std::string SeedGeneratorForCosmics::hitsforseeds
private

Definition at line 58 of file SeedGeneratorForCosmics.h.

Referenced by init(), and SeedGeneratorForCosmics().

OrderedHitTriplets SeedGeneratorForCosmics::HitTriplets
private

Definition at line 61 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

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

Definition at line 49 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

int32_t SeedGeneratorForCosmics::maxSeeds_
private

Definition at line 45 of file SeedGeneratorForCosmics.h.

Referenced by seeds().

bool SeedGeneratorForCosmics::negativeYOnly
private

Definition at line 65 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

bool SeedGeneratorForCosmics::positiveYOnly
private

Definition at line 64 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

GlobalTrackingRegion SeedGeneratorForCosmics::region
private

Definition at line 46 of file SeedGeneratorForCosmics.h.

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

float SeedGeneratorForCosmics::seedpt
private

Definition at line 59 of file SeedGeneratorForCosmics.h.

Referenced by SeedGeneratorForCosmics(), and seeds().

CosmicHitPairGenerator* SeedGeneratorForCosmics::thePairGenerator
private

Definition at line 47 of file SeedGeneratorForCosmics.h.

Referenced by init(), and run().

PropagatorWithMaterial* SeedGeneratorForCosmics::thePropagatorAl
private

Definition at line 53 of file SeedGeneratorForCosmics.h.

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

PropagatorWithMaterial* SeedGeneratorForCosmics::thePropagatorOp
private

Definition at line 54 of file SeedGeneratorForCosmics.h.

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

CosmicHitTripletGenerator* SeedGeneratorForCosmics::theTripletGenerator
private

Definition at line 48 of file SeedGeneratorForCosmics.h.

Referenced by init(), and run().

KFUpdator* SeedGeneratorForCosmics::theUpdator
private

Definition at line 52 of file SeedGeneratorForCosmics.h.

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

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

Definition at line 50 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().

const TransientTrackingRecHitBuilder* SeedGeneratorForCosmics::TTTRHBuilder
private

Definition at line 55 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().