Corrected protection.
[u/mrichter/AliRoot.git] / STEER / AliAODEvent.cxx
index 318c85c..65ed50e 100644 (file)
@@ -484,7 +484,8 @@ Int_t AliAODEvent::GetMuonTracks(TRefArray *muonTracks) const
 
   AliAODTrack *track = 0;
   for (Int_t iTrack = 0; iTrack < GetNTracks(); iTrack++) {
-    if ((track = GetTrack(iTrack))->IsMuonTrack()) {
+    track = GetTrack(iTrack);
+    if (track->IsMuonTrack()) {
       muonTracks->Add(track);
     }
   }
@@ -527,15 +528,15 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
     TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("AODObjectsConnectedToTree"));
     if (connectedList && (strcmp(opt, "reconnect"))) {
         // If connected use the connected list of objects
-      fAODObjects->Delete();
-      fAODObjects = connectedList;
-      GetStdContent(); 
-      fConnected = kTRUE;
-      return;
+       fAODObjects->Delete();
+       fAODObjects = connectedList;
+       GetStdContent(); 
+       fConnected = kTRUE;
+       return;
     } 
       // Connect to tree
       // prevent a memory leak when reading back the TList
-      // if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete();
+//      if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete();
     
       // create a new TList from the UserInfo TList... 
       // copy constructor does not work...
@@ -705,7 +706,7 @@ Bool_t  AliAODEvent::IsPileupFromSPD(Int_t minContributors,
       Double_t z2=pv->GetZ();
       Double_t distZ=TMath::Abs(z2-z1);
       Double_t distZdiam=TMath::Abs(z2-GetDiamondZ());
-      Double_t cutZdiam=nSigmaDiamZ*GetSigma2DiamondZ();
+      Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ());
       if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information
       if(distZ>minZdist && distZdiam<cutZdiam){
        Double_t x2=pv->GetX();
@@ -757,3 +758,11 @@ void AliAODEvent::AssignIDtoCollection(TCollection* col)
     while ((obj = next()))
        TProcessID::AssignID(obj);
 }
+
+Bool_t AliAODEvent::IsPileupFromSPDInMultBins() const {
+    Int_t nTracklets=GetTracklets()->GetNumberOfTracklets();
+    if(nTracklets<20) return IsPileupFromSPD(3,0.8);
+    else if(nTracklets<50) return IsPileupFromSPD(4,0.8);
+    else return IsPileupFromSPD(5,0.8);
+}
+