]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCclusterKr.cxx
(Jens Viechula)
[u/mrichter/AliRoot.git] / TPC / AliTPCclusterKr.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: AliTPCclusterKr.cxx,v 1.7 2008/01/22 17:24:53 matyja Exp $ */
17
18 //-----------------------------------------------------------------
19 //           Implementation of the TPC Kr cluster class
20 //
21 // Origin: Adam Matyja, INP PAN, adam.matyja@ifj.edu.pl
22 //-----------------------------------------------------------------
23
24 #include "AliTPCclusterKr.h"
25 #include "AliCluster.h"
26 #include "AliTPCvtpr.h"
27 #include "TObjArray.h"
28
29 ClassImp(AliTPCclusterKr)
30
31
32 AliTPCclusterKr::AliTPCclusterKr()
33 :AliCluster(),
34  fMax(),
35  fADCcluster(0),
36  fSec(0),
37  fNPads(0),
38  fNRows(0),
39  fSize(0),
40  fCenterX(0),
41  fCenterY(0),
42  fCenterT(0),
43  fCluster(0)
44 {
45 //
46 // default constructor
47 //
48   fCluster=new TObjArray();
49 }
50
51 AliTPCclusterKr::AliTPCclusterKr(const AliTPCclusterKr &param)
52 :AliCluster(param),
53  fMax(),
54  fADCcluster(0),
55  fSec(0),
56  fNPads(0),
57  fNRows(0),
58  fSize(0),
59  fCenterX(0),
60  fCenterY(0),
61  fCenterT(0),
62  fCluster(0)
63 {
64 //
65 // copy constructor
66 //
67   fADCcluster = param.fADCcluster;
68   fSec  = param.fSec ;
69   fNPads = param.fNPads;
70   fNRows = param.fNRows;
71   fMax = param.fMax;
72   //  fCluster = param.fCluster;
73   fCenterX = param.fCenterX;
74   fCenterY = param.fCenterY;
75   fCenterT = param.fCenterT;
76   fCluster=new TObjArray(*(param.fCluster));
77   fSize = param.fSize;
78
79
80 AliTPCclusterKr &AliTPCclusterKr::operator = (const AliTPCclusterKr & param)
81 {
82   //
83   // assignment operator
84   // 
85   (AliCluster&)(*this) = (AliCluster&)param;
86   fADCcluster = param.fADCcluster;
87   fSec  = param.fSec ;
88   fNPads = param.fNPads;
89   fNRows = param.fNRows;
90   fMax = param.fMax;
91   //  fCluster=param.fCluster;
92   fCenterX = param.fCenterX;
93   fCenterY = param.fCenterY;
94   fCenterT = param.fCenterT;
95   delete fCluster;
96   fCluster=new TObjArray(*(param.fCluster));
97   fSize=param.fSize;
98   return (*this);
99 }
100
101 AliTPCclusterKr::~AliTPCclusterKr()
102 {
103   //
104   // destructor
105   //
106   if(fCluster) {
107     fCluster->SetOwner(kTRUE);
108     fCluster->Delete();
109     delete fCluster;
110   }
111   fCluster=0;
112 }
113
114 ////____________________________________________________________________________
115 void AliTPCclusterKr::SetCenter(){
116   //
117   // calculate geometrical center of the cluster
118   //
119   Double_t rX=0;
120   Double_t rY=0;
121   Double_t rT=0;
122
123   Short_t adc;
124   fADCcluster=0;
125   for(Int_t iter = 0; iter < fCluster->GetEntriesFast(); ++iter) {
126     AliTPCvtpr *iclus=(AliTPCvtpr *)fCluster->At(iter);
127
128     //for( std::vector<AliTPCvtpr*>::iterator iclus  = fCluster.begin();
129     //iclus != fCluster.end(); ++iclus ) {
130     adc = (iclus)->GetAdc();
131     fADCcluster+=adc;
132     rX += ((iclus)->GetX() * adc);
133     rY += ((iclus)->GetY() * adc);
134     rT += ((iclus)->GetT() * adc);
135   }
136   fCenterX=rX/fADCcluster;
137   fCenterY=rY/fADCcluster;
138   fCenterT=rT/fADCcluster;
139
140   return;
141 }