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
 
TrajectoryStateTransform transformer
 
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, transformer, 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  std::auto_ptr<PTrajectoryStateOnDet> PTraj(
149  transformer.persistentState(outerUpdated,(*(HitTriplets[it].outer())).geographicalId().rawId())
150  );
151  output.push_back(TrajectorySeed(*PTraj,hits,alongMomentum));
152 
153  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
154  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
155  output.clear();
156  return false;
157  }
158  }
159  }
160  } else {
161  const TSOS outerState =
162  thePropagatorOp->propagate(CosmicSeed,
163  tracker->idToDet((*(HitTriplets[it].outer())).geographicalId())->surface());
164  if ( outerState.isValid()) {
165  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
166  const TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
167  if ( outerUpdated.isValid()) {
168  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
169 
170  std::auto_ptr<PTrajectoryStateOnDet> PTraj(
171  transformer.persistentState(outerUpdated, (*(HitTriplets[it].outer())).geographicalId().rawId())
172  );
173  output.push_back(TrajectorySeed(*PTraj,hits,oppositeToMomentum));
174 
175  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
176  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
177  output.clear();
178  return false;
179  }
180  }
181  }
182  }
183  }
184 
185 
186  for(unsigned int is=0;is<HitPairs.size();is++){
187 
188 
189 
190  GlobalPoint inner = tracker->idToDet((*(HitPairs[is].inner())).geographicalId())->surface().toGlobal((*(HitPairs[is].inner())).localPosition());
191  GlobalPoint outer = tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface().toGlobal((*(HitPairs[is].outer())).localPosition());
192 
193  LogDebug("CosmicSeedFinder") <<"inner point of the seed "<<inner <<" outer point of the seed "<<outer;
194  //RC const TransientTrackingRecHit* outrhit=TTTRHBuilder->build(HitPairs[is].outer().RecHit());
196  //***top-bottom
198  if (positiveYOnly && (outrhit->globalPosition().y()<0 || innrhit->globalPosition().y()<0
199  || outrhit->globalPosition().y() < innrhit->globalPosition().y()
200  ) ) continue;
201  if (negativeYOnly && (outrhit->globalPosition().y()>0 || innrhit->globalPosition().y()>0
202  || outrhit->globalPosition().y() > innrhit->globalPosition().y()
203  ) ) continue;
204  //***
205 
207  hits.push_back(HitPairs[is].outer()->hit()->clone());
208  // hits.push_back(HitPairs[is].inner()->clone());
209 
210  for (int i=0;i<2;i++){
211  //FIRST STATE IS CALCULATED CONSIDERING THAT THE CHARGE CAN BE POSITIVE OR NEGATIVE
212  int predsign=(2*i)-1;
213  if((outer.y()-inner.y())>0){
214  GlobalTrajectoryParameters Gtp(outer,
215  (inner-outer)*(seedpt/(inner-outer).mag()),
216  predsign,
217  &(*magfield));
218 
219  FreeTrajectoryState CosmicSeed(Gtp,
221 
222 
223  LogDebug("CosmicSeedFinder") << " FirstTSOS "<<CosmicSeed;
224  //First propagation
225  const TSOS outerState =
226  thePropagatorAl->propagate(CosmicSeed,
227  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
228  if ( outerState.isValid()) {
229  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
230  const TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
231  if ( outerUpdated.isValid()) {
232  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
233 
234  std::auto_ptr<PTrajectoryStateOnDet> PTraj(
235  transformer.persistentState(outerUpdated, (*(HitPairs[is].outer())).geographicalId().rawId())
236  );
237 
238  output.push_back( TrajectorySeed(*PTraj,hits,alongMomentum));
239 
240  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
241  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
242  output.clear();
243  return false;
244  }
245 
246  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
247  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
248 
249 
250  }
251  else{
252  GlobalTrajectoryParameters Gtp(outer,
253  (outer-inner)*(seedpt/(outer-inner).mag()),
254  predsign,
255  &(*magfield));
256  FreeTrajectoryState CosmicSeed(Gtp,
258  LogDebug("CosmicSeedFinder") << " FirstTSOS "<<CosmicSeed;
259  //First propagation
260  const TSOS outerState =
261  thePropagatorAl->propagate(CosmicSeed,
262  tracker->idToDet((*(HitPairs[is].outer())).geographicalId())->surface());
263  if ( outerState.isValid()) {
264 
265  LogDebug("CosmicSeedFinder") <<"outerState "<<outerState;
266  const TSOS outerUpdated= theUpdator->update( outerState,*outrhit);
267  if ( outerUpdated.isValid()) {
268  LogDebug("CosmicSeedFinder") <<"outerUpdated "<<outerUpdated;
269 
270  std::auto_ptr<PTrajectoryStateOnDet> PTraj(
271  transformer.persistentState(outerUpdated,(*(HitPairs[is].outer())).geographicalId().rawId())
272  );
273  output.push_back(TrajectorySeed(*PTraj,hits,oppositeToMomentum));
274 
275  if ((maxSeeds_ > 0) && (output.size() > size_t(maxSeeds_))) {
276  edm::LogError("TooManySeeds") << "Found too many seeds, bailing out.\n";
277  output.clear();
278  return false;
279  }
280 
281  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first update failed ";
282  }else edm::LogWarning("CosmicSeedFinder") << " SeedForCosmics first propagation failed ";
283  }
284 
285  }
286  }
287  return true;
288 }
#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
T y() const
Definition: PV3DBase.h:57
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:290
PropagatorWithMaterial * thePropagatorAl
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:28
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
T z() const
Definition: PV3DBase.h:58
PTrajectoryStateOnDet * persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid) const
TrajectoryStateTransform transformer
virtual TrajectoryStateOnSurface propagate(const TrajectoryStateOnSurface &tsos, const Plane &plane) const
T * clone(const T *tp)
Definition: Ptr.h:42
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
virtual unsigned int size() const
T x() const
Definition: PV3DBase.h:56
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().

TrajectoryStateTransform SeedGeneratorForCosmics::transformer
private

Definition at line 51 of file SeedGeneratorForCosmics.h.

Referenced by seeds().

const TransientTrackingRecHitBuilder* SeedGeneratorForCosmics::TTTRHBuilder
private

Definition at line 55 of file SeedGeneratorForCosmics.h.

Referenced by init(), and seeds().