]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCClustersArray.cxx
o) Added DrawHistograms function
[u/mrichter/AliRoot.git] / TPC / AliTPCClustersArray.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 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  Time Projection Chamber clusters objects                                //
21 //
22 //  Origin: Marian Ivanov , GSI Darmstadt
23 //                                                                           //
24 //                                                                           //
25 //                                                                          //
26 ///////////////////////////////////////////////////////////////////////////////
27 #include "AliTPCParam.h" 
28 #include "AliSegmentArray.h" 
29 #include "AliComplexCluster.h"
30 #include "AliClusters.h"
31 #include "AliClustersArray.h" 
32 #include "AliTPCClustersRow.h" 
33
34 #include "AliTPCClustersArray.h"
35 #include "TClonesArray.h"
36 #include "TDirectory.h"
37 #include <TClass.h>
38
39
40
41 //_____________________________________________________________________________
42
43 ClassImp(AliTPCClustersArray) 
44
45 AliTPCClustersArray::AliTPCClustersArray()
46 {
47   fParam = 0;
48   SetClass("AliTPCClustersRow");
49 }
50
51 AliTPCClustersArray::~AliTPCClustersArray()
52 {
53   //
54 }
55
56
57
58 AliTPCClustersRow * AliTPCClustersArray::GetRow(Int_t sector,Int_t row) 
59 {
60   //
61   //return clusters ((AliTPCClustersRow *) per given sector and padrow
62   //
63   if (fParam==0) return 0;
64   Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);  
65   return (AliTPCClustersRow *)(*this)[index];
66 }
67
68 AliTPCClustersRow *  AliTPCClustersArray::CreateRow(Int_t sector, Int_t row)
69 {
70   //
71   //create digits row  
72   //
73   //if row just exist - delete it
74   AliTPCParam * param = (AliTPCParam*)fParam;
75   Int_t index = param->GetIndex(sector,row);  
76   AliTPCClustersRow * clusters = (AliTPCClustersRow *)(*this)[index];
77   if (clusters !=0) delete clusters;
78
79   clusters = (AliTPCClustersRow *) AddSegment(index);
80   if (clusters == 0) return 0;
81   return clusters;
82 }
83
84 AliTPCClustersRow * AliTPCClustersArray::LoadRow(Int_t sector,Int_t row)
85 {
86   //
87   //return clusters ((AliTPCClustersRow *) per given sector and padrow
88   //
89   if (fParam==0) return 0;
90   Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);  
91   return (  AliTPCClustersRow *) LoadSegment(index);
92 }
93
94 Bool_t  AliTPCClustersArray::StoreRow(Int_t sector,Int_t row)
95 {
96   //
97   //return clusters ((AliTPCClustersRow *) per given sector and padrow
98   //
99   if (fParam==0) return 0;
100   Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);  
101   StoreSegment(index);
102   return kTRUE;
103 }
104
105 Bool_t  AliTPCClustersArray::ClearRow(Int_t sector,Int_t row)
106 {
107   //
108   //return clusters ((AliTPCDigitsRow *) per given sector and padrow
109   //
110   if (fParam==0) return 0;
111   Int_t index = ((AliTPCParam*)fParam)->GetIndex(sector,row);  
112   ClearSegment(index);
113   return kTRUE;
114 }
115
116
117
118 Bool_t AliTPCClustersArray::Setup(const AliDetectorParam *param)
119 {
120   //
121   //setup  function to adjust array parameters
122   //
123   if (param==0) return kFALSE;
124   fParam = (AliDetectorParam *)param;
125   return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
126
127 }
128 Bool_t AliTPCClustersArray::Update()
129 {
130   //
131   //setup  function to adjust array parameters
132   //
133   if (fParam ==0 ) return kFALSE;
134   if (fTree!=0) return MakeDictionary( ((AliTPCParam*)fParam)->GetNRowsTotal()) ;
135   ((AliTPCParam*)fParam)->Update();
136   return MakeArray(((AliTPCParam*)fParam)->GetNRowsTotal());
137 }
138
139
140 AliSegmentID * AliTPCClustersArray::NewSegment()
141 {
142   //
143   //create object according class information 
144   if (fClusterType==0) {
145     Error("AliTPCCLustersArray", "cluster type isn't adjusted");
146     return 0;
147   }
148   AliSegmentID *segment=AliSegmentArray::NewSegment();
149   ((AliTPCClustersRow*)segment)->SetClass(fClusterType->GetName()); 
150   ((AliTPCClustersRow*)segment)->SetArray(100);
151   return segment;
152 }