]>
Commit | Line | Data |
---|---|---|
33791895 | 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 TPC processor for the HLT EVE display | |
20 | ||
21 | #include "AliHLTEveTRD.h" | |
22 | #include "AliHLTHOMERBlockDesc.h" | |
23 | #include "TCanvas.h" | |
24 | #include "AliHLTEveBase.h" | |
25 | #include "AliEveHOMERManager.h" | |
26 | #include "TEveManager.h" | |
27 | #include "TEvePointSet.h" | |
28 | #include "TColor.h" | |
29 | #include "TMath.h" | |
30 | #include "TH1F.h" | |
31 | #include "AliHLTTRDCluster.h" | |
32 | #include "AliTRDcluster.h" | |
33 | ||
34 | ClassImp(AliHLTEveTRD) | |
35 | ||
36 | AliHLTEveTRD::AliHLTEveTRD() : | |
37 | AliHLTEveBase(), | |
38 | fEveClusters(NULL), | |
39 | fEveColClusters(NULL), | |
40 | fNColorBins(15) | |
41 | { | |
42 | // Constructor. | |
0fca96b6 | 43 | fEveColClusters = CreatePointSetArray(); |
44 | fEventManager->GetEveManager()->AddElement(fEveColClusters); | |
33791895 | 45 | |
46 | } | |
47 | ||
48 | AliHLTEveTRD::~AliHLTEveTRD() | |
49 | { | |
50 | //Destructor, not implemented | |
51 | if(fEveColClusters) | |
52 | delete fEveColClusters; | |
53 | fEveColClusters = NULL; | |
54 | ||
55 | if(fEveClusters) | |
56 | delete fEveClusters; | |
57 | fEveClusters = NULL; | |
58 | } | |
59 | ||
60 | ||
61 | void AliHLTEveTRD::ProcessBlock(AliHLTHOMERBlockDesc * block) { | |
62 | //See header file for documentation | |
63 | ||
64 | if ( ! block->GetDataType().CompareTo("CLUSTERS") ) { | |
65 | ||
66 | if(!fEveColClusters){ | |
67 | fEveColClusters = CreatePointSetArray(); | |
68 | fEventManager->GetEveManager()->AddElement(fEveColClusters); | |
69 | } | |
70 | ||
cfbfd71f | 71 | ProcessClusters(block, fEveColClusters); |
33791895 | 72 | |
73 | } else if ( ! block->GetDataType().CompareTo("ROOTHIST") ) { | |
74 | ||
2e183639 | 75 | if(!fCanvas) { |
76 | fCanvas = CreateCanvas("TRD QA", "TRD QA"); | |
77 | fCanvas->Divide(3, 2); | |
78 | } | |
79 | ||
33791895 | 80 | AddHistogramsToCanvas(block, fCanvas, fHistoCount); |
81 | ||
82 | } | |
83 | ||
84 | } | |
85 | ||
86 | ||
87 | void AliHLTEveTRD::AddHistogramsToCanvas(AliHLTHOMERBlockDesc* block, TCanvas * canvas, Int_t &cdCount ) { | |
88 | //See header file for documentation | |
89 | if ( ! block->GetClassName().CompareTo("TH1F")) { | |
90 | TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject()); | |
91 | ++cdCount; | |
92 | ||
93 | TVirtualPad* pad = canvas->cd(cdCount); | |
94 | histo->Draw(); | |
95 | pad->SetGridy(); | |
96 | pad->SetGridx(); | |
97 | ||
98 | if ( ! strcmp(histo->GetName(), "nscls") ) { | |
99 | histo->GetXaxis()->SetRangeUser(0.,15.); | |
100 | } | |
101 | ||
102 | if ( ! strcmp(histo->GetName(),"sclsdist") || | |
103 | ! strcmp(histo->GetName(),"evSize") ) | |
104 | pad->SetLogy(); | |
105 | } | |
106 | ||
107 | } | |
108 | ||
109 | ||
110 | ||
111 | TEvePointSet * AliHLTEveTRD::CreatePointSet() { | |
112 | //See header file for documentation | |
113 | TEvePointSet * ps = new TEvePointSet("TRD Clusters"); | |
114 | ps->SetMainColor(kBlue); | |
115 | ps->SetMarkerStyle((Style_t)kFullDotSmall); | |
116 | ||
117 | return ps; | |
118 | ||
119 | } | |
120 | ||
121 | TEvePointSetArray * AliHLTEveTRD::CreatePointSetArray(){ | |
122 | //See header file for documentation | |
123 | TEvePointSetArray * cc = new TEvePointSetArray("TRD Clusters Colorized"); | |
124 | cc->SetMainColor(kRed); | |
125 | cc->SetMarkerStyle(4); // antialiased circle | |
126 | cc->SetMarkerSize(0.4); | |
127 | cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*100.); | |
128 | ||
129 | const Int_t nCol = TColor::GetNumberOfColors(); | |
130 | for (Int_t ii = 0; ii < fNColorBins + 1; ++ii) { | |
131 | cc->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (fNColorBins+2))); | |
132 | } | |
133 | ||
134 | return cc; | |
135 | ||
136 | } | |
137 | ||
138 | ||
139 | void AliHLTEveTRD::UpdateElements() { | |
140 | //See header file for documentation | |
141 | if(fCanvas) fCanvas->Update(); | |
c79c1652 | 142 | // if(fEveClusters) fEveClusters->ResetBBox(); |
33791895 | 143 | |
0fca96b6 | 144 | if(fEveColClusters) { |
145 | for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) { | |
146 | fEveColClusters->GetBin(ib)->ResetBBox(); | |
147 | } | |
e6b89bec | 148 | } |
33791895 | 149 | } |
150 | ||
151 | void AliHLTEveTRD::ResetElements(){ | |
152 | //See header file for documentation | |
c79c1652 | 153 | // if(fEveClusters) fEveClusters->Reset(); |
33791895 | 154 | |
155 | if(fEveColClusters){ | |
156 | for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) { | |
157 | fEveColClusters->GetBin(ib)->Reset(); | |
158 | } | |
159 | } | |
160 | ||
2e183639 | 161 | fHistoCount = 0; |
33791895 | 162 | } |
163 | ||
cfbfd71f | 164 | Int_t AliHLTEveTRD::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSetArray * contCol ){ |
33791895 | 165 | //See header file for documentation |
e6b89bec | 166 | |
33791895 | 167 | Int_t iResult = 0; |
168 | ||
169 | Int_t sm = block->GetSubDetector(); | |
170 | if ( sm == 6 ) sm = 7; | |
171 | ||
172 | Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0; | |
173 | Float_t cos = TMath::Cos( phi ); | |
174 | Float_t sin = TMath::Sin( phi ); | |
175 | ||
176 | Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData()); | |
177 | UInt_t ptrSize = block->GetSize(); | |
178 | ||
179 | for (UInt_t size = 0; size+sizeof(AliHLTTRDCluster) <= ptrSize; size+=sizeof(AliHLTTRDCluster) ) { | |
180 | AliHLTTRDCluster *cluster = reinterpret_cast<AliHLTTRDCluster*>(&(ptrData[size])); | |
181 | ||
182 | AliTRDcluster *trdCluster = new AliTRDcluster; | |
183 | cluster->ExportTRDCluster( trdCluster ); | |
184 | ||
185 | contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(), | |
186 | sin*trdCluster->GetX() + cos*trdCluster->GetY(), | |
187 | trdCluster->GetZ(), | |
188 | trdCluster->GetQ() ); | |
e6b89bec | 189 | |
190 | //cont->SetNextPoint(cos*trdCluster->GetX() - sin*trdCluster->GetY(), | |
191 | // sin*trdCluster->GetX() + cos*trdCluster->GetY(), trdCluster->GetZ()); | |
33791895 | 192 | } |
193 | ||
194 | return iResult; | |
195 | ||
196 | ||
197 | ||
198 | ||
199 | ||
200 | ||
201 | return 0; | |
202 | ||
203 | ||
204 | } | |
205 | ||
206 |