]>
Commit | Line | Data |
---|---|---|
2410262d | 1 | /************************************************************************** |
2374af72 | 2 | * This file is property of and copyright by the ALICE HLT Project * |
3 | * All rights reserved. * | |
2410262d | 4 | * * |
2374af72 | 5 | * Primary Authors: Oystein Djuvsland * |
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 * | |
2374af72 | 12 | * about the suitability of this software for any purpose. It is * |
2410262d | 13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ | |
15 | ||
2374af72 | 16 | /** |
17 | * @file AliHLTPHOSPhysicsAnalyzerSpectrum.cxx | |
18 | * @author Oystein Djuvsland | |
19 | * @date | |
20 | * @brief Invariant mass spectrum from 2 gammas */ | |
21 | ||
22 | // see header file for class documentation | |
23 | // or | |
24 | // refer to README to build package | |
25 | // or | |
26 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
2410262d | 27 | |
28 | #include "AliHLTPHOSPhysicsAnalyzerSpectrum.h" | |
a20d23f9 | 29 | #include "AliHLTPHOSRecPointContainerStruct.h" |
2374af72 | 30 | #include "AliHLTPHOSRecPointDataStruct.h" |
2410262d | 31 | #include <cmath> |
91b95d47 | 32 | #include "math.h" |
33 | #include "TH1F.h" | |
34 | ||
2410262d | 35 | |
36 | ClassImp(AliHLTPHOSPhysicsAnalyzerSpectrum); | |
37 | ||
91b95d47 | 38 | |
39 | ||
6e709a0d | 40 | AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum():AliHLTPHOSPhysicsAnalyzer(), fPos0Ptr(0), fPos1Ptr(0), fThresholdPtr(0), fEnergyPtr(0) |
2410262d | 41 | { |
91b95d47 | 42 | //Constructor |
2374af72 | 43 | //See header file for documentation |
2410262d | 44 | fEnergyPtr = new Float_t[2]; |
45 | fPos0Ptr = new Float_t[3]; | |
46 | fPos1Ptr = new Float_t[3]; | |
47 | fThresholdPtr = new Float_t[2]; | |
48 | fThresholdPtr[0] = 0; | |
49 | fThresholdPtr[1] = 0; | |
50 | ||
51 | } | |
52 | ||
6e709a0d | 53 | AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum(const AliHLTPHOSPhysicsAnalyzerSpectrum &):AliHLTPHOSPhysicsAnalyzer(), fPos0Ptr(0), fPos1Ptr(0), fThresholdPtr(0), fEnergyPtr(0) |
2410262d | 54 | { |
91b95d47 | 55 | //Copy constructor not implemented |
2374af72 | 56 | //See header file for documentation |
2410262d | 57 | } |
58 | ||
59 | AliHLTPHOSPhysicsAnalyzerSpectrum::~AliHLTPHOSPhysicsAnalyzerSpectrum() | |
60 | { | |
91b95d47 | 61 | //Destructor |
2374af72 | 62 | //See header file for documentation |
63 | if(fRecPointsPtr) fRecPointsPtr = 0; | |
2410262d | 64 | |
65 | if(fRootHistPtr) fRootHistPtr = 0; | |
66 | ||
67 | if(fThresholdPtr) | |
68 | { | |
69 | delete [] fThresholdPtr; | |
70 | fThresholdPtr = 0; | |
71 | } | |
72 | if(fEnergyPtr) | |
73 | { | |
74 | delete [] fEnergyPtr; | |
75 | fEnergyPtr = 0; | |
76 | } | |
77 | if(fPos0Ptr) | |
78 | { | |
79 | delete [] fPos0Ptr; | |
80 | fPos0Ptr = 0; | |
81 | } | |
82 | if(fPos1Ptr) | |
83 | { | |
84 | delete [] fPos1Ptr; | |
85 | fPos1Ptr = 0; | |
86 | } | |
87 | ||
88 | } | |
2410262d | 89 | void |
a20d23f9 | 90 | AliHLTPHOSPhysicsAnalyzerSpectrum::Analyze(AliHLTPHOSRecPointContainerStruct* recPointsArrayPtr, Int_t nRecPoints) |
2410262d | 91 | { |
2374af72 | 92 | //Analyzing a set of recPoints |
93 | //See header file for documentation | |
2410262d | 94 | Float_t cosOpeningAngle = 0; |
95 | ||
a20d23f9 | 96 | AliHLTPHOSRecPointDataStruct* firstRecPointPtr; |
97 | AliHLTPHOSRecPointDataStruct* secondRecPointPtr; | |
98 | ||
2374af72 | 99 | if(nRecPoints > 1) |
2410262d | 100 | { |
2374af72 | 101 | for(Int_t i = 0; i < nRecPoints-1; i++) |
2410262d | 102 | { |
a20d23f9 | 103 | firstRecPointPtr = &(recPointsArrayPtr->fRecPointArray[i]); |
104 | fEnergyPtr[0] = firstRecPointPtr->fAmp; | |
2410262d | 105 | if(fEnergyPtr[0] > fThresholdPtr[0]) |
106 | { | |
107 | ||
2374af72 | 108 | for(Int_t j = i+1; j < nRecPoints; j++) |
2410262d | 109 | { |
a20d23f9 | 110 | secondRecPointPtr = &(recPointsArrayPtr->fRecPointArray[j]); |
111 | fEnergyPtr[1] = secondRecPointPtr->fAmp; | |
2410262d | 112 | if(fEnergyPtr[1] > fThresholdPtr[1]) |
113 | { | |
a20d23f9 | 114 | GlobalPosition(firstRecPointPtr, fPos0Ptr); |
115 | GlobalPosition(secondRecPointPtr, fPos1Ptr); | |
2410262d | 116 | |
2410262d | 117 | cosOpeningAngle = (fPos0Ptr[0]*fPos1Ptr[0] + fPos0Ptr[1]*fPos1Ptr[1] + fPos0Ptr[2]*fPos1Ptr[2])/ |
118 | (sqrt(fPos0Ptr[0]*fPos0Ptr[0] + fPos0Ptr[1]*fPos0Ptr[1] + fPos0Ptr[2]*fPos0Ptr[2])* | |
119 | sqrt(fPos1Ptr[0]*fPos1Ptr[0] + fPos1Ptr[1]*fPos1Ptr[1] + fPos1Ptr[2]*fPos1Ptr[2])); | |
120 | ||
121 | fRootHistPtr->Fill(sqrt(2*fEnergyPtr[0]*fEnergyPtr[1]*(1 - cosOpeningAngle))); | |
2410262d | 122 | } |
123 | ||
124 | } | |
125 | ||
126 | } | |
127 | ||
128 | } | |
129 | ||
130 | } | |
2410262d | 131 | } |
132 | ||
2410262d | 133 | Float_t |
134 | AliHLTPHOSPhysicsAnalyzerSpectrum::EvalDistance() | |
135 | { | |
2374af72 | 136 | //Evaluate the distance between the two recPoints |
137 | //See header file for documentation | |
91b95d47 | 138 | if(fPos0Ptr && fPos1Ptr) |
139 | return sqrt(pow(fPos1Ptr[0]-fPos0Ptr[0],2) + pow(fPos1Ptr[1]-fPos0Ptr[1],2) + pow(fPos1Ptr[2]-fPos0Ptr[2],2)); | |
140 | return -1; | |
2410262d | 141 | |
2410262d | 142 | } |
143 | ||
144 | Int_t | |
145 | AliHLTPHOSPhysicsAnalyzerSpectrum::SetThreshold(Float_t photonEnergy0, Float_t photonEnergy1) | |
146 | { | |
91b95d47 | 147 | //Setting the cut thresholds |
2374af72 | 148 | //See header file for documentation |
2410262d | 149 | fThresholdPtr[0] = photonEnergy0; |
150 | ||
151 | fThresholdPtr[1] = photonEnergy1; | |
152 | ||
153 | return 0; | |
154 | ||
155 | } |