1 <!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">
4 <!-- Author: ROOT team (rootdev@hpsalo.cern.ch) -->
6 <!-- Date: Thu Mar 9 00:11:51 2000 -->
9 <title>AliPHOSTrackSegmentMakerv1 - 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.">
16 <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" TEXT="#000000">
17 <a name="TopOfPage"></a>
19 /**************************************************************************
20 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
22 * Author: The ALICE Off-line Project. *
23 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
36 <b>//_________________________________________________________________________</b>
37 <b>// Implementation version 1 of algorithm class to construct PHOS track segments</b>
38 <b>// Associates EMC and PPSD clusters</b>
39 <b>// Unfolds the EMC cluster </b>
41 <b>//*-- Author: Dmitri Peressounko (RRC Ki & SUBATECH)</b>
44 <b>// --- ROOT system ---</b>
46 #include "TObjArray.h"
47 #include "TClonesArray.h"
48 #include "TObjectTable.h"
50 <b>// --- Standard library ---</b>
52 #include <iostream>
53 #include <cassert>
55 <b>// --- AliRoot header files ---</b>
57 #include "<a href="../AliPHOSTrackSegmentMakerv1.h">AliPHOSTrackSegmentMakerv1.h</a>"
58 #include "<a href="../AliPHOSTrackSegment.h">AliPHOSTrackSegment.h</a>"
59 #include "<a href="../AliPHOSLink.h">AliPHOSLink.h</a>"
60 #include "<a href="../AliPHOSv0.h">AliPHOSv0.h</a>"
63 extern void UnfoldingChiSquare(Int_t &nPar, Double_t *Grad, Double_t & fret, Double_t *x, Int_t iflag) ;
65 ClassImp( AliPHOSTrackSegmentMakerv1)
68 <b>//____________________________________________________________________________</b>
69 <a name="AliPHOSTrackSegmentMakerv1:AliPHOSTrackSegmentMakerv1"> </a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:AliPHOSTrackSegmentMakerv1">AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1</a>()
73 <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fR0">fR0</a> = 4. ;
74 <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
75 <b> //clusters are sorted in "rows" and "columns" of width geom->GetCrystalSize(0),</b>
76 <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fDelta">fDelta</a> = <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fR0">fR0</a> + geom->GetCrystalSize(0) ;
77 <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fMinuit">fMinuit</a> = new TMinuit(100) ;
78 <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fUnfoldFlag">fUnfoldFlag</a> = kTRUE ;
81 <b>//____________________________________________________________________________</b>
82 <a name="AliPHOSTrackSegmentMakerv1:~AliPHOSTrackSegmentMakerv1"> </a> <a href=".././AliPHOSTrackSegmentMakerv1.html">AliPHOSTrackSegmentMakerv1</a>::~<a href=".././AliPHOSTrackSegmentMakerv1.html">AliPHOSTrackSegmentMakerv1</a>()
86 delete <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fMinuit">fMinuit</a> ;
89 <b>//____________________________________________________________________________</b>
90 <a name="AliPHOSTrackSegmentMakerv1:FindFit"> </a><a href="../ListOfTypes.html#Bool_t">Bool_t</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:FindFit">AliPHOSTrackSegmentMakerv1::FindFit</a>(<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * emcRP, <a href="../ListOfTypes.html#int">int</a> * maxAt, <a href="../ListOfTypes.html#Float_t">Float_t</a> * maxAtEnergy,
91 <a href="../ListOfTypes.html#Int_t">Int_t</a> nPar, <a href="../ListOfTypes.html#Float_t">Float_t</a> * fitparameters)
93 <b> // Calls TMinuit to fit the energy distribution of a cluster with several maxima </b>
95 <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
97 gMinuit->SetPrintLevel(-1) ; // No Printout
98 gMinuit->SetFCN(UnfoldingChiSquare) ; // To set the address of the minimization function
99 gMinuit->SetObjectFit(emcRP) ; // To tranfer pointer to UnfoldingChiSquare
101 <b> // filling initial values for fit parameters</b>
102 <a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * digit ;
104 <a href="../ListOfTypes.html#Int_t">Int_t</a> ierflg = 0;
105 <a href="../ListOfTypes.html#Int_t">Int_t</a> index = 0 ;
106 <a href="../ListOfTypes.html#Int_t">Int_t</a> nDigits = (<a href="../ListOfTypes.html#Int_t">Int_t</a>) nPar / 3 ;
108 <a href="../ListOfTypes.html#Int_t">Int_t</a> iDigit ;
111 for(iDigit = 0; iDigit < nDigits; iDigit++){
112 digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *) maxAt[iDigit];
114 <a href="../ListOfTypes.html#Int_t">Int_t</a> relid[4] ;
115 <a href="../ListOfTypes.html#Float_t">Float_t</a> x ;
116 <a href="../ListOfTypes.html#Float_t">Float_t</a> z ;
117 geom->AbsToRelNumbering(digit->GetId(), relid) ;
118 geom->RelPosInModule(relid, x, z) ;
120 <a href="../ListOfTypes.html#Float_t">Float_t</a> energy = maxAtEnergy[iDigit] ;
122 gMinuit->mnparm(index, "x", x, 0.1, 0, 0, ierflg) ;
125 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : x = " << x << endl ;
128 gMinuit->mnparm(index, "z", z, 0.1, 0, 0, ierflg) ;
131 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : z = " << z << endl ;
134 gMinuit->mnparm(index, "Energy", energy , 0.05*energy, 0., 4.*energy, ierflg) ;
137 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : energy = " << energy << endl ;
142 <a href="../ListOfTypes.html#Double_t">Double_t</a> p0 = 0.1 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
143 <b> // depends on it. </b>
144 <a href="../ListOfTypes.html#Double_t">Double_t</a> p1 = 1.0 ;
145 <a href="../ListOfTypes.html#Double_t">Double_t</a> p2 = 0.0 ;
147 gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ; // force TgMinuit to reduce function calls
148 gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ; // force TMinuit to use my gradient
149 gMinuit->SetMaxIterations(5);
150 gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ; // No Warnings
151 gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ; // minimize
152 if(ierflg == 4){ // Minimum not found
153 cout << "PHOS Unfolding> Fit not converged, cluster abandoned "<< endl ;
156 for(index = 0; index < nPar; index++){
157 <a href="../ListOfTypes.html#Double_t">Double_t</a> err ;
158 <a href="../ListOfTypes.html#Double_t">Double_t</a> val ;
159 gMinuit->GetParameter(index, val, err) ; // Returns value and error of parameter index
160 fitparameters[index] = val ;
166 <b>//____________________________________________________________________________</b>
167 <a name="AliPHOSTrackSegmentMakerv1:FillOneModule"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:FillOneModule">AliPHOSTrackSegmentMakerv1::FillOneModule</a>(<a href="../ListOfTypes.html#DigitsList">DigitsList</a> * Dl, <a href="../ListOfTypes.html#RecPointsList">RecPointsList</a> * emcIn, TObjArray * emcOut,
168 <a href="../ListOfTypes.html#RecPointsList">RecPointsList</a> * ppsdIn, TObjArray * ppsdOutUp,
169 TObjArray * ppsdOutLow, <a href="../ListOfTypes.html#Int_t">Int_t</a> & phosmod, <a href="../ListOfTypes.html#Int_t">Int_t</a> & emcStopedAt,
170 <a href="../ListOfTypes.html#Int_t">Int_t</a> & ppsdStopedAt)
172 <b> // Unfold clusters and fill xxxOut arrays with clusters from one PHOS module</b>
174 <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * emcRecPoint ;
175 <a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> * ppsdRecPoint ;
176 <a href="../ListOfTypes.html#Int_t">Int_t</a> index ;
178 <a href="../ListOfTypes.html#Int_t">Int_t</a> nEmcUnfolded = emcIn->GetEntries() ;
179 for(index = emcStopedAt; index < nEmcUnfolded; index++){
180 emcRecPoint = (<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> *) (*emcIn)[index] ;
182 if(emcRecPoint->GetPHOSMod() != phosmod )
185 <a href="../ListOfTypes.html#Int_t">Int_t</a> nMultipl = emcRecPoint->GetMultiplicity() ;
186 <a href="../ListOfTypes.html#Int_t">Int_t</a> maxAt[nMultipl] ;
187 <a href="../ListOfTypes.html#Float_t">Float_t</a> maxAtEnergy[nMultipl] ;
188 <a href="../ListOfTypes.html#Int_t">Int_t</a> nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy) ;
190 if(nMax <= 1 ) // if cluster is very flat (no pronounced maximum) then nMax = 0
191 emcOut->Add(emcRecPoint) ;
192 else if (<a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fUnfoldFlag">fUnfoldFlag</a>) {
193 <a href="#AliPHOSTrackSegmentMakerv1:UnfoldClusters">UnfoldClusters</a>(Dl, emcIn, emcRecPoint, nMax, maxAt, maxAtEnergy, emcOut) ;
194 emcIn->Remove(emcRecPoint);
195 emcIn->Compress() ;
200 emcStopedAt = index ;
202 for(index = ppsdStopedAt; index < ppsdIn->GetEntries(); index++){
203 ppsdRecPoint = (<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> *) (*ppsdIn)[index] ;
204 if(ppsdRecPoint->GetPHOSMod() != phosmod )
206 if(ppsdRecPoint->GetUp() )
207 ppsdOutUp->Add(ppsdRecPoint) ;
209 ppsdOutLow->Add(ppsdRecPoint) ;
211 ppsdStopedAt = index ;
214 ppsdOutUp->Sort() ;
215 ppsdOutLow->Sort() ;
217 <b>//____________________________________________________________________________</b>
218 <a name="AliPHOSTrackSegmentMakerv1:GetDistanceInPHOSPlane"> </a><a href="../ListOfTypes.html#Float_t">Float_t</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:GetDistanceInPHOSPlane">AliPHOSTrackSegmentMakerv1::GetDistanceInPHOSPlane</a>(<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * emcclu,<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> * PpsdClu, <a href="../ListOfTypes.html#Bool_t">Bool_t</a> &toofar)
220 <b> // Calculates the distance between the EMC RecPoint and the PPSD RecPoint</b>
222 <a href="../ListOfTypes.html#Float_t">Float_t</a> r = <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fR0">fR0</a> ;
227 emcclu->GetLocalPosition(vecEmc) ;
228 PpsdClu->GetLocalPosition(vecPpsd) ;
229 if(emcclu->GetPHOSMod() == PpsdClu->GetPHOSMod()){
230 if(vecPpsd.X() >= vecEmc.X() - <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fDelta">fDelta</a> ){
231 if(vecPpsd.Z() >= vecEmc.Z() - <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fDelta">fDelta</a> ){
232 <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
233 <b> // Correct to difference in CPV and EMC position due to different distance to center.</b>
234 <b> // we assume, that particle moves from center</b>
235 <a href="../ListOfTypes.html#Float_t">Float_t</a> dCPV = geom->GetIPtoOuterCoverDistance();
236 <a href="../ListOfTypes.html#Float_t">Float_t</a> dEMC = geom->GetIPtoCrystalSurface() ;
238 vecPpsd = dEMC * vecPpsd - vecEmc ;
240 } // if zPpsd >= zEmc - <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fDelta">fDelta</a>
242 } // if xPpsd >= xEmc - <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fDelta">fDelta</a>
252 <b>//____________________________________________________________________________</b>
253 <a name="AliPHOSTrackSegmentMakerv1:MakeLinks"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:MakeLinks">AliPHOSTrackSegmentMakerv1::MakeLinks</a>(TObjArray * emcRecPoints, TObjArray * ppsdRecPointsUp,
254 TObjArray * ppsdRecPointsLow, TClonesArray * linklowArray,
255 TClonesArray *linkupArray)
257 <b> // Finds distances (links) between all EMC and PPSD clusters, which are not further apart from each other than <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fR0">fR0</a> </b>
259 TIter nextEmc(emcRecPoints) ;
260 <a href="../ListOfTypes.html#Int_t">Int_t</a> iEmcClu = 0 ;
262 <a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> * ppsdlow ;
263 <a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> * ppsdup ;
264 <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * emcclu ;
266 <a href="../ListOfTypes.html#Int_t">Int_t</a> iLinkLow = 0 ;
267 <a href="../ListOfTypes.html#Int_t">Int_t</a> iLinkUp = 0 ;
269 while( (emcclu = (<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a>*)nextEmc() ) ) {
270 <a href="../ListOfTypes.html#Bool_t">Bool_t</a> toofar ;
271 TIter nextPpsdLow(ppsdRecPointsLow ) ;
272 <a href="../ListOfTypes.html#Int_t">Int_t</a> iPpsdLow = 0 ;
274 while( (ppsdlow = (<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a>*)nextPpsdLow() ) ) {
275 <a href="../ListOfTypes.html#Float_t">Float_t</a> r = <a href="#AliPHOSTrackSegmentMakerv1:GetDistanceInPHOSPlane">GetDistanceInPHOSPlane</a>(emcclu, ppsdlow, toofar) ;
279 if(r < <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fR0">fR0</a>)
280 new( (*linklowArray)[iLinkLow++]) <a href=".././AliPHOSLink.html">AliPHOSLink</a>(r, iEmcClu, iPpsdLow) ;
286 TIter nextPpsdUp(ppsdRecPointsUp ) ;
287 <a href="../ListOfTypes.html#Int_t">Int_t</a> iPpsdUp = 0 ;
289 while( (ppsdup = (<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a>*)nextPpsdUp() ) ) {
290 <a href="../ListOfTypes.html#Float_t">Float_t</a> r = <a href="#AliPHOSTrackSegmentMakerv1:GetDistanceInPHOSPlane">GetDistanceInPHOSPlane</a>(emcclu, ppsdup, toofar) ;
294 if(r < <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:fR0">fR0</a>)
295 new( (*linkupArray)[iLinkUp++]) <a href=".././AliPHOSLink.html">AliPHOSLink</a>(r, iEmcClu, iPpsdUp) ;
305 linklowArray->Sort() ; //first links with smallest distances
306 linkupArray->Sort() ;
309 <b>//____________________________________________________________________________</b>
310 <a name="AliPHOSTrackSegmentMakerv1:MakePairs"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:MakePairs">AliPHOSTrackSegmentMakerv1::MakePairs</a>(TObjArray * emcRecPoints, TObjArray * ppsdRecPointsUp,
311 TObjArray * ppsdRecPointsLow, TClonesArray * linklowArray,
312 TClonesArray * linkupArray, <a href="../ListOfTypes.html#TrackSegmentsList">TrackSegmentsList</a> * trsl)
315 <b> // Finds the smallest links and makes pairs of PPSD and EMC clusters with smallest distance </b>
317 TIter nextLow(linklowArray) ;
318 TIter nextUp(linkupArray) ;
320 <a href=".././AliPHOSLink.html">AliPHOSLink</a> * linkLow ;
321 <a href=".././AliPHOSLink.html">AliPHOSLink</a> * linkUp ;
323 <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * emc ;
324 <a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> * ppsdLow ;
325 <a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> * ppsdUp ;
327 <a href=".././AliPHOSRecPoint.html">AliPHOSRecPoint</a> * nullpointer = 0 ;
329 while ( (linkLow = (<a href=".././AliPHOSLink.html">AliPHOSLink</a> *)nextLow() ) ){
330 emc = (<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> *) emcRecPoints->At(linkLow->GetEmc()) ;
331 ppsdLow = (<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> *) ppsdRecPointsLow->At(linkLow->GetPpsd()) ;
332 if( (emc) && (ppsdLow) ){ // RecPoints not removed yet
335 while ( (linkUp = (<a href=".././AliPHOSLink.html">AliPHOSLink</a> *)nextUp() ) ){
336 if(linkLow->GetEmc() == linkUp->GetEmc() ){
337 ppsdUp = (<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> *) ppsdRecPointsUp->At(linkUp->GetPpsd()) ;
344 <a href=".././AliPHOSTrackSegment.html">AliPHOSTrackSegment</a> * subtr = new <a href=".././AliPHOSTrackSegment.html">AliPHOSTrackSegment</a>(emc, ppsdUp, ppsdLow ) ;
345 trsl->Add(subtr) ;
346 emcRecPoints->AddAt(nullpointer,linkLow->GetEmc()) ;
347 ppsdRecPointsLow->AddAt(nullpointer,linkLow->GetPpsd()) ;
350 ppsdRecPointsUp->AddAt(nullpointer,linkUp->GetPpsd()) ;
355 TIter nextEmc(emcRecPoints) ;
358 while( (emc = (<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a>*)nextEmc()) ){ //to create pairs if no ppsdlow
362 while ( (linkUp = (<a href=".././AliPHOSLink.html">AliPHOSLink</a> *)nextUp() ) ){
364 if(emcRecPoints->IndexOf(emc) == linkUp->GetEmc() ){
365 ppsdUp = (<a href=".././AliPHOSPpsdRecPoint.html">AliPHOSPpsdRecPoint</a> *) ppsdRecPointsUp->At(linkUp->GetPpsd()) ;
370 <a href=".././AliPHOSTrackSegment.html">AliPHOSTrackSegment</a> * subtr = new <a href=".././AliPHOSTrackSegment.html">AliPHOSTrackSegment</a>(emc, ppsdUp, ppsdLow ) ;
371 trsl->Add(subtr) ;
374 ppsdRecPointsUp->AddAt(nullpointer,linkUp->GetPpsd()) ;
379 <b>//____________________________________________________________________________</b>
380 <a name="AliPHOSTrackSegmentMakerv1:MakeTrackSegments"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:MakeTrackSegments">AliPHOSTrackSegmentMakerv1::MakeTrackSegments</a>(<a href="../ListOfTypes.html#DigitsList">DigitsList</a> * DL, <a href="../ListOfTypes.html#RecPointsList">RecPointsList</a> * emcl,
381 <a href="../ListOfTypes.html#RecPointsList">RecPointsList</a> * ppsdl, <a href="../ListOfTypes.html#TrackSegmentsList">TrackSegmentsList</a> * trsl)
383 <b> // Makes the track segments out of the list of EMC and PPSD Recpoints and stores them in a list</b>
385 <a href="../ListOfTypes.html#Int_t">Int_t</a> phosmod = 1 ;
386 <a href="../ListOfTypes.html#Int_t">Int_t</a> emcStopedAt = 0 ;
387 <a href="../ListOfTypes.html#Int_t">Int_t</a> ppsdStopedAt = 0 ;
389 TObjArray * emcRecPoints = new TObjArray(100) ; // these arrays keep pointers
390 TObjArray * ppsdRecPointsUp = new TObjArray(100) ; // to RecPoints, which are
391 TObjArray * ppsdRecPointsLow = new TObjArray(100) ; // kept in TClonesArray's emcl and ppsdl
394 TClonesArray * linklowArray = new TClonesArray("<a href=".././AliPHOSLink.html">AliPHOSLink</a>", 100);
395 TClonesArray * linkupArray = new TClonesArray("<a href=".././AliPHOSLink.html">AliPHOSLink</a>", 100);
397 <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
399 while(phosmod <= geom->GetNModules() ){
401 <a href="#AliPHOSTrackSegmentMakerv1:FillOneModule">FillOneModule</a>(DL, emcl, emcRecPoints, ppsdl, ppsdRecPointsUp, ppsdRecPointsLow, phosmod, emcStopedAt, ppsdStopedAt) ;
403 <a href="#AliPHOSTrackSegmentMakerv1:MakeLinks">MakeLinks</a>(emcRecPoints, ppsdRecPointsUp, ppsdRecPointsLow, linklowArray, linkupArray) ;
405 <a href="#AliPHOSTrackSegmentMakerv1:MakePairs">MakePairs</a>(emcRecPoints, ppsdRecPointsUp, ppsdRecPointsLow, linklowArray, linkupArray, trsl) ;
407 emcRecPoints->Clear() ;
409 ppsdRecPointsUp->Clear() ;
411 ppsdRecPointsLow->Clear() ;
413 linkupArray->Clear() ;
415 linklowArray->Clear() ;
419 delete emcRecPoints ;
422 delete ppsdRecPointsUp ;
423 ppsdRecPointsUp = 0 ;
425 delete ppsdRecPointsLow ;
426 ppsdRecPointsLow = 0 ;
431 delete linklowArray ;
435 <b>//____________________________________________________________________________</b>
436 <a name="AliPHOSTrackSegmentMakerv1:ShowerShape"> </a><a href="../ListOfTypes.html#Double_t">Double_t</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:ShowerShape">AliPHOSTrackSegmentMakerv1::ShowerShape</a>(<a href="../ListOfTypes.html#Double_t">Double_t</a> r)
438 <b> // Shape of the shower (see PHOS TDR)</b>
439 <b> // If you change this function, change also the gradien evaluation in ChiSquare()</b>
441 <a href="../ListOfTypes.html#Double_t">Double_t</a> r4 = r*r*r*r ;
442 <a href="../ListOfTypes.html#Double_t">Double_t</a> r295 = TMath::Power(r, 2.95) ;
443 <a href="../ListOfTypes.html#Double_t">Double_t</a> shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
447 <b>//____________________________________________________________________________</b>
448 <a name="AliPHOSTrackSegmentMakerv1:UnfoldClusters"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:UnfoldClusters">AliPHOSTrackSegmentMakerv1::UnfoldClusters</a>(<a href="../ListOfTypes.html#DigitsList">DigitsList</a> * DL, <a href="../ListOfTypes.html#RecPointsList">RecPointsList</a> * emcIn, <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * iniEmc,
449 <a href="../ListOfTypes.html#Int_t">Int_t</a> nMax, <a href="../ListOfTypes.html#int">int</a> * maxAt, <a href="../ListOfTypes.html#Float_t">Float_t</a> * maxAtEnergy, TObjArray * emcList)
451 <b> // Performs the unfolding of a cluster with nMax overlapping showers </b>
452 <b> // This is time consuming (use the (Un)SetUnfolFlag() )</b>
454 <a href="../ListOfTypes.html#Int_t">Int_t</a> nPar = 3 * nMax ;
455 <a href="../ListOfTypes.html#Float_t">Float_t</a> fitparameters[nPar] ;
456 <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
458 <a href="../ListOfTypes.html#Bool_t">Bool_t</a> rv = <a href="#AliPHOSTrackSegmentMakerv1:FindFit">FindFit</a>(iniEmc, maxAt, maxAtEnergy, nPar, fitparameters) ;
459 if( !rv ) // Fit failed, return and remove cluster
462 <a href="../ListOfTypes.html#Float_t">Float_t</a> xDigit ;
463 <a href="../ListOfTypes.html#Float_t">Float_t</a> zDigit ;
464 <a href="../ListOfTypes.html#Int_t">Int_t</a> relid[4] ;
466 <a href="../ListOfTypes.html#Int_t">Int_t</a> nDigits = iniEmc->GetMultiplicity() ;
467 <a href="../ListOfTypes.html#Float_t">Float_t</a> xpar ;
468 <a href="../ListOfTypes.html#Float_t">Float_t</a> zpar ;
469 <a href="../ListOfTypes.html#Float_t">Float_t</a> epar ;
470 <a href="../ListOfTypes.html#Float_t">Float_t</a> distance ;
471 <a href="../ListOfTypes.html#Float_t">Float_t</a> ratio ;
472 <a href="../ListOfTypes.html#Float_t">Float_t</a> efit[nDigits] ;
473 <a href="../ListOfTypes.html#Int_t">Int_t</a> iparam ;
474 <a href="../ListOfTypes.html#Int_t">Int_t</a> iDigit ;
476 <a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * digit ;
477 <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * emcRP ;
478 <a href="../ListOfTypes.html#Int_t">Int_t</a> * emcDigits = iniEmc->GetDigitsList() ;
479 <a href="../ListOfTypes.html#Float_t">Float_t</a> * emcEnergies = iniEmc->GetEnergiesList() ;
481 <a href="../ListOfTypes.html#Int_t">Int_t</a> iRecPoint = emcIn->GetEntries() ;
483 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
484 digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *) emcDigits[iDigit];
485 geom->AbsToRelNumbering(digit->GetId(), relid) ;
486 geom->RelPosInModule(relid, xDigit, zDigit) ;
490 while(iparam < nPar ){
491 xpar = fitparameters[iparam] ;
492 zpar = fitparameters[iparam+1] ;
493 epar = fitparameters[iparam+2] ;
495 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
496 distance = TMath::Sqrt(distance) ;
497 efit[iDigit] += epar * <a href="#AliPHOSTrackSegmentMakerv1:ShowerShape">ShowerShape</a>(distance) ;
502 <a href="../ListOfTypes.html#Float_t">Float_t</a> eDigit ;
504 while(iparam < nPar ){
505 xpar = fitparameters[iparam] ;
506 zpar = fitparameters[iparam+1] ;
507 epar = fitparameters[iparam+2] ;
509 new ((*emcIn)[iRecPoint]) <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a>( iniEmc->GetLogWeightCut(), iniEmc->GetLocMaxCut() ) ;
510 emcRP = (<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> *) emcIn->At(iRecPoint++);
512 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
513 digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *) emcDigits[iDigit];
514 geom->AbsToRelNumbering(digit->GetId(), relid) ;
515 geom->RelPosInModule(relid, xDigit, zDigit) ;
516 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
517 distance = TMath::Sqrt(distance) ;
518 ratio = epar * <a href="#AliPHOSTrackSegmentMakerv1:ShowerShape">ShowerShape</a>(distance) / efit[iDigit] ;
519 eDigit = emcEnergies[iDigit] * ratio ;
520 emcRP->AddDigit( *digit, eDigit ) ;
523 emcList->Add(emcRP) ;
528 <b>//______________________________________________________________________________</b>
529 <a href="../ListOfTypes.html#void">void</a> UnfoldingChiSquare(<a href="../ListOfTypes.html#Int_t">Int_t</a> & nPar, <a href="../ListOfTypes.html#Double_t">Double_t</a> * Grad, <a href="../ListOfTypes.html#Double_t">Double_t</a> & fret, <a href="../ListOfTypes.html#Double_t">Double_t</a> * x, <a href="../ListOfTypes.html#Int_t">Int_t</a> iflag)
531 <b> // Calculates th Chi square for the cluster unfolding minimization</b>
532 <b> // Number of parameters, Gradient, Chi squared, parameters, what to do</b>
534 <a href=".././AliPHOSGeometry.html">AliPHOSGeometry</a> * geom = <a href=".././AliPHOSGeometry.html#AliPHOSGeometry:GetInstance">AliPHOSGeometry::GetInstance</a>() ;
536 <a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> * emcRP = (<a href=".././AliPHOSEmcRecPoint.html">AliPHOSEmcRecPoint</a> *) gMinuit->GetObjectFit() ; // EmcRecPoint to fit
537 <a href="../ListOfTypes.html#Int_t">Int_t</a> * emcDigits = emcRP->GetDigitsList() ;
538 <a href="../ListOfTypes.html#Float_t">Float_t</a> * emcEnergies = emcRP->GetEnergiesList() ;
540 <a href="../ListOfTypes.html#Int_t">Int_t</a> iparam ;
543 for(iparam = 0 ; iparam < nPar ; iparam++)
544 Grad[iparam] = 0 ; // Will evaluate gradient
546 <a href="../ListOfTypes.html#Double_t">Double_t</a> efit ;
548 <a href=".././AliPHOSDigit.html">AliPHOSDigit</a> * digit ;
549 <a href="../ListOfTypes.html#Int_t">Int_t</a> iDigit = 0 ;
551 while ( (digit = (<a href=".././AliPHOSDigit.html">AliPHOSDigit</a> *)emcDigits[iDigit] )){
552 <a href="../ListOfTypes.html#Int_t">Int_t</a> relid[4] ;
553 <a href="../ListOfTypes.html#Float_t">Float_t</a> xDigit ;
554 <a href="../ListOfTypes.html#Float_t">Float_t</a> zDigit ;
555 geom->AbsToRelNumbering(digit->GetId(), relid) ;
556 geom->RelPosInModule(relid, xDigit, zDigit) ;
558 if(iflag == 2){ // calculate gradient
559 <a href="../ListOfTypes.html#Int_t">Int_t</a> iParam = 0 ;
561 while(iParam < nPar ){
562 <a href="../ListOfTypes.html#Double_t">Double_t</a> distance = (xDigit - x[iParam]) * (xDigit - x[iParam]) ;
564 distance += (zDigit - x[iParam]) * (zDigit - x[iParam]) ;
565 distance = TMath::Sqrt( distance ) ;
567 efit += x[iParam] * <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:ShowerShape">AliPHOSTrackSegmentMakerv1::ShowerShape</a>(distance) ;
570 <a href="../ListOfTypes.html#Double_t">Double_t</a> sum = 2. * (efit - emcEnergies[iDigit]) / emcEnergies[iDigit] ; // Here we assume, that sigma = sqrt(E)
572 while(iParam < nPar ){
573 <a href="../ListOfTypes.html#Double_t">Double_t</a> xpar = x[iParam] ;
574 <a href="../ListOfTypes.html#Double_t">Double_t</a> zpar = x[iParam+1] ;
575 <a href="../ListOfTypes.html#Double_t">Double_t</a> epar = x[iParam+2] ;
576 <a href="../ListOfTypes.html#Double_t">Double_t</a> dr = TMath::Sqrt( (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) );
577 <a href="../ListOfTypes.html#Double_t">Double_t</a> shape = sum * <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:ShowerShape">AliPHOSTrackSegmentMakerv1::ShowerShape</a>(dr) ;
578 <a href="../ListOfTypes.html#Double_t">Double_t</a> r4 = dr*dr*dr*dr ;
579 <a href="../ListOfTypes.html#Double_t">Double_t</a> r295 = TMath::Power(dr,2.95) ;
580 <a href="../ListOfTypes.html#Double_t">Double_t</a> deriv =-4. * dr*dr * ( 2.32 / ( (2.32 + 0.26 * r4) * (2.32 + 0.26 * r4) ) +
581 0.0316 * (1. + 0.0171 * r295) / ( ( 1. + 0.0652 * r295) * (1. + 0.0652 * r295) ) ) ;
583 Grad[iParam] += epar * shape * deriv * (xpar - xDigit) ; // Derivative over x
585 Grad[iParam] += epar * shape * deriv * (zpar - zDigit) ; // Derivative over z
587 Grad[iParam] += shape ; // Derivative over energy
593 while(iparam < nPar ){
594 <a href="../ListOfTypes.html#Double_t">Double_t</a> xpar = x[iparam] ;
595 <a href="../ListOfTypes.html#Double_t">Double_t</a> zpar = x[iparam+1] ;
596 <a href="../ListOfTypes.html#Double_t">Double_t</a> epar = x[iparam+2] ;
598 <a href="../ListOfTypes.html#Double_t">Double_t</a> distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
599 distance = TMath::Sqrt(distance) ;
600 efit += epar * <a href=".././AliPHOSTrackSegmentMakerv1.html#AliPHOSTrackSegmentMakerv1:ShowerShape">AliPHOSTrackSegmentMakerv1::ShowerShape</a>(distance) ;
602 fret += (efit-emcEnergies[iDigit])*(efit-emcEnergies[iDigit])/emcEnergies[iDigit] ;
603 <b> // Here we assume, that sigma = sqrt(E)</b>
614 <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>
616 <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.