CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
L1MuDTPhiLut Class Reference

#include <L1MuDTPhiLut.h>

Public Member Functions

int getDeltaPhi (int idx, int address) const
 get delta-phi for a given address (bend-angle) More...
 
std::pair< unsigned short, unsigned short > getPrecision () const
 get precision for look-up tables More...
 
 L1MuDTPhiLut ()
 constructor More...
 
int load ()
 load phi-assignment look-up tables More...
 
void print () const
 print phi-assignment look-up tables More...
 
void reset ()
 reset phi-assignment look-up tables More...
 
virtual ~L1MuDTPhiLut ()
 destructor More...
 

Private Types

typedef std::map< short, short, std::less< short > > LUT
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
void setPrecision ()
 set precision for look-up tables More...
 

Private Attributes

unsigned short int nbit_phi
 
unsigned short int nbit_phib
 
std::vector< LUTphi_lut
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Look-up tables for phi-assignment

Date
2007/03/30 07:48:02
Revision
1.1

N. Neumeister CERN EP

Definition at line 40 of file L1MuDTPhiLut.h.

Member Typedef Documentation

◆ LUT

typedef std::map<short, short, std::less<short> > L1MuDTPhiLut::LUT
private

Definition at line 68 of file L1MuDTPhiLut.h.

Constructor & Destructor Documentation

◆ L1MuDTPhiLut()

L1MuDTPhiLut::L1MuDTPhiLut ( )

constructor

Definition at line 51 of file L1MuDTPhiLut.cc.

51  {
52  phi_lut.reserve(2);
53  setPrecision();
54  // if ( load() != 0 ) {
55  // cout << "Can not open files to load phi-assignment look-up tables for DTTrackFinder!" << endl;
56  // }
57 
58  // if ( L1MuDTTFConfig::Debug(6) ) print();
59 }

◆ ~L1MuDTPhiLut()

L1MuDTPhiLut::~L1MuDTPhiLut ( )
virtual

destructor

Definition at line 65 of file L1MuDTPhiLut.cc.

65  {
66  vector<LUT>::iterator iter;
67  for (iter = phi_lut.begin(); iter != phi_lut.end(); iter++) {
68  (*iter).clear();
69  }
70 
71  phi_lut.clear();
72 }

Member Function Documentation

◆ getDeltaPhi()

int L1MuDTPhiLut::getDeltaPhi ( int  idx,
int  address 
) const

get delta-phi for a given address (bend-angle)

Definition at line 220 of file L1MuDTPhiLut.cc.

220  {
221  LUT::const_iterator iter = phi_lut[idx].find(address);
222  if (iter != phi_lut[idx].end()) {
223  return (*iter).second;
224  } else {
225  cerr << "PhiLut::getDeltaPhi : can not find address " << address << endl;
226  return 0;
227  }
228 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, mps_fire::end, and heavyIonCSV_trainingSettings::idx.

Referenced by L1MuDTAssignmentUnit::PhiAU().

◆ getPrecision()

pair< unsigned short, unsigned short > L1MuDTPhiLut::getPrecision ( ) const

get precision for look-up tables

Definition at line 241 of file L1MuDTPhiLut.cc.

241  {
242  return pair<unsigned short, unsigned short>(nbit_phi, nbit_phib);
243 }

◆ load()

int L1MuDTPhiLut::load ( )

load phi-assignment look-up tables

Definition at line 86 of file L1MuDTPhiLut.cc.

86  {
87  // get directory name
88  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
89  string phi_dir = "L1TriggerData/DTTrackFinder/Ass/";
90  string phi_str = "";
91 
92  // precision : in the look-up tables the following precision is used :
93  // address (phib) ...10 bits, phi ... 12 bits
94 
95  int sh_phi = 12 - nbit_phi;
96  int sh_phib = 10 - nbit_phib;
97 
98  // loop over all phi-assignment methods
99  for (int idx = 0; idx < 2; idx++) {
100  switch (idx) {
101  case 0: {
102  phi_str = "phi12";
103  break;
104  }
105  case 1: {
106  phi_str = "phi42";
107  break;
108  }
109  }
110 
111  // assemble file name
112  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + phi_dir + phi_str + ".lut"));
113  string phi_file = lut_f.fullPath();
114 
115  // open file
116  L1TriggerLutFile file(phi_file);
117  if (file.open() != 0)
118  return -1;
119  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
120  // << file.getName() << endl;
121 
122  LUT tmplut;
123 
124  int number = -1;
125  int adr_old = -512 >> sh_phib;
126  int sum_phi = 0;
127 
128  // read values
129  while (file.good()) {
130  int adr = (file.readInteger()) >> sh_phib;
131  int phi = file.readInteger();
132 
133  number++;
134 
135  if (adr != adr_old) {
136  assert(number);
137  tmplut.insert(make_pair(adr_old, ((sum_phi / number) >> sh_phi)));
138 
139  adr_old = adr;
140  number = 0;
141  sum_phi = 0;
142  }
143 
144  sum_phi += phi;
145 
146  if (!file.good())
147  file.close();
148  }
149 
150  file.close();
151  phi_lut.push_back(tmplut);
152  }
153  return 0;
154 }

References cms::cuda::assert(), FrontierConditions_GlobalTag_cff::file, edm::FileInPath::fullPath(), heavyIonCSV_trainingSettings::idx, and contentValuesFiles::number.

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), MatrixToProcess.MatrixToProcess::listAll(), and ConfigBuilder.ConfigBuilder::prepare_FILTER().

◆ print()

void L1MuDTPhiLut::print ( void  ) const

print phi-assignment look-up tables

Definition at line 159 of file L1MuDTPhiLut.cc.

159  {
160  cout << endl;
161  cout << "L1 barrel Track Finder Phi-Assignment look-up tables :" << endl;
162  cout << "======================================================" << endl;
163  cout << endl;
164  cout << "Precision : " << endl;
165  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
166  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
167 
168  // loop over all phi-assignment methods
169  for (int idx = 0; idx < 2; idx++) {
170  cout << endl;
171  if (idx == 0)
172  cout << "Phi-Assignment Method : "
173  << "PHI12" << endl;
174  if (idx == 1)
175  cout << "Phi-Assignment Method : "
176  << "PHI42" << endl;
177  cout << "=============================" << endl;
178  cout << endl;
179 
180  cout << " address";
181  for (int i = 0; i < nbit_phib; i++)
182  cout << ' ';
183  cout << " value" << endl;
184  for (int i = 0; i < nbit_phi + nbit_phib; i++)
185  cout << '-';
186  cout << "----------------------" << endl;
187 
188  LUT::const_iterator iter = phi_lut[idx].begin();
189  while (iter != phi_lut[idx].end()) {
190  int address = (*iter).first;
191  int value = (*iter).second;
192 
193  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
194  DTTFBitArray<12> b_value(static_cast<unsigned>(abs(value)));
195 
196  if (address < 0)
197  b_address.twoComplement();
198  if (value < 0)
199  b_value.twoComplement();
200 
201  cout.setf(ios::right, ios::adjustfield);
202  cout << " " << setbase(10) << setw(5) << address << " (";
203  for (int i = nbit_phib - 1; i >= 0; i--)
204  cout << b_address[i];
205  cout << ") " << setw(5) << value << " (";
206  for (int i = nbit_phi - 1; i >= 0; i--)
207  cout << b_value[i];
208  cout << ") " << endl;
209 
210  iter++;
211  }
212  }
213 
214  cout << endl;
215 }

References funct::abs(), gather_cfg::cout, mps_fire::end, mps_fire::i, heavyIonCSV_trainingSettings::idx, and DTTFBitArray< N >::twoComplement().

◆ reset()

void L1MuDTPhiLut::reset ( void  )

reset phi-assignment look-up tables

Definition at line 81 of file L1MuDTPhiLut.cc.

81 { phi_lut.clear(); }

Referenced by MatrixReader.MatrixReader::__init__(), and MatrixReader.MatrixReader::showRaw().

◆ serialize()

template<class Archive >
void L1MuDTPhiLut::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setPrecision()

void L1MuDTPhiLut::setPrecision ( )
private

set precision for look-up tables

Definition at line 233 of file L1MuDTPhiLut.cc.

233  {
234  nbit_phi = 12;
235  nbit_phib = 10;
236 }

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 75 of file L1MuDTPhiLut.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 75 of file L1MuDTPhiLut.h.

Member Data Documentation

◆ nbit_phi

unsigned short int L1MuDTPhiLut::nbit_phi
private

Definition at line 72 of file L1MuDTPhiLut.h.

◆ nbit_phib

unsigned short int L1MuDTPhiLut::nbit_phib
private

Definition at line 73 of file L1MuDTPhiLut.h.

◆ phi_lut

std::vector<LUT> L1MuDTPhiLut::phi_lut
private

Definition at line 70 of file L1MuDTPhiLut.h.

mps_fire.i
i
Definition: mps_fire.py:428
DTTFBitArray
Definition: DTTFBitArray.h:28
L1TriggerLutFile
Definition: L1TriggerLutFile.h:37
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
edm::FileInPath
Definition: FileInPath.h:64
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
mps_fire.end
end
Definition: mps_fire.py:242
L1MuDTPhiLut::setPrecision
void setPrecision()
set precision for look-up tables
Definition: L1MuDTPhiLut.cc:233
L1MuDTPhiLut::phi_lut
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:70
L1MuDTPhiLut::nbit_phib
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:73
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
value
Definition: value.py:1
DDAxes::phi
LUT
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuDTPhiLut::nbit_phi
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:72
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163