]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSubEventTracker.cxx
Removed - functionality of this class moved to geometry and mapping
[u/mrichter/AliRoot.git] / MUON / AliMUONSubEventTracker.cxx
CommitLineData
69be760c 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 **************************************************************************/
8c343c7c 15
69be760c 16#include "AliMUONSubEventTracker.h"
17
18ClassImp(AliMUONSubEventTracker)
19
c8f4be1a 20 const Int_t AliMUONSubEventTracker::fgkHeaderLength = 4;
21
69be760c 22//___________________________________________
23AliMUONSubEventTracker::AliMUONSubEventTracker()
24 : TObject(),
25 fTotalLength(0),
26 fLength(0),
27 fBusPatchId(0),
28 fTriggerWord(0),
29 fBufSize(1024)
30{
31 //ctor
32 fData = new UInt_t[fBufSize];
33}
34//___________________________________________
35AliMUONSubEventTracker::~AliMUONSubEventTracker()
36{
37 if(fData)
38 delete[] fData;
39}
40
41//___________________________________________
42void AliMUONSubEventTracker::SetAlloc(Int_t size)
43{
44 if (size < fBufSize)
45 return;
46 else
47 ResizeData(size);
48}
49//___________________________________________
50void AliMUONSubEventTracker::AddData(UInt_t data)
51{
52 // could have used class from ROOT
53 // but the structure must be as simple as possible
c8f4be1a 54 // to be written on disc blockwise, not so sure ?
69be760c 55 if (fLength == fBufSize)
56 ResizeData();
57 fData[fLength++] = data;
58 fTotalLength = fLength + 4;
59}
60
61//___________________________________________
62void AliMUONSubEventTracker::ResizeData(Int_t size)
63{
64 if (size == 0)
65 fBufSize *= 2;
66 else
67 fBufSize = size;
68 UInt_t* newData = new UInt_t[fBufSize];
69 for (Int_t i = 0; i < fLength; i++)
70 newData[i] = fData[i];
71 delete[] fData;
72 fData = newData;
73}
74//___________________________________________
75AliMUONSubEventTracker::
76AliMUONSubEventTracker(const AliMUONSubEventTracker& event): TObject(event)
77{
78 fTotalLength = event.fTotalLength;
79 fLength = event.fLength;
80 fBusPatchId = event.fBusPatchId;
81 fTriggerWord = event.fTriggerWord;
82
83 fData = new UInt_t[event.fBufSize];
84 for (int i = 0; i < event.fBufSize; i++)
85 fData[i] = event.fData[i];
86}
87//___________________________________________
88AliMUONSubEventTracker&
89AliMUONSubEventTracker::operator=(const AliMUONSubEventTracker& event)
90{
91 if (this == &event) return *this;
92 fTotalLength = event.fTotalLength;
93 fLength = event.fLength;
94 fBusPatchId = event.fBusPatchId;
95 fTriggerWord = event.fTriggerWord;
96
97 for (int i = 0; i < event.fLength; i++)
98 fData[i] = event.fData[i];
99
100 return *this;
101}
102//___________________________________________
103Int_t AliMUONSubEventTracker::Compare(const TObject *obj) const
104{
105 AliMUONSubEventTracker* event = (AliMUONSubEventTracker*) obj;
106 return (fBusPatchId > event->GetBusPatchId()) ? 1 : -1;
107}