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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Time Projection Chamber clusters objects //
22 // Origin: Marian Ivanov , GSI Darmstadt
26 ///////////////////////////////////////////////////////////////////////////////
27 #include "AliTPCParam.h"
28 #include "AliTPCPRF2D.h"
30 #include "TObjArray.h"
31 #include "AliSegmentID.h"
32 #include "AliSegmentArray.h"
34 #include "AliDigits.h"
35 #include "AliSimDigits.h"
36 #include "AliDigitsArray.h"
37 #include "AliTPCDigitsArray.h"
38 #include <TDirectory.h>
42 //_____________________________________________________________________________
44 ClassImp(AliTPCDigitsArray)
46 AliTPCDigitsArray::AliTPCDigitsArray(Bool_t sim)
52 if ( sim == kTRUE) SetClass("AliSimDigits");
54 SetClass("AliDigits");
62 AliTPCDigitsArray::~AliTPCDigitsArray()
69 AliDigits * AliTPCDigitsArray::CreateRow(Int_t sector, Int_t row)
74 //if row just exist - delete it
75 AliTPCParam * param = (AliTPCParam*)fParam;
76 Int_t index = param->GetIndex(sector,row);
77 AliDigits * dig = (AliDigits *)(*this)[index];
78 if (dig !=0) delete dig;
80 dig = (AliDigits *) AddSegment(index);
81 if (dig == 0) return 0;
82 dig->Allocate(param->GetMaxTBin(),param->GetNPads(sector,row));
83 if (fBSim == kTRUE) ((AliSimDigits*) dig)->AllocateTrack(fTrackLevel);
88 AliDigits * AliTPCDigitsArray::GetRow(Int_t sector,Int_t row)
91 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
93 if (fParam==0) return 0;
94 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
95 return (AliDigits *)(*this)[index];
98 AliDigits * AliTPCDigitsArray::LoadRow(Int_t sector,Int_t row)
101 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
103 if (fParam==0) return 0;
104 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
105 return (AliDigits *)LoadSegment(index);
108 Bool_t AliTPCDigitsArray::StoreRow(Int_t sector,Int_t row)
111 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
113 AliTPCParam * param = (AliTPCParam*)fParam;
114 if (fParam==0) return 0;
115 Int_t index = param->GetIndex(sector,row);
116 ( (AliDigits *)At(index))->CompresBuffer(fCompression,param->GetZeroSup());
117 if (fBSim == kTRUE) ( (AliSimDigits *)At(index))->CompresTrackBuffer(1);
122 Bool_t AliTPCDigitsArray::ClearRow(Int_t sector,Int_t row)
125 //return clusters ((AliTPCDigitsRow *) per given sector and padrow
127 if (fParam==0) return 0;
128 Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);
135 Bool_t AliTPCDigitsArray::Setup(AliDetectorParam *param)
138 //setup function to adjust array parameters
140 if (param==0) return kFALSE;
141 if (fParam !=0) delete fParam;
142 // fParam = new AliTPCParam((AliTPCParam&)(*param));
144 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
147 Bool_t AliTPCDigitsArray::Update()
150 //setup function to adjust array parameters
152 if (fParam ==0 ) return kFALSE;
153 if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
154 ((AliTPCParam*)fParam)->Update();
155 return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());