7#include "GaudiKernel/StatusCode.h"
73 return StatusCode::SUCCESS;
76 std::vector<std::string> *tmp_ASD2PP_DIFF_12 =
m_tgcCablingDbTool->giveASD2PP_DIFF_12();
77 if(!tmp_ASD2PP_DIFF_12)
return StatusCode::FAILURE;
82 for (
const std::string& s : *tmp_ASD2PP_DIFF_12) {
83 char letter = s.at(0);
84 if(letter==
'/'||letter==
'*')
continue;
87 delete tmp_ASD2PP_DIFF_12;
88 tmp_ASD2PP_DIFF_12 =
nullptr;
93 if(!
sc.isSuccess())
return sc;
96 if(!
sc.isSuccess())
return sc;
98 if(!
sc.isSuccess())
return sc;
100 if(!
sc.isSuccess())
return sc;
104 if(!
sc.isSuccess())
return sc;
106 if(!
sc.isSuccess())
return sc;
108 if(!
sc.isSuccess())
return sc;
110 if(!
sc.isSuccess())
return sc;
114 if(!
sc.isSuccess())
return sc;
116 if(!
sc.isSuccess())
return sc;
118 if(!
sc.isSuccess())
return sc;
120 if(!
sc.isSuccess())
return sc;
124 return StatusCode::SUCCESS;
129 const std::string& blockname,
130 std::vector<std::vector<int> >& info)
141 const std::string &buf = (*it);
143 char firstl = buf.at(0);
144 if(firstl==
'/'||firstl==
'*')
continue;
145 if(buf.compare(0,blockname.size(),blockname)==0) {
146 std::istringstream line(buf);
148 line >> temp >> size;
155 const std::string &buf = (*it);
157 char firstl = buf.at(0);
158 if(firstl==
'/'||firstl==
'*')
continue;
159 if(firstl==
'E'||firstl==
'F')
break;
160 std::istringstream line(buf);
161 std::vector<int> entry;
162 int t_side, t_sector;
166 if((t_side==side) && (t_sector==sector)) {
167 for(
int i=2; i<8; i++) {
170 entry.push_back(temp);
177 info.push_back(std::move(entry));
182 return StatusCode::SUCCESS;
190 const int module)
const
193 if(sector<0)
return nullptr;
251 bool orChannel)
const {
262 bool orChannel)
const {
263 if(orChannel)
return nullptr;
264 if(ppin->
isValid()==
false)
return nullptr;
272 if(databaseP==
nullptr)
return nullptr;
277 if(i<0)
return nullptr;
280 int layer = databaseP->
getEntry(i,0);
286 int offset = (ppin->
isWire()) ? 4 : 0;
287 int channel = databaseP->
getEntry(i,2+offset);
290 int chamber = databaseP->
getEntry(i,1);
306 bool orChannel)
const {
307 if(orChannel)
return nullptr;
308 if(asdout->
isValid()==
false)
return nullptr;
310 const bool asdoutisStrip = asdout->
isStrip();
311 const bool asdoutisBackward = asdout->
isBackward();
312 const bool asdoutisEndcap = asdout->
isEndcap();
313 const bool asdoutisTriplet = asdout->
isTriplet();
314 const int asdoutLayer = asdout->
getLayer();
315 const int asdoutChamber = asdout->
getChamber();
316 const int asdoutChannel = asdout->
getChannel();
324 if(databaseP==
nullptr)
return nullptr;
328 for(
int i=0; i<MaxEntry; i++) {
330 int layer = asdoutLayer;
332 if(!asdoutisBackward) {
337 int elecChannel = asdoutChannel;
340 int chamber = asdoutChamber;
341 if(asdoutisEndcap&&asdoutisTriplet)
343 int offset = (asdout->
isWire())? 4 : 0;
344 if(databaseP->
getEntry(i,0)==layer&&
346 databaseP->
getEntry(i,2+offset)==elecChannel)
349 int block = databaseP->
getEntry(i,4);
350 int channel = databaseP->
getEntry(i,5);
367 const std::string& blockname,
368 std::shared_ptr<TGCDatabaseASDToPP>& database) {
369 if (!database)
return StatusCode::FAILURE;
370 std::vector<std::vector<int>> info;
372 if(!
sc.isSuccess())
return sc;
374 size_t info_size = info.size();
375 if(!info_size)
return StatusCode::SUCCESS;
377 if(database->isCommon()) {
379 if(!database)
return StatusCode::FAILURE;
382 for(
size_t i=0; i<info_size; i++) {
383 database->update(info[i]);
386 return StatusCode::SUCCESS;
StatusCode updateDatabase()
ToolHandle< ITGCCablingDbTool > m_tgcCablingDbTool
static const int s_stripForward[]
StatusCode updateIndividualDatabase(const int side, const int sector, const std::string &blockname, std::shared_ptr< TGCDatabaseASDToPP > &database)
void initialize(const std::string &filename)
StatusCode getUpdateInfo(const int side, const int sector, const std::string &blockname, std::vector< std::vector< int > > &info)
virtual ~TGCCableASDToPP()
std::vector< std::string > * m_ASD2PP_DIFF_12
virtual TGCChannelId * getChannelOut(const TGCChannelId *asdout, bool orChannel=false) const
TGCDatabaseASDToPP * getDatabase(const int side, const int region, const int sector, const int module) const
virtual TGCChannelId * getChannelIn(const TGCChannelId *ppin, bool orChannel=false) const
virtual TGCChannelId * getChannel(const TGCChannelId *channelId, bool orChannel=false) const
TGCCable(CableType type=NoCableType)
virtual bool isValid() const
virtual int getIndexDBOut(int *indexOut) const override
Get IndexDBOut (position in the databse between 0 and database.size()-1) from indexOut which is NInde...
virtual int getMaxEntry(void) const
virtual int getEntry(int entry, int column) const
static constexpr int NUM_INNER_SECTOR
ModuleType getModuleType(void) const
static constexpr int NUM_ENDCAP_SECTOR
RegionType getRegionType(void) const
SignalType getSignalType(void) const
virtual int getSector() const
SideType getSideType(void) const
static constexpr int NUM_FORWARD_SECTOR