CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::TrackletCalculator Class Reference

#include <TrackletCalculator.h>

Inheritance diagram for trklet::TrackletCalculator:
trklet::TrackletCalculatorBase trklet::ProcessBase

Public Member Functions

void addInput (MemoryBase *memory, std::string input) override
 
void addOutput (MemoryBase *memory, std::string output) override
 
void addOutputProjection (TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
 
void execute ()
 
 TrackletCalculator (std::string name, Settings const &settings, Globals *globals, unsigned int iSector)
 
 ~TrackletCalculator () override=default
 
- Public Member Functions inherited from trklet::TrackletCalculatorBase
void addDiskProj (Tracklet *tracklet, int disk)
 
bool addLayerProj (Tracklet *tracklet, int layer)
 
void addProjection (int layer, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
 
void addProjectionDisk (int disk, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
 
bool barrelSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
bool diskSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
void exactproj (double rproj, double rinv, double phi0, double t, double z0, double &phiproj, double &zproj, double &phider, double &zder)
 
void exactprojdisk (double zproj, double rinv, double phi0, double t, double z0, double &phiproj, double &rproj, double &phider, double &rder)
 
void exacttracklet (double r1, double z1, double phi1, double r2, double z2, double phi2, double, double &rinv, double &phi0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phiderdisk[N_DISK], double rderdisk[N_DISK])
 
void exacttrackletdisk (double r1, double z1, double phi1, double r2, double z2, double phi2, double, double &rinv, double &phi0, double &t, double &z0, double phiprojLayer[N_PSLAYER], double zprojLayer[N_PSLAYER], double phiderLayer[N_PSLAYER], double zderLayer[N_PSLAYER], double phiproj[N_DISK - 2], double rproj[N_DISK - 2], double phider[N_DISK - 2], double rder[N_DISK - 2])
 
void exacttrackletOverlap (double r1, double z1, double phi1, double r2, double z2, double phi2, double, double &rinv, double &phi0, double &t, double &z0, double phiprojLayer[N_PSLAYER], double zprojLayer[N_PSLAYER], double phiderLayer[N_PSLAYER], double zderLayer[N_PSLAYER], double phiproj[N_DISK - 2], double rproj[N_DISK - 2], double phider[N_DISK - 2], double rder[N_DISK - 2])
 
bool goodTrackPars (bool goodrinv, bool goodz0)
 
bool inSector (int iphi0, int irinv, double phi0approx, double rinvapprox)
 
bool overlapSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
 TrackletCalculatorBase (std::string name, Settings const &settings, Globals *global, unsigned int iSector)
 
 ~TrackletCalculatorBase () override=default
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (std::string name)
 
std::string const & getName () const
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
void initLayerDisksandISeed (unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
 
unsigned int nbits (unsigned int power)
 
 ProcessBase (std::string name, Settings const &settings, Globals *global, unsigned int iSector)
 
virtual ~ProcessBase ()=default
 

Private Attributes

std::vector< AllStubsMemory * > innerallstubs_
 
int iTC_
 
std::vector< AllStubsMemory * > outerallstubs_
 
std::vector< StubPairsMemory * > stubpairs_
 

Additional Inherited Members

- Protected Attributes inherited from trklet::TrackletCalculatorBase
int disk_
 
unsigned int iSeed_
 
int layer_
 
unsigned int layerdisk1_
 
unsigned int layerdisk2_
 
double phioffset_
 
int TCIndex_
 
TrackletParametersMemorytrackletpars_
 
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
 
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
 
- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
unsigned int iSector_
 
std::string name_
 
double phimax_
 
double phimin_
 
Settings const & settings_
 

Detailed Description

Definition at line 18 of file TrackletCalculator.h.

Constructor & Destructor Documentation

◆ TrackletCalculator()

TrackletCalculator::TrackletCalculator ( std::string  name,
Settings const &  settings,
Globals globals,
unsigned int  iSector 
)

Definition at line 15 of file TrackletCalculator.cc.

16  : TrackletCalculatorBase(name, settings, globals, iSector) {
18 
19  for (unsigned int ilayer = 0; ilayer < N_LAYER; ilayer++) {
20  vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(ilayer), nullptr);
21  trackletprojlayers_.push_back(tmp);
22  }
23 
24  for (unsigned int idisk = 0; idisk < N_DISK; idisk++) {
25  vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(idisk + N_LAYER), nullptr);
26  trackletprojdisks_.push_back(tmp);
27  }
28 
30 
31  // set TC index
32  iTC_ = name_[7] - 'A';
33 
34  TCIndex_ = (iSeed_ << 4) + iTC_;
35  assert(TCIndex_ >= 0 && TCIndex_ <= (int)settings_.ntrackletmax());
36 
38  double phicritFactor =
40  if (std::abs(phicritFactor - 2.) > 0.25)
41  edm::LogPrint("Tracklet")
42  << "TrackletCalculator::TrackletCalculator phicrit approximation may be invalid! Please check.";
43  }
44 }

References funct::abs(), cms::cuda::assert(), trklet::ProcessBase::globals_, trklet::ProcessBase::initLayerDisksandISeed(), trklet::TrackletCalculatorBase::iSeed_, iTC_, trklet::Globals::ITC_L1L2(), trklet::VarBase::K(), trklet::TrackletCalculatorBase::layerdisk1_, trklet::TrackletCalculatorBase::layerdisk2_, trklet::N_DISK, trklet::N_LAYER, trklet::Settings::nallstubs(), trklet::ProcessBase::name_, trklet::Settings::ntrackletmax(), trklet::IMATH_TrackletCalculator::phi0_final, trklet::ProcessBase::phimin_, trklet::TrackletCalculatorBase::phioffset_, trklet::Settings::rcrit(), trklet::IMATH_TrackletCalculator::rinv_final, trklet::ProcessBase::settings_, trklet::TrackletCalculatorBase::TCIndex_, createJobs::tmp, trklet::TrackletCalculatorBase::trackletprojdisks_, trklet::TrackletCalculatorBase::trackletprojlayers_, and trklet::Settings::usephicritapprox().

◆ ~TrackletCalculator()

trklet::TrackletCalculator::~TrackletCalculator ( )
overridedefault

Member Function Documentation

◆ addInput()

void TrackletCalculator::addInput ( MemoryBase memory,
std::string  input 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 93 of file TrackletCalculator.cc.

93  {
94  if (settings_.writetrace()) {
95  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
96  << input;
97  }
98  if (input == "innerallstubin") {
99  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
100  assert(tmp != nullptr);
101  innerallstubs_.push_back(tmp);
102  return;
103  }
104  if (input == "outerallstubin") {
105  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
106  assert(tmp != nullptr);
107  outerallstubs_.push_back(tmp);
108  return;
109  }
110  if (input.substr(0, 8) == "stubpair") {
111  auto* tmp = dynamic_cast<StubPairsMemory*>(memory);
112  assert(tmp != nullptr);
113  stubpairs_.push_back(tmp);
114  return;
115  }
116  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find intput : " << input;
117 }

References cms::cuda::assert(), Exception, innerallstubs_, input, mps_setup::memory, trklet::ProcessBase::name_, outerallstubs_, trklet::ProcessBase::settings_, stubpairs_, createJobs::tmp, and trklet::Settings::writetrace().

◆ addOutput()

void TrackletCalculator::addOutput ( MemoryBase memory,
std::string  output 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 51 of file TrackletCalculator.cc.

51  {
52  if (settings_.writetrace()) {
53  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
54  << output;
55  }
56  if (output == "trackpar") {
57  auto* tmp = dynamic_cast<TrackletParametersMemory*>(memory);
58  assert(tmp != nullptr);
60  return;
61  }
62 
63  if (output.substr(0, 7) == "projout") {
64  //output is on the form 'projoutL2PHIC' or 'projoutD3PHIB'
65  auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
66  assert(tmp != nullptr);
67 
68  unsigned int layerdisk = output[8] - '1'; //layer or disk counting from 0
69  unsigned int phiregion = output[12] - 'A'; //phiregion counting from 0
70 
71  if (output[7] == 'L') {
72  assert(layerdisk < N_LAYER);
73  assert(phiregion < trackletprojlayers_[layerdisk].size());
74  //check that phiregion not already initialized
75  assert(trackletprojlayers_[layerdisk][phiregion] == nullptr);
76  trackletprojlayers_[layerdisk][phiregion] = tmp;
77  return;
78  }
79 
80  if (output[7] == 'D') {
81  assert(layerdisk < N_DISK);
82  assert(phiregion < trackletprojdisks_[layerdisk].size());
83  //check that phiregion not already initialized
84  assert(trackletprojdisks_[layerdisk][phiregion] == nullptr);
85  trackletprojdisks_[layerdisk][phiregion] = tmp;
86  return;
87  }
88  }
89 
90  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
91 }

References cms::cuda::assert(), Exception, mps_setup::memory, trklet::N_DISK, trklet::N_LAYER, trklet::ProcessBase::name_, convertSQLitetoXML_cfg::output, trklet::ProcessBase::settings_, findQualityFiles::size, createJobs::tmp, trklet::TrackletCalculatorBase::trackletpars_, trklet::TrackletCalculatorBase::trackletprojdisks_, trklet::TrackletCalculatorBase::trackletprojlayers_, and trklet::Settings::writetrace().

◆ addOutputProjection()

void TrackletCalculator::addOutputProjection ( TrackletProjectionsMemory *&  outputProj,
MemoryBase memory 
)

Definition at line 46 of file TrackletCalculator.cc.

46  {
47  outputProj = dynamic_cast<TrackletProjectionsMemory*>(memory);
48  assert(outputProj != nullptr);
49 }

References cms::cuda::assert(), and mps_setup::memory.

◆ execute()

void TrackletCalculator::execute ( void  )

Definition at line 119 of file TrackletCalculator.cc.

119  {
120  unsigned int countall = 0;
121  unsigned int countsel = 0;
122 
123  for (auto& stubpair : stubpairs_) {
125  edm::LogVerbatim("Tracklet") << "Will break on too many tracklets in " << getName();
126  break;
127  }
128  for (unsigned int i = 0; i < stubpair->nStubPairs(); i++) {
129  countall++;
130  const Stub* innerFPGAStub = stubpair->getVMStub1(i).stub();
131  const L1TStub* innerStub = innerFPGAStub->l1tstub();
132 
133  const Stub* outerFPGAStub = stubpair->getVMStub2(i).stub();
134  const L1TStub* outerStub = outerFPGAStub->l1tstub();
135 
136  if (settings_.debugTracklet()) {
137  edm::LogVerbatim("Tracklet") << "TrackletCalculator execute " << getName() << "[" << iSector_ << "]";
138  }
139 
140  if (innerFPGAStub->isBarrel() && (getName() != "TC_D1L2A" && getName() != "TC_D1L2B")) {
141  if (outerFPGAStub->isDisk()) {
142  //overlap seeding
143  bool accept = overlapSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub);
144  if (accept)
145  countsel++;
146  } else {
147  //barrel+barrel seeding
148  bool accept = barrelSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
149  if (accept)
150  countsel++;
151  }
152  } else {
153  if (outerFPGAStub->isDisk()) {
154  //disk+disk seeding
155  bool accept = diskSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
156  if (accept)
157  countsel++;
158  } else if (innerFPGAStub->isDisk()) {
159  //layer+disk seeding
160  bool accept = overlapSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
161  if (accept)
162  countsel++;
163  } else {
164  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " invalid seeding";
165  }
166  }
167 
169  edm::LogVerbatim("Tracklet") << "Will break on number of tracklets in " << getName();
170  break;
171  }
172 
173  if (countall >= settings_.maxStep("TC")) {
174  if (settings_.debugTracklet())
175  edm::LogVerbatim("Tracklet") << "Will break on MAXTC 1";
176  break;
177  }
178  if (settings_.debugTracklet()) {
179  edm::LogVerbatim("Tracklet") << "TrackletCalculator execute done";
180  }
181  }
182  if (countall >= settings_.maxStep("TC")) {
183  if (settings_.debugTracklet())
184  edm::LogVerbatim("Tracklet") << "Will break on MAXTC 2";
185  break;
186  }
187  }
188 
189  if (settings_.writeMonitorData("TC")) {
190  globals_->ofstream("trackletcalculator.txt") << getName() << " " << countall << " " << countsel << endl;
191  }
192 }

References accept(), trklet::TrackletCalculatorBase::barrelSeeding(), trklet::Settings::debugTracklet(), trklet::TrackletCalculatorBase::diskSeeding(), Exception, trklet::ProcessBase::getName(), trklet::ProcessBase::globals_, mps_fire::i, trklet::Stub::isBarrel(), trklet::Stub::isDisk(), trklet::ProcessBase::iSector_, trklet::Stub::l1tstub(), trklet::Settings::maxStep(), trklet::Settings::ntrackletmax(), trklet::TrackletParametersMemory::nTracklets(), trklet::Globals::ofstream(), trklet::TrackletCalculatorBase::overlapSeeding(), trklet::ProcessBase::settings_, stubpairs_, trklet::TrackletCalculatorBase::trackletpars_, and trklet::Settings::writeMonitorData().

Member Data Documentation

◆ innerallstubs_

std::vector<AllStubsMemory*> trklet::TrackletCalculator::innerallstubs_
private

Definition at line 33 of file TrackletCalculator.h.

Referenced by addInput().

◆ iTC_

int trklet::TrackletCalculator::iTC_
private

Definition at line 31 of file TrackletCalculator.h.

Referenced by TrackletCalculator().

◆ outerallstubs_

std::vector<AllStubsMemory*> trklet::TrackletCalculator::outerallstubs_
private

Definition at line 34 of file TrackletCalculator.h.

Referenced by addInput().

◆ stubpairs_

std::vector<StubPairsMemory*> trklet::TrackletCalculator::stubpairs_
private

Definition at line 35 of file TrackletCalculator.h.

Referenced by addInput(), and execute().

trklet::TrackletCalculatorBase::iSeed_
unsigned int iSeed_
Definition: TrackletCalculatorBase.h:128
mps_fire.i
i
Definition: mps_fire.py:428
trklet::Settings::ntrackletmax
unsigned int ntrackletmax() const
Definition: Settings.h:274
trklet::Settings::writetrace
bool writetrace() const
Definition: Settings.h:147
input
static const std::string input
Definition: EdmProvDump.cc:48
trklet::TrackletCalculatorBase::phioffset_
double phioffset_
Definition: TrackletCalculatorBase.h:134
trklet::TrackletCalculatorBase::trackletpars_
TrackletParametersMemory * trackletpars_
Definition: TrackletCalculatorBase.h:139
trklet::TrackletCalculator::outerallstubs_
std::vector< AllStubsMemory * > outerallstubs_
Definition: TrackletCalculator.h:34
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
trklet::TrackletCalculator::iTC_
int iTC_
Definition: TrackletCalculator.h:31
trklet::L1TStub
Definition: L1TStub.h:12
cms::cuda::assert
assert(be >=bs)
trklet::TrackletCalculatorBase::barrelSeeding
bool barrelSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
Definition: TrackletCalculatorBase.cc:331
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:20
trklet::ProcessBase::settings_
Settings const & settings_
Definition: ProcessBase.h:44
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::TrackletCalculatorBase::trackletprojlayers_
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
Definition: TrackletCalculatorBase.h:142
trklet::Stub::isBarrel
bool isBarrel() const
Definition: Stub.h:60
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
trklet::Stub
Definition: Stub.h:16
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
trklet::ProcessBase::initLayerDisksandISeed
void initLayerDisksandISeed(unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
Definition: ProcessBase.cc:75
trklet::TrackletCalculatorBase::diskSeeding
bool diskSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
Definition: TrackletCalculatorBase.cc:753
trklet::Stub::isDisk
bool isDisk() const
Definition: Stub.h:61
trklet::TrackletCalculatorBase::layerdisk1_
unsigned int layerdisk1_
Definition: TrackletCalculatorBase.h:129
trklet::TrackletCalculatorBase::layerdisk2_
unsigned int layerdisk2_
Definition: TrackletCalculatorBase.h:130
trklet::VarBase::K
double K() const
Definition: imath.h:246
trklet::Globals::ITC_L1L2
IMATH_TrackletCalculator * ITC_L1L2()
Definition: Globals.h:52
trklet::TrackletCalculatorBase::overlapSeeding
bool overlapSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
Definition: TrackletCalculatorBase.cc:1108
trklet::IMATH_TrackletCalculator::phi0_final
VarAdjustK phi0_final
Definition: IMATH_TrackletCalculator.h:218
trklet::TrackletCalculatorBase::trackletprojdisks_
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
Definition: TrackletCalculatorBase.h:143
trklet::TrackletCalculatorBase::TrackletCalculatorBase
TrackletCalculatorBase(std::string name, Settings const &settings, Globals *global, unsigned int iSector)
Definition: TrackletCalculatorBase.cc:17
trklet::IMATH_TrackletCalculator::rinv_final
VarAdjustK rinv_final
Definition: IMATH_TrackletCalculator.h:216
trklet::Settings::writeMonitorData
bool writeMonitorData(std::string module) const
Definition: Settings.h:86
trklet::TrackletCalculatorBase::TCIndex_
int TCIndex_
Definition: TrackletCalculatorBase.h:132
trklet::TrackletParametersMemory::nTracklets
unsigned int nTracklets() const
Definition: TrackletParametersMemory.h:25
trklet::Settings::usephicritapprox
bool usephicritapprox() const
Definition: Settings.h:194
trklet::Globals::ofstream
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
trklet::Stub::l1tstub
L1TStub * l1tstub()
Definition: Stub.h:69
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
mps_setup.memory
memory
Definition: mps_setup.py:156
Exception
Definition: hltDiff.cc:246
trklet::ProcessBase::getName
std::string const & getName() const
Definition: ProcessBase.h:22
trklet::ProcessBase::name_
std::string name_
Definition: ProcessBase.h:38
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::ProcessBase::iSector_
unsigned int iSector_
Definition: ProcessBase.h:39
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:146
trklet::Settings::rcrit
double rcrit() const
Definition: Settings.h:236
trklet::Settings::maxStep
unsigned int maxStep(std::string module) const
Definition: Settings.h:93
trklet::TrackletCalculator::innerallstubs_
std::vector< AllStubsMemory * > innerallstubs_
Definition: TrackletCalculator.h:33
trklet::ProcessBase::phimin_
double phimin_
Definition: ProcessBase.h:41
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trklet::ProcessBase::globals_
Globals * globals_
Definition: ProcessBase.h:45
edm::Log
Definition: MessageLogger.h:70
trklet::TrackletCalculator::stubpairs_
std::vector< StubPairsMemory * > stubpairs_
Definition: TrackletCalculator.h:35
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443