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

L1 tk integration tmtt pre5 #6

Merged
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
36 changes: 0 additions & 36 deletions L1Trigger/TrackFindingTMTT/BuildFile_HLS.xml

This file was deleted.

1,519 changes: 0 additions & 1,519 deletions L1Trigger/TrackFindingTMTT/Doxyfile

This file was deleted.

2 changes: 2 additions & 0 deletions L1Trigger/TrackFindingTMTT/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# N.B. THE GIT INSTRUCTIONS HERE APPLY TO THE ORIGINAL TMTT GIT REPO, SO SHOULD BE IGNORED IF USING THE HYBRID REPO.

# Setup instructions to just run

To checkout and run, or if your modifications won't need to be put into the central repository, do (on an SL7 machine):
35 changes: 0 additions & 35 deletions L1Trigger/TrackFindingTMTT/README_HLS.txt

This file was deleted.

92 changes: 9 additions & 83 deletions L1Trigger/TrackFindingTMTT/README_SimpleCode.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# N.B. THE GIT INSTRUCTIONS HERE APPLY TO THE ORIGINAL TMTT GIT REPO, SO SHOULD BE IGNORED IF USING THE HYBRID REPO. THE CODE DOCUMENTATION HERE IS VALID.

-------------------------------------------------------------------------------------
* How to setup the framework and how to run our analysis code:

@@ -153,9 +155,6 @@ that produced it, also to the stubs on the track and the associated truth partic
It inherits from the pure virutal L1trackBase, ensuring it has some common classes with L1track3D and
L1track2D.

12) Class "L1fittedTrk4and5" contains a pair of L1fittedTrack objects, containg the result of doing
either a 4 or 5 parameter helix fit to the track, where the former assumes d0 = 0.

13) Class "DegradeBend" -- This is used by class "Stub" to degrade the resolution on the stub
bend information to that expected in the electronics, as opposed to that currently in CMSSW.

@@ -207,84 +206,11 @@ TMTrackProducer.EnableHistos = cms.bool(False)

=== To run Louise Skinnari's official CMS L1 track performance analysis code ===

i) This runs on the TTTrack objects produced by our TMTrackProducer. As the Tracklet group also
produce TTTracks, this performance code can be used by all groups. (N.B. When not comparing our
results with another group, our own tmtt_tf_analysis_cfg.py analysis software described
above is usually more convenient).

ii) To include the official analysis code in your setup, follow this recipe:

cmsrel CMSSW_9_3_8
cd CMSSW_9_3_8/src
cmsenv

# Checkout the directory containing the ntuple maker analysis code from git.
git cms-merge-topic skinnari:Tracklet_932

# Checkout the analysis and plotting scripts from gitlab
git clone https://gitlab.cern.ch/cms-tracker-phase2-backend-development/BE_software/L1TrackTools.git

# Checkout our private analysis code from git as explained previously.
(see above)

# Compile
scramv1 b -j8

iii) To run it, do:

cd L1Trigger/TrackFindingTMTT/test/
cmsRun L1TrackNtupleMaker_cfg.py trkFitAlgo=All

This runs our TMTrackProducer code, exactly as before, and configured with the same python files.
This will also run the tracklet track finding code.

The argument trkFitAlgo specifies which track finding algorithms to run.
Possible options are KF4ParamsComb, SimpleLR, Tracklet, All

KF4ParamsComb : TMTT chain with KF4ParamsComb track fitter (HT+KF+DR)
SimpleLR : TMTT chain with seed filter and SimpleLR track fitter (HT+SF+LR+DR)
Tracklet : Runs the default tracklet tracking from skinnari:Tracklet_93X
All : Runs all three

Note that you can run KF4ParamsComb chain without the SF and SimpleLR with the SF in the same job.
You can also specify a comma separated list e.g. if you just wanted to run two of the fitters, you
can specify trkFitAlgo=SimpleLR,Tracklet

It then runs CMS-agreed code to produce an ntuple from these tracks:

L1Trigger/TrackFindingTracklet/test/L1TrackNtupleMaker.cc

iv) When the job has finished, you will see a Hist.root file containing all the histograms produced
by our standard analysis TMTrackProducer, plus in addition the ntuples.
There will be one ntuple corresponding to the tracks produced by each track fitter you ran with,
and one ntuple for the tracklet tracks.

v) To make .png files containing histograms of tracking efficiency, resolution etc., start root & type
the two commands:
.L ../../../L1TrackTools/L1TrackNtuplePlot.C++
L1TrackNtuplePlot("Hist","_TMTT_KF4ParamsComb")

Altenartively, you can copy/move your output Hist.root file to the L1TrackTools directory:
mv Hist.root ../../../L1TrackTools/
cd ../../../L1TrackTools/
.L L1TrackNtuplePlot.C++
L1TrackNtuplePlot("Hist","_TMTT_KF4ParamsComb")

After running, the histograms will be in a root file called "output_Hist_TMTT_KF4ParamsComb.root",
and also saved as pdf/png in the TrkPlots directory (if this directory doesn't exist, you will need
to create it and rerun).

The arguments of the macro are explained around line 45, and here are some usage examples:

To produce plots for muons (from the primary interaction), for the KF4ParamsComb fitter:
.L L1TrackNtuplePlot.C++
L1TrackNtuplePlot("Hist", "_TMTT_KF4ParamsComb", 0, 13 )

To produce plots for all TP in jets with pt>100 GeV:
.L L1TrackNtuplePlot.C++
L1TrackNtuplePlot("Hist", "_TMTT_KF4ParamsComb", 2, 0 )
(This is an alternative way of running the code, useful for comparing with the Tracklet & Hybrid
L1 track algos, since it guarantees identical tracking performance definitions, but providing
no histograms of performance inside the TMTT chain).

Note that by default the efficiency is defined for TPs with pt>2GeV. To consider pt>3GeV, you need to specify a few more arguments.
e.g. to produce plots for TP with pt>3GeV in jets with pt>100 GeV:
.L L1TrackNtuplePlot.C++
L1TrackNtuplePlot("Hist", "_TMTT_KF4ParamsComb", 2, 0, 0, false, false, 3 )
a) cd L1Trigger/TrackFindingTracklet/test/
b) Edit L1TrackNtupleMaker_cfg.py, changing: L1TRKALGO = 'TMTT'
b) cmsRun L1TrackNtupleMaker_cfg.py
c) ./makeHists.csh (prints tracking performance & adds plots to TrkPlots/
21 changes: 0 additions & 21 deletions L1Trigger/TrackFindingTMTT/hls.xml

This file was deleted.

27 changes: 13 additions & 14 deletions L1Trigger/TrackFindingTMTT/interface/ChiSquared4ParamsApprox.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
#ifndef __CHI_SQUARED_4_PARAMS_APPROX__
#define __CHI_SQUARED_4_PARAMS_APPROX__

#include "L1Trigger/TrackFindingTMTT/interface/L1ChiSquared.h"

namespace TMTT {

class ChiSquared4ParamsApprox : public L1ChiSquared{

public:

class ChiSquared4ParamsApprox : public L1ChiSquared {
public:
ChiSquared4ParamsApprox(const Settings* settings, const uint nPar);
~ChiSquared4ParamsApprox(){}
protected:

~ChiSquared4ParamsApprox() {}

protected:
std::vector<double> seed(const L1track3D& l1track3D);
std::vector<double> residuals(std::vector<double> x);
Matrix<double> D(std::vector<double> x);
Matrix<double> Vinv();
std::map<std::string, double> convertParams(std::vector<double> x);
private:

private:
std::vector<double> mapToVec(std::map<std::string, double> x);
std::map<std::string, double> vecToMap(std::vector<double> x);
};
};

} // namespace TMTT

}

#endif
89 changes: 43 additions & 46 deletions L1Trigger/TrackFindingTMTT/interface/ConverterToTTTrack.h
Original file line number Diff line number Diff line change
@@ -11,53 +11,50 @@ using namespace std;

namespace TMTT {

typedef edmNew::DetSetVector< TTStub<Ref_Phase2TrackerDigi_> > DetSetVec;
typedef edm::Ref<DetSetVec, TTStub<Ref_Phase2TrackerDigi_> > TTStubRef;

//=== Convert our non-persistent L1 track collection to the official persistent CMSSW EDM TTTrack format.
//=== Works for both L1track3D and for L1fittedTrk4and5 objects.

class ConverterToTTTrack {

public:

// Initialize constants.
ConverterToTTTrack(const Settings* settings) : settings_(settings) {invPtToInvR_ = settings->invPtToInvR();}

~ConverterToTTTrack(){}

// N.B. The function with argument L1fittedTrk4and5 below should be used if both 4 and 5 parameter helix fit results
// are to be stored in the same TTTrack object. Whilst the function with argument L1fittedTrack should be used if
// they are two be stored in two different TTTrack objects.
// One of these is a better idea, but we don't yet know which, so keep both functions!
// N.B. Do not call these two functions for invalid fitted tracks.

// Convert L1track3D (track candidate before fit) to TTTrack format.
TTTrack< Ref_Phase2TrackerDigi_ > makeTTTrack(const L1track3D& trk , unsigned int iPhiSec, unsigned int iEtaReg) const;
// Convert L1fittedTrack (track candidate after fit) to TTTrack format.
TTTrack< Ref_Phase2TrackerDigi_ > makeTTTrack(const L1fittedTrack& trk , unsigned int iPhiSec, unsigned int iEtaReg) const;

private:

// Get references to stubs on track. (Templated, so works for either L1track3D or L1fittedTrack).
template<class T>
std::vector<TTStubRef> getStubRefs(const T& trk) const {

std::vector<TTStubRef> ttstubrefs;
const std::vector<const Stub*> stubs = trk.getStubs();
for (size_t ii = 0; ii < stubs.size(); ii++) {
TTStubRef ref = *stubs.at(ii);
ttstubrefs.push_back(ref);
typedef edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> > DetSetVec;
typedef edm::Ref<DetSetVec, TTStub<Ref_Phase2TrackerDigi_> > TTStubRef;

//=== Convert our non-persistent L1 track collection to the official persistent CMSSW EDM TTTrack format.
//=== Works for both L1track3D and for L1fittedTrk4and5 objects.

class ConverterToTTTrack {
public:
// Initialize constants.
ConverterToTTTrack(const Settings* settings) : settings_(settings) { invPtToInvR_ = settings->invPtToInvR(); }

~ConverterToTTTrack() {}

// N.B. The function with argument L1fittedTrk4and5 below should be used if both 4 and 5 parameter helix fit results
// are to be stored in the same TTTrack object. Whilst the function with argument L1fittedTrack should be used if
// they are two be stored in two different TTTrack objects.
// One of these is a better idea, but we don't yet know which, so keep both functions!
// N.B. Do not call these two functions for invalid fitted tracks.

// Convert L1track3D (track candidate before fit) to TTTrack format.
TTTrack<Ref_Phase2TrackerDigi_> makeTTTrack(const L1track3D& trk, unsigned int iPhiSec, unsigned int iEtaReg) const;
// Convert L1fittedTrack (track candidate after fit) to TTTrack format.
TTTrack<Ref_Phase2TrackerDigi_> makeTTTrack(const L1fittedTrack& trk,
unsigned int iPhiSec,
unsigned int iEtaReg) const;

private:
// Get references to stubs on track. (Templated, so works for either L1track3D or L1fittedTrack).
template <class T>
std::vector<TTStubRef> getStubRefs(const T& trk) const {
std::vector<TTStubRef> ttstubrefs;
const std::vector<const Stub*> stubs = trk.getStubs();
for (size_t ii = 0; ii < stubs.size(); ii++) {
TTStubRef ref = *stubs.at(ii);
ttstubrefs.push_back(ref);
}

return ttstubrefs;
}

return ttstubrefs;
}

private:

const Settings *settings_; // Configuration parameters.
float invPtToInvR_; // converts 1/Pt to 1/radius_of_curvature
};
private:
const Settings* settings_; // Configuration parameters.
float invPtToInvR_; // converts 1/Pt to 1/radius_of_curvature
};

}
} // namespace TMTT
#endif
Loading