]> git.uio.no Git - u/mrichter/AliRoot.git/commit - ANALYSIS/AliAnalysisManager.h
From C.Loizides: Handle manual branch loading if requested by the user (via SetAutoBr...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Aug 2010 14:46:36 +0000 (14:46 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Aug 2010 14:46:36 +0000 (14:46 +0000)
commit012e169c3d033ddfd05ec17b9e7a15c9702fd4e0
treea92d3f482ad6537bb68d219f25d191321faf9141
parent818d8482650d3010d9cde96ea82cf568bfe38882
From C.Loizides: Handle manual branch loading if requested by the user (via SetAutoBranchLoading(kFALSE))
This turns off the usage of TTree::GetEntry, and uses TBranch::GetEntry. It relies on the fact that the user loads
the needed branches in his tasks on demand (via LoadBranch(brname))
This feature is disabled by default, and therefore the current use of the manager targeted at train mode persists.
The purpose is to speed up the analysis in case only a few branches are needed, and if cuts can be made based on quickly loadable information. For example, on my laptop with auto branch loading enabled takes about 8ms/event while with auto branch loading disabled (just loading the header and run info) only 0.8 ms (ie order of magnitude faster). For a more realistic case, with an actual track based analysis attached, a speed up of 2-3 was achieved.

Example:
//________________________________________________________________________
void AliAnalysisTaskPt::UserExec(Option_t *)
{
...
  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
  am->LoadBranch("AliESDHeader.");
  am->LoadBranch("AliESDRun.");

  /* should have meaningful check here, use dummy just to illustrate example*/
  if (some_condition_on_event_header_or_ESDRun_object) {
    return;
  }
  // We can load the interesting branches:
  am->LoadBranch("Tracks");

  // Track loop to fill a pT spectrum
  printf("There are %d tracks in this event\n", fESD->GetNumberOfTracks());
  ... track loop
ANALYSIS/AliAnalysisManager.cxx
ANALYSIS/AliAnalysisManager.h