]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/EVE/AliHLTEveITS.cxx
added new function to extract DDL id from HLT origin and specification, code cleanup
[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 "AliEveHLTEventManager.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(name.Data()),
37   fName(name), 
38   fPointSet(NULL)
39 {
40   // Constructor.
41
42   SetDetector(fName);
43 }
44
45 AliHLTEveITS::~AliHLTEveITS()
46 {
47   //Destructor
48   if(fPointSet)
49     delete fPointSet;
50   fPointSet = NULL;
51 }
52
53 void AliHLTEveITS::ProcessBlock(AliHLTHOMERBlockDesc * block) {
54   //See header file for documentation
55  
56   if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
57     if(!fCanvas) {  
58       fCanvas = CreateCanvas(Form("%s QA",fName.Data()), Form("%s QA", fName.Data()));
59       fCanvas->Divide(3, 3);
60       SetMaxHistograms(9);
61     }
62     AddHistogramsToCanvas( block , fCanvas, fHistoCount);
63   } 
64
65   else if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
66     if(!fPointSet) {
67       fPointSet = CreatePointSet(fName);
68       AddElement(fPointSet);
69     }
70     ProcessClusters(block, fPointSet);
71   }
72 }
73
74
75 void AliHLTEveITS::UpdateElements() {
76   //See header file for documentation
77   if(fCanvas) fCanvas->Update();
78   if(fPointSet) fPointSet->ElementChanged();
79 }
80
81 void AliHLTEveITS::ResetElements() {
82   //See header file for documentation
83   fHistoCount = 0;
84   if(fPointSet) fPointSet->Reset();
85 }
86
87 TEvePointSet * AliHLTEveITS::CreatePointSet(TString name) {
88   //See header file for documentation
89   TEvePointSet * ps = new TEvePointSet(name.Data());
90   SetUpPointSet(ps);
91   return ps;
92
93
94 void AliHLTEveITS::SetUpPointSet(TEvePointSet * ps ) {
95   //See header file for documentation
96   ps->SetMainColor(kBlack);
97   ps->SetMarkerStyle((Style_t)kFullDotMedium);
98 }
99
100 void AliHLTEveITS::ProcessClusters(AliHLTHOMERBlockDesc * block, TEvePointSet * cont ) {
101   //See header file for documentation
102   AliHLTITSClusterData *cd = reinterpret_cast<AliHLTITSClusterData*> (block->GetData());
103   UChar_t *data            = reinterpret_cast<UChar_t*> (cd->fSpacePoints);
104   
105   if ( cd->fSpacePointCnt != 0 ) {
106     for (UInt_t iter = 0; iter < cd->fSpacePointCnt; ++iter, data += sizeof(AliHLTITSSpacePointData)) {
107       AliHLTITSSpacePointData *sp = reinterpret_cast<AliHLTITSSpacePointData*> (data);
108   
109       Int_t lab[4]   = {0,0,0,0};
110       Float_t hit[6] = {0,0,0,0,0,0};
111       Int_t info[3]  = {0,0,0};
112                                  
113       lab[0]  = sp->fTracks[0];
114       lab[1]  = sp->fTracks[1];
115       lab[2]  = sp->fTracks[2];
116       lab[3]  = sp->fIndex;
117       hit[0]  = sp->fY;
118       hit[1]  = sp->fZ;
119       hit[2]  = sp->fSigmaY2;
120       hit[3]  = sp->fSigmaZ2;
121       hit[4]  = sp->fQ;
122       hit[5]  = sp->fSigmaYZ;
123       info[0] = sp->fNy;
124       info[1] = sp->fNz;
125       info[2] = sp->fLayer;
126       
127       Float_t xyz[3];
128       AliITSRecPoint recpoint(lab,hit,info);
129       recpoint.GetGlobalXYZ(xyz);
130
131       cont->SetNextPoint(xyz[0], xyz[1], xyz[2]);
132     }
133   }
134 }