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