1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include "AliMUONSubEventTracker.h"
18 const Int_t AliMUONSubEventTracker::fgkHeaderLength = 4;
20 ClassImp(AliMUONSubEventTracker)
22 //___________________________________________
23 AliMUONSubEventTracker::AliMUONSubEventTracker()
32 fData = new UInt_t[fBufSize];
34 //___________________________________________
35 AliMUONSubEventTracker::~AliMUONSubEventTracker()
40 //___________________________________________
41 void AliMUONSubEventTracker::SetAlloc(Int_t size)
48 //___________________________________________
49 void AliMUONSubEventTracker::AddData(UInt_t data)
51 // could have used class from ROOT
52 // but the structure must be as simple as possible
53 // to be written on disc blockwise, not so sure ?
54 if (fLength == fBufSize)
56 fData[fLength++] = data;
57 fTotalLength = fLength + 4;
60 //___________________________________________
61 void AliMUONSubEventTracker::ResizeData(Int_t size)
67 UInt_t* newData = new UInt_t[fBufSize];
68 for (Int_t i = 0; i < fLength; i++)
69 newData[i] = fData[i];
73 //___________________________________________
74 AliMUONSubEventTracker::
75 AliMUONSubEventTracker(const AliMUONSubEventTracker& event): TObject(event)
77 fTotalLength = event.fTotalLength;
78 fLength = event.fLength;
79 fBusPatchId = event.fBusPatchId;
80 fTriggerWord = event.fTriggerWord;
82 fData = new UInt_t[event.fBufSize];
83 for (int i = 0; i < event.fBufSize; i++)
84 fData[i] = event.fData[i];
86 //___________________________________________
87 AliMUONSubEventTracker&
88 AliMUONSubEventTracker::operator=(const AliMUONSubEventTracker& event)
90 if (this == &event) return *this;
91 fTotalLength = event.fTotalLength;
92 fLength = event.fLength;
93 fBusPatchId = event.fBusPatchId;
94 fTriggerWord = event.fTriggerWord;
96 for (int i = 0; i < event.fLength; i++)
97 fData[i] = event.fData[i];
101 //___________________________________________
102 Int_t AliMUONSubEventTracker::Compare(const TObject *obj) const
104 AliMUONSubEventTracker* event = (AliMUONSubEventTracker*) obj;
105 return (fBusPatchId > event->GetBusPatchId()) ? 1 : -1;