Example #1
0
void MSFT_AddSPmethod(char *name, TString myFolder, char *thecuts, int harmonic,
		      AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL,
		      char *Qvector) {
  TString fileName = AliAnalysisManager::GetCommonFileName();
  myFolder.Append( Form("v%d",harmonic) );
  TString myNameSP = Form("%sv%d%s_%s", name, harmonic, Qvector, thecuts);
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  AliAnalysisDataContainer *flowEvent2 
    = mgr->CreateContainer( Form("Filter_%s", myNameSP.Data()),
			    AliFlowEventSimple::Class(),
			    AliAnalysisManager::kExchangeContainer );
  AliAnalysisTaskFilterFE *tskFilter 
    = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myNameSP.Data()),
				   NULL, cutsPOI);
  tskFilter->SetSubeventEtaRange( -5.0, -1.0, 1.0, +5.0 );
  mgr->AddTask(tskFilter);
  mgr->ConnectInput( tskFilter, 0, flowEvent);
  mgr->ConnectOutput(tskFilter, 1, flowEvent2);
  AliAnalysisDataContainer *outSP 
    = mgr->CreateContainer( myNameSP.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,
			    Form("%s:FlowCascade_SP_%s",fileName.Data(),myFolder.Data()) );
  AliAnalysisTaskScalarProduct *tskSP 
    = new AliAnalysisTaskScalarProduct( Form("TaskScalarProduct_%s",myNameSP.Data()),kFALSE);
  tskSP->SetApplyCorrectionForNUA(kTRUE);
  tskSP->SetHarmonic(harmonic);
  tskSP->SetTotalQvector(Qvector);
  tskSP->SetBookOnlyBasicCCH(kTRUE);
  mgr->AddTask(tskSP);
  mgr->ConnectInput( tskSP,0,flowEvent2);
  mgr->ConnectOutput(tskSP,1,outSP);
}
AliAnalysisTaskStrangenessVsMultiplicityMC *AddTaskStrangenessVsMultiplicityMC( Bool_t lSaveV0 = kFALSE, Bool_t lSaveCascade = kTRUE, const TString lMasterJobSessionFlag = "")
{
// Creates, configures and attaches to the train a cascades check task.
   // Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
      ::Error("AddTaskStrangenessVsMultiplicity", "No analysis manager to connect to.");
      return NULL;
   }   

   // Check the analysis type using the event handlers connected to the analysis manager.
   //==============================================================================
   if (!mgr->GetInputEventHandler()) {
      ::Error("AddTaskStrangenessVsMultiplicity", "This task requires an input event handler");
      return NULL;
   }   
   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"

  // Create and configure the task
  AliAnalysisTaskStrangenessVsMultiplicityMC *taskAuxiliary = new AliAnalysisTaskStrangenessVsMultiplicityMC("taskAuxiliary");
  mgr->AddTask(taskAuxiliary);
  TString outputFileName = AliAnalysisManager::GetCommonFileName();
   
  outputFileName += ":PWGLF_StrVsMult";
  if (mgr->GetMCtruthEventHandler()) outputFileName += "_MC";
   
  Printf("Set OutputFileName : \n %s\n", outputFileName.Data() );

  AliAnalysisDataContainer *coutputList = mgr->CreateContainer("cList",
							     TList::Class(),
							     AliAnalysisManager::kOutputContainer,
							     outputFileName );
  AliAnalysisDataContainer *coutputTree = mgr->CreateContainer("cTreeEvent",
  					       TTree::Class(),
						       AliAnalysisManager::kOutputContainer,
						       outputFileName );
  AliAnalysisDataContainer *coutputTreeV0 = mgr->CreateContainer("cTreeV0",
  					       TTree::Class(),
						       AliAnalysisManager::kOutputContainer,
						       outputFileName );
  AliAnalysisDataContainer *coutputTreeCascade = mgr->CreateContainer("cTreeCascade",
  					       TTree::Class(),
						       AliAnalysisManager::kOutputContainer,
						       outputFileName );
   
  //This one you should merge in file-resident ways...
  coutputTree->SetSpecialOutput();
  coutputTreeV0->SetSpecialOutput();
  coutputTreeCascade->SetSpecialOutput();

  //Recommendation: Tree as a single output slot
  mgr->ConnectInput (taskAuxiliary, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(taskAuxiliary, 1, coutputList);
  mgr->ConnectOutput(taskAuxiliary, 2, coutputTree);
  mgr->ConnectOutput(taskAuxiliary, 3, coutputTreeV0);
  mgr->ConnectOutput(taskAuxiliary, 4, coutputTreeCascade);
  
  return taskAuxiliary;
}   
Example #3
0
void MSFT_AddQCmethod(char *name, TString myFolder, char *thecuts, int harmonic, 
		      AliAnalysisDataContainer *flowEvent, 
		      AliFlowTrackSimpleCuts *cutsPOI=NULL) {
  TString fileName = AliAnalysisManager::GetCommonFileName();
  myFolder.Append( Form("v%d",harmonic) );
  TString myName = Form("%sv%d_%s", name, harmonic, thecuts);
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  AliAnalysisDataContainer *flowEvent2 
    = mgr->CreateContainer( Form("Filter_%s", myName.Data()),
			    AliFlowEventSimple::Class(),
			    AliAnalysisManager::kExchangeContainer );
  AliAnalysisTaskFilterFE *tskFilter 
    = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myName.Data()),
				   NULL, cutsPOI);
  mgr->AddTask(tskFilter);
  mgr->ConnectInput( tskFilter, 0, flowEvent);
  mgr->ConnectOutput(tskFilter, 1, flowEvent2);

  AliAnalysisDataContainer *outQC 
    = mgr->CreateContainer( myName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer,
			    Form("%s:FlowCascade_QC_%s", fileName.Data(), myFolder.Data()) );
  AliAnalysisTaskQCumulants *tskQC 
    = new AliAnalysisTaskQCumulants( Form("TaskQCumulants_%s",myName.Data()),kFALSE );
  tskQC->SetApplyCorrectionForNUA(kTRUE);
  tskQC->SetHarmonic(harmonic);
  tskQC->SetBookOnlyBasicCCH(kTRUE);
  mgr->AddTask(tskQC);
  mgr->ConnectInput( tskQC, 0, flowEvent2);
  mgr->ConnectOutput(tskQC, 1, outQC);
}
void AddClusterSelectionTask(TString name = "ClusterSelectionTask")
{
    gSystem->AddIncludePath("-I$ALICE_ROOT/include");

    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
    if (!mgr) {
        ::Error("AddTaskPHOSPi0Flow", "No analysis manager to connect to");
        return NULL;
    }

    if (!mgr->GetInputEventHandler()) {
        ::Error("AddTaskPHOSPi0Flow", "This task requires an input event handler");
        return NULL;
    }

    gROOT->LoadMacro("ClusterSelectionTask.cxx+g");
    ClusterSelectionTask * task = new ClusterSelectionTask(name);

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

    TString cname(Form("HistList", name));
    TString pname(Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name));
    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(cname.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, pname.Data());
    mgr->ConnectOutput(task, 1, coutput1);

    cname = Form("SelectedPhotons", name);
    AliAnalysisDataContainer *cexchange2 = mgr->CreateContainer(cname.Data(), TList::Class(), AliAnalysisManager::kExchangeContainer, pname.Data());
    mgr->ConnectOutput(task, 2, cexchange2);

    return task;
}
AliAnalysisTaskSEF01710fromAODtracks *AddTaskF01710fromAODtracks(
    Int_t antype = 0,
    Bool_t theMCon=kFALSE,
    Bool_t writeVariableTree=kFALSE,
    Int_t nTour=0
    )

{

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

  //CREATE THE TASK
  printf("CREATE TASK\n");
  AliAnalysisTaskSEF01710fromAODtracks *task = new AliAnalysisTaskSEF01710fromAODtracks("AliAnalysisTaskSEF01710fromAODtracks",writeVariableTree);
  task->SetMC(theMCon);
  task->SetDebugLevel(1);
  task->SetAnalysisType(antype);

  if(antype==2 || antype == 3){
    task->SetProdV0DaughterDcaToPrimVertex(0.1);
    task->SetProdRfidMinV0(5.);
  }

  task->SetEventMixingWithPools();
  //task->SetEventMixingOff();

  Double_t pvzbinlimits[] = {-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12};
  Int_t pvzbinnumb = sizeof(pvzbinlimits)/sizeof(Double_t) - 1;
  task->SetPoolPVzBinLimits(pvzbinnumb,pvzbinlimits);

  Double_t cent_mult_binlimitspp[] = { 0,100};
  Int_t cent_mult_bin_numbpp = sizeof(cent_mult_binlimitspp)/sizeof(Double_t) - 1;
  task->SetPoolCentBinLimits(cent_mult_bin_numbpp,cent_mult_binlimitspp);
  task->SetNumberOfEventsForMixing(10);//pp

  mgr->AddTask(task);

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

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

  // ----- output data -----
  AliAnalysisDataContainer *coutput1   = mgr->CreateContainer(Form("f0hist%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
  mgr->ConnectOutput(task,1,coutput1);
  AliAnalysisDataContainer *coutputL2 = mgr->CreateContainer(Form("F0variables%1d",nTour),TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); 
  mgr->ConnectOutput(task,2,coutputL2);
  AliAnalysisDataContainer *coutputL3 = mgr->CreateContainer(Form("F0All%1d",nTour),TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data()); // general histos
  mgr->ConnectOutput(task,3,coutputL3);

  return task;

}
Example #6
0
AliAnalysisTask *RegisterTaskPID2(Bool_t useMC, Bool_t isAOD, Int_t tpcCls=120, Int_t tpcClsPID = 80, 
                  Int_t itsCls=4, Double_t dcaxy=1.0, Double_t dcaz=2.0, 
                  Double_t tpcs=-0.0113, Double_t tpcu=3.09, 
                  Double_t tofs=3., Int_t tofm=0,
                  Int_t itshitpixel = AliHFEextraCuts::kBoth, 
                  Bool_t withetacorrection = kTRUE,
                  Int_t TRDtrigger=0){

  gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/hfe/macros/configs/pPb/ConfigHFEmbpPb.C");
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
  AliAnalysisTaskHFE *task = ConfigHFEmbpPb(useMC, isAOD, tpcCls, tpcClsPID, itsCls, dcaxy, dcaz,
					     tpcs,tpcu,tofs,tofm,3.,kFALSE,kTRUE,kFALSE,itshitpixel,withetacorrection,0,TRDtrigger);

  if(isAOD)
    task->SetAODAnalysis();
  else
    task->SetESDAnalysis();

  if (useMC)
    task->SetHasMCData(kTRUE);
  else{
    task->SetHasMCData(kFALSE);
  }

  if(TRDtrigger<2) task->SelectCollisionCandidates(AliVEvent::kINT7);
  else task->SelectCollisionCandidates(AliVEvent::kTRD);

  Int_t idcaxy = (Int_t)(dcaxy*10.);
  Int_t idcaz = (Int_t)(dcaz*10.);
  Int_t itpcs = (Int_t)(tpcs*1000.);
  Int_t itofs = (Int_t)(tofs*10.);
  Int_t ipixelany = itshitpixel;
  Int_t ietacorr = 0;
  if(withetacorrection) ietacorr = 1;
  
  TString appendix(TString::Format("mbTPCc%dTPCp%dITS%dDCAr%dz%dTPCs%dTOFs%dm%ipa%dtrdt%d",tpcCls,
				   tpcClsPID,itsCls,idcaxy,idcaz,itpcs,itofs,tofm,ipixelany,TRDtrigger));
  printf("Add macro appendix %s\n", appendix.Data());

  TString containerName = mgr->GetCommonFileName();
  containerName += ":HFEtask";
  containerName += appendix.Data();
  printf("container name: %s\n", containerName.Data());

  //create data containers
  task->ConnectOutput(1, mgr->CreateContainer(Form("HFE_Results_%s", appendix.Data()), 
					      TList::Class(), AliAnalysisManager::kOutputContainer, 
					      containerName.Data()));
  task->ConnectOutput(2, mgr->CreateContainer(Form("HFE_QA_%s", appendix.Data()), TList::Class(), 
					      AliAnalysisManager::kOutputContainer, 
					      containerName.Data()));
  mgr->ConnectInput(task,  0, cinput );

  mgr->AddTask(task);
  return NULL;
}
AliAnalysisTaskPrepareInputForEmbedding *AddTaskPrepareInputForEmbedding(
   TString njet = "Jet_AKTChargedR040_PicoTracks_pT0150_E_scheme",
   /*TString njetClosest = "Jet_AKTChargedR040_MCParticlesSelected_pT0150_E_scheme",*/
   Double_t R = 0.4,
   Double_t jetptcut = 1,
   Double_t jetareacut = 0.6,
   TString ntrack = "PicoTracks", 
   TString accType = "TPC", 
   Bool_t  useLeadingJet = kFALSE,
   Bool_t  usedHCtagging = kFALSE){
   
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr){
      Error("AddTaskPrepareInputForEmbedding","No analysis manager found.");
      return 0;
   }
   if (!mgr->GetInputEventHandler())
    {
      ::Error("AddTaskPrepareInputForEmbedding", "This task requires an input event handler");
      return NULL;
    }
    TString wagonName = Form("PrepareInputForEmbedding%s%s", useLeadingJet ? "L" : "", usedHCtagging ? "HC" : "");
    AliAnalysisTaskPrepareInputForEmbedding *task = new AliAnalysisTaskPrepareInputForEmbedding(wagonName);
    
    task->SetLeadingJetOnly(useLeadingJet);
    task->SetDetHardCoreTagging(usedHCtagging);
    
    AliParticleContainer *partCont  = task->AddParticleContainer(ntrack);
       
    AliJetContainer *jetCont  = task->AddJetContainer(njet, accType, R);
    if(jetCont){
       //jetCont->SetRhoName(rhoname);
       //jetCont->SetRhoMassName(rhoMname);
       jetCont->ConnectParticleContainer(partCont);
       jetCont->SetJetPtCut(jetptcut);
       jetCont->SetPercAreaCut(jetareacut);
       
    }
    //AliJetContainer *jetContClosest  = task->AddJetContainer(njetClosest, accType, R);
    
    mgr->AddTask(task);
    
    //Connnect input
    mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
    //Connect output
    TString contName(wagonName);
    TString outputfile = Form("%s",AliAnalysisManager::GetCommonFileName());
    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contName.Data(), TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
    contName.Append("Tree");
    AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(contName.Data(), TTree::Class(),AliAnalysisManager::kOutputContainer,outputfile);
    
    mgr->ConnectOutput(task,1,coutput1);
    mgr->ConnectOutput(task,2,coutput2);

    return task;
}
Example #8
0
AliMultSelectionTask *AddTaskMultSelection( Bool_t lCalibration = kFALSE, TString lExtraOptions = "", Int_t lNDebugEstimators = 1, const TString lMasterJobSessionFlag = "")
{
    // Creates, configures and attaches to the train a Multiplicity Selection Task
    // Get the pointer to the existing analysis manager via the static access method.
    //==============================================================================
    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
    if (!mgr) {
        ::Error("AddTaskMultSelection", "No analysis manager to connect to.");
        return NULL;
    }
    
    // Check the analysis type using the event handlers connected to the analysis manager.
    //==============================================================================
    if (!mgr->GetInputEventHandler()) {
        ::Error("AddTaskMultSelection", "This task requires an input event handler");
        return NULL;
    }
    TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
    
    // Create and configure the task
    
    //Special options interpreting: will be taken care of by the task
    // A - Add Extra AliCentrality V0M branch for cross-checks
    // A - Add Extra AliPPVsMultUtils V0M branch for cross-checks    
    
    AliMultSelectionTask *taskMultSelection = new AliMultSelectionTask("taskMultSelection", lExtraOptions.Data(), lCalibration, lNDebugEstimators);
    mgr->AddTask(taskMultSelection);
    TString outputFileName = AliAnalysisManager::GetCommonFileName();
    
    outputFileName += ":MultSelection";
    if (mgr->GetMCtruthEventHandler()) outputFileName += "_MC";
    
    Printf("Set OutputFileName : \n %s\n", outputFileName.Data() );
    
    AliAnalysisDataContainer *coutputList = mgr->CreateContainer("cListMultSelection",
                                                                 TList::Class(),
                                                                 AliAnalysisManager::kOutputContainer,
                                                                 outputFileName );
    
    //Recommendation: Tree as a single output slot
    mgr->ConnectInput (taskMultSelection, 0, mgr->GetCommonInputContainer());
    mgr->ConnectOutput(taskMultSelection, 1, coutputList);
    
    if ( lCalibration ) {
      AliAnalysisDataContainer *coutputTree = mgr->CreateContainer("cCalibrationTree",
                                                                   TTree::Class(),
                                                                   AliAnalysisManager::kOutputContainer,
                                                                   outputFileName );
      //This one you should merge in file-resident ways...
      coutputTree->SetSpecialOutput();
      mgr->ConnectOutput(taskMultSelection, 2, coutputTree);
    }
    
    return taskMultSelection;
}   
Example #9
0
AliAnalysisTask *AddTaskLambdaBayes(Bool_t ismc=kFALSE,Bool_t qa=kTRUE,Int_t filterbit=4,Int_t typeCol=2,Bool_t toEP=kFALSE,Int_t species=4){

  //get the current analysis manager
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("No manager found in AddTaskVZERO. Why?");
    return 0;
  }
  // currently don't accept AOD input
  if (!mgr->GetInputEventHandler()->InheritsFrom(AliAODInputHandler::Class())) {
    Error("AddTaskLambdaBayes","This task works only with AOD input!");
    return 0;
  }

  //========= Add tender to the ANALYSIS manager and set default storage =====
  char mytaskName[100];
  snprintf(mytaskName,100,"AliAnalysisTaskLambdaBayes.cxx"); 

  AliAnalysisTaskLambdaBayes *task = new AliAnalysisTaskLambdaBayes(mytaskName);
  if(ismc) task->SetMC();
  if(qa) task->SetQA();
  task->SetEtaCut(0.8);
  task->SetFilterBit(filterbit);
  task->SetTypeCollisions(typeCol);
  task->SetCorrEP(toEP);
  task->SetRefSpecies(species);

  AliPIDmaxProb *userCut = new AliPIDmaxProb("maxProbProton");
  userCut->RequireTPC();
  userCut->RequireTOF();
  task->SetPIDuserCut(userCut);

  mgr->AddTask(task);

  //Attach input to my tasks
  AliAnalysisDataContainer *cinput = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());

  // Attach output to my tasks
  AliAnalysisDataContainer *cOutputL= mgr->CreateContainer("contLambdaBayes1",TList::Class(), AliAnalysisManager::kOutputContainer, 
AliAnalysisManager::GetCommonFileName());
  mgr->ConnectOutput(task, 1, cOutputL);

  AliAnalysisDataContainer *cOutputL2= mgr->CreateContainer("contLambdaBayes2",TList::Class(), AliAnalysisManager::kOutputContainer, 
AliAnalysisManager::GetCommonFileName());
  mgr->ConnectOutput(task, 2, cOutputL2);

  AliAnalysisDataContainer *cOutputL3= mgr->CreateContainer("contLambdaBayes3",TList::Class(), AliAnalysisManager::kOutputContainer, 
AliAnalysisManager::GetCommonFileName());
  mgr->ConnectOutput(task, 3, cOutputL3);

  return task;
}
Example #10
0
void runProofT0analysis(const char * dataset = "/COMMON/COMMON/LHC09a4_10TeV_200k#esdTree",Long64_t nentries=20000, Long64_t firstentry=0)
{
// Connect to Proof
  TProof::Open("proof://[email protected]"); 
  //TProof::Open("lxb6046");

  // Upload and enable packages: please use the correct version!
  gProof->UploadPackage("AF-v4-16");
  gProof->EnablePackage("AF-v4-16");
  gProof->ShowDataSets();      
 
  // Create the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("AliT0MultiplicityTask");

  AliVEventHandler* esdH = new AliESDInputHandler();
  mgr->SetInputEventHandler(esdH);

  // Enable MC event handler
  AliVEventHandler* handler = new AliMCEventHandler;
  mgr->SetMCtruthEventHandler(handler);

  // Create task
  //  gProof->Load("AliMCComparisonTrack.cxx++g");
  gProof->Load("AliT0MultiplicityTask.cxx++g");
  AliAnalysisTask *task = new AliT0MultiplicityTask("AliT0MultiplicityTask");

  // Add task
  mgr->AddTask(task);

  // Create containers for input/output
  AliAnalysisDataContainer *cinput = 
    mgr->CreateContainer("cchain", TChain::Class(), AliAnalysisManager::kInputContainer);
  AliAnalysisDataContainer *coutput = 
    mgr->CreateContainer("coutput", TList::Class(), 
    AliAnalysisManager::kOutputContainer, "MultHist.root");

  // Connect input/output
  mgr->ConnectInput(task, 0, cinput);
  mgr->ConnectOutput(task, 1, coutput);


  // Enable debug printouts
  mgr->SetDebugLevel(3);

  if (!mgr->InitAnalysis())
    return;

  mgr->PrintStatus();

   mgr->StartAnalysis("proof",dataset,nentries,firstentry);
}
Example #11
0
//_____________________________________________________________________________
AliAnalysisTask  *AddTaskT0Analysis()
{
  //
  // add calibration task
  //
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libT0calib"); 

  cout<<"@@@ AddTaskT0Analysis "<<endl;
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libT0calib"); 


    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskT0Analysis", "No analysis manager to connect to.");
    return NULL;
  }  
  
  // check the input handler
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskT0Analysis", "This task requires an input event handler");
    return NULL;
  }  

  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskT0Analysis", "This task requires an input event handler");
    return NULL;
  }
   TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"

  // setup task
 AliT0CalibAnalysisTask  *task1 = new AliT0CalibAnalysisTask("ObjectsTrain");
   mgr->AddTask(task1);
  

  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
  if (!cinput1) cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
                                      AliAnalysisManager::kInputContainer);
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("T0tree",TList::Class(), AliAnalysisManager::kOutputContainer,"T0AnalysisTree.root");  

  mgr->ConnectInput(task1,0,cinput1);
  mgr->ConnectOutput(task1,1,coutput1);
  return task1;
}
Example #12
0
void runAliTask() {
  TStopwatch timer;
  timer.Start();
//   gSystem->Load("libTree.so");
//   gSystem->Load("libGeom.so");
//   gSystem->Load("libVMC.so");
//   gSystem->Load("libPhysics.so");
//   //____________________________________________________//
//   //_____________Setting up required packages___________//
//   //____________________________________________________//
//   gSystem->Load("libSTEERBase.so");
//   gSystem->Load("libESD.so");
//   gSystem->Load("libAOD.so");
//   gSystem->Load("libANALYSIS.so");
//   gSystem->Load("libANALYSISalice.so");
//   gROOT->ProcessLine(".include $ALICE_ROOT/include");
// 
//   //___________Compile analysis task using AClic____________//
//   gROOT->LoadMacro("../task/AliAnalysisTaskPt.cxx+g");
// 
// 
//   gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");

  TChain* chain = CreateESDChain("files.txt", 2);

  //____________________________________________//
  // Make the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
  AliESDInputHandler* esdH = new AliESDInputHandler();
  mgr->SetInputEventHandler(esdH);  
  //____________________________________________//
  // 1st Pt task
  AliAnalysisTaskPt *task1 = new AliAnalysisTaskPt("TaskPt");
  mgr->AddTask(task1);
  // Create containers for input/output
  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root");
  
  //____________________________________________//
  mgr->ConnectInput(task1,0,cinput1);
  mgr->ConnectOutput(task1,0,coutput1);
  if (!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  //mgr->StartAnalysis("local",chain);

  timer.Stop();
  timer.Print();
}
Example #13
0
AliAnalysisTaskEpRatio* AddTaskPHOSEpRatio (Bool_t kMC = kFALSE,
					    const char* name = "PHOSEpRatio",
					    const char* options = "",
					    UInt_t offlineTriggerMask = AliVEvent::kINT7 )
{
  //Add a task AliAnalysisTaskEpRatio to the analysis train.
  //Author: Boris Polishchuk.
  
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskPHOSEpRatio", "No analysis manager to connect to");
    return NULL;
  }
  
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskPHOSEpRatio", "This task requires an input event handler");
    return NULL;
  }
  
  AliAnalysisTaskEpRatio* task = new AliAnalysisTaskEpRatio(Form("%sTask", name));  
  if(!kMC) task->SelectCollisionCandidates(offlineTriggerMask);
  
  mgr->AddTask(task);
  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer() );
  
  TString cname(Form("%sCoutput1", name));
  TString pname(Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name));
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(cname.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, pname.Data());
  mgr->ConnectOutput(task, 1, coutput1);
  
  return task;
}
Example #14
0
AliAnalysisTaskPIDCORR *AddTaskPIDCORR()
{
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
	if (!mgr) {
		
		return NULL;
	} 
AliAnalysisTaskPIDCORR* task = new AliAnalysisTaskPIDCORR("PIDCORR_pp7TeV");

mgr->AddTask(task);

 TString outputFileName = AliAnalysisManager::GetCommonFileName();
 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
 AliAnalysisDataContainer *coutput = mgr->CreateContainer("PIDCORR_pp7TeV", TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName.Data());
        

outputFileName.Data()


    // connect input/output
mgr->ConnectInput(task, 0, cinput);
mgr->ConnectOutput(task, 1, coutput);

return task;

}
Example #15
0
AliAnalysisTaskADQA *AddTaskADQA(){

  
  //--- get the current analysis manager ---//
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
      Error("AddTask_ADQA", "No analysis manager found.");
      return 0;
   }
  
  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    Error("AddTask_ADQA", "This task requires an input event handler");
    return 0;
  }
	
    
  // Create tasks
  AliAnalysisTaskADQA *task = new AliAnalysisTaskADQA("ESD");
  mgr->AddTask(task);

   // Create containers for input/output
  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput = mgr->CreateContainer("ADQAListHist", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:ADQA", AliAnalysisManager::GetCommonFileName()));  

  // Connect input/output
  mgr->ConnectInput(task, 0, cinput);
  mgr->ConnectOutput(task, 1, coutput);

return task;
}
Example #16
0
//_____________________________________________________________________
AliAnalysisTask *AddTaskJCORRANEfficiency(TString taskName, int fTriggerMask){
    // Load Custom Configuration and parameters
    // override values with parameters

    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

    //==== JCORRAN Efficiency TASK
    AliJEfficiencyTask *jefftask = new AliJEfficiencyTask(taskName.Data(),"JOD");
    jefftask->SetDebugLevel(0);
    jefftask->SetFilterTaskName("PWGCFJCORRANTask");

    AliJEfficiencyScanner *fEffScanner;
    fEffScanner = new AliJEfficiencyScanner("EfficiencyScanner");
    fEffScanner->SetMBTriggMask( fTriggerMask );
    jefftask->SetJEfficiencyScanner( fEffScanner );

    mgr->AddTask((AliAnalysisTask*) jefftask);


    // Create containers for input/output
    AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();

    // Connect input/output
	mgr->ConnectInput(jefftask, 0, cinput);
	// Connect input/output
	AliAnalysisDataContainer *effHist = mgr->CreateContainer(Form("%scontainer",jefftask->GetName()),  TDirectory::Class(), AliAnalysisManager::kOutputContainer, Form("%s:%s",AliAnalysisManager::GetCommonFileName(), jefftask->GetName()));
	mgr->ConnectOutput(jefftask, 1, effHist );

	return jefftask;
}
AliAnalysisTask *AddEventMixingTestTask(TString format = "esd", Bool_t useMC = kFALSE,TString postfix="")
{
   // create manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) mgr = new AliAnalysisManager("MIX test");

   // create our task
   AliAnalysisTaskEx02 *task = new AliAnalysisTaskEx02("AliAnalysisTaskEx02");

   // create output container
   AliAnalysisDataContainer *output1 = mgr->CreateContainer("cEx2", TList::Class(), AliAnalysisManager::kOutputContainer, "MixTestOutput.root");

   // add our task to the manager
   mgr->AddTask(task);

   // finaly connect input and output
   mgr->ConnectInput(task, 0,  mgr->GetCommonInputContainer());
   mgr->ConnectOutput(task, 1, output1);

   // Option for test (only experts)
//    task->SetLoopInUserExecMix(kTRUE);
//    task->SetUseLoopMixedEvent(kTRUE);
//    task->SetLoopV0(kTRUE);
   
   return task;
}
Example #18
0
AliAnalysisTaskMuonAODCreation *AddTaskMuonAODCreation()
{
// Creates a filter task to copy muon tracks from the Standard AOD to the Muon AOD
// R. Arnaldi - 6/10/09

   // Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
      ::Error("AddTaskMuonAODCreation", "No analysis manager to connect to.");
      return NULL;
   }   
   
   // Get input handler
   TString type = mgr->GetInputEventHandler()->GetDataType();

   // Define output
   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0",TList::Class(),AliAnalysisManager::kOutputContainer,"MuonPlots.root");

   // Create the task, add it to the manager and configure it.
   //===========================================================================   
   AliAnalysisTaskMuonAODCreation *muonAODtask = new AliAnalysisTaskMuonAODCreation("Muon AOD creation");
   mgr->AddTask(muonAODtask);
   
   // Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
   //==============================================================================
   mgr->ConnectInput  (muonAODtask,  0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput (muonAODtask,  0, mgr->GetCommonOutputContainer());
   mgr->ConnectOutput (muonAODtask,  1, coutput1);
   return muonAODtask;
}   
Example #19
0
AliAnalysisTaskADCalib* AddTaskADCalib(Int_t bcExtrapolationMin=9,
				       Int_t bcExtrapolationMax=15) {  
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTask_ADCalib", "No analysis manager found.");
    return NULL;
  }
  
  if (!mgr->GetInputEventHandler()) {
    Error("AddTask_ADCalib", "This task requires an input event handler");
    return 0;
  }
      
  AliAnalysisTaskADCalib *task = new AliAnalysisTaskADCalib();
  task->SetBCRangeExtrapolation(bcExtrapolationMin, bcExtrapolationMax);
  mgr->AddTask(task);
  
  // Create containers for input/output
  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput = mgr->CreateContainer("ADCalibListHist",
							   TList::Class(),
							   AliAnalysisManager::kOutputContainer,
							   Form("%s:ADCalib", AliAnalysisManager::GetCommonFileName()));

  // Connect input/output
  mgr->ConnectInput (task, 0, cinput);
  mgr->ConnectOutput(task, 1, coutput);
  
  return task;
}
Example #20
0
AliAnalysisTaskUpcPsi2s *AddTaskUpcPsi2s(Bool_t runTree = kTRUE,Bool_t runHist = kTRUE,Bool_t runSyst = kFALSE,Int_t tracking = 0){

  
  //--- get the current analysis manager ---//
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
      Error("AddTask_UpcPsi2s", "No analysis manager found.");
      return 0;
   }
  
  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    Error("AddTask_UpcPsi2s", "This task requires an input event handler");
    return 0;
  }
	
  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  Bool_t isMC;
  if(mgr->GetMCtruthEventHandler()) isMC = kTRUE;
  
  // Create tasks
  AliAnalysisTaskUpcPsi2s *task = new AliAnalysisTaskUpcPsi2s(inputDataType.Data());
  task->SetRunTree(runTree);
  task->SetRunHist(runHist);
  task->SetIsMC(isMC);
  task->SetRunSyst(runSyst);
  task->SetTracking(tracking);
  mgr->AddTask(task);


   // Create containers for input/output
  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput = mgr->CreateContainer("JPsiTree", TTree::Class(), AliAnalysisManager::kOutputContainer,Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));
  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("Psi2sTree", TTree::Class(), AliAnalysisManager::kOutputContainer, Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));
  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("ListTrig", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));
  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("Psi2sListHist", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:Psi2sCentral", AliAnalysisManager::GetCommonFileName()));  

  // Connect input/output
  mgr->ConnectInput(task, 0, cinput);
  mgr->ConnectOutput(task, 1, coutput);
  mgr->ConnectOutput(task, 2, coutput2);
  mgr->ConnectOutput(task, 3, coutput3);
  mgr->ConnectOutput(task, 4, coutput4);

return task;
}
Example #21
0
AliAnalysisTaskPsEfficiency* AddTaskPsEfficiency(bool isMC=true,TString suffix = ""){

  // Creates, configures and attaches to the train the task for pi, K , p spectra
  // with ITS standalone tracks
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  ::Info("AddTaskPsEfficiency","Adding a new task with this settings isMC = %i",isMC);

  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskPsEfficiency", "No analysis manager to connect to.");
    return NULL;
  }
  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskPsEfficiency", "This task requires an input event handler");
    return NULL;
  }

  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  if(type.Contains("ESD")){
    ::Error("AddTaskPsEfficiency", "This task requires to run on AOD");
    return NULL;
  }

  // Add MC handler (for kinematics)
  if(isMC){
    AliMCEventHandler* handler = new AliMCEventHandler;
    handler->SetReadTR(kFALSE);
    mgr->SetMCtruthEventHandler(handler);
  }

  // Create and configure the task

  TString tskname = "Pentaquark";
  tskname.Append(Form("%s",suffix.Data()));
  AliAnalysisTaskPsEfficiency *taskPs = new AliAnalysisTaskPsEfficiency(tskname);
  //taskPs->SetMC(isMC);
  mgr->AddTask(taskPs);

  // Create ONLY the output containers for the data produced by the task.
  // Get and connect other common input/output containers via the manager as below
  //==============================================================================
  TString outputFileName = AliAnalysisManager::GetCommonFileName();
  outputFileName += ":AODpentaquark";

  AliAnalysisDataContainer *coutput =0x0;

  coutput = mgr->CreateContainer(Form("lbariogl_%s",tskname.Data()),
				 TList::Class(),
				 AliAnalysisManager::kOutputContainer,
				 AliAnalysisManager::GetCommonFileName());

  mgr->ConnectInput(taskPs, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(taskPs, 1, coutput);

  return taskPs;
}
Example #22
0
AliAnalysisTaskFemto *AddTaskFemto(const char *configMacroName="ConfigFemtoAnalysis.C", const char *configMacroParameters="" )
{
// Creates a proton analysis task and adds it to the analysis manager.

  // A. Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskFemto", "No analysis manager to connect to.");
    return NULL;
  }

  // B. Check the analysis type using the event handlers connected to the analysis
  //    manager. The availability of MC handler cann also be checked here.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskFemto", "This task requires an input event handler");
    return NULL;
  }
  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  cout << "Found " <<type << " event handler" << endl;

  // C. Create the task, add it to manager.
  //===========================================================================
//  gSystem->SetIncludePath("-I$ROOTSYS/include  -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_PHYSICS/include");

  if (TProofMgr::GetListOfManagers()->GetEntries()) {
//     if (dynamic_cast<TProofLite *> gProof) {
//       char *macrocommand[10000];
//       sprintf(macrocommand, ".L %s", configMacroName);
//       gProof->Exec(macrocommand);
//     }
//     else
    gProof->Load(configMacroName);
  }
  //  gROOT->LoadMacro("ConfigFemtoAnalysis.C++");

  AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName,configMacroParameters);
  mgr->AddTask(taskfemto);

  // D. Configure the analysis task. Extra parameters can be used via optional
  // arguments of the AddTaskXXX() function.
  //===========================================================================

  // E. Create ONLY the output containers for the data produced by the task.
  // Get and connect other common input/output containers via the manager as below
  //==============================================================================
  TString outputfile = AliAnalysisManager::GetCommonFileName();
  outputfile += ":PWGCFEMTO_PLam";
  AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("femtolist_PLam",  TList::Class(),
  							       AliAnalysisManager::kOutputContainer,outputfile);


   mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput(taskfemto, 0, cout_femto);

   // Return task pointer at the end
   return taskfemto;
}
Example #23
0
void runProofFwdDetsQA(const char * dataset = "/COMMON/COMMON/LHC09a4_run8101X",Long64_t nentries=100000, Long64_t firstentry=0)
{
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->AddIncludePath("-I$ALICE_ROOT/include");

  // Connect to Proof
  gEnv->SetValue("XSec.GSI.DelegProxy","2");
  TProof::Open("cheshkov:[email protected]");

  // Upload and enable packages: please use the correct version!
  gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-16-Release/AF-v4-16");
  gProof->EnablePackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-16-Release/AF-v4-16");

  // Create the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("AliAnaFwdDetsQA");

  AliVEventHandler* esdH = new AliESDInputHandler();
  mgr->SetInputEventHandler(esdH);

  // Enable MC event handler
  AliVEventHandler* handler = new AliMCEventHandler;
  mgr->SetMCtruthEventHandler(handler);

  // Create task

  gProof->Load(Form("%s/PWGPP/AliAnaFwdDetsQA.cxx++g",
		    gSystem->Getenv("ALICE_ROOT")));
  AliAnalysisTask *task = new AliAnaFwdDetsQA("AliAnaFwdDetsQA");

  // Add task
  mgr->AddTask(task);

  // Create containers for input/output
  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput = 
    mgr->CreateContainer("coutput", TList::Class(), 
    AliAnalysisManager::kOutputContainer, "FwdDetsQA.root");

  // Connect input/output
  mgr->ConnectInput(task, 0, cinput);
  mgr->ConnectOutput(task, 1, coutput);


  // Enable debug printouts
  mgr->SetDebugLevel(3);

  if (!mgr->InitAnalysis())
    return;

  mgr->PrintStatus();

  TFileCollection *proofColl = gProof->GetDataSet(dataset);
  TChain *chain = new TChain("esdTree");
  chain->AddFileInfoList((TCollection*)(proofColl->GetList()));
  mgr->StartAnalysis("proof", chain, nentries, firstentry);

    //  mgr->StartAnalysis("proof",dataset,nentries,firstentry);
}
Example #24
0
AliAnalysisTaskIPInfo* AddTaskIntSpotESD() 
{
  //
  // Task to extract the Int.Spot position and sigma as well as the vertex and track 
  // DCA resolutions. Performs estimates both with TPC and TPC+ITS tracks. 
  //

  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskIntSpotESD", "No analysis manager to connect to.");
    return 0;
  }   
  //

  // Create the task
  AliAnalysisTaskIPInfo *taskIP = new AliAnalysisTaskIPInfo("IPInfo");
  taskIP->SetOptions(AliAnalysisTaskIPInfo::kITSTPC, kFALSE, 1e-4, 2, 12,1000,
		     -4e-2,8e-2,  10,2,32,  14,0.2,3., kFALSE);
  taskIP->SetIPCenIni(AliAnalysisTaskIPInfo::kITSTPC, -0.0764,0.2481,0);
  //
  //
  taskIP->SetOptions(AliAnalysisTaskIPInfo::kTPC, kFALSE, 1e-4,	2, 12,1000,
		     -4e-2,8e-2,  10,2,32,  14,0.2,3., kFALSE);
  taskIP->SetIPCenIni(AliAnalysisTaskIPInfo::kTPC, -0.0764,0.2481,0);
  //
  //
  taskIP->SetOptions(AliAnalysisTaskIPInfo::kSPD, kFALSE, 1e-4,	2, 12,1000,
		     -4e-2,8e-2,  10,2,32,  14,0.2,3., kTRUE);
  taskIP->SetIPCenIni(AliAnalysisTaskIPInfo::kSPD, -0.0764,0.2481,0);
  //
  mgr->AddTask(taskIP);

  // Create containers for input/output
  AliAnalysisDataContainer *cInputIPesd = mgr->CreateContainer
    ("cInputIPesd",TChain::Class(),AliAnalysisManager::kInputContainer);

  AliAnalysisDataContainer *cOutputIPesd = mgr->CreateContainer
    ("cOutputIPesd",TList::Class(),AliAnalysisManager::kOutputContainer,"IPInfo.root");

  // Attach input
  mgr->ConnectInput(taskIP,0,mgr->GetCommonInputContainer());
  // Attach output
  mgr->ConnectOutput(taskIP,0,cOutputIPesd);
  
  return taskIP;
}
void RunLinkToMCAnalysisExample(const char* esdFile = "./AliESDs.root")
{
	// Load needed libraries
	gSystem->Load("libTree");
	gSystem->Load("libGeom");
	gSystem->Load("libVMC");
	gSystem->Load("libPhysics");
	gSystem->Load("libSTEERBase");
	gSystem->Load("libESD");
	gSystem->Load("libAOD");
	gSystem->Load("libANALYSIS");
	gSystem->Load("libANALYSISalice");
	gSystem->Load("libPWGHFbase");
	gSystem->Load("libPWGmuon");
	
	// Create the TChain for esdTrees in the AliESDs.root file.
	TChain* chain = new TChain("esdTree");
	chain->Add(esdFile);
	if (!chain) return;
	
	// Create the analysis manager and event handlers.
	AliAnalysisManager* mgr = new AliAnalysisManager("Analysis Train", "An example analysis train setup for AliAnalysisTaskLinkToMC.");
	AliESDInputHandler* esdHandler = new AliESDInputHandler();
	mgr->SetInputEventHandler(esdHandler);
	AliMCEventHandler* mcHandler = new AliMCEventHandler();
	mgr->SetMCtruthEventHandler(mcHandler);
	mcHandler->SetReadTR(kTRUE); 
	AliAODHandler* aodHandler = new AliAODHandler();
	mgr->SetOutputEventHandler(aodHandler);
	aodHandler->SetOutputFileName("AliAOD.root");
	
	// Create the analysis task and setup the parameters.
	AliAnalysisTaskLinkToMC* linktask = new AliAnalysisTaskLinkToMC("Task to link ESD tracks to corresponding MC tracks.");
	linktask->MinClusters(6);
	linktask->HardCutLimitX(4);
	linktask->HardCutLimitY(4);
	linktask->SigmaCut(5.);
	linktask->MinClustersInSt45(3);
	linktask->StationMustMatch(1, true);  // At least one cluster in station 1 must match.
	linktask->StationMustMatch(2, true);  // At least one cluster in station 2 must match.
	linktask->StationMustMatch(3, true);  // At least one cluster in station 3 must match.
	linktask->GenerateHistograms(true);
	mgr->AddTask(linktask);
	
	// Create the input and output containers and connect them up to the analysis task.
	AliAnalysisDataContainer* cinEsd = mgr->GetCommonInputContainer();
	AliAnalysisDataContainer* coutAod = mgr->GetCommonOutputContainer();
	AliAnalysisDataContainer* coutHists = mgr->CreateContainer("cHists", TList::Class(), AliAnalysisManager::kOutputContainer, "hists.root");
	mgr->ConnectInput(linktask, 0, cinEsd);
	mgr->ConnectOutput(linktask, 0, coutAod);
	mgr->ConnectOutput(linktask, 1, coutHists);
	
	if (mgr->InitAnalysis())
	{
		mgr->PrintStatus();
		mgr->StartAnalysis("local", chain);
	}
}
Example #26
0
AliAnalysisTaskDG* AddAnalysisTaskDG(Bool_t isMC,
				     TString branchNames,
				     TString trackCutType,
				     TString triggerSelection,
				     TString triggerSelectionSPD="",
				     Int_t   maxTracksSave=4)
{
  // create manager
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) mgr = new AliAnalysisManager("My test train");

  if (isMC) {
    AliMCEventHandler* handler = new AliMCEventHandler;
    handler->SetReadTR(kFALSE);
    mgr->SetMCtruthEventHandler(handler);
  }

  AliAnalysisTaskDG* task = new AliAnalysisTaskDG;
  // task->SelectCollisionCandidates(AliVEvent::kMB);

  task->SetIsMC(isMC);
  task->SetBranchNames(branchNames);
  task->SetTrackCutType(trackCutType);
  task->SetTriggerSelection(triggerSelection);
  task->SetTriggerSelectionSPD(triggerSelectionSPD);
  task->SetMaxTracksSave(maxTracksSave);

  Printf("created task");

  // OUTPUT --------------------------------------------------------------------
  AliAnalysisDataContainer* output1 =
    mgr->CreateContainer(task->GetListName(), TList::Class(), AliAnalysisManager::kOutputContainer,
			 TString(AliAnalysisManager::GetCommonFileName())+":"+task->GetResultsFileName());
  AliAnalysisDataContainer* output2 =
    mgr->CreateContainer(task->GetTreeName(), TTree::Class(), AliAnalysisManager::kOutputContainer,
			 TString(AliAnalysisManager::GetCommonFileName())+":"+task->GetResultsFileName());
  mgr->AddTask(task);

  mgr->ConnectInput(task,  0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(task, 1, output1);
  mgr->ConnectOutput(task, 2, output2);
  Printf("set up task connections");
  Printf("--------------------------------------------------------------------------------");
  return task;
}
Example #27
0
AliAnalysisTaskEMCALTriggerQA * AddTaskEMCALTriggerQA(Bool_t kSimulation = kFALSE, TString outputFile = "")
{
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) 
  {
    ::Error("AddTaskEMCALTriggerQA", "No analysis manager to connect to.");
    return NULL;
  }  
  
  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) 
  {
    ::Error("AddTaskEMCALTriggerQA", "This task requires an input event handler");
    return NULL;
  }
  
  TString taskName = "QAEMCALTrigger";
  
  AliAnalysisTaskEMCALTriggerQA * qatrigger = new AliAnalysisTaskEMCALTriggerQA(taskName);
    
  // Configuration
  
  Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
    
  if(kUseKinematics) kSimulation = kTRUE;
    
  if(kSimulation) qatrigger->SwitchOnMCData();
  else            qatrigger->SwitchOffMCData();
  
  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
    
  if(inputDataType.Contains("AOD")) qatrigger->SwitchOffV0SignalHistograms();
  else                              qatrigger->SwitchOnV0SignalHistograms();
  
  // Define the input/output containers
    
  qatrigger->GetRecoUtils()->SwitchOnBadChannelsRemoval ();
  
  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
    
  if(outputFile.Length()==0) outputFile = AliAnalysisManager::GetCommonFileName();
 
  printf("*** Task Name %s; Output file name: %s ***\n",taskName.Data(),outputFile.Data());
  
  AliAnalysisDataContainer *coutput = mgr->CreateContainer(Form("%s",taskName.Data()), 
                                                           TList::Class(), AliAnalysisManager::kOutputContainer,
                                                           Form("%s",outputFile.Data()));

  mgr->AddTask(qatrigger);
  mgr->ConnectInput  (qatrigger, 0, cinput1);
  mgr->ConnectOutput (qatrigger, 1, coutput);
  
  return qatrigger;
}
Example #28
0
AliAnalysisTask *AddTaskTrackingUncert() {
  //
  // add task of tracking uncertainty
  //
  //
  //get the current analysis manager
  //
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskTrackingUncert", "No analysis manager found.");
    return 0;
  }
  //  
  //========= Add task for standard analysis to the ANALYSIS manager ====
  //
  AliAnalysisTrackingUncertainties *task    = new AliAnalysisTrackingUncertainties("trackingUncertainty");
  //
  task->SelectCollisionCandidates(AliVEvent::kMB|AliVEvent::kINT7);
  mgr->AddTask(task);
  //  
  //  
  //======================================================================
  //              data containers
  //======================================================================
  //            find input container
  //below the trunk version
  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();

  //dummy output container
  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("dummyTreeUncert",TTree::Class(),AliAnalysisManager::kExchangeContainer,"defaultTreeUncert");

  //define output containers
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("trackingUncert", TList::Class(),AliAnalysisManager::kOutputContainer,"AnalysisResults.root");

  //connect containers
  mgr->ConnectInput  (task, 0, cinput );
  mgr->ConnectOutput (task, 0, coutput0);
  mgr->ConnectOutput (task, 1, coutput1);
  //
  //
  //
  return task;

}
Example #29
0
// runV0ChCorrelations.C
//
// AddTask for AliAnalysisTaskV0ChCorrelations task
//
AliAnalysisTaskV0ChCorrelations *AddTaskV0ChCorrelations(const char * outfilename,
													     const Bool_t bMCtruth=kTRUE,
														 Float_t DcaDToPV = 0.05,
														 Float_t DcaV0D = 3.0,
														 const Bool_t bChCh=kTRUE,
														 Int_t OStatus
														)
{
  // Creates a V0Ch correlations analysis task and adds it to the analysis manager.

  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================

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

    // mc event handlerrunEx01.C
    /*
	if(bMCtruth) {
		cout << "I am here too! " << endl;
        AliAODMCEventHandler* mchandler = new AliAODMCEventHandler();
        // Not reading track references
        mchandler->SetReadTR(kFALSE);
        mgr->SetMCtruthEventHandler(mchandler);
    }   
*/
	// create task
    AliAnalysisTaskV0ChCorrelations* task = new AliAnalysisTaskV0ChCorrelations("V0ChCorrelations_task");
    task->SetAnalysisMC(bMCtruth);
	task->SetDcaDToPV(DcaDToPV);
	task->SetDcaV0D(DcaV0D);
	task->SetWithChCh(bChCh);
	task->SetOStatus(OStatus);
    mgr->AddTask(task);
    
    // Create ONLY the output containers for the data produced by the task.
    // Get and connect other common input/output containers via the manager as below
    //==============================================================================
    TString outputFileName = AliAnalysisManager::GetCommonFileName();
    //outputFileName = "list.grid.v0ch.root";

    // create containers for input/output
    AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(outfilename, TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
        
    // connect input/output
    mgr->ConnectInput(task, 0, cinput);
    mgr->ConnectOutput(task, 1, coutput1);
        
    // Return task pointer at the end
    return task;
}
Example #30
0
//
// This macro serves to add the RSN analysis task to the steering macro.
//
// Inputs:
//   - dataLabel   = a string with informations about the type of data
//                   which could be needed to be ported to the config macro
//                   to set up some cuts
//   - configMacro = macro which configures the analysis; it has *ALWAYS*
//                   defined inside a function named 'RsnConfigTask()',
//                   whatever the name of the macro itself, whose first two
//                   arguments must have to be the task and the 'dataLabel' argument.
//
Bool_t AddRsnAnalysisTask
(
   Bool_t      isMC,
   Bool_t      isMix,
   const char *options,
   const char *path     = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train",
   const char *taskName = "RSNtask"
)
{
   // retrieve analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

   // create the task and connect with physics selection
   AliRsnAnalysisTask *task = new AliRsnAnalysisTask(taskName);
   task->SetZeroEventPercentWarning(100.0);
   task->SelectCollisionCandidates();
   task->SetMixing(isMix);
   ::Info("AddRsnAnalysisTask.C", "Mixing: %s", (task->IsMixing() ? "YES" : "NO"));
   ::Info("AddRsnAnalysisTask.C", "MC:     %s", (isMC ? "YES" : "NO"));

   // add the task to manager
   mgr->AddTask(task);
   
   // add the event computations with the options to eventually select centrality cut
   gROOT->LoadMacro(Form("%s/AddRsnEventComputations.C", path));
   AddRsnEventComputations(isMC, options);
   
   // add all configs for phi
   gROOT->LoadMacro(Form("%s/RsnConfigPhi.C", path));
   RsnConfigPhi(isMC, "tpcpid_tofpid", path, taskName);
   //RsnConfigPhi(isMC, "itspid_tpcpid_tofpid", path, taskName);
   
   // in case of MC, add efficiency tasks
   if (isMC && !isMix) {
      ::Info("Adding efficiency");
      gROOT->LoadMacro(Form("%s/AddRsnAnalysisTaskEffPhi.C", path));
      AddRsnAnalysisTaskEffPhi(options, "tpcpid_tofpid");
      //AddRsnAnalysisTaskEffPhi(options, "itspid_tpcpid_tofpid");
   }

   // connect input container according to source choice
   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());

   // create paths for the output in the common file
   Char_t commonPath[500];
   sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName());

   // create containers for output
   AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
   AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
   mgr->ConnectOutput(task, 1, outputInfo);
   mgr->ConnectOutput(task, 2, outputHist);

   return kTRUE;
}