本文整理汇总了C++中AliAnalysisManager::SetMCtruthEventHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ AliAnalysisManager::SetMCtruthEventHandler方法的具体用法?C++ AliAnalysisManager::SetMCtruthEventHandler怎么用?C++ AliAnalysisManager::SetMCtruthEventHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AliAnalysisManager
的用法示例。
在下文中一共展示了AliAnalysisManager::SetMCtruthEventHandler方法的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: AddTaskPsEfficiency
AliAnalysisTaskPsEfficiency* AddTaskPsEfficiency(bool isMC=true,TString suffix = ""){
// Creates, configures and attaches to the train the task for pi, K , p spectra
// with ITS standalone tracks
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
::Info("AddTaskPsEfficiency","Adding a new task with this settings isMC = %i",isMC);
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
::Error("AddTaskPsEfficiency", "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("AddTaskPsEfficiency", "This task requires an input event handler");
return NULL;
}
TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
if(type.Contains("ESD")){
::Error("AddTaskPsEfficiency", "This task requires to run on AOD");
return NULL;
}
// Add MC handler (for kinematics)
if(isMC){
AliMCEventHandler* handler = new AliMCEventHandler;
handler->SetReadTR(kFALSE);
mgr->SetMCtruthEventHandler(handler);
}
// Create and configure the task
TString tskname = "Pentaquark";
tskname.Append(Form("%s",suffix.Data()));
AliAnalysisTaskPsEfficiency *taskPs = new AliAnalysisTaskPsEfficiency(tskname);
//taskPs->SetMC(isMC);
mgr->AddTask(taskPs);
// 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
//==============================================================================
TString outputFileName = AliAnalysisManager::GetCommonFileName();
outputFileName += ":AODpentaquark";
AliAnalysisDataContainer *coutput =0x0;
coutput = mgr->CreateContainer(Form("lbariogl_%s",tskname.Data()),
TList::Class(),
AliAnalysisManager::kOutputContainer,
AliAnalysisManager::GetCommonFileName());
mgr->ConnectInput(taskPs, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(taskPs, 1, coutput);
return taskPs;
}
示例3: runProofFwdDetsQA
void runProofFwdDetsQA(const char * dataset = "/COMMON/COMMON/LHC09a4_run8101X",Long64_t nentries=100000, Long64_t firstentry=0)
{
gSystem->Load("libANALYSIS");
gSystem->Load("libANALYSISalice");
gSystem->AddIncludePath("-I$ALICE_ROOT/include");
// Connect to Proof
gEnv->SetValue("XSec.GSI.DelegProxy","2");
TProof::Open("cheshkov:[email protected]");
// Upload and enable packages: please use the correct version!
gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-16-Release/AF-v4-16");
gProof->EnablePackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-16-Release/AF-v4-16");
// Create the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("AliAnaFwdDetsQA");
AliVEventHandler* esdH = new AliESDInputHandler();
mgr->SetInputEventHandler(esdH);
// Enable MC event handler
AliVEventHandler* handler = new AliMCEventHandler;
mgr->SetMCtruthEventHandler(handler);
// Create task
gProof->Load(Form("%s/PWGPP/AliAnaFwdDetsQA.cxx++g",
gSystem->Getenv("ALICE_ROOT")));
AliAnalysisTask *task = new AliAnaFwdDetsQA("AliAnaFwdDetsQA");
// Add task
mgr->AddTask(task);
// Create containers for input/output
AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
AliAnalysisDataContainer *coutput =
mgr->CreateContainer("coutput", TList::Class(),
AliAnalysisManager::kOutputContainer, "FwdDetsQA.root");
// Connect input/output
mgr->ConnectInput(task, 0, cinput);
mgr->ConnectOutput(task, 1, coutput);
// Enable debug printouts
mgr->SetDebugLevel(3);
if (!mgr->InitAnalysis())
return;
mgr->PrintStatus();
TFileCollection *proofColl = gProof->GetDataSet(dataset);
TChain *chain = new TChain("esdTree");
chain->AddFileInfoList((TCollection*)(proofColl->GetList()));
mgr->StartAnalysis("proof", chain, nentries, firstentry);
// mgr->StartAnalysis("proof",dataset,nentries,firstentry);
}
示例4: RunLinkToMCAnalysisExample
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);
}
}
示例5: runTOFCalibTaskOnProof
void runTOFCalibTaskOnProof() {
TStopwatch timer;
timer.Start();
printf("*** Open PROOF ***");
gEnv->SetValue("XSec.GSI.DelegProxy","2");
TProof::Open("alicecaf");
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");
gProof->Load("AliTOFArray.cxx++g");
gProof->Load("AliTOFCalibTask.cxx++g");
gROOT->LoadMacro("AddTaskTOFCalib.C");
cout << "Loaded AddTaskTOFCalib macro "<< endl;
gProof->ShowEnabledPackages();
//ANALYSIS PART
//____________________________________________//
// Make the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
AliESDInputHandler* esdH = new AliESDInputHandler;
esdH->SetInactiveBranches("FMD CaloCluster");
mgr->SetInputEventHandler(esdH);
Bool_t domc = kFALSE;
if (domc) {
AliMCEventHandler *mcH = new AliMCEventHandler;
mgr->SetMCtruthEventHandler(mcH);
}
//____________________________________________//
// 1st TOFCalib task
AliTOFCalibTask *taskTOFCalib = AddTaskTOFCalib();
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
mgr->StartAnalysis("proof","/COMMON/COMMON/LHC08c11_10TeV_0.5T",1000);
timer.Stop();
timer.Print();
}
示例6: InputHandlerSetup
Bool_t InputHandlerSetup(TString format = "esd", Bool_t useRP=kFALSE, Bool_t useKine = kFALSE)
{
format.ToLower();
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
AliAnalysisDataContainer *cin = mgr->GetCommonInputContainer();
if (cin) return;
if (!format.CompareTo("esd"))
{
AliESDInputHandler *esdInputHandler = dynamic_cast<AliESDInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
if (!esdInputHandler)
{
Info("CustomAnalysisTaskInputSetup", "Creating esdInputHandler ...");
if (useRP) esdInputHandler = new AliESDInputHandlerRP();
else esdInputHandler = new AliESDInputHandler();
mgr->SetInputEventHandler(esdInputHandler);
}
if (useKine)
{
AliMCEventHandler* mcInputHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
if (!mcInputHandler)
{
Info("CustomAnalysisTaskInputSetup", "Creating mcInputHandler ...");
AliMCEventHandler* mcInputHandler = new AliMCEventHandler();
mgr->SetMCtruthEventHandler(mcInputHandler);
}
}
}
else if (!format.CompareTo("aod"))
{
AliAODInputHandler *aodInputHandler = dynamic_cast<AliAODInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
if (!aodInputHandler)
{
Info("CustomAnalysisTaskInputSetup", "Creating aodInputHandler ...");
aodInputHandler = new AliAODInputHandler();
mgr->SetInputEventHandler(aodInputHandler);
}
}
else
{
Info("Wrong input format!!! Only ESD and AOD are supported. Skipping Task ...");
return kFALSE;
}
return kTRUE;
}
示例7: 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");
}
示例8: runProofT0analysis
void runProofT0analysis(const char * dataset = "/COMMON/COMMON/LHC09a4_10TeV_200k#esdTree",Long64_t nentries=20000, Long64_t firstentry=0)
{
// Connect to Proof
TProof::Open("proof://[email protected]");
//TProof::Open("lxb6046");
// Upload and enable packages: please use the correct version!
gProof->UploadPackage("AF-v4-16");
gProof->EnablePackage("AF-v4-16");
gProof->ShowDataSets();
// Create the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("AliT0MultiplicityTask");
AliVEventHandler* esdH = new AliESDInputHandler();
mgr->SetInputEventHandler(esdH);
// Enable MC event handler
AliVEventHandler* handler = new AliMCEventHandler;
mgr->SetMCtruthEventHandler(handler);
// Create task
// gProof->Load("AliMCComparisonTrack.cxx++g");
gProof->Load("AliT0MultiplicityTask.cxx++g");
AliAnalysisTask *task = new AliT0MultiplicityTask("AliT0MultiplicityTask");
// Add task
mgr->AddTask(task);
// Create containers for input/output
AliAnalysisDataContainer *cinput =
mgr->CreateContainer("cchain", TChain::Class(), AliAnalysisManager::kInputContainer);
AliAnalysisDataContainer *coutput =
mgr->CreateContainer("coutput", TList::Class(),
AliAnalysisManager::kOutputContainer, "MultHist.root");
// Connect input/output
mgr->ConnectInput(task, 0, cinput);
mgr->ConnectOutput(task, 1, coutput);
// Enable debug printouts
mgr->SetDebugLevel(3);
if (!mgr->InitAnalysis())
return;
mgr->PrintStatus();
mgr->StartAnalysis("proof",dataset,nentries,firstentry);
}
示例9: runProofTRDComparison
void runProofTRDComparison(const char *dataset="/PWG0/COMMON/run30000X_10TeV_0.5T",Long64_t nentries=1000, Long64_t firstentry=0)
{
// Connect to Proof
TProof::Open("lxb6046");
// Upload and enable packages: please use the correct version!
gProof->UploadPackage("AF-v4-14");
gProof->EnablePackage("AF-v4-14");
// Create the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("AliTRDComparison");
AliVEventHandler* esdH = new AliESDInputHandler();
mgr->SetInputEventHandler(esdH);
// Enable MC event handler
AliVEventHandler* handler = new AliMCEventHandler;
mgr->SetMCtruthEventHandler(handler);
// Create task
gProof->Load("AliMCComparisonTrack.cxx++g");
gProof->Load("AliTRDComparisonTask.cxx++g");
AliAnalysisTask *task = new AliTRDComparisonTask("AliTRDComparisonTask");
// Add task
mgr->AddTask(task);
// Create containers for input/output
AliAnalysisDataContainer* cinput = mgr->GetCommonInputContainer();
AliAnalysisDataContainer* coutput =
mgr->CreateContainer("coutput", TList::Class(),
AliAnalysisManager::kOutputContainer, "AliTRDComparisonHist.root");
// Connect input/output
mgr->ConnectInput(task, 0, cinput);
mgr->ConnectOutput(task, 1, coutput);
// Enable debug printouts
mgr->SetDebugLevel(3);
if (!mgr->InitAnalysis())
return;
mgr->PrintStatus();
mgr->StartAnalysis("proof",dataset,nentries,firstentry);
}
示例10: AddAnalysisTaskDG
AliAnalysisTaskDG* AddAnalysisTaskDG(Bool_t isMC,
TString branchNames,
TString trackCutType,
TString triggerSelection,
TString triggerSelectionSPD="",
Int_t maxTracksSave=4)
{
// create manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) mgr = new AliAnalysisManager("My test train");
if (isMC) {
AliMCEventHandler* handler = new AliMCEventHandler;
handler->SetReadTR(kFALSE);
mgr->SetMCtruthEventHandler(handler);
}
AliAnalysisTaskDG* task = new AliAnalysisTaskDG;
// task->SelectCollisionCandidates(AliVEvent::kMB);
task->SetIsMC(isMC);
task->SetBranchNames(branchNames);
task->SetTrackCutType(trackCutType);
task->SetTriggerSelection(triggerSelection);
task->SetTriggerSelectionSPD(triggerSelectionSPD);
task->SetMaxTracksSave(maxTracksSave);
Printf("created task");
// OUTPUT --------------------------------------------------------------------
AliAnalysisDataContainer* output1 =
mgr->CreateContainer(task->GetListName(), TList::Class(), AliAnalysisManager::kOutputContainer,
TString(AliAnalysisManager::GetCommonFileName())+":"+task->GetResultsFileName());
AliAnalysisDataContainer* output2 =
mgr->CreateContainer(task->GetTreeName(), TTree::Class(), AliAnalysisManager::kOutputContainer,
TString(AliAnalysisManager::GetCommonFileName())+":"+task->GetResultsFileName());
mgr->AddTask(task);
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(task, 1, output1);
mgr->ConnectOutput(task, 2, output2);
Printf("set up task connections");
Printf("--------------------------------------------------------------------------------");
return task;
}
示例11: CreateInputHandlers
Bool_t CreateInputHandlers(TString input,TString inputMC,Bool_t useAODOut=kFALSE,Bool_t useMultiHandler=kTRUE) {
input.ToLower();
inputMC.ToLower();
Bool_t useMC = !inputMC.CompareTo("mc");
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) { Printf("Error [CreateInputHandlers] : mgr is null !!!"); return kFALSE; }
if (useMultiHandler) {
AliMultiInputEventHandler *inputHandler = new AliMultiInputEventHandler();
if (!input.CompareTo("esd")) {
Printf("Adding ESD Input Handler ...");
inputHandler->AddInputEventHandler(new AliESDInputHandler());
if (useMC) inputHandler->AddInputEventHandler(new AliMCEventHandler());
} else if (!input.CompareTo("aod")) {
inputHandler->AddInputEventHandler(new AliAODInputHandler());
}
mgr->SetInputEventHandler(inputHandler);
} else {
if (!input.CompareTo("esd")) {
mgr->SetInputEventHandler(new AliESDInputHandler());
if (useMC) mgr->SetMCtruthEventHandler(new AliMCEventHandler());
} else if (!input.CompareTo("aod")) {
mgr->SetInputEventHandler(new AliAODInputHandler());
}
}
if (useAODOut) {
AliAODHandler *aodHandler = new AliAODHandler();
aodHandler->SetOutputFileName("AliAOD.root");
mgr->SetOutputEventHandler(aodHandler);
}
return kTRUE;
}
示例12: AliAnalysisTaskHypCrossCheck
AliAnalysisTaskHypCrossCheck *AddTaskHypCrossCheck(Bool_t readMC=kFALSE,
Bool_t fillTree=kFALSE,
Bool_t fillGen=kFALSE,
TString suffix = ""){
// Creates, configures and attaches to the train the task for pi, K , p spectra
// with ITS standalone tracks
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
::Info("AddTaskHypCrossCheck","Adding a new task with this settings readMC = %i",readMC);
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
::Error("AddTaskHypCrossCheck", "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("AddTaskHypCrossCheck", "This task requires an input event handler");
return NULL;
}
TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
if(type.Contains("AOD")){
::Error("AddTaskHypCrossCheck", "This task requires to run on ESD");
return NULL;
}
// Add MC handler (for kinematics)
if(readMC){
AliMCEventHandler* handler = new AliMCEventHandler;
handler->SetReadTR(kFALSE);
mgr->SetMCtruthEventHandler(handler);
}
// Create and configure the task
TString tskname = "hypertriton";
tskname.Append(Form("%s",suffix.Data()));
AliAnalysisTaskHypCrossCheck *taskhyp = new AliAnalysisTaskHypCrossCheck();
Float_t p[5] = {7.25105e-01,4.99820e+01,2.35714e-10,2.49196e+00,1.41570e+01};
taskhyp->SetCustomTPCpid(p,0.08f);
mgr->AddTask(taskhyp);
// 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
//==============================================================================
TString outputFileName = AliAnalysisManager::GetCommonFileName();
outputFileName += ":ESDHypertriton";
AliAnalysisDataContainer *coutput =0x0;
coutput = mgr->CreateContainer(Form("strogolo_%s",tskname.Data()),
TList::Class(),
AliAnalysisManager::kOutputContainer,
AliAnalysisManager::GetCommonFileName());
mgr->ConnectInput(taskhyp, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(taskhyp, 1, coutput);
if(fillTree){
AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("trogolo_HyperTree", TTree::Class(),
AliAnalysisManager::kOutputContainer,
"trogolo_HyperNt.root");
coutput2->SetSpecialOutput();
mgr->ConnectOutput(taskhyp,2, coutput2);
}
if(fillGen){
AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("trogolo_HyperGen",TTree::Class(),
AliAnalysisManager::kOutputContainer,
"trogolo_HyperGen.root");
coutput3->SetSpecialOutput();
mgr->ConnectOutput(taskhyp,3,coutput3);
}
return taskhyp;
}
示例13: runLocal
void runLocal(const char *chainlistfile, int dataFromAlien=0) {
TStopwatch timer;
timer.Start();
printf("*** Connect to AliEn ***\n");
if (dataFromAlien)
TGrid::Connect("alien://");
gSystem->Load("libProofPlayer");
//____________________________________________________//
//_____________Setting up STEERBase.par_______________//
//____________________________________________________//
setupPar("STEERBase");
gSystem->Load("libSTEERBase");
//____________________________________________________//
//_____________Setting up ESD.par_____________________//
//____________________________________________________//
setupPar("ESD");
gSystem->Load("libVMC");
gSystem->Load("libESD");
//____________________________________________________//
//_____________Setting up AOD.par_____________________//
//____________________________________________________//
setupPar("AOD");
gSystem->Load("libAOD");
//_________________________________________________________//
//_____________Setting up ANALYSIS.par_____________________//
//_________________________________________________________//
setupPar("ANALYSIS");
gSystem->Load("libANALYSIS");
//_________________________________________________________//
//_____________Setting up ANALYSISalice.par________________//
//_________________________________________________________//
setupPar("ANALYSISalice");
gSystem->Load("libANALYSISalice");
//____________________________________________________//
//_____________Setting up PWG2AOD.par_________________//
//____________________________________________________//
setupPar("PWG2AOD");
gSystem->Load("libPWG2AOD");
//____________________________________________________//
//_____________Setting up PWG2femtoscopy.par__________//
//____________________________________________________//
setupPar("PWG2femtoscopy");
gSystem->Load("libPWG2femtoscopy");
//____________________________________________________//
//_____________Setting up PWG2femtoscopyUser.par______//
//____________________________________________________//
setupPar("PWG2femtoscopyUser");
gSystem->Load("libPWG2femtoscopyUser");
//ANALYSIS PART
gSystem->SetIncludePath("-I$ROOTSYS/include -I\"/usr/local/CERN/root/include\" -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I./ESD -I./AOD -I./ANALYSIS -I./PWG2AOD/AOD");
gROOT->LoadMacro("ConfigFemtoAnalysis.C++");
//____________________________________________//
//Usage of event tags
AliTagAnalysis *analysis = new AliTagAnalysis();
TChain *chain = 0x0;
// chain = analysis->GetChainFromCollection(collectionfile,"esdTree");
if (dataFromAlien) {
AliTagAnalysis *analysis = new AliTagAnalysis();
chain = analysis->GetChainFromCollection(chainlistfile,"esdTree");
}
else {
gROOT->LoadMacro("CreateESDChain.C");
chain = CreateESDChain(chainlistfile,500);
}
//____________________________________________//
// Make the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
AliESDInputHandler* esdH = new AliESDInputHandler;
AliMCEventHandler *mcH = new AliMCEventHandler;
esdH->SetInactiveBranches("FMD CaloCluster");
mgr->SetInputEventHandler(esdH);
mgr->SetMCtruthEventHandler(mcH);
//____________________________________________//
// 1st Pt task
AliAnalysisTaskFemto *task1 = new AliAnalysisTaskFemto("TaskFemto");
mgr->AddTask(task1);
// Create containers for input/output
// AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("input0",
TTree::Class(), AliAnalysisManager::kInputContainer);
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"Femto.ESD.root");
//____________________________________________//
cinput1->SetData(chain);
//.........这里部分代码省略.........
示例14: QAtrainAOD
void QAtrainAOD(Bool_t isMC=kFALSE, Int_t iCollisionType=0){
if(gSystem->Getenv("ALIEN_JDL_LPMINTERACTIONTYPE")){
for (Int_t icoll = 0; icoll < kNSystem; icoll++)
if (strcmp(gSystem->Getenv("ALIEN_JDL_LPMINTERACTIONTYPE"), CollisionSystem[icoll]) == 0){
iCollisionType = icoll;
break;
}
}
printf("--------------------------------------\n");
if(isMC) printf("Run the AOD QA train for Monte Carlo\n");
else printf("Run the AOD QA train for data\n");
printf("Collision System is %s\n",CollisionSystem[iCollisionType]);
printf("--------------------------------------\n");
UInt_t kTriggerMask = AliVEvent::kINT7 | AliVEvent::kINT8;
if(gSystem->Getenv("ALIEN_JDL_LPMANCHORYEAR"))
{
Int_t year = atoi(gSystem->Getenv("ALIEN_JDL_LPMANCHORYEAR"));
if(year <= 2015)
kTriggerMask = AliVEvent::kAnyINT;
}
// Create manager
AliAnalysisManager *mgr = new AliAnalysisManager("QAtrainAOD", "AOD QA train");
mgr->SetCacheSize(0);
mgr->SetCommonFileName("QAresults_AOD.root");
// Input handler
AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
AliAODInputHandler* aodHandler = new AliAODInputHandler();
mgr->SetInputEventHandler(aodHandler);
if(isMC){
AliMCEventHandler* MChandler = new AliMCEventHandler;
MChandler->SetReadTR(kFALSE);
mgr->SetMCtruthEventHandler(MChandler);
}
TString macroName="";
// Physics selection
gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskPhysicsSelection.C");
AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(isMC);
mgr->AddStatisticsTask(kTriggerMask);
AliAnalysisDataContainer *cstatsout = (AliAnalysisDataContainer*)mgr->GetOutputs()->FindObject("cstatsout");
cstatsout->SetFileName("EventStat_temp_AOD.root");
// PID response
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
AliAnalysisTaskSE *setupTask = AddTaskPIDResponse(isMC);
// PIDqa
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
PIDQA->SelectCollisionCandidates(AliVEvent::kAny);
// MultSelection
gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C");
AliMultSelectionTask *taskMult = AddTaskMultSelection();
if(isMC){
if (gSystem->Getenv("CONFIG_PERIOD")){
TString periodName = gSystem->Getenv("CONFIG_PERIOD");
taskMult->SetAlternateOADBforEstimators(periodName);
}
}
// Vertex QA
macroName="$ALICE_PHYSICS/PWGPP/macros/AddTaskCheckVertexAOD.C";
if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
gROOT->LoadMacro(macroName.Data());
Double_t maxMult=500.;
if(iCollisionType==kPbPb || iCollisionType==kXeXe) maxMult=10000.;
AliAnalysisTaskCheckVertexAOD *taskVert = AddTaskCheckVertexAOD("QA",maxMult,AliVEvent::kAnyINT,isMC);
}else{
printf("Macro %s not found -> task will not be executed\n",macroName.Data());
}
// Track QA
macroName="$ALICE_PHYSICS/PWGPP/macros/AddTaskCheckAODTracks.C";
if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
gROOT->LoadMacro(macroName.Data());
Bool_t usMCtruthForPID=isMC;
AliAnalysisTaskCheckAODTracks* taskAODtr = AddTaskCheckAODTracks("QA",isMC,usMCtruthForPID);
if(iCollisionType==kPbPb || iCollisionType==kXeXe) taskAODtr->SetUpperMultiplicity(10000.);
}else{
printf("Macro %s not found -> task will not be executed\n",macroName.Data());
}
// HF deltaAOD QA
macroName="$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskBasicHFQA.C";
if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
gROOT->LoadMacro(macroName.Data());
AliAnalysisTaskSEHFQA* dqaHF = AddTaskBasicHFQA(AliAnalysisTaskSEHFQA::kD0toKpi,isMC,"QA");
}else{
printf("Macro %s not found -> task will not be executed\n",macroName.Data());
}
if(isMC){
macroName="$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskDmesonMCPerform.C";
if(gSystem->Exec(Form("ls %s > /dev/null 2>&1",macroName.Data()))==0){
//.........这里部分代码省略.........
示例15: AliFatal
AliAnalysisTaskOmegaOmegaOX *AddTaskOmegaOmegaOX(TString finname="",
Bool_t readMC=kFALSE,
Bool_t additionalChecks=kFALSE,
TString suffix = ""){
//------------------------------------------------------------------------------------------
// version 2.10 (2016/02/11)
//------------------------------------------------------------------------------------------
Bool_t stdcuts=kFALSE;
TFile* filecuts;
if( finname.EqualTo("") ) {
stdcuts=kTRUE;
} else {
filecuts=TFile::Open(finname.Data());
if(!filecuts ||(filecuts&& !filecuts->IsOpen())){
AliFatal("Input file not found : check your cut object");
}
}
// Creates, configures and attaches to the train the task for pi, K , p spectra
// with ITS standalone tracks
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
::Info("AddTaskOmegaOmegaOX","Adding a new task with this settings readMC = %i",readMC);
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
::Error("AddTaskOmegaOmegaOX", "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("AddTaskOmegaOmegaOX", "This task requires an input event handler");
return NULL;
}
TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
if(type.Contains("AOD")){
::Error("AddTaskOmegaOmegaOX", "This task requires to run on ESD");
return NULL;
}
// Add MC handler (for kinematics)
if(readMC){
AliMCEventHandler* handler = new AliMCEventHandler;
handler->SetReadTR(kFALSE);
mgr->SetMCtruthEventHandler(handler);
}
// Create and configure the task
TString taskname = "OmegaOmegaOX";
TString combinedName;
combinedName.Form("OmegaOmegaOX%s", suffix.Data());
AliAnalysisTaskOmegaOmegaOX *task = new AliAnalysisTaskOmegaOmegaOX(combinedName);
task->SetMC(readMC);
mgr->AddTask(task);
// 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
//==============================================================================
TString outputFileName = AliAnalysisManager::GetCommonFileName();
outputFileName += ":Dibaryon";
mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(Form("CutPar_%s",combinedName.Data()), TTree::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
mgr->ConnectOutput(task, 1, coutput1);
AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("Vertex_%s",combinedName.Data()), TTree::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
// coutput2->SetSpecialOutput();
mgr->ConnectOutput(task, 2, coutput2);
return task;
}