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

changes to timing info for ticlv5 #23

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
23 changes: 10 additions & 13 deletions DataFormats/HGCalReco/interface/TICLCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "RecoHGCal/TICL/interface/commons.h"

#include "FWCore/MessageLogger/interface/MessageLogger.h"

// A TICLCandidate is a lightweight physics object made from one or multiple Tracksters.

class TICLCandidate : public reco::LeafCandidate {
Expand All @@ -28,16 +30,13 @@ class TICLCandidate : public reco::LeafCandidate {
timeError_(trackster->timeError()),
rawEnergy_(0.f) {}

TICLCandidate(const edm::Ptr<reco::Track> trackPtr, edm::Ptr<ticl::Trackster>& tracksterPtr)
: LeafCandidate(),
tracksters_({std::move(tracksterPtr)}),
trackPtr_(std::move(trackPtr)),
time_(0.f),
timeError_(-1.f) {
//TODO: Raise Error
assert(trackPtr_.isNonnull() or tracksters_[0].isNonnull());

if (tracksters_[0].isNonnull()) {
TICLCandidate(const edm::Ptr<reco::Track> trackPtr, const edm::Ptr<ticl::Trackster>& tracksterPtr)
: LeafCandidate(), tracksters_{}, trackPtr_(trackPtr), time_(0.f), timeError_(-1.f) {
if (trackPtr_.isNull() and tracksterPtr.isNull())
edm::LogError("TICLCandidate") << "At least one between track and trackster must be valid\n";

if (tracksterPtr.isNonnull()) {
tracksters_.push_back(std::move(tracksterPtr));
auto const& trackster = tracksters_[0].get();
idProbabilities_ = trackster->id_probabilities();
if (trackPtr_.isNonnull()) {
Expand Down Expand Up @@ -65,9 +64,7 @@ class TICLCandidate : public reco::LeafCandidate {
regrE);
setP4(p4);
}
}

else {
} else {
//candidate from track only
auto const& tk = trackPtr_.get();
setPdgId(211 * tk->charge());
Expand Down
9 changes: 7 additions & 2 deletions DataFormats/HGCalReco/interface/Trackster.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ namespace ticl {
regressed_energy_(0.f),
raw_energy_(0.f),
time_(0.f),
boundTime_(0.f),
timeError_(-1.f),
raw_em_energy_(0.f),
id_probabilities_{},
raw_pt_(0.f),
raw_em_pt_(0.f),
raw_em_energy_(0.f),
seedIndex_(-1),
eigenvalues_{},
sigmas_{},
Expand Down Expand Up @@ -137,6 +138,8 @@ namespace ticl {
}
inline void setIdProbability(ParticleType type, float value) { id_probabilities_[int(type)] = value; }

inline void setBoundaryTime(float t) { boundTime_ = t; };

inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; }
inline const std::vector<unsigned int> &vertices() const { return vertices_; }
inline const unsigned int vertices(int index) const { return vertices_[index]; }
Expand All @@ -152,6 +155,7 @@ namespace ticl {
inline const float raw_em_energy() const { return raw_em_energy_; }
inline const float raw_pt() const { return raw_pt_; }
inline const float raw_em_pt() const { return raw_em_pt_; }
inline const float boundaryTime() const { return boundTime_; };
inline const Vector &barycenter() const { return barycenter_; }
inline const std::array<float, 3> &eigenvalues() const { return eigenvalues_; }
inline const std::array<Vector, 3> &eigenvectors() const { return eigenvectors_; }
Expand All @@ -173,8 +177,8 @@ namespace ticl {
float raw_energy_;
// -99, -1 if not available. ns units otherwise
float time_;
float boundTime_;
float timeError_;
float raw_em_energy_;

// trackster ID probabilities
std::array<float, 8> id_probabilities_;
Expand All @@ -185,6 +189,7 @@ namespace ticl {
std::vector<float> vertex_multiplicity_;
float raw_pt_;
float raw_em_pt_;
float raw_em_energy_;

// Product ID of the seeding collection used to create the Trackster.
// For GlobalSeeding the ProductID is set to 0. For track-based seeding
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/HGCalReco/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

<lcgdict>
<class name="ticl::Trackster" ClassVersion="10">
<class name="ticl::Trackster" ClassVersion="11">
<version ClassVersion="11" checksum="2995118904"/>
<version ClassVersion="10" checksum="556627704"/>
<version ClassVersion="9" checksum="1001808235"/>
<version ClassVersion="8" checksum="749412802"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import FWCore.ParameterSet.Config as cms
from RecoLocalCalo.HGCalRecProducers.HGCalUncalibRecHitProducer_cfi import HGCalUncalibRecHitProducer

HGCalUncalibRecHitL1Seeded = cms.EDProducer("HGCalUncalibRecHitProducer",
HGCalUncalibRecHitL1Seeded = HGCalUncalibRecHitProducer.clone(
HGCEEConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(100),
Expand All @@ -13,7 +14,6 @@
toaLSB_ns = cms.double(0.0244)
),
HGCEEdigiCollection = cms.InputTag("hgcalDigisL1Seeded","EE"),
HGCEEhitCollection = cms.string('HGCEEUncalibRecHits'),
HGCHEBConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(68.75),
Expand All @@ -26,7 +26,6 @@
toaLSB_ns = cms.double(0.0244)
),
HGCHEBdigiCollection = cms.InputTag("hgcalDigisL1Seeded","HEback"),
HGCHEBhitCollection = cms.string('HGCHEBUncalibRecHits'),
HGCHEFConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(100),
Expand All @@ -39,7 +38,6 @@
toaLSB_ns = cms.double(0.0244)
),
HGCHEFdigiCollection = cms.InputTag("hgcalDigisL1Seeded","HEfront"),
HGCHEFhitCollection = cms.string('HGCHEFUncalibRecHits'),
HGCHFNoseConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(100),
Expand All @@ -50,8 +48,5 @@
tdcSaturation = cms.double(10000),
tofDelay = cms.double(-33),
toaLSB_ns = cms.double(0.0244)
),
HGCHFNosedigiCollection = cms.InputTag("hfnoseDigis","HFNose"),
HGCHFNosehitCollection = cms.string('HGCHFNoseUncalibRecHits'),
algo = cms.string('HGCalUncalibRecHitWorkerWeights')
)
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import FWCore.ParameterSet.Config as cms
from RecoLocalCalo.HGCalRecProducers.HGCalUncalibRecHitProducer_cfi import HGCalUncalibRecHitProducer

HGCalUncalibRecHit = cms.EDProducer("HGCalUncalibRecHitProducer",
HGCalUncalibRecHit = HGCalUncalibRecHitProducer.clone(
HGCEEConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(100),
Expand All @@ -12,8 +13,6 @@
tofDelay = cms.double(-9),
toaLSB_ns = cms.double(0.0244)
),
HGCEEdigiCollection = cms.InputTag("hgcalDigis","EE"),
HGCEEhitCollection = cms.string('HGCEEUncalibRecHits'),
HGCHEBConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(68.75),
Expand All @@ -25,8 +24,6 @@
tofDelay = cms.double(-14),
toaLSB_ns = cms.double(0.0244)
),
HGCHEBdigiCollection = cms.InputTag("hgcalDigis","HEback"),
HGCHEBhitCollection = cms.string('HGCHEBUncalibRecHits'),
HGCHEFConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(100),
Expand All @@ -38,8 +35,6 @@
tofDelay = cms.double(-11),
toaLSB_ns = cms.double(0.0244)
),
HGCHEFdigiCollection = cms.InputTag("hgcalDigis","HEfront"),
HGCHEFhitCollection = cms.string('HGCHEFUncalibRecHits'),
HGCHFNoseConfig = cms.PSet(
adcNbits = cms.uint32(10),
adcSaturation = cms.double(100),
Expand All @@ -50,8 +45,5 @@
tdcSaturation = cms.double(10000),
tofDelay = cms.double(-33),
toaLSB_ns = cms.double(0.0244)
),
HGCHFNosedigiCollection = cms.InputTag("hfnoseDigis","HFNose"),
HGCHFNosehitCollection = cms.string('HGCHFNoseUncalibRecHits'),
algo = cms.string('HGCalUncalibRecHitWorkerWeights')
)
)
6 changes: 3 additions & 3 deletions RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ namespace ticl {
struct TrackTimingInformation {
const edm::Handle<edm::ValueMap<float>> tkTime_h;
const edm::Handle<edm::ValueMap<float>> tkTimeErr_h;
const edm::Handle<edm::ValueMap<float>> tkTimeQual_h;
const edm::Handle<edm::ValueMap<float>> tkBeta_h;
const edm::Handle<edm::ValueMap<float>> tkPath_h;
const edm::Handle<edm::ValueMap<GlobalPoint>> tkMtdPos_h;

TrackTimingInformation(const edm::Handle<edm::ValueMap<float>> tkT,
const edm::Handle<edm::ValueMap<float>> tkTE,
const edm::Handle<edm::ValueMap<float>> tkTQ,
const edm::Handle<edm::ValueMap<float>> tkB,
const edm::Handle<edm::ValueMap<float>> tkP,
const edm::Handle<edm::ValueMap<GlobalPoint>> mtdPos)
: tkTime_h(tkT), tkTimeErr_h(tkTE), tkTimeQual_h(tkTQ), tkBeta_h(tkB), tkMtdPos_h(mtdPos) {}
: tkTime_h(tkT), tkTimeErr_h(tkTE), tkBeta_h(tkB), tkPath_h(tkP), tkMtdPos_h(mtdPos) {}
};

virtual void makeCandidates(const Inputs& input,
Expand Down
32 changes: 2 additions & 30 deletions RecoHGCal/TICL/plugins/GeneralInterpretationAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ GeneralInterpretationAlgo::GeneralInterpretationAlgo(const edm::ParameterSet &co
del_tk_ts_layer1_(conf.getParameter<double>("delta_tk_ts_layer1")),
del_tk_ts_int_(conf.getParameter<double>("delta_tk_ts_interface")),
del_ts_em_had_(conf.getParameter<double>("delta_ts_em_had")),
del_ts_had_had_(conf.getParameter<double>("delta_ts_had_had")),
timing_quality_threshold_(conf.getParameter<double>("track_time_quality_threshold")) {}
del_ts_had_had_(conf.getParameter<double>("delta_ts_had_had")) {}

void GeneralInterpretationAlgo::initialize(const HGCalDDDConstants *hgcons,
const hgcal::RecHitTools rhtools,
Expand Down Expand Up @@ -155,7 +154,6 @@ bool GeneralInterpretationAlgo::timeAndEnergyCompatible(float &total_raw_energy,
const Trackster &trackster,
const float &tkT,
const float &tkTErr,
const float &tkTimeQual,
const float &tkBeta,
const GlobalPoint &tkMtdPos,
bool useMTDTiming) {
Expand All @@ -167,7 +165,7 @@ bool GeneralInterpretationAlgo::timeAndEnergyCompatible(float &total_raw_energy,

// compatible if trackster time is within 3sigma of
// track time; compatible if either: no time assigned
// to trackster or track time quality is below threshold
// to trackster or track

float tsT = trackster.time();
float tsTErr = trackster.timeError();
Expand Down Expand Up @@ -223,21 +221,12 @@ void GeneralInterpretationAlgo::makeCandidates(const Inputs &input,
// to look for potential linkages in the appropriate tiles
std::vector<std::pair<Vector, unsigned>> trackPColl; // propagated track points and index of track in collection
std::vector<std::pair<Vector, unsigned>> tkPropIntColl; // tracks propagated to lastLayerEE
std::vector<std::pair<Vector, unsigned>> tsPropIntColl; // Tracksters in CE-E, propagated to lastLayerEE
std::vector<std::pair<Vector, unsigned>> tsHadPropIntColl; // Tracksters in CE-H, propagated to lastLayerEE

trackPColl.reserve(tracks.size());
tkPropIntColl.reserve(tracks.size());

std::array<TICLLayerTile, 2> tracksterPropTiles = {}; // all Tracksters, propagated to layer 1
std::array<TICLLayerTile, 2> tsPropIntTiles = {}; // all Tracksters, propagated to lastLayerEE
std::array<TICLLayerTile, 2> tsHadPropIntTiles = {}; // Tracksters in CE-H, propagated to lastLayerEE

// linking : trackster is hadronic if its barycenter is in CE-H
auto isHadron = [&](const Trackster &t) -> bool {
auto boundary_z = rhtools_.getPositionLayer(rhtools_.lastLayerEE()).z();
return (std::abs(t.barycenter().Z()) > boundary_z);
};

if (TICLInterpretationAlgoBase::algo_verbosity_ > VerbosityLevel::Advanced)
LogDebug("GeneralInterpretationAlgo") << "------- Geometric Linking ------- \n";
Expand All @@ -248,8 +237,6 @@ void GeneralInterpretationAlgo::makeCandidates(const Inputs &input,
for (unsigned i = 0; i < tracks.size(); ++i) {
if (!maskTracks.at(i))
continue;
const auto &tk = tracks.at(i);
reco::TrackRef trackref = reco::TrackRef(tkH, i);
candidateTrackIds.push_back(i);
}

Expand Down Expand Up @@ -306,15 +293,7 @@ void GeneralInterpretationAlgo::makeCandidates(const Inputs &input,
tsP = propagateTrackster(t, i, zVal, tsPropIntTiles);
tsAllPropInt.emplace_back(tsP);

if (!isHadron(t)) // EM tracksters
tsPropIntColl.emplace_back(tsP, i);
else { // HAD
tsHadPropIntTiles[(t.barycenter().Z() > 0) ? 1 : 0].fill(tsP.Eta(), tsP.Phi(), i);
tsHadPropIntColl.emplace_back(tsP, i);
}
} // TS
tsPropIntColl.shrink_to_fit();
tsHadPropIntColl.shrink_to_fit();

std::vector<std::vector<unsigned>> tsNearTk(tracks.size());
findTrackstersInWindow(
Expand All @@ -329,8 +308,6 @@ void GeneralInterpretationAlgo::makeCandidates(const Inputs &input,
std::vector<std::vector<unsigned int>> trackstersInTrackIndices;
trackstersInTrackIndices.resize(tracks.size());

resultCandidate.resize(tracks.size(), -1);

std::vector<bool> chargedMask(tracksters.size(), true);
for (unsigned &i : candidateTrackIds) {
if (tsNearTk[i].empty() && tsNearTkAtInt[i].empty()) { // nothing linked to track, make charged hadrons
Expand All @@ -343,13 +320,11 @@ void GeneralInterpretationAlgo::makeCandidates(const Inputs &input,
auto tkRef = reco::TrackRef(tkH, i);
float track_time = 0.f;
float track_timeErr = 0.f;
float track_timeQual = 0.f;
float track_beta = 0.f;
GlobalPoint track_MtdPos{0.f, 0.f, 0.f};
if (useMTDTiming) {
track_time = (*inputTiming.tkTime_h)[tkRef];
track_timeErr = (*inputTiming.tkTimeErr_h)[tkRef];
track_timeQual = (*inputTiming.tkTimeQual_h)[tkRef];
track_beta = (*inputTiming.tkBeta_h)[tkRef];
track_MtdPos = (*inputTiming.tkMtdPos_h)[tkRef];
}
Expand All @@ -360,7 +335,6 @@ void GeneralInterpretationAlgo::makeCandidates(const Inputs &input,
tracksters[tsIdx],
track_time,
track_timeErr,
track_timeQual,
track_beta,
track_MtdPos,
useMTDTiming)) {
Expand All @@ -374,7 +348,6 @@ void GeneralInterpretationAlgo::makeCandidates(const Inputs &input,
tracksters[tsIdx],
track_time,
track_timeErr,
track_timeQual,
track_beta,
track_MtdPos,
useMTDTiming)) {
Expand Down Expand Up @@ -412,6 +385,5 @@ void GeneralInterpretationAlgo::fillPSetDescription(edm::ParameterSetDescription
desc.add<double>("delta_tk_ts_interface", 0.03);
desc.add<double>("delta_ts_em_had", 0.03);
desc.add<double>("delta_ts_had_had", 0.03);
desc.add<double>("track_time_quality_threshold", 0.5);
TICLInterpretationAlgoBase::fillPSetDescription(desc);
}
2 changes: 0 additions & 2 deletions RecoHGCal/TICL/plugins/GeneralInterpretationAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace ticl {
const Trackster &trackster,
const float &tkTime,
const float &tkTimeErr,
const float &tkTimeQual,
const float &tkBeta,
const GlobalPoint &tkMtdPos,
bool useMTDTiming);
Expand All @@ -63,7 +62,6 @@ namespace ticl {
const float del_ts_em_had_;
const float del_ts_had_had_;

const float timing_quality_threshold_;
const HGCalDDDConstants *hgcons_;

std::unique_ptr<GeomDet> firstDisk_[2];
Expand Down
Loading