Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:30

0001 #include "CondFormats/RPCObjects/interface/DBSpecToDetUnit.h"
0002 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0003 #include "CondFormats/RPCObjects/interface/ChamberLocationSpec.h"
0004 #include "CondFormats/RPCObjects/interface/FebLocationSpec.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "FWCore/Utilities/interface/Exception.h"
0007 #include <iostream>
0008 #include <string>
0009 
0010 using namespace std;
0011 using namespace edm;
0012 
0013 uint32_t DBSpecToDetUnit::operator()(const ChamberLocationSpec& ch, const FebLocationSpec& feb) {
0014   // REGION
0015   int region = -2;
0016   bool barrel = (ch.barrelOrEndcap == 1);
0017   if (barrel)
0018     region = 0;
0019   else if (ch.diskOrWheel < 0)
0020     region = -1;
0021   else if (ch.diskOrWheel > 0)
0022     region = 1;
0023 
0024   //ROLL
0025   string localEtaPartVal[6] = {"Forward", "Central", "Backward", "A", "B", "C"};
0026   string nroll = localEtaPartVal[feb.localEtaPartition - 1];
0027 
0028   //SUBSECTOR
0029   string subsecVal[5] = {"--", "-", "0", "+", "++"};
0030   string subsec = subsecVal[ch.subsector + 2];
0031 
0032   // build RPCdetId
0033   try {
0034     RPCDetId dn;
0035     dn.buildfromDB(region, ch.diskOrWheel, ch.layer, ch.sector, subsec, nroll, " ");
0036     return dn.rawId();
0037   } catch (cms::Exception& e) {
0038     LogDebug("CondFormas/DBSpecToDetInit") << " Problem with RPCDetId, got exception!! "
0039                                            << "DB Chamber " << ch.chamberLocationName() << " roll " << nroll << e;
0040     return 0;
0041   }
0042 }