当前位置: 首页>>代码示例>>C++>>正文


C++ AliAnalysisManager::GetInputEventHandler方法代码示例

本文整理汇总了C++中AliAnalysisManager::GetInputEventHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ AliAnalysisManager::GetInputEventHandler方法的具体用法?C++ AliAnalysisManager::GetInputEventHandler怎么用?C++ AliAnalysisManager::GetInputEventHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AliAnalysisManager的用法示例。


在下文中一共展示了AliAnalysisManager::GetInputEventHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fileName


//.........这里部分代码省略.........

  cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(AlephParameters[0],AlephParameters[1],AlephParameters[2],AlephParameters[3],AlephParameters[4]);
  cutsPOI->GetESDpid().GetTPCResponse().SetMip(mip);

  TString outputSlotName("");
  outputSlotName+=uniqueStr;  
  outputSlotName+=Form("V%i ",harmonic);
  outputSlotName+=cutsRP->GetName();
  outputSlotName+=" ";
  outputSlotName+=cutsPOI->GetName();
  outputSlotName+=Form(" %.0f-",centrMin);
  outputSlotName+=Form("%.0f ",centrMax);
  outputSlotName+=AliFlowTrackCuts::PIDsourceName(sourcePID);
  outputSlotName+=" ";
  outputSlotName+=AliPID::ParticleName(particleType);
  if (charge<0) outputSlotName+="-";
  if (charge>0) outputSlotName+="+";

  Bool_t useWeights  = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];
  if (useWeights) cout<<"Weights are used"<<endl;
  else cout<<"Weights are not used"<<endl;
  
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskFlowEvent", "No analysis manager to connect to.");
    return NULL;
  }
  
  // Check the analysis type using the event handlers connected to the analysis
  // manager. The availability of MC handler can also be checked here.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskFlowEvent", "This task requires an input event handler");
    return NULL;
  }  

  // Open external input files
  //===========================================================================
  //weights: 
  TFile *weightsFile = NULL;
  TList *weightsList = NULL;

  if(useWeights) {
    //open the file with the weights:
    weightsFile = TFile::Open("weights.root","READ");
    if(weightsFile) {
      //access the list which holds the histos with weigths:
      weightsList = (TList*)weightsFile->Get("weights");
    }
    else {
      cout<<" WARNING: the file <weights.root> with weights from the previous run was not available."<<endl;
      break;
    } 
  }
  
  //LYZ2
  if (LYZ2SUM || LYZ2PROD) {
    //read the outputfile of the first run
    TString outputFileName = "AnalysisResults1.root";
    TString pwd(gSystem->pwd());
    pwd+="/";
    pwd+=outputFileName.Data();
    TFile *outputFile = NULL;
    if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {
开发者ID:ktf,项目名称:AliPhysics,代码行数:67,代码来源:AddTaskFlowCentralityBayesian.C

示例2: configFile

AliAnalysisTask *AddTask_jpsi_JPsiME(TString prod="",
				     Bool_t gridconf=kFALSE,
				     ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB) {

  //get the current analysis manager
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTask_jpsi_JPsiME", "No analysis manager found.");
    return 0;
  }
  
  //Do we have an MC handler?
  Bool_t hasMC = kFALSE;
  TString list = gSystem->Getenv("LIST");
  if( list.IsNull()) list=prod;
  if( list.Contains("LHC10h")   || list.Contains("LHC11h")   ) hasMC=kFALSE;
  if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE;

  //Do we have an AOD handler?
  Bool_t isAOD=(mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class() ? kTRUE : kFALSE);

  // set AOD debug levels
  if(isAOD) {
    mgr->AddClassDebug("AliAODTrack", AliLog::kFatal);
    mgr->AddClassDebug("AliAODpidUtil", AliLog::kInfo);
  }

  //set config file name
  TString configFile("");
  printf("%s \n",gSystem->pwd());
  TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
  if (!trainRoot.IsNull())
    configFile="$TRAIN_ROOT/jbook_jpsi/ConfigJpsiME_jpsi_PbPb.C";   // gsi config
  else if(!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsiME_jpsi_PbPb.C .")) {
    gSystem->Exec(Form("ls -l %s",gSystem->pwd()));
    configFile=Form("%s/ConfigJpsiME_jpsi_PbPb.C",gSystem->pwd());                        // alien config
  }
  else {
    printf("ERROR: couldn't copy file %s from grid \n",
	   "alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsiME_jpsi_PbPb.C");
    return;
  }

  // using aliroot config
  if(!gridconf)
    configFile="$ALICE_PHYSICS/PWGDQ/dielectron/macrosJPSI/ConfigJpsiME_jpsi_PbPb.C"; // aliroot config

  //create task and add it to the manager
  AliAnalysisTaskMultiDielectron *task;

  // trigger selection
  ULong64_t triggerSets[]={AliVEvent::kCentral , AliVEvent::kSemiCentral , AliVEvent::kMB,
			   AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB};
  const char* triggerNames[]={"Central","SemiCentral","MB","MB+Cent+SemiCent"};

  // find out the configured triggers
  Int_t j=0;
  for(j=0; j<4; j++) {
    if(triggers!=triggerSets[j]) continue;
    else break;
  }

  // print task configuration
  printf("production: %s MC: %d \n",  list.Data(),hasMC);
  printf("triggers:   %s \n",         triggerNames[j]  );
  printf("config:     %s Grid: %d \n",configFile.Data(),gridconf);

  task = new AliAnalysisTaskMultiDielectron((Form("MultiDieJpsiME_%s",triggerNames[j])));
  task->SetBeamEnergy(1380.);
  task->SetTriggerMask(triggers);
  if (!hasMC) task->UsePhysicsSelection();
  mgr->AddTask(task);

  //load dielectron configuration file
  TString checkconfig="ConfigJpsiME_jpsi_PbPb";
  if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data()))
    gROOT->LoadMacro(configFile.Data());

  //add dielectron analysis with different cuts to the task
  for (Int_t i=0; i<nDie; ++i) { //nDie defined in config file
    AliDielectron *jpsi=ConfigJpsiME_jpsi_PbPb(i,list,triggers);
    if (jpsi ) task->AddDielectron(jpsi);
    if (jpsi ) printf(" %s added\n",jpsi->GetName());
  }

  //create output container
  TString containerName = "JPSI.root";
  AliAnalysisDataContainer *cOutputHist1 =
    mgr->CreateContainer(Form("jpsiME_QA_%s",triggerNames[j]),
			 TList::Class(),
			 AliAnalysisManager::kOutputContainer,
			 containerName.Data());

  AliAnalysisDataContainer *cOutputHist2 =
    mgr->CreateContainer(Form("jpsiME_CF_%s",triggerNames[j]),
			 TList::Class(),
			 AliAnalysisManager::kOutputContainer,
			 containerName.Data());

  AliAnalysisDataContainer *cOutputHist3 =
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:AddTask_jpsi_JPsiME.C

示例3: AddTaskThreePartTracks

AliAnalysisTaskCorrelation3p* AddTaskThreePartTracks (const char* name = "ThreePartTracks",
						      const char* centrality = "V0M",
						      const Double_t MinTriggerPt = 4.0,
						      const Double_t MaxTriggerPt = 8.0,
						      const Double_t MinAssociatedPt = 4.0,
						      const Double_t MaxAssociatedPt = 8.0,
						      const Double_t Acceptancecut = 0.9,
						      const Double_t MaxNumberOfTracks = 300,
						      const char* period = "11a",
						      UInt_t offlineTriggerMask = AliVEvent::kMB,
						      const Int_t MaxNEventsMix = 100,
						      const Int_t MinNTracksMix = 1000,
						      const Int_t NMBins = 7,
						      const Double_t Mbin0 = 0.,
						      const Double_t Mbin1 = 5.,
						      const Double_t Mbin2 = 10.,
						      const Double_t Mbin3 = 20.,
						      const Double_t Mbin4 = 40.,
						      const Double_t Mbin5 = 60.,
						      const Double_t Mbin6 = 80.,
						      const Double_t Mbin7 = 90.,
						      const char * file = "",
						      const char * cutmask = "GlobalHybrid",
						      const Int_t binver = 1,
						      const Int_t Zbinver =1
 						    )
{
  //Add a task AliAnalysisTaskCorrelation3p to the analysis train in charged track analysis, for pp data 
  //Author: Paul Baetzing
  /* $Id$ */
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr){
    ::Error("AddTaskThreePartTracks", "No analysis manager to connect to");
    return NULL;
  }
    if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskThreePartTracks", "This task requires an input event handler");
    return NULL;
  }
  const char* fname = Form("%s_%1.0f_%1.0f",name,MinTriggerPt,MaxTriggerPt,MinAssociatedPt,MaxAssociatedPt);
  const char* tname = Form("%s_%1.0f_%1.0f_%1.0f_%1.0f",name,MinTriggerPt,MaxTriggerPt,MinAssociatedPt,MaxAssociatedPt);

  
  
  
  AliAnalysisTaskCorrelation3p* task = new AliAnalysisTaskCorrelation3p(Form("%sTask", tname), "");

  
  
  
  task->SetCentralityEstimator(centrality);
  task->SetTrigger(AliAnalysisTaskCorrelation3p::tracks);
  task->SetMinTriggerPt(MinTriggerPt);
  task->SetMaxTriggerPt(MaxTriggerPt);
  task->SetMinAssociatedPt(MinAssociatedPt);
  task->SetMaxAssociatedPt(MaxAssociatedPt);
  task->SetAcceptanceCut(Acceptancecut);
  task->SetMaxNumberOfTracks(MaxNumberOfTracks);
  task->SetTrackCut(cutmask);
  task->SetBinVer(binver);
  if(TString(file).CompareTo("")!=0)   task->SetWeights(Form("alien:///alice/cern.ch/user/p/pbatzing/efficiencies/%s",file));
  //Mixing scheme:
  Double_t *Mbin = new Double_t[NMBins+1];
  Mbin[0] = Mbin0;
  Mbin[1] = Mbin1;
  if(NMBins>1) Mbin[2] = Mbin2;
  if(NMBins>2) Mbin[3] = Mbin3;
  if(NMBins>3) Mbin[4] = Mbin4;
  if(NMBins>4) Mbin[5] = Mbin5;
  if(NMBins>5) Mbin[6] = Mbin6;
  if(NMBins>6) Mbin[7] = Mbin6;
  TArrayD tMbin(NMBins+1, Mbin);
  //z vertex binning.
  const Int_t NZBins   =   19;
  const Double_t Zbin0 = -10.;
  const Double_t Zbin1 = -8.5;
  const Double_t Zbin2 = -7.5;
  const Double_t Zbin3 = -6.5;
  const Double_t Zbin4 = -5.5;
  const Double_t Zbin5 = -4.5;
  const Double_t Zbin6 = -3.5;
  const Double_t Zbin7 = -2.5;
  const Double_t Zbin8 = -1.5;
  const Double_t Zbin9 = -0.5;
  const Double_t Zbin10 = 0.5;
  const Double_t Zbin11 = 1.5;						      
  const Double_t Zbin12 = 2.5;						      
  const Double_t Zbin13 = 3.5;						      
  const Double_t Zbin14 = 4.5;						      
  const Double_t Zbin15 = 5.5;						      
  const Double_t Zbin16 = 6.5;						      
  const Double_t Zbin17 = 7.5;						      
  const Double_t Zbin18 = 8.5;						      
  const Double_t Zbin19 = 10.;  
  if(Zbinver==2){
    NZBins=    9;
    Zbin0 = -10.;
    Zbin1 = -7.5;
    Zbin2 = -5.5;
    Zbin3 = -3.5;
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:AddTaskThreePartTracks.C

示例4: centralityName

AliAnalysisTaskEffContBF *AddTaskBalanceEffCont( TString  centralityEstimator="V0M",
						 Double_t centrMin=0.,
						 Double_t centrMax=80.,
						 Double_t vertexZ=10.,
						 Int_t AODfilterBit = 128,
						 Bool_t bUseElectronRejection = kFALSE,
						 TString fileNameBase="AnalysisResults",
						 AliAnalysisTaskBFPsi::etriggerSel triggerSel = AliAnalysisTaskBFPsi::kINT7,
						 Bool_t usePID=kFALSE,
						 AliPID::EParticleType particleType = AliPID::kPion
						 ) {

  // Creates a balance function analysis task and adds it to the analysis manager.
  // Get the pointer to the existing analysis manager via the static access method.
  TString centralityName("");

  centralityName+=Form("%.0f-%.0f_%.0f",centrMin,centrMax,vertexZ);
  TString outputFileName(fileNameBase);
  outputFileName.Append(".root");
  
  //===========================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskTriggeredBF", "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("AddTaskTriggeredBF", "This task requires an input event handler");
    return NULL;
  }
  TString analysisType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  if(dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())) analysisType = "MC";

 
  // Create the task, add it to manager and configure it.
  //===========================================================================


  AliAnalysisTaskEffContBF *taskEffContBF = new AliAnalysisTaskEffContBF("TaskEffContBF");

  // centrality
  if(centralityEstimator) {
    taskEffContBF->UseCentrality();
    taskEffContBF->SetCentralityEstimator(centralityEstimator);
    taskEffContBF->SetCentralityPercentileRange(centrMin,centrMax);
  }
  
  if (triggerSel == AliAnalysisTaskBFPsi::kCentral) taskEffContBF->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
  else if(triggerSel == AliAnalysisTaskBFPsi::kMB) taskEffContBF->SelectCollisionCandidates(AliVEvent::kMB);
  else if(triggerSel == AliAnalysisTaskBFPsi::kINT7) taskEffContBF->SelectCollisionCandidates(AliVEvent::kINT7);
  
  // vertex
  taskEffContBF->SetVertexDiamond(.3,.3,vertexZ);

  //analysis kinematic cuts
  taskEffContBF->SetMinPt(0.0);
  taskEffContBF->SetMaxPt(20.0); //5.0
  //taskEffContBF->SetEtaRange(-0.8,0.8,100,0.0,1.6, 64); //acceptance cuts
  //taskEffContBF->SetPtRange(0.1, 20.0, 100);  //acceptance cuts //5.0,49
  taskEffContBF->SetEtaRange(-0.8,0.8,100,0.0,1.6, 64); //acceptance cuts
  taskEffContBF->SetPtRange(0.0, 20.0, 100);  //acceptance cuts //5.0,49

  // electron rejection
    if(bUseElectronRejection){
      taskEffContBF->SetElectronOnlyRejection(3.); // no other particle in nsigma (this is what we use standard in BF code)
    }

    TString pidsuffix ="ch";
    if (usePID) {
      pidsuffix = AliPID::ParticleShortName(particleType);
      taskEffContBF->SetUsePID(usePID, particleType);
    }
    
  //AODs  
  taskEffContBF->SetAODtrackCutBit(AODfilterBit);
  mgr->AddTask(taskEffContBF);

  // 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 += ":PWGCFEbyE.outputBalanceFunctionEffContAnalysis";
  AliAnalysisDataContainer *coutQA = mgr->CreateContainer(Form("listQA_%s_%s",centralityName.Data(), pidsuffix.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
  AliAnalysisDataContainer *coutEffContBF = mgr->CreateContainer(Form("listEffContBF_%s_%s",centralityName.Data(), pidsuffix.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());

  mgr->ConnectInput(taskEffContBF, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(taskEffContBF, 1, coutQA);
  mgr->ConnectOutput(taskEffContBF, 2, coutEffContBF);
  
  return taskEffContBF;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:94,代码来源:AddTaskBalanceEffCont.C

示例5: 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;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:92,代码来源:AddTaskRhoSparse.C

示例6: printf

AliAnalysisTaskHaHFECorrel *AddTaskHaHFECorrel(Double_t period, Double_t MinPtEvent, Double_t MaxPtEvent, Bool_t TRDQA, Bool_t CorrHadron, Bool_t CorrLP, Bool_t MCTruth,  Bool_t IsMC, Bool_t IsAOD, Bool_t UseTender, Int_t ITSnCut,  Int_t TPCnCut, Int_t TPCnCutdEdx,   Double_t PhotElecPtCut, Int_t PhotElecTPCnCut,Bool_t PhotElecITSrefitCut,Double_t InvmassCut, Int_t HTPCnCut,   Bool_t HITSrefitCut, Bool_t HTPCrefitCut, Bool_t UseITS, Double_t SigmaITScut, Double_t SigmaTOFcut, Double_t SigmaTPCcut, const char * ID="")
{
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskHaHFECorrel", "No analysis manager found.");
    return 0;
  }

  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskHaHFECorrel", "This task requires an input event handler");
    return 0x0;
  }

  TString type = mgr->GetInputEventHandler()->GetDataType();

  /*
  AliMCEventHandler* mcHand = new AliMCEventHandler();
  mgr->SetMCtruthEventHandler(mcHand);
  Bool_t MCthere=kTRUE;
  AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
  if (!mcH) {
    MCthere=kFALSE;
  }
  */



  gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/hfe/macros/configs/pp/ConfigHaHFECorrel.C");
  AliAnalysisTaskHaHFECorrel *taskMB = 
    ConfigHaHFECorrel(period, MinPtEvent, MaxPtEvent, TRDQA, CorrHadron, CorrLP, MCTruth, IsMC, IsAOD, UseTender, ITSnCut, TPCnCut, TPCnCutdEdx, PhotElecPtCut,PhotElecTPCnCut, PhotElecITSrefitCut,  InvmassCut,  HTPCnCut,  HITSrefitCut, HTPCrefitCut, UseITS, SigmaITScut, SigmaTOFcut, SigmaTPCcut, ID);
  if (!taskMB) {
    Error("AddTaskHaHFECorrel", "No task found.");
  }
  taskMB->SelectCollisionCandidates(AliVEvent::kINT7);
  
  // Load correction weights for pi0, eta
  if (IsMC) {
    TH1::AddDirectory(kFALSE);
    printf("Loading Pi0EtaCorrectionFiles\n");
    TString CorrectPi0EtaFile="alien:///alice/cern.ch/user/f/flherrma/HaHFECorrel/Pi0EtaWeights.root";
    TFile *CorrectPi0Eta = TFile::Open(CorrectPi0EtaFile.Data());
    if (CorrectPi0Eta) {    
      TH1F * Pi0W = (TH1F*)CorrectPi0Eta->Get("Pi0Weights");
      TH1F * EtaW = (TH1F*)CorrectPi0Eta->Get("EtaWeights");
      if (Pi0W) taskMB->SetPi0WeightToData(*Pi0W);
      else printf("Could not load Pi0Weights\n");
      if (EtaW)  taskMB->SetEtaWeightToData(*EtaW);
      else printf("Could not load EtaWeights\n");
    }
    else printf("Could not open Pi0Eta correction file \n");
    TH1::AddDirectory(kTRUE);
  }
  TH1::AddDirectory(kFALSE);
  printf("Loading RecEffFiles\n");
  TString RecEffFileName="alien:///alice/cern.ch/user/f/flherrma/HaHFECorrel/RecEff.root";
  TFile *RecEffFile = TFile::Open(RecEffFileName.Data());

  //RecEffFile->ls();
  if (RecEffFile) {    
    TH3F * HadRecEff = (TH3F*)RecEffFile->Get("HadRecEff");
    TH2F * EleRecEff = (TH2F*)RecEffFile->Get("EleRecEff");
    if (HadRecEff) taskMB->SetHadRecEff(*HadRecEff);
    else printf("Could not load HadRecEff\n");
    if (EleRecEff) taskMB->SetEleRecEff(*EleRecEff);
    else printf("Could not load EleRecEff\n");
  }
  else printf("Could not open RecEff correction file \n");
  TH1::AddDirectory(kTRUE);




  mgr->AddTask(taskMB);

  TString containerName1 = mgr->GetCommonFileName();
  containerName1 += ":PWGHF_HaHFECorrel_kINT7_";
  containerName1 += ID;
        
  TString name1 = "histMB_";
  name1 += ID;
        
  AliAnalysisDataContainer *cinput   = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(name1.Data(), TList::Class(),AliAnalysisManager::kOutputContainer, containerName1.Data());
  mgr->ConnectInput(taskMB, 0, cinput);
  mgr->ConnectOutput(taskMB, 1, coutput1);




  return NULL;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:91,代码来源:AddTaskHaHFECorrel.C

示例7: AliEPSelectionTask

AliEPSelectionTask *AddTaskEventplane(Bool_t useEtaGap=kTRUE,Float_t etaGap=0.4,Bool_t posTPCAOD=kFALSE,TString containername = "EPStat")
{
  // Macro to connect an event plane selection task to an existing analysis manager.

  if(useEtaGap && posTPCAOD){
    ::Error("AddTaskEventplane", "eta-splitting of events and one side of TPC not possible at same time!");
    return NULL;
  }
  
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskEventplane", "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("AddTaskEventplane", "This task requires an input event handler");
    return NULL;
  }
  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
 
  AliEPSelectionTask *eventplaneTask = new AliEPSelectionTask("EventplaneSelection");
  eventplaneTask->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral);
  if (inputDataType == "AOD"){
    eventplaneTask->SetInput("AOD");
  }
  eventplaneTask->SetTrackType("TPC");
  eventplaneTask->SetUsePtWeight();
  eventplaneTask->SetUsePhiWeight();
  eventplaneTask->SetSaveTrackContribution();
  if(useEtaGap){
    eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask::kEta); 
    eventplaneTask->SetEtaGap(etaGap); 
  }
  if(posTPCAOD){
    eventplaneTask->SetPersonalAODtrackCuts(128,0.,0.8,0.15,20.);
    eventplaneTask->SetSubeventsSplitMethod(AliEPSelectionTask::kRandom);
  }
   // Cuts on primary tracks
  AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Standard");
  esdTrackCutsL->SetMinNClustersTPC(50);
  esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
//  esdTrackCutsL->SetMaxCovDiagonalElements(2, 2, 0.5, 0.5, 2);
//  esdTrackCutsL->SetRequireTPCRefit(kTRUE);
  esdTrackCutsL->SetMaxDCAToVertexXY(3.0);
  esdTrackCutsL->SetMaxDCAToVertexZ(3.0);
  esdTrackCutsL->SetDCAToVertex2D(kTRUE);
//  esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
//  esdTrackCutsL->SetAcceptKinkDaughters(kFALSE);
  eventplaneTask->SetPersonalESDtrackCuts(esdTrackCutsL);


  
  mgr->AddTask(eventplaneTask);

  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(containername,
                TList::Class(), AliAnalysisManager::kOutputContainer,
                "EventStat_temp.root");
  
  mgr->ConnectInput(eventplaneTask, 0, mgr->GetCommonInputContainer());
  mgr->ConnectOutput(eventplaneTask,1,coutput1);

  return eventplaneTask;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:66,代码来源:AddTaskEMCALEventPlane.C

示例8: AliResonanceKink

AliAnalysisTaskKinkResonance *AddTaskKinkResonanceL1520MC(Short_t lCollidingSystems=0 /*0 = pp, 1 = AA*/)
{
// Creates, configures and attaches to the train a kink resonance task.
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
 if (!mgr) {
 ::Error("AddTaskKinkResonanceL1520MC", "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("AddTaskKinkResonanceL1520MC", "This task requires an input event handler");
 return NULL;
}
TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
 if (type != "ESD") {
 ::Error("AddTaskKinkResonanceL1520MC", "This task needs an ESD input handler");
return NULL;
}
if (!mgr->GetMCtruthEventHandler()) {
 ::Error("AddTaskKinkResonanceL1520MC", "This task needs an MC handler");
 return NULL;
}

// Setup the analysis object
  
  AliResonanceKink  *kinkResonanceObjectLMC=new AliResonanceKink();
  kinkResonanceObjectLMC->InitOutputHistograms(100,1.4,1.8, 36, -0.9, 0.9, 100, 0.0, 10.0);
  kinkResonanceObjectLMC->SetPDGCodes(kProton, kKPlus, AliResonanceKink::kLambda1520); 
  kinkResonanceObjectLMC->SetAnalysisType("MC"); // "ESD" or "MC" or "DATA"
  kinkResonanceObjectLMC->SetMaxNsigmaToVertex(4.0);
  kinkResonanceObjectLMC->SetMaxDCAxy(3.0);
  kinkResonanceObjectLMC->SetMaxDCAzaxis(3.0);
  kinkResonanceObjectLMC->SetPtTrackCut(0.25);
  kinkResonanceObjectLMC->SetMinTPCclusters(50);
  kinkResonanceObjectLMC->SetMaxChi2PerTPCcluster(3.5);
  kinkResonanceObjectLMC->SetMaxCov0(2.0);
  kinkResonanceObjectLMC->SetMaxCov2(2.0);
  kinkResonanceObjectLMC->SetMaxCov5(0.5);
  kinkResonanceObjectLMC->SetMaxCov9(0.5);
  kinkResonanceObjectLMC->SetMaxCov14(2.0);
  kinkResonanceObjectLMC->SetMinKinkRadius(120.);
  kinkResonanceObjectLMC->SetMaxKinkRadius(220.);
  kinkResonanceObjectLMC->SetQtLimits(0.05, 0.5);
  kinkResonanceObjectLMC->SetUpperAbsEtaCut(0.9);

// Create and configure the task
AliAnalysisTaskKinkResonance *taskresonanceL1520MC = new AliAnalysisTaskKinkResonance("TaskResL1520MCKinkPID");
taskresonanceL1520MC->SetAnalysisKinkObject(kinkResonanceObjectLMC);
mgr->AddTask(taskresonanceL1520MC);

// 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 += ":PWG2KINKResonanceL1520MC";
   if (lCollidingSystems) outputFileName += "_AA";
   else outputFileName += "_PP";
   if (mgr->GetMCtruthEventHandler()) outputFileName += "_MC";

   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("KinkResL1520MC",
							     TList::Class(),
							     AliAnalysisManager::kOutputContainer,
							     outputFileName );

mgr->ConnectInput(taskresonanceL1520MC, 0, mgr->GetCommonInputContainer());
mgr->ConnectOutput(taskresonanceL1520MC, 1, coutput1);
return taskresonanceL1520MC;
} 
开发者ID:ktf,项目名称:AliPhysics,代码行数:72,代码来源:AddTaskKinkResonanceL1520MC.C

示例9: AddMixingHandler

void AddMixingHandler ( AliMultiInputEventHandler *multiInputHandler,TString format = "esd", Bool_t useMC = kFALSE, TString opts = "" ) {

   const Int_t bufferSize = 2;
   const Int_t mixNum = 1;
   if ( !multiInputHandler ) return;

   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   AliMixInputEventHandler *mixHandler = new AliMixInputEventHandler ( bufferSize, mixNum );
   mixHandler->SetInputHandlerForMixing ( dynamic_cast<AliMultiInputEventHandler *> ( mgr->GetInputEventHandler() ) );
   AliMixEventPool *evPool = new AliMixEventPool();

   AliMixEventCutObj *multi = new AliMixEventCutObj ( AliMixEventCutObj::kMultiplicity, 2, 102, 10 );
//    AliMixEventCutObj *zvertex = new AliMixEventCutObj ( AliMixEventCutObj::kZVertex, -10, 10, 1 );

//    AliMixEventCutObj *centrality = new AliMixEventCutObj(AliMixEventCutObj::kCentrality, 0, 20, 10, "V0M");
//    AliMixEventCutObj *multi = new AliMixEventCutObj(AliMixEventCutObj::kMultiplicity, 2, 102, 10);
//    AliMixEventCutObj *zvertex = new AliMixEventCutObj(AliMixEventCutObj::kZVertex, -5, 5, 1);
//
//    AliMixEventCutObj *multi = new AliMixEventCutObj(AliMixEventCutObj::kMultiplicity, 2, 10002, 1000);
//    AliMixEventCutObj *zvertex = new AliMixEventCutObj(AliMixEventCutObj::kZVertex, -10, 10, 1);
//
//     AliMixEventCutObj *centrality = new AliMixEventCutObj ( AliMixEventCutObj::kCentrality, 0, 100, 10, "V0M" );
   AliMixEventCutObj *zvertex = new AliMixEventCutObj ( AliMixEventCutObj::kZVertex, -10, 10, 1 );

//    evPool->AddCut(centrality);
   evPool->AddCut(multi);
   evPool->AddCut ( zvertex );

   // adds event pool (comment it and u will have default mixing)
   mixHandler->SetEventPool ( evPool );

//   mixHandler->SelectCollisionCandidates(AliVEvent::kAny);
//    mixHandler->SelectCollisionCandidates(AliVEvent::kAnyINT);
//    mixHandler->SelectCollisionCandidates(AliVEvent::kMB);
   mixHandler->SelectCollisionCandidates(AliVEvent::kMUSPB);


//    mixHandler->DoMixIfNotEnoughEvents(kFALSE);

   multiInputHandler->AddInputEventHandler ( mixHandler );

   // adds mixing info task
   gROOT->LoadMacro ( "AddAnalysisTaskMixInfo.C" );
   AddAnalysisTaskMixInfo (opts);

}
开发者ID:musinsky,项目名称:AliRsnLite,代码行数:46,代码来源:AddMixingHandler.C

示例10: Error

AliAnalysisTaskFemto *AddTaskFemto(TString configMacroName, const char *containerName="femtolist", const char *configMacroParameters="" )
{
// Creates a proton analysis task and adds it to the analysis manager.
  
  // A. Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskFemto", "No analysis manager to connect to.");
    return NULL;
  }  

  // B. Check the analysis type using the event handlers connected to the analysis
  //    manager. The availability of MC handler cann also be checked here.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskFemto", "This task requires an input event handler");
    return NULL;
  }  
  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  cout << "Found " <<type << " event handler" << endl;

  // C. Create the task, add it to manager.
  //===========================================================================
//  gSystem->SetIncludePath("-I$ROOTSYS/include  -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_PHYSICS/include");

  if (TProofMgr::GetListOfManagers()->GetEntries()) {
//     if (dynamic_cast<TProofLite *> gProof) {
//       char *macrocommand[10000];
//       sprintf(macrocommand, ".L %s", configMacroName);
//       gProof->Exec(macrocommand);
//     }
//     else
    gProof->Load(configMacroName);
  }  
  //  gROOT->LoadMacro("ConfigFemtoAnalysis.C++");

  //was befere aliroot 5.04.33: AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName);
  //  AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName,kFALSE);
  //March 2013:
  //to check localy before new tag I did symbolic link on my laplot
  //in $ALICE_PHYSICS/PWGCF/FEMTOSCOPY/macros/Train/
  //[[email protected] Train]# ln -s /scratch/AliWork/PbPb2.76/Train2013/KchHBT KchHBT
  //
  AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto","$ALICE_PHYSICS/"+configMacroName,configMacroParameters,kFALSE);
  //10-90% only two triggers: SemiCentral and MB
  //taskfemto->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kSemiCentral);// this a new line for train
  taskfemto->SelectCollisionCandidates(AliVEvent::kINT7);
  //0-10 % all three triggers
  //taskfemto->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);// this a new line for train
  mgr->AddTask(taskfemto);

  // D. Configure the analysis task. Extra parameters can be used via optional
  // arguments of the AddTaskXXX() function.
  //===========================================================================
  
  // E. 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 outputfile = AliAnalysisManager::GetCommonFileName();  
  outputfile += ":PWG2FEMTO";
  AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("femtolist_kt13",  TList::Class(),
  							       AliAnalysisManager::kOutputContainer,outputfile);


   mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput(taskfemto, 0, cout_femto);

   // Return task pointer at the end
   return taskfemto;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:71,代码来源:AddTaskFemto.C

示例11: AddTaskJetExtractor

AliAnalysisTaskJetExtractor* AddTaskJetExtractor(
  const char *trackArray         = "tracks",
  const char *jetArray           = "jets",
  const char *rhoObject          = "Rho",
  Double_t    jetRadius          = 0.3,
  Double_t    minJetEta          = 0.6,
  Double_t    minJetPt           = 0.15,
  Double_t    minTrackPt         = 0.15,
  Double_t    minJetAreaPerc     = 0.557,
  const char *suffix             = ""
)
{  
  cout << " ############ MACRO EXECUTION STARTED: AddTaskJetExtractor.C ############\n";
  //==============================================================================
  // Prepare analysis manager, containers, etc.
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

  if (!mgr)
  {
    ::Error("AddTaskJetExtractor", "No analysis manager to connect to.");
    return NULL;
  }  
  if (!mgr->GetInputEventHandler())
  {
    ::Error("AddTaskJetExtractor", "This task requires an input event handler");
    return NULL;
  }
  
  TString name("AliAnalysisTaskJetExtractor");
  if (strcmp(jetArray,"")) {
    name += "_";
    name += jetArray;
  }
  if (strcmp(rhoObject,"")) {
    name += "_";
    name += rhoObject;
  }
  if (strcmp(suffix,"")) {
    name += "_";
    name += suffix;
  }

  AliAnalysisDataContainer* contHistos = mgr->CreateContainer(Form("%s_histos", name.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:ChargedJetsHadronCF", AliAnalysisManager::GetCommonFileName()));

  //==============================================================================
  // Adding and configuring tasks

  AliAnalysisTaskJetExtractor* jetTask = new AliAnalysisTaskJetExtractor(name);
  jetTask->SetNeedEmcalGeom(kFALSE);
  jetTask->SetVzRange(-10.,10.);

  AliParticleContainer *trackCont = 0;
  if(!strcmp(trackArray,"mctracks") || !strcmp(trackArray, "mcparticles"))
    trackCont = jetTask->AddMCParticleContainer(trackArray);
  else
    trackCont = jetTask->AddTrackContainer(trackArray);

  trackCont->SetParticlePtCut(minTrackPt);

  AliJetContainer *jetCont = jetTask->AddJetContainer(jetArray,6,jetRadius);
  if (jetCont) {
    jetCont->SetRhoName(rhoObject);
    jetCont->SetPercAreaCut(minJetAreaPerc);
    jetCont->SetJetPtCut(minJetPt);
    jetCont->SetLeadingHadronType(0);
    jetCont->SetPtBiasJetTrack(minTrackPt);
    jetCont->SetJetEtaLimits(-minJetEta, +minJetEta);
    jetCont->ConnectParticleContainer(trackCont);
    jetCont->SetMaxTrackPt(1000);
  }

  mgr->AddTask(jetTask);

  //==============================================================================
  // Finalization

  mgr->ConnectInput  (jetTask, 0,  mgr->GetCommonInputContainer() );
  mgr->ConnectOutput (jetTask, 1, contHistos );
 
  cout << " ############ MACRO EXECUTION DONE: AddTaskJetExtractor.C ############\n";
 
  return jetTask;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:83,代码来源:AddTaskJetExtractor.C

示例12: AddTaskFlowCentralityKinkQbMunu


//.........这里部分代码省略.........
  outputSlotName+=" ";
  outputSlotName+=cutsPOI->GetName();
  outputSlotName+=Form(" %.0f-",centrMin);
  outputSlotName+=Form("%.0f ",centrMax);
  outputSlotName+=Form("POI:%s ", AliFlowTrackCuts::GetParamTypeName(cutsPOI->GetParamType()) );
  outputSlotName+=Form("RP:%s ", AliFlowTrackCuts::GetParamTypeName(cutsRP->GetParamType()) );
  if (particleType!=AliPID::kUnknown)
  {
    outputSlotName+=AliFlowTrackCuts::PIDsourceName(sourcePID);
    outputSlotName+=" ";
    outputSlotName+=AliPID::ParticleName(particleType);
  }
  if (charge<0) outputSlotName+="-";
  if (charge>0) outputSlotName+="+";

  TString fileName(fileNameBase);
  fileName.Append(".root");

  Bool_t useWeights  = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];
  if (useWeights) cout<<"Weights are used"<<endl;
  else cout<<"Weights are not used"<<endl;
  
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error("AddTaskFlowEvent", "No analysis manager to connect to.");
    return NULL;
  }
  
  // Check the analysis type using the event handlers connected to the analysis
  // manager. The availability of MC handler can also be checked here.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskFlowEvent", "This task requires an input event handler");
    return NULL;
  }  

  // Open external input files
  //===========================================================================
  //weights: 
  TFile *weightsFile = NULL;
  TList *weightsList = NULL;

  if(useWeights) {
    //open the file with the weights:
    weightsFile = TFile::Open("weights.root","READ");
    if(weightsFile) {
      //access the list which holds the histos with weigths:
      weightsList = (TList*)weightsFile->Get("weights");
    }
    else {
      cout<<" WARNING: the file <weights.root> with weights from the previous run was not available."<<endl;
      break;
    } 
  }
  
  //LYZ2
  if (LYZ2SUM || LYZ2PROD) {
    //read the outputfile of the first run
    TString outputFileName = "AnalysisResults1.root";
    TString pwd(gSystem->pwd());
    pwd+="/";
    pwd+=outputFileName.Data();
    TFile *outputFile = NULL;
    if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {
开发者ID:ktf,项目名称:AliPhysics,代码行数:67,代码来源:AddTaskFlowCentralityKinkQbMunu.C

示例13: AddMixingHandler

void AddMixingHandler(Double_t centMin = 70, Double_t centMax = 80, Double_t centStep = 2, Bool_t bAOD = kTRUE, Bool_t useMC = kFALSE, Bool_t usePhysSel = kTRUE, Bool_t bCentralTrigger = kFALSE, TString opts = "")
{
  
    AliESDInputHandler *esdInputHandler = 0;
    AliAODInputHandler *aodInputHandler = 0;
    AliMCEventHandler  *mcInputHandler  = 0;
  
    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

    AliMultiInputEventHandler *multiInputHandler = new AliMultiInputEventHandler();
    mgr->SetInputEventHandler(multiInputHandler);
    
    if (!bAOD) {
      esdInputHandler = new AliESDInputHandler();
      multiInputHandler->AddInputEventHandler(esdInputHandler);
      //centralityInputHandler = new AliCentralityInputHandler();
      //multiInputHandler->AddInputEventHandler(centralityInputHandler);
      if (bMCtruth) {
    	mcInputHandler = new AliMCEventHandler();
    	multiInputHandler->AddInputEventHandler(mcInputHandler);
    	// Not reading track references
    	mchandler->SetReadTR(kFALSE);
      }
    } else if (bAOD) {
      aodInputHandler = new AliAODInputHandler();
      multiInputHandler->AddInputEventHandler(aodInputHandler);
    } else {
      Printf("Error: Only ESD and AOD input format is supported !!!");
     return;
    }

   if (!multiInputHandler) return;

   const Int_t bufferSize = 1;
   const Int_t mixNum = 5;
   AliMixInputEventHandler *mixHandler = new AliMixInputEventHandler(bufferSize, mixNum);
   mixHandler->SetInputHandlerForMixing(dynamic_cast<AliMultiInputEventHandler*>(mgr->GetInputEventHandler()));
   AliMixEventPool *evPool = new AliMixEventPool();

   //AliMixEventCutObj *multi = new AliMixEventCutObj(AliMixEventCutObj::kMultiplicity, 2, 10002, 10000);
   AliMixEventCutObj *zvertex = new AliMixEventCutObj(AliMixEventCutObj::kZVertex, -10, 10, 5);

   AliMixEventCutObj *centrality = new AliMixEventCutObj(AliMixEventCutObj::kCentrality, centMin, centMax, centStep, "V0M");

   evPool->AddCut(centrality);
   //evPool->AddCut(multi);
   evPool->AddCut(zvertex);

   // adds event pool (comment it and u will have default mixing)
   mixHandler->SetEventPool(evPool);

   // only use events with physics selection
   if (usePhysSel){
     if (bCentralTrigger){
       mixHandler->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral);
     }
     else{ 
       mixHandler->SelectCollisionCandidates(AliVEvent::kMB);
     }
   }
   
   multiInputHandler->AddInputEventHandler(mixHandler);

}
开发者ID:ktf,项目名称:AliPhysics,代码行数:64,代码来源:AddMixingHandler.C

示例14: 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 ================
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:AddTask_GammaCaloDalitzV1_pPb.C

示例15: AddTaskThermalGAFlow

AliAnalysisTaskThermalGAFlow* AddTaskThermalGAFlow(
   const char *outfilename    = "AnalysisOutput.root",

//Default Cuts
   const Int_t fDebug = 0,
   const Int_t fMinCells = 3,
   const Double_t fMinE = 0.3,
   const Double_t fMinTrackDr = 0,
   const Double_t fMaxVertexx = 10,
   const Double_t fMinCentrality = -1,
   const Double_t fMaxCentrality = 100,
   const Double_t fCoreRadius = 3.5,
   const Double_t fMinCoreEnergyRatio = 0.4,
   const Double_t fMinLambdaDisp = 0.3,
   const Double_t fMinCPVStd = 2.5,

   const Int_t fMixVertxbins = 1,
   const Int_t fMixCentbins = 1,
   const Int_t fMixEvbins = 1,
   const Int_t fNptbins = 150,
//End Default Cuts

   const char *tag            = ""

)

{    
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr)
  {
    ::Error("AddTaskPHOSThermalGAFlow", "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("AddTaskPHOSThermalGAFlow", "This task requires an input event handler");
    return NULL;
  }
  //-------------------------------------------------------
  // Init the task and do settings
  //-------------------------------------------------------
  TString name(Form("ash_%s", tag));
  printf("Adding\n");
  AliAnalysisTaskThermalGAFlow *PHOSGAtask = new AliAnalysisTaskThermalGAFlow(name);

  PHOSGAtask->SetDebug(fDebug);
  PHOSGAtask->SetMinCells(fMinCells);
  PHOSGAtask->SetMinE(fMinE);
  PHOSGAtask->SetMinTrackDr(fMinTrackDr);
  PHOSGAtask->SetMaxVertexx(fMaxVertexx);
  PHOSGAtask->SetMinCentrality(fMinCentrality);
  PHOSGAtask->SetMaxCentrality(fMaxCentrality);
  PHOSGAtask->SetCoreRadius(fCoreRadius);
  PHOSGAtask->SetMinCoreEnergyRatio(fMinCoreEnergyRatio);
  PHOSGAtask->SetMinLambdaDisp(fMinLambdaDisp);
  PHOSGAtask->SetMinCPVStd(fMinCPVStd);

  PHOSGAtask->SetMixVertxbins(fMixVertxbins);
  PHOSGAtask->SetMixCentbins(fMixCentbins);
  PHOSGAtask->SetMixEvbins(fMixEvbins);
  PHOSGAtask->SetNptbins(fNptbins);

  //-------------------------------------------------------
  // Final settings, pass to manager and set the containers
  //-------------------------------------------------------
  mgr->AddTask(PHOSGAtask);
  // Create containers for input/output
  mgr->ConnectInput (PHOSGAtask, 0, mgr->GetCommonInputContainer() );
  AliAnalysisDataContainer *coGAFlow = mgr->CreateContainer(name,
    TList::Class(),
    AliAnalysisManager::kOutputContainer,
    outfilename);

  mgr->ConnectOutput(PHOSGAtask,1,coGAFlow);
  return PHOSGAtask;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:80,代码来源:AddTaskThermalGAFlow.C


注:本文中的AliAnalysisManager::GetInputEventHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。