diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index b7d691465a3ab..ca78bab90e840 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -92,16 +92,30 @@ def customiseFor10234(process): delattr(process.hltCaloStage1Digis, 'FedId') return process + +# migrate RPCPointProducer to a global::EDProducer (PR #10927) +def customiseFor10927(process): + if any(module.type_() is 'RPCPointProducer' for module in process.producers.itervalues()): + if not hasattr(process, 'CSCObjectMapESProducer'): + process.CSCObjectMapESProducer = cms.ESProducer( 'CSCObjectMapESProducer' ) + if not hasattr(process, 'DTObjectMapESProducer'): + process.DTObjectMapESProducer = cms.ESProducer( 'DTObjectMapESProducer' ) + return process + + # CMSSW version specific customizations -def customiseHLTforCMSSW(process,menuType="GRun",fastSim=False): +def customiseHLTforCMSSW(process, menuType="GRun", fastSim=False): import os cmsswVersion = os.environ['CMSSW_VERSION'] if cmsswVersion >= "CMSSW_7_5": + process = customiseFor9232(process) process = customiseFor8679(process) process = customiseFor8356(process) process = customiseFor7966(process) process = customiseFor7794(process) if cmsswVersion >= "CMSSW_7_4": process = customiseFor10234(process) + process = customiseFor10927(process) + return process diff --git a/HLTrigger/special/test/testHLTRPCFilter.py b/HLTrigger/special/test/testHLTRPCFilter.py index 987b7f36cf49e..4bfa8fa9498bf 100644 --- a/HLTrigger/special/test/testHLTRPCFilter.py +++ b/HLTrigger/special/test/testHLTRPCFilter.py @@ -31,7 +31,7 @@ fileName = cms.untracked.string('/tmp/carrillo/afterfilter.root') ) -process.load("RecoLocalMuon.RPCRecHit.rpcPointProducer_cfi") +process.load("RecoLocalMuon.RPCRecHit.rpcPointProducer_cff") process.load("HLTrigger.special.hltRPCFilter_cfi") process.selrpc = cms.Path(process.rpcPointProducer*process.hltRPCFilter) diff --git a/RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h b/RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h index 2bda1e06527bf..d138c79d5ecd1 100644 --- a/RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h +++ b/RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h @@ -1,66 +1,25 @@ #ifndef CSCSEGTORPC_H #define CSCSEGTORPC_H - -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include class CSCSegtoRPC { public: - explicit CSCSegtoRPC(edm::Handle allCSCSegments,const edm::EventSetup& iSetup, const edm::Event& iEvent, bool debug, double eyr); + CSCSegtoRPC(CSCSegmentCollection const* allCSCSegments, edm::EventSetup const& iSetup, bool debug, double eyr); ~CSCSegtoRPC(); - RPCRecHitCollection* thePoints(){return _ThePoints;} + std::unique_ptr && thePoints(){ return std::move(_ThePoints); } private: - RPCRecHitCollection* _ThePoints; + std::unique_ptr _ThePoints; edm::OwnVector RPCPointVector; bool inclcsc; double MaxD; }; -class CSCStationIndex{ -public: - CSCStationIndex():_region(0),_station(0),_ring(0),_chamber(0){} - CSCStationIndex(int region, int station, int ring, int chamber): - _region(region), - _station(station), - _ring(ring), - _chamber(chamber){} - ~CSCStationIndex(){} - int region() const {return _region;} - int station() const {return _station;} - int ring() const {return _ring;} - int chamber() const {return _chamber;} - bool operator<(const CSCStationIndex& cscind) const{ - if(cscind.region()!=this->region()) - return cscind.region()region(); - else if(cscind.station()!=this->station()) - return cscind.station()station(); - else if(cscind.ring()!=this->ring()) - return cscind.ring()ring(); - else if(cscind.chamber()!=this->chamber()) - return cscind.chamber()chamber(); - return false; - } - -private: - int _region; - int _station; - int _ring; - int _chamber; -}; - -class ObjectMapCSC{ -public: - static ObjectMapCSC* GetInstance(const edm::EventSetup& iSetup); - std::set GetRolls(CSCStationIndex cscstationindex){return mapInstance->rollstoreCSC[cscstationindex];} -//protected: - std::map > rollstoreCSC; - ObjectMapCSC(const edm::EventSetup& iSetup); -private: - static ObjectMapCSC* mapInstance; -}; - #endif diff --git a/RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h b/RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h index 2aeb76b69d2ad..b15781ae12bc0 100644 --- a/RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h +++ b/RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h @@ -1,20 +1,22 @@ #ifndef DTSEGTORPC_H #define DTSEGTORPC_H - -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include class DTSegtoRPC { public: - explicit DTSegtoRPC(edm::Handle all4DSegments,const edm::EventSetup& iSetup, const edm::Event& iEvent,bool debug, double eyr); + DTSegtoRPC(DTRecSegment4DCollection const* all4DSegments, edm::EventSetup const& iSetup, bool debug, double eyr); ~DTSegtoRPC(); - RPCRecHitCollection* thePoints(){return _ThePoints;} + std::unique_ptr && thePoints(){ return std::move(_ThePoints); } private: - RPCRecHitCollection* _ThePoints; + std::unique_ptr _ThePoints; edm::OwnVector RPCPointVector; bool incldt; bool incldtMB4; @@ -25,47 +27,4 @@ class DTSegtoRPC { std::vector extrapolatedRolls; }; -class DTStationIndex{ -public: - DTStationIndex():_region(0),_wheel(0),_sector(0),_station(0){} - DTStationIndex(int region, int wheel, int sector, int station) : - _region(region), - _wheel(wheel), - _sector(sector), - _station(station){} - ~DTStationIndex(){} - int region() const {return _region;} - int wheel() const {return _wheel;} - int sector() const {return _sector;} - int station() const {return _station;} - bool operator<(const DTStationIndex& dtind) const{ - if(dtind.region()!=this->region()) - return dtind.region()region(); - else if(dtind.wheel()!=this->wheel()) - return dtind.wheel()wheel(); - else if(dtind.sector()!=this->sector()) - return dtind.sector()sector(); - else if(dtind.station()!=this->station()) - return dtind.station()station(); - return false; - } - -private: - int _region; - int _wheel; - int _sector; - int _station; -}; - -class ObjectMap{ -public: - static ObjectMap* GetInstance(const edm::EventSetup& iSetup); - std::set GetRolls(DTStationIndex dtstationindex){return mapInstance->rollstoreDT[dtstationindex];} -//protected: - std::map > rollstoreDT; - ObjectMap(const edm::EventSetup& iSetup); -private: - static ObjectMap* mapInstance; -}; - #endif diff --git a/RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h b/RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h index 857b7539041bd..18f209ca01989 100644 --- a/RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h +++ b/RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h @@ -1,15 +1,15 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include -#include +#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h" +#include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h" #include "FWCore/Framework/interface/ESHandle.h" -#include +#include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h" #include "RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h" @@ -19,31 +19,26 @@ // class decleration // -class RPCPointProducer : public edm::EDProducer { +class RPCPointProducer : public edm::global::EDProducer<> { public: explicit RPCPointProducer(const edm::ParameterSet&); - ~RPCPointProducer(); - // edm::InputTag cscSegments; - edm::EDGetTokenT cscSegments; - edm::EDGetTokenT dt4DSegments; - // edm::InputTag dt4DSegments; - edm::EDGetTokenT tracks; - edm::InputTag tracks_; + private: - virtual void beginJob() ; - virtual void produce(edm::Event&, const edm::EventSetup&); - virtual void endJob() ; - bool incldt; - bool inclcsc; - bool incltrack; - bool debug; - double MinCosAng; - double MaxD; - double MaxDrb4; - double MaxDistanceBetweenSegments; - double ExtrapolatedRegion; - edm::ParameterSet trackTransformerParam; - edm::ParameterSet serviceParameters; - // ----------member data --------------------------- + virtual void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; + + const edm::EDGetTokenT cscSegments; + const edm::EDGetTokenT dt4DSegments; + const edm::EDGetTokenT tracks; + const edm::InputTag tracks_; + + const bool incldt; + const bool inclcsc; + const bool incltrack; + const bool debug; + const double MinCosAng; + const double MaxD; + const double MaxDrb4; + const double ExtrapolatedRegion; + const edm::ParameterSet trackTransformerParam; }; diff --git a/RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h b/RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h index 4b4d9374c84f7..92434eaf6a2a0 100644 --- a/RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h +++ b/RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h @@ -3,8 +3,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -51,8 +49,8 @@ #include "TrackingTools/TrackRefitter/interface/TrackTransformerForCosmicMuons.h" #include "TrackingTools/TrackRefitter/interface/TrackTransformerBase.h" #include "TrackingTools/TrackRefitter/interface/TrackTransformer.h" -//#include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h" -//#include "RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h" + +#include using reco::MuonCollection; using reco::TrackCollection; @@ -60,16 +58,14 @@ typedef std::vector Trajectories; class TracktoRPC { public: - - - explicit TracktoRPC(edm::Handle alltracks,const edm::EventSetup& iSetup, const edm::Event& iEvent,bool debug, const edm::ParameterSet& iConfig,edm::InputTag& tracklabel); - + TracktoRPC(reco::TrackCollection const* alltracks, edm::EventSetup const& iSetup, bool debug, const edm::ParameterSet& iConfig, const edm::InputTag & tracklabel); ~TracktoRPC(); - RPCRecHitCollection* thePoints(){return _ThePoints;} - bool ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::EventSetup& iSetup); + std::unique_ptr && thePoints(){ return std::move(_ThePoints); } private: - RPCRecHitCollection* _ThePoints; + bool ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::EventSetup& iSetup); + + std::unique_ptr _ThePoints; edm::OwnVector RPCPointVector; double MaxD; @@ -77,89 +73,4 @@ class TracktoRPC { edm::ESHandle thePropagator; }; -class DTStationIndex2{ -public: - DTStationIndex2():_region(0),_wheel(0),_sector(0),_station(0){} - DTStationIndex2(int region, int wheel, int sector, int station) : - _region(region), - _wheel(wheel), - _sector(sector), - _station(station){} - ~DTStationIndex2(){} - int region() const {return _region;} - int wheel() const {return _wheel;} - int sector() const {return _sector;} - int station() const {return _station;} - bool operator<(const DTStationIndex2& dtind) const{ - if(dtind.region()!=this->region()) - return dtind.region()region(); - else if(dtind.wheel()!=this->wheel()) - return dtind.wheel()wheel(); - else if(dtind.sector()!=this->sector()) - return dtind.sector()sector(); - else if(dtind.station()!=this->station()) - return dtind.station()station(); - return false; - } - -private: - int _region; - int _wheel; - int _sector; - int _station; -}; - -class ObjectMap2{ -public: - static ObjectMap2* GetInstance(const edm::EventSetup& iSetup); - std::set GetRolls(DTStationIndex2 dtstationindex){return mapInstance->rollstoreDT[dtstationindex];} -//protected: - std::map > rollstoreDT; - ObjectMap2(const edm::EventSetup& iSetup); -private: - static ObjectMap2* mapInstance; -}; -class CSCStationIndex2{ -public: - CSCStationIndex2():_region(0),_station(0),_ring(0),_chamber(0){} - CSCStationIndex2(int region, int station, int ring, int chamber): - _region(region), - _station(station), - _ring(ring), - _chamber(chamber){} - ~CSCStationIndex2(){} - int region() const {return _region;} - int station() const {return _station;} - int ring() const {return _ring;} - int chamber() const {return _chamber;} - bool operator<(const CSCStationIndex2& cscind) const{ - if(cscind.region()!=this->region()) - return cscind.region()region(); - else if(cscind.station()!=this->station()) - return cscind.station()station(); - else if(cscind.ring()!=this->ring()) - return cscind.ring()ring(); - else if(cscind.chamber()!=this->chamber()) - return cscind.chamber()chamber(); - return false; - } - -private: - int _region; - int _station; - int _ring; - int _chamber; -}; - -class ObjectMap2CSC{ -public: - static ObjectMap2CSC* GetInstance(const edm::EventSetup& iSetup); - std::set GetRolls(CSCStationIndex2 cscstationindex){return mapInstance->rollstoreCSC[cscstationindex];} -//protected: - std::map > rollstoreCSC; - ObjectMap2CSC(const edm::EventSetup& iSetup); -private: - static ObjectMap2CSC* mapInstance; -}; - #endif diff --git a/RecoLocalMuon/RPCRecHit/python/rpcPointProducer_cff.py b/RecoLocalMuon/RPCRecHit/python/rpcPointProducer_cff.py new file mode 100644 index 0000000000000..79f00ebe4429f --- /dev/null +++ b/RecoLocalMuon/RPCRecHit/python/rpcPointProducer_cff.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms + +# EventSetup modules +from RecoLocalMuon.RPCRecHit.cscObjectMapESProducer_cfi import * +from RecoLocalMuon.RPCRecHit.dtObjectMapESProducer_cfi import * + +# EDProducer +from RecoLocalMuon.RPCRecHit.rpcPointProducer_cfi import * diff --git a/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.cc b/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.cc new file mode 100644 index 0000000000000..4cadc4001c8b2 --- /dev/null +++ b/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.cc @@ -0,0 +1,59 @@ +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/RPCGeometry/interface/RPCGeomServ.h" +#include "Geometry/RPCGeometry/interface/RPCChamber.h" +#include "Geometry/RPCGeometry/interface/RPCRoll.h" +#include "Geometry/CSCGeometry/interface/CSCGeometry.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" + +CSCObjectMap::CSCObjectMap(MuonGeometryRecord const& record){ + edm::ESHandle rpcGeo; + record.get(rpcGeo); + + edm::ESHandle cscGeo; + record.get(cscGeo); + + for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();itdets().end();it++){ + if(dynamic_cast< const RPCChamber* >( *it ) != 0 ){ + auto ch = dynamic_cast< const RPCChamber* >( *it ); + std::vector< const RPCRoll*> roles = (ch->rolls()); + for(std::vector::const_iterator r = roles.begin();r != roles.end(); ++r){ + RPCDetId rpcId = (*r)->id(); + int region=rpcId.region(); + if(region!=0){ + int station=rpcId.station(); + int ring=rpcId.ring(); + int cscring=ring; + int cscstation=station; + RPCGeomServ rpcsrv(rpcId); + int rpcsegment = rpcsrv.segment(); + int cscchamber = rpcsegment; //FIX THIS ACCORDING TO RPCGeomServ::segment()Definition + if((station==2||station==3)&&ring==3){//Adding Ring 3 of RPC to the CSC Ring 2 + cscring = 2; + } + CSCStationIndex ind(region,cscstation,cscring,cscchamber); + std::set myrolls; + if (rollstore.find(ind)!=rollstore.end()) myrolls=rollstore[ind]; + myrolls.insert(rpcId); + rollstore[ind]=myrolls; + } + } + } + } +} + +std::set const& CSCObjectMap::getRolls(CSCStationIndex index) const +{ + // FIXME + // the present inplementation allows for NOT finding the given index in the map; + // a muon expert should check that this is the intended behaviour. + static const std::set empty; + return (rollstore.find(index) == rollstore.end()) ? empty : rollstore.at(index); +} + +// register the class with the typelookup system used by the EventSetup +#include "FWCore/Utilities/interface/typelookup.h" +TYPELOOKUP_DATA_REG(CSCObjectMap); diff --git a/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h b/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h new file mode 100644 index 0000000000000..3b1e285e72377 --- /dev/null +++ b/RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h @@ -0,0 +1,22 @@ +#ifndef RecoLocalMuon_RPCRecHit_CSCObjectMap_h +#define RecoLocalMuon_RPCRecHit_CSCObjectMap_h + +#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/MuonDetId/interface/RPCDetId.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" + +#include +#include + +class CSCObjectMap { +public: + CSCObjectMap(MuonGeometryRecord const& record); + + std::set const& getRolls(CSCStationIndex index) const; + +private: + std::map> rollstore; +}; + +#endif // RecoLocalMuon_RPCRecHit_CSCObjectMap_h diff --git a/RecoLocalMuon/RPCRecHit/src/CSCObjectMapESProducer.cc b/RecoLocalMuon/RPCRecHit/src/CSCObjectMapESProducer.cc new file mode 100644 index 0000000000000..e10e5e579564d --- /dev/null +++ b/RecoLocalMuon/RPCRecHit/src/CSCObjectMapESProducer.cc @@ -0,0 +1,37 @@ +// system include files +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" + +class CSCObjectMapESProducer : public edm::ESProducer { +public: + CSCObjectMapESProducer(const edm::ParameterSet&) { + setWhatProduced(this); + } + + ~CSCObjectMapESProducer() { + } + + boost::shared_ptr produce(MuonGeometryRecord const& record) { + return boost::make_shared(record); + } + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + descriptions.add("cscObjectMapESProducer", desc); + } + +}; + +//define this as a plug-in +#include "FWCore/Framework/interface/ModuleFactory.h" +DEFINE_FWK_EVENTSETUP_MODULE(CSCObjectMapESProducer); diff --git a/RecoLocalMuon/RPCRecHit/src/CSCSegtoRPC.cc b/RecoLocalMuon/RPCRecHit/src/CSCSegtoRPC.cc index d540908501ed3..952ecf19c52f8 100644 --- a/RecoLocalMuon/RPCRecHit/src/CSCSegtoRPC.cc +++ b/RecoLocalMuon/RPCRecHit/src/CSCSegtoRPC.cc @@ -1,74 +1,32 @@ -#include -#include -#include -#include -#include -#include -#include +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/CSCGeometry/interface/CSCGeometry.h" +#include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h" #include "FWCore/Framework/interface/ESHandle.h" -#include -#include -#include -#include - -ObjectMapCSC* ObjectMapCSC::mapInstance = NULL; - -ObjectMapCSC* ObjectMapCSC::GetInstance(const edm::EventSetup& iSetup){ - if (mapInstance == NULL){ - mapInstance = new ObjectMapCSC(iSetup); - } - return mapInstance; -} - -ObjectMapCSC::ObjectMapCSC(const edm::EventSetup& iSetup){ - edm::ESHandle rpcGeo; - edm::ESHandle cscGeo; - - iSetup.get().get(rpcGeo); - iSetup.get().get(cscGeo); - - for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();itdets().end();it++){ - if(dynamic_cast< const RPCChamber* >( *it ) != 0 ){ - auto ch = dynamic_cast< const RPCChamber* >( *it ); - std::vector< const RPCRoll*> roles = (ch->rolls()); - for(std::vector::const_iterator r = roles.begin();r != roles.end(); ++r){ - RPCDetId rpcId = (*r)->id(); - int region=rpcId.region(); - if(region!=0){ - int station=rpcId.station(); - int ring=rpcId.ring(); - int cscring=ring; - int cscstation=station; - RPCGeomServ rpcsrv(rpcId); - int rpcsegment = rpcsrv.segment(); - int cscchamber = rpcsegment; //FIX THIS ACCORDING TO RPCGeomServ::segment()Definition - if((station==2||station==3)&&ring==3){//Adding Ring 3 of RPC to the CSC Ring 2 - cscring = 2; - } - CSCStationIndex ind(region,cscstation,cscring,cscchamber); - std::set myrolls; - if (rollstoreCSC.find(ind)!=rollstoreCSC.end()) myrolls=rollstoreCSC[ind]; - myrolls.insert(rpcId); - rollstoreCSC[ind]=myrolls; - } - } - } - } -} - -CSCSegtoRPC::CSCSegtoRPC(edm::Handle allCSCSegments, const edm::EventSetup& iSetup,const edm::Event& iEvent, bool debug, double eyr){ +#include "Geometry/RPCGeometry/interface/RPCGeomServ.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHit.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include "RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" + +CSCSegtoRPC::CSCSegtoRPC(const CSCSegmentCollection * allCSCSegments, const edm::EventSetup& iSetup, bool debug, double eyr){ edm::ESHandle rpcGeo; edm::ESHandle cscGeo; + edm::ESHandle cscMap; iSetup.get().get(rpcGeo); iSetup.get().get(cscGeo); + iSetup.get().get(cscMap); MaxD=80.; if(debug) std::cout<<"CSC \t Number of CSC Segments in this event = "<size()<size()==0){ if(debug) std::cout<<"CSC 0 segments skiping event"< allCSCSegments, const float dy=segmentDirection.y(); float dz=segmentDirection.z(); - if(debug) std::cout<<"Calling to Object Map class"< rollsForThisCSC = TheObjectCSC->GetInstance(iSetup)->GetRolls(theindex); - - + std::set rollsForThisCSC = cscMap->getRolls(theindex); if(debug) std::cout<<"CSC \t \t Getting chamber from Geometry"<chamber(CSCId); if(debug) std::cout<<"CSC \t \t Getting ID from Chamber"<region()) + return cscind.region()region(); + else if(cscind.station()!=this->station()) + return cscind.station()station(); + else if(cscind.ring()!=this->ring()) + return cscind.ring()ring(); + else if(cscind.chamber()!=this->chamber()) + return cscind.chamber()chamber(); + return false; + } + +private: + int _region; + int _station; + int _ring; + int _chamber; +}; + +#endif // RecoLocalMuon_RPCRecHit_CSCStationIndex_h diff --git a/RecoLocalMuon/RPCRecHit/src/DTObjectMap.cc b/RecoLocalMuon/RPCRecHit/src/DTObjectMap.cc new file mode 100644 index 0000000000000..0dbebbde968a6 --- /dev/null +++ b/RecoLocalMuon/RPCRecHit/src/DTObjectMap.cc @@ -0,0 +1,54 @@ +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/RPCGeometry/interface/RPCGeomServ.h" +#include "Geometry/RPCGeometry/interface/RPCChamber.h" +#include "Geometry/RPCGeometry/interface/RPCRoll.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" +#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" + +DTObjectMap::DTObjectMap(MuonGeometryRecord const& record) +{ + edm::ESHandle rpcGeo; + record.get(rpcGeo); + + edm::ESHandle dtGeo; + record.get(dtGeo); + + for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();itdets().end();it++){ + if(dynamic_cast( *it ) != 0 ){ + auto ch = dynamic_cast( *it ); + std::vector< const RPCRoll*> roles = (ch->rolls()); + for(std::vector::const_iterator r = roles.begin();r != roles.end(); ++r){ + RPCDetId rpcId = (*r)->id(); + int region=rpcId.region(); + if(region==0){ + int wheel=rpcId.ring(); + int sector=rpcId.sector(); + int station=rpcId.station(); + DTStationIndex ind(region,wheel,sector,station); + std::set myrolls; + if (rollstore.find(ind)!=rollstore.end()) myrolls=rollstore[ind]; + myrolls.insert(rpcId); + rollstore[ind]=myrolls; + } + } + } + } +} + +std::set const& DTObjectMap::getRolls(DTStationIndex index) const +{ + // FIXME + // the present inplementation allows for NOT finding the given index in the map; + // a muon expert should check that this is the intended behaviour. + static const std::set empty; + return (rollstore.find(index) == rollstore.end()) ? empty : rollstore.at(index); +} + +// register the class with the typelookup system used by the EventSetup +#include "FWCore/Utilities/interface/typelookup.h" +TYPELOOKUP_DATA_REG(DTObjectMap); diff --git a/RecoLocalMuon/RPCRecHit/src/DTObjectMap.h b/RecoLocalMuon/RPCRecHit/src/DTObjectMap.h new file mode 100644 index 0000000000000..1335cae2e4e1d --- /dev/null +++ b/RecoLocalMuon/RPCRecHit/src/DTObjectMap.h @@ -0,0 +1,22 @@ +#ifndef RecoLocalMuon_RPCRecHit_DTObjectMap_h +#define RecoLocalMuon_RPCRecHit_DTObjectMap_h + +#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/MuonDetId/interface/RPCDetId.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" + +#include +#include + +class DTObjectMap { +public: + DTObjectMap(MuonGeometryRecord const& record); + + std::set const & getRolls(DTStationIndex index) const; + +private: + std::map> rollstore; +}; + +#endif // RecoLocalMuon_RPCRecHit_DTObjectMap_h diff --git a/RecoLocalMuon/RPCRecHit/src/DTObjectMapESProducer.cc b/RecoLocalMuon/RPCRecHit/src/DTObjectMapESProducer.cc new file mode 100644 index 0000000000000..6884d7aff28f1 --- /dev/null +++ b/RecoLocalMuon/RPCRecHit/src/DTObjectMapESProducer.cc @@ -0,0 +1,37 @@ +// system include files +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" + +class DTObjectMapESProducer : public edm::ESProducer { +public: + DTObjectMapESProducer(const edm::ParameterSet&) { + setWhatProduced(this); + } + + ~DTObjectMapESProducer() { + } + + boost::shared_ptr produce(MuonGeometryRecord const& record) { + return boost::make_shared(record); + } + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + descriptions.add("dtObjectMapESProducer", desc); + } + +}; + +//define this as a plug-in +#include "FWCore/Framework/interface/ModuleFactory.h" +DEFINE_FWK_EVENTSETUP_MODULE(DTObjectMapESProducer); diff --git a/RecoLocalMuon/RPCRecHit/src/DTSegtoRPC.cc b/RecoLocalMuon/RPCRecHit/src/DTSegtoRPC.cc index 8816dc07cde83..fdebfa3cfd20c 100644 --- a/RecoLocalMuon/RPCRecHit/src/DTSegtoRPC.cc +++ b/RecoLocalMuon/RPCRecHit/src/DTSegtoRPC.cc @@ -1,54 +1,18 @@ -#include -#include -#include -#include -#include -#include -#include +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/CommonTopologies/interface/RectangularStripTopology.h" #include "FWCore/Framework/interface/ESHandle.h" -#include -#include -#include -#include -#include - -ObjectMap* ObjectMap::mapInstance = NULL; - -ObjectMap* ObjectMap::GetInstance(const edm::EventSetup& iSetup){ - if (mapInstance == NULL){ - mapInstance = new ObjectMap(iSetup); - } - return mapInstance; -} +#include "Geometry/RPCGeometry/interface/RPCGeomServ.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHit.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h" +#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" +#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" -ObjectMap::ObjectMap(const edm::EventSetup& iSetup){ - edm::ESHandle rpcGeo; - edm::ESHandle dtGeo; - - iSetup.get().get(rpcGeo); - iSetup.get().get(dtGeo); - - for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();itdets().end();it++){ - if(dynamic_cast( *it ) != 0 ){ - auto ch = dynamic_cast( *it ); - std::vector< const RPCRoll*> roles = (ch->rolls()); - for(std::vector::const_iterator r = roles.begin();r != roles.end(); ++r){ - RPCDetId rpcId = (*r)->id(); - int region=rpcId.region(); - if(region==0){ - int wheel=rpcId.ring(); - int sector=rpcId.sector(); - int station=rpcId.station(); - DTStationIndex ind(region,wheel,sector,station); - std::set myrolls; - if (rollstoreDT.find(ind)!=rollstoreDT.end()) myrolls=rollstoreDT[ind]; - myrolls.insert(rpcId); - rollstoreDT[ind]=myrolls; - } - } - } - } -} +#include int distsector(int sector1,int sector2){ if(sector1==13) sector1=4; @@ -67,7 +31,7 @@ int distwheel(int wheel1,int wheel2){ return distance; } -DTSegtoRPC::DTSegtoRPC(edm::Handle all4DSegments, const edm::EventSetup& iSetup,const edm::Event& iEvent,bool debug,double eyr){ +DTSegtoRPC::DTSegtoRPC(const DTRecSegment4DCollection * all4DSegments, const edm::EventSetup& iSetup, bool debug,double eyr){ /* MinCosAng=iConfig.getUntrackedParameter("MinCosAng",0.95); @@ -97,16 +61,18 @@ DTSegtoRPC::DTSegtoRPC(edm::Handle all4DSegments, cons clock_gettime(CLOCK_REALTIME, &start_time); */ - _ThePoints = new RPCRecHitCollection(); + _ThePoints.reset(new RPCRecHitCollection()); if(all4DSegments->size()>8){ if(debug) std::cout<<"Too many segments in this event we are not doing the extrapolation"< rpcGeo; edm::ESHandle dtGeo; + edm::ESHandle dtMap; iSetup.get().get(rpcGeo); iSetup.get().get(dtGeo); + iSetup.get().get(dtMap); /* clock_gettime(CLOCK_REALTIME, &stop_time); @@ -179,13 +145,10 @@ DTSegtoRPC::DTSegtoRPC(edm::Handle all4DSegments, cons float dy=segmentDirection.y(); float dz=segmentDirection.z(); - if(debug) std::cout<<"Calling to Object Map class"< rollsForThisDT = TheObject->GetInstance(iSetup)->GetRolls(theindex); + std::set rollsForThisDT = dtMap->getRolls(theindex); if(debug) std::cout<<"DT \t \t Number of rolls for this DT = "< all4DSegments, cons dtSector=10; } - if(debug) std::cout<<"Calling to Object Map class"< rollsForThisDT = TheObject->GetInstance(iSetup)->GetRolls(theindex); + std::set rollsForThisDT = dtMap->getRolls(theindex); if(debug) std::cout<<"MB4 \t \t Number of rolls for this DT = "<region()) + return dtind.region()region(); + else if(dtind.wheel()!=this->wheel()) + return dtind.wheel()wheel(); + else if(dtind.sector()!=this->sector()) + return dtind.sector()sector(); + else if(dtind.station()!=this->station()) + return dtind.station()station(); + return false; + } + +private: + int _region; + int _wheel; + int _sector; + int _station; +}; + +#endif // RecoLocalMuon_RPCRecHit_DTStationIndex_h diff --git a/RecoLocalMuon/RPCRecHit/src/RPCPointProducer.cc b/RecoLocalMuon/RPCRecHit/src/RPCPointProducer.cc index ba6eb52072dca..a3c860eb721be 100644 --- a/RecoLocalMuon/RPCRecHit/src/RPCPointProducer.cc +++ b/RecoLocalMuon/RPCRecHit/src/RPCPointProducer.cc @@ -25,51 +25,33 @@ // user include files -RPCPointProducer::RPCPointProducer(const edm::ParameterSet& iConfig) +RPCPointProducer::RPCPointProducer(const edm::ParameterSet& iConfig) : + cscSegments( consumes(iConfig.getParameter("cscSegments")) ), + dt4DSegments( consumes(iConfig.getParameter("dt4DSegments")) ), + tracks( consumes(iConfig.getParameter("tracks")) ), + tracks_( iConfig.getParameter("tracks") ), + incldt( iConfig.getUntrackedParameter("incldt", true) ), + inclcsc( iConfig.getUntrackedParameter("inclcsc", true) ), + incltrack( iConfig.getUntrackedParameter("incltrack", true) ), + debug( iConfig.getUntrackedParameter("debug", false) ), + MinCosAng( iConfig.getUntrackedParameter("MinCosAng", 0.95) ), + MaxD( iConfig.getUntrackedParameter("MaxD", 80.) ), + MaxDrb4( iConfig.getUntrackedParameter("MaxDrb4", 150.) ), + ExtrapolatedRegion( iConfig.getUntrackedParameter("ExtrapolatedRegion", 0.5) ), + trackTransformerParam( iConfig.getParameter("TrackTransformer") ) { - cscSegments = consumes(iConfig.getParameter("cscSegments")); - - dt4DSegments = consumes(iConfig.getParameter("dt4DSegments")); - tracks = consumes(iConfig.getParameter("tracks")); - tracks_ = iConfig.getParameter("tracks"); - - debug=iConfig.getUntrackedParameter("debug",false); - incldt=iConfig.getUntrackedParameter("incldt",true); - inclcsc=iConfig.getUntrackedParameter("inclcsc",true); - incltrack=iConfig.getUntrackedParameter("incltrack",true); - MinCosAng=iConfig.getUntrackedParameter("MinCosAng",0.95); - MaxD=iConfig.getUntrackedParameter("MaxD",80.); - MaxDrb4=iConfig.getUntrackedParameter("MaxDrb4",150.); - ExtrapolatedRegion=iConfig.getUntrackedParameter("ExtrapolatedRegion",0.5); - produces("RPCDTExtrapolatedPoints"); produces("RPCCSCExtrapolatedPoints"); produces("RPCTrackExtrapolatedPoints"); - trackTransformerParam = iConfig.getParameter("TrackTransformer"); } - -RPCPointProducer::~RPCPointProducer(){ - -} - -void RPCPointProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup){ - /* - struct timespec start_time, stop_time; - time_t fs; - time_t fn; - time_t ls; - time_t ln; - clock_gettime(CLOCK_REALTIME, &start_time); - */ - +void RPCPointProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { if(incldt){ edm::Handle all4DSegments; iEvent.getByToken(dt4DSegments, all4DSegments); if(all4DSegments.isValid()){ - DTSegtoRPC DTClass(all4DSegments,iSetup,iEvent,debug,ExtrapolatedRegion); - std::auto_ptr TheDTPoints(DTClass.thePoints()); - iEvent.put(TheDTPoints,"RPCDTExtrapolatedPoints"); + DTSegtoRPC DTClass(all4DSegments.product(), iSetup, debug, ExtrapolatedRegion); + iEvent.put(DTClass.thePoints(), "RPCDTExtrapolatedPoints"); }else{ if(debug) std::cout<<"RPCHLT Invalid DTSegments collection"< allCSCSegments; iEvent.getByToken(cscSegments, allCSCSegments); if(allCSCSegments.isValid()){ - CSCSegtoRPC CSCClass(allCSCSegments,iSetup,iEvent,debug,ExtrapolatedRegion); - std::auto_ptr TheCSCPoints(CSCClass.thePoints()); - iEvent.put(TheCSCPoints,"RPCCSCExtrapolatedPoints"); + CSCSegtoRPC CSCClass(allCSCSegments.product(), iSetup, debug, ExtrapolatedRegion); + iEvent.put(CSCClass.thePoints(), "RPCCSCExtrapolatedPoints"); }else{ if(debug) std::cout<<"RPCHLT Invalid CSCSegments collection"< alltracks; iEvent.getByToken(tracks,alltracks); if(!(alltracks->empty())){ - TracktoRPC TrackClass(alltracks,iSetup,iEvent,debug,trackTransformerParam,tracks_); - std::auto_ptr TheTrackPoints(TrackClass.thePoints()); - iEvent.put(TheTrackPoints,"RPCTrackExtrapolatedPoints"); + TracktoRPC TrackClass(alltracks.product(), iSetup, debug, trackTransformerParam, tracks_); + iEvent.put(TrackClass.thePoints(), "RPCTrackExtrapolatedPoints"); }else{ - std::cout<<"RPCHLT Invalid Tracks collection"< { // The reconstruction algorithm RPCRecHitBaseAlgo *theAlgo; -// static std::string theAlgoName; RPCMaskedStrips* RPCMaskedStripsObj; // Object with mask-strips-vector for all the RPC Detectors diff --git a/RecoLocalMuon/RPCRecHit/src/TracktoRPC.cc b/RecoLocalMuon/RPCRecHit/src/TracktoRPC.cc index 76db3a7d7ad81..f4a67a114cc55 100644 --- a/RecoLocalMuon/RPCRecHit/src/TracktoRPC.cc +++ b/RecoLocalMuon/RPCRecHit/src/TracktoRPC.cc @@ -1,120 +1,23 @@ -#include -#include -#include -#include -#include -#include -#include +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/CommonTopologies/interface/RectangularStripTopology.h" #include "FWCore/Framework/interface/ESHandle.h" -#include -#include -#include -//#include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h" -//#include "RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h" -#include -#include +#include "Geometry/RPCGeometry/interface/RPCGeomServ.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHit.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h" +#include "RecoLocalMuon/RPCRecHit/src/DTStationIndex.h" +#include "RecoLocalMuon/RPCRecHit/src/DTObjectMap.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCStationIndex.h" +#include "RecoLocalMuon/RPCRecHit/src/CSCObjectMap.h" + #include #include -ObjectMap2* ObjectMap2::mapInstance = NULL; - -ObjectMap2* ObjectMap2::GetInstance(const edm::EventSetup& iSetup){ - if (mapInstance == NULL){ - mapInstance = new ObjectMap2(iSetup); - } - return mapInstance; -} - -ObjectMap2::ObjectMap2(const edm::EventSetup& iSetup){ - edm::ESHandle rpcGeo; - edm::ESHandle dtGeo; - - iSetup.get().get(rpcGeo); - iSetup.get().get(dtGeo); - - for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();itdets().end();it++){ - if(dynamic_cast< RPCChamber const * >( *it ) != 0 ){ - auto ch = dynamic_cast( *it ); - std::vector< const RPCRoll*> roles = (ch->rolls()); - for(std::vector::const_iterator r = roles.begin();r != roles.end(); ++r){ - RPCDetId rpcId = (*r)->id(); - int region=rpcId.region(); - if(region==0){ - int wheel=rpcId.ring(); - int sector=rpcId.sector(); - int station=rpcId.station(); - DTStationIndex2 ind(region,wheel,sector,station); - std::set myrolls; - if (rollstoreDT.find(ind)!=rollstoreDT.end()) myrolls=rollstoreDT[ind]; - myrolls.insert(rpcId); - rollstoreDT[ind]=myrolls; - } - } - } - } -} - -int distsector2(int sector1,int sector2){ - if(sector1==13) sector1=4; - if(sector1==14) sector1=10; - - if(sector2==13) sector2=4; - if(sector2==14) sector2=10; - - int distance = std::abs(sector1 - sector2); - if(distance>6) distance = 12-distance; - return distance; -} - -int distwheel2(int wheel1,int wheel2){ - int distance = std::abs(wheel1 - wheel2); - return distance; -} -ObjectMap2CSC* ObjectMap2CSC::mapInstance = NULL; - -ObjectMap2CSC* ObjectMap2CSC::GetInstance(const edm::EventSetup& iSetup){ - if (mapInstance == NULL){ - mapInstance = new ObjectMap2CSC(iSetup); - } - return mapInstance; -} - -ObjectMap2CSC::ObjectMap2CSC(const edm::EventSetup& iSetup){ - edm::ESHandle rpcGeo; - edm::ESHandle cscGeo; - - iSetup.get().get(rpcGeo); - iSetup.get().get(cscGeo); - - for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();itdets().end();it++){ - if(dynamic_cast< const RPCChamber* >( *it ) != 0 ){ - const RPCChamber* ch = dynamic_cast< const RPCChamber* >( *it ); - std::vector< const RPCRoll*> roles = (ch->rolls()); - for(std::vector::const_iterator r = roles.begin();r != roles.end(); ++r){ - RPCDetId rpcId = (*r)->id(); - int region=rpcId.region(); - if(region!=0){ - int station=rpcId.station(); - int ring=rpcId.ring(); - int cscring=ring; - int cscstation=station; - RPCGeomServ rpcsrv(rpcId); - int rpcsegment = rpcsrv.segment(); - int cscchamber = rpcsegment; //FIX THIS ACCORDING TO RPCGeomServ::segment()Definition - if((station==2||station==3)&&ring==3){//Adding Ring 3 of RPC to the CSC Ring 2 - cscring = 2; - } - CSCStationIndex2 ind(region,cscstation,cscring,cscchamber); - std::set myrolls; - if (rollstoreCSC.find(ind)!=rollstoreCSC.end()) myrolls=rollstoreCSC[ind]; - myrolls.insert(rpcId); - rollstoreCSC[ind]=myrolls; - } - } - } - } -} - bool TracktoRPC::ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::EventSetup& iSetup) { edm::ESHandle rpcGeo; @@ -148,9 +51,9 @@ bool TracktoRPC::ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::E } else return false; } -TracktoRPC::TracktoRPC(edm::Handle alltracks, const edm::EventSetup& iSetup,const edm::Event& iEvent,bool debug,const edm::ParameterSet& iConfig,edm::InputTag& tracklabel){ +TracktoRPC::TracktoRPC(const reco::TrackCollection * alltracks, const edm::EventSetup& iSetup, bool debug,const edm::ParameterSet& iConfig, const edm::InputTag& tracklabel){ - _ThePoints = new RPCRecHitCollection(); + _ThePoints.reset(new RPCRecHitCollection()); // if(alltracks->empty()) return; if(tracklabel.label().find("cosmic")==0) theTrackTransformer = new TrackTransformerForCosmicMuons(iConfig); @@ -160,12 +63,16 @@ TracktoRPC::TracktoRPC(edm::Handle alltracks, const edm:: edm::ESHandle rpcGeo; edm::ESHandle dtGeo; + edm::ESHandle dtMap; edm::ESHandle cscGeo; + edm::ESHandle cscMap; iSetup.get().get("SteppingHelixPropagatorAny",thePropagator); iSetup.get().get(rpcGeo); iSetup.get().get(dtGeo); + iSetup.get().get(dtMap); iSetup.get().get(cscGeo); + iSetup.get().get(cscMap); std::vector rpcput; double MaxD=999.; @@ -217,9 +124,8 @@ for(trackingRecHit_iterator hit=track->recHitsBegin(); hit != track->recHitsEnd( DTChamberId dtid(geomDet->geographicalId().rawId()); int dtW=dtid.wheel(), dtS=dtid.sector(), dtT=dtid.station(); if(dtS==13) dtS=4; if(dtS==14) dtS=10; - ObjectMap2* TheObject = ObjectMap2::GetInstance(iSetup); - DTStationIndex2 theindex(0,dtW,dtS,dtT); - std::set rollsForThisDT = TheObject->GetInstance(iSetup)->GetRolls(theindex); + DTStationIndex theindex(0,dtW,dtS,dtT); + std::set rollsForThisDT = dtMap->getRolls(theindex); for(std::set::iterator iteraRoll = rollsForThisDT.begin();iteraRoll != rollsForThisDT.end(); iteraRoll++) { const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); @@ -264,13 +170,12 @@ for(trackingRecHit_iterator hit=track->recHitsBegin(); hit != track->recHitsEnd( float dx = trajLP.x()-trackLP.x(), dy=trajLP.y()-trackLP.y();//, dz=trajLP.z()-trackLP.z(); if( dx>10. && dy>10.) continue; - ObjectMap2CSC* TheObjectCSC = ObjectMap2CSC::GetInstance(iSetup); int En = cscid.endcap(), St = cscid.station(), Ri = cscid.ring(); int rpcSegment = cscid.chamber(); if(En==2) En= -1; if(Ri==4) Ri =1; - CSCStationIndex2 theindex(En,St,Ri,rpcSegment); - std::set rollsForThisCSC = TheObjectCSC->GetInstance(iSetup)->GetRolls(theindex); + CSCStationIndex theindex(En,St,Ri,rpcSegment); + std::set rollsForThisCSC = cscMap->getRolls(theindex); for (std::set::iterator iteraRoll = rollsForThisCSC.begin();iteraRoll != rollsForThisCSC.end(); iteraRoll++) { const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); diff --git a/RecoLocalMuon/RPCRecHit/test/RPCRecHitReader.cc b/RecoLocalMuon/RPCRecHit/test/RPCRecHitReader.cc index 6414f21b44a9c..3c4ac49c82b0c 100644 --- a/RecoLocalMuon/RPCRecHit/test/RPCRecHitReader.cc +++ b/RecoLocalMuon/RPCRecHit/test/RPCRecHitReader.cc @@ -19,17 +19,17 @@ #include #include -#include -#include -#include -#include +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" -#include +#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" -#include -#include +#include "Geometry/RPCGeometry/interface/RPCRoll.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" diff --git a/RecoLocalMuon/RPCRecHit/test/testRPCPointProducer.py b/RecoLocalMuon/RPCRecHit/test/testRPCPointProducer.py index ddd43ccc7ea8c..764097b55c980 100644 --- a/RecoLocalMuon/RPCRecHit/test/testRPCPointProducer.py +++ b/RecoLocalMuon/RPCRecHit/test/testRPCPointProducer.py @@ -13,7 +13,7 @@ process.GlobalTag.globaltag = "START53_V27::All" process.load("Configuration.StandardSequences.Services_cff") -process.load("Configuration.StandardSequences.Geometry_cff") +process.load("Configuration.StandardSequences.GeometryDB_cff") process.load("Configuration.StandardSequences.Reconstruction_cff") process.load("Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff") @@ -29,7 +29,7 @@ ) -process.load("RecoLocalMuon.RPCRecHit.rpcPointProducer_cfi") +process.load("RecoLocalMuon.RPCRecHit.rpcPointProducer_cff") process.rpcPointProducer.tracks = cms.InputTag("cosmicMuons") # for cosmicMuons process.out = cms.OutputModule("PoolOutputModule", diff --git a/Validation/RPCRecHits/test/rpcRecHitValidation_cfg.py b/Validation/RPCRecHits/test/rpcRecHitValidation_cfg.py index 5ac35eeb72275..b9b84b8f46093 100644 --- a/Validation/RPCRecHits/test/rpcRecHitValidation_cfg.py +++ b/Validation/RPCRecHits/test/rpcRecHitValidation_cfg.py @@ -53,7 +53,7 @@ process.load("Validation.RPCRecHits.rpcRecHitValidation_cfi") #### RPCPorintProducer-Reco validation -process.load("RecoLocalMuon.RPCRecHit.rpcPointProducer_cfi") +process.load("RecoLocalMuon.RPCRecHit.rpcPointProducer_cff") process.load("Validation.RPCRecHits.rpcPointValidation_cfi") process.rpcPointProducerPlusValidation_step = cms.Sequence(