CMS 3D CMS Logo

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

#include <CosmicSeedCreator.h>

Inheritance diagram for CosmicSeedCreator:
SeedCreator

Public Member Functions

 CosmicSeedCreator (const edm::ParameterSet &extra)
 
virtual ~CosmicSeedCreator ()
 
- Public Member Functions inherited from SeedCreator
virtual ~SeedCreator ()
 

Protected Member Functions

const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &ordered, const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter)
 

Private Attributes

unsigned int maxseeds_
 

Detailed Description

Definition at line 8 of file CosmicSeedCreator.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file CosmicSeedCreator.h.

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

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

Definition at line 16 of file CosmicSeedCreator.h.

16 {}

Member Function Documentation

const TrajectorySeed * CosmicSeedCreator::trajectorySeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet ordered,
const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
protectedvirtual

Implements SeedCreator.

Definition at line 12 of file CosmicSeedCreator.cc.

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

17 {
18 
19  //_________________________
20  //
21  //Get Parameters
22  //________________________
23 
24 
25  //hit package
26  //+++++++++++
27  const SeedingHitSet & hits = ordered;
28  if ( hits.size() < 2) return 0;
29 
30 
31  //hits
32  //++++
35 
37 
38  //definition of position & momentum
39  //++++++++++++++++++++++++++++++++++
40  GlobalVector initialMomentum(region.direction());//direction of the trajectory seed given by the direction of the region
41  //fix the momentum scale
42  //initialMomentum = initialMomentum.basicVector.unitVector() * region.origin().direction().mag();
43  //initialMomentum = region.origin().direction(); //alternative.
44  LogDebug("CosmicSeedCreator") << "initial momentum = " << initialMomentum;
45 
46 
47  //magnetic field
48  //++++++++++++++
50  es.get<IdealMagneticFieldRecord>().get(bfield);
51 
52 
53  //___________________________________________
54  //
55  //Direction of the trajectory seed
56  //___________________________________________
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 usedHit=tth2;
70 
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 
78  //apply corrections
79  //+++++++++++++++++
81 
82  if (reverseAll){
83  LogDebug("CosmicSeedCreator") <<"Reverse all applied";
84 
85  seedHits.push_back(tth2->hit()->clone());
86  seedHits.push_back(tth1->hit()->clone());
87  }
88 
89  else {
90  seedHits.push_back(tth1->hit()->clone());
91  seedHits.push_back(tth2->hit()->clone());
92  }
93 
94 
95  //propagation
96  //+++++++++++
97 
98  PropagationDirection seedDirection = alongMomentum; //by default
99 
100 
101  if (reverseAll) initialMomentum *=-1;
102 
103  if (bottomSeed){
104  //means that the seed parameters are inverse of what we want.
105  //reverse the momentum again
106  initialMomentum *=-1;
107  //and change the direction of the seed
108  seedDirection = oppositeToMomentum;
109  }
110 
111 
112  for (int charge=-1;charge<=1;charge+=2){
113  //fixme, what hit do you want to use ?
114 
115  FreeTrajectoryState freeState(GlobalTrajectoryParameters(usedHit->globalPosition(),
116  initialMomentum, charge, &*bfield),
117  CurvilinearTrajectoryError(ROOT::Math::SMatrixIdentity())
118  );
119 
120  LogDebug("CosmicSeedCreator")<<"Position freeState: " << usedHit->globalPosition()
121  <<"\nCharge: "<< charge
122  <<"\nInitial momentum :" << initialMomentum ;
123 
124  TrajectoryStateOnSurface tsos(freeState, *usedHit->surface());
125 
126 
127  PTrajectoryStateOnDet const & PTraj = trajectoryStateTransform::persistentState(tsos, usedHit->hit()->geographicalId().rawId());
128  TrajectorySeed seed(PTraj,seedHits,seedDirection);
129  if (filter == 0 || filter->compatible(seed)) {
130  seedCollection.push_back(seed);
131  }
132 
133  }//end charge loop
134 
135 
136  //________________
137  //
138  //Return seed
139  //________________
140 
141 
142  LogDebug("CosmicSeedCreator")
143  << "Using SeedCreator---------->\n"
144  << "seedCollections size = " << seedCollection.size();
145 
146  if ( seedCollection.size() > maxseeds_ ) {
147  edm::LogError("TooManySeeds") << "Found too many seeds (" << seedCollection.size() << " > " << maxseeds_ << "), bailing out.\n";
148  seedCollection.clear();
149  return 0;
150  }
151  else {
152  return (seedCollection.empty() ? 0 : &seedCollection.back());
153  }
154 
155 }
#define LogDebug(id)
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)
void push_back(D *&d)
Definition: OwnVector.h:273
virtual GlobalVector direction() const =0
the direction around which region is constructed
const T & get() const
Definition: EventSetup.h:55
unsigned int maxseeds_
unsigned int size() const
Definition: SeedingHitSet.h:31

Member Data Documentation

unsigned int CosmicSeedCreator::maxseeds_
private

Definition at line 27 of file CosmicSeedCreator.h.

Referenced by CosmicSeedCreator(), and trajectorySeed().