TString outName1=outName;
TString outName2("nTotEvents.dat");
- Double_t covV1[6];
Int_t nTotEv=0,nD0rec=0,nD0rec1ev=0;
Double_t dca;
Double_t v2[3],mom[6],d0[2];
//AliESDVertex *vertex1stored = (AliESDVertex*)trkFile->Get(vtxName);
//vertex1stored->GetXYZ(fV1);
//delete vertex1stored;
- event->GetVertex(fV1,covV1);
+ event->GetVertex()->GetXYZ(fV1);
trkEntries = event->GetNumberOfTracks();
printf(" Number of tracks: %d\n",trkEntries);
#include "AliITSDigitizer.h"
#include "AliITSclustererV2.h"
#include "AliITStrackerV2.h"
+#include "AliITStrackerSA.h"
#include "AliITSpidESD.h"
#include "AliV0vertexer.h"
+#include "AliITSVertexerPPZ.h"
+#include "AliITSVertexerFast.h"
+#include "AliITSVertexerZ.h"
+#include "AliITSVertexerIons.h"
#include "AliCascadeVertexer.h"
#include "AliESD.h"
#include "AliRun.h"
fNRecPoints = 0;
SetMarkerColor(kRed);
+ SelectVertexer(" ");
}
//______________________________________________________________________
AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
} // end for i
SetMarkerColor(kRed);
-
+ SelectVertexer(" ");
}
//______________________________________________________________________
AliITS::~AliITS(){
{
// create an ITS tracker
- return new AliITStrackerV2(GetITSgeom());
+ return new AliITStrackerSA(GetITSgeom());
+}
+//_____________________________________________________________________________
+AliVertexer* AliITS::CreateVertexer() const
+{
+ // create a ITS vertexer
+
+ if(fSelectedVertexer.Contains("ions") || fSelectedVertexer.Contains("IONS")){
+ Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
+ return new AliITSVertexerIons("null");
+ }
+ if(fSelectedVertexer.Contains("smear") || fSelectedVertexer.Contains("SMEAR")){
+ Double_t smear[3]={0.005,0.005,0.01};
+ Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
+ return new AliITSVertexerFast(smear);
+ }
+ if(fSelectedVertexer.Contains("ppz") || fSelectedVertexer.Contains("PPZ")){
+ Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
+ return new AliITSVertexerPPZ("null");
+ }
+ // by default an AliITSVertexerZ object is instatiated
+ Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
+ return new AliITSVertexerZ("null");
}
//_____________________________________________________________________________
};
AliV0vertexer vtxer(cuts);
Double_t vtx[3], cvtx[6];
- esd->GetVertex(vtx, cvtx);
+ esd->GetVertex()->GetXYZ(vtx);
+ esd->GetVertex()->GetSigmaXYZ(cvtx);
vtxer.SetVertex(vtx);
vtxer.Tracks2V0vertices(esd);
class AliITSRecPoint;
class AliITSRawCluster;
class AliITSmodule;
+class AliVertexer;
const Int_t kNTYPES=3;
Int_t *Ndtype() {return fNdtype;}
TClonesArray *DigitsAddress(Int_t id)
{return ((TClonesArray *) (*fDtype)[id]);}
+ void SelectVertexer(TString sel=" "){fSelectedVertexer = sel;}
//===================== Raw Data IO ================================
// Write digits into raw data format
virtual void Reconstruct() const;
virtual AliTracker* CreateTracker() const;
+ virtual AliVertexer* CreateVertexer() const;
virtual void FillESD(AliESD* esd) const;
protected:
TClonesArray *fRecPoints; //! List of reconstructed points
Int_t fNRecPoints; // Number of rec points
+ TString fSelectedVertexer; // Vertexer selected in CreateVertexer
- ClassDef(AliITS,3) // Base class for ITS
+ ClassDef(AliITS,4) // Base class for ITS
};
#endif
#include <AliITSVertexer.h>
#include <AliRunLoader.h>
#include <AliITSLoader.h>
+#include <AliITSRecPoint.h>
+#include <AliITSclusterV2.h>
ClassImp(AliITSVertexer)
//////////////////////////////////////////////////////////////////////
//______________________________________________________________________
-AliITSVertexer::AliITSVertexer() {
+AliITSVertexer::AliITSVertexer():AliVertexer() {
// Default Constructor
-
- fCurrentVertex = 0;
- SetDebug();
- SetFirstEvent(0);
- SetLastEvent(0);
+ SetUseV2Clusters(kTRUE);
}
AliITSVertexer::AliITSVertexer(TString filename) {
rl->LoadHeader();
AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename);
- itsLoader->LoadVertices("recreate");
+ if(!filename.Contains("null"))itsLoader->LoadVertices("recreate");
itsLoader->LoadRecPoints();
Int_t lst;
if(rl->TreeE()){
lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
SetLastEvent(lst-1);
}
+ SetUseV2Clusters(kTRUE);
}
//______________________________________________________________________
-AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : TObject(vtxr) {
+AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr) {
// Copy constructor
// Copies are not allowed. The method is protected to avoid misuse.
Error("AliITSVertexer","Copy constructor not allowed\n");
return *this;
}
-//______________________________________________________________________
-AliITSVertexer::~AliITSVertexer() {
- // Default Destructor
- // The objects pointed by the following pointers are not owned
- // by this class and are not deleted
-
- fCurrentVertex = 0;
-}
//______________________________________________________________________
void AliITSVertexer::WriteCurrentVertex(){
Int_t rc = itsLoader->PostVertex(fCurrentVertex);
rc = itsLoader->WriteVertices();
}
+
+//______________________________________________________________________
+void AliITSVertexer::Clusters2RecPoints
+(const TClonesArray *clusters, Int_t idx, TClonesArray *points) {
+ //------------------------------------------------------------
+ // Conversion AliITSclusterV2 -> AliITSRecPoints for the ITS
+ // module "idx" (entry in the tree with the clusters).
+ // Simplified version, supposed to work with the pixels only !
+ //------------------------------------------------------------
+ const Int_t lastSPD1=79; //let's hope the number of the SPDs will not change
+ const Int_t lastSPD2=239;//let's hope the number of the SPDs will not change
+
+ Float_t yshift = 0; //see AliITSclustererV2.cxx about these shifts
+ Float_t zshift[4] = {-10.708000, -3.536000, 3.536000, 10.708000}; //let's hope the positioning of the SPDs will not change
+
+ if (idx<=lastSPD1) {
+ yshift=0.248499; //let's hope the positioning of the SPDs will not change
+ } else if (idx<=lastSPD2) {
+ yshift=3.096207; //let's hope the positioning of the SPDs will not change
+ } else {
+ Fatal("Clusters2RecPoints","This is not an SPD module ! %d",idx);
+ }
+
+ TClonesArray &pn=*points;
+ Int_t ncl=clusters->GetEntriesFast();
+ for (Int_t i=0; i<ncl; i++) {
+ AliITSRecPoint p;
+ AliITSclusterV2 *c = (AliITSclusterV2 *)clusters->UncheckedAt(i);
+
+ Float_t x=c->GetY(); if (idx<=lastSPD1) x=-x;
+ x+=yshift;
+
+ Float_t z=c->GetZ();
+ z=-z; z+=zshift[idx%4];
+
+ p.SetX(x);
+ p.SetZ(z);
+ p.SetQ(c->GetQ());
+ p.SetSigmaX2(c->GetSigmaY2());
+ p.SetSigmaZ2(c->GetSigmaZ2());
+ p.SetLabel(0,c->GetLabel(0));
+ p.SetLabel(1,c->GetLabel(1));
+ p.SetLabel(2,c->GetLabel(2));
+
+ new (pn[i]) AliITSRecPoint(p);
+ }
+
+}
#ifndef ALIITSVERTEXER_H
#define ALIITSVERTEXER_H
-#include<TObject.h>
+#include<AliVertexer.h>
///////////////////////////////////////////////////////////////////
// //
-// Base class for primary vertex reconstruction //
+// Base class for primary vertex reconstruction for ITS //
// //
///////////////////////////////////////////////////////////////////
-class TFile;
class TString;
-class TTRee;
-class AliESDVertex;
+class TClonesArray;
-class AliITSVertexer : public TObject {
+class AliITSVertexer : public AliVertexer {
public:
// default constructor
AliITSVertexer();
// standard constructor
AliITSVertexer(TString filename);
- // destructor
- virtual ~AliITSVertexer();
- // computes the vertex for the current event
- virtual AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb)=0;
- // computes the vetex for each event and stores it on file
- virtual void FindVertices()= 0;
- virtual void PrintStatus() const = 0;
- virtual void SetDebug(Int_t debug = 0){fDebug = debug;}
- virtual void SetFirstEvent(Int_t ev){fFirstEvent = ev;}
- virtual void SetLastEvent(Int_t ev){fLastEvent = ev;}
+ virtual void SetUseV2Clusters(Bool_t v2c){fUseV2Clusters = v2c;}
virtual void WriteCurrentVertex();
+ virtual void Clusters2RecPoints(const TClonesArray *clusters, Int_t idx, TClonesArray *points);
+
protected:
AliITSVertexer(const AliITSVertexer& vtxr);
// assignment operator (NO assignment allowed)
AliITSVertexer& operator=(const AliITSVertexer& /* vtxr */);
+ Bool_t fUseV2Clusters; // true if V2 clusters are used
- AliESDVertex *fCurrentVertex; //! pointer to the vertex of the current
- // event
- Int_t fFirstEvent; // First event to be processed by FindVertices
- Int_t fLastEvent; // Last event to be processed by FindVertices
- Int_t fDebug; //! debug flag - verbose printing if >0
-
- ClassDef(AliITSVertexer,1);
+ ClassDef(AliITSVertexer,2);
};
#endif
// Standard constructor
fSmear = new Double_t[3];
for(Int_t i=0;i<3;i++)fSmear[i]=smear[i];
+ Info("AliITSVertexerFast","Gaussian smaring of the generated vertex. Parameters %f12.5 , %f12.5 , %f12.5 \n",fSmear[0],fSmear[1],fSmear[2]);
}
//______________________________________________________________________
fITS->SetTreeAddress();
AliITSgeom *g2 = fITS->GetITSgeom();
TClonesArray *recpoints = fITS->RecPoints();
+ TClonesArray dummy("AliITSclusterV2",10000), *clusters=&dummy;
+ TBranch *branch;
+ if(fUseV2Clusters){
+ branch = itsloader->TreeR()->GetBranch("Clusters");
+ branch->SetAddress(&clusters);
+ }
+ else {
+ branch = itsloader->TreeR()->GetBranch("ITSRecPoints");
+ }
+
AliITSRecPoint *pnt;
Int_t nopoints1 = 0;
for(i=g2->GetStartSPD();i<=g2->GetLastSPD();i++)
{
fITS->ResetRecPoints();
- tr->GetEvent(i);
+ tr->GetEvent(i);
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,i,recpoints);
+ }
npoints = recpoints->GetEntries();
for (ipoint=0;ipoint<npoints;ipoint++) {
pnt = (AliITSRecPoint*)recpoints->UncheckedAt(ipoint);
}
nopoints1 = (Int_t)(hITSz1->GetEntries());
-
+ if (nopoints1 == 0) {
+ delete hITSz1;
+ return fCurrentVertex;
+ }
aspar[0] = (mxpiu-mxmeno)/(mxpiu+mxmeno);
aspar[1] = (mypiu-mymeno)/(mypiu+mymeno);
{
fITS->ResetRecPoints();
itsloader->TreeR()->GetEvent(i);
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,i,recpoints);
+ }
npoints = recpoints->GetEntries();
for (ipoint=0;ipoint<npoints;ipoint++) {
Warning("FindVertexForCurrentEvent","AliITSVertexerIons finder is not reliable for low multiplicity events. Switching to AliITSVertexerPPZ with default parameters...\n");
Warning("FindVertexForCurrentEvent","N rec points = %d - Threshold is %d",np1,fNpThreshold);
- AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ("default");
+ AliITSVertexerPPZ *dovert = new AliITSVertexerPPZ("null");
fCurrentVertex =dovert->FindVertexForCurrentEvent(rl->GetEventNumber());
delete dovert;
return fCurrentVertex;
Error("FindVertexForCurrentEvent","ITS geometry is not defined");
return fCurrentVertex;
}
- TTree *TR=0;
- TClonesArray *ITSrec = 0;
+ TTree *tR=0;
+ 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.;
- TR = ITSloader->TreeR();
- if(!TR){
+ tR = ITSloader->TreeR();
+ if(!tR){
Error("FindVertexForCurrentEvent","TreeR not found");
return fCurrentVertex;
}
- ITSrec = fITS->RecPoints(); // uses slow points or fast points if slow are
+ itsRec = fITS->RecPoints(); // uses slow points or fast points if slow are
// missing
- TBranch *branch = TR->GetBranch("ITSRecPoints");
- if(!branch){
- branch = TR->GetBranch("ITSRecPointsF");
- // Warning("FindVertexForCurrentEvent","Using Fast points");
+ TClonesArray dummy("AliITSclusterV2",10000), *clusters=&dummy;
+ TBranch *branch;
+ if(fUseV2Clusters){
+ branch = tR->GetBranch("Clusters");
+ branch->SetAddress(&clusters);
+ }
+ else {
+ branch = tR->GetBranch("ITSRecPoints");
+ if(!branch){
+ branch = tR->GetBranch("ITSRecPointsF");
+ }
}
if(!branch){
Error("FindVertexForCurrentEvent","branch for ITS rec points not found");
Int_t firipixe=0;
for(Int_t module= fFirstL1; module<=fLastL1;module++){
branch->GetEvent(module);
- Int_t nrecp1 = ITSrec->GetEntries();
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,module,itsRec);
+ }
+ Int_t nrecp1 = itsRec->GetEntries();
for(Int_t i=0; i<nrecp1;i++){
- AliITSRecPoint *current = (AliITSRecPoint*)ITSrec->At(i);
+ AliITSRecPoint *current = (AliITSRecPoint*)itsRec->At(i);
lc[0]=current->GetX();
lc[2]=current->GetZ();
geom->LtoG(module,lc,gc);
for(Int_t module= fFirstL1; module<=fLastL1;module++){
if(fDebug>0)cout<<"processing module "<<module<<" \r";
branch->GetEvent(module);
- Int_t nrecp1 = ITSrec->GetEntries();
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,module,itsRec);
+ }
+ Int_t nrecp1 = itsRec->GetEntries();
TObjArray *poiL1 = new TObjArray(nrecp1);
- for(Int_t i=0; i<nrecp1;i++)poiL1->AddAt(ITSrec->At(i),i);
+ for(Int_t i=0; i<nrecp1;i++)poiL1->AddAt(itsRec->At(i),i);
fITS->ResetRecPoints();
for(Int_t i=0; i<nrecp1;i++){
AliITSRecPoint *current = (AliITSRecPoint*)poiL1->At(i);
if(fDebug>1)cout<<"module "<<module<<" "<<gc[0]<<" "<<gc[1]<<" "<<gc[2]<<" "<<phi1<<" \n";
for(Int_t modul2=fFirstL2; modul2<=fLastL2; modul2++){
branch->GetEvent(modul2);
- Int_t nrecp2 = ITSrec->GetEntries();
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,modul2,itsRec);
+ }
+ Int_t nrecp2 = itsRec->GetEntries();
for(Int_t j=0; j<nrecp2;j++){
- AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(j);
+ AliITSRecPoint *recp = (AliITSRecPoint*)itsRec->At(j);
lc2[0]=recp->GetX();
lc2[2]=recp->GetZ();
geom->LtoG(modul2,lc2,gc2);
if(nTrks < fMinTracks) { TooFewTracks(); return fCurrentVertex; }
// Set initial vertex position from ESD
- esdEvent->GetVertex(vtx,cvtx);
+ esdEvent->GetVertex()->GetXYZ(vtx);
SetVtxStart(vtx[0],vtx[1]);
// VERTEX FINDER
// store vertex information in ESD
fCurrentVertex->GetXYZ(vtx);
fCurrentVertex->GetCovMatrix(cvtx);
- esdEvent->SetVertex(vtx,cvtx);
+ esdEvent->SetVertex(fCurrentVertex);
cout<<"Vertex: "<<vtx[0]<<", "<<vtx[1]<<", "<<vtx[2]<<endl;
return fCurrentVertex;
fCurrentVertex = 0;
AliRunLoader *rl =AliRunLoader::GetRunLoader();
AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
- itsLoader->ReloadRecPoints();
-
+ itsLoader->LoadRecPoints();
rl->GetEvent(evnumber);
if(!fITS) {
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();
- TBranch *branch = tR->GetBranch("ITSRecPoints");
+ itsRec = fITS->RecPoints();
+
+ //cout<<"Address of itsRec = "<<itsRec<<endl;
+ TClonesArray dummy("AliITSclusterV2",10000), *clusters=&dummy;
+ TBranch *branch;
+ if(fUseV2Clusters){
+ branch = tR->GetBranch("Clusters");
+ branch->SetAddress(&clusters);
+ }
+ else {
+ branch = tR->GetBranch("ITSRecPoints");
+ }
Int_t nbinfine = static_cast<Int_t>((fHighLim-fLowLim)/fStepFine);
Int_t nbincoarse = static_cast<Int_t>((fHighLim-fLowLim)/fStepCoarse);
Int_t nrpL2 = 0;
for(Int_t module= fFirstL1; module<=fLastL1;module++){
if(module%4==0 || module%4==3)continue;
+ // cout<<"Procesing module "<<module<<" ";
branch->GetEvent(module);
+ // cout<<"Number of clusters "<<clusters->GetEntries()<<endl;
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,module,itsRec);
+ }
nrpL1+= itsRec->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();
}
- cout<<"nrpL1 = "<<nrpL1<<"; nrpL2= "<<nrpL2<<endl;
if(nrpL1 == 0 || nrpL2 == 0){
- cout<<"achi, achi\n";
ResetHistograms();
return fCurrentVertex;
}
for(Int_t module= fFirstL1; module<=fLastL1;module++){
if(module%4==0 || module%4==3)continue;
branch->GetEvent(module);
+ if(fUseV2Clusters){
+ Clusters2RecPoints(clusters,module,itsRec);
+ }
Int_t nrecp1 = itsRec->GetEntries();
for(Int_t j=0;j<nrecp1;j++){
AliITSRecPoint *recp = (AliITSRecPoint*)itsRec->At(j);
ind = 0;
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;j<nrecp2;j++){
AliITSRecPoint *recp = (AliITSRecPoint*)itsRec->At(j);
ResetHistograms();
return fCurrentVertex;
}
- else {
- cout<<"Number of entries in hist. "<<fZCombc->GetEntries()<<endl;
- }
+ // else {
+ // cout<<"Number of entries in hist. "<<fZCombc->GetEntries()<<endl;
+ // }
Int_t bi = fZCombc->GetMaximumBin();
Float_t centre = fZCombc->GetBinCenter(bi);
Int_t n1 = static_cast<Int_t>((centre-fZCombc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fZCombf->GetBinWidth(0));
fZFound/=num;
}
goon = TMath::Abs(TMath::Abs(fZFound-fZCombf->GetBinCenter(n1))-TMath::Abs(fZFound-fZCombf->GetBinCenter(n2)))>fTolerance;
- cout<<"Simmetria "<<TMath::Abs(TMath::Abs(fZFound-fZCombf->GetBinCenter(n1))-TMath::Abs(fZFound-fZCombf->GetBinCenter(n2)))<<endl;
n1 = static_cast<Int_t>((fZFound-fZCombc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fZCombf->GetBinWidth(0));
n2 = static_cast<Int_t>((fZFound+fZCombc->GetBinWidth(bi)-fZCombf->GetBinLowEdge(0))/fZCombf->GetBinWidth(0));
niter++;
Warning("FindVertexForCurrentEvent","The procedure dows not converge\n");
}
}
- cout<<"Numer of Iterations "<<niter<<endl<<endl;
+ // cout<<"Numer of Iterations "<<niter<<endl<<endl;
fCurrentVertex = new AliESDVertex(fZFound,fZsig,num);
fCurrentVertex->SetTitle("vertexer: B");
ResetHistograms();
fLambdaList = 0;
fXList = 0;
fYList =0;
+ fZList =0;
+ fSxList = 0;
+ fSyList =0;
+ fSzList =0;
for(Int_t i=0;i<3;i++){fPrimaryVertex[i]=0;}
}
fLambdaList = 0;
fXList = 0;
fYList = 0;
+ fZList =0;
+ fSxList = 0;
+ fSyList =0;
+ fSzList =0;
}
//______________________________________________________________________
for (Int_t i=0; i<nm; i++){
delete fDet[i];
}
- delete fDet;
+ delete[] fDet;
}
- if (fLbl)delete [] fLbl;
+ if (fLbl)delete [] fLbl; // memory leak!
if (fNCl)delete [] fNCl;
- if (fPhiList)delete [] fPhiList;
- if (fLambdaList) delete [] fLambdaList;
- if (fXList) delete [] fXList;
- if (fYList) delete [] fYList;
+ for (Int_t i = 0; i < fGeom->GetNlayers(); i++) {
+ if (fPhiList) delete fPhiList[i];
+ if (fLambdaList) delete fLambdaList[i];
+ if (fXList) delete fXList[i];
+ if (fYList) delete fYList[i];
+ if (fZList) delete fZList[i];
+ if (fSxList) delete fSxList[i];
+ if (fSyList) delete fSyList[i];
+ if (fSzList) delete fSzList[i];
+ }
+ if (fPhiList) delete[] fPhiList;
+ if (fLambdaList) delete[] fLambdaList;
+ if (fXList) delete[] fXList;
+ if (fYList) delete[] fYList;
+ if (fZList) delete[] fZList;
+ if (fSxList) delete[] fSxList;
+ if (fSyList) delete[] fSyList;
+ if (fSzList) delete[] fSzList;
}
//__________________________________________________________
-void AliITSclusterTable::FillArray(TTree* clusterTree,Int_t evnumber){
+void AliITSclusterTable::FillArray(TTree* clusterTree){
//
Int_t nm = fGeom->GetIndexMax();
fDet = new TArrayI*[nm];
- fTracker->SetEventNumber(evnumber);
- fTracker->LoadClusters(clusterTree);
TArrayI** vect = new TArrayI*[fGeom->GetNlayers()];
Int_t nlr = FindIndex(fGeom->GetNlayers(),firstmod,mod);
if(nlr<0){
Fatal("FillArray","Wrong module number %d . Limits: %d , %d",mod,firstmod[0],firstmod[fGeom->GetNlayers()+1]);
- return;
+ exit(1);
}
else {
for(Int_t n=0;n<vect[nlr]->GetSize();n++){
}
- fTracker->UnloadClusters();
-
+ clus->Delete();
+ delete clus;
for(Int_t n=0;n<fGeom->GetNlayers();n++)delete vect[n];
- delete vect;
+ delete [] vect;
delete [] firstmod;
}
//_________________________________________________________________
-void AliITSclusterTable::FillArrayLabel(Int_t numberofparticles,TTree* clusterTree,Int_t evnumber){
+void AliITSclusterTable::FillArrayLabel(Int_t numberofparticles){
//
fLbl = new TArrayI*[numberofparticles];
- fTracker->SetEventNumber(evnumber);
- fTracker->LoadClusters(clusterTree);
const Int_t knm =fGeom->GetNlayers();
for(Int_t nlab=0;nlab<numberofparticles;nlab++){
fLbl[nlab] = new TArrayI(knm);
delete [] nn;
}
- fTracker->UnloadClusters();
}
//_______________________________________________________________
return retval;
}
-void AliITSclusterTable::FillArrayCoorAngles(TTree* clusterTree,Int_t evnumber){
+void AliITSclusterTable::FillArrayCoorAngles(){
//Fill arrays with phi,lambda and indices of clusters for each layer
Info("FillArrayCoorAngles","Filling Array...");
fSyList = new TArrayD*[fGeom->GetNlayers()];
fSzList = new TArrayD*[fGeom->GetNlayers()];
- fTracker->SetEventNumber(evnumber);
- fTracker->LoadClusters(clusterTree);
Int_t * firstmod = new Int_t[fGeom->GetNlayers()+1];
firstmod[fGeom->GetNlayers()]=fGeom->GetIndexMax(); // upper limit
}
- fTracker->UnloadClusters();
delete [] firstmod;
}
AliITSclusterTable();
AliITSclusterTable(AliITSgeom* geom, AliITStrackerSA* tracker, Double_t* primaryVertex);
- void FillArray(TTree* clusterTree,Int_t evnumber=0);
- void FillArrayLabel(Int_t numberofparticles,TTree* clusterTree,
- Int_t evnumber=0);
- void FillArrayCoorAngles(TTree* clusterTree, Int_t evnumber=0);
+ void FillArray(TTree* clusterTree);
+ void FillArrayLabel(Int_t numberofparticles);
+ void FillArrayCoorAngles();
void GetCoorAngles(AliITSclusterV2* cl,Int_t module,Double_t &phi,Double_t &lambda,Double_t &x,Double_t &y,Double_t &z);
void GetCoorErrors(AliITSclusterV2* cl, Int_t module,Double_t &sx,Double_t &sy, Double_t &sz);
virtual ~AliITSclusterTable();
// Default constructor
Init();
}
+//____________________________________________________________________________
+AliITStrackerSA::AliITStrackerSA(AliITSgeom *geom):AliITStrackerV2(geom)
+{
+ // Standard constructor (Vertex is known and passed to this obj.)
+ Init();
+ fVert = 0;
+ fGeom = geom;
+}
+
//____________________________________________________________________________
AliITStrackerSA::AliITStrackerSA(AliITSgeom *geom, AliESDVertex *vert):AliITStrackerV2(geom)
{
fFlagLoad = 0;
SetWindowSizes();
fTable = 0;
+ fITSclusters = 0;
+ SetSixPoints();
}
//_______________________________________________________________________
void AliITStrackerSA::ResetForFinding(){
fPointc[1]=0;
}
//____________________________________________________________________________
-void AliITStrackerSA::FindTracks(TTree *clusterTree, TTree *out,Int_t evnumber,char *opt){
+void AliITStrackerSA::FindTracks(TTree *out,Int_t evnumber){
/**************************************************************************
* This function finds primary tracks.
- * Options: to use only ITS execute FindTracks *
- * to define good tracks with 6 points out of 6 in the ITS write *
- * *opt="6/6". The default is *opt="6/6" *
* *
* *
* Example: to execute function with only the ITS (no combined tracking *
* with TPC+ITS) and requiring 5/6 points to define a good track *
- * use: FindTracks(treein,treeout,evnumber,"5/6") *
- * to execute combined tracking, before using FindTracks use *
+ * call SetSixPoinbts(kFALSE) in advance and then *
+ * use: FindTracks(treein,treeout,evnumber) *
+ * to execute combined tracking, before using FindTracks, use *
* UseFoundTracksV2 *
*************************************************************************/
- //options
- TString choice(opt);
- Bool_t sixpoints= choice.Contains("6/6");
-
+ if(!fITSclusters){
+ Fatal("FindTracks","ITS cluster tree is not accessed - Abort!!!\n Please use method SetClusterTree to pass the pointer to the tree\n");
+ exit(1);
+ }
//Get primary vertex
if(fVertexer){
if(fVert)delete fVert;
//Fill array with cluster indices for each module
if(!fTable){
fTable = new AliITSclusterTable(fGeom,this,primaryVertex);
- fTable->FillArray(clusterTree,evnumber);
- fTable->FillArrayCoorAngles(clusterTree,evnumber);
+ fTable->FillArray(fITSclusters);
+ fTable->FillArrayCoorAngles();
}
- SetEventNumber(evnumber);
- if(GetFlagLoadedClusters()==0) LoadClusters(clusterTree);
//Fill tree for found tracks
AliITStrackV2* outrack=0;
AliITStrackSA* trs = new AliITStrackSA();
fPoint1[0]=primaryVertex[0];
fPoint1[1]=primaryVertex[1];
- fPoint2[0]=fTable->GetXCluster(0,ncl);;
- fPoint2[1]=fTable->GetYCluster(0,ncl);;
+ fPoint2[0]=fTable->GetXCluster(0,ncl);
+ fPoint2[1]=fTable->GetYCluster(0,ncl);
Int_t * nn = new Int_t[fGeom->GetNlayers()];//counter for clusters on each layer
for(Int_t i=0;i<fGeom->GetNlayers();i++){ nn[i]=0;}
Int_t layOK=0;
Int_t numberofpoints;
- if(sixpoints) numberofpoints=6; //check of the candidate track
+ if(fSixPoints) numberofpoints=6; //check of the candidate track
else numberofpoints=5; //if track is good (with the required number
for(Int_t nnp=0;nnp<fGeom->GetNlayers();nnp++){ //of points) it is written on file
if(nn[nnp]!=0) layOK+=1;
}
if(layOK>=numberofpoints){
- AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert,opt);
+ AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert);
if(tr2==0){
Int_t nct = trs->GetNumberOfClustersSA();
while(nct--){
//from second layer, to find tracks with point of
//layer 1 missing
- if(!sixpoints){
+ if(!fSixPoints){
// counter for clusters on each layer
Int_t * nn = new Int_t[fGeom->GetNlayers()-1];
for(Int_t nloop=0;nloop<fNloop;nloop++){
if(nn[nnp]!=0) fl+=1;
}
if(fl>=5){ // 5/6
- AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert,opt);
+ AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert);
if(tr2==0){
Int_t nct = trs->GetNumberOfClustersSA();
while(nct--){
}//end loop on clusters of layer2
}
delete [] nn;
- } //end opt="5/6"
+ } // if(!fSixPoints....
delete [] firstmod;
-
- UnloadClusters();
+ delete fTable;
}
+
//______________________________________________________________________
-void AliITStrackerSA::FindTracks(TTree *clusterTree, AliESD* event, Int_t evnumber,char *opt){
- /**************************************************************************
- * Options: to use only ITS execute FindTracks *
- * to define good tracks with 6 points out of 6 in the ITS write *
- * *opt="6/6". The default is *opt="6/6" *
- * *
- * *
- * Example: to execute function with only the ITS (no combined tracking *
- * with TPC+ITS) and requiring 5/6 points to define a good track *
- * use: FindTracks(treein,treeout,evnumber,"5/6") *
- * to execute combined tracking, before using FindTracks use *
- * UseFoundTracksV2 *
- *************************************************************************/
+Int_t AliITStrackerSA::FindTracks(AliESD* event){
- //options
- TString choice(opt);
- Bool_t sixpoints= choice.Contains("6/6");
- //Get primary vertex
- if(fVertexer){
- if(fVert)delete fVert;
- fVert = fVertexer->FindVertexForCurrentEvent(evnumber);
- }
- else {
- gAlice->GetEvent(evnumber);
- if(!fVert){
- Fatal("FindTracks","Vertex is missing\n");
- return;
- }
+ // Track finder using the ESD object
+
+ if(!fITSclusters){
+ Fatal("FindTracks","ITS cluster tree is not accessed - Abort!!!\n Please use method SetClusterTree to pass the pointer to the tree\n");
+ return -1;
}
- Double_t primaryVertex[3];
+
+ //Get primary vertex
Double_t errorsprimvert[3];
- fVert->GetXYZ(primaryVertex);
- fVert->GetSigmaXYZ(errorsprimvert);
+ Double_t primaryVertex[3];
+ event->GetVertex()->GetXYZ(primaryVertex);
+ event->GetVertex()->GetSigmaXYZ(errorsprimvert);
+
if(errorsprimvert[0]==0 || errorsprimvert[1]==0){
- Warning("FindTracks","Set errors on vertex positions x and y at 0.0001");
- errorsprimvert[0]=0.0001;
- errorsprimvert[1]=0.0001;
+ // Warning("FindTracks","Set errors on vertex positions x and y at 0.005");
+ errorsprimvert[0]=0.005;
+ errorsprimvert[1]=0.005;
}
- fVert->PrintStatus();
//Fill array with cluster indices for each module
- if(!fTable){
- fTable = new AliITSclusterTable(fGeom,this,primaryVertex);
- fTable->FillArray(clusterTree,evnumber);
- fTable->FillArrayCoorAngles(clusterTree,evnumber);
- }
+ fTable = new AliITSclusterTable(fGeom,this,primaryVertex);
+ fTable->FillArray(fITSclusters);
+ fTable->FillArrayCoorAngles();
- SetEventNumber(evnumber);
- if(GetFlagLoadedClusters()==0) LoadClusters(clusterTree);
Int_t * firstmod = new Int_t[fGeom->GetNlayers()];
for(Int_t i=0;i<fGeom->GetNlayers();i++){
Int_t layOK=0;
Int_t numberofpoints;
- if(sixpoints) numberofpoints=6; //check of the candidate track
+ if(fSixPoints) numberofpoints=6; //check of the candidate track
else numberofpoints=5; //if track is good (with the required number
for(Int_t nnp=0;nnp<fGeom->GetNlayers();nnp++){ //of points) it is written on file
if(nn[nnp]!=0) layOK+=1;
}
if(layOK>=numberofpoints){
- AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert,opt);
+ AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert);
if(tr2==0){
Int_t nct = trs->GetNumberOfClustersSA();
while(nct--){
}
}
delete trs;
+ delete[] nn;
}//end loop on clusters of layer1
//from second layer, to find tracks with point of
//layer 1 missing
- if(!sixpoints){
+ if(!fSixPoints){
// counter for clusters on each layer
Int_t * nn = new Int_t[fGeom->GetNlayers()-1];
for(Int_t nloop=0;nloop<fNloop;nloop++){
if(nn[nnp]!=0) fl+=1;
}
if(fl>=5){ // 5/6
- AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert,opt);
+ AliITStrackV2* tr2 = FitTrack(trs,primaryVertex,errorsprimvert);
if(tr2==0){
ntrack++;
Int_t nct = trs->GetNumberOfClustersSA();
delete [] firstmod;
delete fTable;
- UnloadClusters();
Info("FindTracks","Number of found tracks: %d",event->GetNumberOfTracks());
-
+ return 0;
}
+
+
//________________________________________________________________________
-AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVertex,Double_t *errorsprimvert,char *opt){
+AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVertex,Double_t *errorsprimvert){
//fit of the found track
-
-//options
- TString choice(opt);
- Bool_t sixpoints= choice.Contains("6/6");
Int_t * firstmod = new Int_t[fGeom->GetNlayers()];
for(Int_t i=0;i<fGeom->GetNlayers();i++){
labl[2]=-1;
}
Int_t numberofpoints;
- if(sixpoints) numberofpoints=6;
+ if(fSixPoints) numberofpoints=6;
else numberofpoints=5;
Int_t label = Label(cl0->GetLabel(0),cl1->GetLabel(0),
cl2->GetLabel(0),cl3->GetLabel(0),
if(!fTable){
fTable = new AliITSclusterTable(fGeom,this,primaryVertex);
- fTable->FillArray(clustertree,evnum);
- fTable->FillArrayCoorAngles(clustertree,evnum);
+ fTable->FillArray(fITSclusters);
+ fTable->FillArrayCoorAngles();
}
SetEventNumber(evnum);
if(GetFlagLoadedClusters()==0) LoadClusters(clustertree);
if(!fTable){
fTable = new AliITSclusterTable(fGeom,this,primaryVertex);
- fTable->FillArray(clustertree,evnum);
- fTable->FillArrayCoorAngles(clustertree,evnum);
+ fTable->FillArray(fITSclusters);
+ fTable->FillArrayCoorAngles();
}
SetEventNumber(evnum);
if(GetFlagLoadedClusters()==0) LoadClusters(clustertree);
Float_t cx1,cx2,cy1,cy2;
FindEquation(fPoint1[0],fPoint1[1],fPoint2[0],fPoint2[1],fPoint3[0],fPoint3[1],fCoef1,fCoef2,fCoef3);
Int_t fun = FindIntersection(fCoef1,fCoef2,fCoef3,-(lay.GetR()*lay.GetR()),cx1,cy1,cx2,cy2);
- if(fun==0) return 0;
+ if(fun==0) {
+ delete[] firstmod;
+ return 0;
+ }
Double_t fi1 =TMath::ATan2(cy1,cx1);
Double_t fi2 =TMath::ATan2(cy2,cx2);
fPhiEstimate = ChoosePoint(fi1,fi2,fPhic);
Double_t zed2 = TMath::Tan(fLambdac-lambdawindow)*lay.GetR()+zvertex;
Double_t fi = fPhiEstimate;
- Int_t nmod = lay.FindDetectorIndex(fi,zed)+firstmod[layer];
+ Int_t nmod = lay.FindDetectorIndex(fi,zed);
+ if (nmod < 0) {
+ delete[] firstmod;
+ return 0;
+ }
+ nmod += firstmod[layer];
Int_t nm[8]={0,0,0,0,0,0,0,0};
- nm[0] = lay.FindDetectorIndex(fi+phiwindow,zed)+firstmod[layer];
- nm[1] = lay.FindDetectorIndex(fi-phiwindow,zed)+firstmod[layer];
- nm[2] = lay.FindDetectorIndex(fi,zed1)+firstmod[layer];
- nm[3] = lay.FindDetectorIndex(fi,zed2)+firstmod[layer];
- nm[4] = lay.FindDetectorIndex(fi+phiwindow,zed1)+firstmod[layer];
- nm[5] = lay.FindDetectorIndex(fi-phiwindow,zed1)+firstmod[layer];
- nm[6] = lay.FindDetectorIndex(fi+phiwindow,zed2)+firstmod[layer];
- nm[7] = lay.FindDetectorIndex(fi-phiwindow,zed2)+firstmod[layer];
+ nm[0] = lay.FindDetectorIndex(fi+phiwindow,zed);
+ nm[1] = lay.FindDetectorIndex(fi-phiwindow,zed);
+ nm[2] = lay.FindDetectorIndex(fi,zed1);
+ nm[3] = lay.FindDetectorIndex(fi,zed2);
+ nm[4] = lay.FindDetectorIndex(fi+phiwindow,zed1);
+ nm[5] = lay.FindDetectorIndex(fi-phiwindow,zed1);
+ nm[6] = lay.FindDetectorIndex(fi+phiwindow,zed2);
+ nm[7] = lay.FindDetectorIndex(fi-phiwindow,zed2);
-
- if(nmod<0) return 0;
Int_t nn=0;
TArrayI* array =(TArrayI*)table->GetListOfClusters(nmod);
TArrayI* list = new TArrayI(array->GetSize());
nn++;
}
+// Info("SearchClusters", "layer %d, module %d", layer, nmod);
for(Int_t ii=0;ii<8;ii++){
if(nm[ii]!=nmod && nm[ii]>=0){
- TArrayI* ar =(TArrayI*)table->GetListOfClusters(nm[ii]);
+ TArrayI* ar =(TArrayI*)table->GetListOfClusters(nm[ii]+firstmod[layer]);
list->Set(list->GetSize()+ar->GetSize());
for(Int_t j=0;j<ar->GetSize();j++){
Int_t in=(Int_t)ar->At(j);
nc+=1;
fLambdac = lambda;
if(trs->GetNumberOfClustersSA()==20){
+ delete[] firstmod;
delete list;
return 0;
}
class AliITStrackSA;
class AliESDVertex;
class AliITSVertexer;
+class TTree;
class AliITStrackerSA : public AliITStrackerV2 {
public:
AliITStrackerSA();
+ AliITStrackerSA(AliITSgeom *geom);
AliITStrackerSA(AliITSgeom *geom,AliESDVertex *vert);
AliITStrackerSA(AliITSgeom *geom,AliITSVertexer *vertexer);
AliITStrackerSA(AliITStrackerSA& tracker);
virtual ~AliITStrackerSA();
- void FindTracks(TTree *clusterTree, TTree *out,Int_t evnumber=0,
- char *opt="6/6");
- void FindTracks(TTree *clusterTree, AliESD* event, Int_t evnumber=0,
- char *opt="6/6");
+ virtual Int_t Clusters2Tracks(AliESD *event){Int_t rc = AliITStrackerV2::Clusters2Tracks(event); if(!rc)rc=FindTracks(event); return rc;}
+ Int_t FindTracks(AliESD* event);
+ void FindTracks(TTree *out,Int_t evnumber=0);
AliITStrackV2* FitTrack(AliITStrackSA* tr,Double_t* primaryVertex,
- Double_t *errorprimvert,char *opt="6/6");
+ Double_t *errorprimvert);
AliITStrackV2* FindTrackLowChiSquare(TObjArray* tracklist, Int_t dim) const;
+ Int_t LoadClusters(TTree *cf) {Int_t rc=AliITStrackerV2::LoadClusters(cf); SetClusterTree(cf); return rc;}
void SetVertex(AliESDVertex *vtx){fVert = vtx;}
+ void SetClusterTree(TTree * itscl){fITSclusters = itscl;}
+ void SetSixPoints(Bool_t sp = kTRUE){fSixPoints = sp;}
+ Bool_t GetSixPoints() const {return fSixPoints;}
void SetWindowSizes(Int_t n=46, Double_t *phi=0, Double_t *lam=0);
void UseFoundTracksV2(Int_t evnum,TTree* treev2, TTree* clustertree);
void UseFoundTracksV2(Int_t evnum,AliESD *event, TTree* clustertree);
AliESDVertex *fVert; //! primary vertex
AliITSVertexer *fVertexer; //! vertexer
AliITSgeom *fGeom; //! ITS geometry
+ TTree *fITSclusters; //! pointer to ITS tree of clusters
Int_t fFlagLoad; // flag for loaded clusters (1==already loaded)
+ Bool_t fSixPoints; // If true 6/6 points are required (default). 5/6 otherwise
AliITSclusterTable* fTable; // table with clusters
ClassDef(AliITStrackerSA,1)
};
Int_t entries = fTrackHypothesys.GetEntriesFast();
for (Int_t ientry=0;ientry<entries;ientry++){
TObjArray * array =(TObjArray*)fTrackHypothesys.UncheckedAt(ientry);
- if (array){
- Int_t arrayentries = array->GetEntriesFast();
- for (Int_t j=0;j<arrayentries;j++){
- AliITStrackV2 * track = (AliITStrackV2*)array->UncheckedAt(j);
- if (track){
- delete array->RemoveAt(j);
- }
- }
- delete fTrackHypothesys.RemoveAt(ientry);
- }
+ if (array) array->Delete();
+ delete fTrackHypothesys.RemoveAt(ientry);
}
+
fTrackHypothesys.Delete();
Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk);
if ((esd->GetStatus()&AliESDtrack::kITSout) == 0) continue;
if (esd->GetStatus()&AliESDtrack::kITSrefit) continue;
if (esd->GetStatus()&AliESDtrack::kTPCout)
- if ((esd->GetStatus()&AliESDtrack::kTPCrefit)==0) continue;
+ if ((esd->GetStatus()&AliESDtrack::kTPCrefit)==0) continue;
AliITStrackV2 *t=0;
try {
ResetTrackToFollow(*t);
fTrackToFollow.ResetClusters();
+ if ((esd->GetStatus()&AliESDtrack::kTPCin)==0)
+ fTrackToFollow.ResetCovariance();
+
//Refitting...
if (RefitAt(3.7, &fTrackToFollow, t)) {
fTrackToFollow.SetLabel(t->GetLabel());
if (esdindex>=fTrackHypothesys.GetEntriesFast()) fTrackHypothesys.Expand(esdindex*2+10);
//
- TObjArray * array = (TObjArray*) fTrackHypothesys.UncheckedAt(esdindex);
+ TObjArray * array = (TObjArray*) fTrackHypothesys.At(esdindex);
if (!array) {
array = new TObjArray(10);
fTrackHypothesys.AddAt(array,esdindex);
// compress array of track hypothesys
// keep only maxsize best hypothesys
//-------------------------------------------------------------------
- if (! (fTrackHypothesys.UncheckedAt(esdindex)) ) return;
- TObjArray * array = (TObjArray*) fTrackHypothesys.UncheckedAt(esdindex);
+ if (esdindex>fTrackHypothesys.GetEntriesFast()) return;
+ if (! (fTrackHypothesys.At(esdindex)) ) return;
+ TObjArray * array = (TObjArray*) fTrackHypothesys.At(esdindex);
Int_t entries = array->GetEntries();
if (entries<maxsize) return;
- Float_t chi2[entries];
- Int_t index[entries];
+ Float_t * chi2 = new Float_t[entries];
+ Int_t * index = new Int_t[entries];
Int_t current=0;
//
for (Int_t i=0;i<array->GetEntriesFast();i++){
- AliITStrackV2 * track = (AliITStrackV2*)array->UncheckedAt(i);
- if (!track) continue;
- chi2[current] = track->GetNumberOfClusters()+0.001+track->GetChi2()/track->GetNumberOfClusters();
+ AliITStrackV2 * track = (AliITStrackV2*)array->At(i);
+ if (track)
+ chi2[current] = track->GetNumberOfClusters()+0.001+track->GetChi2()/track->GetNumberOfClusters();
+ else
+ chi2[current] = 100000000;
current++;
}
TMath::Sort(current,chi2,index,kFALSE);
newarray->AddLast(array->RemoveAt(index[i]));
}
array->Delete();
- delete array;
+ delete fTrackHypothesys.RemoveAt(esdindex);
fTrackHypothesys.AddAt(newarray,esdindex);
+ delete [] chi2;
+ delete [] index;
+
}
fTrigger(0),
fRecoVersion(0),
fMagneticField(0),
+ fPrimaryVertex(),
fTracks("AliESDtrack",15000),
fCaloTracks("AliESDCaloTrack",500),
fMuonTracks("AliESDMuonTrack",30),
fV0s("AliESDv0",200),
fCascades("AliESDcascade",20)
{
- Int_t i;
- for (i=0; i<3; i++) fVtx[i]=0.;
- for (i=0; i<6; i++) fCovVtx[i]=0.;
-}
-
-void AliESD::SetVertex(const Double_t *vtx, const Double_t *cvtx) {
- //Save the primary vertex position
- Int_t i;
- for (i=0; i<3; i++) fVtx[i]=vtx[i];
- if (cvtx)
- for (i=0; i<6; i++) fCovVtx[i]=cvtx[i];
-}
-
-void AliESD::GetVertex(Double_t *vtx, Double_t *cvtx) const {
- //Get the primary vertex position
- Int_t i;
- for (i=0; i<3; i++) vtx[i]=fVtx[i];
- if (cvtx)
- for (i=0; i<6; i++) cvtx[i]=fCovVtx[i];
}
void AliESD::Print(Option_t *) const {
GetRunNumber(),
GetTrigger(),
GetMagneticField() );
+ printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n",
+ fPrimaryVertex.GetXv(), fPrimaryVertex.GetXRes(),
+ fPrimaryVertex.GetYv(), fPrimaryVertex.GetYRes(),
+ fPrimaryVertex.GetZv(), fPrimaryVertex.GetZRes());
printf("Event from reconstruction version %d \n",fRecoVersion);
printf("Number of tracks: \n");
printf(" charged %d\n",GetNumberOfTracks());
#include "TObject.h"
#include "TClonesArray.h"
+#include "AliESDVertex.h"
#include "AliESDtrack.h"
#include "AliESDMuonTrack.h"
#include "AliESDCaloTrack.h"
void SetEventNumber(Int_t n) {fEventNumber=n;}
void SetRunNumber(Int_t n) {fRunNumber=n;}
+ void SetTrigger(Long_t n) {fTrigger=n;}
void SetMagneticField(Float_t mf){fMagneticField = mf;}
Float_t GetMagneticField() const {return fMagneticField;}
new(fCascades[fCascades.GetEntriesFast()]) AliESDcascade(*c);
}
- void SetVertex(const Double_t *vtx, const Double_t *cvtx=0);
- void GetVertex(Double_t *vtx, Double_t *cvtx) const;
+ void SetVertex(AliESDVertex* vertex) {
+ new(&fPrimaryVertex) AliESDVertex(*vertex);
+ }
+ const AliESDVertex* GetVertex() const {return &fPrimaryVertex;};
Int_t GetEventNumber() const {return fEventNumber;}
Int_t GetRunNumber() const {return fRunNumber;}
Int_t fRecoVersion; // Version of reconstruction
Float_t fMagneticField; // Solenoid Magnetic Field in kG : for compatibility with AliMagF
- Double_t fVtx[3]; // Primary vertex position
- Double_t fCovVtx[6]; // Cov. matrix of the primary vertex position
+ AliESDVertex fPrimaryVertex; // Primary vertex
TClonesArray fTracks; // ESD tracks
TClonesArray fCaloTracks; // Calorimeters' ESD tracks
TClonesArray fV0s; // V0 vertices
TClonesArray fCascades; // Cascade vertices
- ClassDef(AliESD,2) //ESD class
+ ClassDef(AliESD,3) //ESD class
//ver. 2: Magnetic Field Added; skowron
};
fTruePos[i] = 0;
fSNR[i] = 0.;
}
- fCovXX = 0;
+ fCovXX = 0.005*0.005;
fCovXY = 0;
- fCovYY = 0;
+ fCovYY = 0.005*0.005;
fCovXZ = 0;
fCovYZ = 0;
- fCovZZ = 0;
+ fCovZZ = 5.3*5.3;
fChi2 = 0;
fNContributors = 0;
/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
+/* $Id$ */
//-------------------------------------------------------
// Primary Vertex Class
class AliTrackReference;
class AliDigitizer;
class AliRunDigitizer;
+class AliVertexer;
class AliTracker;
class AliESD;
class AliRunLoader;
virtual void Hits2Digits() {}
virtual void Digits2Reco() {}
virtual void Reconstruct() const {}
+ virtual AliVertexer* CreateVertexer() const {return NULL;}
virtual AliTracker* CreateTracker() const {return NULL;}
virtual void FillESD(AliESD* /*esd*/) const {}
virtual void Digits2Raw() {}
#include "AliDetector.h"
#include "AliTracker.h"
#include "AliESD.h"
+#include "AliESDVertex.h"
+#include "AliVertexer.h"
#include "AliHeader.h"
#include "AliGenEventHeader.h"
#include "AliESDpid.h"
TNamed(name, title),
fRunReconstruction("ALL"),
+ fRunVertexFinder(kTRUE),
fRunTracking(kTRUE),
fFillESD("ALL"),
fGAliceFileName(gAliceFilename),
fRunLoader(NULL),
fITSLoader(NULL),
+ fITSVertexer(NULL),
fITSTracker(NULL),
fTPCLoader(NULL),
fTPCTracker(NULL),
TNamed(rec),
fRunReconstruction(rec.fRunReconstruction),
+ fRunVertexFinder(rec.fRunVertexFinder),
fRunTracking(rec.fRunTracking),
fFillESD(rec.fFillESD),
fGAliceFileName(rec.fGAliceFileName),
fRunLoader(NULL),
fITSLoader(NULL),
+ fITSVertexer(NULL),
fITSTracker(NULL),
fTPCLoader(NULL),
fTPCTracker(NULL),
if (fStopOnError) {CleanUp(); return kFALSE;}
}
}
- if (!fRunTracking && fFillESD.IsNull()) return kTRUE;
+ if (!fRunVertexFinder && !fRunTracking && fFillESD.IsNull()) return kTRUE;
+
+ // get vertexer
+ if (fRunVertexFinder && !CreateVertexer()) {
+ if (fStopOnError) {
+ CleanUp();
+ return kFALSE;
+ }
+ }
// get loaders and trackers
if (fRunTracking && !CreateTrackers()) {
esd->SetEventNumber(aliRun->GetEvNumber());
esd->SetMagneticField(aliRun->Field()->SolenoidField());
+ // vertex finder
+ if (fRunVertexFinder) {
+ if (!ReadESD(esd, "vertex")) {
+ if (!RunVertexFinder(esd)) {
+ if (fStopOnError) {CleanUp(file); return kFALSE;}
+ }
+ if (fCheckPointLevel > 0) WriteESD(esd, "vertex");
+ }
+ }
+
// barrel tracking
if (fRunTracking) {
if (!ReadESD(esd, "tracking")) {
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::RunTracking(AliESD*& esd)
+Bool_t AliReconstruction::RunVertexFinder(AliESD*& esd)
{
// run the barrel tracking
TStopwatch stopwatch;
stopwatch.Start();
- // get the primary vertex (from MC for the moment)
- TArrayF vertex(3);
- fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(vertex);
- Double_t vtxPos[3] = {vertex[0], vertex[1], vertex[2]};
- Double_t vtxCov[6] = {
- 0.005,
- 0.000, 0.005,
- 0.000, 0.000, 0.010
- };
- Double_t vtxErr[3] = {vtxCov[0], vtxCov[2], vtxCov[5]}; // diag. elements
- esd->SetVertex(vtxPos, vtxCov);
+ AliESDVertex* vertex = NULL;
+ Double_t vtxPos[3] = {0, 0, 0};
+ Double_t vtxErr[3] = {0.07, 0.07, 0.1};
+ TArrayF mcVertex(3);
+ fRunLoader->GetHeader()->GenEventHeader()->PrimaryVertex(mcVertex);
+ for (Int_t i = 0; i < 3; i++) vtxPos[i] = mcVertex[i];
+
+ if (fITSVertexer) {
+ Info("RunVertexFinder", "running the ITS vertex finder");
+ fITSVertexer->SetDebug(1);
+ vertex = fITSVertexer->FindVertexForCurrentEvent(fRunLoader->GetEventNumber());
+ if(!vertex){
+ Warning("RunVertexFinder","Vertex not found \n");
+ vtxErr[2]=10000.;
+ vertex = new AliESDVertex(vtxPos, vtxErr);
+ }
+ else {
+ vertex->SetTruePos(vtxPos); // store also the vertex from MC
+ }
+
+ } else {
+ Info("RunVertexFinder", "getting the primary vertex from MC");
+ vertex = new AliESDVertex(vtxPos, vtxErr);
+ }
+
+ if (vertex) {
+ vertex->GetXYZ(vtxPos);
+ vertex->GetSigmaXYZ(vtxErr);
+ } else {
+ Warning("RunVertexFinder", "no vertex reconstructed");
+ vertex = new AliESDVertex(vtxPos, vtxErr);
+ }
+ esd->SetVertex(vertex);
if (fITSTracker) fITSTracker->SetVertex(vtxPos, vtxErr);
if (fTPCTracker) fTPCTracker->SetVertex(vtxPos, vtxErr);
if (fTRDTracker) fTRDTracker->SetVertex(vtxPos, vtxErr);
- if (fCheckPointLevel > 1) WriteESD(esd, "vertex");
+ delete vertex;
+
+ Info("RunVertexFinder", "execution time:");
+ stopwatch.Print();
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliReconstruction::RunTracking(AliESD*& esd)
+{
+// run the barrel tracking
+
+ TStopwatch stopwatch;
+ stopwatch.Start();
if (!fTPCTracker) {
Error("RunTracking", "no TPC tracker");
return result;
}
+//_____________________________________________________________________________
+Bool_t AliReconstruction::CreateVertexer()
+{
+// create the vertexer
+
+ fITSVertexer = NULL;
+ AliRun* aliRun = fRunLoader->GetAliRun();
+ if (aliRun->GetDetector("ITS")) {
+ fITSVertexer = aliRun->GetDetector("ITS")->CreateVertexer();
+ }
+ if (!fITSVertexer) {
+ Warning("CreateVertexer", "couldn't create a vertexer for ITS");
+ if (fStopOnError) return kFALSE;
+ }
+
+ return kTRUE;
+}
+
//_____________________________________________________________________________
Bool_t AliReconstruction::CreateTrackers()
{
{
// delete trackers and the run loader and close and delete the file
+ delete fITSVertexer;
+ fITSVertexer = NULL;
delete fITSTracker;
fITSTracker = NULL;
delete fTPCTracker;
class AliRunLoader;
class AliLoader;
+class AliVertexer;
class AliTracker;
class AliESD;
class TFile;
void SetRunReconstruction(const char* detectors) {
fRunReconstruction = detectors;};
+ void SetRunVertexFinder(Bool_t run) {fRunVertexFinder = run;};
void SetRunTracking(Bool_t run) {fRunTracking = run;};
void SetFillESD(const char* detectors) {fFillESD = detectors;};
private:
Bool_t RunReconstruction(const TString& detectors);
+ Bool_t RunVertexFinder(AliESD*& esd);
Bool_t RunTracking(AliESD*& esd);
Bool_t FillESD(AliESD*& esd, const TString& detectors);
Bool_t IsSelected(TString detName, TString& detectors) const;
+ Bool_t CreateVertexer();
Bool_t CreateTrackers();
void CleanUp(TFile* file = NULL);
void WriteESD(AliESD* esd, const char* recStep) const;
TString fRunReconstruction; // run the reconstr. for these detectors
+ Bool_t fRunVertexFinder; // run the vertex finder
Bool_t fRunTracking; // run the barrel tracking
TString fFillESD; // fill ESD for these detectors
TString fGAliceFileName; // name of the galice file
AliRunLoader* fRunLoader; //! current run loader object
AliLoader* fITSLoader; //! loader for ITS
+ AliVertexer* fITSVertexer; //! vertexer for ITS
AliTracker* fITSTracker; //! tracker for ITS
AliLoader* fTPCLoader; //! loader for TPC
AliTracker* fTPCTracker; //! tracker for TPC
--- /dev/null
+#include <AliESDVertex.h>
+#include <AliVertexer.h>
+
+ClassImp(AliVertexer)
+
+//////////////////////////////////////////////////////////////////////
+// Base class for primary vertex reconstruction //
+// AliESDVertexer is a class for full 3D primary vertex finding //
+// derived classes: AliITSVertexer //
+// //
+//////////////////////////////////////////////////////////////////////
+
+//______________________________________________________________________
+AliVertexer::AliVertexer() {
+ // Default Constructor
+
+ fCurrentVertex = 0;
+ SetDebug();
+ SetFirstEvent(0);
+ SetLastEvent(0);
+}
+
+
+//______________________________________________________________________
+AliVertexer::AliVertexer(const AliVertexer &vtxr) : TObject(vtxr) {
+ // Copy constructor
+ // Copies are not allowed. The method is protected to avoid misuse.
+ Error("AliVertexer","Copy constructor not allowed\n");
+}
+
+//______________________________________________________________________
+AliVertexer& AliVertexer::operator=(const AliVertexer& /* vtxr */){
+ // Assignment operator
+ // Assignment is not allowed. The method is protected to avoid misuse.
+ Error("= operator","Assignment operator not allowed\n");
+ return *this;
+}
+
+//______________________________________________________________________
+AliVertexer::~AliVertexer() {
+ // Default Destructor
+ // The objects pointed by the following pointers are not owned
+ // by this class and are not deleted
+
+ fCurrentVertex = 0;
+}
--- /dev/null
+#ifndef ALIVERTEXER_H
+#define ALIVERTEXER_H
+
+#include<TObject.h>
+
+///////////////////////////////////////////////////////////////////
+// //
+// Base class for primary vertex reconstruction //
+// //
+///////////////////////////////////////////////////////////////////
+
+class TFile;
+class TString;
+class TTRee;
+class AliESDVertex;
+
+
+class AliVertexer : public TObject {
+
+ public:
+ // default constructor
+ AliVertexer();
+
+ // destructor
+ virtual ~AliVertexer();
+ // computes the vertex for the current event
+ virtual AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb)=0;
+ // computes the vetex for each event and stores it on file
+ virtual void FindVertices()= 0;
+ virtual void PrintStatus() const = 0;
+ virtual void SetDebug(Int_t debug = 0){fDebug = debug;}
+ virtual void SetFirstEvent(Int_t ev){fFirstEvent = ev;}
+ virtual void SetLastEvent(Int_t ev){fLastEvent = ev;}
+ virtual void SetUseV2Clusters(Bool_t choice) = 0;
+ virtual void WriteCurrentVertex() = 0;
+
+
+ protected:
+ // copy constructor (NO copy allowed: the constructor is protected
+ // to avoid misuse)
+ AliVertexer(const AliVertexer& vtxr);
+ // assignment operator (NO assignment allowed)
+ AliVertexer& operator=(const AliVertexer& /* vtxr */);
+
+ AliESDVertex *fCurrentVertex; //! pointer to the vertex of the current
+ // event
+ Int_t fFirstEvent; // First event to be processed by FindVertices
+ Int_t fLastEvent; // Last event to be processed by FindVertices
+ Int_t fDebug; //! debug flag - verbose printing if >0
+
+ ClassDef(AliVertexer,1);
+};
+
+#endif
#pragma link C++ class AliSimulation+;
#pragma link C++ class AliReconstruction+;
#pragma link C++ class AliVertexGenFile+;
+#pragma link C++ class AliVertexer+;
#endif
AliTrackMap.cxx AliTrackMapper.cxx AliCollisionGeometry.cxx \
AliMemoryWatcher.cxx AliBarrelTrack.cxx \
AliESDtrack.cxx AliESDCaloTrack.cxx AliESDMuonTrack.cxx AliESDv0.cxx AliESDcascade.cxx AliESDVertex.cxx AliESDpid.cxx \
+AliVertexer.cxx \
AliMC.cxx AliSimulation.cxx AliReconstruction.cxx AliVertexGenFile.cxx
HDRS:= $(SRCS:.cxx=.h)