coverity 15108 fixed
[u/mrichter/AliRoot.git] / HLT / EVE / AliHLTEveHLT.cxx
CommitLineData
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 HLT class for the HLT EVE display
20
21#include "AliHLTEveHLT.h"
22#include "AliHLTHOMERBlockDesc.h"
23#include "AliHLTEveBase.h"
fd2adb88 24#include "AliEveHLTEventManager.h"
c8fc4838 25#include "AliHLTGlobalTriggerDecision.h"
33791895 26#include "TEveManager.h"
27#include "TEvePointSet.h"
28#include "TEveTrack.h"
73ac9862 29#include "TEveElement.h"
33791895 30#include "TCanvas.h"
31#include "AliESDEvent.h"
4883ef27 32#include "AliESDtrack.h"
33791895 33#include "TEveTrackPropagator.h"
34#include "AliEveTrack.h"
35#include "TEveVSDStructs.h"
36#include "TString.h"
37#include "TPCLib/tracking-ca/AliHLTTPCCATrackParam.h"
38#include "TPCLib/tracking-ca/AliHLTTPCCATrackConvertor.h"
39#include "AliEveMagField.h"
f1a55ef4 40#include "TH1.h"
33791895 41#include "TH1F.h"
42#include "TH2F.h"
fd2adb88 43#include "TThread.h"
33791895 44
45ClassImp(AliHLTEveHLT)
46
47AliHLTEveHLT::AliHLTEveHLT() :
fd2adb88 48 AliHLTEveBase("TPC tracks"),
33791895 49 fTrueField(kFALSE),
50 fUseIpOnFailedITS(kFALSE),
51 fUseRkStepper(kFALSE),
353f10b3 52 fTrackList(NULL),
73ac9862 53 fTrackLists(NULL),
fd2adb88 54 fOldTrackList(NULL),
bc1a13f1 55 fPointSetVertex(NULL),
353f10b3 56 fTrCanvas(NULL),
f1a55ef4 57 fVertexCanvas(NULL),
353f10b3 58 fHistEta(NULL),
353f10b3 59 fHistPhi(NULL),
60 fHistnClusters(NULL),
f1a55ef4 61 fHistMult(NULL),
4883ef27 62 fHistDCAr(NULL),
f1a55ef4 63 fTrCount(0),
73ac9862 64 fVCount(0),
65 fNTrackBins(10)
33791895 66{
67 // Constructor.
4883ef27 68 CreateHistograms();
69
33791895 70}
c8fc4838 71///___________________________________________________________________
33791895 72AliHLTEveHLT::~AliHLTEveHLT()
73{
74 //Destructor, not implemented
75 if(fTrackList)
76 delete fTrackList;
77 fTrackList = NULL;
73ac9862 78
79 if(fTrackLists)
80 delete fTrackLists;
81 fTrackLists = NULL;
82
83
353f10b3 84}
4883ef27 85
73ac9862 86
4883ef27 87///________________________________________________________________________
88void AliHLTEveHLT::CreateHistograms(){
89 //See header file for documentation
90
91 //fHistPt = new TH1F("fHistPt", "transverse momentum", 100, 0, 10); // KK
92 //fHistP = new TH1F("fHistP", "signed momentum", 100,-7, 7);
93
94 //fHistPt ->SetXTitle("p_{t} (GeV/c)"); // KK
95 //fHistP ->SetXTitle("P*charge (GeV/c)");
96
97 // fHistTheta = new TH1F("fHistTheta", "polar angle", 180, 0,180);
98 // fHistTheta->SetXTitle("#theta (degrees)");
99
100 fHistEta = new TH1F("fHistEta", "pseudorapidity", 100,-2, 2);
101 fHistEta ->SetXTitle("#eta");
102
103 fHistPhi = new TH1F("fHistPhi", "azimuthal angle", 180, 0,360);
104 fHistPhi ->SetXTitle("#phi (degrees)");
105
106 fHistnClusters = new TH1F("fHistnClusters","TPC clusters per track", 160, 0,160);
107
437159d3 108 fHistMult = new TH1F("fHistMult", "event track multiplicity",150, 0, 15000);
4883ef27 109
110 fHistDCAr = new TH1F("fHistDCAr", "DCA r", 200, -100, 100);
111
112}
113
114
fd2adb88 115///_____________________________________________________________________
33791895 116void AliHLTEveHLT::ProcessBlock(AliHLTHOMERBlockDesc * block) {
117 //See header file for documentation
118 if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
73ac9862 119 ProcessEsdBlock(block);
33791895 120 }
121
122 else if ( ! block->GetDataType().CompareTo("ROOTTOBJ") ) {
123 //processROOTTOBJ( block, gHLTText );
124 }
125
126 else if ( ! block->GetDataType().CompareTo("HLTRDLST") ) {
c8fc4838 127 cout << "ignoring hlt rdlst"<<endl;
33791895 128 //processHLTRDLST( block );
129 }
130
c8fc4838 131 else if ( ! block->GetDataType().CompareTo("GLOBTRIG") ) {
132 ProcessGlobalTrigger( block );
133 }
134
33791895 135 else if ( !block->GetDataType().CompareTo("ROOTHIST") ) {
136 if( !fCanvas ) {
4883ef27 137 fCanvas = CreateCanvas("PVtx/Tr QA", "PrimV");
138 fCanvas->Divide(3, 3);
33791895 139 }
140 ProcessHistograms( block , fCanvas);
fd2adb88 141 }
33791895 142}
143
fd2adb88 144///____________________________________________________________________________
33791895 145void AliHLTEveHLT::UpdateElements() {
146 //See header file for documentation
73ac9862 147
4883ef27 148 DrawHistograms();
73ac9862 149
150 if(fTrackLists) {
151 for(Int_t il = 0; il < fNTrackBins; il++) {
152 TEveTrackList * trackList = dynamic_cast<TEveTrackList*>(fTrackLists->FindChild(Form("Tracks_%d", il)));
040245b5 153 if(trackList) trackList->ElementChanged();
73ac9862 154 }
155 }
156
bc1a13f1 157 if(fPointSetVertex) fPointSetVertex->ResetBBox();
f1a55ef4 158 if(fTrCanvas) fTrCanvas->Update();
159 if(fVertexCanvas) fVertexCanvas->Update();
160 if(fCanvas) fCanvas->Update();
161
33791895 162}
73ac9862 163
fd2adb88 164///_________________________________________________________________________________
33791895 165void AliHLTEveHLT::ResetElements(){
fd2adb88 166 //See header file for documentation
167
168 cout << "destroy"<<endl;
73ac9862 169
170 if(fTrackLists) {
171 for(Int_t il = 0; il < fNTrackBins; il++) {
172 TEveTrackList * trackList = dynamic_cast<TEveTrackList*>(fTrackLists->FindChild(Form("Tracks_%d", il)));
040245b5 173 if(trackList) trackList->DestroyElements();
73ac9862 174 }
fd2adb88 175 }
73ac9862 176
fd2adb88 177
2d91aa68 178 fTrCount = 0;
179 fVCount = 0;
180
bc1a13f1 181 if(fPointSetVertex) fPointSetVertex->Reset();
fd2adb88 182 cout<< "reset done"<<endl;
33791895 183 fHistoCount = 0;
184
185}
186
fd2adb88 187///_____________________________________________________________________________________
188void * AliHLTEveHLT::DestroyGarbage(void * arg) {
189 AliHLTEveHLT * hlt = reinterpret_cast<AliHLTEveHLT*>(arg);
190 if(hlt) hlt->DestroyOldTrackList();
191 return (void*)0;
192}
193///_____________________________________________________________________________________
194void AliHLTEveHLT::DestroyOldTrackList() {
195 cout << "Destroying the old tracklist's elements"<<endl;
196 fOldTrackList->DestroyElements();
197 cout << "Destroying the old tracklist itself"<<endl;
198 fOldTrackList->Destroy();
199}
200
201///_____________________________________________________________________________________
33791895 202void AliHLTEveHLT::ProcessHistograms(AliHLTHOMERBlockDesc * block, TCanvas * canvas) {
203 //See header file for documentation
f1a55ef4 204 if (!fTrCanvas) {
4883ef27 205 fTrCanvas = CreateCanvas("ESD", "ESD");
f1a55ef4 206 fTrCanvas->Divide(4, 2);
207 }
4883ef27 208
f1a55ef4 209 if(!fVertexCanvas) {
4883ef27 210 fVertexCanvas = CreateCanvas("Vtx", "Vtx");
f1a55ef4 211 fVertexCanvas->Divide(4, 2);
212 }
213
214
215
33791895 216 if ( ! block->GetClassName().CompareTo("TH1F")) {
217 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
218 if( histo ){
219 TString name(histo->GetName());
f1a55ef4 220 cout << "TH1F " <<name << endl;
33791895 221 if( !name.CompareTo("primVertexZ") ){
222 canvas->cd(2);
223 histo->Draw();
224 }else if( !name.CompareTo("primVertexX") ){
225 canvas->cd(3);
226 histo->Draw();
227 }else if( !name.CompareTo("primVertexY") ){
228 canvas->cd(4);
229 histo->Draw();
f1a55ef4 230 } else if ( name.Contains("Track")) {
231 AddHistogramToCanvas(histo, fTrCanvas, fTrCount);
232 } else {
233 AddHistogramToCanvas(histo, fVertexCanvas, fVCount);
33791895 234 }
235 }
236 } else if ( ! block->GetClassName().CompareTo("TH2F")) {
237 TH2F *hista = reinterpret_cast<TH2F*>(block->GetTObject());
238 if (hista ){
239 TString name(hista->GetName());
f1a55ef4 240 cout << "TH2F " << name << endl;
33791895 241 if( !name.CompareTo("primVertexXY")) {
242 canvas->cd(1);
243 hista->Draw();
f1a55ef4 244 } else if ( name.Contains("Track")) {
245 AddHistogramToCanvas(hista, fTrCanvas, fTrCount);
246 } else {
247 AddHistogramToCanvas(hista, fVertexCanvas, fVCount);
248 }
33791895 249 }
250 }
251 canvas->cd();
33791895 252}
253
f1a55ef4 254///_____________________________________________________________________________________
255void AliHLTEveHLT::AddHistogramToCanvas(TH1* histogram, TCanvas * canvas, Int_t &cdCount) {
256 canvas->cd(++cdCount);
257 histogram->Draw();
258}
259
260
fd7a3071 261///________________________________________________________________________________________
33791895 262void AliHLTEveHLT::CreateTrackList() {
263 //See header file for documentation
264 fTrackList = new TEveTrackList("ESD Tracks");
73ac9862 265 fTrackList->SetMainColor(kOrange);
fd2adb88 266 AddElement(fTrackList);
33791895 267}
73ac9862 268
269///________________________________________________________________________________________
270void AliHLTEveHLT::CreateTrackLists() {
271 //See header file for documentation
272 fTrackLists = new TEveElementList("ESD Track lists");
273 AddElement(fTrackLists);
274 for(Int_t i = 0; i < 10; i++) {
275 TEveTrackList * trackList = new TEveTrackList(Form("Tracks_%d", i));
276 trackList->SetMainColor(kOrange-i);
277 fTrackLists->AddElement(trackList);
278 }
279}
280
33791895 281
fd7a3071 282///_________________________________________________________________________________________
bc1a13f1 283void AliHLTEveHLT::CreateVertexPointSet() {
284 //See header file for documentation
285 fPointSetVertex = new TEvePointSet("Primary Vertex");
286 fPointSetVertex->SetMainColor(6);
287 fPointSetVertex->SetMarkerStyle((Style_t)kFullStar);
288
fd2adb88 289 AddElement(fPointSetVertex);
bc1a13f1 290}
291
c8fc4838 292///________________________________________________________________________
293void AliHLTEveHLT::ProcessGlobalTrigger( AliHLTHOMERBlockDesc * block ) {
294 //See header file for documentation
295 AliHLTGlobalTriggerDecision * decision = dynamic_cast<AliHLTGlobalTriggerDecision*>(block->GetTObject());
040245b5 296 if(decision) decision->Print();
c8fc4838 297
298}
299
33791895 300
c8fc4838 301///______________________________________________________________________
73ac9862 302void AliHLTEveHLT::ProcessEsdBlock( AliHLTHOMERBlockDesc * block) {
33791895 303 //See header file for documentation
304
305 AliESDEvent* esd = (AliESDEvent *) (block->GetTObject());
fd2adb88 306 if (!esd) return;
307
73ac9862 308 ProcessEsdEvent(esd);
309}
310
311
312
313///_________________________________________________________________________________
314Color_t AliHLTEveHLT::GetColor(Float_t pt) {
315 //See header file
316 Color_t baseColor = kOrange;
317
318 Float_t binlimit = 0.1;
319 for(Int_t i = 0; i< 10; i++) {
320
321 if (pt < binlimit)
322 return baseColor - i;
323
324 binlimit +=0.1;
325 }
326
327 return baseColor - 9;
328
fd2adb88 329}
73ac9862 330
331///_________________________________________________________________________________
332Int_t AliHLTEveHLT::GetColorBin(Float_t pt) {
333 //See header file
334
335 Float_t binlimit = 0.1;
336 for(Int_t i = 0; i< 10; i++) {
337
338 if (pt < binlimit)
339 return i;
340
341 binlimit +=0.1;
342 }
343
344 return 9;
345
346}
347
348///____________________________________________________________________
349void AliHLTEveHLT::ProcessEsdEvent( AliESDEvent * esd ) {
350 //See header file for documentation
351 if(!fPointSetVertex) CreateVertexPointSet();
352 if(!fTrackLists) CreateTrackLists();
fd2adb88 353
fd7a3071 354 cout << "ProcessESDEvent() :"<< esd->GetEventNumberInFile()<< " " << esd->GetNumberOfCaloClusters() << " tracks : " << esd->GetNumberOfTracks() << endl;
fd2adb88 355
356 //fEventManager->SetRunNumber(esd->GetRunNumber());
357
bc1a13f1 358 Double_t vertex[3];
cb9a310a 359 const AliESDVertex * esdVertex = esd->GetPrimaryVertex();
bc1a13f1 360
cb9a310a 361 if(esdVertex) {
362 esdVertex->GetXYZ(vertex);
363 fPointSetVertex->SetNextPoint(vertex[0], vertex[1], vertex[2]);
364 }
33791895 365
040245b5 366 TEveTrackList * trackList = dynamic_cast<TEveTrackList*>(fTrackLists->FirstChild());
367 if(trackList) SetUpTrackPropagator(trackList->GetPropagator(),-0.1*esd->GetMagneticField(), 520);
33791895 368 for (Int_t iter = 0; iter < esd->GetNumberOfTracks(); ++iter) {
4883ef27 369
73ac9862 370 AliESDtrack * esdTrack = dynamic_cast<AliESDtrack*>(esd->GetTrack(iter));
371 FillTrackList(esdTrack);
372 FillHistograms(esdTrack);
353f10b3 373
33791895 374 }
4883ef27 375 fHistMult->Fill(esd->GetNumberOfTracks()); // KK
33791895 376
73ac9862 377 //BALLE hardcoded size
378 for(Int_t il = 0; il < fNTrackBins; il++) {
040245b5 379 trackList = dynamic_cast<TEveTrackList*>(fTrackLists->FindChild(Form("Tracks_%d", il)));
73ac9862 380 trackList->MakeTracks();
381 }
382}
383///__________________________________________________________________________
384void AliHLTEveHLT::FillTrackList(AliESDtrack * esdTrack) {
385 //See header file for documentation
040245b5 386 TEveTrackList * trackList = dynamic_cast<TEveTrackList*>(fTrackLists->FirstChild());
387 if (!trackList) return;
388
389 AliEveTrack* track = dynamic_cast<AliEveTrack*>(MakeEsdTrack(esdTrack, trackList));
73ac9862 390 Int_t bin = GetColorBin(esdTrack->Pt());
040245b5 391 trackList = dynamic_cast<TEveTrackList*>(fTrackLists->FindChild(Form("Tracks_%d", bin)));
73ac9862 392 if(trackList) {
393 track->SetAttLineAttMarker(trackList);
394 trackList->AddElement(track);
395 } else cout << "BALLE"<<endl;
396
397
33791895 398}
399
d0cbdfc0 400
401///____________________________________________________________________________________
402void AliHLTEveHLT::FillHistograms(AliESDtrack * esdTrack) {
403
404 if(esdTrack->GetTPCNcls() == 0) return;
405
406 fHistEta->Fill(esdTrack->Eta());
407 // fHistTheta->Fill(esdTrack->Theta()*TMath::RadToDeg());
408 fHistPhi->Fill(esdTrack->Phi()*TMath::RadToDeg());
409
410
411 Float_t DCAr, DCAz = -99;
412 esdTrack->GetImpactParametersTPC(DCAr, DCAz);
413 fHistDCAr->Fill(DCAr);
414
415
416 if(esdTrack->GetStatus()&AliESDtrack::kTPCin || (esdTrack->GetStatus()&AliESDtrack::kTPCin && esdTrack->GetStatus()&AliESDtrack::kITSin)){
417 fHistnClusters->Fill(esdTrack->GetTPCNcls());
418 }
419}
420
353f10b3 421void AliHLTEveHLT::DrawHistograms(){
422 //See header file for documentation
4883ef27 423 if(!fCanvas) {
424 fCanvas = CreateCanvas("PVtx/Tr QA", "Primary vertex, Track QA");
425 fCanvas->Divide(3, 3);
426 }
427
428 fCanvas->cd(5);
429 fHistEta->Draw();
430
431 fCanvas->cd(6);
432 fHistPhi->Draw();
433
434 fCanvas->cd(7);
435 fHistnClusters->Draw();
436
437 fCanvas->cd(8);
438 fHistMult->Draw();
353f10b3 439
4883ef27 440 fCanvas->cd(9);
441 fHistDCAr->Draw();
353f10b3 442
4883ef27 443 fCanvas->cd();
353f10b3 444
445}
446
33791895 447AliEveTrack* AliHLTEveHLT::MakeEsdTrack (AliESDtrack *at, TEveTrackList* cont) {
448 //See header file for documentation
73ac9862 449
450
451
33791895 452
453
454 const double kCLight = 0.000299792458;
455 double bz = - kCLight*10.*( cont->GetPropagator()->GetMagField(0,0,0).fZ);
456
457 Bool_t innerTaken = kFALSE;
458 if ( ! at->IsOn(AliESDtrack::kITSrefit) && fUseIpOnFailedITS)
459 {
460 //tp = at->GetInnerParam();
461 innerTaken = kTRUE;
462 }
463
464 // Add inner/outer track parameters as path-marks.
465
466 Double_t pbuf[3], vbuf[3];
467
468 AliExternalTrackParam trackParam = *at;
469
470 // take parameters constrained to vertex (if they are)
471
472 if( at->GetConstrainedParam() ){
473 trackParam = *at->GetConstrainedParam();
474 }
475 else if( at->GetInnerParam() ){
db742b8e 476 float x = at->GetX();
477 float y = at->GetY();
478 if(sqrt(x*x+y*y)>.5 ) trackParam = *(at->GetInnerParam());
33791895 479 }
480 if( at->GetStatus()&AliESDtrack::kTRDin ){
481 // transport to TRD in
482 trackParam = *at;
483 trackParam.PropagateTo( 290.45, -10.*( cont->GetPropagator()->GetMagField(0,0,0).fZ) );
484 }
485
486 TEveRecTrack rt;
487 {
488 rt.fLabel = at->GetLabel();
489 rt.fIndex = (Int_t) at->GetID();
490 rt.fStatus = (Int_t) at->GetStatus();
491 rt.fSign = (Int_t) trackParam.GetSign();
492 trackParam.GetXYZ(vbuf);
493 trackParam.GetPxPyPz(pbuf);
494 rt.fV.Set(vbuf);
495 rt.fP.Set(pbuf);
496 Double_t ep = at->GetP(), mc = at->GetMass();
497 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
498 }
499
500 AliEveTrack* track = new AliEveTrack(&rt, cont->GetPropagator());
33791895 501 track->SetName(Form("AliEveTrack %d", at->GetID()));
502 track->SetElementTitle(CreateTrackTitle(at));
503 track->SetSourceObject(at);
504
505
506 // Set reference points along the trajectory
507 // and the last point
508
509 {
510 TEvePathMark startPoint(TEvePathMark::kReference);
511 trackParam.GetXYZ(vbuf);
512 trackParam.GetPxPyPz(pbuf);
513 startPoint.fV.Set(vbuf);
514 startPoint.fP.Set(pbuf);
515 rt.fV.Set(vbuf);
516 rt.fP.Set(pbuf);
517 Double_t ep = at->GetP(), mc = at->GetMass();
518 rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc);
519
520 track->AddPathMark( startPoint );
521 }
522
2d91aa68 523 bool ok = 1;
7036e5c1 524 if( at->GetOuterParam() && at->GetTPCPoints(2)>80 ){
2d91aa68 525
33791895 526 //
527 // use AliHLTTPCCATrackParam propagator
528 // since AliExternalTrackParam:PropagateTo()
529 // has an offset at big distances
530 //
7036e5c1 531 double rot = at->GetOuterParam()->GetAlpha() - trackParam.GetAlpha();
532 double crot = cos(rot), srot = sin(rot);
2d91aa68 533 double xEnd = at->GetTPCPoints(2)*crot - at->GetTPCPoints(3)*srot;
7036e5c1 534 // take parameters constrained to vertex (if they are)
535
536
33791895 537 AliHLTTPCCATrackParam t;
538 AliHLTTPCCATrackConvertor::SetExtParam( t, trackParam );
539
540 Double_t x0 = trackParam.GetX();
7036e5c1 541 Double_t dx = xEnd - x0;
33791895 542
2d91aa68 543 if( dx<0 ) ok = 0;
33791895 544 //
545 // set a reference at the half of trajectory for better drawing
546 //
547
e090fd32 548 if( ok ){
549 double dxx=dx/2;
550 if( TMath::Abs(dxx)>=1. ){
551
552 if( !t.TransportToX(x0+dxx, bz, .999 ) ){
553 ok = 0;
554 } else {
555 AliExternalTrackParam tt;
556 AliHLTTPCCATrackConvertor::GetExtParam( t, tt, trackParam.GetAlpha() );
557 tt.GetXYZ(vbuf);
558 tt.GetPxPyPz(pbuf);
559 TEvePathMark midPoint(TEvePathMark::kReference);
560 midPoint.fV.Set(vbuf);
561 midPoint.fP.Set(pbuf);
562 track->AddPathMark( midPoint );
563 }
2d91aa68 564 }
33791895 565 }
7036e5c1 566
33791895 567 //
568 // Set a reference at the end of the trajectory
569 // and a "decay point", to let the event display know where the track ends
570 //
571
2d91aa68 572 for( ; ok; dx*=.9 ){
573
7036e5c1 574 if( !t.TransportToX(x0+dx, bz, .999 ) ){
2d91aa68 575 ok = 0;
576 break;
577 if( TMath::Abs(dx)<1. ) break;
7036e5c1 578 continue;
579 }
2d91aa68 580 break;
581 }
582
583 {
584 if( !ok ){
585 AliHLTTPCCATrackConvertor::SetExtParam( t, trackParam );
586 }
587 AliExternalTrackParam tt;
7036e5c1 588 AliHLTTPCCATrackConvertor::GetExtParam( t, tt, trackParam.GetAlpha() );
589 tt.GetXYZ(vbuf);
590 tt.GetPxPyPz(pbuf);
33791895 591 TEvePathMark endPoint(TEvePathMark::kReference);
592 TEvePathMark decPoint(TEvePathMark::kDecay);
593 endPoint.fV.Set(vbuf);
594 endPoint.fP.Set(pbuf);
595 decPoint.fV.Set(vbuf);
596 decPoint.fP.Set(pbuf);
597 track->AddPathMark( endPoint );
2d91aa68 598 track->AddPathMark( decPoint );
33791895 599 }
600 }
601
2d91aa68 602 if ( ok && at->IsOn(AliESDtrack::kTPCrefit))
33791895 603 {
604 if ( ! innerTaken)
605 {
606 AddTrackParamToTrack(track, at->GetInnerParam());
607 }
608 AddTrackParamToTrack(track, at->GetOuterParam());
609 }
2d91aa68 610
33791895 611 return track;
612}
613
614void AliHLTEveHLT::SetUpTrackPropagator(TEveTrackPropagator* trkProp, Float_t magF, Float_t maxR) {
615 //See header file for documentation
616
617 if (fTrueField) {
618 trkProp->SetMagFieldObj(new AliEveMagField);
619
620 } else {
621 trkProp->SetMagField(magF);
622 }
623
624 if (fUseRkStepper) {
625 trkProp->SetStepper(TEveTrackPropagator::kRungeKutta);
626 }
627
628 trkProp->SetMaxR(maxR);
629}
630
631
632void AliHLTEveHLT::AddTrackParamToTrack(AliEveTrack* track, const AliExternalTrackParam* tp) {
633 //See header file for documentation
634
635 if (tp == 0)
636 return;
637
638 Double_t pbuf[3], vbuf[3];
639 tp->GetXYZ(vbuf);
640 tp->GetPxPyPz(pbuf);
641
642 TEvePathMark pm(TEvePathMark::kReference);
643 pm.fV.Set(vbuf);
644 pm.fP.Set(pbuf);
645 track->AddPathMark(pm);
646}
647
648
649
650TString AliHLTEveHLT::CreateTrackTitle(AliESDtrack* t) {
651 // Add additional track parameters as a path-mark to track.
652
653 TString s;
654
655 Int_t label = t->GetLabel(), index = t->GetID();
656 TString idx(index == kMinInt ? "<undef>" : Form("%d", index));
657 TString lbl(label == kMinInt ? "<undef>" : Form("%d", label));
658
659 Double_t p[3], v[3];
660 t->GetXYZ(v);
661 t->GetPxPyPz(p);
662 Double_t pt = t->Pt();
663 Double_t ptsig = TMath::Sqrt(t->GetSigma1Pt2());
664 Double_t ptsq = pt*pt;
665 Double_t ptm = pt / (1.0 + pt*ptsig);
666 Double_t ptM = pt / (1.0 - pt*ptsig);
667
668 s = Form("Index=%s, Label=%s\nChg=%d, Pdg=%d\n"
669 "pT = %.3f + %.3f - %.3f [%.3f]\n"
670 "P = (%.3f, %.3f, %.3f)\n"
671 "V = (%.3f, %.3f, %.3f)\n",
672 idx.Data(), lbl.Data(), t->Charge(), 0,
673 pt, ptM - pt, pt - ptm, ptsig*ptsq,
674 p[0], p[1], p[2],
675 v[0], v[1], v[2]);
676
677 Int_t o;
678 s += "Det (in,out,refit,pid):\n";
679 o = AliESDtrack::kITSin;
680 s += Form("ITS (%d,%d,%d,%d) ", t->IsOn(o), t->IsOn(o<<1), t->IsOn(o<<2), t->IsOn(o<<3));
681 o = AliESDtrack::kTPCin;
682 s += Form("TPC(%d,%d,%d,%d)\n", t->IsOn(o), t->IsOn(o<<1), t->IsOn(o<<2), t->IsOn(o<<3));
683 o = AliESDtrack::kTRDin;
684 s += Form("TRD(%d,%d,%d,%d) ", t->IsOn(o), t->IsOn(o<<1), t->IsOn(o<<2), t->IsOn(o<<3));
685 o = AliESDtrack::kTOFin;
686 s += Form("TOF(%d,%d,%d,%d)\n", t->IsOn(o), t->IsOn(o<<1), t->IsOn(o<<2), t->IsOn(o<<3));
687 o = AliESDtrack::kHMPIDout;
688 s += Form("HMPID(out=%d,pid=%d)\n", t->IsOn(o), t->IsOn(o<<1));
689 s += Form("ESD pid=%d", t->IsOn(AliESDtrack::kESDpid));
690
691 if (t->IsOn(AliESDtrack::kESDpid))
692 {
693 Double_t pid[5];
694 t->GetESDpid(pid);
695 s += Form("\n[%.2f %.2f %.2f %.2f %.2f]", pid[0], pid[1], pid[2], pid[3], pid[4]);
696 }
697
698 return s;
699}
700
fd2adb88 701