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

migrating to multithreading of RPCPointProducer #9100

Merged
merged 10 commits into from
Jul 7, 2015
87 changes: 45 additions & 42 deletions RecoLocalMuon/RPCRecHit/interface/CSCSegtoRPC.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,58 @@
#ifndef CSCSEGTORPC_H
#define CSCSEGTORPC_H


#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "DataFormats/RPCRecHit/interface/RPCRecHit.h"
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"

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:
ObjectMapCSC* getInstance(const edm::EventSetup& iSetup);
const std::set<RPCDetId> getRolls(CSCStationIndex cscstationindex) const {return rollstoreCSC.find(cscstationindex)->second;}
//protected:
std::map<CSCStationIndex,const std::set<RPCDetId> > rollstoreCSC;
ObjectMapCSC(const edm::EventSetup& iSetup);
ObjectMapCSC();
void fillObjectMapCSC(const edm::EventSetup& iSetup);
};

class CSCSegtoRPC {
public:
explicit CSCSegtoRPC(edm::Handle<CSCSegmentCollection> allCSCSegments,const edm::EventSetup& iSetup, const edm::Event& iEvent, bool debug, double eyr);
explicit CSCSegtoRPC(edm::Handle<CSCSegmentCollection> allCSCSegments,const edm::EventSetup& iSetup, const edm::Event& iEvent, bool debug, double eyr, const ObjectMapCSC *TheObjectCSC);
~CSCSegtoRPC();
RPCRecHitCollection* thePoints(){return _ThePoints;}

Expand All @@ -20,47 +63,7 @@ class CSCSegtoRPC {
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
88 changes: 45 additions & 43 deletions RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,58 @@
#ifndef DTSEGTORPC_H
#define DTSEGTORPC_H


#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "DataFormats/RPCRecHit/interface/RPCRecHit.h"
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"


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:
ObjectMap* getInstance(const edm::EventSetup& iSetup);
const std::set<RPCDetId> getRolls(DTStationIndex dtstationindex) const {return rollstoreDT.find(dtstationindex)->second;}
//protected:
std::map<DTStationIndex,const std::set<RPCDetId> > rollstoreDT;
ObjectMap(const edm::EventSetup& iSetup);
ObjectMap();
void fillObjectMapDT(const edm::EventSetup&);
};

class DTSegtoRPC {
public:
explicit DTSegtoRPC(edm::Handle<DTRecSegment4DCollection> all4DSegments,const edm::EventSetup& iSetup, const edm::Event& iEvent,bool debug, double eyr);
explicit DTSegtoRPC(edm::Handle<DTRecSegment4DCollection> all4DSegments,const edm::EventSetup& iSetup, const edm::Event& iEvent, bool debug, double eyr,const ObjectMap*);
~DTSegtoRPC();
RPCRecHitCollection* thePoints(){return _ThePoints;}

Expand All @@ -25,47 +68,6 @@ 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
50 changes: 28 additions & 22 deletions RecoLocalMuon/RPCRecHit/interface/RPCPointProducer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
Expand All @@ -9,6 +9,7 @@
#include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h>

#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include <DataFormats/RPCRecHit/interface/RPCRecHit.h>
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "RecoLocalMuon/RPCRecHit/interface/DTSegtoRPC.h"
Expand All @@ -19,31 +20,36 @@
// class decleration
//

class RPCPointProducer : public edm::EDProducer {
class RPCPointProducer : public edm::stream::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_;

const edm::EDGetTokenT<CSCSegmentCollection> cscSegments;
const edm::EDGetTokenT<DTRecSegment4DCollection> dt4DSegments;
const edm::EDGetTokenT<reco::TrackCollection> tracks;
const 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;
void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override;
void produce(edm::Event&, const edm::EventSetup&) override;
const bool debug;
const bool incldt;
const bool inclcsc;
const bool incltrack;
const double MinCosAng;
const double MaxD;
const double MaxDrb4;
const double ExtrapolatedRegion;
const edm::ParameterSet serviceParameters;
const edm::ParameterSet trackTransformerParam;

// ----------member data ---------------------------

ObjectMapCSC* TheCSCObjectsMap_;
ObjectMap* TheDTObjectsMap_;
ObjectMap2* TheDTtrackObjectsMap_;
ObjectMap2CSC* TheCSCtrackObjectsMap_;
edm::ESWatcher<MuonGeometryRecord> MuonGeometryWatcher;
};

56 changes: 29 additions & 27 deletions RecoLocalMuon/RPCRecHit/interface/TracktoRPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,7 @@ 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();
RPCRecHitCollection* thePoints(){return _ThePoints;}
bool ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::EventSetup& iSetup);

private:
RPCRecHitCollection* _ThePoints;
edm::OwnVector<RPCRecHit> RPCPointVector;
double MaxD;

TrackTransformerBase *theTrackTransformer;
edm::ESHandle<Propagator> thePropagator;
};

class DTStationIndex2{
public:
Expand Down Expand Up @@ -111,14 +94,14 @@ class DTStationIndex2{

class ObjectMap2{
public:
static ObjectMap2* GetInstance(const edm::EventSetup& iSetup);
std::set<RPCDetId> GetRolls(DTStationIndex2 dtstationindex){return mapInstance->rollstoreDT[dtstationindex];}
ObjectMap2* getInstance(const edm::EventSetup& iSetup);
const std::set<RPCDetId> getRolls(DTStationIndex2 dtstationindex) const {return rollstoreDT.find(dtstationindex)->second;}
//protected:
std::map<DTStationIndex2,std::set<RPCDetId> > rollstoreDT;
ObjectMap2(const edm::EventSetup& iSetup);
private:
static ObjectMap2* mapInstance;
};
ObjectMap2();
void fillObjectMapDT(const edm::EventSetup&);
};
class CSCStationIndex2{
public:
CSCStationIndex2():_region(0),_station(0),_ring(0),_chamber(0){}
Expand Down Expand Up @@ -153,13 +136,32 @@ class CSCStationIndex2{

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

class TracktoRPC {
public:


explicit TracktoRPC(edm::Handle<reco::TrackCollection> alltracks,const edm::EventSetup& iSetup, const edm::Event& iEvent, const edm::ParameterSet& iConfig, const edm::InputTag& tracklabel,const ObjectMap2* , const ObjectMap2CSC*);

~TracktoRPC();
RPCRecHitCollection* thePoints(){return _ThePoints;}
bool ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::EventSetup& iSetup);

private:
static ObjectMap2CSC* mapInstance;
};
RPCRecHitCollection* _ThePoints;
edm::OwnVector<RPCRecHit> RPCPointVector;
double MaxD;

TrackTransformerBase *theTrackTransformer;
edm::ESHandle<Propagator> thePropagator;
};

#endif
Loading