CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
L1MuDTPtaLut Class Reference

#include <L1MuDTPtaLut.h>

Public Member Functions

int getPt (int pta_ind, int address) const
 get pt-value for a given address More...
 
int getPtLutThreshold (int pta_ind) const
 get pt-assignment LUT threshold More...
 
 L1MuDTPtaLut ()
 constructor More...
 
int load ()
 load pt-assignment look-up tables More...
 
void print () const
 print pt-assignment look-up tables More...
 
void reset ()
 reset pt-assignment look-up tables More...
 
virtual ~L1MuDTPtaLut ()
 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
 
std::vector< LUTpta_lut
 
std::vector< int > pta_threshold
 

Friends

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

Detailed Description

Look-up tables for pt-assignment

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

N. Neumeister CERN EP

Definition at line 42 of file L1MuDTPtaLut.h.

Member Typedef Documentation

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

Definition at line 74 of file L1MuDTPtaLut.h.

Constructor & Destructor Documentation

L1MuDTPtaLut::L1MuDTPtaLut ( )

constructor

Definition at line 52 of file L1MuDTPtaLut.cc.

References MAX_PTASSMETH, pta_lut, pta_threshold, and setPrecision().

52  :
53  pta_lut(0),
55 
56  pta_lut.reserve(MAX_PTASSMETH);
57  pta_threshold.reserve(MAX_PTASSMETH/2);
58  setPrecision();
59 
60  // if ( load() != 0 ) {
61  // cout << "Can not open files to load pt-assignment look-up tables for DTTrackFinder!" << endl;
62  // }
63 
64  // if ( L1MuDTTFConfig::Debug(6) ) print();
65 
66 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:76
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:77
void setPrecision()
set precision for look-up tables
const int MAX_PTASSMETH
L1MuDTPtaLut::~L1MuDTPtaLut ( )
virtual

destructor

Definition at line 73 of file L1MuDTPtaLut.cc.

References pta_lut, and pta_threshold.

73  {
74 
75  vector<LUT>::iterator iter;
76  for ( iter = pta_lut.begin(); iter != pta_lut.end(); iter++ ) {
77  (*iter).clear();
78  }
79 
80  pta_lut.clear();
81  pta_threshold.clear();
82 
83 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:76
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:77

Member Function Documentation

int L1MuDTPtaLut::getPt ( int  pta_ind,
int  address 
) const

get pt-value for a given address

Definition at line 265 of file L1MuDTPtaLut.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, end, and pta_lut.

265  {
266 
267  LUT::const_iterator iter = pta_lut[pta_ind].find(address);
268  if ( iter != pta_lut[pta_ind].end() ) {
269  return (*iter).second;
270  }
271  else {
272  cerr << "PtaLut::getPt : can not find address " << address << endl;
273  return 0;
274  }
275 
276 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:76
#define end
Definition: vmac.h:37
int L1MuDTPtaLut::getPtLutThreshold ( int  pta_ind) const

get pt-assignment LUT threshold

Definition at line 282 of file L1MuDTPtaLut.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, MAX_PTASSMETH, and pta_threshold.

Referenced by print().

282  {
283 
284  if ( pta_ind >= 0 && pta_ind < MAX_PTASSMETH/2 ) {
285  return pta_threshold[pta_ind];
286  }
287  else {
288  cerr << "PtaLut::getPtLutThreshold : can not find threshold " << pta_ind << endl;
289  return 0;
290  }
291 
292 }
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:77
const int MAX_PTASSMETH
int L1MuDTPtaLut::load ( )

load pt-assignment look-up tables

Definition at line 104 of file L1MuDTPtaLut.cc.

References assert(), L1TriggerLutFile::close(), mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), MAX_PTASSMETH, nbit_phi, contentValuesFiles::number, L1TriggerLutFile::open(), EnergyCorrector::pt, PT12H, PT12HO, PT12L, PT12LO, PT13H, PT13HO, PT13L, PT13LO, PT14H, PT14HO, PT14L, PT14LO, PT15HO, PT15LO, PT23H, PT23HO, PT23L, PT23LO, PT24H, PT24HO, PT24L, PT24LO, PT25HO, PT25LO, PT34H, PT34HO, PT34L, PT34LO, pta_lut, pta_threshold, L1TriggerLutFile::readInteger(), edm::shift, and dtDQMClient_cfg::threshold.

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

104  {
105 
106  // get directory name
107  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
108  string pta_dir = "L1TriggerData/DTTrackFinder/Ass/";
109  string pta_str = "";
110 
111  // precision : in the look-up tables the following precision is used :
112  // phi ...12 bits (address) and pt ...5 bits
113  // now convert phi and phib to the required precision
114 
115  int sh_phi = 12 - nbit_phi;
116 
117  // loop over all pt-assignment methods
118  for ( int pam = 0; pam < MAX_PTASSMETH; pam++ ) {
119  switch ( pam ) {
120  case PT12L : { pta_str = "pta12l"; break; }
121  case PT12H : { pta_str = "pta12h"; break; }
122  case PT13L : { pta_str = "pta13l"; break; }
123  case PT13H : { pta_str = "pta13h"; break; }
124  case PT14L : { pta_str = "pta14l"; break; }
125  case PT14H : { pta_str = "pta14h"; break; }
126  case PT23L : { pta_str = "pta23l"; break; }
127  case PT23H : { pta_str = "pta23h"; break; }
128  case PT24L : { pta_str = "pta24l"; break; }
129  case PT24H : { pta_str = "pta24h"; break; }
130  case PT34L : { pta_str = "pta34l"; break; }
131  case PT34H : { pta_str = "pta34h"; break; }
132  case PT12LO : { pta_str = "pta12l_ovl"; break; }
133  case PT12HO : { pta_str = "pta12h_ovl"; break; }
134  case PT13LO : { pta_str = "pta13l_ovl"; break; }
135  case PT13HO : { pta_str = "pta13h_ovl"; break; }
136  case PT14LO : { pta_str = "pta14l_ovl"; break; }
137  case PT14HO : { pta_str = "pta14h_ovl"; break; }
138  case PT23LO : { pta_str = "pta23l_ovl"; break; }
139  case PT23HO : { pta_str = "pta23h_ovl"; break; }
140  case PT24LO : { pta_str = "pta24l_ovl"; break; }
141  case PT24HO : { pta_str = "pta24h_ovl"; break; }
142  case PT34LO : { pta_str = "pta34l_ovl"; break; }
143  case PT34HO : { pta_str = "pta34h_ovl"; break; }
144  case PT15LO : { pta_str = "pta15l_ovl"; break; }
145  case PT15HO : { pta_str = "pta15h_ovl"; break; }
146  case PT25LO : { pta_str = "pta25l_ovl"; break; }
147  case PT25HO : { pta_str = "pta25h_ovl"; break; }
148  }
149 
150  // assemble file name
151  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + pta_dir + pta_str + ".lut"));
152  string pta_file = lut_f.fullPath();
153 
154  // open file
155  L1TriggerLutFile file(pta_file);
156  if ( file.open() != 0 ) return -1;
157  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
158  // << file.getName() << endl;
159 
160  // get the right shift factor
161  int shift = sh_phi;
162  int adr_old = -2048 >> shift;
163 
164  LUT tmplut;
165 
166  int number = -1;
167  int sum_pt = 0;
168 
169  if ( file.good() ) {
170  int threshold = file.readInteger();
171  pta_threshold[pam/2] = threshold;
172  }
173 
174  // read values and shift to correct precision
175  while ( file.good() ) {
176 
177  int adr = (file.readInteger()) >> shift;
178  int pt = file.readInteger();
179 
180  number++;
181 
182  if ( adr != adr_old ) {
183  assert(number);
184  tmplut.insert(make_pair( adr_old, (sum_pt/number) ));
185 
186  adr_old = adr;
187  number = 0;
188  sum_pt = 0;
189  }
190 
191  sum_pt += pt;
192 
193  if ( !file.good() ) file.close();
194 
195  }
196 
197  file.close();
198  pta_lut.push_back(tmplut);
199  }
200  return 0;
201 
202 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:76
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:77
assert(m_qm.get())
unsigned short int nbit_phi
Definition: L1MuDTPtaLut.h:79
static unsigned int const shift
std::string fullPath() const
Definition: FileInPath.cc:165
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
const int MAX_PTASSMETH
void L1MuDTPtaLut::print ( void  ) const

print pt-assignment look-up tables

Definition at line 208 of file L1MuDTPtaLut.cc.

References funct::abs(), gather_cfg::cout, end, getPtLutThreshold(), i, MAX_PTASSMETH, nbit_phi, DTTFBitArray< N >::print(), pta_lut, DTTFBitArray< N >::twoComplement(), and relativeConstraints::value.

208  {
209 
210  cout << endl;
211  cout << "L1 barrel Track Finder Pt-Assignment look-up tables :" << endl;
212  cout << "=====================================================" << endl;
213  cout << endl;
214  cout << "Precision : " << endl;
215  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
216 
217  // loop over all pt-assignment methods
218  for ( int pam = 0; pam < MAX_PTASSMETH; pam++ ) {
219 
220  cout << endl;
221  cout << "Pt-Assignment Method : " << static_cast<PtAssMethod>(pam) << endl;
222  cout << "============================" << endl;
223  cout << endl;
224 
225  cout << "\t Threshold : " << getPtLutThreshold(pam/2) << endl << endl;
226 
227  int maxbits = nbit_phi;
228 
229  cout << " address";
230  for ( int i = 0; i < maxbits; i++ ) cout << ' ';
231  cout << " value" << endl;
232  for ( int i = 0; i < maxbits; i++ ) cout << '-';
233  cout << "-------------------------" << endl;
234 
235  LUT::const_iterator iter = pta_lut[pam].begin();
236  while ( iter != pta_lut[pam].end() ) {
237  int address = (*iter).first;
238  int value = (*iter).second;
239 
240  DTTFBitArray<12> b_address(static_cast<unsigned>(abs(address)));
241  DTTFBitArray<5> b_value(static_cast<unsigned>(abs(value)));
242 
243  if ( address < 0 ) b_address.twoComplement();
244 
245  cout.setf(ios::right,ios::adjustfield);
246  cout << " " << setbase(10) << setw(5) << address << " (";
247  for ( int i = maxbits-1; i >= 0; i-- ) cout << b_address[i];
248  cout << ") " << setw(3) << value << " (";
249  b_value.print();
250  cout << ")" << endl;
251 
252  iter++;
253  }
254 
255  }
256 
257  cout << endl;
258 
259 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:76
int i
Definition: DBlmapReader.cc:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:37
unsigned short int nbit_phi
Definition: L1MuDTPtaLut.h:79
tuple cout
Definition: gather_cfg.py:121
int getPtLutThreshold(int pta_ind) const
get pt-assignment LUT threshold
const int MAX_PTASSMETH
PtAssMethod
void L1MuDTPtaLut::reset ( void  )

reset pt-assignment look-up tables

Definition at line 93 of file L1MuDTPtaLut.cc.

References pta_lut, and pta_threshold.

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

93  {
94 
95  pta_lut.clear();
96  pta_threshold.clear();
97 
98 }
std::vector< LUT > pta_lut
Definition: L1MuDTPtaLut.h:76
std::vector< int > pta_threshold
Definition: L1MuDTPtaLut.h:77
template<class Archive >
void L1MuDTPtaLut::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void L1MuDTPtaLut::setPrecision ( )
private

set precision for look-up tables

Definition at line 298 of file L1MuDTPtaLut.cc.

References nbit_phi.

Referenced by L1MuDTPtaLut().

298  {
299 
300  nbit_phi = 12;
301 
302 }
unsigned short int nbit_phi
Definition: L1MuDTPtaLut.h:79

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 82 of file L1MuDTPtaLut.h.

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

Definition at line 82 of file L1MuDTPtaLut.h.

Member Data Documentation

unsigned short int L1MuDTPtaLut::nbit_phi
private

Definition at line 79 of file L1MuDTPtaLut.h.

Referenced by load(), print(), and setPrecision().

std::vector<LUT> L1MuDTPtaLut::pta_lut
private

Definition at line 76 of file L1MuDTPtaLut.h.

Referenced by getPt(), L1MuDTPtaLut(), load(), print(), reset(), and ~L1MuDTPtaLut().

std::vector<int> L1MuDTPtaLut::pta_threshold
private

Definition at line 77 of file L1MuDTPtaLut.h.

Referenced by getPtLutThreshold(), L1MuDTPtaLut(), load(), reset(), and ~L1MuDTPtaLut().