本文整理汇总了C++中AliAnalysisManager::SetGridHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ AliAnalysisManager::SetGridHandler方法的具体用法?C++ AliAnalysisManager::SetGridHandler怎么用?C++ AliAnalysisManager::SetGridHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AliAnalysisManager
的用法示例。
在下文中一共展示了AliAnalysisManager::SetGridHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runAlien
//___________________________________________________________
void runAlien(TString data, TString mode = "test", Bool_t MC = kFALSE){
if(!gSystem->Getenv("ALICE_ROOT")){
printf("AliRoot has to be initialized\n");
return;
}
// check for valid modes
const int kModes = 5;
TString allowed_modes[kModes] = {"proof", "prooftest", "test", "full", "submit"};
Bool_t isValid = kFALSE;
mode.ToLower();
for(int imode = 0; imode < kModes; imode++){
if(!mode.CompareTo(allowed_modes[imode])) isValid = kTRUE;
}
if(!isValid){
printf("invalid analysis mode selected\n");
return;
}
analysis_mode = mode;
Bool_t proofmode = mode.Contains("proof");
// libraries to be loaded
gSystem->Load("libANALYSIS");
gSystem->Load("libANALYSISalice");
gSystem->Load("libCORRFW");
gSystem->Load("libPWGhfe");
// Create Analysis Manager
AliAnalysisManager *runAnalysis = new AliAnalysisManager("Heavy Flavour Electron Analysis");
runAnalysis->SetCommonFileName(output_file.Data());
runAnalysis->SetInputEventHandler(new AliESDInputHandler);
if(MC) runAnalysis->SetMCtruthEventHandler(new AliMCEventHandler);
AliAnalysisAlien *alienhandler = CreateAlienHandler(proofmode);
printf("alienhandler %p\n", alienhandler);
runAnalysis->SetGridHandler(alienhandler);
//return;
// Specify input (runs or dataset)
if(!proofmode){
// Query sample ID and runs
TString sample;
TArrayI listofruns;
DecodeDataString(data, sample, listofruns);
AddInput(alienhandler, sample, listofruns, MC);
} else {
alienhandler->SetProofDataSet(data);
}
// Add Tasks
gROOT->LoadMacro(Form("%s/OADB/macros/AddTaskPhysicsSelection.C", gSystem->Getenv("ALICE_ROOT")));
gROOT->LoadMacro(Form("%s/PWG3/hfe/macros/AddTaskHFE.C", gSystem->Getenv("ALICE_ROOT")));
AddTaskPhysicsSelection(MC);
AddTaskHFE(); // @TODO: MC and PbPb flag to be fixed
// Run Analysis
TString anamode = proofmode ? "proof" : "grid";
if(runAnalysis->InitAnalysis()){
runAnalysis->PrintStatus();
runAnalysis->StartAnalysis(anamode);
}
}
示例2: rundStarTask
void rundStarTask(const char* mode = "test", bool isMC=true){
// Include AliPhysics and AliRoot libraries
gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_PHYSICS/include");
//Check the run mode
if(std::strcmp(mode,"local")!=0 && std::strcmp(mode,"grid")!=0 && std::strcmp(mode,"test")!=0){
Printf("\n\tIncorrect run option, check first argument of run macro");
Printf("\tmode = local, test or grid\n");
return;
}
Printf("%s analysis chosen",mode);
//Define the plugin
AliAnalysisGrid *plugin = 0x0;
TChain *chain = 0x0;
if(std::strcmp(mode,"local")!=0) {
plugin = CreateAlienHandler(mode,isMC);
if(!plugin) return;
}
else {
gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/CreateAODChain.C");
chain = CreateAODChain("localdata.txt");
}
// Create the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager(kTaskName);
if(plugin) mgr->SetGridHandler(plugin);
// Define input handlers
if(isMC){
AliMCEventHandler* mcHandler = new AliMCEventHandler();
if (plugin) mgr->SetMCtruthEventHandler(mcHandler);
}
AliAODInputHandler *aodH = new AliAODInputHandler();
mgr->SetInputEventHandler(aodH);
// Compile the class
gROOT->LoadMacro("AliAnalysisTaskdStar.cxx++g");
// PID response
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
AliAnalysisTaskPIDResponse *pidTask = AddTaskPIDResponse(isMC); // useMC
// dStar task
gROOT->LoadMacro("AddTaskdStar.C");
AliAnalysisTaskdStar *task = AddTaskdStar(isMC);
// Disbale debug printouts
mgr->SetDebugLevel(3);
AliLog::SetGlobalLogLevel(AliLog::kFatal);
AliLog::SetGlobalDebugLevel(0);
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
// Start analysis in grid.
if (std::strcmp(mode,"local")==0)
mgr->StartAnalysis(mode,chain);
else
mgr->StartAnalysis("grid");
}
示例3: AddAnalysisManagerMixRsn
void AddAnalysisManagerMixRsn(TString analysisSource = "proof", TString analysisMode = "test", TString opts = "")
{
Bool_t useMC = kFALSE;
TString format = "esd";
// ALICE stuff
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) mgr = new AliAnalysisManager("Martin Vala's AM");
gROOT->LoadMacro("SetupAnalysisPlugin.C");
AliAnalysisGrid *analysisPlugin = SetupAnalysisPlugin(analysisMode.Data());
if (!analysisPlugin) return;
gSystem->Load("libXMLParser.so");
gSystem->Load("libANALYSIS.so");
gSystem->Load("libANALYSISalice.so");
gSystem->Load("libCORRFW.so");
gSystem->Load("libEventMixing.so");
gSystem->Load("libPWG2resonances.so");
analysisPlugin->SetAliRootMode("ALIROOT"); // Loads AF libs by default
// sets additional settings to plubin
analysisPlugin->SetAdditionalLibs("libXMLParser.so libCORRFW.so libEventMixing.so libPWG2resonances.so");
// analysisPlugin->SetAdditionalLibs("libXMLParser.so libCORRFW.so libEventMixing.so PWG2resonances.par RESONANCESMV.par");
// analysisPlugin->SetAdditionalLibs("libXMLParser.so libCORRFW.so libEventMixing.so libPWG2resonances.so");
// sets plugin to manager
mgr->SetGridHandler(analysisPlugin);
Info("AddAnalysisManagerMixRsn.C", "Creating AliMultiInputEventHandler ...");
AliMultiInputEventHandler *mainInputHandler = new AliMultiInputEventHandler();
Info("AddAnalysisManagerMixRsn.C", "Creating esdInputHandler ...");
AliESDInputHandler *esdInputHandler = new AliESDInputHandler();
mainInputHandler->AddInputEventHandler(esdInputHandler);
if (useMC) {
Info("AddAnalysisManagerMixRsn.C", "Creating mcInputHandler ...");
AliMCEventHandler* mcInputHandler = new AliMCEventHandler();
mainInputHandler->AddInputEventHandler(mcInputHandler);
}
// add main input handler (with mixing handler)
mgr->SetInputEventHandler(mainInputHandler);
// add mixing handler (uncomment to turn on Mixnig)
gROOT->LoadMacro("MixingSetting.C");
mainInputHandler->AddInputEventHandler(MixingSetting());
// adds all tasks
gROOT->LoadMacro("AddAnalysisTaskAllRsn.C");
AddAnalysisTaskAllRsn(format, useMC, opts);
}
示例4: runGridpPb
void runGridpPb(const char *config = "config.txt"){
//
// run analysis
//
TGrid::Connect("alien://");
// Create Lookup with sample information
TMap sampleinfos;
Generate_Sample_Lookup(sampleinfos);
ConfigParser(config);
// Configure alien plugin
AliAnalysisAlien *plugin = CreateGridHandler();
if(!CreateTrainDir(plugin, sampleinfos)){
printf("Cannot setup output directory\n");
return;
}
if(!MakeSample(plugin, sampleinfos)){
printf("Cannot create data sample\n");
return;
}
if(!g_plugin_mode.CompareTo("full")){
// full mode, creating config files for the merging stage
GenerateMergeConfigs();
}
AliAnalysisManager *mgr = new AliAnalysisManager("tpctofanalysis");
mgr->SetGridHandler(plugin);
SetupTrain(sampleinfos);
// Run train
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
// Start analysis in grid.
mgr->StartAnalysis("grid");
}
示例5: AODmerge
//______________________________________________________________________________
void AODmerge()
{
// Merging method. No staging and no terminate phase.
TStopwatch timer;
timer.Start();
TString outputDir = "wn.xml";
TString outputFiles = "EventStat_temp.root,AODQA.root,AliAOD.root,AliAOD.VertexingHF.root,AliAODGammaConversion.root,FilterEvents_Trees.root,AliAOD.Muons.root";
TString mergeExcludes = "";
TObjArray *list = outputFiles.Tokenize(",");
TIter *iter = new TIter(list);
TObjString *str;
TString outputFile;
Bool_t merged = kTRUE;
while((str=(TObjString*)iter->Next())) {
outputFile = str->GetString();
// Skip already merged outputs
if (!gSystem->AccessPathName(outputFile)) {
printf("Output file <%s> found. Not merging again.",outputFile.Data());
continue;
}
if (mergeExcludes.Contains(outputFile.Data())) continue;
merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 10, 0);
if (!merged) {
printf("ERROR: Cannot merge %s\n", outputFile.Data());
continue;
}
}
// all outputs merged, validate
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
mgr->InitAnalysis();
mgr->SetGridHandler(new AliAnalysisAlien);
mgr->StartAnalysis("gridterminate",0);
ofstream out;
out.open("outputs_valid", ios::out);
out.close();
timer.Print();
}
示例6: RunGrid
//______________________________________________________________________________
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")
//.........这里部分代码省略.........
示例7: runGridDeuteronTree
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);
}
示例8: AODtrainsim
//______________________________________________________________________________
void AODtrainsim(Int_t merge=0)
{
// Main analysis train macro.
// merge = 0: production
// merge = 1: intermediate merging
// merge = 2: final merging + terminate
// merge = 3: terminate only
if (merge) {
TGrid::Connect("alien://");
if (!gGrid || !gGrid->IsConnected()) {
::Error("AODtrainsim.C", "No grid connection");
return;
}
}
// Set temporary merging directory to current one
gSystem->Setenv("TMPDIR", gSystem->pwd());
// Set temporary compilation directory to current one
gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
printf("==================================================================\n");
printf("=========== RUNNING FILTERING TRAIN ==========\n");
printf("==================================================================\n");
printf("= Configuring analysis train for: =\n");
if (usePhysicsSelection) printf("= Physics selection =\n");
if (iESDfilter) printf("= ESD filter =\n");
if (iMUONcopyAOD) printf("= MUON copy AOD =\n");
// Load common libraries and set include path
gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_PHYSICS/include");
// Make the analysis manager and connect event handlers
AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "Production train");
if (useSysInfo) mgr->SetNSysInfo(100);
// Load ParFiles
if (!LoadAnalysisLibraries()) {
::Error("AODtrainsim.C", "Could not load analysis libraries");
return;
}
// Create input handler (input container created automatically)
// ESD input handler
AliESDInputHandler *esdHandler = new AliESDInputHandler();
mgr->SetInputEventHandler(esdHandler);
// Monte Carlo handler
if (useMC) {
AliMCEventHandler* mcHandler = new AliMCEventHandler();
mgr->SetMCtruthEventHandler(mcHandler);
mcHandler->SetReadTR(useTR);
}
// AOD output container, created automatically when setting an AOD handler
if (iAODhandler) {
// AOD output handler
AliAODHandler* aodHandler = new AliAODHandler();
aodHandler->SetOutputFileName("AliAOD.root");
mgr->SetOutputEventHandler(aodHandler);
}
// Debugging if needed
if (useDBG) mgr->SetDebugLevel(3);
AddAnalysisTasks(merge);
if (merge) {
if (merge < 3) AODmerge();
if (merge > 1) {
mgr->InitAnalysis();
mgr->SetGridHandler(new AliAnalysisAlien());
mgr->StartAnalysis("grid terminate",0);
}
return;
}
// Run the analysis
//
TChain *chain = CreateChain();
if (!chain) return;
TStopwatch timer;
timer.Start();
mgr->SetSkipTerminate(kTRUE);
if (mgr->InitAnalysis()) {
mgr->PrintStatus();
mgr->StartAnalysis("local", chain);
}
timer.Print();
}
示例9: runPmdTask
//______________________________________________________________________________
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);
};
示例10: RunALICE
Bool_t RunALICE(TString anSrc = "grid",
TString anMode = "terminate",
TString input="aod" /*or "esd"*/,
TString inputMC="" /*or "mc"*/,
Long64_t nEvents = 1e10,
Long64_t nSkip = 0,
TString dsName="",
TString alirsnliteManagers ="AddAMRsn",
Bool_t useMultiHandler=kTRUE,
TString alirsnlitesrc ="$ALICE_ROOT",
TString alirsnlitetasks =""
) {
// some init work
anSrc.ToLower(); anMode.ToLower(); input.ToLower(); inputMC.ToLower();
// loads libs and setup include paths
if (LoadLibsBase(alirsnlitesrc)) return kFALSE;
// reset manager if already exists
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (mgr) delete mgr;
mgr = new AliAnalysisManager("AliRsnLiteAM","AliRsnLite Analysis Manager");
Bool_t useAODOut = kFALSE;
CreateInputHandlers(input,inputMC,useAODOut,useMultiHandler);
// add default grid handler
gROOT->LoadMacro("SetupAnalysisPlugin.C");
AliAnalysisGrid *analysisPlugin = SetupAnalysisPlugin(anMode.Data());
if (!analysisPlugin) { Printf("Error : analysisPlugin is null !!!"); return kFALSE; }
mgr->SetGridHandler(analysisPlugin);
if (!dsName.IsNull()) {
if (!anSrc.CompareTo("proof") && !anMode.CompareTo("full")) {
analysisPlugin->SetProofDataSet(dsName.Data());
Printf(Form("Using DataSet %s ...",dsName.Data()));
} else {
analysisPlugin->SetFileForTestMode(dsName.Data());
Printf(Form("Using Test file %s ...",dsName.Data()));
}
}
TList *listManagers = CreateListOfManagersFromDir(alirsnliteManagers,alirsnlitetasks);
if (!listManagers) { Printf("Error : CreateListOfManagersFromDir failed !!!"); return kFALSE;}
// adds all tasks
if (!AddAllManagers(listManagers, anSrc, anMode,input,inputMC)) { Printf("Error : AddAllManagers failed !!!"); return kFALSE;}
gSystem->ListLibraries("ls");
TStopwatch timer;
timer.Start();
// runs analysis
if (!RunAnalysisManager(anSrc, anMode.Data(), nEvents, nSkip)) { Printf("Error : RunAnalysisManager failed !!!"); return kFALSE;}
timer.Stop();
timer.Print();
Printf("Working directory is %s ...", gSystem->WorkingDirectory());
Printf("Done OK");
return kTRUE;
}
示例11: runFlowTaskCentralityKinkTrain
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,
//.........这里部分代码省略.........
示例12: runCPVAnalysis
void runCPVAnalysis(const char *runmode = "full")
{
// set if you want to run the analysis locally (kTRUE), or on grid (kFALSE)
// Bool_t local = kFALSE;
Bool_t local = kTRUE;
// if you run on grid, specify test mode (kTRUE) or full grid model (kFALSE)
// Bool_t gridTest = kTRUE;
Bool_t gridTest = kFALSE;
// since we will compile a class, tell root where to look for headers
gROOT->ProcessLine(".include $ROOTSYS/include");
gROOT->ProcessLine(".include $ALICE_ROOT/include");
// create the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("AnalysisTaskCPV");
AliESDInputHandler *esdH = new AliESDInputHandler();
mgr->SetInputEventHandler(esdH);
//PID task
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
AliAnalysisTask *taskPID = AddTaskPIDResponse(/*Bool_t isMC=*/ kFALSE, /*Bool_t autoMCesd=*/kTRUE,
/*Bool_t tuneOnData=*/kTRUE);
// // Add physics selection
gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection();
physSelTask->GetPhysicsSelection()->SetUseBXNumbers(kFALSE);// ---> ???
// load the addtask macro
gROOT->LoadMacro("AddTaskCPV.C");
// create an instance of your analysis task
AliAnalysisTaskCPV *task = AddTaskCPV();
task->SetRCPV(428.3);
task->SelectCollisionCandidates(AliVEvent::kINT7);
if(!mgr->InitAnalysis()) return;
mgr->SetDebugLevel(2);
mgr->PrintStatus();
mgr->SetUseProgressBar(1, 25);
if(local) {
// if you want to run locally, we need to define some input
TChain* chain = new TChain("esdTree");
// add a few files to the chain (change this so that your local files are added)
TGrid::Connect("alien://");
chain->Add("alien:///alice/data/2015/LHC15n/000244340/pass2/15000244340020.100/AliESDs.root");
// start the analysis locally, reading the events from the tchain
mgr->StartAnalysis("local", chain);
} else {
// if we want to run on grid, we create and configure the plugin
AliAnalysisAlien *alienHandler = new AliAnalysisAlien();
alienHandler->SetCheckCopy(kFALSE);
// also specify the include (header) paths on grid
alienHandler->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_PHYSICS/include");
// select the aliphysics version. all other packages
// are LOADED AUTOMATICALLY!
alienHandler->SetAliPhysicsVersion("vAN-20170215-1");
// set the Alien API version
alienHandler->SetAPIVersion("V1.1x");
// select the input data
alienHandler->SetGridDataDir("/alice/data/2015/LHC15n");
alienHandler->SetDataPattern("/pass2/*/AliESDs.root");
const Int_t runList[] = {244340, 244343};
const Int_t nRuns = 2;
// const Int_t runList[] = {244340, 244343, 244351, 244355, 244359,
// 244364, 244377, 244411, 244416, 244418,
// 244421, 244453, 244480, 244481, 244482,
// 244483, 244484, 244531, 244540, 244542,
// 244617, 244618, 244627, 244628};
// const Int_t nRuns = 24;
// MC has no prefix, data has prefix 000
alienHandler->SetRunPrefix("000");
// runnumber
for (Int_t iRun=0; iRun<nRuns; iRun++) {
alienHandler->AddRunNumber(runList[iRun]);
}
// number of files per subjob
alienHandler->SetSplitMaxInputFileNumber(50);
alienHandler->SetExecutable("CPVTask.sh");
// specify how many seconds your job may take
alienHandler->SetTTL(36000);
alienHandler->SetJDLName("CPVTask.jdl");
alienHandler->SetOutputToRunNo(kTRUE);
alienHandler->SetKeepLogs(kTRUE);
// merging: run with kTRUE to merge on grid
// after re-running the jobs in SetRunMode("terminate")
// (see below) mode, set SetMergeViaJDL(kFALSE)
// to collect final results
alienHandler->SetMaxMergeStages(2);
alienHandler->SetMergeViaJDL(kTRUE);
// define the output folders
alienHandler->SetGridWorkingDir("CPVWorkingDir");
alienHandler->SetGridOutputDir("CPVOutputDir_R428");
// connect the alien plugin to the manager
mgr->SetGridHandler(alienHandler);
//.........这里部分代码省略.........
示例13: runGrid
void runGrid() {
gSystem->Load("libCore.so");
gSystem->Load("libTree.so");
gSystem->Load("libGeom.so");
gSystem->Load("libVMC.so");
gSystem->Load("libPhysics.so");
gSystem->Load("libSTEERBase");
// gSystem->Load("libESD");
gSystem->Load("libAOD");
gSystem->Load("libANALYSIS");
gSystem->Load("libANALYSISalice");
gSystem->Load("libTENDER");
// gSystem->Load("libPWGPP");
gROOT->ProcessLine(".include $ALICE_ROOT/include");
gROOT->LoadMacro("CreateAlienHandler.C");
AliAnalysisGrid *alienHandler = CreateAlienHandler();
if (!alienHandler) return;
cout<<" Got alien handler"<<endl;
AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
mgr->SetGridHandler(alienHandler);
/*
// For centrality Selection: Requires input event handler.
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
taskCentrality->SetPass(2); // remember to set the pass you are processing!!!
*/
// My Task
gROOT->LoadMacro("AliAnalysisFBMultFluct.cxx++g");
AliAnalysisTask *task = new AliAnalysisFBMultFluct("TaskFBGrid");
// task->SelectCollisionCandidates(AliVEvent::kMB) // Added for minbias trigger on 3Jun14
// task->SelectCollisionCandidates(AliVEvent::kCentral) // Added for minbias trigger on 3Jun14
mgr->AddTask(task);
/*
AliESDInputHandler* esdH = new AliESDInputHandler;
mgr->SetInputEventHandler(esdH);
AliMCEventHandler *mc = new AliMCEventHandler();
mgr->SetMCtruthEventHandler(mc);
TChain *chain = new TChain("aodTree");
// chain->Add("/Users/sadhanadash/QA/AliESDs.root");
chain->Add("/Users/rashmi/ALICE/InitFluct/alice/data/2010/LHC11h/000170388/ESDs/pass2_muon/AOD/132/AliAOD.root");
// chain->Add("/Users/rashmi/ALICE/InitFluct/alice/data/2011/LHC11h/000170388/ESDs/pass2_muon/AOD/132/AliESDs.root");
chain->Add("AliESDs.root");
*/
// AliAODInputHandler* aodH = new AliAODInputHandler;
AliVEventHandler* aodH = new AliAODInputHandler;
mgr->SetInputEventHandler(aodH);
cout<<" SetInputEventHandler"<<endl;
// TChain *chain = new TChain("aodTree");
//alice/data/2010/LHC10h/000139510/ESDs/pass2/AOD160/0001
//chain->Add("AODfile/139510/AliAOD.root");
// chain->Add("pass2/137161/1/AliAOD.root");
// chain->Add("pass2/137161/2/AliAOD.root");
// chain->GetListOfFiles()->Print();
// Create containers for input/output
AliAnalysisDataContainer *coutput =
// mgr->CreateContainer("coutput", TObjArray::Class(),
// mgr->CreateContainer("coutput", TList::Class(),
// AliAnalysisManager::kOutputContainer, "MC.AOD.root" );
mgr->CreateContainer("coutput", TList::Class(),
AliAnalysisManager::kOutputContainer, "AOD.DATA.root" );
AliAnalysisDataContainer *cTree =
mgr->CreateContainer("cTree",TTree::Class(),AliAnalysisManager::kOutputContainer,"AOD.DATA.root");
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task,1,coutput);
mgr->ConnectOutput(task,2,cTree);
/*
mgr->CreateContainer("cinput",TFile::Class(),1,"AOD.137161.input.root");
mgr->ConnectInput(task,2,cinput);
*/
mgr->SetDebugLevel(1);
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
cout<<" Starting Analysis now"<<endl;
// mgr->StartAnalysis("local",chain);
mgr->StartAnalysis("grid");
}
示例14: runAAF
//.........这里部分代码省略.........
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
示例15: RunSingleTrackEfficiencyTaskHFCJ
void RunSingleTrackEfficiencyTaskHFCJ()
{
TBenchmark fBenchMark;
fBenchMark.Start("AliCFSingleTrackEfficiencyTask");
Load();
if(fAnalysisMode=="grid"){
//gSystem->Exec(Form("alien-token-init %s",fUsername.Data()));
TGrid::Connect("alien://") ;
}
if(IsPlugin) {
AliAnalysisGrid *alienHandler = CreateAlienHandler();
if(!alienHandler) return;
}
printf("CREATE ANALYSIS MANAGER\n");
AliAnalysisManager *mgr = new AliAnalysisManager("My Manager","My Manager");
mgr->SetDebugLevel(10);
if(IsPlugin) mgr->SetGridHandler(alienHandler);
AliMCEventHandler* mcHandler = new AliMCEventHandler();
if (!readAOD) mgr->SetMCtruthEventHandler(mcHandler);
AliInputEventHandler* dataHandler;
if (readAOD) dataHandler = new AliAODInputHandler();
else dataHandler = new AliESDInputHandler();
mgr->SetInputEventHandler(dataHandler);
if (!readAOD) {
gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kTRUE);
}
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
AliAnalysisTaskSE *setupTask = AddTaskPIDResponse(kTRUE, kTRUE, kTRUE, 2, kFALSE, "", kTRUE, kFALSE, -1);
if(ifTaskPIDQA){
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
AliAnalysisTaskPIDqa *pidQA = AddTaskPIDqa();
}
printf("Prepare to create the task\n");
gROOT->LoadMacro("./AddSingleTrackEfficiencyTaskDhCorrelations.C");
//NCharge Filterbin0 + kFAST configuration + w/o external cut file
AliCFSingleTrackEfficiencyTask *taskNchF0wFile = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "NchFbit0woFile", AliPID::kPion, 0, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID, "", "");
//NCharge Filterbin0 + kFAST configuration + w external cut file
AliCFSingleTrackEfficiencyTask *taskNchF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "NchFbit0", AliPID::kPion, 0, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID, "AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
//Pion Filterbin0+ kFAST configuration + w external cut file
AliCFSingleTrackEfficiencyTask *taskPionF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "PionFbit0", AliPID::kPion, 211, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID,"AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
//Kaons Filterbin0+ kFAST configuration + w external cut file
AliCFSingleTrackEfficiencyTask *taskKaonF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "KaonFbit0", AliPID::kKaon, 321, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID,"AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
//Protons Filterbin0+ kFAST configuration + w external cut file
AliCFSingleTrackEfficiencyTask *taskProtF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "ProtonFbit0", AliPID::kProton, 2212, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID,"AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
//Electron Filterbin0+ kFAST configuration + w external cut file
AliCFSingleTrackEfficiencyTask *taskElecF0 = AddSingleTrackEfficiencyTaskDhCorrelations(kTRUE, "ElectronFbit0", AliPID::kElectron,11, AliVEvent::kAnyINT, kFALSE, AliCFSingleTrackEfficiencyTask::kFast, AliSingleTrackEffCuts::kNoBayesianPID, "AssocPartCuts_Std_NewPoolsAndCode_10000Tr.root", "AssociatedTrkCuts");
// Run the analysis
TChain * analysisChain=0;
if(analysisChain) printf("CHAIN HAS %d ENTRIES\n",(Int_t)analysisChain->GetEntries());
if(!mgr->InitAnalysis()) return;
mgr->PrintStatus();
if(fAnalysisMode=="grid" && !IsPlugin) fAnalysisMode="local";
if(fAnalysisMode!="proof") {
mgr->StartAnalysis(fAnalysisMode.Data(),analysisChain,nEntries,firstentry);
}
fBenchMark.Stop("AliCFSingleTrackEfficiencyTask");
fBenchMark.Show("AliCFSingleTrackEfficiencyTask");
return;
}