Belle II Software  release-05-01-25
ECLShowerVariables.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Torben Ferber *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 // analysis
12 #include <analysis/VariableManager/Manager.h>
13 
14 // framework
15 #include <framework/core/Module.h>
16 #include <framework/datastore/StoreObjPtr.h>
17 #include <framework/datastore/StoreArray.h>
18 
19 // dataobjects
20 #include <mdst/dataobjects/ECLCluster.h>
21 
22 #include <analysis/dataobjects/Particle.h>
23 #include <ecl/dataobjects/ECLShower.h>
24 
25 using namespace std;
26 
27 namespace Belle2 {
33  namespace Variable {
34 
36  double getShowerNumberOfCrystalsForEnergy(const Particle* particle)
37  {
38  const ECLCluster* cluster = particle->getECLCluster();
39  if (cluster) {
40  double showerNumberOfCrystalsForEnergy = -1.0;
41 
42  auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
43  for (unsigned int ir = 0; ir < clusterShowerRelations.size(); ++ir) {
44  const auto shower = clusterShowerRelations.object(ir);
45 
46  showerNumberOfCrystalsForEnergy = shower->getNumberOfCrystalsForEnergy();
47  }
48 
49  return showerNumberOfCrystalsForEnergy;
50  }
51 
52  return std::numeric_limits<float>::quiet_NaN();
53  }
54 
56  double getShowerNominalNumberOfCrystalsForEnergy(const Particle* particle)
57  {
58  const ECLCluster* cluster = particle->getECLCluster();
59  if (cluster) {
60  double showerNominalNumberOfCrystalsForEnergy = -1.0;
61 
62  auto clusterShowerRelations = cluster->getRelationsWith<ECLShower>();
63  for (unsigned int ir = 0; ir < clusterShowerRelations.size(); ++ir) {
64  const auto shower = clusterShowerRelations.object(ir);
65 
66  showerNominalNumberOfCrystalsForEnergy = shower->getNominalNumberOfCrystalsForEnergy();
67  }
68 
69  return showerNominalNumberOfCrystalsForEnergy;
70  }
71 
72  return std::numeric_limits<float>::quiet_NaN();
73  }
74 
75 
76  VARIABLE_GROUP("ECL Shower Debugging (cDST)");
77 
78  REGISTER_VARIABLE("eclShowerNumberOfCrystalsForEnergy", getShowerNumberOfCrystalsForEnergy,
79  "[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. ");
80  REGISTER_VARIABLE("eclShowerNominalNumberOfCrystalsForEnergy", getShowerNominalNumberOfCrystalsForEnergy,
81  "[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. ");
82 
83  }
85 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19