ce9ace8c |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
3 | * * |
4 | * Author: The ALICE Off-line Project. * |
5 | * Contributors are mentioned in the code where appropriate. * |
6 | * * |
7 | * Permission to use, copy, modify and distribute this software and its * |
8 | * documentation strictly for non-commercial purposes is hereby granted * |
9 | * without fee, provided that the above copyright notice appears in all * |
10 | * copies and that both the copyright notice and this permission notice * |
11 | * appear in the supporting documentation. The authors make no claims * |
12 | * about the suitability of this software for any purpose. It is * |
13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ |
15 | |
16 | /////////////////////////////////////////////////////////////////////////////// |
17 | // |
18 | // Class represents CTP interaction record |
19 | // |
20 | // The definition of the IR follows the ALICE internal note: |
21 | // ALICE-INT-2002-010 |
22 | // The CTP raw-data payload will contain IRs within +- 1 orbit |
23 | // around the triggered event. |
24 | // The same IRs are propagated to the ESD (and AOD). |
25 | // |
26 | // cvetan.cheshkov@cern.ch 10/07/2008 |
27 | // |
28 | /////////////////////////////////////////////////////////////////////////////// |
29 | |
30 | #include <Riostream.h> |
31 | |
32 | #include "AliTriggerIR.h" |
33 | |
34 | ClassImp(AliTriggerIR) |
35 | |
36 | //_____________________________________________________________________________ |
37 | AliTriggerIR::AliTriggerIR(): |
38 | TObject(), |
39 | fOrbit(0), |
40 | fNWord(0), |
41 | fInt1(NULL), |
42 | fInt2(NULL), |
43 | fBC(NULL), |
44 | fIncomplete(kFALSE), |
45 | fTransErr(kFALSE) |
46 | { |
47 | // Default constructor |
48 | } |
49 | |
50 | //_____________________________________________________________________________ |
51 | AliTriggerIR::AliTriggerIR(UInt_t orbit, UInt_t nwords, UInt_t *words, Bool_t incomplete, Bool_t transerr): |
52 | TObject(), |
53 | fOrbit(orbit), |
54 | fNWord(nwords), |
55 | fInt1(NULL), |
56 | fInt2(NULL), |
57 | fBC(NULL), |
58 | fIncomplete(incomplete), |
59 | fTransErr(transerr) |
60 | { |
61 | // Standard constructor |
62 | // |
63 | // It takes as an input the CTP raw-data payload (words) |
64 | // corresponding to the IRs |
8b44b965 |
65 | if(fNWord){ |
66 | fInt1 = new Bool_t[fNWord]; |
67 | fInt2 = new Bool_t[fNWord]; |
68 | fBC = new UShort_t[fNWord]; |
69 | for(UInt_t i = 0; i < fNWord; i++) { |
70 | fInt1[i] = words[i] & 0x1000; |
71 | fInt2[i] = words[i] & 0x2000; |
72 | fBC[i] = words[i] & 0xFFF; |
73 | } |
ce9ace8c |
74 | } |
75 | } |
76 | |
77 | //______________________________________________________________________________ |
78 | AliTriggerIR::AliTriggerIR(const AliTriggerIR &rec): |
79 | TObject(rec), |
80 | fOrbit(rec.fOrbit), |
81 | fNWord(rec.fNWord), |
82 | fInt1(NULL), |
83 | fInt2(NULL), |
84 | fBC(NULL), |
85 | fIncomplete(rec.fIncomplete), |
86 | fTransErr(rec.fTransErr) |
87 | { |
88 | // Copy constructor |
89 | // |
8b44b965 |
90 | if(fNWord){ |
91 | fInt1 = new Bool_t[fNWord]; |
92 | fInt2 = new Bool_t[fNWord]; |
93 | fBC = new UShort_t[fNWord]; |
94 | for (UInt_t i = 0; i < fNWord; i++) { |
95 | fInt1[i] = rec.fInt1[i]; |
96 | fInt2[i] = rec.fInt2[i]; |
97 | fBC[i] = rec.fBC[i]; |
98 | } |
ce9ace8c |
99 | } |
100 | } |
ce9ace8c |
101 | //_____________________________________________________________________________ |
102 | AliTriggerIR &AliTriggerIR::operator =(const AliTriggerIR& rec) |
103 | { |
104 | // assignment operator |
105 | // |
106 | if(this==&rec) return *this; |
107 | ((TObject *)this)->operator=(rec); |
108 | |
109 | fOrbit = rec.fOrbit; |
110 | fNWord = rec.fNWord; |
8b44b965 |
111 | if(fNWord){ |
112 | if (fInt1) delete fInt1; |
113 | fInt1 = new Bool_t[fNWord]; |
114 | if (fInt2) delete fInt2; |
115 | fInt2 = new Bool_t[fNWord]; |
116 | if (fBC) delete fBC; |
117 | fBC = new UShort_t[fNWord]; |
118 | for (UInt_t i = 0; i < fNWord; i++) { |
119 | fInt1[i] = rec.fInt1[i]; |
120 | fInt2[i] = rec.fInt2[i]; |
121 | fBC[i] = rec.fBC[i]; |
122 | } |
123 | } |
ce9ace8c |
124 | fIncomplete = rec.fIncomplete; |
125 | fTransErr = rec.fTransErr; |
ce9ace8c |
126 | return *this; |
127 | } |
128 | |
129 | //______________________________________________________________________________ |
130 | AliTriggerIR::~AliTriggerIR() |
131 | { |
132 | // Destructor |
133 | // |
481caaea |
134 | if (fInt1) delete [] fInt1; |
135 | if (fInt2) delete [] fInt2; |
136 | if (fBC) delete [] fBC; |
ce9ace8c |
137 | } |
138 | |
139 | //_____________________________________________________________________________ |
140 | void AliTriggerIR::Print( const Option_t* ) const |
141 | { |
142 | // Print |
7ad2ebb6 |
143 | cout << "Trigger Interaction Record:" << endl; |
ce9ace8c |
144 | cout << " Orbit: 0x" << hex << fOrbit << dec << endl; |
145 | cout << " Number of signals: " << fNWord << endl; |
146 | for (UInt_t i = 0; i < fNWord; i++) |
147 | cout << " BC: 0x" << hex << fBC[i] << dec << " Interaction1: " << fInt1[i] << " Interaction2: " << fInt2[i] << endl; |
148 | |
149 | cout << " Record incomplete: " << fIncomplete << endl; |
150 | cout << " Transmission Error: " << fTransErr << endl; |
151 | } |