AliPhysics  vAN-20150630 (513c479)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliEmcalTriggerPatchInfo.cxx
Go to the documentation of this file.
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 
11 #include "AliLog.h"
12 #include "AliEMCALGeometry.h"
13 #include "TArrayI.h"
14 
15 //_________________________________________________________________________________________________
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 //_________________________________________________________________________________________________
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 //_________________________________________________________________________________________________
54 {
55  // Destructor.
56 }
57 
58 //_________________________________________________________________________________________________
60 {
61  // Assignment operator.
62 
63  if (this != &p) {
66  fEdge1 = p.fEdge1;
67  fEdge2 = p.fEdge2;
68  fADCAmp = p.fADCAmp;
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 
AliEmcalTriggerPatchInfo & operator=(const AliEmcalTriggerPatchInfo &p)
void GetCellIndices(AliEMCALGeometry *geom, TArrayI *cells)
void SetLorentzVector(TLorentzVector &lv, TVector3 &v, Double_t e)