AliPhysics  c7b8e89 (c7b8e89)
AddTaskSelectHF4Prong.C
Go to the documentation of this file.
2 {
3  //
4  // Test macro for the AliAnalysisTaskSE for heavy-flavour selection
5  // and creation of a stand-alone AOD
6  // A.Dainese, andrea.dainese@lnl.infn.it
7  // F.Colamaria, fabio.colamaria@ba.infn.it
8  //
9 
10  // Get the pointer to the existing analysis manager via the static access method.
11  //==============================================================================
12  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13  if (!mgr) {
14  ::Error("AddTaskSelectHF4Prong", "No analysis manager to connect to.");
15  return NULL;
16  }
17 
18  // Output
19  AliAODHandler *aodHandler = new AliAODHandler();
20  aodHandler->SetOutputFileName("AliAOD.VertexingHF.sa.root");
21  aodHandler->SetCreateNonStandardAOD();
22  mgr->SetOutputEventHandler(aodHandler);
23 
24  //Cuts loading
25  TFile* filecuts=TFile::Open("Charm4ProngCutsDef.root");
26  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
27  cout<<"Input file not found: exit"<<endl;
28  return;
29  }
30 
31  AliRDHFCutsD0toKpipipi* RDHFCharm4Prong=new AliRDHFCutsD0toKpipipi();
32  RDHFCharm4Prong = (AliRDHFCutsD0toKpipipi*)filecuts->Get("Charm4ProngCuts");
33  RDHFCharm4Prong->SetName(Form("Charm4ProngCuts%d",1));
34 
35  if(!RDHFCharm4Prong){
36  cout<<"Specific AliRDHFCuts not found"<<endl;
37  return;
38  }
39 
40  // Analysis task
41  AliAnalysisTaskSESelectHF4Prong *hfTask = new AliAnalysisTaskSESelectHF4Prong("SelectHFAnalysis",RDHFCharm4Prong);
42  hfTask->SetDebugLevel(2);
43  mgr->AddTask(hfTask);
44 
45  // Create containers for input/output
46  mgr->ConnectInput(hfTask,0,mgr->GetCommonInputContainer());
47 
48  AliAnalysisDataContainer *contHist = mgr->CreateContainer("histos_bin1",TList::Class(),AliAnalysisManager::kOutputContainer,"HistMassInvAndCuts.root");
49  AliAnalysisDataContainer *contHist2 = mgr->CreateContainer("histos_bin2",TList::Class(),AliAnalysisManager::kOutputContainer,"HistMassInvAndCuts.root");
50  AliAnalysisDataContainer *contHist3 = mgr->CreateContainer("histos_bin3",TList::Class(),AliAnalysisManager::kOutputContainer,"HistMassInvAndCuts.root");
51  AliAnalysisDataContainer *contHist4 = mgr->CreateContainer("histos_bin4",TList::Class(),AliAnalysisManager::kOutputContainer,"HistMassInvAndCuts.root");
52  AliAnalysisDataContainer *contHist5 = mgr->CreateContainer("histos_bin5",TList::Class(),AliAnalysisManager::kOutputContainer,"HistMassInvAndCuts.root");
53  AliAnalysisDataContainer *contHistCuts = mgr->CreateContainer("histoscuts",TList::Class(),AliAnalysisManager::kOutputContainer,"HistMassInvAndCuts.root");
54 
55  mgr->ConnectOutput(hfTask,0,mgr->GetCommonOutputContainer());
56  mgr->ConnectOutput(hfTask,1,contHist);
57  mgr->ConnectOutput(hfTask,2,contHist2);
58  mgr->ConnectOutput(hfTask,3,contHist3);
59  mgr->ConnectOutput(hfTask,4,contHist4);
60  mgr->ConnectOutput(hfTask,5,contHist5);
61  mgr->ConnectOutput(hfTask,6,contHistCuts);
62 
63  return hfTask;
64 }
AliAnalysisTaskSESelectHF4Prong * AddTaskSelectHF4Prong()