]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.cxx
Selectiv readout and writing to FXS (oystein)
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSPhysicsAnalyzer.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors: Oystein Djuvsland                                     *
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  * @file   AliHLTPHOSPhysicsAnalyzer.cxx
18  * @author Oystein Djuvsland
19  * @date 
20  * @brief  Physics analysis base class  */
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
27
28 #include "AliHLTPHOSPhysicsAnalyzer.h"
29 #include "TVector3.h"
30 #include "TFile.h"
31 #include "TMath.h"
32 #include "TH1F.h"
33 #include "AliPHOSGeometry.h"
34 #include "Rtypes.h"
35 #include "AliHLTPHOSCommonDefs.h"
36 #include "AliHLTPHOSRecPointDataStruct.h"
37  
38
39 ClassImp(AliHLTPHOSPhysicsAnalyzer);
40
41 AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():
42   fRecPointsPtr(0), 
43   fRootHistPtr(0), 
44   fPHOSRadius(0)
45 {
46   //Constructor
47   //See header file for documentation
48   AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
49
50   //  fPHOSRadius = geom->GetIPtoCrystalSurface();
51   fPHOSRadius = geom->GetIPtoCrystalSurface();
52
53   for(UInt_t i = 0; i < N_MODULES; i++)
54     {
55       fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
56
57       fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
58     }
59 }
60 /*
61 AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(0), fRootHistPtr(0), fPHOSRadius(0)
62
63 {
64   //Cooy constructor
65   //See header file for documentation
66   AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
67
68   fPHOSRadius = geom->GetIPtoCrystalSurface();
69   
70   for(UInt_t i = 0; i < N_MODULES; i++)
71     {
72       fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
73       
74       fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
75     }
76
77 }
78 */
79
80 AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer()
81 {
82   //Destructor
83   //See header file for documentation
84   fRecPointsPtr = 0;
85   fRootHistPtr = 0;
86 }
87
88 void
89 AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSRecPointDataStruct* /*recPointPtr*/, Float_t* /*locPositionPtr*/)
90 {
91   //Get local position for a recPoint
92
93   //  locPositionPtr[0] = recPointPtr->fLocalPositionPtr[0];
94   //locPositionPtr[1] = recPointPtr->fLocalPositionPtr[1];
95
96 }
97
98 void
99 AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSRecPointDataStruct* recPointPtr, Float_t* positionPtr)
100 {
101   //Get global position for a recPoint
102   //See header file for documentation
103   Float_t tempPosX = 0;
104  
105   
106   Int_t module = recPointPtr->fModule;
107
108   tempPosX = kCRYSTAL_SIZE*(recPointPtr->fX-N_XCOLUMNS_MOD/2) + kCRYSTAL_SIZE/2;
109
110   positionPtr[0] = tempPosX*fRotParametersSin[module] + fPHOSRadius*fRotParametersCos[module];
111
112   positionPtr[1] = tempPosX*fRotParametersCos[module] - fPHOSRadius*fRotParametersSin[module];
113  
114   positionPtr[2] = kCRYSTAL_SIZE*(recPointPtr->fZ-N_ZROWS_MOD/2) + kCRYSTAL_SIZE/2;
115
116 }
117
118 void
119 AliHLTPHOSPhysicsAnalyzer::GlobalPosition(Float_t* locPositionPtr, Float_t* positionPtr, Int_t module)
120
121   //Get global position from local postion and module number
122   //See header file for documentation
123   positionPtr[0] = kCRYSTAL_SIZE*(locPositionPtr[0]-N_XCOLUMNS_MOD/2)*fRotParametersCos[module] + fPHOSRadius*fRotParametersSin[module];
124
125   positionPtr[1] = kCRYSTAL_SIZE*(locPositionPtr[0]-N_XCOLUMNS_MOD/2)*fRotParametersSin[module] - fPHOSRadius*fRotParametersCos[module];
126   
127   positionPtr[2] = kCRYSTAL_SIZE*(locPositionPtr[1]-N_ZROWS_MOD);
128
129 }
130
131 void
132 AliHLTPHOSPhysicsAnalyzer::WriteHistogram(Char_t* fileName)
133 {
134   //Write the histogram
135   //See header file for documentation
136   TFile *outfile = new TFile(fileName,"recreate");  
137   
138   fRootHistPtr->Write();
139   
140   outfile->Close();
141   
142   delete outfile;
143   outfile = 0;
144
145 }
146
147