CMS 3D CMS Logo

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

Member Typedef Documentation

typedef LUT::const_iterator L1MuBMTEtaPatternLut::ETFLut_iter

Definition at line 47 of file L1MuBMTEtaPatternLut.h.

typedef LUT::iterator L1MuBMTEtaPatternLut::ETFLut_Iter

Definition at line 48 of file L1MuBMTEtaPatternLut.h.

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

Definition at line 46 of file L1MuBMTEtaPatternLut.h.

Constructor & Destructor Documentation

L1MuBMTEtaPatternLut::L1MuBMTEtaPatternLut ( )

constructor

Definition at line 49 of file L1MuBMTEtaPatternLut.cc.

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

destructor

Definition at line 64 of file L1MuBMTEtaPatternLut.cc.

64  {
65 
66  m_lut.clear();
67 
68 }

Member Function Documentation

ETFLut_iter L1MuBMTEtaPatternLut::begin ( void  ) const
inline

return iterator which points to the first entry of the LUT

Definition at line 74 of file L1MuBMTEtaPatternLut.h.

References m_lut.

Referenced by L1MuBMEtaProcessor::runEtaTrackFinder().

74 { 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 77 of file L1MuBMTEtaPatternLut.h.

References m_lut.

Referenced by L1MuBMEtaProcessor::runEtaTrackFinder().

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

Definition at line 172 of file L1MuBMTEtaPatternLut.cc.

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

172  {
173  if ( file.open() != 0 ) return -1;
174  int skip=0;
175  while ( file.good() ) {
176 
177  string str=file.readString();
178  if (str.find("#")==0) skip+=1;
179  //cout<<"here "<<str<<" found "<<str.find("#")<<endl;
180  if ( !file.good() ) { file.close(); break; }
181  }
182  file.close();
183  return skip;
184 }
bool good()
return status of file stream
void close()
close file
std::string readString()
read one string from file
int open()
open file
L1MuDTEtaPattern L1MuBMTEtaPatternLut::getPattern ( int  id) const

get pattern with a given ID

Definition at line 162 of file L1MuBMTEtaPatternLut.cc.

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

162  {
163 
164  LUT::const_iterator it = m_lut.find(id);
165  if ( it == m_lut.end() ) {
166  edm::LogError ("L1MuBMTEtaPatternLut: fine eta not found") << "Error: L1MuBMTEtaPatternLut: pattern not found : " << id << endl;
167  }
168  return (*it).second;
169 
170 }
int L1MuBMTEtaPatternLut::load ( )

load pattern look-up table

Definition at line 88 of file L1MuBMTEtaPatternLut.cc.

References L1TriggerLutFile::close(), stringResolutionProvider_cfi::eta, FrontierConditions_GlobalTag_cff::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), L1MuDTEtaPattern::id(), L1TriggerLutFile::ignoreLines(), L1TriggerLutFile::open(), listBenchmarks::pattern, L1TriggerLutFile::readInteger(), and L1TriggerLutFile::readString().

Referenced by L1TMuonBarrelParamsHelper::configFromPy().

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

print pattern look-up table

Definition at line 137 of file L1MuBMTEtaPatternLut.cc.

References gather_cfg::cout.

137  {
138 
139  cout << endl;
140  cout << "L1 barrel Track Finder ETA Pattern look-up table :" << endl;
141  cout << "==================================================" << endl;
142  cout << endl;
143 
144  cout << "ETF Patterns : " << m_lut.size() << endl;
145  cout << "======================" << endl;
146  cout << endl;
147 
148  LUT::const_iterator iter = m_lut.begin();
149  while ( iter != m_lut.end() ) {
150  cout << (*iter).second << endl;
151  iter++;
152  }
153 
154  cout << endl;
155 
156 }
void L1MuBMTEtaPatternLut::reset ( void  )

reset pattern look-up table

Definition at line 78 of file L1MuBMTEtaPatternLut.cc.

78  {
79 
80  m_lut.clear();
81 
82 }
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 71 of file L1MuBMTEtaPatternLut.h.

References m_lut.

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

71 { return m_lut.size(); }

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 84 of file L1MuBMTEtaPatternLut.h.

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

Definition at line 84 of file L1MuBMTEtaPatternLut.h.

Member Data Documentation

LUT L1MuBMTEtaPatternLut::m_lut