]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDspHeader.cxx
reco update
[u/mrichter/AliRoot.git] / MUON / AliMUONDspHeader.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 /* $Id$ */
17  
18 #include "AliMUONDspHeader.h"
19 #include "AliMUONBusStruct.h"
20 #include <Riostream.h>
21
22 //-----------------------------------------------------------------------------
23 /// \class AliMUONDspHeader
24 /// DSP structure for tracker raw data.
25 /// Each block contains at most 5 Dsp structures.
26 /// Beside the total length and length of the below data
27 /// the header of the Dsp contains the front end DSP id, trigger words
28 /// and event word (1 for nb of word is odd and 0 if not 
29 ///
30 /// \author Christian Finck
31 //-----------------------------------------------------------------------------
32
33 using std::cout;
34 using std::endl;
35 /// \cond CLASSIMP
36 ClassImp(AliMUONDspHeader)
37 /// \endcond
38   
39   const Int_t  AliMUONDspHeader::fgkHeaderLength = 10;
40   const UInt_t AliMUONDspHeader::fgkDefaultDataKey = 0xF000000F;
41   const UInt_t AliMUONDspHeader::fgkDefaultPaddingWord = 0xBEEFFACE;
42
43 //___________________________________________
44 AliMUONDspHeader::AliMUONDspHeader(TRootIOCtor* /*dummy*/)
45 :  TObject(),
46 fDataKey(0),
47 fTotalLength(0),
48 fLength(0),
49 fDspId(0),
50 fBlkL1ATrigger(0),
51 fMiniEventId(0),
52 fL1ATrigger(0),
53 fL1RTrigger(0),
54 fPaddingWord(0),
55 fErrorWord(0),
56 fBusPatchArray(0x0)
57 {
58   ///
59   ///ctor
60   ///
61   
62 }
63
64 //___________________________________________
65 AliMUONDspHeader::AliMUONDspHeader()
66   :  TObject(),
67      fDataKey(0),
68      fTotalLength(0),
69      fLength(0),
70      fDspId(0),
71      fBlkL1ATrigger(0),
72      fMiniEventId(0),
73      fL1ATrigger(0),
74      fL1RTrigger(0),
75      fPaddingWord(0),
76      fErrorWord(0),
77      fBusPatchArray(new TClonesArray("AliMUONBusStruct",5))
78 {
79   ///
80   ///ctor
81   ///
82
83 }
84
85 //___________________________________________
86 AliMUONDspHeader::~AliMUONDspHeader()
87 {
88   ///
89   /// dtr
90   ///
91   fBusPatchArray->Delete();
92   delete fBusPatchArray;
93 }
94
95 //___________________________________________
96 AliMUONDspHeader::AliMUONDspHeader(const AliMUONDspHeader& event)
97   :  TObject(event),
98      fDataKey(event.fDataKey),
99      fTotalLength(event.fTotalLength),
100      fLength(event.fLength),
101      fDspId(event.fDspId),
102      fBlkL1ATrigger(event.fBlkL1ATrigger),
103      fMiniEventId(event.fMiniEventId),
104      fL1ATrigger(event.fL1ATrigger),
105      fL1RTrigger(event.fL1RTrigger),
106      fPaddingWord(event.fPaddingWord),
107      fErrorWord(event.fErrorWord),
108      fBusPatchArray(new TClonesArray("AliMUONBusStruct", 5))
109 {
110   /// 
111   /// copy constructor
112   ///
113
114   for (Int_t index = 0; index < (event.fBusPatchArray)->GetEntriesFast(); index++) {
115     {new ((*fBusPatchArray)[fBusPatchArray->GetEntriesFast()]) 
116         AliMUONBusStruct(*(AliMUONBusStruct*)(event.fBusPatchArray)->At(index));}
117   }
118   // fBusPatchArray->SetOwner();
119  
120 }
121
122 //___________________________________________
123 AliMUONDspHeader& AliMUONDspHeader::operator=(const AliMUONDspHeader& event)
124 {
125   ///
126   /// assignemnt constructor
127   ///
128   if (this == &event) return *this;
129
130   fDataKey       = event.fDataKey;
131   fTotalLength   = event.fTotalLength;
132   fLength        = event.fLength;
133   fDspId         = event.fDspId;
134   fBlkL1ATrigger = event.fBlkL1ATrigger;
135   fMiniEventId   = event.fMiniEventId;
136   fL1ATrigger    = event.fL1ATrigger;
137   fL1RTrigger    = event.fL1RTrigger;
138   fPaddingWord   = event.fPaddingWord;
139   fErrorWord     = event.fErrorWord;
140
141
142   fBusPatchArray = new TClonesArray("AliMUONBusStruct", 5);
143   for (Int_t index = 0; index < (event.fBusPatchArray)->GetEntriesFast(); index++) {
144     {new ((*fBusPatchArray)[fBusPatchArray->GetEntriesFast()]) 
145         AliMUONBusStruct(*(AliMUONBusStruct*)(event.fBusPatchArray)->At(index));}
146   }
147   return *this;
148 }
149 //___________________________________________
150 void AliMUONDspHeader::AddBusPatch(const AliMUONBusStruct& busPatch)
151 {
152   /// 
153   /// adding buspatch info
154   /// into TClonesArray
155   ///
156   TClonesArray &eventArray = *fBusPatchArray;
157   new(eventArray[eventArray.GetEntriesFast()]) AliMUONBusStruct(busPatch);
158 }
159 //___________________________________________
160 void AliMUONDspHeader::Clear(Option_t* )
161 {
162   /// Clear TClones arrays
163   /// instead of deleting
164   ///
165   fBusPatchArray->Clear("C");
166  
167 }
168
169 //___________________________________________
170 void AliMUONDspHeader::Print(Option_t* /*opt*/) const
171 {
172   /// print out
173
174   cout << "FRT info"        << endl;
175   cout << "DataKey: "       << fDataKey << endl;
176   cout << "TotalLength: "   << fTotalLength << endl;
177   cout << "Length : "       << fLength << endl;
178   cout << "DspId: "         << fDspId << endl;
179   cout << "BlkL1ATrigger: " << fBlkL1ATrigger << endl;
180   cout << "MiniEventId: "   << fMiniEventId << endl;
181   cout << "L1ATrigger: "    << fL1ATrigger << endl;
182   cout << "L1RTrigger: "    << fL1RTrigger << endl;
183   cout << "PaddingWord: "   << fPaddingWord << endl;
184   cout << "ErrorWord: "     << fErrorWord << endl;
185
186 }