CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CosmicSeedCreator Class Referencefinal

#include <CosmicSeedCreator.h>

Inheritance diagram for CosmicSeedCreator:
SeedCreator

Public Member Functions

 CosmicSeedCreator (const edm::ParameterSet &extra)
 
void init (const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) override
 
void makeSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) override
 
 ~CosmicSeedCreator () override
 
- Public Member Functions inherited from SeedCreator
virtual ~SeedCreator ()
 

Private Attributes

edm::ESHandle< MagneticFieldbfield
 
const SeedComparitorfilter = 0
 
unsigned int maxseeds_
 
const TrackingRegionregion = 0
 

Detailed Description

Definition at line 10 of file CosmicSeedCreator.h.

Constructor & Destructor Documentation

CosmicSeedCreator::CosmicSeedCreator ( const edm::ParameterSet extra)
inline

Definition at line 12 of file CosmicSeedCreator.h.

References edm::ParameterSet::getParameter(), and maxseeds_.

12 { maxseeds_ = extra.getParameter<int>("maxseeds"); }
T getParameter(std::string const &) const
unsigned int maxseeds_
CosmicSeedCreator::~CosmicSeedCreator ( )
inlineoverride

Member Function Documentation

void CosmicSeedCreator::init ( const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
overridevirtual

Implements SeedCreator.

Definition at line 17 of file CosmicSeedCreator.cc.

References bfield, filter, edm::EventSetup::get(), and region.

Referenced by ~CosmicSeedCreator().

17  {
18  region = &iregion;
19  filter = ifilter;
20  // mag field
22 }
edm::ESHandle< MagneticField > bfield
T get() const
Definition: EventSetup.h:73
void CosmicSeedCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
overridevirtual

Implements SeedCreator.

Definition at line 24 of file CosmicSeedCreator.cc.

References alongMomentum, bfield, ALCARECOTkAlJpsiMuMu_cff::charge, TrackingRegion::direction(), hfClusterShapes_cfi::hits, trackerHitRTTI::isUndef(), LogDebug, maxseeds_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), region, and SeedingHitSet::size().

Referenced by ~CosmicSeedCreator().

24  {
25  //_________________________
26  //
27  //Get Parameters
28  //________________________
29 
30  //hit package
31  //+++++++++++
32  const SeedingHitSet& hits = ordered;
33  if (hits.size() < 2)
34  return;
35 
36  //hits
37  //++++
38  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
39  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
40  assert(!trackerHitRTTI::isUndef(*tth1));
41  assert(!trackerHitRTTI::isUndef(*tth2));
42 
44 
45  //definition of position & momentum
46  //++++++++++++++++++++++++++++++++++
47  //direction of the trajectory seed given by the direction of the region
48  GlobalVector initialMomentum(region->direction());
49  //fix the momentum scale
50  //initialMomentum = initialMomentum.basicVector.unitVector() * region->origin().direction().mag();
51  //initialMomentum = region->origin().direction(); //alternative.
52  LogDebug("CosmicSeedCreator") << "initial momentum = " << initialMomentum;
53 
54  //___________________________________________
55  //
56  //Direction of the trajectory seed
57  //___________________________________________
58 
59  //radius
60  //++++++
61  bool reverseAll = false;
62  if (fabs(tth1->globalPosition().perp()) < fabs(tth2->globalPosition().perp()))
63  //comparison of the position of the 2 hits by checking/comparing their radius
64  {
65  usedHit = tth1;
66  reverseAll = true;
67  }
68 
69  else
70  usedHit = tth2;
71 
72  //location in the barrel (up or bottom)
73  //+++++++++++++++++++++++++++++++++++++
74  //simple check, probably nees to be more precise FIXME
75  bool bottomSeed = (usedHit->globalPosition().y() < 0);
76 
77  //apply corrections
78  //+++++++++++++++++
80 
81  if (reverseAll) {
82  LogDebug("CosmicSeedCreator") << "Reverse all applied";
83 
84  seedHits.push_back(tth2->clone());
85  seedHits.push_back(tth1->clone());
86  }
87 
88  else {
89  seedHits.push_back(tth1->clone());
90  seedHits.push_back(tth2->clone());
91  }
92 
93  //propagation
94  //+++++++++++
95 
96  PropagationDirection seedDirection = alongMomentum; //by default
97 
98  if (reverseAll)
99  initialMomentum *= -1;
100 
101  if (bottomSeed) {
102  //means that the seed parameters are inverse of what we want.
103  //reverse the momentum again
104  initialMomentum *= -1;
105  //and change the direction of the seed
106  seedDirection = oppositeToMomentum;
107  }
108 
109  for (int charge = -1; charge <= 1; charge += 2) {
110  //fixme, what hit do you want to use ?
111 
112  FreeTrajectoryState freeState(
113  GlobalTrajectoryParameters(usedHit->globalPosition(), initialMomentum, charge, &*bfield),
114  CurvilinearTrajectoryError(ROOT::Math::SMatrixIdentity()));
115 
116  LogDebug("CosmicSeedCreator") << "Position freeState: " << usedHit->globalPosition() << "\nCharge: " << charge
117  << "\nInitial momentum :" << initialMomentum;
118 
119  TrajectoryStateOnSurface tsos(freeState, *usedHit->surface());
120 
121  PTrajectoryStateOnDet const& PTraj =
122  trajectoryStateTransform::persistentState(tsos, usedHit->hit()->geographicalId().rawId());
123  seedCollection.emplace_back(PTraj, seedHits, seedDirection);
124 
125  } //end charge loop
126 
127  //________________
128  //
129  //Return seed
130  //________________
131 
132  LogDebug("CosmicSeedCreator") << "Using SeedCreator---------->\n"
133  << "seedCollections size = " << seedCollection.size();
134 
135  if (seedCollection.size() > maxseeds_) {
136  edm::LogError("TooManySeeds") << "Found too many seeds (" << seedCollection.size() << " > " << maxseeds_
137  << "), bailing out.\n";
138  seedCollection.clear();
139  }
140 }
#define LogDebug(id)
edm::ESHandle< MagneticField > bfield
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
PropagationDirection
GlobalVector const & direction() const
the direction around which region is constructed
void push_back(D *&d)
Definition: OwnVector.h:326
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
const TrackingRegion * region
unsigned int maxseeds_
unsigned int size() const
Definition: SeedingHitSet.h:41
bool isUndef(TrackingRecHit const &hit)

Member Data Documentation

edm::ESHandle<MagneticField> CosmicSeedCreator::bfield
private

Definition at line 26 of file CosmicSeedCreator.h.

Referenced by init(), and makeSeed().

const SeedComparitor* CosmicSeedCreator::filter = 0
private
unsigned int CosmicSeedCreator::maxseeds_
private

Definition at line 28 of file CosmicSeedCreator.h.

Referenced by CosmicSeedCreator(), and makeSeed().

const TrackingRegion* CosmicSeedCreator::region = 0
private

Definition at line 24 of file CosmicSeedCreator.h.

Referenced by init(), makeSeed(), and ~CosmicSeedCreator().