]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/src/AliRoot/TriggerRecord.cxx
b5a4b9089c60e016a1b6b2af1e702e7f1282a039
[u/mrichter/AliRoot.git] / HLT / MUON / src / AliRoot / TriggerRecord.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Author: Artur Szostak
4 // Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
5 //
6 ////////////////////////////////////////////////////////////////////////////////
7
8 #include "AliRoot/TriggerRecord.hpp"
9 #include "TMath.h"
10
11 ClassImp(AliHLTMUONTriggerRecord)
12
13
14 AliHLTMUONTriggerRecord::AliHLTMUONTriggerRecord()
15 {
16 // Default constructor initialises everything to zero and the trigger number to -1.
17
18         Init();
19 }
20
21
22 AliHLTMUONTriggerRecord::AliHLTMUONTriggerRecord(
23                 Int_t triggernumber, Int_t sign, Float_t pt,
24                 const AliHLTMUONPoint& station1point, const AliHLTMUONPoint& station2point
25         )
26 {
27 // Creates a trigger record from the specified parameters.
28 // Note: the trigger number must be greater or equal to zero. The particle
29 // sign must also be one of the following values: -1, 0 or +1
30 // Pt must be a positive number.
31 // If these conditions are not met then an error message is displayed and
32 // the object is filled like it is in the default constructor. 
33
34         if (triggernumber < 0)
35         {
36                 Init();
37                 Error("AliHLTMUONTriggerRecord",
38                         "The trigger number must be a positive number. Got: %d",
39                         triggernumber
40                 );
41         }
42         else if (sign < -1 || +1 < sign)
43         {
44                 Init();
45                 Error("AliHLTMUONTriggerRecord",
46                         "The particle sign must a value of -1, 0 or +1. Got: %d",
47                         sign
48                 );
49         }
50         else if (pt < 0.0)
51         {
52                 Init();
53                 Error("AliHLTMUONTriggerRecord",
54                         "The transverse momentum must be a positive number. Got: %f",
55                         pt
56                 );
57         }
58         else
59         {
60                 fTriggerNumber = triggernumber;
61                 fParticleSign = sign;
62                 fPt = pt;
63                 fSt1Point = station1point;
64                 fSt2Point = station2point;
65         }
66 }
67
68
69 void AliHLTMUONTriggerRecord::Init()
70 {
71 // Performs internal initialisation for the constructors.
72
73         fTriggerNumber = -1;
74         fParticleSign = 0;
75         fPt = 0.0;
76 }
77
78
79 void AliHLTMUONTriggerRecord::TriggerNumber(Int_t value)
80 {
81 // Set method for the trigger number. 
82 // The trigger number must be positive when assigning the trigger number.
83 // If it is not then an error message is displayed and the internal value
84 // remains untouched.
85
86         if (value >= 0)
87                 fTriggerNumber = value;
88         else
89                 Error("TriggerNumber",
90                         "The trigger number must be a positive number. Got: %d",
91                         value
92                 );
93 }
94
95
96 void AliHLTMUONTriggerRecord::ParticleSign(Int_t value)
97 {
98 // Set method for the particle sign.
99 // The particle sign must be one of the following values: -1, 0 or +1
100 // If it is not then an error message is displayed and the internal value
101 // remains untouched.
102
103         if (-1 <= value && value <= +1)
104                 fParticleSign = value;
105         else
106                 Error("ParticleSign",
107                         "The particle sign must a value of -1, 0 or +1. Got: %d",
108                         value
109                 );
110 }
111
112
113 void AliHLTMUONTriggerRecord::Pt(Float_t value)
114 {
115 // Set method for the particle Pt, as measured by the L0 trigger.
116 // The pt must be a positive number when assigning the pt.
117 // If it is not then an error message is displayed and the internal value
118 // remains untouched.
119
120         if (value >= 0)
121                 fPt = value;
122         else
123                 Error("Pt",
124                         "The transverse momentum must be a positive number. Got: %f",
125                         value
126                 );
127 }
128
129
130 ostream& operator << (ostream& os, const AliHLTMUONTriggerRecord& r)
131 {
132         os << "{trig#: " << r.fTriggerNumber << ", sign: " << r.fParticleSign
133            << ", pt: " << r.fPt << ", st1: " << r.fSt1Point << ", st2: "
134            << r.fSt2Point << "}";
135         return os;
136 }
137