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
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 42 of file L1MuDTPhiLut.h.

Member Typedef Documentation

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

Definition at line 74 of file L1MuDTPhiLut.h.

Constructor & Destructor Documentation

L1MuDTPhiLut::L1MuDTPhiLut ( )

constructor

Definition at line 51 of file L1MuDTPhiLut.cc.

51  {
52 
53  phi_lut.reserve(2);
54  setPrecision();
55  // if ( load() != 0 ) {
56  // cout << "Can not open files to load phi-assignment look-up tables for DTTrackFinder!" << endl;
57  // }
58 
59  // if ( L1MuDTTFConfig::Debug(6) ) print();
60 
61 }
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:76
void setPrecision()
set precision for look-up tables
L1MuDTPhiLut::~L1MuDTPhiLut ( )
virtual

destructor

Definition at line 68 of file L1MuDTPhiLut.cc.

68  {
69 
70  vector<LUT>::iterator iter;
71  for ( iter = phi_lut.begin(); iter != phi_lut.end(); iter++ ) {
72  (*iter).clear();
73  }
74 
75  phi_lut.clear();
76 
77 }
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:76

Member Function Documentation

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

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

Definition at line 223 of file L1MuDTPhiLut.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, end, and customizeTrackingMonitorSeedNumber::idx.

223  {
224 
225  LUT::const_iterator iter = phi_lut[idx].find(address);
226  if ( iter != phi_lut[idx].end() ) {
227  return (*iter).second;
228  }
229  else {
230  cerr << "PhiLut::getDeltaPhi : can not find address " << address << endl;
231  return 0;
232  }
233 
234 }
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:76
#define end
Definition: vmac.h:37
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
pair< unsigned short, unsigned short > L1MuDTPhiLut::getPrecision ( ) const

get precision for look-up tables

Definition at line 251 of file L1MuDTPhiLut.cc.

251  {
252 
253  return pair<unsigned short, unsigned short>(nbit_phi,nbit_phib);
254 
255 }
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:78
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:79
int L1MuDTPhiLut::load ( )

load phi-assignment look-up tables

Definition at line 97 of file L1MuDTPhiLut.cc.

References assert(), L1TriggerLutFile::close(), mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), customizeTrackingMonitorSeedNumber::idx, contentValuesFiles::number, L1TriggerLutFile::open(), phi(), and L1TriggerLutFile::readInteger().

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

97  {
98 
99  // get directory name
100  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
101  string phi_dir = "L1TriggerData/DTTrackFinder/Ass/";
102  string phi_str = "";
103 
104  // precision : in the look-up tables the following precision is used :
105  // address (phib) ...10 bits, phi ... 12 bits
106 
107  int sh_phi = 12 - nbit_phi;
108  int sh_phib = 10 - nbit_phib;
109 
110  // loop over all phi-assignment methods
111  for ( int idx = 0; idx < 2; idx++ ) {
112  switch ( idx ) {
113  case 0 : { phi_str = "phi12"; break; }
114  case 1 : { phi_str = "phi42"; break; }
115  }
116 
117  // assemble file name
118  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + phi_dir + phi_str + ".lut"));
119  string phi_file = lut_f.fullPath();
120 
121  // open file
122  L1TriggerLutFile file(phi_file);
123  if ( file.open() != 0 ) return -1;
124  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
125  // << file.getName() << endl;
126 
127  LUT tmplut;
128 
129  int number = -1;
130  int adr_old = -512 >> sh_phib;
131  int sum_phi = 0;
132 
133  // read values
134  while ( file.good() ) {
135 
136  int adr = (file.readInteger()) >> sh_phib;
137  int phi = file.readInteger();
138 
139  number++;
140 
141  if ( adr != adr_old ) {
142  assert(number);
143  tmplut.insert(make_pair( adr_old, ((sum_phi/number) >> sh_phi) ));
144 
145  adr_old = adr;
146  number = 0;
147  sum_phi = 0;
148  }
149 
150  sum_phi += phi;
151 
152  if ( !file.good() ) file.close();
153 
154  }
155 
156  file.close();
157  phi_lut.push_back(tmplut);
158  }
159  return 0;
160 
161 }
assert(m_qm.get())
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:78
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:76
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:79
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::string fullPath() const
Definition: FileInPath.cc:165
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
void L1MuDTPhiLut::print ( void  ) const

print phi-assignment look-up tables

Definition at line 167 of file L1MuDTPhiLut.cc.

References funct::abs(), gather_cfg::cout, end, i, customizeTrackingMonitorSeedNumber::idx, DTTFBitArray< N >::twoComplement(), and relativeConstraints::value.

167  {
168 
169  cout << endl;
170  cout << "L1 barrel Track Finder Phi-Assignment look-up tables :" << endl;
171  cout << "======================================================" << endl;
172  cout << endl;
173  cout << "Precision : " << endl;
174  cout << '\t' << setw(2) << nbit_phi << " bits are used for phi " << endl;
175  cout << '\t' << setw(2) << nbit_phib << " bits are used for phib " << endl;
176 
177  // loop over all phi-assignment methods
178  for ( int idx = 0; idx < 2; idx++ ) {
179 
180  cout << endl;
181  if ( idx == 0 ) cout << "Phi-Assignment Method : " << "PHI12" << endl;
182  if ( idx == 1 ) cout << "Phi-Assignment Method : " << "PHI42" << endl;
183  cout << "=============================" << endl;
184  cout << endl;
185 
186  cout << " address";
187  for ( int i = 0; i < nbit_phib; i++ ) cout << ' ';
188  cout << " value" << endl;
189  for ( int i = 0; i < nbit_phi + nbit_phib; i++ ) cout << '-';
190  cout << "----------------------" << endl;
191 
192  LUT::const_iterator iter = phi_lut[idx].begin();
193  while ( iter != phi_lut[idx].end() ) {
194  int address = (*iter).first;
195  int value = (*iter).second;
196 
197  DTTFBitArray<10> b_address(static_cast<unsigned>(abs(address)));
198  DTTFBitArray<12> b_value(static_cast<unsigned>(abs(value)));
199 
200  if ( address < 0 ) b_address.twoComplement();
201  if ( value < 0 ) b_value.twoComplement();
202 
203  cout.setf(ios::right,ios::adjustfield);
204  cout << " " << setbase(10) << setw(5) << address << " (";
205  for ( int i = nbit_phib-1; i >= 0; i-- ) cout << b_address[i];
206  cout << ") " << setw(5) << value << " (";
207  for ( int i = nbit_phi-1; i >= 0; i-- ) cout << b_value[i];
208  cout << ") " << endl;
209 
210  iter++;
211  }
212 
213  }
214 
215  cout << endl;
216 
217 }
int i
Definition: DBlmapReader.cc:9
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:78
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:76
#define end
Definition: vmac.h:37
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:79
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple cout
Definition: gather_cfg.py:121
void L1MuDTPhiLut::reset ( void  )

reset phi-assignment look-up tables

Definition at line 87 of file L1MuDTPhiLut.cc.

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

87  {
88 
89  phi_lut.clear();
90 
91 }
std::vector< LUT > phi_lut
Definition: L1MuDTPhiLut.h:76
template<class Archive >
void L1MuDTPhiLut::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void L1MuDTPhiLut::setPrecision ( )
private

set precision for look-up tables

Definition at line 240 of file L1MuDTPhiLut.cc.

240  {
241 
242  nbit_phi = 12;
243  nbit_phib = 10;
244 
245 }
unsigned short int nbit_phi
Definition: L1MuDTPhiLut.h:78
unsigned short int nbit_phib
Definition: L1MuDTPhiLut.h:79

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 82 of file L1MuDTPhiLut.h.

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

Definition at line 82 of file L1MuDTPhiLut.h.

Member Data Documentation

unsigned short int L1MuDTPhiLut::nbit_phi
private

Definition at line 78 of file L1MuDTPhiLut.h.

unsigned short int L1MuDTPhiLut::nbit_phib
private

Definition at line 79 of file L1MuDTPhiLut.h.

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

Definition at line 76 of file L1MuDTPhiLut.h.