CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
trklet::TrackletCalculatorDisplaced Class Reference

#include <TrackletCalculatorDisplaced.h>

Inheritance diagram for trklet::TrackletCalculatorDisplaced:
trklet::ProcessBase trklet::TrackletProcessorDisplaced

Public Member Functions

void addDiskProj (Tracklet *tracklet, int disk)
 
void addInput (MemoryBase *memory, std::string input) override
 
bool addLayerProj (Tracklet *tracklet, int layer)
 
void addOutput (MemoryBase *memory, std::string output) override
 
void addOutputProjection (TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
 
void addProjection (int layer, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
 
void addProjectionDisk (int disk, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
 
void approxproj (double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double rmean, double &phiproj, double &phiprojder, double &zproj, double &zprojder)
 
void approxprojdisk (double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double zmean, double &phiproj, double &phiprojder, double &rproj, double &rprojder)
 
void approxtracklet (double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, bool take3, unsigned ndisks, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[4], double zproj[4], double phider[4], double zder[4], double phiprojdisk[5], double rprojdisk[5], double phiderdisk[5], double rderdisk[5])
 
bool DDLSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
void exactproj (double rproj, double rinv, double phi0, double d0, double t, double z0, double r0, double &phiproj, double &zproj, double &phider, double &zder)
 
void exactprojdisk (double zproj, double rinv, double, double, double t, double z0, double x0, double y0, double &phiproj, double &rproj, double &phider, double &rder)
 
void exacttracklet (double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, int take3, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiderdisk[N_DISK], double rderdisk[N_DISK])
 
void execute (unsigned int iSector, double phimin, double phimax)
 
bool LLDSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
bool LLLSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
 TrackletCalculatorDisplaced (std::string name, Settings const &settings, Globals *global)
 
 ~TrackletCalculatorDisplaced () override=default
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (const std::string &name)
 
std::string const & getName () const
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
unsigned int initLayerDisk (unsigned int pos)
 
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)
 
virtual ~ProcessBase ()=default
 

Protected Attributes

int disk_
 
int dproj_ [N_DISK - 2]
 
std::vector< AllStubsMemory * > innerallstubs_
 
unsigned int iSector_
 
unsigned int iSeed_
 
int layer_
 
int lproj_ [N_LAYER - 2]
 
std::vector< AllStubsMemory * > middleallstubs_
 
std::vector< AllStubsMemory * > outerallstubs_
 
double phimax_
 
double phimin_
 
double rproj_ [N_LAYER - 2]
 
double rzmeanInv_ [N_DISK - 2]
 
std::vector< StubTripletsMemory * > stubtriplets_
 
int TCIndex_
 
std::vector< double > toR_
 
std::vector< double > toZ_
 
TrackletParametersMemorytrackletpars_
 
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
 
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
 
double zproj_ [N_DISK - 2]
 
- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
std::string name_
 
Settings const & settings_
 

Detailed Description

Definition at line 20 of file TrackletCalculatorDisplaced.h.

Constructor & Destructor Documentation

◆ TrackletCalculatorDisplaced()

TrackletCalculatorDisplaced::TrackletCalculatorDisplaced ( std::string  name,
Settings const &  settings,
Globals global 
)

Definition at line 16 of file TrackletCalculatorDisplaced.cc.

References cms::cuda::assert(), disk_, dproj_, mps_fire::i, iSeed_, layer_, lproj_, trklet::N_DISK, trklet::N_LAYER, trklet::Settings::nallstubs(), Skims_PA_cff::name, trklet::Settings::rmean(), rproj_, rzmeanInv_, trklet::ProcessBase::settings_, TCIndex_, createJobs::tmp, toR_, toZ_, trackletprojdisks_, trackletprojlayers_, trklet::Settings::zmean(), and zproj_.

17  : ProcessBase(name, settings, global) {
18  for (unsigned int ilayer = 0; ilayer < N_LAYER; ilayer++) {
19  vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(ilayer), nullptr);
20  trackletprojlayers_.push_back(tmp);
21  }
22 
23  for (unsigned int idisk = 0; idisk < N_DISK; idisk++) {
24  vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(idisk + N_LAYER), nullptr);
25  trackletprojdisks_.push_back(tmp);
26  }
27 
28  layer_ = 0;
29  disk_ = 0;
30 
31  string name1 = name.substr(1); //this is to correct for "TCD" having one more letter then "TC"
32  if (name1[3] == 'L')
33  layer_ = name1[4] - '0';
34  if (name1[3] == 'D')
35  disk_ = name1[4] - '0';
36 
37  // set TC index
38  iSeed_ = 0;
39 
40  int iTC = name1[9] - 'A';
41 
42  if (name1.substr(3, 6) == "L3L4L2")
43  iSeed_ = 8;
44  else if (name1.substr(3, 6) == "L5L6L4")
45  iSeed_ = 9;
46  else if (name1.substr(3, 6) == "L2L3D1")
47  iSeed_ = 10;
48  else if (name1.substr(3, 6) == "D1D2L2")
49  iSeed_ = 11;
50 
51  assert(iSeed_ != 0);
52 
53  TCIndex_ = (iSeed_ << 4) + iTC;
54  assert(TCIndex_ >= 128 && TCIndex_ < 191);
55 
56  assert((layer_ != 0) || (disk_ != 0));
57 
58  toR_.clear();
59  toZ_.clear();
60 
61  if (iSeed_ == 8 || iSeed_ == 9) {
62  if (layer_ == 3) {
63  rzmeanInv_[0] = 1.0 / settings_.rmean(2 - 1);
64  rzmeanInv_[1] = 1.0 / settings_.rmean(3 - 1);
65  rzmeanInv_[2] = 1.0 / settings_.rmean(4 - 1);
66 
67  rproj_[0] = settings_.rmean(0);
68  rproj_[1] = settings_.rmean(4);
69  rproj_[2] = settings_.rmean(5);
70  lproj_[0] = 1;
71  lproj_[1] = 5;
72  lproj_[2] = 6;
73 
74  dproj_[0] = 1;
75  dproj_[1] = 2;
76  dproj_[2] = 0;
77  toZ_.push_back(settings_.zmean(0));
78  toZ_.push_back(settings_.zmean(1));
79  }
80  if (layer_ == 5) {
81  rzmeanInv_[0] = 1.0 / settings_.rmean(4 - 1);
82  rzmeanInv_[1] = 1.0 / settings_.rmean(5 - 1);
83  rzmeanInv_[2] = 1.0 / settings_.rmean(6 - 1);
84 
85  rproj_[0] = settings_.rmean(0);
86  rproj_[1] = settings_.rmean(1);
87  rproj_[2] = settings_.rmean(2);
88  lproj_[0] = 1;
89  lproj_[1] = 2;
90  lproj_[2] = 3;
91 
92  dproj_[0] = 0;
93  dproj_[1] = 0;
94  dproj_[2] = 0;
95  }
96  for (unsigned int i = 0; i < N_LAYER - 3; ++i)
97  toR_.push_back(rproj_[i]);
98  }
99 
100  if (iSeed_ == 10 || iSeed_ == 11) {
101  if (layer_ == 2) {
102  rzmeanInv_[0] = 1.0 / settings_.rmean(2 - 1);
103  rzmeanInv_[1] = 1.0 / settings_.rmean(3 - 1);
104  rzmeanInv_[2] = 1.0 / settings_.zmean(1 - 1);
105 
106  rproj_[0] = settings_.rmean(0);
107  lproj_[0] = 1;
108  lproj_[1] = -1;
109  lproj_[2] = -1;
110 
111  zproj_[0] = settings_.zmean(1);
112  zproj_[1] = settings_.zmean(2);
113  zproj_[2] = settings_.zmean(3);
114  dproj_[0] = 2;
115  dproj_[1] = 3;
116  dproj_[2] = 4;
117  }
118  if (disk_ == 1) {
119  rzmeanInv_[0] = 1.0 / settings_.rmean(2 - 1);
120  rzmeanInv_[1] = 1.0 / settings_.zmean(1 - 1);
121  rzmeanInv_[2] = 1.0 / settings_.zmean(2 - 1);
122 
123  rproj_[0] = settings_.rmean(0);
124  lproj_[0] = 1;
125  lproj_[1] = -1;
126  lproj_[2] = -1;
127 
128  zproj_[0] = settings_.zmean(2);
129  zproj_[1] = settings_.zmean(3);
130  zproj_[2] = settings_.zmean(4);
131  dproj_[0] = 3;
132  dproj_[1] = 4;
133  dproj_[2] = 5;
134  }
135  toR_.push_back(settings_.rmean(0));
136  for (unsigned int i = 0; i < N_DISK - 2; ++i)
137  toZ_.push_back(zproj_[i]);
138  }
139 }
constexpr int N_DISK
Definition: Settings.h:22
Settings const & settings_
Definition: ProcessBase.h:40
assert(be >=bs)
ProcessBase(std::string name, Settings const &settings, Globals *global)
Definition: ProcessBase.cc:14
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
double rmean(unsigned int iLayer) const
Definition: Settings.h:164
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
double zmean(unsigned int iDisk) const
Definition: Settings.h:167
tmp
align.sh
Definition: createJobs.py:716
constexpr int N_LAYER
Definition: Settings.h:21

◆ ~TrackletCalculatorDisplaced()

trklet::TrackletCalculatorDisplaced::~TrackletCalculatorDisplaced ( )
overridedefault

Member Function Documentation

◆ addDiskProj()

void TrackletCalculatorDisplaced::addDiskProj ( Tracklet tracklet,
int  disk 
)

Definition at line 301 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), addProjectionDisk(), trklet::Projection::fpgaphiproj(), trklet::Projection::fpgarzproj(), LEDCalibrationChannels::iphi, trklet::Settings::krprojshiftdisk(), trklet::N_LAYER, trklet::Settings::nallstubs(), trklet::FPGAWord::nbits(), trklet::Tracklet::proj(), trklet::Settings::rmaxdisk(), trklet::Settings::rmindiskvm(), trklet::ProcessBase::settings_, trackletprojdisks_, and trklet::FPGAWord::value().

Referenced by DDLSeeding(), LLDSeeding(), and LLLSeeding().

301  {
302  disk = std::abs(disk);
303  FPGAWord fpgar = tracklet->proj(N_LAYER + disk - 1).fpgarzproj();
304 
305  if (fpgar.value() * settings_.krprojshiftdisk() < settings_.rmindiskvm())
306  return;
307  if (fpgar.value() * settings_.krprojshiftdisk() > settings_.rmaxdisk())
308  return;
309 
310  FPGAWord fpgaphi = tracklet->proj(N_LAYER + disk - 1).fpgaphiproj();
311 
312  int iphivmRaw = fpgaphi.value() >> (fpgaphi.nbits() - 5);
313  int iphi = iphivmRaw / (32 / settings_.nallstubs(disk + N_LAYER - 1));
314 
315  addProjectionDisk(disk, iphi, trackletprojdisks_[disk - 1][iphi], tracklet);
316 }
Projection & proj(int layerdisk)
Definition: Tracklet.h:87
Settings const & settings_
Definition: ProcessBase.h:40
double rmindiskvm() const
Definition: Settings.h:327
const FPGAWord & fpgaphiproj() const
Definition: Projection.h:39
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int value() const
Definition: FPGAWord.h:24
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:107
double rmaxdisk() const
Definition: Settings.h:125
int nbits() const
Definition: FPGAWord.h:25
const FPGAWord & fpgarzproj() const
Definition: Projection.h:44
double krprojshiftdisk() const
Definition: Settings.h:413
void addProjectionDisk(int disk, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
constexpr int N_LAYER
Definition: Settings.h:21

◆ addInput()

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

Implements trklet::ProcessBase.

Reimplemented in trklet::TrackletProcessorDisplaced.

Definition at line 189 of file TrackletCalculatorDisplaced.cc.

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

189  {
190  if (settings_.writetrace()) {
191  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
192  << input;
193  }
194 
195  if (input == "thirdallstubin") {
196  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
197  assert(tmp != nullptr);
198  innerallstubs_.push_back(tmp);
199  return;
200  }
201  if (input == "firstallstubin") {
202  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
203  assert(tmp != nullptr);
204  middleallstubs_.push_back(tmp);
205  return;
206  }
207  if (input == "secondallstubin") {
208  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
209  assert(tmp != nullptr);
210  outerallstubs_.push_back(tmp);
211  return;
212  }
213  if (input.find("stubtriplet") == 0) {
214  auto* tmp = dynamic_cast<StubTripletsMemory*>(memory);
215  assert(tmp != nullptr);
216  stubtriplets_.push_back(tmp);
217  return;
218  }
219  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find input : " << input;
220 }
Log< level::Info, true > LogVerbatim
std::vector< AllStubsMemory * > middleallstubs_
std::vector< StubTripletsMemory * > stubtriplets_
std::string name_
Definition: ProcessBase.h:38
std::vector< AllStubsMemory * > innerallstubs_
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:183
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
std::vector< AllStubsMemory * > outerallstubs_
tmp
align.sh
Definition: createJobs.py:716

◆ addLayerProj()

bool TrackletCalculatorDisplaced::addLayerProj ( Tracklet tracklet,
int  layer 
)

Definition at line 318 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), addProjection(), cms::cuda::assert(), trklet::FPGAWord::atExtreme(), trklet::Projection::fpgaphiproj(), trklet::Projection::fpgarzproj(), LEDCalibrationChannels::iphi, trklet::Settings::kz(), trklet::Settings::nallstubs(), trklet::FPGAWord::nbits(), trklet::Tracklet::proj(), trklet::ProcessBase::settings_, trackletprojlayers_, trklet::FPGAWord::value(), and trklet::Settings::zlength().

Referenced by DDLSeeding(), LLDSeeding(), and LLLSeeding().

318  {
319  assert(layer > 0);
320 
321  FPGAWord fpgaz = tracklet->proj(layer - 1).fpgarzproj();
322  FPGAWord fpgaphi = tracklet->proj(layer - 1).fpgaphiproj();
323 
324  if (fpgaz.atExtreme())
325  return false;
326 
327  if (std::abs(fpgaz.value() * settings_.kz()) > settings_.zlength())
328  return false;
329 
330  int iphivmRaw = fpgaphi.value() >> (fpgaphi.nbits() - 5);
331  int iphi = iphivmRaw / (32 / settings_.nallstubs(layer - 1));
332 
334 
335  return true;
336 }
double kz() const
Definition: Settings.h:314
double zlength() const
Definition: Settings.h:124
Projection & proj(int layerdisk)
Definition: Tracklet.h:87
Settings const & settings_
Definition: ProcessBase.h:40
void addProjection(int layer, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
assert(be >=bs)
const FPGAWord & fpgaphiproj() const
Definition: Projection.h:39
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int value() const
Definition: FPGAWord.h:24
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:107
int nbits() const
Definition: FPGAWord.h:25
const FPGAWord & fpgarzproj() const
Definition: Projection.h:44
bool atExtreme() const
Definition: FPGAWord.cc:79

◆ addOutput()

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

Implements trklet::ProcessBase.

Reimplemented in trklet::TrackletProcessorDisplaced.

Definition at line 146 of file TrackletCalculatorDisplaced.cc.

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, trackletpars_, trackletprojdisks_, trackletprojlayers_, and trklet::Settings::writetrace().

146  {
147  if (settings_.writetrace()) {
148  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
149  << output;
150  }
151 
152  if (output == "trackpar") {
153  auto* tmp = dynamic_cast<TrackletParametersMemory*>(memory);
154  assert(tmp != nullptr);
155  trackletpars_ = tmp;
156  return;
157  }
158 
159  if (output.substr(0, 7) == "projout") {
160  //output is on the form 'projoutL2PHIC' or 'projoutD3PHIB'
161  auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
162  assert(tmp != nullptr);
163 
164  unsigned int layerdisk = output[8] - '1'; //layer or disk counting from 0
165  unsigned int phiregion = output[12] - 'A'; //phiregion counting from 0
166 
167  if (output[7] == 'L') {
168  assert(layerdisk < N_LAYER);
169  assert(phiregion < trackletprojlayers_[layerdisk].size());
170  //check that phiregion not already initialized
171  assert(trackletprojlayers_[layerdisk][phiregion] == nullptr);
172  trackletprojlayers_[layerdisk][phiregion] = tmp;
173  return;
174  }
175 
176  if (output[7] == 'D') {
177  assert(layerdisk < N_DISK);
178  assert(phiregion < trackletprojdisks_[layerdisk].size());
179  //check that phiregion not already initialized
180  assert(trackletprojdisks_[layerdisk][phiregion] == nullptr);
181  trackletprojdisks_[layerdisk][phiregion] = tmp;
182  return;
183  }
184  }
185 
186  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
187 }
size
Write out results.
Log< level::Info, true > LogVerbatim
constexpr int N_DISK
Definition: Settings.h:22
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:183
assert(be >=bs)
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
Definition: output.py:1
tmp
align.sh
Definition: createJobs.py:716
constexpr int N_LAYER
Definition: Settings.h:21

◆ addOutputProjection()

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

Definition at line 141 of file TrackletCalculatorDisplaced.cc.

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

141  {
142  outputProj = dynamic_cast<TrackletProjectionsMemory*>(memory);
143  assert(outputProj != nullptr);
144 }
assert(be >=bs)

◆ addProjection()

void TrackletCalculatorDisplaced::addProjection ( int  layer,
int  iphi,
TrackletProjectionsMemory trackletprojs,
Tracklet tracklet 
)

Definition at line 338 of file TrackletCalculatorDisplaced.cc.

References trklet::TrackletProjectionsMemory::addProj(), cms::cuda::assert(), trklet::ProcessBase::getName(), LEDCalibrationChannels::iphi, trklet::ProcessBase::settings_, and trklet::Settings::warnNoMem().

Referenced by addLayerProj().

341  {
342  if (trackletprojs == nullptr) {
343  if (settings_.warnNoMem()) {
344  edm::LogVerbatim("Tracklet") << "No projection memory exists in " << getName() << " for layer = " << layer
345  << " iphi = " << iphi + 1;
346  }
347  return;
348  }
349  assert(trackletprojs != nullptr);
350  trackletprojs->addProj(tracklet);
351 }
Log< level::Info, true > LogVerbatim
Settings const & settings_
Definition: ProcessBase.h:40
assert(be >=bs)
bool warnNoMem() const
Definition: Settings.h:185
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::string const & getName() const
Definition: ProcessBase.h:22

◆ addProjectionDisk()

void TrackletCalculatorDisplaced::addProjectionDisk ( int  disk,
int  iphi,
TrackletProjectionsMemory trackletprojs,
Tracklet tracklet 
)

Definition at line 353 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), trklet::TrackletProjectionsMemory::addProj(), cms::cuda::assert(), trklet::Settings::debugTracklet(), trklet::MemoryBase::getName(), trklet::ProcessBase::getName(), LEDCalibrationChannels::iphi, layer_, trklet::ProcessBase::settings_, and trklet::Settings::warnNoMem().

Referenced by addDiskProj().

356  {
357  if (trackletprojs == nullptr) {
358  if (layer_ == 3 && abs(disk) == 3)
359  return; //L3L4 projections to D3 are not used.
360  if (settings_.warnNoMem()) {
361  edm::LogVerbatim("Tracklet") << "No projection memory exists in " << getName() << " for disk = " << abs(disk)
362  << " iphi = " << iphi + 1;
363  }
364  return;
365  }
366  assert(trackletprojs != nullptr);
367  if (settings_.debugTracklet())
368  edm::LogVerbatim("Tracklet") << getName() << " adding projection to " << trackletprojs->getName();
369  trackletprojs->addProj(tracklet);
370 }
Log< level::Info, true > LogVerbatim
Settings const & settings_
Definition: ProcessBase.h:40
assert(be >=bs)
bool warnNoMem() const
Definition: Settings.h:185
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::string const & getName() const
Definition: MemoryBase.h:19
bool debugTracklet() const
Definition: Settings.h:182
std::string const & getName() const
Definition: ProcessBase.h:22

◆ approxproj()

void TrackletCalculatorDisplaced::approxproj ( double  halfRinv,
double  phi0,
double  d0,
double  t,
double  z0,
double  halfRinv_0,
double  d0_0,
double  rmean,
double &  phiproj,
double &  phiprojder,
double &  zproj,
double &  zprojder 
)

Definition at line 1760 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), d0, trklet::Settings::debugTracklet(), trklet::Settings::disp_z0cut(), angle0to2pi::make0To2pi(), trklet::Settings::maxd0(), funct::pow(), trklet::Settings::rinvcut(), trklet::ProcessBase::settings_, trklet::sixth, and submitPVValidationJobs::t.

Referenced by approxtracklet().

1771  {
1772  if (std::abs(2.0 * halfRinv) > settings_.rinvcut() || std::abs(z0) > settings_.disp_z0cut() ||
1773  std::abs(d0) > settings_.maxd0()) {
1774  phiproj = 0.0;
1775  return;
1776  }
1777  double rmeanInv = 1.0 / rmean;
1778 
1779  phiproj = phi0 + rmean * (-halfRinv + 2.0 * d0_0 * halfRinv_0 * halfRinv_0) +
1780  rmeanInv * (-d0 + halfRinv_0 * d0_0 * d0_0) + sixth * pow(-rmean * halfRinv_0 - rmeanInv * d0_0, 3);
1781  phiprojder = -halfRinv + d0 * rmeanInv * rmeanInv; //removed all high terms
1782 
1783  zproj = z0 + t * rmean - 0.5 * rmeanInv * t * d0_0 * d0_0 - t * rmean * halfRinv * d0 +
1784  sixth * pow(rmean, 3) * t * halfRinv_0 * halfRinv_0;
1785  zprojder = t; // removed all high terms
1786 
1787  phiproj = angle0to2pi::make0To2pi(phiproj);
1788 
1789  if (settings_.debugTracklet())
1790  edm::LogVerbatim("Tracklet") << "approx proj layer at " << rmean << " : " << phiproj << " " << zproj << endl;
1791 }
double disp_z0cut() const
Definition: Settings.h:338
double maxd0() const
Definition: Settings.h:320
Settings const & settings_
Definition: ProcessBase.h:40
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double rinvcut() const
Definition: Settings.h:210
bool debugTracklet() const
Definition: Settings.h:182
static constexpr float d0
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
constexpr double sixth
Definition: Settings.h:41
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ approxprojdisk()

void TrackletCalculatorDisplaced::approxprojdisk ( double  halfRinv,
double  phi0,
double  d0,
double  t,
double  z0,
double  halfRinv_0,
double  d0_0,
double  zmean,
double &  phiproj,
double &  phiprojder,
double &  rproj,
double &  rprojder 
)

Definition at line 1793 of file TrackletCalculatorDisplaced.cc.

References A, funct::abs(), B, correctionTermsCaloMet_cff::C, d0, trklet::Settings::debugTracklet(), trklet::Settings::disp_z0cut(), geometryDiff::epsilon, angle0to2pi::make0To2pi(), trklet::Settings::maxd0(), funct::pow(), trklet::Settings::rinvcut(), trklet::ProcessBase::settings_, trklet::sixth, and submitPVValidationJobs::t.

Referenced by approxtracklet().

1804  {
1805  if (std::abs(2.0 * halfRinv) > settings_.rinvcut() || std::abs(z0) > settings_.disp_z0cut() ||
1806  std::abs(d0) > settings_.maxd0()) {
1807  phiproj = 0.0;
1808  return;
1809  }
1810 
1811  if (t < 0)
1812  zmean = -zmean;
1813 
1814  double zmeanInv = 1.0 / zmean, rstar = (zmean - z0) / t,
1815  epsilon = 0.5 * zmeanInv * zmeanInv * d0_0 * d0_0 * t * t + halfRinv * d0 -
1816  sixth * rstar * rstar * halfRinv_0 * halfRinv_0;
1817 
1818  rproj = rstar * (1 + epsilon);
1819  rprojder = 1 / t;
1820 
1821  double A = rproj * halfRinv;
1822  double B = -d0 * t * zmeanInv * (1 + z0 * zmeanInv) * (1 - epsilon);
1823  double C = -d0 * halfRinv;
1824  double A_0 = rproj * halfRinv_0;
1825  double B_0 = -d0_0 * t * zmeanInv * (1 + z0 * zmeanInv) * (1 - epsilon);
1826  // double C_0 = -d0_0 * halfRinv_0;
1827 
1828  phiproj = phi0 - A + B * (1 + C - 2 * A_0 * A_0) + sixth * pow(-A_0 + B_0, 3);
1829  phiprojder = -halfRinv / t + d0 * t * zmeanInv * zmeanInv;
1830 
1831  phiproj = angle0to2pi::make0To2pi(phiproj);
1832 
1833  if (settings_.debugTracklet())
1834  edm::LogVerbatim("Tracklet") << "approx proj disk at" << zmean << " : " << phiproj << " " << rproj << endl;
1835 }
Definition: APVGainStruct.h:7
double disp_z0cut() const
Definition: Settings.h:338
double maxd0() const
Definition: Settings.h:320
Settings const & settings_
Definition: ProcessBase.h:40
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double rinvcut() const
Definition: Settings.h:210
bool debugTracklet() const
Definition: Settings.h:182
static constexpr float d0
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
constexpr double sixth
Definition: Settings.h:41
Definition: APVGainStruct.h:7
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ approxtracklet()

void TrackletCalculatorDisplaced::approxtracklet ( double  r1,
double  z1,
double  phi1,
double  r2,
double  z2,
double  phi2,
double  r3,
double  z3,
double  phi3,
bool  take3,
unsigned  ndisks,
double &  rinv,
double &  phi0,
double &  d0,
double &  t,
double &  z0,
double  phiproj[4],
double  zproj[4],
double  phider[4],
double  zder[4],
double  phiprojdisk[5],
double  rprojdisk[5],
double  phiderdisk[5],
double  rderdisk[5] 
)

Definition at line 1837 of file TrackletCalculatorDisplaced.cc.

References a, funct::abs(), approxproj(), approxprojdisk(), b, HltBtagPostValidation_cff::c, alignmentValidation::c1, d0, trklet::Settings::debugTracklet(), trklet::Settings::disp_z0cut(), mps_fire::i, angle0to2pi::make0To2pi(), trklet::Settings::maxd0(), phimin_, funct::pow(), diffTwoXMLs::r2, trklet::rinv(), trklet::Settings::rinvcut(), rzmeanInv_, trklet::ProcessBase::settings_, trklet::sixth, submitPVValidationJobs::t, toR_, toZ_, and testProducerWithPsetDescEmpty_cfi::z2.

Referenced by DDLSeeding(), LLDSeeding(), and LLLSeeding().

1860  {
1861  double a = 1.0 / ((r1 - r2) * (r1 - r3));
1862  double b = 1.0 / ((r1 - r2) * (r2 - r3));
1863  double c = 1.0 / ((r1 - r3) * (r2 - r3));
1864 
1865  // first iteration in r-phi plane
1866  double halfRinv_0 = -phi1 * r1 * a + phi2 * r2 * b - phi3 * r3 * c;
1867  double d0_0 = r1 * r2 * r3 * (-phi1 * a + phi2 * b - phi3 * c);
1868 
1869  // corrections to phi1, phi2, and phi3
1870  double r = r2, z = z2;
1871  if (take3)
1872  r = r3, z = z3;
1873 
1874  double d0OverR1 = d0_0 * rzmeanInv_[0] * (ndisks > 2 ? std::abs((z - z1) / (r - r1)) : 1.0);
1875  double d0OverR2 = d0_0 * rzmeanInv_[1] * (ndisks > 1 ? std::abs((z - z1) / (r - r1)) : 1.0);
1876  double d0OverR3 = d0_0 * rzmeanInv_[2] * (ndisks > 0 ? std::abs((z - z1) / (r - r1)) : 1.0);
1877 
1878  double d0OverR = d0OverR2;
1879  if (take3)
1880  d0OverR = d0OverR3;
1881 
1882  double c1 = d0_0 * halfRinv_0 * d0OverR1 + 2.0 * d0_0 * halfRinv_0 * r1 * halfRinv_0 +
1883  sixth * pow(-r1 * halfRinv_0 - d0OverR1, 3);
1884  double c2 = d0_0 * halfRinv_0 * d0OverR2 + 2.0 * d0_0 * halfRinv_0 * r2 * halfRinv_0 +
1885  sixth * pow(-r2 * halfRinv_0 - d0OverR2, 3);
1886  double c3 = d0_0 * halfRinv_0 * d0OverR3 + 2.0 * d0_0 * halfRinv_0 * r3 * halfRinv_0 +
1887  sixth * pow(-r3 * halfRinv_0 - d0OverR3, 3);
1888 
1889  double phi1c = phi1 - c1;
1890  double phi2c = phi2 - c2;
1891  double phi3c = phi3 - c3;
1892 
1893  // second iteration in r-phi plane
1894  double halfRinv = -phi1c * r1 * a + phi2c * r2 * b - phi3c * r3 * c;
1895  phi0 = -phi1c * r1 * (r2 + r3) * a + phi2c * r2 * (r1 + r3) * b - phi3c * r3 * (r1 + r2) * c;
1896  d0 = r1 * r2 * r3 * (-phi1c * a + phi2c * b - phi3c * c);
1897 
1898  t = ((z - z1) / (r - r1)) *
1899  (1. + d0 * halfRinv - 0.5 * d0OverR1 * d0OverR - sixth * (r1 * r1 + r2 * r2 + r1 * r2) * halfRinv_0 * halfRinv_0);
1900  z0 = z1 - t * r1 * (1.0 - d0_0 * halfRinv_0 - 0.5 * d0OverR1 * d0OverR1 + sixth * r1 * r1 * halfRinv_0 * halfRinv_0);
1901 
1902  rinv = 2.0 * halfRinv;
1903  phi0 += -phimin_;
1904 
1905  phi0 = angle0to2pi::make0To2pi(phi0);
1906 
1907  for (unsigned int i = 0; i < toR_.size(); i++) {
1908  approxproj(halfRinv,
1909  phi0,
1910  d0,
1911  t,
1912  z0,
1913  halfRinv_0,
1914  d0_0, // added _0 version for high term calculations
1915  toR_.at(i),
1916  phiproj[i],
1917  phider[i],
1918  zproj[i],
1919  zder[i]);
1920  }
1921 
1922  for (unsigned int i = 0; i < toZ_.size(); i++) {
1923  approxprojdisk(halfRinv,
1924  phi0,
1925  d0,
1926  t,
1927  z0,
1928  halfRinv_0,
1929  d0_0, // added _0 version for high term calculations
1930  toZ_.at(i),
1931  phiprojdisk[i],
1932  phiderdisk[i],
1933  rprojdisk[i],
1934  rderdisk[i]);
1935  }
1936 
1938  std::abs(d0) > settings_.maxd0()) {
1939  phi0 = 0.0;
1940  return;
1941  }
1942 
1943  if (settings_.debugTracklet())
1944  edm::LogVerbatim("Tracklet") << "TCD approx tracklet: " << rinv << " " << phi0 << " " << t << " " << z0 << " " << d0
1945  << endl;
1946 }
double disp_z0cut() const
Definition: Settings.h:338
double maxd0() const
Definition: Settings.h:320
Settings const & settings_
Definition: ProcessBase.h:40
void approxprojdisk(double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double zmean, double &phiproj, double &phiprojder, double &rproj, double &rprojder)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double rinvcut() const
Definition: Settings.h:210
bool debugTracklet() const
Definition: Settings.h:182
static constexpr float d0
void approxproj(double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double rmean, double &phiproj, double &phiprojder, double &zproj, double &zprojder)
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49
double b
Definition: hdecay.h:118
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
constexpr double sixth
Definition: Settings.h:41
double a
Definition: hdecay.h:119
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ DDLSeeding()

bool TrackletCalculatorDisplaced::DDLSeeding ( const Stub innerFPGAStub,
const L1TStub innerStub,
const Stub middleFPGAStub,
const L1TStub middleStub,
const Stub outerFPGAStub,
const L1TStub outerStub 
)

Definition at line 794 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), addDiskProj(), addLayerProj(), trklet::TrackletParametersMemory::addTracklet(), approxtracklet(), d0, trklet::Settings::debugTracklet(), trklet::Stub::disk(), trklet::Settings::disp_z0cut(), dproj_, exacttracklet(), groupFilesInBlocks::fout, trklet::Tracklet::getISeed(), trklet::ProcessBase::getName(), trklet::ProcessBase::globals_, mps_fire::i, trklet::Projection::init(), trklet::Stub::isBarrel(), iSector_, iSeed_, trklet::Globals::ITC_L1L2(), dqmiolumiharvest::j, trklet::VarBase::K(), trklet::Settings::kd0(), runTheMatrix::keep, trklet::Settings::kphi1(), trklet::Settings::kr(), trklet::Settings::kz(), trklet::Stub::layer(), layer_, lproj_, trklet::Settings::maxd0(), trklet::N_DISK, trklet::N_LAYER, trklet::ProcessBase::name_, trklet::Settings::nbitsphiprojderL123(), trklet::Settings::nbitsphiprojderL456(), trklet::Settings::nphibitsstub(), trklet::TrackletParametersMemory::nTracklets(), trklet::Settings::nzbitsstub(), trklet::Globals::ofstream(), trklet::L1TStub::phi(), trklet::IMATH_TrackletCalculator::phi0_final, trklet::Settings::phi0_shift(), trklet::Stub::phiapprox(), trklet::Settings::phicritmaxmc(), trklet::Settings::phicritminmc(), phimax_, phimin_, funct::pow(), trklet::Settings::PS_rD_shift(), trklet::Settings::PS_rderD_shift(), trklet::Settings::PS_zderL_shift(), trklet::Settings::PS_zL_shift(), trklet::L1TStub::r(), diffTwoXMLs::r2, trklet::Stub::rapprox(), trklet::Settings::rcrit(), trklet::rinv(), trklet::Settings::rinv_shift(), trklet::Settings::rinvcut(), trklet::Settings::rmaxdisk(), trklet::Settings::rmindisk(), rproj_, trklet::Settings::rPS2S(), trklet::Tracklet::setTCIndex(), trklet::ProcessBase::settings_, trklet::Tracklet::setTrackletIndex(), trklet::Settings::SS_phiD_shift(), trklet::Settings::SS_phiderD_shift(), trklet::Settings::SS_phiderL_shift(), trklet::Settings::SS_phiL_shift(), summarizeEdmComparisonLogfiles::success, submitPVValidationJobs::t, trklet::Settings::t_shift(), TCIndex_, toR_, toZ_, trackletpars_, trklet::Settings::useapprox(), trklet::Settings::usephicritapprox(), trklet::Tracklet::validProj(), trklet::FPGAWord::value(), trklet::Settings::writeMonitorData(), trklet::L1TStub::z(), trklet::Settings::z0_shift(), testProducerWithPsetDescEmpty_cfi::z2, and trklet::Stub::zapprox().

Referenced by execute(), and trklet::TrackletProcessorDisplaced::execute().

799  {
800  if (settings_.debugTracklet())
801  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName() << " " << layer_
802  << " trying stub triplet in (L2 D1 D2): " << innerFPGAStub->layer().value() << " "
803  << middleFPGAStub->disk().value() << " " << outerFPGAStub->disk().value();
804 
805  int take3 = 1; //D1D2L2
806  unsigned ndisks = 2;
807 
808  double r1 = innerStub->r();
809  double z1 = innerStub->z();
810  double phi1 = innerStub->phi();
811 
812  double r2 = middleStub->r();
813  double z2 = middleStub->z();
814  double phi2 = middleStub->phi();
815 
816  double r3 = outerStub->r();
817  double z3 = outerStub->z();
818  double phi3 = outerStub->phi();
819 
820  double rinv, phi0, d0, t, z0;
821 
822  double phiproj[N_LAYER - 2], zproj[N_LAYER - 2], phider[N_LAYER - 2], zder[N_LAYER - 2];
823  double phiprojdisk[N_DISK], rprojdisk[N_DISK], phiderdisk[N_DISK], rderdisk[N_DISK];
824 
826  z1,
827  phi1,
828  r2,
829  z2,
830  phi2,
831  r3,
832  z3,
833  phi3,
834  take3,
835  rinv,
836  phi0,
837  d0,
838  t,
839  z0,
840  phiproj,
841  zproj,
842  phiprojdisk,
843  rprojdisk,
844  phider,
845  zder,
846  phiderdisk,
847  rderdisk);
848 
849  if (settings_.debugTracklet())
850  edm::LogVerbatim("Tracklet") << __LINE__ << ":" << __FILE__ << " DLL Exact values " << innerFPGAStub->isBarrel()
851  << middleFPGAStub->isBarrel() << outerFPGAStub->isBarrel() << " " << phi1 << ", " << z1
852  << ", " << r1 << ", " << phi2 << ", " << z2 << ", " << r2 << ", " << phi3 << ", " << z3
853  << ", " << r3 << endl;
854 
855  if (settings_.useapprox()) {
856  phi1 = innerFPGAStub->phiapprox(phimin_, phimax_);
857  z1 = innerFPGAStub->zapprox();
858  r1 = innerFPGAStub->rapprox();
859 
860  phi2 = middleFPGAStub->phiapprox(phimin_, phimax_);
861  z2 = middleFPGAStub->zapprox();
862  r2 = middleFPGAStub->rapprox();
863 
864  phi3 = outerFPGAStub->phiapprox(phimin_, phimax_);
865  z3 = outerFPGAStub->zapprox();
866  r3 = outerFPGAStub->rapprox();
867  }
868 
869  if (settings_.debugTracklet())
870  edm::LogVerbatim("Tracklet") << __LINE__ << ":" << __FILE__ << "DLL Approx values " << innerFPGAStub->isBarrel()
871  << middleFPGAStub->isBarrel() << outerFPGAStub->isBarrel() << " " << phi1 << ", " << z1
872  << ", " << r1 << ", " << phi2 << ", " << z2 << ", " << r2 << ", " << phi3 << ", " << z3
873  << ", " << r3 << endl;
874 
875  double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
876  double phiprojapprox[N_LAYER - 2], zprojapprox[N_LAYER - 2], phiderapprox[N_LAYER - 2], zderapprox[N_LAYER - 2];
877  double phiprojdiskapprox[N_DISK], rprojdiskapprox[N_DISK];
878  double phiderdiskapprox[N_DISK], rderdiskapprox[N_DISK];
879 
880  //TODO: implement the actual integer calculation
881  if (settings_.useapprox()) {
883  z1,
884  phi1,
885  r2,
886  z2,
887  phi2,
888  r3,
889  z3,
890  phi3,
891  take3,
892  ndisks,
893  rinvapprox,
894  phi0approx,
895  d0approx,
896  tapprox,
897  z0approx,
898  phiprojapprox,
899  zprojapprox,
900  phiderapprox,
901  zderapprox,
902  phiprojdiskapprox,
903  rprojdiskapprox,
904  phiderdiskapprox,
905  rderdiskapprox);
906  } else {
907  rinvapprox = rinv;
908  phi0approx = phi0;
909  d0approx = d0;
910  tapprox = t;
911  z0approx = z0;
912 
913  for (unsigned int i = 0; i < toR_.size(); ++i) {
914  phiprojapprox[i] = phiproj[i];
915  zprojapprox[i] = zproj[i];
916  phiderapprox[i] = phider[i];
917  zderapprox[i] = zder[i];
918  }
919 
920  for (unsigned int i = 0; i < toZ_.size(); ++i) {
921  phiprojdiskapprox[i] = phiprojdisk[i];
922  rprojdiskapprox[i] = rprojdisk[i];
923  phiderdiskapprox[i] = phiderdisk[i];
924  rderdiskapprox[i] = rderdisk[i];
925  }
926  }
927 
928  //store the approcximate results
929  if (settings_.debugTracklet()) {
930  edm::LogVerbatim("Tracklet") << "rinvapprox: " << rinvapprox << " rinv: " << rinv << endl;
931  edm::LogVerbatim("Tracklet") << "phi0approx: " << phi0approx << " phi0: " << phi0 << endl;
932  edm::LogVerbatim("Tracklet") << "d0approx: " << d0approx << " d0: " << d0 << endl;
933  edm::LogVerbatim("Tracklet") << "tapprox: " << tapprox << " t: " << t << endl;
934  edm::LogVerbatim("Tracklet") << "z0approx: " << z0approx << " z0: " << z0 << endl;
935  }
936 
937  for (unsigned int i = 0; i < toR_.size(); ++i) {
938  if (settings_.debugTracklet()) {
939  edm::LogVerbatim("Tracklet") << "phiprojapprox[" << i << "]: " << phiprojapprox[i] << " phiproj[" << i
940  << "]: " << phiproj[i] << endl;
941  edm::LogVerbatim("Tracklet") << "zprojapprox[" << i << "]: " << zprojapprox[i] << " zproj[" << i
942  << "]: " << zproj[i] << endl;
943  edm::LogVerbatim("Tracklet") << "phiderapprox[" << i << "]: " << phiderapprox[i] << " phider[" << i
944  << "]: " << phider[i] << endl;
945  edm::LogVerbatim("Tracklet") << "zderapprox[" << i << "]: " << zderapprox[i] << " zder[" << i << "]: " << zder[i]
946  << endl;
947  }
948  }
949 
950  for (unsigned int i = 0; i < toZ_.size(); ++i) {
951  if (settings_.debugTracklet()) {
952  edm::LogVerbatim("Tracklet") << "phiprojdiskapprox[" << i << "]: " << phiprojdiskapprox[i] << " phiprojdisk[" << i
953  << "]: " << phiprojdisk[i] << endl;
954  edm::LogVerbatim("Tracklet") << "rprojdiskapprox[" << i << "]: " << rprojdiskapprox[i] << " rprojdisk[" << i
955  << "]: " << rprojdisk[i] << endl;
956  edm::LogVerbatim("Tracklet") << "phiderdiskapprox[" << i << "]: " << phiderdiskapprox[i] << " phiderdisk[" << i
957  << "]: " << phiderdisk[i] << endl;
958  edm::LogVerbatim("Tracklet") << "rderdiskapprox[" << i << "]: " << rderdiskapprox[i] << " rderdisk[" << i
959  << "]: " << rderdisk[i] << endl;
960  }
961  }
962 
963  //now binary
964  double krinv = settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift()),
965  kphi0 = settings_.kphi1() * pow(2, settings_.phi0_shift()),
966  kt = settings_.kz() / settings_.kr() * pow(2, settings_.t_shift()),
967  kz0 = settings_.kz() * pow(2, settings_.z0_shift()),
968  kphiproj = settings_.kphi1() * pow(2, settings_.SS_phiL_shift()),
969  kphider = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift()),
970  kzproj = settings_.kz() * pow(2, settings_.PS_zL_shift()),
971  kzder = settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift()),
972  kphiprojdisk = settings_.kphi1() * pow(2, settings_.SS_phiD_shift()),
973  kphiderdisk = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift()),
974  krprojdisk = settings_.kr() * pow(2, settings_.PS_rD_shift()),
975  krderdisk = settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift());
976 
977  int irinv, iphi0, id0, it, iz0;
978  int iphiproj[N_LAYER - 2], izproj[N_LAYER - 2], iphider[N_LAYER - 2], izder[N_LAYER - 2];
979  int iphiprojdisk[N_DISK], irprojdisk[N_DISK], iphiderdisk[N_DISK], irderdisk[N_DISK];
980 
981  //store the binary results
982  irinv = rinvapprox / krinv;
983  iphi0 = phi0approx / kphi0;
984  id0 = d0approx / settings_.kd0();
985  it = tapprox / kt;
986  iz0 = z0approx / kz0;
987 
988  bool success = true;
989  if (std::abs(rinvapprox) > settings_.rinvcut()) {
990  if (settings_.debugTracklet())
991  edm::LogVerbatim("Tracklet") << "TrackletCalculator::DDL Seeding irinv too large: " << rinvapprox << "(" << irinv
992  << ")";
993  success = false;
994  }
995  if (std::abs(z0approx) > settings_.disp_z0cut()) {
996  if (settings_.debugTracklet())
997  edm::LogVerbatim("Tracklet") << "Failed tracklet z0 cut " << z0approx;
998  success = false;
999  }
1000  if (std::abs(d0approx) > settings_.maxd0()) {
1001  if (settings_.debugTracklet())
1002  edm::LogVerbatim("Tracklet") << "Failed tracklet d0 cut " << d0approx;
1003  success = false;
1004  }
1005 
1006  if (!success)
1007  return false;
1008 
1009  double phicritapprox = phi0approx - asin((0.5 * settings_.rcrit() * rinvapprox) + (d0approx / settings_.rcrit()));
1010  int phicrit = iphi0 - 2 * irinv - 2 * id0;
1011 
1012  int iphicritmincut = settings_.phicritminmc() / globals_->ITC_L1L2()->phi0_final.K();
1013  int iphicritmaxcut = settings_.phicritmaxmc() / globals_->ITC_L1L2()->phi0_final.K();
1014 
1015  bool keepapprox = (phicritapprox > settings_.phicritminmc()) && (phicritapprox < settings_.phicritmaxmc()),
1016  keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
1017 
1018  if (settings_.debugTracklet())
1019  if (keep && !keepapprox)
1020  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced::DDLSeeding tracklet kept with exact phicrit cut "
1021  "but not approximate, phicritapprox: "
1022  << phicritapprox;
1023  if (settings_.usephicritapprox()) {
1024  if (!keepapprox)
1025  return false;
1026  } else {
1027  if (!keep)
1028  return false;
1029  }
1030 
1031  Projection projs[N_LAYER + N_DISK];
1032 
1033  for (unsigned int i = 0; i < toR_.size(); ++i) {
1034  iphiproj[i] = phiprojapprox[i] / kphiproj;
1035  izproj[i] = zprojapprox[i] / kzproj;
1036 
1037  iphider[i] = phiderapprox[i] / kphider;
1038  izder[i] = zderapprox[i] / kzder;
1039 
1040  //check that z projection in range
1041  if (izproj[i] < -(1 << (settings_.nzbitsstub(0) - 1)))
1042  continue;
1043  if (izproj[i] >= (1 << (settings_.nzbitsstub(0) - 1)))
1044  continue;
1045 
1046  //check that phi projection in range
1047  if (iphiproj[i] >= (1 << settings_.nphibitsstub(5)) - 1)
1048  continue;
1049  if (iphiproj[i] <= 0)
1050  continue;
1051 
1052  if (rproj_[i] < settings_.rPS2S()) {
1053  iphiproj[i] >>= (settings_.nphibitsstub(5) - settings_.nphibitsstub(0));
1054  } else {
1055  izproj[i] >>= (settings_.nzbitsstub(0) - settings_.nzbitsstub(5));
1056  }
1057 
1058  if (rproj_[i] < settings_.rPS2S()) {
1059  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL123() - 1)))
1060  iphider[i] = -(1 << (settings_.nbitsphiprojderL123() - 1));
1061  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL123() - 1)))
1062  iphider[i] = (1 << (settings_.nbitsphiprojderL123() - 1)) - 1;
1063  } else {
1064  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL456() - 1)))
1065  iphider[i] = -(1 << (settings_.nbitsphiprojderL456() - 1));
1066  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL456() - 1)))
1067  iphider[i] = (1 << (settings_.nbitsphiprojderL456() - 1)) - 1;
1068  }
1069 
1070  projs[lproj_[i] - 1].init(settings_,
1071  lproj_[i] - 1,
1072  iphiproj[i],
1073  izproj[i],
1074  iphider[i],
1075  izder[i],
1076  phiproj[i],
1077  zproj[i],
1078  phider[i],
1079  zder[i],
1080  phiprojapprox[i],
1081  zprojapprox[i],
1082  phiderapprox[i],
1083  zderapprox[i],
1084  false);
1085  }
1086 
1087  if (std::abs(it * kt) > 1.0) {
1088  for (unsigned int i = 0; i < toZ_.size(); ++i) {
1089  iphiprojdisk[i] = phiprojdiskapprox[i] / kphiprojdisk;
1090  irprojdisk[i] = rprojdiskapprox[i] / krprojdisk;
1091 
1092  iphiderdisk[i] = phiderdiskapprox[i] / kphiderdisk;
1093  irderdisk[i] = rderdiskapprox[i] / krderdisk;
1094 
1095  if (iphiprojdisk[i] <= 0)
1096  continue;
1097  if (iphiprojdisk[i] >= (1 << settings_.nphibitsstub(0)) - 1)
1098  continue;
1099 
1100  if (irprojdisk[i] < settings_.rmindisk() / krprojdisk || irprojdisk[i] >= settings_.rmaxdisk() / krprojdisk)
1101  continue;
1102 
1103  projs[N_LAYER + i + 2].init(settings_,
1104  N_LAYER + i + 2,
1105  iphiprojdisk[i],
1106  irprojdisk[i],
1107  iphiderdisk[i],
1108  irderdisk[i],
1109  phiprojdisk[i],
1110  rprojdisk[i],
1111  phiderdisk[i],
1112  rderdisk[i],
1113  phiprojdiskapprox[i],
1114  rprojdiskapprox[i],
1115  phiderdisk[i],
1116  rderdisk[i],
1117  false);
1118  }
1119  }
1120 
1121  if (settings_.writeMonitorData("TrackletPars")) {
1122  globals_->ofstream("trackletpars.txt")
1123  << layer_ << " , " << rinv << " , " << rinvapprox << " , " << phi0 << " , " << phi0approx << " , " << t << " , "
1124  << tapprox << " , " << z0 << " , " << z0approx << " , " << d0 << " , " << d0approx << endl;
1125  }
1126 
1127  Tracklet* tracklet = new Tracklet(settings_,
1128  iSeed_,
1129  innerFPGAStub,
1130  middleFPGAStub,
1131  outerFPGAStub,
1132  rinv,
1133  phi0,
1134  d0,
1135  z0,
1136  t,
1137  rinvapprox,
1138  phi0approx,
1139  d0approx,
1140  z0approx,
1141  tapprox,
1142  irinv,
1143  iphi0,
1144  id0,
1145  iz0,
1146  it,
1147  projs,
1148  true);
1149 
1150  if (settings_.debugTracklet())
1151  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName()
1152  << " Found DDL tracklet in sector = " << iSector_ << " phi0 = " << phi0;
1153 
1155  tracklet->setTCIndex(TCIndex_);
1156 
1157  if (settings_.writeMonitorData("Seeds")) {
1158  ofstream fout("seeds.txt", ofstream::app);
1159  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " " << tracklet->getISeed() << endl;
1160  fout.close();
1161  }
1162  trackletpars_->addTracklet(tracklet);
1163 
1164  for (unsigned int j = 0; j < toR_.size(); j++) {
1165  if (settings_.debugTracklet())
1166  edm::LogVerbatim("Tracklet") << "adding layer projection " << j << "/" << toR_.size() << " " << lproj_[j] << " "
1167  << tracklet->validProj(lproj_[j] - 1);
1168  if (tracklet->validProj(lproj_[j] - 1)) {
1169  addLayerProj(tracklet, lproj_[j]);
1170  }
1171  }
1172 
1173  for (unsigned int j = 0; j < toZ_.size(); j++) {
1174  int disk = dproj_[j];
1175  if (disk == 0)
1176  continue;
1177  if (it < 0)
1178  disk = -disk;
1179  if (settings_.debugTracklet())
1180  edm::LogVerbatim("Tracklet") << "adding disk projection " << j << "/" << toZ_.size() << " " << disk << " "
1181  << tracklet->validProj(N_LAYER + abs(disk) - 1);
1182  if (tracklet->validProj(N_LAYER + abs(disk) - 1)) {
1183  addDiskProj(tracklet, disk);
1184  }
1185  }
1186 
1187  return true;
1188 }
Log< level::Info, true > LogVerbatim
double kz() const
Definition: Settings.h:314
double phi() const
Definition: L1TStub.h:65
int PS_rD_shift() const
Definition: Settings.h:369
int PS_zL_shift() const
Definition: Settings.h:361
double zapprox() const
Definition: Stub.cc:158
constexpr int N_DISK
Definition: Settings.h:22
int PS_rderD_shift() const
Definition: Settings.h:372
int PS_zderL_shift() const
Definition: Settings.h:364
double rPS2S() const
Definition: Settings.h:334
std::string name_
Definition: ProcessBase.h:38
double kphi1() const
Definition: Settings.h:311
bool addLayerProj(Tracklet *tracklet, int layer)
double phiapprox(double phimin, double) const
Definition: Stub.cc:177
double disp_z0cut() const
Definition: Settings.h:338
double phicritmaxmc() const
Definition: Settings.h:307
double rmindisk() const
Definition: Settings.h:126
bool isBarrel() const
Definition: Stub.h:81
double maxd0() const
Definition: Settings.h:320
Settings const & settings_
Definition: ProcessBase.h:40
double z() const
Definition: L1TStub.h:59
Globals * globals_
Definition: ProcessBase.h:41
int phi0_shift() const
Definition: Settings.h:353
double phicritminmc() const
Definition: Settings.h:306
const FPGAWord & disk() const
Definition: Stub.h:68
void init(Settings const &settings, unsigned int layerdisk, int iphiproj, int irzproj, int iphider, int irzder, double phiproj, double rzproj, double phiprojder, double rzprojder, double phiprojapprox, double rzprojapprox, double phiprojderapprox, double rzprojderapprox, bool isPSseed)
Definition: Projection.cc:11
unsigned int nbitsphiprojderL456() const
Definition: Settings.h:88
void exacttracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, int take3, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiderdisk[N_DISK], double rderdisk[N_DISK])
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:82
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:83
int t_shift() const
Definition: Settings.h:354
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
IMATH_TrackletCalculator * ITC_L1L2()
Definition: Globals.h:48
int value() const
Definition: FPGAWord.h:24
double rinvcut() const
Definition: Settings.h:210
int z0_shift() const
Definition: Settings.h:355
void approxtracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, bool take3, unsigned ndisks, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[4], double zproj[4], double phider[4], double zder[4], double phiprojdisk[5], double rprojdisk[5], double phiderdisk[5], double rderdisk[5])
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
double rapprox() const
Definition: Stub.cc:144
void setTCIndex(int index)
Definition: Tracklet.h:210
double K() const
Definition: imath.h:247
int SS_phiD_shift() const
Definition: Settings.h:368
bool debugTracklet() const
Definition: Settings.h:182
int SS_phiderD_shift() const
Definition: Settings.h:371
double kr() const
Definition: Settings.h:316
static constexpr float d0
double rmaxdisk() const
Definition: Settings.h:125
void addDiskProj(Tracklet *tracklet, int disk)
void setTrackletIndex(unsigned int index)
Definition: Tracklet.cc:796
double kd0() const
Definition: Settings.h:323
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49
int getISeed() const
Definition: Tracklet.cc:801
int SS_phiderL_shift() const
Definition: Settings.h:363
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:87
double r() const
Definition: L1TStub.h:60
int rinv_shift() const
Definition: Settings.h:352
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
const FPGAWord & layer() const
Definition: Stub.h:67
bool usephicritapprox() const
Definition: Settings.h:236
std::string const & getName() const
Definition: ProcessBase.h:22
int SS_phiL_shift() const
Definition: Settings.h:360
bool useapprox() const
Definition: Settings.h:235
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
bool validProj(int layerdisk) const
Definition: Tracklet.h:82
constexpr int N_LAYER
Definition: Settings.h:21
double rcrit() const
Definition: Settings.h:299

◆ exactproj()

void TrackletCalculatorDisplaced::exactproj ( double  rproj,
double  rinv,
double  phi0,
double  d0,
double  t,
double  z0,
double  r0,
double &  phiproj,
double &  zproj,
double &  phider,
double &  zder 
)

Definition at line 1585 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), HLT_2023v12_cff::beta, d0, trklet::Settings::debugTracklet(), funct::pow(), trklet::rinv(), trklet::ProcessBase::settings_, mathSSE::sqrt(), and submitPVValidationJobs::t.

Referenced by exacttracklet().

1595  {
1596  double rho = 1 / rinv;
1597  if (rho < 0) {
1598  r0 = -r0;
1599  }
1600  phiproj = phi0 - asin((rproj * rproj + r0 * r0 - rho * rho) / (2 * rproj * r0));
1601  double beta = acos((rho * rho + r0 * r0 - rproj * rproj) / (2 * r0 * rho));
1602  zproj = z0 + t * std::abs(rho * beta);
1603 
1604  //not exact, but close
1605  phider = -0.5 * rinv / sqrt(1 - pow(0.5 * rproj * rinv, 2)) + d0 / (rproj * rproj);
1606  zder = t / sqrt(1 - pow(0.5 * rproj * rinv, 2));
1607 
1608  if (settings_.debugTracklet())
1609  edm::LogVerbatim("Tracklet") << "exact proj layer at " << rproj << " : " << phiproj << " " << zproj;
1610 }
Settings const & settings_
Definition: ProcessBase.h:40
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool debugTracklet() const
Definition: Settings.h:182
static constexpr float d0
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ exactprojdisk()

void TrackletCalculatorDisplaced::exactprojdisk ( double  zproj,
double  rinv,
double  ,
double  ,
double  t,
double  z0,
double  x0,
double  y0,
double &  phiproj,
double &  rproj,
double &  phider,
double &  rder 
)

Definition at line 1612 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), HLT_2023v12_cff::beta, HltBtagPostValidation_cff::c, funct::cos(), trklet::Settings::debugTracklet(), phimin_, reco::reduceRange(), trklet::rinv(), trklet::ProcessBase::settings_, funct::sin(), mathSSE::sqrt(), submitPVValidationJobs::t, and x.

Referenced by exacttracklet().

1623  {
1624  //protect against t=0
1625  if (std::abs(t) < 0.1)
1626  t = 0.1;
1627  if (t < 0)
1628  zproj = -zproj;
1629  double rho = std::abs(1 / rinv);
1630  double beta = (zproj - z0) / (t * rho);
1631  double phiV = atan2(-y0, -x0);
1632  double c = rinv > 0 ? -1 : 1;
1633 
1634  double x = x0 + rho * cos(phiV + c * beta);
1635  double y = y0 + rho * sin(phiV + c * beta);
1636 
1637  phiproj = atan2(y, x);
1638 
1639  phiproj = reco::reduceRange(phiproj - phimin_);
1640 
1641  rproj = sqrt(x * x + y * y);
1642 
1643  phider = c / t / (x * x + y * y) * (rho + x0 * cos(phiV + c * beta) + y0 * sin(phiV + c * beta));
1644  rder = c / t / rproj * (y0 * cos(phiV + c * beta) - x0 * sin(phiV + c * beta));
1645 
1646  if (settings_.debugTracklet())
1647  edm::LogVerbatim("Tracklet") << "exact proj disk at" << zproj << " : " << phiproj << " " << rproj;
1648 }
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Settings const & settings_
Definition: ProcessBase.h:40
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool debugTracklet() const
Definition: Settings.h:182
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49

◆ exacttracklet()

void TrackletCalculatorDisplaced::exacttracklet ( double  r1,
double  z1,
double  phi1,
double  r2,
double  z2,
double  phi2,
double  r3,
double  z3,
double  phi3,
int  take3,
double &  rinv,
double &  phi0,
double &  d0,
double &  t,
double &  z0,
double  phiproj[N_LAYER - 2],
double  zproj[N_LAYER - 2],
double  phiprojdisk[N_DISK],
double  rprojdisk[N_DISK],
double  phider[N_LAYER - 2],
double  zder[N_LAYER - 2],
double  phiderdisk[N_DISK],
double  rderdisk[N_DISK] 
)

Definition at line 1650 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), b1, b2, funct::cos(), d0, trklet::Settings::debugTracklet(), MillePedeFileConverter_cfg::e, exactproj(), exactprojdisk(), mps_fire::i, M_PI, angle0to2pi::make0To2pi(), phimax_, phimin_, funct::pow(), diffTwoXMLs::r2, reco::reduceRange(), trklet::rinv(), trklet::ProcessBase::settings_, funct::sin(), mathSSE::sqrt(), submitPVValidationJobs::t, toR_, toZ_, testProducerWithPsetDescEmpty_cfi::y1, testProducerWithPsetDescEmpty_cfi::y2, and testProducerWithPsetDescEmpty_cfi::z2.

Referenced by DDLSeeding(), LLDSeeding(), and LLLSeeding().

1672  {
1673  //two lines perpendicular to the 1->2 and 2->3
1674  double x1 = r1 * cos(phi1);
1675  double x2 = r2 * cos(phi2);
1676  double x3 = r3 * cos(phi3);
1677 
1678  double y1 = r1 * sin(phi1);
1679  double y2 = r2 * sin(phi2);
1680  double y3 = r3 * sin(phi3);
1681 
1682  double dy21 = y2 - y1;
1683  double dy32 = y3 - y2;
1684 
1685  //Hack to protect against dividing by zero
1686  //code should be rewritten to avoid this
1687  if (dy21 == 0.0)
1688  dy21 = 1e-9;
1689  if (dy32 == 0.0)
1690  dy32 = 1e-9;
1691 
1692  double k1 = -(x2 - x1) / dy21;
1693  double k2 = -(x3 - x2) / dy32;
1694  double b1 = 0.5 * (y2 + y1) - 0.5 * (x1 + x2) * k1;
1695  double b2 = 0.5 * (y3 + y2) - 0.5 * (x2 + x3) * k2;
1696  //their intersection gives the center of the circle
1697  double y0 = (b1 * k2 - b2 * k1) / (k2 - k1);
1698  double x0 = (b1 - b2) / (k2 - k1);
1699  //get the radius three ways:
1700  double R1 = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
1701  double R2 = sqrt(pow(x2 - x0, 2) + pow(y2 - y0, 2));
1702  double R3 = sqrt(pow(x3 - x0, 2) + pow(y3 - y0, 2));
1703  //check if the same
1704  double eps1 = std::abs(R1 / R2 - 1);
1705  double eps2 = std::abs(R3 / R2 - 1);
1706  if (eps1 > 1e-10 || eps2 > 1e-10)
1707  edm::LogVerbatim("Tracklet") << "&&&&&&&&&&&& bad circle! " << R1 << "\t" << R2 << "\t" << R3;
1708 
1709  if (settings_.debugTracklet())
1710  edm::LogVerbatim("Tracklet") << "phimin_: " << phimin_ << " phimax_: " << phimax_;
1711  //results
1712  rinv = 1. / R1;
1713  phi0 = 0.5 * M_PI + atan2(y0, x0);
1714 
1715  phi0 -= phimin_;
1716 
1717  d0 = -R1 + sqrt(x0 * x0 + y0 * y0);
1718  //sign of rinv:
1719  double dphi = reco::reduceRange(phi3 - atan2(y0, x0));
1720  if (dphi < 0) {
1721  rinv = -rinv;
1722  d0 = -d0;
1723  phi0 = phi0 + M_PI;
1724  }
1725  phi0 = angle0to2pi::make0To2pi(phi0);
1726 
1727  //now in RZ:
1728  //turning angle
1729  double beta1 = reco::reduceRange(atan2(y1 - y0, x1 - x0) - atan2(-y0, -x0));
1730  double beta2 = reco::reduceRange(atan2(y2 - y0, x2 - x0) - atan2(-y0, -x0));
1731  double beta3 = reco::reduceRange(atan2(y3 - y0, x3 - x0) - atan2(-y0, -x0));
1732 
1733  double t12 = (z2 - z1) / std::abs(beta2 - beta1) / R1;
1734  double z12 = (z1 * beta2 - z2 * beta1) / (beta2 - beta1);
1735  double t13 = (z3 - z1) / std::abs(beta3 - beta1) / R1;
1736  double z13 = (z1 * beta3 - z3 * beta1) / (beta3 - beta1);
1737 
1738  if (take3 > 0) {
1739  //take 13 (large lever arm)
1740  t = t13;
1741  z0 = z13;
1742  } else {
1743  //take 12 (pixel layers)
1744  t = t12;
1745  z0 = z12;
1746  }
1747 
1748  for (unsigned int i = 0; i < toR_.size(); i++) {
1749  exactproj(toR_[i], rinv, phi0, d0, t, z0, sqrt(x0 * x0 + y0 * y0), phiproj[i], zproj[i], phider[i], zder[i]);
1750  }
1751 
1752  for (unsigned int i = 0; i < toZ_.size(); i++) {
1753  exactprojdisk(toZ_[i], rinv, phi0, d0, t, z0, x0, y0, phiprojdisk[i], rprojdisk[i], phiderdisk[i], rderdisk[i]);
1754  }
1755 
1756  if (settings_.debugTracklet())
1757  edm::LogVerbatim("Tracklet") << "exact tracklet: " << rinv << " " << phi0 << " " << t << " " << z0 << " " << d0;
1758 }
Log< level::Info, true > LogVerbatim
weight_default_t b1[25]
Definition: b1.h:9
void exactproj(double rproj, double rinv, double phi0, double d0, double t, double z0, double r0, double &phiproj, double &zproj, double &phider, double &zder)
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Settings const & settings_
Definition: ProcessBase.h:40
void exactprojdisk(double zproj, double rinv, double, double, double t, double z0, double x0, double y0, double &phiproj, double &rproj, double &phider, double &rder)
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
weight_default_t b2[10]
Definition: b2.h:9
#define M_PI
bool debugTracklet() const
Definition: Settings.h:182
static constexpr float d0
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ execute()

void TrackletCalculatorDisplaced::execute ( unsigned int  iSector,
double  phimin,
double  phimax 
)

Definition at line 222 of file TrackletCalculatorDisplaced.cc.

References accept(), DDLSeeding(), trklet::Settings::debugTracklet(), Exception, trklet::ProcessBase::getName(), trklet::ProcessBase::globals_, mps_fire::i, iSector_, trklet::Stub::l1tstub(), trklet::Stub::layerdisk(), LLDSeeding(), LLLSeeding(), trklet::Settings::maxStep(), trklet::N_LAYER, trklet::Settings::ntrackletmax(), trklet::TrackletParametersMemory::nTracklets(), trklet::Globals::ofstream(), phimax, phimax_, phimin, phimin_, trklet::ProcessBase::settings_, stubtriplets_, trackletpars_, and trklet::Settings::writeMonitorData().

222  {
223  unsigned int countall = 0;
224  unsigned int countsel = 0;
225 
226  phimin_ = phimin;
227  phimax_ = phimax;
228  iSector_ = iSector;
229 
230  for (auto& stubtriplet : stubtriplets_) {
232  edm::LogVerbatim("Tracklet") << "Will break on too many tracklets in " << getName();
233  break;
234  }
235  for (unsigned int i = 0; i < stubtriplet->nStubTriplets(); i++) {
236  countall++;
237 
238  const Stub* innerFPGAStub = stubtriplet->getFPGAStub1(i);
239  const L1TStub* innerStub = innerFPGAStub->l1tstub();
240 
241  const Stub* middleFPGAStub = stubtriplet->getFPGAStub2(i);
242  const L1TStub* middleStub = middleFPGAStub->l1tstub();
243 
244  const Stub* outerFPGAStub = stubtriplet->getFPGAStub3(i);
245  const L1TStub* outerStub = outerFPGAStub->l1tstub();
246 
247  if (settings_.debugTracklet())
248  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
249 
250  if (innerFPGAStub->layerdisk() < N_LAYER && middleFPGAStub->layerdisk() < N_LAYER &&
251  outerFPGAStub->layerdisk() < N_LAYER) {
252  //barrel+barrel seeding
253  bool accept = LLLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
254  if (accept)
255  countsel++;
256  } else if (innerFPGAStub->layerdisk() >= N_LAYER && middleFPGAStub->layerdisk() >= N_LAYER &&
257  outerFPGAStub->layerdisk() >= N_LAYER) {
258  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Invalid seeding!";
259  } else {
260  //layer+disk seeding
261  if (innerFPGAStub->layerdisk() < N_LAYER && middleFPGAStub->layerdisk() >= N_LAYER &&
262  outerFPGAStub->layerdisk() >= N_LAYER) { //D1D2L2
263  bool accept = DDLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
264  if (accept)
265  countsel++;
266  } else if (innerFPGAStub->layerdisk() >= N_LAYER && middleFPGAStub->layerdisk() < N_LAYER &&
267  outerFPGAStub->layerdisk() < N_LAYER) { //L2L3D1
268  bool accept = LLDSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
269  if (accept)
270  countsel++;
271  } else {
272  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Invalid seeding!";
273  }
274  }
275 
277  edm::LogVerbatim("Tracklet") << "Will break on number of tracklets in " << getName();
278  break;
279  }
280 
281  if (countall >= settings_.maxStep("TC")) {
282  if (settings_.debugTracklet())
283  edm::LogVerbatim("Tracklet") << "Will break on MAXTC 1";
284  break;
285  }
286  if (settings_.debugTracklet())
287  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
288  }
289  if (countall >= settings_.maxStep("TC")) {
290  if (settings_.debugTracklet())
291  edm::LogVerbatim("Tracklet") << "Will break on MAXTC 2";
292  break;
293  }
294  }
295 
296  if (settings_.writeMonitorData("TPD")) {
297  globals_->ofstream("trackletcalculatordisplaced.txt") << getName() << " " << countall << " " << countsel << endl;
298  }
299 }
Log< level::Info, true > LogVerbatim
unsigned int maxStep(std::string module) const
Definition: Settings.h:116
std::vector< StubTripletsMemory * > stubtriplets_
Settings const & settings_
Definition: ProcessBase.h:40
Globals * globals_
Definition: ProcessBase.h:41
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
bool LLDSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
bool LLLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
L1TStub * l1tstub()
Definition: Stub.h:77
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
unsigned int layerdisk() const
Definition: Stub.cc:185
bool debugTracklet() const
Definition: Settings.h:182
bool DDLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
unsigned int ntrackletmax() const
Definition: Settings.h:343
std::string const & getName() const
Definition: ProcessBase.h:22
constexpr int N_LAYER
Definition: Settings.h:21

◆ LLDSeeding()

bool TrackletCalculatorDisplaced::LLDSeeding ( const Stub innerFPGAStub,
const L1TStub innerStub,
const Stub middleFPGAStub,
const L1TStub middleStub,
const Stub outerFPGAStub,
const L1TStub outerStub 
)

Definition at line 1190 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), addDiskProj(), addLayerProj(), trklet::TrackletParametersMemory::addTracklet(), approxtracklet(), d0, trklet::Settings::debugTracklet(), trklet::Stub::disk(), trklet::Settings::disp_z0cut(), dproj_, exacttracklet(), groupFilesInBlocks::fout, trklet::Tracklet::getISeed(), trklet::ProcessBase::getName(), trklet::ProcessBase::globals_, mps_fire::i, trklet::Projection::init(), trklet::Stub::isBarrel(), iSector_, iSeed_, trklet::Globals::ITC_L1L2(), dqmiolumiharvest::j, trklet::VarBase::K(), trklet::Settings::kd0(), runTheMatrix::keep, trklet::Settings::kphi1(), trklet::Settings::kr(), trklet::Settings::kz(), trklet::Stub::layer(), layer_, lproj_, trklet::Settings::maxd0(), trklet::N_DISK, trklet::N_LAYER, trklet::ProcessBase::name_, trklet::Settings::nbitsphiprojderL123(), trklet::Settings::nbitsphiprojderL456(), trklet::Settings::nphibitsstub(), trklet::TrackletParametersMemory::nTracklets(), trklet::Settings::nzbitsstub(), trklet::Globals::ofstream(), trklet::L1TStub::phi(), trklet::IMATH_TrackletCalculator::phi0_final, trklet::Settings::phi0_shift(), trklet::Stub::phiapprox(), trklet::Settings::phicritmaxmc(), trklet::Settings::phicritminmc(), phimax_, phimin_, funct::pow(), trklet::Settings::PS_rD_shift(), trklet::Settings::PS_rderD_shift(), trklet::Settings::PS_zderL_shift(), trklet::Settings::PS_zL_shift(), trklet::L1TStub::r(), diffTwoXMLs::r2, trklet::Stub::rapprox(), trklet::Settings::rcrit(), trklet::rinv(), trklet::Settings::rinv_shift(), trklet::Settings::rinvcut(), trklet::Settings::rmaxdisk(), trklet::Settings::rmindisk(), rproj_, trklet::Settings::rPS2S(), trklet::Tracklet::setTCIndex(), trklet::ProcessBase::settings_, trklet::Tracklet::setTrackletIndex(), trklet::Settings::SS_phiD_shift(), trklet::Settings::SS_phiderD_shift(), trklet::Settings::SS_phiderL_shift(), trklet::Settings::SS_phiL_shift(), summarizeEdmComparisonLogfiles::success, submitPVValidationJobs::t, trklet::Settings::t_shift(), TCIndex_, toR_, toZ_, trackletpars_, trklet::Settings::useapprox(), trklet::Settings::usephicritapprox(), trklet::Tracklet::validProj(), trklet::FPGAWord::value(), trklet::Settings::writeMonitorData(), trklet::L1TStub::z(), trklet::Settings::z0_shift(), testProducerWithPsetDescEmpty_cfi::z2, and trklet::Stub::zapprox().

Referenced by execute(), and trklet::TrackletProcessorDisplaced::execute().

1195  {
1196  if (settings_.debugTracklet())
1197  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName() << " " << layer_
1198  << " trying stub triplet in (L2L3D1): " << middleFPGAStub->layer().value() << " "
1199  << outerFPGAStub->layer().value() << " " << innerFPGAStub->disk().value();
1200 
1201  int take3 = 0; //L2L3D1
1202  unsigned ndisks = 1;
1203 
1204  double r3 = innerStub->r();
1205  double z3 = innerStub->z();
1206  double phi3 = innerStub->phi();
1207 
1208  double r1 = middleStub->r();
1209  double z1 = middleStub->z();
1210  double phi1 = middleStub->phi();
1211 
1212  double r2 = outerStub->r();
1213  double z2 = outerStub->z();
1214  double phi2 = outerStub->phi();
1215 
1216  double rinv, phi0, d0, t, z0;
1217 
1218  double phiproj[N_LAYER - 2], zproj[N_LAYER - 2], phider[N_LAYER - 2], zder[N_LAYER - 2];
1219  double phiprojdisk[N_DISK], rprojdisk[N_DISK], phiderdisk[N_DISK], rderdisk[N_DISK];
1220 
1221  exacttracklet(r1,
1222  z1,
1223  phi1,
1224  r2,
1225  z2,
1226  phi2,
1227  r3,
1228  z3,
1229  phi3,
1230  take3,
1231  rinv,
1232  phi0,
1233  d0,
1234  t,
1235  z0,
1236  phiproj,
1237  zproj,
1238  phiprojdisk,
1239  rprojdisk,
1240  phider,
1241  zder,
1242  phiderdisk,
1243  rderdisk);
1244 
1245  if (settings_.debugTracklet())
1246  edm::LogVerbatim("Tracklet") << __LINE__ << ":" << __FILE__ << "LLD Exact values " << innerFPGAStub->isBarrel()
1247  << middleFPGAStub->isBarrel() << outerFPGAStub->isBarrel() << " " << phi3 << ", " << z3
1248  << ", " << r3 << ", " << phi1 << ", " << z1 << ", " << r1 << ", " << phi2 << ", " << z2
1249  << ", " << r2 << endl;
1250 
1251  if (settings_.useapprox()) {
1252  phi3 = innerFPGAStub->phiapprox(phimin_, phimax_);
1253  z3 = innerFPGAStub->zapprox();
1254  r3 = innerFPGAStub->rapprox();
1255 
1256  phi1 = middleFPGAStub->phiapprox(phimin_, phimax_);
1257  z1 = middleFPGAStub->zapprox();
1258  r1 = middleFPGAStub->rapprox();
1259 
1260  phi2 = outerFPGAStub->phiapprox(phimin_, phimax_);
1261  z2 = outerFPGAStub->zapprox();
1262  r2 = outerFPGAStub->rapprox();
1263  }
1264 
1265  if (settings_.debugTracklet())
1266  edm::LogVerbatim("Tracklet") << __LINE__ << ":" << __FILE__ << "LLD approx values " << innerFPGAStub->isBarrel()
1267  << middleFPGAStub->isBarrel() << outerFPGAStub->isBarrel() << " " << phi3 << ", " << z3
1268  << ", " << r3 << ", " << phi1 << ", " << z1 << ", " << r1 << ", " << phi2 << ", " << z2
1269  << ", " << r2 << endl;
1270 
1271  double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
1272  double phiprojapprox[N_LAYER - 2], zprojapprox[N_LAYER - 2], phiderapprox[N_LAYER - 2], zderapprox[N_LAYER - 2];
1273  double phiprojdiskapprox[N_DISK], rprojdiskapprox[N_DISK];
1274  double phiderdiskapprox[N_DISK], rderdiskapprox[N_DISK];
1275 
1276  //TODO: implement the actual integer calculation
1277  if (settings_.useapprox()) {
1279  z1,
1280  phi1,
1281  r2,
1282  z2,
1283  phi2,
1284  r3,
1285  z3,
1286  phi3,
1287  take3,
1288  ndisks,
1289  rinvapprox,
1290  phi0approx,
1291  d0approx,
1292  tapprox,
1293  z0approx,
1294  phiprojapprox,
1295  zprojapprox,
1296  phiderapprox,
1297  zderapprox,
1298  phiprojdiskapprox,
1299  rprojdiskapprox,
1300  phiderdiskapprox,
1301  rderdiskapprox);
1302  } else {
1303  rinvapprox = rinv;
1304  phi0approx = phi0;
1305  d0approx = d0;
1306  tapprox = t;
1307  z0approx = z0;
1308 
1309  for (unsigned int i = 0; i < toR_.size(); ++i) {
1310  phiprojapprox[i] = phiproj[i];
1311  zprojapprox[i] = zproj[i];
1312  phiderapprox[i] = phider[i];
1313  zderapprox[i] = zder[i];
1314  }
1315 
1316  for (unsigned int i = 0; i < toZ_.size(); ++i) {
1317  phiprojdiskapprox[i] = phiprojdisk[i];
1318  rprojdiskapprox[i] = rprojdisk[i];
1319  phiderdiskapprox[i] = phiderdisk[i];
1320  rderdiskapprox[i] = rderdisk[i];
1321  }
1322  }
1323 
1324  //store the approcximate results
1325  if (settings_.debugTracklet()) {
1326  edm::LogVerbatim("Tracklet") << "rinvapprox: " << rinvapprox << " rinv: " << rinv << endl;
1327  edm::LogVerbatim("Tracklet") << "phi0approx: " << phi0approx << " phi0: " << phi0 << endl;
1328  edm::LogVerbatim("Tracklet") << "d0approx: " << d0approx << " d0: " << d0 << endl;
1329  edm::LogVerbatim("Tracklet") << "tapprox: " << tapprox << " t: " << t << endl;
1330  edm::LogVerbatim("Tracklet") << "z0approx: " << z0approx << " z0: " << z0 << endl;
1331  }
1332 
1333  for (unsigned int i = 0; i < toR_.size(); ++i) {
1334  if (settings_.debugTracklet()) {
1335  edm::LogVerbatim("Tracklet") << "phiprojapprox[" << i << "]: " << phiprojapprox[i] << " phiproj[" << i
1336  << "]: " << phiproj[i] << endl;
1337  edm::LogVerbatim("Tracklet") << "zprojapprox[" << i << "]: " << zprojapprox[i] << " zproj[" << i
1338  << "]: " << zproj[i] << endl;
1339  edm::LogVerbatim("Tracklet") << "phiderapprox[" << i << "]: " << phiderapprox[i] << " phider[" << i
1340  << "]: " << phider[i] << endl;
1341  edm::LogVerbatim("Tracklet") << "zderapprox[" << i << "]: " << zderapprox[i] << " zder[" << i << "]: " << zder[i]
1342  << endl;
1343  }
1344  }
1345 
1346  for (unsigned int i = 0; i < toZ_.size(); ++i) {
1347  if (settings_.debugTracklet()) {
1348  edm::LogVerbatim("Tracklet") << "phiprojdiskapprox[" << i << "]: " << phiprojdiskapprox[i] << " phiprojdisk[" << i
1349  << "]: " << phiprojdisk[i] << endl;
1350  edm::LogVerbatim("Tracklet") << "rprojdiskapprox[" << i << "]: " << rprojdiskapprox[i] << " rprojdisk[" << i
1351  << "]: " << rprojdisk[i] << endl;
1352  edm::LogVerbatim("Tracklet") << "phiderdiskapprox[" << i << "]: " << phiderdiskapprox[i] << " phiderdisk[" << i
1353  << "]: " << phiderdisk[i] << endl;
1354  edm::LogVerbatim("Tracklet") << "rderdiskapprox[" << i << "]: " << rderdiskapprox[i] << " rderdisk[" << i
1355  << "]: " << rderdisk[i] << endl;
1356  }
1357  }
1358 
1359  //now binary
1360  double krinv = settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift()),
1361  kphi0 = settings_.kphi1() * pow(2, settings_.phi0_shift()),
1362  kt = settings_.kz() / settings_.kr() * pow(2, settings_.t_shift()),
1363  kz0 = settings_.kz() * pow(2, settings_.z0_shift()),
1364  kphiproj = settings_.kphi1() * pow(2, settings_.SS_phiL_shift()),
1365  kphider = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift()),
1366  kzproj = settings_.kz() * pow(2, settings_.PS_zL_shift()),
1367  kzder = settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift()),
1368  kphiprojdisk = settings_.kphi1() * pow(2, settings_.SS_phiD_shift()),
1369  kphiderdisk = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift()),
1370  krprojdisk = settings_.kr() * pow(2, settings_.PS_rD_shift()),
1371  krderdisk = settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift());
1372 
1373  int irinv, iphi0, id0, it, iz0;
1374  int iphiproj[N_LAYER - 2], izproj[N_LAYER - 2], iphider[N_LAYER - 2], izder[N_LAYER - 2];
1375  int iphiprojdisk[N_DISK], irprojdisk[N_DISK], iphiderdisk[N_DISK], irderdisk[N_DISK];
1376 
1377  //store the binary results
1378  irinv = rinvapprox / krinv;
1379  iphi0 = phi0approx / kphi0;
1380  id0 = d0approx / settings_.kd0();
1381  it = tapprox / kt;
1382  iz0 = z0approx / kz0;
1383 
1384  bool success = true;
1385  if (std::abs(rinvapprox) > settings_.rinvcut()) {
1386  if (settings_.debugTracklet())
1387  edm::LogVerbatim("Tracklet") << "TrackletCalculator:: LLD Seeding irinv too large: " << rinvapprox << "(" << irinv
1388  << ")";
1389  success = false;
1390  }
1391  if (std::abs(z0approx) > settings_.disp_z0cut()) {
1392  if (settings_.debugTracklet())
1393  edm::LogVerbatim("Tracklet") << "Failed tracklet z0 cut " << z0approx;
1394  success = false;
1395  }
1396  if (std::abs(d0approx) > settings_.maxd0()) {
1397  if (settings_.debugTracklet())
1398  edm::LogVerbatim("Tracklet") << "Failed tracklet d0 cut " << d0approx;
1399  success = false;
1400  }
1401 
1402  if (!success)
1403  return false;
1404 
1405  double phicritapprox = phi0approx - asin((0.5 * settings_.rcrit() * rinvapprox) + (d0approx / settings_.rcrit()));
1406  int phicrit = iphi0 - 2 * irinv - 2 * id0;
1407 
1408  int iphicritmincut = settings_.phicritminmc() / globals_->ITC_L1L2()->phi0_final.K();
1409  int iphicritmaxcut = settings_.phicritmaxmc() / globals_->ITC_L1L2()->phi0_final.K();
1410 
1411  bool keepapprox = (phicritapprox > settings_.phicritminmc()) && (phicritapprox < settings_.phicritmaxmc()),
1412  keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
1413 
1414  if (settings_.debugTracklet())
1415  if (keep && !keepapprox)
1416  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced::LLDSeeding tracklet kept with exact phicrit cut "
1417  "but not approximate, phicritapprox: "
1418  << phicritapprox;
1419  if (settings_.usephicritapprox()) {
1420  if (!keepapprox)
1421  return false;
1422  } else {
1423  if (!keep)
1424  return false;
1425  }
1426 
1427  Projection projs[N_LAYER + N_DISK];
1428 
1429  for (unsigned int i = 0; i < toR_.size(); ++i) {
1430  iphiproj[i] = phiprojapprox[i] / kphiproj;
1431  izproj[i] = zprojapprox[i] / kzproj;
1432 
1433  iphider[i] = phiderapprox[i] / kphider;
1434  izder[i] = zderapprox[i] / kzder;
1435 
1436  if (izproj[i] < -(1 << (settings_.nzbitsstub(0) - 1)))
1437  continue;
1438  if (izproj[i] >= (1 << (settings_.nzbitsstub(0) - 1)))
1439  continue;
1440 
1441  //this is left from the original....
1442  if (iphiproj[i] >= (1 << settings_.nphibitsstub(5)) - 1)
1443  continue;
1444  if (iphiproj[i] <= 0)
1445  continue;
1446 
1447  if (rproj_[i] < settings_.rPS2S()) {
1448  iphiproj[i] >>= (settings_.nphibitsstub(5) - settings_.nphibitsstub(0));
1449  } else {
1450  izproj[i] >>= (settings_.nzbitsstub(0) - settings_.nzbitsstub(5));
1451  }
1452 
1453  if (rproj_[i] < settings_.rPS2S()) {
1454  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL123() - 1)))
1455  iphider[i] = -(1 << (settings_.nbitsphiprojderL123() - 1));
1456  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL123() - 1)))
1457  iphider[i] = (1 << (settings_.nbitsphiprojderL123() - 1)) - 1;
1458  } else {
1459  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL456() - 1)))
1460  iphider[i] = -(1 << (settings_.nbitsphiprojderL456() - 1));
1461  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL456() - 1)))
1462  iphider[i] = (1 << (settings_.nbitsphiprojderL456() - 1)) - 1;
1463  }
1464 
1465  projs[lproj_[i] - 1].init(settings_,
1466  lproj_[i] - 1,
1467  iphiproj[i],
1468  izproj[i],
1469  iphider[i],
1470  izder[i],
1471  phiproj[i],
1472  zproj[i],
1473  phider[i],
1474  zder[i],
1475  phiprojapprox[i],
1476  zprojapprox[i],
1477  phiderapprox[i],
1478  zderapprox[i],
1479  false);
1480  }
1481 
1482  if (std::abs(it * kt) > 1.0) {
1483  for (unsigned int i = 0; i < toZ_.size(); ++i) {
1484  iphiprojdisk[i] = phiprojdiskapprox[i] / kphiprojdisk;
1485  irprojdisk[i] = rprojdiskapprox[i] / krprojdisk;
1486 
1487  iphiderdisk[i] = phiderdiskapprox[i] / kphiderdisk;
1488  irderdisk[i] = rderdiskapprox[i] / krderdisk;
1489 
1490  //Check phi range of projection
1491  if (iphiprojdisk[i] <= 0)
1492  continue;
1493  if (iphiprojdisk[i] >= (1 << settings_.nphibitsstub(0)) - 1)
1494  continue;
1495 
1496  //Check r range of projection
1497  if (irprojdisk[i] < settings_.rmindisk() / krprojdisk || irprojdisk[i] >= settings_.rmaxdisk() / krprojdisk)
1498  continue;
1499 
1500  projs[N_LAYER + i + 1].init(settings_,
1501  N_LAYER + i + 1,
1502  iphiprojdisk[i],
1503  irprojdisk[i],
1504  iphiderdisk[i],
1505  irderdisk[i],
1506  phiprojdisk[i],
1507  rprojdisk[i],
1508  phiderdisk[i],
1509  rderdisk[i],
1510  phiprojdiskapprox[i],
1511  rprojdiskapprox[i],
1512  phiderdisk[i],
1513  rderdisk[i],
1514  false);
1515  }
1516  }
1517 
1518  if (settings_.writeMonitorData("TrackletPars")) {
1519  globals_->ofstream("trackletpars.txt")
1520  << layer_ << " , " << rinv << " , " << rinvapprox << " , " << phi0 << " , " << phi0approx << " , " << t << " , "
1521  << tapprox << " , " << z0 << " , " << z0approx << " , " << d0 << " , " << d0approx << endl;
1522  }
1523 
1524  Tracklet* tracklet = new Tracklet(settings_,
1525  iSeed_,
1526  innerFPGAStub,
1527  middleFPGAStub,
1528  outerFPGAStub,
1529  rinv,
1530  phi0,
1531  d0,
1532  z0,
1533  t,
1534  rinvapprox,
1535  phi0approx,
1536  d0approx,
1537  z0approx,
1538  tapprox,
1539  irinv,
1540  iphi0,
1541  id0,
1542  iz0,
1543  it,
1544  projs,
1545  false);
1546 
1547  if (settings_.debugTracklet())
1548  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName()
1549  << " Found LLD tracklet in sector = " << iSector_ << " phi0 = " << phi0;
1550 
1552  tracklet->setTCIndex(TCIndex_);
1553 
1554  if (settings_.writeMonitorData("Seeds")) {
1555  ofstream fout("seeds.txt", ofstream::app);
1556  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " " << tracklet->getISeed() << endl;
1557  fout.close();
1558  }
1559  trackletpars_->addTracklet(tracklet);
1560 
1561  for (unsigned int j = 0; j < toR_.size(); j++) {
1562  if (settings_.debugTracklet())
1563  edm::LogVerbatim("Tracklet") << "adding layer projection " << j << "/" << toR_.size() << " " << lproj_[j];
1564  if (tracklet->validProj(lproj_[j] - 1)) {
1565  addLayerProj(tracklet, lproj_[j]);
1566  }
1567  }
1568 
1569  for (unsigned int j = 0; j < toZ_.size(); j++) {
1570  int disk = dproj_[j];
1571  if (disk == 0)
1572  continue;
1573  if (it < 0)
1574  disk = -disk;
1575  if (settings_.debugTracklet())
1576  edm::LogVerbatim("Tracklet") << "adding disk projection " << j << "/" << toZ_.size() << " " << disk;
1577  if (tracklet->validProj(N_LAYER + abs(disk) - 1)) {
1578  addDiskProj(tracklet, disk);
1579  }
1580  }
1581 
1582  return true;
1583 }
Log< level::Info, true > LogVerbatim
double kz() const
Definition: Settings.h:314
double phi() const
Definition: L1TStub.h:65
int PS_rD_shift() const
Definition: Settings.h:369
int PS_zL_shift() const
Definition: Settings.h:361
double zapprox() const
Definition: Stub.cc:158
constexpr int N_DISK
Definition: Settings.h:22
int PS_rderD_shift() const
Definition: Settings.h:372
int PS_zderL_shift() const
Definition: Settings.h:364
double rPS2S() const
Definition: Settings.h:334
std::string name_
Definition: ProcessBase.h:38
double kphi1() const
Definition: Settings.h:311
bool addLayerProj(Tracklet *tracklet, int layer)
double phiapprox(double phimin, double) const
Definition: Stub.cc:177
double disp_z0cut() const
Definition: Settings.h:338
double phicritmaxmc() const
Definition: Settings.h:307
double rmindisk() const
Definition: Settings.h:126
bool isBarrel() const
Definition: Stub.h:81
double maxd0() const
Definition: Settings.h:320
Settings const & settings_
Definition: ProcessBase.h:40
double z() const
Definition: L1TStub.h:59
Globals * globals_
Definition: ProcessBase.h:41
int phi0_shift() const
Definition: Settings.h:353
double phicritminmc() const
Definition: Settings.h:306
const FPGAWord & disk() const
Definition: Stub.h:68
void init(Settings const &settings, unsigned int layerdisk, int iphiproj, int irzproj, int iphider, int irzder, double phiproj, double rzproj, double phiprojder, double rzprojder, double phiprojapprox, double rzprojapprox, double phiprojderapprox, double rzprojderapprox, bool isPSseed)
Definition: Projection.cc:11
unsigned int nbitsphiprojderL456() const
Definition: Settings.h:88
void exacttracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, int take3, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiderdisk[N_DISK], double rderdisk[N_DISK])
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:82
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:83
int t_shift() const
Definition: Settings.h:354
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
IMATH_TrackletCalculator * ITC_L1L2()
Definition: Globals.h:48
int value() const
Definition: FPGAWord.h:24
double rinvcut() const
Definition: Settings.h:210
int z0_shift() const
Definition: Settings.h:355
void approxtracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, bool take3, unsigned ndisks, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[4], double zproj[4], double phider[4], double zder[4], double phiprojdisk[5], double rprojdisk[5], double phiderdisk[5], double rderdisk[5])
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
double rapprox() const
Definition: Stub.cc:144
void setTCIndex(int index)
Definition: Tracklet.h:210
double K() const
Definition: imath.h:247
int SS_phiD_shift() const
Definition: Settings.h:368
bool debugTracklet() const
Definition: Settings.h:182
int SS_phiderD_shift() const
Definition: Settings.h:371
double kr() const
Definition: Settings.h:316
static constexpr float d0
double rmaxdisk() const
Definition: Settings.h:125
void addDiskProj(Tracklet *tracklet, int disk)
void setTrackletIndex(unsigned int index)
Definition: Tracklet.cc:796
double kd0() const
Definition: Settings.h:323
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49
int getISeed() const
Definition: Tracklet.cc:801
int SS_phiderL_shift() const
Definition: Settings.h:363
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:87
double r() const
Definition: L1TStub.h:60
int rinv_shift() const
Definition: Settings.h:352
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
const FPGAWord & layer() const
Definition: Stub.h:67
bool usephicritapprox() const
Definition: Settings.h:236
std::string const & getName() const
Definition: ProcessBase.h:22
int SS_phiL_shift() const
Definition: Settings.h:360
bool useapprox() const
Definition: Settings.h:235
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
bool validProj(int layerdisk) const
Definition: Tracklet.h:82
constexpr int N_LAYER
Definition: Settings.h:21
double rcrit() const
Definition: Settings.h:299

◆ LLLSeeding()

bool TrackletCalculatorDisplaced::LLLSeeding ( const Stub innerFPGAStub,
const L1TStub innerStub,
const Stub middleFPGAStub,
const L1TStub middleStub,
const Stub outerFPGAStub,
const L1TStub outerStub 
)

Definition at line 372 of file TrackletCalculatorDisplaced.cc.

References funct::abs(), addDiskProj(), addLayerProj(), trklet::TrackletParametersMemory::addTracklet(), approxtracklet(), cms::cuda::assert(), d0, trklet::Settings::debugTracklet(), trklet::Settings::disp_z0cut(), dproj_, exacttracklet(), groupFilesInBlocks::fout, trklet::Tracklet::getISeed(), trklet::ProcessBase::getName(), trklet::ProcessBase::globals_, mps_fire::i, trklet::Projection::init(), trklet::Stub::isBarrel(), iSector_, iSeed_, trklet::Globals::ITC_L1L2(), dqmiolumiharvest::j, trklet::VarBase::K(), trklet::Settings::kd0(), runTheMatrix::keep, trklet::Settings::kphi1(), trklet::Settings::kr(), trklet::Settings::kz(), trklet::Stub::layer(), layer_, trklet::Stub::layerdisk(), lproj_, trklet::Settings::maxd0(), trklet::N_DISK, trklet::N_LAYER, trklet::ProcessBase::name_, trklet::Settings::nbitsphiprojderL123(), trklet::Settings::nbitsphiprojderL456(), trklet::Settings::nphibitsstub(), trklet::TrackletParametersMemory::nTracklets(), trklet::Settings::nzbitsstub(), trklet::Globals::ofstream(), trklet::L1TStub::phi(), trklet::IMATH_TrackletCalculator::phi0_final, trklet::Settings::phi0_shift(), trklet::Stub::phiapprox(), trklet::Settings::phicritmaxmc(), trklet::Settings::phicritminmc(), phimax_, phimin_, funct::pow(), trklet::Settings::PS_rD_shift(), trklet::Settings::PS_rderD_shift(), trklet::Settings::PS_zderL_shift(), trklet::Settings::PS_zL_shift(), trklet::L1TStub::r(), diffTwoXMLs::r2, trklet::Stub::rapprox(), trklet::Settings::rcrit(), trklet::rinv(), trklet::Settings::rinv_shift(), trklet::Settings::rinvcut(), trklet::Settings::rmaxdisk(), trklet::Settings::rmindisk(), rproj_, trklet::Settings::rPS2S(), trklet::Tracklet::setTCIndex(), trklet::ProcessBase::settings_, trklet::Tracklet::setTrackletIndex(), trklet::Settings::SS_phiD_shift(), trklet::Settings::SS_phiderD_shift(), trklet::Settings::SS_phiderL_shift(), trklet::Settings::SS_phiL_shift(), summarizeEdmComparisonLogfiles::success, submitPVValidationJobs::t, trklet::Settings::t_shift(), TCIndex_, toR_, toZ_, trackletpars_, trklet::Settings::useapprox(), trklet::Settings::usephicritapprox(), trklet::Tracklet::validProj(), trklet::FPGAWord::value(), trklet::Settings::writeMonitorData(), trklet::L1TStub::z(), trklet::Settings::z0_shift(), testProducerWithPsetDescEmpty_cfi::z2, and trklet::Stub::zapprox().

Referenced by execute(), and trklet::TrackletProcessorDisplaced::execute().

377  {
378  if (settings_.debugTracklet())
379  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName() << " " << layer_
380  << " trying stub triplet in layer (L L L): " << innerFPGAStub->layer().value() << " "
381  << middleFPGAStub->layer().value() << " " << outerFPGAStub->layer().value();
382 
383  assert(outerFPGAStub->layerdisk() < N_LAYER);
384 
385  double r1 = innerStub->r();
386  double z1 = innerStub->z();
387  double phi1 = innerStub->phi();
388 
389  double r2 = middleStub->r();
390  double z2 = middleStub->z();
391  double phi2 = middleStub->phi();
392 
393  double r3 = outerStub->r();
394  double z3 = outerStub->z();
395  double phi3 = outerStub->phi();
396 
397  int take3 = 0;
398  if (layer_ == 5)
399  take3 = 1;
400  unsigned ndisks = 0;
401 
402  double rinv, phi0, d0, t, z0;
403 
404  Projection projs[N_LAYER + N_DISK];
405 
406  double phiproj[N_LAYER - 2], zproj[N_LAYER - 2], phider[N_LAYER - 2], zder[N_LAYER - 2];
407  double phiprojdisk[N_DISK], rprojdisk[N_DISK], phiderdisk[N_DISK], rderdisk[N_DISK];
408 
410  z1,
411  phi1,
412  r2,
413  z2,
414  phi2,
415  r3,
416  z3,
417  phi3,
418  take3,
419  rinv,
420  phi0,
421  d0,
422  t,
423  z0,
424  phiproj,
425  zproj,
426  phiprojdisk,
427  rprojdisk,
428  phider,
429  zder,
430  phiderdisk,
431  rderdisk);
432  if (settings_.debugTracklet())
433  edm::LogVerbatim("Tracklet") << __LINE__ << ":" << __FILE__ << "LLL Exact values " << innerFPGAStub->isBarrel()
434  << middleFPGAStub->isBarrel() << outerFPGAStub->isBarrel() << " " << phi1 << ", " << z1
435  << ", " << r1 << ", " << phi2 << ", " << z2 << ", " << r2 << ", " << phi3 << ", " << z3
436  << ", " << r3 << endl;
437 
438  if (settings_.useapprox()) {
439  phi1 = innerFPGAStub->phiapprox(phimin_, phimax_);
440  z1 = innerFPGAStub->zapprox();
441  r1 = innerFPGAStub->rapprox();
442 
443  phi2 = middleFPGAStub->phiapprox(phimin_, phimax_);
444  z2 = middleFPGAStub->zapprox();
445  r2 = middleFPGAStub->rapprox();
446 
447  phi3 = outerFPGAStub->phiapprox(phimin_, phimax_);
448  z3 = outerFPGAStub->zapprox();
449  r3 = outerFPGAStub->rapprox();
450  }
451 
452  if (settings_.debugTracklet())
453  edm::LogVerbatim("Tracklet") << __LINE__ << ":" << __FILE__ << "LLL Approx values " << innerFPGAStub->isBarrel()
454  << middleFPGAStub->isBarrel() << outerFPGAStub->isBarrel() << " " << phi1 << ", " << z1
455  << ", " << r1 << ", " << phi2 << ", " << z2 << ", " << r2 << ", " << phi3 << ", " << z3
456  << ", " << r3 << endl;
457 
458  double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
459  double phiprojapprox[N_LAYER - 2], zprojapprox[N_LAYER - 2], phiderapprox[N_LAYER - 2], zderapprox[N_LAYER - 2];
460  double phiprojdiskapprox[N_DISK], rprojdiskapprox[N_DISK];
461  double phiderdiskapprox[N_DISK], rderdiskapprox[N_DISK];
462 
463  //TODO: implement the actual integer calculation
464  if (settings_.useapprox()) {
466  z1,
467  phi1,
468  r2,
469  z2,
470  phi2,
471  r3,
472  z3,
473  phi3,
474  take3,
475  ndisks,
476  rinvapprox,
477  phi0approx,
478  d0approx,
479  tapprox,
480  z0approx,
481  phiprojapprox,
482  zprojapprox,
483  phiderapprox,
484  zderapprox,
485  phiprojdiskapprox,
486  rprojdiskapprox,
487  phiderdiskapprox,
488  rderdiskapprox);
489  } else {
490  rinvapprox = rinv;
491  phi0approx = phi0;
492  d0approx = d0;
493  tapprox = t;
494  z0approx = z0;
495 
496  for (unsigned int i = 0; i < toR_.size(); ++i) {
497  phiprojapprox[i] = phiproj[i];
498  zprojapprox[i] = zproj[i];
499  phiderapprox[i] = phider[i];
500  zderapprox[i] = zder[i];
501  }
502 
503  for (unsigned int i = 0; i < toZ_.size(); ++i) {
504  phiprojdiskapprox[i] = phiprojdisk[i];
505  rprojdiskapprox[i] = rprojdisk[i];
506  phiderdiskapprox[i] = phiderdisk[i];
507  rderdiskapprox[i] = rderdisk[i];
508  }
509  }
510 
511  //store the approcximate results
512 
513  if (settings_.debugTracklet()) {
514  edm::LogVerbatim("Tracklet") << "rinvapprox: " << rinvapprox << " rinv: " << rinv << endl;
515  edm::LogVerbatim("Tracklet") << "phi0approx: " << phi0approx << " phi0: " << phi0 << endl;
516  edm::LogVerbatim("Tracklet") << "d0approx: " << d0approx << " d0: " << d0 << endl;
517  edm::LogVerbatim("Tracklet") << "tapprox: " << tapprox << " t: " << t << endl;
518  edm::LogVerbatim("Tracklet") << "z0approx: " << z0approx << " z0: " << z0 << endl;
519  }
520 
521  for (unsigned int i = 0; i < toR_.size(); ++i) {
522  if (settings_.debugTracklet()) {
523  edm::LogVerbatim("Tracklet") << "phiprojapprox[" << i << "]: " << phiprojapprox[i] << " phiproj[" << i
524  << "]: " << phiproj[i] << endl;
525  edm::LogVerbatim("Tracklet") << "zprojapprox[" << i << "]: " << zprojapprox[i] << " zproj[" << i
526  << "]: " << zproj[i] << endl;
527  edm::LogVerbatim("Tracklet") << "phiderapprox[" << i << "]: " << phiderapprox[i] << " phider[" << i
528  << "]: " << phider[i] << endl;
529  edm::LogVerbatim("Tracklet") << "zderapprox[" << i << "]: " << zderapprox[i] << " zder[" << i << "]: " << zder[i]
530  << endl;
531  }
532  }
533 
534  for (unsigned int i = 0; i < toZ_.size(); ++i) {
535  if (settings_.debugTracklet()) {
536  edm::LogVerbatim("Tracklet") << "phiprojdiskapprox[" << i << "]: " << phiprojdiskapprox[i] << " phiprojdisk[" << i
537  << "]: " << phiprojdisk[i] << endl;
538  edm::LogVerbatim("Tracklet") << "rprojdiskapprox[" << i << "]: " << rprojdiskapprox[i] << " rprojdisk[" << i
539  << "]: " << rprojdisk[i] << endl;
540  edm::LogVerbatim("Tracklet") << "phiderdiskapprox[" << i << "]: " << phiderdiskapprox[i] << " phiderdisk[" << i
541  << "]: " << phiderdisk[i] << endl;
542  edm::LogVerbatim("Tracklet") << "rderdiskapprox[" << i << "]: " << rderdiskapprox[i] << " rderdisk[" << i
543  << "]: " << rderdisk[i] << endl;
544  }
545  }
546 
547  //now binary
548  double krinv = settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift()),
549  kphi0 = settings_.kphi1() * pow(2, settings_.phi0_shift()),
550  kt = settings_.kz() / settings_.kr() * pow(2, settings_.t_shift()),
551  kz0 = settings_.kz() * pow(2, settings_.z0_shift()),
552  kphiproj = settings_.kphi1() * pow(2, settings_.SS_phiL_shift()),
553  kphider = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift()),
554  kzproj = settings_.kz() * pow(2, settings_.PS_zL_shift()),
555  kzder = settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift()),
556  kphiprojdisk = settings_.kphi1() * pow(2, settings_.SS_phiD_shift()),
557  kphiderdisk = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift()),
558  krprojdisk = settings_.kr() * pow(2, settings_.PS_rD_shift()),
559  krderdisk = settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift());
560 
561  int irinv, iphi0, id0, it, iz0;
562  int iphiproj[N_LAYER - 2], izproj[N_LAYER - 2], iphider[N_LAYER - 2], izder[N_LAYER - 2];
563  int iphiprojdisk[N_DISK], irprojdisk[N_DISK], iphiderdisk[N_DISK], irderdisk[N_DISK];
564 
565  //store the binary results
566  irinv = rinvapprox / krinv;
567  iphi0 = phi0approx / kphi0;
568  id0 = d0approx / settings_.kd0();
569  it = tapprox / kt;
570  iz0 = z0approx / kz0;
571 
572  bool success = true;
573  if (std::abs(rinvapprox) > settings_.rinvcut()) {
574  if (settings_.debugTracklet())
575  edm::LogVerbatim("Tracklet") << "TrackletCalculator::LLL Seeding irinv too large: " << rinvapprox << "(" << irinv
576  << ")";
577  success = false;
578  }
579  if (std::abs(z0approx) > settings_.disp_z0cut()) {
580  if (settings_.debugTracklet())
581  edm::LogVerbatim("Tracklet") << "Failed tracklet z0 cut " << z0approx << " in layer " << layer_;
582  success = false;
583  }
584  if (std::abs(d0approx) > settings_.maxd0()) {
585  if (settings_.debugTracklet())
586  edm::LogVerbatim("Tracklet") << "Failed tracklet d0 cut " << d0approx;
587  success = false;
588  }
589 
590  if (!success) {
591  return false;
592  }
593 
594  double phicritapprox = phi0approx - asin((0.5 * settings_.rcrit() * rinvapprox) + (d0approx / settings_.rcrit()));
595  int phicrit = iphi0 - 2 * irinv - 2 * id0;
596 
597  int iphicritmincut = settings_.phicritminmc() / globals_->ITC_L1L2()->phi0_final.K();
598  int iphicritmaxcut = settings_.phicritmaxmc() / globals_->ITC_L1L2()->phi0_final.K();
599 
600  bool keepapprox = (phicritapprox > settings_.phicritminmc()) && (phicritapprox < settings_.phicritmaxmc()),
601  keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
602 
603  if (settings_.debugTracklet())
604  if (keep && !keepapprox)
605  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced::LLLSeeding tracklet kept with exact phicrit cut "
606  "but not approximate, phicritapprox: "
607  << phicritapprox;
608  if (settings_.usephicritapprox()) {
609  if (!keepapprox) {
610  return false;
611  }
612  } else {
613  if (!keep) {
614  return false;
615  }
616  }
617 
618  for (unsigned int i = 0; i < toR_.size(); ++i) {
619  iphiproj[i] = phiprojapprox[i] / kphiproj;
620  izproj[i] = zprojapprox[i] / kzproj;
621 
622  iphider[i] = phiderapprox[i] / kphider;
623  izder[i] = zderapprox[i] / kzder;
624 
625  //check that z projection is in range
626  if (izproj[i] < -(1 << (settings_.nzbitsstub(0) - 1)))
627  continue;
628  if (izproj[i] >= (1 << (settings_.nzbitsstub(0) - 1)))
629  continue;
630 
631  //check that phi projection is in range
632  if (iphiproj[i] >= (1 << settings_.nphibitsstub(N_LAYER - 1)) - 1)
633  continue;
634  if (iphiproj[i] <= 0)
635  continue;
636 
637  //adjust number of bits for phi and z projection
638  if (rproj_[i] < settings_.rPS2S()) {
639  iphiproj[i] >>= (settings_.nphibitsstub(N_LAYER - 1) - settings_.nphibitsstub(0));
640  if (iphiproj[i] >= (1 << settings_.nphibitsstub(0)) - 1)
641  iphiproj[i] = (1 << settings_.nphibitsstub(0)) - 2; //-2 not to hit atExtreme
642  } else {
643  izproj[i] >>= (settings_.nzbitsstub(0) - settings_.nzbitsstub(N_LAYER - 1));
644  }
645 
646  if (rproj_[i] < settings_.rPS2S()) {
647  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL123() - 1))) {
648  iphider[i] = -(1 << (settings_.nbitsphiprojderL123() - 1));
649  }
650  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL123() - 1))) {
651  iphider[i] = (1 << (settings_.nbitsphiprojderL123() - 1)) - 1;
652  }
653  } else {
654  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL456() - 1))) {
655  iphider[i] = -(1 << (settings_.nbitsphiprojderL456() - 1));
656  }
657  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL456() - 1))) {
658  iphider[i] = (1 << (settings_.nbitsphiprojderL456() - 1)) - 1;
659  }
660  }
661 
662  projs[lproj_[i] - 1].init(settings_,
663  lproj_[i] - 1,
664  iphiproj[i],
665  izproj[i],
666  iphider[i],
667  izder[i],
668  phiproj[i],
669  zproj[i],
670  phider[i],
671  zder[i],
672  phiprojapprox[i],
673  zprojapprox[i],
674  phiderapprox[i],
675  zderapprox[i],
676  false);
677  }
678 
679  if (std::abs(it * kt) > 1.0) {
680  for (unsigned int i = 0; i < toZ_.size(); ++i) {
681  iphiprojdisk[i] = phiprojdiskapprox[i] / kphiprojdisk;
682  irprojdisk[i] = rprojdiskapprox[i] / krprojdisk;
683 
684  iphiderdisk[i] = phiderdiskapprox[i] / kphiderdisk;
685  irderdisk[i] = rderdiskapprox[i] / krderdisk;
686 
687  //check phi projection in range
688  if (iphiprojdisk[i] <= 0)
689  continue;
690  if (iphiprojdisk[i] >= (1 << settings_.nphibitsstub(0)) - 1)
691  continue;
692 
693  //check r projection in range
694  if (rprojdiskapprox[i] < settings_.rmindisk() || rprojdiskapprox[i] >= settings_.rmaxdisk())
695  continue;
696 
697  projs[N_LAYER + i].init(settings_,
698  N_LAYER + i,
699  iphiprojdisk[i],
700  irprojdisk[i],
701  iphiderdisk[i],
702  irderdisk[i],
703  phiprojdisk[i],
704  rprojdisk[i],
705  phiderdisk[i],
706  rderdisk[i],
707  phiprojdiskapprox[i],
708  rprojdiskapprox[i],
709  phiderdisk[i],
710  rderdisk[i],
711  false);
712  }
713  }
714 
715  if (settings_.writeMonitorData("TrackletPars")) {
716  globals_->ofstream("trackletpars.txt")
717  << layer_ << " , " << rinv << " , " << rinvapprox << " , " << phi0 << " , " << phi0approx << " , " << t << " , "
718  << tapprox << " , " << z0 << " , " << z0approx << " , " << d0 << " , " << d0approx << endl;
719  }
720 
721  Tracklet* tracklet = new Tracklet(settings_,
722  iSeed_,
723  innerFPGAStub,
724  middleFPGAStub,
725  outerFPGAStub,
726  rinv,
727  phi0,
728  d0,
729  z0,
730  t,
731  rinvapprox,
732  phi0approx,
733  d0approx,
734  z0approx,
735  tapprox,
736  irinv,
737  iphi0,
738  id0,
739  iz0,
740  it,
741  projs,
742  false);
743 
744  if (settings_.debugTracklet())
745  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName()
746  << " Found LLL tracklet in sector = " << iSector_ << " phi0 = " << phi0;
747 
749  tracklet->setTCIndex(TCIndex_);
750 
751  if (settings_.writeMonitorData("Seeds")) {
752  ofstream fout("seeds.txt", ofstream::app);
753  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " " << tracklet->getISeed() << endl;
754  fout.close();
755  }
756  trackletpars_->addTracklet(tracklet);
757 
758  bool addL5 = false;
759  bool addL6 = false;
760  for (unsigned int j = 0; j < toR_.size(); j++) {
761  bool added = false;
762 
763  if (settings_.debugTracklet())
764  edm::LogVerbatim("Tracklet") << "adding layer projection " << j << "/" << toR_.size() << " " << lproj_[j];
765  if (tracklet->validProj(lproj_[j] - 1)) {
766  added = addLayerProj(tracklet, lproj_[j]);
767  if (added && lproj_[j] == 5)
768  addL5 = true;
769  if (added && lproj_[j] == 6)
770  addL6 = true;
771  }
772  }
773 
774  for (unsigned int j = 0; j < toZ_.size(); j++) {
775  int disk = dproj_[j];
776  if (disk == 0)
777  continue;
778  if (disk == 2 && addL5)
779  continue;
780  if (disk == 1 && addL6)
781  continue;
782  if (it < 0)
783  disk = -disk;
784  if (settings_.debugTracklet())
785  edm::LogVerbatim("Tracklet") << "adding disk projection " << j << "/" << toZ_.size() << " " << disk;
786  if (tracklet->validProj(N_LAYER + abs(disk) - 1)) {
787  addDiskProj(tracklet, disk);
788  }
789  }
790 
791  return true;
792 }
Log< level::Info, true > LogVerbatim
double kz() const
Definition: Settings.h:314
double phi() const
Definition: L1TStub.h:65
int PS_rD_shift() const
Definition: Settings.h:369
int PS_zL_shift() const
Definition: Settings.h:361
double zapprox() const
Definition: Stub.cc:158
constexpr int N_DISK
Definition: Settings.h:22
int PS_rderD_shift() const
Definition: Settings.h:372
int PS_zderL_shift() const
Definition: Settings.h:364
double rPS2S() const
Definition: Settings.h:334
std::string name_
Definition: ProcessBase.h:38
double kphi1() const
Definition: Settings.h:311
bool addLayerProj(Tracklet *tracklet, int layer)
double phiapprox(double phimin, double) const
Definition: Stub.cc:177
double disp_z0cut() const
Definition: Settings.h:338
double phicritmaxmc() const
Definition: Settings.h:307
double rmindisk() const
Definition: Settings.h:126
bool isBarrel() const
Definition: Stub.h:81
double maxd0() const
Definition: Settings.h:320
Settings const & settings_
Definition: ProcessBase.h:40
double z() const
Definition: L1TStub.h:59
Globals * globals_
Definition: ProcessBase.h:41
int phi0_shift() const
Definition: Settings.h:353
assert(be >=bs)
double phicritminmc() const
Definition: Settings.h:306
void init(Settings const &settings, unsigned int layerdisk, int iphiproj, int irzproj, int iphider, int irzder, double phiproj, double rzproj, double phiprojder, double rzprojder, double phiprojapprox, double rzprojapprox, double phiprojderapprox, double rzprojderapprox, bool isPSseed)
Definition: Projection.cc:11
unsigned int nbitsphiprojderL456() const
Definition: Settings.h:88
void exacttracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, int take3, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiderdisk[N_DISK], double rderdisk[N_DISK])
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:82
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:83
int t_shift() const
Definition: Settings.h:354
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
IMATH_TrackletCalculator * ITC_L1L2()
Definition: Globals.h:48
int value() const
Definition: FPGAWord.h:24
double rinvcut() const
Definition: Settings.h:210
int z0_shift() const
Definition: Settings.h:355
void approxtracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, bool take3, unsigned ndisks, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[4], double zproj[4], double phider[4], double zder[4], double phiprojdisk[5], double rprojdisk[5], double phiderdisk[5], double rderdisk[5])
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
unsigned int layerdisk() const
Definition: Stub.cc:185
double rapprox() const
Definition: Stub.cc:144
void setTCIndex(int index)
Definition: Tracklet.h:210
double K() const
Definition: imath.h:247
int SS_phiD_shift() const
Definition: Settings.h:368
bool debugTracklet() const
Definition: Settings.h:182
int SS_phiderD_shift() const
Definition: Settings.h:371
double kr() const
Definition: Settings.h:316
static constexpr float d0
double rmaxdisk() const
Definition: Settings.h:125
void addDiskProj(Tracklet *tracklet, int disk)
void setTrackletIndex(unsigned int index)
Definition: Tracklet.cc:796
double kd0() const
Definition: Settings.h:323
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:49
int getISeed() const
Definition: Tracklet.cc:801
int SS_phiderL_shift() const
Definition: Settings.h:363
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:87
double r() const
Definition: L1TStub.h:60
int rinv_shift() const
Definition: Settings.h:352
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
const FPGAWord & layer() const
Definition: Stub.h:67
bool usephicritapprox() const
Definition: Settings.h:236
std::string const & getName() const
Definition: ProcessBase.h:22
int SS_phiL_shift() const
Definition: Settings.h:360
bool useapprox() const
Definition: Settings.h:235
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
bool validProj(int layerdisk) const
Definition: Tracklet.h:82
constexpr int N_LAYER
Definition: Settings.h:21
double rcrit() const
Definition: Settings.h:299

Member Data Documentation

◆ disk_

int trklet::TrackletCalculatorDisplaced::disk_
protected

◆ dproj_

int trklet::TrackletCalculatorDisplaced::dproj_[N_DISK - 2]
protected

◆ innerallstubs_

std::vector<AllStubsMemory*> trklet::TrackletCalculatorDisplaced::innerallstubs_
protected

◆ iSector_

unsigned int trklet::TrackletCalculatorDisplaced::iSector_
protected

◆ iSeed_

unsigned int trklet::TrackletCalculatorDisplaced::iSeed_
protected

◆ layer_

int trklet::TrackletCalculatorDisplaced::layer_
protected

◆ lproj_

int trklet::TrackletCalculatorDisplaced::lproj_[N_LAYER - 2]
protected

◆ middleallstubs_

std::vector<AllStubsMemory*> trklet::TrackletCalculatorDisplaced::middleallstubs_
protected

◆ outerallstubs_

std::vector<AllStubsMemory*> trklet::TrackletCalculatorDisplaced::outerallstubs_
protected

◆ phimax_

double trklet::TrackletCalculatorDisplaced::phimax_
protected

◆ phimin_

double trklet::TrackletCalculatorDisplaced::phimin_
protected

◆ rproj_

double trklet::TrackletCalculatorDisplaced::rproj_[N_LAYER - 2]
protected

◆ rzmeanInv_

double trklet::TrackletCalculatorDisplaced::rzmeanInv_[N_DISK - 2]
protected

Definition at line 167 of file TrackletCalculatorDisplaced.h.

Referenced by approxtracklet(), and TrackletCalculatorDisplaced().

◆ stubtriplets_

std::vector<StubTripletsMemory*> trklet::TrackletCalculatorDisplaced::stubtriplets_
protected

Definition at line 178 of file TrackletCalculatorDisplaced.h.

Referenced by addInput(), and execute().

◆ TCIndex_

int trklet::TrackletCalculatorDisplaced::TCIndex_
protected

◆ toR_

std::vector<double> trklet::TrackletCalculatorDisplaced::toR_
protected

◆ toZ_

std::vector<double> trklet::TrackletCalculatorDisplaced::toZ_
protected

◆ trackletpars_

TrackletParametersMemory* trklet::TrackletCalculatorDisplaced::trackletpars_
protected

◆ trackletprojdisks_

std::vector<std::vector<TrackletProjectionsMemory*> > trklet::TrackletCalculatorDisplaced::trackletprojdisks_
protected

◆ trackletprojlayers_

std::vector<std::vector<TrackletProjectionsMemory*> > trklet::TrackletCalculatorDisplaced::trackletprojlayers_
protected

◆ zproj_

double trklet::TrackletCalculatorDisplaced::zproj_[N_DISK - 2]
protected

Definition at line 165 of file TrackletCalculatorDisplaced.h.

Referenced by TrackletCalculatorDisplaced().