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, edm::ConsumesCollector &&)
 
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

const MagneticFieldbfield = nullptr
 
const SeedComparitorfilter = nullptr
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldESToken_
 
unsigned int maxseeds_
 
const TrackingRegionregion = nullptr
 

Detailed Description

Definition at line 11 of file CosmicSeedCreator.h.

Constructor & Destructor Documentation

◆ CosmicSeedCreator()

CosmicSeedCreator::CosmicSeedCreator ( const edm::ParameterSet extra,
edm::ConsumesCollector &&  iC 
)

Definition at line 18 of file CosmicSeedCreator.cc.

19  : magneticFieldESToken_(iC.esConsumes()), maxseeds_(extra.getParameter<int>("maxseeds")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldESToken_
unsigned int maxseeds_

◆ ~CosmicSeedCreator()

CosmicSeedCreator::~CosmicSeedCreator ( )
inlineoverride

Definition at line 15 of file CosmicSeedCreator.h.

15 {}

Member Function Documentation

◆ init()

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

Implements SeedCreator.

Definition at line 21 of file CosmicSeedCreator.cc.

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

21  {
22  region = &iregion;
23  filter = ifilter;
24  // mag field
26 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const MagneticField * bfield
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldESToken_
const SeedComparitor * filter
const TrackingRegion * region

◆ makeSeed()

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

Implements SeedCreator.

Definition at line 28 of file CosmicSeedCreator.cc.

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.

28  {
29  //_________________________
30  //
31  //Get Parameters
32  //________________________
33 
34  //hit package
35  //+++++++++++
36  const SeedingHitSet& hits = ordered;
37  if (hits.size() < 2)
38  return;
39 
40  //hits
41  //++++
46 
48 
49  //definition of position & momentum
50  //++++++++++++++++++++++++++++++++++
51  //direction of the trajectory seed given by the direction of the region
52  GlobalVector initialMomentum(region->direction());
53  //fix the momentum scale
54  //initialMomentum = initialMomentum.basicVector.unitVector() * region->origin().direction().mag();
55  //initialMomentum = region->origin().direction(); //alternative.
56  LogDebug("CosmicSeedCreator") << "initial momentum = " << initialMomentum;
57 
58  //___________________________________________
59  //
60  //Direction of the trajectory seed
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
74  usedHit = tth2;
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  //apply corrections
82  //+++++++++++++++++
84 
85  if (reverseAll) {
86  LogDebug("CosmicSeedCreator") << "Reverse all applied";
87 
88  seedHits.push_back(tth2->clone());
89  seedHits.push_back(tth1->clone());
90  }
91 
92  else {
93  seedHits.push_back(tth1->clone());
94  seedHits.push_back(tth2->clone());
95  }
96 
97  //propagation
98  //+++++++++++
99 
100  PropagationDirection seedDirection = alongMomentum; //by default
101 
102  if (reverseAll)
103  initialMomentum *= -1;
104 
105  if (bottomSeed) {
106  //means that the seed parameters are inverse of what we want.
107  //reverse the momentum again
108  initialMomentum *= -1;
109  //and change the direction of the seed
110  seedDirection = oppositeToMomentum;
111  }
112 
113  for (int charge = -1; charge <= 1; charge += 2) {
114  //fixme, what hit do you want to use ?
115 
116  FreeTrajectoryState freeState(
117  GlobalTrajectoryParameters(usedHit->globalPosition(), initialMomentum, charge, bfield),
118  CurvilinearTrajectoryError(ROOT::Math::SMatrixIdentity()));
119 
120  LogDebug("CosmicSeedCreator") << "Position freeState: " << usedHit->globalPosition() << "\nCharge: " << charge
121  << "\nInitial momentum :" << initialMomentum;
122 
123  TrajectoryStateOnSurface tsos(freeState, *usedHit->surface());
124 
125  PTrajectoryStateOnDet const& PTraj =
126  trajectoryStateTransform::persistentState(tsos, usedHit->hit()->geographicalId().rawId());
127  seedCollection.emplace_back(PTraj, seedHits, seedDirection);
128 
129  } //end charge loop
130 
131  //________________
132  //
133  //Return seed
134  //________________
135 
136  LogDebug("CosmicSeedCreator") << "Using SeedCreator---------->\n"
137  << "seedCollections size = " << seedCollection.size();
138 
139  if (seedCollection.size() > maxseeds_) {
140  edm::LogError("TooManySeeds") << "Found too many seeds (" << seedCollection.size() << " > " << maxseeds_
141  << "), bailing out.\n";
142  seedCollection.clear();
143  }
144 }
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
PropagationDirection
Log< level::Error, false > LogError
assert(be >=bs)
const MagneticField * bfield
void push_back(D *&d)
Definition: OwnVector.h:326
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:14
const TrackingRegion * region
unsigned int maxseeds_
GlobalVector const & direction() const
the direction around which region is constructed
bool isUndef(TrackingRecHit const &hit)
#define LogDebug(id)

Member Data Documentation

◆ bfield

const MagneticField* CosmicSeedCreator::bfield = nullptr
private

Definition at line 27 of file CosmicSeedCreator.h.

Referenced by init(), and makeSeed().

◆ filter

const SeedComparitor* CosmicSeedCreator::filter = nullptr
private

Definition at line 26 of file CosmicSeedCreator.h.

Referenced by init().

◆ magneticFieldESToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> CosmicSeedCreator::magneticFieldESToken_
private

Definition at line 29 of file CosmicSeedCreator.h.

Referenced by init().

◆ maxseeds_

unsigned int CosmicSeedCreator::maxseeds_
private

Definition at line 31 of file CosmicSeedCreator.h.

Referenced by makeSeed().

◆ region

const TrackingRegion* CosmicSeedCreator::region = nullptr
private

Definition at line 25 of file CosmicSeedCreator.h.

Referenced by init(), and makeSeed().