+//______________________________________________________________________
+void AliITSVertexer::ResetVertex(){
+ // Resets vertex related data members
+ if(fNoVertices > 0){
+ if(fVertArray) delete []fVertArray;
+ fVertArray = NULL;
+ fNoVertices = 0;
+ }
+ fIsPileup=kFALSE;
+ fNTrpuv=-2;
+ fZpuv=-99999.;
+
+}
+//______________________________________________________________________
+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){
+ 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,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;
+ }
+
+ 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 *dtht = 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.GetNTracklets();i++){
+ tht[i] = multReco.GetTracklet(i)[0];
+ phi[i] = multReco.GetTracklet(i)[1];
+ dtht[i] = multReco.GetTracklet(i)[3];
+ dphi[i] = multReco.GetTracklet(i)[2];
+ labels[i] = static_cast<Int_t>(multReco.GetTracklet(i)[4]);
+ labelsL2[i] = static_cast<Int_t>(multReco.GetTracklet(i)[5]);