]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCclusterKr.cxx
Changes needed for the analysis train (Mihaela).
[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)delete fCluster;
107   fCluster=0;
108 }
109
110 ////____________________________________________________________________________
111 void AliTPCclusterKr::SetCenter(){
112   //
113   // calculate geometrical center of the cluster
114   //
115   Double_t rX=0;
116   Double_t rY=0;
117   Double_t rT=0;
118
119   Short_t adc;
120   fADCcluster=0;
121   for(Int_t iter = 0; iter < fCluster->GetEntriesFast(); ++iter) {
122     AliTPCvtpr *iclus=(AliTPCvtpr *)fCluster->At(iter);
123
124     //for( std::vector<AliTPCvtpr*>::iterator iclus  = fCluster.begin();
125     //iclus != fCluster.end(); ++iclus ) {
126     adc = (iclus)->GetAdc();
127     fADCcluster+=adc;
128     rX += ((iclus)->GetX() * adc);
129     rY += ((iclus)->GetY() * adc);
130     rT += ((iclus)->GetTime() * adc);
131   }
132   fCenterX=rX/fADCcluster;
133   fCenterY=rY/fADCcluster;
134   fCenterT=rT/fADCcluster;
135
136   return;
137 }