]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/PHOS-HTML/src/AliPHOSClusterizerv1.cxx.html
This commit was generated by cvs2svn to compensate for changes in r799,
[u/mrichter/AliRoot.git] / PHOS / PHOS-HTML / src / AliPHOSClusterizerv1.cxx.html
1 <!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">
2 <html>
3 <!--                                             -->
4 <!-- Author: ROOT team (rootdev@hpsalo.cern.ch)  -->
5 <!--                                             -->
6 <!--   Date: Thu Mar  9 00:11:48 2000            -->
7 <!--                                             -->
8 <head>
9 <title>AliPHOSClusterizerv1 - source file</title>
10 <link rev=made href="mailto:rootdev@root.cern.ch">
11 <meta name="rating" content="General">
12 <meta name="objecttype" content="Manual">
13 <meta name="keywords" content="software development, oo, object oriented, unix, x11, motif, windows nt, c++, html, rene brun, fons rademakers">
14 <meta name="description" content="ROOT - An Object Oriented Framework For Large Scale Data Analysis.">
15 </head>
16 <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" TEXT="#000000">
17 <a name="TopOfPage"></a>
18 <pre>
19 /**************************************************************************
20  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
21  *                                                                        *
22  * Author: The ALICE Off-line Project.                                    *
23  * Contributors are mentioned in the code where appropriate.              *
24  *                                                                        *
25  * Permission to use, copy, modify and distribute this software and its   *
26  * documentation strictly for non-commercial purposes is hereby granted   *
27  * without fee, provided that the above copyright notice appears in all   *
28  * copies and that both the copyright notice and this permission notice   *
29  * appear in the supporting documentation. The authors make no claims     *
30  * about the suitability of this software for any purpose. It is          *
31  * provided "as is" without express or implied warranty.                  *
32  **************************************************************************/
33
34 /* $Id$ */
35
36 <b>//_________________________________________________________________________</b>
37 <b>//  Implementation version 1 of the clusterization algorithm </b>
38 <b>// </b>
39 <b>//*-- Author: Yves Schutz (SUBATECH) </b>
40 <b>//////////////////////////////////////////////////////////////////////////////</b>
41
42 <b>// --- ROOT system ---</b>
43
44 #include "TMath.h" 
45
46 <b>// --- Standard library ---</b>
47
48 #include &lt;iostream&gt;
49
50 <b>// --- AliRoot header files ---</b>
51
52 #include "<a href="../AliPHOSClusterizerv1.h">AliPHOSClusterizerv1.h</a>"
53 #include "<a href="../AliPHOSDigit.h">AliPHOSDigit.h</a>"
54 #include "<a href="../AliPHOSEmcRecPoint.h">AliPHOSEmcRecPoint.h</a>"
55 #include "<a href="../AliPHOSPpsdRecPoint.h">AliPHOSPpsdRecPoint.h</a>"
56 #include "<a href="../AliPHOSv0.h">AliPHOSv0.h</a>" 
57 #include "AliRun.h" 
58
59 ClassImp(AliPHOSClusterizerv1)
60
61 <b>//____________________________________________________________________________</b>
62 <a name="AliPHOSClusterizerv1:AliPHOSClusterizerv1"> </a><a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:AliPHOSClusterizerv1">AliPHOSClusterizerv1::AliPHOSClusterizerv1</a>()
63 {
64 <b>  // default ctor (to be used)</b>
65
66   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fA">fA</a>                       = 0.;
67   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fB">fB</a>                       = 0.01 ;
68   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfEmcClusters">fNumberOfEmcClusters</a>     = 0 ; 
69   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfPpsdClusters">fNumberOfPpsdClusters</a>    = 0 ; 
70   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fEmcClusteringThreshold">fEmcClusteringThreshold</a>  = 0.1;   
71   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fEmcEnergyThreshold">fEmcEnergyThreshold</a>      = 0.01;    
72   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fPpsdClusteringThreshold">fPpsdClusteringThreshold</a> = 0.00000015; 
73   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fPpsdEnergyThreshold">fPpsdEnergyThreshold</a>     = 0.0000001;  
74   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fW0">fW0</a>                      = 4.5 ;
75   <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fLocMaxCut">fLocMaxCut</a>               = 0.06 ;
76 }
77
78 <b>//____________________________________________________________________________</b>
79 <a name="AliPHOSClusterizerv1:AreNeighbours"> </a><a href="../ListOfTypes.html#Int_t">Int_t</a> <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:AreNeighbours">AliPHOSClusterizerv1::AreNeighbours</a>(<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * d1, <a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * d2)
80 {
81 <b>  // Gives the neighbourness of two digits = 0 are not neighbour but continue searching </b>
82 <b>  //                                       = 1 are neighbour</b>
83 <b>  //                                       = 2 are not neighbour but do not continue searching</b>
84 <b>  // neighbours are defined as digits having at least common vertex</b>
85 <b>  // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster </b>
86 <b>  //                                      which is compared to a digit (d2)  not yet in a cluster  </b>
87
88   <a href="../ListOfTypes.html#Int_t">Int_t</a> rv = 0 ; 
89
90   <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
91
92   <a href="../ListOfTypes.html#Int_t">Int_t</a> relid1[4] ; 
93   geom-&gt;AbsToRelNumbering(d1-&gt;GetId(), relid1) ; 
94
95   <a href="../ListOfTypes.html#Int_t">Int_t</a> relid2[4] ; 
96   geom-&gt;AbsToRelNumbering(d2-&gt;GetId(), relid2) ; 
97  
98   if ( (relid1[0] == relid2[0]) &amp;&amp; (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module 
99     <a href="../ListOfTypes.html#Int_t">Int_t</a> rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;  
100     <a href="../ListOfTypes.html#Int_t">Int_t</a> coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;  
101     
102     if (( coldiff &lt;= 1 )  &amp;&amp; ( rowdiff &lt;= 1 )){
103       rv = 1 ; 
104     }
105     else {
106       if((relid2[2] &gt; relid1[2]) &amp;&amp; (relid2[3] &gt; relid1[3]+1)) 
107         rv = 2; //  Difference in row numbers is too large to look further 
108     }
109
110   } 
111   else {
112     
113     if( (relid1[0] &lt; relid2[0]) || (relid1[1] &lt; relid2[1]) )  
114       rv=2 ;
115
116   }
117   
118   return rv ; 
119 }
120
121 <b>//____________________________________________________________________________</b>
122 <a name="AliPHOSClusterizerv1:FillandSort"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:FillandSort">AliPHOSClusterizerv1::FillandSort</a>(const <a href="../ListOfTypes.html#DigitsList">DigitsList</a> * dl, TObjArray * tl) 
123 {
124 <b>  // Copies the digits with energy above thershold and sorts the list</b>
125 <b>  // according to increasing Id number</b>
126
127   <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
128   <a href="../ListOfTypes.html#Int_t">Int_t</a> relid[4] ;  
129   
130   TIter next(dl) ; 
131   <a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * digit ;
132   
133  
134  
135
136   while ( (digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *)next()) ) { 
137
138 <b>//     cout &lt;&lt; " clusterizerv1 " &lt;&lt; endl ;</b>
139 <b>//     <a href="../ListOfTypes.html#int">int</a> nprim = digit-&gt;GetNprimary() ;</b>
140 <b>//     <a href="../ListOfTypes.html#int">int</a> * aprim = digit-&gt;GetPrimary() ;</b>
141 <b>//     for ( <a href="../ListOfTypes.html#int">int</a> ii = 0 ; ii &lt; nprim ; ii++)</b>
142 <b>//       cout &lt;&lt; ii &lt;&lt; " prim = " &lt;&lt; aprim[ii] &lt;&lt; endl ;</b>
143
144     <a href="../ListOfTypes.html#Int_t">Int_t</a> id    = digit-&gt;GetId() ; 
145     <a href="../ListOfTypes.html#Float_t">Float_t</a> ene = <a href="#AliPHOSClusterizerv1:Calibrate">Calibrate</a>(digit-&gt;GetAmp()) ; 
146     geom-&gt;AbsToRelNumbering(id, relid) ;
147     if(relid[1]==0){ // EMC
148       if ( ene &gt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fEmcEnergyThreshold">fEmcEnergyThreshold</a> )
149         tl-&gt;Add(digit) ;
150     }
151
152     else { //Ppsd
153       if ( ene &gt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fPpsdEnergyThreshold">fPpsdEnergyThreshold</a> )
154         tl-&gt;Add(digit) ; 
155     }
156
157   }
158   tl-&gt;Sort() ; 
159 }
160
161 <b>//____________________________________________________________________________</b>
162 <a name="AliPHOSClusterizerv1:GetNumberOfClustersFound"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:GetNumberOfClustersFound">AliPHOSClusterizerv1::GetNumberOfClustersFound</a>(<a href="../ListOfTypes.html#Int_t">Int_t</a> * numb) 
163 {
164 <b>  // Fills numb with the number of EMC  (numb[0]) clusters found</b>
165 <b>  //                               PPSD (numb[1]) clusters found</b>
166
167   numb[0] = <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfEmcClusters">fNumberOfEmcClusters</a> ; 
168   numb[1] = <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfPpsdClusters">fNumberOfPpsdClusters</a> ; 
169 }
170
171 <b>//____________________________________________________________________________</b>
172 <a name="AliPHOSClusterizerv1:IsInEmc"> </a><a href="../ListOfTypes.html#Bool_t">Bool_t</a> <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:IsInEmc">AliPHOSClusterizerv1::IsInEmc</a>(<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * digit) 
173 {
174 <b>  // Tells if (true) or not (false) the digit is in a PHOS-EMC module</b>
175  
176   <a href="../ListOfTypes.html#Bool_t">Bool_t</a> rv = kFALSE ; 
177
178   <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;  
179
180   <a href="../ListOfTypes.html#Int_t">Int_t</a> relid[4] ; 
181   geom-&gt;AbsToRelNumbering(digit-&gt;GetId(), relid) ; 
182
183   if ( relid[1] == 0  )
184     rv = kTRUE; 
185
186   return rv ; 
187 }
188
189 <b>//____________________________________________________________________________</b>
190 <a name="AliPHOSClusterizerv1:MakeClusters"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:MakeClusters">AliPHOSClusterizerv1::MakeClusters</a>(const <a href="../ListOfTypes.html#DigitsList">DigitsList</a> * dl, <a href="../ListOfTypes.html#RecPointsList">RecPointsList</a> * emcl, <a href="../ListOfTypes.html#RecPointsList">RecPointsList</a> * ppsdl)
191 {
192 <b>  // Steering method to construct the clusters stored in a list of Reconstructed Points</b>
193 <b>  // A cluster is defined as a list of neighbour digits</b>
194   
195 <b>  // Fill and sort the working digits list</b>
196   TObjArray tempodigitslist( dl-&gt;GetEntries() ) ;
197   <a href="#AliPHOSClusterizerv1:FillandSort">FillandSort</a>(dl, &amp;tempodigitslist) ; 
198
199 <b>  // Clusterization starts  </b>
200   TIter nextdigit(&amp;tempodigitslist) ; 
201   <a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * digit ; 
202   <a href="../ListOfTypes.html#Bool_t">Bool_t</a> notremoved = kTRUE ;
203
204
205   while ( (digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *)nextdigit()) ) { // scan over the list of digits
206     <a href=".././AliPHOSRecPoint.html">AliPHOSRecPoint</a> * clu ; 
207    
208     <a href="../ListOfTypes.html#int">int</a> * clusterdigitslist[dl-&gt;GetEntries()] ;   
209     <a href="../ListOfTypes.html#Int_t">Int_t</a> index ;
210     if (( ( <a href="#AliPHOSClusterizerv1:IsInEmc">IsInEmc</a>(digit) ) &amp;&amp; ( <a href="#AliPHOSClusterizerv1:Calibrate">Calibrate</a>(digit-&gt;GetAmp() ) &gt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fEmcClusteringThreshold">fEmcClusteringThreshold</a> ) ) || 
211         ( ( !<a href="#AliPHOSClusterizerv1:IsInEmc">IsInEmc</a>(digit) ) &amp;&amp; ( <a href="#AliPHOSClusterizerv1:Calibrate">Calibrate</a>(digit-&gt;GetAmp() ) &gt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fPpsdClusteringThreshold">fPpsdClusteringThreshold</a> ) ) ) {
212   
213       <a href="../ListOfTypes.html#Int_t">Int_t</a> iDigitInCluster = 0 ; 
214
215       if  ( <a href="#AliPHOSClusterizerv1:IsInEmc">IsInEmc</a>(digit) ) {   
216         new ((*emcl)[<a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfEmcClusters">fNumberOfEmcClusters</a>]) <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a>(<a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fW0">fW0</a>, <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fLocMaxCut">fLocMaxCut</a>) ; // start a new EMC RecPoint
217         clu = (<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> *) (*emcl)[<a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfEmcClusters">fNumberOfEmcClusters</a>] ; 
218         <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfEmcClusters">fNumberOfEmcClusters</a>++ ; 
219         clu-&gt;AddDigit(*digit, <a href="#AliPHOSClusterizerv1:Calibrate">Calibrate</a>(digit-&gt;GetAmp())) ; 
220
221         clusterdigitslist[iDigitInCluster] = (<a href="../ListOfTypes.html#int">int</a>* ) digit ;      
222         iDigitInCluster++ ; 
223         tempodigitslist.Remove(digit) ; 
224
225
226       }
227
228       else { 
229         new ((*ppsdl)[<a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfPpsdClusters">fNumberOfPpsdClusters</a>]) <a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a>() ; // start a new PPSD cluster
230         clu =  (<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> *) ppsdl-&gt;At(<a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfPpsdClusters">fNumberOfPpsdClusters</a>)  ;  
231         <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fNumberOfPpsdClusters">fNumberOfPpsdClusters</a>++ ; 
232         clu-&gt;AddDigit(*digit, <a href="#AliPHOSClusterizerv1:Calibrate">Calibrate</a>(digit-&gt;GetAmp()) ) ;        
233         clusterdigitslist[iDigitInCluster] = (<a href="../ListOfTypes.html#int">int</a>* ) digit ;      
234         iDigitInCluster++ ; 
235         tempodigitslist.Remove(digit) ; 
236         nextdigit.Reset() ;
237         
238 <b>     // Here we remove resting EMC digits, which cannot make cluster</b>
239
240         if( notremoved ) { 
241           
242           while( ( digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *)nextdigit() ) ) {
243             
244             if( <a href="#AliPHOSClusterizerv1:IsInEmc">IsInEmc</a>(digit) ) 
245               tempodigitslist.Remove(digit) ;
246             else 
247               break ;
248           
249           } // while digit  
250           
251         } // if notremoved 
252         
253       } // else        
254       
255       nextdigit.Reset() ;
256
257       <a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * digitN ; 
258       index = 0 ;
259       while (index &lt; iDigitInCluster){ // scan over digits already in cluster 
260         digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *) clusterdigitslist[index]  ;      
261         index++ ; 
262         while ( (digitN = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *)nextdigit()) ) { // scan over the reduced list of digits 
263           <a href="../ListOfTypes.html#Int_t">Int_t</a> ineb = <a href="#AliPHOSClusterizerv1:AreNeighbours">AreNeighbours</a>(digit, digitN);   //  call (digit,digitN) in THAT oder !!!!!
264           switch (ineb ) {
265           case 0 :   // not a neighbour
266             break ;      
267           case 1 :   // are neighbours 
268             clu-&gt;AddDigit( *digitN, <a href="#AliPHOSClusterizerv1:Calibrate">Calibrate</a>( digitN-&gt;GetAmp() ) ) ;
269             clusterdigitslist[iDigitInCluster] =(<a href="../ListOfTypes.html#int">int</a>*) digitN ; 
270             iDigitInCluster++ ; 
271             tempodigitslist.Remove(digitN) ;
272             break ;
273           case 2 :   // too far from each other
274             goto endofloop;   
275           } // switch
276           
277         } // while digitN
278
279       endofloop: ;
280         nextdigit.Reset() ; 
281         
282       } // loop over cluster     
283  
284    }  //below energy theshold  
285   
286   } // while digit
287
288   tempodigitslist.Clear() ; 
289 }
290
291 <b>//____________________________________________________________________________</b>
292 <a name="AliPHOSClusterizerv1:PrintParameters"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:PrintParameters">AliPHOSClusterizerv1::PrintParameters</a>() 
293 {
294 <b>  // Print the energy thresholds </b>
295
296   cout &lt;&lt; "PHOS Clusterizer version 1 :" &lt;&lt; endl 
297        &lt;&lt; "                       EMC  Clustering threshold = " &lt;&lt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fEmcClusteringThreshold">fEmcClusteringThreshold</a> &lt;&lt; endl
298        &lt;&lt; "                       EMC  Energy threshold     = " &lt;&lt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fEmcEnergyThreshold">fEmcEnergyThreshold</a> &lt;&lt; endl                  
299        &lt;&lt; "                      PPSD  Clustering threshold = " &lt;&lt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fPpsdClusteringThreshold">fPpsdClusteringThreshold</a> &lt;&lt; endl
300        &lt;&lt; "                      PPSD  Energy threshold     = " &lt;&lt; <a href=".././AliPHOSClusterizerv1.html#AliPHOSClusterizerv1:fPpsdEnergyThreshold">fPpsdEnergyThreshold</a> &lt;&lt; endl ;                
301 }
302 </pre>
303
304 <!--SIGNATURE-->
305 <br>
306 <address>
307 <hr>
308 <center>
309 <a href="http://root.cern.ch/root/Welcome.html">ROOT page</a> - <a href="../ClassIndex.html">Class index</a> - <a href="#TopOfPage">Top of the page</a><br>
310 </center>
311 <hr>This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to <a href="mailto:rootdev@root.cern.ch">ROOT support</a>, or contact <a href="mailto:rootdev@root.cern.ch">the developers</a> with any questions or problems regarding ROOT.
312 </address>
313 </body>
314 </html>