ROOT logo
// runEx.C
//
// run macro for central diffractive example analysis
//
// Author: Felix Reidt <felix.reidt@cern.ch>
//
// based on:
// ---
// Template run macro for AliBasicTask.cxx/.h with example layout of
// physics selections and options, in macro and task.
//
// Author: Arvinder Palaha
//
class AliAnalysisGrid;

//______________________________________________________________________________
void runEx(
             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 bMCphyssel = 0, // 1 = looking at MC truth or reconstructed, 0 = looking at real data
             const Long64_t nentries = 2000, // 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 = "CDex" // 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 (to be optimized)
	gSystem->Load("libCore.so");
	gSystem->Load("libTree.so");
	gSystem->Load("libPhysics");
	gSystem->Load("libMinuit");
	gSystem->Load("libProof");
	gSystem->Load("libmicrocern");
	gSystem->Load("liblhapdf");
	gSystem->Load("libpythia6");
	gSystem->Load("libEG");
	gSystem->Load("libGeom");
	gSystem->Load("libVMC");
	gSystem->Load("libEGPythia6");
	gSystem->Load("libSTEERBase");
	gSystem->Load("libESD");
	gSystem->Load("libCDB");
	gSystem->Load("libRAWDatabase");
	gSystem->Load("libRAWDatarec");
	gSystem->Load("libAOD");
	gSystem->Load("libANALYSIS");
	gSystem->Load("libANALYSISalice");
	gSystem->Load("libSTEER");
	gSystem->Load("libTENDER");
	gSystem->Load("libRAWDatasim");
	gSystem->Load("libFASTSIM");
	gSystem->Load("libEVGEN");
	gSystem->Load("libAliPythia6");
	gSystem->Load("libSTAT");
	gSystem->Load("libhijing");
	gSystem->Load("libTHijing");
	gSystem->Load("libSTRUCT");
	gSystem->Load("libPHOSUtils");
	gSystem->Load("libPHOSbase");
	gSystem->Load("libPHOSsim");
	gSystem->Load("libPHOSrec");
	gSystem->Load("libMUONcore");
	gSystem->Load("libMUONmapping");
	gSystem->Load("libMUONgeometry");
	gSystem->Load("libMUONcalib");
	gSystem->Load("libMUONraw");
	gSystem->Load("libMUONtrigger");
	gSystem->Load("libMUONbase");
	gSystem->Load("libMUONsim");
	gSystem->Load("libMUONrec");
	gSystem->Load("libMUONevaluation");
	gSystem->Load("libFMDbase");
	gSystem->Load("libFMDsim");
	gSystem->Load("libFMDrec");
	gSystem->Load("libPMDbase");
	gSystem->Load("libPMDsim");
	gSystem->Load("libPMDrec");
	gSystem->Load("libHMPIDbase");
	gSystem->Load("libHMPIDsim");
	gSystem->Load("libHMPIDrec");
	gSystem->Load("libT0base");
	gSystem->Load("libT0sim");
	gSystem->Load("libT0rec");
	gSystem->Load("libZDCbase");
	gSystem->Load("libZDCsim");
	gSystem->Load("libZDCrec");
	gSystem->Load("libACORDEbase");
	gSystem->Load("libACORDErec");
	gSystem->Load("libACORDEsim");
	gSystem->Load("libVZERObase");
	gSystem->Load("libVZEROrec");
	gSystem->Load("libVZEROsim");
	gSystem->Load("libEMCALraw");
	gSystem->Load("libEMCALUtils");
	gSystem->Load("libEMCALbase");
	gSystem->Load("libEMCALsim");
	gSystem->Load("libEMCALrec");
	gSystem->Load("libTPCbase");
	gSystem->Load("libTPCrec");
	gSystem->Load("libTPCsim");
	gSystem->Load("libITSbase");
	gSystem->Load("libITSsim");
	gSystem->Load("libITSrec");
	gSystem->Load("libTRDbase");
	gSystem->Load("libTRDsim");
	gSystem->Load("libTRDrec");
	gSystem->Load("libTOFbase");
	gSystem->Load("libTOFrec");
	gSystem->Load("libTOFsim");
	gSystem->Load("libHLTbase");
	gSystem->Load("libHLTinterface");
	gSystem->Load("libHLTsim");
	gSystem->Load("libHLTrec");
	gSystem->Load("libPWGPP");

	// add aliroot include path
	gROOT->ProcessLine(Form(".include %s/include",
	                        gSystem->ExpandPathName("$ALICE_ROOT")));
	gROOT->ProcessLine(Form(".include $ALICE_ROOT/include",
	                        gSystem->ExpandPathName("$ALICE_ROOT")));
	gROOT->ProcessLine(Form(".include $ALICE_ROOT/ITS",
	                        gSystem->ExpandPathName("$ALICE_ROOT")));
	gROOT->ProcessLine(Form(".include $ALICE_ROOT/PWGPP/ITS",
	                        gSystem->ExpandPathName("$ALICE_ROOT")));

	gROOT->SetStyle("Plain");

	// create the alien handler and attach it to the manager
	AliAnalysisGrid *plugin =
		CreateAlienHandler(taskname, gridmode, proofcluster, proofdataset);

	// analysis manager
	AliAnalysisManager* mgr = new AliAnalysisManager("CDMeson-Manager");
	mgr->SetGridHandler(plugin);

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

	// === Physics Selection Task ===
	gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
	AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(bMCphyssel);
	if(!physSelTask) { Printf("no physSelTask"); return; }

	// === create user task ===
	gROOT->LoadMacro("AliCDMesonBaseStripped.cxx+g");
	gROOT->LoadMacro("AliCDMesonTracks.cxx+g");
	gROOT->LoadMacro("AliCDMesonUtilsStripped.cxx+g");
	gROOT->LoadMacro("AliAnalysisTaskCDex.cxx+g");

	AliAnalysisTaskSE* task = new AliAnalysisTaskCDex(taskname);
	task->SelectCollisionCandidates(AliVEvent::kMB);
	mgr->AddTask(task);

	// INPUT ---------------------------------------------------------------------
	AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
	mgr->ConnectInput(task,  0, cinput );

	// OUTPUT --------------------------------------------------------------------
	// output filename
	Char_t foutname[100];
	sprintf(foutname,"diffExample_%s.root",taskname);

	// output containers
	// in AnalysisTaskSE, slot 0 reserved, must start from 1
	AliAnalysisDataContainer* output =
		mgr->CreateContainer("diffExample_Hist", TList::Class(),
		                     AliAnalysisManager::kOutputContainer,foutname);
	task->ConnectOutput(1, output);

	// 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->SetOverwriteMode();
	plugin->SetRunMode(gridmode);

	plugin->SetMergeViaJDL(kTRUE);

	// Set versions of used packages
	plugin->SetAPIVersion("V1.1x");
	plugin->SetROOTVersion("v5-33-02b");
	plugin->SetAliROOTVersion("v5-02-Rev-09");

	// Declare input data to be processed.
	//plugin->SetCheckCopy(kFALSE);

	// Method 1: Create automatically XML collections using alien 'find' command.
	// Define production directory LFN
	plugin->SetGridDataDir("/alice/data/2010/LHC10b");
	// On real reconstructed data:
	// plugin->SetGridDataDir("/alice/data/2009/LHC09d");
	// Set data search pattern
	//plugin->SetDataPattern("*ESDs.root"); // THIS CHOOSES ALL PASSES
	// Data pattern for reconstructed data
	plugin->SetDataPattern("*ESDs/pass2/*ESDs.root"); // CHECK LATEST PASS OF DATA SET IN ALIENSH
	//    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

	//Int_t runlist[15]={117039, 146859, 146858, 146856, 146824, 146817, 146806, 146805, 146804, 146803, 146802, 146801, 146748, 146747, 146746};  
	//for (Int_t ind=0; ind<1; ind++) {
	//	plugin->AddRunNumber(runlist[ind]);
	//}
	//plugin->SetRunRange(114917,115322);
	plugin->AddRunNumber(117050);

	plugin->SetNrunsPerMaster(1);

	// 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("out"); // 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("AliCDMesonBaseStripped.cxx AliCDMesonTracks.cxx AliCDMesonUtilsStripped.cxx AliAnalysisTaskCDex.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("libGui.so libCore.so libTree.so libPhysics.so libMinuit.so libProof.so libmicrocern.so liblhapdf.so libpythia6.so libEG.so libGeom.so libVMC.so libEGPythia6.so libSTEERBase.so libESD.so libRAWDatabase.so libRAWDatarec.so libAOD.so libANALYSIS.so libANALYSISalice.so libCDB.so libSTEER.so libRAWDatasim.so libFASTSIM.so libEVGEN.so libAliPythia6.so libSTAT.so libhijing.so libTHijing.so libSTRUCT.so libPHOSUtils.so libPHOSbase.so libPHOSsim.so libPHOSrec.so libMUONcore.so libMUONmapping.so libMUONgeometry.so libMUONcalib.so libMUONraw.so libMUONtrigger.so libMUONbase.so libMUONsim.so libMUONrec.so libMUONevaluation.so libFMDbase.so libFMDsim.so libFMDrec.so libPMDbase.so libPMDsim.so libPMDrec.so libHMPIDbase.so libHMPIDsim.so libHMPIDrec.so libT0base.so libT0sim.so libT0rec.so libZDCbase.so libZDCsim.so libZDCrec.so libACORDEbase.so libACORDErec.so libACORDEsim.so libVZERObase.so libVZEROrec.so libVZEROsim.so libEMCALraw.so libEMCALUtils.so libEMCALbase.so libEMCALsim.so libEMCALrec.so libTPCbase.so libTPCrec.so libTPCsim.so libTPCfast.so libITSbase.so libITSsim.so libITSrec.so libTRDbase.so libTRDsim.so libTRDrec.so libTOFbase.so libTOFrec.so libTOFsim.so libHLTbase.so libHLTinterface.so libHLTsim.so libHLTrec.so AliCDMesonBaseStripped.h AliCDMesonBaseStripped.cxx AliCDMesonTracks.h AliCDMesonTracks.cxx AliCDMesonUtilsStripped.h AliCDMesonUtilsStripped.cxx AliAnalysisTaskCDex.h AliAnalysisTaskCDex.cxx");

	plugin->AddIncludePath("-I$ALICE_ROOT/ITS -I$ALICE_ROOT/PWGPP/ITS");

	// 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();

	// Optionally set a name for the generated analysis macro (default MyAnalysis.C)
	plugin->SetAnalysisMacro("CDMeson.C");

	// 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("CDMeson.sh");

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

	// 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("CDMeson.jdl");

	// 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");
	// 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("files.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;
}
 runEx.C:1
 runEx.C:2
 runEx.C:3
 runEx.C:4
 runEx.C:5
 runEx.C:6
 runEx.C:7
 runEx.C:8
 runEx.C:9
 runEx.C:10
 runEx.C:11
 runEx.C:12
 runEx.C:13
 runEx.C:14
 runEx.C:15
 runEx.C:16
 runEx.C:17
 runEx.C:18
 runEx.C:19
 runEx.C:20
 runEx.C:21
 runEx.C:22
 runEx.C:23
 runEx.C:24
 runEx.C:25
 runEx.C:26
 runEx.C:27
 runEx.C:28
 runEx.C:29
 runEx.C:30
 runEx.C:31
 runEx.C:32
 runEx.C:33
 runEx.C:34
 runEx.C:35
 runEx.C:36
 runEx.C:37
 runEx.C:38
 runEx.C:39
 runEx.C:40
 runEx.C:41
 runEx.C:42
 runEx.C:43
 runEx.C:44
 runEx.C:45
 runEx.C:46
 runEx.C:47
 runEx.C:48
 runEx.C:49
 runEx.C:50
 runEx.C:51
 runEx.C:52
 runEx.C:53
 runEx.C:54
 runEx.C:55
 runEx.C:56
 runEx.C:57
 runEx.C:58
 runEx.C:59
 runEx.C:60
 runEx.C:61
 runEx.C:62
 runEx.C:63
 runEx.C:64
 runEx.C:65
 runEx.C:66
 runEx.C:67
 runEx.C:68
 runEx.C:69
 runEx.C:70
 runEx.C:71
 runEx.C:72
 runEx.C:73
 runEx.C:74
 runEx.C:75
 runEx.C:76
 runEx.C:77
 runEx.C:78
 runEx.C:79
 runEx.C:80
 runEx.C:81
 runEx.C:82
 runEx.C:83
 runEx.C:84
 runEx.C:85
 runEx.C:86
 runEx.C:87
 runEx.C:88
 runEx.C:89
 runEx.C:90
 runEx.C:91
 runEx.C:92
 runEx.C:93
 runEx.C:94
 runEx.C:95
 runEx.C:96
 runEx.C:97
 runEx.C:98
 runEx.C:99
 runEx.C:100
 runEx.C:101
 runEx.C:102
 runEx.C:103
 runEx.C:104
 runEx.C:105
 runEx.C:106
 runEx.C:107
 runEx.C:108
 runEx.C:109
 runEx.C:110
 runEx.C:111
 runEx.C:112
 runEx.C:113
 runEx.C:114
 runEx.C:115
 runEx.C:116
 runEx.C:117
 runEx.C:118
 runEx.C:119
 runEx.C:120
 runEx.C:121
 runEx.C:122
 runEx.C:123
 runEx.C:124
 runEx.C:125
 runEx.C:126
 runEx.C:127
 runEx.C:128
 runEx.C:129
 runEx.C:130
 runEx.C:131
 runEx.C:132
 runEx.C:133
 runEx.C:134
 runEx.C:135
 runEx.C:136
 runEx.C:137
 runEx.C:138
 runEx.C:139
 runEx.C:140
 runEx.C:141
 runEx.C:142
 runEx.C:143
 runEx.C:144
 runEx.C:145
 runEx.C:146
 runEx.C:147
 runEx.C:148
 runEx.C:149
 runEx.C:150
 runEx.C:151
 runEx.C:152
 runEx.C:153
 runEx.C:154
 runEx.C:155
 runEx.C:156
 runEx.C:157
 runEx.C:158
 runEx.C:159
 runEx.C:160
 runEx.C:161
 runEx.C:162
 runEx.C:163
 runEx.C:164
 runEx.C:165
 runEx.C:166
 runEx.C:167
 runEx.C:168
 runEx.C:169
 runEx.C:170
 runEx.C:171
 runEx.C:172
 runEx.C:173
 runEx.C:174
 runEx.C:175
 runEx.C:176
 runEx.C:177
 runEx.C:178
 runEx.C:179
 runEx.C:180
 runEx.C:181
 runEx.C:182
 runEx.C:183
 runEx.C:184
 runEx.C:185
 runEx.C:186
 runEx.C:187
 runEx.C:188
 runEx.C:189
 runEx.C:190
 runEx.C:191
 runEx.C:192
 runEx.C:193
 runEx.C:194
 runEx.C:195
 runEx.C:196
 runEx.C:197
 runEx.C:198
 runEx.C:199
 runEx.C:200
 runEx.C:201
 runEx.C:202
 runEx.C:203
 runEx.C:204
 runEx.C:205
 runEx.C:206
 runEx.C:207
 runEx.C:208
 runEx.C:209
 runEx.C:210
 runEx.C:211
 runEx.C:212
 runEx.C:213
 runEx.C:214
 runEx.C:215
 runEx.C:216
 runEx.C:217
 runEx.C:218
 runEx.C:219
 runEx.C:220
 runEx.C:221
 runEx.C:222
 runEx.C:223
 runEx.C:224
 runEx.C:225
 runEx.C:226
 runEx.C:227
 runEx.C:228
 runEx.C:229
 runEx.C:230
 runEx.C:231
 runEx.C:232
 runEx.C:233
 runEx.C:234
 runEx.C:235
 runEx.C:236
 runEx.C:237
 runEx.C:238
 runEx.C:239
 runEx.C:240
 runEx.C:241
 runEx.C:242
 runEx.C:243
 runEx.C:244
 runEx.C:245
 runEx.C:246
 runEx.C:247
 runEx.C:248
 runEx.C:249
 runEx.C:250
 runEx.C:251
 runEx.C:252
 runEx.C:253
 runEx.C:254
 runEx.C:255
 runEx.C:256
 runEx.C:257
 runEx.C:258
 runEx.C:259
 runEx.C:260
 runEx.C:261
 runEx.C:262
 runEx.C:263
 runEx.C:264
 runEx.C:265
 runEx.C:266
 runEx.C:267
 runEx.C:268
 runEx.C:269
 runEx.C:270
 runEx.C:271
 runEx.C:272
 runEx.C:273
 runEx.C:274
 runEx.C:275
 runEx.C:276
 runEx.C:277
 runEx.C:278
 runEx.C:279
 runEx.C:280
 runEx.C:281
 runEx.C:282
 runEx.C:283
 runEx.C:284
 runEx.C:285
 runEx.C:286
 runEx.C:287
 runEx.C:288
 runEx.C:289
 runEx.C:290
 runEx.C:291
 runEx.C:292
 runEx.C:293
 runEx.C:294
 runEx.C:295
 runEx.C:296
 runEx.C:297
 runEx.C:298
 runEx.C:299
 runEx.C:300
 runEx.C:301
 runEx.C:302
 runEx.C:303
 runEx.C:304
 runEx.C:305
 runEx.C:306
 runEx.C:307
 runEx.C:308
 runEx.C:309
 runEx.C:310
 runEx.C:311
 runEx.C:312
 runEx.C:313
 runEx.C:314