CMS 3D CMS Logo

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

#include <L1MuBMTEtaPatternLut.h>

Public Types

typedef LUT::const_iterator ETFLut_iter
 
typedef LUT::iterator ETFLut_Iter
 
typedef std::map< short,
L1MuDTEtaPattern, std::less
< short > > 
LUT
 

Public Member Functions

ETFLut_iter begin () const
 return iterator which points to the first entry of the LUT More...
 
ETFLut_iter end () const
 return iterator which points to the one-past-last entry of the LUT More...
 
int getIgnoredLines (L1TriggerLutFile file) const
 
L1MuDTEtaPattern getPattern (int id) const
 get pattern with a given ID More...
 
 L1MuBMTEtaPatternLut ()
 constructor More...
 
int load ()
 load pattern look-up table More...
 
void print () const
 print pattern look-up table More...
 
void reset ()
 reset pattern look-up table More...
 
int size () const
 return number of entries in the LUT More...
 
virtual ~L1MuBMTEtaPatternLut ()
 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 41 of file L1MuBMTEtaPatternLut.h.

Member Typedef Documentation

typedef LUT::const_iterator L1MuBMTEtaPatternLut::ETFLut_iter

Definition at line 44 of file L1MuBMTEtaPatternLut.h.

typedef LUT::iterator L1MuBMTEtaPatternLut::ETFLut_Iter

Definition at line 45 of file L1MuBMTEtaPatternLut.h.

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

Definition at line 43 of file L1MuBMTEtaPatternLut.h.

Constructor & Destructor Documentation

L1MuBMTEtaPatternLut::L1MuBMTEtaPatternLut ( )

constructor

Definition at line 49 of file L1MuBMTEtaPatternLut.cc.

49  {
50  // if ( load() != 0 ) {
51  // cout << "Can not open files to load eta track finder look-up tables for DTTrackFinder!" << endl;
52  // }
53 
54  // if ( L1MuDTTFConfig::Debug(6) ) print();
55 }
L1MuBMTEtaPatternLut::~L1MuBMTEtaPatternLut ( )
virtual

destructor

Definition at line 61 of file L1MuBMTEtaPatternLut.cc.

61 { m_lut.clear(); }

Member Function Documentation

ETFLut_iter L1MuBMTEtaPatternLut::begin ( void  ) const
inline

return iterator which points to the first entry of the LUT

Definition at line 71 of file L1MuBMTEtaPatternLut.h.

References m_lut.

Referenced by L1MuBMEtaProcessor::runEtaTrackFinder().

71 { return m_lut.begin(); }
ETFLut_iter L1MuBMTEtaPatternLut::end ( void  ) const
inline

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

Definition at line 74 of file L1MuBMTEtaPatternLut.h.

References m_lut.

Referenced by L1MuBMEtaProcessor::runEtaTrackFinder().

74 { return m_lut.end(); }
int L1MuBMTEtaPatternLut::getIgnoredLines ( L1TriggerLutFile  file) const

Definition at line 158 of file L1MuBMTEtaPatternLut.cc.

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

158  {
159  if (file.open() != 0)
160  return -1;
161  int skip = 0;
162  while (file.good()) {
163  string str = file.readString();
164  if (str.find('#') == 0)
165  skip += 1;
166  //cout<<"here "<<str<<" found "<<str.find("#")<<endl;
167  if (!file.good()) {
168  file.close();
169  break;
170  }
171  }
172  file.close();
173  return skip;
174 }
bool good()
return status of file stream
void close()
close file
std::string readString()
read one string from file
#define str(s)
int open()
open file
L1MuDTEtaPattern L1MuBMTEtaPatternLut::getPattern ( int  id) const

get pattern with a given ID

Definition at line 149 of file L1MuBMTEtaPatternLut.cc.

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

149  {
150  LUT::const_iterator it = m_lut.find(id);
151  if (it == m_lut.end()) {
152  edm::LogError("L1MuBMTEtaPatternLut: fine eta not found")
153  << "Error: L1MuBMTEtaPatternLut: pattern not found : " << id << endl;
154  }
155  return (*it).second;
156 }
Log< level::Error, false > LogError
int L1MuBMTEtaPatternLut::load ( )

load pattern look-up table

Definition at line 75 of file L1MuBMTEtaPatternLut.cc.

References L1TriggerLutFile::close(), PVValHelper::eta, mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), L1MuDTEtaPattern::id(), L1TriggerLutFile::ignoreLines(), L1TriggerLutFile::open(), L1TriggerLutFile::readInteger(), and L1TriggerLutFile::readString().

Referenced by L1TMuonBarrelParamsHelper::configFromPy().

75  {
76  // get directory name
77  string defaultPath = "L1Trigger/";
78  string eau_dir = "L1TMuon/data/bmtf_luts/LUTs_Ass/";
79 
80  // assemble file name
81  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + eau_dir + "ETFPatternList.lut"));
82  string etf_file = lut_f.fullPath();
83 
84  // open file
85  L1TriggerLutFile file(etf_file);
86  if (file.open() != 0)
87  return -1;
88  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
89  // << file.getName() << endl;
90 
91  // ignore comment lines (always at the beginning)
92  int skip2 = getIgnoredLines(file);
93  file.ignoreLines(skip2);
94 
95  // read patterns
96  while (file.good()) {
97  int id = file.readInteger();
98  if (!file.good())
99  break;
100  string pat = file.readString();
101  if (!file.good())
102  break;
103  int qual = file.readInteger();
104  if (!file.good())
105  break;
106  int eta = file.readInteger();
107  if (!file.good())
108  break;
109  L1MuDTEtaPattern pattern(id, pat, eta, qual);
110 
111  m_lut[pattern.id()] = pattern;
112 
113  if (!file.good()) {
114  file.close();
115  break;
116  }
117  }
118 
119  file.close();
120 
121  return 0;
122 }
int getIgnoredLines(L1TriggerLutFile file) const
std::string fullPath() const
Definition: FileInPath.cc:161
void L1MuBMTEtaPatternLut::print ( void  ) const

print pattern look-up table

Definition at line 127 of file L1MuBMTEtaPatternLut.cc.

References gather_cfg::cout.

127  {
128  cout << endl;
129  cout << "L1 barrel Track Finder ETA Pattern look-up table :" << endl;
130  cout << "==================================================" << endl;
131  cout << endl;
132 
133  cout << "ETF Patterns : " << m_lut.size() << endl;
134  cout << "======================" << endl;
135  cout << endl;
136 
137  LUT::const_iterator iter = m_lut.begin();
138  while (iter != m_lut.end()) {
139  cout << (*iter).second << endl;
140  iter++;
141  }
142 
143  cout << endl;
144 }
tuple cout
Definition: gather_cfg.py:144
void L1MuBMTEtaPatternLut::reset ( void  )

reset pattern look-up table

Definition at line 70 of file L1MuBMTEtaPatternLut.cc.

70 { m_lut.clear(); }
template<class Archive >
void L1MuBMTEtaPatternLut::serialize ( Archive &  ar,
const unsigned int  version 
)
private
int L1MuBMTEtaPatternLut::size ( void  ) const
inline

return number of entries in the LUT

Definition at line 68 of file L1MuBMTEtaPatternLut.h.

References m_lut.

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

68 { return m_lut.size(); }

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 79 of file L1MuBMTEtaPatternLut.h.

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

Definition at line 79 of file L1MuBMTEtaPatternLut.h.

Member Data Documentation

LUT L1MuBMTEtaPatternLut::m_lut