adding SSD cluster QA component (Ingrid & Panos)
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITSSSDQARecPointsComponent.cxx
1 // $Id$
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project        * 
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors: Ingrid Kielen                                         *
7 //*                  for The ALICE HLT Project.                            *
8 //*                                                                        *
9 //* Permission to use, copy, modify and distribute this software and its   *
10 //* documentation strictly for non-commercial purposes is hereby granted   *
11 //* without fee, provided that the above copyright notice appears in all   *
12 //* copies and that both the copyright notice and this permission notice   *
13 //* appear in the supporting documentation. The authors make no claims     *
14 //* about the suitability of this software for any purpose. It is          *
15 //* provided "as is" without express or implied warranty.                  *
16 //**************************************************************************
17
18 /** @file   AliHLTITSSSDQARecPointsComponent.cxx
19     @author Ingrid Kielen
20     @brief  Component for the SSD clusters QA
21 */
22
23 #if __GNUC__>= 3
24 using namespace std;
25 #endif
26
27 #include "AliHLTITSSSDQARecPointsComponent.h"
28 #include "AliHLTITSClusterDataFormat.h"
29 #include "AliCDBEntry.h"
30 #include "AliCDBManager.h"
31 #include "AliITSRecPoint.h"
32 #include <TFile.h>
33 #include <TMath.h>
34 #include <TString.h>
35 #include "TObjString.h"
36 #include "TObjArray.h"
37 #include "AliITSgeomTGeo.h"
38
39 //#include <stdlib.h>
40 //#include <cerrno>
41
42 /** ROOT macro for the implementation of ROOT specific class methods */
43 ClassImp(AliHLTITSSSDQARecPointsComponent)
44
45 AliHLTITSSSDQARecPointsComponent::AliHLTITSSSDQARecPointsComponent()
46   :AliHLTProcessor(),
47 fHistArray(NULL),
48 fHistSSDModuleIdLayer5(NULL),
49 fHistSSDLocalXLayer5(NULL),
50 fHistSSDLocalZLayer5(NULL),
51 fHistSSDGlobalXLayer5(NULL),
52 fHistSSDGlobalYLayer5(NULL),
53 fHistSSDGlobalZLayer5(NULL),
54 fHistSSDPhiLayer5(NULL),
55 fHistSSDThetaLayer5(NULL),
56 fHistSSDRadiusLayer5(NULL),
57 fHistSSDClusterTypeLayer5(NULL),
58 fHistSSDChargeRatioLayer5(NULL),
59 fHistSSDChargekeVLayer5(NULL),
60 fHistSSDChargePSideLayer5(NULL),
61 fHistSSDChargeNSideLayer5(NULL),
62 fHistSSDChargeRatio2Layer5(NULL),
63 fHistSSDChargePNSideLayer5(NULL),
64 fHistSSDChargeMapLayer5(NULL),
65 fHistSSDClusterMapLayer5(NULL),
66 fHistSSDModuleIdLayer6(NULL),
67 fHistSSDLocalXLayer6(NULL),
68 fHistSSDLocalZLayer6(NULL),
69 fHistSSDGlobalXLayer6(NULL),
70 fHistSSDGlobalYLayer6(NULL),
71 fHistSSDGlobalZLayer6(NULL),
72 fHistSSDPhiLayer6(NULL),
73 fHistSSDThetaLayer6(NULL),
74 fHistSSDRadiusLayer6(NULL),
75 fHistSSDClusterTypeLayer6(NULL),
76 fHistSSDChargeRatioLayer6(NULL),
77 fHistSSDChargekeVLayer6(NULL),
78 fHistSSDChargePSideLayer6(NULL),
79 fHistSSDChargeNSideLayer6(NULL),
80 fHistSSDChargeRatio2Layer6(NULL),
81 fHistSSDChargePNSideLayer6(NULL),
82 fHistSSDChargeMapLayer6(NULL),
83 fHistSSDClusterMapLayer6(NULL) {
84   // see header file for class documentation
85   // or
86   // refer to README to build package
87   // or
88   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
89
90 }
91
92 AliHLTITSSSDQARecPointsComponent::~AliHLTITSSSDQARecPointsComponent()
93 {
94   // see header file for class documentation
95 }
96
97 // Public functions to implement AliHLTComponent's interface.
98 // These functions are required for the registration process
99
100 const char* AliHLTITSSSDQARecPointsComponent::GetComponentID()
101 {
102   // see header file for class documentation
103   
104   return "ITSSSDQARecPoints";
105 }
106
107 void AliHLTITSSSDQARecPointsComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list) {
108   // see header file for class documentation
109   list.clear();
110   list.push_back( kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD );
111 }
112
113 AliHLTComponentDataType AliHLTITSSSDQARecPointsComponent::GetOutputDataType() {
114   // see header file for class documentation
115   return kAliHLTDataTypeTObjArray;
116 }
117
118 void AliHLTITSSSDQARecPointsComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
119 {
120   // see header file for class documentation
121   // XXX TODO: Find more realistic values.
122   constBase = 80000;
123   inputMultiplier = 10;
124 }
125
126 AliHLTComponent* AliHLTITSSSDQARecPointsComponent::Spawn()
127 {
128   // see header file for class documentation
129   return new AliHLTITSSSDQARecPointsComponent;
130 }
131
132 int AliHLTITSSSDQARecPointsComponent::DoInit(int argc, const char** argv) {
133   //Inititalization of histograms for the SSD QA component
134
135   Int_t nModuleOffset = 500;
136   Int_t nITSTotalModules = AliITSgeomTGeo::GetNModules();  
137   fHistSSDModuleIdLayer5 = new TH1F("SSD/Statistics/fHistSSDModuleIdLayer5",
138                                     "Module Id - Layer 5;Module Id;Entries",
139                                     fgkSSDMODULESLAYER5,
140                                     nModuleOffset - 0.5,
141                                     nITSTotalModules-fgkSSDMODULESLAYER6+0.5);
142   
143   fHistSSDModuleIdLayer6 = new TH1F("SSD/Statistics/fHistSSDModuleIdLayer6",
144                                     "Module Id - Layer 6;Module Id;Entries",
145                                     fgkSSDMODULESLAYER6,
146                                     nModuleOffset+fgkSSDMODULESLAYER5 - 0.5,
147                                     nITSTotalModules + 0.5);
148   
149   fHistSSDClusterPerEventLayer5 = new TH1F("SSD/Statistics/fHistSSDClusterPerEventLayer5",
150                                            "N_{clusters} - Layer 5;N_{clusters};Entries;",
151                                            100,0.1,5000);
152   
153   fHistSSDClusterPerEventLayer6 = new TH1F("SSD/Statistics/fHistSSDClusterPerEventLayer6",
154                                            "N_{clusters} - Layer 6;N_{clusters};Entries;",
155                                            100,0.1,5000);
156   
157   fHistSSDLocalXLayer5 = new TH1F("SSD/Coordinates/fHistSSDLocalXLayer5",
158                                   "Local x coord.- Layer 5;x [cm];Entries;",
159                                   100,-4.,4.);
160   
161   fHistSSDLocalXLayer6 = new TH1F("SSD/Coordinates/fHistSSDLocalXLayer6",
162                                   "Local x coord.- Layer 6;x [cm];Entries;",
163                                   100,-4.,4.);
164   
165   fHistSSDLocalZLayer5 = new TH1F("SSD/Coordinates/fHistSSDLocalZLayer5",
166                                   "Local z coord.- Layer 5;z [cm];Entries;",
167                                   100,-4.,4.);
168   
169   fHistSSDLocalZLayer6 = new TH1F("SSD/Coordinates/fHistSSDLocalZLayer6",
170                                   "Local z coord.- Layer 6;z [cm];Entries;",
171                                   100,-4.,4.);
172   
173   fHistSSDGlobalXLayer5 = new TH1F("SSD/Coordinates/fHistSSDGlobalXLayer5",
174                                    "Global x - Layer 5;x [cm];Entries;",
175                                    100,-40.,40.);
176   
177   fHistSSDGlobalXLayer6 = new TH1F("SSD/Coordinates/fHistSSDGlobalXLayer6",
178                                    "Global x - Layer 6;x [cm];Entries;",
179                                    100,-45.,45.);
180   
181   fHistSSDGlobalYLayer5 = new TH1F("SSD/Coordinates/fHistSSDGlobalYLayer5",
182                                    "Global y - Layer 5;y [cm];Entries;",
183                                    100,-40.,40);
184   
185   fHistSSDGlobalYLayer6 = new TH1F("SSD/Coordinates/fHistSSDGlobalYLayer6",
186                                    "Global y - Layer 6;y [cm];Entries;",
187                                    100,-45.,45.);
188   
189   fHistSSDGlobalZLayer5 = new TH1F("SSD/Coordinates/fHistSSDGlobalZLayer5",
190                                    "Global z - Layer 5;z [cm];Entries;",
191                                    100,-45.,45);
192   
193   fHistSSDGlobalZLayer6 = new TH1F("SSD/Coordinates/fHistSSDGlobalZLayer6",
194                                    "Global z - Layer 6;z [cm];Entries;",
195                                    100,-55.,55.);
196   
197   fHistSSDPhiLayer5 = new TH1F("SSD/Coordinates/fHistSSDPhiLayer5",
198                                "#phi - Layer 5;#phi [rad];Entries;",
199                                100,-TMath::Pi(),TMath::Pi());
200   
201   fHistSSDPhiLayer6 = new TH1F("SSD/Coordinates/fHistSSDPhiLayer6",
202                                "#phi - Layer 6;#phi [rad];Entries;",
203                                100,-TMath::Pi(),TMath::Pi());
204   
205   fHistSSDThetaLayer5 = new TH1F("SSD/Coordinates/fHistSSDThetaLayer5",
206                                  "#theta - Layer 5;#theta [rad];Entries;",
207                                  100,-TMath::Pi(),TMath::Pi());
208   
209   fHistSSDThetaLayer6 = new TH1F("SSD/Coordinates/fHistSSDThetaLayer6",
210                                  "#theta - Layer 6;#theta [rad];Entries;",
211                                  100,-TMath::Pi(),TMath::Pi());
212   
213   fHistSSDRadiusLayer5 = new TH1F("SSD/Coordinates/fHistSSDRadiusLayer5",
214                                   "r - Layer 5;r [cm];Entries;",
215                                   100,35.,50.);
216   
217   fHistSSDRadiusLayer6 = new TH1F("SSD/Coordinates/fHistSSDRadiusLayer6",
218                                   "r - Layer 6;r [cm];Entries;",
219                                   100,35.,50.);
220   
221   fHistSSDClusterTypeLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDClusterTypeLayer5",
222                                        "CL type - Layer 5;Cluster type;Entries;",
223                                        150,0,150);
224   
225   fHistSSDClusterTypeLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDClusterTypeLayer6",
226                                        "CL type - Layer 6;Cluster type;Entries;",
227                                        150,0,150);
228   
229   fHistSSDChargeRatioLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargeRatioLayer5",
230                                        "Charge ratio - Layer 5;q_{ratio};Entries;",
231                                        100,-2.0,2.0);
232   
233   fHistSSDChargeRatioLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargeRatioLayer6",
234                                        "Charge ratio - Layer 6;q_{ratio};Entries;",
235                                        100,-2.0,2.0);
236   
237   fHistSSDChargeRatio2Layer5 = new TH1F("fHistSSDChargeRatio2Layer5",
238                                         "Charge Ratio qN/qP - Layer 5;q_{N}/q_{P};Entries;",
239                                         100,0,2);
240   fHistSSDChargeRatio2Layer6 = new TH1F("fHistSSDChargeRatio2Layer6",
241                                         "Charge Ratio qN/qP - Layer 6;q_{N}/q_{P};Entries;",
242                                         100,0,2);
243   fHistSSDChargekeVLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargekeVLayer5",
244                                      "Charge - Layer 5;q [keV];Entries;",
245                                      100,0.,300.);
246   
247   fHistSSDChargekeVLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargekeVLayer6",
248                                      "Charge - Layer 6;q [keV];Entries;",
249                                      100,0.,300.);
250   
251   fHistSSDChargePSideLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargePSideLayer5",
252                                        "Charge P- Layer 5;q_{P} [keV];Entries;",
253                                        100,0.,300.);
254   
255   fHistSSDChargePSideLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargePSideLayer6",
256                                        "Charge P- Layer 6;q_{P} [keV];Entries;",
257                                        100,0.,300.);
258   
259   fHistSSDChargeNSideLayer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargeNSideLayer5",
260                                        "Charge N- Layer 5;q_{N} [keV];Entries;",
261                                        100,0.,300.);
262   
263   fHistSSDChargeNSideLayer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargeNSideLayer6",
264                                        "Charge N- Layer 6;q_{N} [keV];Entries;",
265                                        100,0.,300.);
266   
267   fHistSSDChargeRatio2Layer5 = new TH1F("SSD/ClusterCharge/Layer5/fHistSSDChargeRatio2Layer5",
268                                         "Charge Ratio qN/qP - Layer 5;q_{N}/q_{P};Entries;",
269                                         100,0,2);
270   
271   fHistSSDChargeRatio2Layer6 = new TH1F("SSD/ClusterCharge/Layer6/fHistSSDChargeRatio2Layer6",
272                                         "Charge Ratio qN/qP - Layer 6;q_{N}/q_{P};Entries;",
273                                         100,0,2);
274   
275   fHistSSDChargePNSideLayer5 = new TH2F("SSD/ClusterCharge/Layer5/fHistSSDChargePNSideLayer5",
276                                         "Charge correlation - Layer 5;q_{P} [keV];q_{N} [keV]",
277                                         100,0.,300.,
278                                         100,0.,300.);
279   
280   fHistSSDChargePNSideLayer6 = new TH2F("SSD/ClusterCharge/Layer6/fHistSSDChargePNSideLayer6",
281                                         "Charge correlation - Layer 6;q_{P} [keV];q_{N} [keV]",
282                                         100,0.,300.,
283                                         100,0.,300.);
284   
285   fHistSSDChargeMapLayer5 = new TH2F("SSD/ClusterCharge/Layer5/fHistSSDChargeMapLayer5",
286                                      "Charge map;N_{modules};N_{Ladders}",
287                                      fgkSSDMODULESPERLADDERLAYER5,
288                                      -0.5,fgkSSDMODULESPERLADDERLAYER5+0.5,
289                                      3*fgkSSDLADDERSLAYER5,
290                                      -0.5,fgkSSDLADDERSLAYER5+0.5);
291   
292   fHistSSDChargeMapLayer6 = new TH2F("SSD/ClusterCharge/Layer6/fHistSSDChargeMapLayer6",
293                                      "Charge map;N_{modules};N_{Ladders}",
294                                      fgkSSDMODULESPERLADDERLAYER6,
295                                      -0.5,fgkSSDMODULESPERLADDERLAYER6+0.5,
296                                      3*fgkSSDLADDERSLAYER6,
297                                      -0.5,fgkSSDLADDERSLAYER6+0.5);
298   
299   fHistSSDClusterMapLayer5 = new TH2F("SSD/Statistics/Layer5/fHistSSDClusterMapLayer5",
300                                       "Layer 5;N_{module};N_{ladder}",
301                                       22,1,23,
302                                       34,500,534);
303   fHistSSDClusterMapLayer5->GetXaxis()->SetTitleColor(1);
304   fHistSSDClusterMapLayer5->SetStats(kFALSE);
305   fHistSSDClusterMapLayer5->GetYaxis()->SetTitleOffset(1.8);
306   fHistSSDClusterMapLayer5->GetXaxis()->SetNdivisions(22);
307   fHistSSDClusterMapLayer5->GetYaxis()->SetNdivisions(34);
308   fHistSSDClusterMapLayer5->GetXaxis()->SetLabelSize(0.03);
309   fHistSSDClusterMapLayer5->GetYaxis()->SetLabelSize(0.03);
310   fHistSSDClusterMapLayer5->GetZaxis()->SetTitleOffset(1.4);
311   fHistSSDClusterMapLayer5->GetZaxis()->SetTitle("N_{clusters}");
312   
313   fHistSSDClusterMapLayer6 = new TH2F("SSD/Statistics/Layer6/fHistSSDClusterMapLayer6",
314                                       "Layer 6;N_{module};N_{ladder}",
315                                       25,1,26,
316                                       38,600,638);
317   fHistSSDClusterMapLayer6->GetXaxis()->SetTitleColor(1);
318   fHistSSDClusterMapLayer6->SetStats(kFALSE);
319   fHistSSDClusterMapLayer6->GetYaxis()->SetTitleOffset(1.8);
320   fHistSSDClusterMapLayer6->GetXaxis()->SetNdivisions(25);
321   fHistSSDClusterMapLayer6->GetYaxis()->SetNdivisions(38);
322   fHistSSDClusterMapLayer6->GetXaxis()->SetLabelSize(0.03);
323   fHistSSDClusterMapLayer6->GetYaxis()->SetLabelSize(0.03);
324   fHistSSDClusterMapLayer6->GetZaxis()->SetTitleOffset(1.4);
325   fHistSSDClusterMapLayer6->GetZaxis()->SetTitle("N_{clusters}");
326
327   HLTInfo("Finished initialization of SSD histograms");  
328
329   return 0; 
330  
331 }
332   
333 int AliHLTITSSSDQARecPointsComponent::DoDeinit() {
334   // see header file for class documentation
335   if(fHistSSDModuleIdLayer5) delete fHistSSDModuleIdLayer5;
336   if(fHistSSDModuleIdLayer6) delete fHistSSDModuleIdLayer6;    
337   if(fHistSSDClusterPerEventLayer5) delete fHistSSDClusterPerEventLayer5;
338   if(fHistSSDClusterPerEventLayer6) delete fHistSSDClusterPerEventLayer6;   
339   if(fHistSSDLocalXLayer5) delete fHistSSDLocalXLayer5;
340   if(fHistSSDLocalXLayer6) delete fHistSSDLocalXLayer6;   
341   if(fHistSSDLocalZLayer5) delete fHistSSDLocalZLayer5;
342   if(fHistSSDLocalZLayer6) delete fHistSSDLocalZLayer6;   
343   if(fHistSSDGlobalXLayer5) delete fHistSSDGlobalXLayer5;
344   if(fHistSSDGlobalXLayer6) delete fHistSSDGlobalXLayer6;   
345   if(fHistSSDGlobalYLayer5) delete fHistSSDGlobalYLayer5;
346   if(fHistSSDGlobalYLayer6) delete fHistSSDGlobalYLayer6;   
347   if(fHistSSDGlobalZLayer5) delete fHistSSDGlobalZLayer5;
348   if(fHistSSDGlobalZLayer6) delete fHistSSDGlobalZLayer6;   
349   if(fHistSSDPhiLayer5) delete fHistSSDPhiLayer5;
350   if(fHistSSDPhiLayer6) delete fHistSSDPhiLayer6;      
351   if(fHistSSDThetaLayer5) delete fHistSSDThetaLayer5;
352   if(fHistSSDThetaLayer6) delete fHistSSDThetaLayer6;      
353   if(fHistSSDRadiusLayer5) delete fHistSSDRadiusLayer5;
354   if(fHistSSDRadiusLayer6) delete fHistSSDRadiusLayer6;         
355   if(fHistSSDClusterTypeLayer5) delete fHistSSDClusterTypeLayer5;
356   if(fHistSSDClusterTypeLayer6) delete fHistSSDClusterTypeLayer6;         
357   if(fHistSSDChargeRatioLayer5) delete fHistSSDChargeRatioLayer5;
358   if(fHistSSDChargeRatioLayer6) delete fHistSSDChargeRatioLayer6;         
359   if(fHistSSDChargekeVLayer5) delete fHistSSDChargekeVLayer5;
360   if(fHistSSDChargekeVLayer6) delete fHistSSDChargekeVLayer6;         
361   if(fHistSSDChargePSideLayer5) delete fHistSSDChargePSideLayer5;
362   if(fHistSSDChargePSideLayer6) delete fHistSSDChargePSideLayer6;         
363   if(fHistSSDChargeNSideLayer5) delete fHistSSDChargeNSideLayer5;
364   if(fHistSSDChargeNSideLayer6) delete fHistSSDChargeNSideLayer6;         
365   if(fHistSSDChargeRatio2Layer5) delete fHistSSDChargeRatio2Layer5;
366   if(fHistSSDChargeRatio2Layer6) delete fHistSSDChargeRatio2Layer6;               
367   if(fHistSSDChargePNSideLayer5) delete fHistSSDChargePNSideLayer5;
368   if(fHistSSDChargePNSideLayer6) delete fHistSSDChargePNSideLayer6;         
369   if(fHistSSDChargeMapLayer5) delete fHistSSDChargeMapLayer5;
370   if(fHistSSDChargeMapLayer6) delete fHistSSDChargeMapLayer6;         
371   if(fHistSSDClusterMapLayer5) delete fHistSSDClusterMapLayer5;
372   if(fHistSSDClusterMapLayer6) delete fHistSSDClusterMapLayer6; 
373   return 0;
374 }
375
376 int AliHLTITSSSDQARecPointsComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
377 {
378   
379   int TotalSpacePoint = 0;
380     
381   const AliHLTComponentBlockData* iter = NULL;
382   
383   if(!IsDataEvent())
384     return 0;
385    
386  for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters); iter != NULL; iter = GetNextInputBlock() ) {
387     
388     if(iter->fDataType!=(kAliHLTAnyDataType|kAliHLTDataOriginITSSSD))
389        continue;
390
391     const AliHLTITSClusterData* clusterData = (const AliHLTITSClusterData*) iter->fPtr;
392     Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
393     TotalSpacePoint += nSpacepoint;
394     AliHLTITSSpacePointData *clusters = (AliHLTITSSpacePointData*) clusterData->fSpacePoints;
395
396     for(int i=0;i<nSpacepoint;i++){ //cluster loop
397       Int_t lab[4]={0,0,0,0};
398       Float_t hit[6]={0,0,0,0,0,0};
399       Int_t info[3]={0,0,0};
400       
401       lab[0]=clusters[i].fTracks[0];
402       lab[1]=clusters[i].fTracks[1];
403       lab[2]=clusters[i].fTracks[2];
404       lab[3]=clusters[i].fIndex;
405       hit[0]=clusters[i].fY;
406       hit[1]=clusters[i].fZ;
407       hit[2]=clusters[i].fSigmaY2;
408       hit[3]=clusters[i].fSigmaZ2;
409       hit[4]=clusters[i].fQ;
410       hit[5]=clusters[i].fSigmaYZ;
411       info[0]=clusters[i].fNy;
412       info[1]=clusters[i].fNz;
413       info[2]=clusters[i].fLayer;
414
415       AliITSRecPoint recp(lab,hit,info);
416      
417      Int_t module = 0;
418      Int_t gLayer = 0, gLadder = 0, gModule = 0;
419      Int_t lLadderLocationY = 0;
420       
421      Int_t nClustersLayer5 = 0, nClustersLayer6 = 0;   
422      Float_t cluglo[3]={0.,0.,0.}; 
423      
424      Int_t layer = recp.GetLayer();
425      if (layer == 4) module = recp.GetDetectorIndex() + 500;
426      if (layer == 5) module = recp.GetDetectorIndex() + 1248;
427
428      AliITSgeomTGeo::GetModuleId(module,gLayer,gLadder,gModule);
429      lLadderLocationY = 3*gLadder; 
430
431      recp.GetGlobalXYZ(cluglo);
432      Float_t radius = TMath::Sqrt(cluglo[0]*cluglo[0]+cluglo[1]*cluglo[1]); 
433      Float_t phi = TMath::ATan2(cluglo[1],cluglo[0]);
434      Float_t theta = TMath::ATan2(radius,cluglo[2]);
435      Double_t chargeRatio = recp.GetChargeRatio();
436      Double_t clusterCharge = recp.GetQ();
437      Double_t chargePSide = clusterCharge*(1. + chargeRatio);
438      Double_t chargeNSide = clusterCharge*(1. - chargeRatio);
439      
440       if(layer == 4) {
441         fHistSSDModuleIdLayer5->Fill(module);
442         fHistSSDLocalXLayer5->Fill(recp.GetDetLocalX());
443         fHistSSDLocalZLayer5->Fill(recp.GetDetLocalZ());
444         fHistSSDGlobalXLayer5->Fill(cluglo[0]);
445         fHistSSDGlobalYLayer5->Fill(cluglo[1]);
446         fHistSSDGlobalZLayer5->Fill(cluglo[2]);
447         fHistSSDPhiLayer5->Fill(phi);
448         fHistSSDThetaLayer5->Fill(theta);
449         fHistSSDRadiusLayer5->Fill(radius);
450         fHistSSDClusterTypeLayer5->Fill(recp.GetType());
451         fHistSSDChargeRatioLayer5->Fill(recp.GetChargeRatio());
452         fHistSSDChargekeVLayer5->Fill(recp.GetQ());
453         fHistSSDChargePSideLayer5->Fill(chargePSide);
454         fHistSSDChargeNSideLayer5->Fill(chargeNSide);
455         if(chargePSide != 0.) fHistSSDChargeRatio2Layer5->Fill(chargeNSide/chargePSide);
456         fHistSSDChargePNSideLayer5->Fill(chargePSide,chargeNSide);
457         fHistSSDChargeMapLayer5->SetBinContent(gModule,lLadderLocationY,recp.GetQ());
458         ((TH2F *)fHistSSDClusterMapLayer5)->Fill(gModule,499+gLadder,1);
459         nClustersLayer5 += 1;
460       }//layer 5 histograms
461       if(layer == 5) {
462         fHistSSDModuleIdLayer6->Fill(module);
463         fHistSSDLocalXLayer6->Fill(recp.GetDetLocalX());
464         fHistSSDLocalZLayer6->Fill(recp.GetDetLocalZ());
465         fHistSSDGlobalXLayer6->Fill(cluglo[0]);
466         fHistSSDGlobalYLayer6->Fill(cluglo[1]);
467         fHistSSDGlobalZLayer6->Fill(cluglo[2]);
468         fHistSSDPhiLayer6->Fill(phi);
469         fHistSSDThetaLayer6->Fill(theta);
470         fHistSSDRadiusLayer6->Fill(radius);
471         fHistSSDClusterTypeLayer6->Fill(recp.GetType());
472         fHistSSDChargeRatioLayer6->Fill(recp.GetChargeRatio());
473         fHistSSDChargekeVLayer6->Fill(recp.GetQ());
474         fHistSSDChargePSideLayer6->Fill(chargePSide);
475         fHistSSDChargeNSideLayer6->Fill(chargeNSide);
476         if(chargePSide != 0.) fHistSSDChargeRatio2Layer6->Fill(chargeNSide/chargePSide);
477         fHistSSDChargePNSideLayer6->Fill(chargePSide,chargeNSide);
478         fHistSSDChargeMapLayer6->SetBinContent(gModule,lLadderLocationY,recp.GetQ());
479         ((TH2F *)fHistSSDClusterMapLayer6)->Fill(gModule,599+gLadder,1);
480         nClustersLayer6 += 1;
481       }//layer 6 histograms
482     }//cluster loop
483   }//input block
484       
485     //Write all histograms in TObjArray
486     fHistArray = new TObjArray; 
487     fHistArray->AddLast(fHistSSDModuleIdLayer5); 
488     fHistArray->AddLast(fHistSSDLocalXLayer5); 
489     fHistArray->AddLast(fHistSSDLocalZLayer5); 
490     fHistArray->AddLast(fHistSSDGlobalXLayer5); 
491     fHistArray->AddLast(fHistSSDGlobalYLayer5); 
492     fHistArray->AddLast(fHistSSDGlobalZLayer5); 
493     fHistArray->AddLast(fHistSSDPhiLayer5); 
494     fHistArray->AddLast(fHistSSDThetaLayer5); 
495     fHistArray->AddLast(fHistSSDRadiusLayer5); 
496     fHistArray->AddLast(fHistSSDClusterTypeLayer5); 
497     fHistArray->AddLast(fHistSSDChargeRatioLayer5); 
498     fHistArray->AddLast(fHistSSDChargekeVLayer5); 
499     fHistArray->AddLast(fHistSSDChargePSideLayer5); 
500     fHistArray->AddLast(fHistSSDChargeNSideLayer5); 
501     fHistArray->AddLast(fHistSSDChargeRatio2Layer5); 
502     fHistArray->AddLast(fHistSSDChargePNSideLayer5); 
503     fHistArray->AddLast(fHistSSDChargeMapLayer5); 
504     fHistArray->AddLast(fHistSSDClusterMapLayer5);  
505     fHistArray->AddLast(fHistSSDModuleIdLayer6); 
506     fHistArray->AddLast(fHistSSDLocalXLayer6); 
507     fHistArray->AddLast(fHistSSDLocalZLayer6); 
508     fHistArray->AddLast(fHistSSDGlobalXLayer6); 
509     fHistArray->AddLast(fHistSSDGlobalYLayer6); 
510     fHistArray->AddLast(fHistSSDGlobalZLayer6); 
511     fHistArray->AddLast(fHistSSDPhiLayer6); 
512     fHistArray->AddLast(fHistSSDThetaLayer6); 
513     fHistArray->AddLast(fHistSSDRadiusLayer6); 
514     fHistArray->AddLast(fHistSSDClusterTypeLayer6); 
515     fHistArray->AddLast(fHistSSDChargeRatioLayer6); 
516     fHistArray->AddLast(fHistSSDChargekeVLayer6); 
517     fHistArray->AddLast(fHistSSDChargePSideLayer6); 
518     fHistArray->AddLast(fHistSSDChargeNSideLayer6); 
519     fHistArray->AddLast(fHistSSDChargeRatio2Layer6); 
520     fHistArray->AddLast(fHistSSDChargePNSideLayer6); 
521     fHistArray->AddLast(fHistSSDChargeMapLayer6); 
522     fHistArray->AddLast(fHistSSDClusterMapLayer6); 
523
524     //Publish array
525     AliHLTUInt32_t fSpecification = 0x0;
526     PushBack( (TObjArray*) fHistArray,kAliHLTDataTypeTObjArray,fSpecification);
527   return 0;
528 }