CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/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 "FWCore/Utilities/interface/Exception.h"
00007 #include <iostream>
00008 #include <string>
00009 
00010 using namespace std;
00011 using namespace edm;
00012 
00013 uint32_t DBSpecToDetUnit::operator()(const ChamberLocationSpec & ch, 
00014    const FebLocationSpec & feb)
00015 {
00016   static bool debug = edm::MessageDrop::instance()->debugEnabled;
00017   // REGION
00018   int region = -2;
00019   bool barrel = (ch.barrelOrEndcap==1);
00020   if (barrel) region = 0;
00021   else if (ch.diskOrWheel<0) region = -1;
00022   else if (ch.diskOrWheel>0) region = 1;
00023 
00024   //ROLL
00025   string localEtaPartVal[6]={"Forward","Central","Backward","A","B","C"};
00026   string nroll = localEtaPartVal[feb.localEtaPartition-1];
00027 
00028   //SUBSECTOR
00029   string subsecVal[5]={"--","-","0","+","++"};
00030   string subsec=subsecVal[ch.subsector+2];
00031 
00032   // build RPCdetId
00033   try {
00034     RPCDetId dn;
00035     dn.buildfromDB(region, ch.diskOrWheel, ch.layer, ch.sector, 
00036                    subsec, nroll, " ");
00037     return dn.rawId();
00038   } 
00039   catch(cms::Exception & e) {
00040     if (debug) LogDebug ("CondFormas/DBSpecToDetInit") 
00041       <<" Problem with RPCDetId, got exception!! " 
00042       <<"DB Chamber "<<ch.chamberLocationName()<<" roll "<<nroll
00043       <<e;
00044     return 0;
00045   }
00046 }