Esempio n. 1
0
void SetupUtil(bool isMC, bool isAOD){
        //
        // Setup utility packages
        //
        // 1. Physics Selection (ESD only)
        // 2. Tender (ESD only)
        // 3. PID Response (always)
        // 4. Centrality Task (ESD only)
        //

        //===== ADD PID RESPONSE: ===
        gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
        AddTaskPIDResponse(isMC);

        //==== Add tender ====
        if(!isAOD){
                gROOT->LoadMacro("$ALICE_ROOT/TENDER/TenderSupplies/AddTaskTender.C");
                //AddTaskTender();
        }

        //==== Physics Selection ====
        if(!isAOD){
                gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
                AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);
        }

        //===== ADD CENTRALITY: ===
        if(!isAOD){
                gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
                AddTaskCentrality();
        }
}
Esempio n. 2
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 = "*****@*****.**";    
    const char* AAF = "*****@*****.**";    

    if(strstr(type,"reset") != NULL)
       TProof::Reset(AAF,kFALSE);
    //       TProof::Reset("*****@*****.**",kTRUE);
    //    TProof::Open(AAF);
    TProof::Open(AAF, "workers=10");

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

    gProof->EnablePackage(Form("VO_ALICE@AliRoot::%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;
    }
  } 
}  
Esempio n. 3
0
void runGridDeuteronTree(TString mode="terminate", TString fname="DeuteronTreeTest")
{

  AliLog::SetGlobalDebugLevel(5);

  //__________________________________________________________________________
  // Use AliRoot includes to compile our task
  gROOT->ProcessLine(".include $ALICE_ROOT/include");
  gROOT->ProcessLine(".include $ALICE_PHYSICS/include");
  gSystem->Load("libPWGTools.so");
  gSystem->Load("libPWGLFnuclex.so");

  // Create and configure the alien handler plugin
  AliAnalysisGrid *alienHandler = CreateAlienHandler(mode,fname);
  if (!alienHandler) return;
  // Create the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
  // Connect plug-in to the analysis manager
  mgr->SetGridHandler(alienHandler);
  AliESDInputHandler* esdH = new AliESDInputHandler();
  mgr->SetInputEventHandler(esdH);

  Bool_t mc = kFALSE;
  //if(sub == 2)
  //mc = kTRUE;
  
  // Add PIDResponse task
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AliAnalysisTaskPIDResponse *taskPID=AddTaskPIDResponse(mc,kTRUE,kTRUE);

  // Add Physics Selec
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
    
  // Add centrality
  gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
  //taskCentrality->SetPass(2); // Change if changing pass


  // Add AliPPVsMultUtils task
  // AliAnalysisUtils* utils = new AliAnalysisUtils();

  // add DPhiCorrelations task from $ALICE_PHYSICS/../src/PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations[.cxx .h]
  //gROOT->LoadMacro("AliAnalysisTaskPhiCorrelations.cxx+g");
  gROOT->LoadMacro("$ALICE_PHYSICS/../src/PWGLF/NUCLEX/Nuclei/DeuteronpA/macros/AddTaskDeuteronTree.C");

  AliAnalysisDeuteronTree *taskDeuteronTree = AddTaskDeuteronTree("DeuteronTreeTest");

  taskDeuteronTree->SelectCollisionCandidates(AliVEvent::kINT7);

    //mgr->SetDebugLevel(5);

  if (!mgr->InitAnalysis())
    return;
  mgr->PrintStatus();
  // Start analysis in grid.
  mgr->StartAnalysis("grid",100);

  // local analysis
  //TChain *chain = new TChain("aodTree");
  //chain->AddFile("./traintest/__alice__data__2010__LHC10d__000126158__ESDs__pass2__AOD147_root_archive_AliAOD_2/0002/root_archive/AliAOD.root");
  //mgr->StartAnalysis("local",chain);

}
Bool_t AddTasksEmcalFjetSparseMaker()
{
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

  if (bIsInfoAOD) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODHandler.C");
    AliAODInputHandler *aodIH = AddAODHandler();
  } else {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddESDHandler.C");
    AliESDInputHandler *esdIH = AddESDHandler();
//  esdIH->SetReadFriends(kFALSE);
  }

  if (bAnaInfoMC && (!bIsInfoAOD)) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddMCHandler.C");
    AliMCEventHandler *mctEH = AddMCHandler(kTRUE);
  }

  if (bOutputAOD) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODOutputHandler.C");
    AliAODHandler *aodH = AddAODOutputHandler();
    aodH->SetOutputFileName("AliAOD.PicoJets.root");
    aodH->SetFillAOD(kTRUE);
    aodH->SetCreateNonStandardAOD();
    mgr->SetOutputEventHandler(aodH);
  }
//=============================================================================

  if (bIsPhysSel) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalPhysicsSelection.C");
    AliEmcalPhysicsSelectionTask *taksPhysSel = AddTaskEmcalPhysicsSelection(kTRUE, kTRUE, wTriggerMask, 5., 5., 10., kTRUE, -1, -1, -1, -1);
    if (bAnaInfoMC) {
      AliEmcalPhysicsSelection *pPhysSel = static_cast<AliEmcalPhysicsSelection*>(taksPhysSel->GetPhysicsSelection());
      if (!pPhysSel) return kTRUE; pPhysSel->SetAnalyzeMC();
    }
  }

  if (bIsCentSel) {
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *taskCentSel = AddTaskCentrality(kTRUE, bIsAOD);
    if (bAnaInfoMC) taskCentSel->SetMCInput();
  }

  if (bIsEvPnSel) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
    AliEPSelectionTask *taskEventPlane = AddTaskEventplane();
    if (bAnaInfoMC) taskEventPlane->SetUseMCRP();
  }

  if (bIsRespPID) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
    AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bAnaInfoMC);
  }
//=============================================================================

  gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
  AliEmcalSetupTask *taskSetupEMCal = AddTaskEmcalSetup();
  taskSetupEMCal->SetGeoPath("$ALICE_PHYSICS/OADB/EMCAL");

  gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalPreparation.C");
  AliAnalysisTaskSE *taskEmcMaker = AddTaskEmcalPreparation(sPeriodIn);

  gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/EMCALJetTasks/macros/AddTaskJetPreparation.C");
  AliAnalysisTaskSE *taskHadCorr = AddTaskJetPreparation(sPeriodIn.Data(),
                                                         sUsedTrksRD.Data(),
                                                        (bAnaInfoMC ? sUsedTrksMC.Data() : ""),
                                                         sInputClsRD.Data(),
                                                         sUsedClusRD.Data(),
                                                         2., 0., 0.03, 0.015, 0.15,
                                                         wTriggerMask,
                                                         kTRUE,   // do trk clus
                                                         kTRUE,   // histos
                                                         kTRUE,   // make pico trk
                                                         kFALSE,  // make trigger
                                                         kFALSE,  // is EMCal train
                                                         1.,      // track eff
                                                         kTRUE,   // do AOD track prop
                                                         kTRUE,   // modify match
                                                         kFALSE,  // use old bit
                                                         kFALSE,  // trigger QA
                                                         4);      // cent bin
//=============================================================================

  gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");

/*AliEmcalJetTask *taskAkt = AddTaskEmcalJet(sUsedTrksRD.Data(),
                                             sUsedClusRD.Data(),
                                             1, // anti-kT
                                             dJetRadius,
                                             nJetType,
                                             dTrkPtCut,
                                             dCluEnCut);*/
//=============================================================================

  AliAnalysisTaskEmcalFjetSparseMaker *taskEmcalSM = new AliAnalysisTaskEmcalFjetSparseMaker("AliAnalysisTaskEmcalFjetSM");
//taskEmcalSM->SetForceBeamType(0);
//taskEmcalSM->SetIsPythia(kTRUE);

/*taskEmcalSM->SetCaloTriggerPatchInfoName("EmcalTriggers");
  taskEmcalSM->SetTriggerTypeSel(AliAnalysisTaskEmcal::kJ2);
  taskEmcalSM->SetMainPatchType(AliAnalysisTaskEmcal::kTriggerLevel1Jet);*/

  AliParticleContainer *pContTrks = taskEmcalSM->AddParticleContainer(sUsedTrksRD.Data());
  pContTrks->SetParticlePtCut(dTrkPtCut);

  AliClusterContainer *pContClus = taskEmcalSM->AddClusterContainer(sUsedClusRD.Data());
  pContClus->SetClusPtCut(dCluEnCut);

/*AliJetContainer *pContJets = taskEmcalSM->AddJetContainer(taskAkt->GetName(), sCutType.Data(), dJetRadius);
  pContJets->SetPercAreaCut(dJetAreaCut);
  pContJets->SetJetPtCut(dJetPtCut);
//pContJets->SetRhoName(sUsedRho.Data());
//pContJets->SetLocalRhoName();
  pContJets->SetLeadingHadronType(nLeading);
  pContJets->ConnectParticleContainer(taskEmcalSM->GetParticleContainer());
  pContJets->ConnectClusterContainer(taskEmcalSM->GetClusterContainer());
  pContJets->SetNameTitle(taskEmcalSM->GetNameJet().Data(),
                          taskEmcalSM->GetNameJet().Data());*/

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

  mgr->ConnectOutput(taskEmcalSM, 1, mgr->CreateContainer("listGeneralH",
                                                          TList::Class(),
                                                          AliAnalysisManager::kOutputContainer,
                                                          AliAnalysisManager::GetCommonFileName()));

  mgr->ConnectOutput(taskEmcalSM, 2, mgr->CreateContainer("listEmcalEvH",
                                                          TList::Class(),
                                                          AliAnalysisManager::kOutputContainer,
                                                          "AnalysisResults_EmcalEvH.root"));

  mgr->ConnectOutput(taskEmcalSM, 3, mgr->CreateContainer("listEmcalTrk",
                                                          TList::Class(),
                                                          AliAnalysisManager::kOutputContainer,
                                                          "AnalysisResults_EmcalTrk.root"));

  mgr->ConnectOutput(taskEmcalSM, 4, mgr->CreateContainer("listEmcalClu",
                                                          TList::Class(),
                                                          AliAnalysisManager::kOutputContainer,
                                                          "AnalysisResults_EmcalClu.root"));

/*mgr->ConnectOutput(taskEmcalSM, 5, mgr->CreateContainer("listEmcalJet",
                                                          TList::Class(),
                                                          AliAnalysisManager::kOutputContainer,
                                                          "AnalysisResults_EmcalJet.root"));*/
//=============================================================================

  TObjArray *aTasks = mgr->GetTasks();
  for (Int_t i=0; i<aTasks->GetEntries(); i++) {
    AliAnalysisTaskEmcal *taskJE = dynamic_cast<AliAnalysisTaskEmcal*>(aTasks->At(i));
    if (taskJE) if (taskJE->InheritsFrom("AliAnalysisTaskEmcal")) {
      taskJE->SetVzRange(-10., 10.);

      if (!sCentEsti.IsNull()) {
        taskJE->SetCentralityEstimator(sCentEsti.Data());
        taskJE->SetCentRange(dCentMin, dCentMax);
       }
    }

    if (wTriggerMask) {
      AliAnalysisTaskSE *taskSE = dynamic_cast<AliAnalysisTaskSE*>(aTasks->At(i));
      if (taskSE) if (!(taskSE->InheritsFrom("AliPhysicsSelectionTask"))) {
        taskSE->SelectCollisionCandidates(wTriggerMask);
      }
    }
  }
//=============================================================================

  return kFALSE;
}
Esempio n. 5
0
File: run.C Progetto: ktf/AliPhysics
void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kFALSE, Int_t runMode = 0, Bool_t isMC = 0, 
	 Int_t centrBin = 0, const char * centrEstimator = "VOM", Int_t useOtherCentralityCut = 0, Int_t trackMin=0, Int_t trackMax=10000, 
	 const char* option = "",TString customSuffix = "", Int_t workers = -1, Bool_t useSingleBin=kTRUE, const char * runList = 0)
{
  // runMode:
  //
  // 0 local 
  // 1 proof

  if (nev < 0)
    nev = 1234567890;

  InitAndLoadLibs(runMode,workers,debug);

  // Create the analysis manager
  mgr = new AliAnalysisManager;

  // Add ESD handler
  AliESDInputHandler* esdH = new AliESDInputHandler;
  // Do I need any of this? 
  esdH->SetInactiveBranches("AliESDACORDE FMD ALIESDTZERO ALIESDZDC AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks AliESDTZERO ALIESDACORDE MuonTracks TrdTracks");
  mgr->SetInputEventHandler(esdH);

  if(isMC) {
    AliMCEventHandler* handler = new AliMCEventHandler;
    handler->SetPreReadMode(AliMCEventHandler::kLmPreRead);
    mgr->SetMCtruthEventHandler(handler);
  }



  // Parse option strings
  TString optionStr(option);
  
  // remove SAVE option if set
  // This  is copied from a macro by Jan. The reason I kept it is that I may want to pass textual options to the new task at some point
  Bool_t doSave = kFALSE;
  TString optionStr(option);
  if (optionStr.Contains("SAVE"))
    {
      optionStr = optionStr(0,optionStr.Index("SAVE")) + optionStr(optionStr.Index("SAVE")+4, optionStr.Length());
      doSave = kTRUE;
    }

  AliESDtrackCuts * cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE);  
  TString pathsuffix = "";

  if(!useSingleBin) pathsuffix += "_AllCentr";

  if (optionStr.Contains("DCA")) {
    delete cuts;
    //    cuts = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009();
    cout << ">>>> USING DCA cut" << endl;
    cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();  
    cuts->SetMaxChi2TPCConstrainedGlobal(); // remove golden cut
    pathsuffix+="_DCAcut";
  }

  if (optionStr.Contains("ITSsa")) {
    delete cuts;
    cuts = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009();
    cout << ">>>> USING ITS sa tracks" << endl;
    pathsuffix+="_ITSsa";
  }

  if (optionStr.Contains("TPC")) {
    delete cuts;
    cuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
    cout << ">>>> USING TPC only tracks" << endl;
    pathsuffix+="_TPC";
  }

  if(optionStr.Contains("NoElectrons")) pathsuffix +="_NoElectrons";



  Bool_t useMCKinematics = isMC;
  if (optionStr.Contains("NOMCKIN")) {
    cout << ">>>> Ignoring MC kinematics" << endl;
    useMCKinematics=kFALSE;
    pathsuffix+="_NOMCKIN";
  }
  
  // If we are running on grid, we need the alien handler
  if (runMode == kMyRunModeGRID) {
    // Create and configure the alien handler plugin
    gROOT->LoadMacro("CreateAlienHandler.C");
    AliAnalysisGrid *alienHandler = CreateAlienHandler(data, runList, pathsuffix.Data(), listToLoad, "full", isMC);  // full
    if (!alienHandler) {
      cout << "Cannot create alien handler" << endl;    
      exit(1);
    }
    mgr->SetGridHandler(alienHandler);  
  }



  // Add tasks
  // physics selection
  gROOT->ProcessLine(".L $ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
  physicsSelectionTask = AddTaskPhysicsSelection(isMC);

  //PID
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AddTaskPIDResponse(isMC); 

  // // PID QA:
  // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
  // AddTaskPIDqa();


  // Centrality
  gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask *taskCentr = AddTaskCentrality();
  // OBSOLETE
  const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityBy1D.root";
  const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityByFunction.root";
  // END of OBSOLETE
  if(isMC) taskCentr-> SetMCInput();
  taskCentr->SetPass(2);

  // Create my own centrality selector
  AliAnalysisMultPbCentralitySelector * centrSelector = new AliAnalysisMultPbCentralitySelector();
  centrSelector->SetIsMC(isMC);
  centrSelector->SetCentrTaskFiles(file1,file2); // for bookkeping only
  centrSelector->SetCentralityBin(centrBin);
  if (!useSingleBin) centrSelector->SetCentralityBin(0); // FIXME: ok?
  centrSelector->SetCentralityEstimator(centrEstimator);

  if(useOtherCentralityCut == 1){
    cout << "Setting centrality by MULT" << endl;
    centrSelector->SetUseMultRange();
    centrSelector->SetMultRange(trackMin,trackMax);
  }
  if(useOtherCentralityCut == 2){
    cout << "Setting centrality by V0" << endl;
    
    centrSelector->SetUseV0Range();
    centrSelector->SetMultRange(trackMin,trackMax);
  }
  if(useOtherCentralityCut == 3){
    cout << "Setting centrality by SPD outer" << endl;    
    centrSelector->SetUseSPDOuterRange();
    centrSelector->SetMultRange(trackMin,trackMax);
  }

  // load my task
  if (useSingleBin) {
    gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracks.C");
    AliAnalysisTaskMultPbTracks * task = AddTaskMultPbPbTracks("multPbPbtracks.root", cuts, centrSelector); 
    task->SetIsMC(useMCKinematics);
    task->SetOfflineTrigger(AliVEvent::kMB);
    if(optionStr.Contains("TPC")) task->SetTPCOnly();
    if(optionStr.Contains("NoElectrons")) task->RejectElectrons(kTRUE);
    if(useMCKinematics) task->GetHistoManager()->SetSuffix("MC");
    if(customSuffix!=""){
      cout << "Setting custom suffix: " << customSuffix << endl;    
      task->GetHistoManager()->SetSuffix(customSuffix);
    }
  } else {
    gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracksAllCentrality.C");
    centrSelector->SetUseV0Range(kTRUE);
    Int_t ncentr = 11;
   
    const Float_t minCentr[] = {0 ,79 ,239,559 ,1165,2135,3555,5525,8213 ,12191,15079};
    const Float_t maxCentr[] = {79,239,559,1165,2135,3555,5525,8213,12191,15079,21000};
    AliAnalysisTaskMultPbTracks ** tasks = AddTaskMultPbPbTracksAllCentrality("multPbPbtracks.root", cuts, centrSelector, ncentr,minCentr,maxCentr); 
    for(Int_t icentr = 0; icentr < ncentr; icentr++){
      tasks[icentr]->Print();
      cout << "MC KINEMATICS:" << useMCKinematics << endl;
      
      tasks[icentr]->SetIsMC(useMCKinematics);
      tasks[icentr]->SetOfflineTrigger(AliVEvent::kMB);
      if(optionStr.Contains("TPC")) tasks[icentr]->SetTPCOnly();
      if(optionStr.Contains("NoElectrons")) task[icentr]->RejectElectrons(kTRUE);
      if(useMCKinematics) tasks[icentr]->GetHistoManager()->SetSuffix("MC");
      if(customSuffix!=""){
	cout << "Setting custom suffix: " << customSuffix+long(icentr) << endl;    
	tasks[icentr]->GetHistoManager()->SetSuffix(customSuffix+long(icentr));
      }	
    }    
  }
  // Init and run the analy
  if (!mgr->InitAnalysis()) return;

  mgr->PrintStatus();
  
  if (runMode == kMyRunModeLocal ) {
    // If running in local mode, create chain of ESD files
    cout << "RUNNING LOCAL, CHAIN" << endl;    
    TChain * chain = GetAnalysisChain(data);
    chain->Print();
    mgr->StartAnalysis("local",chain,nev);
  } else if (runMode == kMyRunModeProofLite) {
    TChain * chain = GetAnalysisChain(data);
    mgr->StartAnalysis("proof",chain,nev);
  } 
  else if (runMode == kMyRunModeCAF) {
    mgr->StartAnalysis("proof",TString(data)+"#esdTree",nev);
  } else if (runMode == kMyRunModeGRID) {
    mgr->StartAnalysis("grid");
  } else {
    cout << "ERROR: unknown run mode" << endl;        
  }

  if (!useOtherCentralityCut) {
    pathsuffix = pathsuffix + "_" + centrEstimator + "_bin_"+long(centrBin);
  } else if(useOtherCentralityCut==1){
    pathsuffix = pathsuffix + "_TrackRange_" + long(trackMin) + "_" + long(trackMax);
  } else if(useOtherCentralityCut==2){
    pathsuffix = pathsuffix + "_V0Range_" + long(trackMin) + "_" + long(trackMax);
  } else if(useOtherCentralityCut==3){
    pathsuffix = pathsuffix + "_SPDOutRange_" + long(trackMin) + "_" + long(trackMax);
  }
  pathsuffix += customSuffix;

  if (doSave) MoveOutput(data, pathsuffix.Data());

  

  
}
Esempio n. 6
0
void Embedding(const char* dataset="collection.xml")
{
    
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  
  //load analysis framework
  gSystem->Load("libSTEERBase");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE
  
  gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS");

  // A task can be compiled dynamically with AClic
  gROOT->LoadMacro("AliPHOSEmbedding.cxx+g");
  
  // Connect to alien
  TString token = gSystem->Getenv("GRID_TOKEN") ;
  if (1) // token == "OK" ) 
    TGrid::Connect("alien://");
  else 
    AliInfo("You are not connected to the GRID") ; 
  cout << "Pi0Analysis: processing collection " << dataset << endl;
  
  // Create the chain
  TChain* chain = new TChain("esdTree");

  TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset));
  
  TAlienResult* result = collection->GetGridResult("",0 ,0);
  TList* rawFileList = result->GetFileInfoList();
  for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) {
    TFileInfo * fi =  static_cast<TFileInfo*>(rawFileList->At(counter)) ; 
    const char * rawFile = fi->GetCurrentUrl()->GetUrl() ;  
    printf("Processing %s\n", rawFile) ;
    chain->Add(rawFile);
    printf("Chain: %d entries.\n",chain->GetEntries()); 
  }
  TFileInfo * fi =  static_cast<TFileInfo*>(rawFileList->At(0));
  const char * fn = fi->GetCurrentUrl()->GetUrl() ;

  char runNum[7]; 
  for(Int_t i=0;i<6;i++)runNum[i]=fn[35+i] ;

  runNum[6]=0 ;
  Int_t iRunNum=atoi(runNum) ;
  printf("Run number=%d \n",iRunNum) ;

  //Run AOD simulation
  int nrun = atoi(runNum);
  int nevent = 0;
  int seed = 0;

  char sseed[1024];
  char sevent[1024];
  char sprocess[1024];
  char sfield[1024];
  char senergy[1024];

  sprintf(sevent,"");
  sprintf(sprocess,"");
  sprintf(sfield,"");
  sprintf(senergy,"");

  seed = 0;
  sprintf(sseed,"%d",seed);

  if (seed==0) {
    fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
    fprintf(stderr,"!!!!  WARNING! Seeding variable for MC is 0          !!!!\n");
    fprintf(stderr,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
  } else {
    fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
    fprintf(stdout,"!!!  MC Seed is %d \n",seed);
    fprintf(stdout,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
  }
  
// set the seed environment variable
  gSystem->Setenv("CONFIG_SEED",sseed);
  gSystem->Setenv("CONFIG_RUN_TYPE","kPythia6"); // kPythia6 or kPhojet^M
  gSystem->Setenv("CONFIG_FIELD","k5kG");      // kNoField or k5kG^M
  gSystem->Setenv("CONFIG_ENERGY","2760");    // 900 or 10000 (GeV)
  gSystem->Setenv("DC_RUN",runNum);    //run number 
  

  char nSimEvents[55] ;
  sprintf(nSimEvents,"%d",chain->GetEntries());
  gSystem->Setenv("SIM_EVENTS",nSimEvents); 
  gSystem->Exec("mv geometry.root geometry_PHOS.root") ;
  gSystem->Exec("aliroot -b -q simrun.C > simrun.log 2>&1");
  gSystem->Exec("mv geometry_PHOS.root geometry.root") ;

  // Make the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("Pi0EmbeddingManager");
  
  // ESD input handler
  AliESDInputHandler* esdH = new AliESDInputHandler();
  esdH->SetReadFriends(kFALSE);
  mgr->SetInputEventHandler(esdH);

  // Output
  AliAODHandler* aodHandler   = new AliAODHandler();
  aodHandler->SetOutputFileName("AliAODout.root");
  mgr->SetOutputEventHandler(aodHandler);

  
  // Debug level
  mgr->SetDebugLevel(0);


  // Add physics selection
  gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE);

  gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask *taskCentrality = AddTaskCentrality() ;

  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
  AliEPSelectionTask *taskEP = AddTaskEventplane() ;

  // Add my task
  AliPHOSEmbedding *task1 = new AliPHOSEmbedding("Embedding");

  TChain* chainAOD = new TChain("aodTree");
  chainAOD->AddFile("AliAOD.root") ;
  task1->SetSignalChain(chainAOD) ;
  task1->SelectCollisionCandidates();


  TFile *fOldCalib = TFile::Open("OldCalibration.root");
  if(fOldCalib->IsOpen()){
    printf("\n\n...Adding PHOS calibration used in ESD production \n") ;
    char key[55] ;
    TH2F * hCalib[5] ;
    for(Int_t mod=0;mod<5; mod++){
      sprintf(key,"calibrationMod%d",mod) ;
      hCalib[mod] = (TH2F*)fOldCalib->Get(key) ;
    }
    task1->SetOldCalibration(hCalib) ;
    fOldCalib->Close() ;
  }

  mgr->AddTask(task1);
  
  // Create containers for input/output
  AliAnalysisDataContainer *cinput   = mgr->GetCommonInputContainer(); 
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("output0",
                      TTree::Class(), AliAnalysisManager::kOutputContainer);


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

  AliLog::SetClassDebugLevel("AliGeomManager", 10) ;

  AliCDBManager::Instance()->SetRun(iRunNum) ;
//  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB") ;
//  AliCDBManager::Instance()->SetDefaultStorage("raw://") ;
  AliCDBManager::Instance()->SetDefaultStorage("alien://folder=/alice/data/2010/OCDB") ;
  AliCDBManager::Instance()->SetSpecificStorage("PHOS/*/*",
                                                "local://OCDB");
printf("RunNunm===%d \n",iRunNum) ;
  

  if (mgr->InitAnalysis()) {
    mgr->PrintStatus();
    mgr->StartAnalysis("local", chain);
  }
  
  if(iRunNum<=137848){ //period 1
    gSystem->Exec("mv BadMap_LHC10h_period1.root BadMap_LHC10h.root") ;
  }
  else{
    gSystem->Exec("mv BadMap_LHC10h_period234.root BadMap_LHC10h.root") ;
  }
  gSystem->Exec("aliroot -b -q AnalyzeDiff.C> analyze3.log 2>&1");

}
Esempio n. 7
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);
 
};
Esempio n. 8
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();
}
Esempio n. 9
0
//______________________________________________________________________________
void RunGrid(
         const char* runtype = "grid", // local, proof or grid
         const char *gridmode = "test", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof
         const Long64_t nentries = 400, // for local and proof mode, ignored in grid mode. Set to 1234567890 for all events.
         const Long64_t firstentry = 0, // for local and proof mode, ignored in grid mode
         const char *proofdataset = "/alice/data/LHC10c_000120821_p1", // path to dataset on proof cluster, for proof analysis
         const char *proofcluster = "alice-caf.cern.ch", // which proof cluster to use in proof mode
         const char *taskname = "Deuterons2011ESD"
         )
{
  // check run type
  if(runtype != "local" && runtype != "proof" && runtype != "grid"){
    Printf("\n\tIncorrect run option, check first argument of run macro");
    Printf("\tint runtype = local, proof or grid\n");
    return;
  }
  Printf("%s analysis chosen",runtype);
  
  gROOT->ProcessLine(".include $ALICE_ROOT/include");
  
  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
  gSystem->AddIncludePath("-I$ALICE_ROOT/PWGHF/vertexingHF");
  // Load analysis specific libraries
  //=====================================================================
  
  gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER/STEER -I$ALICE_ROOT/STEER/STEERBase -I$ALICE_ROOT/STEER/ESD -I$ALICE_ROOT/STEER/AOD -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_ROOT/OADB -I$ALICE_ROOT/PWGHF -I$ALICE_ROOT/PWGHF/base -I$ALICE_ROOT/PWGHF/vertexingHF -I$ALICE_ROOT/PWG/FLOW/Base -I$ALICE_ROOT/PWG/FLOW/Tasks -g");
  
  gSystem->Load("libTree.so");
  gSystem->Load("libGeom.so");
  gSystem->Load("libPhysics.so");
  gSystem->Load("libVMC.so");
  gSystem->Load("libMinuit.so");
  gSystem->Load("libSTEERBase.so");
  gSystem->Load("libESD.so");
  gSystem->Load("libAOD.so");
  gSystem->Load("libANALYSIS.so");
  gSystem->Load("libOADB.so");
  gSystem->Load("libANALYSISalice.so");
  gSystem->Load("libCORRFW.so");
  gSystem->Load("libPWGHFbase.so");
  gSystem->Load("libPWGflowBase.so");
  gSystem->Load("libPWGflowTasks.so");
  gSystem->Load("libPWGHFvertexingHF.so");
  
  // Load analysis specific libraries
  //=====================================================================
  //------ Create AlienPlugin ---------------------
  AliAnalysisGrid *plugin = 0x0;
  TChain *chain = 0x0;
  if (runtype != "local") {
    plugin = CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset);
    if(!plugin) return;
  } else {
    gROOT->LoadMacro("$ALICE_ROOT/PWGCF/Correlations/macros/dphicorrelations/CreateESDChain.C");
    chain = CreateESDChain("ESDs.txt");
  }
  
  //---- Create the analysis manager
  AliAnalysisManager* mgr = new AliAnalysisManager(taskname);
  if(plugin) mgr->SetGridHandler(plugin);
  
  //  Input
  
  AliESDInputHandler* iH = new AliESDInputHandler("handler","handler for my analisys");
  mgr->SetInputEventHandler(iH);
  
  //--------------------------------------------------------------
  // Other tasks

  // Physics selection
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
  AliPhysicsSelectionTask *physSel = AddTaskPhysicsSelection(kFALSE); // useMC
  // Centrality selection
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask *taskCentr = AddTaskCentrality();
  // PID response
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AliAnalysisTaskPIDResponse *pidTask = AddTaskPIDResponse(kFALSE); // useMC
  // PID QA
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
  AliAnalysisTaskPIDqa *pidQATask = AddTaskPIDqa();
  
  gROOT->LoadMacro("./AliAnalysisTaskFlowd.cxx+g");//$ALICE_ROOT/PWGLF/STRANGENESS/Cascades/AliAnalysisTaskCheckCascadePbPb.cxx++g");
  gROOT->LoadMacro("./AddTaskFlowd.C");//$ALICE_ROOT/PWGLF/STRANGENESS/Cascades/macros/AddTaskCheckCascadePbPb.C");
  AliAnalysisTaskFlowd *task = AddTaskFlowd(kTRUE);
  

  
  //__________________________________________________________________________
  // Disable debug printouts
  mgr->SetDebugLevel(3);
  AliLog::SetGlobalLogLevel(AliLog::kFatal);
  AliLog::SetGlobalDebugLevel(0);
  
  //__________________________________________________________________________
  if (!mgr->InitAnalysis()) return;
  mgr->PrintStatus();
  // Start analysis in grid.
  if (runtype == "local")
    mgr->StartAnalysis(runtype,chain,nentries,firstentry);
  else
    mgr->StartAnalysis(runtype,nentries,firstentry);
}
Esempio n. 10
0
void AddAnalysisTasks(const char *cdb_location)
{
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  mgr->SetCommonFileName("QAresults.root");
  // Statistics task
  mgr->AddStatisticsTask(kTriggerMask);
  //
  // CDB connection
  //
  if (doCDBconnect) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C");
    AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(cdb_location, run_number);
    if (!taskCDB) return;
  }    
  
  //
  // Event Statistics (Jan Fiete)
  //
  if (doEventStat) {
      gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
      AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kTRUE /*MC*/);
  }
  //
  // PIDResponse(JENS)
  //
  if (doPIDResponse) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); 
    AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse(kTRUE);
    PIDResponse->SelectCollisionCandidates(kTriggerMask);
  }  

   
  //
  // Centrality (A. Toia)
  //
  if (doCentrality) 
  {
    if(run_flag >= 1500)
    {
      gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C");
      AliMultSelectionTask *taskMult = AddTaskMultSelection();
      taskMult->SetAlternateOADBforEstimators(periodName);
    }
    else
      // old scheme is only valid for PbPb
      if (iCollisionType == kPbPb)
      {
        gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
        AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
        taskCentrality->SetMCInput();
      }
  }   
  
  // Vertexing (A. Dainese)
  // 
  if (doVertex) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskVertexESD.C");
    // Specific setting for MC
    AliAnalysisTaskVertexESD* taskvertexesd =  AddTaskVertexESD(kTRUE, kTriggerMask);
    taskvertexesd->SelectCollisionCandidates(kTriggerMask);
  }  

  // TPC QA (E. Sicking)
  //
  if (doQAsym) {
  // offline trigger in AddTask
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskQAsym.C");
    AliAnalysisTaskSE * taskqasim = AddTaskQAsym(0, kTriggerMask, kTriggerHM, kTriggerEMC, kTriggerMuonBarell);
  }  
  //
  // VZERO QA  (C. Cheshkov)
  //
  if (doVZERO) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskVZEROQA.C");
    AliAnalysisTaskSE * taskv0qa = AddTaskVZEROQA(0);
//  taskv0qa->SelectCollisionCandidates();
  }
  if (doVZEROPbPb) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/VZERO/AddTaskVZEROPbPb.C");
    AliAnaVZEROPbPb* taskV0PbPb = (AliAnaVZEROPbPb*)AddTaskVZEROPbPb(run_number);
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVLNWU-,CVLN-");
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU,CPBI2,CPBI1WU-,CPBI1-,CVHNWU,CVHN,CVLNWU,CVLN");
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_B2-,CVLNWU_B2-");
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_R1-,CVLN_B2-,CVLNWU_R1-,CVLNWU_B2-");
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_R1-,CVLN_B2-,CVLNWU_R1-,CVLNWU_B2-,CSEMI_R1-,CSEMIWU_R1-,CCENT_R2-,CCENTWU_R2-");
  }
  //
  // TPC (Jacek Otwinowski & Michael Knichel)
  //
  //
  // Optionally MC information can be used by setting the 1st argument to true
  // Optionally friends information can be switched off by setting the 2st argument 
  // to false
  // Optionally highMult axis can be used by setting the 3st argument to true (for PbPb)
  if (doTPC) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
    AliPerformanceTask *tpcQA = 0;
    if (iCollisionType==kPbPb  || iCollisionType == kXeXe) {
       // High multiplicity Pb-Pb
       tpcQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, kTRUE);
    } else {
      // Low multiplicity (pp)
       tpcQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, kFALSE);
    }
    tpcQA->SelectCollisionCandidates(kTriggerMask);
    AliPerformanceRes::SetMergeEntriesCut(5000000); 
  }  

  // HLT (Alberica Toia)
  if (doHLT) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
    AliPerformanceTask *hltQA = AddTaskPerformanceTPCdEdxQA(kTRUE, kTRUE, kFALSE,0,kTRUE);
    hltQA->SelectCollisionCandidates(kTriggerMask);
  }  
  //
  // SPD (A. Mastroserio)
  //
  if (doSPD) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskSPDQA.C");
    AliAnalysisTaskSPD* taskspdqa = (AliAnalysisTaskSPD*)AddTaskSPDQA();
    // Request from Annalisa
    if (iCollisionType==kPbPb  || iCollisionType == kXeXe) taskspdqa->SetHeavyIonMode();
    taskspdqa->SelectCollisionCandidates(kTriggerMask);
    taskspdqa->SetOCDBInfo(run_number, "raw://");
  }  
  //
  // SDD (F. Prino)
  //
  if (doSDD) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddSDDPoints.C");
    AliAnalysisTaskSE* tasksdd = AddSDDPoints();
    tasksdd->SelectCollisionCandidates(kTriggerMask);
  }
  //
  // SSD dEdx (Marek Chojnacki)
  //
  if (doSSDdEdx) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskdEdxSSDQA.C");
    AliAnalysisTaskSE* taskssddedx = AddTaskdEdxSSDQA();
    taskssddedx->SelectCollisionCandidates(kTriggerMask);
  }

  //
  // ITS
  //
  if (doITS) {
  // hardcoded non-zero trigger mask
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskPerformanceITS.C");
      AliAnalysisTaskITSTrackingCheck *itsQA = 0;
      AliAnalysisTaskITSTrackingCheck *itsQACent0010 = 0;
      AliAnalysisTaskITSTrackingCheck *itsQACent3050 = 0;
      AliAnalysisTaskITSTrackingCheck *itsQACent6080 = 0;
      itsQA = AddTaskPerformanceITS(kTRUE);
      if(iCollisionType==kPbPb) {
        itsQACent0010 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,3500,10000);
        itsQACent3050 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,590,1570);
        itsQACent6080 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,70,310);
      }
      else if(iCollisionType==kXeXe) {
        itsQACent0010 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,2000,6000);
        itsQACent3050 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,350,1000);
        itsQACent6080 = AddTaskPerformanceITS(kTRUE,kFALSE,kFALSE,40,200);
      }
  }
  //
  // ITS saTracks, align (F.Prino)
  //
  if (doITSsaTracks) {
  // offline trigger in AddTask
     gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskITSsaTracks.C");
     AliAnalysisTaskITSsaTracks *itssaTracks = AddTaskITSsaTracks(kTRUE,kFALSE);
     itssaTracks->SelectCollisionCandidates(kTriggerMask);
  }   
  if (doITSalign) {
  // no offline trigger selection
     gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskITSAlign.C");
     AliAnalysisTaskITSAlignQA *itsAlign = AddTaskITSAlign(0,2011);
  }   
  //
  // Global tracks + V0s QA
  //
  if(doESDTracks) {
    // protection for bug fixed in v5-09-14
    Bool_t disable=kTRUE;
    if(gSystem->Getenv("ALIEN_JDL_PACKAGES")){
      TString packg=gSystem->Getenv("ALIEN_JDL_PACKAGES");
      TObjArray* pkgs=packg.Tokenize("##");
      Int_t np=pkgs->GetEntries();
      Int_t ver,n1,n2;
      Char_t str2[20];
      for(Int_t i=0; i<np; i++){
	TObjString* str=(TObjString*)pkgs->At(i);
	TString s=str->GetString();
	if(s.Contains("AliPhysics")){
	  s.ReplaceAll("VO_ALICE@","");
	  sscanf(s.Data(),"AliPhysics::v%d-%d-%d-%s",&ver,&n1,&n2,str2);
	  if(ver>=5 && n1>=9 && n2>=14){
	    printf("%s -> enable ESD track QA\n",s.Data());
	    disable=kFALSE;
	  }else{
	    disable=kTRUE;
	    printf("%s -> disable ESD track QA\n",s.Data());
	  }
	}
      }
    }
    if(!disable){
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskCheckESDTracks.C");
      AliAnalysisTaskCheckESDTracks* taskestr=AddTaskCheckESDTracks("QA",kFALSE,kTRUE,kTRUE);
      taskestr->SetPtBinning(160,0.,40.);
      taskestr->SelectCollisionCandidates(kTriggerMask);
    }
  }
  //
  // TRD (Alex Bercuci, M. Fasel) 
  //
  if(doTRD) {
  
   // no offline trigger selection
      // steer individual TRD tasks
      Bool_t 
      doCheckESD(kTRUE),  // AliTRDcheckESD
      doCheckDET(kTRUE),  // AliTRDcheckDET
      doEffic(kTRUE),     // AliTRDefficiency
      doResolution(kTRUE),// AliTRDresolution
      doCheckPID(kFALSE),  // AliTRDcheckPID
      doV0Monitor(kFALSE);// AliTRDv0Monitor
      AliTRDpwgppHelper::AddTrainPerformanceTRD(AliTRDpwgppHelper::Translate(doCheckESD, doCheckDET, doEffic, doResolution, doCheckPID, doV0Monitor));
  
  
  // no offline trigger selection
  //    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTrainPerformanceTRD.C");
      // steer individual TRD tasks
 //     Bool_t 
 //     doCheckESD(kTRUE),  // AliTRDcheckESD
 //     doCheckDET(kTRUE),  // AliTRDcheckDET
 //     doEffic(kTRUE),     // AliTRDefficiency
  //    doResolution(kTRUE),// AliTRDresolution
  //    doCheckPID(kFALSE),  // AliTRDcheckPID
  //    doV0Monitor(kFALSE);// AliTRDv0Monitor
  //    AddTrainPerformanceTRD(Translate(doCheckESD, doCheckDET, doEffic, doResolution, doCheckPID, doV0Monitor));
  }

  //
  // ZDC (Chiara Oppedisano) 
  //
  if(doZDC) {
  // hardcoded kMB trigger mask
     gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/ZDC/AddTaskZDCQA.C");
     AliAnalysisTaskSE *taskZDC = AddTaskZDCQA();
     taskZDC->SelectCollisionCandidates(kTriggerMask);
  }   
  //
  // Calorimetry (Gustavo Conesa)
  //

  if(doCALO) {
        
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");
      AliAnalysisTaskCaloTrackCorrelation *taskCaloQA = AddTaskCalorimeterQA("default");
      taskCaloQA->SetDebugLevel(0);
      
      taskCaloQA->GetAnalysisMaker()->GetCaloUtils()->SetEMCALGeometryName("EMCAL_COMPLETE12SMV1_DCAL_8SM");
      taskCaloQA->GetAnalysisMaker()->GetCaloUtils()->SetImportGeometryFromFile(kFALSE);
      taskCaloQA->GetAnalysisMaker()->GetCaloUtils()->SetNumberOfSuperModulesUsed(20);

      AliAnaCalorimeterQA * caloqa = (AliAnaCalorimeterQA*) taskCaloQA->GetAnalysisMaker()->GetListOfAnalysisContainers()->At(0);
      AliHistogramRanges* histoRanges = caloqa->GetHistogramRanges();
      histoRanges->SetHistoPhiRangeAndNBins(77*TMath::DegToRad(), 330*TMath::DegToRad(), 253) ;

      
      // offline mask set in AddTask to kMB
//      taskCaloQA->SelectCollisionCandidates(kTriggerMask);
      // Add a new calo task with EMC1 trigger only
//      taskCaloQA = AddTaskCalorimeterQA("trigEMC");
//      taskCaloQA->SelectCollisionCandidates(kTriggerEMC);
     
//      gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");
//      AliAnalysisTaskCaloTrackCorrelation*taskCaloQA=  AddTaskCalorimeterQA("ESD",  2012,  kFALSE,  kTRUE);
//      taskCaloQA->SetDebugLevel(0);
      // offline mask set in AddTask to kMB
//      taskCaloQA->SelectCollisionCandidates(kTriggerMask);
      // Add a new calo task with EMC1 trigger only
//      taskCaloQA=  AddTaskCalorimeterQA("ESD",  2012,  kFALSE,  kTRUE,  "",  "EMC7");
//      taskCaloQA->SetDebugLevel(0);
//      taskCaloQA->SelectCollisionCandidates(kTriggerEMC);

  
//      gROOT->LoadMacro("$ALICE_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");
//       AliAnalysisTaskCaloTrackCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kTRUE);
//      taskCaloQA->SetDebugLevel(0);
      // offline mask set in AddTask to kMB
//      taskCaloQA->SelectCollisionCandidates(kTriggerMask);
      // Add a new calo task with EMC1 trigger only
//      taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kTRUE, "", "EMC7");
//      taskCaloQA->SetDebugLevel(0);
//      taskCaloQA->SelectCollisionCandidates(kTriggerEMC);
  }

  //
  // Muon Trigger
  //
  
  if(doMUONTrig) {
  // no offline trigger selection
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
      AliAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency(kTRUE);
  }

  //
  // Muon Efficiency (not used)
  //

  if(doMUONEff) 
  {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/MUON/dep/AddTaskMUONTrackingEfficiency.C");
    AliAnalysisTaskMuonTrackingEff *muonEfficiency = AddTaskMUONTrackingEfficiency(kTRUE,kTRUE,"");
    if (!isMuonOnly) muonEfficiency->SelectCollisionCandidates(kTriggerMask);
    muonEfficiency->UseMCLabel(kTRUE);
  }

  //
  // Muon Performance (Philippe Pillot)
  //
  //
  if (doMUONPerf) 
  {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/MUON/dep/AddTaskMuonPerformance.C");
    AliAnalysisTaskMuonPerformance* muonPerformance = AddTaskMuonPerformance();
    if (!isMuonOnly) muonPerformance->SelectCollisionCandidates(kTriggerMask);
    muonPerformance->UseMCKinematics(kTRUE);
    muonPerformance->SetMCTrigLevelFromMatchTrk(kTRUE);
 }

  //
  // V0-Decay Reconstruction (Ana Marin) (not used)
  // 

  if (doV0) {
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskV0QA.C");
      AliAnalysisTaskV0QA *taskv0QA = AddTaskV0QA(kTRUE);
  }
  //
  // Impact parameter resolution ([email protected], [email protected])
  //
  if (doImpParRes) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskImpParRes.C");
    AliAnalysisTaskSE* taskimpparres=0;
    // Specific setting for MC
    if(iCollisionType==kpp || iCollisionType==kpPb || iCollisionType==kPbp) {
       taskimpparres= AddTaskImpParRes(kTRUE);
    } else {
       taskimpparres= AddTaskImpParRes(kTRUE,-1,kTRUE,kFALSE);
    }
    taskimpparres->SelectCollisionCandidates(kTriggerMask);
  }  
  //
  // MUON QA (Philippe Pillot)
  //
  if (doMUON) {
  // trigger analysis internal
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskMuonQA.C");
    AliAnalysisTaskMuonQA* taskmuonqa = AddTaskMuonQA(kFALSE);
    taskmuonqa->GetTrackCuts()->SetIsMC(kTRUE);
  }  
  //
  // TOF (Francesca Bellini)
  //
  if (doTOF) {
  //    gROOT->LoadMacro("$ALICE_ROOT/PWGPP/TOF/AddTaskTOFQA.C");
 //   AliAnalysisTaskTOFqa *tofQA = AddTaskTOFQA(kFALSE);
  //  tofQA->SelectCollisionCandidates(kTriggerMask);
   gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/TOF/AddTaskTOFqaID.C");
   AliAnalysisTaskTOFqaID *tofQA = AddTaskTOFqaID(kFALSE, AliVEvent::kAnyINT, 0, kFALSE, "", kTRUE, 0);
//   tofQA->SelectCollisionCandidates(kTriggerMask);
 } 
  //
  // PIDqa(JENS)
  //
  if (doPIDqa) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
    AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
    PIDQA->SelectCollisionCandidates(kTriggerMask);
  }  
 
  //
  // HMPID QA (Giacomo Volpe)
  //
  if (doHMPID) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/HMPID/AddTaskHmpidQA.C");
    AliAnalysisTaskSE* taskhmpidqa= AddTaskHmpidQA(kTRUE);
      // offline mask set in AddTask to kMB
    taskhmpidqa->SelectCollisionCandidates(kTriggerMask);
  }      
  // T0 QA (Alla Mayevskaya)
  if (doT0) {
  // no offline trigger selection
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/T0/AddTaskT0QA.C");
    AliT0AnalysisTaskQA* taskt0qa= AddTaskT0QA();
    taskt0qa->SelectCollisionCandidates(kTriggerMask);
  }      
  // FMD QA (Christian Holm Christiansen)
  if (doFMD) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskForwardQA.C");
    // Parameters: usemc, usecentrality
    AliAnalysisTaskSE *forwardQA = (AliAnalysisTaskSE *)AddTaskForwardQA(kTRUE, (Bool_t)doCentrality);
    // No offline trigger config. needed (see #84077)
  }
   //     
  // PHOS QA (Boris Polishchuk)
  //
  if (doPHOS) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGGA/PHOSTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C");
    //AliAnalysisTaskCaloCellsQA *taskPHOSCellQA1 = AddTaskCaloCellsQA(4, 1, NULL,"PHOSCellsQA_AnyInt");
    AliAnalysisTaskCaloCellsQA *taskPHOSCellQA1 = AddTaskCaloCellsQA(5, 1, NULL,"PHOSCellsQA_AnyInt");
    taskPHOSCellQA1->SelectCollisionCandidates(kTriggerMask);
    taskPHOSCellQA1->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.3,1.0);
    //AliAnalysisTaskCaloCellsQA *taskPHOSCellQA2 = AddTaskCaloCellsQA(4, 1, NULL,"PHOSCellsQA_PHI7"); 
    AliAnalysisTaskCaloCellsQA *taskPHOSCellQA2 = AddTaskCaloCellsQA(5, 1, NULL,"PHOSCellsQA_PHI7");
    taskPHOSCellQA2->SelectCollisionCandidates(AliVEvent::kPHI7);
    taskPHOSCellQA2->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.3,1.0);
    // Pi0 QA fo PbPb
    if (iCollisionType == kPbPb || iCollisionType == kXeXe) {
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGGA/PHOSTasks/PHOS_PbPbQA/macros/AddTaskPHOSPbPb.C");
      AliAnalysisTaskPHOSPbPbQA* phosPbPb = AddTaskPHOSPbPbQA(0);
    }
  } 
   if (doPHOSTrig) {
     gROOT->LoadMacro("$ALICE_PHYSICS/PWGGA/PHOSTasks/PHOS_TriggerQA/macros/AddTaskPHOSTriggerQA.C");
     AliAnalysisTaskPHOSTriggerQA *taskPHOSTrig = AddTaskPHOSTriggerQA(NULL);
  }   
  //
  // EMCAL QA (Gustavo Conesa)
  //
  if (doEMCAL) {
     gROOT->LoadMacro("$ALICE_PHYSICS/PWGGA/EMCALTasks/macros/AddTaskEMCALTriggerQA.C");
     AliAnalysisTaskEMCALTriggerQA *emctrig = AddTaskEMCALTriggerQA();
  }  
   //
  // EvTrk QA (Zaida)
  //
  if (doEvTrk) {
   gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/EvTrkSelection/AddSingleTrackEfficiencyTaskForAutomaticQA.C");
   AliAnalysisTask *task = AddSingleTrackEfficiencyTaskForAutomaticQA();
 }  
   //
  // AD QA (Michal Broz))
  //
  if (doAD) {
   gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/AD/AddTaskADQA.C");
   AliAnalysisTaskADQA *task = AddTaskADQA();
 }  

   
  //     
  // FLOW and BF QA (C.Perez && A.Rodriguez)
  //
  if (doFBFqa) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskFBFqa.C");
    AliAnalysisTaskSE *qaFBFMB = (AliAnalysisTaskSE*) AddTaskFBFqa("qaFBFmb",kFALSE);
    qaFBFMB->SelectCollisionCandidates(AliVEvent::kMB);
    AliAnalysisTaskSE *qaFBFSC = (AliAnalysisTaskSE*) AddTaskFBFqa("qaFBFsc",kFALSE);
    qaFBFSC->SelectCollisionCandidates(AliVEvent::kSemiCentral);
    AliAnalysisTaskSE *qaFBFCE = (AliAnalysisTaskSE*) AddTaskFBFqa("qaFBFce",kFALSE);
    qaFBFCE->SelectCollisionCandidates(AliVEvent::kCentral);
  }
}
Esempio n. 11
0
//______________________________________________________________________________                                                           
void AddAnalysisTasks(const char *cdb_location)
{
  // Add all analysis task wagons to the train                                                                                               
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();                                                                     

  //
  // Tender and supplies. Needs to be called for every event.
  //
   AliAnalysisManager::SetCommonFileName("AODQA.root");
   if (useTender) {
      gROOT->LoadMacro("$ALICE_PHYSICS/ANALYSIS/TenderSupplies/AddTaskTender.C");
      // IF V0 tender needed, put kTRUE below
      AliAnalysisTaskSE *tender = AddTaskTender(useV0tender);
//      tender->SetDebugLevel(2);
   }
   
   // Clean Geometry: Ruben
//  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/CalibMacros/commonMacros/CleanGeom.C++");
//  CleanGeom* clgmTask = new CleanGeom("cleanGeom");
//  mgr->AddTask(clgmTask);
//  AliAnalysisDataContainer *dummyInp = mgr->GetCommonInputContainer();
//  if (dummyInp) mgr->ConnectInput(clgmTask,0,dummyInp);  
 
   
   //
  // PIDResponse(JENS)
  //
  if (doPIDResponse) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); 
    AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse();
 //    PIDResponse->SetUserDataRecoPass(1);
//    PIDResponse->SelectCollisionCandidates(AliVEvent::kAny);
  }  
 
  //
  // PIDqa(JENS)
  //
  if (doPIDqa) {
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
    AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
    PIDQA->SelectCollisionCandidates(AliVEvent::kAny);
  }  
  // CDB connection
  //
  if (doCDBconnect && !useTender) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C");
    AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(cdb_location, 0 /*run_number*/);
    if (!taskCDB) return;
    AliCDBManager *cdb = AliCDBManager::Instance();
    cdb->SetDefaultStorage(cdb_location);
//    taskCDB->SetRunNumber(run_number);
  }    
 
   if (usePhysicsSelection) {
   // Physics selection task
      gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
      mgr->RegisterExtraFile("event_stat.root");
      AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(useMC);
      mgr->AddStatisticsTask(AliVEvent::kAny);
   }
   

//Jacek
   if (iPWGPP) {
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/macros/AddTaskFilteredTree.C");
      AddTaskFilteredTree("FilterEvents_Trees.root");
   }   
   
   // Centrality 
   if (useCentrality) {
      if ( run_flag >= 1500 )
      {
        gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C");
        AliMultSelectionTask *taskMult = AddTaskMultSelection();
      }
      else
      {
        // old scheme is only valid for PbPb
        if ( iCollision == kPbPb )
        {
          gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
          AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
          //taskCentrality->SelectCollisionCandidates(AliVEvent::kAny);
        }
      }
   }
   
// --- PWGLF - Forward ([email protected]) -----------------------------
   if (iPWGLFForward && usePhysicsSelection) { 
        gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskForwardMult.C");
     UShort_t pwglfForwardSys = 0; // iCollision+1; // pp:1, PbPb:2, pPb:3
     UShort_t pwglfSNN        = 0;            // GeV, 0==unknown
     Short_t  pwglfField      = 0;
     AddTaskForwardMult(useMC && useTR,        // Need track-refs 
			pwglfForwardSys,       // Collision system
			pwglfSNN, 
			pwglfField);
        gROOT->LoadMacro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskCentralMult.C");
        AddTaskCentralMult(useMC, pwglfForwardSys, pwglfSNN, pwglfField);
   }

    //PWGAgammaconv
    if (iPWGGAgammaconv) {
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGGA/GammaConv/macros/AddTask_ConversionAODProduction.C");
      Int_t dataset=iCollision;
      if( iCollision == kXeXe) dataset=kPbPb;
      if( iCollision == kPbp || iCollision == kpPb ) dataset=2;
      AliAnalysisTask *taskconv = AddTask_ConversionAODProduction(dataset, kFALSE, periodName);
      mgr->RegisterExtraFile("AliAODGammaConversion.root");
   }   
 
   if (iESDfilter) 
   {
      //  ESD filter task configuration.
      gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C");
      if (iMUONcopyAOD) {
         printf("Registering delta AOD file\n");
         mgr->RegisterExtraFile("AliAOD.Muons.root");
      }

      Bool_t muonWithSPDTracklets = (iCollision==kPbPb || iCollision==kXeXe) ? kFALSE : kTRUE; // add SPD information to muon AOD only for pp

      AliAnalysisTaskESDfilter *taskesdfilter = 
                 AddTaskESDFilter(useKFILTER, 
                                  iMUONcopyAOD,          // write Muon AOD
                                  kFALSE,                // write dimuon AOD 
                                  kFALSE,                // usePhysicsSelection 
                                  kFALSE,                // centrality OBSOLETE
                                  kTRUE,                 // enable TPS only tracks
                                  kFALSE,                // disable cascades
                                  kFALSE,                // disable kinks
                                  run_flag,              // run flag (YY00)
                                  3,                     // muonMCMode
                                  //kTRUE,               // useV0Filter
                                  kFALSE,                // useV0Filter - turned off for PCM to make sense
                                  muonWithSPDTracklets,
                                  isMuonCaloPass,
                                  iPWGGAgammaconv);      // Add PCMV0
         AliEMCALGeometry::GetInstance("","");
   }   

// ********** PWG3 wagons ******************************************************           
   // PWGHF vertexing
  if (iPWGHFvertexing) 
  {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C");

    Int_t configHF=0;
    if(iCollision == kPbPb || iCollision == kXeXe) configHF=1;
    AliAnalysisTaskSEVertexingHF *taskvertexingHF = AddTaskVertexingHF(configHF,train_name,"",run_number,periodName);
    // Now we need to keep in sync with the ESD filter
    if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED");
    else mgr->RegisterExtraFile("AliAOD.VertexingHF.root");
    taskvertexingHF->SelectCollisionCandidates(0);
  }

   // PWGDQ JPSI filtering (only pp)
   if (iPWGDQJPSIfilter && (iCollision==kpp)) {
      gROOT->LoadMacro("$ALICE_PHYSICS/PWGDQ/dielectron/macros/AddTaskJPSIFilter.C");
      AliAnalysisTaskSE *taskJPSIfilter = AddTaskJPSIFilter();
      if (!taskJPSIfilter) ::Warning("AnalysisTrainNew", "AliAnalysisTaskDielectronFilter cannot run for this train conditions - EXCLUDED");
      else mgr->RegisterExtraFile("AliAOD.Dielectron.root");
      taskJPSIfilter->SelectCollisionCandidates(0);
   }   

  // PWGHF D2h
  if (iPWGHFd2h) 
  {   
    gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/vertexingHF/AddD2HTrain.C");

    AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);                                 
  }
   

   
   // ********** PWG4 wagons ******************************************************
   // Jet analysis

   // Configurations flags, move up?
   TString kDeltaAODJetName = "AliAOD.Jets.root"; //
   Bool_t  kIsPbPb = (iCollision==kPbPb || iCollision==kXeXe);
   TString kDefaultJetBackgroundBranch = "";
   TString kJetSubtractBranches = "";
   UInt_t kHighPtFilterMask = 272;// from esd filter
   UInt_t iPhysicsSelectionFlag = 0;
   if (iJETAN) {
     gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/macros/AddTaskJets.C");
     // Default jet reconstructor running on ESD's
     AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction     
     if (!taskjets) ::Fatal("AnalysisTrainNew", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED");
     if(kDeltaAODJetName.Length()>0) taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
     if (iJETANdelta) {
        //            AddTaskJetsDelta("AliAOD.Jets.root"); // need to modify this accordingly in the add task jets
        mgr->RegisterExtraFile(kDeltaAODJetName.Data());
        TString cTmp("");
        if(kIsPbPb){
          // UA1 intrinsic background subtraction
          taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction
          if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
       // SICONE 
       taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later....                                                                                  
       if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       cTmp = taskjets->GetNonStdBranch();
       if(cTmp.Length()>0)kJetSubtractBranches += Form("%s ",cTmp.Data());
	 
       // Add the clusters..
       gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/macros/AddTaskJetCluster.C");
       AliAnalysisTaskJetCluster *taskCl = 0;
       Float_t fCenUp = 0;
       Float_t fCenLo = 0;
       Float_t fTrackEtaWindow = 0.9;
       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip                                                                                 
       taskCl->SetBackgroundCalc(kTRUE);
       taskCl->SetNRandomCones(10);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       taskCl->SetGhostEtamax(fTrackEtaWindow);
       kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch());

       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,2,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       taskCl->SetNRandomCones(10);
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());

       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
	 
       // DO THE BACKGROUND SUBTRACTION
       if(kIsPbPb&&kJetSubtractBranches.Length()){
         gROOT->LoadMacro("$ALICE_PHYSICS/PWGJE/macros/AddTaskJetBackgroundSubtract.C");
         AliAnalysisTaskJetBackgroundSubtract *taskSubtract = 0;
         taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,1,"B0","B%d");
         taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
         if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
     } 
   }
}
Esempio n. 12
0
void Hyperon(const char* dataset="collection.xml")
{
  /* $Id$ */
  TStopwatch timer;
  timer.Start();


    TStringToken libs("Core,Tree,Geom,VMC,Physics,Minuit,Gui,XMLParser,Minuit2,Proof,STEERBase,ESD,AOD,OADB,ANALYSIS,ANALYSISalice,CDB,RAWDatabase,STEER,CORRFW,PHOSUtils,PHOSbase,PHOSpi0Calib,PHOSrec,PHOSshuttle,PHOSsim", ",");
  while( libs.NextToken() )
    gSystem->Load( Form("lib%s", libs.Data()) );

  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  gSystem->Load("libPWGGAGammaConv");
  gSystem->Load("libPWGGAHyperon");
  
  //load analysis framework
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE
  
  // Connect to alien
  TString token = gSystem->Getenv("GRID_TOKEN") ;
  if (1) // token == "OK" ) 
    TGrid::Connect("alien://");
  else 
    AliInfo("You are not connected to the GRID") ; 

  cout << "Pi0Analysis: processing collection " << dataset << endl;

  // Create the chain
  TChain* chain = new TChain("aodTree");

  TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset));
  
  TAlienResult* result = collection->GetGridResult("",0 ,0);
  TList* rawFileList = result->GetFileInfoList();
  
  for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) {
    TFileInfo * fi =  static_cast<TFileInfo*>(rawFileList->At(counter)) ; 
    const char * rawFile = fi->GetCurrentUrl()->GetUrl() ;  
    printf("Processing %s\n", rawFile) ;
    chain->Add(rawFile);
    printf("Chain: %d entries.\n",chain->GetEntriesFast()); 
  }

  // Make the analysis manager
  AliAnalysisManager *mgr = new AliAnalysisManager("Hyperon");
  mgr->SetCommonFileName("histos.root");
  
  // AOD input handler
  AliAODInputHandler* aodH = new AliAODInputHandler();
  mgr->SetInputEventHandler(aodH);

  
  // Debug level
  mgr->SetDebugLevel(2);

   gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C"); 
   AliCentralitySelectionTask* taskCentrality = AddTaskCentrality(); 
   if (analysisMC) 
    taskCentrality->SetMCInput(); 

  // // Update it for Hyperon (YK 22.01.2015)
  // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
  // AliEPSelectionTask *taskEP = AddTaskEventplane() ; 

  // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
  // AliVZEROEPSelectionTask *selTask = AddTaskVZEROEPSelection();  

  // Add my task
  AliAnalysisHyperon* task = new AliAnalysisHyperon();
  // gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_PbPb/AddTaskPHOSPi0Flow.C"); // Update it for Hyperon (YK 22.01.2015)
  // task = AddTaskPHOSPi0Flow();

  
  // // Create containers for input/output
  AliAnalysisDataContainer *cinput   = mgr->GetCommonInputContainer(); 
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("Hyperon",TList::Class(),AliAnalysisManager::kOutputContainer,"HyperonHist.root");
  
  // // Connect input/output
  mgr->ConnectInput(task , 0, cinput);
  mgr->ConnectOutput(task, 1, coutput1);
 
  if (mgr->InitAnalysis()) {
    mgr->PrintStatus();
    mgr->StartAnalysis("local", chain);
  }

  timer.Stop();
  timer.Print();
}
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(...)
Esempio n. 14
0
TString Setup
(
   Int_t       nmix,
   const char *options,
   const char *outputFileName,
   const char *macroPath = "."
)
{
  
  
  // prepare output
   TString out("");
   
   //
   // === EXAMINE OPTIONS ==========================================================================
   //
   
   // this is done using the utility 'RsnOptions.C'
   // which provides a unique way to interpret them
   
   TString opt(options);
   opt.ToUpper();
   
   Bool_t isMC      = opt.Contains("MC") || (!opt.Contains("DATA"));
   Bool_t isPP      = opt.Contains("PP") || (!opt.Contains("PBPB"));
   Bool_t isESD     = opt.Contains("ESD");
   Bool_t useTender = opt.Contains("Tender");
   Bool_t noV0      = opt.Contains("NOV0");
   
   //
   // === LOAD LIBRARIES ===========================================================================
   //

   // load analysis libraries
   gSystem->Load("libCore");
   gSystem->Load("libGeom");
   gSystem->Load("libVMC");
   gSystem->Load("libMinuit");
   gSystem->Load("libPhysics");
   gSystem->Load("libTree");
   gSystem->Load("libSTEERBase");
   gSystem->Load("libESD");
   gSystem->Load("libAOD");
   gSystem->Load("libANALYSIS");
   gSystem->Load("libANALYSISalice");
   gSystem->Load("libEventMixing");
   gSystem->Load("libCORRFW");
   gSystem->Load("libPWGLFresonances");


   // tender-related libraries
   if (isESD && useTender) {
      ::Info("AnalysisSetup", "Loading tender libraries");
      gSystem->Load("libTender");
      gSystem->Load("libTenderSupplies");
   } else if (!isESD) {
      useTender = kFALSE;
   }
   
   // load development RSN library
   if (!AliAnalysisAlien::SetupPar("PWGLFresonances.par")) return "";

   //
   // === CREATE ANALYSIS MANAGER ==================================================================
   //

   AliAnalysisManager *mgr = new AliAnalysisManager("RsnAnalysisManager");
   mgr->SetCommonFileName(outputFileName);
   ::Info("AnalysisSetup", "Common file name: %s", outputFileName);

   //
   // === INPUT / OUTPUT HANDLER CONFIGURATION =====================================================
   //

   if (isESD) {
      out = "esdTree";
      ::Info("AnalysisSetup", "Creating ESD handler");
      AliESDInputHandler *esdHandler = new AliESDInputHandler();
      mgr->SetInputEventHandler(esdHandler);
      if (isMC) {
         ::Info("AnalysisSetup", "Creating MC handler");
         AliMCEventHandler *mcHandler  = new AliMCEventHandler();
         mgr->SetMCtruthEventHandler(mcHandler);
      }
   } else {
      out = "aodTree";
      ::Info("AnalysisSetup", "Creating AOD handler");
      AliAODInputHandler *aodHandler = new AliAODInputHandler();
      mgr->SetInputEventHandler(aodHandler);
   }
   
   //
   // === Tender TASK (ESD only -- optional) =======================================================
   //

   if (isESD && useTender) {
      ::Info("AnalysisSetup", "Adding tender (and then accepting V0 info)", options);
      gROOT->LoadMacro(Form("%s/AddTaskTender.C", macroPath));
      AddTaskTender();
      noV0 = kFALSE;
   }

   //
   // === PHYSICS SELECTION (ESD only) =============================================================
   //

   if (isESD) {
      ::Info("AnalysisSetup", "Add physics selection by default on ESD analysis");
      gROOT->LoadMacro("$(ALICE_PHYSICS)/OADB/macros/AddTaskPhysicsSelection.C");
      AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);
      if (noV0) {
         ::Info("AnalysisSetup", "Skip of V0 info is required");
         physSelTask->GetPhysicsSelection()->SetSkipV0(kTRUE);
      }
   }
   
   //
   // === CENTRALITY/PLANE (ESD only) ==============================================================
   //
   if (isESD && !isPP) {
     ::Info("AnalysisSetup", "Add centrality and event plane computation tasks");
      gROOT->LoadMacro("$(ALICE_PHYSICS)/OADB/macros/AddTaskCentrality.C");
      gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskEventplane.C");
      AliCentralitySelectionTask* taskCentrality = (AliCentralitySelectionTask*)AddTaskCentrality();
      if (isMC) {
	::Info("AnalysisSetup", "Setting centrality computation for MC");
	taskCentrality->SetMCInput();
      }
      AddTaskEventplane();
   }
   //
   // === PID RESPONSE =============================================================================
   //
   
   gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDResponse.C");
   AddTaskPIDResponse(isMC,kTRUE,kTRUE);

   //gROOT->LoadMacro("$(ALICE_ROOT)/ANALYSIS/macros/AddTaskPIDqa.C ");
   //AddTaskPIDqa();
   
   //
   // === OTHER TASKS ==============================================================================
   //
   
   // add RSN task
   gROOT->LoadMacro(Form("%s/AddTaskLStarPPb.C", macroPath));
   if (!AddTaskLStarPPb(isMC, isPP, macroPath, nmix)) return "";
   
   ::Info("AnalysisSetup", "Setup successful");
   return out;
}
Esempio n. 15
0
//______________________________________________________________________________                                                           
void AddAnalysisTasks(){                                                                                                                                          
  // Add all analysis task wagons to the train                                                                                               
   IlcAnalysisManager *mgr = IlcAnalysisManager::GetAnalysisManager();                                                                     

  //
  // Tender and supplies. Needs to be called for every event.
  //
   IlcAnalysisManager::SetCommonFileName("AODQA.root");
   if (useTender) {
      gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C");
      // IF V0 tender needed, put kTRUE below
      IlcAnalysisTaskSE *tender = AddTaskTender(useV0tender);
//      tender->SetDebugLevel(2);
   }

   if (usePhysicsSelection) {
   // Physics selection task
      gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
      mgr->RegisterExtraFile("event_stat.root");
      IlcPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(useMC);
//      IlcOADBPhysicsSelection * oadbDefaultPbPb = CreateOADBphysicsSelection();      
//      physSelTask->GetPhysicsSelection()->SetCustomOADBObjects(oadbDefaultPbPb,0,0);
      mgr->AddStatisticsTask(IlcVEvent::kAny);
   }
   // Centrality (only Pb-Pb)
   if (iCollision && useCentrality) {
      gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
      IlcCentralitySelectionTask *taskCentrality = AddTaskCentrality();
      taskCentrality->SelectCollisionCandidates(IlcVEvent::kAny);
   }

   if (iESDfilter) {
      //  ESD filter task configuration.
      gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
      if (iMUONcopyAOD) {
         printf("Registering delta AOD file\n");
         mgr->RegisterExtraFile("IlcAOD.Muons.root");
         mgr->RegisterExtraFile("IlcAOD.Dimuons.root");
         IlcAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kTRUE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,IlcESDpid::kTOF_T0,kTRUE,kFALSE,kFALSE,run_flag);
      } else {
   	   IlcAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,IlcESDpid::kTOF_T0,kTRUE,kFALSE,kFALSE,run_flag); // others
      }   
   }   

// ********** PWG3 wagons ******************************************************           
   // PWGHF vertexing
   if (iPWGHFvertexing) {
      gROOT->LoadMacro("$ILC_ROOT/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C");
      if (!iPWGHFd2h) TFile::Cp(gSystem->ExpandPathName(configPWGHFd2h.Data()), "file:ConfigVertexingHF.C");
      IlcAnalysisTaskSEVertexingHF *taskvertexingHF = AddTaskVertexingHF();
      if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "IlcAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED");
      else mgr->RegisterExtraFile("IlcAOD.VertexingHF.root");
      taskvertexingHF->SelectCollisionCandidates(0);
   }   
      
   // PWGDQ JPSI filtering (only pp)
   if (iPWGDQJPSIfilter && (iCollision==0)) {
      gROOT->LoadMacro("$ILC_ROOT/PWGDQ/dielectron/macros/AddTaskJPSIFilter.C");
      IlcAnalysisTaskSE *taskJPSIfilter = AddTaskJPSIFilter();
      if (!taskJPSIfilter) ::Warning("AnalysisTrainNew", "IlcAnalysisTaskDielectronFilter cannot run for this train conditions - EXCLUDED");
      else mgr->RegisterExtraFile("IlcAOD.Dielectron.root");
      taskJPSIfilter->SelectCollisionCandidates(0);
   }   

   // PWGHF D2h
   if (iPWGHFd2h) {   
     gROOT->LoadMacro("$ILC_ROOT/PWGHF/vertexingHF/AddD2HTrain.C");
     TFile::Cp(gSystem->ExpandPathName(configPWGHFd2h.Data()), "file:ConfigVertexingHF.C");
     AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);                                 
   }
   
   // ********** PWG4 wagons ******************************************************
   // Jet analysis

   // Configurations flags, move up?
   TString kDeltaAODJetName = "IlcAOD.Jets.root"; //
   Bool_t  kIsPbPb = (iCollision==0)?false:true; // can be more intlligent checking the name of the data set
   TString kDefaultJetBackgroundBranch = "";
   TString kJetSubtractBranches = "";
   UInt_t kHighPtFilterMask = 128;// from esd filter
   UInt_t iPhysicsSelectionFlag = IlcVEvent::kMB;
   if (iJETAN) {
     gROOT->LoadMacro("$ILC_ROOT/PWGJE/macros/AddTaskJets.C");
     // Default jet reconstructor running on ESD's
     IlcAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction     
     if (!taskjets) ::Fatal("AnalysisTrainNew", "IlcAnalysisTaskJets cannot run for this train conditions - EXCLUDED");
     if(kDeltaAODJetName.Length()>0) taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
     if (iJETANdelta) {
        //            AddTaskJetsDelta("IlcAOD.Jets.root"); // need to modify this accordingly in the add task jets
        mgr->RegisterExtraFile(kDeltaAODJetName.Data());
        TString cTmp("");
        if(kIsPbPb){
          // UA1 intrinsic background subtraction
          taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction
          if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
       // SICONE 
       taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later....                                                                                  
       if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data());
       cTmp = taskjets->GetNonStdBranch();
       if(cTmp.Length()>0)kJetSubtractBranches += Form("%s ",cTmp.Data());
	 
       // Add the clusters..
       gROOT->LoadMacro("$ILC_ROOT/PWGJE/macros/AddTaskJetCluster.C");
       IlcAnalysisTaskJetCluster *taskCl = 0;
       Float_t fCenUp = 0;
       Float_t fCenLo = 0;
       Float_t fTrackEtaWindow = 0.9;
       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip                                                                                 
       taskCl->SetBackgroundCalc(kTRUE);
       taskCl->SetNRandomCones(10);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       taskCl->SetGhostEtamax(fTrackEtaWindow);
       kDefaultJetBackgroundBranch = Form("%s_%s",IlcAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch());

       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,2,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       taskCl->SetNRandomCones(10);
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());

       taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data(),0.15);
       taskCl->SetCentralityCut(fCenLo,fCenUp);
       if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
       kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
	 
       // DO THE BACKGROUND SUBTRACTION
       if(kIsPbPb&&kJetSubtractBranches.Length()){
         gROOT->LoadMacro("$ILC_ROOT/PWGJE/macros/AddTaskJetBackgroundSubtract.C");
         IlcAnalysisTaskJetBackgroundSubtract *taskSubtract = 0;
         taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,1,"B0","B%d");
         taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data());
         if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data());
       }
     } 
   }
}
Esempio n. 16
0
void AddAnalysisTasks(const char *suffix)
{
  TString ss(suffix);
  ss.ToLower();
  Bool_t ibarrel = (ss.Contains("barrel"))?kTRUE:kFALSE;
  IlcAnalysisManager *mgr = IlcAnalysisManager::GetAnalysisManager();
  mgr->SetCommonFileName(Form("QAresults%s.root",suffix));
  // Statistics task
  mgr->AddStatisticsTask(kTriggerMask);
  //
  // CDB connection
  //
  if (doCDBconnect) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C");
    IlcTaskCDBconnect *taskCDB = AddTaskCDBconnect();
    if (!taskCDB) return;
    IlcCDBManager *cdb = IlcCDBManager::Instance();
    cdb->SetDefaultStorage("raw://");
    taskCDB->SetRunNumber(run_number);
  }    
  
  //
  // Event Statistics (Jan Fiete)
  //
  if (doEventStat) {
      gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
      IlcPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE /*MC*/);
      IlcAnalysisDataContainer *cstatsout = (IlcAnalysisDataContainer*)mgr->GetOutputs()->FindObject("cstatsout");
      cstatsout->SetFileName(Form("EventStat_temp%s.root", suffix));
  }
  
  //
  // Centrality (A. Toia)
  //
  if (doCentrality) {
     if (!iCollisionType) {
        printf("Disabling centrality task for p-p\n");
        doCentrality = kFALSE;
     } else {           
        gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
        IlcCentralitySelectionTask *taskCentrality = AddTaskCentrality();
     }   
  }   
  
  // Vertexing (A. Dainese)
  // 
  if (doVertex) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTaskVertexESD.C");
    IlcAnalysisTaskVertexESD* taskvertexesd =  AddTaskVertexESD(kFALSE, kTriggerMask);
    taskvertexesd->SelectCollisionCandidates(kTriggerMask);
  }  

  // TPC QA (E. Sicking)
  //
  if (doQAsym) {
  // offline trigger in AddTask
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/PilotTrain/AddTaskQAsym.C");
    IlcAnalysisTaskSE * taskqasim = AddTaskQAsym(0, kTriggerMask, kTriggerHM, kTriggerEMC, kTriggerMuonBarell);
  }  
  //
  // VZERO QA  (C. Cheshkov)
  //
  if (doVZERO && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/PilotTrain/AddTaskVZEROQA.C");
    IlcAnalysisTaskSE * taskv0qa = AddTaskVZEROQA(0);
//  taskv0qa->SelectCollisionCandidates();
  }
  if (doVZEROPbPb && iCollisionType==1) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/VZERO/AddTaskVZEROPbPb.C");
    IlcAnaVZEROPbPb* taskV0PbPb = (IlcAnaVZEROPbPb*)AddTaskVZEROPbPb(0);
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVLNWU-,CVLN-");
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU,CPBI2,CPBI1WU-,CPBI1-,CVHNWU,CVHN,CVLNWU,CVLN");
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_B2-,CVLNWU_B2-");
//    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_R1-,CVLN_B2-,CVLNWU_R1-,CVLNWU_B2-");
    taskV0PbPb->SetClassesNames("CTRUE-,C0HWU-,CPBI2WU-,CPBI2-,CPBI2WU_B1-,CPBI2_B1-,CPBI1WU-,CPBI1-,CVHNWU-,CVHN-,CVHN_R2-,CVHNWU_R2-,CVLNWU-,CVLN-,CVLN_R1-,CVLN_B2-,CVLNWU_R1-,CVLNWU_B2-,CSEMI_R1-,CSEMIWU_R1-,CCENT_R2-,CCENTWU_R2-");
  }
  //
  // TPC (Jacek Otwinowski & Michael Knichel)
  //
  //
  // Optionally MC information can be used by setting the 1st argument to true
  // Optionally friends information can be switched off by setting the 2st argument 
  // to false
  // Optionally highMult axis can be used by setting the 3st argument to true (for PbPb)
  if (doTPC && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
    IlcPerformanceTask *tpcQA = 0;
    if (iCollisionType) {
       // High multiplicity Pb-Pb
       tpcQA = AddTaskPerformanceTPCdEdxQA(kFALSE, kTRUE, kTRUE);
    } else {
      // Low multiplicity (pp)
       tpcQA = AddTaskPerformanceTPCdEdxQA(kFALSE, kTRUE, kFALSE);
    }
    tpcQA->SelectCollisionCandidates(kTriggerMask);
  }  

  // HLT (Alberica Toia)
  if (doHLT && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/TPC/macros/AddTaskPerformanceTPCdEdxQA.C");
    IlcPerformanceTask *hltQA = AddTaskPerformanceTPCdEdxQA(kFALSE, kTRUE, kFALSE,0,kTRUE);
    hltQA->SelectCollisionCandidates(kTriggerMask);
  }  
  //
  // SPD (A. Mastroserio)
  //
  if (doSPD) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/PilotTrain/AddTaskSPDQA.C");
    IlcAnalysisTaskSPD* taskspdqa = (IlcAnalysisTaskSPD*)AddTaskSPDQA();
    // Request from Annalisa
    if (iCollisionType) taskspdqa->SetHeavyIonMode();
    taskspdqa->SelectCollisionCandidates(kTriggerMask);
    taskspdqa->SetOCDBInfo(run_number, "raw://");
  }  
  //
  // SDD (F. Prino)
  //
  if (doSDD) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/PilotTrain/AddSDDPoints.C");
    IlcAnalysisTaskSE* tasksdd = AddSDDPoints();
    tasksdd->SelectCollisionCandidates(kTriggerMask);
  }
  //
  // SSD dEdx (Marek Chojnacki)
  //
  if (doSSDdEdx) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/PilotTrain/AddTaskdEdxSSDQA.C");
    IlcAnalysisTaskSE* taskssddedx = AddTaskdEdxSSDQA();
    taskssddedx->SelectCollisionCandidates(kTriggerMask);
  }

  //
  // ITS
  //
  if (doITS) {
  // hardcoded non-zero trigger mask
      gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTaskPerformanceITS.C");
      IlcAnalysisTaskITSTrackingCheck *itsQA = 0;
      IlcAnalysisTaskITSTrackingCheck *itsQACent0010 = 0;
      IlcAnalysisTaskITSTrackingCheck *itsQACent3050 = 0;
      IlcAnalysisTaskITSTrackingCheck *itsQACent6080 = 0;
      if(iCollisionType==0) {
        itsQA = AddTaskPerformanceITS(kFALSE);
      } else {
        itsQA = AddTaskPerformanceITS(kFALSE);
        itsQACent0010 = AddTaskPerformanceITS(kFALSE,kFALSE,kFALSE,3500,10000);
        itsQACent3050 = AddTaskPerformanceITS(kFALSE,kFALSE,kFALSE,590,1570);
        itsQACent6080 = AddTaskPerformanceITS(kFALSE,kFALSE,kFALSE,70,310);
      }
  }
  //
  // ITS saTracks, align (F.Prino)
  //
  if (doITSsaTracks) {
  // offline trigger in AddTask
     gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTaskITSsaTracks.C");
     IlcAnalysisTaskITSsaTracks *itssaTracks = AddTaskITSsaTracks(kFALSE,kFALSE);
     itssaTracks->SelectCollisionCandidates(kTriggerMask);
  }   
  if (doITSalign) {
  // no offline trigger selection
     gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTaskITSAlign.C");
     IlcAnalysisTaskITSAlignQA *itsAlign = AddTaskITSAlign(0,2011);
  }   
  //
  // TRD (Alex Bercuci, M. Fasel) 
  //
  if(doTRD && ibarrel) {
  // no offline trigger selection
      gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTrainPerformanceTRD.C");
      // steer individual TRD tasks
      Bool_t 
      doCheckESD(kTRUE),  // IlcTRDcheckESD
      doCheckDET(kTRUE),  // IlcTRDcheckDET
      doEffic(kTRUE),     // IlcTRDefficiency
      doResolution(kTRUE),// IlcTRDresolution
      doCheckPID(kTRUE),  // IlcTRDcheckPID
      doV0Monitor(kFALSE);// IlcTRDv0Monitor
      AddTrainPerformanceTRD(Translate(doCheckESD, doCheckDET, doEffic, doResolution, doCheckPID, doV0Monitor));
  }

  //
  // ZDC (Chiara Oppedisano) 
  //
  if(doZDC && ibarrel) {
  // hardcoded kMB trigger mask
     gROOT->LoadMacro("$ILC_ROOT/PWGPP/ZDC/AddTaskZDCQA.C");
     IlcAnalysisTaskSE *taskZDC = AddTaskZDCQA();
     taskZDC->SelectCollisionCandidates(kTriggerMask);
  }   
  //
  // Calorimetry (Gustavo Conesa)
  //

  if(doCALO) {
      gROOT->LoadMacro("$ILC_ROOT/PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C");
      IlcAnalysisTaskCaloTrackCorrelation *taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kFALSE);
      taskCaloQA->SetDebugLevel(0);
      // offline mask set in AddTask to kMB
      taskCaloQA->SelectCollisionCandidates(kTriggerMask);
      // Add a new calo task with EMC1 trigger only
      taskCaloQA = AddTaskCalorimeterQA("ESD", 2011, kFALSE, kFALSE, "", "EMC7");
      taskCaloQA->SetDebugLevel(0);
      taskCaloQA->SelectCollisionCandidates(kTriggerEMC);
  }

  //
  // Muon Trigger
  //
  
  if(doMUONTrig) {
  // no offline trigger selection
      gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTaskMTRchamberEfficiency.C");
      IlcAnalysisTaskTrigChEff *taskMuonTrig = AddTaskMTRchamberEfficiency();
  }

  //
  // Impact parameter resolution ([email protected], [email protected])
  //
  if (doImpParRes && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTaskImpParRes.C");
    IlcAnalysisTaskSE* taskimpparres=0;
    if(iCollisionType==0) {
       taskimpparres= AddTaskImpParRes();
    } else {
       taskimpparres= AddTaskImpParRes(kFALSE,-1,kFALSE,kFALSE);
    }
    taskimpparres->SelectCollisionCandidates(kTriggerMask);
  }  
  //
  // MUON QA (Philippe Pillot)
  //
  if (doMUON) {
  // trigger analysis internal
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/PilotTrain/AddTaskMuonQA.C");
    IlcAnalysisTaskSE* taskmuonqa= AddTaskMuonQA();
  }  
  //
  // TOF (Francesca Bellini)
  //
  if (doTOF && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/TOF/AddTaskTOFQA.C");
    IlcAnalysisTaskTOFqa *tofQA = AddTaskTOFQA();
    tofQA->SelectCollisionCandidates(kTriggerMask);
  } 
   //
  // PIDResponse(JENS)
  //
  if (doPIDResponse && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); 
    IlcAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse();
    PIDResponse->SelectCollisionCandidates(kTriggerMask);
  }  

  //
  // PIDqa(JENS)
  //
  if (doPIDqa && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
    IlcAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
    PIDQA->SelectCollisionCandidates(kTriggerMask);
  }  
 
  //
  // HMPID QA (Giacomo Volpe)
  //
  if (doHMPID && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/HMPID/AddTaskHmpidQA.C");
    IlcAnalysisTaskSE* taskhmpidqa= AddTaskHmpidQA(kFALSE);
      // offline mask set in AddTask to kMB
    taskhmpidqa->SelectCollisionCandidates(kTriggerMask);
  }      
  
  
  // T0 QA (Alla Mayevskaya)
  if (doT0 && ibarrel) {
  // no offline trigger selection
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/T0/AddTaskT0QA.C");
    IlcT0AnalysisTaskQA* taskt0qa= AddTaskT0QA();
    taskt0qa->SelectCollisionCandidates(kTriggerMask);
  }      
  // FMD QA (Christian Holm Christiansen)
  if (doFMD && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGLF/FORWARD/analysis2/AddTaskForwardQA.C");
    // Parameters: usemc, usecentrality
    IlcAnalysisTaskSE *forwardQA = (IlcAnalysisTaskSE *)AddTaskForwardQA(kFALSE, kFALSE);
    // No offline trigger config. needed (see #84077)
  }
   //     
  // PHOS QA (Boris Polishchuk)
  //
  if (doPHOS) {
    gROOT->LoadMacro("$ILC_ROOT/PWGGA/PHOSTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C");
    IlcAnalysisTaskCaloCellsQA *taskPHOSCellQA1 = AddTaskCaloCellsQA(4, 1, NULL,"PHOSCellsQA_AnyInt"); 
    taskPHOSCellQA1->SelectCollisionCandidates(kTriggerMask);
    taskPHOSCellQA1->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.3,1.0);
    IlcAnalysisTaskCaloCellsQA *taskPHOSCellQA2 = AddTaskCaloCellsQA(4, 1, NULL,"PHOSCellsQA_PHI7"); 
    taskPHOSCellQA2->SelectCollisionCandidates(IlcVEvent::kPHI7);
    taskPHOSCellQA2->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.3,1.0);
    // Pi0 QA fo PbPb
    if (iCollisionType) {
      gROOT->LoadMacro("$ILC_ROOT/PWGGA/PHOSTasks/PHOS_PbPbQA/macros/AddTaskPHOSPbPb.C");
      IlcAnalysisTaskPHOSPbPbQA* phosPbPb = AddTaskPHOSPbPbQA(0);
    }
  }    
  if (doPHOSTrig) {
     gROOT->LoadMacro("$ILC_ROOT/PWGGA/PHOSTasks/PHOS_TriggerQA/macros/AddTaskPHOSTriggerQA.C");
     IlcAnalysisTaskPHOSTriggerQA *taskPHOSTrig = AddTaskPHOSTriggerQA(NULL);
  }
  //
  // EMCAL QA (Gustavo Conesa)
  //
  if (doEMCAL) {
     gROOT->LoadMacro("$ILC_ROOT/PWGGA/EMCALTasks/macros/AddTaskEMCALTriggerQA.C");
     IlcAnalysisTaskEMCALTriggerQA *emctrig = AddTaskEMCALTriggerQA();
  }   
  //     
  // FLOW and BF QA (C.Perez && A.Rodriguez)
  //
  if (doFBFqa && ibarrel) {
    gROOT->LoadMacro("$ILC_ROOT/PWGPP/macros/AddTaskFBFqa.C");
    IlcAnalysisTaskSE *qaFBFMB = (IlcAnalysisTaskSE*) AddTaskFBFqa("qaFBFmb",kFALSE);
    qaFBFMB->SelectCollisionCandidates(IlcVEvent::kMB);
    IlcAnalysisTaskSE *qaFBFSC = (IlcAnalysisTaskSE*) AddTaskFBFqa("qaFBFsc",kFALSE);
    qaFBFSC->SelectCollisionCandidates(IlcVEvent::kSemiCentral);
    IlcAnalysisTaskSE *qaFBFCE = (IlcAnalysisTaskSE*) AddTaskFBFqa("qaFBFce",kFALSE);
    qaFBFCE->SelectCollisionCandidates(IlcVEvent::kCentral);
  }
}