Exemplo n.º 1
0
//________________________________________________________________
Bool_t InputHandlerSetup(TString esdFName)
{
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  AliAnalysisDataContainer *cin = mgr->GetCommonInputContainer();
  if (cin) return;
  AliESDInputHandler *esdInputHandler = 
    dynamic_cast<AliESDInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
  if (!esdInputHandler) {
    Info("CustomAnalysisTaskInputSetup", "Creating esdInputHandler ...");
    esdInputHandler = new AliESDInputHandler();
    mgr->SetInputEventHandler(esdInputHandler);
  }
  esdInputHandler->SetFriendFileName(esdFName.Data());
  //  esdInputHandler->SetActiveBranches("ESDfriend*");
  esdInputHandler->SetReadFriends(kTRUE);
  return kTRUE;
}
Exemplo n.º 2
0
void Embedding(const char* dataset="collection.xml")
{
    
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  
  //load analysis framework
  gSystem->Load("libSTEERBase");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE
  
  gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS");

  // A task can be compiled dynamically with AClic
  gROOT->LoadMacro("AliPHOSEmbedding.cxx+g");
  
  // Connect to alien
  TString token = gSystem->Getenv("GRID_TOKEN") ;
  if (1) // token == "OK" ) 
    TGrid::Connect("alien://");
  else 
    AliInfo("You are not connected to the GRID") ; 
  cout << "Pi0Analysis: processing collection " << dataset << endl;
  
  // Create the chain
  TChain* chain = new TChain("esdTree");

  TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset));
  
  TAlienResult* result = collection->GetGridResult("",0 ,0);
  TList* rawFileList = result->GetFileInfoList();
  for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) {
    TFileInfo * fi =  static_cast<TFileInfo*>(rawFileList->At(counter)) ; 
    const char * rawFile = fi->GetCurrentUrl()->GetUrl() ;  
    printf("Processing %s\n", rawFile) ;
    chain->Add(rawFile);
    printf("Chain: %d entries.\n",chain->GetEntries()); 
  }
  TFileInfo * fi =  static_cast<TFileInfo*>(rawFileList->At(0));
  const char * fn = fi->GetCurrentUrl()->GetUrl() ;

  char runNum[7]; 
  for(Int_t i=0;i<6;i++)runNum[i]=fn[35+i] ;

  runNum[6]=0 ;
  Int_t iRunNum=atoi(runNum) ;
  printf("Run number=%d \n",iRunNum) ;

  //Run AOD simulation
  int nrun = atoi(runNum);
  int nevent = 0;
  int seed = 0;

  char sseed[1024];
  char sevent[1024];
  char sprocess[1024];
  char sfield[1024];
  char senergy[1024];

  sprintf(sevent,"");
  sprintf(sprocess,"");
  sprintf(sfield,"");
  sprintf(senergy,"");

  seed = 0;
  sprintf(sseed,"%d",seed);

  if (seed==0) {
    fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
    fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");
    fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
  } else {
    fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
    fprintf(stdout,"!!!  MC Seed is %d \n",seed);
    fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
  }
  
// set the seed environment variable
  gSystem->Setenv("CONFIG_SEED",sseed);
  gSystem->Setenv("CONFIG_RUN_TYPE","kPythia6"); // kPythia6 or kPhojet^M
  gSystem->Setenv("CONFIG_FIELD","k5kG");      // kNoField or k5kG^M
  gSystem->Setenv("CONFIG_ENERGY","2760");    // 900 or 10000 (GeV)
  gSystem->Setenv("DC_RUN",runNum);    //run number 
  

  char nSimEvents[55] ;
  sprintf(nSimEvents,"%d",chain->GetEntries());
  gSystem->Setenv("SIM_EVENTS",nSimEvents); 
  gSystem->Exec("mv geometry.root geometry_PHOS.root") ;
  gSystem->Exec("aliroot -b -q simrun.C > simrun.log 2>&1");
  gSystem->Exec("mv geometry_PHOS.root geometry.root") ;

  // Make the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("Pi0EmbeddingManager");
  
  // ESD input handler
  AliESDInputHandler* esdH = new AliESDInputHandler();
  esdH->SetReadFriends(kFALSE);
  mgr->SetInputEventHandler(esdH);

  // Output
  AliAODHandler* aodHandler   = new AliAODHandler();
  aodHandler->SetOutputFileName("AliAODout.root");
  mgr->SetOutputEventHandler(aodHandler);

  
  // Debug level
  mgr->SetDebugLevel(0);


  // Add physics selection
  gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE);

  gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask *taskCentrality = AddTaskCentrality() ;

  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
  AliEPSelectionTask *taskEP = AddTaskEventplane() ;

  // Add my task
  AliPHOSEmbedding *task1 = new AliPHOSEmbedding("Embedding");

  TChain* chainAOD = new TChain("aodTree");
  chainAOD->AddFile("AliAOD.root") ;
  task1->SetSignalChain(chainAOD) ;
  task1->SelectCollisionCandidates();


  TFile *fOldCalib = TFile::Open("OldCalibration.root");
  if(fOldCalib->IsOpen()){
    printf("\n\n...Adding PHOS calibration used in ESD production \n") ;
    char key[55] ;
    TH2F * hCalib[5] ;
    for(Int_t mod=0;mod<5; mod++){
      sprintf(key,"calibrationMod%d",mod) ;
      hCalib[mod] = (TH2F*)fOldCalib->Get(key) ;
    }
    task1->SetOldCalibration(hCalib) ;
    fOldCalib->Close() ;
  }

  mgr->AddTask(task1);
  
  // Create containers for input/output
  AliAnalysisDataContainer *cinput   = mgr->GetCommonInputContainer(); 
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("output0",
                      TTree::Class(), AliAnalysisManager::kOutputContainer);


  // Connect input/output
  mgr->ConnectInput(task1 , 0, cinput);
  mgr->ConnectOutput(task1, 0,coutput1);

  AliLog::SetClassDebugLevel("AliGeomManager", 10) ;

  AliCDBManager::Instance()->SetRun(iRunNum) ;
//  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB") ;
//  AliCDBManager::Instance()->SetDefaultStorage("raw://") ;
  AliCDBManager::Instance()->SetDefaultStorage("alien://folder=/alice/data/2010/OCDB") ;
  AliCDBManager::Instance()->SetSpecificStorage("PHOS/*/*",
                                                "local://OCDB");
printf("RunNunm===%d \n",iRunNum) ;
  

  if (mgr->InitAnalysis()) {
    mgr->PrintStatus();
    mgr->StartAnalysis("local", chain);
  }
  
  if(iRunNum<=137848){ //period 1
    gSystem->Exec("mv BadMap_LHC10h_period1.root BadMap_LHC10h.root") ;
  }
  else{
    gSystem->Exec("mv BadMap_LHC10h_period234.root BadMap_LHC10h.root") ;
  }
  gSystem->Exec("aliroot -b -q AnalyzeDiff.C> analyze3.log 2>&1");

}
Exemplo n.º 3
0
void runNorm(TString inputFileName = "AliAOD.root", Int_t nEvents = 1e6, TString beamConf = "p-Pb", Bool_t isESD = kFALSE, Bool_t isMC = kFALSE, Int_t debugLevel = 0)
{

  TStopwatch timer;
  timer.Start();
  
  // Check runing mode
  Int_t mode = GetMode(inputFileName);
  if(mode < 0){
    Error("runAnalysis","Please provide either an ESD/AOD root file or a collection of ESDs/AODs.");
    return;
  }
  
  // Load common libraries
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  gSystem->Load("libSTEERBase");
  //  gSystem->Load("libSTEER");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libEventMixing");
  gSystem->Load("libCORRFW");
  gSystem->Load("libPWGmuon"); 
  gSystem->Load("libPWGmuondep"); 
  
  gSystem->AddIncludePath(Form("-I\"%s/include\" -I\"%s/include\"", gSystem->ExpandPathName("$ALICE_ROOT"),gSystem->ExpandPathName("$ALICE_PHYSICS")));
  gROOT->ProcessLine(Form(".include %s/include %s/include", gSystem->ExpandPathName("$ALICE_ROOT"), gSystem->ExpandPathName("$ALICE_PHYSICS")));

  // Create input chain
  TChain* chain = CreateChain(inputFileName,isESD);
  if (!chain) return;
  
  // Create the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("MuonTask");
  
  if ( isESD) {
    // ESD input handler
    AliESDInputHandler* esdH = new AliESDInputHandler();
    esdH->SetReadFriends(kFALSE);
    mgr->SetInputEventHandler(esdH);
  }
  else {
    // AOD input handler
    AliAODInputHandler* aodH = new AliAODInputHandler();
    mgr->SetInputEventHandler(aodH);
  }

  TString dataType = mgr->GetInputEventHandler()->GetDataType();
  Info("runLocal",Form("Manager with %s",dataType.Data()));

 // Enable MC event handler for ESDs
  if ( isMC && isESD ){
    AliVEventHandler* handler = new AliMCEventHandler;
    mgr->SetMCtruthEventHandler(handler);
  }
  
  // event selection and centrality framework
  if ( isESD ){
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
    AliPhysicsSelectionTask* physicsSelection = AddTaskPhysicsSelection(isMC);
    if ( !physicsSelection ) {
      Error("runLocal","AliPhysicsSelectionTask not created!");
      return;
    }
  }
  if ( isESD ){
    // event centrality
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
    if ( !taskCentrality ) {
      Error("runLocal on ESD","AliCentralitySelectionTask not created!");
      return;
    }
    if ( isMC ) taskCentrality->SetMCInput();     
    //taskCentrality->SetPass(1); // remember to set the pass you are processing!!!
  }
  /*else {
    //Only on full AOD, it is possible to reprocess the centrality framework
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(kTRUE,kTRUE);
    if ( !taskCentrality ) {
      Error("runLocal on AOD","AliCentralitySelectionTask not created!");
      return;
    }
    if ( isMC ) taskCentrality->SetMCInput();    
    }*/
  
  // Example analysis
  // Create task
  //Analysis task is on working directory
  //  gROOT->LoadMacro("AliAnalysisTaskNorm.cxx+g");
  //  gROOT->LoadMacro("AddTaskNorm.C");
  gROOT->LoadMacro("$ALICE_PHYSICS/../src/PWG/muon/AliAnalysisTaskNorm.cxx+g");
  gROOT->LoadMacro("$ALICE_PHYSICS/../src/PWG/muon/AddTaskNorm.C");
  AliAnalysisTaskNorm* task = AddTaskNorm(isESD,isMC,beamConf);
  if (!task) {
    Error("runAnalysis","AliAnalysisTaskNorm not created!");
    return;
  }
  task->SetDebugLevel(debugLevel);
  
  // Enable debug printouts
  mgr->SetDebugLevel(debugLevel);

  // start local analysis
  if (mgr->InitAnalysis()) {
    mgr->PrintStatus();
    if(debugLevel>=2) mgr->SetNSysInfo(100);
    mgr->StartAnalysis("local", chain, nEvents);
  }

  if(debugLevel>=2){
    mgr->ProfileTask("Task");
  }

  timer.Stop();
  timer.Print();
}
Exemplo n.º 4
0
void anaCaloFilter(Int_t mode=mLocal)
{
  // Main
  char cmd[200] ; 
  sprintf(cmd, ".! rm -rf AliAOD.root") ; 
  gROOT->ProcessLine(cmd) ; 
  //--------------------------------------------------------------------
  // Load analysis libraries
  // Look at the method below, 
  // change whatever you need for your analysis case
  // ------------------------------------------------------------------
  LoadLibraries(mode) ;
  
  //-------------------------------------------------------------------------------------------------
  //Create chain from ESD and from cross sections files, look below for options.
  //-------------------------------------------------------------------------------------------------
  if(kInputData == "ESD") kTreeName = "esdTree" ;
  else if(kInputData == "AOD") kTreeName = "aodTree" ;
  else {
    cout<<"Wrong  data type "<<kInputData<<endl;
    break;
  }
  
  TChain *chain       = new TChain(kTreeName) ;
  CreateChain(mode, chain);  
  
  if(chain){
    AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen
    
    //--------------------------------------
    // Make the analysis manager
    //-------------------------------------
    AliAnalysisManager *mgr  = new AliAnalysisManager("Manager", "Manager");
    
    // AOD output handler
    AliAODHandler* aodoutHandler   = new AliAODHandler();
    aodoutHandler->SetOutputFileName("AliAOD.root");
    ////aodoutHandler->SetCreateNonStandardAOD();
    mgr->SetOutputEventHandler(aodoutHandler);
    
    //input
    if(kInputData == "ESD")
    {
      // ESD handler
      AliESDInputHandler *esdHandler = new AliESDInputHandler();
      mgr->SetInputEventHandler(esdHandler);
      esdHandler->SetReadFriends(kFALSE);
      cout<<"ESD handler "<<mgr->GetInputEventHandler()<<endl;
    }
    if(kInputData == "AOD")
    {
      // AOD handler
      AliAODInputHandler *aodHandler = new AliAODInputHandler();
      mgr->SetInputEventHandler(aodHandler);
      cout<<"AOD handler "<<mgr->GetInputEventHandler()<<endl;
      
    }
    
    // mgr->SetDebugLevel(1);
    
    //-------------------------------------------------------------------------
    //Define task, put here any other task that you want to use.
    //-------------------------------------------------------------------------    
    // ESD physics selection task
    if(kInputData == "ESD" && kUsePhysSel)
    {
      gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
      AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
    }
    
    gROOT->LoadMacro("AddTaskCaloFilter.C");
    AliAnalysisTaskCaloFilter* filter = AddTaskCaloFilter();
            
    //AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter();
    //filter->SetConfigFileName("ConfigCaloFilter.C");
    //mgr->AddTask(filter);
      
    // Create containers for input/output
    AliAnalysisDataContainer *cinput1    = mgr->GetCommonInputContainer();
    AliAnalysisDataContainer *coutput1   = mgr->GetCommonOutputContainer();
    AliAnalysisDataContainer *coutntuple = mgr->CreateContainer("EventNtuple", TNtuple::Class(), 
                                                                AliAnalysisManager::kOutputContainer, "eventselection.root");
    
    mgr->ConnectInput  (filter, 0, cinput1);
    mgr->ConnectOutput (filter, 0, coutput1 );
    mgr->ConnectOutput (filter, 1, coutntuple );
    
    //-----------------------
    // Run the analysis
    //-----------------------    
    TString smode = "";
    if (mode==mLocal || mode == mLocalCAF) 
      smode = "local";
    else if (mode==mPROOF) 
      smode = "proof";
    else if (mode==mGRID) 
      smode = "local";
    
    mgr->InitAnalysis();
    mgr->PrintStatus();
    mgr->StartAnalysis(smode.Data(),chain);
    
    cout <<" Analysis ended sucessfully "<< endl ;
    
  }
  else cout << "Chain was not produced ! "<<endl;
  
  //sprintf(cmd, ".! rm -rf CorrectionFiles") ;
  
}
Exemplo n.º 5
0
void CPVanalysis(const TString dataset="")
{
    
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  
  //load analysis framework
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE
  
  gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS");

  // A task can be compiled dynamically with AClic
  gROOT->LoadMacro("AliAnalysisTaskCPV.cxx+g");
  
  // Connect to alien
  TString token = gSystem->Getenv("GRID_TOKEN") ;
  token="OK";
  if ( token == "OK" ) 
    TGrid::Connect("alien://");
  else 
    Printf("You are not connected to the GRID") ; 
    // AliInfo("You are not connected to the GRID") ; 

  cout << "CPVanalysis: processing collection " << dataset << endl;
  
  // Create the chain
    TChain* chain;

  if (dataset.Contains(".txt")) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/CreateESDChain.C");
    chain = CreateESDChain(dataset.Data(), 1000);
  }
  else if (dataset.Contains(".xml")) {
    chain = new TChain("esdTree");
    TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset));
  
    TAlienResult* result = collection->GetGridResult("",0 ,0);
    TList* rawFileList = result->GetFileInfoList();
    
    for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) {
      TFileInfo * fi =  static_cast<TFileInfo*>(rawFileList->At(counter)) ; 
      const char * rawFile = fi->GetCurrentUrl()->GetUrl() ;  
      printf("Processing %s\n", rawFile) ;
      chain->Add(rawFile);
      printf("Chain: %d entries.\n",chain->GetEntries()); 
    }
  }
  
  // Make the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("CPVanalysis");
  
  // ESD input handler
  AliESDInputHandler* esdH = new AliESDInputHandler();
  esdH->SetReadFriends(kFALSE);
  mgr->SetInputEventHandler(esdH);
  
  // Debug level
  mgr->SetDebugLevel(0);
  
  //PID task
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AliAnalysisTask *taskPID =  AddTaskPIDResponse(/*Bool_t isMC=*/ kFALSE, /*Bool_t autoMCesd=*/kTRUE,
						 /*Bool_t tuneOnData=*/kTRUE);

  // // Add physics selection
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
  physSelTask->GetPhysicsSelection()->SetUseBXNumbers(kFALSE);// ---> ???

  // Add my task
  AliAnalysisTaskCPV *task1 = new AliAnalysisTaskCPV("CPVanalysis");

  // task1->SelectCollisionCandidates(AliVEvent::kMB);
  mgr->AddTask(task1);
  
  // Create containers for input/output
  AliAnalysisDataContainer *cinput   = mgr->GetCommonInputContainer(); 
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histCPV1",TList::Class(),AliAnalysisManager::kOutputContainer,"CPVanalysis.root");
  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histCPV2",TList::Class(),AliAnalysisManager::kOutputContainer,"CPVanalysis.root");

  ((AliInputEventHandler*)mgr->GetInputEventHandler())->SetNeedField(1);


  // Connect input/output
  mgr->ConnectInput(task1 , 0, cinput);
  mgr->ConnectOutput(task1, 1, coutput1);
  mgr->ConnectOutput(task1, 2, coutput2);
  
  if (mgr->InitAnalysis()) {
    mgr->PrintStatus();
    mgr->StartAnalysis("local", chain);
  }
  
}
Exemplo n.º 6
0
void AliAnalysisTaskFilteredTest(const char *esdList,
                                 Int_t run = 0,
                                 Float_t scalingTracks = 1,
                                 Float_t scalingV0 = 1,
                                 Float_t scalingFriend = 1,
                                 const char *ocdb = "cvmfs://",
                                 Int_t nFiles = 100000,
                                 Int_t firstFile = 0,
                                 Int_t nEvents = 1000000000,
                                 Int_t firstEvent = 0,
                                 Bool_t mc = kFALSE)
{
    TStopwatch timer;
    timer.Start();
 
    printf("\n\n\n");
    printf("scalingTracks=%d\n",scalingTracks);
    printf("scalingV0=%d\n",scalingV0);
    printf("nFiles=%d\n",nFiles);

    gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD");

    //____________________________________________//
    // Make the analysis manager
    AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
    mgr->SetDebugLevel(0);

    AliESDInputHandler* esdH = new AliESDInputHandler();
    //esdH->SetReadFriends(1);
    esdH->SetReadFriends(1);
    mgr->SetInputEventHandler(esdH);  

    // Enable MC event handler
    AliMCEventHandler* handlerMC = new AliMCEventHandler;
    //handler->SetReadTR(kFALSE);
    if (mc) mgr->SetMCtruthEventHandler(handlerMC);

    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C");
    AddTaskCDBconnect(ocdb,run);

    if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) {
      gROOT->LoadMacro("localOCDBaccessConfig.C");
      localOCDBaccessConfig();
    }
    // Create input chain
    TChain* chain = AliXRDPROOFtoolkit::MakeChain(esdList, "esdTree",0,nFiles,firstFile);

    if(!chain) {
        printf("ERROR: chain cannot be created\n");
        return;
    }
    chain->Lookup();
  

    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
    Bool_t isMC=kFALSE; // kTRUE in case of MC
    AddTaskPIDResponse(isMC); 

    //
    // Wagons to run 
    //
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskFilteredTree.C");
    AliAnalysisTaskFilteredTree* task = (AliAnalysisTaskFilteredTree*)AddTaskFilteredTree("Filtered.root");
    task->SetLowPtTrackDownscaligF(scalingTracks);
    task->SetLowPtV0DownscaligF(scalingV0);
    task->SetFriendDownscaling(scalingFriend);
    task->SetUseESDfriends(kTRUE);
    task->Dump();
    // Init
    if (!mgr->InitAnalysis()) 
        mgr->PrintStatus();
    //
    // Run on dataset
    mgr->StartAnalysis("local",chain,nEvents, firstEvent);
    timer.Stop();
    timer.Print();
    delete mgr;
    CheckOutput();
}