Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multithreading fix for 74x: RPCPointProducer #11355

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion HLTrigger/special/test/testHLTRPCFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
55 changes: 7 additions & 48 deletions RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h
Original file line number Diff line number Diff line change
@@ -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 <memory>

class CSCSegtoRPC {
public:
explicit CSCSegtoRPC(edm::Handle<CSCSegmentCollection> 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<RPCRecHitCollection> && thePoints(){ return std::move(_ThePoints); }

private:
RPCRecHitCollection* _ThePoints;
std::unique_ptr<RPCRecHitCollection> _ThePoints;
edm::OwnVector<RPCRecHit> 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()<this->region();
else if(cscind.station()!=this->station())
return cscind.station()<this->station();
else if(cscind.ring()!=this->ring())
return cscind.ring()<this->ring();
else if(cscind.chamber()!=this->chamber())
return cscind.chamber()<this->chamber();
return false;
}

private:
int _region;
int _station;
int _ring;
int _chamber;
};

class ObjectMapCSC{
public:
static ObjectMapCSC* GetInstance(const edm::EventSetup& iSetup);
std::set<RPCDetId> GetRolls(CSCStationIndex cscstationindex){return mapInstance->rollstoreCSC[cscstationindex];}
//protected:
std::map<CSCStationIndex,std::set<RPCDetId> > rollstoreCSC;
ObjectMapCSC(const edm::EventSetup& iSetup);
private:
static ObjectMapCSC* mapInstance;
};

#endif
55 changes: 7 additions & 48 deletions RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h
Original file line number Diff line number Diff line change
@@ -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 <memory>

class DTSegtoRPC {
public:
explicit DTSegtoRPC(edm::Handle<DTRecSegment4DCollection> 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<RPCRecHitCollection> && thePoints(){ return std::move(_ThePoints); }

private:
RPCRecHitCollection* _ThePoints;
std::unique_ptr<RPCRecHitCollection> _ThePoints;
edm::OwnVector<RPCRecHit> RPCPointVector;
bool incldt;
bool incldtMB4;
Expand All @@ -25,47 +27,4 @@ class DTSegtoRPC {
std::vector<uint32_t> 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()<this->region();
else if(dtind.wheel()!=this->wheel())
return dtind.wheel()<this->wheel();
else if(dtind.sector()!=this->sector())
return dtind.sector()<this->sector();
else if(dtind.station()!=this->station())
return dtind.station()<this->station();
return false;
}

private:
int _region;
int _wheel;
int _sector;
int _station;
};

class ObjectMap{
public:
static ObjectMap* GetInstance(const edm::EventSetup& iSetup);
std::set<RPCDetId> GetRolls(DTStationIndex dtstationindex){return mapInstance->rollstoreDT[dtstationindex];}
//protected:
std::map<DTStationIndex,std::set<RPCDetId> > rollstoreDT;
ObjectMap(const edm::EventSetup& iSetup);
private:
static ObjectMap* mapInstance;
};

#endif
49 changes: 22 additions & 27 deletions RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h
Original file line number Diff line number Diff line change
@@ -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 <DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h>
#include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h>
#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
#include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"

#include "FWCore/Framework/interface/ESHandle.h"
#include <DataFormats/RPCRecHit/interface/RPCRecHit.h>
#include "DataFormats/RPCRecHit/interface/RPCRecHit.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h"
#include "RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h"
Expand All @@ -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<CSCSegmentCollection> cscSegments;
edm::EDGetTokenT<DTRecSegment4DCollection> dt4DSegments;
// edm::InputTag dt4DSegments;
edm::EDGetTokenT<reco::TrackCollection> 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<CSCSegmentCollection> cscSegments;
const edm::EDGetTokenT<DTRecSegment4DCollection> dt4DSegments;
const edm::EDGetTokenT<reco::TrackCollection> 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;
};

103 changes: 7 additions & 96 deletions RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -51,115 +49,28 @@
#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 <memory>

using reco::MuonCollection;
using reco::TrackCollection;
typedef std::vector<Trajectory> Trajectories;

class TracktoRPC {
public:


explicit TracktoRPC(edm::Handle<reco::TrackCollection> 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<RPCRecHitCollection> && thePoints(){ return std::move(_ThePoints); }

private:
RPCRecHitCollection* _ThePoints;
bool ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::EventSetup& iSetup);

std::unique_ptr<RPCRecHitCollection> _ThePoints;
edm::OwnVector<RPCRecHit> RPCPointVector;
double MaxD;

TrackTransformerBase *theTrackTransformer;
edm::ESHandle<Propagator> 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()<this->region();
else if(dtind.wheel()!=this->wheel())
return dtind.wheel()<this->wheel();
else if(dtind.sector()!=this->sector())
return dtind.sector()<this->sector();
else if(dtind.station()!=this->station())
return dtind.station()<this->station();
return false;
}

private:
int _region;
int _wheel;
int _sector;
int _station;
};

class ObjectMap2{
public:
static ObjectMap2* GetInstance(const edm::EventSetup& iSetup);
std::set<RPCDetId> GetRolls(DTStationIndex2 dtstationindex){return mapInstance->rollstoreDT[dtstationindex];}
//protected:
std::map<DTStationIndex2,std::set<RPCDetId> > 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()<this->region();
else if(cscind.station()!=this->station())
return cscind.station()<this->station();
else if(cscind.ring()!=this->ring())
return cscind.ring()<this->ring();
else if(cscind.chamber()!=this->chamber())
return cscind.chamber()<this->chamber();
return false;
}

private:
int _region;
int _station;
int _ring;
int _chamber;
};

class ObjectMap2CSC{
public:
static ObjectMap2CSC* GetInstance(const edm::EventSetup& iSetup);
std::set<RPCDetId> GetRolls(CSCStationIndex2 cscstationindex){return mapInstance->rollstoreCSC[cscstationindex];}
//protected:
std::map<CSCStationIndex2,std::set<RPCDetId> > rollstoreCSC;
ObjectMap2CSC(const edm::EventSetup& iSetup);
private:
static ObjectMap2CSC* mapInstance;
};

#endif
Loading