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