From 5a80473fcf507d1b9636cf6e6c672aff3d96ee96 Mon Sep 17 00:00:00 2001
From: Marino Missiroli <marino.missiroli@desy.de>
Date: Fri, 16 Aug 2019 11:25:08 +0200
Subject: [PATCH] fix in mem.py

---
 crab/.gitignore      | 2 ++
 crab/cc_looper.py    | 8 ++++----
 crab/mem.py          | 4 ++--
 src/MEMClassifier.cc | 8 +++-----
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/crab/.gitignore b/crab/.gitignore
index 71c6a9c..888fa1a 100644
--- a/crab/.gitignore
+++ b/crab/.gitignore
@@ -1,4 +1,6 @@
 *~
+*.pyc
+*.root
 jobs_*.txt
 crab_projects/
 samples_desy_*
diff --git a/crab/cc_looper.py b/crab/cc_looper.py
index e211cf6..cba2aa5 100644
--- a/crab/cc_looper.py
+++ b/crab/cc_looper.py
@@ -440,19 +440,19 @@ if __name__ == "__main__":
     confs = {
         "CSV": {
             "btag": "btagCSV_",
-            "btagWP" : 0.8484
+            "btagWP" : 0.8484,
         },
         "DeepCSV": {
             "btag" : "btagDeepCSV_",
-            "btagWP" : 0.4941
+            "btagWP" : 0.4941,
         },
         "DeepJet": {
             "btag" : "btagDeepFlavB_",
-            "btagWP" : 0.2770
+            "btagWP" : 0.2770,
         },
         "CMVA": {
             "btag": "btagBDT_",
-            "btagWP" : 0 #Not correct but we're not using it anyway
+            "btagWP" : 0, # Not correct but we're not using it anyway
         },
     }
 
diff --git a/crab/mem.py b/crab/mem.py
index 29cd34b..17ed27e 100644
--- a/crab/mem.py
+++ b/crab/mem.py
@@ -42,8 +42,8 @@ inf_remote.Close()
 
 #now do the processing
 conf = {
-  "btag" : "btagDeepJet_",
-  "btagWP" : 0.2770
+  "btag" : "btagDeepFlavB_",
+  "btagWP" : 0.2770,
 }
 
 main("infile.root", 0, nEvents-1, outfile_name, conf, era=era)
diff --git a/src/MEMClassifier.cc b/src/MEMClassifier.cc
index d82bc4a..3a516af 100644
--- a/src/MEMClassifier.cc
+++ b/src/MEMClassifier.cc
@@ -111,9 +111,7 @@ void MEMClassifier::setup_mem_impl(
         selectedJetP4, selectedJetCSV, best_perm, blr_4b, blr_2b
     );
 
-    const int expN_btagged = 4;
-
-    assert(int(best_perm.size()) >= expN_btagged);
+    assert(best_perm.size() >= 4);
 
     cout << "best_perm = [";
     for (auto ip : best_perm) {
@@ -132,7 +130,7 @@ void MEMClassifier::setup_mem_impl(
         TLorentzVector p4 = selectedJetP4.at(ij);
         assert(p4.Pt() > 0);
         //Check if this jet was in the best 4b permutation, i.e. the first 4 indices of the permutation
-        auto last = best_perm.begin() + expN_btagged;
+        auto last = best_perm.begin() + 4;
 
         bool is_btagged = std::find(best_perm.begin(), last, ij) != last;
 
@@ -162,7 +160,7 @@ void MEMClassifier::setup_mem_impl(
         integrand->push_back_object(untagged[ij]);
     }
 
-    assert(tagged.size() == expN_btagged);
+    assert(tagged.size() == 4);
 
     for (unsigned int il=0; il < selectedLeptonP4.size(); il++) {
         TLorentzVector lep_p4 = selectedLeptonP4.at(il);
-- 
GitLab