]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/physics/AliHLTCaloHistoCellEnergy.cxx
-Moved PHOS Physics histogram producers to HLT/global/physics
[u/mrichter/AliRoot.git] / HLT / global / physics / AliHLTCaloHistoCellEnergy.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors: Albin Gaignette, Svein Lindal slindal@fys.uio.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  * @file   AliHLTCaloHistoCellEnergy
18  * @author Svein Lindal
19  * @date 
20  * @brief  Produces histograms of cluster energy distributions 
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
29 #include "AliHLTCaloHistoCellEnergy.h"
30 #include "TObjArray.h"
31 #include "TH1F.h"
32 #include "TH2F.h"
33 #include "TRefArray.h"
34 #include "TString.h"
35 #include "AliESDCaloCluster.h"
36
37 ClassImp(AliHLTCaloHistoCellEnergy);
38
39 AliHLTCaloHistoCellEnergy::AliHLTCaloHistoCellEnergy(TString det) :
40   fHistCellEnergy(NULL),
41   fHistCellEnergyVsNCells(NULL),
42   fHistArrayPtr(NULL)
43 {
44   // See header file for documentation
45   fHistArrayPtr = new TObjArray;
46
47   fHistCellEnergy = new TH1F(Form("%s fHistCellEnergy", det.Data()), Form("%s Distribution of total energy in clusters", det.Data()), 200, 0, 1);
48   fHistCellEnergy->GetXaxis()->SetTitle("E GeV");
49   fHistCellEnergy->GetYaxis()->SetTitle("Number of counts");
50   fHistCellEnergy->SetMarkerStyle(21);
51   fHistArrayPtr->AddLast(fHistCellEnergy);
52
53   fHistCellEnergyVsNCells = new TH2F(Form("%s fHistCellEnergyVsNCells", det.Data()), Form("%s Distribution of Energy vs Number of Cells in cluster", det.Data()), 200, 0, 200, 50, 0 , 50);
54   fHistCellEnergyVsNCells->GetXaxis()->SetTitle("Energy in cluster (GeV)");
55   fHistCellEnergyVsNCells->GetYaxis()->SetTitle("Number of Cells in cluster");
56   fHistCellEnergyVsNCells->SetMarkerStyle(21);
57   fHistArrayPtr->AddLast(fHistCellEnergyVsNCells);
58
59 }
60
61 AliHLTCaloHistoCellEnergy::~AliHLTCaloHistoCellEnergy()
62 {
63   //See header file for documentation
64
65   if(fHistCellEnergy)
66     delete fHistCellEnergy;
67   fHistCellEnergy = NULL;
68   
69   if(fHistCellEnergyVsNCells)
70     delete fHistCellEnergyVsNCells;
71   fHistCellEnergyVsNCells = NULL;
72
73   if(fHistArrayPtr)
74     delete fHistArrayPtr;
75   fHistArrayPtr = NULL;
76
77 }
78
79 TObjArray* AliHLTCaloHistoCellEnergy::GetHistograms()
80 {  
81   // See header file for documentation
82   return fHistArrayPtr;
83 }
84
85
86 Int_t AliHLTCaloHistoCellEnergy::FillHistograms(Int_t nc, TRefArray * clustersArray) {   
87   
88   for(int ic = 0; ic < nc; ic++) {
89     AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(clustersArray->At(ic));
90     for(int i = 0; i < cluster->GetNCells(); i++) {
91       fHistCellEnergyVsNCells->Fill(cluster->GetNCells(), cluster->GetCellAmplitudeFraction(i));
92       fHistCellEnergy->Fill(cluster->GetCellAmplitudeFraction(i));
93     }
94   }  
95   
96   return 0;
97 }
98   
99  
100  
101