]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawCluster.cxx
Correction of the inheritance scheme
[u/mrichter/AliRoot.git] / ITS / AliITSRawCluster.cxx
CommitLineData
b0f5e3fc 1#include <iostream.h>
2#include <TMath.h>
3
4#include "AliITSRawCluster.h"
5
6ClassImp(AliITSRawCluster)
7
8ClassImp(AliITSRawClusterSDD)
9//--------------------------------------
10AliITSRawClusterSDD::AliITSRawClusterSDD(Int_t wing, Float_t Anode,Float_t Time,Float_t Charge,Float_t PeakAmplitude,Float_t Asigma, Float_t Tsigma,Float_t DriftPath,Float_t AnodeOffset,Int_t Samples) {
11 // constructor
12 fWing = wing;
13 fAnode = Anode;
14 fTime = Time;
15 fQ = Charge;
16 fPeakAmplitude = PeakAmplitude;
17 fNanodes = 1;
18 fNsamples = Samples;
19 Int_t sign = 1;
20 Int_t i;
21 for(i=0;i<fWing; i++) sign*=(-1);
22 fX = DriftPath*sign/10000.;
23 fZ = AnodeOffset/10000.;
24}
25
26//----------------------------------------
27void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
28 // add
29 fAnode = (fAnode*fQ + clJ->A()*clJ->Q())/(fQ+clJ->Q());
30 fTime = (fTime*fQ + clJ->T()*clJ->Q())/(fQ+clJ->Q());
31 fX = (fX*fQ + clJ->X()*clJ->Q())/(fQ+clJ->Q());
32 fZ = (fZ*fQ + clJ->Z()*clJ->Q())/(fQ+clJ->Q());
33 fQ += clJ->Q();
34 fNsamples += (Int_t) (clJ->Samples());
35 (fNanodes)++;
36 if(clJ->PeakAmpl() > fPeakAmplitude) fPeakAmplitude = clJ->PeakAmpl();
37
38 return;
39}
40//--------------------------------------
41Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,Float_t danode,Float_t dtime) {
42 // brother
43 Bool_t brother = kTRUE;
44 if(fWing != cluster->W()) return brother = kFALSE;
45 if(TMath::Abs(fTime-cluster->T()) > dtime) return brother = kFALSE;
46 if(TMath::Abs(fAnode-cluster->A()) > danode) return brother = kFALSE;
47 return brother;
48}
49
50//--------------------------------------
51void AliITSRawClusterSDD::Print() {
52 // print
53 cout << ", Anode " << fAnode << ", Time: " << fTime << ", Charge: " << fQ;
54 cout << ", Samples: " << fNsamples;
55 cout << ", X: " << fX << ", Z: " << fZ << endl;
56}
57//--------------------------------------
58
59
60ClassImp(AliITSRawClusterSPD)
61 //--------------------------------------
62
63 AliITSRawClusterSPD::AliITSRawClusterSPD(Float_t clz,Float_t clx,Float_t Charge,Int_t ClusterSizeZ,Int_t ClusterSizeX,Int_t xstart,Int_t xstop,Int_t xstartf,Int_t xstopf,Float_t zstart,Float_t zstop,Int_t zend) {
64 // constructor
65
66 fZ = clz;
67 fX = clx;
68 fQ = Charge;
69 fNClZ = ClusterSizeZ;
70 fNClX = ClusterSizeX;
71 fXStart = xstart;
72 fXStop = xstop;
73 fXStartf = xstartf;
74 fXStopf = xstopf;
75 fZStart = zstart;
76 fZStop = zstop;
77 fZend = zend;
78}
79
80//--------------------------------------
81void AliITSRawClusterSPD::Add(AliITSRawClusterSPD* clJ) {
82 // Recolculate the new center of gravity coordinate and cluster sizes
83 // in both directions after grouping of clusters
84
85 if(this->fZStop < clJ->ZStop()) this->fZStop = clJ->ZStop();
86
87 this->fZ = (this->fZ + clJ->Z())/2.;
88 this->fX = (this->fX + clJ->X())/2.;
89 this->fQ = this->fQ + clJ->Q();
90
91 this->fXStart = clJ->XStart(); // for a comparison with the next
92 this->fXStop = clJ->XStop(); // z column
93
94 if(this->fXStartf > clJ->XStartf()) this->fXStartf = clJ->XStartf();
95 if(this->fXStopf < clJ->XStopf()) this->fXStopf = clJ->XStopf();
96 if(this->fZend < clJ->Zend()) this->fZend = clJ->Zend();
97 this->fNClX = this->fXStopf - this->fXStartf + 1;
98 (this->fNClZ)++;
99
100 return;
101}
102
103//--------------------------------------
104Bool_t AliITSRawClusterSPD::Brother(AliITSRawClusterSPD* cluster,Float_t dz,Float_t dx) {
105 // fXStart, fXstop and fZend information is used now instead of dz and dx
106 // to check an absent (or a present) of the gap between two pixels in
107 // both x and z directions. The increasing order of fZend is used.
108
109 Bool_t brother = kFALSE;
110 Bool_t test2 = kFALSE;
111 Bool_t test3 = kFALSE;
112
113 // Diagonal clusters are included:
114 if(fXStop >= (cluster->XStart() -1) && fXStart <= (cluster->XStop()+1)) test2 = kTRUE;
115
116 // Diagonal clusters are excluded:
117 // if(fXStop >= cluster->XStart() && fXStart <= cluster->XStop()) test2 = kTRUE;
118 if(cluster->Zend() == (fZend + 1)) test3 = kTRUE;
119 if(test2 && test3) {
120 // cout<<"test 2,3 0k, brother = true "<<endl;
121 return brother = kTRUE;
122 }
123 return brother;
124}
125
126//--------------------------------------
127void AliITSRawClusterSPD::Print()
128{
129 // print
130 cout << ", Z: " << fZ << ", X: " << fX << ", Charge: " << fQ<<endl;
131 cout << " Z cluster size: " << fNClZ <<", X cluster size "<< fNClX <<endl;
132 cout <<" XStart, XStop, XStartf,XStopf,Zend ="<<fXStart<<","<<fXStop<<","<<fXStartf<<","<<fXStopf<<","<<fZend<<endl;
133
134}
135
136
137ClassImp(AliITSRawClusterSSD)
138 //--------------------------------------
139 AliITSRawClusterSSD::AliITSRawClusterSSD(Float_t Prob,Int_t Sp,Int_t Sn) {
140 // constructor
141 //fProbability = Prob;
142 fMultiplicity = Sp;
143 fMultiplicityN = Sn;
144
145}