CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  std::vector<float>& output_mask,
46  std::vector<Trackster>& result) {
47  if (lcVec.empty())
48  return;
49 
50  Trackster tmpTrackster;
51  tmpTrackster.zeroProbabilities();
52  tmpTrackster.vertices().reserve(lcVec.size());
53  tmpTrackster.vertex_multiplicity().reserve(lcVec.size());
54  for (auto const& [lc, energyScorePair] : lcVec) {
55  if (inputClusterMask[lc.index()] > 0) {
56  double fraction = energyScorePair.first / lc->energy();
57  if (fraction < fractionCut_)
58  continue;
59  tmpTrackster.vertices().push_back(lc.index());
60  output_mask[lc.index()] -= fraction;
61  tmpTrackster.vertex_multiplicity().push_back(1. / fraction);
62  }
63  }
64 
65  tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(pdgId, charge), 1.f);
66  tmpTrackster.setRegressedEnergy(energy);
67  tmpTrackster.setSeed(seed, index);
68  result.emplace_back(tmpTrackster);
69  }
70 
71 } // namespace ticl
72 
73 #endif
tuple result
Definition: mps_fire.py:311
Trackster::ParticleType tracksterParticleTypeFromPdgId(int pdgId, int charge)
Definition: commons.h:10
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, std::vector< float > &output_mask, std::vector< Trackster > &result)
Definition: commons.h:36
Abs< T >::type abs(const T &t)
Definition: Abs.h:22