CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CosmicSeedCreator Class Reference

#include <CosmicSeedCreator.h>

Inheritance diagram for CosmicSeedCreator:
SeedCreator

Public Member Functions

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

Private Attributes

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

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_
virtual CosmicSeedCreator::~CosmicSeedCreator ( )
inlinevirtual

Definition at line 20 of file CosmicSeedCreator.h.

20 {}

Member Function Documentation

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

Implements SeedCreator.

Definition at line 15 of file CosmicSeedCreator.cc.

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

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

Implements SeedCreator.

Definition at line 25 of file CosmicSeedCreator.cc.

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

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  TrajectorySeed seed(PTraj,seedHits,seedDirection);
135  if (filter == 0 || filter->compatible(seed)) {
136  seedCollection.push_back(seed);
137  }
138 
139  }//end charge loop
140 
141 
142  //________________
143  //
144  //Return seed
145  //________________
146 
147 
148  LogDebug("CosmicSeedCreator")
149  << "Using SeedCreator---------->\n"
150  << "seedCollections size = " << seedCollection.size();
151 
152  if ( seedCollection.size() > maxseeds_ ) {
153  edm::LogError("TooManySeeds") << "Found too many seeds (" << seedCollection.size() << " > " << maxseeds_ << "), bailing out.\n";
154  seedCollection.clear();
155  }
156 
157 }
#define LogDebug(id)
edm::ESHandle< MagneticField > bfield
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
PropagationDirection
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion &region) const =0
double charge(const std::vector< uint8_t > &Ampls)
const SeedComparitor * filter
GlobalVector const & direction() const
the direction around which region is constructed
void push_back(D *&d)
Definition: OwnVector.h:274
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
const TrackingRegion * region
unsigned int maxseeds_
unsigned int size() const
Definition: SeedingHitSet.h:44
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 = nullptr
private
unsigned int CosmicSeedCreator::maxseeds_
private

Definition at line 38 of file CosmicSeedCreator.h.

Referenced by CosmicSeedCreator(), and makeSeed().

const TrackingRegion* CosmicSeedCreator::region = nullptr
private

Definition at line 34 of file CosmicSeedCreator.h.

Referenced by init(), and makeSeed().