X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=ITS%2FAliITSVertexer.cxx;h=6ecff35c54fe813a2a63e2ebb5f23b8d8417f4f0;hb=6d9b7a9e923ef7f86694b9cd1ec3fb287e618417;hp=30cf5b4f20506b00eee51dbc259abd437ed7c5bd;hpb=c61c02f4ba36c4d773022405bfe47d14d5a2a544;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSVertexer.cxx b/ITS/AliITSVertexer.cxx index 30cf5b4f205..6ecff35c54f 100644 --- a/ITS/AliITSVertexer.cxx +++ b/ITS/AliITSVertexer.cxx @@ -1,117 +1,227 @@ -#include -#include -#include -#include -#include -#include +#include "AliLog.h" +#include "AliMultiplicity.h" +#include "AliITSgeomTGeo.h" +#include "AliITSDetTypeRec.h" +#include "AliITSVertexer.h" +#include "AliITSLoader.h" +#include "AliITSMultReconstructor.h" +#include "AliITSRecPointContainer.h" +#include "AliRunLoader.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 AliITSvertexerPPZ // -// AliITSVertexer3D // +// derived classes: AliITSvertexer3D, AliITSVertexerZ. // +// AliITSVertexerCosmics // ////////////////////////////////////////////////////////////////////// +/* $Id$ */ + //______________________________________________________________________ -AliITSVertexer::AliITSVertexer():AliVertexer() { +AliITSVertexer::AliITSVertexer():AliVertexer(), +fLadders(NULL), +fLadOnLay2(0), +fComputeMultiplicity(kFALSE), +fDetTypeRec(NULL), +fMinTrackletsForPilup(0), +fIsPileup(0), +fNTrpuv(-2), +fZpuv(-9999999.), +fNoVertices(0), +fVertArray(NULL), +fFirstEvent(0), +fLastEvent(-1) +{ // Default Constructor -} - -AliITSVertexer::AliITSVertexer(TString filename) { - // Standard constructor - AliRunLoader *rl = AliRunLoader::GetRunLoader(); - if(!rl){ - Fatal("AliITSVertexer","Run Loader not found"); - } - if(rl->LoadgAlice()){ - Fatal("AliITSVertexer","The AliRun object is not available - nothing done"); - } - fCurrentVertex = 0; - fDebug = 0; - SetFirstEvent(0); - SetLastEvent(0); - rl->LoadHeader(); - AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); - if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename); - if(!filename.Contains("null"))itsLoader->LoadVertices("recreate"); - itsLoader->LoadRecPoints(); - Int_t lst; - if(rl->TreeE()){ - lst = static_cast(rl->TreeE()->GetEntries()); - SetLastEvent(lst-1); - } + SetLaddersOnLayer2(); + SetMinTrackletsForPilup(); + for(Int_t i=0; i 0){ + if(fVertArray) delete []fVertArray; + fVertArray = NULL; + fNoVertices = 0; + } + fIsPileup=kFALSE; + fNTrpuv=-2; + fZpuv=-99999.; +} //______________________________________________________________________ -void AliITSVertexer::FindMultiplicity(Int_t evnumber){ +void AliITSVertexer::FindMultiplicity(TTree *itsClusterTree){ // Invokes AliITSMultReconstructor to determine the // charged multiplicity in the pixel layers if(fMult){delete fMult; fMult = 0;} + Bool_t success=kTRUE; + Bool_t cosmics=kFALSE; if(!fCurrentVertex)success=kFALSE; if(fCurrentVertex && fCurrentVertex->GetNContributors()<1)success=kFALSE; + if(fCurrentVertex && strstr(fCurrentVertex->GetTitle(),"cosmics")) { + success=kFALSE; + cosmics=kTRUE; + } + + // get the FastOr bit mask + TBits fastOrFiredMap = fDetTypeRec->GetFastOrFiredMap(); + TBits firedChipMap = fDetTypeRec->GetFiredChipMap(itsClusterTree); + + AliITSMultReconstructor multReco; + if(!success){ - AliWarning("Tracklets multiplicity not determined because the primary vertex was not found"); + if(!cosmics) { + AliDebug(1,"Tracklets multiplicity not determined because the primary vertex was not found"); + AliDebug(1,"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,0,0,nfcL1,nfcL2,fastOrFiredMap); + fMult->SetFiredChipMap(firedChipMap); + AliITSRecPointContainer* rcont = AliITSRecPointContainer::Instance(); + fMult->SetITSClusters(0,rcont->GetNClustersInLayer(1,itsClusterTree)); + for(Int_t kk=2;kk<=6;kk++){ + fMult->SetITSClusters(kk-1,rcont->GetNClustersInLayerFast(kk)); + } return; } - AliITSMultReconstructor* multReco = new AliITSMultReconstructor(); - AliRunLoader *rl =AliRunLoader::GetRunLoader(); - AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader"); - multReco->SetGeometry(itsLoader->GetITSgeom()); - itsLoader->LoadRecPoints(); - rl->GetEvent(evnumber); - TTree* itsClusterTree = itsLoader->TreeR(); + if (!itsClusterTree) { - AliError(" Can't get the ITS cluster tree !\n"); + 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); - cout<<"======================================================="<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(); + AliRunLoader *rl = AliRunLoader::Instance(); AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); fCurrentVertex->SetName("Vertex"); // const char * name = fCurrentVertex->GetName(); @@ -119,3 +229,23 @@ void AliITSVertexer::WriteCurrentVertex(){ 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::Instance(); + 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)); + } + } +}