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