]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/ESD/AliTriggerIR.cxx
Possibility to not write syswatch info to file (default)
[u/mrichter/AliRoot.git] / STEER / ESD / 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 using std::endl;
35 using std::cout;
36 using std::dec;
37 using std::hex;
38 ClassImp(AliTriggerIR)
39
40 //_____________________________________________________________________________
41 AliTriggerIR::AliTriggerIR():
42   TObject(),
43   fOrbit(0),
44   fNWord(0),
45   fInt1(NULL),
46   fInt2(NULL),
47   fBC(NULL),
48   fIncomplete(kFALSE),
49   fTransErr(kFALSE)
50 {
51   // Default constructor
52 }
53
54 //_____________________________________________________________________________
55 AliTriggerIR::AliTriggerIR(UInt_t orbit, UInt_t nwords, UInt_t *words, Bool_t incomplete, Bool_t transerr):
56   TObject(),
57   fOrbit(orbit),
58   fNWord(nwords),
59   fInt1(NULL),
60   fInt2(NULL),
61   fBC(NULL),
62   fIncomplete(incomplete),
63   fTransErr(transerr)
64 {
65    //  Standard constructor
66    //
67    //  It takes as an input the CTP raw-data payload (words)
68    //  corresponding to the IRs
69    if(fNWord){
70      fInt1 = new Bool_t[fNWord];
71      fInt2 = new Bool_t[fNWord];
72      fBC   = new UShort_t[fNWord];
73      for(UInt_t i = 0; i < fNWord; i++) {
74         fInt1[i] = words[i] & 0x1000;
75         fInt2[i] = words[i] & 0x2000;
76         fBC[i] = words[i] & 0xFFF;
77      }
78   }
79 }
80
81 //______________________________________________________________________________
82 AliTriggerIR::AliTriggerIR(const AliTriggerIR &rec):
83   TObject(rec),
84   fOrbit(rec.fOrbit),
85   fNWord(rec.fNWord),
86   fInt1(NULL),
87   fInt2(NULL),
88   fBC(NULL),
89   fIncomplete(rec.fIncomplete),
90   fTransErr(rec.fTransErr)
91 {
92   // Copy constructor
93   //
94   if(fNWord){
95     fInt1 = new Bool_t[fNWord];
96     fInt2 = new Bool_t[fNWord];
97     fBC   = new UShort_t[fNWord];
98     for (UInt_t i = 0; i < fNWord; i++) {
99       fInt1[i] = rec.fInt1[i];
100       fInt2[i] = rec.fInt2[i];
101       fBC[i] = rec.fBC[i];
102     }
103   }
104 }
105 //_____________________________________________________________________________
106 AliTriggerIR &AliTriggerIR::operator =(const AliTriggerIR& rec)
107 {
108   // assignment operator
109   //
110   if(this==&rec) return *this;
111   ((TObject *)this)->operator=(rec);
112
113   fOrbit = rec.fOrbit;
114   fNWord = rec.fNWord;
115   if(fNWord){
116     if (fInt1) delete fInt1;
117     fInt1 = new Bool_t[fNWord];
118     if (fInt2) delete fInt2;
119     fInt2 = new Bool_t[fNWord];
120     if (fBC) delete fBC;
121     fBC = new UShort_t[fNWord];
122     for (UInt_t i = 0; i < fNWord; i++) {
123       fInt1[i] = rec.fInt1[i];
124       fInt2[i] = rec.fInt2[i];
125       fBC[i] = rec.fBC[i];
126     }
127   }  
128   fIncomplete = rec.fIncomplete;
129   fTransErr = rec.fTransErr;
130   return *this;
131 }
132
133 //______________________________________________________________________________
134 AliTriggerIR::~AliTriggerIR()
135 {
136   // Destructor
137   //
138   if (fInt1) delete [] fInt1;
139   if (fInt2) delete [] fInt2;
140   if (fBC) delete [] fBC;
141 }
142
143 //_____________________________________________________________________________
144 void AliTriggerIR::Print( const Option_t* ) const
145 {
146   // Print
147   cout << "Trigger Interaction Record:" << endl; 
148   cout << "  Orbit:                0x" << hex << fOrbit << dec << endl;
149   cout << "  Number of signals:    " << fNWord << endl;
150   for (UInt_t i = 0; i < fNWord; i++)
151     cout << "    BC: 0x" << hex << fBC[i] << dec << "  Interaction1: " << fInt1[i] << "  Interaction2: " << fInt2[i] << endl;
152
153   cout << "  Record incomplete:    " << fIncomplete << endl;
154   cout << "  Transmission Error:   " << fTransErr << endl;
155 }