ROOT logo
// runV0ChCorrelations.C
//
// Running macro for AliAnalysisTaskV0ChCorrelations task
// Example of usage:  .L runV0ChCorrelations.C
//                     runV0ChCorrelations("proof","full)
//
class AliAnalysisGrid;

//______________________________________________________________________________
void runV0ChCorrelations(
         const char* runtype = "proof", // local, proof or grid
         const char *gridmode = "full", // Set the run mode (can be "full", "test", "offline", "submit" or "terminate"). Full & Test work for proof
         const bool bMCtruth = 0, // 1 = MCEvent handler is on (MC truth), 0 = MCEvent handler is off (MC reconstructed/real data)
         const bool bMCphyssel = 0, // 1 = looking at MC truth or reconstructed, 0 = looking at real data
         const Long64_t nentries = 1234567890, // 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/LHC10h_000138534_p2_AOD049", // path to dataset on proof cluster, for proof analysis
         const char *proofdataset = "/alice/data/LHC11h_2_000169858_p2_AOD095", // 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 = "V0ChCorrelations_task" // sets name of grid generated macros
         )
{
    // 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);
  
    // load libraries
    gSystem->Load("libCore.so");        
    gSystem->Load("libGeom.so");
    gSystem->Load("libVMC.so");
    gSystem->Load("libPhysics.so");
    gSystem->Load("libTree.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");
  
    // add aliroot indlude path
    gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
    gROOT->SetStyle("Plain");
        
    // analysis manager
    AliAnalysisManager* mgr = new AliAnalysisManager(taskname);
    
    // create the alien handler and attach it to the manager
    AliAnalysisGrid *plugin = CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset); 
    mgr->SetGridHandler(plugin);
    
    //AliVEventHandler* iH = new AliESDInputHandler();
    AliAODInputHandler* iH = new AliAODInputHandler();
    mgr->SetInputEventHandler(iH);
        
    // mc event handlerrunEx01.C
    /*if(bMCtruth) {
        AliMCEventHandler* mchandler = new AliMCEventHandler();
        // Not reading track references
        mchandler->SetReadTR(kFALSE);
        mgr->SetMCtruthEventHandler(mchandler);
    } */  

	gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
	AliAnalysisTask *pidtask = AddTaskPIDResponse(kFALSE,kTRUE);

    // create task
    gROOT->LoadMacro("AliAnalysisTaskV0ChCorrelations.cxx+g");
    gROOT->LoadMacro("AddTaskV0ChCorrelations.C");
	AliAnalysisTaskV0ChCorrelations *taskV0 = AddTaskV0ChCorrelations(kFALSE);
        
    // enable debug printouts
    mgr->SetDebugLevel(2);
    mgr->SetNSysInfo(100);
    if (!mgr->InitAnalysis()) return;
    mgr->PrintStatus();
  
    // start analysis
    Printf("Starting Analysis....");
    mgr->StartAnalysis(runtype,nentries,firstentry);
}

//______________________________________________________________________________
AliAnalysisGrid* CreateAlienHandler(const char *taskname, const char *gridmode, const char *proofcluster, const char *proofdataset)
{
    AliAnalysisAlien *plugin = new AliAnalysisAlien();
    // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
    plugin->SetRunMode(gridmode);

    // Set versions of used packages
    plugin->SetAPIVersion("V1.1x");
    plugin->SetROOTVersion("v5-34-01-1");
    plugin->SetAliROOTVersion("v5-03-66-AN");


    // Method 1: Create automatically XML collections using alien 'find' command.
    // Define production directory LFN
    //plugin->SetGridDataDir("/alice/data/2010/LHC10h");
    plugin->SetGridDataDir("/alice/data/2011/LHC11h_2");
    // On real reconstructed data:
    // plugin->SetGridDataDir("/alice/data/2009/LHC09d");
    // Data pattern for reconstructed data
    plugin->SetDataPattern("*ESDs/pass2/AOD095/*AOD.root"); // LHC11h data
    //    plugin->SetDataPattern("ESDs/pass2/AOD038/*AliAOD.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
    plugin->SetRunPrefix("000");   // real data
    // ...then add run numbers to be considered

    //plugin->AddRunNumber(139038);
    plugin->AddRunNumber(169858);
    //plugin->SetRunRange(146686,146860);

    plugin->SetNrunsPerMaster(1); // 1
    plugin->SetOutputToRunNo();
    // comment out the next line when using the "terminate" option, unless
    // you want separate merged files for each run
    //plugin->SetMergeViaJDL();

    // Method 2: Declare existing data files (raw collections, xml collections, root file)
    // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
    // XML collections added via this method can be combined with the first method if
    // the content is compatible (using or not tags)
    //   plugin->AddDataFile("tag.xml");
    //   plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");

    // Define alien work directory where all files will be copied. Relative to alien $HOME.
    plugin->SetGridWorkingDir(taskname);

    // Declare alien output directory. Relative to working directory.
    plugin->SetGridOutputDir("outLHC11h"); // In this case will be $HOME/taskname/out

    // Declare the analysis source files names separated by blancs. To be compiled runtime
    // using ACLiC on the worker nodes.
    plugin->SetAnalysisSource("AliAnalysisTaskV0ChCorrelations.cxx");

    // Declare all libraries (other than the default ones for the framework. These will be
    // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
    plugin->SetAdditionalLibs("AliAnalysisTaskV0ChCorrelations.h AliAnalysisTaskV0ChCorrelations.cxx");

    // Declare the output file names separated by blancs.
    // (can be like: file.root or file.root@ALICE::Niham::File)
    // To only save certain files, use SetDefaultOutputs(kFALSE), and then
    // SetOutputFiles("list.root other.filename") to choose which files to save
    plugin->SetDefaultOutputs(kFALSE);
    plugin->SetOutputFiles("list.grid.v0ch.root");

    // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
    plugin->SetAnalysisMacro(Form("%s.C",taskname));

    // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
    plugin->SetSplitMaxInputFileNumber(100);

    // Optionally modify the executable name (default analysis.sh)
    plugin->SetExecutable(Form("%s.sh",taskname));

    // set number of test files to use in "test" mode
    plugin->SetNtestFiles(10);

    // Optionally resubmit threshold.
    plugin->SetMasterResubmitThreshold(90);

    // Optionally set time to live (default 30000 sec)
    plugin->SetTTL(30000);

    // Optionally set input format (default xml-single)
    plugin->SetInputFormat("xml-single");

    // Optionally modify the name of the generated JDL (default analysis.jdl)
    plugin->SetJDLName(Form("%s.jdl",taskname));

    // Optionally modify job price (default 1)
    plugin->SetPrice(1);      

    // Optionally modify split mode (default 'se')    
    plugin->SetSplitMode("se");
    
    //----------------------------------------------------------
    //---      PROOF MODE SPECIFIC SETTINGS         ------------
    //---------------------------------------------------------- 
    // Proof cluster
    plugin->SetProofCluster(proofcluster);
    // Dataset to be used   
    plugin->SetProofDataSet(proofdataset);
    // May need to reset proof. Supported modes: 0-no reset, 1-soft, 2-hard
    plugin->SetProofReset(0);
    // May limit number of workers
    plugin->SetNproofWorkers(0);
    // May limit the number of workers per slave
    plugin->SetNproofWorkersPerSlave(1);   
    // May use a specific version of root installed in proof
    //plugin->SetRootVersionForProof("current");
    plugin->SetRootVersionForProof("VO_ALICE@ROOT::v5-34-01-1");
    // May set the aliroot mode. Check http://aaf.cern.ch/node/83 
    plugin->SetAliRootMode("default"); // Loads AF libs by default
    // May request ClearPackages (individual ClearPackage not supported)
    plugin->SetClearPackages(kFALSE);
    // Plugin test mode works only providing a file containing test file locations, used in "local" mode also
    plugin->SetFileForTestMode("LocalData_PbPb_LHC10h.txt"); // file should contain path name to a local directory containg *ESDs.root etc
    // Request connection to alien upon connection to grid
    plugin->SetProofConnectGrid(kFALSE);
    // Other PROOF specific parameters
    plugin->SetProofParameter("PROOF_UseMergers","-1");
    printf("Using: PROOF_UseMergers   : %s\n", plugin->GetProofParameter("PROOF_UseMergers"));
    return plugin;
}

 runV0ChCorrelations.C:1
 runV0ChCorrelations.C:2
 runV0ChCorrelations.C:3
 runV0ChCorrelations.C:4
 runV0ChCorrelations.C:5
 runV0ChCorrelations.C:6
 runV0ChCorrelations.C:7
 runV0ChCorrelations.C:8
 runV0ChCorrelations.C:9
 runV0ChCorrelations.C:10
 runV0ChCorrelations.C:11
 runV0ChCorrelations.C:12
 runV0ChCorrelations.C:13
 runV0ChCorrelations.C:14
 runV0ChCorrelations.C:15
 runV0ChCorrelations.C:16
 runV0ChCorrelations.C:17
 runV0ChCorrelations.C:18
 runV0ChCorrelations.C:19
 runV0ChCorrelations.C:20
 runV0ChCorrelations.C:21
 runV0ChCorrelations.C:22
 runV0ChCorrelations.C:23
 runV0ChCorrelations.C:24
 runV0ChCorrelations.C:25
 runV0ChCorrelations.C:26
 runV0ChCorrelations.C:27
 runV0ChCorrelations.C:28
 runV0ChCorrelations.C:29
 runV0ChCorrelations.C:30
 runV0ChCorrelations.C:31
 runV0ChCorrelations.C:32
 runV0ChCorrelations.C:33
 runV0ChCorrelations.C:34
 runV0ChCorrelations.C:35
 runV0ChCorrelations.C:36
 runV0ChCorrelations.C:37
 runV0ChCorrelations.C:38
 runV0ChCorrelations.C:39
 runV0ChCorrelations.C:40
 runV0ChCorrelations.C:41
 runV0ChCorrelations.C:42
 runV0ChCorrelations.C:43
 runV0ChCorrelations.C:44
 runV0ChCorrelations.C:45
 runV0ChCorrelations.C:46
 runV0ChCorrelations.C:47
 runV0ChCorrelations.C:48
 runV0ChCorrelations.C:49
 runV0ChCorrelations.C:50
 runV0ChCorrelations.C:51
 runV0ChCorrelations.C:52
 runV0ChCorrelations.C:53
 runV0ChCorrelations.C:54
 runV0ChCorrelations.C:55
 runV0ChCorrelations.C:56
 runV0ChCorrelations.C:57
 runV0ChCorrelations.C:58
 runV0ChCorrelations.C:59
 runV0ChCorrelations.C:60
 runV0ChCorrelations.C:61
 runV0ChCorrelations.C:62
 runV0ChCorrelations.C:63
 runV0ChCorrelations.C:64
 runV0ChCorrelations.C:65
 runV0ChCorrelations.C:66
 runV0ChCorrelations.C:67
 runV0ChCorrelations.C:68
 runV0ChCorrelations.C:69
 runV0ChCorrelations.C:70
 runV0ChCorrelations.C:71
 runV0ChCorrelations.C:72
 runV0ChCorrelations.C:73
 runV0ChCorrelations.C:74
 runV0ChCorrelations.C:75
 runV0ChCorrelations.C:76
 runV0ChCorrelations.C:77
 runV0ChCorrelations.C:78
 runV0ChCorrelations.C:79
 runV0ChCorrelations.C:80
 runV0ChCorrelations.C:81
 runV0ChCorrelations.C:82
 runV0ChCorrelations.C:83
 runV0ChCorrelations.C:84
 runV0ChCorrelations.C:85
 runV0ChCorrelations.C:86
 runV0ChCorrelations.C:87
 runV0ChCorrelations.C:88
 runV0ChCorrelations.C:89
 runV0ChCorrelations.C:90
 runV0ChCorrelations.C:91
 runV0ChCorrelations.C:92
 runV0ChCorrelations.C:93
 runV0ChCorrelations.C:94
 runV0ChCorrelations.C:95
 runV0ChCorrelations.C:96
 runV0ChCorrelations.C:97
 runV0ChCorrelations.C:98
 runV0ChCorrelations.C:99
 runV0ChCorrelations.C:100
 runV0ChCorrelations.C:101
 runV0ChCorrelations.C:102
 runV0ChCorrelations.C:103
 runV0ChCorrelations.C:104
 runV0ChCorrelations.C:105
 runV0ChCorrelations.C:106
 runV0ChCorrelations.C:107
 runV0ChCorrelations.C:108
 runV0ChCorrelations.C:109
 runV0ChCorrelations.C:110
 runV0ChCorrelations.C:111
 runV0ChCorrelations.C:112
 runV0ChCorrelations.C:113
 runV0ChCorrelations.C:114
 runV0ChCorrelations.C:115
 runV0ChCorrelations.C:116
 runV0ChCorrelations.C:117
 runV0ChCorrelations.C:118
 runV0ChCorrelations.C:119
 runV0ChCorrelations.C:120
 runV0ChCorrelations.C:121
 runV0ChCorrelations.C:122
 runV0ChCorrelations.C:123
 runV0ChCorrelations.C:124
 runV0ChCorrelations.C:125
 runV0ChCorrelations.C:126
 runV0ChCorrelations.C:127
 runV0ChCorrelations.C:128
 runV0ChCorrelations.C:129
 runV0ChCorrelations.C:130
 runV0ChCorrelations.C:131
 runV0ChCorrelations.C:132
 runV0ChCorrelations.C:133
 runV0ChCorrelations.C:134
 runV0ChCorrelations.C:135
 runV0ChCorrelations.C:136
 runV0ChCorrelations.C:137
 runV0ChCorrelations.C:138
 runV0ChCorrelations.C:139
 runV0ChCorrelations.C:140
 runV0ChCorrelations.C:141
 runV0ChCorrelations.C:142
 runV0ChCorrelations.C:143
 runV0ChCorrelations.C:144
 runV0ChCorrelations.C:145
 runV0ChCorrelations.C:146
 runV0ChCorrelations.C:147
 runV0ChCorrelations.C:148
 runV0ChCorrelations.C:149
 runV0ChCorrelations.C:150
 runV0ChCorrelations.C:151
 runV0ChCorrelations.C:152
 runV0ChCorrelations.C:153
 runV0ChCorrelations.C:154
 runV0ChCorrelations.C:155
 runV0ChCorrelations.C:156
 runV0ChCorrelations.C:157
 runV0ChCorrelations.C:158
 runV0ChCorrelations.C:159
 runV0ChCorrelations.C:160
 runV0ChCorrelations.C:161
 runV0ChCorrelations.C:162
 runV0ChCorrelations.C:163
 runV0ChCorrelations.C:164
 runV0ChCorrelations.C:165
 runV0ChCorrelations.C:166
 runV0ChCorrelations.C:167
 runV0ChCorrelations.C:168
 runV0ChCorrelations.C:169
 runV0ChCorrelations.C:170
 runV0ChCorrelations.C:171
 runV0ChCorrelations.C:172
 runV0ChCorrelations.C:173
 runV0ChCorrelations.C:174
 runV0ChCorrelations.C:175
 runV0ChCorrelations.C:176
 runV0ChCorrelations.C:177
 runV0ChCorrelations.C:178
 runV0ChCorrelations.C:179
 runV0ChCorrelations.C:180
 runV0ChCorrelations.C:181
 runV0ChCorrelations.C:182
 runV0ChCorrelations.C:183
 runV0ChCorrelations.C:184
 runV0ChCorrelations.C:185
 runV0ChCorrelations.C:186
 runV0ChCorrelations.C:187
 runV0ChCorrelations.C:188
 runV0ChCorrelations.C:189
 runV0ChCorrelations.C:190
 runV0ChCorrelations.C:191
 runV0ChCorrelations.C:192
 runV0ChCorrelations.C:193
 runV0ChCorrelations.C:194
 runV0ChCorrelations.C:195
 runV0ChCorrelations.C:196
 runV0ChCorrelations.C:197
 runV0ChCorrelations.C:198
 runV0ChCorrelations.C:199
 runV0ChCorrelations.C:200
 runV0ChCorrelations.C:201
 runV0ChCorrelations.C:202
 runV0ChCorrelations.C:203
 runV0ChCorrelations.C:204
 runV0ChCorrelations.C:205
 runV0ChCorrelations.C:206
 runV0ChCorrelations.C:207
 runV0ChCorrelations.C:208
 runV0ChCorrelations.C:209
 runV0ChCorrelations.C:210