CMS 3D CMS Logo

CosmicSeedCreator.cc
Go to the documentation of this file.
9 
10 namespace {
11  template <class T>
12  inline T sqr(T t) {
13  return t * t;
14  }
15 } // namespace
16 
17 void CosmicSeedCreator::init(const TrackingRegion& iregion, const edm::EventSetup& es, const SeedComparitor* ifilter) {
18  region = &iregion;
19  filter = ifilter;
20  // mag field
22 }
23 
25  //_________________________
26  //
27  //Get Parameters
28  //________________________
29 
30  //hit package
31  //+++++++++++
32  const SeedingHitSet& hits = ordered;
33  if (hits.size() < 2)
34  return;
35 
36  //hits
37  //++++
42 
44 
45  //definition of position & momentum
46  //++++++++++++++++++++++++++++++++++
47  //direction of the trajectory seed given by the direction of the region
48  GlobalVector initialMomentum(region->direction());
49  //fix the momentum scale
50  //initialMomentum = initialMomentum.basicVector.unitVector() * region->origin().direction().mag();
51  //initialMomentum = region->origin().direction(); //alternative.
52  LogDebug("CosmicSeedCreator") << "initial momentum = " << initialMomentum;
53 
54  //___________________________________________
55  //
56  //Direction of the trajectory seed
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
70  usedHit = tth2;
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  //apply corrections
78  //+++++++++++++++++
80 
81  if (reverseAll) {
82  LogDebug("CosmicSeedCreator") << "Reverse all applied";
83 
84  seedHits.push_back(tth2->clone());
85  seedHits.push_back(tth1->clone());
86  }
87 
88  else {
89  seedHits.push_back(tth1->clone());
90  seedHits.push_back(tth2->clone());
91  }
92 
93  //propagation
94  //+++++++++++
95 
96  PropagationDirection seedDirection = alongMomentum; //by default
97 
98  if (reverseAll)
99  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  for (int charge = -1; charge <= 1; charge += 2) {
110  //fixme, what hit do you want to use ?
111 
112  FreeTrajectoryState freeState(
113  GlobalTrajectoryParameters(usedHit->globalPosition(), initialMomentum, charge, &*bfield),
114  CurvilinearTrajectoryError(ROOT::Math::SMatrixIdentity()));
115 
116  LogDebug("CosmicSeedCreator") << "Position freeState: " << usedHit->globalPosition() << "\nCharge: " << charge
117  << "\nInitial momentum :" << initialMomentum;
118 
119  TrajectoryStateOnSurface tsos(freeState, *usedHit->surface());
120 
121  PTrajectoryStateOnDet const& PTraj =
122  trajectoryStateTransform::persistentState(tsos, usedHit->hit()->geographicalId().rawId());
123  seedCollection.emplace_back(PTraj, seedHits, seedDirection);
124 
125  } //end charge loop
126 
127  //________________
128  //
129  //Return seed
130  //________________
131 
132  LogDebug("CosmicSeedCreator") << "Using SeedCreator---------->\n"
133  << "seedCollections size = " << seedCollection.size();
134 
135  if (seedCollection.size() > maxseeds_) {
136  edm::LogError("TooManySeeds") << "Found too many seeds (" << seedCollection.size() << " > " << maxseeds_
137  << "), bailing out.\n";
138  seedCollection.clear();
139  }
140 }
Vector3DBase
Definition: Vector3DBase.h:8
TrajectoryStateOnSurface.h
MessageLogger.h
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SeedingHitSet
Definition: SeedingHitSet.h:6
CosmicSeedCreator::filter
const SeedComparitor * filter
Definition: CosmicSeedCreator.h:25
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
SeedingHitSet::ConstRecHitPointer
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:10
oppositeToMomentum
Definition: PropagationDirection.h:4
sqr
int sqr(const T &t)
Definition: pfalgo_common_ref.h:9
cms::cuda::assert
assert(be >=bs)
trackerHitRTTI::isUndef
bool isUndef(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:23
CosmicSeedCreator::bfield
edm::ESHandle< MagneticField > bfield
Definition: CosmicSeedCreator.h:26
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
ElectronSeedTrackRefFix_cfi.seedCollection
seedCollection
Definition: ElectronSeedTrackRefFix_cfi.py:9
SeedingHitSet.h
SeedComparitor
Definition: SeedComparitor.h:25
IdealMagneticFieldRecord.h
CosmicSeedCreator::init
void init(const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) override
Definition: CosmicSeedCreator.cc:17
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
OrderedSet.t
t
Definition: OrderedSet.py:90
CosmicSeedCreator::maxseeds_
unsigned int maxseeds_
Definition: CosmicSeedCreator.h:28
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
CosmicSeedCreator.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
TrackingRegion::direction
GlobalVector const & direction() const
the direction around which region is constructed
Definition: TrackingRegion.h:62
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
SeedComparitor.h
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
CosmicSeedCreator::region
const TrackingRegion * region
Definition: CosmicSeedCreator.h:24
T
long double T
Definition: Basic3DVectorLD.h:48
CosmicSeedCreator::makeSeed
void makeSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) override
Definition: CosmicSeedCreator.cc:24
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
TrajectoryStateTransform.h
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
TrackingRegion
Definition: TrackingRegion.h:38
TrackingRegion.h
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
alongMomentum
Definition: PropagationDirection.h:4
edm::OwnVector< TrackingRecHit >