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 44 of file L1MuBMTQualPatternLut.h.

Member Typedef Documentation

typedef LUT::iterator L1MuBMTQualPatternLut::EMULut_iter

Definition at line 51 of file L1MuBMTQualPatternLut.h.

Definition at line 50 of file L1MuBMTQualPatternLut.h.

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

Definition at line 49 of file L1MuBMTQualPatternLut.h.

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

Definition at line 48 of file L1MuBMTQualPatternLut.h.

Constructor & Destructor Documentation

L1MuBMTQualPatternLut::L1MuBMTQualPatternLut ( )

constructor

Definition at line 51 of file L1MuBMTQualPatternLut.cc.

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

destructor

Definition at line 66 of file L1MuBMTQualPatternLut.cc.

66  {
67 
68 }

Member Function Documentation

EMULut_iter L1MuBMTQualPatternLut::begin ( void  )
inline

return iterator which points to the first entry of the LUT

Definition at line 80 of file L1MuBMTQualPatternLut.h.

References m_lut.

80 { return m_lut.begin(); }
EMULut_iter L1MuBMTQualPatternLut::end ( void  )
inline

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

Definition at line 83 of file L1MuBMTQualPatternLut.h.

References m_lut.

83 { return m_lut.end(); }
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 188 of file L1MuBMTQualPatternLut.cc.

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

188  {
189 
190  LUT::const_iterator it = m_lut.find(make_pair(sp,adr));
191  if ( it == m_lut.end() ) {
192  edm::LogError ("L1MuBMTQualPatternLut") << "Error: L1MuBMTQualPatternLut: no coarse eta found for address " << adr << endl;
193  return 0;
194  }
195  return (*it).second.first;
196 
197 }
int L1MuBMTQualPatternLut::getIgnoredLines ( L1TriggerLutFile  file) const

Definition at line 213 of file L1MuBMTQualPatternLut.cc.

References L1TriggerLutFile::close(), L1TriggerLutFile::good(), L1TriggerLutFile::open(), L1TriggerLutFile::readString(), createPayload::skip, and harvestTrackValidationPlots::str.

213  {
214  if ( file.open() != 0 ) return -1;
215  int skip=0;
216  while ( file.good() ) {
217 
218  string str=file.readString();
219  if (str.find("#")==0) skip+=1;
220  //cout<<"here "<<str<<" found "<<str.find("#")<<endl;
221  if ( !file.good() ) { file.close(); break; }
222  }
223  file.close();
224 
225  // skip aditional lines of comments between "---".
226  skip += 2;
227 
228  return skip;
229 }
bool good()
return status of file stream
void close()
close file
std::string readString()
read one string from file
int open()
open file
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 203 of file L1MuBMTQualPatternLut.cc.

Referenced by L1MuBMEtaProcessor::runEtaMatchingUnit().

203  {
204 
205  LUT::const_iterator it = m_lut.find(make_pair(sp,adr));
206  if ( it == m_lut.end() ) {
207  edm::LogError ("L1MuBMTQualPatternLut") << "Error: L1MuBMTQualPatternLut: no pattern list found for address " << adr << endl;
208  }
209  return (*it).second.second;
210 
211 }
int L1MuBMTQualPatternLut::load ( )

load look-up tables

Definition at line 88 of file L1MuBMTQualPatternLut.cc.

References L1TriggerLutFile::close(), PVValHelper::eta, FrontierConditions_GlobalTag_cff::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), mps_fire::i, L1TriggerLutFile::ignoreLines(), pileupDistInMC::num, L1TriggerLutFile::open(), listBenchmarks::pattern, and L1TriggerLutFile::readInteger().

Referenced by L1TMuonBarrelParamsHelper::configFromPy().

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

print look-up tables

Definition at line 149 of file L1MuBMTQualPatternLut.cc.

References gather_cfg::cout.

149  {
150 
151  cout << endl;
152  cout << "L1 barrel Track Finder Qual Pattern look-up tables :" << endl;
153  cout << "====================================================" << endl;
154  cout << endl;
155 
156  int spold = 0;
157 
158  LUT::const_iterator iter = m_lut.begin();
159  while ( iter != m_lut.end() ) {
160  int sp = (*iter).first.first;
161  if ( sp != spold ) {
162  cout << endl;
163  cout << "Qualified Patterns for Sector Processor " << setw(1) << sp << " :" << endl;
164  cout << "===========================================" << endl;
165  cout << endl;
166  spold = sp;
167  }
168  cout << setw(2) << (*iter).first.second << " "
169  << setw(3) << (*iter).second.first << " "
170  << setw(5) << (*iter).second.second.size() << " : ";
171  const vector<short>& patternlist = (*iter).second.second;
172  vector<short>::const_iterator it;
173  for ( it = patternlist.begin(); it != patternlist.end(); it++ ) {
174  cout << setw(5) << (*it) << " ";
175  }
176  cout << endl;
177  iter++;
178  }
179 
180  cout << endl;
181 
182 }
void L1MuBMTQualPatternLut::reset ( void  )

reset look-up tables

Definition at line 78 of file L1MuBMTQualPatternLut.cc.

78  {
79 
80  m_lut.clear();
81 
82 }
template<class Archive >
void L1MuBMTQualPatternLut::serialize ( Archive &  ar,
const unsigned int  version 
)
private
int L1MuBMTQualPatternLut::size ( void  ) const
inline

return number of entries in the LUT

Definition at line 77 of file L1MuBMTQualPatternLut.h.

References m_lut.

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

77 { return m_lut.size(); }

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 90 of file L1MuBMTQualPatternLut.h.

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

Definition at line 90 of file L1MuBMTQualPatternLut.h.

Member Data Documentation

LUT L1MuBMTQualPatternLut::m_lut