Skip to content

Commit

Permalink
Merge pull request #25305 from Dr15Jones/modernizeCSCTFCandidateProducer
Browse files Browse the repository at this point in the history
Modernize L1Trigger/CSCTrackFinder modules
  • Loading branch information
cmsbuild committed Nov 24, 2018
2 parents c0a3b9a + 1d37274 commit 8da5db6
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 443 deletions.
132 changes: 66 additions & 66 deletions L1Trigger/CSCTrackFinder/interface/CSCTFPtMethods.h
Expand Up @@ -36,72 +36,72 @@ class CSCTFPtMethods
static const float FRCorrHighEta[kME2andMB2][2];

/** parameters for Anna's method 2011*/
static double AB_mu12FnoME11[4][15];
static double AB_mu13FnoME11[4][15];
static double AB_mu14FnoME11[4][15];
static double AB_mu12RnoME11[4][15];
static double AB_mu13RnoME11[4][15];
static double AB_mu14RnoME11[4][15];
static double AB_mu12FME11[4][15];
static double AB_mu13FME11[4][15];
static double AB_mu14FME11[4][15];
static double AB_mu12RME11[4][15];
static double AB_mu13RME11[4][15];
static double AB_mu14RME11[4][15];
static double AB_sig12FnoME11[4][15];
static double AB_sig13FnoME11[4][15];
static double AB_sig14FnoME11[4][15];
static double AB_sig12RnoME11[4][15];
static double AB_sig13RnoME11[4][15];
static double AB_sig14RnoME11[4][15];
static double AB_sig12FME11[4][15];
static double AB_sig13FME11[4][15];
static double AB_sig14FME11[4][15];
static double AB_sig12RME11[4][15];
static double AB_sig13RME11[4][15];
static double AB_sig14RME11[4][15];

static double AB_mu12F[4][15];
static double AB_mu13F[4][15];
static double AB_mu14F[4][15];
static double AB_mu12R[4][15];
static double AB_mu13R[4][15];
static double AB_mu14R[4][15];
static double AB_mu23[4][15];
static double AB_mu24[4][15];
static double AB_mu34[4][15];
static double AB_mu51[4][15];
static double AB_mu52[4][15];
static double AB_mu53[4][15];
static double AB_mu5[4][15];

static double AB_sig12F[4][15];
static double AB_sig13F[4][15];
static double AB_sig14F[4][15];
static double AB_sig12R[4][15];
static double AB_sig13R[4][15];
static double AB_sig14R[4][15];
static double AB_sig23[4][15];
static double AB_sig24[4][15];
static double AB_sig34[4][15];
static double AB_sig51[4][15];
static double AB_sig52[4][15];
static double AB_sig53[4][15];
static double AB_sig5[4][15];

static double AB_rho123F[5][15];
static double AB_rho124F[5][15];
static double AB_rho134F[5][15];
static double AB_rho123R[5][15];
static double AB_rho124R[5][15];
static double AB_rho134R[5][15];
static double AB_rho234[5][15];
static double AB_rho512[5][15];
static double AB_rho513[5][15];
static double AB_rho523[5][15];
static double AB_rho51B[5][15];
static double AB_rho52B[5][15];
static double AB_rho53B[5][15];
static const double AB_mu12FnoME11[4][15];
static const double AB_mu13FnoME11[4][15];
static const double AB_mu14FnoME11[4][15];
static const double AB_mu12RnoME11[4][15];
static const double AB_mu13RnoME11[4][15];
static const double AB_mu14RnoME11[4][15];
static const double AB_mu12FME11[4][15];
static const double AB_mu13FME11[4][15];
static const double AB_mu14FME11[4][15];
static const double AB_mu12RME11[4][15];
static const double AB_mu13RME11[4][15];
static const double AB_mu14RME11[4][15];
static const double AB_sig12FnoME11[4][15];
static const double AB_sig13FnoME11[4][15];
static const double AB_sig14FnoME11[4][15];
static const double AB_sig12RnoME11[4][15];
static const double AB_sig13RnoME11[4][15];
static const double AB_sig14RnoME11[4][15];
static const double AB_sig12FME11[4][15];
static const double AB_sig13FME11[4][15];
static const double AB_sig14FME11[4][15];
static const double AB_sig12RME11[4][15];
static const double AB_sig13RME11[4][15];
static const double AB_sig14RME11[4][15];

static const double AB_mu12F[4][15];
static const double AB_mu13F[4][15];
static const double AB_mu14F[4][15];
static const double AB_mu12R[4][15];
static const double AB_mu13R[4][15];
static const double AB_mu14R[4][15];
static const double AB_mu23[4][15];
static const double AB_mu24[4][15];
static const double AB_mu34[4][15];
static const double AB_mu51[4][15];
static const double AB_mu52[4][15];
static const double AB_mu53[4][15];
static const double AB_mu5[4][15];

static const double AB_sig12F[4][15];
static const double AB_sig13F[4][15];
static const double AB_sig14F[4][15];
static const double AB_sig12R[4][15];
static const double AB_sig13R[4][15];
static const double AB_sig14R[4][15];
static const double AB_sig23[4][15];
static const double AB_sig24[4][15];
static const double AB_sig34[4][15];
static const double AB_sig51[4][15];
static const double AB_sig52[4][15];
static const double AB_sig53[4][15];
static const double AB_sig5[4][15];

static const double AB_rho123F[5][15];
static const double AB_rho124F[5][15];
static const double AB_rho134F[5][15];
static const double AB_rho123R[5][15];
static const double AB_rho124R[5][15];
static const double AB_rho134R[5][15];
static const double AB_rho234[5][15];
static const double AB_rho512[5][15];
static const double AB_rho513[5][15];
static const double AB_rho523[5][15];
static const double AB_rho51B[5][15];
static const double AB_rho52B[5][15];
static const double AB_rho53B[5][15];
/** parameters for Anna's method 2010*/
static const double A_mu12Front[4][15];
static const double A_sig12Front[3][15];
Expand Down
24 changes: 8 additions & 16 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFCandidateProducer.cc
@@ -1,5 +1,4 @@
#include "CSCTFCandidateProducer.h"
#include "L1Trigger/CSCTrackFinder/src/CSCTFCandidateBuilder.h"

#include <vector>
#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
Expand All @@ -8,28 +7,21 @@
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/Event.h"

CSCTFCandidateProducer::CSCTFCandidateProducer(const edm::ParameterSet& pset)
CSCTFCandidateProducer::CSCTFCandidateProducer(const edm::ParameterSet& pset):
input_module{consumes<L1CSCTrackCollection>(pset.getUntrackedParameter<edm::InputTag>("CSCTrackProducer"))},
putToken_{produces<std::vector<L1MuRegionalCand> >("CSC")},
my_builder{pset.getParameter<edm::ParameterSet>("MuonSorter")}
{
edm::ParameterSet mu_sorter_pset = pset.getParameter<edm::ParameterSet>("MuonSorter");
my_builder = new CSCTFCandidateBuilder(mu_sorter_pset);
input_module = consumes<L1CSCTrackCollection>(pset.getUntrackedParameter<edm::InputTag>("CSCTrackProducer"));
produces<std::vector<L1MuRegionalCand> >("CSC");
}

CSCTFCandidateProducer::~CSCTFCandidateProducer()
{
delete my_builder;
my_builder = nullptr;
}

void CSCTFCandidateProducer::produce(edm::Event & e, const edm::EventSetup& c)
void CSCTFCandidateProducer::produce(edm::StreamID, edm::Event & e, const edm::EventSetup& c) const
{
edm::Handle<L1CSCTrackCollection> tracks;
std::unique_ptr<std::vector<L1MuRegionalCand> > cand_product(new std::vector<L1MuRegionalCand>);
std::vector<L1MuRegionalCand> cand_product;

e.getByToken(input_module, tracks);

my_builder->buildCandidates(tracks.product(), cand_product.get());
my_builder.buildCandidates(tracks.product(), &cand_product);

e.put(std::move(cand_product),"CSC");
e.emplace(putToken_, std::move(cand_product));
}
25 changes: 14 additions & 11 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFCandidateProducer.h
Expand Up @@ -2,27 +2,30 @@
#define CSCTrackFinder_CSCTFCandidateProducer_h

#include <string>
#include <vector>

#include <FWCore/Framework/interface/EDProducer.h>
#include <FWCore/ParameterSet/interface/ParameterSet.h>
#include <FWCore/Utilities/interface/InputTag.h>
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/EDPutToken.h"
#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
#include "L1Trigger/CSCTrackFinder/src/CSCTFCandidateBuilder.h"

class CSCTFCandidateBuilder;
class L1MuRegionalCand;

class CSCTFCandidateProducer : public edm::EDProducer
class CSCTFCandidateProducer : public edm::global::EDProducer<>
{
public:

CSCTFCandidateProducer(const edm::ParameterSet&);
explicit CSCTFCandidateProducer(const edm::ParameterSet&);

~CSCTFCandidateProducer() override;

void produce(edm::Event & e, const edm::EventSetup& c) override;
void produce(edm::StreamID, edm::Event & e, const edm::EventSetup& c) const override;

private:
edm::EDGetTokenT<L1CSCTrackCollection> input_module;
CSCTFCandidateBuilder* my_builder;
const edm::EDGetTokenT<L1CSCTrackCollection> input_module;
const edm::EDPutTokenT<std::vector<L1MuRegionalCand>> putToken_;
const CSCTFCandidateBuilder my_builder;
};

#endif
46 changes: 18 additions & 28 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFTrackProducer.cc
@@ -1,6 +1,5 @@
#include "L1Trigger/CSCTrackFinder/plugins/CSCTFTrackProducer.h"

#include "L1Trigger/CSCTrackFinder/src/CSCTFTrackBuilder.h"

#include <vector>
#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
Expand All @@ -22,34 +21,27 @@
#include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
#include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"

CSCTFTrackProducer::CSCTFTrackProducer(const edm::ParameterSet& pset)
CSCTFTrackProducer::CSCTFTrackProducer(const edm::ParameterSet& pset):
my_dtrc{},
useDT{pset.getParameter<bool>("useDT")},
TMB07{pset.getParameter<bool>("isTMB07")},
readDtDirect{pset.getParameter<bool>("readDtDirect")},
input_module{consumes<CSCCorrelatedLCTDigiCollection>(pset.getUntrackedParameter<edm::InputTag>("SectorReceiverInput"))},
dt_producer{consumes<L1MuDTChambPhContainer>(pset.getUntrackedParameter<edm::InputTag>("DTproducer"))},
directProd{consumes<CSCTriggerContainer<csctf::TrackStub> >(pset.getUntrackedParameter<edm::InputTag>("DtDirectProd"))},
sp_pset{pset.getParameter<edm::ParameterSet>("SectorProcessor")}
{
input_module = consumes<CSCCorrelatedLCTDigiCollection>(pset.getUntrackedParameter<edm::InputTag>("SectorReceiverInput"));
dt_producer = consumes<L1MuDTChambPhContainer>(pset.getUntrackedParameter<edm::InputTag>("DTproducer"));
directProd = consumes<CSCTriggerContainer<csctf::TrackStub> >(pset.getUntrackedParameter<edm::InputTag>("DtDirectProd"));
sp_pset = pset.getParameter<edm::ParameterSet>("SectorProcessor");
useDT = pset.getParameter<bool>("useDT");
readDtDirect = pset.getParameter<bool>("readDtDirect");
TMB07 = pset.getParameter<bool>("isTMB07");
my_dtrc = new CSCTFDTReceiver();
m_scalesCacheID = 0ULL ;
m_ptScaleCacheID = 0ULL ;
my_builder = nullptr ;
produces<L1CSCTrackCollection>();
produces<CSCTriggerContainer<csctf::TrackStub> >();
}

CSCTFTrackProducer::~CSCTFTrackProducer()
{
delete my_dtrc;
my_dtrc = nullptr;

delete my_builder;
my_builder = nullptr;
}

void CSCTFTrackProducer::beginJob(){
// my_builder->initialize(es);
//CSCSectorReceiverLUT has a static member it fills by reading a file
usesResource("CSCSectorReceiverLUT");
//CSCTFSPcoreLogic has non-const static members
usesResource("CSCTFSPCoreLogic");
//CSCTFPtLUT has a static member it fills by reading a file
usesResource("CSCTFPtLUT");
}

void CSCTFTrackProducer::produce(edm::Event & e, const edm::EventSetup& c)
Expand All @@ -59,16 +51,14 @@ void CSCTFTrackProducer::produce(edm::Event & e, const edm::EventSetup& c)
if( c.get< L1MuTriggerScalesRcd >().cacheIdentifier() != m_scalesCacheID ||
c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() != m_ptScaleCacheID )
{
if(my_builder) delete my_builder ;

edm::ESHandle< L1MuTriggerScales > scales ;
c.get< L1MuTriggerScalesRcd >().get( scales ) ;

edm::ESHandle< L1MuTriggerPtScale > ptScale ;
c.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;

my_builder = new CSCTFTrackBuilder(sp_pset,TMB07,
scales.product(),ptScale.product());
my_builder = std::make_unique<CSCTFTrackBuilder>(sp_pset,TMB07,
scales.product(),ptScale.product());
my_builder->initialize(c);

m_scalesCacheID = c.get< L1MuTriggerScalesRcd >().cacheIdentifier() ;
Expand All @@ -91,7 +81,7 @@ void CSCTFTrackProducer::produce(edm::Event & e, const edm::EventSetup& c)
{
edm::Handle<L1MuDTChambPhContainer> dttrig;
e.getByToken(dt_producer, dttrig);
emulStub = my_dtrc->process(dttrig.product());
emulStub = my_dtrc.process(dttrig.product());
} else {
edm::Handle<CSCTriggerContainer<csctf::TrackStub> > stubsFromDaq;
//e.getByLabel("csctfunpacker","DT",stubsFromDaq);
Expand Down
23 changes: 12 additions & 11 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFTrackProducer.h
Expand Up @@ -3,12 +3,13 @@

#include <string>

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/one/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.h"
#include "L1Trigger/CSCTrackFinder/src/CSCTFTrackBuilder.h"
#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"

class CSCTFTrackBuilder;
Expand All @@ -18,24 +19,24 @@ namespace csctf {
class TrackStub;
}

class CSCTFTrackProducer : public edm::EDProducer
class CSCTFTrackProducer : public edm::one::EDProducer<edm::one::SharedResources>
{
public:
CSCTFTrackProducer(const edm::ParameterSet&);
~CSCTFTrackProducer() override;
void produce(edm::Event & e, const edm::EventSetup& c) override;
void beginJob() override;

private:
CSCTFDTReceiver* my_dtrc;
bool useDT, TMB07, readDtDirect;
edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> input_module;
edm::EDGetTokenT<L1MuDTChambPhContainer> dt_producer;
edm::EDGetTokenT<CSCTriggerContainer<csctf::TrackStub> > directProd;
edm::ParameterSet sp_pset ;
CSCTFDTReceiver my_dtrc;
const bool useDT;
const bool TMB07;
const bool readDtDirect;
const edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> input_module;
const edm::EDGetTokenT<L1MuDTChambPhContainer> dt_producer;
const edm::EDGetTokenT<CSCTriggerContainer<csctf::TrackStub> > directProd;
const edm::ParameterSet sp_pset ;
unsigned long long m_scalesCacheID ;
unsigned long long m_ptScaleCacheID ;
CSCTFTrackBuilder* my_builder;
std::unique_ptr<CSCTFTrackBuilder> my_builder;
};

#endif
8 changes: 4 additions & 4 deletions L1Trigger/CSCTrackFinder/src/CSCTFCandidateBuilder.cc
@@ -1,8 +1,8 @@
#include <L1Trigger/CSCTrackFinder/src/CSCTFCandidateBuilder.h>
#include "L1Trigger/CSCTrackFinder/src/CSCTFCandidateBuilder.h"

CSCTFCandidateBuilder::CSCTFCandidateBuilder(const edm::ParameterSet& pset)
CSCTFCandidateBuilder::CSCTFCandidateBuilder(const edm::ParameterSet& pset):
m_muonsorter{pset}
{
m_muonsorter = new CSCTFMuonSorter(pset);
}

void CSCTFCandidateBuilder::buildCandidates(const L1CSCTrackCollection* trks,
Expand All @@ -18,7 +18,7 @@ void CSCTFCandidateBuilder::buildCandidates(const L1CSCTrackCollection* trks,
stripped_tracks.push_back(tmp_trk->first);
}

result = m_muonsorter->run(stripped_tracks);
result = m_muonsorter.run(stripped_tracks);

cands->insert(cands->end(), result.begin(), result.end());
}

0 comments on commit 8da5db6

Please sign in to comment.