]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliJetFillUnitArray.cxx
Adding protection against taking Sqrt of negative values...
[u/mrichter/AliRoot.git] / JETAN / AliJetFillUnitArray.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16
17 //======================================================================
18 // ***July 2009
19 // Fill Unit Array class 
20 // Base class used by AliJetESDReader to fill a UnitArray from the information extracted 
21 // from the particle tracks or emcal cells
22 // Author: magali.estienne@subatech.in2p3.fr
23 //======================================================================
24
25
26 #include "AliJetFillUnitArray.h"
27
28 // --- ROOT system ---
29 class TSystem;
30 class TLorentzVector;
31 class TVector3;
32 class TGeoManager;
33 class TProcessID;
34
35 // --- AliRoot header files ---
36 class AliJetFinder;
37 class AliJetReader;
38 class AliJetESDReader;
39 class AliJetESDReaderHeader;
40 class AliJetUnitArray;
41
42 ClassImp(AliJetFillUnitArray)
43
44 //_____________________________________________________________________________
45 AliJetFillUnitArray::AliJetFillUnitArray()
46   : TTask("AliJetFillUnitArray","Fill Unit Array with tpc/its and emcal information"),
47     fNTracks(0),
48     fNTracksCut(0),
49     fOpt(0),
50     fDZ(0),
51     fDebug(0),
52     fReaderHeader(0x0),
53     fMomentumArray(0x0),
54     fUnitArray(0x0),
55     fRefArray(0x0),
56     fRef(0x0),
57     fSignalFlag(0),
58     fCutFlag(0),
59     fProcId(kFALSE),
60     fTPCGrid(0x0),
61     fEMCalGrid(0x0),
62     fGeom(0x0),
63     fNphi(0),
64     fNeta(0),
65     fGrid(0),
66     fPhi2(0),
67     fEta2(0),
68     fIndex(0x0),
69     fParams(0x0),
70     fPhiMin(0),
71     fPhiMax(0),
72     fEtaMin(0),
73     fEtaMax(0),
74     fEtaBinInTPCAcc(0),
75     fPhiBinInTPCAcc(0),
76     fEtaBinInEMCalAcc(0),
77     fPhiBinInEMCalAcc(0),
78     fNbinPhi(0)
79 {
80   // constructor
81 }
82
83 //_____________________________________________________________________________
84 AliJetFillUnitArray::~AliJetFillUnitArray()
85 {
86   // destructor
87 }
88
89 //_____________________________________________________________________________
90 void AliJetFillUnitArray::GetEtaPhiFromIndex(Int_t index, Float_t &eta, Float_t &phi)
91 {
92   // Get the eta,phi position from the index
93
94   for(Int_t j=0; j<fNphi+1; j++) {
95     for(Int_t i=0; i<fNeta+1; i++) {
96
97       // TPC grid only 
98       //-------------------------------------
99       if(fGrid==0) {    
100         if(j*(fNeta+1)+i == index) {
101           eta = fEta2->At(i); 
102           phi = fPhi2->At(j);
103         }
104       }
105
106       // TPC-EMCAL grid
107       //-------------------------------------
108       Int_t ii = 0;
109       if(i==0) ii = 0;
110       if(i>0 && i<(fEtaBinInTPCAcc-fEtaBinInEMCalAcc)/2) ii = i; 
111       if(i>=(fEtaBinInTPCAcc+fEtaBinInEMCalAcc)/2 && i<fNeta+1) ii = i-fEtaBinInEMCalAcc;
112
113       if(fGrid==1) {
114         if(j<(fNbinPhi+1) && j*(fNeta+1)+i == index) {
115           eta = fEta2->At(i);
116           phi = fPhi2->At(j);
117         }  
118
119         if((j>=(fNbinPhi+1) && j<(fNbinPhi+1+fPhiBinInEMCalAcc)) && 
120            ((fNbinPhi+1)*(fNeta+1) + (j-fNbinPhi-1)*(fEtaBinInTPCAcc-fEtaBinInEMCalAcc) + ii)== index ) {
121           if(ii==0) {Int_t ind = 0; eta = fEta2->At(ind);}
122           else eta = fEta2->At(i);
123           phi = fPhi2->At(j);
124         }
125
126         if(j>=(fNbinPhi+1+fPhiBinInEMCalAcc) && ((fNbinPhi+1)*(fNeta+1)+fPhiBinInEMCalAcc*((fEtaBinInTPCAcc-fEtaBinInEMCalAcc))+(j-(fNbinPhi+1+fPhiBinInEMCalAcc))*(fNeta+1)+i == index)) {
127           eta = fEta2->At(i);
128           phi = fPhi2->At(j);
129         }
130       }
131     }
132   }
133 }
134
135 //_____________________________________________________________________________
136 Float_t  AliJetFillUnitArray::EtaToTheta(Float_t arg)
137 {
138   return 2.*atan(exp(-arg));
139 }
140
141
142
143
144
145
146