PandaRoot
BSEmcEnergies_t.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef BSEMCENERGIES_T_HH
14 #define BSEMCENERGIES_T_HH
15 
16 #include "TClonesArray.h"
17 
18 #include "BSEmcDigi.h"
20 
22  Double_t CenterEnergy{0};
23  Double_t NeighbourEnergy{0};
24  Double_t MaxNeighbourEnergy{0};
25  Int_t NeighbourNumber{0};
26 
27  Double_t MaxRatio() { return MaxNeighbourEnergy / CenterEnergy; }
28  Double_t SumRatio() { return NeighbourEnergy / CenterEnergy; }
31 
32  static BSEmcEnergies_t GetEnergies(Int_t t_centralcrystal, const std::vector<const BSEmcDigi *> &t_digiArray, BSEmcGeoNeighbouringRelationPar *t_neighbouring)
33  {
34  BSEmcEnergies_t energies;
35  Double_t energy = 0.0;
36  Int_t detectorid = 0;
37  for (const BSEmcDigi *digi : t_digiArray) {
38  energy = digi->GetEnergy();
39  detectorid = digi->GetDetectorId();
40  if (detectorid == t_centralcrystal) {
41  energies.CenterEnergy += energy;
42  } else if (t_neighbouring->AreNeighbours(detectorid, t_centralcrystal)) {
43  energies.NeighbourNumber += 1;
44  energies.NeighbourEnergy += energy;
45  if (energy > energies.MaxNeighbourEnergy) {
46  energies.MaxNeighbourEnergy = energy;
47  }
48  }
49  }
50  return energies;
51  }
52 };
53 
54 #endif /*BSEMCENERGIES_T_HH*/
Double_t SumRatio()
Bool_t AreNeighbours(Int_t t_a, Int_t t_b) const
Double_t CenterEnergy
Double_t NeighbourEnergy
Double_t MaxPlusRatio()
Double_t MaxNeighbourEnergy
represents the reconstructed hit of one emc crystal
Definition: BSEmcDigi.h:59
Double_t MaxRatio()
Double_t SumPlusRatio()
Neigbouring Relations based on a list of detectorIds.
static BSEmcEnergies_t GetEnergies(Int_t t_centralcrystal, const std::vector< const BSEmcDigi *> &t_digiArray, BSEmcGeoNeighbouringRelationPar *t_neighbouring)