CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ticl::PatternRecognitionbyFastJet< TILES > Class Template Referencefinal

#include <PatternRecognitionbyFastJet.h>

Inheritance diagram for ticl::PatternRecognitionbyFastJet< TILES >:
ticl::PatternRecognitionAlgoBaseT< TILES >

Public Member Functions

void energyRegressionAndID (const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result)
 
void filter (std::vector< Trackster > &output, const std::vector< Trackster > &inTracksters, const typename PatternRecognitionAlgoBaseT< TILES >::Inputs &input, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) override
 
void makeTracksters (const typename PatternRecognitionAlgoBaseT< TILES >::Inputs &input, std::vector< Trackster > &result, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) override
 
 PatternRecognitionbyFastJet (const edm::ParameterSet &conf, edm::ConsumesCollector)
 
 ~PatternRecognitionbyFastJet () override=default
 
- Public Member Functions inherited from ticl::PatternRecognitionAlgoBaseT< TILES >
virtual void filter (std::vector< Trackster > &output, const std::vector< Trackster > &inTracksters, const Inputs &input, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation)=0
 
virtual void makeTracksters (const Inputs &input, std::vector< Trackster > &result, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation)=0
 
 PatternRecognitionAlgoBaseT (const edm::ParameterSet &conf, edm::ConsumesCollector)
 
virtual ~PatternRecognitionAlgoBaseT ()
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &iDesc)
 

Private Member Functions

void buildJetAndTracksters (std::vector< fastjet::PseudoJet > &, std::vector< ticl::Trackster > &)
 

Private Attributes

const double antikt_radius_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeomToken_
 
const bool computeLocalTime_
 
const int minNumLayerCluster_
 
hgcal::RecHitTools rhtools_
 

Additional Inherited Members

- Protected Attributes inherited from ticl::PatternRecognitionAlgoBaseT< TILES >
int algo_verbosity_
 

Detailed Description

template<typename TILES>
class ticl::PatternRecognitionbyFastJet< TILES >

Definition at line 18 of file PatternRecognitionbyFastJet.h.

Constructor & Destructor Documentation

◆ PatternRecognitionbyFastJet()

template<typename TILES >
PatternRecognitionbyFastJet::PatternRecognitionbyFastJet ( const edm::ParameterSet conf,
edm::ConsumesCollector  iC 
)

Definition at line 29 of file PatternRecognitionbyFastJet.cc.

33  antikt_radius_(conf.getParameter<double>("antikt_radius")),
34  minNumLayerCluster_(conf.getParameter<int>("minNumLayerCluster")),
35  computeLocalTime_(conf.getParameter<bool>("computeLocalTime")){};
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_

◆ ~PatternRecognitionbyFastJet()

template<typename TILES >
ticl::PatternRecognitionbyFastJet< TILES >::~PatternRecognitionbyFastJet ( )
overridedefault

Member Function Documentation

◆ buildJetAndTracksters()

template<typename TILES >
void PatternRecognitionbyFastJet::buildJetAndTracksters ( std::vector< fastjet::PseudoJet > &  ,
std::vector< ticl::Trackster > &   
)
private

Definition at line 38 of file PatternRecognitionbyFastJet.cc.

References ticl::Advanced, ticl::Basic, metsig::jet, PDWG_EXODelayedJetMET_cff::jets, and mps_fire::result.

39  {
41  edm::LogVerbatim("PatternRecogntionbyFastJet")
42  << "Creating FastJet with " << fjInputs.size() << " LayerClusters in input";
43  }
44  fastjet::ClusterSequence sequence(fjInputs, JetDefinition(antikt_algorithm, antikt_radius_));
45  auto jets = fastjet::sorted_by_pt(sequence.inclusive_jets(0));
47  edm::LogVerbatim("PatternRecogntionbyFastJet") << "FastJet produced " << jets.size() << " jets/trackster";
48  }
49 
50  auto trackster_idx = result.size();
51  auto jetsSize = std::count_if(jets.begin(), jets.end(), [this](fastjet::PseudoJet jet) {
52  return jet.constituents().size() > static_cast<unsigned int>(minNumLayerCluster_);
53  });
54  result.resize(trackster_idx + jetsSize);
55 
56  for (const auto &pj : jets) {
57  if (pj.constituents().size() > static_cast<unsigned int>(minNumLayerCluster_)) {
58  for (const auto &component : pj.constituents()) {
59  result[trackster_idx].vertices().push_back(component.user_index());
60  result[trackster_idx].vertex_multiplicity().push_back(1);
62  edm::LogVerbatim("PatternRecogntionbyFastJet")
63  << "Jet has " << pj.constituents().size() << " components that are stored in trackster " << trackster_idx;
64  }
65  }
66  trackster_idx++;
67  } else {
69  edm::LogVerbatim("PatternRecogntionbyFastJet")
70  << "Jet with " << pj.constituents().size() << " constituents discarded since too small wrt "
72  }
73  }
74  }
75  fjInputs.clear();
76 }
Log< level::Info, true > LogVerbatim

◆ energyRegressionAndID()

template<typename TILES >
void ticl::PatternRecognitionbyFastJet< TILES >::energyRegressionAndID ( const std::vector< reco::CaloCluster > &  layerClusters,
const tensorflow::Session *  ,
std::vector< Trackster > &  result 
)

◆ fillPSetDescription()

template<typename TILES >
void PatternRecognitionbyFastJet::fillPSetDescription ( edm::ParameterSetDescription iDesc)
static

Definition at line 166 of file PatternRecognitionbyFastJet.cc.

References edm::ParameterSetDescription::add(), and edm::ParameterDescriptionNode::setComment().

166  {
167  iDesc.add<int>("algo_verbosity", 0);
168  iDesc.add<double>("antikt_radius", 0.09)->setComment("Radius to be used while running the Anti-kt clustering");
169  iDesc.add<int>("minNumLayerCluster", 5)->setComment("Not Inclusive");
170  iDesc.add<bool>("computeLocalTime", false);
171 }
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ filter()

template<typename TILES >
void PatternRecognitionbyFastJet::filter ( std::vector< Trackster > &  output,
const std::vector< Trackster > &  inTracksters,
const typename PatternRecognitionAlgoBaseT< TILES >::Inputs input,
std::unordered_map< int, std::vector< int >> &  seedToTracksterAssociation 
)
override

Definition at line 158 of file PatternRecognitionbyFastJet.cc.

161  {
162  output = inTracksters;
163 }
Definition: output.py:1

◆ makeTracksters()

template<typename TILES >
void PatternRecognitionbyFastJet::makeTracksters ( const typename PatternRecognitionAlgoBaseT< TILES >::Inputs input,
std::vector< Trackster > &  result,
std::unordered_map< int, std::vector< int >> &  seedToTracksterAssociation 
)
override

Definition at line 79 of file PatternRecognitionbyFastJet.cc.

References ticl::Advanced, ticl::assignPCAtoTracksters(), ticl::Basic, haddnano::cl, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), relativeConstraints::geom, edm::EventSetup::getData(), hcalRecHitTable_cff::ieta, input, hcalRecHitTable_cff::iphi, L1TMuonDQMOffline_cfi::nEtaBins, ecaldqm::binning::nPhiBins, HLT_IsoTrack_cff::offset, mps_fire::result, submitPVValidationJobs::t, and relativeConstraints::value.

82  {
83  // Protect from events with no seeding regions
84  if (input.regions.empty())
85  return;
86 
87  edm::EventSetup const &es = input.es;
90 
94 
95  // We need to partition the two sides of the HGCAL detector
96  auto lastLayerPerSide = static_cast<unsigned int>(rhtools_.lastLayer(isHFnose)) - 1;
97  unsigned int maxLayer = 2 * lastLayerPerSide - 1;
98  std::vector<fastjet::PseudoJet> fjInputs;
99  fjInputs.clear();
100  for (unsigned int currentLayer = 0; currentLayer <= maxLayer; ++currentLayer) {
101  if (currentLayer == lastLayerPerSide) {
102  buildJetAndTracksters(fjInputs, result);
103  }
104  const auto &tileOnLayer = input.tiles[currentLayer];
105  for (int ieta = 0; ieta <= nEtaBin; ++ieta) {
106  auto offset = ieta * nPhiBin;
108  edm::LogVerbatim("PatternRecogntionbyFastJet") << "offset: " << offset;
109  }
110  for (int iphi = 0; iphi <= nPhiBin; ++iphi) {
112  edm::LogVerbatim("PatternRecogntionbyFastJet") << "iphi: " << iphi;
113  edm::LogVerbatim("PatternRecogntionbyFastJet") << "Entries in tileBin: " << tileOnLayer[offset + iphi].size();
114  }
115  for (auto clusterIdx : tileOnLayer[offset + iphi]) {
116  // Skip masked layer clusters
117  if (input.mask[clusterIdx] == 0.) {
119  edm::LogVerbatim("PatternRecogntionbyFastJet") << "Skipping masked layerIdx " << clusterIdx;
120  }
121  continue;
122  }
123  // Should we correct for the position of the PV?
124  auto const &cl = input.layerClusters[clusterIdx];
125  math::XYZVector direction(cl.x(), cl.y(), cl.z());
126  direction = direction.Unit();
127  direction *= cl.energy();
128  auto fpj = fastjet::PseudoJet(direction.X(), direction.Y(), direction.Z(), cl.energy());
129  fpj.set_user_index(clusterIdx);
130  fjInputs.push_back(fpj);
131  } // End of loop on the clusters on currentLayer
132  } // End of loop over phi-bin region
133  } // End of loop over eta-bin region
134  } // End of loop over layers
135 
136  // Collect the jet from the other side wrt to the one taken care of inside the main loop above.
137  buildJetAndTracksters(fjInputs, result);
138 
140  input.layerClusters,
141  input.layerClustersTime,
142  rhtools_.getPositionLayer(rhtools_.lastLayerEE(isHFnose), isHFnose).z(),
143  rhtools_,
145 
146  // run energy regression and ID
148  for (auto const &t : result) {
149  edm::LogVerbatim("PatternRecogntionbyFastJet") << "Barycenter: " << t.barycenter();
150  edm::LogVerbatim("PatternRecogntionbyFastJet") << "LCs: " << t.vertices().size();
151  edm::LogVerbatim("PatternRecogntionbyFastJet") << "Energy: " << t.raw_energy();
152  edm::LogVerbatim("PatternRecogntionbyFastJet") << "Regressed: " << t.regressed_energy();
153  }
154  }
155 }
Log< level::Info, true > LogVerbatim
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void assignPCAtoTracksters(std::vector< Trackster > &tracksters, const std::vector< reco::CaloCluster > &layerClusters, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, double z_limit_em, hgcal::RecHitTools const &rhTools, bool computeLocalTime=false, bool energyWeight=true, bool clean=false, int minLayer=10, int maxLayer=10)
static std::string const input
Definition: EdmProvDump.cc:50
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
void buildJetAndTracksters(std::vector< fastjet::PseudoJet > &, std::vector< ticl::Trackster > &)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:152
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:79
static constexpr int nPhiBins
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:76
unsigned int lastLayer(bool nose=false) const
Definition: RecHitTools.h:80

Member Data Documentation

◆ antikt_radius_

template<typename TILES >
const double ticl::PatternRecognitionbyFastJet< TILES >::antikt_radius_
private

Definition at line 40 of file PatternRecognitionbyFastJet.h.

◆ caloGeomToken_

template<typename TILES >
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> ticl::PatternRecognitionbyFastJet< TILES >::caloGeomToken_
private

Definition at line 39 of file PatternRecognitionbyFastJet.h.

◆ computeLocalTime_

template<typename TILES >
const bool ticl::PatternRecognitionbyFastJet< TILES >::computeLocalTime_
private

Definition at line 42 of file PatternRecognitionbyFastJet.h.

◆ minNumLayerCluster_

template<typename TILES >
const int ticl::PatternRecognitionbyFastJet< TILES >::minNumLayerCluster_
private

Definition at line 41 of file PatternRecognitionbyFastJet.h.

◆ rhtools_

template<typename TILES >
hgcal::RecHitTools ticl::PatternRecognitionbyFastJet< TILES >::rhtools_
private

Definition at line 44 of file PatternRecognitionbyFastJet.h.