ROOT logo
/***************************************************************************
              fbellini@cern.ch - last modified on 06/08/2012
//
// General macro to configure the RSN analysis task.
// It calls all configs desired by the user, by means
// of the boolean switches defined in the first lines.
// ---
// Inputs:
//  1) flag to know if running on MC or data
//  2) path where all configs are stored
// ---
// Returns:
//  kTRUE  --> initialization successful
//  kFALSE --> initialization failed (some config gave errors)
//
****************************************************************************/

AliRsnMiniAnalysisTask * AddTaskKStarTrkSyst
(
   Bool_t      isMC,
   Bool_t      isPP,
   Int_t       aodFilterBit = 5,
   AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutPiCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPPB2011,
   AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPPB2011,
   Float_t     nsigmaPi = 2.0,
   Float_t     nsigmaKa = 2.0,
   TString     outNameSuffix = "",
   Int_t       signedPdg = 313,
   Double_t    minYlab =  0.465,
   Double_t    maxYlab =  0.965,
   Bool_t      enableTrkSyst = kFALSE,
   Double_t    dcaxymax = 2.4,
   Double_t    dcazmax = 3.2,
   Double_t    minNcls = 70,
   Double_t    maxX2cls = 5.0
 )
{  
  //
  // -- INITIALIZATION ----------------------------------------------------------------------------
  // retrieve analysis manager
  //
  Bool_t      enableMonitor = kTRUE;
  Bool_t      IsMcTrueOnly = kFALSE;
  Int_t       nmix = 0;
  Float_t     maxDiffVzMix = 1.0;
  Float_t     maxDiffMultMix = 10.0;
  TString     monitorOpt = "";
  Bool_t      useMixLS = 0;
  AliRsnMiniValue::EType yaxisvar = AliRsnMiniValue::kPt;                


  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
      ::Error("AddAnalysisTaskTOFKStar", "No analysis manager to connect to.");
      return NULL;
   } 

   // create the task and configure 
   TString taskName = Form("TOFKStar%s%s_%i%i", (isPP? "pp" : "PbPb"), (isMC ? "MC" : "Data"), (Int_t)cutPiCandidate,(Int_t)cutKaCandidate );
   AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
   if (isPP) 
     task->UseMultiplicity("QUALITY");
   else
     task->UseCentrality("V0A");   
   // set event mixing options
   task->UseContinuousMix();
   //task->UseBinnedMix();
   task->SetNMix(nmix);
   task->SetMaxDiffVz(maxDiffVzMix);
   task->SetMaxDiffMult(maxDiffMultMix);
   ::Info("AddAnalysisTaskTOFKStar", Form("Event mixing configuration: \n events to mix = %i \n max diff. vtxZ = cm %5.3f \n max diff multi = %5.3f", nmix, maxDiffVzMix, maxDiffMultMix));
   
   mgr->AddTask(task);
   
   //
   // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
   //  
   // cut on primary vertex:
   // - 2nd argument --> |Vz| range
   // - 3rd argument --> minimum required number of contributors
   // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
   AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
   //if (isPP) cutVertex->SetCheckPileUp(kTRUE);   // set the check for pileup
   
   // define and fill cut set for event cut
   AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
   eventCuts->AddCut(cutVertex);
   eventCuts->SetCutScheme(cutVertex->GetName());
   // set cuts in task
   task->SetEventCuts(eventCuts);
   
   //
   // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
   //   
   //vertex
   Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
   AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
   outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
   
   //multiplicity or centrality
   Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
   AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
   if (isPP) 
     outMult->AddAxis(multID, 400, 0.0, 400.0);
   else
     outMult->AddAxis(multID, 100, 0.0, 100.0);
   
   TH2F* hvz=new TH2F("hVzVsCent","",100,0.,100., 220,-11.,11.);
   task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member

   TH2F* hmc=new TH2F("MultiVsCent","",100,0.,100.,4000,0.,4000.);
   hmc->GetYaxis()->SetTitle("QUALITY");
   task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member

   //
   // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
   //
   AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
   cutY->SetRangeD(minYlab, maxYlab);
   
   AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
   cutsPair->AddCut(cutY);
   cutsPair->SetCutScheme(cutY->GetName());
   
   //
   // -- CONFIG ANALYSIS --------------------------------------------------------------------------
   gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigKStarTrkSyst.C");
   if (!ConfigKStarTrkSyst(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, useMixLS, signedPdg, monitorOpt.Data(), yaxisvar, enableTrkSyst, dcaxymax, dcazmax, minNcls, maxX2cls)) return 0x0;
   
   //
   // -- CONTAINERS --------------------------------------------------------------------------------
   //
   TString outputFileName = AliAnalysisManager::GetCommonFileName();
   //  outputFileName += ":Rsn";
   Printf("AddAnalysisTaskTOFKStar - Set OutputFileName : \n %s\n", outputFileName.Data() );
   
   AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnOut_%s",outNameSuffix.Data()), 
							   TList::Class(), 
							   AliAnalysisManager::kOutputContainer, 
							   outputFileName);
   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput(task, 1, output);
   
   return task;
}
 AddTaskKStarTrkSyst.C:1
 AddTaskKStarTrkSyst.C:2
 AddTaskKStarTrkSyst.C:3
 AddTaskKStarTrkSyst.C:4
 AddTaskKStarTrkSyst.C:5
 AddTaskKStarTrkSyst.C:6
 AddTaskKStarTrkSyst.C:7
 AddTaskKStarTrkSyst.C:8
 AddTaskKStarTrkSyst.C:9
 AddTaskKStarTrkSyst.C:10
 AddTaskKStarTrkSyst.C:11
 AddTaskKStarTrkSyst.C:12
 AddTaskKStarTrkSyst.C:13
 AddTaskKStarTrkSyst.C:14
 AddTaskKStarTrkSyst.C:15
 AddTaskKStarTrkSyst.C:16
 AddTaskKStarTrkSyst.C:17
 AddTaskKStarTrkSyst.C:18
 AddTaskKStarTrkSyst.C:19
 AddTaskKStarTrkSyst.C:20
 AddTaskKStarTrkSyst.C:21
 AddTaskKStarTrkSyst.C:22
 AddTaskKStarTrkSyst.C:23
 AddTaskKStarTrkSyst.C:24
 AddTaskKStarTrkSyst.C:25
 AddTaskKStarTrkSyst.C:26
 AddTaskKStarTrkSyst.C:27
 AddTaskKStarTrkSyst.C:28
 AddTaskKStarTrkSyst.C:29
 AddTaskKStarTrkSyst.C:30
 AddTaskKStarTrkSyst.C:31
 AddTaskKStarTrkSyst.C:32
 AddTaskKStarTrkSyst.C:33
 AddTaskKStarTrkSyst.C:34
 AddTaskKStarTrkSyst.C:35
 AddTaskKStarTrkSyst.C:36
 AddTaskKStarTrkSyst.C:37
 AddTaskKStarTrkSyst.C:38
 AddTaskKStarTrkSyst.C:39
 AddTaskKStarTrkSyst.C:40
 AddTaskKStarTrkSyst.C:41
 AddTaskKStarTrkSyst.C:42
 AddTaskKStarTrkSyst.C:43
 AddTaskKStarTrkSyst.C:44
 AddTaskKStarTrkSyst.C:45
 AddTaskKStarTrkSyst.C:46
 AddTaskKStarTrkSyst.C:47
 AddTaskKStarTrkSyst.C:48
 AddTaskKStarTrkSyst.C:49
 AddTaskKStarTrkSyst.C:50
 AddTaskKStarTrkSyst.C:51
 AddTaskKStarTrkSyst.C:52
 AddTaskKStarTrkSyst.C:53
 AddTaskKStarTrkSyst.C:54
 AddTaskKStarTrkSyst.C:55
 AddTaskKStarTrkSyst.C:56
 AddTaskKStarTrkSyst.C:57
 AddTaskKStarTrkSyst.C:58
 AddTaskKStarTrkSyst.C:59
 AddTaskKStarTrkSyst.C:60
 AddTaskKStarTrkSyst.C:61
 AddTaskKStarTrkSyst.C:62
 AddTaskKStarTrkSyst.C:63
 AddTaskKStarTrkSyst.C:64
 AddTaskKStarTrkSyst.C:65
 AddTaskKStarTrkSyst.C:66
 AddTaskKStarTrkSyst.C:67
 AddTaskKStarTrkSyst.C:68
 AddTaskKStarTrkSyst.C:69
 AddTaskKStarTrkSyst.C:70
 AddTaskKStarTrkSyst.C:71
 AddTaskKStarTrkSyst.C:72
 AddTaskKStarTrkSyst.C:73
 AddTaskKStarTrkSyst.C:74
 AddTaskKStarTrkSyst.C:75
 AddTaskKStarTrkSyst.C:76
 AddTaskKStarTrkSyst.C:77
 AddTaskKStarTrkSyst.C:78
 AddTaskKStarTrkSyst.C:79
 AddTaskKStarTrkSyst.C:80
 AddTaskKStarTrkSyst.C:81
 AddTaskKStarTrkSyst.C:82
 AddTaskKStarTrkSyst.C:83
 AddTaskKStarTrkSyst.C:84
 AddTaskKStarTrkSyst.C:85
 AddTaskKStarTrkSyst.C:86
 AddTaskKStarTrkSyst.C:87
 AddTaskKStarTrkSyst.C:88
 AddTaskKStarTrkSyst.C:89
 AddTaskKStarTrkSyst.C:90
 AddTaskKStarTrkSyst.C:91
 AddTaskKStarTrkSyst.C:92
 AddTaskKStarTrkSyst.C:93
 AddTaskKStarTrkSyst.C:94
 AddTaskKStarTrkSyst.C:95
 AddTaskKStarTrkSyst.C:96
 AddTaskKStarTrkSyst.C:97
 AddTaskKStarTrkSyst.C:98
 AddTaskKStarTrkSyst.C:99
 AddTaskKStarTrkSyst.C:100
 AddTaskKStarTrkSyst.C:101
 AddTaskKStarTrkSyst.C:102
 AddTaskKStarTrkSyst.C:103
 AddTaskKStarTrkSyst.C:104
 AddTaskKStarTrkSyst.C:105
 AddTaskKStarTrkSyst.C:106
 AddTaskKStarTrkSyst.C:107
 AddTaskKStarTrkSyst.C:108
 AddTaskKStarTrkSyst.C:109
 AddTaskKStarTrkSyst.C:110
 AddTaskKStarTrkSyst.C:111
 AddTaskKStarTrkSyst.C:112
 AddTaskKStarTrkSyst.C:113
 AddTaskKStarTrkSyst.C:114
 AddTaskKStarTrkSyst.C:115
 AddTaskKStarTrkSyst.C:116
 AddTaskKStarTrkSyst.C:117
 AddTaskKStarTrkSyst.C:118
 AddTaskKStarTrkSyst.C:119
 AddTaskKStarTrkSyst.C:120
 AddTaskKStarTrkSyst.C:121
 AddTaskKStarTrkSyst.C:122
 AddTaskKStarTrkSyst.C:123
 AddTaskKStarTrkSyst.C:124
 AddTaskKStarTrkSyst.C:125
 AddTaskKStarTrkSyst.C:126
 AddTaskKStarTrkSyst.C:127
 AddTaskKStarTrkSyst.C:128
 AddTaskKStarTrkSyst.C:129
 AddTaskKStarTrkSyst.C:130
 AddTaskKStarTrkSyst.C:131
 AddTaskKStarTrkSyst.C:132
 AddTaskKStarTrkSyst.C:133
 AddTaskKStarTrkSyst.C:134
 AddTaskKStarTrkSyst.C:135
 AddTaskKStarTrkSyst.C:136
 AddTaskKStarTrkSyst.C:137
 AddTaskKStarTrkSyst.C:138
 AddTaskKStarTrkSyst.C:139
 AddTaskKStarTrkSyst.C:140
 AddTaskKStarTrkSyst.C:141
 AddTaskKStarTrkSyst.C:142
 AddTaskKStarTrkSyst.C:143
 AddTaskKStarTrkSyst.C:144
 AddTaskKStarTrkSyst.C:145
 AddTaskKStarTrkSyst.C:146