]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx
Removing obsolete include of math.h (Solaris x86)
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSPhysicsAnalyzerSpectrum.cxx
CommitLineData
2410262d 1
2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
3e599f56 5 * Authors: Ãystein Djuvsland <oysteind@ift.uib.no> *
2410262d 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#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
18#include "AliHLTPHOSClusterDataStruct.h"
19#include <cmath>
2410262d 20#include <iostream>
21
22ClassImp(AliHLTPHOSPhysicsAnalyzerSpectrum);
23
24AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum():AliHLTPHOSPhysicsAnalyzer()
25{
26
27 fEnergyPtr = new Float_t[2];
28 fPos0Ptr = new Float_t[3];
29 fPos1Ptr = new Float_t[3];
30 fThresholdPtr = new Float_t[2];
31 fThresholdPtr[0] = 0;
32 fThresholdPtr[1] = 0;
33
34}
35
36AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum(const AliHLTPHOSPhysicsAnalyzerSpectrum &):AliHLTPHOSPhysicsAnalyzer()
37{
38
39 cout << "AliHLTPHOSPhysicsAnalyzerSpectrum: Copy constructor not implemented yet!" << endl;
40
41}
42
43AliHLTPHOSPhysicsAnalyzerSpectrum::~AliHLTPHOSPhysicsAnalyzerSpectrum()
44{
45
46 if(fClustersPtr) fClustersPtr = 0;
47
48 if(fRootHistPtr) fRootHistPtr = 0;
49
50 if(fThresholdPtr)
51 {
52 delete [] fThresholdPtr;
53 fThresholdPtr = 0;
54 }
55 if(fEnergyPtr)
56 {
57 delete [] fEnergyPtr;
58 fEnergyPtr = 0;
59 }
60 if(fPos0Ptr)
61 {
62 delete [] fPos0Ptr;
63 fPos0Ptr = 0;
64 }
65 if(fPos1Ptr)
66 {
67 delete [] fPos1Ptr;
68 fPos1Ptr = 0;
69 }
70
71}
72
73void
74AliHLTPHOSPhysicsAnalyzerSpectrum::Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters)
75{
76
77 Float_t cosOpeningAngle = 0;
78
79 cout << "number of clusters: " << nClusters << endl;
80
81 if(nClusters > 1)
82 {
83 for(Int_t i = 0; i < nClusters-1; i++)
84 {
85
86 fEnergyPtr[0] = clustersPtr[i]->fClusterEnergy;
87
88 if(fEnergyPtr[0] > fThresholdPtr[0])
89 {
90
91 for(Int_t j = i+1; j < nClusters; j++)
92 {
93
94 fEnergyPtr[1] = clustersPtr[j]->fClusterEnergy;
95
96 if(fEnergyPtr[1] > fThresholdPtr[1])
97 {
98 GlobalPosition(clustersPtr[i], fPos0Ptr);
99
100 GlobalPosition(clustersPtr[j], fPos1Ptr);
101
102 cosOpeningAngle = (fPos0Ptr[0]*fPos1Ptr[0] + fPos0Ptr[1]*fPos1Ptr[1] + fPos0Ptr[2]*fPos1Ptr[2])/
103 (sqrt(fPos0Ptr[0]*fPos0Ptr[0] + fPos0Ptr[1]*fPos0Ptr[1] + fPos0Ptr[2]*fPos0Ptr[2])*
104 sqrt(fPos1Ptr[0]*fPos1Ptr[0] + fPos1Ptr[1]*fPos1Ptr[1] + fPos1Ptr[2]*fPos1Ptr[2]));
105
106 fRootHistPtr->Fill(sqrt(2*fEnergyPtr[0]*fEnergyPtr[1]*(1 - cosOpeningAngle)));
107
108
109 }
110
111 }
112
113 }
114
115 }
116
117 }
118
119}
120
121
122Float_t
123AliHLTPHOSPhysicsAnalyzerSpectrum::EvalDistance()
124{
125
126 return sqrt(pow(fPos1Ptr[0]-fPos0Ptr[0],2) + pow(fPos1Ptr[1]-fPos0Ptr[1],2) + pow(fPos1Ptr[2]-fPos0Ptr[2],2));
127
128}
129
130Float_t
131AliHLTPHOSPhysicsAnalyzerSpectrum::EvalCutDistance(Float_t cutMass)
132{
133
134 Float_t cosCutOpeningAngle = 0;
135
136 cosCutOpeningAngle = 1 - cutMass*cutMass/(2*fEnergyPtr[0]*fEnergyPtr[1]);
137
138 return 1.5*2*sin(acos(cosCutOpeningAngle));
139
140}
141
142Int_t
143AliHLTPHOSPhysicsAnalyzerSpectrum::SetThreshold(Float_t photonEnergy0, Float_t photonEnergy1)
144{
145
146 if(!fThresholdPtr) fThresholdPtr = new Float_t[2];
147
148 fThresholdPtr[0] = photonEnergy0;
149
150 fThresholdPtr[1] = photonEnergy1;
151
152 return 0;
153
154}