#include "AliLog.h" #include "AliMultiplicity.h" #include "AliITSgeomTGeo.h" #include "AliITSVertexer.h" #include "AliITSLoader.h" #include "AliITSMultReconstructor.h" const Float_t AliITSVertexer::fgkPipeRadius = 3.0; ClassImp(AliITSVertexer) ////////////////////////////////////////////////////////////////////// // Base class for primary vertex reconstruction // // AliESDVertexer is a class for full 3D primary vertex finding // // derived classes: AliITSVertexerIons AliITSvertexer3D // // AliITSVertexerCosmics // ////////////////////////////////////////////////////////////////////// /* $Id$ */ //______________________________________________________________________ AliITSVertexer::AliITSVertexer():AliVertexer(), fLadders(), fLadOnLay2(0), fFirstEvent(0), fLastEvent(-1) { // Default Constructor SetLaddersOnLayer2(); for(Int_t i=0; iGetNContributors()<1)success=kFALSE; AliITSMultReconstructor multReco; if(!success){ AliWarning("Tracklets multiplicity not determined because the primary vertex was not found"); AliWarning("Just counting the number of cluster-fired chips on the SPD layers"); if (!itsClusterTree) { AliError(" Invalid ITS cluster tree !\n"); return; } multReco.LoadClusterFiredChips(itsClusterTree); Short_t nfcL1 = multReco.GetNFiredChips(0); Short_t nfcL2 = multReco.GetNFiredChips(1); fMult = new AliMultiplicity(0,0,0,0,0,0,0,0,0,nfcL1,nfcL2); return; } if (!itsClusterTree) { AliError(" Invalid ITS cluster tree !\n"); return; } Double_t vtx[3]; fCurrentVertex->GetXYZ(vtx); Float_t vtxf[3]; for(Int_t i=0;i<3;i++)vtxf[i]=vtx[i]; multReco.SetHistOn(kFALSE); multReco.Reconstruct(itsClusterTree,vtxf,vtxf); Int_t notracks=multReco.GetNTracklets(); Float_t *tht = new Float_t [notracks]; Float_t *phi = new Float_t [notracks]; Float_t *dphi = new Float_t [notracks]; Int_t *labels = new Int_t[notracks]; Int_t *labelsL2 = new Int_t[notracks]; for(Int_t i=0;i(multReco.GetTracklet(i)[3]); labelsL2[i] = static_cast(multReco.GetTracklet(i)[4]); } Int_t nosingleclus=multReco.GetNSingleClusters(); Float_t *ths = new Float_t [nosingleclus]; Float_t *phs = new Float_t [nosingleclus]; for(Int_t i=0;i2*TMath::Pi()) phi1-=2*TMath::Pi(); Double_t philad1=phi0-phi1; UShort_t lad1; Double_t ladder1=(philad1)/(deltaPhi) +1.; if(ladder1<1){ladder1=40+ladder1;} lad1=int(ladder1+0.5); fLadders[i]=lad1; } } #include "AliRunLoader.h" //______________________________________________________________________ void AliITSVertexer::Init(TString filename){ // Initialize the vertexer in case of // analysis of an entire file AliRunLoader *rl = AliRunLoader::GetRunLoader(); if(!rl){ Fatal("AliITSVertexer","Run Loader not found"); } if (fLastEvent < 0) SetLastEvent(rl->GetNumberOfEvents()-1); AliITSLoader* itsloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); if(!filename.Contains("default"))itsloader->SetVerticesFileName(filename); if(!filename.Contains("null"))itsloader->LoadVertices("recreate"); } //______________________________________________________________________ void AliITSVertexer::WriteCurrentVertex(){ // Write the current AliVertex object to file fOutFile AliRunLoader *rl = AliRunLoader::GetRunLoader(); AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); fCurrentVertex->SetName("Vertex"); // const char * name = fCurrentVertex->GetName(); // itsLoader->SetVerticesContName(name); Int_t rc = itsLoader->PostVertex(fCurrentVertex); rc = itsLoader->WriteVertices(); } //______________________________________________________________________ void AliITSVertexer::FindVertices(){ // computes the vertices of the events in the range FirstEvent - LastEvent AliRunLoader *rl = AliRunLoader::GetRunLoader(); AliITSLoader* itsloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); itsloader->LoadRecPoints("read"); for(Int_t i=fFirstEvent;i<=fLastEvent;i++){ rl->GetEvent(i); TTree* cltree = itsloader->TreeR(); FindVertexForCurrentEvent(cltree); if(fCurrentVertex){ WriteCurrentVertex(); } else { AliDebug(1,Form("Vertex not found for event %d",i)); } } }