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