CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CosmicSeedCreator Class Referencefinal

#include <CosmicSeedCreator.h>

Inheritance diagram for CosmicSeedCreator:
SeedCreator

Public Member Functions

 CosmicSeedCreator (const edm::ParameterSet &extra)
 
void init (const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter) override
 
void makeSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) override
 
 ~CosmicSeedCreator () override
 
- 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 10 of file CosmicSeedCreator.h.

Constructor & Destructor Documentation

◆ CosmicSeedCreator()

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

Definition at line 12 of file CosmicSeedCreator.h.

12 { maxseeds_ = extra.getParameter<int>("maxseeds"); }

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

◆ ~CosmicSeedCreator()

CosmicSeedCreator::~CosmicSeedCreator ( )
inlineoverride

Definition at line 14 of file CosmicSeedCreator.h.

14 {}

Member Function Documentation

◆ init()

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

Implements SeedCreator.

Definition at line 17 of file CosmicSeedCreator.cc.

17  {
18  region = &iregion;
19  filter = ifilter;
20  // mag field
22 }

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

◆ makeSeed()

void CosmicSeedCreator::makeSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits 
)
overridevirtual

Implements SeedCreator.

Definition at line 24 of file CosmicSeedCreator.cc.

24  {
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 }

References alongMomentum, cms::cuda::assert(), bfield, ALCARECOTkAlJpsiMuMu_cff::charge, TrackingRegion::direction(), hfClusterShapes_cfi::hits, trackerHitRTTI::isUndef(), LogDebug, maxseeds_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), region, and ElectronSeedTrackRefFix_cfi::seedCollection.

Member Data Documentation

◆ bfield

edm::ESHandle<MagneticField> CosmicSeedCreator::bfield
private

Definition at line 26 of file CosmicSeedCreator.h.

Referenced by init(), and makeSeed().

◆ filter

const SeedComparitor* CosmicSeedCreator::filter = nullptr
private

Definition at line 25 of file CosmicSeedCreator.h.

Referenced by init().

◆ maxseeds_

unsigned int CosmicSeedCreator::maxseeds_
private

Definition at line 28 of file CosmicSeedCreator.h.

Referenced by CosmicSeedCreator(), and makeSeed().

◆ region

const TrackingRegion* CosmicSeedCreator::region = nullptr
private

Definition at line 24 of file CosmicSeedCreator.h.

Referenced by init(), and makeSeed().

Vector3DBase
Definition: Vector3DBase.h:8
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
cms::cuda::assert
assert(be >=bs)
trackerHitRTTI::isUndef
bool isUndef(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:24
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:87
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
ElectronSeedTrackRefFix_cfi.seedCollection
seedCollection
Definition: ElectronSeedTrackRefFix_cfi.py:9
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
CosmicSeedCreator::maxseeds_
unsigned int maxseeds_
Definition: CosmicSeedCreator.h:28
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
TrackingRegion::direction
GlobalVector const & direction() const
the direction around which region is constructed
Definition: TrackingRegion.h:65
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
CosmicSeedCreator::region
const TrackingRegion * region
Definition: CosmicSeedCreator.h:24
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
alongMomentum
Definition: PropagationDirection.h:4
edm::OwnVector< TrackingRecHit >