Example #1
0
//___________________________________________________________
void runAlien(TString data, TString mode = "test", Bool_t MC = kFALSE){  
  if(!gSystem->Getenv("ALICE_ROOT")){
    printf("AliRoot has to be initialized\n");  
    return;
  }
  
  // check for valid modes
  const int kModes = 5;
  TString allowed_modes[kModes] = {"proof", "prooftest", "test", "full", "submit"}; 
  Bool_t isValid = kFALSE;
  mode.ToLower();
  for(int imode = 0; imode < kModes; imode++){
    if(!mode.CompareTo(allowed_modes[imode])) isValid = kTRUE;
  }
  if(!isValid){
    printf("invalid analysis mode selected\n");
    return;
  }
  analysis_mode = mode; 
  Bool_t proofmode = mode.Contains("proof");
  // libraries to be loaded
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libCORRFW");
  gSystem->Load("libPWGhfe");
  
  // Create Analysis Manager
  AliAnalysisManager *runAnalysis = new AliAnalysisManager("Heavy Flavour Electron Analysis");
  runAnalysis->SetCommonFileName(output_file.Data());
  runAnalysis->SetInputEventHandler(new AliESDInputHandler); 
  if(MC) runAnalysis->SetMCtruthEventHandler(new AliMCEventHandler);
  AliAnalysisAlien *alienhandler = CreateAlienHandler(proofmode);
  printf("alienhandler %p\n", alienhandler);
  runAnalysis->SetGridHandler(alienhandler);
  //return;
  
  // Specify input (runs or dataset)
  if(!proofmode){
    // Query sample ID and runs
    TString sample;
    TArrayI listofruns;
    DecodeDataString(data, sample, listofruns);
    AddInput(alienhandler, sample, listofruns, MC);
  } else {
    alienhandler->SetProofDataSet(data);
  }

  // Add Tasks
  gROOT->LoadMacro(Form("%s/OADB/macros/AddTaskPhysicsSelection.C", gSystem->Getenv("ALICE_ROOT")));
  gROOT->LoadMacro(Form("%s/PWG3/hfe/macros/AddTaskHFE.C", gSystem->Getenv("ALICE_ROOT")));
  AddTaskPhysicsSelection(MC);
  AddTaskHFE();     // @TODO: MC and PbPb flag to be fixed

  // Run Analysis
  TString anamode = proofmode ? "proof" : "grid";
  if(runAnalysis->InitAnalysis()){
    runAnalysis->PrintStatus();
    runAnalysis->StartAnalysis(anamode);
  }
}
Example #2
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 #3
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);
}
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 #5
0
void runTOFCalibTaskOnProof() {
	TStopwatch timer;
	timer.Start();
	
	printf("*** Open PROOF ***");

	gEnv->SetValue("XSec.GSI.DelegProxy","2");
	TProof::Open("alicecaf");
		
	gProof->UploadPackage("STEERBase.par");
	gProof->EnablePackage("STEERBase");
	gProof->UploadPackage("ESD.par");
	gProof->EnablePackage("ESD");
	gProof->UploadPackage("AOD.par");
	gProof->EnablePackage("AOD");
	gProof->UploadPackage("ANALYSIS.par");
	gProof->EnablePackage("ANALYSIS");
	gProof->UploadPackage("ANALYSISalice.par");
	gProof->EnablePackage("ANALYSISalice");
	
	gProof->Load("AliTOFArray.cxx++g");
	gProof->Load("AliTOFCalibTask.cxx++g");
	gROOT->LoadMacro("AddTaskTOFCalib.C");
	cout << "Loaded AddTaskTOFCalib macro "<< endl;
	
	gProof->ShowEnabledPackages();
	
	//ANALYSIS PART	
	//____________________________________________//
	// Make the analysis manager

	AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
	AliESDInputHandler* esdH = new AliESDInputHandler;
	
	esdH->SetInactiveBranches("FMD CaloCluster");
	mgr->SetInputEventHandler(esdH);  
	
	Bool_t domc = kFALSE;
	if (domc) {
		AliMCEventHandler *mcH = new AliMCEventHandler;
		mgr->SetMCtruthEventHandler(mcH);
	}

	//____________________________________________//
	// 1st TOFCalib task
	
	AliTOFCalibTask *taskTOFCalib = AddTaskTOFCalib();
	
	if (!mgr->InitAnalysis()) return;
	mgr->PrintStatus();
	mgr->StartAnalysis("proof","/COMMON/COMMON/LHC08c11_10TeV_0.5T",1000);
	
	timer.Stop();
	timer.Print();
}
Example #6
0
Bool_t InputHandlerSetup(TString format = "esd", Bool_t useRP=kFALSE, Bool_t useKine = kFALSE)
{
  format.ToLower();

  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

  AliAnalysisDataContainer *cin = mgr->GetCommonInputContainer();

  if (cin) return;

  if (!format.CompareTo("esd"))
  {
    AliESDInputHandler *esdInputHandler = dynamic_cast<AliESDInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());

    if (!esdInputHandler)
    {
      Info("CustomAnalysisTaskInputSetup", "Creating esdInputHandler ...");
      if (useRP) esdInputHandler = new AliESDInputHandlerRP();
      else       esdInputHandler = new AliESDInputHandler();
      mgr->SetInputEventHandler(esdInputHandler);
    }
    
    if (useKine)
    {
      AliMCEventHandler* mcInputHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());

      if (!mcInputHandler)
      {
        Info("CustomAnalysisTaskInputSetup", "Creating mcInputHandler ...");
        AliMCEventHandler* mcInputHandler = new AliMCEventHandler();
        mgr->SetMCtruthEventHandler(mcInputHandler);
      }
    }

  }
  else if (!format.CompareTo("aod"))
  {
    AliAODInputHandler *aodInputHandler = dynamic_cast<AliAODInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());

    if (!aodInputHandler)
    {
      Info("CustomAnalysisTaskInputSetup", "Creating aodInputHandler ...");
      aodInputHandler = new AliAODInputHandler();
      mgr->SetInputEventHandler(aodInputHandler);
    }
  }
  else
  {
    Info("Wrong input format!!! Only ESD and AOD are supported. Skipping Task ...");
    return kFALSE;
  }

  return kTRUE;
}
Example #7
0
void rundStarTask(const char* mode = "test", bool isMC=true){
  // Include AliPhysics and AliRoot libraries
  gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_PHYSICS/include");
  //Check the run mode
  if(std::strcmp(mode,"local")!=0 && std::strcmp(mode,"grid")!=0 && std::strcmp(mode,"test")!=0){
    Printf("\n\tIncorrect run option, check first argument of run macro");
    Printf("\tmode = local, test or grid\n");
    return;
  }
  Printf("%s analysis chosen",mode);
  //Define the plugin
  AliAnalysisGrid *plugin = 0x0;
  TChain *chain = 0x0;
  if(std::strcmp(mode,"local")!=0) {
    plugin = CreateAlienHandler(mode,isMC);
    if(!plugin) return;
  }
  else {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/CreateAODChain.C");
    chain = CreateAODChain("localdata.txt");
  }
  // Create the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager(kTaskName);
  if(plugin) mgr->SetGridHandler(plugin);
  // Define input handlers
  if(isMC){
    AliMCEventHandler*  mcHandler = new AliMCEventHandler();
    if (plugin) mgr->SetMCtruthEventHandler(mcHandler);
  }
  AliAODInputHandler *aodH = new AliAODInputHandler();
  mgr->SetInputEventHandler(aodH);
  // Compile the class
  gROOT->LoadMacro("AliAnalysisTaskdStar.cxx++g");
  // PID response
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AliAnalysisTaskPIDResponse *pidTask = AddTaskPIDResponse(isMC); // useMC
  // dStar task
  gROOT->LoadMacro("AddTaskdStar.C");
  AliAnalysisTaskdStar *task = AddTaskdStar(isMC);
  // Disbale debug printouts
  mgr->SetDebugLevel(3);
  AliLog::SetGlobalLogLevel(AliLog::kFatal);
  AliLog::SetGlobalDebugLevel(0);
  if (!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  // Start analysis in grid.
  if (std::strcmp(mode,"local")==0)
    mgr->StartAnalysis(mode,chain);
  else
    mgr->StartAnalysis("grid");
}
Example #8
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 #9
0
void runProofTRDComparison(const char *dataset="/PWG0/COMMON/run30000X_10TeV_0.5T",Long64_t nentries=1000, Long64_t firstentry=0)
{
  // Connect to Proof
  TProof::Open("lxb6046");

  // Upload and enable packages: please use the correct version!
  gProof->UploadPackage("AF-v4-14");
  gProof->EnablePackage("AF-v4-14");

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

  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("AliTRDComparisonTask.cxx++g");
  AliAnalysisTask *task = new AliTRDComparisonTask("AliTRDComparisonTask");

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

  // Create containers for input/output
  AliAnalysisDataContainer* cinput = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer* coutput = 
    mgr->CreateContainer("coutput", TList::Class(), 
    AliAnalysisManager::kOutputContainer, "AliTRDComparisonHist.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 #10
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 #11
0
Bool_t CreateInputHandlers(TString input,TString inputMC,Bool_t useAODOut=kFALSE,Bool_t useMultiHandler=kTRUE) {

   input.ToLower();
   inputMC.ToLower();

   Bool_t useMC = !inputMC.CompareTo("mc");


   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) { Printf("Error [CreateInputHandlers] : mgr is null !!!"); return kFALSE; }

   if (useMultiHandler) {
      AliMultiInputEventHandler *inputHandler = new AliMultiInputEventHandler();
      if (!input.CompareTo("esd")) {
         Printf("Adding ESD Input Handler ...");
         inputHandler->AddInputEventHandler(new AliESDInputHandler());
         if (useMC) inputHandler->AddInputEventHandler(new AliMCEventHandler());
      } else if (!input.CompareTo("aod")) {
         inputHandler->AddInputEventHandler(new AliAODInputHandler());
      }

      mgr->SetInputEventHandler(inputHandler);
   } else {
      if (!input.CompareTo("esd")) {
         mgr->SetInputEventHandler(new AliESDInputHandler());
         if (useMC) mgr->SetMCtruthEventHandler(new AliMCEventHandler());
      } else if (!input.CompareTo("aod")) {
         mgr->SetInputEventHandler(new AliAODInputHandler());
      }
   }

   if (useAODOut) {
      AliAODHandler *aodHandler   = new AliAODHandler();
      aodHandler->SetOutputFileName("AliAOD.root");
      mgr->SetOutputEventHandler(aodHandler);
   }

   return kTRUE;
}
Example #12
0
AliAnalysisTaskHypCrossCheck *AddTaskHypCrossCheck(Bool_t readMC=kFALSE,
                                         Bool_t fillTree=kFALSE,
                                         Bool_t fillGen=kFALSE,
                                         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("AddTaskHypCrossCheck","Adding a new task with this settings readMC = %i",readMC);

  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskHypCrossCheck", "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("AddTaskHypCrossCheck", "This task requires an input event handler");
    return NULL;
  }

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

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


  // Create and configure the task

  TString tskname = "hypertriton";
  tskname.Append(Form("%s",suffix.Data()));
  AliAnalysisTaskHypCrossCheck *taskhyp = new AliAnalysisTaskHypCrossCheck();
  Float_t p[5] = {7.25105e-01,4.99820e+01,2.35714e-10,2.49196e+00,1.41570e+01};
  taskhyp->SetCustomTPCpid(p,0.08f);

  mgr->AddTask(taskhyp);

  // 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 += ":ESDHypertriton";

  AliAnalysisDataContainer *coutput =0x0;

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



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


  if(fillTree){
      AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("trogolo_HyperTree", TTree::Class(),
                                                                AliAnalysisManager::kOutputContainer,
                                                                "trogolo_HyperNt.root");
      coutput2->SetSpecialOutput();
      mgr->ConnectOutput(taskhyp,2, coutput2);

  }

  if(fillGen){
      AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("trogolo_HyperGen",TTree::Class(),
                                                                AliAnalysisManager::kOutputContainer,
                                                                "trogolo_HyperGen.root");
      coutput3->SetSpecialOutput();
      mgr->ConnectOutput(taskhyp,3,coutput3);
  }

  return taskhyp;
}
Example #13
0
void runLocal(const char *chainlistfile, int dataFromAlien=0) {
  TStopwatch timer;
  timer.Start();

  printf("*** Connect to AliEn ***\n");
  if (dataFromAlien)
    TGrid::Connect("alien://");
  gSystem->Load("libProofPlayer");

  //____________________________________________________//
  //_____________Setting up STEERBase.par_______________//
  //____________________________________________________//
  setupPar("STEERBase");
  gSystem->Load("libSTEERBase");

  //____________________________________________________//
  //_____________Setting up ESD.par_____________________//
  //____________________________________________________//
  setupPar("ESD");
  gSystem->Load("libVMC");
  gSystem->Load("libESD");

  //____________________________________________________//
  //_____________Setting up AOD.par_____________________//
  //____________________________________________________//
  setupPar("AOD");
  gSystem->Load("libAOD");

  //_________________________________________________________//
  //_____________Setting up ANALYSIS.par_____________________//
  //_________________________________________________________//
  setupPar("ANALYSIS");
  gSystem->Load("libANALYSIS");

  //_________________________________________________________//
  //_____________Setting up ANALYSISalice.par________________//
  //_________________________________________________________//
  setupPar("ANALYSISalice");
  gSystem->Load("libANALYSISalice");

  //____________________________________________________//
  //_____________Setting up PWG2AOD.par_________________//
  //____________________________________________________//
  setupPar("PWG2AOD");
  gSystem->Load("libPWG2AOD");
  
  //____________________________________________________//
  //_____________Setting up PWG2femtoscopy.par__________//
  //____________________________________________________//
  setupPar("PWG2femtoscopy");
  gSystem->Load("libPWG2femtoscopy");
  
  //____________________________________________________//
  //_____________Setting up PWG2femtoscopyUser.par______//
  //____________________________________________________//
  setupPar("PWG2femtoscopyUser");
  gSystem->Load("libPWG2femtoscopyUser");
  
  //ANALYSIS PART
  gSystem->SetIncludePath("-I$ROOTSYS/include  -I\"/usr/local/CERN/root/include\" -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I./ESD -I./AOD -I./ANALYSIS -I./PWG2AOD/AOD");
  gROOT->LoadMacro("ConfigFemtoAnalysis.C++");

  //____________________________________________//
  //Usage of event tags
  AliTagAnalysis *analysis = new AliTagAnalysis();
  TChain *chain = 0x0;
  //  chain = analysis->GetChainFromCollection(collectionfile,"esdTree");

  if (dataFromAlien) {
    AliTagAnalysis *analysis = new AliTagAnalysis();
    chain = analysis->GetChainFromCollection(chainlistfile,"esdTree");
  }
  else {
    gROOT->LoadMacro("CreateESDChain.C");
    chain = CreateESDChain(chainlistfile,500);
  }

  //____________________________________________//
  // Make the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
  AliESDInputHandler* esdH = new AliESDInputHandler;
  AliMCEventHandler *mcH = new AliMCEventHandler;

  esdH->SetInactiveBranches("FMD CaloCluster");
  mgr->SetInputEventHandler(esdH);  
  mgr->SetMCtruthEventHandler(mcH);
  //____________________________________________//
  // 1st Pt task
  AliAnalysisTaskFemto *task1 = new AliAnalysisTaskFemto("TaskFemto");

  mgr->AddTask(task1);

  // Create containers for input/output
  //  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("input0", 
							   TTree::Class(), AliAnalysisManager::kInputContainer);
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"Femto.ESD.root");
  
  //____________________________________________//
  cinput1->SetData(chain);
  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 #14
0
void QAtrainAOD(Bool_t isMC=kFALSE, Int_t iCollisionType=0){

  

  if(gSystem->Getenv("ALIEN_JDL_LPMINTERACTIONTYPE")){
    for (Int_t icoll = 0; icoll < kNSystem; icoll++)
      if (strcmp(gSystem->Getenv("ALIEN_JDL_LPMINTERACTIONTYPE"), CollisionSystem[icoll]) == 0){
        iCollisionType = icoll;
	break;
      }
  }
  printf("--------------------------------------\n");
  if(isMC) printf("Run the AOD QA train for Monte Carlo\n");
  else printf("Run the AOD QA train for data\n");
  printf("Collision System is %s\n",CollisionSystem[iCollisionType]);
  printf("--------------------------------------\n");
 
  UInt_t kTriggerMask =  AliVEvent::kINT7 | AliVEvent::kINT8;
  if(gSystem->Getenv("ALIEN_JDL_LPMANCHORYEAR"))
  {
    Int_t year = atoi(gSystem->Getenv("ALIEN_JDL_LPMANCHORYEAR"));
    if(year <= 2015) 
      kTriggerMask = AliVEvent::kAnyINT;
  }
  // Create manager
  AliAnalysisManager *mgr  = new AliAnalysisManager("QAtrainAOD", "AOD QA train");
  mgr->SetCacheSize(0);
  mgr->SetCommonFileName("QAresults_AOD.root");

  // Input handler
  AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
  AliAODInputHandler* aodHandler = new AliAODInputHandler();
  mgr->SetInputEventHandler(aodHandler);
  if(isMC){
    AliMCEventHandler* MChandler = new AliMCEventHandler;
    MChandler->SetReadTR(kFALSE);
    mgr->SetMCtruthEventHandler(MChandler);      
  }
  TString macroName="";

  // Physics selection
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);
  mgr->AddStatisticsTask(kTriggerMask);
  AliAnalysisDataContainer *cstatsout = (AliAnalysisDataContainer*)mgr->GetOutputs()->FindObject("cstatsout");
  cstatsout->SetFileName("EventStat_temp_AOD.root");

  // PID response
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AliAnalysisTaskSE *setupTask = AddTaskPIDResponse(isMC);
  
  // PIDqa
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
  AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
  PIDQA->SelectCollisionCandidates(AliVEvent::kAny);

  // MultSelection
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C");
  AliMultSelectionTask *taskMult = AddTaskMultSelection();
  if(isMC){
    if (gSystem->Getenv("CONFIG_PERIOD")){
      TString periodName = gSystem->Getenv("CONFIG_PERIOD");
      taskMult->SetAlternateOADBforEstimators(periodName);
    }
  }
  // Vertex QA
  macroName="$ALICE_PHYSICS/PWGPP/macros/AddTaskCheckVertexAOD.C";
  if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
    gROOT->LoadMacro(macroName.Data());
    Double_t maxMult=500.;
    if(iCollisionType==kPbPb || iCollisionType==kXeXe) maxMult=10000.;
    AliAnalysisTaskCheckVertexAOD *taskVert =  AddTaskCheckVertexAOD("QA",maxMult,AliVEvent::kAnyINT,isMC);
  }else{
    printf("Macro %s not found -> task will not be executed\n",macroName.Data());
  }

  // Track QA
  macroName="$ALICE_PHYSICS/PWGPP/macros/AddTaskCheckAODTracks.C";
  if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
    gROOT->LoadMacro(macroName.Data());
    Bool_t usMCtruthForPID=isMC;
    AliAnalysisTaskCheckAODTracks* taskAODtr = AddTaskCheckAODTracks("QA",isMC,usMCtruthForPID);
    if(iCollisionType==kPbPb || iCollisionType==kXeXe) taskAODtr->SetUpperMultiplicity(10000.);
  }else{
    printf("Macro %s not found -> task will not be executed\n",macroName.Data());
  }


  // HF deltaAOD QA
  macroName="$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskBasicHFQA.C";
  if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
    gROOT->LoadMacro(macroName.Data());
    AliAnalysisTaskSEHFQA* dqaHF = AddTaskBasicHFQA(AliAnalysisTaskSEHFQA::kD0toKpi,isMC,"QA");
  }else{
    printf("Macro %s not found -> task will not be executed\n",macroName.Data());
  }

  if(isMC){
    macroName="$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskDmesonMCPerform.C";
    if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
      gROOT->LoadMacro(macroName.Data());
      AliAnalysisTaskDmesonMCPerform* dMCp = AddTaskDmesonMCPerform("QA");
    }else{
      printf("Macro %s not found -> task will not be executed\n",macroName.Data());
    }
  }

  TChain *chainAOD = new TChain("aodTree");
  TChain *chainAODfriend = new TChain("aodTree");
  chainAOD->Add("AliAOD.root");
  chainAODfriend->Add("AliAOD.VertexingHF.root"); 
  chainAOD->AddFriend(chainAODfriend);

  TStopwatch timer;
  timer.Start();
  if (mgr->InitAnalysis()) {                      
    mgr->PrintStatus(); 
    mgr->SetSkipTerminate(kTRUE);
    mgr->StartAnalysis("local", chainAOD);
  }
  gSystem->Exec("rm TreeOfAODTracks.root");
  timer.Print();
}
Example #15
0
AliAnalysisTaskOmegaOmegaOX *AddTaskOmegaOmegaOX(TString finname="",
						 Bool_t readMC=kFALSE,
						 Bool_t additionalChecks=kFALSE,
						 TString suffix = ""){

	//------------------------------------------------------------------------------------------
	// version 2.10 (2016/02/11)
	//------------------------------------------------------------------------------------------

  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");
      }
  }

  // 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("AddTaskOmegaOmegaOX","Adding a new task with this settings readMC = %i",readMC);
 
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskOmegaOmegaOX", "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("AddTaskOmegaOmegaOX", "This task requires an input event handler");
    return NULL;
  }   
  
  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  if(type.Contains("AOD")){
    ::Error("AddTaskOmegaOmegaOX", "This task requires to run on ESD");
    return NULL;
  }

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


  // Create and configure the task

  TString taskname = "OmegaOmegaOX";
	TString combinedName;
	combinedName.Form("OmegaOmegaOX%s", suffix.Data());
  AliAnalysisTaskOmegaOmegaOX *task = new AliAnalysisTaskOmegaOmegaOX(combinedName);
  task->SetMC(readMC);
  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 += ":Dibaryon";
  
  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());

  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("CutPar_%s",combinedName.Data()), TTree::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
  mgr->ConnectOutput(task, 1, coutput1);
  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("Vertex_%s",combinedName.Data()), TTree::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
//  coutput2->SetSpecialOutput();
  mgr->ConnectOutput(task, 2, coutput2);


  return task;
}
Example #16
0
//______________________________________________________________________________
void QAtrainsim(Int_t run = 0,
             const char *xmlfile   = "wn.xml",
             Int_t  stage          = 0, /*0 = QA train, 1...n - merging stage*/
             const char *cdb     = "raw://")
{
  run_number = run;

  ProcessEnvironment();

  //
  // set OCDB source
  TString ocdbConfig = "default,snapshot";
  if (gSystem->Getenv("CONFIG_OCDB"))
    ocdbConfig = gSystem->Getenv("CONFIG_OCDB");
  if (stage != 0) {
    //
    gSystem->Setenv("CONFIG_RUN", gSystem->Getenv("ALIEN_JDL_LPMRUNNUMBER"));
    // set OCDB 
    gROOT->LoadMacro("$ALIDPG_ROOT/MC/OCDBConfig.C");
    OCDBDefault(1);
  }
  else if (ocdbConfig.Contains("alien") || ocdbConfig.Contains("cvmfs")) {
    // set OCDB 
    gROOT->LoadMacro("$ALIDPG_ROOT/MC/OCDBConfig.C");
    OCDBDefault(1);
  }
  else {
    // set OCDB snapshot mode
    AliCDBManager *cdbm = AliCDBManager::Instance();
    cdbm->SetSnapshotMode("OCDBrec.root");
  }
  printf("------ Run QAtrainsim.C for collision type %s ------\n",CollisionSystem[iCollisionType]);


  UpdateFlags();
  
  TString cdbString(cdb);
  if (cdbString.Contains("raw://") && !ocdbConfig.Contains("cvmfs")) {
    TGrid::Connect("alien://");
    if (!gGrid || !gGrid->IsConnected()) {
      ::Error("QAtrain", "No grid connection");
      return;
    }
  }
  // gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_PHYSICS -I$ALICE_PHYSICS/include -I$ALICE_PHYSICS/PWGPP/TRD/macros");
  // Set temporary merging directory to current one
  gSystem->Setenv("TMPDIR", gSystem->pwd());
  // Set temporary compilation directory to current one
  gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
  // Load libraries
  // LoadLibraries();
  printf("Include path: %s\n", gSystem->GetIncludePath());
  // Create manager
  AliAnalysisManager *mgr  = new AliAnalysisManager("PilotAnalysis_sim", "Production train");
  mgr->SetRunFromPath(run_number);
  // Input handler
  AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
  esdHandler->SetReadFriends(kTRUE);
  esdHandler->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(esdHandler);
  mgr->SetDebugLevel(debug_level);
  
  // Monte Carlo handler
  AliMCEventHandler* mcHandler = new AliMCEventHandler();
  mgr->SetMCtruthEventHandler(mcHandler);
  mcHandler->SetPreReadMode(1);
  mcHandler->SetReadTR(kTRUE);

  // subsidiary handler for mc-to-mc embedding
  TString bgDir = gSystem->Getenv("CONFIG_BGEVDIR");
  if (!bgDir.IsNull()) { // add extra handler for underlaying event
    if (bgDir.BeginsWith("alien://") && !gGrid && !TGrid::Connect("alien://")) {
      printf("Failed to create a grid connection\n");
      abort();
    }
    if (!bgDir.EndsWith("/")) bgDir += "/";
    AliMCEventHandler* mcHandlerBg = new AliMCEventHandler();
    mcHandlerBg->SetInputPath(bgDir.Data());
    mcHandlerBg->SetPreReadMode(1);
    mcHandlerBg->SetReadTR(kTRUE);
    mcHandler->AddSubsidiaryHandler(mcHandlerBg);
  }
  
  // AnalysisTasks
  //  mgr->Lock();
  mgr->SetFileInfoLog("fileinfo.log"); 
  AddAnalysisTasks(cdb);
  //  mgr->UnLock();
  //  mcHandler = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
  //  mcHandler->SetReadTR(kTRUE);
  //  mcHandler->SetPreReadMode(1);
  if (stage>0) {
    QAmerge(xmlfile, stage);
    return;
  }   
  // Input chain
  TChain *chain = new TChain("esdTree");
  chain->Add("AliESDs.root");
  TStopwatch timer;
  timer.Start();
  if (mgr->InitAnalysis()) {                                                                                                              
    mgr->PrintStatus(); 
    mgr->SetSkipTerminate(kTRUE);
  //   mgr->SetNSysInfo(1);
    mgr->StartAnalysis("local", chain);
  }
  timer.Print();
}
Example #17
0
//_____________________________________________________________________________
void RunPerformanceTrain(Char_t *file="esd.root", Int_t runNumber = 2, const char* triggerClass ="CINT1B-ABCE-NOPF-ALL", Bool_t bUseMCInfo=kFALSE, Bool_t bUseESDfriend=kTRUE, Bool_t bGrid=kFALSE)
{
  //
  // Grid settings
  // use GSI::SE
  if(bGrid) {
    gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE");
    TGrid * alien = TGrid::Connect("alien://",0,0,"t");
    gSystem->Setenv("alien_CLOSE_SE","ALICE::GSI::SE");
  }

  //
  // Train Configuration
  //
  Int_t       iPWGPPperfTPC       = 1;      // Test TPC performance
  Int_t       iPWGPPperfTRD       = 0;      // Test TRD performance
  Int_t       iPWGPPperfITS       = 0;      // Test ITS performance
  Int_t       iPWGPPperfCalo      = 0;      // Test Calo performance
  Int_t       iPWGPPperfMuonTrig  = 0;      // Test Muon Trigger performance
  Int_t       iPWGPPperfMuonEff   = 0;      // Test Muon Efficiency performance
  Int_t       iPWGPPperfTOF       = 0;      // Test TOF-TPC matching performance
  Int_t       iPWGPPperfPrimVertex = 0;     // Test Primary Vertex performance
  Int_t       iPWGPPv0QA          = 0;      // V0 algorithm QA task

  //
  // Load Libraries
  //
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libTender");
  gSystem->Load("libCORRFW");

  gSystem->Load("libTPCcalib");
  gSystem->Load("libPWGPP");

  gSystem->Load("libPHOSUtils");
  gSystem->Load("libEMCALUtils");
  gSystem->Load("libPWG4PartCorrBase");
  gSystem->Load("libPWG4PartCorrDep");

  gSystem->Load("libPWGmuon"); // The class is here

  //
  // OCDB Configuration 
  //
  AliCDBManager *cdbManager = AliCDBManager::Instance();
  cdbManager->SetDefaultStorage("local:///lustre/alice/alien/alice/data/2009/OCDB");
  //cdbManager->SetDefaultStorage("local://$ALICE_PHYSICS/OCDB");
  //cdbManager->SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
  cdbManager->SetRun(runNumber);
  //cdbManager->SetCacheFlag(kFALSE);
  // initialize magnetic field from the GRP manager.
  //if(magField==0) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 0., 0., AliMagF::k2kG));
  //if(magField==1) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k2kG));
  //if(magField==2) TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));

  /*
  AliGRPManager grpMan;
  grpMan.ReadGRPEntry();
  grpMan.SetMagField();
  AliRunInfo *runInfo = grpMan.GetRunInfo();
 
  //
  // Load geometry
  //
  */
  AliGeomManager::LoadGeometry();

  //
  // Swtich off all AliInfo (too much output!)
  //
  AliLog::SetGlobalLogLevel(AliLog::kError);

  //
  // Create input ESD chain
  //
  /*
  gROOT->LoadMacro("$ALICE_PHYSICS/PWG0/CreateESDChain.C");
  TChain* chain = CreateESDChain(list,nFiles,fistFile);
  if(!chain) { 
    Error("RunPerformanceTrain","ESD chain not created!");
    return;
  }
  */
  TChain  *chain = new TChain("esdTree");
  if(!chain) { 
    Error("RunPerformanceTrain","ESD chain not created!");
    return;
  }
  chain->Add(file);
  chain->Lookup();

  //
  // Create analysis manager
  //
  AliAnalysisManager *mgr = new AliAnalysisManager;
  if(!mgr) { 
    Error("RunPerformanceTrain","AliAnalysisManager not set!");
    return;
  }

  //
  // Set ESD input handler
  //
  AliESDInputHandler* esdH = new AliESDInputHandler;
  if(!esdH) { 
    Error("RunPerformanceTrain","AliESDInputHandler not created!");
    return;
  }
  if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(esdH);

  /*
  //
  // Set RecPoints and ESD input handler
  //
  AliESDInputHandlerRP* rpH = new AliESDInputHandlerRP;
  if(!rpH) { 
    Error("RunPerformanceTrain","AliESDInputHandlerRP not created!");
    return;
  }
  if(bUseESDfriend) rpH->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(rpH);
  */

  //
  // Set MC input handler
  //
  if(bUseMCInfo) {
    AliMCEventHandler* mcH = new AliMCEventHandler;
    if(!mcH) { 
      Error("RunPerformanceTrain","AliMCEventHandler not created!");
      return;
    }
    mcH->SetReadTR(kTRUE);
    mgr->SetMCtruthEventHandler(mcH);
  }


  //
  // Add task to AliAnalysisManager
  //

  //
  // TPC performance
  //
  if(iPWGPPperfTPC) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskPerformanceTPC.C");
    AliPerformanceTask *tpcQA = AddTaskPerformanceTPC(bUseMCInfo,bUseESDfriend,triggerClass);
    if(!tpcQA) { 
      Error("RunPerformanceTrain","AliPerformanceTask not created!");
      return;
    }
  } 
  else {
    Printf("RunPerformanceTrain: TPC Performance - EXCLUDED!");
  }
  //
  // TRD perormance
  //
  if(iPWGPPperfTRD) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTrainPerformanceTRD.C");
    if(!AddTrainPerformanceTRD(bUseMCInfo,bUseESDfriend)) { 
      Error("RunPerformanceTrain","TrainPerformanceTRD not created!");
      return;
    }
  } else {
    Printf("RunPerformanceTrain: TRD TrainPerformanceTRD - EXCLUDED!");
  }
  //
  // ITS performance
  //
  if(iPWGPPperfITS) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskPerformanceITS.C");
    AliAnalysisTaskITSTrackingCheck *itsQA = AddTaskPerformanceITS(bUseMCInfo);
    if(!itsQA) { 
      Error("RunPerformanceTrain","AliAnalysisTaskITSTrackingCheck not created!");
      return;
    }
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskITSTrackingCheck - EXCLUDED!");
  }
  //
  // Calorimeter Performance
  //
  if(iPWGPPperfCalo) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWG4/macros/AddTaskCalorimeterQA.C");
    AliAnalysisTaskParticleCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD",bUseMCInfo,kFALSE);
    if(!taskCaloQA) { 
      Error("RunPerformanceTrain","AliAnalysisTaskParticleCorrelation not created!");
      return;
    }
    mgr->AddTask(taskCaloQA);
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskParticleCorrelation - EXCLUDED!");
  }
  //
  // Muon Trigger
  //
  if(iPWGPPperfMuonTrig) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
    AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
    if(!taskMuonTrig) { 
      Error("RunPerformanceTrain","AliAnalysisTaskTrigChEff not created!");
      return;
    }
    mgr->AddTask(taskMuonTrig);
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskTrigChEff - EXCLUDED!");
  }
  //
  // Muon Efficiency
  //
  if(iPWGPPperfMuonEff) {
  gROOT->LoadMacro("$ALICE_PHYSICS/PWG3/muondep/AddTaskMUONTrackingEfficiency.C");
  AliAnalysisTaskMuonTrackingEff *taskMuonTrackEff = AliAnalysisTaskMuonTrackingEff();
  if(!taskMuonTrackEff) { 
     Error("RunPerformanceTrain","AliAnalysisTaskMuonTrackingEff not created!");
     return;
  }
  mgr->AddTask(taskMuonTrackEff);
  } 
  else {
    Printf("RunPerformanceTrain: Muon Efficiency - EXCLUDED!");
  }
  //
  // TOF performance
  //
  if(iPWGPPperfTOF) {
  //
  } 
  else {
    Printf("RunPerformanceTrain: TOF - EXCLUDED!");
  }
  //
  // PWGPP Primary Vertex
  //
  if(iPWGPPperfPrimVertex) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskVertexESD.C");
    AliAnalysisTaskVertexESD *taskPrimVertex = AddTaskVertexESD();
    if(!taskPrimVertex) { 
      Error("RunPerformanceTrain","AliAnalysisTaskVertexESD not created!");
      return;
    }
  } 
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskVertexESD - EXCLUDED!");
  }
  //
  // PWGPP V0 QA
  //
  if (iPWGPPv0QA) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskV0QA.C");
    AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(bUseMCInfo);
    if(!taskv0QA) {
      Error("RunPerformanceTrain","AliAnalysisTaskV0QA not created!");
      return;
    }    
  }
  else {
    Printf("RunPerformanceTrain: AliAnalysisTaskV0QA - EXCLUDED!");
  }

  //
  // Disable debug printouts
  //
  mgr->SetDebugLevel(0);

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

  mgr->PrintStatus();
  //mgr->StartAnalysis("local",chain, nEvents, firstEvent);
  mgr->StartAnalysis("local",chain);
}
Example #18
0
//
// This is an example of steering macro for running RSN analysis task
// locally with a collection of files written in a text file
//
// Allowed inputs:
// - ESD + MC (MC is included automatically)
// - AOD
//
// All settings are specified as arguments in the main macro,
// which is at the end of this script.
//
void RunAnalysisPhi900GeV
(
  Int_t       nReadFiles   = 2,
  Int_t       nSkipFiles   = 0,
  const char *dataType     = "900GeV_pass4_sim",
  const char *inputSource  = "list.txt",
  const char *outName1     = "Phi900GeV_all.root",
  const char *outName2     = "Phi900GeV_true.root",
  const char *outName3     = "Phi900GeV_info.root"
)
{
  // convert the last argument into a BOOL variable
  Bool_t isMC = kTRUE;
  if (!strcmp(dataType, "900GeV_pass4_data")) isMC = kFALSE;
  if (!strcmp(dataType, "7TeV_pass1_data")) isMC = kFALSE;

  // message on aliroot version
  cout << "*** ALIROOT PATH = " << gSystem->Getenv("ALICE_ROOT") << " ***" << endl;
  cout << "*** MC " << (isMC ? "" : "NOT") << " INCLUDED ***" << endl;

  // check extension of input to distinguish between XML and TXT
  TString sInput(inputSource);
  sInput.ToLower();
  Bool_t isTXT = (!strcmp(sInput(sInput.Length() - 3, 3).Data(), "txt"));
  cout << "Input = " << (isTXT ? "TXT" : "XML") << endl;

  // load compiled libraries (for aliroot session)
  gSystem->Load("libANALYSIS.so");
  gSystem->Load("libANALYSISalice.so");
  gSystem->Load("libPWG2resonances.so");

  // if input is XML, connect to AliEn
  if (!isTXT) TGrid::Connect("alien://");

  // create analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("MyTaskManager");

  // create handlers for input
  AliESDInputHandler *esdHandler = new AliESDInputHandler();
  mgr->SetInputEventHandler(esdHandler);
  // if required, create also MC handler
  if (isMC)
  {
    AliMCEventHandler *mcHandler  = new AliMCEventHandler();
    mgr->SetMCtruthEventHandler(mcHandler);
  }
  
  // add event selection for data
  gROOT->LoadMacro("AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);

  // add task macro
  AliRsnAnalysisPhi900GeV *task = new AliRsnAnalysisPhi900GeV("taskphi900gev");
  task->SelectCollisionCandidates();
  task->SetTPCparams(isMC);
  task->SetMaxChi2(4.0);
  task->SetMaxDCAr(0.5);
  task->SetMaxDCAz(3.0);
  task->SetMinNTPC(80);
  task->SetUseMC(kFALSE);
  if (!strcmp(dataType, "900GeV_pass4_data"))
  {
    task->SetTOFESD(kFALSE);
    task->SetTOFSigma(130.0);
    task->SetTOFSettings(AliTOFT0makerANA::kPass4);
  }
  if (!strcmp(dataType, "7TeV_pass1_data"))
  {
    task->SetTOFESD(kFALSE);
    task->SetTOFSigma(130.0);
    task->SetTOFSettings(AliTOFT0makerANA::kPass4);
  }
  else if (!strcmp(dataType, "900GeV_pass4_sim"))
  {
    task->SetTOFESD(kTRUE);
    task->SetTOFSigma(130.0);
    task->SetTOFSettings(AliTOFT0makerANA::kNone);
  }
  mgr->AddTask(task);
  
  // create containers for input/output
  AliAnalysisDataContainer *out1 = mgr->CreateContainer("tracks", TTree::Class(), AliAnalysisManager::kOutputContainer, outName1);
  AliAnalysisDataContainer *out2 = mgr->CreateContainer("rsn"   , TTree::Class(), AliAnalysisManager::kOutputContainer, outName2);
  AliAnalysisDataContainer *out3 = mgr->CreateContainer("info"  , TList::Class(), AliAnalysisManager::kOutputContainer, outName3);
  mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(task, 1, out1);
  mgr->ConnectOutput(task, 2, out2);
  mgr->ConnectOutput(task, 3, out3);

  // create TChain of input events
  TChain *analysisChain = 0x0;
  if (isTXT) analysisChain = CreateChainFromText(inputSource, "esdTree", nReadFiles, nSkipFiles);
  else       analysisChain = CreateChainFromXML (inputSource, "esdTree", nReadFiles, nSkipFiles);

  // start analysis
  if (!analysisChain)
  {
    Error("runLocal", "Analysis chain not properly initialized");
    return;
  }
  mgr->InitAnalysis();
  mgr->PrintStatus();
  if (isTXT) mgr->StartAnalysis("local", analysisChain);
  else       mgr->StartAnalysis("alien", analysisChain);
}
Example #19
0
void runNorm(TString inputFileName = "AliAOD.root", Int_t nEvents = 1e6, TString beamConf = "p-Pb", Bool_t isESD = kFALSE, Bool_t isMC = kFALSE, Int_t debugLevel = 0)
{

  TStopwatch timer;
  timer.Start();
  
  // Check runing mode
  Int_t mode = GetMode(inputFileName);
  if(mode < 0){
    Error("runAnalysis","Please provide either an ESD/AOD root file or a collection of ESDs/AODs.");
    return;
  }
  
  // Load common libraries
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  gSystem->Load("libSTEERBase");
  //  gSystem->Load("libSTEER");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libEventMixing");
  gSystem->Load("libCORRFW");
  gSystem->Load("libPWGmuon"); 
  gSystem->Load("libPWGmuondep"); 
  
  gSystem->AddIncludePath(Form("-I\"%s/include\" -I\"%s/include\"", gSystem->ExpandPathName("$ALICE_ROOT"),gSystem->ExpandPathName("$ALICE_PHYSICS")));
  gROOT->ProcessLine(Form(".include %s/include %s/include", gSystem->ExpandPathName("$ALICE_ROOT"), gSystem->ExpandPathName("$ALICE_PHYSICS")));

  // Create input chain
  TChain* chain = CreateChain(inputFileName,isESD);
  if (!chain) return;
  
  // Create the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("MuonTask");
  
  if ( isESD) {
    // ESD input handler
    AliESDInputHandler* esdH = new AliESDInputHandler();
    esdH->SetReadFriends(kFALSE);
    mgr->SetInputEventHandler(esdH);
  }
  else {
    // AOD input handler
    AliAODInputHandler* aodH = new AliAODInputHandler();
    mgr->SetInputEventHandler(aodH);
  }

  TString dataType = mgr->GetInputEventHandler()->GetDataType();
  Info("runLocal",Form("Manager with %s",dataType.Data()));

 // Enable MC event handler for ESDs
  if ( isMC && isESD ){
    AliVEventHandler* handler = new AliMCEventHandler;
    mgr->SetMCtruthEventHandler(handler);
  }
  
  // event selection and centrality framework
  if ( isESD ){
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
    AliPhysicsSelectionTask* physicsSelection = AddTaskPhysicsSelection(isMC);
    if ( !physicsSelection ) {
      Error("runLocal","AliPhysicsSelectionTask not created!");
      return;
    }
  }
  if ( isESD ){
    // event centrality
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
    if ( !taskCentrality ) {
      Error("runLocal on ESD","AliCentralitySelectionTask not created!");
      return;
    }
    if ( isMC ) taskCentrality->SetMCInput();     
    //taskCentrality->SetPass(1); // remember to set the pass you are processing!!!
  }
  /*else {
    //Only on full AOD, it is possible to reprocess the centrality framework
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(kTRUE,kTRUE);
    if ( !taskCentrality ) {
      Error("runLocal on AOD","AliCentralitySelectionTask not created!");
      return;
    }
    if ( isMC ) taskCentrality->SetMCInput();    
    }*/
  
  // Example analysis
  // Create task
  //Analysis task is on working directory
  //  gROOT->LoadMacro("AliAnalysisTaskNorm.cxx+g");
  //  gROOT->LoadMacro("AddTaskNorm.C");
  gROOT->LoadMacro("$ALICE_PHYSICS/../src/PWG/muon/AliAnalysisTaskNorm.cxx+g");
  gROOT->LoadMacro("$ALICE_PHYSICS/../src/PWG/muon/AddTaskNorm.C");
  AliAnalysisTaskNorm* task = AddTaskNorm(isESD,isMC,beamConf);
  if (!task) {
    Error("runAnalysis","AliAnalysisTaskNorm not created!");
    return;
  }
  task->SetDebugLevel(debugLevel);
  
  // Enable debug printouts
  mgr->SetDebugLevel(debugLevel);

  // start local analysis
  if (mgr->InitAnalysis()) {
    mgr->PrintStatus();
    if(debugLevel>=2) mgr->SetNSysInfo(100);
    mgr->StartAnalysis("local", chain, nEvents);
  }

  if(debugLevel>=2){
    mgr->ProfileTask("Task");
  }

  timer.Stop();
  timer.Print();
}
Example #20
0
//______________________________________________________________________________
void AODtrain(Int_t merge=0)
{
  // Main analysis train macro.
  ProcessEnvironment();

  UpdateFlags();

  PrintSettings();

  if (merge || doCDBconnect) {
    TGrid::Connect("alien://");
    if (!gGrid || !gGrid->IsConnected()) {
      ::Error("AODtrain", "No grid connection");
      return;
    }
  }
  // Set temporary merging directory to current one
  gSystem->Setenv("TMPDIR", gSystem->pwd());
  // Set temporary compilation directory to current one
  gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
   printf("==================================================================\n");
   printf("===========    RUNNING FILTERING TRAIN   ==========\n");
   printf("===========    Collision System is %s    ==========\n",CollisionSystem[iCollision]);
   printf("==================================================================\n");
   printf("=  Configuring analysis train for:                               =\n");
   if (usePhysicsSelection)   printf("=  Physics selection                                                =\n");
   if (useTender)    printf("=  TENDER                                                        =\n");
   if (iESDfilter)   printf("=  ESD filter                                                    =\n");
   if (iMUONcopyAOD) printf("=  MUON copy AOD                                                 =\n");
   if (iJETAN)       printf("=  Jet analysis                                                  =\n");
   if (iJETANdelta)  printf("=     Jet delta AODs                                             =\n");
   if (iPWGHFvertexing) printf("=  PWGHF vertexing                                                =\n");
   if (iPWGDQJPSIfilter) printf("=  PWGDQ j/psi filter                                             =\n");
   if (iPWGHFd2h) printf("=  PWGHF D0->2 hadrons QA                                     =\n");

   // Make the analysis manager and connect event handlers
   AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", "Production train");
    mgr->SetCacheSize(0);
   if (useSysInfo) {
      //mgr->SetNSysInfo(100);
      AliSysInfo::SetVerbose(kTRUE);
   }   
   // Create input handler (input container created automatically)
   // ESD input handler
   AliESDInputHandler *esdHandler = new AliESDInputHandler();
   mgr->SetInputEventHandler(esdHandler);       
   // Monte Carlo handler
   if (useMC) {
      AliMCEventHandler* mcHandler = new AliMCEventHandler();
      mgr->SetMCtruthEventHandler(mcHandler);
      mcHandler->SetReadTR(useTR); 
   }   
   // AOD output container, created automatically when setting an AOD handler
   if (iAODhandler) {
      // AOD output handler
      AliAODHandler* aodHandler   = new AliAODHandler();
      aodHandler->SetOutputFileName("AliAOD.root");
      mgr->SetOutputEventHandler(aodHandler);
   }
   // Debugging if needed
   if (useDBG) mgr->SetDebugLevel(3);

   AddAnalysisTasks(cdbPath);
   if (merge) {
      AODmerge();
      mgr->InitAnalysis();
      mgr->SetGridHandler(new AliAnalysisAlien);
      mgr->StartAnalysis("gridterminate",0);
      return;
   }   
   // Run the analysis                                                                                                                     
   //
   TChain *chain = CreateChain();
   if (!chain) return;
                                                                                                                                                   
   TStopwatch timer;
   timer.Start();
   mgr->SetSkipTerminate(kTRUE);
   if (mgr->InitAnalysis()) {
      mgr->PrintStatus();
      mgr->StartAnalysis("local", chain);
   }
   timer.Print();
}                                                                                                                                          
Example #21
0
//______________________________________________________________________________
// creates an AliAnalysisTaskCEP and the output containers
//
AliAnalysisTaskSE* AddTaskCEPAnalysis (
  TString taskname        = TString("CEPAnalysis"),
  UInt_t  taskconfig      = AliCEPBase::kBitConfigurationSet,
  Int_t rnummin,
  Int_t rnummax,
  Int_t   numTracksMax    = 6,
  Double_t fracDG         = 1.0,
  Double_t fracNDG        = 0.0,
  UInt_t  ETmaskDG        = AliCEPBase::kETBaseLine,
  UInt_t  ETpatternDG     = AliCEPBase::kETBaseLine,
  UInt_t  ETmaskNDG       = AliCEPBase::kETBaseLine,
  UInt_t  ETpatternNDG    = AliCEPBase::kETBaseLine,
  UInt_t  TTmask          = AliCEPBase::kTTBaseLine,
  UInt_t  TTpattern       = AliCEPBase::kTTBaseLine
  )
{

	// get the manager and task
	AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

  // check for MonteCarlo
  Bool_t isMC = (taskconfig&AliCEPBase::kBitisMC)==AliCEPBase::kBitisMC;
  if (isMC) {
    AliMCEventHandler* MChandler = new AliMCEventHandler;
    MChandler->SetReadTR(kFALSE);
    mgr->SetMCtruthEventHandler(MChandler);
  }

  // create the analysis task
	AliAnalysisTaskCEP *task = new AliAnalysisTaskCEP (
    taskname.Data(),taskconfig,
    rnummin,rnummax,
    numTracksMax,
    fracDG,fracNDG,
    ETmaskDG,ETpatternDG,ETmaskNDG,ETpatternNDG,TTmask,TTpattern
  );

	// get input and output managers
	AliAnalysisDataContainer *aadci  = mgr->GetCommonInputContainer();
	AliAnalysisDataContainer *aadco1 = mgr->CreateContainer
	(
		Form("CEPHist"),
		TList::Class(),
		AliAnalysisManager::kOutputContainer,
		Form("%s", AliAnalysisManager::GetCommonFileName())
	);

	AliAnalysisDataContainer *aadco2 = mgr->CreateContainer
	(
		Form("CEPTree"),
		TTree::Class(),
		AliAnalysisManager::kOutputContainer,
		Form("%s", AliAnalysisManager::GetCommonFileName())
	);
	
	// add task and connect input and output managers
	mgr->AddTask(task);
	mgr->ConnectInput (task,0,aadci);
	mgr->ConnectOutput(task,1,aadco1);
	mgr->ConnectOutput(task,2,aadco2);

	// return pointer to Task
	return task;

}
Example #22
0
void runTask(Float_t etamax=0.5,const char * incollection = 0, const char * outfile = "dndeta.root", Bool_t skipNorm = kFALSE)
{
  // for running with root only
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");

  // load analysis framework
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");


  TChain * chain = new TChain ("TE");
  if (incollection == 0) {
    chain->Add("galice.root");
  }
  else if (TString(incollection).Contains("xml")){
    TGrid::Connect("alien://");
    TAlienCollection * coll = TAlienCollection::Open (incollection);
    while(coll->Next()){
      chain->Add(TString("alien://")+coll->GetLFN());
    }
  } else {
    ifstream file_collect(incollection);
    TString line;
    while (line.ReadLine(file_collect) ) {
      chain->Add(line.Data());
    }
  }
  chain->GetListOfFiles()->Print();

  // for includes use either global setting in $HOME/.rootrc
  // ACLiC.IncludePaths: -I$(ALICE_ROOT)/include
  // or in each macro
  gSystem->AddIncludePath("-I$ALICE_ROOT/include");

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

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

  // Create tasks
  gROOT->LoadMacro("AliAnalysisTaskdNdetaMC.cxx++g");

  AliAnalysisTask *task1 = new AliAnalysisTaskdNdetaMC("TaskdNdeta");
  ((AliAnalysisTaskdNdetaMC*)task1)->SetEtaMax(etamax);
  if (skipNorm) ((AliAnalysisTaskdNdetaMC*)task1)->SkipNormalization();
  // Enable MC event handler

  AliMCEventHandler* handler = new AliMCEventHandler;
  handler->SetReadTR(kFALSE);
  mgr->SetMCtruthEventHandler(handler);

  // Add tasks
  mgr->AddTask(task1);

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

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

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

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

  mgr->PrintStatus();

  mgr->StartAnalysis("local", chain);
}
Example #23
0
//______________________________________________________________________________
void runPmdTask(Bool_t         isGrid = 0,
		Bool_t           isMC = 0,
		const char *gridmode  = "test") {

 
  if (isGrid) {
    Printf("Strating the Grid Job ");
    Printf("Grid Mode %s",gridmode);
    if (isMC)  Printf("It is Data Type Run");
    if (!isMC) Printf("It is MC Type Run");
  }
    
  // Load the needed libraries most of 
  // them already loaded by aliroot
  //--------------------------------------
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libXMLIO");
  gSystem->Load("libPhysics");

  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");

  // Use AliRoot includes to compile our task                                   
  gROOT->ProcessLine(".include $ALICE_INSTALL/include");
  
  AliAnalysisManager *mgr = new AliAnalysisManager("PMDAnalysis");
  
  if(isGrid) {
    gROOT->LoadMacro("CreateAlienHandler.C");
    AliAnalysisGrid *alienHandler = CreateAlienHandler(gridmode);  
    if (!alienHandler) return;
    mgr->SetGridHandler(alienHandler);
  }
    
  
 
  //  TChain *  chain;
  //  if(!isGrid) {
  //  gROOT->LoadMacro("CreateESDChain.C"); // use it if you know it
  //  chain = CreateESDChain("file.txt", 10);
  //  }
 
  TChain *  chain = new TChain("esdTree"); 
  if(!isGrid) {
    ifstream file_collect(incollection);
    TString line;
    while (line.ReadLine(file_collect) ) {
      chain->Add(line.Data());
    }
  }
    
  if(isMC) {
    AliVEventHandler* esdH = new AliESDInputHandler();
    mgr->SetInputEventHandler(esdH);
    AliMCEventHandler *mc = new AliMCEventHandler();
    //mc->SetReadTR(kTRUE);
    mgr->SetMCtruthEventHandler(mc);
    gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
    AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection(isMC);
    physicsSelTask->GetPhysicsSelection()->SetAnalyzeMC();

    gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *centralityTask = AddTaskCentrality();
  } else {
    AliVEventHandler* esdH = new AliESDInputHandler();
    mgr->SetInputEventHandler(esdH);
    gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
    AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection(isMC);
    
    gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *centralityTask = AddTaskCentrality();
  }

  gROOT->LoadMacro("AliPMDAnalysisTaskPbPb.cxx++g");   
  gROOT->LoadMacro("AddAliPMDAnalysisTaskPbPb.C");
  AddAliPMDAnalysisTaskPbPb("MyTask",isMC);
  
  // Enable debug printouts
  mgr->SetDebugLevel(0);
  if (!mgr->InitAnalysis())
    return;
  
 mgr->PrintStatus();
 
 if(isGrid)
   mgr->StartAnalysis("grid");
 else  
   mgr->StartAnalysis("local",chain);
 
};
void runFlowTaskCentralityKinkTrain( Int_t mode = mLocal,
                                     Bool_t useFlowParFiles = kFALSE,
                                     Bool_t DATA = kTRUE,
                                     const Char_t* dataDir="fileList",
                                     Int_t nEvents = 1e4,
                                     Int_t offset=0 )
{
  // Time:
  TStopwatch timer;
  timer.Start();

  // Load needed libraries:
  LoadLibraries(mode,useFlowParFiles);

  // Create analysis manager:
  AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");

  // Chains:
  if(mode == mLocal)
  {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGUD/macros/CreateESDChain.C");
    TChain* chain = CreateESDChain(dataDir, nEvents, offset);
    //TChain* chain = CreateAODChain(dataDir, nEvents, offset);
  }

  // Connect plug-in to the analysis manager:
  if(mode == mGrid)
  {
    gROOT->LoadMacro("CreateAlienHandler.C");
    AliAnalysisGrid *alienHandler = CreateAlienHandler(useFlowParFiles);
    if(!alienHandler) return;
    mgr->SetGridHandler(alienHandler);
  }

  // Event handlers:
  AliVEventHandler* esdH = new AliESDInputHandler;
  mgr->SetInputEventHandler(esdH);
  if (!DATA)
  {
    AliMCEventHandler *mc = new AliMCEventHandler();
    mgr->SetMCtruthEventHandler(mc);
  }

  // Task to check the offline trigger:
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
  AddTaskPhysicsSelection(!DATA);

  //Add the centrality determination task
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask* centSelTask = AddTaskCentrality();
  if (!DATA) centSelTask->SetMCInput();

  //add the PID response task
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AliAnalysisTaskPIDResponse* pidresponsetask = AddTaskPIDResponse(!DATA);

  //Add the TOF tender
  //gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/AddTaskTenderTOF.C");
  //AddTaskTenderTOF();

  // Setup kink analysis per centrality bin:
  gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityKink.C");
  for (Int_t i=binfirst; i<binlast+1; i++)
  {
    Float_t lowCentralityBinEdge = centralityArray[i];
    Float_t highCentralityBinEdge = centralityArray[i+1];
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,2,kTRUE );
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              1,2,kTRUE );
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,3 );
    AddTaskFlowCentralityKink( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kUnknown,
                              AliFlowTrackCuts::kTOFbeta,
                              1,3 );
  } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)

  // Setup kaon analysis per centrality bin:
  gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityPID.C");
  for (Int_t i=binfirst; i<binlast+1; i++)
  {
    Float_t lowCentralityBinEdge = centralityArray[i];
    Float_t highCentralityBinEdge = centralityArray[i+1];
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              -1,3 );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kKaon,
                              AliFlowTrackCuts::kTOFbeta,
                              1,3 );
  } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)

  // Setup He3 analysis per centrality bin:
  gROOT->LoadMacro("$ALICE_PHYSICS/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityPID.C");
  for (Int_t i=binfirst; i<binlast+1; i++)
  {
    Float_t lowCentralityBinEdge = centralityArray[i];
    Float_t highCentralityBinEdge = centralityArray[i+1];
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              -1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              1,2,kTRUE );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              -1,3 );
    AddTaskFlowCentralityPID( lowCentralityBinEdge,
                              highCentralityBinEdge,
                              commonOutputFileName,
                              AliPID::kHe3,
                              AliFlowTrackCuts::kTPCNuclei,
                              1,3 );
  } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)

  // Enable debug printouts:
  mgr->SetDebugLevel(2);
  // Run the analysis:
  if(!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  if(mode == mLocal)
  {
    mgr->StartAnalysis("local",chain);
  }
  else if(mode == mPROOF)
  {
    mgr->StartAnalysis("proof",dataDir,nEvents,offset);
  }
  else if(mode == mGrid)
  {
    mgr->StartAnalysis("grid");
  }

  // Print real and CPU time used for analysis:
  timer.Stop();
  timer.Print();

} // end of void runFlowTaskCentralityPIDTrain(...)
Example #25
0
//______________________________________________________________________________
void AODtrainsim(Int_t merge=0)
{
  // Main analysis train macro.
  // merge = 0: production
  // merge = 1: intermediate merging
  // merge = 2: final merging + terminate
  // merge = 3: terminate only

  if (merge) {
    TGrid::Connect("alien://");
    if (!gGrid || !gGrid->IsConnected()) {
      ::Error("AODtrainsim.C", "No grid connection");
      return;
    }
  }
  // Set temporary merging directory to current one
  gSystem->Setenv("TMPDIR", gSystem->pwd());
  // Set temporary compilation directory to current one
  gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
  printf("==================================================================\n");
  printf("===========    RUNNING FILTERING TRAIN   ==========\n");
  printf("==================================================================\n");
  printf("=  Configuring analysis train for:                               =\n");
  if (usePhysicsSelection)   printf("=  Physics selection                                                =\n");
  if (iESDfilter)   printf("=  ESD filter                                                    =\n");
  if (iMUONcopyAOD) printf("=  MUON copy AOD                                                 =\n");

  // Load common libraries and set include path
  gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_PHYSICS/include");

  // Make the analysis manager and connect event handlers
  AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", "Production train");
  if (useSysInfo) mgr->SetNSysInfo(100);

  // Load ParFiles
  if (!LoadAnalysisLibraries()) {
    ::Error("AODtrainsim.C", "Could not load analysis libraries");
    return;
  }
  
  // Create input handler (input container created automatically)
  // ESD input handler
  AliESDInputHandler *esdHandler = new AliESDInputHandler();
  mgr->SetInputEventHandler(esdHandler);
  // Monte Carlo handler
  if (useMC) {
    AliMCEventHandler* mcHandler = new AliMCEventHandler();
    mgr->SetMCtruthEventHandler(mcHandler);
    mcHandler->SetReadTR(useTR);
  }
  // AOD output container, created automatically when setting an AOD handler
  if (iAODhandler) {
    // AOD output handler
    AliAODHandler* aodHandler   = new AliAODHandler();
    aodHandler->SetOutputFileName("AliAOD.root");
    mgr->SetOutputEventHandler(aodHandler);
  }
  // Debugging if needed
  if (useDBG) mgr->SetDebugLevel(3);

  AddAnalysisTasks(merge);
  if (merge) {
    if (merge < 3) AODmerge();
    if (merge > 1) {
      mgr->InitAnalysis();
      mgr->SetGridHandler(new AliAnalysisAlien());
      mgr->StartAnalysis("grid terminate",0);
    }
    return;
  }
  // Run the analysis
  //
  TChain *chain = CreateChain();
  if (!chain) return;

  TStopwatch timer;
  timer.Start();
  mgr->SetSkipTerminate(kTRUE);
  if (mgr->InitAnalysis()) {
    mgr->PrintStatus();
    mgr->StartAnalysis("local", chain);
  }
  timer.Print();
}
//_____________________________________________________________________________
void RunPerformanceTaskResEffMC(TChain *chain, Bool_t bUseMCInfo=kTRUE, Bool_t bUseESDfriend=kTRUE,  Bool_t bProof=kTRUE)
{
  if(!chain) 
  {
    AliDebug(AliLog::kError, "ERROR: No input chain available");
    return;
  }
  //
  // Swtich off all AliInfo (too much output!)
  //
  AliLog::SetGlobalLogLevel(AliLog::kError);

  //
  // Create analysis manager
  //
  AliAnalysisManager *mgr = new AliAnalysisManager;
  if(!mgr) { 
    Error("runTPCQA","AliAnalysisManager not set!");
    return;
  }

  //
  // Set ESD input handler
  //
  AliESDInputHandler* esdH = new AliESDInputHandler;
  if(!esdH) { 
    Error("runTPCQA","AliESDInputHandler not created!");
    return;
  }
  if(bUseESDfriend) esdH->SetActiveBranches("ESDfriend");
  mgr->SetInputEventHandler(esdH);

  //
  // Set MC input handler
  //
  if(bUseMCInfo) {
    AliMCEventHandler* mcH = new AliMCEventHandler;
    if(!esdH) { 
      Error("runTPCQA","AliMCEventHandler not created!");
      return;
    }
    mcH->SetReadTR(kTRUE);
    mgr->SetMCtruthEventHandler(mcH);
  }

  //
  // Create task
  //
  AliPerformanceTask *task = new AliPerformanceTask("Performance","TPC Performance");
  if (!task) {
    Error("AddTaskPerformanceTPC", "TPC performance task cannot be created!");
    return NULL;
  }
  task->SetUseMCInfo(bUseMCInfo);
  task->SetUseESDfriend(bUseESDfriend);

  //
  // Add task to analysis manager
  //
  mgr->AddTask(task);

  //
  // Create TPC-ESD track reconstruction cuts
  // MB tracks
  //
  AliRecInfoCuts *pRecInfoCutsTPC = new AliRecInfoCuts("pRecInfoCutsTPC"); 
  if(pRecInfoCutsTPC) {
    pRecInfoCutsTPC->SetMaxDCAToVertexXY(3.0);
    pRecInfoCutsTPC->SetMaxDCAToVertexZ(30.0);
    //pRecInfoCutsTPC->SetMaxDCAToVertexZ(3.0);
    pRecInfoCutsTPC->SetRequireSigmaToVertex(kFALSE);
    pRecInfoCutsTPC->SetRequireTPCRefit(kFALSE);
    pRecInfoCutsTPC->SetAcceptKinkDaughters(kTRUE);
    pRecInfoCutsTPC->SetMinNClustersTPC(50);
    pRecInfoCutsTPC->SetMaxChi2PerClusterTPC(1000000.);
    pRecInfoCutsTPC->SetDCAToVertex2D(kFALSE);

    pRecInfoCutsTPC->SetHistogramsOn(kFALSE); 
  } 
  else {
    Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!");
    return NULL;
  }

  //
  // Create TPC-ESD track reconstruction cuts
  // MATCH tracks
  //
  AliRecInfoCuts *pRecInfoCutsMATCH = new AliRecInfoCuts("pRecInfoCutsMATCH"); 
  if(pRecInfoCutsMATCH) {
    pRecInfoCutsMATCH->SetMaxDCAToVertexXY(3.0);
    pRecInfoCutsMATCH->SetMaxDCAToVertexZ(3.0);
    pRecInfoCutsMATCH->SetRequireSigmaToVertex(kFALSE);
    pRecInfoCutsMATCH->SetRequireTPCRefit(kFALSE);
    pRecInfoCutsMATCH->SetAcceptKinkDaughters(kTRUE);
    pRecInfoCutsMATCH->SetMinNClustersTPC(50);
    pRecInfoCutsMATCH->SetMaxChi2PerClusterTPC(1000000.);
    pRecInfoCutsMATCH->SetDCAToVertex2D(kFALSE);
    pRecInfoCutsMATCH->SetTPCITSMatchingRadius(70); 
    pRecInfoCutsMATCH->SetTPCTRDMatchingRadius(260); 
    pRecInfoCutsMATCH->SetMinNClustersITS(3);

    pRecInfoCutsMATCH->SetHistogramsOn(kFALSE); 
  } 
  else {
    Error("AddTaskPerformanceTPC", "AliRecInfoCutsTPC cannot be created!");
    return NULL;
  }

  //
  // Create TPC-ESD track reconstruction cuts
  // standard cuts
  AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts("pRecInfoCuts"); 
  if(pRecInfoCuts) {
    pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
    pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
    pRecInfoCuts->SetMinNClustersTPC(50);
    pRecInfoCuts->SetMinNClustersITS(2);
    pRecInfoCuts->SetHistogramsOn(kFALSE); 
    pRecInfoCuts->SetTPCITSMatchingRadius(70); 
    pRecInfoCuts->SetTPCTRDMatchingRadius(260); 
  } 
  else {
    Error("AddTaskPerformanceTPC", "AliRecInfoCuts cannot be created!");
    return NULL;
  }
  //
  // Create TPC-MC track reconstruction cuts
  //
  AliMCInfoCuts  *pMCInfoCuts = new AliMCInfoCuts("pMCInfoCuts");
  if(pMCInfoCuts) {
    pMCInfoCuts->SetMinTrackLength(70);
  } 
  else {
    Error("AddTaskPerformanceTPC", "AliMCInfoCuts cannot be created!");
    return NULL;
  }

  //
  // Create performance objects for TPC and set cuts 
  //
  enum { kTPC = 0, kTPCITS, kConstrained, kTPCInner, kTPCOuter, kTPCSec };

  //
  // Resolution
  //
  AliPerformanceRes *pCompRes0 = new AliPerformanceRes("AliPerformanceRes","AliPerformanceRes",kTPC,kFALSE); 
  if(!pCompRes0) {
    Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceRes");
  }
  pCompRes0->SetAliRecInfoCuts(pRecInfoCuts);
  pCompRes0->SetAliMCInfoCuts(pMCInfoCuts);

  AliPerformanceRes *pCompRes3 = new AliPerformanceRes("AliPerformanceResTPCInner","AliPerformanceResTPCInner",kTPCInner,kFALSE); 
  if(!pCompRes3) {
    Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCInner");
  }
  pCompRes3->SetAliRecInfoCuts(pRecInfoCuts);
  pCompRes3->SetAliMCInfoCuts(pMCInfoCuts);

  AliPerformanceRes *pCompRes4 = new AliPerformanceRes("AliPerformanceResTPCOuter","AliPerformanceResTPCOuter",kTPCOuter,kFALSE); 
  if(!pCompRes4) {
    Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceResTPCOuter");
  }
  pCompRes4->SetAliRecInfoCuts(pRecInfoCuts);
  pCompRes4->SetAliMCInfoCuts(pMCInfoCuts);
  //
  // Efficiency
  //
  AliPerformanceEff *pCompEff0 = new AliPerformanceEff("AliPerformanceEff","AliPerformanceEff",kTPC,kFALSE); 
  if(!pCompEff0) {
    Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceEff");
  }
  pCompEff0->SetAliRecInfoCuts(pRecInfoCuts);
  pCompEff0->SetAliMCInfoCuts(pMCInfoCuts);
  //
  // dEdx
  //
  AliPerformanceDEdx *pCompDEdx3 = new AliPerformanceDEdx("AliPerformanceDEdxTPCInner","AliPerformanceDEdxTPCInner",kTPCInner,kFALSE); 
  if(!pCompDEdx3) {
    Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDEdxTPCInner");
  }
  pCompDEdx3->SetAliRecInfoCuts(pRecInfoCuts);
  pCompDEdx3->SetAliMCInfoCuts(pMCInfoCuts);
  //
  // DCA
  //
  AliPerformanceDCA *pCompDCA0 = new AliPerformanceDCA("AliPerformanceDCA","AliPerformanceDCA",kTPC,kFALSE); 
  if(!pCompDCA0) {
    Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceDCA");
  }
  pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts);
  pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts);
  //
  // TPC performance
  //
  AliPerformanceTPC *pCompTPC0 = new AliPerformanceTPC("AliPerformanceTPC","AliPerformanceTPC",kTPC,kFALSE); 
  if(!pCompTPC0) {
    Error("AddTaskPerformanceTPC", "Cannot create AliPerformanceTPC");
  }
  pCompTPC0->SetAliRecInfoCuts(pRecInfoCutsTPC);
  pCompTPC0->SetAliMCInfoCuts(pMCInfoCuts);
  //
  // TPC+ITS matching performance
  //
  AliPerformanceMatch *pCompMatch0 = new AliPerformanceMatch("AliPerformanceMatchTPCITS","AliPerformanceMatchTPCITS",0,kFALSE); 
  if(!pCompMatch0) {
    Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCITS");
  }
  pCompMatch0->SetAliRecInfoCuts(pRecInfoCutsMATCH);
  pCompMatch0->SetAliMCInfoCuts(pMCInfoCuts);
  //
  // TPC+TRD matching performance
  //
  AliPerformanceMatch *pCompMatch1 = new AliPerformanceMatch("AliPerformanceMatchTPCTRD","AliPerformanceMatchTPCTRD",1,kFALSE); 
  if(!pCompMatch1) {
    Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCTRD");
  }
  pCompMatch1->SetAliRecInfoCuts(pRecInfoCutsMATCH);
  pCompMatch1->SetAliMCInfoCuts(pMCInfoCuts);
 
  AliPerformanceMatch *pCompMatch2 = new AliPerformanceMatch("AliPerformanceMatchTPCEFF","AliPerformanceMatchTPCEFF",2,kFALSE); 
  if(!pCompMatch2) {
    Error("AddTaskPerformanceMatch", "Cannot create AliPerformanceMatchTPCEFF");
  }
  pCompMatch2->SetAliRecInfoCuts(pRecInfoCutsMATCH);
  pCompMatch2->SetAliMCInfoCuts(pMCInfoCuts);

  //
  // Add components to the performance task
  //
  //task->AddPerformanceObject( pCompDEdx3 );
  //task->AddPerformanceObject( pCompDCA0 );
  //task->AddPerformanceObject( pCompTPC0 );
  //task->AddPerformanceObject( pCompMatch0 );
  //task->AddPerformanceObject( pCompMatch1 );
  //task->AddPerformanceObject( pCompMatch2 );

  //
  if(bUseMCInfo) { 
     task->AddPerformanceObject( pCompRes0 );
     //task->AddPerformanceObject( pCompRes3 );
     //task->AddPerformanceObject( pCompRes4 );
     task->AddPerformanceObject( pCompEff0 );
  }

  //
  if(!bUseMCInfo) {
    pCompDEdx3->SetTriggerClass(triggerClass);
    pCompDCA0->SetTriggerClass(triggerClass);
    pCompTPC0->SetTriggerClass(triggerClass);
    pCompMatch0->SetTriggerClass(triggerClass);
    pCompMatch1->SetTriggerClass(triggerClass);
    pCompMatch2->SetTriggerClass(triggerClass);
  }

  //
  // Create containers for input
  //
  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());

  //
  // Create containers for output
  //
  AliAnalysisDataContainer *coutput_tpc = mgr->CreateContainer("TPCMC", TList::Class(), AliAnalysisManager::kOutputContainer, Form("TPC.MC.%s.root", task->GetName()));
  mgr->ConnectOutput(task, 1, coutput_tpc);

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

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

  mgr->PrintStatus();

  if(bProof) mgr->StartAnalysis("proof",chain);
  else mgr->StartAnalysis("local",chain);
}
Example #27
0
//________________________________________________________________
void runAAF(Int_t nFilesMax, char* type, char* textFileName, Int_t task)
{
  Int_t analysisMC  = 0;
  Bool_t debug      = kTRUE;
  Bool_t readTR     = kFALSE;
  Bool_t esdAna     = kTRUE;  // run ESD analysis (kTRUE) or AOD analysis (kFALSE)
  Int_t runtype = -1;
  
  if(strstr(type,"aod") != NULL) {
    esdAna = kFALSE;; // AOD analysis
    cout << "Performing AOD analysis" << endl;
  } else 
    cout << "Performing ESD analysis" << endl;
  
  const Char_t* treeName = GetTreeName(esdAna);
  
  if(strstr(type,"PbPb") != NULL) runtype = 2; // PbPb
  if(strstr(type,"pp") != NULL) runtype = 3; // pp
  if(strstr(type,"900") != NULL){ // 900GeV pp
    if(runtype != -1){
      printf("conflicting run types\n");
      return;
    }
    runtype = 1;
  }
  if(runtype == -1) runtype = 0; // 7TeV pp
  
  char *test;
  test = strstr(type,"MC");
  if(test != NULL){
    analysisMC = kTRUE;
    cout << "Test: " << test << endl;
    if(sscanf(test,"MC%d",&analysisMC)){
      //  cout << "**************" << analysisMC << endl;
      if(!analysisMC) analysisMC = 1;
    }
  }
  cout << "MonteCarlo " << analysisMC << endl;
  
  const char* alirootver = "v5-02-17-AN";
  Int_t mode = -1; // mode 1: PROOF, 2: GRID, 0: LOCAL
  printf("===================================================================\n");
  if(strstr(type,"proof") != NULL){ 
    if(mode != -1){
      printf("===== CONFLICTING TYPES =====\n");
      return;
    }
    mode = 1; 
    printf("===============   RUNNING ANALYSIS IN CAF MODE   ================\n");
  }
  if(strstr(type,"grid") != NULL){
    if(mode != -1){
      printf("===== CONFLICTING TYPES =====\n");
      return;
    }
    printf("===============  RUNNING ANALYSIS IN GRID MODE   ================\n");
    mode = 2; 
  }
  if(strstr(type,"local") != NULL || mode<0){ 
    if(mode != -1){
      printf("===== CONFLICTING TYPES =====\n");
      return;
    }
    printf("===============  RUNNING ANALYSIS IN LOCAL MODE  ================\n");
    mode = 0;
  }
  
  printf("===================================================================\n");
  printf("===================================================================\n");
  if (analysisMC) printf(":: use MC    TRUE\n");
  else            printf(":: use MC    FALSE\n");
  if (readTR)     printf(":: read TR   TRUE\n");
  else            printf(":: read TR   FALSE\n");
  if (debug)      printf(":: debugging TRUE\n");
  else            printf(":: debugging FALSE\n");
  
  Char_t taskname[128];
  
  switch(task){
  case 1:
    sprintf(taskname,"HighPtDeDxCosmic");
    break;
  case 2:
    sprintf(taskname,"HighPtDeDx");
    break;
  case 3:
    sprintf(taskname,"HighPtDeDxV0");
    break;
  case 4:{
    sprintf(taskname,"EffDecomposition");
  }
    break;
  default:
    printf("Unknown task\n");
    return;
  }
  
  Char_t nameouputfiles[1280]={0};
  if(runtype ==2){
    for(Int_t i=0;i<6;++i){
      //Char_t tmpname[128]={0};
      sprintf(nameouputfiles,"%s %s_Tree_%1.0f_%1.0f.root",nameouputfiles,taskname,minCent[i],maxCent[i]);
      
    }
  }
  if(runtype ==3){
    sprintf(nameouputfiles,"%s %s_Tree.root",taskname);
  }
  


  cout<<"Files to be stored:"<<nameouputfiles<<endl;


  // Load common libraries   
  gSystem->Load("libTree.so");
  gSystem->Load("libPhysics.so");
  gSystem->Load("libGeom.so");
  gSystem->Load("libVMC.so");
  gSystem->Load("libSTEERBase.so");
  gSystem->Load("libESD.so");
  gSystem->Load("libAOD.so");
  gSystem->Load("libCDB.so");
  gSystem->Load("libANALYSIS.so");
  gSystem->Load("libANALYSISalice.so");
  // tender

  gROOT->ProcessLine(Form(".include %s/include", gSystem->ExpandPathName("$ALICE_ROOT")));


  cout << "mode " << mode << ", type " << type << endl;

  if (mode == 1){
    cout << "Connecting to CAF..." << endl;
    gEnv->SetValue("XSec.GSI.DelegProxy","2");

    //const char* AAF = "[email protected]";    
    const char* AAF = "[email protected]";    

    if(strstr(type,"reset") != NULL)
       TProof::Reset(AAF,kFALSE);
    //       TProof::Reset("[email protected]",kTRUE);
    //    TProof::Open(AAF);
    TProof::Open(AAF, "workers=10");

    TList *list = new TList();
    list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "CDB"));

    gProof->EnablePackage(Form("[email protected]::%s",alirootver), list);

    cout << "Connected to " << AAF << endl;
  }

 
  // Load the analysis macro (old version); should be removed when the library will be decided
  Char_t loadtask[128];

  if(task==4) {
    sprintf(loadtask,"AliAnaTaskV0%s.cxx++", taskname);
  }else{
    sprintf(loadtask,"AliAnalysisTask%s.cxx++", taskname);
  }
  
  if(mode == 1){ // PROOF
    
    // switch(task){
    // case 1: // ch fluct
    //   break;
    // case 2: // high pt dedx
    //gProof->Load("DebugClasses.C++g");
    //   break;
    // case 3: // high pt v0s
    //   gProof->Load("DebugClasses.C++g");
    //   break;
    // default:
    //   printf("Unknown task\n");
    //   return;
    // }

    gProof->Load(loadtask);
  }else{

    if(task==2) {
      
      cout << "Analysis task is loaded with AliRoot" << endl;
    } else {

      gROOT->LoadMacro(loadtask);
    }
  }

  // Make the analysis manager
  AliAnalysisManager* mgr = new AliAnalysisManager("PID histos", "testing analysis");


  // Dataset 
  switch(mode){
  case 1: // PROOF
    TFileCollection* proofColl = gProof->GetDataSet(textFileName);
    TFileCollection* stagedColl = proofColl->GetStagedSubset();
    TChain* chain = CreateChainCAF(nFilesMax, stagedColl, treeName);
//    TChain* chain = CreateChainCAF(nFilesMax, textFileName, treeName, analysisMC);
    break;
  case 2: // GRID
    //gSystem->Setenv("alien_CLOSE_SE", "ALICE::GSI::SE2");
    //    gSystem->Setenv("alien_CLOSE_SE", "ALICE::NIHAM::FILE");
    TGrid::Connect("alien://");
    //gSystem->Setenv("alien_CLOSE_SE", "ALICE::GSI::SE2");
    //    gSystem->Setenv("alien_CLOSE_SE", "ALICE::NIHAM::FILE");
    
    Char_t gridmode[64];
    sprintf(gridmode, "full");
    if(strstr(type,"term") != NULL) 
      sprintf(gridmode, "terminate");
    if(strstr(type,"off") != NULL) 
      sprintf(gridmode, "offline");
    if(strstr(type,"sub") != NULL) 
      sprintf(gridmode, "submit");
    if(strstr(type,"test") != NULL) 
      sprintf(gridmode, "test");


    gROOT->LoadMacro("CreateAlienHandler.C");
    //    AliAnalysisGrid *alienHandler = CreateAlienHandler(nFilesMax, analysisMC, runtype, taskname, gridmode);  
    AliAnalysisGrid *alienHandler = CreateAlienHandler(nFilesMax, analysisMC, esdAna, taskname, nameouputfiles, gridmode, textFileName, alirootver, task);  
    if (!alienHandler) return; 

    // DOES NOT WORK BECAUSE THERE ARE NO GETTERS?
    // // Here we can add extra files to the plugin
    // switch(task){
    // case 1: // ch fluct
    //   break;
    // case 2: // high pt dedx
    //   alienHandler->SetAnalysisSource(Form("DebugClasses.C %s", alienHandler->GetAnalysisSource()));
    //   alienHandler->SetAdditionalLibs(Form("DebugClasses.C %s", alienHandler->GetAdditionalLibs()));
    //   break;
    // case 3: // high pt v0s
    //   alienHandler->SetAnalysisSource(Form("DebugClasses.C %s", alienHandler->GetAnalysisSource()));
    //   alienHandler->SetAdditionalLibs(Form("DebugClasses.C %s", alienHandler->GetAdditionalLibs()));
    //   break;
    // default:
    //   printf("Unknown task\n");
    //   return;
    // }

    // Connect plugin to the analysis manager
    mgr->SetGridHandler(alienHandler); 
    break;
  case 0: // LOCAL
    // Process data - chain
    AliXRDPROOFtoolkit tool;
    TChain* chain = tool.MakeChain(textFileName,treeName, 0, 100);
    chain->Lookup();
    break;
  default:
    printf("Unknown mode");
    return;
  }
  
  // ESD input handler
  if(esdAna) {

    AliESDInputHandler *esdHandler = new AliESDInputHandler();
    mgr->SetInputEventHandler(esdHandler);
  } else {

    AliAODInputHandler* aodHandler = new AliAODInputHandler();
    mgr->SetInputEventHandler(aodHandler);
  }

  // Monte Carlo handler
  if (analysisMC) {
    AliMCEventHandler* mcHandler = new AliMCEventHandler();
    if(esdAna)
      mgr->SetMCtruthEventHandler(mcHandler);
    mcHandler->SetReadTR(readTR); 
  }

  // Debug if needed
  if (debug) 
    mgr->SetDebugLevel(3);


  // ######### Centrality task ###############  

  cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  cout<<"esdAna="<<esdAna<<"  runtype="<<runtype<<endl;
    
  // ######### PHYSICS SELECTION ###############
  if (esdAna) { // PC: 17/8-15: this does not work for AODs..... 

    cout << "Adding task physics selection" << endl;
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
    AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
    if (analysisMC) {
      AliPhysicsSelection* physSel = physSelTask->GetPhysicsSelection();
      physSel->SetAnalyzeMC();
    }
  }

  if(esdAna && runtype==2) { // only for ESD and PbPb

    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); 
    //taskCentrality->SetPass(2);
    if (analysisMC)
      taskCentrality->SetMCInput(); 
  }

  // ######### PID task ###############

  if(task == 2) {
    cout << "Loading macro in AliRoot!" << endl;
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/IdentifiedHighPt/train/macros/AddTask.C");      
    cout << "Adding task!" << endl;
    AliAnalysisTask* taskPid = AddTask(analysisMC, taskname, runtype, kTriggerInt, minCent, maxCent);
  } else {
    cout << "Adding AliAnaTaskV0EffDecomposition" << endl;
    gROOT->LoadMacro("AddTask.C");  
    AliAnalysisTask* taskPid = AddTask(taskname);
  }
  
  // Run the analysis  
  if (mgr->InitAnalysis()){
    mgr->PrintStatus();
    switch(mode){
    case 1: // PROOF
      mgr->StartAnalysis("proof",chain);
      break;
    case 2: // GRID
      mgr->StartAnalysis("grid");
      break;
    case 0:
      mgr->StartAnalysis("local",chain);
      break;
    default:
      printf("Unknown mode\n");
      return;
    }
  } 
}  
void RunSingleTrackEfficiencyTaskHFCJ()
{
    
    TBenchmark fBenchMark;
    fBenchMark.Start("AliCFSingleTrackEfficiencyTask");
    
    Load();
    
    if(fAnalysisMode=="grid"){
        //gSystem->Exec(Form("alien-token-init %s",fUsername.Data()));
        TGrid::Connect("alien://") ;
    }
    
    if(IsPlugin) {
        AliAnalysisGrid *alienHandler = CreateAlienHandler();
        if(!alienHandler) return;
    }
    
    printf("CREATE ANALYSIS MANAGER\n");
    AliAnalysisManager *mgr = new AliAnalysisManager("My Manager","My Manager");
    mgr->SetDebugLevel(10);
    if(IsPlugin) mgr->SetGridHandler(alienHandler);
    
    AliMCEventHandler*  mcHandler = new AliMCEventHandler();
    if (!readAOD) mgr->SetMCtruthEventHandler(mcHandler);
    
    AliInputEventHandler* dataHandler;
    if   (readAOD) dataHandler = new AliAODInputHandler();
    else           dataHandler = new AliESDInputHandler();
    mgr->SetInputEventHandler(dataHandler);
    
    if (!readAOD) {
        gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
        AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kTRUE);
    }
    
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
    AliAnalysisTaskSE *setupTask = AddTaskPIDResponse(kTRUE, kTRUE, kTRUE, 2, kFALSE, "", kTRUE, kFALSE, -1);
    
    if(ifTaskPIDQA){
        gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
        AliAnalysisTaskPIDqa *pidQA = AddTaskPIDqa();
    }
    
    printf("Prepare to create the task\n");
    gROOT->LoadMacro("./AddSingleTrackEfficiencyTaskDhCorrelations.C");
    
    //NCharge Filterbin0 + kFAST configuration + w/o external cut file
    AliCFSingleTrackEfficiencyTask *taskNchF0wFile  = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "NchFbit0woFile", AliPID::kPion, 0, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID, "", "");
    
    //NCharge Filterbin0 + kFAST configuration + w external cut file
    AliCFSingleTrackEfficiencyTask *taskNchF0  = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "NchFbit0", AliPID::kPion, 0, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID, "AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
    
    //Pion Filterbin0+ kFAST configuration + w external cut file
    AliCFSingleTrackEfficiencyTask *taskPionF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "PionFbit0", AliPID::kPion, 211, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID,"AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
    
    //Kaons Filterbin0+ kFAST configuration + w external cut file
    AliCFSingleTrackEfficiencyTask *taskKaonF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "KaonFbit0", AliPID::kKaon, 321, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID,"AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
    
    //Protons Filterbin0+ kFAST configuration + w external cut file
    AliCFSingleTrackEfficiencyTask *taskProtF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "ProtonFbit0", AliPID::kProton, 2212, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID,"AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
    
    //Electron Filterbin0+ kFAST configuration + w external cut file
    AliCFSingleTrackEfficiencyTask *taskElecF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "ElectronFbit0", AliPID::kElectron,11, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID, "AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
    
    
    
    // Run the analysis
    TChain * analysisChain=0;
    if(analysisChain) printf("CHAIN HAS %d ENTRIES\n",(Int_t)analysisChain->GetEntries());
    if(!mgr->InitAnalysis()) return;
    mgr->PrintStatus();
    if(fAnalysisMode=="grid" && !IsPlugin) fAnalysisMode="local";
    if(fAnalysisMode!="proof") {
        mgr->StartAnalysis(fAnalysisMode.Data(),analysisChain,nEntries,firstentry);
    }
    
    fBenchMark.Stop("AliCFSingleTrackEfficiencyTask");
    fBenchMark.Show("AliCFSingleTrackEfficiencyTask");
    
    return;
    
}
Example #29
0
File: run.C Project: ktf/AliPhysics
void run(const Char_t *files=NULL, Bool_t mc=kFALSE, Bool_t tpid=kTRUE,  Bool_t tchg=kFALSE,  Bool_t tpp=kTRUE, Long64_t nev=1234567890, Long64_t first = 0)
{
  TStopwatch timer;
  timer.Start();

  // VERY GENERAL SETTINGS
  //AliLog::SetGlobalLogLevel(AliLog::kError);
  if(gSystem->Load("libANALYSIS.so")<0) return;
  if(gSystem->Load("libANALYSISalice.so")<0) return;
  if(gSystem->Load("libTender.so")<0) return;
  if(gSystem->Load("libTenderSupplies.so")<0) return;
//   if(gSystem->Load("libMES.so")<0) return;
    if(gSystem->Load("libPWGLFspectra.so")<0) return;

  // DEFINE DATA CHAIN
  TChain *chain = NULL;
  if(!files) chain = MakeChainLST();
  else chain = MakeChainLST(files);

  if(!chain) return;
  chain->Lookup();
  chain->GetListOfFiles()->Print();
  Long64_t nfound=chain->GetEntries();
  printf("\tENTRIES FOUND [%lli] REQUESTED [%lli]\n", nfound, nev>nfound?nfound:nev);

  // BUILD ANALYSIS MANAGER
  AliAnalysisManager *mgr = new AliAnalysisManager("Multiplicity and Event Shape");
  AliESDInputHandler *esdH = new AliESDInputHandler();
  AliMCEventHandler *mcH(NULL);
  mgr->SetInputEventHandler(esdH);
  if(mc) mgr->SetMCtruthEventHandler(mcH = new AliMCEventHandler());
  //mgr->SetDebugLevel(10);
  mgr->SetSkipTerminate(kTRUE);

  // LOAD tasks
  // *******************  PID response  ******************
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  if(!mc) AddTaskPIDResponse();
  else AddTaskPIDResponse(kTRUE,kTRUE,kTRUE,2);

  // *******************  Tenders  ***********************
  AliTender *aliTender(NULL);
  gROOT->LoadMacro("$ALICE_PHYSICS/TENDER/TenderSupplies/AddTaskTender.C");
  if(!mc){    // for DATA
    aliTender = (AliTender*)AddTaskTender(!mc, kTRUE, kTRUE, kTRUE, kTRUE, kFALSE, kTRUE, kFALSE, kFALSE);
       // (useV0, useTPC,  !!! useTOF=kFALSE for MC !!!, useTRD, usePID, useVTX, useT0, useEmc, usePtFix)
  } else {  // for MC
    aliTender = (AliTender*)AddTaskTender(!mc, kTRUE, kFALSE, kTRUE, kTRUE, kTRUE, kTRUE, kFALSE, kFALSE);  // (useV0, useTPC,  !!! useTOF=kFALSE for MC !!!, useTRD, usePID, useVTX, useT0, useEmc, usePtFix)
  }
  aliTender->SetHandleOCDB(kTRUE);
  //aliTender->SetDefaultCDBStorage(Form("alien://folder=/alice/data/2010/OCDB?cacheFolder=%s/local", gSystem->ExpandPathName("$HOME")));
  // aliTender->SetDefaultCDBStorage(Form("local://%s/local/alice/data/2010/OCDB", gSystem->ExpandPathName("$HOME")));

// *******************  Physics Selection  *************
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(mc); // 0 = real data; 1 = MC

  // *******************  MES Tender  ******************
  gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMEStender.C");
  AddMEStender(mc);

  // *******************  MES PID task  ******************
  if(tpid){
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMESpidTask.C");
	AddMESpidTask(mc);
  }
//

//   // *******************  MES CHG task  ******************
  if(tchg){
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMESchgTask.C");
    AddMESchgTask(mc);
  }
//
//   // *******************  MES ppCol task  ******************
  if(tpp){
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/SPECTRA/MultEvShape/AddMESppColTask.C");
    AddMESppColTask(mc);
  }


  if (!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  mgr->StartAnalysis("local", chain, nev, first);
  timer.Stop();
  timer.Print();
  // verbosity
  printf("\tCLEANING TASK LIST:\n");
  mgr->GetTasks()->Delete();

  if(mcH) delete mcH;
  delete esdH;
  delete chain;
}
Example #30
0
void runAODFilterMC()
{
  // PROOF example

      gSystem->Load("libTree");
      gSystem->Load("libPhysics");
      gSystem->Load("libGeom");
      gSystem->Load("libVMC");

      bool bKineFilter = true;
      //      TProof::Mgr("alicecaf")->SetROOTVersion("v5-21-01-alice_dbg");
      TProof::Open("alicecaf");
      //      gProof->SetParallel(1);

      char *dataset = "/COMMON/COMMON/LHC08c11_10TeV_0.5T";
      //      char *dataset = "/PWG4/kleinb/LHC08q_jetjet100";
      // gProof->ClearPackages();
      gProof->UploadPackage("${ALICE_ROOT}/STEERBase.par");
      gProof->EnablePackage("STEERBase");
      gProof->UploadPackage("${ALICE_ROOT}/ESD.par");
      gProof->EnablePackage("ESD");
      gProof->UploadPackage("${ALICE_ROOT}/AOD.par");
      gProof->EnablePackage("AOD");
      gProof->UploadPackage("${ALICE_ROOT}/ANALYSIS.par");
      gProof->EnablePackage("ANALYSIS");
      gProof->UploadPackage("${ALICE_ROOT}/ANALYSISalice.par");
      gProof->EnablePackage("ANALYSISalice");
      
      //
      if (gApplication) gApplication->InitializeGraphics();
      // Create the chain
      //


	/////////////////////////////////////////////////////////////////////////////////// 
	// Create the analysis manager
	//
	// Input 
      AliESDInputHandler* inpHandler = new AliESDInputHandler();
      // Output
      AliAODHandler* aodHandler = new AliAODHandler();
      aodHandler->SetOutputFileName("aod_ckb2.root");
      // MC Truth
      AliMCEventHandler* mcHandler = new AliMCEventHandler();
      AliAnalysisManager *mgr  = new AliAnalysisManager("Filter Manager", "Filter Manager");
     if(bKineFilter){
       mgr->SetMCtruthEventHandler(mcHandler);
     }

      mgr->SetInputEventHandler  (inpHandler);
      mgr->SetOutputEventHandler (aodHandler);
      aodHandler->Dump();

      mgr->SetDebugLevel(10);

      // Filtering of MC particles (decays conversions etc)
      // this task is also needed to set the MCEventHandler
      // to the AODHandler, this will not be needed when
      // AODHandler goes to ANALYSISalice
      AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Filter");
      if(bKineFilter)mgr->AddTask(kinefilter);
      
      
      // 
      AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
      esdTrackCutsL->SetMinNClustersTPC(50);
      esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
      esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
      esdTrackCutsL->SetRequireTPCRefit(kTRUE);
      esdTrackCutsL->SetDCAToVertexZ(3.0);
      esdTrackCutsL->SetDCAToVertexXY(3.0);
      esdTrackCutsL->SetDCAToVertex2D(kTRUE);
      esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
      esdTrackCutsL->SetAcceptKinkDaughters(kFALSE);

      AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("AliESDtrackCuts", "ITS stand-alone");
      esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
      
      AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
      trackFilter->AddCuts(esdTrackCutsL);
      trackFilter->AddCuts(esdTrackCutsITSsa);
      
      AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
      esdfilter->SetTrackFilter(trackFilter);
      
      mgr->AddTask(esdfilter);
    
    
      //
      // Create containers for input/output
      AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
      AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
      
      coutput1->SetSpecialOutput();

      if(bKineFilter){
	mgr->ConnectInput  (kinefilter,     0, cinput1  );
	mgr->ConnectOutput (kinefilter,     0, coutput1 );
	AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(),
								   AliAnalysisManager::kOutputContainer,"pyxsec_hists.root");
	mgr->ConnectOutput (kinefilter,     1, coutputEx );
      }

	mgr->ConnectInput  (esdfilter,     0, cinput1  );
	mgr->ConnectOutput (esdfilter,     0, coutput1 );
      
      //
      // Run the analysis
      //    
      mgr->InitAnalysis();
      mgr->PrintStatus();
      mgr->StartAnalysis("proof",dataset,10000);

}