Example #1
0
AliAnalysisTaskMuonAODCreation *AddTaskMuonAODCreation()
{
// Creates a filter task to copy muon tracks from the Standard AOD to the Muon AOD
// R. Arnaldi - 6/10/09

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

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

   // Create the task, add it to the manager and configure it.
   //===========================================================================   
   AliAnalysisTaskMuonAODCreation *muonAODtask = new AliAnalysisTaskMuonAODCreation("Muon AOD creation");
   mgr->AddTask(muonAODtask);
   
   // Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
   //==============================================================================
   mgr->ConnectInput  (muonAODtask,  0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput (muonAODtask,  0, mgr->GetCommonOutputContainer());
   mgr->ConnectOutput (muonAODtask,  1, coutput1);
   return muonAODtask;
}   
Example #2
0
  /** 
   * Get the name of the registered data set
   * 
   * 
   * @return Name of the registered data set
   */
  static TString RegisteredDataset()
  {
    TString ret;

    AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
    AliVEventHandler*   oh  = mgr->GetOutputEventHandler();
    if (!oh) { 
      Warning("OutputUtilities::GetOutputDataSet", 
	      "No outout event handler defined");
      return ret;
    }
    AliAnalysisDataContainer* co  = mgr->GetCommonOutputContainer();
    if (!co) { 
      Warning("OutputUtilities::GetOutputDataSet", 
	      "No common output container defined");
      return ret;
    }
    if (!co->IsRegisterDataset()) { 
      Info("OutputUtilities::GetOutputDataSet", 
	   "Common output is not registered as dataset");
      return ret;
    }
    ret = oh->GetOutputFileName();
    // ret.ReplaceAll("TTree", "");
    ret.ReplaceAll(".root", "");
    // ret.Append(co->GetTitle());

    return ret;
  }
Example #3
0
  /** 
   * Register special putput storage 
   * 
   * @param url Url (root://host/full_path)
   * 
   * @return true on success
   */
  static Bool_t RegisterStorage(const TString& url)
  {
    if (url.IsNull()) { 
      Error("OutputUtilities::RegisterStorage", "No storage URI specified");
      return false;
    }

    // Get the manager
    AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
    
    // Get the container 
    AliAnalysisDataContainer* cont    = mgr->GetCommonOutputContainer();
    if (!cont) { 
      Warning("OutputUtilities::RegisterStorage", 
	      "No common output container defined");
      return false;
    }

    TString u(url);
    if (u.EqualTo("auto")) {
      if (!StartXrootd(u)) {
	Warning("OutputUtilities::RegisterStorage",
		"Couldn't start the XRootD server");
	return false;
      }
    }

    cont->SetSpecialOutput();
    mgr->SetSpecialOutputLocation(u);

    return true;
  }
Example #4
0
AliAnalysisTaskFilterFriend *AddTaskFilterFriend()
{

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

	// check the input handler
	if (!mgr->GetInputEventHandler()) {
		::Error("AddTask", "This task requires an input event handler");
		return NULL;
	}  
	TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"

	// create the task
	AliAnalysisTaskFilterFriend* filter = new AliAnalysisTaskFilterFriend("filter_1");
	mgr->AddTask(filter);

	// connecting the input/output containers
	AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
	AliAnalysisDataContainer *coutput0 = mgr->GetCommonOutputContainer();

	mgr->ConnectInput (filter, 0, cinput0 );
	//mgr->ConnectOutput(filter, 0, coutput0);

	return filter;
}
void RunLinkToMCAnalysisExample(const char* esdFile = "./AliESDs.root")
{
	// Load needed libraries
	gSystem->Load("libTree");
	gSystem->Load("libGeom");
	gSystem->Load("libVMC");
	gSystem->Load("libPhysics");
	gSystem->Load("libSTEERBase");
	gSystem->Load("libESD");
	gSystem->Load("libAOD");
	gSystem->Load("libANALYSIS");
	gSystem->Load("libANALYSISalice");
	gSystem->Load("libPWGHFbase");
	gSystem->Load("libPWGmuon");
	
	// Create the TChain for esdTrees in the AliESDs.root file.
	TChain* chain = new TChain("esdTree");
	chain->Add(esdFile);
	if (!chain) return;
	
	// Create the analysis manager and event handlers.
	AliAnalysisManager* mgr = new AliAnalysisManager("Analysis Train", "An example analysis train setup for AliAnalysisTaskLinkToMC.");
	AliESDInputHandler* esdHandler = new AliESDInputHandler();
	mgr->SetInputEventHandler(esdHandler);
	AliMCEventHandler* mcHandler = new AliMCEventHandler();
	mgr->SetMCtruthEventHandler(mcHandler);
	mcHandler->SetReadTR(kTRUE); 
	AliAODHandler* aodHandler = new AliAODHandler();
	mgr->SetOutputEventHandler(aodHandler);
	aodHandler->SetOutputFileName("AliAOD.root");
	
	// Create the analysis task and setup the parameters.
	AliAnalysisTaskLinkToMC* linktask = new AliAnalysisTaskLinkToMC("Task to link ESD tracks to corresponding MC tracks.");
	linktask->MinClusters(6);
	linktask->HardCutLimitX(4);
	linktask->HardCutLimitY(4);
	linktask->SigmaCut(5.);
	linktask->MinClustersInSt45(3);
	linktask->StationMustMatch(1, true);  // At least one cluster in station 1 must match.
	linktask->StationMustMatch(2, true);  // At least one cluster in station 2 must match.
	linktask->StationMustMatch(3, true);  // At least one cluster in station 3 must match.
	linktask->GenerateHistograms(true);
	mgr->AddTask(linktask);
	
	// Create the input and output containers and connect them up to the analysis task.
	AliAnalysisDataContainer* cinEsd = mgr->GetCommonInputContainer();
	AliAnalysisDataContainer* coutAod = mgr->GetCommonOutputContainer();
	AliAnalysisDataContainer* coutHists = mgr->CreateContainer("cHists", TList::Class(), AliAnalysisManager::kOutputContainer, "hists.root");
	mgr->ConnectInput(linktask, 0, cinEsd);
	mgr->ConnectOutput(linktask, 0, coutAod);
	mgr->ConnectOutput(linktask, 1, coutHists);
	
	if (mgr->InitAnalysis())
	{
		mgr->PrintStatus();
		mgr->StartAnalysis("local", chain);
	}
}
Example #6
0
AliAnalysisTask* AddTaskAOD2AODMuonOnly(const char* triggerinputs,Bool_t withSPDtracklets, Int_t mcMode)
{
  
  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr)
  {
    ::Error("AddTaskAOD2AODMuonOnly", "No analysis manager to connect to.");
    return 0x0;
  }
  
  AliInputEventHandler* input = mgr->GetInputEventHandler();
  
  if (!input)
  {
    ::Error("AddTaskAOD2AODMuonOnly", "This task requires an input event handler");
    return 0x0;
  }
  
  TString inputDataType = input->GetDataType(); // can be "ESD" or "AOD"

  if (inputDataType != "AOD")
  {
    ::Error("AddTaskAOD2AODMuonOnly", "This task requires an AOD input event handler");
    return 0x0;
  }
  
  AliAODHandler* aodHandler = dynamic_cast<AliAODHandler*>(mgr->GetOutputEventHandler());
  if (!aodHandler)
  {
    ::Error("AddTaskAOD2AODMuonOnly", "This task requires an AOD output event handler");
    return 0x0;
  }
  
  aodHandler->SetCreateNonStandardAOD();

  AliMuonEventCuts* eventCuts = new AliMuonEventCuts("L0cutter","");
    
  eventCuts->SetTrigClassPatterns("0MSL|0MUL|0MSH|0MLL",triggerinputs);
  
  AliAnalysisTask* task = new AliAnalysisTaskAOD2MuonAOD(mcMode,withSPDtracklets,eventCuts);
    
  mgr->AddTask(task);
    
  // Connect input/output
  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer());

  return task;
}
Example #7
0
  /** 
   * Register output data set 
   * 
   * @param dsname Data set name 
   * 
   * @return true on success
   */
  static Bool_t RegisterDataset(const TString& dsname)
  {
    // Get the manager
    AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();

    // If we are asked to make a data-set, get the output handler and
    // common output container.
    AliVEventHandler*         handler = mgr->GetOutputEventHandler();
    if (!handler) return true;

    // Get the container 
    AliAnalysisDataContainer* cont    = mgr->GetCommonOutputContainer();
    if (!cont) { 
      Warning("OutputUtilities::RegisterDataset", 
	      "No common output container defined");
      return false;
    }

    // Make the name 
    TString nme(dsname);
    if (nme.IsNull()) nme = mgr->GetName();
    if (nme.IsNull()) { 
      Error("OutputUtilities::RegisterDataset", "No data set name specified");
      return false;
    }

    // Flag for data-set creation
    cont->SetRegisterDataset(true);

    handler->SetOutputFileName(nme);
    // cont->SetFileName(nme);

    TString base(handler->GetOutputFileName());
    base.ReplaceAll(".root","");
    Info("OutputUtilities::RegisterDataset", 
	 "Will register tree output AODs (%s%s) as dataset",
	 base.Data(), cont->GetTitle());

    return true;
  }
Example #8
0
AliAnalysisTaskJetCluster *AddTaskJetCluster(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t nSkip,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow,Float_t vertexWindow,Int_t nSkipCone,Int_t dice,Int_t smear,Bool_t useOADB,Double_t changeEfficiencyFraction)
 {
 // Creates a jet fider task, configures it and adds it to the analysis manager.
   kPtTrackCutCl = ptTrackCut;
   kTrackEtaWindowCl = etaTrackWindow;
   kVertexWindowCl = vertexWindow;

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

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

    TString type = mgr->GetInputEventHandler()->GetDataType();
    TString typeRec(bRec);
    TString typeGen(bGen);
    if(!typeRec.Contains("AODextra") && !typeRec.Contains("AODMCextra")) {
      typeGen.ToUpper();
      typeRec.ToUpper();
    }
    cout << "typeRec: " << typeRec << endl;
    // Create the task and configure it.
    //===========================================================================




    TString cAdd = "";
    cAdd += Form("%02d_",(int)((radius+0.01)*10.));
    cAdd += Form("B%d",(int)kBackgroundModeCl);
    cAdd += Form("_Filter%05d",filterMask);
    cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCutCl));
    cAdd += Form("_Skip%02d",nSkip);
    if(dice>0 || smear>0)
      cAdd += Form("Detector%d%dFr%d",dice,smear,(int)(changeEfficiencyFraction*100.));
    

    Printf("%s %E %d %d",cAdd.Data(),kPtTrackCutCl,dice,smear);
    AliAnalysisTaskJetCluster* clus = new  AliAnalysisTaskJetCluster(Form("JetCluster%s_%s%s",bRec,jf,cAdd.Data()));
      
   // or a config file
   // clus->SetAnalysisType(AliAnalysisTaskJetCluster::kAnaMC);
   // if(iAODanalysis)clus->SetAODInput(kTRUE);
   // clus->SetDebugLevel(11); 
   clus->SetFilterMask(filterMask); 
   //   clus->SetUseGlobalSelection(kTRUE); 
   clus->SetVtxCuts(kVertexWindowCl,1);
   if(type == "AOD"){
     // Assume all jet are produced already
     clus->SetAODTrackInput(kTRUE);
     clus->SetAODMCInput(kTRUE);
   }

 if (typeRec.Contains("AODMCHF")){
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCHF);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCChargedAcceptance);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODMC2")){
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCCharged);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(5);
   }
   else if (typeRec.Contains("AODMCextraonly")) {
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCextraonly);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODMCextra")) {
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCextra);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODMC")){
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCAll);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(5);
   }
   else if (typeRec.Contains("AODextraonly")) {
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextraonly);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODextra")) {
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextra);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AOD")) {
     clus->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAOD);
     clus->SetTrackPtCut(kPtTrackCutCl);
     clus->SetTrackEtaWindow(kTrackEtaWindowCl);
   }

   clus->SetRparam(radius);
   clus->SetGhostArea(0.005);
   clus->SetGhostEtamax(kTrackEtaWindowCl);

   switch (jf) {
   case "ANTIKT":
     clus->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh
     break;
   case "CA":
     clus->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh
     break;
   case "KT":
     clus->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh
     break;
   default:
     ::Error("AddTaskJetCluster", "Wrong jet finder selected\n");
     return 0;
   }

   
   if(kWriteAOD){
     if(outputFile.Length())clus->SetJetOutputFile(outputFile);
     clus->SetJetOutputBranch(Form("clusters%s_%s%s",bRec,jf,cAdd.Data()));
     clus->SetJetOutputMinPt(0); // store only jets / clusters above a certain threshold
   }

   clus->SetNSkipLeadingRan(nSkip);
   clus->SetNSkipLeadingCone(nSkipCone);

   if(iPhysicsSelectionFlag)clus->SelectCollisionCandidates(iPhysicsSelectionFlag);

   if(useOADB) {
     clus->SetUseTrResolutionFromOADB();
     clus->SetUseTrEfficiencyFromOADB();
     clus->SetChangeEfficiencyFraction(changeEfficiencyFraction);
   }

   mgr->AddTask(clus);

   // Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
   //==============================================================================
   AliAnalysisDataContainer *coutput1_clus = mgr->CreateContainer(Form("cluster_%s_%s_%s%s",bRec,bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_cluster_%s_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen,jf,cAdd.Data()));

   mgr->ConnectInput  (clus, 0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput (clus, 0, mgr->GetCommonOutputContainer());
   mgr->ConnectOutput (clus,  1, coutput1_clus );
   
   return clus;
}
Example #9
0
void AnalysisTrainMuonCAF(char* fileout = "AliAOD.root", char *datasetname = "myDataSet", Int_t nev=1234567890)
{
// Macro to produce a generic AOD starting from an ESD file. 
// The AOD is filled with two tasks: 
// 1- with the first one (AliAnalysisTaskESDfilter), 
//    all the branches of the AOD are filled apart from the muons. 
// 2- with the second task (AliAnalysisTaskESDMuonFilter) 
//    muons tracks are added to the tracks branch 
// This macro works on the CAF
// R. Arnaldi 4/5/08

  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
    
  // Reset user processes if CAF if not responding anymore
  // TProof::Reset("lxb6046");

  // Connect to proof
  TProof::Open("lxb6046"); // may be [email protected] if user not the same as on local

  // Clear packages if changing ROOT version on CAF or local
  // gProof->ClearPackages();
  // Enable proof debugging if needed
  // gProof->SetLogLevel(5);

  // Common packages
  gProof->UploadPackage("STEERBase.par");
  gProof->EnablePackage("STEERBase");
  gProof->UploadPackage("ESD.par");
  gProof->EnablePackage("ESD");
  gProof->UploadPackage("AOD.par");
  gProof->EnablePackage("AOD");
  gProof->UploadPackage("ANALYSIS.par");
  gProof->EnablePackage("ANALYSIS");
  gProof->UploadPackage("ANALYSISalice.par");
  gProof->EnablePackage("ANALYSISalice");
  // Analysis-specific
  // --- Enable the PWG3base Package
  gProof->UploadPackage("PWG3muon.par");
  gProof->EnablePackage("PWG3muon");

  // Chain from files staged on CAF
  // gROOT->LoadMacro("CreateESDChain.C");
  // TChain* chain = CreateESDChain("ESD1503X_v1.txt",3);
  // TChain* chain = CreateESDChain("ESD82XX_30Kshort.txt", 10);
  
  // Chain from datasets
  gROOT->LoadMacro("CreateChainFromDataSet.C");
  ds = gProof->GetDataSet(datasetname)->GetStagedSubset();
  chain = CreateChainFromDataSet(ds, "esdTree");   
  
  // Make the analysis manager
  AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", "Analysis train");
  
  // ESD input handler
  AliESDInputHandler *esdHandler = new AliESDInputHandler();
  esdHandler->SetInactiveBranches("FMD CaloCluster");
  
  // AOD output handler
  AliAODHandler* aodHandler   = new AliAODHandler();
  aodHandler->SetOutputFileName(fileout);
  //aodHandler->SetOutputFileName("AOD.root");

  mgr->SetInputEventHandler(esdHandler);
  mgr->SetOutputEventHandler(aodHandler);
  
  // Set of cuts plugged into the ESD filter
  // 
  // standard
  AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
  esdTrackCutsL->SetMinNClustersTPC(50);
  esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
  esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
  esdTrackCutsL->SetRequireTPCRefit(kTRUE);
  esdTrackCutsL->SetMinNsigmaToVertex(3);
  esdTrackCutsL->SetRequireSigmaToVertex(kTRUE);
  esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
  //
  // hard cuts
  AliESDtrackCuts* esdTrackCutsH = new AliESDtrackCuts("AliESDtrackCuts", "Hard");
  esdTrackCutsH->SetMinNClustersTPC(100);
  esdTrackCutsH->SetMaxChi2PerClusterTPC(2.0);
  esdTrackCutsH->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
  esdTrackCutsH->SetRequireTPCRefit(kTRUE);
  esdTrackCutsH->SetMinNsigmaToVertex(2);
  esdTrackCutsH->SetRequireSigmaToVertex(kTRUE);
  esdTrackCutsH->SetAcceptKingDaughters(kFALSE);
  esdTrackCutsH->SetPRange(0.,2.);
  //
  //  muon cuts
  AliESDMuonTrackCuts* esdMuonTrackCuts = new AliESDMuonTrackCuts("AliESDMuonTrackCuts", "test");
  esdMuonTrackCuts->SetPRange(0.,20.);
  //esdMuonTrackCuts->SetPtRange(0.,0.5);   // example of kinematic cuts that can be applied
  
  // track filter (to reject tracks not surviving the cuts - refers to all particles apart from muons)
  AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
  trackFilter->AddCuts(esdTrackCutsH);
  
  // muon track filter  (to reject muon tracks not surviving the cuts)
  AliAnalysisFilter* trackMuonFilter = new AliAnalysisFilter("trackMuonFilter");
  trackMuonFilter->AddCuts(esdMuonTrackCuts);

  // ESD filter task putting standard info to output generic AOD 
  AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
  //esdfilter->SetTrackFilter(trackFilter);
  esdfilter->SetDebugLevel(10);
  mgr->AddTask(esdfilter);
  
  // ESD filter task putting muon info to output generic AOD 
  AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter");
  esdmuonfilter->SetTrackFilter(trackMuonFilter);
  mgr->AddTask(esdmuonfilter);

  // Containers for input/output
  AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
  // Output AOD container. 
  AliAnalysisDataContainer *cout_aod = mgr->GetCommonOutputContainer();
        						    
  // Connect containers to tasks slots
  mgr->ConnectInput  (esdfilter,  0, cin_esd  );
  mgr->ConnectOutput (esdfilter,  0, cout_aod );

  mgr->ConnectInput  (esdmuonfilter,  0, cin_esd);
  mgr->ConnectOutput (esdmuonfilter,  0, cout_aod );

  //
  // Run the analysis
  //	
  if (mgr->InitAnalysis()) {
      mgr->PrintStatus();
      mgr->StartAnalysis("proof",chain,nev);
  }   
}
Example #10
0
void runAODFilterMC()
{
  // PROOF example

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

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

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


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

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

      mgr->SetDebugLevel(10);

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

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

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

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

}
Example #11
0
///
/// Main method calling all the configuration
///
/// The parameters passed to the analysis are:
/// \param bias      : bias or not depending on EMCal signal.
/// \param mc        : simulation or data.
/// \param minE      : at least one cluster in EMCal with this energy.
/// \param minN      : at least one cluster in EMCal with this number of cells.
/// \param vz        : z vertex cut.
/// \param opt       : filter EMCal only, PHOS only or both.
/// \param correct   : calibrate the EMCal, remove bad cells ...
/// \param fillTrack : Fill event with hybrid tracks
/// \param fillAOD   : Output AOD is filled, not used only for a secondary task analysis at the same time.
///
AliAnalysisTaskCaloFilter * AddTaskCaloFilter
(  const Bool_t  bias      = kTRUE
 , const Bool_t  mc        = kFALSE
 , const Float_t minE      = 6.
 , const Int_t   minN      = 3 
 , const Float_t vz        = 10.
 , const Int_t   opt       = 0
 //AliAnalysisTaskCaloFilter::kBoth,kPHOS, kEMCAL or kBoth
 , const Bool_t  correct   = kFALSE
 , const Bool_t  fillTrack = kFALSE
 , const Bool_t  fillAOD   = kTRUE)
{

  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) 
  {
    ::Error("AddTaskCaloFilter", "No analysis manager to connect to.");
    return NULL;
  }  
  
  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) 
  {
    ::Error("AddTaskCaloFilter", "This task requires an input event handler");
    return NULL;
  }
  
  // Set the output AOD handler
  //
  printf("AddTaskCaloFilter --- Init output handler ---\n");
  
  AliAODHandler* aodoutHandler   = new AliAODHandler();
  aodoutHandler->SetOutputFileName("AliAOD.EMCAL.root");
  //aodoutHandler->SetCreateNonStandardAOD();
  mgr->SetOutputEventHandler(aodoutHandler);

  // Configure the task
  //
  printf("AddTaskCaloFilter --- Init task ---\n");

  AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter("CaloFilter");
  
  //filter->SetDebugLevel(2);
  
  filter->SetCaloFilter(opt); //kPHOS, kEMCAL or kBoth
  
  filter->SetVzCut(vz);
  
  if(mc)
  {
    filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
    filter->SwitchOnAcceptAllMBEvent();
    
    filter->SwitchOnFillMCParticles();
    
    filter->SetEMCALEnergyCut(minE);
    filter->SetEMCALNcellsCut(minN);
    
    filter->SetPHOSEnergyCut(minE);
    filter->SetPHOSNcellsCut(minN);
    
    filter->SetTrackPtCut(minE);
    printf("AddTaskCaloFilter --- Select MC events with bias in EMCal ---\n");
  }
  else if(bias) // select events with significant signal in EMCAL or TPC or PHOS
  {
    filter->SetEventSelection(1,0,0); // Select events depending on EMCAL, PHOS and tracks criteria
    filter->SwitchOnAcceptAllMBEvent();
    
    filter->SetEMCALEnergyCut(minE);
    filter->SetEMCALNcellsCut(minN);
 
    filter->SetPHOSEnergyCut(minE);
    filter->SetPHOSNcellsCut(minN);
    
    filter->SetTrackPtCut(minE);

    //filter->SetMBTriggerMask(AliVEvent::kAnyINT);
    filter->SetMBTriggerMask(AliVEvent::kINT7); // not working for all productions
    
    filter->SelectCollisionCandidates(AliVEvent::kAny) ;
    
    printf("AddTaskCaloFilter --- Select events with bias in EMCal ---\n");
  }
  else // Do not bias the signal in EMCAL, select MB events 
  {
    
    filter->SetEventSelection(0,0,0);
    filter->SwitchOnAcceptAllMBEvent();
    
    filter->SetEMCALEnergyCut(-1);
    filter->SetEMCALNcellsCut(0);  
    
    filter->SetPHOSEnergyCut(-1);
    filter->SetPHOSNcellsCut(0); 
    
    filter->SetTrackPtCut(-1);
    
    filter->SelectCollisionCandidates(AliVEvent::kINT7);// | AliVEvent::kCentral | AliVEvent::kSemiCentral ) ;
    
    printf("AddTaskCaloFilter --- Select INT7 events ---\n");
  }

  // Activate the cluster corrections (calibration, bad map...)     
  //
  if(correct)   filter->SwitchOnClusterCorrection();
  else          filter->SwitchOffClusterCorrection();  
  
  // Exoticity cut settings
  //
  AliEMCALRecoUtils * reco = filter->GetEMCALRecoUtils();
  reco->SwitchOnRejectExoticCluster() ;
  reco->SetExoticCellFractionCut(0.97);
  reco->SetExoticCellMinAmplitudeCut(4.);

  // Track storing
  //
  if(fillTrack) { filter->SwitchOnFillTracks()  ; filter->SwitchOnFillHybridTracks()  ; }
  else          { filter->SwitchOffFillTracks() ; filter->SwitchOffFillHybridTracks() ; }
  
  // Other options to store in event
  //
  filter->SwitchOffFillv0s() ; // Put ON if you know what you do.
  
  filter->SwitchOnFillVZERO(); // Be able to recalculate centrality and event plane 
                               // afterwards even it is stored in header
  
  // AOD output storing
  //
  if(fillAOD)   filter->SwitchOnFillAODFile();
  else          filter->SwitchOffFillAODFile();
  
  // Pass the task to the manager, print first set parameters
  filter->PrintInfo();
  
  mgr->AddTask(filter);
  
  // Create containers for input/output
  //
  printf("AddTaskCaloFilter --- Created input/output containers ---\n");

  AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
    
  printf("AddTaskCaloFilter --- Created containers, add them ---\n");
  
  mgr->ConnectInput  (filter, 0, cinput1  );
  mgr->ConnectOutput (filter, 0, coutput1 );
  
  printf("AddTaskCaloFilter --- End ---\n");

  return filter;

}
Example #12
0
AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString inputDataType, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE, Bool_t outputAOD=kFALSE, Bool_t oldAOD=kFALSE, Int_t debugLevel = 0)
{
  // Creates a PartCorr task, configures it and adds it to the analysis manager.
  
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
    return NULL;
  }  
 
  Bool_t kUseKinematics = kFALSE; 
  if(kSimulation) { 
    kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; 
    if (!kUseKinematics && inputDataType == "AOD") kUseKinematics = kTRUE; //AOD primary should be available ... 
  } 
  
  cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
  
  // Configure analysis
  //===========================================================================
  
  // *** Reader ***
  AliCaloTrackReader * reader =0x0 ;
  if(inputDataType.Contains("AOD")) reader = new AliCaloTrackAODReader();
  else if(inputDataType=="ESD") reader = new AliCaloTrackESDReader();
  else if(inputDataType=="MC" && inputDataType == "ESD") reader = new AliCaloTrackMCReader();
  reader->SetDebug(-1);//10 for lots of messages
  reader->SwitchOnCTS();
  reader->SwitchOffEMCAL();
  reader->SwitchOffPHOS();
  reader->SwitchOffEMCALCells(); 
  reader->SwitchOffPHOSCells(); 
  

  reader->SetDataType(2);
    
  //Min particle pT
  reader->SetEMCALPtMin(0.3); 
  reader->SetPHOSPtMin(0.3);
  reader->SetCTSPtMin(0.1);
  reader->SwitchOnWriteDeltaAOD()  ;
  // if(oldAOD) reader->SwitchOnOldAODs();
  reader->SwitchOnWriteDeltaAOD();
  if(kPrintSettings) reader->Print("");
  
  // *** Calorimeters Utils	***
  AliCalorimeterUtils *cu = new AliCalorimeterUtils;
  
  
  //Recalibration
  //cu->SwitchOnRecalibration();
  //TFile * f = new TFile("RecalibrationFactors.root","read");
  //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0"));
  //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1"));
  //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2"));
  //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3"));
  //f->Close();	
  
  cu->SetDebug(debugLevel);
  if(kPrintSettings) cu->Print("");
  
  
  // ##### Analysis algorithm settings ####
  
  
  //==================================
  // ### Isolation analysis ###	
  //=================================
  //Photon
  AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
  anaisol->SetDebug(debugLevel);
  anaisol->SetMinPt(0);
  anaisol->SetInputAODName("ConversionGamma");
  anaisol->SetAODObjArrayName("ConversionGamma");
  anaisol->SetCalorimeter("CTS");
  
  if(kUseKinematics) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms
  else  anaisol->SwitchOffDataMC() ;

  anaisol->SwitchOffInvariantMass();

  AliIsolationCut * ic =  anaisol->GetIsolationCut();	
  ic->SetConeSize(0.4);
  ic->SetPtThreshold(0.7);
  ic->SetPtFraction(0.1);
  ic->SetSumPtThreshold(1.0) ;
  ic->SetParticleTypeInCone(AliIsolationCut::kOnlyCharged);
  ic->SetICMethod(AliIsolationCut::kSumPtFracIC);
  if(kPrintSettings) ic->Print("");

  anaisol->SetHistoPtRangeAndNBins(0, 50, 500) ;
  anaisol->AddToHistogramsName("AnaIsolPhoton_");
  
  anaisol->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
  

  anaisol->SwitchOnReIsolation();
  anaisol->SwitchOffSeveralIsolation();

  // anaisol->SetPtThresholds(0, 1.0);
  // anaisol->SetPtThresholds(1, 2.0);
  // anaisol->SetPtThresholds(2, 3.0);
  // anaisol->SetPtThresholds(3, 4.0);
  // anaisol->SetPtThresholds(4, 5.0);


  // anaisol->SetPtFractions(0, 0.4);
  // anaisol->SetPtFractions(1, 0.3);
  // anaisol->SetPtFractions(2, 0.1);
  // anaisol->SetPtFractions(3, 0.08);
  // anaisol->SetPtFractions(4, 0.05);

  // anaisol->SetNCones(5);
  // anaisol->SetConeSizes(0, 0.50);
  // anaisol->SetConeSizes(1, 0.60);
  // anaisol->SetConeSizes(2, 0.70);
  // anaisol->SetConeSizes(3, 0.80);
  // anaisol->SetConeSizes(4, 0.90);
  



  if(kPrintSettings) anaisol->Print("");
  
	
  // //===========================
  // //Correlation analysis
  // //===========================
	
  // // ### Correlation with Jet Finder AOD output
  // AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation();
  // anacorrjet->SetInputAODName("ConversionGamma");//,calorimeter.Data()));
  // anacorrjet->SwitchOffFiducialCut();
  // anacorrjet->SetDebug(debugLevel);
  // anacorrjet->SetConeSize(1);  
  // anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons
  // anacorrjet->SetPtThresholdInCone(0.2);
  // anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts 
  // anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts
  // anacorrjet->UseJetRefTracks(kFALSE); //Not working now
  // //Set Histograms bins and ranges
  // anacorrjet->SetHistoPtRangeAndNBins(0, 50, 200) ;
  // //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
  // //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
  // if(kPrintSettings) anacorrjet->Print("");
  
  
  // #### Configure Maker ####
  AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
  maker->SetReader(reader);//pointer to reader
  maker->SetCaloUtils(cu); //pointer to calorimeter utils
  Int_t n = 0;//Analysis number, order is important
  maker->AddAnalysis(anaisol,n++);
  //maker->AddAnalysis(anacorrjet, n++);
  maker->SetAnaDebug(-1);
  maker->SwitchOnHistogramsMaker()  ;
 	
  if(kPrintSettings) maker->Print("");
  
  printf("======================== \n");
  printf(" End Configuration of PartCorr analysis with detector %s \n",calorimeter.Data());
  printf("======================== \n");
  
  // Create task
  //===========================================================================
  AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s",calorimeter.Data()));
  task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
  task->SetDebugLevel(debugLevel);
  task->SetAnalysisMaker(maker);
  if(inputDataType=="ESD" && !kSimulation) task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before.
  mgr->AddTask(task);
  
  //Create containers
  char name[128];
  sprintf(name,"PartCorr_%s",calorimeter.Data());
  cout<<"Name of task "<<name<<endl;
  
  TString outputfile = AliAnalysisManager::GetCommonFileName(); 
  AliAnalysisDataContainer *cout_pc   = mgr->CreateContainer(calorimeter.Data(), TList::Class(), 
                                                             AliAnalysisManager::kOutputContainer, 
                                                             Form("%s:PartCorr",outputfile.Data()));
	
  AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts",calorimeter.Data()), TList::Class(), 
                                                             AliAnalysisManager::kParamContainer, 
                                                             Form("%s:PartCorrCuts",outputfile.Data()));
	
  // Create ONLY the output containers for the data produced by the task.
  // Get and connect other common input/output containers via the manager as below
  //==============================================================================
  mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
  // AOD output slot will be used in a different way in future
  if(!inputDataType.Contains("delta")   && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
  mgr->ConnectOutput (task, 1, cout_pc);
  mgr->ConnectOutput (task, 2, cout_cuts);
  
  return task;
}
Example #13
0
void anaCaloFilter(Int_t mode=mLocal)
{
  // Main
  char cmd[200] ; 
  sprintf(cmd, ".! rm -rf AliAOD.root") ; 
  gROOT->ProcessLine(cmd) ; 
  //--------------------------------------------------------------------
  // Load analysis libraries
  // Look at the method below, 
  // change whatever you need for your analysis case
  // ------------------------------------------------------------------
  LoadLibraries(mode) ;
  
  //-------------------------------------------------------------------------------------------------
  //Create chain from ESD and from cross sections files, look below for options.
  //-------------------------------------------------------------------------------------------------
  if(kInputData == "ESD") kTreeName = "esdTree" ;
  else if(kInputData == "AOD") kTreeName = "aodTree" ;
  else {
    cout<<"Wrong  data type "<<kInputData<<endl;
    break;
  }
  
  TChain *chain       = new TChain(kTreeName) ;
  CreateChain(mode, chain);  
  
  if(chain){
    AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen
    
    //--------------------------------------
    // Make the analysis manager
    //-------------------------------------
    AliAnalysisManager *mgr  = new AliAnalysisManager("Manager", "Manager");
    
    // AOD output handler
    AliAODHandler* aodoutHandler   = new AliAODHandler();
    aodoutHandler->SetOutputFileName("AliAOD.root");
    ////aodoutHandler->SetCreateNonStandardAOD();
    mgr->SetOutputEventHandler(aodoutHandler);
    
    //input
    if(kInputData == "ESD")
    {
      // ESD handler
      AliESDInputHandler *esdHandler = new AliESDInputHandler();
      mgr->SetInputEventHandler(esdHandler);
      esdHandler->SetReadFriends(kFALSE);
      cout<<"ESD handler "<<mgr->GetInputEventHandler()<<endl;
    }
    if(kInputData == "AOD")
    {
      // AOD handler
      AliAODInputHandler *aodHandler = new AliAODInputHandler();
      mgr->SetInputEventHandler(aodHandler);
      cout<<"AOD handler "<<mgr->GetInputEventHandler()<<endl;
      
    }
    
    // mgr->SetDebugLevel(1);
    
    //-------------------------------------------------------------------------
    //Define task, put here any other task that you want to use.
    //-------------------------------------------------------------------------    
    // ESD physics selection task
    if(kInputData == "ESD" && kUsePhysSel)
    {
      gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
      AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
    }
    
    gROOT->LoadMacro("AddTaskCaloFilter.C");
    AliAnalysisTaskCaloFilter* filter = AddTaskCaloFilter();
            
    //AliAnalysisTaskCaloFilter * filter = new AliAnalysisTaskCaloFilter();
    //filter->SetConfigFileName("ConfigCaloFilter.C");
    //mgr->AddTask(filter);
      
    // Create containers for input/output
    AliAnalysisDataContainer *cinput1    = mgr->GetCommonInputContainer();
    AliAnalysisDataContainer *coutput1   = mgr->GetCommonOutputContainer();
    AliAnalysisDataContainer *coutntuple = mgr->CreateContainer("EventNtuple", TNtuple::Class(), 
                                                                AliAnalysisManager::kOutputContainer, "eventselection.root");
    
    mgr->ConnectInput  (filter, 0, cinput1);
    mgr->ConnectOutput (filter, 0, coutput1 );
    mgr->ConnectOutput (filter, 1, coutntuple );
    
    //-----------------------
    // Run the analysis
    //-----------------------    
    TString smode = "";
    if (mode==mLocal || mode == mLocalCAF) 
      smode = "local";
    else if (mode==mPROOF) 
      smode = "proof";
    else if (mode==mGRID) 
      smode = "local";
    
    mgr->InitAnalysis();
    mgr->PrintStatus();
    mgr->StartAnalysis(smode.Data(),chain);
    
    cout <<" Analysis ended sucessfully "<< endl ;
    
  }
  else cout << "Chain was not produced ! "<<endl;
  
  //sprintf(cmd, ".! rm -rf CorrectionFiles") ;
  
}
Example #14
0
AliAnalysisTaskJetHBOM *AddTaskJetHBOM(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow,Float_t vertexWindow,TString effLoc,Int_t fNHBOM, Int_t constCone, Float_t constConePhi,Float_t constConeEta)
 {
   //if constCone is true, the random Cone positon is set to constConePhi and constConeEta. Else the cone is random set and the parameters constConePhi and constConeEta are irrelevant

 // Creates a jet fider task, configures it and adds it to the analysis manager.
   kPtTrackCutCl = ptTrackCut;
   kTrackEtaWindowCl = etaTrackWindow;
   kVertexWindowCl = vertexWindow;

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

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

    TString type = mgr->GetInputEventHandler()->GetDataType();
    TString typeRec(bRec);
    TString typeGen(bGen);
    if(!typeRec.Contains("AODextra")) {
      typeGen.ToUpper();
      typeRec.ToUpper();
    }
    cout << "typeRec: " << typeRec << endl;
    // Create the task and configure it.
    //===========================================================================


    TString cAdd = "";
    cAdd += Form("%02d_",(int)((radius+0.01)*10.));
    cAdd += Form("B%d",(int)kBackgroundModeCl);
    cAdd += Form("_Filter%05d",filterMask);
    cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCutCl));
    cAdd += Form("_hbom%02d",fNHBOM);
    if(constCone){
      cAdd += Form("_constConePhi%02dEta%02d",constConePhi,constConeEta);
    }
    Printf("%s %E",cAdd.Data(),kPtTrackCutCl);
    AliAnalysisTaskJetHBOM* hbom = new  AliAnalysisTaskJetHBOM(Form("JetHBOM%s_%s%s",bRec,jf,cAdd.Data()));
      
   hbom->SetFilterMask(filterMask); 
   //   hbom->SetUseGlobalSelection(kTRUE); 
   hbom->SetVtxCuts(kVertexWindowCl,1);//sets fVtxZCut and fVtxR2Cut
   if(type == "AOD"){
     // Assume all jet are produced already
     hbom->SetAODTrackInput(kTRUE);
     hbom->SetAODMCInput(kTRUE);
   }

   if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCChargedAcceptance);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODMC2")){
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCCharged);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(5);
   }
   else if (typeRec.Contains("AODMC")){
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODMCAll);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(5);
   }
   else if (typeRec.Contains("AODextraonly")) {
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextraonly);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AODextra")) {
     cout << "AliAnalysisTaskJetHBOM::kTrackAODextra: " << AliAnalysisTaskJetHBOM::kTrackAODextra << endl;
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAODextra);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }
   else if (typeRec.Contains("AOD")) {
     hbom->SetTrackTypeRec(AliAnalysisTaskJetHBOM::kTrackAOD);
     hbom->SetTrackPtCut(kPtTrackCutCl);
     hbom->SetTrackEtaWindow(kTrackEtaWindowCl);
   }

   hbom->SetRparam(radius);
   hbom->SetGhostArea(0.005);
   hbom->SetGhostEtamax(kTrackEtaWindowCl);

   switch (jf) {
   case "ANTIKT":
     hbom->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh
     break;
   case "CA":
     hbom->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh
     break;
   case "KT":
     hbom->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh
     break;
   default:
     ::Error("AddTaskJetHBOM", "Wrong jet finder selected\n");
     return 0;
   }

   //Constant Cone analysis
   if(constCone){
     hbom->SetRandConePos(constConeEta,constConePhi);
   }

   
   if(kWriteAOD){
     if(outputFile.Length())hbom->SetJetOutputFile(outputFile);
     hbom->SetJetOutputBranch(Form("hbom%s_%s%s",bRec,jf,cAdd.Data()));
     hbom->SetJetOutputMinPt(0); // store only jets above a certain threshold
   }

   //sets number of detector hits
   hbom->SetfNHBOM(fNHBOM);

   //physics Selection
   if(iPhysicsSelectionFlag)hbom->SelectCollisionCandidates(iPhysicsSelectionFlag);

   mgr->AddTask(hbom);

   // Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
   //==============================================================================
   AliAnalysisDataContainer *coutput1_Spec = mgr->CreateContainer(Form("hbom_%s_%s_%s%s",bRec,bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_hbom_%s_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen,jf,cAdd.Data()));

   mgr->ConnectInput  (hbom, 0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput (hbom, 0, mgr->GetCommonOutputContainer());
   mgr->ConnectOutput (hbom,  1, coutput1_Spec );
   
   //loads efficiencies
   hbom->SetEfficiencyPt(GetEfficiencyPt(effLoc));
   hbom->SetEfficiencyPhi(GetEfficiencyPhi(effLoc));
   
   return hbom;
}
Example #15
0
AliAnalysisTaskJetClusterKine *AddTaskJetClusterKine(char* bGen, Char_t *jf, Float_t radius, Int_t kWriteAOD, char *deltaFile, Float_t ptTrackCut, Float_t etaTrackWindow, Float_t vertexWindow){

 // Creates a jet fider task, configures it and adds it to the analysis manager.
   kPtTrackCutCl     = ptTrackCut;
   kTrackEtaWindowCl = etaTrackWindow;
   kVertexWindowCl   = vertexWindow;

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

    // Check the analysis type using the event handlers connected to the analysis manager.
    //==============================================================================
    if(!mgr->GetMCtruthEventHandler()){
      ::Error("AddTaskJetClusterKine", "This task requires an input MC event handler");
       return NULL;
    }

    TString typeGen(bGen);
    typeGen.ToUpper();

    // Create the task and configure it.
    //===========================================================================

    TString cAdd = "";
    cAdd += Form("%02d_",TMath::Nint(radius*10.));
    cAdd += Form("Cut%05d",TMath::Nint(1000.*kPtTrackCutCl));
    
    Printf("%s %s%s", typeGen.Data(), jf, cAdd.Data());

    AliAnalysisTaskJetClusterKine* clus = new  AliAnalysisTaskJetClusterKine(Form("JetCluster%s_%s%s",bGen,jf,cAdd.Data()));
      
    // or a config file
    clus->SetVtxCuts(kVertexWindowCl);

    if(typeGen.Contains("KINECHARGED")){
       clus->SetTrackTypeGen(AliAnalysisTaskJetClusterKine::kTrackKineCharged);
       clus->SetTrackPtCut(kPtTrackCutCl);
       clus->SetTrackEtaWindow(kTrackEtaWindowCl);

    }else if(typeGen.Contains("KINEFULL")){
       clus->SetTrackTypeGen(AliAnalysisTaskJetClusterKine::kTrackKineAll);
       clus->SetTrackPtCut(kPtTrackCutCl);
       clus->SetTrackEtaWindow(kTrackEtaWindowCl);
    }

   clus->SetRparam(radius);
   clus->SetGhostArea(0.005);
   clus->SetGhostEtamax(kTrackEtaWindowCl);

   clus->SetDebugLevel(0);

   switch (jf) {
   case "ANTIKT":
     clus->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh
     break;
   case "CA":
     clus->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh
     break;
   case "KT":
     clus->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh
     break;
   default:
     ::Error("AddTaskJetClusterKine", "Wrong jet finder selected\n");
     return 0;
   }

   TString nameOutArray =  Form("clusters%s_%s%s",bGen,jf,cAdd.Data()); //FF//
   if(kWriteAOD){
     if(outputFile.Length())clus->SetJetOutputFile(outputFile);
     Printf("Output branch: %s",nameOutArray.Data());//FF//  
     clus->SetJetOutputBranch(nameOutArray.Data());//FF//
     clus->SetJetOutputMinPt(0); // store only jets / clusters above a certain threshold
   }
   clus->SetJetOutputContainer(kWriteAOD); //0=no output 1=AOD 2=Exchange

   mgr->AddTask(clus);

   // Create ONLY the output containers for the data produced by the task.
   // Get and connect other common input/output containers via the manager as below
   //==============================================================================
   AliAnalysisDataContainer *coutput1_clus = mgr->CreateContainer(Form("cluster_%s_%s%s",bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWGJE_cluster_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bGen,jf,cAdd.Data()));

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

   if(kWriteAOD==1){//FF//
      mgr->ConnectOutput (clus, 0, mgr->GetCommonOutputContainer());

   }

   mgr->ConnectOutput (clus, 1, coutput1_clus );



   if(kWriteAOD==2){//FF//
      AliAnalysisDataContainer *coutput2_clus = mgr->CreateContainer( nameOutArray.Data(), //??
                                           TClonesArray::Class(), 
                                           AliAnalysisManager::kExchangeContainer);
      mgr->ConnectOutput (clus, 2, coutput2_clus); //FF//
   }


   return clus;
}