CMS 3D CMS Logo

commons.h
Go to the documentation of this file.
1 #ifndef RecoHGCal_TICL_interface_commons_h
2 #define RecoHGCal_TICL_interface_commons_h
3 #include <vector>
7 
8 namespace ticl {
9 
11  if (pdgId == 111) {
13  } else {
14  pdgId = std::abs(pdgId);
15  if (pdgId == 22) {
17  } else if (pdgId == 11) {
19  } else if (pdgId == 13) {
21  } else {
22  bool isHadron = (pdgId > 100 and pdgId < 900) or (pdgId > 1000 and pdgId < 9000);
23  if (isHadron) {
24  if (charge != 0) {
26  } else {
28  }
29  } else {
31  }
32  }
33  }
34  }
35 
36  static void addTrackster(
37  const int& index,
38  const std::vector<std::pair<edm::Ref<reco::CaloClusterCollection>, std::pair<float, float>>>& lcVec,
39  const std::vector<float>& inputClusterMask,
40  const float& fractionCut_,
41  const float& energy,
42  const int& pdgId,
43  const int& charge,
44  const edm::ProductID& seed,
45  const Trackster::IterationIndex iter,
46  std::vector<float>& output_mask,
47  std::vector<Trackster>& result) {
48  if (lcVec.empty())
49  return;
50 
51  Trackster tmpTrackster;
52  tmpTrackster.zeroProbabilities();
53  tmpTrackster.vertices().reserve(lcVec.size());
54  tmpTrackster.vertex_multiplicity().reserve(lcVec.size());
55  for (auto const& [lc, energyScorePair] : lcVec) {
56  if (inputClusterMask[lc.index()] > 0) {
57  double fraction = energyScorePair.first / lc->energy();
58  if (fraction < fractionCut_)
59  continue;
60  tmpTrackster.vertices().push_back(lc.index());
61  output_mask[lc.index()] -= fraction;
62  tmpTrackster.vertex_multiplicity().push_back(1. / fraction);
63  }
64  }
65 
67  tmpTrackster.setRegressedEnergy(energy);
68  tmpTrackster.setIteration(iter);
69  tmpTrackster.setSeed(seed, index);
70  result.emplace_back(tmpTrackster);
71  }
72 
73 } // namespace ticl
74 
75 #endif
void setSeed(edm::ProductID pid, int index)
Definition: Trackster.h:60
void setRegressedEnergy(float value)
Definition: Trackster.h:68
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)
Definition: commons.h:36
Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge)
Definition: commons.h:10
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
void zeroProbabilities()
Definition: Trackster.h:107
std::vector< unsigned int > & vertices()
Definition: Trackster.h:57
std::vector< float > & vertex_multiplicity()
Definition: Trackster.h:58
Definition: Common.h:8
void setIteration(const Trackster::IterationIndex i)
Definition: Trackster.h:56
void setIdProbability(ParticleType type, float value)
Definition: Trackster.h:117