]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/EVE/AliHLTEveITS.cxx
Fixed bugs that made histograms being drawn on top of each other
[u/mrichter/AliRoot.git] / HLT / EVE / AliHLTEveITS.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * ALICE Experiment at CERN, All rights reserved.                         *
4  *                                                                        *
5  * Primary Authors: Svein Lindal <slindal@fys.uio.no   >                  *
6  *                  for The ALICE HLT Project.                            *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /// @file   AliHLTEvePhos.cxx
18 /// @author Svein Lindal <slindal@fys.uio.no>
19 /// @brief  base class for the ITS elements in the HLT EVE display
20
21 #include "AliHLTEveITS.h"
22 #include "AliHLTHOMERBlockDesc.h"
23 #include "TCanvas.h"
24 #include "AliEveHOMERManager.h"
25 #include "TEveManager.h"
26 #include "TH1F.h"
27 #include "TH2F.h"
28 #include "TEvePointSet.h"
29 #include "ITS/AliHLTITSClusterDataFormat.h"
30 #include "AliITSRecPoint.h"
31 #include "TCanvas.h"
32
33 ClassImp(AliHLTEveITS)
34
35 AliHLTEveITS::AliHLTEveITS(TString name) : 
36 AliHLTEveBase(),
37   fName(name), 
38   fPointSet(NULL)
39 {
40   // Constructor.
41 }
42
43 AliHLTEveITS::~AliHLTEveITS()
44 {
45   //Destructor
46   if(fPointSet)
47     delete fPointSet;
48   fPointSet = NULL;
49 }
50
51 void AliHLTEveITS::ProcessBlock(AliHLTHOMERBlockDesc * block) {
52   //See header file for documentation
53  
54   if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
55     if(!fCanvas) {  
56       fCanvas = CreateCanvas(Form("%s QA",fName.Data()), Form("%s QA", fName.Data()));
57       fCanvas->Divide(3, 2);
58     }
59     AddHistogramsToCanvas( block , fCanvas, fHistoCount);
60   } 
61
62   else if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
63     if(!fPointSet) {
64       fPointSet = CreatePointSet(fName);
65       fEventManager->GetEveManager()->AddElement(fPointSet);
66     }
67     ProcessClusters(block, fPointSet);
68   }
69 }
70
71
72 void AliHLTEveITS::UpdateElements() {
73   //See header file for documentation
74   if(fCanvas) fCanvas->Update();
75   if(fPointSet) fPointSet->ElementChanged();
76 }
77
78 void AliHLTEveITS::ResetElements() {
79   //See header file for documentation
80   fHistoCount = 0;
81   if(fPointSet) fPointSet->Reset();
82 }
83
84 TEvePointSet * AliHLTEveITS::CreatePointSet(TString name) {
85   //See header file for documentation
86   TEvePointSet * ps = new TEvePointSet(name.Data());
87   SetUpPointSet(ps);
88   return ps;
89
90
91 void AliHLTEveITS::SetUpPointSet(TEvePointSet * ps ) {
92   //See header file for documentation
93   ps->SetMainColor(kBlack);
94   ps->SetMarkerStyle((Style_t)kFullDotMedium);
95 }
96
97 void AliHLTEveITS::ProcessClusters(AliHLTHOMERBlockDesc * block, TEvePointSet * cont ) {
98   //See header file for documentation
99   AliHLTITSClusterData *cd = reinterpret_cast<AliHLTITSClusterData*> (block->GetData());
100   UChar_t *data            = reinterpret_cast<UChar_t*> (cd->fSpacePoints);
101   
102   if ( cd->fSpacePointCnt != 0 ) {
103     for (UInt_t iter = 0; iter < cd->fSpacePointCnt; ++iter, data += sizeof(AliHLTITSSpacePointData)) {
104       AliHLTITSSpacePointData *sp = reinterpret_cast<AliHLTITSSpacePointData*> (data);
105   
106       Int_t lab[4]   = {0,0,0,0};
107       Float_t hit[6] = {0,0,0,0,0,0};
108       Int_t info[3]  = {0,0,0};
109                                  
110       lab[0]  = sp->fTracks[0];
111       lab[1]  = sp->fTracks[1];
112       lab[2]  = sp->fTracks[2];
113       lab[3]  = sp->fIndex;
114       hit[0]  = sp->fY;
115       hit[1]  = sp->fZ;
116       hit[2]  = sp->fSigmaY2;
117       hit[3]  = sp->fSigmaZ2;
118       hit[4]  = sp->fQ;
119       hit[5]  = sp->fSigmaYZ;
120       info[0] = sp->fNy;
121       info[1] = sp->fNz;
122       info[2] = sp->fLayer;
123       
124       Float_t xyz[3];
125       AliITSRecPoint recpoint(lab,hit,info);
126       recpoint.GetGlobalXYZ(xyz);
127
128       cont->SetNextPoint(xyz[0], xyz[1], xyz[2]);
129     }
130   }
131 }