]> git.uio.no Git - u/mrichter/AliRoot.git/commit - ANALYSIS/AliPhysicsSelection.cxx
A task can now declare the list of input branches that are requested during analysis.
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Nov 2010 10:59:27 +0000 (10:59 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Nov 2010 10:59:27 +0000 (10:59 +0000)
commit7acc5b9d84bb86bc31621712548a7ff1dde83fcc
tree83c4ef051bbf1bfa4b4af0ae0185716703ec62d8
parent94b94be09e4cf99a07c51d4f14d992aeaac964a1
A task can now declare the list of input branches that are requested during analysis.
The way to do this is to add in the constructor where the output slots are defined:
fBranchNames = "ESD:bre1,bre2,...,breN AOD:bra1,bra2,...,braM";
The declared branches are currently not loaded automatically, the list being only used to make sure we don't combine in a train tasks that are using the branch loading feature with others that expect the full event.
A task using this should manually request loading of needed branches during UserExec - see example below.
This commit modifies the AliPhysicsSelectionTask to use this feature, gaining a factor of 2 in speed when run standalone.
//________________________________________________________________________
AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name)
  : AliAnalysisTaskSE(name), fEvent(0), fOutputList(0), fHistPt(0)
{
  // Constructor

  // Define input and output slots here
  // Input slot #0 works with a TChain
  DefineInput(0, TChain::Class());
  // Output slot #0 id reserved by the base class for AOD
  // Output slot #1 writes into a TH1 container
  DefineOutput(1, TList::Class());
  fBranchNames = "ESD:AliESDRun.,AliESDHeader.,Tracks";
}
//________________________________________________________________________
void AliAnalysisTaskPt::UserExec(Option_t *)
{
  // Main loop
  // Called for each event

  // Post output data.
  fEvent = InputEvent();
  if (!fEvent) {
    printf("ERROR: Event not available\n");
    return;
  }

  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
  am->LoadBranch("AliESDHeader.");
  am->LoadBranch("AliESDRun.");

  // Track loop to fill a pT spectrum.
  am->LoadBranch("Tracks");
  Int_t ntracks = fEvent->GetNumberOfTracks();
  printf("There are %d tracks in this event\n", ntracks);
  for (Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
  ...
}
ANALYSIS/AliAnalysisAlien.cxx
ANALYSIS/AliAnalysisManager.cxx
ANALYSIS/AliAnalysisManager.h
ANALYSIS/AliAnalysisTask.cxx
ANALYSIS/AliAnalysisTask.h
ANALYSIS/AliPhysicsSelection.cxx
ANALYSIS/AliPhysicsSelectionTask.cxx
ANALYSIS/macros/AnalysisTrainNewFilterAOD.C