26 const std::string& diffFile) {
28 std::make_shared<TGCDatabaseASDToPP>(filename,
"FWD");
30 std::make_shared<TGCDatabaseASDToPP>(filename,
"FSD");
32 std::make_shared<TGCDatabaseASDToPP>(filename,
"FWT");
34 std::make_shared<TGCDatabaseASDToPP>(filename,
"FST");
37 std::make_shared<TGCDatabaseASDToPP>(filename,
"EWD");
39 std::make_shared<TGCDatabaseASDToPP>(filename,
"ESD");
41 std::make_shared<TGCDatabaseASDToPP>(filename,
"EWT");
43 std::make_shared<TGCDatabaseASDToPP>(filename,
"EST");
46 std::make_shared<TGCDatabaseASDToPP>(filename,
"FWI");
48 std::make_shared<TGCDatabaseASDToPP>(filename,
"FSI");
50 std::make_shared<TGCDatabaseASDToPP>(filename,
"EWI");
52 std::make_shared<TGCDatabaseASDToPP>(filename,
"ESI");
79 std::vector<std::string> fileContent{};
80 std::ifstream inASDToPP;
81 inASDToPP.open(diffFile);
82 if (inASDToPP.bad()) {
83 throw std::runtime_error(
"Failed to open " + diffFile);
89 while (getline(inASDToPP, buf)) {
90 char letter = buf.at(0);
92 if (letter ==
'/' || letter ==
'*') {
96 fileContent.push_back(buf);
134 const int side,
const int sector,
const std::vector<std::string>& diffFile,
136 const std::string& blockname) {
138 std::vector<std::vector<int>> info{};
140 std::vector<std::string>::const_iterator it = diffFile.begin();
141 std::vector<std::string>::const_iterator it_e = diffFile.end();
146 const std::string& buf = (*it);
148 char firstl = buf.at(0);
149 if (firstl ==
'/' || firstl ==
'*') {
152 if (buf.compare(0, blockname.size(), blockname) == 0) {
153 std::istringstream line(buf);
155 line >> temp >> size;
162 const std::string& buf = (*it);
164 char firstl = buf.at(0);
165 if (firstl ==
'/' || firstl ==
'*') {
168 if (firstl ==
'E' || firstl ==
'F') {
171 std::istringstream line(buf);
172 std::vector<int> entry;
173 int t_side, t_sector;
177 if ((t_side == side) && (t_sector == sector)) {
178 for (
int i = 2; i < 8; i++) {
181 entry.push_back(temp);
188 info.push_back(std::move(entry));
336 if (orChannel || !asdout.
isValid()) {
340 const bool asdoutisStrip = asdout.
isStrip();
341 const bool asdoutisBackward = asdout.
isBackward();
342 const bool asdoutisEndcap = asdout.
isEndcap();
343 const bool asdoutisTriplet = asdout.
isTriplet();
344 const int asdoutLayer = asdout.
getLayer();
345 const int asdoutChamber = asdout.
getChamber();
346 const int asdoutChannel = asdout.
getChannel();
352 if (databaseP ==
nullptr) {
357 for (
int i = 0; i < MaxEntry; i++) {
359 int layer = asdoutLayer;
360 if (asdoutisStrip && !asdoutisBackward) {
364 int elecChannel = asdoutChannel;
367 int chamber = asdoutChamber;
368 if (asdoutisEndcap && asdoutisTriplet) {
369 chamber = chamber - 1;
371 int offset = (asdout.
isWire()) ? 4 : 0;
372 if (databaseP->
getEntry(i, 0) == layer &&
373 databaseP->
getEntry(i, 1) == chamber &&
374 databaseP->
getEntry(i, 2 + offset) == elecChannel) {
376 int block = databaseP->
getEntry(i, 4);
377 int channel = databaseP->
getEntry(i, 5);
379 return std::make_unique<TGCChannelPPIn>(
388 const int side,
const int sector,
const std::vector<std::string>& diffFile,
389 const std::string& blockname,
390 std::shared_ptr<TGCDatabaseASDToPP>& database) {
394 std::vector<std::vector<int>> info =
401 if (database->isCommon()) {
402 database = std::make_unique<TGCDatabaseASDToPP>(
407 for (
auto& i : info) {