]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adds void AliFlowEventSimple::ShuffleTracks() to allow for explicit reshuffling of...
authormkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Mar 2013 16:05:55 +0000 (16:05 +0000)
committermkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Mar 2013 16:05:55 +0000 (16:05 +0000)
PWG/FLOW/Base/AliFlowEventSimple.cxx
PWG/FLOW/Base/AliFlowEventSimple.h

index 0e0fc0dccdb827c7b1a3115bf4184f57c16ae069..f4a483939ac47fb8cf31fb6bd8fd8e7b9ae0d46f 100644 (file)
@@ -200,19 +200,27 @@ AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
   //if asked use the shuffled index
   if (fShuffleTracks)
   {
-    if (!fShuffledIndexes) 
-    {
-      //initialize the table with shuffeled indexes
-      fShuffledIndexes = new Int_t[fNumberOfTracks];
-      for (Int_t j=0; j<fNumberOfTracks; j++) { fShuffledIndexes[j]=j; }
-      std::random_shuffle(&fShuffledIndexes[0], &fShuffledIndexes[fNumberOfTracks]);
-    }
+    if (!fShuffledIndexes) ShuffleTracks();
     trackIndex=fShuffledIndexes[i];
   }
   AliFlowTrackSimple* pTrack = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(trackIndex)) ;
   return pTrack;
 }
 
+//-----------------------------------------------------------------------
+void AliFlowEventSimple::ShuffleTracks()
+{
+  //shuffle track indexes
+  if (!fShuffledIndexes) 
+  {
+    //initialize the table with shuffeled indexes
+    fShuffledIndexes = new Int_t[fNumberOfTracks];
+    for (Int_t j=0; j<fNumberOfTracks; j++) { fShuffledIndexes[j]=j; }
+  }
+  //shuffle
+  std::random_shuffle(&fShuffledIndexes[0], &fShuffledIndexes[fNumberOfTracks]);
+}
+
 //-----------------------------------------------------------------------
 void AliFlowEventSimple::AddTrack( AliFlowTrackSimple* track )
 {
index 14d199698a0d9736c264cf3e58c4dbd21c8a5ead..678447891f78aaeb9d867821e152d46d4b787032 100644 (file)
@@ -66,6 +66,7 @@ class AliFlowEventSimple: public TObject {
   void     SetUserModified(Bool_t s=kTRUE)          { fUserModified=s; }
   Bool_t   IsUserModified() const                   { return fUserModified; }
   void     SetShuffleTracks(Bool_t b)               {fShuffleTracks=b;}
+  void     ShuffleTracks();
 
   void ResolutionPt(Double_t res);
   void TagSubeventsInEta(Double_t etaMinA, Double_t etaMaxA, Double_t etaMinB, Double_t etaMaxB );