From dd36288a0967735cc24d51b908b675fae7c45610 Mon Sep 17 00:00:00 2001 From: cvetan Date: Tue, 16 Nov 2004 14:28:42 +0000 Subject: [PATCH] Introduction of a fast version of the AliITSVertexerZ for HLT --- HLT/ITS/AliL3ITSLinkDef.h | 1 + HLT/ITS/AliL3ITSVertexerZ.cxx | 311 ++++++++++++++++++++++++++++++++++ HLT/ITS/AliL3ITSVertexerZ.h | 31 ++++ HLT/libAliL3ITS.pkg | 2 +- 4 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 HLT/ITS/AliL3ITSVertexerZ.cxx create mode 100644 HLT/ITS/AliL3ITSVertexerZ.h diff --git a/HLT/ITS/AliL3ITSLinkDef.h b/HLT/ITS/AliL3ITSLinkDef.h index b9be55e95b4..92401001b24 100644 --- a/HLT/ITS/AliL3ITSLinkDef.h +++ b/HLT/ITS/AliL3ITSLinkDef.h @@ -8,6 +8,7 @@ #ifdef use_aliroot #pragma link C++ class AliL3ITStrack; #pragma link C++ class AliL3ITStracker; +#pragma link C++ class AliL3ITSVertexerZ; #endif #endif diff --git a/HLT/ITS/AliL3ITSVertexerZ.cxx b/HLT/ITS/AliL3ITSVertexerZ.cxx new file mode 100644 index 00000000000..02b3a424525 --- /dev/null +++ b/HLT/ITS/AliL3ITSVertexerZ.cxx @@ -0,0 +1,311 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +#include "AliL3ITSVertexerZ.h" +#include +#include +#include +#include +#include +#include "AliITSLoader.h" +#include +#include + +//------------------------------------------------------------------------- +// Implementation of the HLT ITS vertexer class +// +// Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch +//------------------------------------------------------------------------- + +ClassImp(AliL3ITSVertexerZ) + +AliL3ITSVertexerZ::AliL3ITSVertexerZ(TString filename,Float_t x0, Float_t y0):AliITSVertexerZ(filename,x0,y0) +{ + // Standard Constructor +} + +//______________________________________________________________________ +AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){ + // Defines the AliESDVertex for the current event + + fCurrentVertex = 0; + AliRunLoader *rl =AliRunLoader::GetRunLoader(); + AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); + itsLoader->LoadRecPoints(); + rl->GetEvent(evnumber); + + if(!fITS) { + fITS = (AliITS*)gAlice->GetModule("ITS"); + if(!fITS) { + Error("FindVertexForCurrentEvent","AliITS object was not found"); + return fCurrentVertex; + } + } + + fITS->SetTreeAddress(); + + AliITSgeom *geom = fITS->GetITSgeom(); + + TTree *tR = itsLoader->TreeR(); + TClonesArray *itsRec = 0; + Float_t lc[3]; for(Int_t ii=0; ii<3; ii++) lc[ii]=0.; + Float_t gc[3]; for(Int_t ii=0; ii<3; ii++) gc[ii]=0.; + Float_t lc2[3]; for(Int_t ii=0; ii<3; ii++) lc2[ii]=0.; + Float_t gc2[3]; for(Int_t ii=0; ii<3; ii++) gc2[ii]=0.; + + itsRec = fITS->RecPoints(); + + //cout<<"Address of itsRec = "<GetBranch("Clusters"); + branch->SetAddress(&clusters); + } + else { + branch = tR->GetBranch("ITSRecPoints"); + } + + + Int_t nrpL1 = 0; + Int_t nrpL2 = 0; + for(Int_t module= fFirstL1; module<=fLastL1;module++){ + if(module%4==0 || module%4==3)continue; + // cout<<"Procesing module "<GetEvent(module); + // cout<<"Number of clusters "<GetEntries()<GetEntries(); + fITS->ResetRecPoints(); + } + for(Int_t module= fFirstL2; module<=fLastL2;module++){ + branch->GetEvent(module); + if(fUseV2Clusters){ + Clusters2RecPoints(clusters,module,itsRec); + } + nrpL2+= itsRec->GetEntries(); + fITS->ResetRecPoints(); + } + if(nrpL1 == 0 || nrpL2 == 0){ + ResetHistograms(); + return fCurrentVertex; + } + + Int_t nPhiBins = (Int_t)(TMath::Pi()/fDiffPhiMax); + Float_t phiBinSize = 2*TMath::Pi()/(Float_t)nPhiBins; + + Int_t maxind1 = 2*nrpL1/nPhiBins; + Float_t **zc1 = new Float_t *[nPhiBins]; + Float_t **phi1 = new Float_t *[nPhiBins]; + Float_t **r1 = new Float_t *[nPhiBins]; + Int_t *ind1 = new Int_t [nPhiBins]; + Int_t maxind2 = 2*nrpL2/nPhiBins; + Float_t **zc2 = new Float_t *[nPhiBins]; + Float_t **phi2 = new Float_t *[nPhiBins]; + Float_t **r2 = new Float_t *[nPhiBins]; + Int_t *ind2 = new Int_t [nPhiBins]; + for(Int_t i=0;iGetEvent(module); + if(fUseV2Clusters){ + Clusters2RecPoints(clusters,module,itsRec); + } + Int_t nrecp1 = itsRec->GetEntries(); + for(Int_t j=0;jAt(j); + lc[0]=recp->GetX(); + lc[2]=recp->GetZ(); + geom->LtoG(module,lc,gc); + gc[0]-=fX0; + gc[1]-=fY0; + Float_t xc1,yc1; + xc1=gc[0]; + yc1=gc[1]; + Float_t phi = TMath::ATan2(gc[1],gc[0]); + if(phi<0)phi=2*TMath::Pi()+phi; + Int_t bin = (Int_t)(phi/phiBinSize); + Int_t ind = ind1[bin]; + if(indResetRecPoints(); + } + memset(ind2,0,nPhiBins*sizeof(Int_t)); + for(Int_t module= fFirstL2; module<=fLastL2;module++){ + branch->GetEvent(module); + if(fUseV2Clusters){ + Clusters2RecPoints(clusters,module,itsRec); + } + Int_t nrecp2 = itsRec->GetEntries(); + for(Int_t j=0;jAt(j); + lc[0]=recp->GetX(); + lc[2]=recp->GetZ(); + geom->LtoG(module,lc,gc); + gc[0]-=fX0; + gc[1]-=fY0; + Float_t xc2,yc2; + xc2=gc[0]; + yc2=gc[1]; + Float_t phi = TMath::ATan2(gc[1],gc[0]); + if(phi<0)phi=2*TMath::Pi()+phi; + Int_t bin = (Int_t)(phi/phiBinSize+0.5); + if(bin==nPhiBins) bin = 0; + Int_t ind = ind2[bin]; + if(indResetRecPoints(); + } + Int_t nbinfine = static_cast((fHighLim-fLowLim)/fStepFine); + Float_t lowz = fLowLim/fStepFine; + Float_t highz = fHighLim/fStepFine; + Int_t *harray = new Int_t[nbinfine]; + memset(harray,0,nbinfine*sizeof(Int_t)); + for(Int_t ibin=0;ibinTMath::Pi())diff=2.*TMath::Pi()-diff; + if(difflowz && zr0SetBinContent(bin+1,(Stat_t)harray[bin]); + fZCombf->SetBinError(bin+1,TMath::Sqrt((Stat_t)harray[bin])); + contents+=(Stat_t)harray[bin]; + counter++; + if(counter==nbinratio) { + Int_t binc=bin/nbinratio; + fZCombc->SetBinContent(binc+1,contents); + fZCombc->SetBinError(binc+1,TMath::Sqrt(contents)); + contents=0; + counter=0; + } + } + + delete [] harray; + + if(fZCombc->GetEntries()==0){ + Warning("FindVertexForCurrentEvent","Insufficient number of rec. points\n"); + ResetHistograms(); + return fCurrentVertex; + } + // else { + // cout<<"Number of entries in hist. "<GetEntries()<GetMaximumBin(); + Float_t centre = fZCombc->GetBinCenter(bi); + Int_t n1 = static_cast((centre-fZCombc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fZCombf->GetBinWidth(0)); + Int_t n2 = static_cast((centre+fZCombc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fZCombf->GetBinWidth(0)); + Int_t niter = 0; + Bool_t goon = kTRUE; + Int_t num; + while(goon){ + fZFound = 0.; + fZsig = 0.; + num=0; + for(Int_t n=n1;n<=n2;n++){ + fZFound+=fZCombf->GetBinCenter(n)*fZCombf->GetBinContent(n); + num+=static_cast(fZCombf->GetBinContent(n)); + fZsig+=fZCombf->GetBinCenter(n)*fZCombf->GetBinCenter(n)*fZCombf->GetBinContent(n); + } + if(num<2){ + fZsig = 0.; + } + else { + Float_t radi = fZsig/(num-1)-fZFound*fZFound/num/(num-1); + if(radi>0.)fZsig=TMath::Sqrt(radi); + else fZsig=0.; + fZFound/=num; + } + goon = TMath::Abs(TMath::Abs(fZFound-fZCombf->GetBinCenter(n1))-TMath::Abs(fZFound-fZCombf->GetBinCenter(n2)))>fTolerance; + n1 = static_cast((fZFound-fZCombc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fZCombf->GetBinWidth(0)); + n2 = static_cast((fZFound+fZCombc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fZCombf->GetBinWidth(0)); + niter++; + if(niter>=10){ + goon = kFALSE; + Warning("FindVertexForCurrentEvent","The procedure dows not converge\n"); + } + } + // cout<<"Numer of Iterations "<SetTitle("vertexer: HLT"); + ResetHistograms(); + PrintStatus(); + return fCurrentVertex; +} diff --git a/HLT/ITS/AliL3ITSVertexerZ.h b/HLT/ITS/AliL3ITSVertexerZ.h new file mode 100644 index 00000000000..38a63ca1985 --- /dev/null +++ b/HLT/ITS/AliL3ITSVertexerZ.h @@ -0,0 +1,31 @@ +#ifndef ALIL3ITSVERTEXERZ_H +#define ALIL3ITSVERTEXERZ_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------------------------- +// High Level Trigger ITS vertexer +// This class is a fast version of the off-line AliITSVertexerZ. +// The two main differences with respect to the off-line vertexer +// are the splitting of the clusters in phi bins and the filling +// of local arrays instead of root histograms. +// +// Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch +//------------------------------------------------------------------------- + +#include "AliITSVertexerZ.h" + +class TString; + +//------------------------------------------------------------------------- +class AliL3ITSVertexerZ : public AliITSVertexerZ { +public: + AliL3ITSVertexerZ():AliITSVertexerZ() {;} + AliL3ITSVertexerZ(TString filename,Float_t x0=0., Float_t y0=0.); + + AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb); + + ClassDef(AliL3ITSVertexerZ,1) //HLT ITS vertexer +}; + +#endif diff --git a/HLT/libAliL3ITS.pkg b/HLT/libAliL3ITS.pkg index 956e20f7f8a..f0cfe9e8691 100644 --- a/HLT/libAliL3ITS.pkg +++ b/HLT/libAliL3ITS.pkg @@ -2,7 +2,7 @@ include HLT/hlt.conf -SRCS:= ITS/AliL3ITStrack.cxx ITS/AliL3ITStracker.cxx +SRCS:= ITS/AliL3ITStrack.cxx ITS/AliL3ITStracker.cxx ITS/AliL3ITSVertexerZ.cxx HDRS:= $(SRCS:.cxx=.h) $(HLTEHDRS) -- 2.31.1