+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+//*-- Author: Boris Polichtchouk, IHEP
+//////////////////////////////////////////////////////////////////////////////
+// Reconstructed point operations for the Clusterization class for IHEP reconstruction.
+// Performs clusterization (collects neighbouring active cells)
+// It differs from AliPHOSClusterizerv1 in neighbour definition only
+
// ---- ROOT system ---
-#include "TDirectory.h"
-#include "TBranch.h"
-#include "TTree.h"
-#include "TROOT.h"
-#include "TFolder.h"
+#include <TMath.h>
+#include <TDirectory.h>
+#include <TBranch.h>
+#include <TTree.h>
+#include <TROOT.h>
+#include <TFolder.h>
// --- AliRoot header files ---
+#include "AliLog.h"
+#include "AliConfig.h"
+#include "AliPHOSDigit.h"
+#include "AliPHOSClusterizer.h"
#include "AliPHOSEvalRecPoint.h"
#include "AliRun.h"
-#include "AliPHOSGetter.h"
+#include "AliPHOSLoader.h"
#include "AliPHOSRecCpvManager.h"
#include "AliPHOSRecEmcManager.h"
#include "AliPHOSDigitizer.h"
+#include "AliPHOSGeometry.h"
// --- Standard library ---
-#include <iostream.h>
ClassImp(AliPHOSEvalRecPoint)
- AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(): AliPHOSCpvRecPoint()
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint() :
+ fIsEmc(kFALSE),
+ fIsCpv(kTRUE),
+ fParent(-333),
+ fChi2Dof(-111),
+ fEventFolderName(AliConfig::GetDefaultEventFolderName())
{
- fParent=-333;
- fChi2Dof=-111;
- fIsCpv = kTRUE;
- fIsEmc = kFALSE;
+ // default ctor
}
-AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) : AliPHOSCpvRecPoint()
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Bool_t cpv, AliPHOSEvalRecPoint* parent) :
+ fIsEmc(kFALSE),
+ fIsCpv(kFALSE),
+ fParent(-333),
+ fChi2Dof(-111),
+ fEventFolderName("")
{
-
+ // ctor
fParent=-333;
fChi2Dof=-111;
// fParent=parent;
TObjArray* wPool = (TObjArray*)GetWorkingPool();
if(!wPool) {
- cout<<" Couldn't find working pool. Exit."<<endl;
- exit(1);
+ Fatal("ctor", "Couldn't find working pool") ;
}
fParent = wPool->IndexOf((TObject*)parent);
}
-AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) : AliPHOSCpvRecPoint()
+AliPHOSEvalRecPoint::AliPHOSEvalRecPoint(Int_t i, Bool_t cpv) :
+ fIsEmc(kFALSE),
+ fIsCpv(kFALSE),
+ fParent(-333),
+ fChi2Dof(-111),
+ fEventFolderName(AliConfig::GetDefaultEventFolderName())
{
-
- fChi2Dof=-111;
- fParent=-333;
-
+ // ctor
AliPHOSEmcRecPoint* rp=0;
- AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance();
+ AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
if(cpv) {
- rp = (AliPHOSCpvRecPoint*)fGetter->CpvRecPoints()->At(i);
+ rp = (AliPHOSCpvRecPoint*)fLoader->CpvRecPoints()->At(i);
fIsEmc = kFALSE;
fIsCpv = kTRUE;
}
else {
- rp = (AliPHOSEmcRecPoint*)fGetter->EmcRecPoints()->At(i);
+ rp = (AliPHOSEmcRecPoint*)fLoader->EmcRecPoints()->At(i);
fIsEmc = kTRUE;
fIsCpv = kFALSE;
}
- Int_t* Digits = rp->GetDigitsList();
- Float_t* Energies = rp->GetEnergiesList();
+ Int_t* digits = rp->GetDigitsList();
+ Float_t* energies = rp->GetEnergiesList();
Int_t nDigits = rp->GetMultiplicity();
for(Int_t iDigit=0; iDigit<nDigits; iDigit++) {
- AliPHOSDigit* digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- Float_t eDigit = Energies[iDigit];
+ AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+ Float_t eDigit = energies[iDigit];
this->AddDigit(*digit,eDigit);
}
AliPHOSClusterizer* AliPHOSEvalRecPoint::GetClusterizer()
{
+ // returns clusterizer task
TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
AliPHOSClusterizer* clu = (AliPHOSClusterizer*)wPoolF->FindObject("PHOS:clu-v1");
if(!clu) {
- cout<<" Couldn't find Clusterizer. Exit."<<endl;
- exit(1);
+ Fatal("GetClusterizer", "Couldn't find Clusterizer") ;
}
return clu;
Bool_t AliPHOSEvalRecPoint::TooClose(AliPHOSRecPoint* pt) const
{
- TVector3 her_pos;
- TVector3 my_pos;
- pt->GetLocalPosition(her_pos);
- this->GetLocalPosition(my_pos);
- Float_t dx = her_pos.X() - my_pos.X();
- Float_t dz = her_pos.Z() - my_pos.Z();
+ // check if a rec.point pt is too close to this one
+ TVector3 herPos;
+ TVector3 myPos;
+ pt->GetLocalPosition(herPos);
+ this->GetLocalPosition(myPos);
+ Float_t dx = herPos.X() - myPos.X();
+ Float_t dz = herPos.Z() - myPos.Z();
Float_t dr = TMath::Sqrt(dx*dx + dz*dz);
if(dr<GetReconstructionManager()->MergeGammasMinDistanceCut())
Bool_t AliPHOSEvalRecPoint::NeedToSplit() const
{
+ // rec.point needs to be split
return kFALSE;
}
void AliPHOSEvalRecPoint::DeleteParent()
{
+ // delete parent
fParent=-333;
}
void AliPHOSEvalRecPoint::UpdateWorkingPool()
{
+ // update pool of rec.points
+ Int_t i; //loop variable
- for(Int_t i=0; i<this->InWorkingPool(); i++) {
+ for(i=0; i<this->InWorkingPool(); i++) {
AliPHOSEvalRecPoint* parent = (AliPHOSEvalRecPoint*)GetFromWorkingPool(i);
TObjArray children;
Int_t nChild = parent->HasChild(children);
}
- for(Int_t i=0; i<this->InWorkingPool(); i++) {
+ for(i=0; i<this->InWorkingPool(); i++) {
AliPHOSEvalRecPoint* weak = (AliPHOSEvalRecPoint*)GetFromWorkingPool(i);
if (weak->KillWeakPoint()) delete weak;
}
- for(Int_t i=0; i<this->InWorkingPool(); i++) {
+ for(i=0; i<this->InWorkingPool(); i++) {
AliPHOSEvalRecPoint* close = (AliPHOSEvalRecPoint*)GetFromWorkingPool(i);
close->MergeClosePoint();
}
- for(Int_t i=0; i<this->InWorkingPool(); i++)
+ for(i=0; i<this->InWorkingPool(); i++)
((AliPHOSEvalRecPoint*)AliPHOSEvalRecPoint::GetFromWorkingPool(i))->SetIndexInList(i);
}
Int_t AliPHOSEvalRecPoint::HasChild(TObjArray& children)
{
+ // returns the number of children
for(Int_t iChild=0; iChild<InWorkingPool(); iChild++)
{
AliPHOSEvalRecPoint* child = (AliPHOSEvalRecPoint*)GetFromWorkingPool(iChild);
void AliPHOSEvalRecPoint::Init()
{
-
+ // initialization
AliPHOSClusterizer* clusterizer = GetClusterizer();
if(!clusterizer) {
- cout<<" Cannot get clusterizer. Exit."<<endl;
- exit(1);
+ Fatal("Init", "Cannot get clusterizer") ;
}
- TClonesArray* digits = AliPHOSGetter::GetInstance()->Digits();
- Float_t LogWeight=0;
+ TClonesArray* digits = AliPHOSLoader::GetPHOSLoader(fEventFolderName)->Digits();
+ Float_t logWeight=0;
if(this->IsEmc()) {
- LogWeight = clusterizer->GetEmcLogWeight();
+ logWeight = clusterizer->GetEmcLogWeight();
}
else {
- LogWeight = clusterizer->GetCpvLogWeight();
+ logWeight = clusterizer->GetCpvLogWeight();
}
- EvalLocalPosition(LogWeight,digits); // evaluate initial position
+ TVector3 vtx(0.,0.,0.) ;
+ TVector3 inc(0.,0.,0.) ;
+ EvalLocalPosition(logWeight,vtx,digits,inc); // evaluate initial position
}
GetLocalPosition(lpos);
Float_t xx = lpos.Z();
Float_t yy = lpos.X();
- Float_t E = GetEnergy();
+ Float_t e = GetEnergy();
- cout<<" (x,z,E)[old] = ("<<yy<<","<<xx<<","<<E<<")"<<endl;
+ AliInfo(Form("(x,z,e)[old] = (%f, %f, %f)", yy, xx, e)) ;
-// xx = XY(xx/E);
-// yy = XY(yy/E);
+// xx = XY(xx/e);
+// yy = XY(yy/e);
Float_t eDigit ;
AliPHOSDigit * digit ;
Int_t nDigits = GetMultiplicity();
- Int_t * Digits = GetDigitsList();
- Float_t * Energies = GetEnergiesList();
+ Int_t * digits = GetDigitsList();
+ Float_t * energies = GetEnergiesList();
Float_t ix ;
Float_t iy ;
Float_t sqr;
Float_t cos2fi = 1.;
- AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance();
- const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry();
+ AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
+ AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
- for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
+ Int_t iDigit; //loop variable
+
+ for(iDigit = 0 ; iDigit < nDigits ; iDigit ++)
{
- digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- eDigit = Energies[iDigit];
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- fGeom->RelPosInModule(relid, iy, ix);
+ digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+ eDigit = energies[iDigit];
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, iy, ix);
Float_t dx = ix - xx;
Float_t dy = iy - yy;
if(exy<0) sinfi = -sinfi;
Float_t eu3 = 0;
- for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
+ for(iDigit = 0 ; iDigit < nDigits ; iDigit ++)
{
- digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- eDigit = Energies[iDigit];
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- fGeom->RelPosInModule(relid, iy, ix);
+ digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+ eDigit = energies[iDigit];
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, iy, ix);
Float_t dx = ix - xx;
Float_t dy = iy - yy;
eu3 += eDigit*du*du*du;
}
- Float_t c = E*eu3*eu3/(euu*euu*euu)/2.;
+ Float_t c = e*eu3*eu3/(euu*euu*euu)/2.;
Float_t sign = 1.;
if(eu3<0) sign = -1.;
Float_t r = 1.+ c + sign*TMath::Sqrt(2.*c + c*c);
Float_t u = 0;
if(TMath::Abs(r-1.)>0.1) u = eu3/euu*(r+1.)/(r-1.);
- if(TMath::Abs(r-1.)<0.1) u = TMath::Sqrt(sqr/E/r)*(1.+r);
+ if(TMath::Abs(r-1.)<0.1) u = TMath::Sqrt(sqr/e/r)*(1.+r);
- Float_t e2c = E/(1.+r);
- Float_t e1c = E-e2c;
+ Float_t e2c = e/(1.+r);
+ Float_t e1c = e-e2c;
Float_t u1 = -u/(1.+r);
Float_t u2 = u+u1;
Float_t chmin = GetReconstructionManager()->TwoGamChisqMin();
Float_t emin = GetReconstructionManager()->TwoGamEmin();
Float_t stpmin = GetReconstructionManager()->TwoGamStepMin();
- Int_t Niter = GetReconstructionManager()->TwoGamNumOfIterations(); // Number of iterations.
+ Int_t nIter = GetReconstructionManager()->TwoGamNumOfIterations(); // Number of iterations.
Float_t chisq = 100.; //Initial chisquare.
Float_t y2c = gamma2[1];
Float_t x2c = gamma2[2];
- Float_t E = GetEnergy();
+ Float_t e = GetEnergy();
Float_t eDigit ;
AliPHOSDigit * digit ;
Int_t nDigits = GetMultiplicity();
- Int_t * Digits = GetDigitsList();
- Float_t * Energies = GetEnergiesList();
+ Int_t * digits = GetDigitsList();
+ Float_t * energies = GetEnergiesList();
Float_t ix ;
Float_t iy ;
Int_t relid[4] ;
- AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance();
- const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry();
+ AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
+ AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
- for(Int_t Iter=0; Iter<Niter; Iter++)
+ for(Int_t iter=0; iter<nIter; iter++)
{
Float_t chisqc = 0.;
Float_t grx1c = 0.;
for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
{
- digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- eDigit = Energies[iDigit];
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- fGeom->RelPosInModule(relid, iy, ix);
+ digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+ eDigit = energies[iDigit];
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, iy, ix);
Float_t a1,gx1,gy1;
Float_t a2,gx2,gy2;
Float_t dx1 = x1c - ix;
Float_t dy1 = y1c - iy;
-// cout<<" Mult "<<nDigits<<" dx1 "<<dx1<<" dy1 "<<dy1<<endl;
-// AG(e1c,dx1,dy1,a1,gx1,gy1);
+
GetReconstructionManager()->AG(e1c,dx1,dy1,a1,gx1,gy1);
Float_t dx2 = x2c - ix;
Float_t dy2 = y2c - iy;
-// cout<<" "<<" dx2 "<<dx2<<" dy2 "<<dy2<<endl;
-// AG(e2c,dx2,dy2,a2,gx2,gy2);
+
GetReconstructionManager()->AG(e2c,dx2,dy2,a2,gx2,gy2);
- Float_t A = a1+a2;
-// Float_t D = Const*A*(1. - A/E);
+ Float_t a = a1+a2;
+// Float_t D = Const*a*(1. - a/e);
// if(D<0) D=0;
// // D = 9.; // ????
-// Float_t da = A - eDigit;
+// Float_t da = a - eDigit;
// chisqc += da*da/D;
// Float_t dd = da/D;
-// dd = dd*(2.-dd*Const*(1.-2.*A/E));
+// dd = dd*(2.-dd*Const*(1.-2.*a/e));
Float_t dd;
- chisqc += GetReconstructionManager()->TwoGamChi2(A,eDigit,E,dd);
+ chisqc += GetReconstructionManager()->TwoGamChi2(a,eDigit,e,dd);
grx1c += gx1*dd;
gry1c += gy1*dd;
grx2c += gx2*dd;
gry2c += gy2*dd;
- grec += (a1/e1c - a2/e2c)*E*dd;
+ grec += (a1/e1c - a2/e2c)*e*dd;
}
loop20: ;
Float_t step = st*gr;
-
- cout<<" Iteration "<<Iter<<" dof "<<dof<<" chisq/dof "<<ch/dof<<" chstop/dof "<<chstop/dof<<" step " <<step<<" stpmin "<<stpmin<<endl;
+ AliInfo(Form("Iteration %d dof %d chisq/dof %f chstop/dof %f step %f stpmin %f",
+ iter, dof, ch/dof, chstop/dof, step, stpmin)) ;
if(step<stpmin)
goto loop101;
- Float_t de = st*gre*E;
+ Float_t de = st*gre*e;
e1c = ee1 - de;
e2c = ee2 + de;
gamma2[1] = yy2;
gamma2[2] = xx2;
- Float_t x1_new = yy1;
- Float_t z1_new = xx1;
- Float_t e1_new = ee1;
- Float_t x2_new = yy2;
- Float_t z2_new = xx2;
- Float_t e2_new = ee2;
+ Float_t x1New = yy1;
+ Float_t z1New = xx1;
+ Float_t e1New = ee1;
+ Float_t x2New = yy2;
+ Float_t z2New = xx2;
+ Float_t e2New = ee2;
- cout<<" (x,z,E)[1 fit] = ("<<x1_new<<","<<z1_new<<","<<e1_new<<")"<<endl;
- cout<<" (x,z,E)[2 fit] = ("<<x2_new<<","<<z2_new<<","<<e2_new<<")"<<endl;
+ TString message ;
+ message = " (x,z,e)[1 fit] = (%f, %f, %f)\n" ;
+ message = " (x,z,e)[2 fit] = (%f, %f, %f)\n" ;
+ AliInfo(Form(message.Data(),
+ x1New, z1New, e1New,
+ x2New, z2New, e2New)) ;
fChi2Dof = chisq;
// Use TwoGam() to estimate the positions and energies of merged points.
- Int_t Nmax = 2;
+ Int_t nMax = 2;
Float_t* gamma;
- Int_t* Digits = GetDigitsList();
+ Int_t* digits = GetDigitsList();
Int_t nDigits = GetMultiplicity();
- Float_t* Energies = GetEnergiesList();
+ Float_t* energies = GetEnergiesList();
Float_t* eFit = new Float_t[nDigits];
- AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance();
- const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry();
+ AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
+ AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
for(Int_t iDigit=0; iDigit<nDigits; iDigit++)
{
- AliPHOSDigit* digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
+ AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
Int_t relid[4] ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
Float_t x,z;
- fGeom->RelPosInModule(relid, x, z);
+ phosgeom->RelPosInModule(relid, x, z);
Float_t gain = 0.;
- for(Int_t iMax=0; iMax<Nmax; iMax++)
+ for(Int_t iMax=0; iMax<nMax; iMax++)
{
if(iMax==0)
gamma = gamma1;
Float_t dx = xMax - x;
Float_t dz = zMax - z;
- Float_t Amp,gx,gy;
- GetReconstructionManager()->AG(eMax,dz,dx,Amp,gx,gy);
- gain += Amp;
+ Float_t amp,gx,gy;
+ GetReconstructionManager()->AG(eMax,dz,dx,amp,gx,gy);
+ gain += amp;
}
eFit[iDigit] = gain;
}
- for( Int_t iMax=0; iMax<Nmax; iMax++)
+ for( Int_t iMax=0; iMax<nMax; iMax++)
{
if(iMax==0)
gamma = gamma1;
for( Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
{
- AliPHOSDigit* digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- Float_t eDigit = Energies[iDigit];
+ AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+ Float_t eDigit = energies[iDigit];
Int_t relid[4] ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
Float_t ix,iz;
- fGeom->RelPosInModule(relid, ix, iz);
+ phosgeom->RelPosInModule(relid, ix, iz);
Float_t dx = xMax - ix;
Float_t dz = zMax - iz;
- Float_t single_shower_gain,gxMax,gyMax;
- GetReconstructionManager()->AG(eMax,dz,dx,single_shower_gain,gxMax,gyMax);
- Float_t total_gain = eFit[iDigit];
- Float_t ratio = single_shower_gain/total_gain;
-// cout<<" ratio -> "<<ratio<<endl;
+ Float_t singleShowerGain,gxMax,gyMax;
+ GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax);
+ Float_t totalGain = eFit[iDigit];
+ Float_t ratio = singleShowerGain/totalGain;
eDigit = eDigit*ratio;
newRP->AddDigit(*digit,eDigit);
}
-
- cout<<"======= Split: daughter rec point "<<iMax<<" ================="<<endl;
- newRP->Print("");
+ AliInfo(Form("======= Split: daughter rec point %d =================",
+ iMax)) ;
+ newRP->Print();
}
delete[] eFit;
- cout<<endl;
}
if(nDigits<2)
return;
- Int_t Niter = GetReconstructionManager()->OneGamNumOfIterations(); // number of iterations
- Float_t St0 = GetReconstructionManager()->OneGamInitialStep(); // initial step
-// const Float_t Stpmin = 0.005;
- Float_t Stpmin = GetReconstructionManager()->OneGamStepMin();
+ Int_t nIter = GetReconstructionManager()->OneGamNumOfIterations(); // number of iterations
+ Float_t st0 = GetReconstructionManager()->OneGamInitialStep(); // initial step
+// const Float_t stpMin = 0.005;
+ Float_t stpMin = GetReconstructionManager()->OneGamStepMin();
Float_t chmin = GetReconstructionManager()->OneGamChisqMin();
TVector3 locpos;
Float_t ix, iy;
GetLocalPosition(locpos);
- Float_t E = GetEnergy();
+ Float_t e = GetEnergy();
Float_t xc = locpos.Z();
Float_t yc = locpos.X();
Float_t dx,dy,gx,gy,grxc,gryc;
- Float_t st = St0;
+ Float_t st = st0;
Float_t chisq = 1.e+20;
Float_t gr = 1.;
Float_t grx = 0.;
Float_t cosi,x1=0,y1=0;
Float_t chisqc;
- AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance();
- const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry();
+ AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
+ AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
- for(Int_t Iter=0; Iter<Niter; Iter++)
+ for(Int_t iter=0; iter<nIter; iter++)
{
chisqc = 0.;
for(Int_t iDigit = 0 ; iDigit < nDigits ; iDigit ++)
{
- Float_t* Energies = GetEnergiesList();
- Int_t* Digits = GetDigitsList();
- digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- eDigit = Energies[iDigit];
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- fGeom->RelPosInModule(relid, iy, ix);
+ Float_t* energies = GetEnergiesList();
+ Int_t* digits = GetDigitsList();
+ digit = (AliPHOSDigit*)fLoader->Digits()->At( digits[iDigit] );
+ eDigit = energies[iDigit];
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, iy, ix);
dx = xc - ix;
dy = yc - iy;
if(!dx) dx=dy;
if(!dy) dy=dx;
- Float_t A;
- GetReconstructionManager()->AG(E,dx,dy,A,gx,gy);
+ Float_t a;
+ GetReconstructionManager()->AG(e,dx,dy,a,gx,gy);
Float_t dd;
- cout<<" (ix iy xc yc dx dy) "<<ix<<" "<<iy<<" "<<xc<<" "<<yc<<" "<<dx<<" "<<dy<<endl;
- Float_t chi2dg = GetReconstructionManager()->OneGamChi2(A,eDigit,E,dd);
+ AliInfo(Form(" (ix iy xc yc dx dy) %f %f %f %f %f %f",
+ ix, iy, xc, yc, dx, dy)) ;
+ Float_t chi2dg = GetReconstructionManager()->OneGamChi2(a,eDigit,e,dd);
// Exclude digit with too large chisquare.
if(chi2dg > 10) { continue; }
Float_t grc = TMath::Sqrt(grxc*grxc + gryc*gryc);
if(grc<1.e-10) grc=1.e-10;
Float_t sc = 1. + chisqc/chisq;
- cout<<" chisq: "<<chisq<<endl;
+ AliInfo(Form(" chisq: %f", chisq)) ;
st = st/sc;
if(chisqc>chisq)
goto loop20;
loop20: ;
Float_t step = st*gr;
-
- cout<<" Iteration "<<Iter<<" dof "<<dof<<" chisq/dof "<<chisq/dof<<" chstop/dof "<<chstop/dof<<" step " <<step<<" Stpmin "<<Stpmin<<endl;
+ AliInfo(Form(" Iteration %d dof %d chisq/dof %f chstop/dof %f step %f stpMin %f",
+ iter, dof, chisq/dof, chstop/dof, step, stpMin)) ;
- if(step<Stpmin)
+ if(step<stpMin)
goto loop101;
if(step>1.)
// }
Float_t gamma1[3];
- gamma1[0] = E;
+ gamma1[0] = e;
gamma1[1] = y1;
gamma1[2] = x1;
//SetLocalPosition(newpos);
fLocPos=newpos;
- fAmp=E;
+ fAmp=e;
// TVector3 pos;
// RP->GetLocalPosition(pos);
-// cout<<" (x,z)[old] = ("<<x_old<<","<<z_old<<")"<<endl;
-// cout<<" (x,z)[new] = ("<<pos.X()<<","<<pos.Z()<<")"<<endl;
-// cout<<" gamma[1]: "<<gamma1[1]<<" gamma1[2]: "<<gamma1[2]<<endl;
fChi2Dof = chisq;
// Remove this point from further procession
// if it's energy is too small.
- Float_t Thr0 = GetReconstructionManager()->KillGamMinEnergy();
+ Float_t thr0 = GetReconstructionManager()->KillGamMinEnergy();
- if(GetEnergy()<Thr0) {
- cout<<"+++++++ Killing this rec point ++++++++++"<<endl;
+ if(GetEnergy()<thr0) {
+ AliInfo(Form("+++++++ Killing this rec point ++++++++++")) ;
RemoveFromWorkingPool(this);
return kTRUE;
}
void AliPHOSEvalRecPoint::MergeClosePoint()
{
-
- AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance();
-// AliPHOSDigitizer* digitizer = fGetter->Digitizer();
+ // merge rec.points if they are too close
+ AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
+// AliPHOSDigitizer* digitizer = fLoader->Digitizer();
// Float_t fPedestal = digitizer->GetPedestal(); // YVK 30.09.2001
// Float_t fSlope = digitizer->GetSlope();
{
if(TooClose(rp))
{
- cout<<"+++++++ Merging point 1: ++++++"<<endl;
- this->Print("");
- cout<<"+++++++ and point 2: ++++++++++"<<endl;
- ((AliPHOSEvalRecPoint*)rp)->Print("");
+ AliInfo(Form("+++++++ Merging point 1: ++++++")) ;
+ this->Print();
+ AliInfo(Form("+++++++ and point 2: ++++++++++")) ;
+ ((AliPHOSEvalRecPoint*)rp)->Print();
//merge two rec. points
TVector3 lpos1;
this->GetLocalPosition(lpos1);
rp->GetLocalPosition(lpos2);
- Int_t* Digits = rp->GetDigitsList();
+ Int_t* digits = rp->GetDigitsList();
Float_t dE = rp->GetEnergy()/(rp->GetEnergy()+this->GetEnergy());
- Float_t new_x = lpos1.X()*dE + lpos2.X()*(1.-dE);
- Float_t new_z = lpos1.Z()*dE + lpos2.Z()*(1.-dE);
- Float_t new_E = rp->GetEnergy()+this->GetEnergy();
- Float_t* Energies = ((AliPHOSEmcRecPoint*)rp)->GetEnergiesList();
+ Float_t newX = lpos1.X()*dE + lpos2.X()*(1.-dE);
+ Float_t newZ = lpos1.Z()*dE + lpos2.Z()*(1.-dE);
+ Float_t newE = rp->GetEnergy()+this->GetEnergy();
+ Float_t* energies = ((AliPHOSEmcRecPoint*)rp)->GetEnergiesList();
for(Int_t iDigit=0; iDigit<rp->GetDigitsMultiplicity(); iDigit++)
{
- AliPHOSDigit* digit = (AliPHOSDigit*)fGetter->Digits()->At(Digits[iDigit]);
- Float_t eDigit = Energies[iDigit];
+ AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At(digits[iDigit]);
+ Float_t eDigit = energies[iDigit];
this->AddDigit(*digit,eDigit);
}
- TVector3 newpos(new_x,0,new_z);
+ TVector3 newpos(newX,0,newZ);
fLocPos = newpos;
- fAmp = new_E;
+ fAmp = newE;
RemoveFromWorkingPool(rp);
delete rp;
- cout<<"++++++ Resulting point: ++++++++"<<endl;
- this->Print("");
+ AliInfo(Form("++++++ Resulting point: ++++++++")) ;
+ this->Print();
break;
}
// if multiplicity less then 2 - nothing to unfold
if(GetMultiplicity()<2) return 1;
- Int_t maxAt[1000];
+ AliPHOSDigit * maxAt[1000];
Float_t maxAtEnergy[1000];
- Float_t LocMaxCut, LogWeight;
+ Float_t locMaxCut, logWeight;
Int_t relid[4] ;
Float_t xMax;
Float_t zMax;
-// AliPHOSClusterizer* clusterizer = fGetter->Clusterizer("PHOSclu-v1");
AliPHOSClusterizer* clusterizer = GetClusterizer();
if(!clusterizer) {
- cout<<" Cannot get clusterizer. Exit."<<endl;
- exit(1);
+ AliFatal(Form("Cannot get clusterizer")) ;
}
if(this->IsEmc()) {
- LocMaxCut = clusterizer->GetEmcLocalMaxCut();
- LogWeight = clusterizer->GetEmcLogWeight();
+ locMaxCut = clusterizer->GetEmcLocalMaxCut();
+ logWeight = clusterizer->GetEmcLogWeight();
}
else {
- LocMaxCut = clusterizer->GetCpvLocalMaxCut();
- LogWeight = clusterizer->GetCpvLogWeight();
+ locMaxCut = clusterizer->GetCpvLocalMaxCut();
+ logWeight = clusterizer->GetCpvLogWeight();
}
- AliPHOSGetter* fGetter = AliPHOSGetter::GetInstance();
- const AliPHOSGeometry* fGeom = fGetter->PHOSGeometry();
- TClonesArray* digits = fGetter->Digits();
+ AliPHOSLoader* fLoader = AliPHOSLoader::GetPHOSLoader(fEventFolderName);
+ AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
+ TClonesArray* digits = fLoader->Digits();
// if number of local maxima less then 2 - nothing to unfold
- Int_t Nmax = GetNumberOfLocalMax(maxAt,maxAtEnergy,LocMaxCut,digits);
- if(Nmax<2) return Nmax;
+ Int_t nMax = GetNumberOfLocalMax(maxAt,maxAtEnergy,locMaxCut,digits);
+ if(nMax<2) return nMax;
- Int_t* Digits = GetDigitsList();
+ Int_t* digitsList = GetDigitsList();
Int_t nDigits = GetMultiplicity();
- Float_t* Energies = GetEnergiesList();
+ Float_t* energies = GetEnergiesList();
Float_t* eFit = new Float_t[nDigits];
- for(Int_t iDigit=0; iDigit<nDigits; iDigit++)
+ Int_t iDigit; //loop variable
+
+ for(iDigit=0; iDigit<nDigits; iDigit++)
{
eFit[iDigit] = 0.;
}
- for(Int_t iDigit=0; iDigit<nDigits; iDigit++)
+ for(iDigit=0; iDigit<nDigits; iDigit++)
{
- AliPHOSDigit* digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digitsList[iDigit] );
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
Float_t x,z;
- fGeom->RelPosInModule(relid, x, z);
+ phosgeom->RelPosInModule(relid, x, z);
- for(Int_t iMax=0; iMax<Nmax; iMax++)
+ for(Int_t iMax=0; iMax<nMax; iMax++)
{
- AliPHOSDigit* digitMax = (AliPHOSDigit*)maxAt[iMax];
+ AliPHOSDigit* digitMax = maxAt[iMax];
Float_t eMax = maxAtEnergy[iMax];
- fGeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
- fGeom->RelPosInModule(relid, xMax, zMax);
+ phosgeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, xMax, zMax);
Float_t dx = xMax - x;
Float_t dz = zMax - z;
- Float_t Amp,gx,gy;
- GetReconstructionManager()->AG(eMax,dz,dx,Amp,gx,gy);
-// Amp = Amp + 0.5;
- eFit[iDigit] += Amp;
+ Float_t amp,gx,gy;
+ GetReconstructionManager()->AG(eMax,dz,dx,amp,gx,gy);
+// amp = amp + 0.5;
+ eFit[iDigit] += amp;
}
}
- for(Int_t iMax=0; iMax<Nmax; iMax++)
+ for(Int_t iMax=0; iMax<nMax; iMax++)
{
- AliPHOSDigit* digitMax = (AliPHOSDigit*)maxAt[iMax];
- fGeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
- fGeom->RelPosInModule(relid, xMax, zMax);
+ AliPHOSDigit* digitMax = maxAt[iMax];
+ phosgeom->AbsToRelNumbering(digitMax->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, xMax, zMax);
Float_t eMax = maxAtEnergy[iMax];
AliPHOSEvalRecPoint* newRP = new AliPHOSEvalRecPoint(IsCPV(),this);
newRP->AddDigit(*digitMax,maxAtEnergy[iMax]);
//Neighbous ( matrix 3x3 around the local maximum)
- for(Int_t iDigit=0; iDigit<nDigits; iDigit++)
+ for(iDigit=0; iDigit<nDigits; iDigit++)
{
- AliPHOSDigit* digit = (AliPHOSDigit*)fGetter->Digits()->At( Digits[iDigit] );
- Float_t eDigit = Energies[iDigit];
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ AliPHOSDigit* digit = (AliPHOSDigit*)fLoader->Digits()->At( digitsList[iDigit] );
+ Float_t eDigit = energies[iDigit];
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
Float_t ix,iz;
- fGeom->RelPosInModule(relid, ix, iz);
+ phosgeom->RelPosInModule(relid, ix, iz);
if(AreNeighbours(digitMax,digit))
{
Float_t dx = xMax - ix;
Float_t dz = zMax - iz;
- Float_t single_shower_gain,gxMax,gyMax;
- GetReconstructionManager()->AG(eMax,dz,dx,single_shower_gain,gxMax,gyMax);
- Float_t total_gain = eFit[iDigit];
- Float_t ratio = single_shower_gain/total_gain;
- cout<<" ratio -> "<<ratio<<endl;
+ Float_t singleShowerGain,gxMax,gyMax;
+ GetReconstructionManager()->AG(eMax,dz,dx,singleShowerGain,gxMax,gyMax);
+ Float_t totalGain = eFit[iDigit];
+ Float_t ratio = singleShowerGain/totalGain;
+ AliInfo(Form(" ratio -> %f", ratio)) ;
eDigit = eDigit*ratio;
newRP->AddDigit(*digit,eDigit);
}
}
- newRP->EvalLocalPosition(LogWeight,digits);
- cout<<"======= Unfold: daughter rec point "<<iMax<<" ================="<<endl;
- newRP->Print("");
+ TVector3 vtx(0.,0.,0.) ;
+ TVector3 inc(0.,0.,0.) ;
+ newRP->EvalLocalPosition(logWeight,vtx,digits,inc);
+ AliInfo(Form("======= Unfold: daughter rec point %d =================",
+ iMax)) ;
+ newRP->Print();
}
// RemoveFromWorkingPool(this);
delete[] eFit;
- cout<<endl;
- return Nmax;
+ return nMax;
}
-void AliPHOSEvalRecPoint::PrintPoint(Option_t* opt)
+void AliPHOSEvalRecPoint::PrintPoint()
{
- AliPHOSCpvRecPoint::Print(opt);
+ // print rec.point to stdout
+ AliPHOSCpvRecPoint::Print();
TVector3 lpos;
GetLocalPosition(lpos);
- cout<<" Chi2/dof = "<<Chi2Dof()<<endl;
- cout<<" Local (x,z) = ("<<lpos.X()<<","<<lpos.Z()<<") in module "<<GetPHOSMod()<<endl;
-// if(GetReconstructionManager())
-// cout<<" Distance of merger = "<<GetReconstructionManager()->MergeGammasMinDistanceCut()<<endl;
+ TString message ;
+ message = " Chi2/dof = %f" ;
+ message += " Local (x,z) = (%f, %f) in module %d" ;
+ AliInfo(Form(message.Data(), Chi2Dof(), lpos.X(), lpos.Z(), GetPHOSMod())) ;
+
}
AliPHOSRecManager* AliPHOSEvalRecPoint::GetReconstructionManager() const
{
-
+ // returns reconstruction manager
TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
AliPHOSRecManager* recMng = (AliPHOSRecManager*)wPoolF->FindObject("AliPHOSRecManager");
if(!recMng) {
- cout<<" Couldn't find Reconstruction Manager. Exit."<<endl;
- exit(1);
+ AliFatal(Form("Couldn't find Reconstruction Manager")) ;
}
return recMng;
AliPHOSRecPoint* AliPHOSEvalRecPoint::Parent()
{
+ // returns a parent
if(fParent<0) return NULL;
else
return (AliPHOSRecPoint*)GetFromWorkingPool(fParent);
Float_t AliPHOSEvalRecPoint::Chi2Dof() const
{
+ // returns a chi^2 per degree of freedom
return fChi2Dof;
}
const TObject* AliPHOSEvalRecPoint::GetWorkingPool()
{
-
+ // returns a pool of rec.points
TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
TFolder* wPoolF = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS/SmP");
TObject* wPool = wPoolF->FindObject("SmartPoints");
if(!wPool) {
- cout<<" Couldn't find Working Pool. Exit."<<endl;
- exit(1);
+ AliFatal(Form("Couldn't find Working Pool")) ;
}
return wPool;
void AliPHOSEvalRecPoint::AddToWorkingPool(TObject* obj)
{
+ // add a rec.point to a pool
((TObjArray*)GetWorkingPool())->Add(obj);
}
TObject* AliPHOSEvalRecPoint::GetFromWorkingPool(Int_t i)
{
+ // return a rec.point from a pool at an index i
// return fWorkingPool->At(i);
return ((TObjArray*)GetWorkingPool())->At(i);
}
Int_t AliPHOSEvalRecPoint::InWorkingPool()
{
+ // return the number of rec.points in a pool
return ((TObjArray*)GetWorkingPool())->GetEntries();
}
void AliPHOSEvalRecPoint::RemoveFromWorkingPool(TObject* obj)
{
+ // remove a rec.point from a pool
((TObjArray*)GetWorkingPool())->Remove(obj);
((TObjArray*)GetWorkingPool())->Compress();
}
void AliPHOSEvalRecPoint::PrintWorkingPool()
{
- ((TObjArray*)GetWorkingPool())->Print("");
+ // print pool of rec.points to stdout
+ ((TObjArray*)GetWorkingPool())->Print();
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-