]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONBlockHeader.cxx
Changing fabs into TMath::Abs
[u/mrichter/AliRoot.git] / MUON / AliMUONBlockHeader.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 "AliMUONBlockHeader.h"
19 #include "AliMUONDspHeader.h"
20
21 #include <Riostream.h>
22
23 //-----------------------------------------------------------------------------
24 /// \class AliMUONBlockHeader
25 /// Block structure for tracker raw data
26 /// each DDL contains two blocks,
27 /// each block contains at most 5 dsp structure.
28 /// Beside the total length and length of the below data
29 /// the header of the block contains the front end DSP id, trigger words and paddind word
30 ///
31 /// \author Christian Finck
32 //-----------------------------------------------------------------------------
33
34 /// \cond CLASSIMP
35 ClassImp(AliMUONBlockHeader)
36 /// \endcond
37
38 const Int_t  AliMUONBlockHeader::fgkHeaderLength   = 8;
39 const UInt_t AliMUONBlockHeader::fgkDefaultDataKey = 0xFC0000FC;
40 const UInt_t AliMUONBlockHeader::fgkDdlDataKey     = 0xD000000D;
41 //___________________________________________
42 AliMUONBlockHeader::AliMUONBlockHeader()
43   :  TObject(),
44      fDataKey(0),
45      fTotalLength(0),
46      fLength(0),
47      fDspId(0),
48      fL0Trigger(0),
49      fMiniEventId(0),
50      fEventId1(0),
51      fEventId2(0),
52      fDspHeaderArray(new TClonesArray("AliMUONDspHeader", 5))
53
54 {
55   ///
56   /// ctor
57   ///
58
59 }
60
61 //___________________________________________
62 AliMUONBlockHeader::~AliMUONBlockHeader()
63 {
64   /// 
65   /// dtor
66   ///
67   fDspHeaderArray->Delete();
68   delete fDspHeaderArray;
69 }
70
71 //___________________________________________
72 AliMUONBlockHeader::AliMUONBlockHeader(const AliMUONBlockHeader& event)
73   :  TObject(event),
74      fDataKey(event.fDataKey),
75      fTotalLength(event.fTotalLength),
76      fLength(event.fLength),
77      fDspId(event.fDspId),
78      fL0Trigger(event.fL0Trigger),
79      fMiniEventId(event.fMiniEventId),
80      fEventId1(event.fEventId1),
81      fEventId2(event.fEventId2),
82      fDspHeaderArray(new TClonesArray("AliMUONDspHeader", 5))
83 {
84   ///
85   /// copy ctor
86   ///
87
88   for (Int_t index = 0; index < (event.fDspHeaderArray)->GetEntriesFast(); index++) {
89     {new ((*fDspHeaderArray)[fDspHeaderArray->GetEntriesFast()]) 
90         AliMUONDspHeader(*(AliMUONDspHeader*)(event.fDspHeaderArray)->At(index));}
91   }
92   //  fDspHeaderArray->SetOwner();
93 }
94
95 //___________________________________________
96 AliMUONBlockHeader&
97 AliMUONBlockHeader::operator=(const AliMUONBlockHeader &event)
98 {
99   /// 
100   /// assignment operator
101   ///
102   if (this == &event) return *this;
103
104   fDataKey     = event.fDataKey;
105   fTotalLength = event.fTotalLength;
106   fLength      = event.fLength;
107   fDspId       = event.fDspId;
108  
109   fL0Trigger   = event.fL0Trigger;
110   fMiniEventId = event.fMiniEventId;
111   fEventId1    = event.fEventId1;
112   fEventId2    = event.fEventId2;
113
114   fDspHeaderArray = new TClonesArray("AliMUONDspHeader", 5);
115   for (Int_t index = 0; index < (event.fDspHeaderArray)->GetEntriesFast(); index++) {
116     new ((*fDspHeaderArray)[fDspHeaderArray->GetEntriesFast()]) 
117         AliMUONDspHeader(*(AliMUONDspHeader*)(event.fDspHeaderArray)->At(index));
118   }
119
120   return *this;
121
122 }
123 //___________________________________________
124 void AliMUONBlockHeader::AddDspHeader(const AliMUONDspHeader& dspHeader)
125
126   /// 
127   /// adding the dsp structure
128   /// into the TClonesArray
129   ///
130   TClonesArray &dspArray = *fDspHeaderArray;
131   new(dspArray[dspArray.GetEntriesFast()]) AliMUONDspHeader(dspHeader);
132
133 }
134 //___________________________________________
135 void AliMUONBlockHeader::Clear(Option_t* )
136 {
137   /// Clear TClones arrays
138   /// instead of deleting
139   ///
140   fDspHeaderArray->Clear("C");
141  
142 }
143
144 //___________________________________________
145 void AliMUONBlockHeader::Print(Option_t* /*opt*/) const
146 {
147   /// print out
148
149   cout << "CRT info"        << endl;
150   cout << "DataKey: "       << fDataKey << endl;
151   cout << "TotalLength: "   << fTotalLength << endl;
152   cout << "Length: "        << fLength << endl;
153   cout << "DspId: "         << fDspId << endl;
154  
155   cout << "L0Trigger: "     << fL0Trigger << endl;
156   cout << "MiniEventId: "   << fMiniEventId<< endl; 
157   cout << "EventId1: "      << fEventId1 << endl;
158   cout << "EventId2: "      << fEventId2 << endl;;
159
160 }