Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions Configuration/ProcessModifiers/python/ticl_v3_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import FWCore.ParameterSet.Config as cms

# This modifier is for running TICL v3.

ticl_v3 = cms.Modifier()
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,30 @@ def condition(self, fragment, stepList, key, hasHarvest):
upgradeWFs['ticl_FastJet'].step3 = {'--procModifiers': 'fastJetTICL'}
upgradeWFs['ticl_FastJet'].step4 = {'--procModifiers': 'fastJetTICL'}

class UpgradeWorkflow_ticl_v3(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
if 'RecoGlobal' in step:
stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
if 'HARVESTGlobal' in step:
stepDict[stepName][k] = merge([self.step4, stepDict[step][k]])
def condition(self, fragment, stepList, key, hasHarvest):
return (fragment=="TTbar_14TeV" or 'CloseByP' in fragment or 'Eta1p7_2p7' in fragment) and '2026' in key
upgradeWFs['ticl_v3'] = UpgradeWorkflow_ticl_v3(
steps = [
'RecoGlobal',
'HARVESTGlobal'
],
PU = [
'RecoGlobal',
'HARVESTGlobal'
],
suffix = '_ticl_v3',
offset = 0.203,
Copy link
Contributor

@srimanob srimanob Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should update also Configuration/PyReleaseValidation/README.md. It can be done later, no need to do in this PR.

)
upgradeWFs['ticl_v3'].step3 = {'--procModifiers': 'ticl_v3'}
upgradeWFs['ticl_v3'].step4 = {'--procModifiers': 'ticl_v3'}


# Track DNN workflows
class UpgradeWorkflow_trackdnn(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/HGCalReco/interface/Trackster.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace ticl {

Trackster()
: iterationIndex_(0),
seedIndex_(0),
seedIndex_(-1),
time_(0.f),
timeError_(-1.f),
regressed_energy_(0.f),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import FWCore.ParameterSet.Config as cms

ticlTrackstersMerge = cms.EDProducer("TrackstersMergeProducer",
ticlTrackstersMerge = cms.EDProducer("TrackstersMergeProducerV3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean HLT Phase-2 is running an old version of TICL? When will that version be removed? Is there a plan to update HLT to use TICL V4? @trtomei ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Martin-Grunewald , yes.
As I said during the HLT upgrade meeting, the plan is to switch HLT to TICLv4, but this might need some work from POGs to adjust the way they are consuming tracksters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felicepantaleo
OK, thanks!

cosangle_align = cms.double(0.9945),
debug = cms.bool(True),
e_over_h_threshold = cms.double(1),
eid_input_name = cms.string('input'),
eid_min_cluster_energy = cms.double(1),
Expand Down
3 changes: 1 addition & 2 deletions RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "RecoHGCal/TICL/interface/GlobalCache.h"
#include "RecoHGCal/TICL/interface/commons.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "PhysicsTools/TensorFlow/interface/TensorFlow.h"

Expand Down Expand Up @@ -54,8 +55,6 @@ namespace ticl {
std::vector<Trackster>& result,
std::unordered_map<int, std::vector<int>>& seedToTracksterAssociation) = 0;

enum VerbosityLevel { None = 0, Basic, Advanced, Expert, Guru };

protected:
int algo_verbosity_;
};
Expand Down
42 changes: 6 additions & 36 deletions RecoHGCal/TICL/interface/commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

namespace ticl {

//constants
constexpr double mpion = 0.13957;
constexpr float mpion2 = mpion * mpion;

inline Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge) {
if (pdgId == 111) {
return Trackster::ParticleType::neutral_pion;
Expand All @@ -33,42 +37,8 @@ namespace ticl {
}
}

static void addTrackster(
const int& index,
const std::vector<std::pair<edm::Ref<reco::CaloClusterCollection>, std::pair<float, float>>>& lcVec,
const std::vector<float>& inputClusterMask,
const float& fractionCut_,
const float& energy,
const int& pdgId,
const int& charge,
const edm::ProductID& seed,
const Trackster::IterationIndex iter,
std::vector<float>& output_mask,
std::vector<Trackster>& result) {
if (lcVec.empty())
return;

Trackster tmpTrackster;
tmpTrackster.zeroProbabilities();
tmpTrackster.vertices().reserve(lcVec.size());
tmpTrackster.vertex_multiplicity().reserve(lcVec.size());
for (auto const& [lc, energyScorePair] : lcVec) {
if (inputClusterMask[lc.index()] > 0) {
double fraction = energyScorePair.first / lc->energy();
if (fraction < fractionCut_)
continue;
tmpTrackster.vertices().push_back(lc.index());
output_mask[lc.index()] -= fraction;
tmpTrackster.vertex_multiplicity().push_back(1. / fraction);
}
}

tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(pdgId, charge), 1.f);
tmpTrackster.setRegressedEnergy(energy);
tmpTrackster.setIteration(iter);
tmpTrackster.setSeed(seed, index);
result.emplace_back(tmpTrackster);
}
// verbosity levels for ticl algorithms
enum VerbosityLevel { None = 0, Basic, Advanced, Expert, Guru };

} // namespace ticl

Expand Down
35 changes: 18 additions & 17 deletions RecoHGCal/TICL/plugins/HGCGraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
endEtaBin = std::min(entryEtaBin + etaWindow + 1, nEtaBins);
startPhiBin = entryPhiBin - phiWindow;
endPhiBin = entryPhiBin + phiWindow + 1;
if (verbosity_ > Guru) {
if (verbosity_ > ticl::VerbosityLevel::Guru) {
LogDebug("HGCGraph") << " Entrance eta, phi: " << origin_eta << ", " << origin_phi
<< " entryEtaBin: " << entryEtaBin << " entryPhiBin: " << entryPhiBin
<< " globalBin: " << firstLayerHisto.globalBin(origin_eta, origin_phi)
Expand All @@ -96,7 +96,7 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
: (il <= lastLayerFH) ? siblings_maxRSquared[1]
: siblings_maxRSquared[2];
const int etaLimitIncreaseWindowBin = innerLayerHisto.etaBin(etaLimitIncreaseWindow);
if (verbosity_ > Advanced) {
if (verbosity_ > ticl::VerbosityLevel::Advanced) {
LogDebug("HGCGraph") << "Limit of Eta for increase: " << etaLimitIncreaseWindow
<< " at etaBin: " << etaLimitIncreaseWindowBin << std::endl;
}
Expand All @@ -105,15 +105,15 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
auto offset = ieta * nPhiBins;
for (int iphi_it = startPhiBin; iphi_it < endPhiBin; ++iphi_it) {
int iphi = ((iphi_it % nPhiBins + nPhiBins) % nPhiBins);
if (verbosity_ > Guru) {
if (verbosity_ > ticl::VerbosityLevel::Advanced) {
LogDebug("HGCGraph") << "Inner Global Bin: " << (offset + iphi)
<< " on layers I/O: " << currentInnerLayerId << "/" << currentOuterLayerId
<< " with clusters: " << innerLayerHisto[offset + iphi].size() << std::endl;
}
for (auto innerClusterId : innerLayerHisto[offset + iphi]) {
// Skip masked clusters
if (mask[innerClusterId] == 0.) {
if (verbosity_ > Advanced)
if (verbosity_ > ticl::VerbosityLevel::Advanced)
LogDebug("HGCGraph") << "Skipping inner masked cluster " << innerClusterId << std::endl;
continue;
}
Expand All @@ -128,7 +128,7 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
if (isGlobal && ieta > etaLimitIncreaseWindowBin) {
etaWindow++;
phiWindow++;
if (verbosity_ > Advanced) {
if (verbosity_ > ticl::VerbosityLevel::Advanced) {
LogDebug("HGCGraph") << "Eta and Phi window increased by one" << std::endl;
}
}
Expand All @@ -144,7 +144,7 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
// account for all other cases, since we add in
// between a full nPhiBins slot.
auto ophi = ((iphi + phiRange - phiWindow) % nPhiBins + nPhiBins) % nPhiBins;
if (verbosity_ > Guru) {
if (verbosity_ > ticl::VerbosityLevel::Guru) {
LogDebug("HGCGraph") << "Outer Global Bin: " << (oeta * nPhiBins + ophi)
<< " on layers I/O: " << currentInnerLayerId << "/" << currentOuterLayerId
<< " with clusters: " << innerLayerHisto[oeta * nPhiBins + ophi].size()
Expand All @@ -153,14 +153,14 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
for (auto outerClusterId : outerLayerHisto[oeta * nPhiBins + ophi]) {
// Skip masked clusters
if (mask[outerClusterId] == 0.) {
if (verbosity_ > Advanced)
if (verbosity_ > ticl::VerbosityLevel::Advanced)
LogDebug("HGCGraph") << "Skipping outer masked cluster " << outerClusterId << std::endl;
continue;
}
auto doubletId = allDoublets_.size();
if (maxDeltaTime != -1 &&
!areTimeCompatible(innerClusterId, outerClusterId, layerClustersTime, maxDeltaTime)) {
if (verbosity_ > Advanced)
if (verbosity_ > ticl::VerbosityLevel::Advanced)
LogDebug("HGCGraph") << "Rejecting doublets due to timing!" << std::endl;
continue;
}
Expand All @@ -175,7 +175,7 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
allDoublets_.emplace_back(
innerClusterId, outerClusterId, doubletId, &layerClusters, r.index, false);
}
if (verbosity_ > Advanced) {
if (verbosity_ > ticl::VerbosityLevel::Advanced) {
LogDebug("HGCGraph")
<< "Creating doubletsId: " << doubletId << " layerLink in-out: [" << currentInnerLayerId
<< ", " << currentOuterLayerId << "] clusterLink in-out: [" << innerClusterId << ", "
Expand All @@ -184,18 +184,19 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
isOuterClusterOfDoublets_[outerClusterId].push_back(doubletId);
auto &neigDoublets = isOuterClusterOfDoublets_[innerClusterId];
auto &thisDoublet = allDoublets_[doubletId];
if (verbosity_ > Expert) {
if (verbosity_ > ticl::VerbosityLevel::Expert) {
LogDebug("HGCGraph")
<< "Checking compatibility of doubletId: " << doubletId
<< " with all possible inners doublets link by the innerClusterId: " << innerClusterId
<< std::endl;
}
bool isRootDoublet = thisDoublet.checkCompatibilityAndTag(allDoublets_,
neigDoublets,
r.directionAtOrigin,
minCosTheta,
minCosPointing,
verbosity_ > Advanced);
bool isRootDoublet =
thisDoublet.checkCompatibilityAndTag(allDoublets_,
neigDoublets,
r.directionAtOrigin,
minCosTheta,
minCosPointing,
verbosity_ > ticl::VerbosityLevel::Advanced);
if (isRootDoublet and checkDistanceRootDoubletVsSeed) {
if (reco::deltaR2(layerClusters[innerClusterId].eta(),
layerClusters[innerClusterId].phi(),
Expand All @@ -217,7 +218,7 @@ void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
}
}
// #ifdef FP_DEBUG
if (verbosity_ > None) {
if (verbosity_ > ticl::VerbosityLevel::None) {
LogDebug("HGCGraph") << "number of Root doublets " << theRootDoublets_.size() << " over a total number of doublets "
<< allDoublets_.size() << std::endl;
}
Expand Down
1 change: 0 additions & 1 deletion RecoHGCal/TICL/plugins/HGCGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class HGCGraphT {
isOuterClusterOfDoublets_.shrink_to_fit();
}
void setVerbosity(int level) { verbosity_ = level; }
enum VerbosityLevel { None = 0, Basic, Advanced, Expert, Guru };

private:
std::vector<HGCDoublet> allDoublets_;
Expand Down
50 changes: 50 additions & 0 deletions RecoHGCal/TICL/plugins/LinkingAlgoBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef RecoHGCal_TICL_LinkingAlgoBase_H__
#define RecoHGCal_TICL_LinkingAlgoBase_H__

#include <vector>
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "DataFormats/HGCalReco/interface/Trackster.h"
#include "DataFormats/HGCalReco/interface/TICLCandidate.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/MuonReco/interface/Muon.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "TrackingTools/GeomPropagators/interface/Propagator.h"
#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"

namespace edm {
class Event;
class EventSetup;
} // namespace edm

namespace ticl {
class LinkingAlgoBase {
public:
LinkingAlgoBase(const edm::ParameterSet& conf) : algo_verbosity_(conf.getParameter<int>("algo_verbosity")) {}

virtual ~LinkingAlgoBase(){};

virtual void initialize(const HGCalDDDConstants* hgcons,
const hgcal::RecHitTools rhtools,
const edm::ESHandle<MagneticField> bfieldH,
const edm::ESHandle<Propagator> propH) = 0;

virtual void linkTracksters(const edm::Handle<std::vector<reco::Track>> tkH,
const edm::ValueMap<float>& tkTime,
const edm::ValueMap<float>& tkTimeErr,
const edm::ValueMap<float>& tkTimeQual,
const std::vector<reco::Muon>& muons,
const edm::Handle<std::vector<Trackster>> tsH,
std::vector<TICLCandidate>& resultTracksters) = 0;

static void fillPSetDescription(edm::ParameterSetDescription& desc) { desc.add<int>("algo_verbosity", 0); };

protected:
int algo_verbosity_;
};
} // namespace ticl

#endif
Loading