本文整理汇总了C++中AliAnalysisManager::GetTask方法的典型用法代码示例。如果您正苦于以下问题:C++ AliAnalysisManager::GetTask方法的具体用法?C++ AliAnalysisManager::GetTask怎么用?C++ AliAnalysisManager::GetTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AliAnalysisManager
的用法示例。
在下文中一共展示了AliAnalysisManager::GetTask方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddTaskEmcalJetCDFUE
/// Add a AliAnalysisTaskEmcalJetCDFUE task - info from char* taskname
/// \param const char* taskname ; to be retrieved from list of tasks
/// \param Double_t jetptcut
/// \param Double_t jetareacut
/// \param const char *type ; either TPC, EMCAL or USER
/// \param Int_t leadhadtype ; 0 = charged, 1 = neutral, 2 = both
/// \param const char *nrho
/// \param const char *taskname
/// \return AliAnalysisTaskEmcalJetCDFUE* task
AliAnalysisTaskEmcalJetCDFUE *AddTaskEmcalJetCDFUE ( const char* taskname,
Double_t jetptcut = 1.,
Double_t jetptcutmax = 250.,
Double_t jetareacut = 0.001,
const char *type = "TPC", // EMCAL, TPC
Int_t leadhadtype = 0, // AliJetContainer :: Int_t fLeadingHadronType; 0 = charged, 1 = neutral, 2 = both
const char *nrho = "",
const char *taskname = "JetCDF" )
{
AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) { ::Error("AddTaskEmcalJetCDF", "No analysis manager to connect to."); }
AliEmcalJetTask* jf = dynamic_cast<AliEmcalJetTask*>(mgr->GetTask(taskname));
if (!jf) { AliError("AddTaskEmcalJetCDF :: task is not EmcalJetTask");}
const char *ntracks = jf->GetTracksName();
const char *nclusters = jf->GetClusName();
const char *njets = jf->GetJetsName();
Double_t jetradius = jf->GetRadius();
return AddTaskEmcalJetCDFUE ( ntracks , nclusters, njets, nrho, jetradius, jetptcut, jetptcutmax, jetareacut, type, leadhadtype, taskname );
}
示例2: AddAnalysisTasks
//.........这里部分代码省略.........
AliMuonTrackCuts *trackCuts = 0x0;
if (iMUONEfficiency) {
trackCuts = new AliMuonTrackCuts("stdCuts", "stdCuts");
trackCuts->SetAllowDefaultParams();
trackCuts->SetFilterMask(AliMuonTrackCuts::kMuMatchLpt | AliMuonTrackCuts::kMuEta | AliMuonTrackCuts::kMuThetaAbs | AliMuonTrackCuts::kMuPdca);
trackCuts->SetIsMC(kTRUE);
}
if (iMUONRefit) {
if (iMUONRefit > 1) gROOT->LoadMacro("AddTaskMuonRefit.C");
else gROOT->LoadMacro("$ALICE_PHYSICS/PWG/muondep/AddTaskMuonRefit.C");
AliAnalysisTaskMuonRefit* refit = AddTaskMuonRefit(-1., -1., kTRUE, -1., -1.);
if (!defaultStorage.IsNull()) refit->SetDefaultStorage(defaultStorage.Data());
if (!alignStorage.IsNull()) refit->SetAlignStorage(alignStorage.Data());
refit->RemoveMonoCathodClusters(kTRUE, kFALSE);
}
if (iMUONRefitVtx) {
if (iMUONRefitVtx > 1) gROOT->LoadMacro("AddTaskMuonRefitVtx.C");
else gROOT->LoadMacro("$ALICE_PHYSICS/PWG/muondep/AddTaskMuonRefitVtx.C");
AliAnalysisTaskMuonRefitVtx* refitVtx = AddTaskMuonRefitVtx(kFALSE, kFALSE, kTRUE);
if (!defaultStorage.IsNull()) refitVtx->SetDefaultStorage(defaultStorage.Data());
}
if(iESDMCLabelAddition) {
if(iESDMCLabelAddition > 1) gROOT->LoadMacro("AddTaskESDMCLabelAddition.C");
else gROOT->LoadMacro("$ALICE_PHYSICS/PWG/muondep/AddTaskESDMCLabelAddition.C");
AliAnalysisTaskESDMCLabelAddition *esdmclabel = AddTaskESDMCLabelAddition();
if (!defaultStorage.IsNull()) esdmclabel->SetDefaultStorage(defaultStorage.Data());
if (!alignStorage.IsNull()) esdmclabel->SetAlignStorage(alignStorage.Data());
if (!recoParamStorage.IsNull()) esdmclabel->SetRecoParamStorage(recoParamStorage.Data());
esdmclabel->DecayAsFake(kTRUE);
}
if (iMUONQA) {
if (iMUONQA > 1) gROOT->LoadMacro("AddTaskMuonQA.C");
else gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskMuonQA.C");
AliAnalysisTaskMuonQA* muonQA = AddTaskMuonQA(kFALSE);
if (usePhysicsSelection) muonQA->SelectCollisionCandidates(offlineTriggerMask);
muonQA->SetTrackCuts(trackCuts);
}
if (useMC && useTR && iMUONPerformance) {
if (iMUONPerformance > 1) gROOT->LoadMacro("AddTaskMuonPerformance.C");
else gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/MUON/dep/AddTaskMuonPerformance.C");
AliAnalysisTaskMuonPerformance* muonPerformance = AddTaskMuonPerformance();
if (usePhysicsSelection) muonPerformance->SelectCollisionCandidates(offlineTriggerMask);
if (!defaultStorage.IsNull()) muonPerformance->SetDefaultStorage(defaultStorage.Data());
if (!alignStorage.IsNull()) muonPerformance->SetAlignStorage(alignStorage.Data());
if (!recoParamStorage.IsNull()) muonPerformance->SetRecoParamStorage(recoParamStorage.Data());
muonPerformance->UseMCKinematics(kTRUE);
muonPerformance->SetMCTrigLevelFromMatchTrk(kTRUE);
}
if (iMUONEfficiency) {
if (iMUONEfficiency > 1) gROOT->LoadMacro("AddTaskMUONTrackingEfficiency.C");
else gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/MUON/dep/AddTaskMUONTrackingEfficiency.C");
AliAnalysisTaskMuonTrackingEff* muonEfficiency = AddTaskMUONTrackingEfficiency(kFALSE,kTRUE,"");
if (usePhysicsSelection) muonEfficiency->SelectCollisionCandidates(offlineTriggerMask);
if (!defaultStorage.IsNull()) muonEfficiency->SetDefaultStorage(defaultStorage.Data());
if (!alignStorage.IsNull()) muonEfficiency->SetAlignStorage(alignStorage.Data());
if (!recoParamStorage.IsNull()) muonEfficiency->SetRecoParamStorage(recoParamStorage.Data());
muonEfficiency->SetMuonTrackCuts(*trackCuts);
muonEfficiency->SetMuonPtCut(VAR_EFFTASK_PTMIN);
muonEfficiency->UseMCLabel(kTRUE);
muonEfficiency->EnableDisplay(kFALSE);
}
TString addExtraTasks = VAR_EXTRATASKS_CONFIGMACRO;
if (!addExtraTasks.IsNull()) gROOT->ProcessLineSync(TString::Format(".x %s",addExtraTasks.Data()));
if (iESDfilter) {
// ESD filter task configuration.
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C");
if (iMUONcopyAOD) {
printf("Registering delta AOD file\n");
mgr->RegisterExtraFile("AliAOD.Muons.root");
}
AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, iMUONcopyAOD, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kTRUE,kTRUE,1500,VAR_MUONMCMODE,kFALSE,kFALSE,kTRUE,kFALSE); // others
taskesdfilter->DisablePmdClusters();
taskesdfilter->DisableCaloClusters();
taskesdfilter->DisableCells();
taskesdfilter->DisableCaloTrigger("PHOS");
taskesdfilter->DisableCaloTrigger("EMCAL");
taskesdfilter->SetPropagateTrackToEMCal(kFALSE);
if ( 0 && VAR_USE_ITS_RECO ) /* 0 for the moment to get this macro running also with AliRoot <= .... */
{
AliAnalysisTaskESDMuonFilter* muFilter = mgr->GetTask("ESD Muon Filter");
if ( !muFilter )
{
std::cout << "ERROR : got a NULL muFilter ! so I cannot ask to keep SPD tracklets !" << std::endl;
}
else
{
muFilter->SetWithSPDtracklets(kTRUE);
}
}
}
}
示例3: AddTaskRho
AliAnalysisTaskRho* AddTaskRho (
const char *nJets = "Jets",
const char *nTracks = "PicoTracks",
const char *nClusters = "CaloClusters",
const char *nRho = "Rho",
Double_t jetradius = 0.2,
const char *cutType = "TPC",
Double_t jetareacut = 0.01,
Double_t emcareacut = 0,
TF1 *sfunc = 0,
const UInt_t exclJets = 2,
const Bool_t histo = kFALSE,
const char *suffix = ""
)
{
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr)
{
::Error("AddTaskRho", "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("AddTaskRho", "This task requires an input event handler");
return NULL;
}
//-------------------------------------------------------
// Init the task and do settings
//-------------------------------------------------------
TString name(Form("AliAnalysisTaskRho_%s_%s", nJets,cutType));
if (strcmp(suffix,"") != 0) {
name += "_";
name += suffix;
}
AliAnalysisTaskRho* mgrTask = mgr->GetTask(name.Data());
if (mgrTask) return mgrTask;
AliAnalysisTaskRho *rhotask = new AliAnalysisTaskRho(name, histo);
rhotask->SetExcludeLeadJets(exclJets);
rhotask->SetScaleFunction(sfunc);
rhotask->SetOutRhoName(nRho);
AliParticleContainer *trackCont = rhotask->AddParticleContainer(nTracks);
AliClusterContainer *clusterCont = rhotask->AddClusterContainer(nClusters);
AliJetContainer *jetCont = rhotask->AddJetContainer(nJets,cutType,jetradius);
if (jetCont) {
jetCont->SetJetAreaCut(jetareacut);
jetCont->SetAreaEmcCut(emcareacut);
jetCont->SetJetPtCut(0);
jetCont->ConnectParticleContainer(trackCont);
jetCont->ConnectClusterContainer(clusterCont);
}
//-------------------------------------------------------
// Final settings, pass to manager and set the containers
//-------------------------------------------------------
mgr->AddTask(rhotask);
// Create containers for input/output
mgr->ConnectInput(rhotask, 0, mgr->GetCommonInputContainer());
if (histo) {
TString contname(name);
contname += "_histos";
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
TList::Class(),AliAnalysisManager::kOutputContainer,
Form("%s", AliAnalysisManager::GetCommonFileName()));
mgr->ConnectOutput(rhotask, 1, coutput1);
}
return rhotask;
}
示例4: AddTask_GammaConvDalitzV1_pp
void AddTask_GammaConvDalitzV1_pp( Int_t trainConfig = 1, //change different set of cuts
Bool_t isMC = kFALSE, //run MC
TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
Int_t enableMatBudWeightsPi0 = 0, // 1 = three radial bins, 2 = 10 radial bins
TString filenameMatBudWeights = "MCInputFileMaterialBudgetWeights.root"
) {
Int_t isHeavyIon = 0;
// ================== GetAnalysisManager ===============================
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error(Form("AddTask_GammaConvDalitzV1_%i",trainConfig), "No analysis manager found.");
return ;
}
// ================== GetInputEventHandler =============================
AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
//========= Add PID Reponse to ANALYSIS manager ====
if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
AddTaskPIDResponse(isMC);
}
//========= Set Cutnumber for V0Reader ================================
//TString cutnumber = "00000000000840010015000000";
TString cutnumberPhoton = "06000008400100007500000000";
TString cutnumberEvent = "00000103";
AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
//========= Add V0 Reader to ANALYSIS manager if not yet existent =====
TString V0ReaderName = Form("V0ReaderV1_%s_%s",cutnumberEvent.Data(),cutnumberPhoton.Data());
if( !(AliV0ReaderV1*)mgr->GetTask(V0ReaderName.Data()) ){
AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1(V0ReaderName.Data());
fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
AliConvEventCuts *fEventCuts=NULL;
if(cutnumberEvent!=""){
fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
fEventCuts->SetPreSelectionCutFlag(kTRUE);
fEventCuts->SetV0ReaderName(V0ReaderName);
if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
fV0ReaderV1->SetEventCuts(fEventCuts);
fEventCuts->SetFillCutHistograms("",kTRUE);
}
}
// Set AnalysisCut Number
AliConversionPhotonCuts *fCuts=NULL;
if(cutnumberPhoton!=""){
fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
fCuts->SetPreSelectionCutFlag(kTRUE);
fCuts->SetIsHeavyIon(isHeavyIon);
fCuts->SetV0ReaderName(V0ReaderName);
if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
fV0ReaderV1->SetConversionCuts(fCuts);
fCuts->SetFillCutHistograms("",kTRUE);
}
}
if(inputHandler->IsA()==AliAODInputHandler::Class()){
// AOD mode
fV0ReaderV1->AliV0ReaderV1::SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
}
fV0ReaderV1->Init();
AliLog::SetGlobalLogLevel(AliLog::kInfo);
//connect input V0Reader
mgr->AddTask(fV0ReaderV1);
mgr->ConnectInput(fV0ReaderV1,0,cinput);
}
if( !(AliDalitzElectronSelector*)mgr->GetTask("ElectronSelector") ){
AliDalitzElectronSelector *fElectronSelector = new AliDalitzElectronSelector("ElectronSelector");
//ConfigV0ReaderV1(fV0ReaderV1,ConvCutnumber,IsHeavyIon);
// Set AnalysisCut Number
AliDalitzElectronCuts *fElecCuts=0;
TString ElecCuts = "30105400000003300000";
if( ElecCuts!=""){
fElecCuts= new AliDalitzElectronCuts(ElecCuts.Data(),ElecCuts.Data());
if(fElecCuts->InitializeCutsFromCutString(ElecCuts.Data())){
fElectronSelector->SetDalitzElectronCuts(fElecCuts);
fElecCuts->SetFillCutHistograms("",kTRUE);
}
}
fElectronSelector->Init();
mgr->AddTask(fElectronSelector);
//connect input fElectronSelector
//.........这里部分代码省略.........
示例5: AddRsnEventComputations
Bool_t AddRsnEventComputations(Bool_t isMC, const char *options = "", const char *taskName = "RSNtask")
{
// ==================================================================================================================
// == PRELIMINARY OPERATIONS ========================================================================================
// ==================================================================================================================
// retrieve task from manager, using its name
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
AliRsnAnalysisTask *task = (AliRsnAnalysisTask*)mgr->GetTask(taskName);
if (!task) {
Error("RsnConfigMonitor", "Task not found");
return kFALSE;
}
TString opt(options);
opt.ToUpper();
opt.ReplaceAll(" ", "");
Bool_t central = opt.Contains("CENT");
Bool_t peripheral = opt.Contains("PERI");
// ==================================================================================================================
// == EVENT CUTS ====================================================================================================
// ==================================================================================================================
// event cuts are added directly to a cutSet in the task
// we create all and then add thos which are needed
// primary vertex:
// - 2nd argument --> |Vz| range
// - 3rd argument --> minimum required number of contributors
// - 4th argument --> tells if TPC stand-alone vertexes must be accepted
// we switch on the check for pileup
AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
cutVertex->SetCheckPileUp(kTRUE);
// centrality:
// - 2nd argument --> one of the centrality evaluation methods
// - 3rd, 4th argument --> centrality ranges in percentile (0-10 for central, 60-70 for peripheral)
AliRsnCutValue *cutCentrality = 0x0;
if (central)
cutCentrality = new AliRsnCutValue("cutCentral", AliRsnValue::kEventCentralityV0, 0.0, 10.0);
else if (peripheral)
cutCentrality = new AliRsnCutValue("cutPeripheral", AliRsnValue::kEventCentralityV0, 60.0, 70.0);
// primary vertex is always used
task->GetEventCuts()->AddCut(cutVertex);
// set cut scheme as AND of primary vertex and centrality, if initialized
if (cutCentrality) {
task->GetEventCuts()->AddCut(cutCentrality);
task->GetEventCuts()->SetCutScheme(Form("%s & %s", cutVertex->GetName(), cutCentrality->GetName()));
} else {
task->GetEventCuts()->SetCutScheme(cutVertex->GetName());
}
::Info("AddEventStuff", "Scheme for event cuts: %s", task->GetEventCuts()->GetCutScheme().Data());
// ==================================================================================================================
// == EVENT FUNCTIONS ===============================================================================================
// ==================================================================================================================
// we want to add an AliRsnFunction to compute multiplicity distribution
// it is needed in order to know how many events we have in each multiplicity bin
// axes
AliRsnValue *axisEvMultSPD = new AliRsnValue("MultSPD", AliRsnValue::kEventMultSPD, 0.0, 150.0, 1.0);
AliRsnValue *axisEvMultMC = new AliRsnValue("MultMC" , AliRsnValue::kEventMultMC , 0.0, 150.0, 1.0);
// create function and add axis
AliRsnFunction *fcnEv = new AliRsnFunction;
if (!fcnEv->AddAxis(axisEvMultSPD)) return kFALSE;
if (isMC && !fcnEv->AddAxis(axisEvMultMC)) return kFALSE;
// add functions to pairs
task->GetInfo()->AddEventFunction(fcnEv);
return kTRUE;
}
示例6: AddTaskRhoSparse
AliAnalysisTaskRhoSparse* AddTaskRhoSparse(
const char *nJetsBkg = "JetsBkg",
const char *nJetsSig = "JetsSig",
const char *nTracks = "PicoTracks",
const char *nClusters = "CaloClusters",
const char *nRho = "Rho",
Double_t jetradius = 0.2,
const char *cutType = "TPC",
Double_t jetareacut = 0.01,
Double_t jetptcut = 0.0,
Double_t emcareacut = 0,
TF1 *sfunc = 0x0,
const UInt_t exclJets = 2,
const Bool_t histo = kFALSE,
const char *taskname = "Rho",
const Bool_t fRhoCMS = kTRUE
)
{
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr)
{
::Error("AddTaskRhoSparse", "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("AddTaskRhoSparse", "This task requires an input event handler");
return NULL;
}
//-------------------------------------------------------
// Init the task and do settings
//-------------------------------------------------------
TString name(Form("%s_%s_%s", taskname, nJetsBkg,cutType));
AliAnalysisTaskRhoSparse* mgrTask = static_cast<AliAnalysisTaskRhoSparse *>(mgr->GetTask(name.Data()));
if (mgrTask) return mgrTask;
AliAnalysisTaskRhoSparse *rhotask = new AliAnalysisTaskRhoSparse(name, histo);
rhotask->SetHistoBins(1000,-0.1,9.9);
rhotask->SetRhoCMS(fRhoCMS);
rhotask->SetExcludeLeadJets(exclJets);
rhotask->SetScaleFunction(sfunc);
rhotask->SetOutRhoName(nRho);
AliParticleContainer *trackCont = rhotask->AddParticleContainer(nTracks);
AliClusterContainer *clusterCont = rhotask->AddClusterContainer(nClusters);
AliJetContainer *bkgJetCont = rhotask->AddJetContainer(nJetsBkg,cutType,jetradius);
if (bkgJetCont) {
bkgJetCont->SetJetAreaCut(jetareacut);
bkgJetCont->SetAreaEmcCut(emcareacut);
bkgJetCont->SetJetPtCut(0.);
bkgJetCont->ConnectParticleContainer(trackCont);
bkgJetCont->ConnectClusterContainer(clusterCont);
}
AliJetContainer *sigJetCont = rhotask->AddJetContainer(nJetsSig,cutType,jetradius);
if (sigJetCont) {
sigJetCont->SetJetAreaCut(jetareacut);
sigJetCont->SetAreaEmcCut(emcareacut);
sigJetCont->SetJetPtCut(jetptcut);
sigJetCont->ConnectParticleContainer(trackCont);
sigJetCont->ConnectClusterContainer(clusterCont);
}
//-------------------------------------------------------
// Final settings, pass to manager and set the containers
//-------------------------------------------------------
rhotask->SetSmallSystem(fRhoCMS);
mgr->AddTask(rhotask);
// Create containers for input/output
mgr->ConnectInput(rhotask, 0, mgr->GetCommonInputContainer());
if (histo) {
TString contname(name);
contname += "_histos";
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
TList::Class(),AliAnalysisManager::kOutputContainer,
Form("%s", AliAnalysisManager::GetCommonFileName()));
mgr->ConnectOutput(rhotask, 1, coutput1);
}
return rhotask;
}
示例7: AddTaskBJetTC
AliAnalysisTaskBJetTC* AddTaskBJetTC(
const char *ntracks = "PicoTracks",
const char *nclusters = "",
const char *njets = "Jets",
const char *nrho = "",
Double_t jetradius = 0.4,
Bool_t isMC = kFALSE,
const char * type = "TPC",
const char *taskname = "AliAnalysisTaskBJetTC",
const char *njetsMC = "Jets",
const char *nrhoMC = "RhoMC",
Bool_t V0PhotonRejection = kFALSE,
Bool_t DoPtRelAna = kFALSE,
Bool_t DoJetProb = kFALSE,
TString pathToResolFunc = "",
Int_t ptHardBin = -999,
const char* suffix = "")
{
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr)
{
::Error("AddTaskEmcalJetSample", "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("AddTaskEmcalJetSample", "This task requires an input event handler");
return NULL;
}
if(V0PhotonRejection){
//========= Set Cutnumber for V0Reader ================================
TString cutnumberAODBranch = "8000000060084000001500000"; // cutnumber for AOD branch
//TString cutnumberAODBranch = "00000003_06000008400100001000000000"; // cutnumber for AOD branch
TString cutnumberPhoton = "10000029200000003220400000";
TString cutnumberEvent = "80010103";
Bool_t doEtaShift = kFALSE;
AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
//========= Add V0 Reader to ANALYSIS manager if not yet existent =====
TString V0ReaderName = Form("V0ReaderV1_%s_%s",cutnumberEvent.Data(),cutnumberPhoton.Data());
if( !(AliV0ReaderV1*)mgr->GetTask(V0ReaderName.Data()) ){
AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1(V0ReaderName.Data());
fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
if (!mgr) {
Error("AddTask_V0ReaderV1", "No analysis manager found.");
return;
}
AliConvEventCuts *fEventCuts=NULL;
if(cutnumberEvent!=""){
fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
fEventCuts->SetPreSelectionCutFlag(kTRUE);
fEventCuts->SetPeriodEnumExplicit(AliConvEventCuts::kLHC16q);
fEventCuts->SetV0ReaderName(V0ReaderName);
fEventCuts->SetLightOutput(kTRUE);
if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
fEventCuts->DoEtaShift(doEtaShift);
fV0ReaderV1->SetEventCuts(fEventCuts);
fEventCuts->SetFillCutHistograms("",kTRUE);
}
}
// Set AnalysisCut Number
AliConversionPhotonCuts *fCuts=NULL;
if(cutnumberPhoton!=""){
fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
fCuts->SetPreSelectionCutFlag(kTRUE);
fCuts->SetIsHeavyIon(kTRUE);
fCuts->SetV0ReaderName(V0ReaderName);
fCuts->SetLightOutput(kTRUE);
fCuts->SetProcessAODCheck(kTRUE);
if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
cout<<" Photon conversion is working \n";
fV0ReaderV1->SetConversionCuts(fCuts);
fCuts->SetFillCutHistograms("",kTRUE);
}
}
if( (mgr->GetInputEventHandler())->IsA()==AliAODInputHandler::Class()){
// AOD mode
cout << "AOD handler: adding " << cutnumberAODBranch.Data() << " as conversion branch" << endl;
fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
}
fV0ReaderV1->Init();
AliLog::SetGlobalLogLevel(AliLog::kInfo);
//.........这里部分代码省略.........
示例8: AddTask_GammaCaloDalitzV1_pPb
void AddTask_GammaCaloDalitzV1_pPb( Int_t trainConfig = 1, //change different set of cuts
Bool_t isMC = kFALSE, //run MC
Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1
Int_t enableQAPhotonTask = 0, // enable additional QA task
TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
Int_t doWeightingPart = 0, //enable Weighting
TString generatorName = "DPMJET",
TString cutnumberAODBranch = "8000000060084000001500000", // cutnumber for AOD branch
Bool_t enableExtendedMatching = kFALSE, //enable or disable extended matching histograms for conversion electrons <-> cluster
Bool_t isUsingTHnSparse = kTRUE, //enable or disable usage of THnSparses for background estimation
Bool_t enableV0findingEffi = kFALSE
) {
Int_t isHeavyIon = 2;
// ================== GetAnalysisManager ===============================
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
if (!mgr) {
Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
return ;
}
// ================== GetInputEventHandler =============================
AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
//========= Add PID Reponse to ANALYSIS manager ====
if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
AddTaskPIDResponse(isMC);
}
Printf("here \n");
//========= Set Cutnumber for V0Reader ================================
//06000078400100001500000000
TString cutnumberPhoton = "06000078400100007500000000";
TString cutnumberEvent = "80000003";
TString cutnumberElectron = "90005400000002000000"; //Electron Cuts
Bool_t doEtaShift = kFALSE;
AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
//========= Add V0 Reader to ANALYSIS manager if not yet existent =====
TString V0ReaderName = Form("V0ReaderV1_%s_%s",cutnumberEvent.Data(),cutnumberPhoton.Data());
if( !(AliV0ReaderV1*)mgr->GetTask(V0ReaderName.Data()) ){
AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1(V0ReaderName.Data());
fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
fV0ReaderV1->SetProduceV0FindingEfficiency(enableV0findingEffi);
if (!mgr) {
Error("AddTask_V0ReaderV1", "No analysis manager found.");
return;
}
AliConvEventCuts *fEventCuts=NULL;
if(cutnumberEvent!=""){
fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
fEventCuts->SetPreSelectionCutFlag(kTRUE);
fEventCuts->SetV0ReaderName(V0ReaderName);
if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
fEventCuts->DoEtaShift(doEtaShift);
fV0ReaderV1->SetEventCuts(fEventCuts);
fEventCuts->SetFillCutHistograms("",kTRUE);
}
}
// Set AnalysisCut Number
AliConversionPhotonCuts *fCuts=NULL;
if(cutnumberPhoton!=""){
fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
fCuts->SetPreSelectionCutFlag(kTRUE);
fCuts->SetIsHeavyIon(isHeavyIon);
fCuts->SetV0ReaderName(V0ReaderName);
if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
fV0ReaderV1->SetConversionCuts(fCuts);
fCuts->SetFillCutHistograms("",kTRUE);
}
}
if(inputHandler->IsA()==AliAODInputHandler::Class()){
// AOD mode
fV0ReaderV1->AliV0ReaderV1::SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
}
fV0ReaderV1->Init();
AliLog::SetGlobalLogLevel(AliLog::kFatal);
//connect input V0Reader
mgr->AddTask(fV0ReaderV1);
mgr->ConnectInput(fV0ReaderV1,0,cinput);
}
//================================================
//========= Add Electron Selector ================
//.........这里部分代码省略.........