Skip to content

Commit

Permalink
GoldenPatternVec = std::vector<std::unique_ptr<GoldenPatternType> >
Browse files Browse the repository at this point in the history
OMTFReconstruction::beginRun modified to adapted to the GoldenPatternVec
and other changes

added calss EmulationObserverBase
PatternOptimizerBase::observeProcesorEmulation and findSimMuon moved
there

DataROOTDumper2 inherits from EmulationObserverBase, removing
omtfGpResultsPdfSum and omtfGpResultsFiredLayers from OmtfEvent,
removing gpResultsToPt

removing DataROOTDumper

EventCapture - goldenPatterns is pointer now

removed OMTFSorterWithThreshold

removed PatternsPtAssignment

ProcessorBase<GoldenPatternType>::setGPs removed, code moved to
constructor
  • Loading branch information
Karol Bunkowski committed Aug 24, 2021
1 parent 70ff9c2 commit e53dc5a
Show file tree
Hide file tree
Showing 33 changed files with 334 additions and 826 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef OMTF_GoldenPatternBase_H
#define OMTF_GoldenPatternBase_H
#ifndef L1T_OmtfP1_GoldenPatternBase_H
#define L1T_OmtfP1_GoldenPatternBase_H

#include "boost/multi_array.hpp"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/MuonStub.h"
Expand Down Expand Up @@ -156,6 +156,9 @@ class GoldenPatternBase {
//second index: myOmtfConfig->nTestRefHits
resultsArrayType results;
};


template <class GoldenPatternType> using GoldenPatternVec = std::vector<std::unique_ptr<GoldenPatternType> > ;
//////////////////////////////////
//////////////////////////////////
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,9 @@ class OMTFConfiguration : public ProcConfigurationBase {

static const unsigned int patternsInGroup = 4;

///and this based on the actual goldenPats
//takes the groups from the kye, it should be set during xml reading, or creating the goldenPats
//takes the groups from the key, it should be set during xml reading, or creating the goldenPats
template <class GoldenPatternType>
vector2D getPatternGroups(const std::vector<std::shared_ptr<GoldenPatternType> >& goldenPats) const {
vector2D getPatternGroups(const std::vector<std::unique_ptr<GoldenPatternType> >& goldenPats) const {
//unsigned int mergedCnt = 4;
vector2D mergedPatterns;
for (unsigned int iPat = 0; iPat < goldenPats.size(); iPat++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class OMTFProcessor : public ProcessorBase<GoldenPatternType>, public IProcessor
OMTFProcessor(OMTFConfiguration* omtfConfig,
const edm::ParameterSet& edmCfg,
edm::EventSetup const& evSetup,
const typename ProcessorBase<GoldenPatternType>::GoldenPatternVec& gps);
GoldenPatternVec<GoldenPatternType>&& gps);

~OMTFProcessor() override;

Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFSorter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class OMTFSorter : public SorterBase<GoldenPatternType> {
///as we allow two candidates with opposite charge from single 10deg region
AlgoMuons::value_type sortRefHitResults(unsigned int procIndx,
unsigned int iRefHit,
const std::vector<std::shared_ptr<GoldenPatternType> >& gPatterns,
const GoldenPatternVec<GoldenPatternType>& gPatterns,
int charge = 0) override;

private:
Expand Down

This file was deleted.

18 changes: 5 additions & 13 deletions L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/ProcessorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,23 @@ class SimTrack;
template <class GoldenPatternType>
class ProcessorBase {
public:
typedef std::vector<std::shared_ptr<GoldenPatternType> > GoldenPatternVec;

ProcessorBase(OMTFConfiguration* omtfConfig, const L1TMuonOverlapParams* omtfPatterns) : myOmtfConfig(omtfConfig) {
configure(omtfConfig, omtfPatterns);
};

ProcessorBase(OMTFConfiguration* omtfConfig, const GoldenPatternVec& gps) : myOmtfConfig(omtfConfig) {
setGPs(gps);
//initPatternPtRange(true); is called in the setGPs
omtfConfig->setPatternPtRange(getPatternPtRange());
};
ProcessorBase(OMTFConfiguration* omtfConfig, GoldenPatternVec<GoldenPatternType>&& gps);

virtual ~ProcessorBase() {}

///Return vector of GoldenPatterns
virtual const GoldenPatternVec& getPatterns() const { return theGPs; };
virtual GoldenPatternVec<GoldenPatternType>& getPatterns() { return theGPs; };

///Fill GP vec with patterns from CondFormats object
virtual bool configure(OMTFConfiguration* omtfParams, const L1TMuonOverlapParams* omtfPatterns);

///Add GoldenPattern to pattern vec.
virtual void addGP(GoldenPatternType* aGP);

virtual void setGPs(const GoldenPatternVec& gps);

///Reset all configuration parameters
virtual void resetConfiguration();

Expand All @@ -55,13 +47,13 @@ class ProcessorBase {
virtual void printInfo() const;

protected:
///vector holding Golden Patterns
GoldenPatternVec theGPs;

///Configuration of the algorithm. This object
///does not contain the patterns data.
const OMTFConfiguration* myOmtfConfig;

///vector holding Golden Patterns
GoldenPatternVec<GoldenPatternType> theGPs;

///Remove hits whis are outside input range
///for given processor and cone
virtual MuonStubPtrs1D restrictInput(unsigned int iProcessor,
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/SorterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SorterBase {

//iProcessor - continuous processor index [0...11]
virtual AlgoMuons sortResults(unsigned int procIndx,
const std::vector<std::shared_ptr<GoldenPatternType> >& gPatterns,
const GoldenPatternVec<GoldenPatternType>& gPatterns,
int charge = 0) {
AlgoMuons refHitCands;
// for(auto itRefHit: procResults) refHitCands.push_back(sortRefHitResults(itRefHit,charge));
Expand All @@ -39,7 +39,7 @@ class SorterBase {
///as we allow two candidates with opposite charge from single 10deg region
virtual AlgoMuons::value_type sortRefHitResults(unsigned int procIndx,
unsigned int iRefHit,
const std::vector<std::shared_ptr<GoldenPatternType> >& gPatterns,
const GoldenPatternVec<GoldenPatternType>& gPatterns,
int charge = 0) = 0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define OMTF_XMLConfigReader_H

#include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternBase.h"

#include "CondFormats/L1TObjects/interface/LUT.h"

#include <string>
Expand Down Expand Up @@ -41,12 +43,12 @@ class XMLConfigReader {
* it is needed in the readLUTs, as only with the empty patterns it is possible to obtain the patterns grouping from the LUTs in the L1TMuonOverlapParams
*/
template <class GoldenPatternType>
std::vector<std::shared_ptr<GoldenPatternType> > readPatterns(const L1TMuonOverlapParams& aConfig,
GoldenPatternVec<GoldenPatternType> readPatterns(const L1TMuonOverlapParams& aConfig,
const std::string& patternsFile,
bool buildEmptyPatterns, bool resetNumbering = true);

template <class GoldenPatternType>
std::vector<std::shared_ptr<GoldenPatternType> > readPatterns(const L1TMuonOverlapParams& aConfig,
GoldenPatternVec<GoldenPatternType> readPatterns(const L1TMuonOverlapParams& aConfig,
const std::vector<std::string>& patternsFiles, bool buildEmptyPatterns);

void readLUTs(std::vector<l1t::LUT*> luts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OmtfName.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternBase.h"
#include <string>
#include <vector>

Expand Down Expand Up @@ -52,7 +53,7 @@ class XMLConfigWriter {
void writeGPData(GoldenPattern* aGP1, GoldenPattern* aGP2, GoldenPattern* aGP3, GoldenPattern* aGP4);

template <class GoldenPatternType>
void writeGPs(const std::vector<std::shared_ptr<GoldenPatternType> >& goldenPats, std::string fName);
void writeGPs(const GoldenPatternVec<GoldenPatternType>& goldenPats, std::string fName);

void writeConnectionsData(const std::vector<std::vector<OMTFConfiguration::vector2D> >& measurements4D);

Expand Down
66 changes: 0 additions & 66 deletions L1Trigger/L1TMuonOverlapPhase1/interface/Tools/DataROOTDumper.h

This file was deleted.

23 changes: 6 additions & 17 deletions L1Trigger/L1TMuonOverlapPhase1/interface/Tools/DataROOTDumper2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#ifndef INTERFACE_TOOLS_DATAROOTDUMPER2_H_
#define INTERFACE_TOOLS_DATAROOTDUMPER2_H_

#include "L1Trigger/L1TMuonOverlapPhase1/interface/Tools/GpResultsToPt.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/Tools/PatternOptimizerBase.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/IOMTFEmulationObserver.h"
#include "L1Trigger/L1TMuonOverlapPhase1/interface/Tools/EmulationObserverBase.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
Expand All @@ -19,6 +17,8 @@

#include "TMap.h"
#include "TArrayI.h"
#include "TFile.h"
#include "TH2.h"

#include <functional>

Expand Down Expand Up @@ -55,19 +55,14 @@ struct OmtfEvent {

std::vector<unsigned long> hits;

boost::multi_array<float, 2> omtfGpResultsPdfSum; //[iREfHit][iGp]
boost::multi_array<unsigned int, 2> omtfGpResultsFiredLayers; //[iREfHit][iGp]

OmtfEvent(unsigned int nRefHits, unsigned int nGoldenPatterns)
: omtfGpResultsPdfSum(boost::extents[nRefHits][nGoldenPatterns]),
omtfGpResultsFiredLayers(boost::extents[nRefHits][nGoldenPatterns]) {}
//OmtfEvent() {}
};

class DataROOTDumper2 : public PatternOptimizerBase {
class DataROOTDumper2 : public EmulationObserverBase {
public:
DataROOTDumper2(const edm::ParameterSet& edmCfg,
const OMTFConfiguration* omtfConfig,
const std::vector<std::shared_ptr<GoldenPattern> >& gps,
std::string rootFileName);

~DataROOTDumper2() override;
Expand All @@ -78,25 +73,19 @@ class DataROOTDumper2 : public PatternOptimizerBase {
void endJob() override;

private:
std::vector<std::shared_ptr<GoldenPattern> > gps;

void initializeTTree(std::string rootFileName);
void saveTTree();

TFile* rootFile = nullptr;
TTree* rootTree = nullptr;

OmtfEvent event;
OmtfEvent omtfEvent;

unsigned int evntCnt = 0;

TH1I* ptGenPos = nullptr;
TH1I* ptGenNeg = nullptr;

bool dumpGpResults = false;

GpResultsToPt* gpResultsToPt = nullptr; //TODO move to OmtfProcessor

std::vector<TH2*> hitVsPt;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* EmulationObserverBase.h
*
* Created on: Aug 18, 2021
* Author: kbunkow
*/

#ifndef L1T_OmtfP1_TOOLS_EMULATIONOBSERVERBASE_H_
#define L1T_OmtfP1_TOOLS_EMULATIONOBSERVERBASE_H_

#include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/IOMTFEmulationObserver.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "SimDataFormats/Track/interface/SimTrackContainer.h"

class EmulationObserverBase : public IOMTFEmulationObserver {
public:
EmulationObserverBase(const edm::ParameterSet& edmCfg, const OMTFConfiguration* omtfConfig);

virtual ~EmulationObserverBase();

void observeProcesorEmulation(unsigned int iProcessor,
l1t::tftype mtfType,
const std::shared_ptr<OMTFinput>& input,
const AlgoMuons& algoCandidates,
const AlgoMuons& gbCandidates,
const std::vector<l1t::RegionalMuonCand>& candMuons) override;

void observeEventBegin(const edm::Event& iEvent) override;

//void observeEventEnd(const edm::Event& iEvent,
// std::unique_ptr<l1t::RegionalMuonCandBxCollection>& finalCandidates) override;

//void endJob() override;

const SimTrack* findSimMuon(const edm::Event& event, const SimTrack* previous = nullptr);

protected:
edm::ParameterSet edmCfg;
const OMTFConfiguration* omtfConfig;

const SimTrack* simMuon = nullptr;

//candidate found by omtf in a given event
AlgoMuons::value_type omtfCand;

l1t::RegionalMuonCand regionalMuonCand;

//AlgoMuons algoCandidates;

unsigned int candProcIndx = 0;
};

#endif /* INTERFACE_TOOLS_EMULATIONOBSERVERBASE_H_ */
Loading

0 comments on commit e53dc5a

Please sign in to comment.