]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added macros for systematic studies on trk selection for K* in pA
authorfbellini <fbellini@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Sep 2013 14:00:56 +0000 (14:00 +0000)
committerfbellini <fbellini@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 Sep 2013 14:00:56 +0000 (14:00 +0000)
PWGLF/RESONANCES/macros/mini/AddTaskKStarTrkSyst.C [new file with mode: 0644]
PWGLF/RESONANCES/macros/mini/ConfigKStarTrkSyst.C [new file with mode: 0644]

diff --git a/PWGLF/RESONANCES/macros/mini/AddTaskKStarTrkSyst.C b/PWGLF/RESONANCES/macros/mini/AddTaskKStarTrkSyst.C
new file mode 100644 (file)
index 0000000..ae57b70
--- /dev/null
@@ -0,0 +1,145 @@
+/***************************************************************************
+              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;
+}
diff --git a/PWGLF/RESONANCES/macros/mini/ConfigKStarTrkSyst.C b/PWGLF/RESONANCES/macros/mini/ConfigKStarTrkSyst.C
new file mode 100644 (file)
index 0000000..2103cc9
--- /dev/null
@@ -0,0 +1,166 @@
+/***************************************************************************
+              fbellini@cern.ch - created on 19/09/2013
+
+// *** Configuration script for K*, anti-K* syst. analysis with p-Pb runs ***
+// 
+// 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 ConfigKStarTrkSyst
+(  
+    AliRsnMiniAnalysisTask *task, 
+    Bool_t                 isMC, 
+    Bool_t                 isPP,
+    const char             *suffix,
+    AliRsnCutSet           *cutsPair,
+    Int_t                  aodFilterBit = 5,
+    AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutPiCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010,
+    AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010,
+    Float_t                nsigmaPi = 2.0,
+    Float_t                nsigmaKa = 2.0,
+    Bool_t                 enableMonitor = kTRUE,
+    Bool_t                 IsMcTrueOnly = kFALSE,
+    Bool_t                 useMixLS = 0,
+    Int_t                  signedPdg = 313,
+    TString                monitorOpt = "",
+    AliRsnMiniValue::EType yaxisVar = AliRsnMiniValue::kPt,
+    Bool_t                 enableTrkSyst = kFALSE,
+    Double_t               dcaxymax = 2.4,
+    Double_t               dcazmax = 3.2,
+    Double_t               minNcls = 70,
+    Double_t               maxX2cls = 4.0
+    // Double_t               minCrossedRows = 50.0,
+    // Double_t               maxClsCrossedRows = 0.8
+)
+{
+  // manage suffix
+  if (strlen(suffix) > 0) suffix = Form("_%s", suffix);
+  
+  // set daughter cuts
+  AliRsnCutSetDaughterParticle * cutSetPi = new AliRsnCutSetDaughterParticle(Form("cutPi%i_%2.1fsigma",cutPiCandidate, nsigmaPi), cutPiCandidate, AliPID::kPion, nsigmaPi, aodFilterBit);
+  AliRsnCutSetDaughterParticle * cutSetK  = new AliRsnCutSetDaughterParticle(Form("cutK%i_%2.1fsigma",cutKaCandidate, nsigmaKa), cutKaCandidate, AliPID::kKaon, nsigmaKa, aodFilterBit);
+  AliRsnCutSetDaughterParticle * cutSetQ  = new AliRsnCutSetDaughterParticle(Form("cut_quality"), AliRsnCutSetDaughterParticle::kQualityStd2011, 1e20, 1e20, aodFilterBit);
+  
+  if (enableTrkSyst) {
+    ((AliRsnCutTrackQuality *)cutSetQ->GetQualityCut())->SetDCARmax(dcaxymax);
+    ((AliRsnCutTrackQuality *)cutSetQ->GetQualityCut())->SetDCAZmax(dcazmax);
+    ((AliRsnCutTrackQuality *)cutSetQ->GetQualityCut())->SetTPCminNClusters(minNcls);
+    ((AliRsnCutTrackQuality *)cutSetQ->GetQualityCut())->SetTPCmaxChi2(maxX2cls);
+    //cutSetQ->SetTPCminNcrossedRows(minCrossedRows); //TO BE IMPLEMENTED
+    //cutSetQ->SetTPCminNclsPerCrossedRow(maxClsCrossedRows); //TO BE IMPLEMENTED
+  }
+  
+  Int_t iCutQ = task->AddTrackCuts(cutSetQ);
+  Int_t iCutPi = task->AddTrackCuts(cutSetPi);
+  Int_t iCutK = task->AddTrackCuts(cutSetK);
+  
+  if (enableMonitor){
+    Printf("======== Cut monitoring enabled");
+    gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/AddMonitorOutput.C");
+    AddMonitorOutput(isMC, cutSetQ->GetMonitorOutput(), monitorOpt.Data());
+    AddMonitorOutput(isMC, cutSetPi->GetMonitorOutput(), monitorOpt.Data());
+    AddMonitorOutput(isMC, cutSetK->GetMonitorOutput()), monitorOpt.Data();
+  }  
+  
+  // -- Values ------------------------------------------------------------------------------------
+  /* invariant mass   */ Int_t imID   = task->CreateValue(AliRsnMiniValue::kInvMass, kFALSE);
+  /* IM resolution    */ Int_t resID  = task->CreateValue(AliRsnMiniValue::kInvMassRes, kTRUE);
+  /* transv. momentum */ Int_t ptID   = task->CreateValue(AliRsnMiniValue::kPt, kFALSE);
+  /* centrality       */ Int_t centID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
+  /* pseudorapidity   */ Int_t etaID  = task->CreateValue(AliRsnMiniValue::kEta, kFALSE);
+  /* rapidity         */ Int_t yID    = task->CreateValue(AliRsnMiniValue::kY, kFALSE);
+  /* 1st daughter pt  */ Int_t fdpt   = task->CreateValue(AliRsnMiniValue::kFirstDaughterPt, kFALSE);
+  /* 2nd daughter pt  */ Int_t sdpt   = task->CreateValue(AliRsnMiniValue::kSecondDaughterPt, kFALSE);
+  /* 1st daughter p   */ Int_t fdp    = task->CreateValue(AliRsnMiniValue::kFirstDaughterP, kFALSE);
+  /* 2nd daughter p   */ Int_t sdp    = task->CreateValue(AliRsnMiniValue::kSecondDaughterP, 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     [12] = { !IsMcTrueOnly,  !IsMcTrueOnly,  !IsMcTrueOnly,  !IsMcTrueOnly ,  !IsMcTrueOnly, !IsMcTrueOnly,  isMC   ,   isMC   ,  isMC   ,   isMC , useMixLS, useMixLS  };
+  Bool_t  useIM   [12] = { 1       ,  1       ,  1       ,  1       ,  1      ,  1      ,  1      ,   1      ,  0      ,   0 , 1    , 1     };
+  TString name    [12] = {"UnlikePM", "UnlikeMP", "MixingPM", "MixingMP", "LikePP", "LikeMM", "TruesPM",  "TruesMP", "ResPM"  ,  "ResMP",  "MixingPP",  "MixingMM"  };
+  TString comp    [12] = {"PAIR"   , "PAIR"   , "MIX"    , "MIX"    , "PAIR"  , "PAIR"  , "TRUE"  ,  "TRUE"  , "TRUE"  ,  "TRUE", "MIX","MIX"};
+  //TString output  [10] = {"HIST"   , "HIST"   , "HIST"   , "HIST"   , "HIST"  , "HIST"  , "HIST"  ,  "HIST"  , "HIST"  ,  "HIST"  };
+  TString output  [12] = {"SPARSE"   , "SPARSE"   , "SPARSE"   , "SPARSE"   , "SPARSE"  , "SPARSE"  , "SPARSE"  ,  "SPARSE"  , "SPARSE"  ,  "SPARSE", "SPARSE"  ,  "SPARSE"};
+  Char_t  charge1 [12] = {'+'      , '-'      , '+'      , '-'      , '+'     , '-'     , '+'     ,  '-'     , '+'     ,  '-'  , '+' , '-'};
+  Char_t  charge2 [12] = {'-'      , '+'      , '-'      , '+'      , '+'     , '-'     , '-'     ,  '+'     , '-'     ,  '+'  ,'+' , '-'   };
+  Int_t   cutID1  [12] = { iCutK   ,  iCutK   ,  iCutK   ,  iCutK   ,  iCutK  ,  iCutK  ,  iCutK  ,   iCutK  ,  iCutK  ,   iCutK , iCutK, iCutK };
+  Int_t   cutID2  [12] = { iCutPi  ,  iCutPi  ,  iCutPi  ,  iCutPi  ,  iCutPi ,  iCutPi ,  iCutPi ,   iCutPi ,  iCutPi ,   iCutPi, iCutPi, iCutPi };
+  
+  for (Int_t i = 0; i < 12; i++) {
+    if (!use[i]) continue;
+    AliRsnMiniOutput *out = task->CreateOutput(Form("kstar_%s%s", name[i].Data(), suffix), output[i].Data(), comp[i].Data());
+    out->SetCutID(0, cutID1[i]);
+    out->SetCutID(1, cutID2[i]);
+    out->SetDaughter(0, AliRsnDaughter::kKaon);
+    out->SetDaughter(1, AliRsnDaughter::kPion);
+    out->SetCharge(0, charge1[i]);
+    out->SetCharge(1, charge2[i]);
+    out->SetMotherPDG(signedPdg);
+    out->SetMotherMass(0.89594);
+    out->SetPairCuts(cutsPair);
+
+    // axis X: invmass (or resolution)
+    if (useIM[i]) 
+      out->AddAxis(imID, 90, 0.6, 1.5);
+    else
+      out->AddAxis(resID, 200, -0.02, 0.02);
+    
+    // axis Y: transverse momentum of pair as default - else chosen value
+    if (yaxisVar==AliRsnMiniValue::kFirstDaughterPt)
+      out->AddAxis(fdpt, 100, 0.0, 10.0);
+    else
+      if (yaxisVar==AliRsnMiniValue::kSecondDaughterPt)
+       out->AddAxis(sdpt, 100, 0.0, 10.0);
+      else
+       if (yaxisVar==AliRsnMiniValue::kFirstDaughterP)
+         out->AddAxis(fdp, 100, 0.0, 10.0);
+       else
+         if (yaxisVar==AliRsnMiniValue::kSecondDaughterP)
+           out->AddAxis(sdp, 100, 0.0, 10.0);
+         else 
+           out->AddAxis(ptID, 100, 0.0, 10.0); //default use mother pt
+
+    // axis Z: centrality-multiplicity
+    if (!isPP)
+      out->AddAxis(centID, 100, 0.0, 100.0);
+    else 
+      out->AddAxis(centID, 400, 0.0, 400.0);
+    
+    // axis W: pseudorapidity
+    // out->AddAxis(etaID, 20, -1.0, 1.0);
+    // axis J: rapidity
+    // out->AddAxis(yID, 10, -0.5, 0.5);
+    
+  }   
+  
+  if (isMC){   
+    // create output
+    AliRsnMiniOutput *outm = task->CreateOutput(Form("kstar_Mother%s", suffix), "SPARSE", "MOTHER");
+    outm->SetDaughter(0, AliRsnDaughter::kKaon);
+    outm->SetDaughter(1, AliRsnDaughter::kPion);
+    outm->SetMotherPDG(signedPdg);
+    outm->SetMotherMass(0.89594);
+    // pair cuts
+    outm->SetPairCuts(cutsPair);
+    // binnings
+    outm->AddAxis(imID, 90, 0.6, 1.5);
+    outm->AddAxis(ptID, 100, 0.0, 10.0);
+    if (!isPP){
+      outm->AddAxis(centID, 100, 0.0, 100.0);
+    }   else    { 
+      outm->AddAxis(centID, 400, 0.0, 400.0);
+    }
+  }
+  return kTRUE;
+}