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)
 

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 
)
protectedvirtual

Implements SeedCreator.

Definition at line 11 of file CosmicSeedCreator.cc.

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

15 {
16 
17  //_________________________
18  //
19  //Get Parameters
20  //________________________
21 
22 
23  //hit package
24  //+++++++++++
25  const SeedingHitSet & hits = ordered;
26  if ( hits.size() < 2) return 0;
27 
28 
29  //hits
30  //++++
33 
35 
36  //definition of position & momentum
37  //++++++++++++++++++++++++++++++++++
38  GlobalVector initialMomentum(region.direction());//direction of the trajectory seed given by the direction of the region
39  //fix the momentum scale
40  //initialMomentum = initialMomentum.basicVector.unitVector() * region.origin().direction().mag();
41  //initialMomentum = region.origin().direction(); //alternative.
42  LogDebug("CosmicSeedCreator") << "initial momentum = " << initialMomentum;
43 
44 
45  //magnetic field
46  //++++++++++++++
48  es.get<IdealMagneticFieldRecord>().get(bfield);
49 
50 
51  //___________________________________________
52  //
53  //Direction of the trajectory seed
54  //___________________________________________
55 
56 
57  //radius
58  //++++++
59  bool reverseAll = false;
60  if ( fabs(tth1->globalPosition().perp()) < fabs(tth2->globalPosition().perp()) )
61  //comparison of the position of the 2 hits by checking/comparing their radius
62  {
63  usedHit=tth1;
64  reverseAll = true;
65  }
66 
67  else usedHit=tth2;
68 
69 
70  //location in the barrel (up or bottom)
71  //+++++++++++++++++++++++++++++++++++++
72  //simple check, probably nees to be more precise FIXME
73  bool bottomSeed = (usedHit->globalPosition().y()<0);
74 
75 
76  //apply corrections
77  //+++++++++++++++++
79 
80  if (reverseAll){
81  LogDebug("CosmicSeedCreator") <<"Reverse all applied";
82 
83  seedHits.push_back(tth2->hit()->clone());
84  seedHits.push_back(tth1->hit()->clone());
85  }
86 
87  else {
88  seedHits.push_back(tth1->hit()->clone());
89  seedHits.push_back(tth2->hit()->clone());
90  }
91 
92 
93  //propagation
94  //+++++++++++
95 
96  PropagationDirection seedDirection = alongMomentum; //by default
97 
98 
99  if (reverseAll) 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 
110  for (int charge=-1;charge<=1;charge+=2){
111  //fixme, what hit do you want to use ?
112 
113  FreeTrajectoryState freeState(GlobalTrajectoryParameters(usedHit->globalPosition(),
114  initialMomentum, charge, &*bfield),
115  CurvilinearTrajectoryError(ROOT::Math::SMatrixIdentity())
116  );
117 
118  LogDebug("CosmicSeedCreator")<<"Position freeState: " << usedHit->globalPosition()
119  <<"\nCharge: "<< charge
120  <<"\nInitial momentum :" << initialMomentum ;
121 
122  TrajectoryStateOnSurface tsos(freeState, *usedHit->surface());
123 
124  TrajectoryStateTransform transformer;
125  boost::shared_ptr<PTrajectoryStateOnDet> PTraj(transformer.persistentState(tsos, usedHit->hit()->geographicalId().rawId()));
126  seedCollection.push_back( TrajectorySeed(*PTraj,seedHits,seedDirection));
127 
128  }//end charge loop
129 
130 
131  //________________
132  //
133  //Return seed
134  //________________
135 
136 
137  LogDebug("CosmicSeedCreator")
138  << "Using SeedCreator---------->\n"
139  << "seedCollections size = " << seedCollection.size();
140 
141  if ( seedCollection.size() > maxseeds_ ) {
142  edm::LogError("TooManySeeds") << "Found too many seeds (" << seedCollection.size() << " > " << maxseeds_ << "), bailing out.\n";
143  seedCollection.clear();
144  return &seedCollection.back();
145  }
146  else {
147  return &seedCollection.back();
148  }
149 
150 }
#define LogDebug(id)
PropagationDirection
double charge(const std::vector< uint8_t > &Ampls)
void push_back(D *&d)
Definition: OwnVector.h:290
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:14

Member Data Documentation

unsigned int CosmicSeedCreator::maxseeds_
private

Definition at line 26 of file CosmicSeedCreator.h.

Referenced by CosmicSeedCreator(), and trajectorySeed().