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