CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
popcon::RPCEMapSourceHandler Class Reference

#include <RPCEMapSourceHandler.h>

Inheritance diagram for popcon::RPCEMapSourceHandler:
popcon::PopConSourceHandler< RPCEMap >

Classes

struct  FEBStruct
 

Public Member Functions

int Compare2EMaps (const Ref &map1, RPCEMap *map2)
 
void ConnectOnlineDB (std::string connect, std::string authPath)
 
void DisconnectOnlineDB ()
 
void getNewObjects () override
 
std::string id () const override
 
void readEMap1 ()
 
 RPCEMapSourceHandler (const edm::ParameterSet &ps)
 
 ~RPCEMapSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< RPCEMap >
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Member Functions

std::string IntToString (int num)
 

Private Attributes

RPCEMapeMap
 
std::string m_authpath
 
std::string m_connect
 
int m_dummy
 
std::string m_name
 
int m_validate
 
cond::persistency::Session session
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< RPCEMap >
typedef std::map< Time_t, std::shared_ptr< RPCEMap > > Container
 
typedef std::unique_ptr< RPCEMapRef
 
typedef PopConSourceHandler< RPCEMapself
 
typedef cond::Time_t Time_t
 
typedef RPCEMap value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< RPCEMap >
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< RPCEMap >
Container m_iovs
 
std::vector< std::pair< RPCEMap *, Time_t > > m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 41 of file RPCEMapSourceHandler.h.

Constructor & Destructor Documentation

◆ RPCEMapSourceHandler()

popcon::RPCEMapSourceHandler::RPCEMapSourceHandler ( const edm::ParameterSet ps)

Definition at line 7 of file RPCEMapSourceHandler.cc.

8  : m_name(ps.getUntrackedParameter<std::string>("name", "RPCEMapSourceHandler")),
9  m_dummy(ps.getUntrackedParameter<int>("WriteDummy", 0)),
10  m_validate(ps.getUntrackedParameter<int>("Validate", 0)),
11  m_connect(ps.getUntrackedParameter<std::string>("OnlineConn", "")),
12  m_authpath(ps.getUntrackedParameter<std::string>("OnlineAuthPath", ".")) {}
T getUntrackedParameter(std::string const &, T const &) const

◆ ~RPCEMapSourceHandler()

popcon::RPCEMapSourceHandler::~RPCEMapSourceHandler ( )
override

Definition at line 14 of file RPCEMapSourceHandler.cc.

14 {}

Member Function Documentation

◆ Compare2EMaps()

int popcon::RPCEMapSourceHandler::Compare2EMaps ( const Ref map1,
RPCEMap map2 
)

Definition at line 390 of file RPCEMapSourceHandler.cc.

References RPCEMap::convert(), RPCReadOutMapping::dccList(), RPCReadOutMapping::dccNumberRange(), and AlCaHLTBitMon_QueryRunRegistry::string.

390  {
391  const Ref& map1 = _map1;
392  RPCReadOutMapping const* oldmap1 = map1->convert();
393  RPCReadOutMapping const* oldmap2 = map2->convert();
394  std::vector<const DccSpec*> dccs1 = oldmap1->dccList();
395  std::vector<const DccSpec*> dccs2 = oldmap2->dccList();
396  if (dccs1.size() != dccs2.size()) {
397  return 1;
398  }
399  std::pair<int, int> dccRange1 = oldmap1->dccNumberRange();
400  std::pair<int, int> dccRange2 = oldmap2->dccNumberRange();
401  if (dccRange1.first != dccRange2.first) {
402  return 1;
403  }
404  if (dccRange1.second != dccRange2.second) {
405  return 1;
406  }
407  typedef std::vector<const DccSpec*>::const_iterator IDCC;
408  IDCC idcc2 = dccs2.begin();
409  for (IDCC idcc1 = dccs1.begin(); idcc1 != dccs1.end(); idcc1++) {
410  int dccNo = (**idcc1).id();
411  std::string dccContents = (**idcc1).print(4);
412  if ((**idcc2).id() != dccNo) {
413  return 1;
414  }
415  if ((**idcc2).print(4) != dccContents) {
416  return 1;
417  }
418  idcc2++;
419  }
420  return 0;
421 }
RPCReadOutMapping const * convert() const
Definition: RPCEMap.h:64
std::vector< const DccSpec * > dccList() const
all FEDs in map
std::pair< int, int > dccNumberRange() const
Range of FED IDs in map (min and max id)

◆ ConnectOnlineDB()

void popcon::RPCEMapSourceHandler::ConnectOnlineDB ( std::string  connect,
std::string  authPath 
)

◆ DisconnectOnlineDB()

void popcon::RPCEMapSourceHandler::DisconnectOnlineDB ( )

Definition at line 70 of file RPCEMapSourceHandler.cc.

70 { session.close(); }
cond::persistency::Session session

◆ getNewObjects()

void popcon::RPCEMapSourceHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< RPCEMap >.

Definition at line 16 of file RPCEMapSourceHandler.cc.

References edmScanValgrind::buffer, gather_cfg::cout, cond::service::PoolDBOutputService::currentTime(), jetsAK4_Puppi_cff::payload, plotBeamSpotDB::ptm, AlCaHLTBitMon_QueryRunRegistry::string, dumpRecoGeometry_cfg::tagInfo, and hcalRecHitTable_cff::time.

16  {
17  // std::cout << "RPCEMapSourceHandler: RPCEMapSourceHandler::getNewObjects begins\n";
18 
20 
21  // first check what is already there in offline DB
22  Ref payload;
23  if (m_validate == 1 && tagInfo().size > 0) {
24  std::cout << " Validation was requested, so will check present contents" << std::endl;
25  std::cout << "Name of tag : " << tagInfo().name << ", tag size : " << tagInfo().size << ", last object valid since "
26  << tagInfo().lastInterval.since << std::endl;
27  payload = lastPayload();
28  }
29 
30  // now construct new cabling map from online DB
31  time_t rawtime;
32  time(&rawtime); //time since January 1, 1970
33  tm* ptm = gmtime(&rawtime); //GMT time
34  char buffer[20];
35  strftime(buffer, 20, "%d/%m/%Y_%H:%M:%S", ptm);
36  std::string eMap_version = (std::string)buffer;
37 
38  eMap = new RPCEMap(eMap_version);
39  if (m_dummy == 0) {
41  readEMap1();
43  }
44 
45  cond::Time_t snc = mydbservice->currentTime();
46 
47  // look for recent changes
48  int difference = 1;
49  if (m_validate == 1)
50  difference = Compare2EMaps(payload, eMap);
51  if (!difference)
52  std::cout << "No changes - will not write anything!!!" << std::endl;
53  if (difference == 1) {
54  std::cout << "Will write new object to offline DB!!!" << std::endl;
55  m_to_transfer.push_back(std::make_pair((RPCEMap*)eMap, snc));
56  }
57 
58  // std::cout << "RPCEMapSourceHandler: RPCEMapSourceHandler::getNewObjects ends\n";
59 }
void ConnectOnlineDB(std::string connect, std::string authPath)
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
size_t size
Definition: Types.h:74
std::string name
Definition: Types.h:72
cond::TagInfo_t const & tagInfo() const
unsigned long long Time_t
Definition: Time.h:14
std::vector< std::pair< RPCEMap *, Time_t > > m_to_transfer
int Compare2EMaps(const Ref &map1, RPCEMap *map2)

◆ id()

std::string popcon::RPCEMapSourceHandler::id ( ) const
inlineoverridevirtual

Implements popcon::PopConSourceHandler< RPCEMap >.

Definition at line 46 of file RPCEMapSourceHandler.h.

References m_name.

46 { return m_name; }

◆ IntToString()

std::string popcon::RPCEMapSourceHandler::IntToString ( int  num)
inlineprivate

Definition at line 62 of file RPCEMapSourceHandler.h.

References EgammaValidation_cff::num.

62  {
63  std::stringstream snum;
64  snum << num << std::flush;
65  return (snum.str());
66  }

◆ readEMap1()

void popcon::RPCEMapSourceHandler::readEMap1 ( )

Definition at line 72 of file RPCEMapSourceHandler.cc.

References amcDumpToRaw_cfi::boardId, popcon::RPCEMapSourceHandler::FEBStruct::chamberId, popcon::RPCEMapSourceHandler::FEBStruct::cmsEtaPart, popcon::RPCEMapSourceHandler::FEBStruct::connectorId, gather_cfg::cout, popcon::RPCEMapSourceHandler::FEBStruct::febId, dqmdumpme::first, mps_fire::i, popcon::RPCEMapSourceHandler::FEBStruct::lbInputNum, popcon::RPCEMapSourceHandler::FEBStruct::localEtaPart, RPCEMap::lbItem::nFebs, RPCEMap::linkItem::nLBs, RPCEMap::tbItem::nLinks, RPCEMap::dccItem::nTBs, popcon::RPCEMapSourceHandler::FEBStruct::posInCmsEtaPart, popcon::RPCEMapSourceHandler::FEBStruct::posInLocalEtaPart, nano_mu_digi_cff::sector, AlCaHLTBitMon_QueryRunRegistry::string, nano_mu_digi_cff::subsector, groupFilesInBlocks::temp, RPCEMap::febItem::theAlgo, RPCEMap::febItem::theChamber, RPCEMap::lbItem::theCode, RPCEMap::dccItem::theId, RPCEMap::febItem::theLinkBoardInputNum, RPCEMap::lbItem::theLinkBoardNumInLink, RPCEMap::lbItem::theMaster, RPCEMap::tbItem::theNum, RPCEMap::febItem::thePartition, RPCEMap::linkItem::theTriggerBoardInputNumber, and makeMuonMisalignmentScenario::wheel.

72  {
73  session.transaction().start(true);
74  coral::ISchema& schema = session.nominalSchema();
75  std::string condition = "";
76  coral::AttributeList conditionData;
77 
78  std::cout << std::endl << "RPCEMapSourceHandler: start to build RPC e-Map..." << std::flush << std::endl << std::endl;
79 
80  // Get FEDs
81  RPCEMap::dccItem thisDcc;
82  coral::IQuery* query1 = schema.newQuery();
83  query1->addToTableList("DCCBOARD");
84  query1->addToOutputList("DCCBOARD.DCCBOARDID", "DCCBOARDID");
85  query1->addToOutputList("DCCBOARD.FEDNUMBER", "FEDNUMBER");
86  query1->addToOrderList("FEDNUMBER");
87  condition = "DCCBOARD.DCCBOARDID>0";
88  query1->setCondition(condition, conditionData);
89  // std::cout<<"Getting DCCBOARD...";
90  coral::ICursor& cursor1 = query1->execute();
91  std::cout << "OK" << std::endl;
92  std::pair<int, int> tmp_tbl;
93  std::vector<std::pair<int, int> > theDAQ;
94  while (cursor1.next()) {
95  // cursor1.currentRow().toOutputStream( std::cout ) << std::endl;
96  const coral::AttributeList& row = cursor1.currentRow();
97  tmp_tbl.first = row["DCCBOARDID"].data<long long>();
98  tmp_tbl.second = row["FEDNUMBER"].data<long long>();
99  theDAQ.push_back(tmp_tbl);
100  }
101  delete query1;
102 
103  for (unsigned int iFED = 0; iFED < theDAQ.size(); iFED++) {
104  thisDcc.theId = theDAQ[iFED].second;
105  std::vector<std::pair<int, int> > theTB;
106  // get TBs
107  RPCEMap::tbItem thisTB;
108  coral::IQuery* query2 = schema.newQuery();
109  query2->addToTableList("TRIGGERBOARD");
110  query2->addToOutputList("TRIGGERBOARD.TRIGGERBOARDID", "TRIGGERBOARDID");
111  query2->addToOutputList("TRIGGERBOARD.DCCINPUTCHANNELNUM", "DCCCHANNELNUM");
112  query2->addToOrderList("DCCCHANNELNUM");
113  condition = "TRIGGERBOARD.DCCBOARD_DCCBOARDID=" + IntToString(theDAQ[iFED].first);
114  query2->setCondition(condition, conditionData);
115  coral::ICursor& cursor2 = query2->execute();
116  int ntbs = 0;
117  while (cursor2.next()) {
118  ntbs++;
119  // cursor2.currentRow().toOutputStream( std::cout ) << std::endl;
120  const coral::AttributeList& row = cursor2.currentRow();
121  tmp_tbl.first = row["TRIGGERBOARDID"].data<long long>();
122  tmp_tbl.second = row["DCCCHANNELNUM"].data<long long>();
123  theTB.push_back(tmp_tbl);
124  }
125  delete query2;
126  for (unsigned int iTB = 0; iTB < theTB.size(); iTB++) {
127  thisTB.theNum = theTB[iTB].second;
128  std::vector<std::pair<int, int> > theLink;
129  // get links
130  RPCEMap::linkItem thisLink;
131  coral::IQuery* query3 = schema.newQuery();
132  query3->addToTableList("BOARDBOARDCONN");
133  query3->addToOutputList("BOARDBOARDCONN.BOARD_BOARDID", "BOARDID");
134  query3->addToOutputList("BOARDBOARDCONN.COLLECTORBOARDINPUTNUM", "TBINPUTNUM");
135  query3->addToOrderList("TBINPUTNUM");
136  condition = "BOARDBOARDCONN.BOARD_COLLECTORBOARDID=" + IntToString(theTB[iTB].first);
137  query3->setCondition(condition, conditionData);
138  coral::ICursor& cursor3 = query3->execute();
139  int nlinks = 0;
140  while (cursor3.next()) {
141  nlinks++;
142  const coral::AttributeList& row = cursor3.currentRow();
143  tmp_tbl.first = row["BOARDID"].data<long long>();
144  tmp_tbl.second = row["TBINPUTNUM"].data<long long>();
145  theLink.push_back(tmp_tbl);
146  }
147  delete query3;
148  for (unsigned int iLink = 0; iLink < theLink.size(); iLink++) {
149  int boardId = theLink[iLink].first;
150  thisLink.theTriggerBoardInputNumber = theLink[iLink].second;
151  std::vector<std::pair<int, std::string> > theLB;
152  std::pair<int, std::string> tmpLB;
153  // Get master LBs first...
154  RPCEMap::lbItem thisLB;
155  coral::IQuery* query4 = schema.newQuery();
156  query4->addToTableList("BOARD");
157  query4->addToOutputList("BOARD.NAME", "NAME");
158  condition = "BOARD.BOARDID=" + IntToString(theLink[iLink].first);
159  query4->setCondition(condition, conditionData);
160  coral::ICursor& cursor4 = query4->execute();
161  int nlbs = 0;
162  while (cursor4.next()) {
163  nlbs++;
164  const coral::AttributeList& row = cursor4.currentRow();
165  tmpLB.first = theLink[iLink].first;
166  tmpLB.second = row["NAME"].data<std::string>();
167  theLB.push_back(tmpLB);
168  }
169  delete query4;
170  // then slaves
171  coral::IQuery* query5 = schema.newQuery();
172  query5->addToTableList("LINKBOARD");
173  query5->addToTableList("BOARD");
174  query5->addToOutputList("LINKBOARD.LINKBOARDID", "LINKBOARDID");
175  query5->addToOutputList("BOARD.NAME", "NAME");
176  query5->addToOrderList("LINKBOARDID");
177  condition = "LINKBOARD.MASTERID=" + IntToString(theLink[iLink].first) +
178  " AND BOARD.BOARDID=LINKBOARD.LINKBOARDID AND LINKBOARD.MASTERID<>LINKBOARD.LINKBOARDID";
179  query5->setCondition(condition, conditionData);
180  coral::ICursor& cursor5 = query5->execute();
181  while (cursor5.next()) {
182  nlbs++;
183  const coral::AttributeList& row = cursor5.currentRow();
184  tmpLB.first = row["LINKBOARDID"].data<long long>();
185  tmpLB.second = row["NAME"].data<std::string>();
186  theLB.push_back(tmpLB);
187  }
188  delete query5;
189  for (unsigned int iLB = 0; iLB < theLB.size(); iLB++) {
190  thisLB.theMaster = (theLB[iLB].first == boardId);
191  // extract all relevant information from BOARD.NAME
192  std::string theName = theLB[iLB].second;
193  int slength = theName.length();
194  thisLB.theLinkBoardNumInLink = atoi((theName.substr(slength - 1, 1)).c_str());
195  int wheel = atoi((theName.substr(6, 1)).c_str());
196  std::string char1 = theName.substr(4, 1);
197  std::string char2 = theName.substr(slength - 7, 1);
198  int num3 = atoi((theName.substr(slength - 6, 1)).c_str());
199  std::string char4 = theName.substr(slength - 5, 1);
200  bool itsS1to9 = (theName.substr(slength - 11, 1) == "S");
201  int n1 = 10;
202  int n2 = 1;
203  int n3 = 0;
204  if (!itsS1to9) {
205  n1 = 11;
206  n2 = 2;
207  }
208  int sector = atoi((theName.substr(slength - n1, n2)).c_str());
209  std::string char1Val[2] = {"B", "E"}; // 1,2
210  std::string char2Val[3] = {"N", "M", "P"}; // 0,1,2
211  std::string char4Val[9] = {"0", "1", "2", "3", "A", "B", "C", "D", "E"}; // 0,...,8
212  for (int i = 0; i < 2; i++)
213  if (char1 == char1Val[i])
214  n1 = i + 1;
215  for (int i = 0; i < 3; i++)
216  if (char2 == char2Val[i])
217  n2 = i;
218  for (int i = 0; i < 9; i++)
219  if (char4 == char4Val[i])
220  n3 = i;
221  thisLB.theCode = n3 + num3 * 10 + n2 * 100 + n1 * 1000 + wheel * 10000 + sector * 100000;
222  std::vector<FEBStruct> theFEB;
223  // get FEBs
224  coral::IQuery* query6 = schema.newQuery();
225  query6->addToTableList("FEBLOCATION");
226  query6->addToTableList("FEBCONNECTOR");
227  query6->addToOutputList("FEBLOCATION.FEBLOCATIONID", "FEBLOCATIONID");
228  query6->addToOutputList("FEBLOCATION.CL_CHAMBERLOCATIONID", "CHAMBERLOCATIONID");
229  query6->addToOutputList("FEBCONNECTOR.FEBCONNECTORID", "FEBCONNECTORID");
230  query6->addToOutputList("FEBLOCATION.FEBLOCALETAPARTITION", "LOCALETAPART");
231  query6->addToOutputList("FEBLOCATION.POSINLOCALETAPARTITION", "POSINLOCALETAPART");
232  query6->addToOutputList("FEBLOCATION.FEBCMSETAPARTITION", "CMSETAPART");
233  query6->addToOutputList("FEBLOCATION.POSINCMSETAPARTITION", "POSINCMSETAPART");
234  query6->addToOutputList("FEBCONNECTOR.LINKBOARDINPUTNUM", "LINKBOARDINPUTNUM");
235  query6->addToOrderList("FEBLOCATIONID");
236  query6->addToOrderList("FEBCONNECTORID");
237  condition = "FEBLOCATION.LB_LINKBOARDID=" + IntToString(theLB[iLB].first) +
238  " AND FEBLOCATION.FEBLOCATIONID=FEBCONNECTOR.FL_FEBLOCATIONID";
239  query6->setCondition(condition, conditionData);
240  coral::ICursor& cursor6 = query6->execute();
241  int nfebs = 0;
242  while (cursor6.next()) {
243  FEBStruct tmpFEB;
244  nfebs++;
245  const coral::AttributeList& row = cursor6.currentRow();
246  tmpFEB.febId = row["FEBLOCATIONID"].data<long long>();
247  tmpFEB.chamberId = row["CHAMBERLOCATIONID"].data<long long>();
248  tmpFEB.connectorId = row["FEBCONNECTORID"].data<long long>();
249  tmpFEB.localEtaPart = row["LOCALETAPART"].data<std::string>();
250  tmpFEB.posInLocalEtaPart = row["POSINLOCALETAPART"].data<short>();
251  tmpFEB.cmsEtaPart = row["CMSETAPART"].data<std::string>();
252  tmpFEB.posInCmsEtaPart = row["POSINCMSETAPART"].data<short>();
253  tmpFEB.lbInputNum = row["LINKBOARDINPUTNUM"].data<short>();
254  theFEB.push_back(tmpFEB);
255  }
256  delete query6;
257  for (unsigned int iFEB = 0; iFEB < theFEB.size(); iFEB++) {
258  RPCEMap::febItem thisFeb;
259  std::string temp = theFEB[iFEB].localEtaPart;
260  std::string localEtaVal[6] = {"Forward", "Central", "Backward", "A", "B", "C"};
261  char localEtaPartition = 0;
262  for (int i = 0; i < 6; i++)
263  if (temp == localEtaVal[i])
264  localEtaPartition = i + 1;
265  char positionInLocalEtaPartition = theFEB[iFEB].posInLocalEtaPart;
266  temp = theFEB[iFEB].cmsEtaPart;
267  std::string cmsEtaVal[6] = {"1", "2", "3", "A", "B", "C"};
268  char cmsEtaPartition = 0;
269  for (int i = 0; i < 6; i++)
270  if (temp == cmsEtaVal[i])
271  cmsEtaPartition = i + 1;
272  char positionInCmsEtaPartition = theFEB[iFEB].posInCmsEtaPart;
273  thisFeb.thePartition = positionInLocalEtaPartition + 10 * localEtaPartition +
274  100 * positionInCmsEtaPartition + 1000 * cmsEtaPartition;
275  thisFeb.theLinkBoardInputNum = theFEB[iFEB].lbInputNum;
276  // Get chamber
277  coral::IQuery* query7 = schema.newQuery();
278  query7->addToTableList("CHAMBERLOCATION");
279  query7->addToOutputList("CHAMBERLOCATION.DISKORWHEEL", "DISKORWHEEL");
280  query7->addToOutputList("CHAMBERLOCATION.LAYER", "LAYER");
281  query7->addToOutputList("CHAMBERLOCATION.SECTOR", "SECTOR");
282  query7->addToOutputList("CHAMBERLOCATION.SUBSECTOR", "SUBSECTOR");
283  query7->addToOutputList("CHAMBERLOCATION.CHAMBERLOCATIONNAME", "NAME");
284  query7->addToOutputList("CHAMBERLOCATION.FEBZORNT", "FEBZORNT");
285  query7->addToOutputList("CHAMBERLOCATION.FEBRADORNT", "FEBRADORNT");
286  query7->addToOutputList("CHAMBERLOCATION.BARRELORENDCAP", "BARRELORENDCAP");
287  condition = "CHAMBERLOCATION.CHAMBERLOCATIONID=" + IntToString(theFEB[iFEB].chamberId);
288  query7->setCondition(condition, conditionData);
289  coral::ICursor& cursor7 = query7->execute();
290  thisFeb.theChamber = -1;
291  while (cursor7.next()) {
292  const coral::AttributeList& row = cursor7.currentRow();
293  char diskOrWheel = row["DISKORWHEEL"].data<short>() + 3;
294  char layer = row["LAYER"].data<short>();
295  int sector = row["SECTOR"].data<short>();
296  temp = row["SUBSECTOR"].data<std::string>();
297  // TEMPORARY TO CORRECT A LITTLE BUG IN OMDS
298  // std::string chname=row["NAME"].data<std::string>();
299  // if (layer==6 && (sector==9 || sector==11)) {
300  // if (temp=="+") {
301  // temp="";
302  // std::cout<<"Changed subsector + to null for "<<chname<<std::endl;
303  // }
304  // }
305 
306  std::string subsVal[5] = {"--", "-", "", "+", "++"};
307  char subsector = 0;
308  for (int i = 0; i < 5; i++)
309  if (temp == subsVal[i])
310  subsector = i;
311  temp = row["FEBZORNT"].data<std::string>();
312  char febZOrnt = 0;
313  if (temp == "+z")
314  febZOrnt = 1;
315  temp = row["FEBRADORNT"].data<std::string>();
316  char febZRadOrnt = 0;
317  std::string febZRVal[3] = {"", "IN", "OUT"};
318  for (int i = 0; i < 3; i++)
319  if (temp == febZRVal[i])
320  febZRadOrnt = i;
321  temp = row["BARRELORENDCAP"].data<std::string>();
322  char barrelOrEndcap = 0;
323  if (temp == "Barrel")
324  barrelOrEndcap = 1;
325  thisFeb.theChamber = sector + 100 * subsector + 1000 * febZRadOrnt + 5000 * febZOrnt +
326  10000 * diskOrWheel + 100000 * layer + 1000000 * barrelOrEndcap;
327  }
328  delete query7;
329  // Get Strips
330  coral::IQuery* query8 = schema.newQuery();
331  query8->addToTableList("CHAMBERSTRIP");
332  query8->addToOutputList("CHAMBERSTRIP.CABLECHANNELNUM", "CABLECHANNELNUM");
333  query8->addToOutputList("CHAMBERSTRIP.CHAMBERSTRIPNUMBER", "CHAMBERSTRIPNUM");
334  // query8->addToOutputList("CHAMBERSTRIP.CMSSTRIPNUMBER","CMSSTRIPNUM");
335  query8->addToOrderList("CABLECHANNELNUM");
336  condition = "CHAMBERSTRIP.FC_FEBCONNECTORID=" + IntToString(theFEB[iFEB].connectorId);
337  query8->setCondition(condition, conditionData);
338  coral::ICursor& cursor8 = query8->execute();
339  // NEW: do not store all the strip information as goes, only the minimum data needed to
340  // reproduce it later on
341  int nstrips = 0;
342  int firstChamberStrip = 0;
343  int firstPin = 0;
344  int lastChamberStrip = 0;
345  int lastPin = 0;
346  while (cursor8.next()) {
347  const coral::AttributeList& row = cursor8.currentRow();
348  lastChamberStrip = row["CHAMBERSTRIPNUM"].data<int>();
349  lastPin = row["CABLECHANNELNUM"].data<short>();
350  if (nstrips == 0) {
351  firstChamberStrip = lastChamberStrip;
352  firstPin = lastPin;
353  }
354  nstrips++;
355  }
356  delete query8;
357  int algo = -1;
358  if (firstPin == 1 && lastPin == nstrips) {
359  algo = 1;
360  } else if (firstPin == 2 && lastPin == nstrips + 1) {
361  algo = 2;
362  } else if (firstPin == 3 && lastPin == nstrips + 2) {
363  algo = 3;
364  } else if (firstPin == 2 && lastPin == nstrips + 2) {
365  algo = 0;
366  } else {
367  std::cout << " Unknown algo : " << firstPin << " " << lastPin << std::endl;
368  }
369  if ((lastPin - firstPin) * (lastChamberStrip - firstChamberStrip) < 0)
370  algo = algo + 4;
371  thisFeb.theAlgo = algo + 100 * firstChamberStrip + 10000 * nstrips;
372  eMap->theFebs.push_back(thisFeb);
373  }
374  thisLB.nFebs = nfebs;
375  eMap->theLBs.push_back(thisLB);
376  }
377  thisLink.nLBs = nlbs;
378  eMap->theLinks.push_back(thisLink);
379  }
380  thisTB.nLinks = nlinks;
381  eMap->theTBs.push_back(thisTB);
382  }
383  thisDcc.nTBs = ntbs;
384  std::cout << "DCC added" << std::endl;
385  eMap->theDccs.push_back(thisDcc);
386  }
387  std::cout << std::endl << "Building RPC e-Map done!" << std::flush << std::endl << std::endl;
388 }
int theTriggerBoardInputNumber
Definition: RPCEMap.h:34
int theLinkBoardInputNum
Definition: RPCEMap.h:50
std::string IntToString(int num)
std::vector< tbItem > theTBs
Definition: RPCEMap.h:59
void start(bool readOnly=true)
Definition: Session.cc:18
Transaction & transaction()
Definition: Session.cc:52
int theLinkBoardNumInLink
Definition: RPCEMap.h:41
std::vector< dccItem > theDccs
Definition: RPCEMap.h:58
std::vector< febItem > theFebs
Definition: RPCEMap.h:62
coral::ISchema & nominalSchema()
Definition: Session.cc:224
int thePartition
Definition: RPCEMap.h:51
std::vector< linkItem > theLinks
Definition: RPCEMap.h:60
cond::persistency::Session session
bool theMaster
Definition: RPCEMap.h:40
std::vector< lbItem > theLBs
Definition: RPCEMap.h:61

Member Data Documentation

◆ eMap

RPCEMap* popcon::RPCEMapSourceHandler::eMap
private

Definition at line 53 of file RPCEMapSourceHandler.h.

◆ m_authpath

std::string popcon::RPCEMapSourceHandler::m_authpath
private

Definition at line 59 of file RPCEMapSourceHandler.h.

◆ m_connect

std::string popcon::RPCEMapSourceHandler::m_connect
private

Definition at line 58 of file RPCEMapSourceHandler.h.

◆ m_dummy

int popcon::RPCEMapSourceHandler::m_dummy
private

Definition at line 56 of file RPCEMapSourceHandler.h.

◆ m_name

std::string popcon::RPCEMapSourceHandler::m_name
private

Definition at line 55 of file RPCEMapSourceHandler.h.

Referenced by id().

◆ m_validate

int popcon::RPCEMapSourceHandler::m_validate
private

Definition at line 57 of file RPCEMapSourceHandler.h.

◆ session

cond::persistency::Session popcon::RPCEMapSourceHandler::session
private

Definition at line 54 of file RPCEMapSourceHandler.h.