]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/PHOS-HTML/reconstruction.html
Macro for checking dimuon trigger efficiency (Fabien)
[u/mrichter/AliRoot.git] / PHOS / PHOS-HTML / reconstruction.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
2                "http://www.w3.org/TR/REC-html40/loose.dtd">
3 <html>
4 <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6    <meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; I; Linux 2.2.5-15 i686) [Netscape]">
7    <title>PHOS Reconstruction in AliRoot</title>
8     <link REL="stylesheet" href="http://www-subatech.in2p3.fr/~photons/gps_alice.css" type="text/css">
9 </head>
10 <body>
11     <h1>
12       PHOS Reconstruction
13     </h1>
14     <hr><hr>
15     <ul>
16       <li>
17         <a href="reconstruction.html#Definitions and objectives">Definitions and objectives</a>
18         <ul>
19           <li>
20             <a href="reconstruction.html#What is PHOS">What is PHOS ?</a>
21           </li>
22           <li>
23             <a href="reconstruction.html#Reconstruction design">Reconstruction design</a>
24           </li>
25           <li>
26             <a href="reconstruction.html#How to use it">How to use it</a> 
27           </li>
28         </ul>
29       <li>
30         <a href="reconstruction.html#Clusterization">Clusterization</a>
31       </li>
32       <li>
33         <a href="reconstruction.html#Sub-Track construction">Sub-Track construction</a>
34       </li>
35       <li>
36         <a href="reconstruction.html#Particle identification">Particle identification</a>
37       </li>
38       <li>
39         <a href="reconstruction.html#Disk Storage Structure">Disk Storage Structure</a>
40       </li>
41       <li>
42         <a href="reconstruction.html#How are the links implemented">How are the links implemented</a>
43       </li>
44     </ul>
45     <a NAME="Definitions and objectives"></a>
46     <hr><hr> 
47    <h1>
48       Definitions and objectives
49     </h1>
50     <a NAME="What is PHOS"></a>   <h2>
51       What is PHOS ?
52     </h2>
53     PHOS is the association of two sub-detectors: 
54     <ul>
55       <li>
56         the lead-tungstate crystals electromagnetic-calorimeter named <b>EMCA</b>, 
57       </li>
58       <li>
59         and a pre-shower gas detector named <b>PPSD</b>. 
60         </li>
61     </ul>
62     Both sub-detectors are physically organized in <i>modules</i>. A separate document
63     is dedicated to the description of the <a href="simulation.html">PHOS geometry</a>.
64     <a NAME="Reconstruction design"></a>   
65     <h2>
66       Reconstruction design
67     </h2>
68     The reconstruction software consists in making <a href="html/AliPHOSRecParticle.html">particles</a> 
69     from the <a href="html/AliPHOSDigit.html">digits</a> generated by the <a href="simulation.html">simulation</a>. 
70    <p>
71     <center>
72       <a href="images/phosreconstructs.eps"> 
73         <img src="images/phosreconstructs.gif" alt="Use Case of reconstruction" width=800>
74       </a>
75       <p>
76         <b> Figure 1.: </b> <i>Use Case for reconstruction. Only PHOS is implemented. Other detectors are ignored. 
77           Click on image for full scale</i>
78     </center>
79     The PHOS reconstruction is delegated by the <a href="html/AliPHOSv0.html">detector</a> to a 
80     <a href="html/AliPHOSReconstructioner.html">reconstructioner</a> algorithmic object. It proceeds along three steps: 
81     <dl>
82       <dt>
83         <b>Clusterization</b>
84       </dt>
85       <dd>
86         The reconstruction of the showers (total energy loss and incident direction) 
87         induced in the EM calorimeter (<a href="html/AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a>)
88         and of the pads hit in the pre-shower detector (<a href="html/AliPHOSPpsdRecPoint.html" >AliPHOSPpsdRecPoint</a>).
89         The clustering is delegated to the algorithmic object <a href="html/AliPHOSClusterizerv1.html">AliPHOSClusterizerv1</a> 
90         which derives from the interface <a href="html/AliPHOSClusterizer.html">AliPHOSClusterizer</a>. The clusterization is controlled
91         by several parameters.
92       </dd>
93       <dt>
94         <b>Sub-Track construction</b>
95       </dt>
96       <dd>
97         Sub tracks are obtained by combining reconstructed points in EMCA and PPSD to form a track segment 
98         (<a href="html/AliPHOSTrackSegment.html">AliPHOSTrackSegment</a>). This construction is delegated to the 
99         algorithmic object <a href="html/AliPHOSTrackSegmentMakerv1.html">AliPHOSTrackSegmentMakerv1</a> 
100         which derives from the interface <a href="html/AliPHOSTrackSegmentMaker.html">AliPHOSTrackSegmentMaker</a>. 
101       </dd>
102       <dt>
103         <b>Particle identification</b>
104       </dt>
105       <dd>
106         From each track segment a reconstructed particle (<a href="html/AliPHOSRecParticle.html">AliPHOSRecParticle</a>)
107         is made the identification being based on the information delivered by the PPSD (which PPSD stage is hit) 
108         and by EMCA (shower profile and topology).The identification is delegated to the 
109         algorithmic object <a href="html/AliPHOSPIDv1.html">AliPHOSPIDv1</a> 
110         which derives from the interface <a href="html/AliPHOSPID.html">AliPHOSPID</a>. Several parameters control the identification
111         procedure.
112       </dd>
113     </dl>
114     The first step is detector specific, i.e. does not require any information
115     about other detectors. The two last steps may (and probably will) depend on
116     other detector reconstructions (connecting sub tracks or combining particle identification delivered by 
117     various sub-detectors).
118         <a NAME="How to use it"></a> 
119     <h2>
120       How to use it ?
121     </h2>
122     This is a little piece of code which shows how to use the reconstruction. It can be used in a Root macro or the class
123     <a href="html/AliPHOSAnalyze.html">AliPHOSAnalyze</a> can be used instead together with the GUI interface 
124     <a href="EditorBar.C">EditorBar.C</a>:
125     <pre class="code">
126       fRootFile   = new TFile("MyFileName", "update") ;   // open the root file created by the simulation
127       gAlice = (AliRun*) fRootFile->Get("gAlice");        // get from file the AliRun object
128       fPHOS  = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; // get from file the detector object
129       fGeom  = AliPHOSGeometry::GetInstance(              // get the geometry used for the simulation
130                      fPHOS->GetGeometry()->GetName(), 
131                      fPHOS->GetGeometry()->GetTitle() ) ;
132
133       //========== Initializes the Index to Object converter
134       fObjGetter = AliPHOSIndexToObject::GetInstance(fPHOS) ; 
135   
136       //========== Create the Clusterizer and set a few parameters
137       fClu =  new AliPHOSClusterizerv1() ; 
138       fClu->SetEmcEnergyThreshold(0.030) ; 
139       fClu->SetEmcClusteringThreshold(1.0) ; 
140       fClu->SetPpsdEnergyThreshold    (0.0000002) ; 
141       fClu->SetPpsdClusteringThreshold(0.0000001) ; 
142       fClu->SetLocalMaxCut(0.03) ;
143       fClu->SetCalibrationParameters(0., 0.00000001) ;  
144       cout <<  "AnalyzeOneEvent > using clusterizer " << fClu->GetName() << endl ; 
145       fClu->PrintParameters() ; 
146     
147       //========== Creates the track segment maker
148       fTrs = new AliPHOSTrackSegmentMakerv1() ;
149       cout <<  "AnalyzeOneEvent > using tack segment maker " << fTrs->GetName() << endl ; 
150       fTrs->UnsetUnfoldFlag() ;
151     
152       //========== Creates the particle identifier
153       fPID = new AliPHOSPIDv1() ;
154       cout <<  "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ; 
155       fPID->SetShowerProfileCuts(0., 0., 0., 0.) ;
156       fPIS->SetDispersionCutOff(0.34) ;
157
158       //========== Creates the Reconstructioner  
159       fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ;     
160     
161       //=========== Connect the various Tree's for evt
162       gAlice->GetEvent(evt);
163     
164       //=========== Fill the fDigits array from the Digit TTree
165       gAlice->TreeD()->GetEvent(0) ;     
166       
167       //=========== Do the reconstruction
168       fPHOS->Reconstruction(fRec);  
169     
170       // =========== Write to the root file
171       fRootFile->Close() ; 
172     </pre>
173     <hr>
174     <a NAME="Clusterization"></a> 
175    <h1>
176       <a href="html/AliPHOSClusterizerv1.html">Clusterization</a>
177     </h1>
178     A <a href="html/AliPHOSDigit.html">digit</a> is a set of two numbers: the id of the elementary cell
179     numbered from 1 to the maximum number of cells (EMCA+PPSD), and a digitized deposited energy. With 
180     the help of the <a href="html/AliPHOSGeometry.html">geometry</a> object the absolute id is converted into
181     a relative numbering with a single EMCA or PPSD module, in terms of rows and columns 
182     ( <i>ALIPHOSGeometry::AbsToRelNumbering()</i> ). A clustering algorithm ( <i> AliPHOSClusterizerv1::MakeClusters()</i> )
183     groups neighbouring cells in EMCA and PPSD ( <i>AliPHOSClusterizerv1::AreNeighbours()</i> ) where two cells
184     are defined as neighbours if they have a common edge or a common corner. The algorithm is controlled with
185     alltogether 4 parameters:
186     <ul>
187       <li> the energy thresholds (one for EMCA, <i>fEmcEnergyThreshold</i> and one for PPSD, <i> fPpsdEnergyThreshold</i>) 
188         which the deposited energy of the digits must surpass to be taken into account for the clusterization;
189       </li>
190       <li> the energy thresholds (one for EMCA, <i>fEmcEnergyThreshold</i> and one for PPSD, <i>fPpsdEnergyThreshold</i>) 
191         which the deposited energy of the digits must surpass to start a cluster.
192       </li>
193     </ul>
194     An ensemble of neighbouring digits is called a reconstructed point. The PHOS clusterizer produces 
195     <a href="html/AliPHOSEmcRecPoint.html">EmcRecPoints</a> and  <a href="html/AliPHOSPpsdRecPoint.html">PpsdRecPoints</a>
196     deriving form the base class <a href="html/AliPHOSRecPoint.html">AliPHOSRecPoint</a>. Each reconstructed point
197     points, through a mechanism described later, to the digits at its origin. Since a digit remembers which
198     primary particle(s) were at its origin, the list of primary particles at the origin of a reconstructed
199     point is provided by the method <i>AliPHOSRecPoint::GetPrimaries()</i>).
200     <p>
201       The reconstructed points are contained in two <a href="http://root.cern.ch/root/html/TObjArray.html">TObjArray</a> 
202       (mandatory because the size of a reconstructed
203       point depends on the number of digits used to build it) which are stored in <i>TreeR</i>, branch <i>PHOSEmcRP</i>
204       for EMCA and branch <i>PHOSPpsdRP</i> for PPSD.
205     </p>
206     <hr>
207     <a NAME="Sub-Track construction"></a> 
208     <h1>
209       <a href="html/AliPHOSTrackSegmentMakerv1.html">Track Segments Maker</a>
210     </h1>
211     Each EMCA reconstructed point is either combined with one or two PPSD reconstructed points to form 
212     a <a href="html/AliPHOSTrackSegment.html">track segment</a> or constitutes a track segment by itself. As a first step
213     the EMCA reconstructed points are unfolded in case there is more than one local maximum ( overlapping
214     showers) to make two new reconstructed points which digit's energy is shared after a fitting procedure.
215     The unfolding procedure can be switch on and off with the method: <i>AliPHOSTrackSegmentMakerv1::(Un)SetUnfoldFlag()</i>.
216     EMCA reconstructed points and PPSD reconstructed points are then linked together to form pairs or triplets
217     according to their relative distance. Each track segment points is linked, through a mechanism described later, to the 
218     reconstructed points at its origin.
219     <p>
220       The track segments are contained in a <a href="http://root.cern.ch/root/html/TClonesArray.html">TClonesArray</a> which are stored in <i>TreeR</i>, branch <i>PHOSTS</i>.
221     </p>
222     <hr>
223     <a NAME="Particle identification"></a> 
224    <h1>
225       <a href="html/AliPHOSPIDv1.html">Particle Identification</a>
226     </h1>
227     Clusterization and track segments making are two activities that are <i>detector-driven</i>. This is not the case for the
228     particle identification. Indeed a particle might be identified by combining the track segments calculated by several
229     detectors. Up to know the implementation for such a mechanism is not yet done. Instead PHOS has its own stand alone
230     particle identification algorithm which associates a <a href="html/AliPHOSRecParticle.html">reconstructed particle</a> to
231     each track segment. The particle identification is controlled by several parameters which can be set by the user. Each
232     reconstructed particle is linked, through a mechanism described later, to the track segment at its origin.
233     The various types of reconstructed particles are the following:
234     <table>
235       <tr>
236         <td><b>NEUTRAL</b>: </td>
237         <td>a reconstructed point in EMCA, none in the two layers of the PPSD;</td>
238       </tr>
239       <tr>
240         <td><b>GAMMA</b>  : </td>
241         <td>a reconstructed point in the lower PPSD layer, none in the upper one, and a reconstructed point in
242         EMCA that satisfies the shower topology cuts;</td>
243       </tr>
244       <tr>
245         <td><b>GAMMAHADRON</b> : </td>
246         <td>as a GAMMA, but the EMCA reconstructed point does not satisfy the shower topology cuts;</td>
247       </tr>
248       <tr>
249         <td><b>CHARGED</b>:  </td>
250         <td>a reconstructed point in EMCA, and one  in the upper layer of the PPSD;</td>
251       </tr>
252       <tr>
253         <td><b>NEUTRALEM</b>: </td>
254         <td>a NEUTRAL particle for which the EMCA reconstructed point satisfies the shower profile cut;</td>
255       </tr>
256       <tr>
257         <td><b>NEUTRALHADRON</b>:</td>
258         <td> a NEUTRAL particle for which the EMCA reconstructed point does not satisfy the shower profile cut;</td>
259       </tr>
260       <tr>
261         <td><b>ELECTRON</b>: </td>
262         <td>a CHARGED particle for which the EMCA reconstructed point satisfies the shower profile cut;</td>
263       </tr>
264       <tr>
265         <td><b>CHARGEDHADRON</b>:</td>
266         <td> a CHARGED particle for which the EMCA reconstructed point does not satisfy the shower profile cut;</td>
267       </tr>
268     </table>
269     <hr>
270     <a NAME="Disk Storage Structure"></a> 
271     <h1>
272       Disk Storage Structure
273     </h1>
274     All the three types of reconstructed objects( reconstructed point, track segment and reconstructed particle) are stored in
275     the reconstruction Tree (<i>TreeR</i>). The container of the reconstructed points is a 
276     <a href="http://root.cern.ch/root/html/TObjArray.html">TObjArray</a> and the container
277     of the track segment and the reconstructed particles is a 
278     <a href="http://root.cern.ch/root/html/TClonesArray.html">TClonesArray</a>. The names of the branches are respectively:
279     PHOSEmcRP, PHOSPpsdRP, PHOSTS and PHOSRP. The <i>TreeR</i> is best seen in the following example: 
280     <pre class="code">
281       root [2] TFile myfile("junk.root")
282       root [3] TTree * reconstructedtree = (TTree *)myfile.Get("TreeR0")
283       root [5] reconstructedtree.Print()
284       ******************************************************************************
285       *Tree    :TreeR0    : Reconstruction                                         *
286       *Entries :        1 : Total  Size =     10882 bytes  File  Size =       4024 *
287       *        :          : Tree compression factor =   5.65                       *
288       ******************************************************************************
289       *Branch  :PHOSEmcRP : PHOSEmcRP                                              *
290       *Entries :        1 : Total  Size =         0 bytes  File Size  =          0 *
291       *Baskets :        0 : Basket Size =     16000 bytes  Compression=   1.00     *
292       *............................................................................*
293       *Branch  :PHOSPpsdRP : PHOSPpsdRP                                            *
294       *Entries :        1 : Total  Size =      8334 bytes  File Size  =       1476 *
295       *Baskets :        1 : Basket Size =     16000 bytes  Compression=   5.65     *
296       *............................................................................*
297       *Branch  :PHOSTS    : PHOSTS                                                 *
298       *Entries :        1 : Total  Size =         0 bytes  File Size  =          0 *
299       *Baskets :        0 : Basket Size =     16000 bytes  Compression=   1.00     *
300       *............................................................................*
301       *Branch  :PHOSRP    : PHOSRP                                                 *
302       *Entries :        1 : Total  Size =         0 bytes  File Size  =          0 *
303       *Entries :        1 : Total  Size =         0 bytes  File Size  =          0 *
304       *Baskets :        0 : Basket Size =     16000 bytes  Compression=   1.00     *
305       *............................................................................*
306       root [6]                       
307     </pre>
308     <center>
309       <img src="images/BranchesInTreeR.gif" alt="branches in reconstructed Tree">
310       <p>
311         <b>Figure 2: </b><i>Branches in TreeR generated by the PHOS reconstruction.
312           PHOSEmc(Ppsd)RP contains EMCA(PPSD) reconstructed points in
313           <a href="http://root.cern.ch/root/html/TObjArray.html">TObjArray</a>;
314           PHOSTS contains track segments in a 
315           <a href="http://root.cern.ch/root/html/TClonesArray.html">TClonesArray</a>; PHOSRP contains reconstructed
316           particles in a <a href="http://root.cern.ch/root/html/TClonesArray.html">TClonesArray</a>. </i>
317       </p>
318     </center>
319     <hr>
320      <a NAME="How are the links implemented"></a> 
321     <h1>
322       How are the links implemented ?
323     </h1>
324     An algorithmic class, <a href="html/AliPHOSIndexToObject.html">AliPHOSIndexToObject</a> returns a pointer to the object of
325     interest given the index of its storage in the array 
326     (<a href="http://root.cern.ch/root/html/TObjArray.html">TObjArray</a> or 
327     <a href="http://root.cern.ch/root/html/TClonesArray.html">TClonesArray</a>). It is a singleton (only one instance of the
328     object does exist at run time). It must be initialized once:
329     <pre class="code">
330       AliPHOS * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
331       AliPHOSIndexToObject::GetInstance(phos) ; 
332     </pre>
333     It can then be used as follow, for example for retrieving a particle from the kine tree (<i>TreeK</i>):
334     <pre class="code">
335      AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
336      Int_t index = 123 ; 
337      TParticle * primaryparticle = please->GimePrimaryParticle(index) ;
338     </pre>
339     We shall now detail how the various reconstruction objects are linked together.
340     <h4>
341       Digits to primary particles
342     </h4>
343     <A href="html/AliPHOSDigit.html">Digits</a> have three additional data members (<i>fPrimary1(2,3)</i>) that gives the index
344     of the primary particles (maximum 3) that have contributed to the formation of the digit. Remember that in PHOS a digit is
345     obtained from all the hits accumulated in a single cell. 
346     This is not really elegant, but because the container of digits is a 
347     <a href="http://root.cern.ch/root/html/TClonesArray.html">TClonesArray</a> it is not possible
348     to replace the three data members by an array of integers of variable length as all objects in a 
349     <a href="http://root.cern.ch/root/html/TClonesArray.html">TClonesArray</a> must be identical. To retrieve the particles that
350     have contibuted to a digit, do:
351     <pre class="code">
352     // initialization
353           // open root file
354      TFile rootfile("junk.root") ;               
355           // get AliRun object
356      gAlice = (AliRun *)rootfile.Get("gAlice") ;
357           // get detector object
358      AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
359           // get the geometry associated with the detector
360      AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; 
361           // initializes the index to object converter
362      AliPHOSIndexToObject::GetInstance(phos) ;
363           // get the list of digits
364      TClonesArray * digitslist = phos->Digits() ; 
365           // loop over the list of digits
366      TIter nextdigit(digitslist) ; 
367      AliPHOSDigit * digit ; 
368      TParticle * primaryparticle[3] ; 
369           // get the pointer of the index to object converter
370      AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
371      while ( digit = (AliPHOSDigit * )nextdigit() ) {
372        for ( Int_t i = 0 ; i < digit->GetNprimary() ; i++ ) 
373        primary[i] = please->GimePrimaryParticle(digit->GetPrimary(i) ) ;
374      }     
375     </pre>
376     <h4>
377       Reconstructed point to Digit
378     </h4>
379     A <a href="html/AliPHOSDigit.html">digit</a> has an additional data member which is the index of the object stored
380     in the  <a href="http://root.cern.ch/root/html/TObjArray.html">TObjArray</a>. It is set by 
381     <a href="html/AliPHOSv0.html">FinishEvent()</a>. A <a href="html/AliPHOSRecPoint.html">reconstructed point</a> containing
382     a list of digits, it can retrieve the digit object with the help of 
383     <a href="html/AliPHOSIndexToObject.html">AliPHOSIndexToObject</a>:
384     <pre class="code">
385       // initialization
386           // open root file
387      TFile rootfile("junk.root") ;               
388           // get AliRun object
389      gAlice = (AliRun *)rootfile.Get("gAlice") ;
390           // get detector object
391      AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
392           // get the geometry associated with the detector
393      AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; 
394           // initializes the index to object converter
395      AliPHOSIndexToObject::GetInstance(phos) ;
396           // get the reconstructed points list
397      Int_t evt = 123 ; 
398      TObjArray * recpointslist = phos->EmcRecPoints(evt) ; 
399           // loop over reconstructed points 
400      TIter nextrecpoint(recpointslist) ; 
401           // get the pointer of the index to object converter
402      AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
403      AliPHOSEmcRecPoint * recpoint ;  
404      while ( recpoint = (AliPHOSEmcRecPoint * )nextrecpoint() ) {
405              // get the associated digits list
406        Int_t * digitsindexeslist = recpoint->GetDigitsList() ;
407              // loop over the list of digits
408        for ( Int_t i = 0 ; i < recpoint->GetDigitsMultiplicity() ; i++ ) {
409          AliPHOSDigit * digit = please->GimeDigit(digitsindexeslist[i] ) ;
410                // get the primary particle associated with that digit
411          Int_t numberofprimaries = 0 ; 
412          Int_t * prim = digit->GetPrimaries(numberofprimaries) ;
413          for (Int_t i = 0 ; i < numberofprimaries ; i++ )
414            // and print them 
415            please->GimePrimaryParticle( prim[i] )->Print()  ;
416          } 
417        } 
418          // or get the primaries directly from the reconstructed point
419        Int_t numberofprimaries = 0 ; 
420        Int_t * prim = recpoint->GetPrimaries(numberofprimaries) ;  
421      }       
422     </pre>
423     <h4>
424       Track segment to reconstructed point 
425     </h4>
426     A <a href="html/AliPHOSRecPoint.html">reconstructed point</a> has an additional data member which is the index of the object stored
427     in the  <a href="http://root.cern.ch/root/html/TClonesArray.html">TClnesArray</a>. It is set by the 
428     <a href="html/AliPHOSReconstructioner.html">reconstructioner</a>. 
429     A <a href="html/AliPHOSTrackSegment.html">track segment</a> contains the index of one EMCA reconstructed points and two 
430     PPSD reconstructed points, it can retrieve this reconstructed point objects with the help of 
431     <a href="html/AliPHOSIndexToObject.html">AliPHOSIndexToObject</a>:
432     <pre class="code">
433      // initialization
434           // open root file
435      TFile rootfile("junk.root") ;               
436           // get AliRun object
437      gAlice = (AliRun *)rootfile.Get("gAlice") ;
438           // get detector object
439      AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
440           // get the geometry associated with the detector
441      AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; 
442           // initializes the index to object converter
443      AliPHOSIndexToObject::GetInstance(phos) ;
444           // get the track segments list
445      Int_t evt = 123 ; 
446      TClonesArray * tracksegmentslist = phos->TrackSegments(evt) ; 
447           // loop over track segments
448      TIter nexttracksegment(tracksegmentslist) ; 
449      AliPHOSTrackSegment * tracksegment ;  
450          // get the pointer of the index to object converter
451      AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
452      while ( tracksegment = (AliPHOSTrackSegment * )nexttracksegment() ) {
453            // get the associated reconstructed points
454          AliPHOSEmcRecPoint  * emcrecpoint     = please->GimeRecPoint(tracksegment->GetEmcRecPoint(),    "emc" ) ;
455          AliPHOSPpsdRecPoint * ppsduprecpoint  = please->GimeRecPoint(tracksegment->GetPpsdUpRecPoint(), "ppsd" ) ;
456          AliPHOSPpsdRecPoint * ppsdlowrecpoint = please->GimeRecPoint(tracksegment->GetPpsdLowRecPoint(),"ppsd" ) ;
457           // get the primaries particles  
458          Int_t numberofprimariestoemc = 0 ; 
459          Int_t * primemc = tracksegment->GetPrimariesEmc(numberofprimariestoemc) ;
460          Int_t numberofprimariestoppsdup = 0 ; 
461          Int_t * primppsdup = tracksegment->GetPrimariesPpsdUp(numberofprimariestoppsdup) ;
462          Int_t numberofprimariestoppsdlow = 0 ; 
463          Int_t * primppsdlow = tracksegment->GetPrimariesPpsdLow(numberofprimariestoppsdlow) ;
464           // print one as example  
465          please->GimePrimaryParticle( primppsdlow[0] )->Print()  ;     
466        }
467      rootfile.Close() ;
468      gAlice = 0 ; 
469      phos = 0 ; 
470      recparticleslist = 0 ;
471      </pre>    
472     <h4>
473       Reconstructed particle to Track segment  
474     </h4>
475     A <a href="html/AliPHOSTrackSegment.html">track segment</a> has an additional data member which is the index of the object stored
476     in the  <a href="http://root.cern.ch/root/html/TClonesArray.html">TClnesArray</a>. It is set by the 
477     <a href="html/AliPHOSReconstructioner.html">reconstructioner</a>. 
478     A <a href="html/AliPHOSRecParticle.html">reconstructed particle</a> contains the index of a track segment, 
479     it can retrieve this reconstructed point objects with the help of 
480     <a href="html/AliPHOSIndexToObject.html">AliPHOSIndexToObject</a>:
481     <pre class="code">
482      // initialization
483           // open root file
484      TFile rootfile("junk.root") ;               
485           // get AliRun object
486      gAlice = (AliRun *)rootfile.Get("gAlice") ;
487           // get detector object
488      AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ;
489           // get the geometry associated with the detector
490      AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; 
491           // initializes the index to object converter
492      AliPHOSIndexToObject::GetInstance(phos) ;
493           // get the reconstructed particles list
494      Int_t evt = 123 ; 
495      TClonesArray * recparticleslist = phos->RecParticles(evt) ; 
496      // loop over reconstructed particles
497      TIter nextrecparticle(recparticleslist) ; 
498      AliPHOSRecParticle * recparticle ;  
499        // get the pointer of the index to object converter
500      AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
501      while ( recparticle = (AliPHOSRecParticle * )nextrecparticle() ) {
502            // get the track segment ...
503          AliPHOSTrackSegment  * tracksegment  = recparticle->GetPHOSTrackSegment()  ;
504            // and print it
505          tracksegment->Print() ;
506            // get the list of primaries ...
507          Int_t numberofprimaries = 0 ; 
508          Int_t * prim = recparticle->GetPrimaries(numberofprimaries) ;
509          for (Int_t i = 0 ; i < numberofprimaries ; i++ )
510            // and print them 
511            please->GimePrimaryParticle( prim[i] )->Print()  ; 
512     }     
513      rootfile.Close() ;
514      gAlice = 0 ; 
515      phos = 0 ; 
516      recparticleslist = 0 ;
517     </pre>
518     A short cut allows to access the primaries at the origin of the reconstructed particle:
519     <pre class="code">
520      Int_t numberofprimaries = 0 ; 
521      Int_t * prim = recparticle->GetPrimariesPpsdLow(numberofprimaries) ;
522     </pre>    
523 <hr>
524 <address class="left">
525 &copy; <a href="mailto:schutz@in2p3.fr">Groupe Photons Subatech</a> <a href="http://www-subatech.in2p3.fr/~photons/subatech/en_index.shtml">[Go
526 to the GPS Home Page]</a></address>
527
528 <address class="right"> 
529 <!-- Created: Tue Oct 26 19:52:56 CEST 1999 -->
530 <!-- hhmts start -->
531 Last modified: Sun Mar 26 17:20:12 CEST 2000
532 <!-- hhmts end --></address>
533
534 <!-- <div align=right><a href="http://validator.w3.org/check/referer"><img SRC="images/vh40.gif" ALT="Valid HTML 4.0!" BORDER=0 height=31 width=88></a><a href="http://jigsaw.w3.org/css-validator"><img SRC="images/vcss.gif" ALT="Valid CSS!" BORDER=0 height=31 width=88></a></div> -->
535
536 </body>
537 </html>