00001 #include "CondFormats/RPCObjects/interface/DBSpecToDetUnit.h" 00002 #include "DataFormats/MuonDetId/interface/RPCDetId.h" 00003 #include "CondFormats/RPCObjects/interface/ChamberLocationSpec.h" 00004 #include "CondFormats/RPCObjects/interface/FebLocationSpec.h" 00005 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00006 #include <iostream> 00007 #include <string> 00008 00009 using namespace std; 00010 using namespace edm; 00011 00012 uint32_t DBSpecToDetUnit::operator()(const ChamberLocationSpec & ch, 00013 const FebLocationSpec & feb) 00014 { 00015 static bool debug = edm::MessageDrop::instance()->debugEnabled; 00016 // REGION 00017 int region = -2; 00018 bool barrel = (ch.barrelOrEndcap=="Barrel"); 00019 if (barrel) region = 0; 00020 else if (ch.diskOrWheel<0) region = -1; 00021 else if (ch.diskOrWheel>0) region = 1; 00022 00023 //ROLL 00024 string nroll = feb.localEtaPartition; 00025 00026 // build RPCdetId 00027 try { 00028 RPCDetId dn; 00029 dn.buildfromDB(region, ch.diskOrWheel, ch.layer, ch.sector, 00030 ch.subsector, nroll, ch.chamberLocationName); 00031 return dn.rawId(); 00032 } 00033 catch(...) { 00034 if (debug) LogDebug ("CondFormas/DBSpecToDetInit") 00035 <<" Problem with RPCDetId, got exception!! " 00036 <<"DB Chamber "<<ch.chamberLocationName<<" roll "<<nroll; 00037 return 0; 00038 } 00039 }