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

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().