Skip to content

Commit

Permalink
Merge pull request cms-sw#181 from konec/omtfdev_mk3
Browse files Browse the repository at this point in the history
New quality definition, and code refactorin
  • Loading branch information
akalinow committed Mar 4, 2016
2 parents 57b2eeb + 5834e9e commit 0ab3839
Show file tree
Hide file tree
Showing 17 changed files with 692 additions and 383 deletions.
61 changes: 61 additions & 0 deletions L1Trigger/L1TMuonOverlap/interface/AlgoMuon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef AlgoMuon_H
#define AlgoMuon_H

#include <ostream>

class AlgoMuon{

public:

// AlgoMuon() : pt(-1.), eta(99.), phi(9999.), disc(-999), bx(0), q(-1), charge(99), refLayer(-1), hits(0) {} // the old one version
AlgoMuon() : m_disc(-999), m_phi(9999), m_eta(99), m_refLayer(-1), m_hits(0), m_q(-1), m_bx(0), m_pt(-1), m_charge(99) {}
AlgoMuon(int disc=-999, int phi=9999, int eta=99, int refLayer=-1,
int hits=0, int q=-1, int bx=0, int pt=-1, int charge=99):
m_disc(disc), m_phi(phi), m_eta(eta), m_refLayer(refLayer),
m_hits(hits), m_q(q), m_bx(bx), m_pt(pt), m_charge(charge) {}

int getDisc() const { return m_disc; }
int getPhi() const { return m_phi; }
int getEta() const { return m_eta; }
int getRefLayer() const { return m_refLayer; }
int getHits() const { return m_hits; }
int getQ() const { return m_q; }
int getBx() const { return m_bx; }
int getPt() const { return m_pt; }
int getCharge() const { return m_charge; }
int getPhiRHit() const { return m_phiRHit; }

void setDisc(int disc) { m_disc = disc; }
void setPhi(int phi) { m_phi = phi; }
void setEta(int eta) { m_eta = eta; }
void setRefLayer(int refLayer) { m_refLayer = refLayer; }
void setHits(int hits) { m_hits = hits; }
void setQ(int q) { m_q = q; }
void setBx(int bx) { m_bx = bx; }
void setPt(int pt) { m_pt = pt; }
void setCharge(int charge) { m_charge = charge; }
void setPhiRHit(int phiRHit) { m_phiRHit = phiRHit; }

bool isValid() const;

bool operator< (const AlgoMuon & o) const;

friend std::ostream & operator<< (std::ostream &out, const AlgoMuon &o);

private:

int m_disc;
int m_phi;
int m_eta;
int m_refLayer;
int m_hits;
int m_q;
int m_bx;
int m_pt;
int m_charge;
int m_phiRHit;
// to add
// int m_pdf;

};
#endif
21 changes: 21 additions & 0 deletions L1Trigger/L1TMuonOverlap/interface/GhostBuster.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef OMTF_GhostBuster_H
#define OMTF_GhostBuster_H

#include <vector>
#include <ostream>

#include <map>
#include <set>

#include <memory>

#include "L1Trigger/L1TMuonOverlap/interface/AlgoMuon.h"

class OMTFGhostBuster {

public:

void select(std::vector<AlgoMuon> & refHitCands, int charge=0);

};
#endif
32 changes: 0 additions & 32 deletions L1Trigger/L1TMuonOverlap/interface/InternalObj.h

This file was deleted.

85 changes: 85 additions & 0 deletions L1Trigger/L1TMuonOverlap/interface/OMTFReconstruction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#ifndef OMTFReconstruction_H
#define OMTFReconstruction_H

#include "xercesc/util/XercesDefs.hpp"

#include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/EDProducer.h"

#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"

#include "L1Trigger/L1TMuonOverlap/interface/OMTFinputMaker.h"
#include "L1Trigger/L1TMuonOverlap/interface/OMTFSorter.h"
#include "L1Trigger/L1TMuonOverlap/interface/GhostBuster.h"

class L1TMuonOverlapParams;
class OMTFProcessor;
class OMTFConfiguration;
class OMTFConfigMaker;
class XMLConfigWriter;

namespace XERCES_CPP_NAMESPACE{
class DOMElement;
class DOMDocument;
class DOMImplementation;
}

class OMTFReconstruction {
public:
OMTFReconstruction();

OMTFReconstruction(const edm::ParameterSet&);

~OMTFReconstruction();

void beginJob();

void endJob();

void beginRun(edm::Run const& run, edm::EventSetup const& iSetup);

std::auto_ptr<l1t::RegionalMuonCandBxCollection > reconstruct(const edm::Event&, const edm::EventSetup&);

private:

edm::ParameterSet m_Config;

edm::Handle<L1MuDTChambPhContainer> dtPhDigis;
edm::Handle<L1MuDTChambThContainer> dtThDigis;
edm::Handle<CSCCorrelatedLCTDigiCollection> cscDigis;
edm::Handle<RPCDigiCollection> rpcDigis;

void loadAndFilterDigis(const edm::Event&);

void getProcessorCandidates(unsigned int iProcessor, l1t::tftype mtfType, int bx,
l1t::RegionalMuonCandBxCollection & myCandidates);

void writeResultToXML(unsigned int iProcessor, const OMTFinput &myInput,
const std::vector<OMTFProcessor::resultsMap> & myResults);


bool dumpResultToXML, dumpDetailedResultToXML;

///OMTF objects
OMTFConfiguration *m_OMTFConfig;
OMTFinputMaker m_InputMaker;
OMTFSorter m_Sorter;
OMTFGhostBuster m_GhostBuster;
OMTFProcessor *m_OMTF;
///
xercesc::DOMElement *aTopElement;
OMTFConfigMaker *m_OMTFConfigMaker;
XMLConfigWriter *m_Writer;

};

#endif
6 changes: 6 additions & 0 deletions L1Trigger/L1TMuonOverlap/interface/OMTFResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class OMTFResult{

const OMTFResult::vector1D & getHitsWord() const { return hitsBits;}

const OMTFResult::vector1D & getRefPhiRHits() const {return refPhiRHit1D;}

void setRefPhiRHits(unsigned int iRefLayer, int iRefPhiRHit);

void addResult(unsigned int iRefLayer,
unsigned int iLayer,
Expand Down Expand Up @@ -60,6 +63,9 @@ class OMTFResult{

///Words representing nimber of hit layers for each reference layer
vector1D hitsBits;

///Reference phi for each reference layer - the input value
vector1D refPhiRHit1D;

};

Expand Down
41 changes: 25 additions & 16 deletions L1Trigger/L1TMuonOverlap/interface/OMTFSorter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,50 @@

#include "L1Trigger/L1TMuonOverlap/interface/OMTFResult.h"
#include "L1Trigger/L1TMuonOverlap/interface/OMTFProcessor.h"
#include "L1Trigger/L1TMuonOverlap/interface/InternalObj.h"

#include "L1Trigger/L1TMuonOverlap/interface/AlgoMuon.h"
#include "L1Trigger/L1TMuonOverlap/interface/GhostBuster.h"

class OMTFSorter{

public:

/////////////////////////////////////////////////////////////
// method not used
/////////////////////////////////////////////////////////////
///Sort all processor results.
///First for each region cone find a best candidate using sortRegionResults()
///Then select best candidate amongs found for each logic region.
///The sorting is made for candidates with a given charge
InternalObj sortProcessorResults(const std::vector<OMTFProcessor::resultsMap> & procResults,
int charge=0);
// AlgoMuon sortProcessorResults(const std::vector<OMTFProcessor::resultsMap> & procResults,
// int charge=0);
//
void sortProcessorResults(const std::vector<OMTFProcessor::resultsMap> & procResults,
std::vector<InternalObj> & refHitCleanCands,
int charge=0);

// void sortProcessorResults(const std::vector<OMTFProcessor::resultsMap> & procResults,
// std::vector<AlgoMuon> & refHitCands,
// int charge=0);
//
///Sort all processor results.
///First for each region cone find a best candidate using sortRegionResults()
///Then select best candidate amongs found for each logic region
l1t::RegionalMuonCand sortProcessor(const std::vector<OMTFProcessor::resultsMap> & procResults,
int charge=0);
// l1t::RegionalMuonCand sortProcessor(const std::vector<OMTFProcessor::resultsMap> & procResults,
// int charge=0);
/////////////////////////////////////////////////////////////

void sortRefHitResults(const std::vector<OMTFProcessor::resultsMap> & procResults,
std::vector<AlgoMuon> & refHitCleanCands,
int charge=0);


//
void sortProcessorAndFillCandidates(unsigned int iProcessor, l1t::tftype mtfType,
const std::vector<OMTFProcessor::resultsMap> & procResults,
l1t::RegionalMuonCandBxCollection & sortedCands,
int bx, int charge=0);
const std::vector<AlgoMuon> & algoCands,
l1t::RegionalMuonCandBxCollection & sortedCands,
int bx, int charge=0);


///Sort results from a single reference hit.
///Select candidate with highest number of hit layers
///Then select a candidate with largest likelihood value and given charge
///as we allow two candidates with opposite charge from single 10deg region
InternalObj sortRefHitResults(const OMTFProcessor::resultsMap & aResultsMap,
AlgoMuon sortRefHitResults(const OMTFProcessor::resultsMap & aResultsMap,
int charge=0);

private:
Expand All @@ -61,7 +70,7 @@ class OMTFSorter{
///The output tuple contains (nHitsMax, pdfValMax, refPhi, refLayer, hitsWord, refEta)
///hitsWord codes number of layers hit: hitsWord= sum 2**iLogicLayer,
///where sum runs over layers which were hit
std::tuple<unsigned int,unsigned int, int, int, unsigned int, int> sortSingleResult(const OMTFResult & aResult);
AlgoMuon sortSingleResult(const OMTFResult & aResult);

};

Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1TMuonOverlap/interface/XMLConfigWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GoldenPattern;
class OMTFConfiguration;
class OMTFinput;
class OMTFResult;
class InternalObj;
class AlgoMuon;
struct Key;

namespace XERCES_CPP_NAMESPACE{
Expand Down Expand Up @@ -40,7 +40,7 @@ class XMLConfigWriter{

void writeCandidateData(xercesc::DOMElement *aTopElement,
unsigned int iRefHit,
const InternalObj & aCand);
const AlgoMuon & aCand);

void writeResultsData(xercesc::DOMElement *aTopElement,
unsigned int iRegion,
Expand Down
Loading

0 comments on commit 0ab3839

Please sign in to comment.