CMS 3D CMS Logo

DTConfigManager.cc

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 //
00003 //   Class: DTConfigManager
00004 //
00005 //   Description: DT Configuration manager includes config classes for every single chip
00006 //
00007 //
00008 //   Author List:
00009 //   C.Battilana
00010 //
00011 //   april 07 : SV DTConfigTrigUnit added
00012 //   april 07 : CB Removed DTGeometry dependecies
00013 //-----------------------------------------------------------------------
00014 
00015 //-----------------------
00016 // This Class's Header --
00017 //-----------------------
00018 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigManager.h"
00019 
00020 //---------------
00021 // C++ Headers --
00022 //---------------
00023 #include <iostream>
00024                
00025 //-------------------------------
00026 // Collaborating Class Headers --
00027 //-------------------------------
00028 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
00029 
00030 using namespace std;
00031 
00032 //----------------
00033 // Constructors --
00034 //----------------
00035 
00036 DTConfigManager::DTConfigManager(){
00037 
00038 }
00039         
00040 //--------------
00041 // Destructor --
00042 //--------------
00043 
00044 DTConfigManager::~DTConfigManager(){
00045 
00046   my_sectcollmap.clear();
00047   my_trigunitmap.clear();
00048   my_tsphimap.clear();
00049   my_tsthetamap.clear();
00050   my_tracomap.clear();
00051   my_btimap.clear();
00052 
00053 }
00054 
00055 //--------------
00056 // Operations --
00057 //--------------
00058 
00059 DTConfigBti* DTConfigManager::getDTConfigBti(DTBtiId btiid) const {
00060   
00061   DTChamberId chambid = btiid.SLId().chamberId();
00062   BtiMap::const_iterator biter1 = my_btimap.find(chambid);
00063   if (biter1 == my_btimap.end()){
00064     std::cout << "DTConfigManager::getConfigBti : Chamber (" << chambid.wheel()
00065               << "," << chambid.sector()
00066               << "," << chambid.station() 
00067               << ") not found, return 0" << std::endl;
00068     return 0;
00069   }
00070   
00071   innerBtiMap::const_iterator biter2 = (*biter1).second.find(btiid);
00072   if (biter2 == (*biter1).second.end()){
00073     std::cout << "DTConfigManager::getConfigBti : BTI (" << btiid.wheel()
00074               << "," << btiid.sector()
00075               << "," << btiid.station()
00076               << "," << btiid.superlayer()
00077               << "," << btiid.bti()
00078               << ") not found, return 0" << std::endl;
00079     return 0;
00080   }
00081   return const_cast<DTConfigBti*>(&(*biter2).second);
00082 
00083 }  
00084 
00085 const std::map<DTBtiId,DTConfigBti>& DTConfigManager::getDTConfigBtiMap(DTChamberId chambid) const {
00086   
00087   BtiMap::const_iterator biter = my_btimap.find(chambid);
00088   if (biter == my_btimap.end()){
00089     std::cout << "DTConfigManager::getConfigBtiMap : Chamber (" << chambid.wheel()
00090               << "," << chambid.sector()
00091               << "," << chambid.station() 
00092               << ") not found, return a reference to the end of the map" << std::endl;
00093   }
00094   
00095   return (*biter).second;
00096 
00097 }
00098 
00099 DTConfigTraco* DTConfigManager::getDTConfigTraco(DTTracoId tracoid) const {
00100   
00101   DTChamberId chambid = tracoid.ChamberId();
00102   TracoMap::const_iterator titer1 = my_tracomap.find(chambid);
00103   if (titer1 == my_tracomap.end()){
00104     std::cout << "DTConfigManager::getConfigTraco : Chamber (" << chambid.wheel()
00105               << "," << chambid.sector()
00106               << "," << chambid.station() 
00107               << ") not found, return 0" << std::endl;
00108     return 0;
00109   }
00110   
00111   innerTracoMap::const_iterator titer2 = (*titer1).second.find(tracoid);
00112   if (titer2 == (*titer1).second.end()){
00113     std::cout << "DTConfigManager::getConfigTraco : TRACO (" << tracoid.wheel()
00114               << "," << tracoid.sector()
00115               << "," << tracoid.station()
00116               << "," << tracoid.traco()
00117               << ") not found, return a reference to the end of the map" << std::endl;
00118     return 0;
00119   }
00120   return const_cast<DTConfigTraco*>(&(*titer2).second);
00121 
00122 }
00123 
00124 const std::map<DTTracoId,DTConfigTraco>& DTConfigManager::getDTConfigTracoMap(DTChamberId chambid) const {
00125   
00126   TracoMap::const_iterator titer = my_tracomap.find(chambid);
00127   if (titer == my_tracomap.end()){
00128     std::cout << "DTConfigManager::getConfigTracoMap : Chamber (" << chambid.wheel()
00129               << "," << chambid.sector()
00130               << "," << chambid.station() 
00131               << ") not found, return 0" << std::endl;
00132   }
00133 
00134   return (*titer).second;
00135 
00136 }
00137 
00138 DTConfigTSTheta* DTConfigManager::getDTConfigTSTheta(DTChamberId chambid) const {
00139  
00140   TSThetaMap::const_iterator thiter = my_tsthetamap.find(chambid);
00141   if (thiter == my_tsthetamap.end()){
00142     std::cout << "DTConfigManager::getConfigTSTheta : Chamber (" << chambid.wheel()
00143               << "," << chambid.sector()
00144               << "," << chambid.station() 
00145               << ") not found, return 0" << std::endl;
00146     return 0;
00147   }
00148   
00149   return const_cast<DTConfigTSTheta*>(&(*thiter).second);
00150 
00151 }
00152 
00153 DTConfigTSPhi* DTConfigManager::getDTConfigTSPhi(DTChamberId chambid) const {
00154   
00155   TSPhiMap::const_iterator phiter = my_tsphimap.find(chambid);
00156   if (phiter == my_tsphimap.end()){
00157     std::cout << "DTConfigManager::getConfigTSPhi : Chamber (" << chambid.wheel()
00158               << "," << chambid.sector()
00159               << "," << chambid.station() 
00160               << ") not found, return 0" << std::endl;
00161     return 0;
00162   }
00163 
00164   return const_cast<DTConfigTSPhi*>(&(*phiter).second);
00165 
00166 }
00167   
00168 DTConfigTrigUnit* DTConfigManager::getDTConfigTrigUnit(DTChamberId chambid) const {
00169   
00170    TrigUnitMap::const_iterator tuiter = my_trigunitmap.find(chambid);
00171    if (tuiter == my_trigunitmap.end()){
00172      std::cout << "DTCOnfigManager::getConfigTrigUnit : Chamber (" << chambid.wheel()
00173               << "," << chambid.sector()
00174               << "," << chambid.station() 
00175               << ") not found, return 0" << std::endl;
00176      return 0;
00177    }
00178 
00179    return const_cast<DTConfigTrigUnit*>(&(*tuiter).second);
00180 
00181 }
00182 
00183 DTConfigSectColl* DTConfigManager::getDTConfigSectColl(DTSectCollId scid) const {
00184   
00185   SectCollMap::const_iterator sciter = my_sectcollmap.find(scid);
00186   if (sciter == my_sectcollmap.end()){
00187     std::cout << "DTConfigManager::getConfigSectColl : SectorCollector (" << scid.wheel()
00188               << "," << scid.sector() 
00189               << ") not found, return 0" << std::endl;
00190     return 0;
00191   }
00192 
00193   return const_cast<DTConfigSectColl*>(&(*sciter).second);
00194 
00195 }
00196 
00197 void DTConfigManager::setDTConfigBti(DTBtiId btiid,DTConfigBti conf){
00198 
00199   DTChamberId chambid = btiid.SLId().chamberId();
00200   my_btimap[chambid][btiid] = conf;
00201 
00202 }  
00203 
00204 void DTConfigManager::setDTConfigTraco(DTTracoId tracoid,DTConfigTraco conf){
00205 
00206   DTChamberId chambid = tracoid.ChamberId();
00207   my_tracomap[chambid][tracoid] = conf;
00208 
00209 }  
00210 
00211 int DTConfigManager::getBXOffset() const {
00212 
00213   int ST = static_cast<int>(getDTConfigBti(DTBtiId(1,1,1,1,1))->ST());
00214   int coarse = getDTConfigSectColl(DTSectCollId(1,1))->CoarseSync(1);
00215   return (ST/2 + ST%2 + coarse); //CB check this function!
00216 
00217 }
00218 

Generated on Tue Jun 9 17:40:26 2009 for CMSSW by  doxygen 1.5.4