]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/EMCAL/AliHLTEMCALClusterMonitor.cxx
correcting placement of 'using' statements (Thorsten), minor coverity defect corrected
[u/mrichter/AliRoot.git] / HLT / EMCAL / AliHLTEMCALClusterMonitor.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors: Francesco Blanco                                      *
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   AliHLTEMCALClusterMonitor.cxx
18  * @author Francesco Blanco
19  * @date 
20  * @brief  Online Monitoring Histogram maker for EMCAL  
21  */
22   
23
24 #include "AliHLTEMCALClusterMonitor.h"
25 #include "AliHLTCaloSharedMemoryInterfacev2.h"
26 #include "TMath.h"
27
28 ClassImp(AliHLTEMCALClusterMonitor);
29
30 AliHLTEMCALClusterMonitor::AliHLTEMCALClusterMonitor():
31   fClusterReaderPtr(0),
32   hList(0),
33         hClusterEne(0),
34         hClusterEneVsTime(0),
35         hClusterCells(0),
36         hClusterEneVsCells(0),
37         hClusterEtaVsPhi(0)
38
39 {
40   // See header file for documentation
41
42   fClusterReaderPtr = new AliHLTCaloClusterReader();
43
44   // Booking histograms
45   hList = new TObjArray;
46
47         hClusterEne = new TH1F("hClusterEne", "ClusterEnergy (GeV)", 200, 0, 100);
48         hList->Add(hClusterEne);
49
50         hClusterEneVsTime = new TH2F("hClusterEneVsTime", "ClusterEnergy vs Time", 200, 0, 100, 40, -0.5, 39.5);
51         hList->Add(hClusterEneVsTime);
52         
53         hClusterCells = new TH1I("hClusterCells", "# of cells per cluster", 50, -0.5, 49.5);
54         hList->Add(hClusterCells);
55
56         hClusterEneVsCells = new TH2F("hClusterEneCells", "# of cells per cluster vs cluster energy", 200, 0, 100, 50, -0.5, 49.5);
57         hList->Add(hClusterEneVsCells);
58
59         hClusterEtaVsPhi = new TH2F("hClusterEtaVsPhi", "Cluster position in #eta#phi", 100, -0.7, 0.7, 100, 1.38, 3.15);
60         hClusterEtaVsPhi->GetXaxis()->SetTitle("#eta");
61         hClusterEtaVsPhi->GetYaxis()->SetTitle("#phi");
62         hList->Add(hClusterEtaVsPhi);
63         
64         
65 }
66
67 AliHLTEMCALClusterMonitor::~AliHLTEMCALClusterMonitor() 
68 {
69   //See header file for documentation
70 }
71
72 // Pointer to histograms objects
73 TObjArray* AliHLTEMCALClusterMonitor::GetHistograms()
74 {
75   return hList;
76 }
77
78
79 Int_t AliHLTEMCALClusterMonitor::MakeHisto(AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr)
80 {
81
82         // Cluster variables
83         // Pointer to Cluster struture
84         AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
85
86         float clusterEne, clusterTime, clusterEta, clusterPhi, clusterX, clusterY, clusterZ;
87         int nCells;
88         if (caloClusterHeaderPtr) {
89           
90           // stuff to handle clusters here
91           fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
92           
93           while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0) {
94                         clusterX = caloClusterStructPtr->fGlobalPos[0];
95                         clusterY = caloClusterStructPtr->fGlobalPos[1];
96                         clusterZ = caloClusterStructPtr->fGlobalPos[2];
97
98                         nCells = caloClusterStructPtr->fNCells;
99                         clusterEne = caloClusterStructPtr->fEnergy;
100                         clusterTime = caloClusterStructPtr->fTOF;
101                 hClusterEne->Fill(clusterEne);
102                 hClusterEneVsTime->Fill(clusterEne, clusterTime);
103                 hClusterCells->Fill(nCells);
104                 hClusterEneVsCells->Fill(clusterEne, nCells);
105                         float r = TMath::Sqrt(clusterX*clusterX + clusterY*clusterY + clusterZ*clusterZ);
106                         clusterEta = 0.5*TMath::Log( (r+clusterZ)/(r-clusterZ) );
107                         clusterPhi = TMath::ATan2(clusterY, clusterX);
108                 hClusterEtaVsPhi->Fill(clusterEta, clusterPhi);
109
110             }
111           
112         }
113
114 return 0; 
115 }