3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
7 * Primary Authors: Oystein Djuvsland *
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 **************************************************************************/
19 * @file AliHLTPHOSPhysicsAnalyzer.cxx
20 * @author Oystein Djuvsland
22 * @brief Physics analysis base class */
24 // see header file for class documentation
26 // refer to README to build package
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
30 #include "AliHLTPHOSPhysicsAnalyzer.h"
35 #include "AliPHOSGeometry.h"
37 #include "AliHLTPHOSCommonDefs.h"
38 #include "AliHLTPHOSRecPointDataStruct.h"
41 ClassImp(AliHLTPHOSPhysicsAnalyzer);
43 AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():
49 //See header file for documentation
50 // AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
51 AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("IHEP");
53 // fPHOSRadius = geom->GetIPtoCrystalSurface();
54 fPHOSRadius = geom->GetIPtoCrystalSurface();
56 for(int i = 0; i < NMODULES; i++)
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);
66 AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(0), fRootHistPtr(0), fPHOSRadius(0)
70 //See header file for documentation
71 AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
73 fPHOSRadius = geom->GetIPtoCrystalSurface();
75 for(UInt_t i = 0; i < N_MODULES; i++)
77 fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
79 fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
85 AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer()
88 //See header file for documentation
94 AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSRecPointDataStruct* /*recPointPtr*/, Float_t* /*locPositionPtr*/)
96 //Get local position for a recPoint
98 // locPositionPtr[0] = recPointPtr->fLocalPositionPtr[0];
99 //locPositionPtr[1] = recPointPtr->fLocalPositionPtr[1];
104 AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSRecPointDataStruct* recPointPtr, Float_t* positionPtr)
106 //Get global position for a recPoint
107 //See header file for documentation
108 Float_t tempPosX = 0;
111 Int_t module = recPointPtr->fModule;
113 tempPosX = kCRYSTALSIZE*(recPointPtr->fX-NXCOLUMNSMOD/2) + kCRYSTALSIZE/2;
115 positionPtr[0] = tempPosX*fRotParametersSin[module] + fPHOSRadius*fRotParametersCos[module];
117 positionPtr[1] = tempPosX*fRotParametersCos[module] - fPHOSRadius*fRotParametersSin[module];
119 positionPtr[2] = kCRYSTALSIZE*(recPointPtr->fZ-NZROWSMOD/2) + kCRYSTALSIZE/2;
124 AliHLTPHOSPhysicsAnalyzer::GlobalPosition(Float_t* locPositionPtr, Float_t* positionPtr, Int_t module)
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];
130 positionPtr[1] = kCRYSTALSIZE*(locPositionPtr[0]-NXCOLUMNSMOD/2)*fRotParametersSin[module] - fPHOSRadius*fRotParametersCos[module];
132 positionPtr[2] = kCRYSTALSIZE*(locPositionPtr[1]-NZROWSMOD/2);
137 AliHLTPHOSPhysicsAnalyzer::WriteHistogram(const Char_t* fileName)
139 //Write the histogram
140 //See header file for documentation
141 TFile *outfile = new TFile(fileName,"recreate");
143 fRootHistPtr->Write();
153 AliHLTPHOSPhysicsAnalyzer::Analyze(AliHLTPHOSRecPointContainerStruct* /*recPointsArrayPtr*/, Int_t /*nRecPoints*/)