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