Skip to content

Commit

Permalink
Merge pull request #29837 from mariadalfonso/ticlHFNosePR
Browse files Browse the repository at this point in the history
HFNose: add ticl iteration
  • Loading branch information
cmsbuild committed May 26, 2020
2 parents c1dda75 + e84a6a3 commit fa34d6f
Show file tree
Hide file tree
Showing 21 changed files with 270 additions and 94 deletions.
5 changes: 5 additions & 0 deletions Configuration/StandardSequences/python/Reconstruction_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
_phase2HGALRecoTask.add(iterTICLTask)
phase2_hgcal.toReplaceWith(globalrecoTask, _phase2HGALRecoTask)

from Configuration.Eras.Modifier_phase2_hfnose_cff import phase2_hfnose
_phase2HFNoseRecoTask = globalrecoTask.copy()
_phase2HFNoseRecoTask.add(iterHFNoseTICLTask)
phase2_hfnose.toReplaceWith(globalrecoTask, _phase2HFNoseRecoTask)


globalreco_plusPLTask= cms.Task(globalrecoTask,ctfTracksPixelLessTask)
globalreco_plusPL= cms.Sequence(globalreco_plusPLTask)
Expand Down
13 changes: 13 additions & 0 deletions DataFormats/HGCalReco/interface/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ namespace ticl {
static constexpr int nLayers = 104;
static constexpr int iterations = 4;
static constexpr int nBins = nEtaBins * nPhiBins;
static constexpr int type = 0;
};

struct TileConstantsHFNose {
static constexpr float minEta = 3.0f;
static constexpr float maxEta = 4.2f;
static constexpr int nEtaBins = 24;
static constexpr int nPhiBins = 126;
static constexpr int nLayers = 16; // 8x2
static constexpr int iterations = 4;
static constexpr int nBins = nEtaBins * nPhiBins;
static constexpr int type = 1;
};

} // namespace ticl

namespace ticl {
Expand Down
9 changes: 9 additions & 0 deletions DataFormats/HGCalReco/interface/TICLLayerTile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class TICLLayerTileT {
tile_[globalBin(eta, phi)].push_back(layerClusterId);
}

int typeT() const { return T::type; }

int etaBin(float eta) const {
constexpr float etaRange = T::maxEta - T::minEta;
static_assert(etaRange >= 0.f);
Expand Down Expand Up @@ -51,6 +53,11 @@ namespace ticl {
using TICLLayerTile = TICLLayerTileT<TileConstants>;
using Tiles = std::array<TICLLayerTile, TileConstants::nLayers>;
using TracksterTiles = std::array<TICLLayerTile, TileConstants::iterations>;

using TICLLayerTileHFNose = TICLLayerTileT<TileConstantsHFNose>;
using TilesHFNose = std::array<TICLLayerTileHFNose, TileConstantsHFNose::nLayers>;
using TracksterTilesHFNose = std::array<TICLLayerTileHFNose, TileConstantsHFNose::iterations>;

} // namespace ticl

template <typename T>
Expand All @@ -68,5 +75,7 @@ class TICLGenericTile {

using TICLLayerTiles = TICLGenericTile<ticl::Tiles>;
using TICLTracksterTiles = TICLGenericTile<ticl::TracksterTiles>;
using TICLLayerTilesHFNose = TICLGenericTile<ticl::TilesHFNose>;
using TICLTracksterTilesHFNose = TICLGenericTile<ticl::TracksterTilesHFNose>;

#endif
14 changes: 14 additions & 0 deletions DataFormats/HGCalReco/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
</class>
<class name="edm::Wrapper<TICLGenericTile<ticl::TracksterTiles>>" persistent="false"/>

<class name="ticl::TICLLayerTileHFNose" persistent="false">
<field name="tile_" transient="true"/>
</class>

<class name="TICLGenericTile<ticl::TilesHFNose>" persistent="false">
<field name="tiles_" transient="true"/>
</class>
<class name="edm::Wrapper<TICLGenericTile<ticl::TilesHFNose>>" persistent="false"/>

<class name="TICLGenericTile<ticl::TracksterTilesHFNose>" persistent="false">
<field name="tiles_" transient="true"/>
</class>
<class name="edm::Wrapper<TICLGenericTile<ticl::TracksterTilesHFNose>>" persistent="false"/>

<class name="TICLSeedingRegion" ClassVersion="3">
<version ClassVersion="3" checksum="2409655320"/>
</class>
Expand Down
4 changes: 4 additions & 0 deletions RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
'keep *_ticlTrackstersMIP_*_*',
'keep *_ticlTrackstersMerge_*_*',
'keep *_ticlCandidateFromTracksters_*_*',
'keep *_ticlTrackstersHFNoseEM_*_*',
'keep *_ticlTrackstersHFNoseMIP_*_*',
'keep *_ticlTrackstersHFNoseMerge_*_*',
'keep *_ticlCandidateFromTrackstersHFNose_*_*',
'keep *_pfTICL_*_*'
)
)
Expand Down
4 changes: 2 additions & 2 deletions RecoHGCal/TICL/plugins/FilteredLayerClustersProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FilteredLayerClustersProducer : public edm::stream::EDProducer<> {
DEFINE_FWK_MODULE(FilteredLayerClustersProducer);

FilteredLayerClustersProducer::FilteredLayerClustersProducer(const edm::ParameterSet& ps) {
clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("HGCLayerClusters"));
clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("LayerClusters"));
clustersMask_token_ = consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("LayerClustersInputMask"));
clusterFilter_ = ps.getParameter<std::string>("clusterFilter");
theFilter_ = ClusterFilterFactory::get()->create(clusterFilter_, ps);
Expand All @@ -52,7 +52,7 @@ void FilteredLayerClustersProducer::beginRun(edm::Run const&, edm::EventSetup co
void FilteredLayerClustersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
// hgcalMultiClusters
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("HGCLayerClusters", edm::InputTag("hgcalLayerClusters"));
desc.add<edm::InputTag>("LayerClusters", edm::InputTag("hgcalLayerClusters"));
desc.add<edm::InputTag>("LayerClustersInputMask", edm::InputTag("hgcalLayerClusters", "InitialLayerClustersMask"));
desc.add<std::string>("iteration_label", "iterationLabelGoesHere");
desc.add<std::string>("clusterFilter", "ClusterFilterByAlgoAndSize");
Expand Down
51 changes: 27 additions & 24 deletions RecoHGCal/TICL/plugins/HGCGraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
#include "HGCGraph.h"
#include "DataFormats/Common/interface/ValueMap.h"

void HGCGraph::makeAndConnectDoublets(const TICLLayerTiles &histo,
const std::vector<TICLSeedingRegion> &regions,
int nEtaBins,
int nPhiBins,
const std::vector<reco::CaloCluster> &layerClusters,
const std::vector<float> &mask,
const edm::ValueMap<std::pair<float, float>> &layerClustersTime,
int deltaIEta,
int deltaIPhi,
float minCosTheta,
float minCosPointing,
float etaLimitIncreaseWindow,
int missing_layers,
int maxNumberOfLayers,
float maxDeltaTime) {
template <typename TILES>
void HGCGraphT<TILES>::makeAndConnectDoublets(const TILES &histo,
const std::vector<TICLSeedingRegion> &regions,
int nEtaBins,
int nPhiBins,
const std::vector<reco::CaloCluster> &layerClusters,
const std::vector<float> &mask,
const edm::ValueMap<std::pair<float, float>> &layerClustersTime,
int deltaIEta,
int deltaIPhi,
float minCosTheta,
float minCosPointing,
float etaLimitIncreaseWindow,
int missing_layers,
int maxNumberOfLayers,
float maxDeltaTime) {
isOuterClusterOfDoublets_.clear();
isOuterClusterOfDoublets_.resize(layerClusters.size());
allDoublets_.clear();
Expand Down Expand Up @@ -189,10 +190,11 @@ void HGCGraph::makeAndConnectDoublets(const TICLLayerTiles &histo,
// #endif
}

bool HGCGraph::areTimeCompatible(int innerIdx,
int outerIdx,
const edm::ValueMap<std::pair<float, float>> &layerClustersTime,
float maxDeltaTime) {
template <typename TILES>
bool HGCGraphT<TILES>::areTimeCompatible(int innerIdx,
int outerIdx,
const edm::ValueMap<std::pair<float, float>> &layerClustersTime,
float maxDeltaTime) {
float timeIn = layerClustersTime.get(innerIdx).first;
float timeInE = layerClustersTime.get(innerIdx).second;
float timeOut = layerClustersTime.get(outerIdx).first;
Expand All @@ -203,11 +205,12 @@ bool HGCGraph::areTimeCompatible(int innerIdx,
}

//also return a vector of seedIndex for the reconstructed tracksters
void HGCGraph::findNtuplets(std::vector<HGCDoublet::HGCntuplet> &foundNtuplets,
std::vector<int> &seedIndices,
const unsigned int minClustersPerNtuplet,
const bool outInDFS,
unsigned int maxOutInHops) {
template <typename TILES>
void HGCGraphT<TILES>::findNtuplets(std::vector<HGCDoublet::HGCntuplet> &foundNtuplets,
std::vector<int> &seedIndices,
const unsigned int minClustersPerNtuplet,
const bool outInDFS,
unsigned int maxOutInHops) {
HGCDoublet::HGCntuplet tmpNtuplet;
tmpNtuplet.reserve(minClustersPerNtuplet);
std::vector<std::pair<unsigned int, unsigned int>> outInToVisit;
Expand Down
8 changes: 6 additions & 2 deletions RecoHGCal/TICL/plugins/HGCGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
#include "DataFormats/HGCalReco/interface/TICLSeedingRegion.h"
#include "HGCDoublet.h"

class HGCGraph {
template <typename TILES>
class HGCGraphT {
public:
void makeAndConnectDoublets(const TICLLayerTiles &h,
void makeAndConnectDoublets(const TILES &h,
const std::vector<TICLSeedingRegion> &regions,
int nEtaBins,
int nPhiBins,
Expand Down Expand Up @@ -58,4 +59,7 @@ class HGCGraph {
int verbosity_;
};

template class HGCGraphT<TICLLayerTiles>;
template class HGCGraphT<TICLLayerTilesHFNose>;

#endif
12 changes: 6 additions & 6 deletions RecoHGCal/TICL/plugins/PatternRecognitionAlgoBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <memory>
#include <vector>
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "DataFormats/HGCalReco/interface/Common.h"
#include "DataFormats/HGCalReco/interface/Trackster.h"
#include "DataFormats/HGCalReco/interface/TICLLayerTile.h"
#include "DataFormats/HGCalReco/interface/TICLSeedingRegion.h"
Expand All @@ -21,27 +20,28 @@ namespace edm {
} // namespace edm

namespace ticl {
class PatternRecognitionAlgoBase {
template <typename TILES>
class PatternRecognitionAlgoBaseT {
public:
PatternRecognitionAlgoBase(const edm::ParameterSet& conf, const CacheBase* cache)
PatternRecognitionAlgoBaseT(const edm::ParameterSet& conf, const CacheBase* cache)
: algo_verbosity_(conf.getParameter<int>("algo_verbosity")) {}
virtual ~PatternRecognitionAlgoBase(){};
virtual ~PatternRecognitionAlgoBaseT(){};

struct Inputs {
const edm::Event& ev;
const edm::EventSetup& es;
const std::vector<reco::CaloCluster>& layerClusters;
const std::vector<float>& mask;
const edm::ValueMap<std::pair<float, float>>& layerClustersTime;
const TICLLayerTiles& tiles;
const TILES& tiles;
const std::vector<TICLSeedingRegion>& regions;

Inputs(const edm::Event& eV,
const edm::EventSetup& eS,
const std::vector<reco::CaloCluster>& lC,
const std::vector<float>& mS,
const edm::ValueMap<std::pair<float, float>>& lT,
const TICLLayerTiles& tL,
const TILES& tL,
const std::vector<TICLSeedingRegion>& rG)
: ev(eV), es(eS), layerClusters(lC), mask(mS), layerClustersTime(lT), tiles(tL), regions(rG) {}
};
Expand Down

0 comments on commit fa34d6f

Please sign in to comment.