Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:14

0001 #include "FWCore/Framework/interface/EventSetup.h"
0002 #include "FWCore/Framework/interface/ESHandle.h"
0003 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
0004 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
0005 #include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
0006 #include "Geometry/RPCGeometry/interface/RPCChamber.h"
0007 #include "Geometry/RPCGeometry/interface/RPCRoll.h"
0008 #include "CSCObjectMap.h"
0009 #include "CSCStationIndex.h"
0010 
0011 CSCObjectMap::CSCObjectMap(RPCGeometry const& rpcGeo) {
0012   for (TrackingGeometry::DetContainer::const_iterator it = rpcGeo.dets().begin(); it < rpcGeo.dets().end(); it++) {
0013     if (dynamic_cast<const RPCChamber*>(*it) != nullptr) {
0014       auto ch = dynamic_cast<const RPCChamber*>(*it);
0015       std::vector<const RPCRoll*> roles = (ch->rolls());
0016       for (std::vector<const RPCRoll*>::const_iterator r = roles.begin(); r != roles.end(); ++r) {
0017         RPCDetId rpcId = (*r)->id();
0018         int region = rpcId.region();
0019         if (region != 0) {
0020           int station = rpcId.station();
0021           int ring = rpcId.ring();
0022           int cscring = ring;
0023           int cscstation = station;
0024           RPCGeomServ rpcsrv(rpcId);
0025           int rpcsegment = rpcsrv.segment();
0026           int cscchamber = rpcsegment;  //FIX THIS ACCORDING TO RPCGeomServ::segment()Definition
0027           if ((station == 2 || station == 3 || station == 4) && ring == 3) {  //Adding Ring 3 of RPC to the CSC Ring 2
0028             cscring = 2;
0029           }
0030           CSCStationIndex ind(region, cscstation, cscring, cscchamber);
0031           std::set<RPCDetId> myrolls;
0032           if (rollstore.find(ind) != rollstore.end())
0033             myrolls = rollstore[ind];
0034           myrolls.insert(rpcId);
0035           rollstore[ind] = myrolls;
0036         }
0037       }
0038     }
0039   }
0040 }
0041 
0042 std::set<RPCDetId> const& CSCObjectMap::getRolls(CSCStationIndex index) const {
0043   // FIXME
0044   // the present inplementation allows for NOT finding the given index in the map;
0045   // a muon expert should check that this is the intended behaviour.
0046   static const std::set<RPCDetId> empty;
0047   return (rollstore.find(index) == rollstore.end()) ? empty : rollstore.at(index);
0048 }
0049 
0050 // register the class with the typelookup system used by the EventSetup
0051 #include "FWCore/Utilities/interface/typelookup.h"
0052 TYPELOOKUP_DATA_REG(CSCObjectMap);