]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/global/physics/AliHLTCaloHistoClusterEnergy.cxx
-Fixed bug preventing all clusters from being added to histograms
[u/mrichter/AliRoot.git] / HLT / global / physics / AliHLTCaloHistoClusterEnergy.cxx
CommitLineData
844d7fdd 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
4 * *
ce063697 5 * Primary Authors: Svein Lindal <slindal@fys.uio.no> *
844d7fdd 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/**
766aafea 17 * @file AliHLTCaloHistoClusterEnergy
18 * @author Svein Lindal
844d7fdd 19 * @date
87b87810 20 * @brief Produces histograms of cluster energy distributions
844d7fdd 21 */
22
23// see header file for class documentation
24// or
25// refer to README to build package
26// or
27// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
28
766aafea 29#include "AliHLTCaloHistoClusterEnergy.h"
30#include "AliESDCaloCluster.h"
ce063697 31#include "AliHLTCaloClusterDataStruct.h"
844d7fdd 32#include "TH1F.h"
87b87810 33#include "TH2F.h"
766aafea 34#include "TRefArray.h"
f00fcfff 35#include "TVector3.h"
15c22d47 36#include "TMath.h"
766aafea 37
766aafea 38ClassImp(AliHLTCaloHistoClusterEnergy);
39
40AliHLTCaloHistoClusterEnergy::AliHLTCaloHistoClusterEnergy(TString det) :
ce063697 41 AliHLTCaloHistoProducer(),
87b87810 42 fHistClusterEnergy(NULL),
f00fcfff 43 fHistClusterEnergyVsNCells(NULL),
44 fHistClusterEnergyDepositEtaPhi(NULL)
844d7fdd 45{
46 // See header file for documentation
9584bcf7 47 fHistClusterEnergy = new TH1F(Form("%s fHistClusterEnergy", det.Data()), Form("%s Distribution of total energy in clusters", det.Data()), 5000, 0, 100);
87b87810 48 fHistClusterEnergy->GetXaxis()->SetTitle("E GeV");
49 fHistClusterEnergy->GetYaxis()->SetTitle("Number of counts");
ce063697 50 fHistArray->AddLast(fHistClusterEnergy);
87b87810 51
9584bcf7 52 fHistClusterEnergyVsNCells = new TH2F(Form("%s fHistClusterEnergyVsNCells", det.Data()), Form("%s Distribution of Energy vs Number of Cells in cluster", det.Data()), 1000, 0, 100, 50, 0 , 50);
87b87810 53 fHistClusterEnergyVsNCells->GetXaxis()->SetTitle("Energy in cluster (GeV)");
54 fHistClusterEnergyVsNCells->GetYaxis()->SetTitle("Number of Cells in cluster");
ce063697 55 fHistArray->AddLast(fHistClusterEnergyVsNCells);
f00fcfff 56
57 Float_t phiMin = 0.;
15c22d47 58 Float_t phiMax = 2*TMath::Pi();
f00fcfff 59 Float_t etaMin = -1.;
60 Float_t etaMax = 1.;
61
62 if(det == "PHOS")
63 {
15c22d47 64 phiMin = 255.0/180.*TMath::Pi();
65 phiMax = 325.0/180.*TMath::Pi();
f00fcfff 66 etaMin = -0.13;
67 etaMax = 0.13;
68 }
69
70 fHistClusterEnergyDepositEtaPhi = new TH2F(Form("%s fHistClusterEnergyDepositedEtaPhi", det.Data()), Form("%s Amount of energy deposited in Phi vs Eta", det.Data()), 200, phiMin, phiMax, 50, etaMin , etaMax);
00bb5bad 71 fHistClusterEnergyDepositEtaPhi->GetXaxis()->SetTitle("#phi");
72 fHistClusterEnergyDepositEtaPhi->GetYaxis()->SetTitle("#eta");
f00fcfff 73 fHistArray->AddLast(fHistClusterEnergyDepositEtaPhi);
87b87810 74
844d7fdd 75}
76
766aafea 77AliHLTCaloHistoClusterEnergy::~AliHLTCaloHistoClusterEnergy()
844d7fdd 78{
ce063697 79 //destructor
766aafea 80 if(fHistClusterEnergy)
81 delete fHistClusterEnergy;
82 fHistClusterEnergy = NULL;
83
84 if(fHistClusterEnergyVsNCells)
85 delete fHistClusterEnergyVsNCells;
86 fHistClusterEnergyVsNCells = NULL;
844d7fdd 87}
88
ce063697 89Int_t AliHLTCaloHistoClusterEnergy::FillHistograms(Int_t nc, TRefArray * clusterArray) {
90 //See header file for documentation
6a6e8a01 91
766aafea 92 for(int ic = 0; ic < nc; ic++) {
ce063697 93 AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(clusterArray->At(ic));
6a6e8a01 94 FillClusterEnergyHistos(cluster);
844d7fdd 95 }
ce063697 96 return 0;
97}
6a6e8a01 98
ce063697 99Int_t AliHLTCaloHistoClusterEnergy::FillHistograms(Int_t nc, vector<AliHLTCaloClusterDataStruct*> &cVec) {
100 //See header file for documentation
74085fad 101 // HLTInfo("histo");
ce063697 102 for(int ic = 0; ic < nc; ic++) {
103 AliHLTCaloClusterDataStruct * cluster = cVec.at(ic);
6a6e8a01 104 FillClusterEnergyHistos(cluster);
ce063697 105 }
106 return 0;
766aafea 107}
7b5c97a1 108
109template <class T>
110Int_t AliHLTCaloHistoClusterEnergy::FillClusterEnergyHistos(T* cluster) {
111 fHistClusterEnergy->Fill(cluster->E());
6a6e8a01 112 fHistClusterEnergyVsNCells->Fill(cluster->E(), cluster->GetNCells());
f00fcfff 113
114 Float_t pos[3];
115 cluster->GetPosition(pos);
116 TVector3 vec(pos);
117
00bb5bad 118 // Stupid hack, too tired to fix
119 if(vec.Phi() < 0) fHistClusterEnergyDepositEtaPhi->Fill(2*TMath::Pi() + vec.Phi(), vec.Eta(), cluster->E());
120 else fHistClusterEnergyDepositEtaPhi->Fill(vec.Phi(), vec.Eta(), cluster->E());
f00fcfff 121
7b5c97a1 122 return 0;
123}