]>
Commit | Line | Data |
---|---|---|
2410262d | 1 | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: Øystein Djuvsland <oysteind@ift.uib.no> * | |
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" | |
21 | #include <cmath> | |
22 | #include "../../PHOS/AliPHOSGeometry.h" | |
23 | #include <iostream> | |
24 | ||
25 | ClassImp(AliHLTPHOSPhysicsAnalyzer); | |
26 | ||
27 | AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():fClustersPtr(NULL) | |
28 | ||
29 | ||
30 | { | |
31 | ||
32 | AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV"); | |
33 | ||
34 | fPHOSRadius = geom->GetIPtoCrystalSurface(); | |
35 | ||
36 | for(Int_t i = 0; i < N_MODULES; i++) | |
37 | { | |
38 | fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
39 | ||
40 | fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
41 | } | |
42 | } | |
43 | ||
44 | AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(NULL) | |
45 | ||
46 | { | |
47 | AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV"); | |
48 | ||
49 | fPHOSRadius = geom->GetIPtoCrystalSurface(); | |
50 | ||
51 | for(Int_t i = 0; i < N_MODULES; i++) | |
52 | { | |
53 | fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
54 | ||
55 | fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360); | |
56 | } | |
57 | cout << "Copy constructor not tested!\n"; | |
58 | } | |
59 | ||
60 | ||
61 | AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer() | |
62 | { | |
63 | ||
64 | } | |
65 | ||
66 | void | |
67 | AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* locPositionPtr) | |
68 | { | |
69 | ||
70 | locPositionPtr[0] = clusterPtr->fLocalPositionPtr[0]; | |
71 | locPositionPtr[1] = clusterPtr->fLocalPositionPtr[1]; | |
72 | ||
73 | } | |
74 | ||
75 | void | |
76 | AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* positionPtr) | |
77 | { | |
78 | ||
79 | Float_t tempPosX = 0; | |
80 | ||
81 | Int_t module = clusterPtr->fPHOSModule; | |
82 | ||
83 | tempPosX = CRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[0]-N_COLUMNS_MOD/2) + CRYSTAL_SIZE/2; | |
84 | ||
85 | positionPtr[0] = tempPosX*fRotParametersSin[module] + fPHOSRadius*fRotParametersCos[module]; | |
86 | ||
87 | positionPtr[1] = tempPosX*fRotParametersCos[module] - fPHOSRadius*fRotParametersSin[module]; | |
88 | ||
89 | positionPtr[2] = CRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[1]-N_ROWS_MOD/2) + CRYSTAL_SIZE/2; | |
90 | ||
91 | } | |
92 | ||
93 | void | |
94 | AliHLTPHOSPhysicsAnalyzer::GlobalPosition(Float_t* locPositionPtr, Float_t* positionPtr, Int_t module) | |
95 | { | |
96 | ||
97 | positionPtr[0] = CRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersCos[module-1] + fPHOSRadius*fRotParametersSin[module-1]; | |
98 | ||
99 | positionPtr[1] = CRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersSin[module-1] - fPHOSRadius*fRotParametersCos[module-1]; | |
100 | ||
101 | positionPtr[2] = CRYSTAL_SIZE*(locPositionPtr[1]-N_ROWS_MOD); | |
102 | ||
103 | } | |
104 | ||
105 | void | |
106 | AliHLTPHOSPhysicsAnalyzer::WriteHistogram(Char_t* fileName) | |
107 | { | |
108 | TFile *outfile = new TFile(fileName,"recreate"); | |
109 | ||
110 | fRootHistPtr->Write(); | |
111 | ||
112 | outfile->Close(); | |
113 | ||
114 | } | |
115 | ||
116 |