]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/src/AliRoot/convert.cxx
Coding conventions
[u/mrichter/AliRoot.git] / HLT / MUON / src / AliRoot / convert.cxx
CommitLineData
8356cc1d 1////////////////////////////////////////////////////////////////////////////////
2//
3// Author: Artur Szostak
4// Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
5//
6////////////////////////////////////////////////////////////////////////////////
7
8#include "AliRoot/convert.hpp"
9#include "Utils.hpp"
10#include "Error.hpp"
11
8356cc1d 12
69d7cf2e 13AliHLTMUONPoint AliHLTMUONConvert(const AliHLTMUONCorePoint& point)
8356cc1d 14{
69d7cf2e 15 DebugMsg(5, "Convert from AliHLTMUONCorePoint");
16 return AliHLTMUONPoint(point.fX, point.fY);
cbee67e7 17}
8356cc1d 18
19
69d7cf2e 20AliHLTMUONCorePoint AliHLTMUONConvert(const AliHLTMUONPoint& point)
8356cc1d 21{
69d7cf2e 22 DebugMsg(5, "Convert from AliHLTMUONPoint");
23 return AliHLTMUONCorePoint(point.fX, point.fY);
cbee67e7 24}
8356cc1d 25
26
69d7cf2e 27AliHLTMUONTriggerRecord AliHLTMUONConvert(const AliHLTMUONCoreTriggerRecord& record, Int_t triggernumber)
8356cc1d 28{
29 DebugMsg(5, "Convert from dHLT::TriggerRecord");
30 // If the trigger number is negative then set it to zero.
31 if (triggernumber >= 0)
32 {
69d7cf2e 33 return AliHLTMUONTriggerRecord(
8356cc1d 34 triggernumber,
69d7cf2e 35 record.fSign,
36 record.fPt,
37 AliHLTMUONConvert( record.fStation1impact ),
38 AliHLTMUONConvert( record.fStation2impact )
8356cc1d 39 );
40 }
41 else
42 {
69d7cf2e 43 return AliHLTMUONTriggerRecord(
8356cc1d 44 0,
69d7cf2e 45 record.fSign,
46 record.fPt,
47 AliHLTMUONConvert( record.fStation1impact ),
48 AliHLTMUONConvert( record.fStation2impact )
8356cc1d 49 );
cbee67e7 50 }
51}
8356cc1d 52
53
69d7cf2e 54AliHLTMUONCoreTriggerRecord AliHLTMUONConvert(const AliHLTMUONTriggerRecord& record)
8356cc1d 55{
69d7cf2e 56 DebugMsg(5, "Convert from AliHLTMUONTriggerRecord");
57 return AliHLTMUONCoreTriggerRecord(
58 (AliHLTMUONCoreParticleSign) record.ParticleSign(),
8356cc1d 59 record.Pt(),
69d7cf2e 60 AliHLTMUONConvert( record.Station1Point() ),
61 AliHLTMUONConvert( record.Station2Point() )
8356cc1d 62 );
cbee67e7 63}
8356cc1d 64
65
69d7cf2e 66AliHLTMUONTrack AliHLTMUONConvert(const AliHLTMUONCoreTrack& track)
8356cc1d 67{
68 DebugMsg(5, "Convert from dHLT::Track");
69d7cf2e 69 AliHLTMUONTrack t;
70 t.TriggerID( track.fTriggerid );
71 t.ParticleSign( track.fSign );
72 t.P( track.fP );
73 t.Pt( track.fPt );
8356cc1d 74 for (Int_t i = 0; i < 10; i++)
75 {
69d7cf2e 76 t.Hit(i) = AliHLTMUONConvert( track.fPoint[i] );
8356cc1d 77
78 // Only convert if the ROI is valid. Otherwise the Region object
79 // is filled with NaN's.
3a682eae 80 if (track.fRegion[i] != kInvalidROI)
69d7cf2e 81 t.RegionOfInterest(i) = AliHLTMUONConvert( track.fRegion[i] );
cbee67e7 82 }
8356cc1d 83 return t;
cbee67e7 84}
8356cc1d 85
86
69d7cf2e 87AliHLTMUONCoreTrack AliHLTMUONConvert(const AliHLTMUONTrack& track)
8356cc1d 88{
69d7cf2e 89 DebugMsg(5, "Convert from AliHLTMUONTrack");
90 AliHLTMUONCoreTrack t;
91 t.fTriggerid = track.TriggerID();
92 t.fSign = (AliHLTMUONCoreParticleSign) track.ParticleSign();
93 t.fP = track.P();
94 t.fPt = track.Pt();
8356cc1d 95 for (Int_t i = 0; i < 10; i++)
96 {
69d7cf2e 97 t.fPoint[i] = AliHLTMUONConvert( track.Hit(i) );
98 t.fRegion[i] = AliHLTMUONConvert( track.RegionOfInterest(i), i );
cbee67e7 99 }
8356cc1d 100 return t;
cbee67e7 101}
8356cc1d 102
103
69d7cf2e 104AliHLTMUONRegion AliHLTMUONConvert(const AliHLTMUONCoreROI region)
8356cc1d 105{
69d7cf2e 106 DebugMsg(5, "Convert from AliHLTMUONCoreROI");
107 AliHLTMUONCoreRegionOfInterest roi(region);
108 return AliHLTMUONRegion( roi.Left(), roi.Right(), roi.Bottom(), roi.Top() );
cbee67e7 109}
8356cc1d 110
111
69d7cf2e 112AliHLTMUONCoreROI AliHLTMUONConvert(const AliHLTMUONRegion& region, UInt_t chamber)
8356cc1d 113{
69d7cf2e 114 DebugMsg(5, "Convert from AliHLTMUONRegion");
8356cc1d 115 // If the chamber number is too big then truncate it.
116 if (chamber < 10)
117 {
69d7cf2e 118 AliHLTMUONCoreRegionOfInterest roi(
8356cc1d 119 region.Left(), region.Right(), region.Bottom(), region.Top(),
69d7cf2e 120 (AliHLTMUONCoreChamberID) chamber
8356cc1d 121 );
122 return roi;
123 }
124 else
125 {
69d7cf2e 126 AliHLTMUONCoreRegionOfInterest roi(
8356cc1d 127 region.Left(), region.Right(), region.Bottom(), region.Top(),
69d7cf2e 128 kChamber10
8356cc1d 129 );
130 return roi;
cbee67e7 131 }
132}
8356cc1d 133