CMS 3D CMS Logo

DTLVStatus.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //----------------------
9 // This Class' Header --
10 //----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
18 
19 //---------------
20 // C++ Headers --
21 //---------------
22 #include <iostream>
23 #include <sstream>
24 
25 //-------------------
26 // Initializations --
27 //-------------------
28 
29 //----------------
30 // Constructors --
31 //----------------
32 DTLVStatus::DTLVStatus() : dataVersion(" "), dBuf(new DTBufferTree<int, int>) { dataList.reserve(10); }
33 
34 DTLVStatus::DTLVStatus(const std::string& version) : dataVersion(version), dBuf(new DTBufferTree<int, int>) {
35  dataList.reserve(10);
36 }
37 
38 DTLVStatusId::DTLVStatusId() : wheelId(0), stationId(0), sectorId(0) {}
39 
40 DTLVStatusData::DTLVStatusData() : flagCFE(0), flagDFE(0), flagCMC(0), flagDMC(0) {}
41 
42 //--------------
43 // Destructor --
44 //--------------
46 
48 
50 
51 //--------------
52 // Operations --
53 //--------------
55  int wheelId, int stationId, int sectorId, int& flagCFE, int& flagDFE, int& flagCMC, int& flagDMC) const {
56  flagCFE = 0;
57  flagDFE = 0;
58  flagCMC = 0;
59  flagDMC = 0;
60 
61  std::vector<int> chanKey;
62  chanKey.reserve(3);
63  chanKey.push_back(wheelId);
64  chanKey.push_back(stationId);
65  chanKey.push_back(sectorId);
66  int ientry;
67  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
68  if (!searchStatus) {
69  const DTLVStatusData& data(dataList[ientry].second);
70  flagCFE = data.flagCFE;
71  flagDFE = data.flagDFE;
72  flagCMC = data.flagCMC;
73  flagDMC = data.flagDMC;
74  }
75 
76  return searchStatus;
77 }
78 
79 int DTLVStatus::get(const DTChamberId& id, int& flagCFE, int& flagDFE, int& flagCMC, int& flagDMC) const {
80  return get(id.wheel(), id.station(), id.sector(), flagCFE, flagDFE, flagCMC, flagDMC);
81 }
82 
83 const std::string& DTLVStatus::version() const { return dataVersion; }
84 
86 
88  dataList.clear();
89  initialize();
90  return;
91 }
92 
93 int DTLVStatus::set(int wheelId, int stationId, int sectorId, int flagCFE, int flagDFE, int flagCMC, int flagDMC) {
94  std::vector<int> chanKey;
95  chanKey.reserve(3);
96  chanKey.push_back(wheelId);
97  chanKey.push_back(stationId);
98  chanKey.push_back(sectorId);
99  int ientry;
100  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
101 
102  if (!searchStatus) {
104  data.flagCFE = flagCFE;
105  data.flagDFE = flagDFE;
106  data.flagCMC = flagCMC;
107  data.flagDMC = flagDMC;
108  return -1;
109  } else {
111  key.wheelId = wheelId;
112  key.stationId = stationId;
113  key.sectorId = sectorId;
115  data.flagCFE = flagCFE;
116  data.flagDFE = flagDFE;
117  data.flagCMC = flagCMC;
118  data.flagDMC = flagDMC;
119  ientry = dataList.size();
120  dataList.push_back(std::pair<DTLVStatusId, DTLVStatusData>(key, data));
121  dBuf->insert(chanKey.begin(), chanKey.end(), ientry);
122  return 0;
123  }
124 
125  return 99;
126 }
127 
128 int DTLVStatus::set(const DTChamberId& id, int flagCFE, int flagDFE, int flagCMC, int flagDMC) {
129  return set(id.wheel(), id.station(), id.sector(), flagCFE, flagDFE, flagCMC, flagDMC);
130 }
131 
132 int DTLVStatus::setFlagCFE(int wheelId, int stationId, int sectorId, int flag) {
133  int flagCFE;
134  int flagDFE;
135  int flagCMC;
136  int flagDMC;
137  get(wheelId, stationId, sectorId, flagCFE, flagDFE, flagCMC, flagDMC);
138  return set(wheelId, stationId, sectorId, flag, flagDFE, flagCMC, flagDMC);
139 }
140 
142  return setFlagCFE(id.wheel(), id.station(), id.sector(), flag);
143 }
144 
145 int DTLVStatus::setFlagDFE(int wheelId, int stationId, int sectorId, int flag) {
146  int flagCFE;
147  int flagDFE;
148  int flagCMC;
149  int flagDMC;
150  get(wheelId, stationId, sectorId, flagCFE, flagDFE, flagCMC, flagDMC);
151  return set(wheelId, stationId, sectorId, flagCFE, flag, flagCMC, flagDMC);
152 }
153 
155  return setFlagDFE(id.wheel(), id.station(), id.sector(), flag);
156 }
157 
158 int DTLVStatus::setFlagCMC(int wheelId, int stationId, int sectorId, int flag) {
159  int flagCFE;
160  int flagDFE;
161  int flagCMC;
162  int flagDMC;
163  get(wheelId, stationId, sectorId, flagCFE, flagDFE, flagCMC, flagDMC);
164  return set(wheelId, stationId, sectorId, flagCFE, flagDFE, flag, flagDMC);
165 }
166 
168  return setFlagCMC(id.wheel(), id.station(), id.sector(), flag);
169 }
170 
171 int DTLVStatus::setFlagDMC(int wheelId, int stationId, int sectorId, int flag) {
172  int flagCFE;
173  int flagDFE;
174  int flagCMC;
175  int flagDMC;
176  get(wheelId, stationId, sectorId, flagCFE, flagDFE, flagCMC, flagDMC);
177  return set(wheelId, stationId, sectorId, flagCFE, flagDFE, flagCMC, flag);
178 }
179 
181  return setFlagDMC(id.wheel(), id.station(), id.sector(), flag);
182 }
183 
185 
187 
189  std::stringstream name;
190  name << dataVersion << "_map_Mtime" << this;
191  return name.str();
192 }
193 
195  dBuf->clear();
196 
197  int entryNum = 0;
198  int entryMax = dataList.size();
199  std::vector<int> chanKey;
200  chanKey.reserve(3);
201  while (entryNum < entryMax) {
202  const DTLVStatusId& chan = dataList[entryNum].first;
203 
204  chanKey.clear();
205  chanKey.push_back(chan.wheelId);
206  chanKey.push_back(chan.stationId);
207  chanKey.push_back(chan.sectorId);
208  dBuf->insert(chanKey.begin(), chanKey.end(), entryNum++);
209  }
210 
211  return;
212 }
relativeConstraints.station
station
Definition: relativeConstraints.py:67
DTBufferTree::clear
void clear()
DTLVStatus::setFlagCFE
int setFlagCFE(int wheelId, int stationId, int sectorId, int flag)
Definition: DTLVStatus.cc:132
DTLVStatus::end
const_iterator end() const
Definition: DTLVStatus.cc:186
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DTLVStatus::const_iterator
std::vector< std::pair< DTLVStatusId, DTLVStatusData > >::const_iterator const_iterator
Access methods to data.
Definition: DTLVStatus.h:98
DTLVStatus::get
int get(int wheelId, int stationId, int sectorId, int &flagCFE, int &flagDFE, int &flagCMC, int &flagDMC) const
get content
Definition: DTLVStatus.cc:54
DTLVStatusId
Definition: DTLVStatus.h:38
DTLVStatus::DTLVStatus
DTLVStatus()
Definition: DTLVStatus.cc:32
DTLVStatusData
Definition: DTLVStatus.h:50
DTBufferTree::insert
int insert(ElementKey fKey, ElementKey lKey, Content cont)
DTLVStatus::set
int set(int wheelId, int stationId, int sectorId, int flagCFE, int flagDFE, int flagCMC, int flagDMC)
Definition: DTLVStatus.cc:93
DTChamberId.h
DTLVStatus::setFlagDFE
int setFlagDFE(int wheelId, int stationId, int sectorId, int flag)
Definition: DTLVStatus.cc:145
DTLVStatusId::~DTLVStatusId
~DTLVStatusId()
Definition: DTLVStatus.cc:47
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTBufferTree.h
DTLVStatus::dataVersion
std::string dataVersion
Definition: DTLVStatus.h:108
DTLVStatus::clear
void clear()
reset content
Definition: DTLVStatus.cc:87
DTLVStatus::initialize
void initialize()
Definition: DTLVStatus.cc:194
DTLVStatus::~DTLVStatus
~DTLVStatus()
Definition: DTLVStatus.cc:45
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
createfilelist.int
int
Definition: createfilelist.py:10
DTLVStatus::setFlagCMC
int setFlagCMC(int wheelId, int stationId, int sectorId, int flag)
Definition: DTLVStatus.cc:158
DTLVStatusData::DTLVStatusData
DTLVStatusData()
Definition: DTLVStatus.cc:40
DTBufferTree
Definition: DTBufferTree.h:42
DTLVStatusId::DTLVStatusId
DTLVStatusId()
Definition: DTLVStatus.cc:38
DTLVStatus::begin
const_iterator begin() const
Definition: DTLVStatus.cc:184
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
DTLVStatus.h
DTLVStatus::dBuf
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
Definition: DTLVStatus.h:112
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DTLVStatusData::~DTLVStatusData
~DTLVStatusData()
Definition: DTLVStatus.cc:49
DTLVStatus::setFlagDMC
int setFlagDMC(int wheelId, int stationId, int sectorId, int flag)
Definition: DTLVStatus.cc:171
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DTLVStatus::version
const std::string & version() const
access version
Definition: DTLVStatus.cc:83
DTLVStatus::mapName
std::string mapName() const
read and store full content
Definition: DTLVStatus.cc:188
DTChamberId
Definition: DTChamberId.h:14
DTBufferTree::find
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
crabWrapper.key
key
Definition: crabWrapper.py:19
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
DTLVStatus::dataList
std::vector< std::pair< DTLVStatusId, DTLVStatusData > > dataList
Definition: DTLVStatus.h:110
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116