Belle II Software  release-06-02-00
ECLShowerVariables.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 // analysis
10 #include <analysis/VariableManager/Manager.h>
11 
12 // framework
13 #include <framework/core/Module.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 #include <framework/datastore/StoreArray.h>
16 
17 // dataobjects
18 #include <mdst/dataobjects/ECLCluster.h>
19 
20 #include <analysis/dataobjects/Particle.h>
21 #include <ecl/dataobjects/ECLShower.h>
22 
23 using namespace std;
24 
25 namespace Belle2 {
31  namespace Variable {
32 
34  double getShowerNumberOfCrystalsForEnergy(const Particle* particle)
35  {
36  const ECLCluster* cluster = particle->getECLCluster();
37  if (cluster) {
38  double showerNumberOfCrystalsForEnergy = -1.0;
39 
40  auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
41  for (unsigned int ir = 0; ir < clusterShowerRelations.size(); ++ir) {
42  const auto shower = clusterShowerRelations.object(ir);
43 
44  showerNumberOfCrystalsForEnergy = shower->getNumberOfCrystalsForEnergy();
45  }
46 
47  return showerNumberOfCrystalsForEnergy;
48  }
49 
50  return std::numeric_limits<float>::quiet_NaN();
51  }
52 
54  double getShowerNominalNumberOfCrystalsForEnergy(const Particle* particle)
55  {
56  const ECLCluster* cluster = particle->getECLCluster();
57  if (cluster) {
58  double showerNominalNumberOfCrystalsForEnergy = -1.0;
59 
60  auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
61  for (unsigned int ir = 0; ir < clusterShowerRelations.size(); ++ir) {
62  const auto shower = clusterShowerRelations.object(ir);
63 
64  showerNominalNumberOfCrystalsForEnergy = shower->getNominalNumberOfCrystalsForEnergy();
65  }
66 
67  return showerNominalNumberOfCrystalsForEnergy;
68  }
69 
70  return std::numeric_limits<float>::quiet_NaN();
71  }
72 
73 
74  VARIABLE_GROUP("ECL Shower Debugging (cDST)");
75 
76  REGISTER_VARIABLE("eclShowerNumberOfCrystalsForEnergy", getShowerNumberOfCrystalsForEnergy,
77  "[debugging] Returns the number of crystals ued to calculate the shower energy (optimized to minimize the energy resolution). This should not be confused with the number of crystals contained in the cluster. ");
78  REGISTER_VARIABLE("eclShowerNominalNumberOfCrystalsForEnergy", getShowerNominalNumberOfCrystalsForEnergy,
79  "[debugging] Returns the nominal number of crystals ued to calculate the shower energy (optimized to minimize the energy resolution). This should not be confused with the number of crystals contained in the cluster. ");
80 
81  }
83 }
Abstract base class for different kinds of events.