]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes for report #68133: Filtering of ESDFriends at reconstruction level. The defau...
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Jun 2010 14:32:53 +0000 (14:32 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Jun 2010 14:32:53 +0000 (14:32 +0000)
STEER/AliReconstruction.cxx
STEER/AliReconstruction.h

index 5b53f5094d520385bbbc05e89bfae41ad5e87dac..e73860a10c542eaa94b2a9af2a2a786d9c2feab4 100644 (file)
 #include <TGrid.h>
 #include <TMessage.h>
 #include <TUrl.h>
+#include <TRandom.h>
 
 #include "AliAlignObj.h"
 #include "AliCDBEntry.h"
@@ -238,6 +239,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) :
   fFirstEvent(0),
   fLastEvent(-1),
   fNumberOfEventsPerFile((UInt_t)-1),
+  fFractionFriends(0.04),
   fOptions(),
   fLoadAlignFromCDB(kTRUE),
   fLoadAlignData("ALL"),
@@ -344,6 +346,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   fFirstEvent(rec.fFirstEvent),
   fLastEvent(rec.fLastEvent),
   fNumberOfEventsPerFile(rec.fNumberOfEventsPerFile),
+  fFractionFriends(rec.fFractionFriends),
   fOptions(),
   fLoadAlignFromCDB(rec.fLoadAlignFromCDB),
   fLoadAlignData(rec.fLoadAlignData),
@@ -466,6 +469,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec)
   fFirstEvent                    = rec.fFirstEvent;
   fLastEvent                     = rec.fLastEvent;
   fNumberOfEventsPerFile         = rec.fNumberOfEventsPerFile;
+  fFractionFriends               = rec.fFractionFriends;
 
   for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) {
     if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone());
@@ -2050,7 +2054,17 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent)
       fesd->GetESDfriend(fesdf);
 
     ftree->Fill();
-    if (fWriteESDfriend) ftreeF->Fill();
+    if (fWriteESDfriend) {
+      // Sampling
+      Double_t rnd = gRandom->Rndm();
+      if (fFractionFriends < rnd) {
+       fesdf->~AliESDfriend();
+       new (fesdf) AliESDfriend(); // Reset...
+       fesdf->SetSkipBit(kTRUE);
+      }
+
+      ftreeF->Fill();
+    }
 
     // Auto-save the ESD tree in case of prompt reco @P2
     if (fRawReader && fRawReader->UseAutoSaveESD()) {
index f3d9aec4b8cd1a9888b2623fe2c090e57747f808..0408e978ce412985dcdd30d307da262ad477d416 100644 (file)
@@ -65,6 +65,8 @@ public:
     {fFirstEvent = firstEvent; fLastEvent = lastEvent;};
   void           SetNumberOfEventsPerFile(UInt_t nEvents)
     {fNumberOfEventsPerFile = nEvents;};
+  void           SetFractionFriends(Double32_t frac = 0.04)
+    {fFractionFriends = frac;};
   void           SetOption(const char* detector, const char* option);
   void           SetRecoParam(const char* detector, AliDetectorRecoParam *par);
 
@@ -253,6 +255,7 @@ private:
   Int_t          fFirstEvent;         // index of first event to be reconstr.
   Int_t          fLastEvent;          // index of last event to be reconstr.
   UInt_t         fNumberOfEventsPerFile; // number of events per file in case of raw-data reconstruction
+  Double32_t     fFractionFriends; // fraction of ESD friends to be stored
   TObjArray      fOptions;            // options for reconstructor objects
   Bool_t         fLoadAlignFromCDB;   // Load alignment data from CDB and apply it to geometry or not
   TString        fLoadAlignData;      // Load alignment data from CDB for these detectors
@@ -317,7 +320,7 @@ private:
   
   TTree*              fChain;      //! The raw-data chain in case of AliRawReaderChain
 
-  ClassDef(AliReconstruction, 36)      // class for running the reconstruction
+  ClassDef(AliReconstruction, 37)      // class for running the reconstruction
 };
 
 #endif