Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-27 08:40:46

0001 /**
0002  * @file Setup.cc
0003  * @brief Implementation of the Setup singleton geometry and mapping logic.
0004  *
0005  * The Setup class is responsible for loading/initializing the detector map and
0006  * providing accessors for geometry and readout mappings used throughout the
0007  * LFHCal analysis software.
0008  */
0009 
0010 #include "Setup.h"
0011 #include "RootSetupWrapper.h"
0012 #include <iostream>
0013 #include <fstream>
0014 #include "TObjArray.h"
0015 #include "TObjString.h"
0016 #include "utility"
0017 
0018 Setup* Setup::instancePtr = nullptr;
0019 
0020 ClassImp(Setup);
0021 
0022 /**
0023  * @brief Initialize the setup from a text-based detector mapping file.
0024  *
0025  * This routine reads a geometry definition file, fills the lookup maps for cell IDs,
0026  * row/column/layer/module information, and stores the maximum geometry limits.
0027  *
0028  * @param file Path to the mapping file.
0029  * @param debug Verbosity level for diagnostic output.
0030  * @return true if initialization succeeds, false if the file cannot be opened.
0031  */
0032 bool Setup::Initialize(TString file, int debug){
0033 
0034   std::cout << "entered setup initialize" << std::endl;
0035   if(isInit){
0036     std::cout<<"Already initialized, bailing out without action"<<std::endl;
0037     return true;
0038   }
0039   std::fstream input;
0040   input.open(file.Data(),std::ios::in);
0041   if(!input.is_open()){
0042     std::cout<<"Could not open "<<file<<std::endl;
0043     std::cout<<"Leaving uninitialized"<<std::endl;
0044     return false;
0045   }
0046   nMaxLayer   = -1;
0047   nMaxRow     = -1;
0048   nMaxColumn  = -1;
0049   nMaxModule  = -1;
0050   nMaxROUnit  = -1;
0051   maxCellID   = -1;
0052   int AROunit,AROchannel,Alayer,AROlayer,Arow,Acolumn,Amod,segSize;
0053   TString Anassembly;
0054   int Akey;
0055   
0056   for( TString tempLine; tempLine.ReadLine(input, kTRUE); ) {
0057         // check if line should be considered
0058     if (tempLine.BeginsWith("%") || tempLine.BeginsWith("#")){
0059         continue;
0060     }
0061     if (debug > 10) std::cout << tempLine.Data() << std::endl;
0062     TObjArray *tempArr  = tempLine.Tokenize("\t");
0063     if(tempArr->GetEntries()<1){
0064         if (debug > 1) std::cout << "nothing to be done" << std::endl;
0065         delete tempArr;
0066         continue;
0067     } else if (tempArr->GetEntries() == 1 ){
0068         // Separate the string according to space
0069         tempArr       = tempLine.Tokenize(" ");
0070         if(tempArr->GetEntries()<1){
0071             if (debug > 1) std::cout << "nothing to be done" << std::endl;
0072             delete tempArr;
0073             continue;
0074         } else if (tempArr->GetEntries() == 1  ) {
0075             if (debug > 1) std::cout << ((TString)((TObjString*)tempArr->At(0))->GetString()).Data() << " no correct format detected" << std::endl;
0076             delete tempArr;
0077             continue;
0078         }
0079     }
0080 
0081     if (tempLine.BeginsWith("sumOpt")){
0082       sumOpt  = ((TString)((TObjString*)tempArr->At(1))->GetString()).Atoi();
0083       delete tempArr;
0084       continue;
0085     }
0086     
0087     if (tempArr->GetEntries()<10){
0088       if (debug > 1) std::cout << "line not conform with mapping format, skipping" << std::endl;
0089       delete tempArr;
0090       continue;
0091     }
0092    
0093     AROunit     = ((TString)((TObjString*)tempArr->At(0))->GetString()).Atoi();
0094     AROchannel  = ((TString)((TObjString*)tempArr->At(1))->GetString()).Atoi();
0095     Alayer      = ((TString)((TObjString*)tempArr->At(2))->GetString()).Atoi();
0096     Anassembly  = ((TString)((TObjString*)tempArr->At(3))->GetString());
0097     AROlayer    = ((TString)((TObjString*)tempArr->At(4))->GetString()).Atoi();
0098     Arow        = ((TString)((TObjString*)tempArr->At(5))->GetString()).Atoi();
0099     Acolumn     = ((TString)((TObjString*)tempArr->At(6))->GetString()).Atoi();
0100     Amod        = ((TString)((TObjString*)tempArr->At(7))->GetString()).Atoi();
0101     float AmodX = ((TString)((TObjString*)tempArr->At(8))->GetString()).Atof();
0102     float AmodY = ((TString)((TObjString*)tempArr->At(9))->GetString()).Atof(); 
0103     segSize     = ((TString)((TObjString*)tempArr->At(10))->GetString()).Atoi();    
0104 
0105 
0106         // Try to set map for mod pos
0107     ModPos[Amod]=std::make_pair(AmodX,AmodY);
0108     //std::cerr<< "modnr: "<< Amod <<std::endl;
0109 
0110     //set segment size per representative layer
0111     SegmentSum[Alayer] = segSize;
0112     
0113     Akey=(Amod<<9)+(Arow<<8)+(Acolumn<<6)+(Alayer);
0114     assemblyID[Akey] = Anassembly;
0115     ROunit    [Akey] = AROunit;
0116     ROchannel [Akey] = AROchannel;
0117     Board     [Akey] = AROlayer;
0118     CellIDfromRO[std::make_pair(AROunit,AROchannel)]=Akey;
0119     if (nMaxLayer < Alayer)   nMaxLayer   = Alayer;
0120     if (nMaxRow < Arow)       nMaxRow     = Arow;
0121     if (nMaxColumn < Acolumn) nMaxColumn  = Acolumn;
0122     if (nMaxModule < Amod)    nMaxModule  = Amod;
0123     if (nMaxROUnit < AROunit) nMaxROUnit  = AROunit;
0124     if (maxCellID < Akey)     maxCellID   = Akey;
0125     if (debug > 10)std::cout <<AROunit<< "\t" << AROchannel << "\t"<< Alayer << "\t"<< Anassembly << "\t"<< AROlayer << "\t row: "<< Arow << "\t col: "<< Acolumn << "\t mod: "<< Amod << "\t"<< AmodX<< "\t"<< AmodY<< "\t"<< segSize<< std::endl;
0126     if (debug > 1)std::cout << "registered cell: " << DecodeCellID(Akey).Data() << std::endl;
0127   }
0128     
0129   input.close();
0130   isInit=true;
0131   return isInit;
0132 }
0133 
0134 bool Setup::Initialize(RootSetupWrapper& rsw){
0135   std::cout<<rsw.isInit<<"\t"<<rsw.assemblyID.size()<<std::endl;
0136   isInit          =rsw.isInit;
0137   assemblyID      =rsw.assemblyID;
0138   ROunit          =rsw.ROunit;
0139   ROchannel       =rsw.ROchannel;
0140   Board           =rsw.Board;
0141   CellIDfromRO    =rsw.CellIDfromRO;
0142   nMaxLayer       =rsw.nMaxLayer;
0143   nMaxRow         =rsw.nMaxRow;
0144   nMaxColumn      =rsw.nMaxColumn;
0145   nMaxModule      =rsw.nMaxModule;
0146   nMaxROUnit      =rsw.nMaxROUnit;
0147   maxCellID       =rsw.maxCellID;
0148   ModPos          =rsw.ModPos;
0149   SegmentSum      =rsw.SegmentSum;
0150   sumOpt          =rsw.sumOpt;
0151   return isInit;
0152 }
0153 
0154 bool Setup::IsInit() const{
0155   return isInit;
0156 }
0157 
0158 TString Setup::GetAssemblyID(int cellID) const{
0159   std::map<int, TString>::const_iterator it=assemblyID.find(cellID);
0160   if(it!=assemblyID.end()) return it->second;
0161   else return "";
0162 }
0163 
0164 TString Setup::GetAssemblyID(int row, int col, int lay, int mod=0) const{
0165   return GetAssemblyID((mod<<9)+(row<<8)+(col<<6)+lay);
0166 }
0167 
0168 int Setup::GetCellID(int roboard, int roch) const{
0169   std::map<std::pair<int,int>,int>::const_iterator it=CellIDfromRO.find(std::make_pair(roboard,roch));
0170   if(it!=CellIDfromRO.cend()) return it->second;
0171   else return -1;
0172 }
0173 
0174 int Setup::GetCellID(int row, int col, int lay, int mod=0)const {
0175   return (mod<<9)+(row<<8)+(col<<6)+lay;
0176 }
0177 
0178 int Setup::GetColumn(int cellID) const{
0179   return (cellID&(3<<6))>>6;
0180 }
0181 
0182 int Setup::GetLayer(int cellID) const{
0183   return (cellID&((1<<6)-1));
0184 }
0185 
0186 int Setup::GetModule(int cellID) const{
0187   return cellID>>9;
0188 }
0189 
0190 int Setup::GetROchannel(int cellID) const{
0191   std::map<int, int>::const_iterator it=ROchannel.find(cellID);
0192   if(it!=ROchannel.end()) return it->second;
0193   else return -999;
0194 }
0195 
0196 int Setup::GetROchannel(int row, int col, int lay, int mod=0) const{
0197   return GetROchannel((mod<<9)+(row<<8)+(col<<6)+lay);
0198 }
0199 
0200 int Setup::GetROunit(int cellID) const{
0201   std::map<int,int>::const_iterator it=ROunit.find(cellID);
0202   if(it!=ROunit.end()) return it->second;
0203   else return -999;
0204 }
0205 
0206 int Setup::GetROunit(int row, int col, int lay, int mod=0) const{
0207   return GetROunit((mod<<9)+(row<<8)+(col<<6)+lay);
0208 }
0209 
0210 int Setup::GetRow(int cellID) const{
0211   return (cellID&(1<<8))>>8;
0212 }
0213 
0214 double Setup::GetModuleX(int mod)const {
0215   auto it = ModPos.find(mod);
0216   if (it != ModPos.end()) {
0217 //      std::cerr<< "My value: " << it->second.first << std::endl;
0218       return static_cast<double>(it->second.first);
0219   }
0220   else {
0221     std::cerr << "Warning: Module " << mod << " not found in ModPos\n";
0222     return -999.0;
0223   }
0224 }
0225 
0226 double Setup::GetModuleY(int mod)const {
0227   auto it = ModPos.find(mod);
0228   if (it != ModPos.end()) {
0229       return static_cast<double>(it->second.second);
0230   }
0231   else {
0232     std::cerr << "Warning: Module " << mod << " not found in ModPos\n";
0233     return -999.0;
0234   }
0235 }
0236 
0237 int Setup::GetTotalNbChannels(void) const {
0238   return (int) ROunit.size();
0239 }
0240 
0241 double Setup::GetX(int cellID) const{
0242   int col=GetColumn(cellID);
0243   return -7.5/*cm*/+col*cellW/*cm*/ + GetModuleX(GetModule(cellID));
0244 }
0245 
0246 double Setup::GetY(int cellID) const{
0247   int row=GetRow(cellID);
0248   return -2.5/*cm*/+row*cellH/*cm*/ + GetModuleY(GetModule(cellID));
0249 }
0250 
0251 double Setup::GetZ(int cellID) const{
0252   int lay=GetLayer(cellID);
0253   if (sumOpt == 0){
0254     return cellD/2 + lay*cellD/*cm*/;
0255   } else {
0256     double tempZ = 0;
0257     int row = GetRow(cellID);
0258     int col = GetColumn(cellID);
0259     int mod = GetModule(cellID);
0260     for (int l = 0; l < lay; l++){
0261       long tempCellID = GetCellID(row, col,l, mod);
0262       tempZ = tempZ+GetSegmentDepth(tempCellID);
0263     }  
0264     tempZ = tempZ+GetSegmentDepth(cellID)/2.;
0265     return tempZ;
0266   } 
0267 }
0268 
0269 int Setup::GetLayersInSegmentFromLayer(int layerNr) const{
0270   auto it = SegmentSum.find(layerNr);
0271   if (it != SegmentSum.end())
0272     return it->second;
0273   return 1;
0274 }
0275 
0276 int Setup::GetLayersInSegment(int cellID) const{
0277   int lay=GetLayer(cellID);
0278   auto it = SegmentSum.find(lay);
0279   if (it != SegmentSum.end())
0280     return it->second;
0281   return 1;
0282 }
0283 
0284 double Setup::GetSegmentDepth(int cellID) const{
0285   int lay=GetLayer(cellID);
0286   auto it = SegmentSum.find(lay);
0287   if (it != SegmentSum.end())
0288     return it->second*cellD;
0289   return cellD;
0290 }
0291 
0292 bool Setup::HasSameSegmentDepth() const{
0293   const int& firstVal = SegmentSum.begin()->second;
0294   for (const auto& [key, val] : SegmentSum) {
0295     if (val != firstVal) {
0296       return false;
0297     }
0298   }
0299   return true;
0300 }
0301 
0302 TString Setup::DecodeCellID(int cellID) const{
0303   TString out = Form("cell ID: %d ==> RO unit %d RO channel %d  module %d  layer %d  column %d row %d", cellID, GetROunit(cellID), GetROchannel(cellID), GetModule(cellID), GetLayer(cellID), GetColumn(cellID), GetRow(cellID));
0304   return out;
0305 }
0306 
0307 
0308 int Setup::GetNMaxLayer() const{
0309   return nMaxLayer;
0310 }
0311 
0312 int Setup::GetNMaxRow() const{
0313   return nMaxRow;
0314 }
0315 
0316 int Setup::GetNMaxColumn() const{
0317   return nMaxColumn;
0318 }
0319 
0320 int Setup::GetNMaxModule() const{
0321   return nMaxModule;
0322 }
0323 
0324 int Setup::GetNMaxROUnit() const{
0325   return nMaxROUnit;
0326 }
0327 
0328 int Setup::GetNMaxKCUs() const{
0329   return (int)(nMaxROUnit/2+1);
0330 }
0331 
0332 int Setup::GetMaxCellID() const{
0333   return maxCellID;
0334 }
0335 
0336 int Setup::GetMaxChannelInLayerFull() const{
0337   int maxChInLayer  = (nMaxColumn+1)*(nMaxRow+1)*(nMaxModule+1);
0338   return maxChInLayer;
0339 }
0340 
0341 
0342 int Setup::GetChannelInLayer(int cellID) const{
0343   int row     = GetRow(cellID);
0344   int column  = GetColumn(cellID);
0345   int absChL  = row*(nMaxColumn+1)+column;
0346   return absChL;
0347 }
0348 
0349 int Setup::GetChannelInLayerFull(int cellID, DetConf::Type type) const{
0350   int row     = GetRow(cellID);
0351   int column  = GetColumn(cellID);
0352   int mod     = GetModule(cellID);
0353   int absChL  = -1;
0354   
0355   if (type == DetConf::Type::Unset){
0356     type = GetDetectorConfig();
0357   }
0358   // Dual 8M
0359   if ( type == DetConf::Type::Dual8M){
0360     absChL    = mod*((nMaxColumn+1)*(nMaxRow+1))+row*(nMaxColumn+1)+column;
0361   // Medium TB
0362   } else if ( type == DetConf::Type::MediumTB){
0363     if (mod%2 == 0){
0364       absChL = mod%2*((nMaxColumn+1) *(nMaxRow+1))+row*(nMaxColumn+1)*2+column+(int)mod/2*16;
0365     } else {
0366       absChL = (mod%2-1)*((nMaxColumn+1) *(nMaxRow+1))+row*(nMaxColumn+1)*2+column+(int)(mod-1)/2*16 + (nMaxColumn+1);
0367     }
0368   // Single 8M module
0369   } else if ( type == DetConf::Type::Single8M){
0370     absChL = row*(nMaxColumn+1)+column;
0371   // Focal or Asic geom
0372   } else if ( type == DetConf::Type::FocalH || type == DetConf::Type::Asic){
0373     absChL = mod*((nMaxColumn+1)*(nMaxRow+1))+row*(nMaxColumn+1)+column;
0374   }
0375   return absChL;
0376 }
0377 
0378 int Setup::GetAbsRow(int cellID, DetConf::Type type) const{
0379   int row     = GetRow(cellID);
0380   int mod     = GetModule(cellID);
0381   int absRow  = row;
0382   
0383   if (type == DetConf::Type::Unset){
0384     type = GetDetectorConfig();
0385   }
0386   // Dual 8M
0387   if ( type == DetConf::Type::Dual8M){
0388     absRow    = mod * (nMaxRow+1) + row;
0389     
0390   // Medium TB
0391   } else if ( type == DetConf::Type::MediumTB){
0392     if (mod%2 == 0){
0393       absRow = int(mod/2) * (nMaxRow+1) + row;
0394     } else {
0395       absRow = int((mod-1)/2)* (nMaxRow+1) + row;
0396     }
0397   // Single 8M module
0398   } else if ( type == DetConf::Type::Single8M){
0399     absRow = row;
0400   // Focal or Asic geom
0401   } else if ( type == DetConf::Type::FocalH || type == DetConf::Type::Asic){
0402     absRow = row;
0403   }
0404   return absRow;
0405 }
0406 
0407 int Setup::GetAbsColumn(int cellID, DetConf::Type type) const{
0408   int col     = GetColumn(cellID);
0409   int mod     = GetModule(cellID);
0410   int absCol  = col;
0411   
0412   if (type == DetConf::Type::Unset){
0413     type = GetDetectorConfig();
0414   }
0415   // Dual 8M
0416   if ( type == DetConf::Type::Dual8M){
0417     absCol    = col;
0418   // Medium TB
0419   } else if ( type == DetConf::Type::MediumTB){
0420     
0421     absCol = mod%2 * (nMaxColumn+1) + col;
0422     
0423   // Single 8M module
0424   } else if ( type == DetConf::Type::Single8M){
0425     absCol = col;
0426   // Focal or Asic geom
0427   } else if ( type == DetConf::Type::FocalH || type == DetConf::Type::Asic){
0428     absCol = col;
0429   }
0430   return absCol;
0431 }
0432 
0433 
0434 
0435 int Setup::GetAbsNMaxROChannel() const{
0436   int max = -1;
0437   std::map<int, int>::const_iterator it;
0438   for(it=ROchannel.begin(); it!=ROchannel.end(); ++it){
0439     if( it->second > max ) max = it->second;
0440   }
0441   return max; 
0442 }
0443 
0444 float Setup::GetMinX() const{
0445   float min = 1e6;
0446   std::map<int, TString>::const_iterator it;
0447   for(it=assemblyID.begin(); it!=assemblyID.end(); ++it){
0448     int cellID = it->first;
0449     if( GetX(cellID) < min ) min = GetX(cellID);
0450   }
0451   return min-(cellW/2);/*to get to the center of the tile*/
0452 }
0453 
0454 float Setup::GetMaxX() const{
0455   float max = -1e6;
0456   std::map<int, TString>::const_iterator it;
0457   for(it=assemblyID.begin(); it!=assemblyID.end(); ++it){
0458     int cellID = it->first;
0459     if( GetX(cellID) > max ) max = GetX(cellID);
0460   }
0461   return max+(cellW/2);/*to get to the center of the tile*/
0462 }
0463 
0464 float Setup::GetMinY() const{
0465   float min = 1e6;
0466   std::map<int, TString>::const_iterator it;
0467   for(it=assemblyID.begin(); it!=assemblyID.end(); ++it){
0468     int cellID = it->first;
0469     if( GetY(cellID) < min ) min = GetY(cellID);
0470   }
0471   return min-(cellH/2);/*to get to the center of the tile*/
0472 }
0473 
0474 float Setup::GetMaxY() const{
0475   float max = -1e6;
0476   std::map<int, TString>::const_iterator it;
0477   for(it=assemblyID.begin(); it!=assemblyID.end(); ++it){
0478     int cellID = it->first;
0479     if( GetY(cellID) > max ) max = GetY(cellID);
0480   }
0481   return max+(cellH/2);/*to get to the center of the tile*/
0482 }
0483 
0484 float Setup::GetMinZ() const{
0485   float min = 1e6;
0486   std::map<int, TString>::const_iterator it;
0487   for(it=assemblyID.begin(); it!=assemblyID.end(); ++it){
0488     int cellID = it->first;
0489     if( GetZ(cellID) < min ) min = GetZ(cellID)-(GetSegmentDepth(cellID)/2);
0490   }
0491   return min;/*to get to the beginning of tile*/
0492 }
0493 
0494 float Setup::GetMaxZ() const{
0495   float max = -1e6;
0496   std::map<int, TString>::const_iterator it;
0497   for(it=assemblyID.begin(); it!=assemblyID.end(); ++it){
0498     int cellID = it->first;
0499     if( GetZ(cellID) > max ) max = GetZ(cellID)+(GetSegmentDepth(cellID)/2);
0500   }
0501   return max;/*to get to the end of tile*/
0502 }
0503 
0504 std::vector<double> Setup::GetZBinEdges() const{  // for summing
0505   std::vector<double> edges;
0506   double z = GetMinZ();
0507   edges.push_back(z);
0508   for (int lay = 0; lay <= nMaxLayer; lay++){
0509     z += GetLayersInSegmentFromLayer(lay) * cellD;
0510     edges.push_back(z);
0511   }
0512   return edges;
0513 }
0514 
0515 bool Setup::IsLayerOn(int layer, int mod) const{
0516   bool isOn = false;
0517   for (int r = 0; r< GetNMaxRow(); r++){
0518     for (int c = 0; c < GetNMaxColumn(); c++){
0519       if (mod == -1){
0520         for (int m = 0; m < GetNMaxModule(); m++){
0521           int cellID = GetCellID(r, c, layer, m);
0522           std::map<int, TString>::const_iterator it=assemblyID.find(cellID);
0523           if (it != assemblyID.end()){
0524             isOn = true;
0525             break;
0526           }
0527         }
0528       } else {
0529         int cellID = GetCellID(r, c, layer, mod);
0530         std::map<int, TString>::const_iterator it=assemblyID.find(cellID);
0531         if (it != assemblyID.end()){
0532           isOn = true;
0533           break;
0534         }
0535       }
0536     }
0537   }
0538   return isOn;
0539 }
0540 
0541 bool Setup::IsAsicOn(int asic) const{
0542   bool isOn = false;
0543   for (int ch = 0; ch< 76; ch++){
0544     int cellID = GetCellID(asic, ch);
0545     std::map<int, TString>::const_iterator it=assemblyID.find(cellID);
0546     if (it != assemblyID.end()){
0547       isOn = true;
0548       break;
0549     }    
0550   }
0551   return isOn;
0552 }
0553 
0554 
0555 int Setup::GetNActiveLayers() const{
0556   int nActLayer = 0;
0557   for (Int_t l = 0; l < GetNMaxLayer()+1; l++){
0558     if (IsLayerOn(l,-1)) nActLayer++;
0559   }
0560   return nActLayer;
0561 }
0562 
0563 int Setup::GetNActiveCells() const{
0564   int nActCells = assemblyID.size();
0565   return nActCells;
0566 }
0567 
0568 float Setup::GetCellWidth() const{
0569   return cellW;
0570 }
0571 
0572 float Setup::GetCellHeight() const{
0573   return cellH;
0574 }
0575 
0576 float Setup::GetCellDepth() const{
0577   return cellD;
0578 }
0579 
0580 DetConf::Type Setup::GetDetectorConfig() const{
0581   DetConf::Type type;
0582   if (GetNMaxModule()+1 == 2){
0583     if (GetNMaxRow()+1 == 2 && GetNMaxColumn()+1 == 4)
0584       type = DetConf::Type::Dual8M;
0585     else 
0586       type = DetConf::Type::Undef;
0587   } else if (GetNMaxModule()+1 == 8){
0588     if(GetNMaxRow()+1 == 2 && GetNMaxColumn()+1 == 4)
0589       type = DetConf::Type::LargeTB;
0590     else 
0591       type = DetConf::Type::Undef;
0592   } else if (GetNMaxModule()+1 == 6){
0593     if(GetNMaxRow()+1 == 2 && GetNMaxColumn()+1 == 4)
0594       type = DetConf::Type::MediumTB;
0595     else 
0596       type = DetConf::Type::Undef;
0597   } else if (GetNMaxModule()+1 == 1){
0598     if (GetNMaxRow()+1 == 2 && GetNMaxColumn()+1 == 4)
0599       type = DetConf::Type::Single8M;
0600     else if (GetNMaxRow()+1 == 2 && GetNMaxColumn()+1 == 2)
0601       type = DetConf::Type::Single4M;
0602     else if (GetNMaxRow()+1 == 1 && GetNMaxColumn()+1 == 2)
0603       type = DetConf::Type::Single2MH;
0604     else if (GetNMaxRow()+1 == 2 && GetNMaxColumn()+1 == 1)
0605       type = DetConf::Type::Single2MV;
0606     else if (GetNMaxRow()+1 == 1 && GetNMaxColumn()+1 == 1)
0607       type = DetConf::Type::SingleTile;
0608     else 
0609       type = DetConf::Type::Undef;
0610   } else {
0611     type = DetConf::Type::Undef;
0612   }
0613   return type;
0614 }
0615 
0616 int Setup::GetAbsMaxColumnsSetup( DetConf::Type type){
0617   int maxCol = nMaxColumn+1;
0618   // Dual 8M
0619   if ( type == DetConf::Type::Dual8M){
0620     maxCol = nMaxColumn+1;
0621   // Medium TB
0622   } else if ( type == DetConf::Type::MediumTB){
0623     maxCol = (nMaxColumn+1)*2;
0624   // Single 8M module
0625   } else if ( type == DetConf::Type::Single8M){
0626     maxCol = nMaxColumn+1;
0627   // Focal or Asic geom
0628   } else if ( type == DetConf::Type::FocalH || type == DetConf::Type::Asic){
0629     maxCol = 8;   // fixed number
0630   }
0631   return maxCol;
0632 }
0633 
0634 int Setup::GetAbsMaxRowsSetup( DetConf::Type type){
0635   int maxRow = nMaxRow+1;
0636   // Dual 8M
0637   if ( type == DetConf::Type::Dual8M){
0638     maxRow = (nMaxRow+1)*2;
0639   // Medium TB
0640   } else if ( type == DetConf::Type::MediumTB){
0641     maxRow = (nMaxRow+1)*3;
0642   // Single 8M module
0643   } else if ( type == DetConf::Type::Single8M){
0644     maxRow = nMaxRow+1;
0645   // Focal or Asic geom
0646   } else if ( type == DetConf::Type::FocalH || type == DetConf::Type::Asic){
0647     maxRow = 8;   // fixed number
0648   }
0649   return maxRow;
0650 }
0651 
0652 
0653 bool Setup::ContainedInSetup(int cellID) const{
0654   std::map<int, TString>::const_iterator it=assemblyID.find(cellID);
0655   if(it!=assemblyID.end()) return true;
0656   else return false;
0657 }
0658