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