CMS 3D CMS Logo

Classes | Typedefs | Enumerations | Functions | Variables
ticl Namespace Reference

Classes

class  CacheBase
 
class  ClusterFilterBase
 
class  ClusterFilterByAlgo
 
class  ClusterFilterByAlgoAndSize
 
class  ClusterFilterByAlgoAndSizeAndLayerRange
 
class  ClusterFilterBySize
 
class  LinkingAlgoBase
 
class  LinkingAlgoByDirectionGeometric
 
class  PatternRecognitionAlgoBaseT
 
class  PatternRecognitionbyCA
 
class  PatternRecognitionbyCLUE3D
 
class  PatternRecognitionbyFastJet
 
class  PatternRecognitionbyMultiClusters
 
class  SeedingRegionAlgoBase
 
class  SeedingRegionByHF
 
class  SeedingRegionByL1
 
class  SeedingRegionByTracks
 
class  SeedingRegionGlobal
 
struct  TileConstants
 
struct  TileConstantsHFNose
 
class  Trackster
 
class  TracksterMomentumPluginBase
 
class  TracksterP4FromEnergySum
 
class  TracksterP4FromTrackAndPCA
 
class  TracksterRecoTrackPlugin
 
class  TrackstersCache
 
class  TracksterTrackPluginBase
 

Typedefs

typedef std::vector< std::pair< unsigned int, float > > TICLClusterFilterMask
 
using TICLLayerTile = TICLLayerTileT< TileConstants >
 
using TICLLayerTileHFNose = TICLLayerTileT< TileConstantsHFNose >
 
using Tiles = std::array< TICLLayerTile, TileConstants::nLayers >
 
using TilesHFNose = std::array< TICLLayerTileHFNose, TileConstantsHFNose::nLayers >
 
typedef std::vector< TracksterTracksterCollection
 
using TracksterTiles = std::array< TICLLayerTile, TileConstants::iterations >
 
using TracksterTilesHFNose = std::array< TICLLayerTileHFNose, TileConstantsHFNose::iterations >
 
typedef math::XYZVectorF Vector
 

Enumerations

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

Functions

void assignPCAtoTracksters (std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool energyWeight=true)
 
Trackster::ParticleType tracksterParticleTypeFromPdgId (int pdgId, int charge)
 

Variables

constexpr double mpion = 0.13957
 
constexpr float mpion2 = mpion * mpion
 

Typedef Documentation

◆ TICLClusterFilterMask

typedef std::vector<std::pair<unsigned int, float> > ticl::TICLClusterFilterMask

Definition at line 32 of file Common.h.

◆ TICLLayerTile

Definition at line 80 of file TICLLayerTile.h.

◆ TICLLayerTileHFNose

Definition at line 84 of file TICLLayerTile.h.

◆ Tiles

using ticl::Tiles = typedef std::array<TICLLayerTile, TileConstants::nLayers>

Definition at line 81 of file TICLLayerTile.h.

◆ TilesHFNose

Definition at line 85 of file TICLLayerTile.h.

◆ TracksterCollection

typedef std::vector<Trackster> ticl::TracksterCollection

Definition at line 199 of file Trackster.h.

◆ TracksterTiles

Definition at line 82 of file TICLLayerTile.h.

◆ TracksterTilesHFNose

Definition at line 86 of file TICLLayerTile.h.

◆ Vector

Definition at line 14 of file commons.h.

Enumeration Type Documentation

◆ VerbosityLevel

Enumerator
None 
Basic 
Advanced 
Expert 
Guru 

Definition at line 43 of file commons.h.

Function Documentation

◆ assignPCAtoTracksters()

void ticl::assignPCAtoTracksters ( std::vector< Trackster > &  tracksters,
const std::vector< reco::CaloCluster > &  layerClusters,
const edm::ValueMap< std::pair< float, float >> &  layerClustersTime,
double  z_limit_em,
bool  energyWeight = true 
)

Definition at line 12 of file TrackstersPCA.cc.

References funct::abs(), ticl::Trackster::ascending, HltBtagPostValidation_cff::c, f, dqmdumpme::first, hgcalsimclustertime::ComputeClusterTime::fixSizeHighestDensity(), HLT_2024v13_cff::fraction, mps_fire::i, dqmiolumiharvest::j, hltEgammaHGCALIDVarsL1Seeded_cfi::layerClusters, LogDebug, N, point, funct::pow(), edm::second(), Success, mps_merge::weight, x, and detailsBasic3DVector::y.

Referenced by ticl::PatternRecognitionbyCLUE3D< TILES >::makeTracksters(), ticl::PatternRecognitionbyCA< TILES >::makeTracksters(), ticl::PatternRecognitionbyFastJet< TILES >::makeTracksters(), TrackstersMergeProducerV3::produce(), SimTrackstersProducer::produce(), and TrackstersMergeProducer::produce().

16  {
17  LogDebug("TrackstersPCA_Eigen") << "------- Eigen -------" << std::endl;
18 
19  for (auto &trackster : tracksters) {
21  point << 0., 0., 0.;
22  Eigen::Vector3d barycenter;
23  barycenter << 0., 0., 0.;
24 
25  auto fillPoint = [&](const reco::CaloCluster &c, const float weight = 1.f) {
26  point[0] = weight * c.x();
27  point[1] = weight * c.y();
28  point[2] = weight * c.z();
29  };
30 
31  // Initialize this trackster with default, dummy values
32  trackster.setRawEnergy(0.f);
33  trackster.setRawEmEnergy(0.f);
34  trackster.setRawPt(0.f);
35  trackster.setRawEmPt(0.f);
36 
37  size_t N = trackster.vertices().size();
38  float weight = 1.f / N;
39  float weights2_sum = 0.f;
40  Eigen::Vector3d sigmas;
41  sigmas << 0., 0., 0.;
42  Eigen::Vector3d sigmasEigen;
43  sigmasEigen << 0., 0., 0.;
44  Eigen::Matrix3d covM = Eigen::Matrix3d::Zero();
45 
46  std::vector<float> times;
47  std::vector<float> timeErrors;
48  std::set<uint32_t> usedLC;
49 
50  for (size_t i = 0; i < N; ++i) {
51  auto fraction = 1.f / trackster.vertex_multiplicity(i);
52  trackster.addToRawEnergy(layerClusters[trackster.vertices(i)].energy() * fraction);
53  if (std::abs(layerClusters[trackster.vertices(i)].z()) <= z_limit_em)
54  trackster.addToRawEmEnergy(layerClusters[trackster.vertices(i)].energy() * fraction);
55 
56  // Compute the weighted barycenter.
57  if (energyWeight)
58  weight = layerClusters[trackster.vertices(i)].energy() * fraction;
59  fillPoint(layerClusters[trackster.vertices(i)], weight);
60  for (size_t j = 0; j < 3; ++j)
61  barycenter[j] += point[j];
62 
63  // Add timing from layerClusters not already used
64  if ((usedLC.insert(trackster.vertices(i))).second) {
65  float timeE = layerClustersTime.get(trackster.vertices(i)).second;
66  if (timeE > 0.f) {
67  times.push_back(layerClustersTime.get(trackster.vertices(i)).first);
68  timeErrors.push_back(1. / pow(timeE, 2));
69  }
70  }
71  }
72  if (energyWeight && trackster.raw_energy())
73  barycenter /= trackster.raw_energy();
74 
76  std::pair<float, float> timeTrackster = timeEstimator.fixSizeHighestDensity(times, timeErrors);
77 
78  // Compute the Covariance Matrix and the sum of the squared weights, used
79  // to compute the correct normalization.
80  // The barycenter has to be known.
81  for (size_t i = 0; i < N; ++i) {
82  fillPoint(layerClusters[trackster.vertices(i)]);
83  if (energyWeight && trackster.raw_energy())
84  weight =
85  (layerClusters[trackster.vertices(i)].energy() / trackster.vertex_multiplicity(i)) / trackster.raw_energy();
86  weights2_sum += weight * weight;
87  for (size_t x = 0; x < 3; ++x)
88  for (size_t y = 0; y <= x; ++y) {
89  covM(x, y) += weight * (point[x] - barycenter[x]) * (point[y] - barycenter[y]);
90  covM(y, x) = covM(x, y);
91  }
92  }
93  covM *= 1. / (1. - weights2_sum);
94 
95  // Perform the actual decomposition
96  Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d>::RealVectorType eigenvalues_fromEigen;
97  Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d>::EigenvectorsType eigenvectors_fromEigen;
98  Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d> eigensolver(covM);
99  if (eigensolver.info() != Eigen::Success) {
100  eigenvalues_fromEigen = eigenvalues_fromEigen.Zero();
101  eigenvectors_fromEigen = eigenvectors_fromEigen.Zero();
102  } else {
103  eigenvalues_fromEigen = eigensolver.eigenvalues();
104  eigenvectors_fromEigen = eigensolver.eigenvectors();
105  }
106 
107  // Compute the spread in the both spaces.
108  for (size_t i = 0; i < N; ++i) {
109  fillPoint(layerClusters[trackster.vertices(i)]);
110  sigmas += weight * (point - barycenter).cwiseAbs2();
111  Eigen::Vector3d point_transformed = eigenvectors_fromEigen * (point - barycenter);
112  if (energyWeight && trackster.raw_energy())
113  weight =
114  (layerClusters[trackster.vertices(i)].energy() / trackster.vertex_multiplicity(i)) / trackster.raw_energy();
115  sigmasEigen += weight * (point_transformed.cwiseAbs2());
116  }
117  sigmas /= (1. - weights2_sum);
118  sigmasEigen /= (1. - weights2_sum);
119 
120  // Add trackster attributes
121  trackster.setBarycenter(ticl::Trackster::Vector(barycenter));
122  trackster.setTimeAndError(timeTrackster.first, timeTrackster.second);
123  trackster.fillPCAVariables(
124  eigenvalues_fromEigen, eigenvectors_fromEigen, sigmas, sigmasEigen, 3, ticl::Trackster::PCAOrdering::ascending);
125 
126  LogDebug("TrackstersPCA") << "Use energy weighting: " << energyWeight << std::endl;
127  LogDebug("TrackstersPCA") << "\nTrackster characteristics: " << std::endl;
128  LogDebug("TrackstersPCA") << "Size: " << N << std::endl;
129  LogDebug("TrackstersPCA") << "Energy: " << trackster.raw_energy() << std::endl;
130  LogDebug("TrackstersPCA") << "raw_pt: " << trackster.raw_pt() << std::endl;
131  LogDebug("TrackstersPCA") << "Means: " << barycenter[0] << ", " << barycenter[1] << ", " << barycenter[2]
132  << std::endl;
133  LogDebug("TrackstersPCA") << "Time: " << trackster.time() << " +/- " << trackster.timeError() << std::endl;
134  LogDebug("TrackstersPCA") << "EigenValues from Eigen/Tr(cov): " << eigenvalues_fromEigen[2] / covM.trace() << ", "
135  << eigenvalues_fromEigen[1] / covM.trace() << ", "
136  << eigenvalues_fromEigen[0] / covM.trace() << std::endl;
137  LogDebug("TrackstersPCA") << "EigenValues from Eigen: " << eigenvalues_fromEigen[2] << ", "
138  << eigenvalues_fromEigen[1] << ", " << eigenvalues_fromEigen[0] << std::endl;
139  LogDebug("TrackstersPCA") << "EigenVector 3 from Eigen: " << eigenvectors_fromEigen(0, 2) << ", "
140  << eigenvectors_fromEigen(1, 2) << ", " << eigenvectors_fromEigen(2, 2) << std::endl;
141  LogDebug("TrackstersPCA") << "EigenVector 2 from Eigen: " << eigenvectors_fromEigen(0, 1) << ", "
142  << eigenvectors_fromEigen(1, 1) << ", " << eigenvectors_fromEigen(2, 1) << std::endl;
143  LogDebug("TrackstersPCA") << "EigenVector 1 from Eigen: " << eigenvectors_fromEigen(0, 0) << ", "
144  << eigenvectors_fromEigen(1, 0) << ", " << eigenvectors_fromEigen(2, 0) << std::endl;
145  LogDebug("TrackstersPCA") << "Original sigmas: " << sigmas[0] << ", " << sigmas[1] << ", " << sigmas[2]
146  << std::endl;
147  LogDebug("TrackstersPCA") << "SigmasEigen in PCA space: " << sigmasEigen[2] << ", " << sigmasEigen[1] << ", "
148  << sigmasEigen[0] << std::endl;
149  LogDebug("TrackstersPCA") << "covM: \n" << covM << std::endl;
150  }
151 }
Eigen::Vector3d Vector3d
Definition: FitResult.h:11
Eigen::Matrix3d Matrix3d
Definition: FitResult.h:15
math::XYZVectorF Vector
Definition: Trackster.h:21
const_reference_type get(ProductID id, size_t idx) const
Definition: ValueMap.h:138
Definition: weight.py:1
U second(std::pair< T, U > const &p)
std::pair< float, float > fixSizeHighestDensity(std::vector< float > &time, std::vector< float > weight=std::vector< float >(), unsigned int minNhits=3, float deltaT=0.210, float timeWidthBy=0.5)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
#define N
Definition: blowfish.cc:9
float x
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
#define LogDebug(id)

◆ tracksterParticleTypeFromPdgId()

Trackster::ParticleType ticl::tracksterParticleTypeFromPdgId ( int  pdgId,
int  charge 
)
inline

Definition at line 16 of file commons.h.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, ticl::Trackster::charged_hadron, ticl::Trackster::electron, ticl::Trackster::muon, ticl::Trackster::neutral_hadron, ticl::Trackster::neutral_pion, EgammaValidation_cff::pdgId, ticl::Trackster::photon, and ticl::Trackster::unknown.

Referenced by SimTrackstersProducer::addTrackster(), and SimTrackstersProducer::produce().

16  {
17  if (pdgId == 111) {
18  return Trackster::ParticleType::neutral_pion;
19  } else {
20  pdgId = std::abs(pdgId);
21  if (pdgId == 22) {
23  } else if (pdgId == 11) {
25  } else if (pdgId == 13) {
27  } else {
28  bool isHadron = (pdgId > 100 and pdgId < 900) or (pdgId > 1000 and pdgId < 9000);
29  if (isHadron) {
30  if (charge != 0) {
31  return Trackster::ParticleType::charged_hadron;
32  } else {
33  return Trackster::ParticleType::neutral_hadron;
34  }
35  } else {
37  }
38  }
39  }
40  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Variable Documentation

◆ mpion

constexpr double ticl::mpion = 0.13957

◆ mpion2

constexpr float ticl::mpion2 = mpion * mpion