]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/AliEmcalTriggerPatchInfo.cxx
Coverity fixes 16727, 19855
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalTriggerPatchInfo.cxx
CommitLineData
00c77045 1// $Id$
2//
3// Emcal particle trigger class, which can contain either
4//
5// Author: J.Kral
6
7#include "AliEmcalTriggerPatchInfo.h"
8#include "AliLog.h"
cf9ee6ed 9#include "AliEMCALGeometry.h"
10#include "TArrayI.h"
00c77045 11
12//_________________________________________________________________________________________________
13AliEmcalTriggerPatchInfo::AliEmcalTriggerPatchInfo() :
14 TObject(),
15 fCenterGeo(),
16 fCenterMass(),
17 fEdge1(),
18 fEdge2(),
cf9ee6ed 19 fADCAmp(0),
00c77045 20 fTriggerBits(0)
21{
22 // Default constructor.
cf9ee6ed 23 fEdgeCell[0] = -1;
24 fEdgeCell[1] = -1;
00c77045 25}
26
27
28//_________________________________________________________________________________________________
29AliEmcalTriggerPatchInfo::AliEmcalTriggerPatchInfo(const AliEmcalTriggerPatchInfo &p) :
30 TObject(p),
31 fCenterGeo(p.fCenterGeo),
32 fCenterMass(p.fCenterMass),
33 fEdge1(p.fEdge1),
34 fEdge2(p.fEdge2),
35 fADCAmp(p.fADCAmp),
36 fTriggerBits(p.fTriggerBits)
37{
38 // Copy constructor.
cf9ee6ed 39 fEdgeCell[0] = p.fEdgeCell[0];
40 fEdgeCell[1] = p.fEdgeCell[1];
00c77045 41}
42
43//_________________________________________________________________________________________________
44AliEmcalTriggerPatchInfo::~AliEmcalTriggerPatchInfo()
45{
46 // Destructor.
47}
48
49//_________________________________________________________________________________________________
50AliEmcalTriggerPatchInfo &AliEmcalTriggerPatchInfo::operator=(const AliEmcalTriggerPatchInfo &p)
51{
52 // Assignment operator.
53
54 if (this != &p) {
55 fCenterGeo = p.fCenterGeo;
56 fCenterMass = p.fCenterMass;
57 fEdge1 = p.fEdge1;
58 fEdge2 = p.fEdge2;
59 fADCAmp = p.fADCAmp;
60 fTriggerBits = p.fTriggerBits;
cf9ee6ed 61 fEdgeCell[0] = p.fEdgeCell[0];
62 fEdgeCell[1] = p.fEdgeCell[1];
00c77045 63 }
64
65 return *this;
66}
67
cf9ee6ed 68//_________________________________________________________________________________________________
69void AliEmcalTriggerPatchInfo::GetCellIndices( AliEMCALGeometry *geom, TArrayI *cells ){
70
71 // return cell indices of the given patch in hte cell array
72 Int_t globCol, globRow, i, j, k, absId, cellAbsId[4];;
73
74 cells->Set( 1024 );
75
76 // get corner, convert from cells to trigger channels
77 globCol = GetEdgeCellX() / 2;
78 globRow = GetEdgeCellY() / 2;
79
80 // get the absolute trigger ID
81 geom->GetAbsFastORIndexFromPositionInEMCAL( globCol, globRow, absId );
82 // convert to the 4 absId of the cells composing the trigger channel
83 geom->GetCellIndexFromFastORIndex( absId, cellAbsId );
84
85 // sum the available energy in the 32/32 window of cells
86 // step over trigger channels and get all the corresponding cells
87 for( i = 0; i < 16; i++ ){
88 for( j = 0; j < 16; j++ ){
89 // get the 4 cells composing the trigger channel
90 geom->GetAbsFastORIndexFromPositionInEMCAL( globCol+i, globRow+j, absId );
91 geom->GetCellIndexFromFastORIndex( absId, cellAbsId );
92 // add amplitudes and find patch edges
93 for( k = 0; k < 4; k++ ){
94 cells->SetAt( cellAbsId[k], i*16*4+j*4+k );
95 }
96 }
97 } // 32x32 cell window
98
99
100}
101
102
00c77045 103//_________________________________________________________________________________________________
104void AliEmcalTriggerPatchInfo::SetLorentzVector( TLorentzVector &lv, TVector3 &v, Double_t e ){
105 // sets the vector
106 Double_t r = TMath::Sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2] ) ;
107
108 lv.SetPxPyPzE( e*v[0]/r, e*v[1]/r, e*v[2]/r, e) ;
109}
110