//__________________________________________________//
AliESDtrackCuts *GetTrackCutsObject() {
  //Function to setup the AliESDtrackCuts object and return it
  AliESDtrackCuts *cuts = new AliESDtrackCuts("ebyeTrackCuts","ebyeTrackCuts");
  cuts->SetMinNClustersTPC(80);
  //cuts->SetMinNClustersITS(2);
  cuts->SetMaxChi2PerClusterTPC(4.0);
  cuts->SetRequireTPCRefit();
  //cuts->SetRequireITSRefit();
  cuts->SetAcceptKinkDaughters(kFALSE);
  cuts->SetMaxDCAToVertexXY(3.0);
  cuts->SetMaxDCAToVertexZ(3.0);
  
  cuts->SetPtRange(0.3,1.5);
  cuts->SetEtaRange(-0.8,0.8);

  cuts->SaveHistograms("trackCuts");

  return cuts;
}
//------------------------------------------------------
void DefineCutsTagger(AliHFJetsTaggingVertex *tg){
   
    // define cuts for tagger:
    // 1) AliRDHFJetsCuts: event selections, basic jet cuts (pT jet, accpetance, emcal, pT leading-track)
    // 2) AliRDHFJetsCutsVertex: cuts to reconstruct vertices
    // (nprong, pT jet, eta, R, pTmin tracks, electron ID, displacement and other cut variables)
    AliRDHFJetsCutsVertex *cuts2=new AliRDHFJetsCutsVertex("jetCuts");
    // jets
    cuts2->SetJetRadius(0.4);
    cuts2->SetMaxEtaJet(0.5);//0.9-R
    cuts2->SetMinPtJet(10);
    cuts2->SetMaxPtJet(200);
    // tracks
    AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
    esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
    esdTrackCuts->SetMinNClustersTPC(70);
    esdTrackCuts->SetMaxChi2PerClusterTPC(4);
    esdTrackCuts->SetRequireTPCRefit(kTRUE);
    esdTrackCuts->SetRequireITSRefit(kTRUE);
    //esdTrackCuts->SetMinNClustersITS(4);
    esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
    esdTrackCuts->SetMinDCAToVertexXY(0.);
    esdTrackCuts->SetEtaRange(-0.8,0.8);
    esdTrackCuts->SetPtRange(0.3,1.e10);
  
    cuts2->AddTrackCuts(esdTrackCuts);
    
    // vertexing
    cuts2->SetNprongs(3);
    cuts2->SetIsElec(kFALSE); // kTRUE to select e in jet vertex  

    cuts2->SetMinPtHardestTrack(1.0);//default 0.3
    cuts2->SetSecVtxWithKF(kFALSE);//default with StrLinMinDist
    cuts2->SetImpParCut(0.);//default 0
    cuts2->SetDistPrimSec(0.);//default 0
    cuts2->SetCospCut(-1);//default -1
    tg->SetCuts(cuts2);

    delete esdTrackCuts;
    delete cuts2;
}
Example #3
0
File: run.C Project: ktf/AliPhysics
void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kFALSE, Int_t runMode = 0, Bool_t isMC = 0, 
	 Int_t centrBin = 0, const char * centrEstimator = "VOM", Int_t useOtherCentralityCut = 0, Int_t trackMin=0, Int_t trackMax=10000, 
	 const char* option = "",TString customSuffix = "", Int_t workers = -1, Bool_t useSingleBin=kTRUE, const char * runList = 0)
{
  // runMode:
  //
  // 0 local 
  // 1 proof

  if (nev < 0)
    nev = 1234567890;

  InitAndLoadLibs(runMode,workers,debug);

  // Create the analysis manager
  mgr = new AliAnalysisManager;

  // Add ESD handler
  AliESDInputHandler* esdH = new AliESDInputHandler;
  // Do I need any of this? 
  esdH->SetInactiveBranches("AliESDACORDE FMD ALIESDTZERO ALIESDZDC AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks AliESDTZERO ALIESDACORDE MuonTracks TrdTracks");
  mgr->SetInputEventHandler(esdH);

  if(isMC) {
    AliMCEventHandler* handler = new AliMCEventHandler;
    handler->SetPreReadMode(AliMCEventHandler::kLmPreRead);
    mgr->SetMCtruthEventHandler(handler);
  }



  // Parse option strings
  TString optionStr(option);
  
  // remove SAVE option if set
  // This  is copied from a macro by Jan. The reason I kept it is that I may want to pass textual options to the new task at some point
  Bool_t doSave = kFALSE;
  TString optionStr(option);
  if (optionStr.Contains("SAVE"))
    {
      optionStr = optionStr(0,optionStr.Index("SAVE")) + optionStr(optionStr.Index("SAVE")+4, optionStr.Length());
      doSave = kTRUE;
    }

  AliESDtrackCuts * cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE);  
  TString pathsuffix = "";

  if(!useSingleBin) pathsuffix += "_AllCentr";

  if (optionStr.Contains("DCA")) {
    delete cuts;
    //    cuts = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009();
    cout << ">>>> USING DCA cut" << endl;
    cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();  
    cuts->SetMaxChi2TPCConstrainedGlobal(); // remove golden cut
    pathsuffix+="_DCAcut";
  }

  if (optionStr.Contains("ITSsa")) {
    delete cuts;
    cuts = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009();
    cout << ">>>> USING ITS sa tracks" << endl;
    pathsuffix+="_ITSsa";
  }

  if (optionStr.Contains("TPC")) {
    delete cuts;
    cuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
    cout << ">>>> USING TPC only tracks" << endl;
    pathsuffix+="_TPC";
  }

  if(optionStr.Contains("NoElectrons")) pathsuffix +="_NoElectrons";



  Bool_t useMCKinematics = isMC;
  if (optionStr.Contains("NOMCKIN")) {
    cout << ">>>> Ignoring MC kinematics" << endl;
    useMCKinematics=kFALSE;
    pathsuffix+="_NOMCKIN";
  }
  
  // If we are running on grid, we need the alien handler
  if (runMode == kMyRunModeGRID) {
    // Create and configure the alien handler plugin
    gROOT->LoadMacro("CreateAlienHandler.C");
    AliAnalysisGrid *alienHandler = CreateAlienHandler(data, runList, pathsuffix.Data(), listToLoad, "full", isMC);  // full
    if (!alienHandler) {
      cout << "Cannot create alien handler" << endl;    
      exit(1);
    }
    mgr->SetGridHandler(alienHandler);  
  }



  // Add tasks
  // physics selection
  gROOT->ProcessLine(".L $ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
  physicsSelectionTask = AddTaskPhysicsSelection(isMC);

  //PID
  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
  AddTaskPIDResponse(isMC); 

  // // PID QA:
  // gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
  // AddTaskPIDqa();


  // Centrality
  gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
  AliCentralitySelectionTask *taskCentr = AddTaskCentrality();
  // OBSOLETE
  const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityBy1D.root";
  const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityByFunction.root";
  // END of OBSOLETE
  if(isMC) taskCentr-> SetMCInput();
  taskCentr->SetPass(2);

  // Create my own centrality selector
  AliAnalysisMultPbCentralitySelector * centrSelector = new AliAnalysisMultPbCentralitySelector();
  centrSelector->SetIsMC(isMC);
  centrSelector->SetCentrTaskFiles(file1,file2); // for bookkeping only
  centrSelector->SetCentralityBin(centrBin);
  if (!useSingleBin) centrSelector->SetCentralityBin(0); // FIXME: ok?
  centrSelector->SetCentralityEstimator(centrEstimator);

  if(useOtherCentralityCut == 1){
    cout << "Setting centrality by MULT" << endl;
    centrSelector->SetUseMultRange();
    centrSelector->SetMultRange(trackMin,trackMax);
  }
  if(useOtherCentralityCut == 2){
    cout << "Setting centrality by V0" << endl;
    
    centrSelector->SetUseV0Range();
    centrSelector->SetMultRange(trackMin,trackMax);
  }
  if(useOtherCentralityCut == 3){
    cout << "Setting centrality by SPD outer" << endl;    
    centrSelector->SetUseSPDOuterRange();
    centrSelector->SetMultRange(trackMin,trackMax);
  }

  // load my task
  if (useSingleBin) {
    gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracks.C");
    AliAnalysisTaskMultPbTracks * task = AddTaskMultPbPbTracks("multPbPbtracks.root", cuts, centrSelector); 
    task->SetIsMC(useMCKinematics);
    task->SetOfflineTrigger(AliVEvent::kMB);
    if(optionStr.Contains("TPC")) task->SetTPCOnly();
    if(optionStr.Contains("NoElectrons")) task->RejectElectrons(kTRUE);
    if(useMCKinematics) task->GetHistoManager()->SetSuffix("MC");
    if(customSuffix!=""){
      cout << "Setting custom suffix: " << customSuffix << endl;    
      task->GetHistoManager()->SetSuffix(customSuffix);
    }
  } else {
    gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracksAllCentrality.C");
    centrSelector->SetUseV0Range(kTRUE);
    Int_t ncentr = 11;
   
    const Float_t minCentr[] = {0 ,79 ,239,559 ,1165,2135,3555,5525,8213 ,12191,15079};
    const Float_t maxCentr[] = {79,239,559,1165,2135,3555,5525,8213,12191,15079,21000};
    AliAnalysisTaskMultPbTracks ** tasks = AddTaskMultPbPbTracksAllCentrality("multPbPbtracks.root", cuts, centrSelector, ncentr,minCentr,maxCentr); 
    for(Int_t icentr = 0; icentr < ncentr; icentr++){
      tasks[icentr]->Print();
      cout << "MC KINEMATICS:" << useMCKinematics << endl;
      
      tasks[icentr]->SetIsMC(useMCKinematics);
      tasks[icentr]->SetOfflineTrigger(AliVEvent::kMB);
      if(optionStr.Contains("TPC")) tasks[icentr]->SetTPCOnly();
      if(optionStr.Contains("NoElectrons")) task[icentr]->RejectElectrons(kTRUE);
      if(useMCKinematics) tasks[icentr]->GetHistoManager()->SetSuffix("MC");
      if(customSuffix!=""){
	cout << "Setting custom suffix: " << customSuffix+long(icentr) << endl;    
	tasks[icentr]->GetHistoManager()->SetSuffix(customSuffix+long(icentr));
      }	
    }    
  }
  // Init and run the analy
  if (!mgr->InitAnalysis()) return;

  mgr->PrintStatus();
  
  if (runMode == kMyRunModeLocal ) {
    // If running in local mode, create chain of ESD files
    cout << "RUNNING LOCAL, CHAIN" << endl;    
    TChain * chain = GetAnalysisChain(data);
    chain->Print();
    mgr->StartAnalysis("local",chain,nev);
  } else if (runMode == kMyRunModeProofLite) {
    TChain * chain = GetAnalysisChain(data);
    mgr->StartAnalysis("proof",chain,nev);
  } 
  else if (runMode == kMyRunModeCAF) {
    mgr->StartAnalysis("proof",TString(data)+"#esdTree",nev);
  } else if (runMode == kMyRunModeGRID) {
    mgr->StartAnalysis("grid");
  } else {
    cout << "ERROR: unknown run mode" << endl;        
  }

  if (!useOtherCentralityCut) {
    pathsuffix = pathsuffix + "_" + centrEstimator + "_bin_"+long(centrBin);
  } else if(useOtherCentralityCut==1){
    pathsuffix = pathsuffix + "_TrackRange_" + long(trackMin) + "_" + long(trackMax);
  } else if(useOtherCentralityCut==2){
    pathsuffix = pathsuffix + "_V0Range_" + long(trackMin) + "_" + long(trackMax);
  } else if(useOtherCentralityCut==3){
    pathsuffix = pathsuffix + "_SPDOutRange_" + long(trackMin) + "_" + long(trackMax);
  }
  pathsuffix += customSuffix;

  if (doSave) MoveOutput(data, pathsuffix.Data());

  

  
}
Example #4
0
//
// *** Configuration script for K*+-->K0Short-Pi analysis ***
// 
// A configuration script for RSN package needs to define the followings:
//
// (1) decay tree of each resonance to be studied, which is needed to select
//     true pairs and to assign the right mass to all candidate daughters
// (2) cuts at all levels: single daughters, tracks, events
// (3) output objects: histograms or trees
//
Bool_t ConfigKStarPlusMinus
(  
   AliRsnMiniAnalysisTask *task,
   Int_t		   collSyst, 
   Bool_t                  isMC,
   Float_t                 piPIDCut,
   Float_t                 pPIDCut,
   Int_t                   aodFilterBit,
   Float_t                 trackDCAcut,
   Float_t                 massTol,
   Float_t                 lambdaDCA,
   Float_t                 lambdaCosPoinAn,
   Float_t                 lambdaDaughDCA,
   Int_t                   NTPCcluster,
   const char             *suffix,
   AliRsnCutSet           *cutsPair
)
{
   // manage suffix
   if (strlen(suffix) > 0) suffix = Form("_%s", suffix);
 
   /////////////////////////////////////////////////////
   // selections for the pion from the decay of KStarPlusMinus*
   /////////////////////////////////////////////////////
   //
   AliRsnCutDaughterSigmaStar2010PP *cutPi = new AliRsnCutDaughterSigmaStar2010PP("cutPionForKStarPlusMinus", AliPID::kPion);
   cutPi->SetPIDCut(piPIDCut);    // fPIDCut used in IsSelected() after the call to cutQuality
   AliRsnCutTrackQuality *cutQuality = (AliRsnCutTrackQuality*) cutPi->CutQuality();
   //cutQuality->SetDefaults2011();
   cutQuality->SetDefaults2010(0,1);  // 1st par. not default (0 -> use TPC clusters). 2nd par. default (-> standard Pt and eta range)
   // SetDefaults2010 contains the following selections:
   //     SetPtRange(0.15, 1E+20);
   //     SetEtaRange(-0.8, 0.8);
   //     and from aliroot/master/src/ANALYSIS/ANALYSISalice/AliESDtrackCuts.cxx
   //     AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(1,0)
   //         esdTrackCuts->SetMinNClustersTPC(70);
   //         esdTrackCuts->SetMaxChi2PerClusterTPC(4);
   //         esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
   //         esdTrackCuts->SetRequireTPCRefit(kTRUE);
   //         esdTrackCuts->SetRequireITSRefit(kTRUE);
   //         esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
   //         esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");    // NB. With pt_min=0.15 (see above) -> DCAxy_max = 0.2560
   //         esdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
   //         esdTrackCuts->SetMaxDCAToVertexZ(2);
   //         esdTrackCuts->SetDCAToVertex2D(kFALSE);
   //         esdTrackCuts->SetRequireSigmaToVertex(kFALSE);  
   //         esdTrackCuts->SetMaxChi2PerClusterITS(36);
   //  
   AliRsnCutSet *cutSetPi = new AliRsnCutSet("setPionForKStarPlusMinus", AliRsnTarget::kDaughter);
   cutSetPi->AddCut(cutPi);
   cutSetPi->SetCutScheme(cutPi->GetName());
   Int_t iCutPi = task->AddTrackCuts(cutSetPi);
   //
   /////////////////////////////////////////////////////////////
   // selections for Lambda and for the daughters of Lambda 
   /////////////////////////////////////////////////////////////
   // 
   // selections for the proton and pion daugthers of Lambda and AntiLambda
   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("qualityDaughterLambda");   
   esdTrackCuts->SetPtRange(0.15,1.E10);
   esdTrackCuts->SetEtaRange(-0.8,0.8);
   esdTrackCuts->SetRequireTPCRefit();
   esdTrackCuts->SetAcceptKinkDaughters(0); //
   esdTrackCuts->SetMinNClustersTPC(NTPCcluster);
   esdTrackCuts->SetMaxChi2PerClusterTPC(4);
   esdTrackCuts->SetMinDCAToVertexXY(0.15);   
   //
   /////////////////////////////////////////////////
   // selections for Lambda
   AliRsnCutV0 *cutLambda = new AliRsnCutV0("cutLambda", kK0Short, AliPID::kPion, AliPID::kPion);
   cutLambda->SetPIDCutProton(pPIDCut);       // PID for the proton daughter of Lambda
   cutLambda->SetPIDCutPion(piPIDCut);        // PID for the pion daughter of Lambda 
   cutLambda->SetESDtrackCuts(esdTrackCuts);  // all the other selections (defined above) for proton and pion daughters of Lambda
   cutLambda->SetMaxDaughtersDCA(lambdaDaughDCA);
   cutLambda->SetMaxDCAVertex(lambdaDCA);
   cutLambda->SetMinCosPointingAngle(lambdaCosPoinAn);
   cutLambda->SetTolerance(massTol);
   cutLambda->SetMaxRapidity(0.5);
   //
   AliRsnCutSet *cutSetLambda = new AliRsnCutSet("setLambda", AliRsnTarget::kDaughter);
   cutSetLambda->AddCut(cutLambda);
   cutSetLambda->SetCutScheme(cutLambda->GetName());
   Int_t iCutLambda = task->AddTrackCuts(cutSetLambda);
   //
   
   
   //######################################################################################################  
    
   //
   // -- Values ------------------------------------------------------------------------------------
   //
   
   /* invariant mass   */ Int_t imID   = task->CreateValue(AliRsnMiniValue::kInvMass, kFALSE);
   /* transv. momentum */ Int_t ptID   = task->CreateValue(AliRsnMiniValue::kPt, kFALSE);
   /* centrality       */ Int_t centID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
   
   //
   // -- Create all needed outputs -----------------------------------------------------------------
   //
   
   // use an array for more compact writing, which are different on mixing and charges
   // [0] = unlike
   // [1] = mixing
   // [2] = like ++
   // [3] = like --
   Bool_t   use     [6] = {1               ,1                ,1                  ,1                   ,1                ,1                 };
   Bool_t   useIM   [6] = {1               ,1                ,1                  ,1                   ,1                ,1                 };
   TString  name    [6] = {"KStarPlusMinus","AKStarPlusMinus","KStarPlusMinusmix","AKStarPlusMinusmix","KStarPlusMinust","AKStarPlusMinust"};
   TString  comp    [6] = {"PAIR"          ,"PAIR"           ,"MIX"              ,"MIX"               ,"TRUE"           ,"TRUE"            };
   TString  output  [6] = {"HIST"          ,"HIST"           ,"HIST"             ,"HIST"              ,"HIST"           ,"HIST"            };
   Char_t   charge1 [6] = {'0'             ,'0'              ,'0'                ,'0'                 ,'0'              ,'0'               };
   Char_t   charge2 [6] = {'+'             ,'-'              ,'+'                ,'-'                 ,'+'              ,'-'               };
   Int_t    cutID1  [6] = { iCutLambda     ,iCutLambda   ,iCutLambda         ,iCutLambda      ,iCutLambda       ,iCutLambda    };
   Int_t    cutID2  [6] = { iCutPi         ,iCutPi           ,iCutPi             ,iCutPi              ,iCutPi           ,iCutPi            };
   Int_t    ipdg    [6] = {323             ,-323             ,323                ,-323                ,323              ,-323              };
   Double_t mass    [6] = { 0.89166        ,0.89166          ,0.89166            ,0.89166             ,0.89166          ,0.89166           };
   
   for (Int_t i = 0; i < 6; i++) {
      if (!use[i]) continue;
      if (collSyst) output[i] = "SPARSE";
      // create output
      AliRsnMiniOutput *out = task->CreateOutput(Form("sigmastar_%s%s", name[i].Data(), suffix), output[i].Data(), comp[i].Data());
      // selection settings
      out->SetCutID(0, cutID1[i]);
      out->SetCutID(1, cutID2[i]);
      out->SetDaughter(0, AliRsnDaughter::kKaon0);
      out->SetDaughter(1, AliRsnDaughter::kPion);
      out->SetCharge(0, charge1[i]);
      out->SetCharge(1, charge2[i]);
      out->SetMotherPDG(ipdg[i]);
      out->SetMotherMass(mass[i]);
      // pair cuts
      out->SetPairCuts(cutsPair);
      // axis X: invmass
      if (useIM[i]) 
             out->AddAxis(imID, 2000, 0, 2.0);
      //  out->AddAxis(imID, 700, 1.2, 4.0);
      // axis Y: transverse momentum
	  out->AddAxis(ptID, 100, 0.0, 10.0);
	 //out->AddAxis(lambdaDCA, 10, 0.0, 1.0);
	 
      if (collSyst) out->AddAxis(centID, 10, 0.0, 100.0);
      
    } 
    
   AddMonitorOutput_PionPt(cutSetPi->GetMonitorOutput());
   AddMonitorOutput_PionEta(cutSetPi->GetMonitorOutput());
   AddMonitorOutput_PionDCAxy(cutSetPi->GetMonitorOutput());
   AddMonitorOutput_PionDCAz(cutSetPi->GetMonitorOutput());
   AddMonitorOutput_PionPIDCut(cutSetPi->GetMonitorOutput());
   AddMonitorOutput_PionNTPC(cutSetPi->GetMonitorOutput());
   AddMonitorOutput_PionTPCchi2(cutSetPi->GetMonitorOutput());
   
   // AddMonitorOutput_LambdaP(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaPt(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaNegDaughPt(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaPosDaughPt(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaMass(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaDCA(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaRadius(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaDaughterDCA(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaCosPointAngle(cutSetLambda->GetMonitorOutput());
   //   AddMonitorOutput_LambdaProtonPID(cutSetLambda->GetMonitorOutput());
   AddMonitorOutput_LambdaPionPID(cutSetLambda->GetMonitorOutput());
   
   if (isMC) {
     
     TString mode = "HIST";
     if (collSyst) mode = "SPARSE";
     
     // create output
     AliRsnMiniOutput *out = task->CreateOutput(Form("KStarPlusMinus_TrueMC%s", suffix), mode.Data(), "MOTHER");
     // selection settings
     out->SetDaughter(0, AliRsnDaughter::kKaon0);
     out->SetDaughter(1, AliRsnDaughter::kPion);
     out->SetMotherPDG(323);
     out->SetMotherMass(0.89166);
     // pair cuts
     out->SetPairCuts(cutsPair);
     // binnings
     out->AddAxis(imID, 2000, 0.0, 2.0);
     out->AddAxis(ptID, 100, 0.0, 10.0);
     //out->AddAxis(lambdaDCA, 10, 0.0, 1.0);
     
     if (collSyst) out->AddAxis(centID, 10, 0.0, 100.0);
     
     // create output
     AliRsnMiniOutput *out = task->CreateOutput(Form("AKStarPlusMinus_TrueMC%s", suffix), mode.Data(), "MOTHER");
     // selection settings
     out->SetDaughter(0, AliRsnDaughter::kKaon0);
     out->SetDaughter(1, AliRsnDaughter::kPion);
     out->SetMotherPDG(-323);
     out->SetMotherMass(0.89166);
     // pair cuts
     out->SetPairCuts(cutsPair);
     // binnings
     out->AddAxis(imID, 2000, 0.0, 2.0);
     out->AddAxis(ptID, 100, 0.0, 10.0);
     //out->AddAxis(lambdaDCA, 10, 0.0, 1.0);
     
     if (collSyst) out->AddAxis(centID, 10, 0.0, 100.0);
     
   }
   
   return kTRUE;
}
AliCFSingleTrackEfficiencyTask *AddSingleTrackEfficiencyTaskAnalysisQA(TString collSyst="pp",
								       const Bool_t readAOD = 0, // Flag to read AOD:1 or ESD:0
								       TString suffix="default", // suffix for the output directory
								       AliPID::EParticleType specie=AliPID::kPion, 
								       Int_t pdgcode=0, //particle specie
								       Bool_t useMCtruthForKine=kFALSE,
								       Double_t maxRadiusForPrimaries=999.,
								       ULong64_t triggerMask=AliVEvent::kAnyINT,
								       TString centralityEstimator = "V0M",
								       Int_t fBit=0,
								       Bool_t TPCRefit = kTRUE,
								       Int_t minclustersTPC = 0,
								       Bool_t ITSRefit = kTRUE,
								       Int_t spdHits=AliESDtrackCuts::kAny,
								       Int_t minclustersITS = 0,
								       Bool_t useRecoEvSelCutsForKine=kFALSE,
								       Int_t configuration=AliCFSingleTrackEfficiencyTask::kFast,
								       Int_t usageOfBayesianPID=AliSingleTrackEffCuts::kNoBayesianPID)
{

  Info("AliCFSingleTrackEfficiencyTask","SETUP CONTAINER");

  //
  // Setting up the container
  // 
  // Variables
  const Int_t nvar = 7; // number of variables on the grid: pt, y, phi, theta, zvtx, multiplicity, centrality
  UInt_t nstep = 8;     // number of container steps
  const UInt_t ipt = 0;
  const UInt_t ieta  = 1;
  const UInt_t iphi = 2;
  const UInt_t itheta = 3;
  const UInt_t izvtx = 4;
  const UInt_t imult = 5;
  const UInt_t icent = 6;
  //
  // Containter bining

  const Int_t nbinpt=30;
  //   A2. Bins variation by hand for other variables
  const Int_t nbin2 = configuration==AliCFSingleTrackEfficiencyTask::kSlow ? 8 : 8; //bins in eta
  const Int_t nbin3 = configuration==AliCFSingleTrackEfficiencyTask::kSlow ? 9 : 18; //bins in phi
  const Int_t nbin4 = configuration==AliCFSingleTrackEfficiencyTask::kSlow ? 9 : 1; //bins in theta
  const Int_t nbin5 = configuration==AliCFSingleTrackEfficiencyTask::kSlow ? 10 : 4; //bins in zvtx

  const Int_t nbinmult=8;
  const Int_t nbincent=12;

  //arrays for the number of bins in each dimension
  Int_t iBin[nvar];
  iBin[0]=nbinpt;
  iBin[1]=nbin2;
  iBin[2]=nbin3;
  iBin[3]=nbin4;
  iBin[4]=nbin5;
  iBin[5]=nbinmult;
  iBin[6]=nbincent;

  //arrays for lower bounds :
  Double_t binLimpT[nbinpt+1] = {0.00,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.50,0.60,
				 0.70,0.80,0.90,1.00,1.25,1.50,1.75,2.00,2.50,3.00,
				 3.50,4.00,5.00,6.00,7.00,8.00,10.0,12.0,16.0,20.0,30.0};

  Double_t *binLim2 = new Double_t[iBin[1]+1];
  Double_t *binLim3 = new Double_t[iBin[2]+1];
  Double_t *binLim4 = new Double_t[iBin[3]+1];
  Double_t *binLim5 = new Double_t[iBin[4]+1];
  Double_t binLimmult[nbinmult+1] = {0.,5.,10.,20.,30.,40.,50.,80.,200.};
  Double_t binLimcent[nbincent+1] = {0.,2.5,5.0,7.5,10.,15.,20.,30.,40.,50.,60.,80.,100.};
  if(collSyst=="Pb-Pb" || collSyst=="PbPb" || collSyst=="Xe-Xe" || collSyst=="XeXe"){
    binLimmult[1]=100.;
    binLimmult[2]=500.;
    binLimmult[3]=1000.;
    binLimmult[4]=2000.;
    binLimmult[5]=3000.;
    binLimmult[6]=4000.;
    binLimmult[7]=5000.;
    binLimmult[8]=10000.;
  }

  // Other Variables
  for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)etamin + (etamax-etamin)/nbin2*(Double_t)i ;
  for(Int_t i=0; i<=nbin3; i++) binLim3[i]=(Double_t)phimin + (phimax-phimin)/nbin3*(Double_t)i ;
  for(Int_t i=0; i<=nbin4; i++) binLim4[i]=(Double_t)thetamin + (thetamax-thetamin)/nbin4*(Double_t)i ;
  for(Int_t i=0; i<=nbin5; i++) binLim5[i]=(Double_t)zvtxmin + (zvtxmax-zvtxmin)/nbin5*(Double_t)i ;

  // Container  
  AliCFContainer* container = new AliCFContainer(Form("container%s",suffix.Data()),"container for tracks",nstep,nvar,iBin);
  container -> SetBinLimits(ipt,binLimpT);    // pt
  container -> SetBinLimits(ieta,binLim2);      // eta
  container -> SetBinLimits(iphi,binLim3);    // phi
  container -> SetBinLimits(itheta,binLim4);  // theta
  container -> SetBinLimits(izvtx,binLim5);   // Zvtx
  container -> SetBinLimits(imult,binLimmult);// multiplicity
  container -> SetBinLimits(icent,binLimcent);// centrality

  // Variable Titles
  container -> SetVarTitle(ipt,"pt");
  container -> SetVarTitle(ieta, "eta");
  container -> SetVarTitle(iphi,"phi");
  container -> SetVarTitle(itheta, "theta");
  container -> SetVarTitle(izvtx, "Zvtx");
  container -> SetVarTitle(imult, "Multiplicity");
  container -> SetVarTitle(icent, "Centrality");

  // Step Titles
  container -> SetStepTitle(0, " MC Particle with Generated Cuts");
  container -> SetStepTitle(1, " MC Particle with Kine Acceptance Cuts");
  container -> SetStepTitle(2, " MC Particle with Track Ref Acceptance Cuts");
  container -> SetStepTitle(3, " Total Reconstructed  Particle ");
  container -> SetStepTitle(4, " Reco Particle With Kine Acceptance Cuts");
  container -> SetStepTitle(5, " Reco Particle to MC True pt particles ");
  container -> SetStepTitle(6, " Reco Particle With Quality Cuts");
  container -> SetStepTitle(7, " Reco PID With Quality Cuts");


  // SET TLIST FOR QA HISTOS
  TList* qaList = new TList();
  TObjArray* emptyList = new TObjArray(0);

  //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
  printf("CREATE INTERFACE AND CUTS\n");
  AliCFManager* man = new AliCFManager();

  man->SetNStepEvent(2);
  man->SetEventContainer(container);
  man->SetEventCutsList(0,emptyList);//evtmcList);
  man->SetEventCutsList(1,emptyList);//evtrecoList);
  
  man->SetParticleContainer(container);
  man->SetParticleCutsList(0,emptyList);//mcGenList);
  man->SetParticleCutsList(1,emptyList);//mcKineList);
  man->SetParticleCutsList(2,emptyList);//mcaccList);
  man->SetParticleCutsList(3,emptyList);//evtrecoPureList);
  man->SetParticleCutsList(4,emptyList);//recKineList);
  man->SetParticleCutsList(5,emptyList);
  man->SetParticleCutsList(6,emptyList);
  man->SetParticleCutsList(7,emptyList);
  
  // Simulated particle & event cuts
  AliSingleTrackEffCuts* cuts = new AliSingleTrackEffCuts();
  cuts->SetPtRange(ptmin,ptmax);
  cuts->SetEtaRange(etamin,etamax);
  cuts->SetIsCharged(ischarged);
  cuts->SetMinVtxContr(1);
  cuts->SetMaxVtxZ(zvtxmax);
  cuts->SetNumberOfClusters(mintrackrefsITS,mintrackrefsTPC,mintrackrefsTOF,mintrackrefsMUON);
  cuts->SetTriggerMask(triggerMask);
  cuts->SetIsAOD(readAOD);
  cuts->SetMaxRadiusOfParticleOrigin(maxRadiusForPrimaries);
  //
  // Pid selection here
  //
  if(pdgcode>0){
    cuts->SetUsePid(true);
    cuts->SetParticleSpecie(specie);
    cuts->SetPdgCode(pdgcode);
    // 
    const Int_t nlims=1;
    Float_t plims[nlims+1]={0.,999.}; //TPC limits in momentum [GeV/c]
    Float_t sigmas[nlims]={3.};
    cuts->SetUseTPCPid();
    cuts->SetTPCSigmaPtBins(nlims,plims,sigmas);
    cuts->SetMaximumPTPC(4.);
    // 
    const Int_t nlims2=1;
    Float_t plims2[nlims2+1]={0.,999.}; //TPC limits in momentum [GeV/c]
    Float_t sigmas2[nlims2]={3.};
    cuts->SetUseTOFPid();
    cuts->SetTOFSigmaPtBins(nlims2,plims2,sigmas2);
    cuts->SetMaximumPTOF(4.);

    if(usageOfBayesianPID>0) {
      cuts->SetUseCombinPID(usageOfBayesianPID);
      if(usageOfBayesianPID==AliSingleTrackEffCuts::kThresholdBayesianProb)
	cuts->SetPIDThreshold(thresholdPID);
    }

  }

  //
  //  Track Quality cuts via ESD track cuts
  //
  AliESDtrackCuts* QualityCuts = new AliESDtrackCuts();
  QualityCuts->SetRequireSigmaToVertex(kFALSE);
  QualityCuts->SetMinNClustersTPC(minclustersTPC);
  QualityCuts->SetMinNClustersITS(minclustersITS);
  QualityCuts->SetRequireTPCRefit(TPCRefit);
  QualityCuts->SetRequireITSRefit(ITSRefit);
  QualityCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,spdHits);
  QualityCuts->SetMinDCAToVertexXY(0.);
  QualityCuts->SetEtaRange(etamin,etamax);
  QualityCuts->SetPtRange(ptmin,ptmax);


  //CREATE THE TASK
  printf("CREATE CF Single track task\n");

  AliCFSingleTrackEfficiencyTask *task = new AliCFSingleTrackEfficiencyTask("AliCFSingleTrackEfficiencyTask",QualityCuts,cuts);
  if(readAOD && fBit>=0){
    task->SetFilterBit(kTRUE);
    task->SetFilterType(fBit);
  }else{
    task->SetFilterBit(kFALSE);
  }

  //  task->SelectCollisionCandidates(triggerMask);//AliVEvent::kMB);
  if(centralityEstimator != "") task->SetUseCentrality(kTRUE,centralityEstimator);
  task->SetConfiguration(configuration);
  task->SetUseGeneratedKine(useMCtruthForKine);
  if(useRecoEvSelCutsForKine) task->ApplyRecoEventSelectionsToFillMCKine();
  task->SetCFManager(man); //here is set the CF manager

  //
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTask", "No analysis manager to connect to.");
    return NULL;
  }

  // This task requires an ESD or AOD input handler and an AOD output handler.
  // Check this using the analysis manager.
  //===============================================================================
  TString type = mgr->GetInputEventHandler()->GetDataType();
  if (!type.Contains("ESD") && !type.Contains("AOD")) {
    ::Error("AddSingleTrackEfficiencyTaskPbPb", "AliCFSingleTrackEfficiency task needs the manager to have an ESD or AOD input handler.");
    return NULL;
  }
  
  mgr->AddTask(task);
  printf(" Create the output container\n");

  //
  // Create and connect containers for input/output
  //
  // ----- output data -----
  TString outputfile = AliAnalysisManager::GetCommonFileName();
  TString input1name="cchain0";
  TString output2name="HistEventsProcessed", output3name="container",output4name="list",output5name="ESDtrackCuts",output6name="MCtrackCuts";
  outputfile += ":PWGPP_CFSingleTrack";
//  outputfile += suffix;
  output2name += suffix;
  output3name += suffix;
  output4name += suffix;
  output5name += suffix;
  output6name += suffix;


  // ------ input data ------
  AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
  // ----- output data -----
  // output TH1I for event counting
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(output2name, TH1I::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
  // output Correction Framework Container (for acceptance & efficiency calculations)
  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(output3name, AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
  // output QA histograms
  AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(output4name, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
  // output ESD track cuts for book keeping
  AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(output5name, AliESDtrackCuts::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
  // output event and particle selection cuts for book keeping
  AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(output6name, AliSingleTrackEffCuts::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());

  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
  mgr->ConnectOutput(task,1,coutput1);
  mgr->ConnectOutput(task,2,coutput2);
  mgr->ConnectOutput(task,3,coutput3);
  mgr->ConnectOutput(task,4,coutput4);
  mgr->ConnectOutput(task,5,coutput5);

  return task;
}
Example #6
0
void AnalysisTrainMuonCAF(char* fileout = "AliAOD.root", char *datasetname = "myDataSet", Int_t nev=1234567890)
{
// Macro to produce a generic AOD starting from an ESD file. 
// The AOD is filled with two tasks: 
// 1- with the first one (AliAnalysisTaskESDfilter), 
//    all the branches of the AOD are filled apart from the muons. 
// 2- with the second task (AliAnalysisTaskESDMuonFilter) 
//    muons tracks are added to the tracks branch 
// This macro works on the CAF
// R. Arnaldi 4/5/08

  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
    
  // Reset user processes if CAF if not responding anymore
  // TProof::Reset("lxb6046");

  // Connect to proof
  TProof::Open("lxb6046"); // may be username@lxb6046 if user not the same as on local

  // Clear packages if changing ROOT version on CAF or local
  // gProof->ClearPackages();
  // Enable proof debugging if needed
  // gProof->SetLogLevel(5);

  // Common packages
  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");
  // Analysis-specific
  // --- Enable the PWG3base Package
  gProof->UploadPackage("PWG3muon.par");
  gProof->EnablePackage("PWG3muon");

  // Chain from files staged on CAF
  // gROOT->LoadMacro("CreateESDChain.C");
  // TChain* chain = CreateESDChain("ESD1503X_v1.txt",3);
  // TChain* chain = CreateESDChain("ESD82XX_30Kshort.txt", 10);
  
  // Chain from datasets
  gROOT->LoadMacro("CreateChainFromDataSet.C");
  ds = gProof->GetDataSet(datasetname)->GetStagedSubset();
  chain = CreateChainFromDataSet(ds, "esdTree");   
  
  // Make the analysis manager
  AliAnalysisManager *mgr  = new AliAnalysisManager("Analysis Train", "Analysis train");
  
  // ESD input handler
  AliESDInputHandler *esdHandler = new AliESDInputHandler();
  esdHandler->SetInactiveBranches("FMD CaloCluster");
  
  // AOD output handler
  AliAODHandler* aodHandler   = new AliAODHandler();
  aodHandler->SetOutputFileName(fileout);
  //aodHandler->SetOutputFileName("AOD.root");

  mgr->SetInputEventHandler(esdHandler);
  mgr->SetOutputEventHandler(aodHandler);
  
  // Set of cuts plugged into the ESD filter
  // 
  // standard
  AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
  esdTrackCutsL->SetMinNClustersTPC(50);
  esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
  esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
  esdTrackCutsL->SetRequireTPCRefit(kTRUE);
  esdTrackCutsL->SetMinNsigmaToVertex(3);
  esdTrackCutsL->SetRequireSigmaToVertex(kTRUE);
  esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
  //
  // hard cuts
  AliESDtrackCuts* esdTrackCutsH = new AliESDtrackCuts("AliESDtrackCuts", "Hard");
  esdTrackCutsH->SetMinNClustersTPC(100);
  esdTrackCutsH->SetMaxChi2PerClusterTPC(2.0);
  esdTrackCutsH->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
  esdTrackCutsH->SetRequireTPCRefit(kTRUE);
  esdTrackCutsH->SetMinNsigmaToVertex(2);
  esdTrackCutsH->SetRequireSigmaToVertex(kTRUE);
  esdTrackCutsH->SetAcceptKingDaughters(kFALSE);
  esdTrackCutsH->SetPRange(0.,2.);
  //
  //  muon cuts
  AliESDMuonTrackCuts* esdMuonTrackCuts = new AliESDMuonTrackCuts("AliESDMuonTrackCuts", "test");
  esdMuonTrackCuts->SetPRange(0.,20.);
  //esdMuonTrackCuts->SetPtRange(0.,0.5);   // example of kinematic cuts that can be applied
  
  // track filter (to reject tracks not surviving the cuts - refers to all particles apart from muons)
  AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
  trackFilter->AddCuts(esdTrackCutsH);
  
  // muon track filter  (to reject muon tracks not surviving the cuts)
  AliAnalysisFilter* trackMuonFilter = new AliAnalysisFilter("trackMuonFilter");
  trackMuonFilter->AddCuts(esdMuonTrackCuts);

  // ESD filter task putting standard info to output generic AOD 
  AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
  //esdfilter->SetTrackFilter(trackFilter);
  esdfilter->SetDebugLevel(10);
  mgr->AddTask(esdfilter);
  
  // ESD filter task putting muon info to output generic AOD 
  AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter");
  esdmuonfilter->SetTrackFilter(trackMuonFilter);
  mgr->AddTask(esdmuonfilter);

  // Containers for input/output
  AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
  // Output AOD container. 
  AliAnalysisDataContainer *cout_aod = mgr->GetCommonOutputContainer();
        						    
  // Connect containers to tasks slots
  mgr->ConnectInput  (esdfilter,  0, cin_esd  );
  mgr->ConnectOutput (esdfilter,  0, cout_aod );

  mgr->ConnectInput  (esdmuonfilter,  0, cin_esd);
  mgr->ConnectOutput (esdmuonfilter,  0, cout_aod );

  //
  // Run the analysis
  //	
  if (mgr->InitAnalysis()) {
      mgr->PrintStatus();
      mgr->StartAnalysis("proof",chain,nev);
  }   
}
Example #7
0
File: run.C Project: ktf/AliPhysics
void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Int_t aProof = kFALSE, Int_t requiredData = 1, const char* option = "")
{
  // runWhat options: 0 = AlidNdEtaTask
  //                  1 = AlidNdEtaCorrectionTask
  //                  2 = both
  //
  // aProof option: 0 no proof
  //                1 proof with chain
  //                2 proof with dataset
  //
  // requiredData option: 0 = only ESD
  //                      1 = ESD+MC
  //                      2 = RAW (ESD+check on event type)
  //
  // option is passed to the task(s)
  //   option SAVE is removed and results in moving the output files to maps/<ds name>/<trigger>/<det>
  //
  
  TString taskName;
  if (runWhat == 0 || runWhat == 2)
  {
    Printf("Running AlidNdEtaTask");
  }
  if (runWhat == 1 || runWhat == 2)
  {
    Printf("Running AlidNdEtaCorrectionTask");
    if (requiredData != 1)
    {
      Printf("AlidNdEtaCorrectionTask needs MC. Exiting...");
      return;
    }
  }

  if (nRuns < 0)
    nRuns = 1234567890;

  if (aProof)
  {
    TProof::Open("alice-caf"); 

    Bool_t fullAliroot = kFALSE;
    // Enable the needed package
    if (1)
    {
      gProof->UploadPackage("$ALICE_ROOT/STEERBase");
      gProof->EnablePackage("$ALICE_ROOT/STEERBase");
      gProof->UploadPackage("$ALICE_ROOT/ESD");
      gProof->EnablePackage("$ALICE_ROOT/ESD");
      gProof->UploadPackage("$ALICE_ROOT/AOD");
      gProof->EnablePackage("$ALICE_ROOT/AOD");
      gProof->UploadPackage("$ALICE_ROOT/ANALYSIS");
      gProof->EnablePackage("$ALICE_ROOT/ANALYSIS");
      gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice");
      gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice");
    }
    else if (!fullAliroot)
    {
      gProof->UploadPackage("$ALICE_ROOT/AF-v4-18-12-AN.par");
      gProof->EnablePackage("AF-v4-18-12-AN");
    }
    else
    {
      // needed if ITS recpoints are accessed, see AlidNdEtaTask, FULLALIROOT define statement
      gProof->UploadPackage("$ALICE_ROOT/v4-18-15-AN-all.par");
      gProof->EnablePackage("v4-18-15-AN-all");
    
      gProof->Exec("TGrid::Connect(\"alien://\")", kTRUE);
      
      // TODO add this to loadlibs.C
      gProof->Exec("gSystem->Load(\"libXMLParser\")", kTRUE);
    }

    gProof->UploadPackage("$ALICE_ROOT/PWG0base");
    gProof->EnablePackage("$ALICE_ROOT/PWG0base");
  }
  else
  {
    gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/"); 
    gSystem->Load("libVMC");
    gSystem->Load("libTree");
    gSystem->Load("libProof");
    gSystem->Load("libSTEERBase");
    gSystem->Load("libESD");
    gSystem->Load("libAOD");
    gSystem->Load("libANALYSIS");
    gSystem->Load("libANALYSISalice");
    gSystem->Load("libPWG0base");
  }

  // Create the analysis manager
  mgr = new AliAnalysisManager;

  // Add ESD handler
  
  if (fullAliroot)
    AliESDInputHandler* esdH = new AliESDInputHandlerRP; // for RecPoints
  else
    AliESDInputHandler* esdH = new AliESDInputHandler;
  
  esdH->SetInactiveBranches("FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks MuonTracks TrdTracks");
  mgr->SetInputEventHandler(esdH);

  AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD | AliPWG0Helper::kFieldOn;
  //AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD | AliPWG0Helper::kFieldOn | AliPWG0Helper::kSPDOnlyL0;
  //AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kTPCITS | AliPWG0Helper::kFieldOn;
  
  AliTriggerAnalysis::Trigger trigger      = AliTriggerAnalysis::kAcceptAll | AliTriggerAnalysis::kOfflineFlag;
  //AliTriggerAnalysis::Trigger trigger      = AliTriggerAnalysis::kAcceptAll | AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kOneParticle;
  
  //AliTriggerAnalysis::Trigger trigger      = AliTriggerAnalysis::kSPDGFOBits | AliTriggerAnalysis::kOfflineFlag;
  //AliTriggerAnalysis::Trigger trigger      = AliTriggerAnalysis::kSPDGFOBits | AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kOneParticle;
  
  //AliTriggerAnalysis::Trigger trigger      = AliTriggerAnalysis::kV0AND | AliTriggerAnalysis::kOfflineFlag; 
  
  //AliTriggerAnalysis::Trigger trigger      = AliTriggerAnalysis::kV0OR | AliTriggerAnalysis::kOfflineFlag; 
  //AliTriggerAnalysis::Trigger trigger      = AliTriggerAnalysis::kV0OR | AliTriggerAnalysis::kOfflineFlag | AliTriggerAnalysis::kOneParticle; 

  AliPWG0Helper::DiffTreatment diffTreatment = AliPWG0Helper::kMCFlags;
  //AliPWG0Helper::DiffTreatment diffTreatment = AliPWG0Helper::kE710Cuts;
  
  AliPWG0Helper::PrintConf(analysisMode, trigger, diffTreatment);

  AliESDtrackCuts* esdTrackCuts = 0;
  if (!(analysisMode & AliPWG0Helper::kSPD))
  {
    // selection of esd tracks
    gROOT->ProcessLine(".L ../CreateStandardCuts.C");
    esdTrackCuts = CreateTrackCuts(analysisMode);
    if (!esdTrackCuts)
    {
      printf("ERROR: esdTrackCuts could not be created\n");
      return;
    }
    esdTrackCuts->SetHistogramsOn(kTRUE);
  }

  cInput = mgr->GetCommonInputContainer();
  
  // remove SAVE option if set
  Bool_t save = kFALSE;
  TString optStr(option);
  if (optStr.Contains("SAVE"))
  {
    optStr = optStr(0,optStr.Index("SAVE")) + optStr(optStr.Index("SAVE")+4, optStr.Length());
    save = kTRUE;
  }
  
  // physics selection
  gROOT->ProcessLine(".L $ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
  physicsSelectionTask = AddTaskPhysicsSelection((requiredData == 2) ? kFALSE : kTRUE);
  
  // 900 GeV 
  if (0 && requiredData == 2)
  {
    physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #769 #3119");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL #446 #2554");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1C-ABCE-NOPF-ALL #1334 #2228");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1-E-NOPF-ALL #790");
  }
  
  // 7 TeV, run 114783
  if (0 && requiredData == 2)
  {
    physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #345");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL #2130");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1C-ABCE-NOPF-ALL #3018");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1-E-NOPF-ALL #1238");
  }

  // 7 TeV, run 114786,98
  if (0 && requiredData == 2)
  {
    physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1B-ABCE-NOPF-ALL #346");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1A-ABCE-NOPF-ALL #2131");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1C-ABCE-NOPF-ALL #3019");
    physicsSelectionTask->GetPhysicsSelection()->AddBGTriggerClass("+CINT1-E-NOPF-ALL #1238");
    //physicsSelectionTask->GetPhysicsSelection()->Initialize(114786);
  }

  // FO efficiency (for MC)
  if (0 && requiredData != 2)
  {
    //const char* fastORFile = "spdFOEff_run104824_52.root";
    //const char* fastORFile = "spdFOEff_run104867_92.root";
    //const char* fastORFile = "spdFOEff_run105054_7.root";
    const char* fastORFile = "spdFOEff_run114931.root";
  
    Printf("NOTE: Simulating FAST-OR efficiency on the analysis level using file %s", fastORFile);
    TFile::Open(fastORFile);
    spdFOEff = (TH1F*) gFile->Get("spdFOEff");
    physicsSelectionTask->GetPhysicsSelection()->Initialize(114931);
    physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis()->SetSPDGFOEfficiency(spdFOEff);
  }
  
  // V0 syst. study
  if (0)
  {
    Printf("NOTE: Systematic study for VZERO enabled!");
    physicsSelectionTask->GetPhysicsSelection()->Initialize(104867);
    for (Int_t i=0; i<1; i++)
    {
      // for MC and data
      //physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0HwPars(15, 61.5, 86.5);
      physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0AdcThr(6);
      // only for MC
      //physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0HwPars(0, 0, 125);
      //physicsSelectionTask->GetPhysicsSelection()->GetTriggerAnalysis(i)->SetV0AdcThr(0);
    }
  }
  
  // BG study
  //physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1A-ABCE-NOPF-ALL");
  //physicsSelectionTask->GetPhysicsSelection()->AddCollisionTriggerClass("+CINT1C-ABCE-NOPF-ALL");
  
  // Create, add task
  if (runWhat == 0 || runWhat == 2)
  {
    Load("AlidNdEtaTask", aDebug);
    task = new AlidNdEtaTask(optStr);

    if (requiredData == 1)
      task->SetReadMC();
      
    //physicsSelectionTask->GetPhysicsSelection()->SetBin0Callback("AlidNdEtaTask");

    // syst. error flags
    //task->SetUseMCVertex();
    //task->SetUseMCKine();
    //task->SetOnlyPrimaries();
    //task->SetFillPhi();
    //task->SetSymmetrize();

    // INEL>0 definition
    if (trigger & AliTriggerAnalysis::kOneParticle)
      task->SetMultAxisEta1();

    task->SetTrigger(trigger);
    task->SetAnalysisMode(analysisMode);
    task->SetTrackCuts(esdTrackCuts);
    //task->SetDeltaPhiCut(0.064);
    task->SetDiffTreatment(diffTreatment);

    mgr->AddTask(task);

    // Attach input
    mgr->ConnectInput(task, 0, cInput);

    // Attach output
    cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
    mgr->ConnectOutput(task, 1, cOutput);
  }

  if (runWhat == 1 || runWhat == 2)
  {
    Load("AlidNdEtaCorrectionTask", aDebug);
    task2 = new AlidNdEtaCorrectionTask(optStr);

    // syst. error flags
    //task2->SetFillPhi();
    //task2->SetOnlyPrimaries();
    //task2->SetSymmetrize();

    // to account for gaps in real life SPD geometry
    task2->SetSkipParticles();

    // INEL>0 definition
    if (trigger & AliTriggerAnalysis::kOneParticle)
      task2->SetMultAxisEta1();

    task2->SetTrigger(trigger);
    task2->SetAnalysisMode(analysisMode);
    task2->SetTrackCuts(esdTrackCuts);
    //task2->SetDeltaPhiCut(0.064);
    task2->SetDiffTreatment(diffTreatment);

    mgr->AddTask(task2);

    // Attach input
    mgr->ConnectInput(task2, 0, cInput);

    // Attach output
    cOutput = mgr->CreateContainer("cOutput2", TList::Class(), AliAnalysisManager::kOutputContainer);
    mgr->ConnectOutput(task2, 0, cOutput);
  }

  if (requiredData == 1) 
  {
    // Enable MC event handler
    AliMCEventHandler* handler = new AliMCEventHandler;
    handler->SetReadTR(kFALSE);
    mgr->SetMCtruthEventHandler(handler);
  }

  // Enable debug printouts
  if (aDebug)
    mgr->SetDebugLevel(2);

  // Run analysis
  mgr->InitAnalysis();
  mgr->PrintStatus();

  if (aProof == 2)
  {
    // process dataset

    mgr->StartAnalysis("proof", data, nRuns, offset);
    
    if (save)
    {
      TString path("maps/");
      path += TString(data).Tokenize("/")->Last()->GetName();
      
      UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) AliTriggerAnalysis::kStartOfFlags;
      switch (triggerNoFlags)
      {
        case AliTriggerAnalysis::kMB1: path += "/mb1"; break;
        case AliTriggerAnalysis::kMB2: path += "/mb2"; break;
        case AliTriggerAnalysis::kMB3: path += "/mb3"; break;
        case AliTriggerAnalysis::kSPDGFO: path += "/spdgfo"; break;
        case AliTriggerAnalysis::kSPDGFOBits: path += "/spdgfobits"; break;
        case AliTriggerAnalysis::kAcceptAll: path += "/all"; break;
        case AliTriggerAnalysis::kV0AND: path += "/v0and"; break;
        case AliTriggerAnalysis::kV0OR: path += "/v0or"; break;
        case AliTriggerAnalysis::kNSD1: path += "/nsd1"; break;
        case AliTriggerAnalysis::kMB1Prime: path += "/mb1prime"; break;
        default: Printf("ERROR: Trigger undefined for path to files"); return;
      }
      
      if (trigger & AliTriggerAnalysis::kOneParticle)
        path += "-onepart";
      
      if (strlen(requireClass) > 0 && strlen(rejectClass) == 0)
      {
        path += Form("/%s", requireClass);
      }
      else if (strlen(rejectClass) > 0)
        path += Form("/%s--%s", requireClass, rejectClass);
      
      if (analysisMode & AliPWG0Helper::kSPD)
        path += "/spd";
      
      if (analysisMode & AliPWG0Helper::kSPDOnlyL0)
        path += "onlyL0";
      
      if (analysisMode & AliPWG0Helper::kTPC)
        path += "/tpc";
        
      if (analysisMode & AliPWG0Helper::kTPCITS)
        path += "/tpcits";

      gSystem->mkdir(path, kTRUE);
      if (runWhat == 0 || runWhat == 2)
      {
        gSystem->Rename("analysis_esd_raw.root", path + "/analysis_esd_raw.root");
        if (requiredData == 1)
          gSystem->Rename("analysis_mc.root", path + "/analysis_mc.root");
      }
      if (runWhat == 1 || runWhat == 2)
      {
        if (optStr.Contains("process-types"))
          gSystem->Rename("correction_mapprocess-types.root", path + "/correction_mapprocess-types.root");
        else
          gSystem->Rename("correction_map.root", path + "/correction_map.root");
      }
      gSystem->Rename("event_stat.root", path + "/event_stat.root");
      
      Printf(">>>>> Moved files to %s", path.Data());
    }
  }
  else if (aProof == 3)
  {
    gROOT->ProcessLine(".L CreateChainFromDataSet.C");
    ds = gProof->GetDataSet(data)->GetStagedSubset();
    chain = CreateChainFromDataSet(ds, "esdTree", nRuns);
    mgr->StartAnalysis("local", chain, 1234567890, offset);
  }
  else
  {
    // Create chain of input files
    gROOT->LoadMacro("../CreateESDChain.C");

    chain = CreateESDChain(data, nRuns, offset);
    //chain = CreateChain("TE", data, nRuns, offset);

    mgr->StartAnalysis((aProof > 0) ? "proof" : "local", chain);
  }
}
AliEmcalEsdTrackFilterTask* AddTaskEmcalEsdTrackFilter(
  const char *name              = "TrackFilter",
  const char *trackCuts         = "Hybrid_LHC11h",
  const char *taskName          = "AliEmcalEsdTrackFilterTask"
)
{ 
  enum CutsType {
    kHybrid  = 0,
    kTpcOnly = 1
  };

  enum DataSet {
    kLHC10bcde  = 0,
    kLHC10h     = 0,
    kLHC11a     = 1,
    kLHC11c     = 3,
    kLHC11d     = 3,
    kLHC11h     = 3
  };

  CutsType cutsType = kHybrid;
  DataSet  dataSet  = kLHC11h;

  TString cutsLabel("hybrid tracks");
  TString dataSetLabel("LHC11h");

  TString strTrackCuts(trackCuts);
  strTrackCuts.ToLower();

  if (strTrackCuts.Contains("hybrid")) {
    cutsType = kHybrid;
  } else if (strTrackCuts.Contains("tpconly")) {
    cutsType = kTpcOnly;
    cutsLabel = "TPC only constrained tracks";
  } else {
    ::Warning("AddTaskEmcalEsdTrackFilter", "Cuts type not recognized, will assume Hybrid");
  }

  if (strTrackCuts.Contains("lhc10h")) {
    dataSet = kLHC10h;
    dataSetLabel = "LHC10h";
  } else if (strTrackCuts.Contains("lhc10b") || strTrackCuts.Contains("lhc10c") ||
      strTrackCuts.Contains("lhc10d") || strTrackCuts.Contains("lhc10e")) {
    dataSet = kLHC10bcde;
    dataSetLabel = "LHC10bcde";
  } else if (strTrackCuts.Contains("lhc11a") || strTrackCuts.Contains("lhc12a15a")) {
    dataSet = kLHC11a;
    dataSetLabel = "LHC11a";
  } else if (strTrackCuts.Contains("lhc11a1a") ||  strTrackCuts.Contains("lhc11a1b") ||
	     strTrackCuts.Contains("lhc11a1c") ||  strTrackCuts.Contains("lhc11a1d") ||
	     strTrackCuts.Contains("lhc11a1e") ||  strTrackCuts.Contains("lhc11a1f") ||
	     strTrackCuts.Contains("lhc11a1g") ||  strTrackCuts.Contains("lhc11a1h") ||
	     strTrackCuts.Contains("lhc11a1i") ||  strTrackCuts.Contains("lhc11a1j")) {
    dataSet = kLHC11a;
    dataSetLabel = "LHC11a";
  } else if (strTrackCuts.Contains("lhc11c")) {
    dataSet = kLHC11c;
    dataSetLabel = "LHC11c";
  } else if (strTrackCuts.Contains("lhc11d")) {
    dataSet = kLHC11d;
    dataSetLabel = "LHC11d";
  } else if (strTrackCuts.Contains("lhc11h") || strTrackCuts.Contains("lhc12a15e")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC11h";
  } else if (strTrackCuts.Contains("lhc12g")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC12g";
  } else if (strTrackCuts.Contains("lhc12")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC12";
  } else if (strTrackCuts.Contains("lhc13b")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC13b";
  } else if (strTrackCuts.Contains("lhc13c")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC13c";
  } else if (strTrackCuts.Contains("lhc13d")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC13d";
  } else if (strTrackCuts.Contains("lhc13e")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC13e";
  } else if (strTrackCuts.Contains("lhc13f")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC13f";
  } else if (strTrackCuts.Contains("lhc13g")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC13g";
  } else if (strTrackCuts.Contains("lhc12a15f")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC12a15f";
  } else if (strTrackCuts.Contains("lhc13b4")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC13b4";
  } else if (strTrackCuts.Contains("lhc12a15g")) {
    dataSet = kLHC11d;
    dataSetLabel = "LHC12a15g";
  } else if (strTrackCuts.Contains("lhc12f2a")) {
    dataSet = kLHC11d;
    dataSetLabel = "LHC12f2a";
  } else if (strTrackCuts.Contains("lhc12a17")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC12a17";
  } else if (strTrackCuts.Contains("lhc14a1")) {
    dataSet = kLHC11h;
    dataSetLabel = "LHC14a1";
  } else {
    ::Warning("AddTaskEmcalEsdTrackFilter", "Dataset not recognized, will assume LHC11h");
  }

  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskEmcalEsdTrackFilter", "No analysis manager to connect to.");
    return NULL;
  }  
  
  // Check the analysis type using the event handlers connected to the analysis manager.
  //==============================================================================
  AliVEventHandler *evhand = mgr->GetInputEventHandler();
  if (!evhand) {
    ::Error("AddTaskEmcalEsdTrackFilter", "This task requires an input event handler");
    return NULL;
  }
  
  if (!evhand->InheritsFrom("AliESDInputHandler")) {
    ::Info("AddTaskEmcalEsdTrackFilter", "This task is only needed for ESD analysis. No task added.");
    return NULL;
  }
  
  //-------------------------------------------------------
  // Init the task and do settings
  //-------------------------------------------------------

  AliEmcalEsdTrackFilterTask *eTask = new AliEmcalEsdTrackFilterTask(taskName); // default is no cut
  if ((dataSet == kLHC11c && cutsType == kHybrid) ||
      (dataSet == kLHC11d && cutsType == kHybrid) ||
      (dataSet == kLHC11h && cutsType == kHybrid)) {
    /* hybrid track cuts*/
    AliESDtrackCuts *cutsp = AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(10001008);       //1000 adds SPD any requirement
    eTask->SetTrackCuts(cutsp);
    AliESDtrackCuts *hybsp = AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(10041008);       //1004 removes ITSrefit requirement from standard set
    hybsp->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
    eTask->SetHybridTrackCuts(hybsp);
    eTask->SetIncludeNoITS(kFALSE);
  } else if ((dataSet == kLHC10h && cutsType == kHybrid) ||
	     (dataSet == kLHC11a && cutsType == kHybrid)) {
    /* hybrid track cuts*/
    AliESDtrackCuts *cutsp = AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(10001006);       //1000 adds SPD any requirement
    eTask->SetTrackCuts(cutsp);
    AliESDtrackCuts *hybsp = AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(10041006);       //1004 removes ITSrefit requirement from standard set
    hybsp->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
    eTask->SetHybridTrackCuts(hybsp);
    eTask->SetIncludeNoITS(kTRUE);
  }
  else if (dataSet == kLHC11h && cutsType == kTpcOnly) {
    /* TPC-only constrained track cuts*/
    AliESDtrackCuts *cutsp = AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(2001);       //TPC-only loose track cuts
    eTask->SetTrackCuts(cutsp);
    eTask->SetHybridTrackCuts(0);
  }
  else {
    ::Error("AddTaskEmcalEsdTrackFilter","Track cuts type / period not recognized! Undefined beahviour will follow!");
  }
  eTask->SetTracksName(name);

  std::cout << " *** Track selector task configured to select " << cutsLabel  << " in dataset "<< dataSetLabel << " *** " << std::endl;

  //-------------------------------------------------------
  // Final settings, pass to manager and set the containers
  //-------------------------------------------------------
  mgr->AddTask(eTask);
  
  // Create containers for input/output
  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
  mgr->ConnectInput(eTask, 0, cinput1);
  
  return eTask;
}
Example #9
0
//______________________________________________________________________________________
void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition /*, Bool_t isAOD*/)
{
  //
  // Setup the track cuts
  //
  
  
  
  AliDielectronTrackCuts *ITSrefit=new AliDielectronTrackCuts("ITSrefit","ITSrefit");
  ITSrefit->SetRequireITSRefit(kTRUE);
  diele->GetTrackFilter().AddCuts(ITSrefit);
  
  AliDielectronTrackCuts *TPCrefit=new AliDielectronTrackCuts("TPCrefit","TPCrefit");
  TPCrefit->SetRequireTPCRefit(kTRUE);
  diele->GetTrackFilter().AddCuts(TPCrefit);  

  //Pt cut ----------------------------------------------------------
  AliDielectronVarCuts *p = new AliDielectronVarCuts("mom","mom");
  p->AddCut(AliDielectronVarManager::kPt,0.8,1e30);
  
  diele->GetTrackFilter().AddCuts(p);
  
  
  AliDielectronVarCuts *kink = new AliDielectronVarCuts("kink","kink");
  kink->AddCut(AliDielectronVarManager::kKinkIndex0,.000001,1e30,kTRUE);
  diele->GetTrackFilter().AddCuts(kink);
  

  AliDielectronVarCuts *sPD = new AliDielectronVarCuts("SPDfirstlayercut","SPDfirstlayercut");
  sPD->AddCut(AliDielectronVarManager::kITSLayerFirstCls,-0.5,1.5);//change 30.5.2013
  if(cutDefinition==2){
     sPD->AddCut(AliDielectronVarManager::kITSLayerFirstCls,-0.5,0.5);//change 30.5.2013
  }
  diele->GetTrackFilter().AddCuts(sPD);


 // TPC #clusteres cut
 AliDielectronVarCuts *clustercut = new AliDielectronVarCuts("60cluster","60cluster");
 
 clustercut->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);//ATTENTION: wider in order to vary on CFContainer level

  diele->GetTrackFilter().AddCuts(clustercut);
  
  AliDielectronVarCuts *chisquarecut = new AliDielectronVarCuts("chisquarecut4","chisquarecut4");
  chisquarecut->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
  //cut to be added for comparison with AODs: kITSchi2Cl
  //NOTE next cut added in order to be compatible with AODs!!!!!
  // chisquarecut->AddCut(AliDielectronVarManager::kITSchi2Cl,0.,36.);
  diele->GetTrackFilter().AddCuts(chisquarecut);

  AliDielectronVarCuts *etacut = new AliDielectronVarCuts("etacut","etacut");
  
  etacut ->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);//ATTENTION: wider in order to vary on CFContainer level
  diele->GetTrackFilter().AddCuts(etacut);
  
  AliDielectronVarCuts *dcacut = new AliDielectronVarCuts("dcacut","dcacut");
  //TODO: DCA cuts to be investigated!!! NOTE: why?? (mwinn, 15.01.2013)
  dcacut->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
  dcacut->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
  //for comparison with AODs cut at -2,2 for z-vertex coordinate
  //NOTE next cut added in order to be compatible with AODs!!!!!
  //  dcacut->AddCut(AliDielectronVarManager::kImpactParZ,-2.,2.);
  diele->GetTrackFilter().AddCuts(dcacut);
  
    
  // PID cuts --------------------------------------------------------
    AliDielectronPID *pid = new AliDielectronPID("PID10","TPC nSigma e>-3, e<4, pion>2.5,proton>2.5");
    pid->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.,3.);//ATTENTION looser, postprocessing by CFContainer machinerie
    //problem with variable Cuts for nsigma electron in order to express proton and pion exclusion as electron cuts, and how to integrate them into CFContainer....., if not feasible different dielectron objects...
    if(cutDefinition!=3) pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3.5,3.0,0.,0.,kTRUE);//attention changed at the 19th of may to 2.0 instead of 1.5
    pid->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-20.,3.0,0.,0.,kTRUE);//attention changed at the 19th of may, instead of 1.5, also important for trending
   

  if(cutDefinition==3){
    pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-5.0,3.0,0.,0.,kTRUE);
    AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts;
    esdTrackCuts->SetMinLengthActiveVolumeTPC();
    diele->GetTrackFilter().AddCuts(esdTrackCuts);
  }
  
  diele->GetTrackFilter().AddCuts(pid);

}
Example #10
0
AliESDtrackCuts *CreateTrackCutsPWGJE(Int_t cutMode) {

  //
  // Macro to create track cuts for PWG Jet analysis
  // User can select a specific set by indicating cutMode
  // cutMode has 8 digits: first 4 digits additional cuts, last 4 digits standard cuts
  //                       additional cuts are variations of standard cuts (used for hybrid track selection and QA)
  // Numbering starts from 1000 For standard and additional cut numbers

  AliESDtrackCuts *trackCuts  = new AliESDtrackCuts("AliESDtrackCuts");

  TString tag;

  Int_t mod = 10000;

  Bool_t bStdCutsDefined = kFALSE;


  //_____________________________________________________________________
  //                     STANDARD CUTS

  //Get standard cuts: last 4 digits of cutMode
  Int_t stdCutMode = cutMode%mod;

  if(stdCutMode == 1000) {

    bStdCutsDefined = kTRUE;

    trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);
    trackCuts->SetMinNCrossedRowsTPC(120);
    trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
    trackCuts->SetMaxChi2PerClusterITS(36);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
    trackCuts->SetMaxChi2TPCConstrainedGlobal(36);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 1e10);

    tag = "Global track RAA analysis QM2011 + Chi2ITS<36";

  }

  if(stdCutMode == 1001) {

    bStdCutsDefined = kTRUE;

    // TPC  
    trackCuts->SetMinNClustersTPC(90);
    trackCuts->SetMaxChi2PerClusterTPC(4);
    trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
    trackCuts->SetAcceptKinkDaughters(kFALSE);
    trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
    // ITS
    trackCuts->SetRequireITSRefit(kTRUE);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);
    //reject fakes
    trackCuts->SetMaxChi2PerClusterITS(36);

    trackCuts->SetRequireSigmaToVertex(kFALSE);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 100.);

 
    tag = "Global tracks jet analysis with ITSrefit and NclsIter1=90, noSPD requirement";

  }

  if(stdCutMode == 1002) {

    bStdCutsDefined = kTRUE;

    // TPC  
    trackCuts->SetMinNClustersTPC(80);
    trackCuts->SetMaxChi2PerClusterTPC(4);
    trackCuts->SetAcceptKinkDaughters(kFALSE);
    trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
    // ITS
    trackCuts->SetRequireITSRefit(kTRUE);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);
    //reject fakes
    trackCuts->SetMaxChi2PerClusterITS(36);

    trackCuts->SetRequireSigmaToVertex(kFALSE);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 100.);

 
    tag = "Global tracks jet analysis with ITSrefit and Ncls=80, noSPD requirement";

  }

  if(stdCutMode == 1003) {

    bStdCutsDefined = kTRUE;

    // tight global tracks
    trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE,1);
    trackCuts->SetMinNClustersTPC(0);
    trackCuts->SetMinNCrossedRowsTPC(120);
    trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switches it off
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);
    trackCuts->SetMaxChi2PerClusterITS(36);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);

    tag = "Global tracks ITSTPC2010 + NCrossedRows + loose ITS";

  }
  
  if(stdCutMode == 1004) {

    bStdCutsDefined = kTRUE;

    // TPC  
    trackCuts->SetMinNClustersTPC(70);
    trackCuts->SetMaxChi2PerClusterTPC(4);
    trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
    trackCuts->SetAcceptKinkDaughters(kFALSE);
    trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
    // ITS
    trackCuts->SetRequireITSRefit(kTRUE);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);
    //reject fakes
    trackCuts->SetMaxChi2PerClusterITS(36);

    trackCuts->SetRequireSigmaToVertex(kFALSE);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 100.);
 
    tag = "Global tracks jet analysis with ITSrefit and NclsIter1=70, noSPD requirement";

  }
  if(stdCutMode == 1005) {

    bStdCutsDefined = kTRUE;

    // TPC  
    trackCuts->SetMinNClustersTPC(70);
    trackCuts->SetMaxChi2PerClusterTPC(4);
    trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
    trackCuts->SetAcceptKinkDaughters(kFALSE);
    trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
    // ITS
    trackCuts->SetRequireITSRefit(kTRUE);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);
    //reject fakes
    trackCuts->SetMaxChi2PerClusterITS(36);

    trackCuts->SetRequireSigmaToVertex(kFALSE);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 1E+15);
 
    tag = "Global tracks jet analysis with ITSrefit and NclsIter1=70, noSPD requirement, no upper pt cut";

  }
  
  if(stdCutMode == 1006) {

    bStdCutsDefined = kTRUE;

    // TPC  
    TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
    trackCuts->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
    trackCuts->SetMinNClustersTPC(70);
    trackCuts->SetMaxChi2PerClusterTPC(4);
    trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
    trackCuts->SetAcceptKinkDaughters(kFALSE);
    trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
    // ITS
    trackCuts->SetRequireITSRefit(kTRUE);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);
    //reject fakes
    trackCuts->SetMaxChi2PerClusterITS(36);
    trackCuts->SetMaxChi2TPCConstrainedGlobal(36);

    trackCuts->SetRequireSigmaToVertex(kFALSE);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 1E+15);
 
    tag = "Global tracks jet analysis with ITSrefit and NclsIter1=PtDep, noSPD requirement, no upper pt cut, golden chi2";

  }

  if(stdCutMode == 1007) {
    
    bStdCutsDefined = kTRUE;
    
    trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,1);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);

    //
    trackCuts->SetMaxChi2TPCConstrainedGlobal(36);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 1E+15);
 
    tag = "Global tracks with AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE)";

  }

  if(stdCutMode == 1008) {
    
    bStdCutsDefined = kTRUE;
    
    trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,1);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);

    //
    trackCuts->SetMaxChi2TPCConstrainedGlobal(36);
    trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);

    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
 
    tag = "Global tracks 2011 with NCrossedRows cut";

  }


  if(stdCutMode == 2000) {

    bStdCutsDefined = kTRUE;

    // TPC  
    trackCuts->SetMinNClustersTPC(90);
    trackCuts->SetMaxChi2PerClusterTPC(4);
    trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
    trackCuts->SetAcceptKinkDaughters(kFALSE);
    trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMaxFractionSharedTPCClusters(0.4);
    //accept secondaries
    trackCuts->SetMaxDCAToVertexXY(2.4);
    trackCuts->SetMaxDCAToVertexZ(3.2);
    trackCuts->SetDCAToVertex2D(kTRUE);

    trackCuts->SetRequireSigmaToVertex(kFALSE);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 100.);

 
    tag = "Global tracks jet analysis, loose cuts, NClsIter1=90, no ITS requirements";

  }

  if(stdCutMode == 2001) {

    bStdCutsDefined = kTRUE;

    trackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); 
    // trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMinNClustersTPC(70);

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 100.);

 
    tag = "TPConly track cuts, loose cuts, NCls=70, no ITS requirements";

  }

  if(stdCutMode == 2002) {

    bStdCutsDefined = kTRUE;

    trackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); 
    //  trackCuts->SetRequireTPCRefit(kTRUE);
    trackCuts->SetMinNClustersTPC(0);
    trackCuts->SetMinNCrossedRowsTPC(120);
    trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switches it off  

    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 100.);

 
    tag = "TPConly track cuts, loose cuts, NCls=70, no ITS requirements";

  }

  if(!bStdCutsDefined) {
    printf("last 4 digits do not represent a predefined set of standard cuts. Returning 0\n");
    return 0;

  }


  //_____________________________________________________________________
  //                     ADDITIONAL CUTS

  //Get additional cut mode: first 4 digits of cutMode
  Int_t addCutMode = (int)((float)cutMode/(float)mod);

  if(addCutMode == 1000) {

    trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
 
    tag += " + additonal: SPD any requirement";

  }

  if(addCutMode == 1001) {

    trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
 
    tag += " + additional: w/o hits in SPD";

  }

  if(addCutMode == 1002) {

    trackCuts->SetMaxChi2PerClusterITS(1E10);

    tag += " + additional: maxITSChi2=1e10";

  }

  if(addCutMode == 1003) {

    trackCuts->SetMinNClustersTPC(0);
    trackCuts->SetMinNCrossedRowsTPC(0);
    trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.);

    tag += " + additional: minClusters=0 minCrossedRows=0 minCrossedRowsOverFindable=0";

  }

  if(addCutMode == 1004) {

    trackCuts->SetRequireITSRefit(kFALSE);

    tag += " + additional: ITSrefit=kFALSE";

  }

  if(addCutMode == 1005) {

    trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
 
    tag += " + additional: no SPD requirement (kOff)";

  }

  Printf("Created track cuts for: %s", tag.Data());

  return trackCuts;

}
Example #11
0
void runAODFilterMC()
{
  // PROOF example

      gSystem->Load("libTree");
      gSystem->Load("libPhysics");
      gSystem->Load("libGeom");
      gSystem->Load("libVMC");

      bool bKineFilter = true;
      //      TProof::Mgr("alicecaf")->SetROOTVersion("v5-21-01-alice_dbg");
      TProof::Open("alicecaf");
      //      gProof->SetParallel(1);

      char *dataset = "/COMMON/COMMON/LHC08c11_10TeV_0.5T";
      //      char *dataset = "/PWG4/kleinb/LHC08q_jetjet100";
      // gProof->ClearPackages();
      gProof->UploadPackage("${ALICE_ROOT}/STEERBase.par");
      gProof->EnablePackage("STEERBase");
      gProof->UploadPackage("${ALICE_ROOT}/ESD.par");
      gProof->EnablePackage("ESD");
      gProof->UploadPackage("${ALICE_ROOT}/AOD.par");
      gProof->EnablePackage("AOD");
      gProof->UploadPackage("${ALICE_ROOT}/ANALYSIS.par");
      gProof->EnablePackage("ANALYSIS");
      gProof->UploadPackage("${ALICE_ROOT}/ANALYSISalice.par");
      gProof->EnablePackage("ANALYSISalice");
      
      //
      if (gApplication) gApplication->InitializeGraphics();
      // Create the chain
      //


	/////////////////////////////////////////////////////////////////////////////////// 
	// Create the analysis manager
	//
	// Input 
      AliESDInputHandler* inpHandler = new AliESDInputHandler();
      // Output
      AliAODHandler* aodHandler = new AliAODHandler();
      aodHandler->SetOutputFileName("aod_ckb2.root");
      // MC Truth
      AliMCEventHandler* mcHandler = new AliMCEventHandler();
      AliAnalysisManager *mgr  = new AliAnalysisManager("Filter Manager", "Filter Manager");
     if(bKineFilter){
       mgr->SetMCtruthEventHandler(mcHandler);
     }

      mgr->SetInputEventHandler  (inpHandler);
      mgr->SetOutputEventHandler (aodHandler);
      aodHandler->Dump();

      mgr->SetDebugLevel(10);

      // Filtering of MC particles (decays conversions etc)
      // this task is also needed to set the MCEventHandler
      // to the AODHandler, this will not be needed when
      // AODHandler goes to ANALYSISalice
      AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Filter");
      if(bKineFilter)mgr->AddTask(kinefilter);
      
      
      // 
      AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
      esdTrackCutsL->SetMinNClustersTPC(50);
      esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
      esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
      esdTrackCutsL->SetRequireTPCRefit(kTRUE);
      esdTrackCutsL->SetDCAToVertexZ(3.0);
      esdTrackCutsL->SetDCAToVertexXY(3.0);
      esdTrackCutsL->SetDCAToVertex2D(kTRUE);
      esdTrackCutsL->SetRequireSigmaToVertex(kFALSE);
      esdTrackCutsL->SetAcceptKinkDaughters(kFALSE);

      AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("AliESDtrackCuts", "ITS stand-alone");
      esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
      
      AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
      trackFilter->AddCuts(esdTrackCutsL);
      trackFilter->AddCuts(esdTrackCutsITSsa);
      
      AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
      esdfilter->SetTrackFilter(trackFilter);
      
      mgr->AddTask(esdfilter);
    
    
      //
      // Create containers for input/output
      AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
      AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer();
      
      coutput1->SetSpecialOutput();

      if(bKineFilter){
	mgr->ConnectInput  (kinefilter,     0, cinput1  );
	mgr->ConnectOutput (kinefilter,     0, coutput1 );
	AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(),
								   AliAnalysisManager::kOutputContainer,"pyxsec_hists.root");
	mgr->ConnectOutput (kinefilter,     1, coutputEx );
      }

	mgr->ConnectInput  (esdfilter,     0, cinput1  );
	mgr->ConnectOutput (esdfilter,     0, coutput1 );
      
      //
      // Run the analysis
      //    
      mgr->InitAnalysis();
      mgr->PrintStatus();
      mgr->StartAnalysis("proof",dataset,10000);

}
//________________________________________________________________
AliAnalysisCuts* SetupTrackCuts(Int_t cutInstance)
{

  std::cout << "SetupTrackCuts()" <<std::endl;
  //AliAnalysisCuts* trackCuts=0x0;

  AliESDtrackCuts *fesdTrackCuts = new AliESDtrackCuts();

  //global
  fesdTrackCuts->SetPtRange( 0.2 , 100. );
  fesdTrackCuts->SetEtaRange( -0.8 , 0.8 );
  fesdTrackCuts->SetAcceptKinkDaughters(kFALSE);
  fesdTrackCuts->SetRequireSigmaToVertex(kFALSE);
  fesdTrackCuts->SetDCAToVertex2D(kFALSE);
  fesdTrackCuts->SetMaxDCAToVertexZ(3.);
  fesdTrackCuts->SetMaxDCAToVertexXY(1.);
 
  fesdTrackCuts->SetRequireTPCRefit(kTRUE);
  fesdTrackCuts->SetRequireITSRefit(kTRUE);

  if(cutInstance == 0){
    fesdTrackCuts->SetMinNClustersITS(4);
    fesdTrackCuts->SetMaxChi2PerClusterITS(4.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
  }
  if(cutInstance == 1){
    fesdTrackCuts->SetMinNClustersITS(5);
    fesdTrackCuts->SetMaxChi2PerClusterITS(3.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(100);
    fesdTrackCuts->SetMinNCrossedRowsTPC(130);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.9);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 2){
    fesdTrackCuts->SetMinNClustersITS(4);
    fesdTrackCuts->SetMaxChi2PerClusterITS(3.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kBoth);
    fesdTrackCuts->SetMinNClustersTPC(100);
    fesdTrackCuts->SetMinNCrossedRowsTPC(80);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 3){
    fesdTrackCuts->SetMinNClustersITS(4);
    fesdTrackCuts->SetMaxChi2PerClusterITS(4.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(120);
    fesdTrackCuts->SetMinNCrossedRowsTPC(130);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.7);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
  }
  if(cutInstance == 4){
    fesdTrackCuts->SetMinNClustersITS(6);
    fesdTrackCuts->SetMaxChi2PerClusterITS(2.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(80);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.9);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 5){
    fesdTrackCuts->SetMinNClustersITS(5);
    fesdTrackCuts->SetMaxChi2PerClusterITS(4.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(100);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
  }
  if(cutInstance == 6){
    fesdTrackCuts->SetMinNClustersITS(5);
    fesdTrackCuts->SetMaxChi2PerClusterITS(4.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(100);
    fesdTrackCuts->SetMinNCrossedRowsTPC(80);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 7){
    fesdTrackCuts->SetMinNClustersITS(5);
    fesdTrackCuts->SetMaxChi2PerClusterITS(3.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kBoth);
    fesdTrackCuts->SetMinNClustersTPC(120);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.9);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 8){
    fesdTrackCuts->SetMinNClustersITS(4);
    fesdTrackCuts->SetMaxChi2PerClusterITS(4.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(120);
    fesdTrackCuts->SetMinNCrossedRowsTPC(80);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.9);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 9){
    fesdTrackCuts->SetMinNClustersITS(4);
    fesdTrackCuts->SetMaxChi2PerClusterITS(4.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
  }
  if(cutInstance == 10){
    fesdTrackCuts->SetMinNClustersITS(5);
//    fesdTrackCuts->SetMaxChi2PerClusterITS(6);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(100);
    fesdTrackCuts->SetMinNCrossedRowsTPC(120);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.7);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 11){
    fesdTrackCuts->SetMinNClustersITS(5);
//    fesdTrackCuts->SetMaxChi2PerClusterITS(100);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(100);
    fesdTrackCuts->SetMinNCrossedRowsTPC(120);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.7);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 12){
    fesdTrackCuts->SetMinNClustersITS(6);
//    fesdTrackCuts->SetMaxChi2PerClusterITS(100);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
  }
  if(cutInstance == 13){
    fesdTrackCuts->SetMinNClustersITS(5);
    fesdTrackCuts->SetMaxChi2PerClusterITS(3.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kBoth);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 14){
    fesdTrackCuts->SetMinNClustersITS(6);
    fesdTrackCuts->SetMaxChi2PerClusterITS(2.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kBoth);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.7);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 15){
    fesdTrackCuts->SetMinNClustersITS(5);
    fesdTrackCuts->SetMaxChi2PerClusterITS(4.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 16){
    fesdTrackCuts->SetMinNClustersITS(4);
    fesdTrackCuts->SetMaxChi2PerClusterITS(3.5);
//    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kBoth);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
  }
  if(cutInstance == 17){
    fesdTrackCuts->SetMinNClustersITS(3);
//    fesdTrackCuts->SetMaxChi2PerClusterITS(4);
//    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kBoth);
    fesdTrackCuts->SetMinNClustersTPC(100);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
  }
  if(cutInstance == 18){
    fesdTrackCuts->SetMinNClustersITS(4);
//    fesdTrackCuts->SetMaxChi2PerClusterITS(6);    
//    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(80);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }
  if(cutInstance == 19){
    fesdTrackCuts->SetMinNClustersITS(5);
    fesdTrackCuts->SetMaxChi2PerClusterITS(3.5);
    fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
    fesdTrackCuts->SetMinNClustersTPC(120);
    fesdTrackCuts->SetMinNCrossedRowsTPC(100);
    fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.9);
    fesdTrackCuts->SetMaxChi2PerClusterTPC(3);
  }

  return fesdTrackCuts;

}
Example #13
0
AliESDtrackCuts* MyTrackCuts(Int_t clusterCut = 1,  Bool_t selPrimaries = kTRUE, TString optSyt="DefaultITSTPC2011")
{
  Double_t  dcaxymax                  = 2.0;
  TString   PtDcaFormula              = "0.0105+0.0350/pt^1.1";//7sigma
  Double_t  dcazmax                   = 2.0;
  Double_t  minNcls                   = 50;
  Double_t  maxX2TPCcls               = 4.0;
  Double_t  maxX2ITScls               = 36.0;
  Double_t  minCrossedRows            = 70.0;
  Double_t  minRatioClsCrRowsOverFCls = 0.8;
  
  if(optSyt.Contains("PtDCAXY5s")) {PtDcaFormula = "0.0075+0.025/pt^1.1";}
  if(optSyt.Contains("PtDCAXY6s")) {PtDcaFormula = "0.0090+0.030/pt^1.1";}
  if(optSyt.Contains("PtDCAXY7s")) {PtDcaFormula = "0.0105+0.035/pt^1.1";}//Defult
  if(optSyt.Contains("PtDCAXY8s")) {PtDcaFormula = "0.0120+0.040/pt^1.1";}
  if(optSyt.Contains("PtDCAXY9s")) {PtDcaFormula = "0.0135+0.045/pt^1.1";}

  if(optSyt.Contains("FixDCAZ1")) {dcazmax = 1.0;}
  if(optSyt.Contains("FixDCAZ2")) {dcazmax = 2.0;}//Defult
  if(optSyt.Contains("FixDCAZ3")) {dcazmax = 3.0;}
  
  if(optSyt.Contains("NCrRows60")){minCrossedRows = 60;}
  if(optSyt.Contains("NCrRows70")){minCrossedRows = 70;}//Defult
  if(optSyt.Contains("NCrRows80")){minCrossedRows = 80;}
  if(optSyt.Contains("NCrRows90")){minCrossedRows = 90;}

  if(optSyt.Contains("RClsCrRowsOvFCls0.7")){minRatioClsCrRowsOverFCls = 0.7;}
  if(optSyt.Contains("RClsCrRowsOvFCls0.8")){minRatioClsCrRowsOverFCls = 0.8;}//Defult
  if(optSyt.Contains("RClsCrRowsOvFCls0.9")){minRatioClsCrRowsOverFCls = 0.9;}

  if(optSyt.Contains("ChiSqrPerTPCCls3")) {maxX2TPCcls = 3.0;}
  if(optSyt.Contains("ChiSqrPerTPCCls4")) {maxX2TPCcls = 4.0;}//Defult
  if(optSyt.Contains("ChiSqrPerTPCCls5")) {maxX2TPCcls = 5.0;}

  if(optSyt.Contains("ChiSqrPerITSCls30")) {maxX2ITScls = 30.0;}
  if(optSyt.Contains("ChiSqrPerITSCls36")) {maxX2ITScls = 36.0;}//Defult
  if(optSyt.Contains("ChiSqrPerITSCls45")) {maxX2ITScls = 45.0;}
  


  AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
  if(optSyt.Contains("DefaultITSTPC2011")){
    ::Info("Config KSTAR ", Form("Default 2011 ESD track cuts used : %s\n",optSyt.Data()));
    if(clusterCut == 0)  esdTrackCuts->SetMinNClustersTPC(50);
    else if (clusterCut == 1) {
      esdTrackCuts->SetMinNCrossedRowsTPC(70);
      esdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
    }
    esdTrackCuts->SetMaxChi2PerClusterTPC(4);
    esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
    esdTrackCuts->SetRequireTPCRefit(kTRUE);
    // ITS
    esdTrackCuts->SetRequireITSRefit(kTRUE);
    esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
					   AliESDtrackCuts::kAny);
    if(selPrimaries) {
      // 7*(0.0015+0.0050/pt^1.1)
      esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
      esdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
    }
    esdTrackCuts->SetMaxDCAToVertexZ(2);
    esdTrackCuts->SetDCAToVertex2D(kFALSE);
    esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
    esdTrackCuts->SetMaxChi2PerClusterITS(36);
  }
  else{
    ::Info("Config KSTAR ", Form("User Defined ESD track cuts used for Sys : %s\n",optSyt.Data()));
    if(clusterCut == 0)  esdTrackCuts->SetMinNClustersTPC(minNcls);
    else if (clusterCut == 1) {
      esdTrackCuts->SetMinNCrossedRowsTPC(minCrossedRows);
      esdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(minRatioClsCrRowsOverFCls);
    }
    esdTrackCuts->SetMaxChi2PerClusterTPC(maxX2TPCcls);
    esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
    esdTrackCuts->SetRequireTPCRefit(kTRUE);
    // ITS
    esdTrackCuts->SetRequireITSRefit(kTRUE);
    esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
					   AliESDtrackCuts::kAny);
    if(selPrimaries) {
      // 7*(0.0015+0.0050/pt^1.1)
      esdTrackCuts->SetMaxDCAToVertexXYPtDep(PtDcaFormula.Data());
      esdTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
    }
    esdTrackCuts->SetMaxDCAToVertexZ(dcazmax);
    esdTrackCuts->SetDCAToVertex2D(kFALSE);
    esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
    esdTrackCuts->SetMaxChi2PerClusterITS(maxX2ITScls);
  }
  return esdTrackCuts;
}
AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly(char *prodType = "LHC10e14",int cuts=2)//1: Standard Cuts 2009 2: GetStandardITSTPCTrackCuts2009
{
  // Creates HighPtQATPConly 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("AddTaskPWG4HighPtQATPConly", "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 can also be checked here.
  //==============================================================================
  if (!mgr->GetInputEventHandler()) {
    ::Error("AddTaskPWG4HighPtQATPConly", "This task requires an input event handler");
    return NULL;
  }  
  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
  const char *analysisType = "ESD";//"TPC"

  // C. Create the task, add it to manager.
  //===========================================================================
 
  //CREATE THE  CUTS -----------------------------------------------
  //Use AliESDtrackCuts
  AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
  if(cuts==1) {
    trackCuts=trackCuts->GetStandardITSTPCTrackCuts2010(kTRUE);//Primary Track Selection
    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 1e10);

  }
  else if(cuts==2) {
    trackCuts=trackCuts->GetStandardITSTPCTrackCuts2009(kTRUE);//Primary Track Selection
    trackCuts->SetEtaRange(-0.9,0.9);
    trackCuts->SetPtRange(0.15, 1e10);
  }

  AliESDtrackCuts *trackCutsITS = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts with ITSrefit");
  if(cuts==1) {
    //Cuts SPD || SDD
    // TPC  
    trackCutsITS->SetMinNClustersTPC(70);
    trackCutsITS->SetMaxChi2PerClusterTPC(4);
    trackCutsITS->SetAcceptKinkDaughters(kFALSE);
    trackCutsITS->SetRequireTPCRefit(kTRUE);
    // ITS
    trackCutsITS->SetRequireITSRefit(kTRUE);
    trackCutsITS->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
    trackCutsITS->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst);
    
    trackCutsITS->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
    trackCutsITS->SetMaxDCAToVertexZ(2);
    trackCutsITS->SetDCAToVertex2D(kFALSE);
    trackCutsITS->SetRequireSigmaToVertex(kFALSE);
    
    trackCutsITS->SetEtaRange(-0.9,0.9);
    trackCutsITS->SetPtRange(0.15, 1e10);
    trackCutsITS->SetRequireITSRefit(kTRUE);

  }
 else if(cuts==2) {
   trackCutsITS=trackCutsITS->GetStandardITSTPCTrackCuts2009(kTRUE);//Primary Track Selection
   trackCutsITS->SetEtaRange(-0.9,0.9);
   trackCutsITS->SetPtRange(0.15, 1e10);
 }

//Create the task
  AliPWG4HighPtQATPConly *taskPWG4QA = new AliPWG4HighPtQATPConly(Form("AliPWG4HighPtQATPConly%d",cuts));
  taskPWG4QA->SetCuts(trackCuts);
  taskPWG4QA->SetCutsITS(trackCutsITS);
  taskPWG4QA->SetCutType(cuts);
  if(!strcmp(prodType, "LHC10e14") || !strcmp(prodType, "PbPb")) taskPWG4QA->SetPtMax(500.);
  else taskPWG4QA->SetPtMax(100.);

  // 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
  //==============================================================================

  //------ input data ------
  TString outputfile = "";
  outputfile = AliAnalysisManager::GetCommonFileName();
  outputfile += Form(":PWG4_HighPtQATPConly%d",cuts);
  
  AliAnalysisDataContainer *cout_hist0;
  AliAnalysisDataContainer *cout_hist1;
  AliAnalysisDataContainer *cout_hist2;

  AliAnalysisDataContainer *cout_cuts0;
  AliAnalysisDataContainer *cout_cuts1;

  cout_hist0 = mgr->CreateContainer(Form("qa_histsCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
  cout_hist1 = mgr->CreateContainer(Form("qa_histsTPCCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
  cout_hist2 = mgr->CreateContainer(Form("qa_histsITSCuts%d",cuts), TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);  

  cout_cuts0 = mgr->CreateContainer(Form("qa_trackCuts%d",cuts), AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile);
  cout_cuts1 = mgr->CreateContainer(Form("qa_trackCutsITS%d",cuts), AliESDtrackCuts::Class(), AliAnalysisManager::kParamContainer,outputfile);

  //Add task to manager
  mgr->AddTask(taskPWG4QA);

  //Connect input containter to manager
  mgr->ConnectInput(taskPWG4QA,0,mgr->GetCommonInputContainer());

  //Connect output containers to manager
  mgr->ConnectOutput(taskPWG4QA,0,cout_hist0);
  mgr->ConnectOutput(taskPWG4QA,1,cout_hist1);
  mgr->ConnectOutput(taskPWG4QA,2,cout_hist2);
  mgr->ConnectOutput(taskPWG4QA,3,cout_cuts0);
  mgr->ConnectOutput(taskPWG4QA,4,cout_cuts1);

  // Return task pointer at the end
  return taskPWG4QA;
}
Example #15
0
AliAnalysisTaskEmcalHFCJQA* AddTaskEmcalHFCJQA(
  const char *ntracks            = "Tracks",
  const char *nclusters          = "CaloClusters",
  const char *njets              = "Jets",
  const char *nrho               = "Rho",
  Int_t       nCentBins          = 1,
  Double_t    jetradius          = 0.4,
  Double_t    jetptcut           = 0,
  Double_t    jetareacut         = 0.6,
  const char *type               = "TPC",
  Int_t       leadhadtype        = 0,
  const char *taskname           = "AliAnalysisTaskEmcalHFCJQA",
  TString cutfile				 ="HFCJCuts.root",
  UInt_t triggerMask			 =-1,//AliVEvent::kEMC1 | AliVEvent::kEMC7 | AliVEvent::kEMC8,/*kMB kEMC7 (kEMC8) kEMCEJE kEMCEGA*/
  Bool_t isMC					 = kFALSE,
  Float_t minC					 = 0.,
  Float_t maxC					 = 7.5
)
{  
  // Get the pointer to the existing analysis manager via the static access method.
  //==============================================================================
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr)
  {
    ::Error("AddTaskEmcalHFCJQA", "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("AddTaskEmcalHFCJQA", "This task requires an input event handler");
    return NULL;
  }
  
  //-------------------------------------------------------
  // Init the task and do settings
  //-------------------------------------------------------

  TString name(taskname);
  if (strcmp(njets,"")) {
    name += "_";
    name += njets;
  }
  if (strcmp(nrho,"")) {
    name += "_";
    name += nrho;
  }
  if (strcmp(type,"")) {
    name += "_";
    name += type;
  }

  Printf("name: %s",name.Data());

  AliAnalysisTaskEmcalHFCJQA* jetTask = new AliAnalysisTaskEmcalHFCJQA(name);
  jetTask->SetReadMC(isMC);
  jetTask->SetDebug(-1);
  jetTask->SetFilterBit(AliAODTrack::kTrkGlobalNoDCA);
  //Defaut parameters
  
  AliParticleContainer *trackCont  = jetTask->AddParticleContainer(ntracks);
  trackCont->SetClassName("AliVTrack");
  AliClusterContainer *clusterCont = jetTask->AddClusterContainer(nclusters);

  TString strType(type);
  AliJetContainer *jetCont = jetTask->AddJetContainer(njets,strType,jetradius);
  if(jetCont) {
    jetCont->SetRhoName(nrho);
    jetCont->ConnectParticleContainer(trackCont);
    jetCont->ConnectClusterContainer(clusterCont);
    jetCont->SetZLeadingCut(0.98,0.98);
    jetCont->SetPercAreaCut(0.6);
    jetCont->SetJetPtCut(jetptcut);    
    jetCont->SetLeadingHadronType(leadhadtype);
  }

//=========================CUTS=========================
AliRDHFJetsCuts *cuts;

bool kFileExists=kFALSE;
//if(!gSystem->AccessPathName(cutfile.Data(),kFileExists)){
  
if(gSystem->AccessPathName(cutfile.Data(),kFileExists))
{
	Printf("\n==CutObject not Defined in .root File. Using Standard Cuts==\n");

// possible (!not standard!) selection for pp2012 data triggered with EMCAL
    cuts=new AliRDHFJetsCuts();
    hfTask = new AliAnalysisTaskEmcalHFCJQA("AliAnalysisTaskEmcalHFCJQA");
   
    // AliRDHFJetsCutsVertex *cuts2=new AliRDHFJetsCutsVertex("jetCuts");

    //cuts for jets
    //    cuts->SetJetRadius(0.4);
    //    cuts->SetMaxEtaJet(0.5);//0.9-R
    //    cuts->SetMinPtJet(0);
    //    cuts->SetMaxPtJet(200);
    //    cuts->ResetMaskAndEnableMBTrigger();
    //cuts->SetUseAnyTrigger();
    //cuts->SetTriggerMask(0);
    cuts->SetTriggerMask(AliVEvent::kEMC1 | AliVEvent::kEMC7 | AliVEvent::kEMC8);
    cuts->SetTriggerClass("");

    AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
    esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
    esdTrackCuts->SetMinNClustersTPC(70);
    esdTrackCuts->SetMaxChi2PerClusterTPC(4);
    esdTrackCuts->SetRequireTPCRefit(kTRUE);
    esdTrackCuts->SetRequireITSRefit(kTRUE);
    esdTrackCuts->SetMinNClustersITS(2);
    esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
    esdTrackCuts->SetMinDCAToVertexXY(0.);
    esdTrackCuts->SetEtaRange(-0.8,0.8);
    esdTrackCuts->SetPtRange(1,1.e10);

    if(minC>0&&minC<maxC)
    {
      // Pb-Pb
      cuts->SetTriggerClass("");
      cuts->ResetMaskAndEnableMBTrigger();
      cuts->EnableCentralTrigger();
      cuts->EnableSemiCentralTrigger();
      cuts->SetUseCentrality(AliRDHFCuts::kCentV0M);
      cuts->SetMinCentrality(minC);
      cuts->SetMaxCentrality(maxC);  
    }

    cuts->AddTrackCuts(esdTrackCuts);
    //cuts for vertexing
    //    ::Error("AddTaskSEHFJets","No Cut Object");
}
else
{
	TFile *f=TFile::Open(cutfile.Data());
	//cuts= (AliRDHFCutsD0toKpi*)f->Get("EventTrackCuts");
	cuts= (AliRDHFJetsCuts*)f->Get("HFCJCuts");

	cout<<"\n==========================================\n Cutfile used:\n"<<cutfile.Data()<<endl;
	//cuts->PrintAll();
	//jetTask->SetJetCuts(cuts);
}
if(triggerMask>0) cuts->SetTriggerMask(triggerMask);

jetTask->SetJetCuts(cuts);
delete cuts;
//========================================================== 
  
//-------------------------------------------------------
// Final settings, pass to manager and set the containers
//-------------------------------------------------------
  
  mgr->AddTask(jetTask);

  // Create containers for input/output
  AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
  TString contname(name);
  contname += "_histos";
  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(), 
							    TList::Class(),AliAnalysisManager::kOutputContainer,
							    Form("%s", AliAnalysisManager::GetCommonFileName()));
  mgr->ConnectInput  (jetTask, 0,  cinput1 );
  mgr->ConnectOutput (jetTask, 1, coutput1 );
  
  return jetTask;
}
Int_t AddRsnDaughterCutsPhiNsigma(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)
{

  if (!rsnIH) return 0;
  
  Bool_t valid = kTRUE;
  //   Int_t collisionType = AliRsnTrainManager::GetGlobalInt("IsCollisionType",valid);
  Int_t useCommonQualityCut = AliRsnTrainManager::GetGlobalInt("RsnCommonQualityCut",valid);
  TString rsnQualityCut = AliRsnTrainManager::GetGlobalStr("RsnQualityCut",valid);
  Int_t isMC = AliRsnTrainManager::GetGlobalInt("IsMC",valid);
  Int_t isRsnMini = AliRsnTrainManager::GetGlobalInt("IsRsnMini",valid);
  Int_t isMixing = AliRsnTrainManager::GetGlobalInt("IsMixing",valid);

  // experts only (don't touch)
  Int_t isRsnDev = AliAnalysisManager::GetGlobalInt("rsnUseRSNParDev",valid);

  // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====
  Int_t numberOfCuts = 1;

  //---------------------------------------------
  //  Define single cuts
  //---------------------------------------------

  Printf("AliRsnCutPIDNSigma Option : %s",opt.Data());

  Double_t nSigmaTPC=3.0;
  Double_t nSigmaTOF=3.0;
  Double_t etaMin=-0.8;
  Double_t etaMax=0.8;
  Double_t trackPtMin=0.;
  Double_t trackPtMax=1.e10;
  Int_t NclTPC=70;
  Char_t DCAxyFormula[100]="0.0182+0.035/pt^1.01";

  Bool_t useTPC_K=kFALSE;
  Bool_t useTOF_K=kFALSE;
  Bool_t rejectUnmatchedTOF_K=kTRUE;
  Bool_t useTrackPtCut=kFALSE;

  if (opt.Contains("qualityonly")) {
    useTPC_K=kFALSE;
    useTOF_K=kFALSE;
  }

  if (opt.Contains("KTPCnsig"))  useTPC_K=kTRUE;
  if (opt.Contains("KTOFnsig"))  useTOF_K=kTRUE;
  if (opt.Contains("KTOFacceptUnmatched")) rejectUnmatchedTOF_K=kFALSE;

  if (opt.Contains("KTPCnsig05")) nSigmaTPC = 0.5;
  if (opt.Contains("KTPCnsig08")) nSigmaTPC = 0.8;
  if (opt.Contains("KTPCnsig10")) nSigmaTPC = 1.0;
  if (opt.Contains("KTPCnsig15")) nSigmaTPC = 1.5;
  if (opt.Contains("KTPCnsig20")) nSigmaTPC = 2.0;
  if (opt.Contains("KTPCnsig25")) nSigmaTPC = 2.5;
  if (opt.Contains("KTPCnsig30")) nSigmaTPC = 3.0;
  if (opt.Contains("KTPCnsig40")) nSigmaTPC = 4.0;
  if (opt.Contains("KTPCnsig50")) nSigmaTPC = 5.0;
  if (opt.Contains("KTPCnsig1000")) nSigmaTPC = 100.0;

  if (opt.Contains("KTOFnsig10")) nSigmaTOF = 1.0;
  if (opt.Contains("KTOFnsig15")) nSigmaTOF = 1.5;
  if (opt.Contains("KTOFnsig20")) nSigmaTOF = 2.0;
  if (opt.Contains("KTOFnsig25")) nSigmaTOF = 2.5;
  if (opt.Contains("KTOFnsig30")) nSigmaTOF = 3.0;
  if (opt.Contains("KTOFnsig40")) nSigmaTOF = 4.0;
  if (opt.Contains("KTOFnsig50")) nSigmaTOF = 5.0;
  if (opt.Contains("KTOFnsig1000")) nSigmaTOF = 100.0;

  if (opt.Contains("trackPt")) {
    useTrackPtCut = kTRUE;
    if (opt.Contains("trackPtMin015")) trackPtMin = 0.15;
    if (opt.Contains("trackPtMin02")) trackPtMin = 0.2;
    if (opt.Contains("trackPtMin05")) trackPtMin = 0.5;
    if (opt.Contains("trackPtMin06")) trackPtMin = 0.6;

    if (opt.Contains("trackPtMax18")) trackPtMax = 1.8;
    if (opt.Contains("trackPtMax20")) trackPtMax = 2.0;
    if (opt.Contains("trackPtMax25")) trackPtMax = 2.5;
  }

  Bool_t usePDG=kFALSE;
  if (opt.Contains("pdg")) {
    Printf("Using PDG");
    usePDG = kTRUE;
  }

  Bool_t useEta = kFALSE;
  if (opt.Contains("eta")) {
    for(int j=1;j<=9;j++) if(opt.Contains(Form("eta0%i",j))){etaMin=-0.1*j; etaMax=0.1*j;}

    for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinMinus0%i",j))) etaMin=-0.1*j;
    if(opt.Contains("etaMin00")) etaMin=0.;
    for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMinPlus0%i",j))) etaMin=0.1*j;

    for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxMinus0%i",j))) etaMax=-0.1*j;
    if(opt.Contains("etaMax00")) etaMax=0.;
    for(int j=1;j<=9;j++) if(opt.Contains(Form("etaMaxPlus0%i",j))) etaMax=0.1*j;

    Printf("Using ETA range (%.2f,%.2f)",etaMin,etaMax);
    useEta = kTRUE;
  }

  Bool_t useNclTPC = kFALSE;
  if (opt.Contains("NclTPC")) {
    if (opt.Contains("NclTPC70")) NclTPC=70;
    if (opt.Contains("NclTPC75")) NclTPC=75;
    if (opt.Contains("NclTPC80")) NclTPC=80;
    if (opt.Contains("NclTPC85")) NclTPC=85;
    if (opt.Contains("NclTPC90")) NclTPC=90;
    useNclTPC = kTRUE;
  }

  Bool_t useDCAxy = kFALSE;
  if (opt.Contains("DCAxy")) {
    if (opt.Contains("DCAxyFormula7s")) sprintf(DCAxyFormula,"0.0182+0.035/pt^1.01");
    if (opt.Contains("DCAxyFormula6s")) sprintf(DCAxyFormula,"0.0156+0.03/pt^1.01");
    if (opt.Contains("DCAxyFormula5s")) sprintf(DCAxyFormula,"0.013+0.025/pt^1.01");
    useDCAxy = kTRUE;
  }

  //---------------------------------------------
  //  Combine cuts
  //---------------------------------------------

  TString cutname = "K_Phi";
  if (!opt.IsNull()) cutname += Form("_%s",opt.Data());
  AliRsnCutSet *cuts = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter);

  TString scheme="";
  AliRsnCutTrackQuality *qualityCut = new AliRsnCutTrackQuality("cutQualityK");
  if (!rsnQualityCut.IsNull()) {
    AliESDtrackCuts *esdTK = RsnQualityCut(rsnQualityCut.Data());
    if(useDCAxy) esdTK->SetMaxDCAToVertexXYPtDep(DCAxyFormula);
    qualityCut->SetESDtrackCuts(esdTK);
  } else {
    if (useCommonQualityCut>=0) {
      qualityCut->SetAODTestFilterBit(useCommonQualityCut);
      if(useDCAxy) {qualityCut->SetCheckOnlyFilterBit(kFALSE); qualityCut->SetDCARPtFormula(DCAxyFormula);}
    } else {
      qualityCut->SetDefaults2010();
      if(useDCAxy) qualityCut->SetDCARPtFormula(DCAxyFormula);
    }
  }

  cuts->AddCut(qualityCut);
  if (!scheme.IsNull()) scheme += "&";
  scheme += qualityCut->GetName();


  if (useTPC_K) {
    AliRsnCutPIDNSigma *cutKTPC = new AliRsnCutPIDNSigma("cutPIDNSigmaTPCK",AliPID::kKaon,AliRsnCutPIDNSigma::kTPC);
    cutKTPC->SinglePIDRange(nSigmaTPC);
    cuts->AddCut(cutKTPC);
    if (!scheme.IsNull()) scheme += "&";
    scheme += cutKTPC->GetName();
  }

  if (useTOF_K) {
    AliRsnCutPIDNSigma *cutKTOF = new AliRsnCutPIDNSigma("cutPIDNSigmaTOFK",AliPID::kKaon,AliRsnCutPIDNSigma::kTOF);
    cutKTOF->SinglePIDRange(nSigmaTOF);
    cuts->AddCut(cutKTOF);
    if(rejectUnmatchedTOF_K){
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutKTOF->GetName();
    }else{
      AliRsnCutTOFMatch *cutKTOFMatch = new AliRsnCutTOFMatch("cutKTOFMatch");
      cuts->AddCut(cutKTOFMatch);
      if (!scheme.IsNull()) scheme += "&";
      scheme += Form("(%s|(!%s))",cutKTOF->GetName(),cutKTOFMatch->GetName());
    }
  }

  if (useEta) {
    Printf("Adding ETA ...");
    AliRsnValueDaughter *valEta = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kEta);
    AliRsnCutValue *cutEta = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),etaMin,etaMax);
    cutEta->SetTargetType(AliRsnTarget::kDaughter);
    cutEta->SetValueObj(valEta);
    cuts->AddCut(cutEta);
    if (!scheme.IsNull()) scheme += "&";
    scheme += cutEta->GetName();
  }

  if (useTrackPtCut) {
    Printf("Adding Pt min=%.3f max=%.3f ...",trackPtMin,trackPtMax);
    AliRsnValueDaughter *valTrackPt = new AliRsnValueDaughter(Form("val%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kPt);

    AliRsnCutValue *cutTrackPt = new AliRsnCutValue(Form("cut%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),trackPtMin,trackPtMax);
    cutTrackPt->SetTargetType(AliRsnTarget::kDaughter);
    cutTrackPt->SetValueObj(valTrackPt);
    cuts->AddCut(cutTrackPt);
    if (!scheme.IsNull()) scheme += "&";
    scheme += cutTrackPt->GetName();
  }

  if (useNclTPC) {
    Printf("Adding NclTPC >= %i",NclTPC);
    AliRsnValueDaughter *valNclTPC = new AliRsnValueDaughter(Form("val%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
    AliRsnCutValue *cutNclTPC = new AliRsnCutValue(Form("cut%sNclTPC%s",AliPID::ParticleName(type1),opt.Data()),NclTPC-0.1,1000.);
    cutNclTPC->SetTargetType(AliRsnTarget::kDaughter);
    cutNclTPC->SetValueObj(valNclTPC);
    cuts->AddCut(cutNclTPC);
    if (!scheme.IsNull()) scheme += "&";
    scheme += cutNclTPC->GetName();
  }

  if (usePDG) {
    Printf("Adding PDG ...");
    AliRsnCutPID *cutPDG = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE);
    cuts->AddCut(cutPDG);
    if (!scheme.IsNull()) scheme += "&";
    scheme += cutPDG->GetName();
  }

  Printf ("CUT Scheme is '%s'",scheme.Data());
  cuts->SetCutScheme(scheme.Data());

  if (opt.Contains("mon")) {
    AddMonitorOutput(cuts->GetMonitorOutput(),opt);
  }
  if (isRsnMini) {
    AliRsnMiniAnalysisTask *taskRsnMini = (AliRsnMiniAnalysisTask *)task;
    if (taskRsnMini) {
      taskRsnMini->AddTrackCuts(cuts);
    }
  } else {
    AliRsnDaughterSelector *sel = rsnIH->GetSelector();
    //       sel->SetLabelCheck(kFALSE);
    sel->Add(cuts, kTRUE);
    if (isRsnDev>=0 && opt.Contains("pairPID")) {
      AliRsnActPostDaughterSelection *pairPID = new AliRsnActPostDaughterSelection();
      pairPID->SetID(0);

      const char *fn="rsnRange.txt";
      if (!gSystem->AccessPathName(fn)) {
	TString minStr = gSystem->GetFromPipe(TString::Format("head -n 1 %s").Data());
	TString maxStr = gSystem->GetFromPipe(TString::Format("tail -n 1 %s").Data());
	pairPID->SetMass(minStr.Atof(),maxStr.Atof());
      } else {
	//       pairPID->SetMass(1.01,1.03);
	pairPID->SetMass(1.015,1.025);
	pairPID->SetMass(1.019,1.021);
	pairPID->SetMass(1.0195,1.0205);
	pairPID->SetMass(1.1000,1.1005);
	//       pairPID->SetMass(1.1005,1.1010);
      }
      sel->AddAction(pairPID);
    }

  }
  return numberOfCuts;

}
AliAnalysisVertexingHF* ConfigVertexingHF() {

  printf("Call to AliAnalysisVertexingHF parameters setting :\n");
  vHF = new AliAnalysisVertexingHF();
 
  //--- switch-off candidates finding (default: all on)
  //vHF->SetD0toKpiOff();
  vHF->SetJPSItoEleOff();
  //vHF->Set3ProngOff();
  vHF->SetLikeSignOn(); // like-sign pairs and triplets
  //  vHF->SetLikeSign3prongOff();
  vHF->Set4ProngOff();
  //vHF->SetDstarOff();
  vHF->SetFindVertexForDstar(kFALSE);
  //--- secondary vertex with KF?
  //vHF->SetSecVtxWithKF();
  vHF->SetCascadesOff();
  vHF->SetFindVertexForCascades(kFALSE);
  vHF->SetMassCutBeforeVertexing(kTRUE); // PbPb
  vHF->SetV0TypeForCascadeVertex(AliRDHFCuts::kAllV0s);

  //--- set cuts for single-track selection  
  //     displaced tracks
  AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
  esdTrackCuts->SetRequireTPCRefit(kTRUE);
  esdTrackCuts->SetMinNClustersTPC(70);
  esdTrackCuts->SetRequireITSRefit(kTRUE);
  //esdTrackCuts->SetMinNClustersITS(4);
  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
					 AliESDtrackCuts::kAny);
  // |d0|>75 micron for pt<2GeV, no cut above 2
  esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
  esdTrackCuts->SetMaxDCAToVertexXY(1.);  
  esdTrackCuts->SetMaxDCAToVertexZ(1.);
  esdTrackCuts->SetPtRange(0.6,1.e10);
  esdTrackCuts->SetEtaRange(-0.8,+0.8);
  AliAnalysisFilter *trkFilter = new AliAnalysisFilter("trackFilter");
  trkFilter->AddCuts(esdTrackCuts);
  vHF->SetTrackFilter(trkFilter);
  //     D* soft pion tracks
  AliESDtrackCuts *esdTrackCutsSoftPi = new AliESDtrackCuts("AliESDtrackCuts","default");
  esdTrackCutsSoftPi->SetMinNClustersITS(4);
  esdTrackCutsSoftPi->SetMaxDCAToVertexXY(1.);  
  esdTrackCutsSoftPi->SetMaxDCAToVertexZ(1.);
  esdTrackCutsSoftPi->SetPtRange(0.2,1.e10);
  esdTrackCutsSoftPi->SetEtaRange(-0.8,+0.8);
  AliAnalysisFilter *trkFilterSoftPi = new AliAnalysisFilter("trackFilterSoftPi");
  trkFilterSoftPi->AddCuts(esdTrackCutsSoftPi);
  vHF->SetTrackFilterSoftPi(trkFilterSoftPi);
  //--- set cuts for candidates selection
  Int_t nptbins=2; Float_t ptlimits[2]={0.,1000000.};
  AliRDHFCutsD0toKpi *cutsD0toKpi = new AliRDHFCutsD0toKpi("CutsD0toKpi");
  cutsD0toKpi->SetStandardCutsPbPb2010();
  cutsD0toKpi->SetMinCentrality(-10);
  cutsD0toKpi->SetMaxCentrality(110);
  cutsD0toKpi->SetUseSpecialCuts(kFALSE);
  cutsD0toKpi->SetMinPtCandidate(0.);
  cutsD0toKpi->SetUsePID(kFALSE);
  cutsD0toKpi->SetUsePhysicsSelection(kFALSE);
  cutsD0toKpi->SetMaxVtxZ(1.e6);
  cutsD0toKpi->SetTriggerClass("");
  Float_t cutsArrayD0toKpi[11]={0.4,999999.,1.1,0.,0.,999999.,999999.,0.,0.5,-1,0.};
  cutsD0toKpi->SetPtBins(nptbins,ptlimits);
  cutsD0toKpi->SetCuts(11,cutsArrayD0toKpi);
  cutsD0toKpi->AddTrackCuts(esdTrackCuts);
  vHF->SetCutsD0toKpi(cutsD0toKpi);
  AliRDHFCutsJpsitoee *cutsJpsitoee = new AliRDHFCutsJpsitoee("CutsJpsitoee");
  Float_t cutsArrayJpsitoee[9]={0.350,100000.,1.1,0.,0.,100000.,100000.,100000000.,-1.1};
  cutsJpsitoee->SetCuts(9,cutsArrayJpsitoee);
  cutsJpsitoee->AddTrackCuts(esdTrackCuts);
  vHF->SetCutsJpsitoee(cutsJpsitoee);
  AliRDHFCutsDplustoKpipi *cutsDplustoKpipi = new AliRDHFCutsDplustoKpipi("CutsDplustoKpipi");
  cutsDplustoKpipi->SetStandardCutsPbPb2010();
  cutsDplustoKpipi->SetUsePID(kFALSE);
  Float_t cutsArrayDplustoKpipi[14]={0.25,0.3,0.3,0.,0.,0.01,0.05,0.05,0.,0.88,0.,10000000000.,0.,-1.};
  cutsDplustoKpipi->SetPtBins(nptbins,ptlimits);
  cutsDplustoKpipi->SetCuts(14,cutsArrayDplustoKpipi);
  cutsDplustoKpipi->AddTrackCuts(esdTrackCuts);
  cutsDplustoKpipi->SetMinPtCandidate(2.);
  vHF->SetCutsDplustoKpipi(cutsDplustoKpipi);
  AliRDHFCutsDstoKKpi *cutsDstoKKpi = new AliRDHFCutsDstoKKpi("CutsDstoKKpi");
  cutsDstoKKpi->SetStandardCutsPbPb2010();
  cutsDstoKKpi->SetUsePID(kFALSE);
  Float_t cutsArrayDstoKKpi[20]={0.35,0.3,0.3,0.,0.,0.005,0.06,0.,0.,0.9,0.,100000.,0.035,0.0001,-1.,1.,0.,0.,0.,-1.};
  cutsDstoKKpi->SetPtBins(nptbins,ptlimits);
  cutsDstoKKpi->SetCuts(20,cutsArrayDstoKKpi);
  cutsDstoKKpi->AddTrackCuts(esdTrackCuts);
  cutsDstoKKpi->SetMinPtCandidate(2.);
  vHF->SetCutsDstoKKpi(cutsDstoKKpi);
  AliRDHFCutsLctopKpi *cutsLctopKpi = new AliRDHFCutsLctopKpi("CutsLctopKpi");
  cutsLctopKpi->SetStandardCutsPbPb2010();
  cutsLctopKpi->SetUsePID(kFALSE);
  Float_t cutsArrayLctopKpi[13]={0.13,0.9,1.,0.,0.,0.01,0.04,0.006,1.,0.5,0.,0.05,0.4};
  cutsLctopKpi->SetPtBins(nptbins,ptlimits);
  cutsLctopKpi->SetCuts(13,cutsArrayLctopKpi);
  cutsLctopKpi->AddTrackCuts(esdTrackCuts);
  cutsLctopKpi->SetMinPtCandidate(2.);
  vHF->SetCutsLctopKpi(cutsLctopKpi);
  AliRDHFCutsD0toKpipipi *cutsD0toKpipipi = new AliRDHFCutsD0toKpipipi("CutsD0toKpipipi");
  Float_t cutsArrayD0toKpipipi[9]={0.2,0.04,0.00,0.01,0.02,0.8,0.,0.1,0.};
  cutsD0toKpipipi->SetCuts(9,cutsArrayD0toKpipipi);
  cutsD0toKpipipi->AddTrackCuts(esdTrackCuts);
  vHF->SetCutsD0toKpipipi(cutsD0toKpipipi);


 // D* pt dependent cuts ------------------------------------------

  AliRDHFCutsDStartoKpipi *cutsDStartoKpipi = new AliRDHFCutsDStartoKpipi("CutsDStartoKpipi");
  cutsDStartoKpipi->SetUsePID(kFALSE);
  
  const Int_t nvars=16;
  const Int_t nptbins=2;
  
  Float_t* ptbins;
  ptbins=new Float_t[nptbins+1];
  ptbins[0]=0.;
  ptbins[1]=5.;
  ptbins[2]=999.;
  
  cutsDStartoKpipi->SetPtBins(nptbins+1,ptbins);
  
  Float_t** rdcutsvalmine;
  rdcutsvalmine=new Float_t*[nvars];
  for(Int_t iv=0;iv<nvars;iv++){
    rdcutsvalmine[iv]=new Float_t[nptbins];
  }
  //0-5
  rdcutsvalmine[0][0]=0.10;  //D0 inv mass window
  rdcutsvalmine[1][0]=0.06;   // dca
  rdcutsvalmine[2][0]=0.9;    // thetastar
  rdcutsvalmine[3][0]=0.5;    // pt Pion
  rdcutsvalmine[4][0]=0.5;    // Pt Kaon
  rdcutsvalmine[5][0]=0.1;    // d0K
  rdcutsvalmine[6][0]=0.1;    // d0Pi
  rdcutsvalmine[7][0]=0.0001; // d0xd0
  rdcutsvalmine[8][0]=0.8;    // costhetapoint
  rdcutsvalmine[9][0]=0.15;   // Dstar inv mass window
  rdcutsvalmine[10][0]=0.03;  // half width of (M_Kpipi-M_D0)
  rdcutsvalmine[11][0]=0.1;   // Pt min of Pi soft
  rdcutsvalmine[12][0]=100.;  // Pt max of pi soft
  rdcutsvalmine[13][0]=9999.; // theta
  rdcutsvalmine[14][0]=0.9;   // |cosThetaPointXY|
  rdcutsvalmine[15][0]=1.;    // NormDecayLenghtXY
 //5-999
  rdcutsvalmine[0][1]=0.10;   //D0 inv mass window
  rdcutsvalmine[1][1]=0.06;   // dca
  rdcutsvalmine[2][1]=0.9;    // thetastar
  rdcutsvalmine[3][1]=0.5;    // pt Pion
  rdcutsvalmine[4][1]=0.5;    // Pt Kaon
  rdcutsvalmine[5][1]=0.1;    // d0K
  rdcutsvalmine[6][1]=0.1;    // d0Pi
  rdcutsvalmine[7][1]=0.0001; // d0xd0
  rdcutsvalmine[8][1]=0.7;    // costhetapoint
  rdcutsvalmine[9][1]=0.15;   // Dstar inv mass window
  rdcutsvalmine[10][1]=0.03;  // half width of (M_Kpipi-M_D0)
  rdcutsvalmine[11][1]=0.1;   // Pt min of Pi soft
  rdcutsvalmine[12][1]=100.;  // Pt max of pi soft
  rdcutsvalmine[13][1]=9999.; // theta
  rdcutsvalmine[14][1]=0.8;   // |cosThetaPointXY|
  rdcutsvalmine[15][1]=0.;    // NormDecayLenghtXY

  cutsDStartoKpipi->SetCuts(nvars,nptbins,rdcutsvalmine);
 
  cutsDStartoKpipi->AddTrackCuts(esdTrackCuts);
  cutsDStartoKpipi->AddTrackCutsSoftPi(esdTrackCutsSoftPi);
  cutsDStartoKpipi->SetMinPtCandidate(2.);
  vHF->SetCutsDStartoKpipi(cutsDStartoKpipi);

  //--------------------------------------------------------

  AliRDHFCutsLctoV0 *cutsLctoV0 = new AliRDHFCutsLctoV0("CutsLctoV0");
  Float_t cutsArrayLctoV0[17]={1.0,1.0,0.05,0.05,0.0,0.0,0.0,1000.,1000.,0.99,3.,1000.,0.,0.,0.,0.,0.0};
  cutsLctoV0->SetCuts(17,cutsArrayLctoV0);
  cutsLctoV0->AddTrackCuts(esdTrackCuts);
  vHF->SetCutsLctoV0(cutsLctoV0);
  // 
  //--- set this if you want to reconstruct primary vertex candidate by
  //    candidate using other tracks in the event (for pp, broad 
  //    interaction region)
  //vHF->SetRecoPrimVtxSkippingTrks();
  //--- OR set this if you want to remove the candidate daughters from 
  //    the primary vertex, without recostructing it from scratch
  //vHF->SetRmTrksFromPrimVtx();

  //--- check the settings
  vHF->PrintStatus();
  //--- verbose
  //  AliLog::SetClassDebugLevel("AliAnalysisVertexingHF",2);

 
  return vHF;
}
Example #18
0
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;
}
Example #19
0
AliAnalysisTaskJetExtractorHF* AddTaskJetExtractorHF(
  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: AddTaskJetExtractorHF.C ############\n";
  //==============================================================================
  // Prepare analysis manager, containers, etc.
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

  if (!mgr)
  {
    ::Error("AddTaskJetExtractorHF", "No analysis manager to connect to.");
    return NULL;
  }  
  if (!mgr->GetInputEventHandler())
  {
    ::Error("AddTaskJetExtractorHF", "This task requires an input event handler");
    return NULL;
  }
  
  TString name("AliAnalysisTaskJetExtractorHF");
  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

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

  AliRDHFJetsCutsVertex* cuts = new AliRDHFJetsCutsVertex("jetCuts");

  // vertexing
  AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts", "default");
  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
  esdTrackCuts->SetMinNClustersTPC(90);
  esdTrackCuts->SetMaxChi2PerClusterTPC(4);
  esdTrackCuts->SetRequireTPCRefit(kTRUE);
  esdTrackCuts->SetRequireITSRefit(kTRUE);
  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
  esdTrackCuts->SetMinDCAToVertexXY(0.);
  esdTrackCuts->SetEtaRange(-0.8, 0.8);
  esdTrackCuts->SetPtRange(1.0, 1.e10);

  cuts->AddTrackCuts(esdTrackCuts);
  cuts->SetNprongs(3);
  cuts->SetMinPtHardestTrack(1.0);//default 0.3
  cuts->SetSecVtxWithKF(kFALSE);//default with StrLinMinDist
  cuts->SetImpParCut(0.);//default 0
  cuts->SetDistPrimSec(0.);//default 0
  cuts->SetCospCut(-1);//default -1

  jetTask->SetVertexerCuts(cuts);

  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: AddTaskJetExtractorHF.C ############\n";
 
  return jetTask;
}
AliAnalysisTaskSEHFJetsOrig* AddTaskSEHFJetsOrig(TString fileout="standard",Bool_t readmc=kTRUE,TString cutfile="HFJetVertexCuts.root",TString containerprefix="c", Float_t minC=0., Float_t maxC=7.5)
{  
  //
  // Configuration macro for the task to analyze the fraction of prompt charm
  // using the D0 impact parameter
  // [email protected]
  //
  //==========================================================================

  Int_t last=0;

  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    ::Error("AddTaskSEHFJetsOrig", "No analysis manager to connect to.");
    return NULL;
  }   
  
  TString str,containername;
  if(fileout=="standard"){
    fileout=AliAnalysisManager::GetCommonFileName();
    fileout+=":PWG3_HFCJ_";
    fileout+="HFjetVertex";
    if(containerprefix!="c")fileout+=containerprefix;
    str="HFjetVertex";
  }
  else {
    str=fileout;
    str.ReplaceAll(".root","");
  }
  str.Prepend("_");

  AliAnalysisTaskSEHFJetsOrig *hfTask;
  
  
  if(!gSystem->AccessPathName(cutfile.Data(),kFileExists)){
    TFile *f=TFile::Open(cutfile.Data());
    AliRDHFJetsCuts.cxx *cuts= (AliRDHFCutsD0toKpi*)f->Get("HFJetsCutsVertex");
    cuts->PrintAll();
    hfTask = new AliAnalysisTaskSEHFJetsOrig("AliAnalysisTaskSEHFJetsOrig");
    AliHFJetVertexTagging *tagger=new AliHFJetVertexTagging();
    hfTask->SetTagger(tagger);
    hfTask->SetCuts(cuts);
  }
  else {
    
    AliRDHFJetsCuts *cuts=new AliRDHFJetsCuts();
    hfTask = new AliAnalysisTaskSEHFJetsOrig("AliAnalysisTaskSEHFJetsOrig");
    hfTask->SetCuts(cuts);
    AliHFJetVertexTagging *tagger=new AliHFJetVertexTagging();

    AliRDHFJetsCutsVertex *cuts2=new AliRDHFJetsCutsVertex("jetCuts");

    //cuts for jets
    cuts->SetJetRadius(0.4);
    cuts->SetMaxEtaJet(0.5);//0.9-R
    cuts->SetMinPtJet(5);
    cuts->SetMaxPtJet(200);
    cuts2->SetJetRadius(0.4);
    cuts2->SetMaxEtaJet(0.5);//0.9-R
    cuts2->SetMinPtJet(5);
    cuts2->SetMaxPtJet(200);

    AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
    esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
    esdTrackCuts->SetMinNClustersTPC(70);
    esdTrackCuts->SetMaxChi2PerClusterTPC(4);
    esdTrackCuts->SetRequireTPCRefit(kTRUE);
    esdTrackCuts->SetRequireITSRefit(kTRUE);
    //esdTrackCuts->SetMinNClustersITS(4);
    esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
    esdTrackCuts->SetMinDCAToVertexXY(0.);
    esdTrackCuts->SetEtaRange(-0.8,0.8);
    esdTrackCuts->SetPtRange(0.3,1.e10);
  
    cuts2->AddTrackCuts(esdTrackCuts);
    //cuts for vertexing
    cuts2->SetNprongs(3);
    cuts2->SetIsElec(kFALSE); // kTRUE to select e in jet vertex  

 //    cuts2->SetMinPtHardestTrack(1.5);//default 0.3
//     cuts2->SetSecVtxWithKF(kFALSE);//default with StrLinMinDist
//     cuts2->SetImpParCut(0.01);//default 0
//     cuts2->SetDistPrimSec(0.1);//default 0
//     cuts2->SetCospCut(0.7);//default -1

//   cuts2->SetMinPtHardestTrack(1.3);//default 0.3
//     cuts2->SetSecVtxWithKF(kFALSE);//default with StrLinMinDist
//     cuts2->SetImpParCut(0.01);//default 0
//     cuts2->SetDistPrimSec(0.05);//default 0
//     cuts2->SetCospCut(0.7);//default -1

    cuts2->SetMinPtHardestTrack(1.0);//default 0.3
    cuts2->SetSecVtxWithKF(kFALSE);//default with StrLinMinDist
    cuts2->SetImpParCut(0.);//default 0
    cuts2->SetDistPrimSec(0.);//default 0
    cuts2->SetCospCut(-1);//default -1
 

    tagger->SetCuts(cuts2);
    hfTask->SetCuts(cuts);
    hfTask->SetTagger(tagger);
    //    ::Error("AddTaskSEHFJets","No Cut Object");
  }

  cuts->SetMinCentrality(minC);
  cuts->SetMaxCentrality(maxC);
  hfTask->SetReadMC(readmc);
  
  
  mgr->AddTask(hfTask);
 
 
  
 // Create containers for input/output
  AliAnalysisDataContainer *cinput =   mgr->GetCommonInputContainer();
  //mgr->CreateContainer("cinput",TChain::Class(),AliAnalysisManager::kInputContainer);
  mgr->ConnectInput(hfTask,0,cinput);
  

  //Now container for general properties histograms
  containername="outputNentries";
  containername.Prepend(containerprefix.Data());
  containername.Append(str.Data());
  AliAnalysisDataContainer *coutputNentries = mgr->CreateContainer(containername.Data(),TH1F::Class(), AliAnalysisManager::kOutputContainer, fileout.Data());
  mgr->ConnectOutput(hfTask,1,coutputNentries);

  containername="RecoJetsProp";
  containername.Prepend(containerprefix.Data());
  containername.Append(str.Data());
  AliAnalysisDataContainer *cSparseVtxProp = mgr->CreateContainer(containername.Data(),THnSparse::Class(), AliAnalysisManager::kOutputContainer, fileout.Data());
  mgr->ConnectOutput(hfTask,2,cSparseVtxProp);

  containername="SparseVerticesProp";
  containername.Prepend(containerprefix.Data());
  containername.Append(str.Data());
  AliAnalysisDataContainer *cSparseVtxProp = mgr->CreateContainer(containername.Data(),THnSparse::Class(), AliAnalysisManager::kOutputContainer, fileout.Data());
  mgr->ConnectOutput(hfTask,3,cSparseVtxProp);

  containername="SparseJetVerticesProp";
  containername.Prepend(containerprefix.Data());
  containername.Append(str.Data());
  AliAnalysisDataContainer *cSparseVtxProp = mgr->CreateContainer(containername.Data(),THnSparse::Class(), AliAnalysisManager::kOutputContainer, fileout.Data());
  mgr->ConnectOutput(hfTask,4,cSparseVtxProp);


  containername="SparsebTaggedJets";
  containername.Prepend(containerprefix.Data());
  containername.Append(str.Data());
  AliAnalysisDataContainer *cSparsebJets = mgr->CreateContainer(containername.Data(),THnSparse::Class(), AliAnalysisManager::kOutputContainer, fileout.Data());
  mgr->ConnectOutput(hfTask,5,cSparsebJets);




  return hfTask;
}