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 ClassImp(AliMUONSubEventTracker)
20 const Int_t AliMUONSubEventTracker::fgkHeaderLength = 4;
22 //___________________________________________
23 AliMUONSubEventTracker::AliMUONSubEventTracker()
32 fData = new UInt_t[fBufSize];
34 //___________________________________________
35 AliMUONSubEventTracker::~AliMUONSubEventTracker()
41 //___________________________________________
42 void AliMUONSubEventTracker::SetAlloc(Int_t size)
49 //___________________________________________
50 void AliMUONSubEventTracker::AddData(UInt_t data)
52 // could have used class from ROOT
53 // but the structure must be as simple as possible
54 // to be written on disc blockwise, not so sure ?
55 if (fLength == fBufSize)
57 fData[fLength++] = data;
58 fTotalLength = fLength + 4;
61 //___________________________________________
62 void AliMUONSubEventTracker::ResizeData(Int_t size)
68 UInt_t* newData = new UInt_t[fBufSize];
69 for (Int_t i = 0; i < fLength; i++)
70 newData[i] = fData[i];
74 //___________________________________________
75 AliMUONSubEventTracker::
76 AliMUONSubEventTracker(const AliMUONSubEventTracker& event): TObject(event)
78 fTotalLength = event.fTotalLength;
79 fLength = event.fLength;
80 fBusPatchId = event.fBusPatchId;
81 fTriggerWord = event.fTriggerWord;
83 fData = new UInt_t[event.fBufSize];
84 for (int i = 0; i < event.fBufSize; i++)
85 fData[i] = event.fData[i];
87 //___________________________________________
88 AliMUONSubEventTracker&
89 AliMUONSubEventTracker::operator=(const AliMUONSubEventTracker& event)
91 if (this == &event) return *this;
92 fTotalLength = event.fTotalLength;
93 fLength = event.fLength;
94 fBusPatchId = event.fBusPatchId;
95 fTriggerWord = event.fTriggerWord;
97 for (int i = 0; i < event.fLength; i++)
98 fData[i] = event.fData[i];
102 //___________________________________________
103 Int_t AliMUONSubEventTracker::Compare(const TObject *obj) const
105 AliMUONSubEventTracker* event = (AliMUONSubEventTracker*) obj;
106 return (fBusPatchId > event->GetBusPatchId()) ? 1 : -1;