]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.cxx
- set clustering thresholds from CDB entries
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSPhysicsAnalyzer.cxx
1 // $Id$
2
3 /**************************************************************************
4  * This file is property of and copyright by the ALICE HLT Project        * 
5  * All rights reserved.                                                   *
6  *                                                                        *
7  * Primary Authors: Oystein Djuvsland                                     *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          * 
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 /** 
19  * @file   AliHLTPHOSPhysicsAnalyzer.cxx
20  * @author Oystein Djuvsland
21  * @date 
22  * @brief  Physics analysis base class  */
23
24 // see header file for class documentation
25 // or
26 // refer to README to build package
27 // or
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29
30 #include "AliHLTPHOSPhysicsAnalyzer.h"
31 #include "TVector3.h"
32 #include "TFile.h"
33 #include "TMath.h"
34 #include "TH1F.h"
35 #include "AliPHOSGeometry.h"
36 #include "Rtypes.h"
37 #include "AliHLTPHOSCommonDefs.h"
38 #include "AliHLTPHOSRecPointDataStruct.h"
39  
40
41 ClassImp(AliHLTPHOSPhysicsAnalyzer);
42
43 AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():
44   fRecPointsPtr(0), 
45   fRootHistPtr(0), 
46   fPHOSRadius(0)
47 {
48   //Constructor
49   //See header file for documentation
50   //  AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
51   AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("IHEP");
52
53   //  fPHOSRadius = geom->GetIPtoCrystalSurface();
54   fPHOSRadius = geom->GetIPtoCrystalSurface();
55
56   for(int i = 0; i < NMODULES; i++)
57     {
58        fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
59        fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
60 //      fRotParametersCos[i] = cos((geom->GetPHOSAngle(i))*2*TMath::Pi()/360);
61 //      fRotParametersSin[i] = sin((geom->GetPHOSAngle(i))*2*TMath::Pi()/360);
62
63     }
64 }
65 /*
66 AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(0), fRootHistPtr(0), fPHOSRadius(0)
67
68 {
69   //Cooy constructor
70   //See header file for documentation
71   AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
72
73   fPHOSRadius = geom->GetIPtoCrystalSurface();
74   
75   for(UInt_t i = 0; i < N_MODULES; i++)
76     {
77       fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
78       
79       fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
80     }
81
82 }
83 */
84
85 AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer()
86 {
87   //Destructor
88   //See header file for documentation
89   fRecPointsPtr = 0;
90   fRootHistPtr = 0;
91 }
92
93 void
94 AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSRecPointDataStruct* /*recPointPtr*/, Float_t* /*locPositionPtr*/)
95 {
96   //Get local position for a recPoint
97
98   //  locPositionPtr[0] = recPointPtr->fLocalPositionPtr[0];
99   //locPositionPtr[1] = recPointPtr->fLocalPositionPtr[1];
100
101 }
102
103 void
104 AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSRecPointDataStruct* recPointPtr, Float_t* positionPtr)
105 {
106   //Get global position for a recPoint
107   //See header file for documentation
108   Float_t tempPosX = 0;
109  
110   
111   Int_t module = recPointPtr->fModule;
112
113   tempPosX = kCRYSTALSIZE*(recPointPtr->fX-NXCOLUMNSMOD/2) + kCRYSTALSIZE/2;
114
115   positionPtr[0] = tempPosX*fRotParametersSin[module] + fPHOSRadius*fRotParametersCos[module];
116
117   positionPtr[1] = tempPosX*fRotParametersCos[module] - fPHOSRadius*fRotParametersSin[module];
118  
119   positionPtr[2] = kCRYSTALSIZE*(recPointPtr->fZ-NZROWSMOD/2) + kCRYSTALSIZE/2;
120
121 }
122
123 void
124 AliHLTPHOSPhysicsAnalyzer::GlobalPosition(Float_t* locPositionPtr, Float_t* positionPtr, Int_t module)
125
126   //Get global position from local postion and module number
127   //See header file for documentation
128   positionPtr[0] = kCRYSTALSIZE*(locPositionPtr[0]-NXCOLUMNSMOD/2)*fRotParametersCos[module] + fPHOSRadius*fRotParametersSin[module];
129
130   positionPtr[1] = kCRYSTALSIZE*(locPositionPtr[0]-NXCOLUMNSMOD/2)*fRotParametersSin[module] - fPHOSRadius*fRotParametersCos[module];
131   
132   positionPtr[2] = kCRYSTALSIZE*(locPositionPtr[1]-NZROWSMOD/2);
133
134 }
135
136 void
137 AliHLTPHOSPhysicsAnalyzer::WriteHistogram(const Char_t* fileName)
138 {
139   //Write the histogram
140   //See header file for documentation
141   TFile *outfile = new TFile(fileName,"recreate");  
142   
143   fRootHistPtr->Write();
144   
145   outfile->Close();
146   
147   delete outfile;
148   outfile = 0;
149
150 }
151
152 void
153 AliHLTPHOSPhysicsAnalyzer::Analyze(AliHLTPHOSRecPointContainerStruct* /*recPointsArrayPtr*/, Int_t /*nRecPoints*/)
154 {
155   //comment
156   return;
157 }
158