15 #include <sys/types.h>
19 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseException.hh"
24 #include <toolbox/string.h>
41 quotes.push_back(
"Fear is the path to the Dark Side...");
42 quotes.push_back(
"You don't know the power of the Dark Side...");
43 quotes.push_back(
"You must learn the ways of the Force!");
44 quotes.push_back(
"Where's the money, Lebowski?!");
45 quotes.push_back(
"You see what happens when you find a stranger in the Alps!!!?");
47 "You hear this? This is the sound of inevitability. This is the sound of your death. Goodbye, mr. Anderson");
48 quotes.push_back(
"Welcome to the desert of the Real");
49 quotes.push_back(
"In Tyler we trust");
50 quotes.push_back(
"How about a little snack?..Let's have a snack now, we can get friendly later");
51 quotes.push_back(
"Is he human? Hey, no need for name calling!");
52 quotes.push_back(
"Frankly, my dear, I don't give a damn");
53 quotes.push_back(
"I've a feeling we're not in Kansas anymore");
54 quotes.push_back(
"What we've got here is failure to communicate");
55 quotes.push_back(
"I love the smell of napalm in the morning!");
56 quotes.push_back(
"I see stupid people");
57 quotes.push_back(
"Stella! Hey, Stella!");
58 quotes.push_back(
"Houston, we have a problem");
59 quotes.push_back(
"Mrs. Robinson, you're trying to seduce me. Aren't you?");
60 quotes.push_back(
"I feel the need - the need for speed!");
61 quotes.push_back(
"He's got emotional problems. What, beyond pacifism?");
66 int _quotes_array_size = quotes.size();
67 int _num = rand() % _quotes_array_size;
72 struct passwd* _pwd = getpwuid(geteuid());
78 int _geomId = _det + 10 * _depth + 100 * _iphi + 10000 *
abs(_ieta);
86 int _ieta = _geomId / 10000;
91 int _iphi =
abs(_geomId % 10000) / 100;
96 int _depth =
abs(_geomId % 100) / 10;
101 int _det =
abs(_geomId) % 10;
119 int _det =
abs(_geomId) % 10;
141 if (_det.find(
"HB") != std::string::npos)
143 else if (_det.find(
"HE") != std::string::npos)
145 else if (_det.find(
"HF") != std::string::npos)
147 else if (_det.find(
"HO") != std::string::npos)
149 else if (_det.find(
"HT") != std::string::npos)
175 zdcSection =
"ZDC EM";
177 zdcSection =
"ZDC HAD";
179 zdcSection =
"ZDC LUM";
181 zdcSection =
"ZDC RPD";
183 zdcSection =
"UNKNOWN";
188 if (_section.find(
"ZDC EM") != std::string::npos)
190 else if (_section.find(
"ZDC HAD") != std::string::npos)
192 else if (_section.find(
"ZDC LUM") != std::string::npos)
194 else if (_section.find(
"ZDC RPD") != std::string::npos)
205 query +=
" channel_map_id,subdet,ieta,iphi,depth ";
207 query +=
" cms_hcl_hcal_cond.hcal_channels ";
209 query +=
" subdet='HB' or subdet='HE' or subdet='HF' or subdet='HO' ";
211 oracle::occi::Statement* stmt =
conn.getStatement(
query);
212 oracle::occi::ResultSet* rs = stmt->executeQuery();
213 geom_to_rawid.clear();
214 rawid_to_geom.clear();
217 int _rawid = rs->getInt(1);
218 int _geomId = getGeomId(getSubdetector(rs->getString(2)), rs->getInt(3), rs->getInt(4), rs->getInt(5));
219 geom_to_rawid.insert(std::pair<int, int>(_geomId, _rawid));
220 rawid_to_geom.insert(std::pair<int, int>(_rawid, _geomId));
223 }
catch (SQLException&
e) {
225 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException,
234 std::map<int, int>::const_iterator _geomId = rawid_to_geom.find(_rawid);
235 if (_geomId != rawid_to_geom.end()) {
236 return _geomId->second;
245 std::map<int, int>::const_iterator _rawid = geom_to_rawid.find(_geomId);
246 if (_rawid != geom_to_rawid.end()) {
247 return _rawid->second;
256 if (s_det.find(
"HB") != std::string::npos || s_det.find(
"HE") != std::string::npos ||
257 s_det.find(
"HF") != std::string::npos || s_det.find(
"HO") != std::string::npos ||
258 s_det.find(
"HT") != std::string::npos) {
259 HcalDetId _id(getSubdetector(s_det), getHcalIeta(_geomId), getHcalIphi(_geomId), getHcalDepth(_geomId));
261 }
else if (s_det.find(
"ZDC") != std::string::npos) {
278 return getRawId(getGeomId(_det, _ieta, _iphi, _depth));
283 sscanf(inbuf,
"%d", &
result);