]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/AliEmcalTriggerPatchInfo.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalTriggerPatchInfo.cxx
1 //
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)
7 //
8 // Author: J.Kral
9
10 #include "AliEmcalTriggerPatchInfo.h"
11 #include "AliLog.h"
12 #include "AliEMCALGeometry.h"
13 #include "TArrayI.h"
14
15 //_________________________________________________________________________________________________
16 AliEmcalTriggerPatchInfo::AliEmcalTriggerPatchInfo() :
17   TObject(),
18   fCenterGeo(),
19   fCenterMass(),
20   fEdge1(),
21   fEdge2(),
22   fADCAmp(0),
23   fADCOfflineAmp(0),
24   fTriggerBits(0),
25   fOffSet(0),            // To be set explictly by the trigger maker in order to avoid hard coding
26   fTriggerBitConfig()
27 {
28   // Default constructor.
29   fEdgeCell[0] = -1;
30   fEdgeCell[1] = -1;
31 }
32
33   
34 //_________________________________________________________________________________________________
35 AliEmcalTriggerPatchInfo::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),
42   fADCOfflineAmp(p.fADCOfflineAmp),
43   fTriggerBits(p.fTriggerBits),
44   fOffSet(p.fOffSet),
45   fTriggerBitConfig(p.fTriggerBitConfig)
46 {
47   // Copy constructor.
48   fEdgeCell[0] = p.fEdgeCell[0];
49   fEdgeCell[1] = p.fEdgeCell[1];
50 }
51
52 //_________________________________________________________________________________________________
53 AliEmcalTriggerPatchInfo::~AliEmcalTriggerPatchInfo()
54 {
55   // Destructor.
56 }
57
58 //_________________________________________________________________________________________________
59 AliEmcalTriggerPatchInfo &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;
69     fADCOfflineAmp = p.fADCOfflineAmp;
70     fTriggerBits = p.fTriggerBits;
71     fEdgeCell[0] = p.fEdgeCell[0];
72     fEdgeCell[1] = p.fEdgeCell[1];
73   }
74
75   return *this;
76 }
77
78 //_________________________________________________________________________________________________
79 void 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
113 //_________________________________________________________________________________________________
114 void 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