Addeing MultCorr processors
[u/mrichter/AliRoot.git] / HLT / EVE / AliHLTEveMultCorr.cxx
1 #include "AliHLTEveMultCorr.h"
2 #include "TH1F.h"
3 #include "TH2F.h"
4 #include <iostream>
5 #include <TCanvas.h>
6 #include "AliHLTHOMERBlockDesc.h"
7 #include "TList.h"
8
9 AliHLTEveMultCorr::AliHLTEveMultCorr(const char* name): AliHLTEveBase(name)
10         ,fVzeroMultCanvas(0)
11         ,fZdcMultCanvas(0)
12         ,fTpcMultCanvas(0)
13         ,fCorrCanvas(0)
14         ,fEtCorrCanvas(0)
15         ,fZdcVzeroSpdCorrCanvas(0)
16 {
17
18 }
19
20 AliHLTEveMultCorr::~AliHLTEveMultCorr()
21 {
22 }
23
24 void AliHLTEveMultCorr::ResetElements()
25 {
26
27 }
28
29 void AliHLTEveMultCorr::UpdateElements()
30 {
31     fVzeroMultCanvas->Update();
32     fZdcMultCanvas->Update();
33     fTpcMultCanvas->Update();
34     fCorrCanvas->Update();
35     fEtCorrCanvas->Update();
36     fZdcVzeroSpdCorrCanvas->Update();
37
38 }
39
40 void AliHLTEveMultCorr::ProcessBlock(AliHLTHOMERBlockDesc* block)
41 {
42     TList *hlist = dynamic_cast<TList*>(block->GetTObject());
43     if (hlist)
44     {
45
46         if (hlist->Contains("fVzeroMult")) // These are the correlation histograms
47         {
48             TH1F *oneDf = 0;
49             TH2F *twoDf = 0;
50             int cd = 1;
51
52             //VZERO multiplicity hists
53             if (!fVzeroMultCanvas) 
54             {
55               fVzeroMultCanvas = CreateCanvas("V0 Mult", "V0 Multiplicities");
56               fVzeroMultCanvas->Divide(2, 2);
57             }
58             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fVzeroMult"));
59             AddHistogramToCanvas(oneDf, fVzeroMultCanvas, cd);
60             cd++;
61             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fVzeroMultAC"));
62             AddHistogramToCanvas(twoDf, fVzeroMultCanvas, cd);
63             cd++;
64             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fVzeroFlaggedMult"));
65             AddHistogramToCanvas(oneDf, fVzeroMultCanvas, cd);
66             cd++;
67             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fVzeroFlaggedMultAC"));
68             AddHistogramToCanvas(twoDf, fVzeroMultCanvas, cd);
69
70             cd = 1;
71             //ZDC multiplicity hists
72             if (!fZdcMultCanvas) 
73             {
74               fZdcMultCanvas = CreateCanvas("ZDC Mult", "ZDC Multiplicities");
75               fZdcMultCanvas->Divide(2, 4);
76             }
77             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fZdcEzdc"));
78             AddHistogramToCanvas(oneDf, fZdcMultCanvas, cd);
79             cd++;
80             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fZdcEzn"));
81             AddHistogramToCanvas(oneDf, fZdcMultCanvas, cd);
82             cd++;
83             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fZdcEzp"));
84             AddHistogramToCanvas(oneDf, fZdcMultCanvas, cd);
85             cd++;
86             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fZdcEzem"));
87             AddHistogramToCanvas(oneDf, fZdcMultCanvas, cd);
88             cd++;
89             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fZdcNpart"));
90             AddHistogramToCanvas(oneDf, fZdcMultCanvas, cd);
91             cd++;
92             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fZdcB"));
93             AddHistogramToCanvas(oneDf, fZdcMultCanvas, cd);
94             cd++;
95             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fZdcEzemEzdc"));
96             AddHistogramToCanvas(twoDf, fZdcMultCanvas, cd);
97
98             cd = 1;
99             // TPC multiplicity
100             if (!fTpcMultCanvas) 
101             {
102               fTpcMultCanvas = CreateCanvas("TPC Mult", "TPC Multiplicities");
103               fTpcMultCanvas->Divide(2);
104             }
105             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fTpcNch2"));
106             AddHistogramToCanvas(oneDf, fTpcMultCanvas, cd);
107             cd++;
108             oneDf = dynamic_cast<TH1F*>(hlist->FindObject("fTpcNch3"));
109             AddHistogramToCanvas(oneDf, fTpcMultCanvas, cd);
110
111             cd = 1;
112             // Correlations
113             if (!fCorrCanvas) 
114             {
115               fCorrCanvas = CreateCanvas("Correlations", "Multiplicity Correlations");
116               fCorrCanvas->Divide(2, 3);
117             }
118             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrEzdcNch"));
119             AddHistogramToCanvas(twoDf, fCorrCanvas, cd);
120             cd++;
121             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrVzeroNch"));
122             AddHistogramToCanvas(twoDf, fCorrCanvas, cd);
123             cd++;
124             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrSpdTpcNch"));
125             AddHistogramToCanvas(twoDf, fCorrCanvas, cd);
126             cd++;
127             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrEzemNch"));
128             AddHistogramToCanvas(twoDf, fCorrCanvas, cd);
129             cd++;
130             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrEzdcVzero"));
131             AddHistogramToCanvas(twoDf, fCorrCanvas, cd);
132             cd++;
133             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrEzemVzero"));
134             AddHistogramToCanvas(twoDf, fCorrCanvas, cd);
135             
136             cd = 1;
137             // ET Correlations
138             if (!fEtCorrCanvas) 
139             {
140               fEtCorrCanvas = CreateCanvas("E_{T} corr", "E_{T} Correlations");
141               fEtCorrCanvas->Divide(2, 3);
142             }
143             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrZdcTotEvsPhosTotEt"));
144             AddHistogramToCanvas(twoDf, fEtCorrCanvas, cd);
145             cd++;
146             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrZdcTotEvsEmcalTotEt"));
147             AddHistogramToCanvas(twoDf, fEtCorrCanvas, cd);
148             cd++;
149             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrZdcTotEvsTotEt"));
150             AddHistogramToCanvas(twoDf, fEtCorrCanvas, cd);
151             cd++;
152             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrVzerovsPhosTotEt"));
153             AddHistogramToCanvas(twoDf, fEtCorrCanvas, cd);
154             cd++;
155             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrVzerovsEmcalTotEt"));
156             AddHistogramToCanvas(twoDf, fEtCorrCanvas, cd);
157             cd++;
158             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrVzerovsTotEt"));
159             AddHistogramToCanvas(twoDf, fEtCorrCanvas, cd);
160
161             cd = 1;
162             // ZDC,V0 vs SPD
163             if (!fZdcVzeroSpdCorrCanvas) 
164             {
165               fZdcVzeroSpdCorrCanvas = CreateCanvas("ZDC/V0 vs SPD", "ZDC/V0 vs. SPD");
166               fZdcVzeroSpdCorrCanvas->Divide(2, 3);
167               
168             }
169             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrVzeroSpd"));
170             AddHistogramToCanvas(twoDf, fZdcVzeroSpdCorrCanvas, cd);
171             cd++;
172             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrVzeroASpd"));
173             AddHistogramToCanvas(twoDf, fZdcVzeroSpdCorrCanvas, cd);
174             cd++;
175             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrVzeroCSpd"));
176             AddHistogramToCanvas(twoDf, fZdcVzeroSpdCorrCanvas, cd);
177             cd++;
178             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrEzdcSpd"));
179             AddHistogramToCanvas(twoDf, fZdcVzeroSpdCorrCanvas, cd);
180             cd++;
181             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrEzdcASpd"));
182             AddHistogramToCanvas(twoDf, fZdcVzeroSpdCorrCanvas, cd);
183             cd++;
184             twoDf = dynamic_cast<TH2F*>(hlist->FindObject("fCorrEzdcCSpd"));
185             AddHistogramToCanvas(twoDf, fZdcVzeroSpdCorrCanvas, cd);
186         }
187         else
188         {
189             std::cout << "ERROR: This block does not contain what you think it contains!" << std::endl;
190         }
191     }
192     else
193     {
194       std::cout << "ERROR: There is no TList object in the block" << std::endl;
195     }
196
197
198 }
199
200 void AliHLTEveMultCorr::AddHistogramsToCanvas(AliHLTHOMERBlockDesc* /*block*/, TCanvas* /*canvas*/, Int_t& /*cdCount*/)
201 {
202 }
203
204 void AliHLTEveMultCorr::AddHistogramToCanvas(TH1* hist, TCanvas* canvas, Int_t& cdCount)
205 {
206     if (hist)
207     {
208         if (!strcmp(hist->ClassName(), "TH1F"))
209         {
210             canvas->cd(cdCount);
211             dynamic_cast<TH1F*>(hist)->Draw();
212         }
213         else if (!strcmp(hist->ClassName(), "TH2F"))
214         {
215             canvas->cd(cdCount);
216             dynamic_cast<TH2F*>(hist)->Draw("COLZ");
217         }
218         else
219         {
220             std::cout << "I don't want histograms of type " << hist->ClassName() << std::endl;
221         }
222     }
223     else
224     {
225       std::cout << "ERROR (AddHistogramsToCanvas): You gave me a null pointer" << std::endl;
226     }
227 }
228