add GetNAcceptedClusters() function
authormverweij <marta.verweij@cern.ch>
Tue, 2 Sep 2014 09:37:56 +0000 (11:37 +0200)
committermverweij <marta.verweij@cern.ch>
Tue, 2 Sep 2014 13:25:26 +0000 (15:25 +0200)
PWG/EMCAL/AliClusterContainer.cxx
PWG/EMCAL/AliClusterContainer.h

index 79b03d4..f536eab 100644 (file)
@@ -210,6 +210,21 @@ Bool_t AliClusterContainer::AcceptCluster(AliVCluster *clus) const
 }
 
 //________________________________________________________________________
+Int_t AliClusterContainer::GetNAcceptedClusters()
+{
+  // Get number of accepted particles
+
+  Int_t nClus = 0;
+
+  AliVCluster *clus = GetNextAcceptCluster(0);
+  if(clus) nClus = 1;
+  while (GetNextAcceptCluster())
+    nClus++;
+
+  return nClus;
+}
+
+//________________________________________________________________________
 void AliClusterContainer::SetClassName(const char *clname)
 {
   // Set the class name
index fa0ebfc..3790e78 100644 (file)
@@ -26,6 +26,7 @@ class AliClusterContainer : public AliEmcalContainer {
   AliVCluster                *GetNextAcceptCluster(Int_t i=-1)            ;
   AliVCluster                *GetNextCluster(Int_t i=-1)                  ;
   Int_t                       GetNClusters()                         const { return GetNEntries();   }
+  Int_t                       GetNAcceptedClusters()                      ;
   void                        SetClassName(const char *clname);
   void                        SetClusECut(Double_t cut)                    { fClusECut      = cut ; }
   void                        SetClusPtCut(Double_t cut)                   { fClusPtCut      = cut ; }