ROOT logo
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.)
{

  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskLc2V0bachelor", "No analysis manager to connect to.");
    return NULL;
  }  
  
  if (writeVariableTree && trackRotation)
    trackRotation=kFALSE;

  // cuts are stored in a TFile generated by makeTFile4CutsLc2V0bachelor.C in ./macros/
  // set there the cuts!!!!!

  Bool_t stdcuts=kFALSE;
  TFile* filecuts;
  if( finname.EqualTo("") ) {
    stdcuts=kTRUE; 
  } else {
      filecuts=TFile::Open(finname.Data());
      if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
	AliFatal("Input file not found : check your cut object");
      }
  }

  cout << " Is it std on not std cut? " << stdcuts << endl;
  AliRDHFCutsLctoV0* RDHFCutsLctoV0anal = new AliRDHFCutsLctoV0();
  if (stdcuts) RDHFCutsLctoV0anal->SetStandardCutsPP2010();
  else RDHFCutsLctoV0anal = (AliRDHFCutsLctoV0*)filecuts->Get("LctoV0AnalysisCuts");
  RDHFCutsLctoV0anal->SetName("LctoV0AnalysisCuts");
  RDHFCutsLctoV0anal->SetMinPtCandidate(-1.);
  RDHFCutsLctoV0anal->SetMaxPtCandidate(10000.);


  // mm let's see if everything is ok
  if (!RDHFCutsLctoV0anal) {
    cout << "Specific AliRDHFCutsLctoV0 not found\n";
    return;
  }


  //CREATE THE TASK

  printf("CREATE TASK\n");
  AliAnalysisTaskSELc2V0bachelor *task = new AliAnalysisTaskSELc2V0bachelor("AliAnalysisTaskSELc2V0bachelor",RDHFCutsLctoV0anal,onTheFly,writeVariableTree,additionalChecks,trackRotation);
  task->SetAdditionalChecks(additionalChecks);
  task->SetMC(theMCon);
  task->SetK0SAnalysis(kTRUE);
  task->SetDebugLevel(0);
  task->SetNRotations(nRot);
  task->SetPtMinToFillTheTree(pTmin);
  task->SetPtMaxToFillTheTree(pTmax);
  task->SetMinAngleForRot(minRotAngle);
  task->SetMaxAngleForRot(maxRotAngle);
  mgr->AddTask(task);

  // Create and connect containers for input/output  
  TString outputfile = AliAnalysisManager::GetCommonFileName();
  outputfile += ":PWG3_D2H_Lc2pK0S_";
  outputfile += nTour;

  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());

  // ----- output data -----
  AliAnalysisDataContainer *coutput1   = mgr->CreateContainer(Form("chist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
  mgr->ConnectOutput(task,1,coutput1);
  AliAnalysisDataContainer *coutputLc2 = mgr->CreateContainer(Form("Lc2pK0Scounter%1d",nTour),AliNormalizationCounter::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); //counter
  mgr->ConnectOutput(task,2,coutputLc2);
  AliAnalysisDataContainer *coutputLc3 = mgr->CreateContainer(Form("Lc2pK0SCuts%1d",nTour),AliRDHFCutsLctoV0::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // cuts
  mgr->ConnectOutput(task,3,coutputLc3);
  if (!writeVariableTree) {
    AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("Lc2pK0SAll%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // production histos
    mgr->ConnectOutput(task,4,coutputLc4);
    AliAnalysisDataContainer *coutputLc5 = mgr->CreateContainer(Form("Lc2pK0SPIDBach%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); // analysis histos
    mgr->ConnectOutput(task,5,coutputLc5);

    if (trackRotation) {
      AliAnalysisDataContainer *coutputLc6 = mgr->CreateContainer(Form("Lc2pK0SPIDBachTR%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data()); // analysis histos
      mgr->ConnectOutput(task,6,coutputLc6);
    }

  } else {
    AliAnalysisDataContainer *coutputLc4 = mgr->CreateContainer(Form("Lc2pK0Svariables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // variables tree
    mgr->ConnectOutput(task,4,coutputLc4);
  }

  return task;

}
 AddTaskLc2V0bachelor.C:1
 AddTaskLc2V0bachelor.C:2
 AddTaskLc2V0bachelor.C:3
 AddTaskLc2V0bachelor.C:4
 AddTaskLc2V0bachelor.C:5
 AddTaskLc2V0bachelor.C:6
 AddTaskLc2V0bachelor.C:7
 AddTaskLc2V0bachelor.C:8
 AddTaskLc2V0bachelor.C:9
 AddTaskLc2V0bachelor.C:10
 AddTaskLc2V0bachelor.C:11
 AddTaskLc2V0bachelor.C:12
 AddTaskLc2V0bachelor.C:13
 AddTaskLc2V0bachelor.C:14
 AddTaskLc2V0bachelor.C:15
 AddTaskLc2V0bachelor.C:16
 AddTaskLc2V0bachelor.C:17
 AddTaskLc2V0bachelor.C:18
 AddTaskLc2V0bachelor.C:19
 AddTaskLc2V0bachelor.C:20
 AddTaskLc2V0bachelor.C:21
 AddTaskLc2V0bachelor.C:22
 AddTaskLc2V0bachelor.C:23
 AddTaskLc2V0bachelor.C:24
 AddTaskLc2V0bachelor.C:25
 AddTaskLc2V0bachelor.C:26
 AddTaskLc2V0bachelor.C:27
 AddTaskLc2V0bachelor.C:28
 AddTaskLc2V0bachelor.C:29
 AddTaskLc2V0bachelor.C:30
 AddTaskLc2V0bachelor.C:31
 AddTaskLc2V0bachelor.C:32
 AddTaskLc2V0bachelor.C:33
 AddTaskLc2V0bachelor.C:34
 AddTaskLc2V0bachelor.C:35
 AddTaskLc2V0bachelor.C:36
 AddTaskLc2V0bachelor.C:37
 AddTaskLc2V0bachelor.C:38
 AddTaskLc2V0bachelor.C:39
 AddTaskLc2V0bachelor.C:40
 AddTaskLc2V0bachelor.C:41
 AddTaskLc2V0bachelor.C:42
 AddTaskLc2V0bachelor.C:43
 AddTaskLc2V0bachelor.C:44
 AddTaskLc2V0bachelor.C:45
 AddTaskLc2V0bachelor.C:46
 AddTaskLc2V0bachelor.C:47
 AddTaskLc2V0bachelor.C:48
 AddTaskLc2V0bachelor.C:49
 AddTaskLc2V0bachelor.C:50
 AddTaskLc2V0bachelor.C:51
 AddTaskLc2V0bachelor.C:52
 AddTaskLc2V0bachelor.C:53
 AddTaskLc2V0bachelor.C:54
 AddTaskLc2V0bachelor.C:55
 AddTaskLc2V0bachelor.C:56
 AddTaskLc2V0bachelor.C:57
 AddTaskLc2V0bachelor.C:58
 AddTaskLc2V0bachelor.C:59
 AddTaskLc2V0bachelor.C:60
 AddTaskLc2V0bachelor.C:61
 AddTaskLc2V0bachelor.C:62
 AddTaskLc2V0bachelor.C:63
 AddTaskLc2V0bachelor.C:64
 AddTaskLc2V0bachelor.C:65
 AddTaskLc2V0bachelor.C:66
 AddTaskLc2V0bachelor.C:67
 AddTaskLc2V0bachelor.C:68
 AddTaskLc2V0bachelor.C:69
 AddTaskLc2V0bachelor.C:70
 AddTaskLc2V0bachelor.C:71
 AddTaskLc2V0bachelor.C:72
 AddTaskLc2V0bachelor.C:73
 AddTaskLc2V0bachelor.C:74
 AddTaskLc2V0bachelor.C:75
 AddTaskLc2V0bachelor.C:76
 AddTaskLc2V0bachelor.C:77
 AddTaskLc2V0bachelor.C:78
 AddTaskLc2V0bachelor.C:79
 AddTaskLc2V0bachelor.C:80
 AddTaskLc2V0bachelor.C:81
 AddTaskLc2V0bachelor.C:82
 AddTaskLc2V0bachelor.C:83
 AddTaskLc2V0bachelor.C:84
 AddTaskLc2V0bachelor.C:85
 AddTaskLc2V0bachelor.C:86
 AddTaskLc2V0bachelor.C:87
 AddTaskLc2V0bachelor.C:88
 AddTaskLc2V0bachelor.C:89
 AddTaskLc2V0bachelor.C:90
 AddTaskLc2V0bachelor.C:91
 AddTaskLc2V0bachelor.C:92
 AddTaskLc2V0bachelor.C:93
 AddTaskLc2V0bachelor.C:94
 AddTaskLc2V0bachelor.C:95
 AddTaskLc2V0bachelor.C:96
 AddTaskLc2V0bachelor.C:97
 AddTaskLc2V0bachelor.C:98
 AddTaskLc2V0bachelor.C:99
 AddTaskLc2V0bachelor.C:100
 AddTaskLc2V0bachelor.C:101
 AddTaskLc2V0bachelor.C:102