Project
Loading...
Searching...
No Matches
Cluster.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#include <map>
18#include <vector>
21
22using namespace o2::ecal;
23
25
26//==============================================================================
27void Cluster::addDigit(int digitIndex, int towerId, double energy)
28{
29 mE += energy;
30 mDigitIndex.push_back(digitIndex);
31 mDigitTowerId.push_back(towerId);
32 mDigitEnergy.push_back(energy);
33}
34
35//==============================================================================
36int Cluster::getMcTrackID() const
37{
38 float maxEnergy = 0;
39 int maxID = 0;
40 for (const auto& [mcTrackID, energy] : mMcTrackEnergy) {
41 if (energy > maxEnergy) {
42 maxEnergy = energy;
43 maxID = mcTrackID;
44 }
45 }
46 return maxID;
47}
48
49//==============================================================================
50TLorentzVector Cluster::getMomentum() const
51{
52 double r = std::sqrt(mX * mX + mY * mY + mZ * mZ);
53 if (r == 0)
54 return TLorentzVector();
55 return TLorentzVector(mE * mX / r, mE * mY / r, mE * mZ / r, mE);
56}
Definition of ECal cluster class.
Definition of ECal digit class.
ClassImp(Cluster)
GLboolean r
Definition glcorearb.h:1233