Project
Loading...
Searching...
No Matches
AnalysisCluster.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
13
15#include <TLorentzVector.h>
16
17#include <fairlogger/Logger.h>
18#include <gsl/span>
19
20#include <array>
21
22using namespace o2::emcal;
23
24//_______________________________________________________________________
26{
27 //if(mTracksMatched) delete mTracksMatched;
28 //mTracksMatched = 0;
29 mCellsAmpFraction.clear();
30 mCellsIndices.clear();
31}
32
33//_______________________________________________________________________
34TLorentzVector AnalysisCluster::getMomentum(std::array<const float, 3> vertex) const
35{
36
37 TLorentzVector p;
38
39 std::array<float, 3> pos = {mGlobalPos.X(), mGlobalPos.Y(), mGlobalPos.Z()};
40 pos[0] -= vertex[0];
41 pos[1] -= vertex[1];
42 pos[2] -= vertex[2];
43
44 float r = TMath::Sqrt(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]);
45
46 if (r > 0) {
47 p.SetPxPyPzE(mEnergy * pos[0] / r, mEnergy * pos[1] / r, mEnergy * pos[2] / r, mEnergy);
48 } else {
49 LOG(info) << "Null cluster radius, momentum calculation not possible";
50 }
51
52 return p;
53}
54
55//______________________________________________________________________________
57{
58 mGlobalPos.SetX(x.X());
59 mGlobalPos.SetY(x.Y());
60 mGlobalPos.SetZ(x.Z());
61}
62
63//______________________________________________________________________________
65{
66 mLocalPos.SetX(x.X());
67 mLocalPos.SetY(x.Y());
68 mLocalPos.SetZ(x.Z());
69}
uint64_t vertex
Definition RawEventData.h:9
uint16_t pos
Definition RawData.h:3
math_utils::Point3D< float > mGlobalPos
Position in global coordinate system (cm).
float mEnergy
Energy measured by calorimeter in GeV.
void setGlobalPosition(const math_utils::Point3D< float > &x)
Set the cluster global position.
math_utils::Point3D< float > mLocalPos
Local position in the sub-detector coordinate.
TLorentzVector getMomentum(std::array< const float, 3 > vertexPosition) const
void setLocalPosition(const math_utils::Point3D< float > &x)
std::vector< float > mCellsAmpFraction
std::vector< unsigned short > mCellsIndices
Array of cell indices contributing to this cluster.
GLint GLenum GLint x
Definition glcorearb.h:403
GLboolean r
Definition glcorearb.h:1233
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"