]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTriggerIR.cxx
Trigger interaction records conainer class + the corresponding raw-data reader stuff...
[u/mrichter/AliRoot.git] / STEER / AliTriggerIR.cxx
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
65   fInt1 = new Bool_t[fNWord];
66   fInt2 = new Bool_t[fNWord];
67   fBC   = new UShort_t[fNWord];
68   for(UInt_t i = 0; i < fNWord; i++) {
69     fInt1[i] = words[i] & 0x1000;
70     fInt2[i] = words[i] & 0x2000;
71     fBC[i] = words[i] & 0xFFF;
72   }
73 }
74
75 //______________________________________________________________________________
76 AliTriggerIR::AliTriggerIR(const AliTriggerIR &rec):
77   TObject(rec),
78   fOrbit(rec.fOrbit),
79   fNWord(rec.fNWord),
80   fInt1(NULL),
81   fInt2(NULL),
82   fBC(NULL),
83   fIncomplete(rec.fIncomplete),
84   fTransErr(rec.fTransErr)
85 {
86   // Copy constructor
87   //
88   fInt1 = new Bool_t[fNWord];
89   fInt2 = new Bool_t[fNWord];
90   fBC   = new UShort_t[fNWord];
91   for (UInt_t i = 0; i < fNWord; i++) {
92     fInt1[i] = rec.fInt1[i];
93     fInt2[i] = rec.fInt2[i];
94     fBC[i] = rec.fBC[i];
95   }
96 }
97
98 //_____________________________________________________________________________
99 AliTriggerIR &AliTriggerIR::operator =(const AliTriggerIR& rec)
100 {
101   // assignment operator
102   //
103   if(this==&rec) return *this;
104   ((TObject *)this)->operator=(rec);
105
106   fOrbit = rec.fOrbit;
107   fNWord = rec.fNWord;
108
109   if (fInt1) delete fInt1;
110   fInt1 = new Bool_t[fNWord];
111   if (fInt2) delete fInt2;
112   fInt2 = new Bool_t[fNWord];
113   if (fBC) delete fBC;
114   fBC = new UShort_t[fNWord];
115   for (UInt_t i = 0; i < fNWord; i++) {
116     fInt1[i] = rec.fInt1[i];
117     fInt2[i] = rec.fInt2[i];
118     fBC[i] = rec.fBC[i];
119   }
120     
121   fIncomplete = rec.fIncomplete;
122   fTransErr = rec.fTransErr;
123
124   return *this;
125 }
126
127 //______________________________________________________________________________
128 AliTriggerIR::~AliTriggerIR()
129 {
130   // Destructor
131   //
132   if (fInt1) delete fInt1;
133   if (fInt2) delete fInt2;
134   if (fBC) delete fBC;
135 }
136
137 //_____________________________________________________________________________
138 void AliTriggerIR::Print( const Option_t* ) const
139 {
140   // Print
141   cout << "Trigger Ineteraction Record:" << endl; 
142   cout << "  Orbit:                0x" << hex << fOrbit << dec << endl;
143   cout << "  Number of signals:    " << fNWord << endl;
144   for (UInt_t i = 0; i < fNWord; i++)
145     cout << "    BC: 0x" << hex << fBC[i] << dec << "  Interaction1: " << fInt1[i] << "  Interaction2: " << fInt2[i] << endl;
146
147   cout << "  Record incomplete:    " << fIncomplete << endl;
148   cout << "  Transmission Error:   " << fTransErr << endl;
149 }