X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=ITS%2FAliITSVertexer.cxx;h=51d999e3589f00b709d7c53c5841c3f7d0672a45;hb=253fefa40ceaae544ee230b7ce2f57c85f0e7db8;hp=5f1d5b75972faf99a82d83cc55cfcad657777674;hpb=1b9fef1cf8bbce0100e127914802c39b5afdd970;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSVertexer.cxx b/ITS/AliITSVertexer.cxx index 5f1d5b75972..51d999e3589 100644 --- a/ITS/AliITSVertexer.cxx +++ b/ITS/AliITSVertexer.cxx @@ -1,9 +1,8 @@ -#include -#include "AliITSgeom.h" +#include "AliLog.h" +#include "AliMultiplicity.h" +#include "AliITSgeomTGeo.h" #include "AliITSVertexer.h" -#include "AliRunLoader.h" #include "AliITSLoader.h" -#include "AliMultiplicity.h" #include "AliITSMultReconstructor.h" const Float_t AliITSVertexer::fgkPipeRadius = 3.0; @@ -17,60 +16,19 @@ ClassImp(AliITSVertexer) // AliITSVertexerCosmics // ////////////////////////////////////////////////////////////////////// +/* $Id$ */ + //______________________________________________________________________ AliITSVertexer::AliITSVertexer():AliVertexer(), fLadders(), -fLadOnLay2(0) { - // Default Constructor - SetLaddersOnLayer2(); -} - -AliITSVertexer::AliITSVertexer(TString filename):AliVertexer(), -fLadders(), -fLadOnLay2(0) +fLadOnLay2(0), +fFirstEvent(0), +fLastEvent(-1), +fDetTypeRec(NULL) { - // 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; - 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; - SetLastEvent(rl->GetNumberOfEvents()-1); - /* - if(rl->TreeE()){ - lst = static_cast(rl->TreeE()->GetEntries()); - SetLastEvent(lst-1); - } - */ + // Default Constructor SetLaddersOnLayer2(); -} - -//______________________________________________________________________ -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"); -} - -//______________________________________________________________________ -AliITSVertexer& AliITSVertexer::operator=(const AliITSVertexer& /* vtxr */){ - // Assignment operator - // Assignment is not allowed. The method is protected to avoid misuse. - Error("= operator","Assignment operator not allowed\n"); - return *this; + for(Int_t i=0; iGetNContributors()<1)success=kFALSE; + + // get the FastOr bit mask + TBits fastOrFiredMap = fDetTypeRec->GetFastOrFiredMap(); + + 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,fastOrFiredMap); 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); - Int_t notracks=multReco->GetNTracklets(); + 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]; - for(Int_t i=0;iGetNTracklets();i++){ - tht[i] = multReco->GetTracklet(i)[0]; - phi[i] = multReco->GetTracklet(i)[1]; - dphi[i] = multReco->GetTracklet(i)[2]; - labels[i] = static_cast(multReco->GetTracklet(i)[3]); + 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(); + Int_t nosingleclus=multReco.GetNSingleClusters(); Float_t *ths = new Float_t [nosingleclus]; Float_t *phs = new Float_t [nosingleclus]; for(Int_t i=0;iGetCluster(i)[0]; - phs[i] = multReco->GetCluster(i)[1]; + ths[i] = multReco.GetCluster(i)[0]; + phs[i] = multReco.GetCluster(i)[1]; } - fMult = new AliMultiplicity(notracks,tht,phi,dphi,labels,nosingleclus,ths,phs); + Short_t nfcL1 = multReco.GetNFiredChips(0); + Short_t nfcL2 = multReco.GetNFiredChips(1); + fMult = new AliMultiplicity(notracks,tht,phi,dphi,labels,labelsL2,nosingleclus,ths,phs,nfcL1,nfcL2,fastOrFiredMap); + delete [] tht; delete [] phi; delete [] dphi; delete [] ths; delete [] phs; - itsLoader->UnloadRecPoints(); - delete multReco; + delete [] labels; + delete [] labelsL2; + return; } @@ -142,29 +115,26 @@ void AliITSVertexer::SetLaddersOnLayer2(Int_t ladwid){ // Calculates the array of ladders on layer 2 to be used with a // given ladder on layer 1 fLadOnLay2=ladwid; - AliRunLoader *rl =AliRunLoader::GetRunLoader(); - AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader"); - AliITSgeom* geom = itsLoader->GetITSgeom(); - Int_t ladtot1=geom->GetNladders(1); + Int_t ladtot1=AliITSgeomTGeo::GetNLadders(1); if(fLadders) delete [] fLadders; fLadders=new UShort_t[ladtot1]; Double_t pos1[3],pos2[3]; - Int_t mod1=geom->GetModuleIndex(2,1,1); - geom->GetTrans(mod1,pos1); // position of the module in the MRS + Int_t mod1=AliITSgeomTGeo::GetModuleIndex(2,1,1); + AliITSgeomTGeo::GetTranslation(mod1,pos1); // position of the module in the MRS Double_t phi0=TMath::ATan2(pos1[1],pos1[0]); if(phi0<0) phi0+=2*TMath::Pi(); - Int_t mod2=geom->GetModuleIndex(2,2,1); - geom->GetTrans(mod2,pos2); + Int_t mod2=AliITSgeomTGeo::GetModuleIndex(2,2,1); + AliITSgeomTGeo::GetTranslation(mod2,pos2); Double_t phi2=TMath::ATan2(pos2[1],pos2[0]); if(phi2<0) phi2+=2*TMath::Pi(); Double_t deltaPhi= phi0-phi2; // phi width of a layer2 module for(Int_t i= 0; iGetModuleIndex(1,i+1,1); + Int_t modlad= AliITSgeomTGeo::GetModuleIndex(1,i+1,1); Double_t posmod[3]; - geom->GetTrans(modlad,posmod); + AliITSgeomTGeo::GetTranslation(modlad,posmod); Double_t phimod=TMath::ATan2(posmod[1],posmod[0]); if(phimod<0) phimod+=2*TMath::Pi(); Double_t phi1= phimod+deltaPhi*double(fLadOnLay2); @@ -179,6 +149,22 @@ void AliITSVertexer::SetLaddersOnLayer2(Int_t ladwid){ } } +#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(){ @@ -192,3 +178,22 @@ void AliITSVertexer::WriteCurrentVertex(){ 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)); + } + } +}