]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/physics/AliHLTCaloHistoClusterEnergy.cxx
Merge branch 'histos'
[u/mrichter/AliRoot.git] / HLT / global / physics / AliHLTCaloHistoClusterEnergy.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors: 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   AliHLTCaloHistoClusterEnergy
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 "AliHLTCaloHistoClusterEnergy.h"
30 #include "AliESDCaloCluster.h"
31 #include "AliHLTCaloClusterDataStruct.h"
32 #include "TH1F.h"
33 #include "TH2F.h"
34 #include "TRefArray.h"
35
36 ClassImp(AliHLTCaloHistoClusterEnergy);
37
38 AliHLTCaloHistoClusterEnergy::AliHLTCaloHistoClusterEnergy(TString det) :
39   AliHLTCaloHistoProducer(),
40   fHistClusterEnergy(NULL),
41   fHistClusterEnergyVsNCells(NULL)
42 {
43   // See header file for documentation
44   fHistClusterEnergy = new TH1F(Form("%s fHistClusterEnergy", det.Data()), Form("%s Distribution of total energy in clusters", det.Data()), 200, 0, 200);
45   fHistClusterEnergy->GetXaxis()->SetTitle("E GeV");
46   fHistClusterEnergy->GetYaxis()->SetTitle("Number of counts");
47   fHistClusterEnergy->SetMarkerStyle(21);
48   fHistArray->AddLast(fHistClusterEnergy);
49
50   fHistClusterEnergyVsNCells = new TH2F(Form("%s fHistClusterEnergyVsNCells", det.Data()), Form("%s Distribution of Energy vs Number of Cells in cluster", det.Data()), 200, 0, 200, 50, 0 , 50);
51   fHistClusterEnergyVsNCells->GetXaxis()->SetTitle("Energy in cluster (GeV)");
52   fHistClusterEnergyVsNCells->GetYaxis()->SetTitle("Number of Cells in cluster");
53   fHistClusterEnergyVsNCells->SetMarkerStyle(21);
54   fHistArray->AddLast(fHistClusterEnergyVsNCells);
55
56 }
57
58 AliHLTCaloHistoClusterEnergy::~AliHLTCaloHistoClusterEnergy()
59 {
60   //destructor
61   if(fHistClusterEnergy)
62     delete fHistClusterEnergy;
63   fHistClusterEnergy = NULL;
64
65   if(fHistClusterEnergyVsNCells)
66     delete fHistClusterEnergyVsNCells;
67   fHistClusterEnergyVsNCells = NULL;
68 }
69
70 Int_t AliHLTCaloHistoClusterEnergy::FillHistograms(Int_t nc, TRefArray * clusterArray) {
71   //See header file for documentation
72   for(int ic = 0; ic < nc; ic++) {
73     AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(clusterArray->At(ic));
74     return FillClusterEnergyHistos(cluster);
75   }
76   return 0;
77 }
78 Int_t AliHLTCaloHistoClusterEnergy::FillHistograms(Int_t nc, vector<AliHLTCaloClusterDataStruct*> &cVec) {
79   //See header file for documentation
80   // HLTInfo("histo");
81   for(int ic = 0; ic < nc; ic++) {
82     AliHLTCaloClusterDataStruct * cluster = cVec.at(ic);
83     return FillClusterEnergyHistos(cluster);
84   }
85   return 0;
86 }
87
88 template <class T>
89 Int_t AliHLTCaloHistoClusterEnergy::FillClusterEnergyHistos(T* cluster) {
90   fHistClusterEnergy->Fill(cluster->E());
91   fHistClusterEnergyVsNCells->Fill(cluster->GetNCells(), cluster->E());
92
93   return 0;
94 }