7#include "GaudiKernel/StatusCode.h"
71 return StatusCode::SUCCESS;
74 std::vector<std::string> *tmp_ASD2PP_DIFF_12 =
m_tgcCablingDbTool->giveASD2PP_DIFF_12();
75 if(!tmp_ASD2PP_DIFF_12)
return StatusCode::FAILURE;
79 for (
const std::string& s : *tmp_ASD2PP_DIFF_12) {
80 char letter = s.at(0);
81 if(letter==
'/'||letter==
'*')
continue;
84 delete tmp_ASD2PP_DIFF_12;
85 tmp_ASD2PP_DIFF_12 =
nullptr;
90 if(!
sc.isSuccess())
return sc;
93 if(!
sc.isSuccess())
return sc;
95 if(!
sc.isSuccess())
return sc;
97 if(!
sc.isSuccess())
return sc;
101 if(!
sc.isSuccess())
return sc;
103 if(!
sc.isSuccess())
return sc;
105 if(!
sc.isSuccess())
return sc;
107 if(!
sc.isSuccess())
return sc;
111 if(!
sc.isSuccess())
return sc;
113 if(!
sc.isSuccess())
return sc;
115 if(!
sc.isSuccess())
return sc;
117 if(!
sc.isSuccess())
return sc;
121 return StatusCode::SUCCESS;
126 const std::string& blockname,
127 std::vector<std::vector<int> >& info)
138 const std::string &buf = (*it);
140 char firstl = buf.at(0);
141 if(firstl==
'/'||firstl==
'*')
continue;
142 if(buf.compare(0,blockname.size(),blockname)==0) {
143 std::istringstream line(buf);
145 line >> temp >> size;
152 const std::string &buf = (*it);
154 char firstl = buf.at(0);
155 if(firstl==
'/'||firstl==
'*')
continue;
156 if(firstl==
'E'||firstl==
'F')
break;
157 std::istringstream line(buf);
158 std::vector<int> entry;
159 int t_side, t_sector;
163 if((t_side==side) && (t_sector==sector)) {
164 for(
int i=2; i<8; i++) {
167 entry.push_back(temp);
174 info.push_back(std::move(entry));
179 return StatusCode::SUCCESS;
187 const int module)
const
190 if(sector<0)
return nullptr;
248 bool orChannel)
const {
259 bool orChannel)
const {
260 if(orChannel)
return nullptr;
261 if(ppin->
isValid()==
false)
return nullptr;
269 if(databaseP==
nullptr)
return nullptr;
274 if(i<0)
return nullptr;
277 int layer = databaseP->
getEntry(i,0);
283 int offset = (ppin->
isWire()) ? 4 : 0;
284 int channel = databaseP->
getEntry(i,2+offset);
287 int chamber = databaseP->
getEntry(i,1);
303 bool orChannel)
const {
304 if(orChannel)
return nullptr;
305 if(asdout->
isValid()==
false)
return nullptr;
307 const bool asdoutisStrip = asdout->
isStrip();
308 const bool asdoutisBackward = asdout->
isBackward();
309 const bool asdoutisEndcap = asdout->
isEndcap();
310 const bool asdoutisTriplet = asdout->
isTriplet();
311 const int asdoutLayer = asdout->
getLayer();
312 const int asdoutChamber = asdout->
getChamber();
313 const int asdoutChannel = asdout->
getChannel();
321 if(databaseP==
nullptr)
return nullptr;
325 for(
int i=0; i<MaxEntry; i++) {
327 int layer = asdoutLayer;
329 if(!asdoutisBackward) {
334 int elecChannel = asdoutChannel;
337 int chamber = asdoutChamber;
338 if(asdoutisEndcap&&asdoutisTriplet)
340 int offset = (asdout->
isWire())? 4 : 0;
341 if(databaseP->
getEntry(i,0)==layer&&
343 databaseP->
getEntry(i,2+offset)==elecChannel)
346 int block = databaseP->
getEntry(i,4);
347 int channel = databaseP->
getEntry(i,5);
364 const std::string& blockname,
365 std::shared_ptr<TGCDatabaseASDToPP>& database) {
366 if (!database)
return StatusCode::FAILURE;
367 std::vector<std::vector<int>> info;
369 if(!
sc.isSuccess())
return sc;
371 size_t info_size = info.size();
372 if(!info_size)
return StatusCode::SUCCESS;
374 if(database->isCommon()) {
376 if(!database)
return StatusCode::FAILURE;
379 for(
size_t i=0; i<info_size; i++) {
380 database->update(info[i]);
383 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)
std::vector< std::string > m_ASD2PP_DIFF_12
StatusCode getUpdateInfo(const int side, const int sector, const std::string &blockname, std::vector< std::vector< int > > &info)
virtual ~TGCCableASDToPP()
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