AliPhysics  vAN-20151012 (2287573)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AddTaskLc2V0bachelor.C
Go to the documentation of this file.
1 AliAnalysisTaskSELc2V0bachelor *AddTaskLc2V0bachelor(TString finname="Lc2V0bachelorCuts.root",
2  Bool_t theMCon=kFALSE,
3  Bool_t onTheFly=kFALSE,
4  Bool_t writeVariableTree=kTRUE,
5  Int_t nTour=0,
6  Bool_t additionalChecks=kFALSE,
7  Bool_t trackRotation=kFALSE,
8  Int_t nRot=9,
9  Double_t pTmin=0.,
10  Double_t pTmax=999.,
11  Double_t minRotAngle=5.*TMath::Pi()/6.,
12  Double_t maxRotAngle=7.*TMath::Pi()/6.,
13  Bool_t useTPCpidToFillTree=kFALSE,
14  Char_t sign=2)
15 {
16 
17  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
18  if (!mgr) {
19  ::Error("AddTaskLc2V0bachelor", "No analysis manager to connect to.");
20  return NULL;
21  }
22 
23  if (writeVariableTree && trackRotation)
24  trackRotation=kFALSE;
25 
26  // cuts are stored in a TFile generated by makeTFile4CutsLc2V0bachelor.C in ./macros/
27  // set there the cuts!!!!!
28 
29  Bool_t stdcuts=kFALSE;
30  TFile* filecuts;
31  if( finname.EqualTo("") ) {
32  stdcuts=kTRUE;
33  } else {
34  filecuts=TFile::Open(finname.Data());
35  if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
36  AliFatal("Input file not found : check your cut object");
37  }
38  }
39 
40  cout << " Is it std on not std cut? " << stdcuts << endl;
41  AliRDHFCutsLctoV0* RDHFCutsLctoV0anal = new AliRDHFCutsLctoV0();
42  if (stdcuts) RDHFCutsLctoV0anal->SetStandardCutsPP2010();
43  else RDHFCutsLctoV0anal = (AliRDHFCutsLctoV0*)filecuts->Get("LctoV0AnalysisCuts");
44  RDHFCutsLctoV0anal->SetName("LctoV0AnalysisCuts");
45  RDHFCutsLctoV0anal->SetMinPtCandidate(-1.);
46  RDHFCutsLctoV0anal->SetMaxPtCandidate(10000.);
47 
48 
49  // mm let's see if everything is ok
50  if (!RDHFCutsLctoV0anal) {
51  cout << "Specific AliRDHFCutsLctoV0 not found\n";
52  return;
53  }
54 
55 
56  //CREATE THE TASK
57 
58  if (writeVariableTree) sign=2;
59 
60  printf("CREATE TASK\n");
61  AliAnalysisTaskSELc2V0bachelor *task = new AliAnalysisTaskSELc2V0bachelor("AliAnalysisTaskSELc2V0bachelor",RDHFCutsLctoV0anal,onTheFly,writeVariableTree,additionalChecks,trackRotation,useTPCpidToFillTree,sign);
62  task->SetAdditionalChecks(additionalChecks);
63  task->SetMC(theMCon);
64  task->SetDebugLevel(0);
65  task->SetNRotations(nRot);
66  task->SetPtMinToFillTheTree(pTmin);
67  task->SetPtMaxToFillTheTree(pTmax);
68  task->SetMinAngleForRot(minRotAngle);
69  task->SetMaxAngleForRot(maxRotAngle);
70  mgr->AddTask(task);
71 
72  // Create and connect containers for input/output
73  TString outputfile = AliAnalysisManager::GetCommonFileName();
74  outputfile += ":PWG3_D2H_Lc2pK0S_";
75  outputfile += nTour;
76  if (sign==0) outputfile += "pos";
77  else if (sign==1) outputfile += "neg";
78 
79  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
80 
81  // ----- output data -----
82  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("chist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
83  mgr->ConnectOutput(task,1,coutput1);
84  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Lc2pK0Scounter%1d",nTour),AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
85  mgr->ConnectOutput(task,2,coutputLc2);
86  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("Lc2pK0SCuts%1d",nTour),AliRDHFCutsLctoV0::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
87  mgr->ConnectOutput(task,3,coutputLc3);
88  if (!writeVariableTree) {
89  AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("Lc2pK0SAll%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // production histos
90  mgr->ConnectOutput(task,4,coutputLc4);
91  AliAnalysisDataContainer *coutputLc5 = mgr->CreateContainer(Form("Lc2pK0SPIDBach%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); // analysis histos
92  mgr->ConnectOutput(task,5,coutputLc5);
93 
94  if (trackRotation) {
95  AliAnalysisDataContainer *coutputLc6 = mgr->CreateContainer(Form("Lc2pK0SPIDBachTR%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); // analysis histos
96  mgr->ConnectOutput(task,6,coutputLc6);
97  }
98 
99  } else {
100  AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("Lc2pK0Svariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
101  mgr->ConnectOutput(task,4,coutputLc4);
102  }
103 
104  return task;
105 
106 }
void SetAdditionalChecks(Bool_t additionalChecks)
set flag for additional checks
virtual void SetStandardCutsPP2010()
void SetPtMaxToFillTheTree(Double_t pTmax=999.)
void SetMC(Bool_t theMCon)
set MC usage
void SetMinAngleForRot(Double_t min=5.*TMath::Pi()/6.)
void SetMaxPtCandidate(Double_t ptCand=1000.)
Definition: AliRDHFCuts.h:216
void SetMinPtCandidate(Double_t ptCand=-1.)
Definition: AliRDHFCuts.h:215
void SetMaxAngleForRot(Double_t max=7.*TMath::Pi()/6.)
AliAnalysisTaskSELc2V0bachelor * AddTaskLc2V0bachelor(TString finname="Lc2V0bachelorCuts.root", Bool_t theMCon=kFALSE, Bool_t onTheFly=kFALSE, Bool_t writeVariableTree=kTRUE, Int_t nTour=0, Bool_t additionalChecks=kFALSE, Bool_t trackRotation=kFALSE, Int_t nRot=9, Double_t pTmin=0., Double_t pTmax=999., Double_t minRotAngle=5.*TMath::Pi()/6., Double_t maxRotAngle=7.*TMath::Pi()/6., Bool_t useTPCpidToFillTree=kFALSE, Char_t sign=2)