CMS 3D CMS Logo

L1MuDTEtaPatternLut.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTEtaPatternLut
4 //
5 // Description: Look-up table for eta track finder
6 //
7 //
8 // $Date: 2007/03/30 07:48:02 $
9 // $Revision: 1.1 $
10 //
11 // Author :
12 // N. Neumeister CERN EP
13 // J. Troconiz UAM Madrid
14 //
15 //--------------------------------------------------
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
20 
22 
23 //---------------
24 // C++ Headers --
25 //---------------
26 
27 #include <iostream>
28 #include <iomanip>
29 #include <string>
30 
31 //-------------------------------
32 // Collaborating Class Headers --
33 //-------------------------------
34 
37 
38 using namespace std;
39 
40 // --------------------------------
41 // class L1MuDTEtaPatternLut
42 //---------------------------------
43 
44 //----------------
45 // Constructors --
46 //----------------
47 
49  // if ( load() != 0 ) {
50  // cout << "Can not open files to load eta track finder look-up tables for DTTrackFinder!" << endl;
51  // }
52 
53  // if ( L1MuDTTFConfig::Debug(6) ) print();
54 }
55 
56 //--------------
57 // Destructor --
58 //--------------
59 
61 
62 //--------------
63 // Operations --
64 //--------------
65 
66 //
67 // reset look-up table
68 //
69 void L1MuDTEtaPatternLut::reset() { m_lut.clear(); }
70 
71 //
72 // load pattern look-up table for ETF
73 //
75  // get directory name
76  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
77  string eau_dir = "L1TriggerData/DTTrackFinder/Eau/";
78 
79  // assemble file name
80  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + eau_dir + "ETFPatternList.lut"));
81  string etf_file = lut_f.fullPath();
82 
83  // open file
84  L1TriggerLutFile file(etf_file);
85  if (file.open() != 0)
86  return -1;
87  // if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : "
88  // << file.getName() << endl;
89 
90  // ignore comment lines
91  file.ignoreLines(16);
92 
93  // read patterns
94  while (file.good()) {
95  int id = file.readInteger();
96  if (!file.good())
97  break;
98  string pat = file.readString();
99  if (!file.good())
100  break;
101  int qual = file.readInteger();
102  if (!file.good())
103  break;
104  int eta = file.readInteger();
105  if (!file.good())
106  break;
107  L1MuDTEtaPattern pattern(id, pat, eta, qual);
108 
109  m_lut[pattern.id()] = pattern;
110 
111  if (!file.good()) {
112  file.close();
113  break;
114  }
115  }
116 
117  file.close();
118 
119  return 0;
120 }
121 
122 //
123 // print pattern look-up table for ETF
124 //
126  cout << endl;
127  cout << "L1 barrel Track Finder ETA Pattern look-up table :" << endl;
128  cout << "==================================================" << endl;
129  cout << endl;
130 
131  cout << "ETF Patterns : " << m_lut.size() << endl;
132  cout << "======================" << endl;
133  cout << endl;
134 
135  LUT::const_iterator iter = m_lut.begin();
136  while (iter != m_lut.end()) {
137  cout << (*iter).second << endl;
138  iter++;
139  }
140 
141  cout << endl;
142 }
143 
144 //
145 // get pattern with a given ID
146 //
148  LUT::const_iterator it = m_lut.find(id);
149  if (it == m_lut.end()) {
150  cerr << "Error: L1MuDTEtaPatternLut: pattern not found : " << id << endl;
151  // return 0;
152  }
153  return (*it).second;
154 }
L1MuDTEtaPattern
Definition: L1MuDTEtaPattern.h:46
L1TriggerLutFile
Definition: L1TriggerLutFile.h:37
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FileInPath.h
edm::FileInPath
Definition: FileInPath.h:64
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1MuDTEtaPatternLut::reset
void reset()
reset pattern look-up table
Definition: L1MuDTEtaPatternLut.cc:69
L1MuDTEtaPatternLut::load
int load()
load pattern look-up table
Definition: L1MuDTEtaPatternLut.cc:74
L1MuDTEtaPatternLut::getPattern
L1MuDTEtaPattern getPattern(int id) const
get pattern with a given ID
Definition: L1MuDTEtaPatternLut.cc:147
L1MuDTEtaPatternLut::print
void print() const
print pattern look-up table
Definition: L1MuDTEtaPatternLut.cc:125
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
L1MuDTEtaPatternLut::~L1MuDTEtaPatternLut
virtual ~L1MuDTEtaPatternLut()
destructor
Definition: L1MuDTEtaPatternLut.cc:60
pat
Definition: HeavyIon.h:7
L1MuDTEtaPatternLut::L1MuDTEtaPatternLut
L1MuDTEtaPatternLut()
constructor
Definition: L1MuDTEtaPatternLut.cc:48
std
Definition: JetResolutionObject.h:76
L1MuDTEtaPatternLut.h
L1TriggerLutFile.h
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163