From 785ecb17be7d210adacb879bbcb0635f342a6bda Mon Sep 17 00:00:00 2001
From: Cornelius Feier-Riesen <cornelius.riesen@physik.uni-giessen.de>
Date: Fri, 10 Dec 2021 13:51:45 +0100
Subject: [PATCH] Include signals in comb. BG

and also change nofBins of hTofM2 histogram.
---
 analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx | 24 ++++++++------------
 macro/analysis/dielectron/draw_analysis.C    |  4 ++--
 macro/analysis/dielectron/run_local.py       | 14 ++++++------
 3 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx b/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx
index d59d4db22a..e0e9100507 100644
--- a/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx
+++ b/analysis/PWGDIL/dielectron/lmvm/LmvmTask.cxx
@@ -92,8 +92,8 @@ void LmvmTask::InitHists()
   fH.CreateH1("hEventNumberMixed", "", "", 1, 0, 1.);
 
   fH.CreateH1("hRichAnn", fH.fSrcNames, "RICH ANN output", ax, 100, -1.1, 1.1);
-  fH.CreateH1("hTrdAnn", fH.fSrcNames, "TRD ANN output", ax, 100, -.1, 1.1);
-  fH.CreateH2("hTofM2", fH.fSrcNames, "P [GeV/c]", "m^{2} [GeV/c^{2}]^{2}", ax, 100, 0., 4., 200, -0.1, 1.0);
+  fH.CreateH1("hTrdAnn", fH.fSrcNames, "Likelihood output", ax, 100, -.1, 1.1);  // TODO: change back to "TRD ANN"
+  fH.CreateH2("hTofM2", fH.fSrcNames, "P [GeV/c]", "m^{2} [GeV/c^{2}]^{2}", ax, 100, 0., 4., 500, -0.1, 1.0);
   fH.CreateH1("hChi2Sts", fH.fSrcNames, "#chi^{2}", ax, 200, 0., 20.);
   fH.CreateH1("hChi2PrimVertex", fH.fSrcNames, "#chi^{2}_{prim}", ax, 200, 0., 20.);
   fH.CreateH1("hNofMvdHits", fH.fSrcNames, "Number of hits in MVD", ax, 5, -0.5, 4.5);
@@ -576,34 +576,30 @@ void LmvmTask::CombinatorialPairs()
   size_t nCand = fCandsTotal.size();
   for (size_t iC1 = 0; iC1 < nCand; iC1++) {
     const auto& cand1 = fCandsTotal[iC1];
-    // for the moment remove signal from combinatorics.
-    // TODO: Discuss if we need to include signal with weight
-    if (cand1.IsMcSignal()) continue;
 
     for (size_t iC2 = iC1 + 1; iC2 < nCand; iC2++) {
       const auto& cand2 = fCandsTotal[iC2];
-      if (cand2.IsMcSignal()) continue;
+      if (cand1.IsMcSignal() xor cand2.IsMcSignal()) continue;
       LmvmKinePar pRec = LmvmKinePar::Create(&cand1, &cand2);
-
-      //double weight = (cand1.IsMcSignal() || cand2.IsMcSignal()) ? fW : 1.;
+      double w         = (cand1.IsMcSignal() && cand2.IsMcSignal()) ? fW : 1.;
       bool isSameEvent = (cand1.fEventNumber == cand2.fEventNumber);
       for (auto step : fH.fAnaSteps) {
         if (step == ELmvmAnaStep::Mc || step == ELmvmAnaStep::Acc) continue;
         if (cand1.IsCutTill(step) && cand2.IsCutTill(step)) {
           if (cand1.fCharge * cand2.fCharge < 0) {
-            if (isSameEvent) fH.FillH1("hMinvCombPM_sameEv", step, pRec.fMinv);
+            if (isSameEvent) fH.FillH1("hMinvCombPM_sameEv", step, pRec.fMinv, w);
             else
-              fH.FillH1("hMinvCombPM_mixedEv", step, pRec.fMinv);
+              fH.FillH1("hMinvCombPM_mixedEv", step, pRec.fMinv, w);
           }
           if (cand1.fCharge < 0 && cand2.fCharge < 0) {
-            if (isSameEvent) fH.FillH1("hMinvCombMM_sameEv", step, pRec.fMinv);
+            if (isSameEvent) fH.FillH1("hMinvCombMM_sameEv", step, pRec.fMinv, w);
             else
-              fH.FillH1("hMinvCombMM_mixedEv", step, pRec.fMinv);
+              fH.FillH1("hMinvCombMM_mixedEv", step, pRec.fMinv, w);
           }
           if (cand1.fCharge > 0 && cand2.fCharge > 0) {
-            if (isSameEvent) fH.FillH1("hMinvCombPP_sameEv", step, pRec.fMinv);
+            if (isSameEvent) fH.FillH1("hMinvCombPP_sameEv", step, pRec.fMinv, w);
             else
-              fH.FillH1("hMinvCombPP_mixedEv", step, pRec.fMinv);
+              fH.FillH1("hMinvCombPP_mixedEv", step, pRec.fMinv, w);
           }
         }
       }
diff --git a/macro/analysis/dielectron/draw_analysis.C b/macro/analysis/dielectron/draw_analysis.C
index f5369bc0be..e04cc2eb90 100644
--- a/macro/analysis/dielectron/draw_analysis.C
+++ b/macro/analysis/dielectron/draw_analysis.C
@@ -4,8 +4,8 @@
 
 //#include <experimental/filesystem>
 
-void draw_analysis(const string& histRootFile = "/lustre/cbm/users/criesen/data/lmvm/inmed/analysis.all.root",
-                   const string& resultDir = "/lustre/cbm/users/criesen/data/lmvm/results/", Bool_t useMvd = true,
+void draw_analysis(const string& histRootFile = "/home/aghoehne/soft/cbm/data/output/phi/analysis.all.root",
+                   const string& resultDir = "/home/aghoehne/soft/cbm/data/output/results/", Bool_t useMvd = true,
                    Bool_t drawSignificance = true)
 
 {
diff --git a/macro/analysis/dielectron/run_local.py b/macro/analysis/dielectron/run_local.py
index 7614628a3e..eebaf8d39d 100755
--- a/macro/analysis/dielectron/run_local.py
+++ b/macro/analysis/dielectron/run_local.py
@@ -6,17 +6,17 @@ import shutil
 
 def main():
 
-  cbmrootConfigPath = "/Users/slebedev/Development/cbm/git/build/config.sh"
-  urqmdFile = "/Users/slebedev/Development/cbm/data/urqmd/auau/8gev/centr/urqmd.auau.8gev.centr.00001.root"
-  plutoFile = "/Users/slebedev/Development/cbm/data/pluto/auau/8gev/omega/epem/pluto.auau.8gev.omega.epem.0001.root"
-  dataDir = "/Users/slebedev/Development/cbm/data/lmvm/test/"
+  cbmrootConfigPath = "/home/aghoehne/soft/cbm/build/config.sh"
+  urqmdFile = "/home/aghoehne/soft/cbm/data/input/urqmd.auau.8gev.centr.00001.root"
+  plutoFile = "/home/aghoehne/soft/cbm/data/input/pluto.auau.8gev.phi.epem.0001.root"
+  dataDir = "/home/aghoehne/soft/cbm/data/output/phi"
   
-  runId = "0"
+  runId = "1"
   geoSetup = "sis100_electron"
   nEvents = 10
   colEnergy = "8gev"
   colSystem = "auau"
-  plutoParticle = "omegaepem"
+  plutoParticle = "phi"
 
   traFile = dataDir + "/tra." + runId + ".root"  
   parFile = dataDir + "/param." + runId + ".root"
@@ -36,7 +36,7 @@ def main():
   #os.system((". /{} -a; {}").format(cbmrootConfigPath, traCmd))
   #os.system((". /{} -a; {}").format(cbmrootConfigPath, digiCmd))
   #os.system((". /{} -a; {}").format(cbmrootConfigPath, recoCmd))
-  #os.system((". /{} -a; {}").format(cbmrootConfigPath, qaCmd))
+  os.system((". /{} -a; {}").format(cbmrootConfigPath, qaCmd))
   os.system((". /{} -a; {}").format(cbmrootConfigPath, anaCmd))
   
 if __name__ == '__main__':
-- 
GitLab