CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/CondFormats/RPCObjects/src/DBSpecToDetUnit.cc

Go to the documentation of this file.
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==1);
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 localEtaPartVal[6]={"Forward","Central","Backward","A","B","C"};
00025   string nroll = localEtaPartVal[feb.localEtaPartition-1];
00026 
00027   //SUBSECTOR
00028   string subsecVal[5]={"--","-","0","+","++"};
00029   string subsec=subsecVal[ch.subsector+2];
00030 
00031   // build RPCdetId
00032   try {
00033     RPCDetId dn;
00034     dn.buildfromDB(region, ch.diskOrWheel, ch.layer, ch.sector, 
00035                    subsec, nroll, " ");
00036     return dn.rawId();
00037   } 
00038   catch(...) {
00039     if (debug) LogDebug ("CondFormas/DBSpecToDetInit") 
00040       <<" Problem with RPCDetId, got exception!! " 
00041       <<"DB Chamber "<<ch.chamberLocationName()<<" roll "<<nroll;
00042     return 0;
00043   }
00044 }