]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSRawCluster.cxx
New version from B. Batyunya to get the Dubna model work with the present HEAD
[u/mrichter/AliRoot.git] / ITS / AliITSRawCluster.cxx
1 #include <iostream.h>
2 #include <TMath.h>
3  
4 #include "AliITSRawCluster.h"
5
6 ClassImp(AliITSRawCluster)
7  
8 ClassImp(AliITSRawClusterSDD)
9 //--------------------------------------
10 AliITSRawClusterSDD::AliITSRawClusterSDD(Int_t wing, Float_t Anode,Float_t Time, Float_t Charge, 
11               Float_t PeakAmplitude,Int_t PeakPosition,  Float_t Asigma, Float_t Tsigma, Float_t DriftPath, Float_t AnodeOffset,  Int_t Samples, 
12                            Int_t Tstart, Int_t Tstop, Int_t Tstartf, Int_t Tstopf, Int_t Anodes, Int_t Astart, Int_t Astop)
13 {                                
14   // constructor
15   fWing = wing;
16   fAnode = Anode;
17   fTime = Time;
18   fQ = Charge;
19   fPeakAmplitude = PeakAmplitude;
20   fPeakPosition = PeakPosition;
21   fAsigma = Asigma;
22   fTsigma = Tsigma;
23   fNanodes = Anodes;
24   fTstart = Tstart;
25   fTstop = Tstop;
26   fTstartf = Tstartf;
27   fTstopf = Tstopf;
28   fAstart = Astart;
29   fAstop = Astop;
30   fMultiplicity = Samples;
31   fSumAmplitude = 0;
32   Int_t sign = 1;
33   for(Int_t i=0;i<fWing; i++) sign*=(-1);
34   fX = DriftPath*sign/10000.;
35   fZ = AnodeOffset/10000.;
36 }
37 AliITSRawClusterSDD::AliITSRawClusterSDD( const AliITSRawClusterSDD & source)
38 {
39   // copy constructor
40   fWing = source.fWing;
41   fAnode = source.fAnode;
42   fTime = source.fTime;
43   fQ = source.fQ;
44   fPeakAmplitude = source.fPeakAmplitude;
45   fPeakPosition = source.fPeakPosition;
46   fAsigma = source.fAsigma;
47   fTsigma = source.fTsigma;
48   fNanodes = source.fNanodes;
49   fTstart = source.fTstart;
50   fTstop = source.fTstop;
51   fTstartf = source.fTstartf;
52   fTstopf = source.fTstopf;
53   fAstart = source.fAstart;
54   fAstop = source.fAstop;
55
56   fMultiplicity = source.fMultiplicity;
57   fSumAmplitude = source.fSumAmplitude;
58   fX = source.fX;
59   fZ = source.fZ;
60 }
61 //----------------------------------------
62 void AliITSRawClusterSDD::Add(AliITSRawClusterSDD* clJ) {
63   // add
64   fAnode = (fAnode*fQ + clJ->A()*clJ->Q())/(fQ+clJ->Q());
65   fTime = (fTime*fQ + clJ->T()*clJ->Q())/(fQ+clJ->Q());
66   fX = (fX*fQ + clJ->X()*clJ->Q())/(fQ+clJ->Q());
67   fZ = (fZ*fQ + clJ->Z()*clJ->Q())/(fQ+clJ->Q());
68   fQ += clJ->Q();
69   if(fSumAmplitude == 0) fSumAmplitude += fPeakAmplitude;
70   /*
71   fAnode = (fAnode*fSumAmplitude+clJ->A()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
72   fTime = (fTime*fSumAmplitude +clJ->T()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
73   fX = (fX*fSumAmplitude +clJ->X()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
74   fZ = (fZ*fSumAmplitude +clJ->Z()*clJ->PeakAmpl())/(fSumAmplitude+clJ->PeakAmpl());
75   */
76   fSumAmplitude += clJ->PeakAmpl();
77
78   fTstart = clJ->Tstart();
79   fTstop = clJ->Tstop();
80   if(fTstartf > clJ->Tstartf()) fTstartf = clJ->Tstartf();
81   if(fTstopf < clJ->Tstopf()) fTstopf = clJ->Tstopf();
82   if(fAstop < clJ->Astop()) fAstop = clJ->Astop();
83
84   fMultiplicity += (Int_t) (clJ->Samples());
85   (fNanodes)++;
86   if(clJ->PeakAmpl() > fPeakAmplitude) {
87      fPeakAmplitude = clJ->PeakAmpl();
88      fPeakPosition = clJ->PeakPos();
89   }
90   
91   return;
92
93
94 //--------------------------------------
95 Bool_t AliITSRawClusterSDD::Brother(AliITSRawClusterSDD* cluster,Float_t danode,Float_t dtime) {
96
97   Bool_t brother = kFALSE;
98
99   Bool_t test2 = kFALSE;
100   Bool_t test3 = kFALSE;
101   Bool_t test4 = kFALSE;
102   Bool_t test5 = kFALSE;
103   
104   if(fWing != cluster->W()) return brother;
105
106   if(fTstopf >= cluster->Tstart() && fTstartf <= cluster->Tstop()) test2 = kTRUE;
107   if(cluster->Astop() == (fAstop+1)) test3 = kTRUE;
108
109   if(TMath::Abs(fTime-cluster->T()) < dtime) test4 = kTRUE;
110   if(TMath::Abs(fAnode-cluster->A()) < danode) test5 = kTRUE;
111
112   if((test2 && test3) || (test4 && test5) ) {
113     return brother = kTRUE;
114   }
115   
116   return brother;
117 }
118
119 //--------------------------------------
120 void AliITSRawClusterSDD::PrintInfo() {
121   // print
122   cout << ", Anode " << fAnode << ", Time: " << fTime << ", Charge: " << fQ;
123   cout << ", Samples: " << fMultiplicity;
124   cout << ", X: " << fX << ", Z: " << fZ << "tstart " << fTstart << "tstop "<< fTstop <<endl;
125 }
126 //--------------------------------------
127
128
129 ClassImp(AliITSRawClusterSPD)
130   //--------------------------------------
131
132   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) {
133   // constructor
134   
135   fZ = clz;
136   fX = clx;
137   fQ = Charge;
138   fNClZ = ClusterSizeZ;
139   fNClX = ClusterSizeX;
140   fXStart = xstart;
141   fXStop = xstop;
142   fXStartf = xstartf;
143   fXStopf = xstopf;
144   fZStart = zstart;
145   fZStop = zstop;
146   fZend = zend;
147 }
148
149 //--------------------------------------
150 void AliITSRawClusterSPD::Add(AliITSRawClusterSPD* clJ) {
151   // Recolculate the new center of gravity coordinate and cluster sizes
152   // in both directions after grouping of clusters
153   
154   if(this->fZStop < clJ->ZStop()) this->fZStop = clJ->ZStop();  
155   
156   this->fZ = this->fZ + clJ->Z();
157   this->fX = (this->fX + clJ->X())/2.;
158   this->fQ = this->fQ + clJ->Q();
159   
160   this->fXStart = clJ->XStart(); // for a comparison with the next
161   this->fXStop = clJ->XStop();   // z column
162   
163   if(this->fXStartf > clJ->XStartf()) this->fXStartf = clJ->XStartf();
164   if(this->fXStopf < clJ->XStopf()) this->fXStopf = clJ->XStopf();
165   if(this->fZend < clJ->Zend()) this->fZend = clJ->Zend();
166   this->fNClX = this->fXStopf - this->fXStartf + 1; 
167   (this->fNClZ)++;
168   
169   return;
170
171
172 //--------------------------------------
173 Bool_t AliITSRawClusterSPD::Brother(AliITSRawClusterSPD* cluster,Float_t dz,Float_t dx) {
174   // fXStart, fXstop and fZend information is used now instead of dz and dx
175   // to check an absent (or a present) of the gap between two pixels in 
176   // both x and z directions. The increasing order of fZend is used.
177   
178   Bool_t brother = kFALSE;  
179   Bool_t test2 = kFALSE;  
180   Bool_t test3 = kFALSE;  
181   
182   // Diagonal clusters are included:
183   if(fXStop >= (cluster->XStart() -1) && fXStart <= (cluster->XStop()+1)) test2 = kTRUE;
184   
185   // Diagonal clusters are excluded:   
186   //       if(fXStop >= cluster->XStart() && fXStart <= cluster->XStop()) test2 = kTRUE;
187   if(cluster->Zend() == (fZend + 1)) test3 = kTRUE; 
188   if(test2 && test3) {
189     // cout<<"test 2,3 0k, brother = true "<<endl;
190     return brother = kTRUE;
191   }
192   return brother;
193 }
194
195 //--------------------------------------
196 void AliITSRawClusterSPD::PrintInfo() 
197 {
198   // print
199   cout << ", Z: " << fZ << ", X: " << fX << ", Charge: " << fQ<<endl;
200   cout << " Z cluster size: " << fNClZ <<", X cluster size "<< fNClX <<endl;
201   cout <<" XStart, XStop, XStartf,XStopf,Zend ="<<fXStart<<","<<fXStop<<","<<fXStartf<<","<<fXStopf<<","<<fZend<<endl;
202   
203 }
204
205
206 ClassImp(AliITSRawClusterSSD)
207   //--------------------------------------
208   AliITSRawClusterSSD::AliITSRawClusterSSD(Float_t Prob,Int_t Sp,Int_t Sn) {  
209   // constructor
210   //fProbability   = Prob;
211   fMultiplicity  = Sp;
212   fMultiplicityN = Sn;
213   
214 }