CMS 3D CMS Logo

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

#include <L1MuBMTQualPatternLut.h>

Public Types

typedef LUT::iterator EMULut_iter
 
typedef std::map< LUTID, LUTCONTLUT
 
typedef std::pair< short, std::vector< short > > LUTCONT
 
typedef std::pair< short, short > LUTID
 

Public Member Functions

EMULut_iter begin ()
 return iterator which points to the first entry of the LUT More...
 
EMULut_iter end ()
 return iterator which points to the one-past-last entry of the LUT More...
 
int getCoarseEta (int sp, int adr) const
 get coarse eta value for a given sector processor [1-6] and address [1-22] More...
 
int getIgnoredLines (L1TriggerLutFile file) const
 
const std::vector< short > & getQualifiedPatterns (int sp, int adr) const
 get list of qualified patterns for a given sector processor [1-6] and address [1-22] More...
 
 L1MuBMTQualPatternLut ()
 constructor More...
 
int load ()
 load look-up tables More...
 
void print () const
 print look-up tables More...
 
void reset ()
 reset look-up tables More...
 
int size () const
 return number of entries in the LUT More...
 
virtual ~L1MuBMTQualPatternLut ()
 destructor More...
 

Public Attributes

LUT m_lut
 

Private Member Functions

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

Friends

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

Detailed Description

Definition at line 42 of file L1MuBMTQualPatternLut.h.

Member Typedef Documentation

◆ EMULut_iter

typedef LUT::iterator L1MuBMTQualPatternLut::EMULut_iter

Definition at line 47 of file L1MuBMTQualPatternLut.h.

◆ LUT

Definition at line 46 of file L1MuBMTQualPatternLut.h.

◆ LUTCONT

typedef std::pair<short, std::vector<short> > L1MuBMTQualPatternLut::LUTCONT

Definition at line 45 of file L1MuBMTQualPatternLut.h.

◆ LUTID

typedef std::pair<short, short> L1MuBMTQualPatternLut::LUTID

Definition at line 44 of file L1MuBMTQualPatternLut.h.

Constructor & Destructor Documentation

◆ L1MuBMTQualPatternLut()

L1MuBMTQualPatternLut::L1MuBMTQualPatternLut ( )

constructor

Definition at line 51 of file L1MuBMTQualPatternLut.cc.

51  {
52  // if ( load() != 0 ) {
53  // cout << "Can not open files to load eta matching look-up tables for DTTrackFinder!" << endl;
54  // }
55 
56  // if ( L1MuDTTFConfig::Debug(6) ) print();
57 }

◆ ~L1MuBMTQualPatternLut()

L1MuBMTQualPatternLut::~L1MuBMTQualPatternLut ( )
virtual

destructor

Definition at line 63 of file L1MuBMTQualPatternLut.cc.

63 {}

Member Function Documentation

◆ begin()

EMULut_iter L1MuBMTQualPatternLut::begin ( void  )
inline

return iterator which points to the first entry of the LUT

Definition at line 76 of file L1MuBMTQualPatternLut.h.

References m_lut.

76 { return m_lut.begin(); }

◆ end()

EMULut_iter L1MuBMTQualPatternLut::end ( void  )
inline

return iterator which points to the one-past-last entry of the LUT

Definition at line 79 of file L1MuBMTQualPatternLut.h.

References m_lut.

79 { return m_lut.end(); }

◆ getCoarseEta()

int L1MuBMTQualPatternLut::getCoarseEta ( int  sp,
int  adr 
) const

get coarse eta value for a given sector processor [1-6] and address [1-22]

Definition at line 174 of file L1MuBMTQualPatternLut.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

Referenced by L1MuBMEtaProcessor::print(), and L1MuBMEtaProcessor::runEtaMatchingUnit().

174  {
175  LUT::const_iterator it = m_lut.find(make_pair(sp, adr));
176  if (it == m_lut.end()) {
177  edm::LogError("L1MuBMTQualPatternLut")
178  << "Error: L1MuBMTQualPatternLut: no coarse eta found for address " << adr << endl;
179  return 0;
180  }
181  return (*it).second.first;
182 }
Log< level::Error, false > LogError

◆ getIgnoredLines()

int L1MuBMTQualPatternLut::getIgnoredLines ( L1TriggerLutFile  file) const

Definition at line 196 of file L1MuBMTQualPatternLut.cc.

References geometryDiff::file, optionsL1T::skip, and str.

196  {
197  if (file.open() != 0)
198  return -1;
199  int skip = 0;
200  while (file.good()) {
201  string str = file.readString();
202  if (str.find('#') == 0)
203  skip += 1;
204  //cout<<"here "<<str<<" found "<<str.find("#")<<endl;
205  if (!file.good()) {
206  file.close();
207  break;
208  }
209  }
210  file.close();
211 
212  // skip aditional lines of comments between "---".
213  skip += 2;
214 
215  return skip;
216 }
#define str(s)

◆ getQualifiedPatterns()

const vector< short > & L1MuBMTQualPatternLut::getQualifiedPatterns ( int  sp,
int  adr 
) const

get list of qualified patterns for a given sector processor [1-6] and address [1-22]

Definition at line 187 of file L1MuBMTQualPatternLut.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

Referenced by L1MuBMEtaProcessor::runEtaMatchingUnit().

187  {
188  LUT::const_iterator it = m_lut.find(make_pair(sp, adr));
189  if (it == m_lut.end()) {
190  edm::LogError("L1MuBMTQualPatternLut")
191  << "Error: L1MuBMTQualPatternLut: no pattern list found for address " << adr << endl;
192  }
193  return (*it).second.second;
194 }
Log< level::Error, false > LogError

◆ load()

int L1MuBMTQualPatternLut::load ( )

load look-up tables

Definition at line 77 of file L1MuBMTQualPatternLut.cc.

References PVValHelper::eta, geometryDiff::file, edm::FileInPath::fullPath(), mps_fire::i, EgammaValidation_cff::num, topSingleLeptonDQM_PU_cfi::pattern, and to_string().

Referenced by L1TMuonBarrelParamsHelper::configFromPy().

77  {
78  // get directory name
79  string defaultPath = "L1Trigger/"; //"L1TriggerConfig/DTTrackFinder/parameters/";
80  string eau_dir = "L1TMuon/data/bmtf_luts/LUTs_Ass/"; //"L1TriggerData/DTTrackFinder/Eau/";
81  string emu_str = "";
82 
83  // loop over all sector processors
84  for (int sp = 0; sp < 6; sp++) {
85  emu_str = "QualPatternList_SP" + std::to_string(sp + 1);
86 
87  // assemble file name
88  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + eau_dir + emu_str + ".lut"));
89  string emu_file = lut_f.fullPath();
90 
91  // open file
92  L1TriggerLutFile file(emu_file);
93  if (file.open() != 0)
94  return -1;
95  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
96  // << file.getName() << endl;
97 
98  // ignore comment lines
99  int skip2 = getIgnoredLines(file);
100  file.ignoreLines(skip2);
101 
102  // read file
103  while (file.good()) {
104  int id = file.readInteger();
105  if (!file.good())
106  break;
107  int eta = file.readInteger();
108  if (!file.good())
109  break;
110  int num = file.readInteger();
111  if (!file.good())
112  break;
113 
114  vector<short> patternlist;
115  patternlist.reserve(num);
116 
117  for (int i = 0; i < num; i++) {
118  int pattern = file.readInteger();
119  patternlist.push_back(pattern);
120  }
121 
122  m_lut[make_pair(sp + 1, id)] = make_pair(eta, patternlist);
123 
124  if (!file.good()) {
125  file.close();
126  break;
127  }
128  }
129 
130  file.close();
131  }
132 
133  return 0;
134 }
std::string fullPath() const
Definition: FileInPath.cc:161
static std::string to_string(const XMLCh *ch)
int getIgnoredLines(L1TriggerLutFile file) const

◆ print()

void L1MuBMTQualPatternLut::print ( void  ) const

print look-up tables

Definition at line 139 of file L1MuBMTQualPatternLut.cc.

References gather_cfg::cout, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

139  {
140  cout << endl;
141  cout << "L1 barrel Track Finder Qual Pattern look-up tables :" << endl;
142  cout << "====================================================" << endl;
143  cout << endl;
144 
145  int spold = 0;
146 
147  LUT::const_iterator iter = m_lut.begin();
148  while (iter != m_lut.end()) {
149  int sp = (*iter).first.first;
150  if (sp != spold) {
151  cout << endl;
152  cout << "Qualified Patterns for Sector Processor " << setw(1) << sp << " :" << endl;
153  cout << "===========================================" << endl;
154  cout << endl;
155  spold = sp;
156  }
157  cout << setw(2) << (*iter).first.second << " " << setw(3) << (*iter).second.first << " " << setw(5)
158  << (*iter).second.second.size() << " : ";
159  const vector<short>& patternlist = (*iter).second.second;
160  vector<short>::const_iterator it;
161  for (it = patternlist.begin(); it != patternlist.end(); it++) {
162  cout << setw(5) << (*it) << " ";
163  }
164  cout << endl;
165  iter++;
166  }
167 
168  cout << endl;
169 }

◆ reset()

void L1MuBMTQualPatternLut::reset ( void  )

reset look-up tables

Definition at line 72 of file L1MuBMTQualPatternLut.cc.

72 { m_lut.clear(); }

◆ serialize()

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

◆ size()

int L1MuBMTQualPatternLut::size ( void  ) const
inline

return number of entries in the LUT

Definition at line 73 of file L1MuBMTQualPatternLut.h.

References m_lut.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

73 { return m_lut.size(); }

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 84 of file L1MuBMTQualPatternLut.h.

◆ cond::serialization::access

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

Definition at line 84 of file L1MuBMTQualPatternLut.h.

Member Data Documentation

◆ m_lut

LUT L1MuBMTQualPatternLut::m_lut