CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
DTSC Class Reference

#include <DTSC.h>

Classes

class  h
 

Public Member Functions

void addDTSectCollPhCand (DTSectCollPhCand *cand)
 Add a Sector Collector. More...
 
void addPhCand (DTSectCollPhCand *cand)
 Add a TSM candidate to the Sect Coll, ifs is first/second track flag. More...
 
void addThCand (DTSectCollThCand *cand)
 Add a Theta candidate to sect coll. More...
 
void clear ()
 Clear. More...
 
const DTConfigSectCollconfig () const
 Configuration set. More...
 
 DTSC (int istat)
 Constructor. More...
 
DTSectCollPhCandDTSectCollsort1 ()
 Phi Sort 1. More...
 
DTSectCollPhCandDTSectCollsort2 ()
 Phi Sort 2. More...
 
DTSectCollPhCandgetDTSectCollPhCand (int ifs, unsigned n) const
 Return requested TSS candidate. More...
 
DTSectCollThCandgetDTSectCollThCand (unsigned n) const
 Return requested Theta candidate. More...
 
DTSectCollPhCandgetTrackPh (int n) const
 Return the requested Phi track. More...
 
DTSectCollThCandgetTrackTh (int n) const
 Return the requested Theta track. More...
 
void ignoreSecondTrack ()
 Set a flag to skip sort2. More...
 
unsigned nCandPh (int ifs) const
 Return the number of Phi input tracks (first/second) More...
 
unsigned nCandTh () const
 Return the number of Theta input tracks. More...
 
int nFirstTPh () const
 Return the number of input first tracks. More...
 
int nSecondTPh () const
 Return the number of input second tracks. More...
 
int nTracksPh () const
 Return the number of output Phi tracks. More...
 
int nTracksTh () const
 Return the number of output Theta tracks. More...
 
void run ()
 Run the Sector Collector algorithm. More...
 
void setConfig (const DTConfigSectColl *conf)
 Set configuration. More...
 
 ~DTSC ()
 Destructor. More...
 

Private Attributes

std::vector< DTSectCollThCand * > _cand_th
 
const DTConfigSectColl_config
 
int _ignoreSecondTrack
 
std::vector< DTSectCollPhCand * > _incand_ph [2]
 
std::vector< DTSectCollPhCand * > _outcand_ph
 
int _stat
 

Detailed Description

Definition at line 41 of file DTSC.h.

Constructor & Destructor Documentation

◆ DTSC()

DTSC::DTSC ( int  istat)

Constructor.

Definition at line 41 of file DTSC.cc.

41  : _ignoreSecondTrack(0), _stat(istat) {
42  // reserve the appropriate amount of space for vectors
43  // test _incand[0].reserve(DTConfigSectColl::NTSMSC);
44  // test_incand[1].reserve(DTConfigSectColl::NTSMSC);
45  // test _outcand.reserve(2);
46 }
int _stat
Definition: DTSC.h:131
int _ignoreSecondTrack
Definition: DTSC.h:128

◆ ~DTSC()

DTSC::~DTSC ( )

Destructor.

Definition at line 51 of file DTSC.cc.

References clear().

51 { clear(); }
void clear()
Clear.
Definition: DTSC.cc:57

Member Function Documentation

◆ addDTSectCollPhCand()

void DTSC::addDTSectCollPhCand ( DTSectCollPhCand cand)

Add a Sector Collector.

Definition at line 238 of file DTSC.cc.

References _incand_ph.

Referenced by DTSectColl::addTSPhi().

238  {
239  int ifs = (cand->isFirst()) ? 0 : 1;
240 
241  _incand_ph[ifs].push_back(cand);
242 }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119

◆ addPhCand()

void DTSC::addPhCand ( DTSectCollPhCand cand)

Add a TSM candidate to the Sect Coll, ifs is first/second track flag.

Definition at line 196 of file DTSC.cc.

References _incand_ph, and push_back().

196 { _incand_ph[(1 - cand->isFirst())].push_back(cand); }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})

◆ addThCand()

void DTSC::addThCand ( DTSectCollThCand cand)

Add a Theta candidate to sect coll.

Definition at line 198 of file DTSC.cc.

References _cand_th.

Referenced by DTSectColl::addTSTheta().

198 { _cand_th.push_back(cand); }
std::vector< DTSectCollThCand * > _cand_th
Definition: DTSC.h:125

◆ clear()

void DTSC::clear ( void  )

Clear.

Definition at line 57 of file DTSC.cc.

References _cand_th, _ignoreSecondTrack, _incand_ph, and _outcand_ph.

Referenced by DTSectColl::localClear(), and ~DTSC().

57  {
59 
60  for (int itk = 0; itk <= 1; itk++) {
61  _incand_ph[itk].clear();
62  }
63 
64  _outcand_ph.clear();
65  _cand_th.clear();
66 }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119
std::vector< DTSectCollThCand * > _cand_th
Definition: DTSC.h:125
std::vector< DTSectCollPhCand * > _outcand_ph
Definition: DTSC.h:122
int _ignoreSecondTrack
Definition: DTSC.h:128

◆ config()

const DTConfigSectColl* DTSC::config ( void  ) const
inline

Configuration set.

Definition at line 82 of file DTSC.h.

References _config.

Referenced by DTSectCollThCand::config(), DTSectCollPhCand::config(), DTSectCollsort1(), and run().

82 { return _config; }
const DTConfigSectColl * _config
Definition: DTSC.h:116

◆ DTSectCollsort1()

DTSectCollPhCand * DTSC::DTSectCollsort1 ( )

Phi Sort 1.

Definition at line 122 of file DTSC.cc.

References _incand_ph, _stat, config(), AlCaHLTBitMon_ParallelJobs::p, DTSectCollPhCand::setBitsSectColl(), and DTSectCollPhCand::setSecondTrack().

Referenced by run().

122  {
123  // Do a sort 1
124  DTSectCollPhCand* best = nullptr;
125  DTSectCollPhCand* carry = nullptr;
126  std::vector<DTSectCollPhCand*>::iterator p;
127  for (p = _incand_ph[0].begin(); p != _incand_ph[0].end(); p++) {
128  DTSectCollPhCand* curr = (*p);
129 
130  curr->setBitsSectColl(); // SM sector collector set bits in dataword to make SC sorting
131 
132  // NO Carry in Sector Collector sorting in default
133  if (config()->SCGetCarryFlag(_stat)) { // get carry
134 
135  if (best == nullptr) {
136  best = curr;
137  } else if ((*curr) < (*best)) {
138  carry = best;
139  best = curr;
140  } else if (carry == nullptr) {
141  carry = curr;
142  } else if ((*curr) < (*carry)) {
143  carry = curr;
144  }
145 
146  } else if (config()->SCGetCarryFlag(_stat) == 0) { // no carry (default)
147  if (best == nullptr) {
148  best = curr;
149  } else if ((*curr) < (*best)) {
150  best = curr;
151  }
152  }
153 
154  if (carry != nullptr && config()->SCGetCarryFlag(_stat)) { // reassign carry to sort 2 candidates
155  carry->setSecondTrack(); // change value of 1st/2nd track bit
156  _incand_ph[1].push_back(carry); // add to list of 2nd track
157  }
158  }
159 
160  return best;
161 }
const DTConfigSectColl * config() const
Configuration set.
Definition: DTSC.h:82
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119
int _stat
Definition: DTSC.h:131
void setBitsSectColl()
Set the bits for DTTSM analysis.
void setSecondTrack()
Set the first track bit to second track (used for carry)

◆ DTSectCollsort2()

DTSectCollPhCand * DTSC::DTSectCollsort2 ( )

Phi Sort 2.

Definition at line 163 of file DTSC.cc.

References _ignoreSecondTrack, _incand_ph, gather_cfg::cout, nTracksPh(), AlCaHLTBitMon_ParallelJobs::p, edm::second(), and DTSectCollPhCand::setBitsSectColl().

Referenced by run().

163  {
164  // Check if there are second tracks
165 
166  if (nTracksPh() < 1) {
167  std::cout << "DTSC::DTSectCollsort2: called with no first Phi track.";
168  std::cout << " empty pointer returned!" << std::endl;
169  return nullptr;
170  }
171  // If a first track at the following BX is present, ignore second tracks of any kind
172  if (_ignoreSecondTrack) {
173  for (std::vector<DTSectCollPhCand*>::iterator p = _incand_ph[1].begin(); p != _incand_ph[1].end(); p++) {
174  }
175  return nullptr;
176  }
177 
178  // If no first tracks at the following BX, do a sort 2
179  // DTSectCollCand* best=getTrack(1); ! not needed as lons as there is no comparison with best in sort 2
180  DTSectCollPhCand* second = nullptr;
181  std::vector<DTSectCollPhCand*>::iterator p;
182  for (p = _incand_ph[1].begin(); p != _incand_ph[1].end(); p++) {
183  DTSectCollPhCand* curr = (*p);
184  curr->setBitsSectColl(); // SM sector collector set bits in dataword to make SC sorting
185 
186  if (second == nullptr) {
187  second = curr;
188  } else if ((*curr) < (*second)) {
189  second = curr;
190  }
191  }
192 
193  return second;
194 }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119
int nTracksPh() const
Return the number of output Phi tracks.
Definition: DTSC.h:103
void setBitsSectColl()
Set the bits for DTTSM analysis.
U second(std::pair< T, U > const &p)
int _ignoreSecondTrack
Definition: DTSC.h:128

◆ getDTSectCollPhCand()

DTSectCollPhCand * DTSC::getDTSectCollPhCand ( int  ifs,
unsigned  n 
) const

Return requested TSS candidate.

Definition at line 211 of file DTSC.cc.

References _incand_ph, gather_cfg::cout, dqmiodumpmetadata::n, nCandPh(), and AlCaHLTBitMon_ParallelJobs::p.

211  {
212  if (ifs < 1 || ifs > 2) {
213  std::cout << "DTSC::getDTSectCollPhCand: wrong track number: " << ifs;
214  std::cout << " empty pointer returned!" << std::endl;
215  return nullptr;
216  }
217  if (n < 1 || n > nCandPh(ifs)) {
218  std::cout << "DTSC::getDTSectCollPhCand: requested trigger not present: " << n;
219  std::cout << " empty pointer returned!" << std::endl;
220  return nullptr;
221  }
222 
223  std::vector<DTSectCollPhCand*>::const_iterator p = _incand_ph[ifs - 1].begin() + n - 1;
224  return (*p);
225 }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119
unsigned nCandPh(int ifs) const
Return the number of Phi input tracks (first/second)
Definition: DTSC.cc:200

◆ getDTSectCollThCand()

DTSectCollThCand * DTSC::getDTSectCollThCand ( unsigned  n) const

Return requested Theta candidate.

Definition at line 227 of file DTSC.cc.

References _cand_th, gather_cfg::cout, dqmiodumpmetadata::n, nCandTh(), and AlCaHLTBitMon_ParallelJobs::p.

227  {
228  if (n < 1 || n > nCandTh()) {
229  std::cout << "DTSC::getDTSectCollThCand: requested trigger not present: " << n;
230  std::cout << " empty pointer returned!" << std::endl;
231  return nullptr;
232  }
233 
234  std::vector<DTSectCollThCand*>::const_iterator p = _cand_th.begin() + n - 1;
235  return (*p);
236 }
std::vector< DTSectCollThCand * > _cand_th
Definition: DTSC.h:125
unsigned nCandTh() const
Return the number of Theta input tracks.
Definition: DTSC.cc:209

◆ getTrackPh()

DTSectCollPhCand * DTSC::getTrackPh ( int  n) const

Return the requested Phi track.

Definition at line 244 of file DTSC.cc.

References _outcand_ph, gather_cfg::cout, dqmiodumpmetadata::n, nTracksPh(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by DTSectColl::runSectColl().

244  {
245  if (n < 1 || n > nTracksPh()) {
246  std::cout << "DTSC::getTrackPh: requested track not present: " << n;
247  std::cout << " empty pointer returned!" << std::endl;
248  return nullptr;
249  }
250 
251  std::vector<DTSectCollPhCand*>::const_iterator p = _outcand_ph.begin() + n - 1;
252 
253  return (*p);
254 }
int nTracksPh() const
Return the number of output Phi tracks.
Definition: DTSC.h:103
std::vector< DTSectCollPhCand * > _outcand_ph
Definition: DTSC.h:122

◆ getTrackTh()

DTSectCollThCand * DTSC::getTrackTh ( int  n) const

Return the requested Theta track.

Definition at line 256 of file DTSC.cc.

References _cand_th, gather_cfg::cout, dqmiodumpmetadata::n, nTracksTh(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by DTSectColl::runSectColl().

256  {
257  if (n < 1 || n > nTracksTh()) {
258  std::cout << "DTSC::getTrackTh: requested track not present: " << n;
259  std::cout << " empty pointer returned!" << std::endl;
260  return nullptr;
261  }
262 
263  std::vector<DTSectCollThCand*>::const_iterator p = _cand_th.begin() + n - 1;
264 
265  return (*p);
266 }
std::vector< DTSectCollThCand * > _cand_th
Definition: DTSC.h:125
int nTracksTh() const
Return the number of output Theta tracks.
Definition: DTSC.h:106

◆ ignoreSecondTrack()

void DTSC::ignoreSecondTrack ( )
inline

Set a flag to skip sort2.

Definition at line 65 of file DTSC.h.

References _ignoreSecondTrack.

65 { _ignoreSecondTrack = 1; }
int _ignoreSecondTrack
Definition: DTSC.h:128

◆ nCandPh()

unsigned DTSC::nCandPh ( int  ifs) const

Return the number of Phi input tracks (first/second)

Definition at line 200 of file DTSC.cc.

References _incand_ph, and gather_cfg::cout.

Referenced by getDTSectCollPhCand().

200  {
201  if (ifs < 1 || ifs > 2) {
202  std::cout << "DTSC::nCandPh: wrong track number: " << ifs;
203  std::cout << " 0 returned!" << std::endl;
204  return 0;
205  }
206  return _incand_ph[ifs - 1].size();
207 }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119

◆ nCandTh()

unsigned DTSC::nCandTh ( ) const

Return the number of Theta input tracks.

Definition at line 209 of file DTSC.cc.

References _cand_th.

Referenced by getDTSectCollThCand(), and run().

209 { return _cand_th.size(); }
std::vector< DTSectCollThCand * > _cand_th
Definition: DTSC.h:125

◆ nFirstTPh()

int DTSC::nFirstTPh ( ) const
inline

Return the number of input first tracks.

Definition at line 91 of file DTSC.h.

References _incand_ph.

Referenced by run().

91 { return _incand_ph[0].size(); }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119

◆ nSecondTPh()

int DTSC::nSecondTPh ( ) const
inline

Return the number of input second tracks.

Definition at line 94 of file DTSC.h.

References _incand_ph.

Referenced by run().

94 { return _incand_ph[1].size(); }
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119

◆ nTracksPh()

int DTSC::nTracksPh ( ) const
inline

Return the number of output Phi tracks.

Definition at line 103 of file DTSC.h.

References _outcand_ph.

Referenced by DTSectCollsort2(), and getTrackPh().

103 { return _outcand_ph.size(); }
std::vector< DTSectCollPhCand * > _outcand_ph
Definition: DTSC.h:122

◆ nTracksTh()

int DTSC::nTracksTh ( ) const
inline

Return the number of output Theta tracks.

Definition at line 106 of file DTSC.h.

References _cand_th.

Referenced by getTrackTh().

106 { return _cand_th.size(); }
std::vector< DTSectCollThCand * > _cand_th
Definition: DTSC.h:125

◆ run()

void DTSC::run ( )

Run the Sector Collector algorithm.

Definition at line 69 of file DTSC.cc.

References _incand_ph, _outcand_ph, config(), gather_cfg::cout, debug, DTSectCollsort1(), DTSectCollsort2(), dqmdumpme::first, nCandTh(), nFirstTPh(), nSecondTPh(), AlCaHLTBitMon_ParallelJobs::p, and edm::second().

Referenced by DTSectColl::runSectColl().

69  {
70  if (config()->debug()) {
71  std::cout << "DTSC::run: Processing DTSectColl: ";
72  std::cout << nFirstTPh() << " first & " << nSecondTPh() << " second Phi tracks ";
73  std::cout << " - " << nCandTh() << " Theta tracks" << std::endl;
74  }
75 
76  if (nFirstTPh() < 1)
77  return; // skip if no first tracks
78  //
79  // SORT 1
80  //
81 
82  // debugging
83  if (config()->debug()) {
84  std::cout << "Vector of first Phi tracks in DTSectColl: " << std::endl;
85  std::vector<DTSectCollPhCand*>::const_iterator p;
86  for (p = _incand_ph[0].begin(); p != _incand_ph[0].end(); p++) {
87  (*p)->print();
88  }
89  }
90  // end debugging
91 
93  if (config()->debug()) {
94  std::cout << "SC: DTSC::run: first Phi track is = " << first << std::endl;
95  }
96  if (first != nullptr) {
97  _outcand_ph.push_back(first);
98  }
99  if (nSecondTPh() < 1)
100  return; // skip if no second tracks
101 
102  //
103  // SORT 2
104  //
105 
106  // debugging
107  if (config()->debug()) {
108  std::vector<DTSectCollPhCand*>::const_iterator p;
109  std::cout << "Vector of second Phi tracks in DTSectColl: " << std::endl;
110  for (p = _incand_ph[1].begin(); p != _incand_ph[1].end(); p++) {
111  (*p)->print();
112  }
113  }
114  // end debugging
115 
117  if (second != nullptr) {
118  _outcand_ph.push_back(second);
119  }
120 }
const DTConfigSectColl * config() const
Configuration set.
Definition: DTSC.h:82
std::vector< DTSectCollPhCand * > _incand_ph[2]
Definition: DTSC.h:119
DTSectCollPhCand * DTSectCollsort2()
Phi Sort 2.
Definition: DTSC.cc:163
U second(std::pair< T, U > const &p)
unsigned nCandTh() const
Return the number of Theta input tracks.
Definition: DTSC.cc:209
std::vector< DTSectCollPhCand * > _outcand_ph
Definition: DTSC.h:122
int nFirstTPh() const
Return the number of input first tracks.
Definition: DTSC.h:91
#define debug
Definition: HDRShower.cc:19
DTSectCollPhCand * DTSectCollsort1()
Phi Sort 1.
Definition: DTSC.cc:122
int nSecondTPh() const
Return the number of input second tracks.
Definition: DTSC.h:94

◆ setConfig()

void DTSC::setConfig ( const DTConfigSectColl conf)
inline

Set configuration.

Definition at line 52 of file DTSC.h.

References _config.

Referenced by DTSectColl::setConfig().

52 { _config = conf; };
const DTConfigSectColl * _config
Definition: DTSC.h:116

Member Data Documentation

◆ _cand_th

std::vector<DTSectCollThCand*> DTSC::_cand_th
private

Definition at line 125 of file DTSC.h.

Referenced by addThCand(), clear(), getDTSectCollThCand(), getTrackTh(), nCandTh(), and nTracksTh().

◆ _config

const DTConfigSectColl* DTSC::_config
private

Definition at line 116 of file DTSC.h.

Referenced by config(), and setConfig().

◆ _ignoreSecondTrack

int DTSC::_ignoreSecondTrack
private

Definition at line 128 of file DTSC.h.

Referenced by clear(), DTSectCollsort2(), and ignoreSecondTrack().

◆ _incand_ph

std::vector<DTSectCollPhCand*> DTSC::_incand_ph[2]
private

◆ _outcand_ph

std::vector<DTSectCollPhCand*> DTSC::_outcand_ph
private

Definition at line 122 of file DTSC.h.

Referenced by clear(), getTrackPh(), nTracksPh(), and run().

◆ _stat

int DTSC::_stat
private

Definition at line 131 of file DTSC.h.

Referenced by plotting.Plot::_setStats(), and DTSectCollsort1().