From ed9e3dd00713aa9138e64abb6dc246d53be83e3f Mon Sep 17 00:00:00 2001 From: Imma Riu <imma.riu@cern.ch> Date: Sun, 3 Sep 2017 08:59:31 +0000 Subject: [PATCH] Merge branch '21.1-dev-reference' into '21.1-dev' Many changes to the TrigInDetAnalysis code See merge request !4237 --- .../TrigInDetAnalysis/Efficiency.h | 11 +- .../TrigInDetAnalysis/Efficiency2D.h | 262 ------------------ .../TrigInDetAnalysis/Track.h | 2 + .../TrigInDetAnalysis/src/TIDAEvent.cxx | 5 +- .../src/AnalysisConfig_Ntuple.cxx | 11 +- .../Analysis/src/ConfAnalysis.cxx | 75 ++++- .../Analysis/src/ConfAnalysis.h | 18 ++ .../Analysis/src/Makefile | 2 +- .../Analysis/src/PurityAnalysis.cxx | 32 +-- .../Analysis/src/PurityAnalysis.h | 6 +- .../Analysis/src/comparitor.cxx | 32 ++- .../Analysis/src/cpucost.cxx | 6 +- .../Analysis/src/fastadd.cxx | 11 +- .../Analysis/src/listroot.cxx | 4 +- .../Analysis/src/reader.cxx | 5 +- .../Analysis/src/rmain.cxx | 107 ++++--- .../Resplot/src/Resplot.cxx | 6 +- .../Resplot/src/Resplot.h | 3 +- .../TrigInDetAnalysisUtils/Filter_Track.h | 12 +- .../TrigInDetAnalysisUtils/T_AnalysisConfig.h | 5 +- .../src/TrigTrackSelector.cxx | 42 ++- 21 files changed, 248 insertions(+), 409 deletions(-) delete mode 100644 Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency2D.h diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency.h b/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency.h index 1b85ff2db57d..575a1afb63c0 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency.h @@ -171,11 +171,12 @@ public: yeup *= scale; yedown *= scale; - /// root is just so much arse - can't just get/set specific y values - /// I mean - why *some* functions to get x or y only get *all* the x values, - /// but the functions to return the errors only get ONE AT A TIME ? - /// why isn't there a simple ScaleX() function? All this crap no one - /// cares about, and basic functions missing + /// root is just such a pain - can't just get/set specific y values + /// I mean - why *some* functions to get an x or y value and others + /// only get *all* the x values, but the functions to return the errors + /// only get ONE AT A TIME ? + /// why isn't there a simple ScaleX() function? All this functionality + /// no one cares about, and basic functionality missing tg->SetPoint( i, x[i], y[i] ); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency2D.h b/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency2D.h deleted file mode 100644 index 38bf79257785..000000000000 --- a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Efficiency2D.h +++ /dev/null @@ -1,262 +0,0 @@ -// emacs: this is -*- c++ -*- -// -// @file Efficiency2D.h -// -// -// -// Copyright (C) 2007 M.Sutton (sutt@cern.ch) -// -// $Id: Efficiency2D.h, v0.0 Mon 26 Oct 2009 01:22:40 GMT sutt $ - - -#ifndef __EFFICIENCY2D_H -#define __EFFICIENCY2D_H - -#include <stdio.h> - -#include <iostream> -#include <string> -#include <vector> -#include <cmath> - -#include "TH2F.h" - -#include "TrigInDetAnalysis/TIDDirectory.h" - - - -class Efficiency2D { - -public: - - Efficiency2D(TH2F* h, const std::string& n="") : - m_name(n), - m_xlimits(h->GetNbinsX()+1), - m_ylimits(h->GetNbinsY()+1) - { - m_hnumer = (TH2F*)h->Clone( "num" ); - m_hdenom = (TH2F*)h->Clone( "denom" ); - m_hmissed = (TH2F*)h->Clone( "missed" ); - m_heff = (TH2F*)h->Clone( "efficiency" ); - - m_hnumer->SetDirectory(0); - m_hdenom->SetDirectory(0); - m_hmissed->SetDirectory(0); - m_heff->SetDirectory(0); - - m_hnumer->Reset(); - m_hdenom->Reset(); - m_heff->Reset(); - m_hmissed->Reset(); - - /// root is absolutely, evil and rene brun is s**m. why - /// isn't there an easy way to get the bin limits in a TH2 ? - /// maybe there is, but it is obscure, so I extract them - /// myself and store them - what a complete waste of time. - - TH1F* hy = (TH1F*)m_heff->ProjectionY("y",1,1,""); - hy->SetDirectory(0); - for ( int i=0 ; i<=hy->GetNbinsX() ; i++ ) { - m_ylimits[i] = hy->GetBinLowEdge(i+1); - // std::cout << "y " << i << " " << m_ylimits[i] << std::endl; - } - - TH1F* hx = (TH1F*)m_heff->ProjectionX("x",1,1,""); - hx->SetDirectory(0); - for ( int i=0 ; i<=hx->GetNbinsX() ; i++ ) { - m_xlimits[i] = hx->GetBinLowEdge(i+1); - // std::cout << "x " << i << " " << m_xlimits[i] << std::endl; - } - - delete hx; - delete hy; - - } - - ~Efficiency2D() { - delete m_heff; - delete m_hdenom; - delete m_hnumer; - delete m_hmissed; - } - - const std::string& Name() const { return m_name; } - - void Fill( double x, double y, double w=1 ) { - m_hnumer->Fill(float(x),float(y),float(w)); - m_hdenom->Fill(float(x),float(y),float(w)); - } - - void FillDenom( double x, double y, float w=1 ) { - m_hdenom->Fill(float(x),float(y),float(w)); - m_hmissed->Fill(float(x),float(y),float(w)); - } - - - void finalise() { - m_heff->Reset(); - for ( int i=1 ; i<=m_hdenom->GetNbinsX() ; i++ ) { - for ( int j=1 ; j<=m_hdenom->GetNbinsY() ; j++ ) { - double n = m_hnumer->GetBinContent(i,j); - double d = m_hdenom->GetBinContent(i,j); - - double e = 0; - double ee = 0; - if ( d!=0 ) { - e = n/d; - ee = e*(1-e)/d; - } - - // need proper error calculation... - m_heff->SetBinContent( i, j, 100*e ); - m_heff->SetBinError( i, j, 100*std::sqrt(ee) ); - } - } - } - - - void Write(const std::string n="", const std::string& xy="xy") { - /// use the object name, but override with argument - /// if given - std::string name = m_name; - if ( n!="" ) name = n; - if ( name!="" ) { - - // TDirectory* _cwd = gDirectory; - - // std::cout << "eff dif " << gDirectory->GetName() << "/" ; - - TIDDirectory dir(name); - dir.push(); - - // std::cout << gDirectory->GetName() << std::endl; - - m_heff->Write(); - m_hnumer->Write(); - m_hdenom->Write(); - m_hmissed->Write(); - - TIDDirectory slices("slices"); - slices.push(); - - if ( xy.find("x")!=std::string::npos ) { - for ( int i=1 ; i<=m_heff->GetNbinsX() ; i++ ) /* TH1F* h = */ SliceX(i); - for ( int i=1 ; i<=m_heff->GetNbinsX() ; i++ ) /* TH1F* h = */ DenomSliceX(i); - - } - - if ( xy.find("y")!=std::string::npos ) { - for ( int i=1 ; i<=m_heff->GetNbinsY() ; i++ ) /* TH1F* h = */ SliceY(i); - for ( int i=1 ; i<=m_heff->GetNbinsY() ; i++ ) /* TH1F* h = */ DenomSliceY(i); - } - - slices.pop(); - - dir.pop(); - - // _cwd->cd(); - } - - } - - TH2F* Hist() { return m_heff; } - - TH1F* SliceX(int i, const std::string& ="") { - TH1F* h = 0; - std::string _s = m_name; - char _n[64]; - if ( i>0 && i<=m_heff->GetNbinsX() ) { - sprintf(_n,"_X%03d", i); - // h = (TH1F*)m_heff->ProjectionY( (_s+_n).c_str(), i, i, "e"); - h = (TH1F*)m_heff->ProjectionY( _n, i, i, "e"); - sprintf(_n, "[ %6f - %6f ]", m_xlimits[i-1], m_xlimits[i]); - h->SetTitle( _n ); - } - return h; - } - - TH1F* SliceY(int i, const std::string& ="") { - TH1F* h = 0; - std::string _s = m_name; - char _n[64]; - if ( i>0 && i<=m_heff->GetNbinsY() ) { - sprintf(_n,"_Y%03d", i); - // h = (TH1F*)m_heff->ProjectionX( (_s+_n).c_str(), i, i, "e" ); - h = (TH1F*)m_heff->ProjectionX( _n, i, i, "e" ); - sprintf(_n, "[ %6f - %6f ]", m_ylimits[i-1], m_ylimits[i]); - h->SetTitle( _n ); - } - return h; - } - - - - TH1F* DenomSliceX(int i, const std::string& ="") { - TH1F* h = 0; - std::string _s = m_name; - char _n[64]; - if ( i>0 && i<=m_hdenom->GetNbinsX() ) { - sprintf(_n,"_DX%03d", i); - h = (TH1F*)m_hdenom->ProjectionY( _n, i, i, "e" ); - sprintf(_n, "[ %6f - %6f ]", m_xlimits[i-1], m_xlimits[i]); - h->SetTitle( _n ); - } - return h; - } - - - - TH1F* DenomSliceY(int i, const std::string& ="") { - TH1F* h = 0; - std::string _s = m_name; - char _n[64]; - if ( i>0 && i<=m_hdenom->GetNbinsY() ) { - sprintf(_n,"_DY%03d", i); - // h = (TH1F*)m_heff->ProjectionX( (_s+_n).c_str(), i, i, "e" ); - h = (TH1F*)m_hdenom->ProjectionX( _n, i, i, "e" ); - sprintf(_n, "[ %6f - %6f ]", m_ylimits[i-1], m_ylimits[i]); - h->SetTitle( _n ); - } - return h; - } - - - int GetNbinsX() const { return m_heff->GetNbinsX(); } - int GetNbinsY() const { return m_heff->GetNbinsY(); } - - - -private: - - std::string m_name; - - TH2F* m_hnumer; - TH2F* m_hdenom; - - TH2F* m_hmissed; - - TH2F* m_heff; - - std::vector<float> m_xlimits; - std::vector<float> m_ylimits; - -}; - - - -inline std::ostream& operator<<( std::ostream& s, const Efficiency2D& _e ) { - return s << _e.Name(); -} - - -#endif // __EFFICIENCY2D_H - - - - - - - - - - diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h b/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h index 48f284afdc3b..72abbdc279c2 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h @@ -167,6 +167,8 @@ inline std::ostream& operator<<( std::ostream& s, const TIDA::Track& t) { // << "\thpb=" << hextobin(t.hitPattern(),20) << "\tchi2=" << t.chi2() << "/" << t.dof() << "\talgo=" << t.author() + << "\tbl=" << t.bLayerHits() + << ":" << ( t.expectBL() ? "t" : "f" ) << "\tid=0x" << std::hex << t.id() << std::dec << "\t] "; } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysis/src/TIDAEvent.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysis/src/TIDAEvent.cxx index ffd0fac9683d..6dd2458885b9 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysis/src/TIDAEvent.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysis/src/TIDAEvent.cxx @@ -34,9 +34,8 @@ std::vector<std::string> TIDA::Event::chainnames() const { void TIDA::Event::erase( const std::string& name ) { /// WHY DOES erase() NOT WORK ON THESE std::vector<TIDA::Chain> Almost certainly - /// because we are using actual TObjects, and they are a pile of shite !!! - /// so instead we need to copy all the chains, and then copy them back *if* - /// we don;t want to delete it THIS IS SOOO STUPID! + /// because we are using actual TObjects so instead we need to copy all the chains, + /// and then copy them back *if* we don't want to delete it.! std::vector<TIDA::Chain> _chains = m_chains; m_chains.clear(); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx index 5ef95649117e..eaed3f0e5a7c 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfig_Ntuple.cxx @@ -1363,14 +1363,9 @@ void AnalysisConfig_Ntuple::loop() { else if ( selectTracks<TrackCollection>( &selectorTest, comb, collectionName) ); else if ( selectTracks<TrigInDetTrackCollection>( &selectorTest, comb, truthMap, collectionName, collectionName_index ) ); #ifdef XAODTRACKING_TRACKPARTICLE_H - else { - // m_provider->msg(MSG::INFO) << "\tsearch for xAOD::TrackParticle " << collectionName << endmsg; - if ( selectTracks<xAOD::TrackParticleContainer>( &selectorTest, comb, collectionName ) ); //m_provider->msg(MSG::INFO) << "\tFound xAOD collection " << collectionName << " (Ntple)" << endmsg; - else m_provider->msg(MSG::WARNING) << "\tNo track collection " << collectionName << " found" << endmsg; - } -#else - else m_provider->msg(MSG::WARNING) << "\tNo track collection " << collectionName << " found" << endmsg; + else if ( selectTracks<xAOD::TrackParticleContainer>( &selectorTest, comb, collectionName ) ); #endif + else m_provider->msg(MSG::WARNING) << "\tNo track collection " << collectionName << " found" << endmsg; } else { //L2 track EDM @@ -1396,7 +1391,7 @@ void AnalysisConfig_Ntuple::loop() { /// what is this doing? Why is it just fetching but not assigning to anything ????? who write this? - m_provider->msg(MSG::INFO) << "\tNo VxContainer for chain " << chainName << " for key " << vtx_name << endmsg; + m_provider->msg(MSG::INFO) << "\tFetch VxContainer for chain " << chainName << " for key " << vtx_name << endmsg; std::vector< Trig::Feature<VxContainer> > trigvertices = comb->get<VxContainer>(vtx_name); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx index 13b2a82dd2ef..d39ecea38708 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx @@ -225,6 +225,7 @@ void ConfAnalysis::initialiseInternal() { mres.push_back( rnpixh_pt = new Resplot( "npixh_pt", ptnbins, ptbinlims, 22, -0.5, 21.5 ) ); mres.push_back( rnscth_pt = new Resplot( "nscth_pt", ptnbins, ptbinlims, 22, -0.5, 21.5 ) ); + mres.push_back( rnpix_pt_bad = new Resplot( "npix_pt_bad", ptnbins, ptbinlims, 22, -0.5, 21.5 ) ); mres.push_back( rnsct_pt_bad = new Resplot( "nsct_pt_bad", ptnbins, ptbinlims, 22, -0.5, 21.5 ) ); mres.push_back( rntrt_pt_bad = new Resplot( "ntrt_pt_bad", ptnbins, ptbinlims, 100, -0.5, 99.5 ) ); @@ -255,6 +256,38 @@ void ConfAnalysis::initialiseInternal() { mres.push_back( rChi2_bad = new Resplot( "Chi2_bad", ptnbins, ptbinlims, 200, 0, 100 ) ); mres.push_back( rChi2dof_bad = new Resplot( "Chi2dof_bad", ptnbins, ptbinlims, 100, 0, 10 ) ); + /// additional resplots for additional si hit and hold monitoring + + double d0bins[40] = { -5.0, -4.0, -3.0, -2.5, + -2.0, -1.8, -1.6, -1.4, -1.2, + -1.05, -0.95, -0.85, -0.75, -0.65, -0.55, -0.45, -0.35, -0.25, -0.15, -0.05, + 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05, + 1.2, 1.4, 1.6, 1.8, 2.0, + 2.5, 3.0, 4.0, 5.0 }; + + + + mres.push_back( rnpix_d0 = new Resplot( "npix_d0", 39, d0bins, 22, -0.5, 21.5 ) ); + mres.push_back( rnsct_d0 = new Resplot( "nsct_d0", 39, d0bins, 22, -0.5, 21.5 ) ); + mres.push_back( rntrt_d0 = new Resplot( "ntrt_d0", 39, d0bins, 22, -0.5, 21.5 ) ); + + mres.push_back( rnpixh_d0 = new Resplot( "npixh_d0", 39, d0bins, 22, -0.5, 21.5 ) ); + mres.push_back( rnscth_d0 = new Resplot( "nscth_d0", 39, d0bins, 22, -0.5, 21.5 ) ); + + mres.push_back( rnsi_pt = new Resplot( "nsi_pt", ptnbins, ptbinlims, 22, -0.5, 21.5 ) ); + mres.push_back( rnsih_pt = new Resplot( "nsih_pt", ptnbins, ptbinlims, 22, -0.5, 21.5 ) ); + + mres.push_back( rnsi_d0 = new Resplot( "nsi_d0", 39, d0bins, 22, -0.5, 21.5 ) ); + mres.push_back( rnsih_d0 = new Resplot( "nsih_d0", 39, d0bins, 22, -0.5, 21.5 ) ); + + mres.push_back( rnsi_eta = new Resplot( "nsi_eta", etaBins, -tmp_maxEta, tmp_maxEta, 22, -0.5, 21.5 ) ); + mres.push_back( rnsih_eta = new Resplot( "nsih_eta", etaBins, -tmp_maxEta, tmp_maxEta, 22, -0.5, 21.5 ) ); + + mres.push_back( rnbl_d0 = new Resplot( "nbl_d0", 39, d0bins, 5, -0.5, 4.5 ) ); + mres.push_back( rnblh_d0 = new Resplot( "nblh_d0", 39, d0bins, 5, -0.5, 4.5 ) ); + + + // int Nptbins = 7; // double _ptlims[8] = { 0, 500, 1000, 1500, 2000, 5000, 8000, 12000 }; @@ -462,23 +495,23 @@ void ConfAnalysis::initialiseInternal() { rd0res.push_back( new Resplot("rd0_vs_ipt", iptnbins, iptbinlims, factor*8*a0resBins, -wfactor*a0resMax, wfactor*a0resMax ) ); - retares.push_back( new Resplot("reta_vs_pt", ptnbins, ptbinlims, 2*etaResBins, -wfactor*tmp_absResEta, wfactor*tmp_absResEta ) ); + retares.push_back( new Resplot("reta_vs_pt", ptnbins, ptbinlims, 8*etaResBins, -wfactor*tmp_absResEta, wfactor*tmp_absResEta ) ); rphires.push_back( new Resplot("rphi_vs_pt", ptnbins, ptbinlims, 8*phiResBins, -wfactor*tmp_absResPhi, wfactor*tmp_absResPhi ) ); - rzedres.push_back( new Resplot("rzed_vs_pt", ptnbins, ptbinlims, 8*zfactor*zresBins, -2*zfactor*zresMax, 2*zfactor*zresMax ) ); + rzedres.push_back( new Resplot("rzed_vs_pt", ptnbins, ptbinlims, 24*zfactor*zresBins, -2*zfactor*zresMax, 2*zfactor*zresMax ) ); //rzedres.push_back( new Resplot("rzed_vs_pt", ptnbins, ptbinlims, 4*zfactor*zresBins, -2*zwidthfactor*zresMax, 2*zwidthfactor*zresMax ) ); riptres.push_back( new Resplot("ript_vs_pt", ptnbins, ptbinlims, 16*pTResBins, -wfactor*tmp_absResPt, wfactor*tmp_absResPt ) ); rptres.push_back( new Resplot("rpt_vs_pt", ptnbins, ptbinlims, 8*pTResBins, -wfactor*tmp_absResPt, wfactor*tmp_absResPt ) ); - rd0res.push_back( new Resplot("rd0_vs_pt", ptnbins, ptbinlims, factor*8*a0resBins, -wfactor*a0resMax, wfactor*a0resMax ) ); + rd0res.push_back( new Resplot("rd0_vs_pt", ptnbins, ptbinlims, factor*24*a0resBins, -wfactor*a0resMax, wfactor*a0resMax ) ); // retares.push_back( new Resplot("reta_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 4*etaResBins, -tmp_absResEta, tmp_absResEta ) ); retares.push_back( new Resplot("reta_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 4*etaResBins, -wfactor*tmp_absResEta, wfactor*tmp_absResEta ) ); rphires.push_back( new Resplot("rphi_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 8*phiResBins, -wfactor*tmp_absResPhi, wfactor*tmp_absResPhi ) ); - rzedres.push_back( new Resplot("rzed_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 4*zfactor*zresBins, -2*zfactor*zresMax, 2*zfactor*zresMax ) ); + rzedres.push_back( new Resplot("rzed_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 12*zfactor*zresBins, -2*zfactor*zresMax, 2*zfactor*zresMax ) ); //rzedres.push_back( new Resplot("rzed_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 4*zfactor*zresBins, -2*zwidthfactor*zresMax, 2*zwidthfactor*zresMax ) ); riptres.push_back( new Resplot("ript_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 16*pTResBins, -tmp_absResPt, tmp_absResPt ) ); rptres.push_back( new Resplot("rpt_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, 8*pTResBins, -tmp_absResPt, tmp_absResPt ) ); - rd0res.push_back( new Resplot("rd0_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, factor*8*a0resBins, -wfactor*a0resMax, wfactor*a0resMax ) ); + rd0res.push_back( new Resplot("rd0_vs_eta", etaBins, -tmp_maxEta, tmp_maxEta, factor*24*a0resBins, -wfactor*a0resMax, wfactor*a0resMax ) ); // rphivsDd0res = new Resplot( "rphi_vs_Dd0", 10, 0, 0.1, int(2*M_PI/0.02), -0.2*int(M_PI/0.02), 0.2*int(M_PI/0.02) ); @@ -905,8 +938,11 @@ void ConfAnalysis::finalise() { std::cout << "ConfAnalysis::finalise() " << name() << std::endl; + std::string spstr[5] = { "npix", "nsct", "nsi", "ntrt", "nbl" }; for ( int i=mres.size() ; i-- ; ) { - mres[i]->Finalise(Resplot::FitNull95); + TF1* (*resfit)(TH1D* s, double a, double b) = Resplot::FitNull95; + for ( int ir=0 ; ir<5 ; ir++ ) if ( mres[i]->Name().find(spstr[ir])!=std::string::npos ) { resfit = Resplot::FitNull; break; } + mres[i]->Finalise( resfit ); mres[i]->Write(); } @@ -1237,10 +1273,14 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, double nsctt = reftracks[i]->sctHits(); double npixt = reftracks[i]->pixelHits(); - double nsit = reftracks[i]->pixelHits() * 0.5 + reftracks[i]->sctHits(); + double nsit = reftracks[i]->pixelHits() * 0.5 + reftracks[i]->sctHits(); double nsctht = reftracks[i]->sctHoles(); double npixht = reftracks[i]->pixelHoles(); + double nsiht = reftracks[i]->pixelHoles() + reftracks[i]->sctHoles(); + + double nbl = reftracks[i]->bLayerHits(); + double nblh = ( ( reftracks[i]->expectBL() && reftracks[i]->bLayerHits()<1 ) ? 1 : 0 ); // double ntrtt = reftracks[i]->trHits(); double nstrawt = reftracks[i]->strawHits(); @@ -1285,6 +1325,27 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, rnpix_pt->Fill( std::fabs(pTt), npixt*0.5 ); rnsct_pt->Fill( std::fabs(pTt), nsctt*1.0 ); rntrt_pt->Fill( std::fabs(pTt), nstrawt*1.0 ); + + + rnpix_d0->Fill( a0t, npixt*0.5 ); + rnsct_d0->Fill( a0t, nsctt*1.0 ); + rntrt_d0->Fill( a0t, nstrawt*1.0 ); + + rnpixh_d0->Fill( a0t, npixht ); + rnscth_d0->Fill( a0t, nsctht ); + + rnsi_pt->Fill( std::fabs(pTt), nsit ); + rnsih_pt->Fill( std::fabs(pTt), nsiht ); + + rnsi_d0->Fill( a0t, nsit ); + rnsih_d0->Fill( a0t, nsiht ); + + rnsi_eta->Fill( etat, nsit ); + rnsih_eta->Fill(etat, nsiht ); + + rnbl_d0->Fill( a0t, nbl ); + rnblh_d0->Fill( a0t, nblh ); + rnpixh_pt->Fill( std::fabs(pTt), npixht ); rnscth_pt->Fill( std::fabs(pTt), nsctht ); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.h index d8eb7c38f6e5..58a58efb9dba 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.h @@ -200,9 +200,27 @@ private: Resplot* rnsct_pt; Resplot* rntrt_pt; + Resplot* rnpix_d0; // new + Resplot* rnsct_d0; // new + Resplot* rntrt_d0; // new + Resplot* rnpixh_pt; Resplot* rnscth_pt; + Resplot* rnpixh_d0; // new + Resplot* rnscth_d0; // new + + Resplot* rnsi_pt; // new + Resplot* rnsih_pt; // new + + Resplot* rnsi_eta; // new + Resplot* rnsih_eta; // new + + Resplot* rnsi_d0; // new + Resplot* rnsih_d0; // new + + Resplot* rnbl_d0; // new + Resplot* rnblh_d0; // new Resplot* rnpix_pt_bad; Resplot* rnsct_pt_bad; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/Makefile b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/Makefile index 626e879cb02a..ca96affb7056 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/Makefile +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/Makefile @@ -364,7 +364,7 @@ $(INSTALLDIR)/TIDA% : $(EXEDIR)/% INSTALLFILES=comparitor chains cpucost runtool sb rdict reader -ginstall : install $(INSTALLDIR)/TIDA$(patsubst %,%,$(INSTALLFILES)) +ginstall : install $(patsubst %,$(INSTALLDIR)/TIDA%,$(INSTALLFILES)) install : all cp $(EXEDIR)/comparitor $(HOME)/bin diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.cxx index 5933cf488996..f17ad761c75c 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.cxx @@ -100,20 +100,20 @@ void PurityAnalysis::initialise() { std::cout << "PurityAnalysis::initialize() Directory " << gDirectory->GetName() << " package directory, " << name() << std::endl; - int Nptbins = 6; - double _ptlims[7] = { 0, 500, 1000, 1500, 2000, 5000, 10000 }; + // int Nptbins = 6; + // double _ptlims[7] = { 0, 500, 1000, 1500, 2000, 5000, 10000 }; - TH2F* effpt2d = new TH2F("pteta2d", "pteta", Nptbins, _ptlims, 40, -tmp_maxEta, tmp_maxEta ); - TH2F* effeta2d = new TH2F("etapt2d", "pteta", ptnbins, ptbinlims, 6, -tmp_maxEta, tmp_maxEta ); + // TH2F* effpt2d = new TH2F("pteta2d", "pteta", Nptbins, _ptlims, 40, -tmp_maxEta, tmp_maxEta ); + // TH2F* effeta2d = new TH2F("etapt2d", "pteta", ptnbins, ptbinlims, 6, -tmp_maxEta, tmp_maxEta ); - eff_pteta = new Efficiency2D( effpt2d, "pteta" ); - eff_etapt = new Efficiency2D( effeta2d, "etapt" ); + // eff_pteta = new Efficiency2D( effpt2d, "pteta" ); + // eff_etapt = new Efficiency2D( effeta2d, "etapt" ); - effpt2d->SetDirectory(0); - effeta2d->SetDirectory(0); + // effpt2d->SetDirectory(0); + // effeta2d->SetDirectory(0); - delete effpt2d; - delete effeta2d; + // delete effpt2d; + // delete effeta2d; Efficiency* heff[8]; Efficiency* hpurity[6]; @@ -251,12 +251,12 @@ void PurityAnalysis::finalise() { // std::cout << "DBG >" << purity_pt->Hist()->GetName() << "< DBG" << std::endl; - eff_pteta->finalise(); eff_pteta->Write("eta_efficiency_binned_pt", "x"); + // eff_pteta->finalise(); eff_pteta->Write("eta_efficiency_binned_pt", "x"); // for ( int i=1 ; i<=eff_pteta->GetNbinsX() ; i++ ) { // TH1F* h = eff_pteta->SliceX(i); // } - eff_etapt->finalise(); eff_etapt->Write("pt_efficieny_binned_eta", "y"); + // eff_etapt->finalise(); eff_etapt->Write("pt_efficieny_binned_eta", "y"); // for ( int i=1 ; i<=eff_etapt->GetNbinsY() ; i++ ) { // TH1F* h = eff_etapt->SliceY(i); // } @@ -429,8 +429,8 @@ void PurityAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, // in this loop over the reference tracks, could fill efficiency // histograms - eff_pteta->Fill( pTt, etat ); - eff_etapt->Fill( pTt, etat ); + // eff_pteta->Fill( pTt, etat ); + // eff_etapt->Fill( pTt, etat ); /// matched track distributions @@ -483,8 +483,8 @@ void PurityAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, #endif - eff_pteta->FillDenom( pTt, etat ); - eff_etapt->FillDenom( pTt, etat ); + // eff_pteta->FillDenom( pTt, etat ); + // eff_etapt->FillDenom( pTt, etat ); } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.h index 202217d37add..a9d007d9a6f0 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/PurityAnalysis.h @@ -20,7 +20,7 @@ #include "TrigInDetAnalysis/Track.h" #include "TrigInDetAnalysis/TIDDirectory.h" #include "TrigInDetAnalysis/Efficiency.h" -#include "TrigInDetAnalysis/Efficiency2D.h" +// #include "TrigInDetAnalysis/Efficiency2D.h" #include "Resplot.h" @@ -107,8 +107,8 @@ private: Efficiency* purity_d0; Efficiency* purity_a0; - Efficiency2D* eff_pteta; - Efficiency2D* eff_etapt; + // Efficiency2D* eff_pteta; + // Efficiency2D* eff_etapt; TH1F* hDeltaR; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx index e9b07b75f1e2..d3b5d218f8f6 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx @@ -602,19 +602,17 @@ int main(int argc, char** argv) { std::string rawrun = refrun.erase( refrun.find("run"), 4 ); - // if ( frefname!=ftestname && contains(frefname, rawrun) ) { if ( contains(frefname, rawrun) ) { std::string release = frefname; release.erase( 0, release.find(rawrun) ); - // release.erase( release.find(rawrun)+1, release.find("HIST")+5); - - if ( contains(release,"HIST") ) release.erase( 0, release.find("HIST")+5 ); - if ( contains(release,"-") ) release.erase( release.find("-"), release.size() ); - if ( contains(release,"_") ) release.erase( release.find("_"), release.size() ); - if ( contains(release,".") ) release.erase( release.find("."), release.size() ); + if ( contains(release,"HIST") ) release.erase( 0, release.find("HIST")+5 ); + while ( contains(release,".") ) release.erase( release.find("."), release.size() ); + while ( contains(release,"-") ) release.erase( release.find("-"), release.size() ); + while ( contains(release,"_p") ) release.erase( release.find("_p"), release.size() ); + while ( contains(release,"_t") ) release.erase( release.find("_t"), release.size() ); newtag += " "; newtag += release; @@ -1214,11 +1212,11 @@ int main(int argc, char** argv) { // if ( contains(histos[i],"npix") || contains(histos[i],"nsct") ) rtest.Finalise(Resplot::FitNull); // else rtest.Finalise(Resplot::FitNull95); if ( rtest.finalised() ) { - if ( contains(histos[i],"npix") || contains(histos[i],"nsct") ) rtest.Refit(Resplot::FitNull); + if ( contains(histos[i],"npix") || contains(histos[i],"nsct") || contains(histos[i],"nsi") || contains(histos[i],"nbl") ) rtest.Refit(Resplot::FitNull); else rtest.Refit(Resplot::FitNull95); } else { - if ( contains(histos[i],"npix") || contains(histos[i],"nsct") ) rtest.Finalise(Resplot::FitNull); + if ( contains(histos[i],"npix") || contains(histos[i],"nsct") || contains(histos[i],"nsi") || contains(histos[i],"nbl") ) rtest.Finalise(Resplot::FitNull); else rtest.Finalise(Resplot::FitNull95); } @@ -1309,6 +1307,22 @@ int main(int argc, char** argv) { continue; } + + + if ( std::string(htest->ClassName()).find("TH2")!=std::string::npos ) { + std::cout << "Class TH2: " << htest->GetName() << std::endl; + continue; + } + + if ( std::string(htest->ClassName()).find("TH1")!=std::string::npos ) { + std::cout << "Class TH1: " << htest->GetName() << std::endl; + } + else if ( std::string(htest->ClassName()).find("TProfile")!=std::string::npos ) { + std::cout << "Class TProf: " << htest->GetName() << std::endl; + } + + + if ( !noreftmp && hreft==0 ) { if ( hreft==0 ) std::cerr << "missing histogram: " << (refchain+"/"+reghist) << " " << hreft << std::endl; noreftmp = true; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/cpucost.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/cpucost.cxx index 825cab802128..471a0a3df664 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/cpucost.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/cpucost.cxx @@ -422,7 +422,7 @@ int main(int argc, char** argv) { tdir->cd(); -#ifdef RENE_IS_PROBABLY_AN_ARSE +#ifdef USE_SLOW_ROOT_FILE_DELETION std::cout << "deleting ftest" << std::endl; @@ -440,10 +440,6 @@ int main(int argc, char** argv) { // delete testtimers; delete ftest; - //#else - - // std::cout << "rene brun is an arse" << std::endl; - #endif std::cout << "done" << std::endl; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/fastadd.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/fastadd.cxx index 3a100b3e1c93..08d8355b7c4f 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/fastadd.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/fastadd.cxx @@ -20,6 +20,7 @@ #include "TKey.h" #include "TH1D.h" #include "TH2D.h" +#include "TProfile.h" #include "TFile.h" #include "TClass.h" @@ -183,8 +184,9 @@ void search(TDirectory* td=0, const std::string& s="") { // if ( std::string(tobj->GetClassName()).find("TH1")!=std::string::npos ) status = add<TH1>( objname.c_str(), tobj ); // if ( std::string(tobj->GetClassName()).find("TH2")!=std::string::npos ) status = add<TH2>( objname.c_str(), tobj ); - if ( std::string(tobj->GetClassName()).find("TH1")!=std::string::npos ) add<TH1>( objname.c_str(), tobj ); - if ( std::string(tobj->GetClassName()).find("TH2")!=std::string::npos ) add<TH2>( objname.c_str(), tobj ); + if ( std::string(tobj->GetClassName()).find("TH1")!=std::string::npos ) add<TH1>( objname.c_str(), tobj ); + if ( std::string(tobj->GetClassName()).find("TH2")!=std::string::npos ) add<TH2>( objname.c_str(), tobj ); + if ( std::string(tobj->GetClassName()).find("TProfile")!=std::string::npos ) add<TProfile>( objname.c_str(), tobj ); // if ( !status ) std::cerr << "bad status" << std::endl; } @@ -338,8 +340,7 @@ int main(int argc, char** argv) { for ( int i=1 ; i<argc ; i++ ) { if ( std::string(argv[i])=="--verbose" ) verbose = true; else if ( std::string(argv[i])=="-o" ) { - ++i; - if ( i<argc ) output_file = argv[i]; + if ( ++i<argc ) output_file = argv[i]; else return usage( std::cerr, argc, argv ); } else { @@ -359,7 +360,7 @@ int main(int argc, char** argv) { if ( files.size()<1 ) return usage( std::cerr, argc, argv ); - + for ( size_t i=files.size() ; i-- ; ) if ( files[i]==output_file ) return usage( std::cerr, argc, argv ); // time the actual running of the cost() routine diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/listroot.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/listroot.cxx index 080059199277..7066c68bd516 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/listroot.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/listroot.cxx @@ -224,7 +224,7 @@ protected: bool accept = true; - // std::cout << "FUCK " << _dir->GetName() << "\tdepth " << depth << " " << __depth << "\tsize " << directories.size() << " " << directories << std::endl; + // std::cout << "GOLLY! " << _dir->GetName() << "\tdepth " << depth << " " << __depth << "\tsize " << directories.size() << " " << directories << std::endl; if ( directories.size()>size_t(0) ) { @@ -553,7 +553,7 @@ int main(int argc, char** argv) { std::cout << "closing" << std::endl; - std::cout << "root is fucking shite, why is it taking so long to close this file?" << std::endl; + // std::cout << "root is extremely annoying, why is it taking so long to close this file?" << std::endl; // f->Close(); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/reader.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/reader.cxx index 69c68c6fc5fc..ad4eb76d330b 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/reader.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/reader.cxx @@ -67,12 +67,13 @@ int main(int argc, char** argv) { for ( unsigned i=0 ; i<files.size() ; i++ ) { TFile* _finput = TFile::Open( files[i].c_str() ); - TFile& finput = *_finput; - if (!finput.IsOpen()) { + if ( _finput==0 || !_finput->IsOpen() || _finput->IsZombie() ) { std::cerr << "Error: could not open output file" << std::endl; exit(-1); } + + TFile& finput = *_finput; if ( show_release || quit_after_release ) { TTree* dataTree = (TTree*)finput.Get("dataTree"); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx index 01fee6a350d6..2c130ba4168f 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx @@ -40,7 +40,6 @@ #include "ConfVtxAnalysis.h" - #include "lumiList.h" #include "lumiParser.h" #include "dataset.h" @@ -166,19 +165,45 @@ TIDARoiDescriptor makeCustomRefRoi( const TIDARoiDescriptor& roi, // Small function to be used in sorting tracks in track vectors bool trackPtGrtr( TIDA::Track* trackA, TIDA::Track* trackB) { return ( std::fabs(trackA->pT()) > std::fabs(trackB->pT()) ); } -template<class T> -std::ostream& operator<<(std::ostream& s, const std::vector<T>& v ) { - if ( v.size()<5 ) for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\t" << v[i]; - else for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\n\t" << v[i]; + +template<typename T> +std::ostream& operator<<( std::ostream& s, const std::vector<T*>& v ) { + for ( size_t i=0 ; i<v.size() ; i++ ) s << "\t" << *v[i] << "\n"; return s; } -template<class T> -std::ostream& operator<<(std::ostream& s, const std::vector<T*>& v ) { - for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\t" << *v[i] << std::endl; + +template<typename T> +std::ostream& operator<<(std::ostream& s, const std::vector<T>& v ) { + if ( v.size()<5 ) for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\t" << v[i]; + else for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\n\t" << v[i]; return s; } + +const std::vector<TIDA::Track> replaceauthor( const std::vector<TIDA::Track>& tv, int a0=5, int a1=4 ) { + + if ( a0==a1 ) return tv; + + std::vector<TIDA::Track> tr; + tr.reserve(tv.size()); + + for ( size_t i=0 ; i<tv.size() ; i++ ) { + const TIDA::Track& t = tv[i]; + int a = t.author(); + if ( a==a0 ) a=a1; + tr.push_back( TIDA::Track( t.eta(), t.phi(), t.z0(), t.a0(), t.pT(), t.chi2(), t.dof(), + t.deta(), t.dphi(), t.dz0(), t.da0(), t.dpT(), + t.bLayerHits(), t.pixelHits(), t.sctHits(), t.siHits(), + t.strawHits(), t.trHits(), + t.hitPattern(), t.multiPattern(), a, t.hasTruth(), + t.barcode(), t.match_barcode(), t.expectBL(), t.id() ) ); + + } + + return tr; + +} @@ -395,7 +420,7 @@ int main(int argc, char** argv) double pT = 1000; double eta = 2.5; - double zed = 200; + double zed = 2000; int npix = 1; int nsct = 6; @@ -403,6 +428,8 @@ int main(int argc, char** argv) int nsiholes = 2; + bool expectBL = false; + double chi2prob = 0; //int npix_rec = 1; // JK removed (unused) @@ -452,6 +479,7 @@ int main(int argc, char** argv) if ( inputdata.isTagDefined("zed") ) zed = inputdata.GetValue("zed"); if ( inputdata.isTagDefined("npix") ) npix = inputdata.GetValue("npix"); if ( inputdata.isTagDefined("nsiholes") ) nsiholes = inputdata.GetValue("nsiholes"); + if ( inputdata.isTagDefined("expectBL") ) expectBL = ( inputdata.GetValue("expectBL") > 0.5 ? true : false ); if ( inputdata.isTagDefined("nsct") ) nsct = inputdata.GetValue("nsct"); if ( inputdata.isTagDefined("nbl") ) nbl = inputdata.GetValue("nbl"); if ( inputdata.isTagDefined("chi2prob") ) chi2prob = inputdata.GetValue("chi2prob"); @@ -577,7 +605,8 @@ int main(int argc, char** argv) if ( inputdata.isTagDefined("GRL") ) { /// read the (xml?) GRL - goodrunslist.read( inputdata.GetString("GRL") ); + std::cout << "Reading GRL from: " << inputdata.GetString("GRL") << std::endl; + goodrunslist.read( inputdata.GetString("GRL") ); // std::cout << goodrunslist << std::endl; } else if ( inputdata.isTagDefined("LumiBlocks") ) { @@ -775,21 +804,19 @@ int main(int argc, char** argv) // int minPixelHits, int minSctHits, int minSiHits, int minBlayerHits, // int minStrawHits, int minTrHits, double prob=0 ) : - Filter_Track filter_kine( eta, 1000, zed, pT, -1, -1, -1, -1, -2, -2); - /// filters for true selection for efficiency Filter_Vertex filter_vertex(a0v, z0v); - Filter_Track filter_offline( eta, 1000, 2000, pT, npix, nsct, -1, nbl, -2, -2, chi2prob, 20, 20, nsiholes ); /// include chi2 probability cut + Filter_Track filter_offline( eta, 1000, zed, pT, + npix, nsct, -1, nbl, + -2, -2, chi2prob, + 20, 20, nsiholes, expectBL ); /// include chi2 probability cut + if ( selectcharge!=0 ) filter_offline.chargeSelection( selectcharge ); if ( pTMax>pT ) filter_offline.maxpT( pTMax ); Filter_etaPT filter_etaPT(eta,pT); - // Filter_True filter_passthrough; - // use an actual filter requiring at least 1 silicon hit - // to get rid of the EF trt only tracks - Filter_Track filter_passthrough( 10, 1000, 2000, 0, -2, -2, 1, -2, -2, -2); // std::cout << "pdgId " << pdgId << std::endl; @@ -798,8 +825,8 @@ int main(int argc, char** argv) // select inside-out offline tracking - //Filter_TruthParticle filter_passthrough(&filter_offline); - Filter_Track filter_track( eta, 1000, 2000, pT, npix, nsct, -1, -1, -2, -2); + // Filter_TruthParticle filter_passthrough(&filter_offline); + // Filter_Track filter_track( eta, 1000, 2000, pT, npix, nsct, -1, -1, -2, -2); Filter_Author filter_inout(0); @@ -807,33 +834,17 @@ int main(int argc, char** argv) Filter_Author filter_auth(author); - Filter_Combined filter_kineoff( &filter_inout, &filter_offline ); - //Filter_Combined filter_off (&filter_passthrough, &filter_vertex); Filter_TrackQuality filter_q(0.01); - //Filter_Combined filter_c(&filter_q, &filter_offline); - //Filter_Combined filter_off (&filter_c, &filter_vertex); Filter_Combined filter_off (&filter_offline, &filter_vertex); - // Filter_Combined filter_off (&filter_offline, &filter_auth); - //Filter_Combined filter_off (&filter_offline, &filter_auth); - Filter_Track filter_onlinekine( eta_rec, 1000, 2000, pT, -1, npix, nsct, -1, -2, -2); - /// filter to select all tracks without filtering - //Filter_Combined filter_off( &filter_kineoff, &filter_vertex); - //Filter_Combined filter_truth( &filter_kineoff, &filter_passthrough); - //Filter_Combined filter_truth( &filter_passthrough, &filter_kineoff); - //Filter_Combined filter_truth( &filter_passthrough, &filter_etaPT); - Filter_Combined filter_truth( &filter_pdgtruth, &filter_etaPT); - - + Filter_Combined filter_truth( &filter_pdgtruth, &filter_etaPT); Filter_Combined filter_muon( &filter_offline, &filter_vertex); - + Filter_Track filter_onlinekine( eta_rec, 1000, 2000, pT, -1, npix, nsct, -1, -2, -2); Filter_Vertex filter_onlinevertex(a0vrec, z0vrec); - //Filter_Track filter_onlinekine( eta_rec, 1000, 2000, pT, -1, npix, nsct, -1, -2, -2); Filter_Combined filter_online( &filter_onlinekine, &filter_onlinevertex ); - Filter_Track filter_offkinetight( 5, 1000, 2000, pT, -1, 0, 0, -1, -2, -2); Filter_Combined filter_offtight( &filter_offkinetight, &filter_inout ); @@ -841,14 +852,11 @@ int main(int argc, char** argv) /// track selectors so we can select multiple times with different /// filters if we want (simpler then looping over vectors each time - // NtupleTrackSelector offlineTracks(&filter_offline); - // NtupleTrackSelector refTracks(&filter_off); TrackFilter* refFilter; TrackFilter* truthFilter; if ( refChain=="Offline" ) refFilter = &filter_off; else if ( contains(refChain,"Electrons") ) refFilter = &filter_off; - // else if ( refChain=="ElectronsMedium" ) refFilter = &filter_off; - else if ( refChain=="Muons" ) refFilter = &filter_muon; + else if ( contains( refChain, "Muons" ) ) refFilter = &filter_muon; else if ( contains( refChain,"1Prong" ) ) refFilter = &filter_off; // tau ref chains else if ( contains( refChain,"3Prong" ) ) refFilter = &filter_off; // tau ref chains else if ( refChain=="Truth" && pdgId!=0 ) refFilter = &filter_truth; @@ -860,7 +868,15 @@ int main(int argc, char** argv) if (pdgId==0) truthFilter = &filter_off; else truthFilter = &filter_truth; - + + + // use an actual filter requiring at least 1 silicon hit + // to get rid of the EF trt only tracks + + std::cout << "filter_passthrough" << std::endl; + + Filter_Track filter_passthrough( 10, 1000, 2000, 0, -2, -2, 1, -2, -2, -2); + TrackFilter* testFilter = &filter_passthrough; @@ -1395,7 +1411,7 @@ int main(int argc, char** argv) if ( truthMatch ) { for (unsigned int ic=0 ; ic<chains.size() ; ic++ ) { if ( chains[ic].name()=="Truth" ) { - truthTracks.selectTracks( chains[ic].rois()[0].tracks() ); + truthTracks.selectTracks( chains[ic].rois()[0].tracks() ); break; } } @@ -1486,7 +1502,6 @@ int main(int argc, char** argv) foundReference = true; //Get tracks from within reference roi refTracks.selectTracks( chains[ic].rois()[0].tracks() ); - // std::cout << "refTracks " << refTracks.size() << " tracks from " << chains[ic].rois()[0].tracks().size() << std::endl; break; } } @@ -1636,8 +1651,8 @@ int main(int argc, char** argv) testTracks.selectTracks( troi.tracks() ); - /// trigger tracks already restricted by roi - std::vector<TIDA::Track*> testp = testTracks.tracks(); + /// trigger tracks already restricted by roi - so no roi filtering required + std::vector<TIDA::Track*> testp = testTracks.tracks(); /// here we set the roi for the filter so we can request only those tracks /// inside the roi diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx index 44b5ce3285a9..b4491f3fc3bf 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.cxx @@ -60,8 +60,8 @@ void binwidth(TH1D* h) { // set the errors on bins with zero entries to be one so they // are not ignored in the fit -// USE WITH CARE - root screws up th mean and rms error calculation -// if these are used - rene brun ... +// USE WITH CARE - root screws up the mean and rms error calculation +// if these are used void ZeroErrors(TH1D* h) { for (int i=1 ; i<=h->GetNbinsX() ; i++ ) if (h->GetBinContent(i)==0) h->SetBinError(i,1); @@ -725,8 +725,6 @@ TH2D* Resplot::combine(const TH2* h, double inveps2) { TH1D* hx = (TH1D*)h->ProjectionX("r1dx", 1, h->GetNbinsY()); hx->SetDirectory(0); - std::cout << "brun can suck my ass " << hx << std::endl; - // hy->SetDirectory(0); // hx->SetDirectory(0); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.h index 693c8a4ede58..af7486bd5b64 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Resplot/src/Resplot.h @@ -65,7 +65,7 @@ public: // try to clean up properly afterwards - LIKE WE SHOULD BE ABLE TO! // NB: NB!! Actually, now we explicitly *remove* them from root managerment // so we can do *proper* garbage collection, not like the - // shite garbage collection in root + // alleged garbage collection in root Resplot() : mSet(false), m_Nentries(NULL), @@ -580,7 +580,6 @@ private: private: // stop the root default histogram ownership nonsense - // rene brun is an idiot. void skip(TH1D* t) { if ( t ) t->SetDirectory(0); } void delskip(TH1D* t) { if ( t ) { t->SetDirectory(0); delete t; } } void deletehist(TH1D* t) { if ( t ) delete t; } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/Filter_Track.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/Filter_Track.h index 0690b023ae48..60f5913c7cf7 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/Filter_Track.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/Filter_Track.h @@ -43,14 +43,15 @@ public: Filter_Track( double etaMax, double d0Max, double z0Max, double pTMin, int minPixelHits, int minSctHits, int minSiHits, int minBlayerHits, int minStrawHits, int minTrHits, double prob=0, - int maxPixelHoles=20, int maxSctHoles=20, int maxSiHoles=20 ) : + int maxPixelHoles=20, int maxSctHoles=20, int maxSiHoles=20, bool expectBL=false ) : m_etaMax(etaMax), m_d0Max(d0Max), m_z0Max(z0Max), m_pTMin(pTMin), m_pTMax(pTMin-1), // guarantee that the default pTMax is *always* < pTMin m_minPixelHits(minPixelHits), m_minSctHits(minSctHits), m_minSiHits(minSiHits), m_minBlayerHits(minBlayerHits), m_minStrawHits(minStrawHits), m_minTrHits(minTrHits), m_maxPixelHoles(maxPixelHoles), m_maxSctHoles(maxSctHoles), m_maxSiHoles(maxSiHoles), m_prob(prob), - m_chargeSelection(0) - { } + m_chargeSelection(0), + m_expectBL(expectBL) + { } bool select(const TIDA::Track* t, const TIDARoiDescriptor* =0 ) { // Select track parameters @@ -65,6 +66,9 @@ public: if( m_prob>0 && TMath::Prob( t->chi2(), t->dof() )<m_prob ) selected = false; // track chare selection if ( m_chargeSelection!=0 && t->pT()*m_chargeSelection<=0 ) selected = false; + /// require a blayer (ibl in run2) hit only if one is expected + if ( m_expectBL && ( ( t->expectBL() || t->hasTruth() ) && t->bLayerHits()<1) ) selected = false; + return selected; } @@ -98,6 +102,8 @@ private: double m_prob; int m_chargeSelection; + + bool m_expectBL; }; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h index 8fd433692043..daa6e1b6750b 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/T_AnalysisConfig.h @@ -298,13 +298,10 @@ protected: std::vector< Trig::Feature<Collection> > trackcollections = citr->get<Collection>( key, TrigDefs::alsoDeactivateTEs ); if ( !trackcollections.empty() ) { - // NB!! a combination should never have more than one entry for a track collection from a single algorithm, - // if ( trackcollections.size()>1 ) std::cerr << "SUTT OH NO!!!!!!!!" << endmsg; + // NB!! a combination should never have more than one entry for a track collection from a single algorithm, for single object triggers for ( unsigned ifeat=0 ; ifeat<trackcollections.size() ; ifeat++ ) { - // std::cout << "selectTracks() ifeat=" << ifeat << "\tkey " << key << std::endl; Trig::Feature<Collection> trackfeature = trackcollections.at(ifeat); if ( !trackfeature.empty() ) { - // m_provider->msg(MSG::DEBUG) << "TDT TrackFeature->size() " << trackfeature.cptr()->size() << " (" << key << ")" << endmsg; // actually select the tracks from this roi at last!! const Collection* trigtracks = trackfeature.cptr(); selector->selectTracks( trigtracks ); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx index e8d75e75fcde..d59303d848cb 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx @@ -217,11 +217,11 @@ void TrigTrackSelector::selectTrack( const Rec::TrackParticle* track ) { // Create and save Track TIDA::Track* t = new TIDA::Track(eta, phi, z0, d0, pT, chi2, dof, - deta, dphi, dz0, dd0, dpT, - nBlayerHits, nPixelHits, nSctHits, nSiHits, - nStrawHits, nTrHits, bitmap, 0, - trackAuthor, - expectBL, id) ; + deta, dphi, dz0, dd0, dpT, + nBlayerHits, nPixelHits, nSctHits, nSiHits, + nStrawHits, nTrHits, bitmap, 0, + trackAuthor, false, -1, -1, + expectBL, id) ; // std::cout << "SUTT TP track " << *t << "\t0x" << std::hex << bitmap << std::dec << std::endl; @@ -493,12 +493,12 @@ TIDA::Track* TrigTrackSelector::makeTrack( const TruthParticle* track, unsigned TIDA::Track* t = new TIDA::Track(eta, phi, z0, d0, pT, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - author, false, barcode, -1, - false, - id ) ; + 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + author, false, barcode, -1, + false, + id ) ; return t; @@ -667,11 +667,11 @@ void TrigTrackSelector::selectTrack( const Trk::Track* track ) { #endif // Create and save Track TIDA::Track* t = new TIDA::Track(eta, phi, z0, d0, pT, chi2, dof, - deta, dphi, dz0, dd0, dpT, - nBlayerHits, nPixelHits, nSctHits, nSiHits, - nStrawHits, nTrHits, bitmap, 0, - trackAuthor, - expectBL, id) ; + deta, dphi, dz0, dd0, dpT, + nBlayerHits, nPixelHits, nSctHits, nSiHits, + nStrawHits, nTrHits, bitmap, 0, + trackAuthor, false, -1, -1, + expectBL, id) ; if ( !addTrack( t ) ) delete t; @@ -752,9 +752,9 @@ void TrigTrackSelector::selectTrack( const xAOD::TrackParticle* track, void* ) { // stereo clusters making a spacepoint are two "hits" uint8_t sum_nBlayerHits = 0; - track->summaryValue( sum_nBlayerHits, xAOD::numberOfBLayerHits); + track->summaryValue( sum_nBlayerHits, xAOD::numberOfInnermostPixelLayerHits); int nBlayerHits = 2*sum_nBlayerHits; - + uint8_t sum_nPixelHits = 0; track->summaryValue( sum_nPixelHits, xAOD::numberOfPixelHits); int nPixelHits = 2*sum_nPixelHits; @@ -773,11 +773,9 @@ void TrigTrackSelector::selectTrack( const xAOD::TrackParticle* track, void* ) { uint8_t sum_expectBL = 0; - track->summaryValue( sum_expectBL, xAOD::expectBLayerHit); - + track->summaryValue( sum_expectBL, xAOD::expectInnermostPixelLayerHit); bool expectBL = ( sum_expectBL ? true : false ); - /// holes uint8_t sum_sctholes = 0; @@ -901,7 +899,7 @@ void TrigTrackSelector::selectTrack( const xAOD::TrackParticle* track, void* ) { deta, dphi, dz0, dd0, dpT, nBlayerHits, nPixelHits, nSctHits, nSiHits, nStrawHits, nTrtHits, bitmap, 0, - trackAuthor, + trackAuthor, false, -1, -1, expectBL, id) ; // std::cout << "SUTT TP track " << *t << "\t0x" << std::hex << bitmap << std::dec << std::endl; -- GitLab