]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/AliEmcalTriggerPatchInfo.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalTriggerPatchInfo.cxx
CommitLineData
00c77045 1//
314552f3 2// Emcal trigger patch information class
3// Can contain three types of information, distinguished by the various bits in the bit field:
4// 1) online trigger information (no extra bits set)
5// 2) offline recalculated trigger patches (bit 25, kSimpleOfflineTriggerBit set)
6// 3) highest patch energy, also for events that did not fire the trigger (bits 22, 23 kRecalc... (using both online and offline info, use bit 25 to distinguish)
00c77045 7//
8// Author: J.Kral
9
10#include "AliEmcalTriggerPatchInfo.h"
11#include "AliLog.h"
cf9ee6ed 12#include "AliEMCALGeometry.h"
13#include "TArrayI.h"
00c77045 14
15//_________________________________________________________________________________________________
16AliEmcalTriggerPatchInfo::AliEmcalTriggerPatchInfo() :
17 TObject(),
18 fCenterGeo(),
19 fCenterMass(),
20 fEdge1(),
21 fEdge2(),
cf9ee6ed 22 fADCAmp(0),
314552f3 23 fADCOfflineAmp(0),
7ea0d3f4 24 fTriggerBits(0),
314552f3 25 fOffSet(0), // To be set explictly by the trigger maker in order to avoid hard coding
26 fTriggerBitConfig()
00c77045 27{
28 // Default constructor.
cf9ee6ed 29 fEdgeCell[0] = -1;
30 fEdgeCell[1] = -1;
00c77045 31}
32
33
34//_________________________________________________________________________________________________
35AliEmcalTriggerPatchInfo::AliEmcalTriggerPatchInfo(const AliEmcalTriggerPatchInfo &p) :
36 TObject(p),
37 fCenterGeo(p.fCenterGeo),
38 fCenterMass(p.fCenterMass),
39 fEdge1(p.fEdge1),
40 fEdge2(p.fEdge2),
41 fADCAmp(p.fADCAmp),
314552f3 42 fADCOfflineAmp(p.fADCOfflineAmp),
7ea0d3f4 43 fTriggerBits(p.fTriggerBits),
314552f3 44 fOffSet(p.fOffSet),
45 fTriggerBitConfig(p.fTriggerBitConfig)
00c77045 46{
47 // Copy constructor.
cf9ee6ed 48 fEdgeCell[0] = p.fEdgeCell[0];
49 fEdgeCell[1] = p.fEdgeCell[1];
00c77045 50}
51
52//_________________________________________________________________________________________________
53AliEmcalTriggerPatchInfo::~AliEmcalTriggerPatchInfo()
54{
55 // Destructor.
56}
57
58//_________________________________________________________________________________________________
59AliEmcalTriggerPatchInfo &AliEmcalTriggerPatchInfo::operator=(const AliEmcalTriggerPatchInfo &p)
60{
61 // Assignment operator.
62
63 if (this != &p) {
64 fCenterGeo = p.fCenterGeo;
65 fCenterMass = p.fCenterMass;
66 fEdge1 = p.fEdge1;
67 fEdge2 = p.fEdge2;
68 fADCAmp = p.fADCAmp;
314552f3 69 fADCOfflineAmp = p.fADCOfflineAmp;
00c77045 70 fTriggerBits = p.fTriggerBits;
cf9ee6ed 71 fEdgeCell[0] = p.fEdgeCell[0];
72 fEdgeCell[1] = p.fEdgeCell[1];
00c77045 73 }
74
75 return *this;
76}
77
cf9ee6ed 78//_________________________________________________________________________________________________
79void AliEmcalTriggerPatchInfo::GetCellIndices( AliEMCALGeometry *geom, TArrayI *cells ){
80
81 // return cell indices of the given patch in hte cell array
82 Int_t globCol, globRow, i, j, k, absId, cellAbsId[4];;
83
84 cells->Set( 1024 );
85
86 // get corner, convert from cells to trigger channels
87 globCol = GetEdgeCellX() / 2;
88 globRow = GetEdgeCellY() / 2;
89
90 // get the absolute trigger ID
91 geom->GetAbsFastORIndexFromPositionInEMCAL( globCol, globRow, absId );
92 // convert to the 4 absId of the cells composing the trigger channel
93 geom->GetCellIndexFromFastORIndex( absId, cellAbsId );
94
95 // sum the available energy in the 32/32 window of cells
96 // step over trigger channels and get all the corresponding cells
97 for( i = 0; i < 16; i++ ){
98 for( j = 0; j < 16; j++ ){
99 // get the 4 cells composing the trigger channel
100 geom->GetAbsFastORIndexFromPositionInEMCAL( globCol+i, globRow+j, absId );
101 geom->GetCellIndexFromFastORIndex( absId, cellAbsId );
102 // add amplitudes and find patch edges
103 for( k = 0; k < 4; k++ ){
104 cells->SetAt( cellAbsId[k], i*16*4+j*4+k );
105 }
106 }
107 } // 32x32 cell window
108
109
110}
111
112
00c77045 113//_________________________________________________________________________________________________
114void AliEmcalTriggerPatchInfo::SetLorentzVector( TLorentzVector &lv, TVector3 &v, Double_t e ){
115 // sets the vector
116 Double_t r = TMath::Sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2] ) ;
117
118 lv.SetPxPyPzE( e*v[0]/r, e*v[1]/r, e*v[2]/r, e) ;
119}
120