]>
Commit | Line | Data |
---|---|---|
2410262d | 1 | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
dabc4c35 | 5 | * Author: Ã\98ystein 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 "AliHLTPHOSPhysicsAnalyzer.h" | |
18 | #include "TVector3.h" | |
19 | #include "TFile.h" | |
20 | #include "TMath.h" | |
91b95d47 | 21 | #include "TH1F.h" |
d6e6cb01 | 22 | #include "AliPHOSGeometry.h" |
91b95d47 | 23 | #include "Rtypes.h" |
24 | #include "AliHLTPHOSCommonDefs.h" | |
25 | #include "AliHLTPHOSClusterDataStruct.h" | |
26 | ||
dabc4c35 | 27 | #include "AliHLTPHOSConstants.h" |
28 | using namespace PhosHLTConst; | |
2410262d | 29 | |
30 | ClassImp(AliHLTPHOSPhysicsAnalyzer); | |
31 | ||
32 | AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():fClustersPtr(NULL) | |
33 | ||
34 | ||
35 | { | |
91b95d47 | 36 | //Constructor |
2410262d | 37 | |
38 | AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV"); | |
39 | ||
40 | fPHOSRadius = geom->GetIPtoCrystalSurface(); | |
41 | ||
42 | for(Int_t i = 0; i < N_MODULES; i++) | |
43 | { | |
44 | fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
45 | ||
46 | fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
47 | } | |
48 | } | |
49 | ||
50 | AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(NULL) | |
51 | ||
52 | { | |
91b95d47 | 53 | //Cooy constructor |
54 | ||
2410262d | 55 | AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV"); |
56 | ||
57 | fPHOSRadius = geom->GetIPtoCrystalSurface(); | |
58 | ||
59 | for(Int_t i = 0; i < N_MODULES; i++) | |
60 | { | |
61 | fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
62 | ||
63 | fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
64 | } | |
91b95d47 | 65 | |
2410262d | 66 | } |
67 | ||
68 | ||
69 | AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer() | |
70 | { | |
91b95d47 | 71 | //Destructor |
2410262d | 72 | |
91b95d47 | 73 | fClustersPtr = 0; |
74 | fRootHistPtr = 0; | |
2410262d | 75 | } |
76 | ||
77 | void | |
78 | AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* locPositionPtr) | |
79 | { | |
91b95d47 | 80 | //Get local position for a cluster |
2410262d | 81 | |
82 | locPositionPtr[0] = clusterPtr->fLocalPositionPtr[0]; | |
83 | locPositionPtr[1] = clusterPtr->fLocalPositionPtr[1]; | |
84 | ||
85 | } | |
86 | ||
87 | void | |
88 | AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* positionPtr) | |
89 | { | |
91b95d47 | 90 | //Get global position for a cluster |
2410262d | 91 | |
92 | Float_t tempPosX = 0; | |
93 | ||
94 | Int_t module = clusterPtr->fPHOSModule; | |
95 | ||
91b95d47 | 96 | tempPosX = kCRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[0]-N_COLUMNS_MOD/2) + kCRYSTAL_SIZE/2; |
2410262d | 97 | |
98 | positionPtr[0] = tempPosX*fRotParametersSin[module] + fPHOSRadius*fRotParametersCos[module]; | |
99 | ||
100 | positionPtr[1] = tempPosX*fRotParametersCos[module] - fPHOSRadius*fRotParametersSin[module]; | |
101 | ||
91b95d47 | 102 | positionPtr[2] = kCRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[1]-N_ROWS_MOD/2) + kCRYSTAL_SIZE/2; |
2410262d | 103 | |
104 | } | |
105 | ||
106 | void | |
107 | AliHLTPHOSPhysicsAnalyzer::GlobalPosition(Float_t* locPositionPtr, Float_t* positionPtr, Int_t module) | |
108 | { | |
91b95d47 | 109 | //Get global position from local postion and module number |
2410262d | 110 | |
91b95d47 | 111 | positionPtr[0] = kCRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersCos[module-1] + fPHOSRadius*fRotParametersSin[module-1]; |
112 | ||
113 | positionPtr[1] = kCRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersSin[module-1] - fPHOSRadius*fRotParametersCos[module-1]; | |
2410262d | 114 | |
91b95d47 | 115 | positionPtr[2] = kCRYSTAL_SIZE*(locPositionPtr[1]-N_ROWS_MOD); |
2410262d | 116 | |
117 | } | |
118 | ||
119 | void | |
120 | AliHLTPHOSPhysicsAnalyzer::WriteHistogram(Char_t* fileName) | |
121 | { | |
91b95d47 | 122 | //Write the histogram |
123 | ||
2410262d | 124 | TFile *outfile = new TFile(fileName,"recreate"); |
125 | ||
126 | fRootHistPtr->Write(); | |
127 | ||
128 | outfile->Close(); | |
91b95d47 | 129 | |
130 | delete outfile; | |
131 | outfile = 0; | |
2410262d | 132 | |
133 | } | |
134 | ||
135 |