예제 #1
0
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);

}
예제 #2
0
void AddMixingHandler ( AliMultiInputEventHandler *multiInputHandler,AliAnalysisTaskSE *task, TString format = "esd", Bool_t useMC = kFALSE,Bool_t isRsnMini=kFALSE,const Int_t mixNum = 10, TString opts = "" ) {

   Bool_t valid = kTRUE;
   Int_t isPP = AliAnalysisManager::GetGlobalInt("rsnIsPP",valid);

   if (isRsnMini) {
      AliRsnMiniAnalysisTask *taskRsn = (AliRsnMiniAnalysisTask *) task;

      // settings
      if (isPP) {
//         taskRsn->UseMultiplicity("TRACKS");
         taskRsn->UseMultiplicity("QUALITY");
         taskRsn->SetMaxDiffMult(1.0);
      } else {
         taskRsn->UseCentrality("V0M");
         taskRsn->SetMaxDiffMult(10.0);
      }
      // set mixing
      taskRsn->UseContinuousMix();
      //task->UseBinnedMix();
      taskRsn->SetNMix(mixNum);
      taskRsn->SetMaxDiffVz(1.0);
//      taskRsn->SetMaxDiffAngle(30.0 * TMath::DegToRad());
      

   } else {
      if ( !multiInputHandler ) return;

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

      AliMixEventCutObj *multi = 0;

      if (isPP) {
         multi = new AliMixEventCutObj ( AliMixEventCutObj::kMultiplicity, 2, 102, 10 );
      } else {
         multi = new AliMixEventCutObj ( AliMixEventCutObj::kCentrality, 0, 100, 10, "V0M" );
      }
      AliMixEventCutObj *zvertex = new AliMixEventCutObj ( AliMixEventCutObj::kZVertex, -10, 10, 1 );

      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->DoMixIfNotEnoughEvents(kFALSE);

      multiInputHandler->AddInputEventHandler ( mixHandler );

      // adds mixing info task
      RsnLoadMacroFromMixHandler( "AddAnalysisTaskMixInfo.C" );
      AddAnalysisTaskMixInfo (opts );

   }
}
예제 #3
0
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);

}
void AddAnalysisManagerTestTask(TString analysisSource = "proof", TString analysisMode = "test", TString opts = "")
{

   Bool_t useMC = kFALSE;
   TString format = "esd";
   format = "aod";

   // ALICE stuff
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) mgr = new AliAnalysisManager("Martin Vala's AM");

   gROOT->LoadMacro("SetupAnalysisPlugin.C");
   AliAnalysisGrid *analysisPlugin = SetupAnalysisPlugin(analysisMode.Data());
   if (!analysisPlugin) return;

   // load par files localy
   gSystem->Load("libANALYSIS.so");
   gSystem->Load("libANALYSISalice.so");

   gROOT->LoadMacro("AliAnalysisTaskCustomMix.cxx+g");

   analysisPlugin->AddIncludePath(gSystem->ExpandPathName("$ALICE_ROOT/ANALYSIS/EventMixing"));
   analysisPlugin->SetAliRootMode("ALIROOT"); // Loads AF libs by default
   // sets additional settings to plubin
   analysisPlugin->SetAnalysisSource("AliAnalysisTaskCustomMix.cxx");
   analysisPlugin->SetAdditionalLibs("libEventMixing.so AliAnalysisTaskCustomMix.h AliAnalysisTaskCustomMix.cxx");

   // sets plugin to manager
   mgr->SetGridHandler(analysisPlugin);

   Info("AddAnalysisManagerMixRsn.C", "Creating AliMultiInputEventHandler ...");
   AliMultiInputEventHandler *mainInputHandler = new AliMultiInputEventHandler();
   Info("AddAnalysisManagerMixRsn.C", "Creating esdInputHandler ...");
   AliESDInputHandler *esdInputHandler = new AliESDInputHandler();
   mainInputHandler->AddInputEventHandler(esdInputHandler);

   if (useMC) {
      Info("AddAnalysisManagerMixRsn.C", "Creating mcInputHandler ...");
      AliMCEventHandler* mcInputHandler = new AliMCEventHandler();
      mainInputHandler->AddInputEventHandler(mcInputHandler);
   }

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


   AliMixEventCutObj *multi = new AliMixEventCutObj(AliMixEventCutObj::kMultiplicity, 1, 101, 10);
   AliMixEventCutObj *zvertex = new AliMixEventCutObj(AliMixEventCutObj::kZVertex, -5, 5, 1);

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

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

   //     add mixing handler (uncomment to turn on Mixnig)
   mainInputHandler->AddInputEventHandler(mixHandler);

   // add main input handler (with mixing handler)
   mgr->SetInputEventHandler(mainInputHandler);

   // adds all tasks
   gROOT->LoadMacro("AddAnalysisTaskAll.C");
   AddAnalysisTaskAll(format, useMC, opts);
}