Commit cae8b087ce8a8fb7f23b705ba2893962504f13d4

Authored by Marcel Hohmann
1 parent 8f0f3d4b

check changes

DualTrackTagger/include/DualTrackTaggerModule.h
... ... @@ -4,8 +4,8 @@
4 4 // Framework
5 5 #include <framework/datastore/StoreArray.h>
6 6 #include <framework/datastore/StoreObjPtr.h>
7   -//#include <framework/core/Module.h>
8   -#include <framework/core/HistoModule.h>
  7 +#include <framework/core/Module.h>
  8 +//#include <framework/core/HistoModule.h>
9 9  
10 10 // Dataobjects
11 11 #include <analysis/dataobjects/Particle.h>
... ... @@ -28,6 +28,7 @@
28 28 #include "TH1F.h"
29 29 #include "TString.h"
30 30 #include "TEfficiency.h"
  31 +#include "TFile.h"
31 32  
32 33 // Include MVA classes - TEST
33 34 #include <analysis/modules/DualTrackTagger/TMVAClassification_BDT5.class.h>
... ... @@ -110,11 +111,14 @@ namespace Belle2 {
110 111 bool m_MCFlag;
111 112 std::vector<std::string> m_strParticleLists;
112 113 double m_MVAResponseCut;
  114 + TString m_histoFileName;
113 115  
114 116 //Belle 2 Classifier
115 117 ReadBDT5 *Belle2ClassifierResponse;
116 118  
117 119 //histograms
  120 + TFile *m_histoFile;
  121 +
118 122 TH1F *h_genParticleIndexMulti;
119 123 TH1F *h_Duplicates;
120 124 TH1F *h_Singles;
... ... @@ -127,6 +131,7 @@ namespace Belle2 {
127 131  
128 132 TEfficiency *h_effTruePosPt;
129 133 TEfficiency *h_effFalsePosPt;
  134 +
130 135 };
131 136 }
132 137 #endif
... ...
DualTrackTagger/src/DualTrackTaggerModule.cc
... ... @@ -26,7 +26,7 @@
26 26 addParam("MCFlag",m_MCFlag,"True = Data is MC, False = Experimental Data. If true outputs additional statistics based on truth information.", false);
27 27 addParam("particleLists", m_strParticleLists, "List of ParticleLists", std::vector<std::string>() );
28 28 addParam("MVAResponseCut", m_MVAResponseCut, "Select the MVA response cut, default = 0", 0.0);
29   -
  29 + addParam("HistoOutFileName", m_histoFileName, "Output Root file for Histograms. Only created if MCFlag is enabled", TString("DualTrackTaggerHistograms.root"));
30 30 }
31 31  
32 32  
... ... @@ -86,6 +86,7 @@
86 86  
87 87 void DualTrackTaggerModule::terminate()
88 88 {
  89 + finalizeHistograms();
89 90 //std::cout << "FINAL STATISTICS:" << total_particles << " | " << lowPt_particles << std::endl;
90 91 //std::cout << "FINAL STATISTICS:" << total_events << std::endl;
91 92 //std::cout << "FINAL STATISTICS:" << (float)total_particles / total_events << " | " << (float)lowPt_particles / total_events << std::endl;
... ... @@ -223,9 +224,9 @@
223 224  
224 225 void DualTrackTaggerModule::defineHisto()
225 226 {
  227 + m_histoFile = TFile::Open(m_histoFileName, "RECREATE");
  228 +
226 229 h_genParticleIndexMulti = new TH1F("h_genParticleIndexMulti","h_genParticleIndexMulti; # of particles with same genParticleIndex",20,0,20);
227   - //h_SameChargeMultAngle = new TH1F("h_SameChargeMultAngle", "h_SameChargeMultAngle; #Angle between two particles - both pos/neg",100,0,TMath::Pi());
228   - //h_OppoChargeMultAngle = new TH1F("h_OppoChargeMultAngle", "h_OppoChargeMultAngle; #Angle between two particles - one pos, one neg",100,0,TMath::Pi());
229 230 h_Duplicates = new TH1F("h_Duplicates","True Duplicates; 0 = Correctly Identified, 1 = False Negative",2,0,2);
230 231 h_Singles = new TH1F("h_Singles","True Single Track Pairs; 0 = Correctly Identified, 1 = False Positive",2,0,2);
231 232 h_taggedDuplicate = new TH1F("h_taggedDuplicate", "Pairs tagged as Duplicate; 0 = correctly Identified, 1 = False Positive",2,0,2);
... ... @@ -235,8 +236,6 @@
235 236 h_TrueNegPt = new TH1F("h_TrueNegPt","True Negative Singles ;pT",100,0,0.5);
236 237 h_FalseNegPt = new TH1F("h_FalseNegPt","False Negative Singles ;pT",100,0,0.5);
237 238  
238   - h_effTruePosPt = new TEfficiency;
239   - h_effFalsePosPt = new TEfficiency;
240 239 }
241 240  
242 241 void DualTrackTaggerModule::fill_h_genParticleIndexMulti()
... ... @@ -325,6 +324,16 @@
325 324  
326 325 h_effTruePosPt = new TEfficiency(*h_TruePosPt, *h_AllDuplicatesPt);
327 326 h_effFalsePosPt = new TEfficiency(*h_FalsePosPt, *h_AllSinglesPt);
  327 +
  328 + m_histoFile -> cd();
  329 +
  330 + //Write TEff
  331 + h_effTruePosPt -> Write();
  332 + h_effFalsePosPt -> Write();
  333 +
  334 + m_histoFile -> Write(); // Writes all open Histograms
  335 +
  336 + m_histoFile -> Close();
328 337 }
329 338  
330 339 //void DualTrackTaggerModule::GroupParticles()
... ...