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 12 of file CosmicSeedCreator.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file CosmicSeedCreator.h.

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

16  {
17  maxseeds_ = extra.getParameter<int>("maxseeds");
18  }
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 15 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:63
void CosmicSeedCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
overridevirtual

Implements SeedCreator.

Definition at line 25 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().

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

Member Data Documentation

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

Definition at line 36 of file CosmicSeedCreator.h.

Referenced by init(), and makeSeed().

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

Definition at line 38 of file CosmicSeedCreator.h.

Referenced by CosmicSeedCreator(), and makeSeed().

const TrackingRegion* CosmicSeedCreator::region = 0
private

Definition at line 34 of file CosmicSeedCreator.h.

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