diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/README b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/README new file mode 100755 index 0000000000000000000000000000000000000000..a3d815ae241238527b3a189c63a497cff1eb571f --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/README @@ -0,0 +1,111 @@ +// README File +// Package : TrigTauPerformAnalysis +// Author : Eric Torrence (University of Oregon) +// Created : February 2007 + +Overview: + + This README is intended to describe the structure behind the +analysis objects found in the TrigTauPerformanceAnalysis package. + +MC Truth: + + MC truth comes from the TrigTauPerformNtuple/TrigTauMCTauList +class. This class takes a pointer to the TrigTauMCEvent (stored +in the ntuple), goes through the particle listing and finds valid +tau records, with duplicates removed and stores these into the +_mcTauPure vector. A second step applies user-controlled fiducial +cuts, incuding potentially on the tau decay mode, and creates +the _mcTauGood vector. This vector should be used as the +denominator for any efficiency calculation, as shown in the +example macros. + + These vectors contian TrigTauMCTau objects, which inherit from +the ntuple object TrigTauTrueParticle, but also provides specific +functions to provide the tau decay mode as well as the visible +momentum 4-vector. + +Trigger Chains: + + One feature of the Atlas trigger system is the vertical +relationship between a single L1 ROI and a single L2 and EF +object. Unfortunately, at the moment, there is no way to +precisely determing which L2 objects belongs to which L1 ROI. +To get around this, trigger chains are built by starting with +each L1 ROI in the event, and assigning L2 and EF objects +to one and only one chain by selecting the closest ROI in +R = sqrt(dEta^2 + dPhi^2). + + The TrigTauTrigChainList class contains this list of +chains returned by the trigChainEntry function, but also +provides an interface to lists of chains passing specific +trigger conditions. The selections are defined by the +TrigTauSelectionManager class (described below). The main +reason for the trigger chains is to require a L2 object to +also pass L1 for the associated ROI (which otherwise would +not be possible). + + Accessors are available to find all chains passing a +certain set of trigger criteria (L1/L2/EF), or to find the +chain containing a trigger object closest in dR to a given +true tau. The max dR allowed for this truth matching can be +adjusted. + +Selectors: + + There are individual selector classes for L1, L2Cal, L2Trk, +as well as EF and the two offline Reco algorithms (to be done). +These place cuts on the quantities contained in the ntuple +to emulate the trigger algorithms at each stage. The operation +of these selectors is coordinated through the TrigTauSelectionManger, +which has predefined "menus" matching the cuts found in Rel. 12.0.4. + + The setTauMenu function can be used to select a specific menu, +and the cut values can easily be seen from the source code of +this function. Note that individual selectors are akin to Hypo +algorithms in that they place cuts on a specific object, while +the SelectionManager will also require that previous objects in +a given chain (such as L1) pass a given selection menu. + + For convenience, rudimentary L1 MET cuts have also been +implemented, and this can be expanded into MET menus as the +need arises. For now, the L1 selection is anded with the L1 +MET cut (by default at 0 GeV). + +TrigTauAnalyzer: + + To make the three main analysis objects (MCList, ChainList, +and SelectionManager) more convenient to use in ROOT macros, +there is a main analysis class called TrigTauAnalyzer which +contains instances of these three classes. In a typical analysis +job, there is one TrigTauAnalyzer instantiated, the user sets +the desired MC fiducial cuts and trigger selection menu, then +for each event a pointer to the TrigTauEvent (ntuple) object +is passed to the analyze function. This fills all the needed +lists (both MC and chain) and the user can then extract any +needed information about the event back out of these two lists. + +Example Macros: + + There are several example macros in TrigTauPerformAnalysis/macros. + +eventRates.cxx : Simple example which does not use MC Truth. + For each event, the total number of objects passing at L1 or L2 + are tabulated, in addition to the number of events with at + least one object passing at each level. A weight input is + provided, so this can be used to plot event rates for backgrounds. + +effMultiPlots.cxx : Example of calculating selection efficiency. + In the event loop, we loop over the Good Taus and look for + chains passing L1 and L2 within some dR of each good tau. + This is repeated for each event with several different + selection menus, and the turn-on curves vs. visible Pt is + plotted. + +resolutionPlots.cxx : Example of looking at resolutions between + different elements in a chain. The resolution with respect + to MC truth, as well as L2 - L1 and EF - L2 (independent + of MC) are both calculated. Looking at different tau decay + modes can be easily done by changing the fiducial cut used + to fill the MC truth list, selecting, for example, only + 1-prong decays. \ No newline at end of file diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauAnalyzer.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauAnalyzer.h new file mode 100755 index 0000000000000000000000000000000000000000..0bd8125994d56de40dab0e7bbf1535f96a66633f --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauAnalyzer.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef _TRIGTAUANALYZER_H +#define _TRIGTAUANALYZER_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauAnalyzer.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Utility class to collect all the analysis functions into one +/// place. Makes the ROOT interface easier. +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" + +class TrigTauEvent; +#include "TrigTauPerformNtuple/TrigTauMCTauList.h" +#include "TrigTauPerformAnalysis/TrigTauTrigChainList.h" +#include "TrigTauPerformAnalysis/TrigTauSelectionManager.h" + +class TrigTauAnalyzer : public TObject { + + public: + TrigTauAnalyzer(); + virtual ~TrigTauAnalyzer(); + + void analyze(const TrigTauEvent* event, bool signal=true) ; + void analyze(const TrigTauEvent* event, bool signal, + TrigTauMCTauList::OFFLINESELECTION offline) ; + + TrigTauMCTauList truthList; + TrigTauTrigChainList chainList; + TrigTauSelectionManager trigMan; + + void setDebug(bool debug=true) {_debug = debug;} + void printSettings() const; + +private: + + bool _debug; + ClassDef(TrigTauAnalyzer, 1) ; + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauBugFix.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauBugFix.h new file mode 100644 index 0000000000000000000000000000000000000000..b790a14b40273f62711d63fd3079b184a68c8261 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauBugFix.h @@ -0,0 +1,77 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef _TRIGTAUBUGFIX_H +#define _TRIGTAUBUGFIX_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauBugFix.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence, Olya Igonkina +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Hack to fix up the objects to replace track+calo eta/phi +/// with calo-only eta/phi. This should be a temporary fix. +/// - nothing is permanent as temporary fixes... Now it is a class to fix varios problems +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" + +class TString; +class TrigTauEvent; +class TrigTauL2Object; + +class TrigTauBugFix : public TObject { + + public: + enum TTPVERSION{TTP4, TTP5, TTP6, TTP7, TTP9, TTP10, TTP11, TTP12, TTP13, TTP14, TTP15}; + enum POOLFILE{ RDO, ESD, AOD}; + + TrigTauBugFix( TTPVERSION version=TTP12, POOLFILE fileType=RDO) : + m_TTP(version), m_fileType(fileType), + m_nTotal(0), + m_nL1GeVtoMeV_Error(0), m_nL2roiWordIs0_Error(0), m_nDuplicateTrack_Error(0), + m_nZeroPointerTracks_Error(0), m_nTRTOnlyTracks(0) {}; + + virtual ~TrigTauBugFix() {}; + + void setTTPVersion(TTPVERSION version){ m_TTP=version; }; + void setPOOLFile( POOLFILE fileType) {m_fileType = fileType; }; + int setTTPVersion(const TString & fileName); // sets both m_TTP and m_fileType + + void fix(TrigTauEvent* event); + + void printSummary() const; + + bool correctL1GeVtoMev(TrigTauEvent* event ) ; + bool removeDuplicateTracks(TrigTauEvent* event); + bool removeDuplicateTracks(TrigTauL2Object * obj); + bool resetIfl2roiWordIs0(TrigTauEvent* event); + bool resetIfZeroPointerTracks(TrigTauEvent* event); + bool attachTRTOnlyTracks(TrigTauEvent*event); + +private: + + float tauRec_et_corr_TTP4(double et_in, double eta_in, int ntrk) const; + + + + TTPVERSION m_TTP; + POOLFILE m_fileType; + + int m_nTotal; + int m_nL1GeVtoMeV_Error; + int m_nL2roiWordIs0_Error; + int m_nDuplicateTrack_Error; + int m_nZeroPointerTracks_Error; + int m_nTRTOnlyTracks; + + + ClassDef(TrigTauBugFix, 2) ; + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauDoubleTrigger.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauDoubleTrigger.h new file mode 100755 index 0000000000000000000000000000000000000000..1938163dbe3f3dba8bba0a628ef554c48b89b4b8 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauDoubleTrigger.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef _TRIGTAUDOUBLETRIGGER_H +#define _TRIGTAUDOUBLETRIGGER_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauDoubleTrigger.h +/// Package : TrigTauPerformAnalysis +/// Author : Olya Igonkina (University of Oregon) +/// Created : April 2007 +/// +/// DESCRIPTION: +/// Utility class to run double trigger, e.g. tau+lept +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" + +class TrigTauEvent; +#include "TrigTauPerformNtuple/TrigTauMCTauList.h" +#include "TrigTauPerformAnalysis/TrigTauAnalyzer.h" +#include "TrigTauPerformAnalysis/TrigTauSelectionManager.h" + +class TrigTauDoubleTrigger : public TObject { + + public: + TrigTauDoubleTrigger(TrigTauFlags::TRIGGERMENU item1, TrigTauFlags::TRIGGERMENU item2); + virtual ~TrigTauDoubleTrigger(); + + void pass(const TrigTauEvent* event, + bool & passL1, bool & passL2, bool & passEF); + +private: + void passNoTauSignature(const TrigTauEvent* event, + bool & passL1, bool & passL2, bool & passEF); + + + bool menuWithTau; + bool bothMenuWithTau; + bool menuWithMET; + TrigTauFlags::TRIGGERMENU menu1; + TrigTauFlags::TRIGGERMENU menu2; + + TrigTauAnalyzer analyzer; + TrigTauSelectionManager trigMan1; + TrigTauSelectionManager trigMan2; + + ClassDef(TrigTauDoubleTrigger, 1) ; + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauEFSel.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauEFSel.h new file mode 100755 index 0000000000000000000000000000000000000000..9040faab5effd7c83e9b2c3c4a14c481f3549a8e --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauEFSel.h @@ -0,0 +1,158 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauEFSel.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply EF selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef _TRIGTAUEFSEL_H +#define _TRIGTAUEFSEL_H + +#include "TrigTauPerformNtuple/TrigTauFlags.h" +#include "TrigTauPerformAnalysis/TrigTauHistogram.h" + +class TrigTauRecEFObject; + +// Bits defining pattern returned by TrigTauL2CalSel::cutWord() +const unsigned long EFCUT_EFIDNONZERO = 0x01; +const unsigned long EFCUT_NTRKMIN = 0x02; +const unsigned long EFCUT_NTRKMAX = 0x04; +const unsigned long EFCUT_EMRAD = 0x08; +const unsigned long EFCUT_ISOFRAC = 0x10; +const unsigned long EFCUT_EMFRAC = 0x20; +const unsigned long EFCUT_LEADPT = 0x40; +const unsigned long EFCUT_ETCORR = 0x80; +const unsigned long EFCUT_EMET = 0x100; +const unsigned long EFCUT_MASS = 0x200; +const unsigned long EFCUT_DRTRKAVG = 0x400; +const unsigned long EFCUT_ETOVERPTTRK = 0x800; + +// +// EF trigger selector +// + +class TrigTauEFSel { + public: + TrigTauEFSel(); + TrigTauEFSel( const TrigTauEFSel& other); + ~TrigTauEFSel(); + + void setCuts(int NTrackMin = 1, + int NTrackMax = 3, + float EMRadiusMax = 0.08, + float IsoFracMax = 0.31, + float EMFracMin = 0., + float PtMaxTrackMin = 5000., + float EtCalibMin = -10000., + float EMEtMin = -10000., + float EMRadiusMaxMultiProng = -1, // if *MultiProng <0, same value as for 1-prong is used + float IsoFracMaxMultiProng = -1, + float EMFracMinMultiProng = -1, + float PtMaxTrackMinMultiProng = -1, + float EtCalibMinMultiProng = -10000., + float EMEtMinMultiProng = -10000., + float MassMax = -1, + float DrTrkAvgMax = -1, + float DrTrkAvgMaxMultiProng = -1); + + class CutFunctor + { + public: + CutFunctor( float am1=-999, float a0=-999, float a1=-999) + : m_am1( am1), m_a0( a0), m_a1( a1) + {} + + float eval( float pt) const + { + if( pt < 0) + return -1; + return m_am1/pt + m_a0 + m_a1*pt; + } + private: + float m_am1; + float m_a0; + float m_a1; + }; + + void setParamSafeCuts( const CutFunctor& LowEMRadSP, + const CutFunctor& LowEMRadMP, + const CutFunctor& LowTrkAvgDistSP, + const CutFunctor& LowTrkAvgDistMP, + float LowEtOverPtLeadTrkSP = -1, + float LowEtOverPtLeadTrkMP = -1, + float HighEMRadSP = 0, + float HighEMRadMP = 0, + float HighTrkAvgDistSP = 0, + float HighTrkAvgDistMP = 0, + float HighEtOverPtLeadTrkSP = -1, + float HighEtOverPtLeadTrkMP = -1, + int NTrackMin = 1, + int NTrackMax = 3, + float EtCalibMinSP = -1, + float EtCalibMinMP = -1, + float ETThresh = 80000); + + // Use trigger decision bits instead + void useBits(TrigTauFlags::TRIGGERMENU type) {menu=type;} + + void print() const; + + bool passed(const TrigTauRecEFObject& tau) const; + + // Return bits indicating cuts failed + unsigned long cutWord(const TrigTauRecEFObject& tau) const; + unsigned long cutWordParamSafeCuts(const TrigTauRecEFObject& tau) const; + + void setDebug(bool value=true) {_debug = value;} + void setHistDebug(TrigTauHistogram::HISTTYPE type=TrigTauHistogram::PTHIST); + + TrigTauHistogram * histManager() { return m_histManager;}; + + private: + + unsigned int m_NTrackMin; + unsigned int m_NTrackMax; + float m_EMRadiusMax; + float m_IsoFracMax; + float m_EMFracMin; + float m_PtMaxTrackMin; + float m_EtCalibMin; + float m_EMEtMin; + + float m_EMRadiusMaxMultiProng; + float m_IsoFracMaxMultiProng; + float m_EMFracMinMultiProng; + float m_PtMaxTrackMinMultiProng; + float m_EtCalibMinMultiProng; + float m_EMEtMinMultiProng; + float m_MassMax; + float m_DrTrkAvgMax; + float m_DrTrkAvgMaxMultiProng; + + // pt parametrized cuts + CutFunctor m_LowEMRadSP; + CutFunctor m_LowEMRadMP; + CutFunctor m_LowTrkAvgDistSP; + CutFunctor m_LowTrkAvgDistMP; + float m_LowEtOverPtLeadTrkSP; + float m_LowEtOverPtLeadTrkMP; + float m_HighEtOverPtLeadTrkSP; + float m_HighEtOverPtLeadTrkMP; + float m_ETThresh; + + bool _debug; + + // For bit-level selection + TrigTauFlags::TRIGGERMENU menu; + + TrigTauHistogram * m_histManager; +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauHistHelper.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauHistHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..5212f099e66c16b49854440313fe283a38c322aa --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauHistHelper.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// Utility class to keep track of a bunch +// of histograms at once. +// +#ifndef TRIGTAUHISTHELPER_H +#define TRIGTAUHISTHELPER_H + +#include <list> +#include <map> +#include <vector> + +#include "TH1D.h" +#include "TH2D.h" +#include "TString.h" +#include "TCanvas.h" + +using namespace std; + +class TrigTauHistHelper { +public: + TrigTauHistHelper(); + TrigTauHistHelper(unsigned long nh); // Number of histograms per family + virtual ~TrigTauHistHelper(); + + void reset(); // Set all counts to zero + void clear(); // Delete everything + + void setNHist(unsigned long nhist) {_nHist = nhist;} + + void create(TString tag, long nbx, double xlo, double xhi, + TString xAxis=""); + void create(TString tag, long nbx, double xlo, double xhi, + long nby, double ylo, double yhi, + TString xAxis="", TString yAxis="", + TString opt="COLZ"); + + // itype is an index to the particular histogram in a family + void fill1D(TString tag, long itype, double x, double wt=1.); + void fill2D(TString tag, long itype, double x, double y, double wt=1.); + + // Generic versions + void fill(TString tag, long itype, double x, double wt) { + fill1D(tag, itype, x, wt); + }; + void fill(TString tag, long itype, double x, double y, double wt) { + fill2D(tag, itype, x, y, wt); + }; + + // Retrieve specific histograms + TH1D* get1D(TString tag, long itype); + TH2D* get2D(TString tag, long itype); + + void draw(TString itag, long itype); + + void writeAll(TString outfile); + void drawAll(TString plotfile, unsigned long nStart, unsigned long nEnd, TCanvas* c); + void drawAll(TString plotfile, long nPerPage, TCanvas* c); + void drawEffAll(TString plotfile, long nPerPage, long nDenom, TCanvas* c); + + void setYAxisLabels(const vector<TString>& lab) {_yAxisLabels = lab;}; + void setLogY(TString tag) {_logY[tag] = true;}; // Draw 1D plot as logy + +private: + unsigned long _nHist; // Total number of histograms per family + bool _debug; + + map<TString, TH1D*> _h1D; + map<TString, TH2D*> _h2D; + map<TString, bool> _logY; + map<TString, TString> _opt; + + list<TString> _tags; + + vector<TString> _yAxisLabels; +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauHistogram.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauHistogram.h new file mode 100644 index 0000000000000000000000000000000000000000..0efaf8588a5d06ee3b939bfa990fb177f6e17832 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauHistogram.h @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauHistogram.h +/// Package : TrigTauPerformAnalysis +/// Author : Olga Igonkina (University of Oregon) +/// Created : October 2007 +/// +/// DESCRIPTION: +/// Class to perform generic selector function, such as histogramming +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef _TRIGTAUHISTOGRAM_H +#define _TRIGTAUHISTOGRAM_H + +#include <vector> +#include "TH1F.h" +#include "TString.h" +#include "TLorentzVector.h" + + +class TrigTauHistogram { +public : + enum HISTTYPE{PTHIST=0, ETAHIST=1, PHIHIST=2, EXTERNAL=3, NONE=4}; + + TrigTauHistogram(HISTTYPE type = PTHIST); + virtual ~TrigTauHistogram(); + + void doHist( HISTTYPE type = PTHIST); // change histogramming type! + static void setHistLimits(HISTTYPE type, int nbin, float xmin, float xmax); + static void setHistLimits(HISTTYPE type, TString baseName, TString xaxistext, int nbin, float xmin, float xmax); + int book(const char * name, const char * title); + void fill(unsigned int index, float var); + void fill(unsigned int index, const TLorentzVector & var); + void setExternal(float var) { m_externalVar = var; }; + + + int nHists() const; + HISTTYPE type() const {return m_type;}; + + int plotHist(unsigned int index, const char * opt=""); + int plotEfficiency(unsigned int indexAfterCut, unsigned int indexBeforeCut, const char * opt=""); + int plotAll(); + int plotAllEfficiencies(int opt = 0 ); // draw all histograms divided on the very first one (id=0) + + float externalVar() const {return m_externalVar; } + + +private: + + struct Definition{ + Definition( TrigTauHistogram::HISTTYPE atype, + const char * baseN, const char * xtext, int nnbin, float xxmin, float xxmax) : + type(atype), baseName(baseN), xaxistext(xtext), nbin(nnbin), xmin(xxmin), xmax(xxmax) {}; + + TrigTauHistogram::HISTTYPE type; + TString baseName; + TString xaxistext; + int nbin; + float xmin; + float xmax; + }; + + static Definition histDefinitions[NONE]; + + HISTTYPE m_type; + std::vector<TH1F*> m_hist; + float m_externalVar; + + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL1BugFix.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL1BugFix.h new file mode 100644 index 0000000000000000000000000000000000000000..86afe09fa32172f3d2e92b5f6e61b2dddf1edd9f --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL1BugFix.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef _TRIGTAUL1BUGFIX_H +#define _TRIGTAUL1BUGFIX_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL1BugFix.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Hack to fix up the L1 objects to replace track+calo eta/phi +/// with calo-only eta/phi. This should be a temporary fix. +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" + +class TrigTauEvent; + +class TrigTauL1BugFix : public TObject { + + public: + TrigTauL1BugFix(); + virtual ~TrigTauL1BugFix(); + + void fix(TrigTauEvent* event); + +private: + + ClassDef(TrigTauL1BugFix, 1) ; + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL1Sel.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL1Sel.h new file mode 100755 index 0000000000000000000000000000000000000000..9838957423687a34939174755930555dd02830b4 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL1Sel.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL1Sel.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L1 selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef _TRIGTAUL1SEL_H +#define _TRIGTAUL1SEL_H + +#include "TrigTauPerformAnalysis/TrigTauHistogram.h" + +class TrigTauL1Object; + +// Bits defining pattern returned by TrigTauL1Sel::cutWord() +const unsigned long L1CUT_TAUCLUS = 0x01; +const unsigned long L1CUT_EMISOL = 0x02; +const unsigned long L1CUT_HDISOL = 0x04; +const unsigned long L1CUT_EMCORE = 0x08; +const unsigned long L1CUT_HDCORE = 0x10; +const unsigned long L1CUT_EMENER = 0x20; + +// +// L1 trigger selector +// + +class TrigTauL1Sel { + public: + TrigTauL1Sel(); + TrigTauL1Sel(const TrigTauL1Sel& other); + virtual ~TrigTauL1Sel(); + + void setCuts(float emE, + float tauE, + float EmI=0., + float HdI=0., + float EmCore=0., + float hdCore=0.); + void removeEmIsol(); + + void print() const; + + bool passed(const TrigTauL1Object& tau) const; + + // Return bits indicating cuts failed + unsigned long cutWord(const TrigTauL1Object& tau) const; + + void setDebug( bool newval) { _debug = newval;}; + void setHistDebug(TrigTauHistogram::HISTTYPE type=TrigTauHistogram::PTHIST); + + TrigTauHistogram * histManager() { return m_histManager;}; + + private: + float cut_EmEnergy; + float cut_TauEnergy; + float cut_EmIsol; + float cut_HdIsol; + float cut_EmCore; + float cut_HdCore; + + bool _debug; + + TrigTauHistogram * m_histManager; + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2BugFix.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2BugFix.h new file mode 100755 index 0000000000000000000000000000000000000000..3a237773270c883eb67d8b0381dacead94592cbf --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2BugFix.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef _TRIGTAUL2BUGFIX_H +#define _TRIGTAUL2BUGFIX_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL2BugFix.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Hack to fix up the L2 objects to replace track+calo eta/phi +/// with calo-only eta/phi. This should be a temporary fix. +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" + +class TrigTauEvent; + +class TrigTauL2BugFix : public TObject { + + public: + TrigTauL2BugFix(); + virtual ~TrigTauL2BugFix(); + + void fix(TrigTauEvent* event); + +private: + + ClassDef(TrigTauL2BugFix, 1) ; + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2CalSel.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2CalSel.h new file mode 100755 index 0000000000000000000000000000000000000000..de9058a8694f5673644fb66ddced46f32a1b51df --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2CalSel.h @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL2CalSel.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L2 selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef _TRIGTAUL2CALSEL_H +#define _TRIGTAUL2CALSEL_H + +#include "TrigTauPerformNtuple/TrigTauFlags.h" +#include "TrigTauPerformAnalysis/TrigTauHistogram.h" + +class TrigTauL2Object; +class TrigTauHistogram; + +// Bits defining pattern returned by TrigTauL2CalSel::cutWord() +const unsigned long L2CUT_ET = 0x01; +const unsigned long L2CUT_ETCALIB = 0x02; +const unsigned long L2CUT_NSTRIP = 0x04; +const unsigned long L2CUT_STRWID = 0x08; +const unsigned long L2CUT_EMRAD = 0x10; +const unsigned long L2CUT_ISOFRAC = 0x20; +const unsigned long L2CUT_EMWID = 0x40; +const unsigned long L2CUT_ETNAR = 0x80; +const unsigned long L2CUT_ETNOR = 0x100; + +// +// L2 Calo trigger selector +// + +class TrigTauL2CalSel { + public: + TrigTauL2CalSel(); + TrigTauL2CalSel(const TrigTauL2CalSel& other); + + virtual ~TrigTauL2CalSel(); + + void setCuts(float Et, + float EtCalib, + int nStrips=0, + float stripWidth=0.055, + float EMRadius=0.0127, + float isoFrac=0.55, + float EMEnWidth2=0, + float EtNar = 0., + int nStripsMultiProng=-1, // if <0, the same cuts as for 1prong are applied + float stripWidthMultiProng=-1, + float EMRadiusMultiProng=-1, + float isoFracMultiProng=-1, + float EMEnWidth2MultiProng=-1 + ); + + void setNewCuts(float RawEtNor, + float EMRadius, + float EMRadiusMultiProng=-1); + + // Individual cut set functions + void setCutEt (float et) {cut_Et = et;} + void setCutEtNar (float et) {cut_EtNar = et;} + void setCutEtCalib (float et) {cut_EtCalib = et;} + void setCutNStrips (int n) {cut_nStrips = n;} + void setCutStripWidth(float width) {cut_stripWidth = width;} + void setCutEMRadius (float r) {cut_EMRadius = r;} + void setCutIsoFrac (float frac) {cut_IsoFrac = frac;} + void setCutEMWidth (float wid) {cut_EMEnergyWidth2 = wid;} + + // Use trigger decision bits instead + void useBits(TrigTauFlags::TRIGGERMENU type) {menu=type;} + + void print() const; + + bool passed(const TrigTauL2Object& tau) const; + + // Return bits indicating cuts failed + unsigned long cutWord(const TrigTauL2Object& tau) const; + unsigned long cutWordNew(const TrigTauL2Object& tau) const; + + void setDebug(bool value=true) {_debug = value;} + void setHistDebug(TrigTauHistogram::HISTTYPE type=TrigTauHistogram::PTHIST); + + TrigTauHistogram * histManager() { return m_histManager;}; + + private: + float cut_Et; + float cut_EtCalib; + float cut_EtNar; + float cut_EtNor; + + int cut_nStrips; + float cut_stripWidth; + float cut_EMRadius; + float cut_IsoFrac; + float cut_EMEnergyWidth2; + + int cut_nStripsMultiProng; + float cut_stripWidthMultiProng; + float cut_EMRadiusMultiProng; + float cut_IsoFracMultiProng; + float cut_EMEnergyWidth2MultiProng; + + bool _debug; + + // For bit-level selection + TrigTauFlags::TRIGGERMENU menu; + + TrigTauHistogram * m_histManager; + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2TrkSel.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2TrkSel.h new file mode 100755 index 0000000000000000000000000000000000000000..f5f5eef3c236df5cae7c7230eb4a3276f7e0f799 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauL2TrkSel.h @@ -0,0 +1,114 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL2TrkSel.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L2 selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef _TRIGTAUL2TRKSEL_H +#define _TRIGTAUL2TRKSEL_H + +#include "TrigTauPerformNtuple/TrigTauFlags.h" +#include "TrigTauPerformAnalysis/TrigTauHistogram.h" + +class TrigTauL2Object; + +// Bits defining pattern returned by TrigTauL2TrkSel::cutWord() +const unsigned long L2CUT_NTRK = 0x01; +const unsigned long L2CUT_NSLOW = 0x02; +const unsigned long L2CUT_NISO = 0x04; +const unsigned long L2CUT_NMATCHED = 0x08; +const unsigned long L2CUT_CHARGE = 0x10; +const unsigned long L2CUT_LEADPT = 0x20; +const unsigned long L2CUT_RISO = 0X40; +const unsigned long L2CUT_ETTRKEM = 0x80; + +// +// L2 track selector +// + +class TrigTauL2TrkSel { + public: + TrigTauL2TrkSel(); + TrigTauL2TrkSel(const TrigTauL2TrkSel& other); + + virtual ~TrigTauL2TrkSel(); + + void setCuts(int nTrMax, + int nTrISO, + int nTrSlow, + int nTrkMatched, + float maxPtSlow = 6500, + float dRIso = 0.15, + float mPt = 1500, + float dRMatch = 0.15, + float dRt = 0.3, + float maxPtMin = 0, + bool chargeCut = true, + float sumPtRatio = 100., + float trkEmEt = 0., + int nTrMin = 0); + + // Default is to use calo (eta,phi) to set core/isolation region + // void setCoreFromLeading(bool lead=true) {l2FEX.setCoreFromLeading(lead);} + // Dummy routine to avoid compilation problems. Doesn't do anything anymore!!! + void setCoreFromLeading(bool) {return;} + + // Individual cut set functions + void setCutNTracks(int nTrkMin, int nTrkMax) + {cut_NtracksMax = nTrkMax;cut_NtracksMin = nTrkMin; } + void setCutNTrkIso(int nTrkIso) {cut_NtracksIsolation = nTrkIso;} + void setCutNTrkSlow(int nTrkSlow) {cut_NtracksSlow = nTrkSlow;} + void setCutNTrkMatch(int nTrkMat) {cut_NtracksMatched = nTrkMat;} + + void setMinLeadPt(float leadPt) {maxPtMin = leadPt;} + + void setCutCharge(bool cut) {chargeCut = cut;} + void setSumPtRatio(float ptr) {sumPtRatio = ptr;} + void setCutTrkEmEt(float et) {trkEmEtMin = et;} + + // Use trigger decision bits instead + void useBits(TrigTauFlags::TRIGGERMENU type) {menu=type;} + + void print() const; + + bool passed(const TrigTauL2Object& tau); + + // Return bits indicating cuts failed + unsigned long cutWord(const TrigTauL2Object& tau); + + void setDebug(bool value=true) {_debug = value;} + void setHistDebug(TrigTauHistogram::HISTTYPE type=TrigTauHistogram::PTHIST); + + TrigTauHistogram * histManager() { return m_histManager;}; + + // Access to FEX information + // const TrigTauL2TrkFEX* getL2TrkFEX() const {return &l2FEX;} + + private: + int cut_NtracksMin; + int cut_NtracksMax; + int cut_NtracksIsolation; + int cut_NtracksSlow; + int cut_NtracksMatched; + float maxPtMin; + bool chargeCut; + float sumPtRatio; + float trkEmEtMin; + + bool _debug; + + // For bit-level selection + TrigTauFlags::TRIGGERMENU menu; + + TrigTauHistogram * m_histManager; +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauMETL1Sel.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauMETL1Sel.h new file mode 100755 index 0000000000000000000000000000000000000000..6aa4c6588aebdf20b6903fdf92634b4f118a2bc8 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauMETL1Sel.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauMETL1Sel.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L1 MET selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#ifndef _TRIGTAUMETL1SEL_H +#define _TRIGTAUMETL1SEL_H + +class TrigTauEtMissL1Object; + +// +// L1 MET trigger selector +// + +class TrigTauMETL1Sel { + public: + TrigTauMETL1Sel(); + TrigTauMETL1Sel(const TrigTauMETL1Sel& other); + + void setCuts(float MET=0.); + + void print() const; + + bool passed(const TrigTauEtMissL1Object& tau) const; + void setDebug( bool newval) { _debug = newval;}; + + private: + float cut_MET; + bool _debug; +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysisLinkDef.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysisLinkDef.h new file mode 100755 index 0000000000000000000000000000000000000000..93ebc9ecfb3418a158a1f6f7f1377359788cd57d --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysisLinkDef.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifdef __CINT__ +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class TrigTauHistogram; +#pragma link C++ class TrigTauAnalyzer+; +#pragma link C++ class TrigTauTrigChain+; +#pragma link C++ class TrigTauTrigChainList+; +#pragma link C++ class TrigTauSelectionManager; +#pragma link C++ class TrigTauL1Sel; +#pragma link C++ class TrigTauMETL1Sel; +#pragma link C++ class TrigTauL2CalSel; +#pragma link C++ class TrigTauL2TrkSel; +#pragma link C++ class TrigTauEFSel; +#pragma link C++ class TrigTauL1BugFix+; +#pragma link C++ class TrigTauL2BugFix+; +#pragma link C++ class TrigTauBugFix+; +#pragma link C++ class TrigTauDoubleTrigger+; +#pragma link C++ class TrigTauHistHelper; +#endif + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauSelectionManager.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauSelectionManager.h new file mode 100755 index 0000000000000000000000000000000000000000..b0fe98b409cbd850ad29fe5f9553575417c46ea5 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauSelectionManager.h @@ -0,0 +1,139 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef _TRIGTAUSELECTIONMANAGER_H +#define _TRIGTAUSELECTIONMANAGER_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauSelectionManager.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to manage the individual L1/L2/EF selectors. +/// Can also be used to define complete trigger menus +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include <vector> + +#include "TrigTauPerformAnalysis/TrigTauL1Sel.h" +#include "TrigTauPerformAnalysis/TrigTauL2CalSel.h" +#include "TrigTauPerformAnalysis/TrigTauL2TrkSel.h" +#include "TrigTauPerformAnalysis/TrigTauEFSel.h" + +#include "TrigTauPerformAnalysis/TrigTauMETL1Sel.h" + + +class TrigTauTrigChain; + +class TrigTauSelectionManager { + + public: + TrigTauSelectionManager(); + virtual ~TrigTauSelectionManager(); + + enum CUTLEVEL{ // level of cuts, applicable from MENU1400 only + DEFAULT, // take cut level according to the TrigTauFlags. other options allows to modify it + SOFT, + LOOSE, + MEDIUM, + MEDIUM1, + TIGHT + }; + + enum MENUVERSION { + MENU1206, // Default 12.0.6 menus + MENUJUNE06, // June T/P week menus + MENUJUNE07, // June T/P week menus (properly named) + MENU13020, // Default 13.0.20 menus + MENUAUG07, // Mostly 13.0.20 cuts, June L2Cal cuts, trk+EM energy + MENU13030pre, // 13.0.30 cuts + MENU1400, // 14.0.0 cuts + MENU1520test, // optimized on 15.1.0, introduced in 15.X.0 cuts + MENU1560, // 15.6.0, simple L1 calibration + MENU1600, // 16.0.0, HLT rejection + MENU1662, // 16.6.2, Et parametrized EF cuts + MENU1666, // 16.6.2.6, Et parametrized EF cuts-tight selection + MENUTEST // Test menu + }; + + // Use TrigTauFlags::TRIGGERMENU to specify menus + void setTauMenu(TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + + + // Menu version defaults to 12.0.6. Must be set differently + // once before using setTauMenu to set generic menus. + void setMenuVersion( MENUVERSION version) {_menuVersion = version;} + + // Use HLT trigger bits to select HLT ROIs instead of emulating trigger. + // Note, MENUVERSION must exactly match the bit requested, as the level + // modifier is not considered. This may be called after + // setTauMenu, but may be toggeled on/off during execution. + void useHLTTriggerBits(bool useBits=true); + + // void setMETMenu(TRIGMETMENU type); + + // Use only calo selection at L2 (default is Trk+Calo) + void setL2CalOnly(bool calOnly=true) {l2CalOnly = calOnly;} + void setL2TrkOnly(bool trkOnly=true) {l2TrkOnly = trkOnly;} + + // Shortcut to the l1METSel function + void setL1MET(float METCut=0.) {l1METSel.setCuts(METCut);} + + void printSettings() const; + void print() const; + void setDebug(bool val); + + // Select by chain (Note: passing L2 also requires passing L1) + bool passedL1(const TrigTauTrigChain& chain); + bool passedL2(const TrigTauTrigChain& chain); + bool passedL2Cal(const TrigTauTrigChain& chain); + bool passedL2Trk(const TrigTauTrigChain& chain); + bool passedEF(const TrigTauTrigChain& chain); + + void setParametrizedEFCuts( TrigTauEFSel& efsel, + CUTLEVEL level, float thresh); + void setParametrizedEFCuts_201104( TrigTauEFSel& efsel, + CUTLEVEL level, float thresh); + + TrigTauFlags::TRIGGERMENU usedTauMenu() const; + CUTLEVEL usedCutLevel() const {return _cutLevel; } + MENUVERSION usedMenuVersion() const {return _menuVersion; } + + + TrigTauL1Sel l1Sel; + TrigTauMETL1Sel l1METSel; + + TrigTauL2CalSel l2CalSel; + TrigTauL2TrkSel l2TrkSel; + + TrigTauEFSel efSel; + +private: + MENUVERSION _menuVersion; + CUTLEVEL _cutLevel; + TrigTauFlags::TRIGGERMENU _usedType; + TrigTauFlags::TRIGGERMENU _givenType; + bool l2CalOnly; + bool l2TrkOnly; + + void setTauMenu1206(TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenuJUNE07(TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu13020 (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenuAUG07 (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu13030pre (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu1400 (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu1520test (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu1560 (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu1600 (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu1662 (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenu1666 (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + void setTauMenuTest (TrigTauFlags::TRIGGERMENU type, CUTLEVEL level= DEFAULT ); + + +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauTrigChain.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauTrigChain.h new file mode 100755 index 0000000000000000000000000000000000000000..244b209ede99c2bf1a6cbcd897813a904cace4d4 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauTrigChain.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGTAUTRIGCHAIN_H +#define TRIGTAUTRIGCHAIN_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauTrigChain.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Container to associate L1-L2-EF into a trigger chain +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformNtuple/TrigTauL1Object.h" +#include "TrigTauPerformNtuple/TrigTauL2Object.h" +#include "TrigTauPerformNtuple/TrigTauRecEFObject.h" + +#include "TrigTauPerformNtuple/TrigTauEtMissL1Object.h" + +#include "TrigTauPerformNtuple/TrigTauRecOfflineObject.h" + +class TrigTauTrigChain : public TObject { + public: + + TrigTauTrigChain(); + virtual ~TrigTauTrigChain(); + + TrigTauTrigChain& operator = (const TrigTauTrigChain& other ); + + // The following function returns the 4-vector of the highest + // available trigger object (EF, L2, L1) available in this chain. + // This is intended for matching to the offline reco objects. + + const TLorentzVector* trigger() const; + + // public members + const TrigTauL1Object* L1; + const TrigTauL2Object* L2; + const TrigTauL2Object* L2Cal; // if both L2Cal and L2Trk are not zero, + const TrigTauL2Object* L2Trk; // they must point to the same object as L2 + const TrigTauRecEFObject* EF; + + const TrigTauEtMissL1Object* L1MET; + + const TrigTauRecOfflineObject* tauRec; + + void print() const; + + private: + + ClassDef(TrigTauTrigChain, 2) ; +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauTrigChainList.h b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauTrigChainList.h new file mode 100755 index 0000000000000000000000000000000000000000..02281d95d1dfa6da37b476a9f45f4553b7c0031d --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/TrigTauPerformAnalysis/TrigTauTrigChainList.h @@ -0,0 +1,146 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGTAUTRIGCHAINLIST_H +#define TRIGTAUTRIGCHAINLIST_H + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauTrigChainList.h +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// List of trigger chains, and associated analysis functions +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauTrigChain.h" +#include "TrigTauPerformNtuple/TrigTauEvent.h" + +class TrigTauSelectionManager; + +class TrigTauTrigChainList : public TObject { + + public: + TrigTauTrigChainList(); + virtual ~TrigTauTrigChainList(); + + // + // Build trigger chains (before trigger has been applied) + // There is one chain per L1 ROI + // + void fillChainList(const TrigTauEvent* event); + void printChainList() const; + bool checkRoIWord() const; + + // Matches based on dR to the L1 object. No trigger selection applied + const TrigTauTrigChain* getChain(const TLorentzVector& goodTau) const; + + // Trigger chain accessors + unsigned int nTrigChains() const; + const TrigTauTrigChain& trigChainEntry(unsigned int i) const; + + // + // Apply trigger conditions (user must provide trigMan) + // + void fillTriggerList(TrigTauSelectionManager& trigMan); + + // + // Trigger chain accessors only for objects passing trigger conditions + // + unsigned int nPassL1Chains() const; + unsigned int nPassL2CalChains() const; + unsigned int nPassL2TrkChains() const; + unsigned int nPassL2Chains() const; + unsigned int nPassEFChains() const; + + const TrigTauTrigChain& passL1ChainEntry(unsigned int i) const; + const TrigTauTrigChain& passL2CalChainEntry(unsigned int i) const; + const TrigTauTrigChain& passL2TrkChainEntry(unsigned int i) const; + const TrigTauTrigChain& passL2ChainEntry(unsigned int i) const; + const TrigTauTrigChain& passEFChainEntry(unsigned int i) const; + + // + // MC truth - trigger object matching functions (or any other 4-vector) + // Return object which passed the trigger, closest in dR. + // Return NULL for no match in dR range + // + const TrigTauL1Object* getL1Tau(const TLorentzVector& goodTau) const; + const TrigTauL2Object* getL2CalTau(const TLorentzVector& goodTau) const; + const TrigTauL2Object* getL2TrkTau(const TLorentzVector& goodTau) const; + const TrigTauL2Object* getL2Tau(const TLorentzVector& goodTau) const; + const TrigTauRecEFObject* getEFTau(const TLorentzVector& goodTau) const; + + // Same matching, but return the entire chain + const TrigTauTrigChain* getL1Chain(const TLorentzVector& goodTau) const; + const TrigTauTrigChain* getL2CalChain(const TLorentzVector& goodTau) const; + const TrigTauTrigChain* getL2TrkChain(const TLorentzVector& goodTau) const; + const TrigTauTrigChain* getL2Chain(const TLorentzVector& goodTau) const; + const TrigTauTrigChain* getEFChain(const TLorentzVector& goodTau) const; + + // Note also the getChain accessor above for unselected chains + + // Choose how to do the matching. RoiWord is correct, but only + // available in TTP05 and beyond. Otherwise, dR matching is used + // by default + void setRoiWordMatching(bool val=true) {_useRoiWord = val;} + + // Set matching dR + void setMaxL1dR(float dR) {_maxL1dR = dR;} + void setMaxL2dR(float dR) {_maxL2dR = dR;} + void setMaxEFdR(float dR) {_maxEFdR = dR;} + void setMaxRedR(float dR) {_maxRedR = dR;} // Offline reco dR + + // From TTP10 onwards, there can be multiple instances of + // ROIs in HLT depending on the algorithms run. + // The following functions can restrict which ROI types are considered + // the default is IDSCAN (tauNoCut) signatures + void setHLTAuthor(TrigTauFlags::HLTAUTHOR type) {_hltAuthorType = type;} + + // Shortcuts + void setAnyAuthor() {setHLTAuthor(TrigTauFlags::ANYAUTHOR);} + void setCaloOnly() {setHLTAuthor(TrigTauFlags::CALOONLY);} + void setIDOnly() {setHLTAuthor(TrigTauFlags::IDONLY);} + void setIDSCAN() {setHLTAuthor(TrigTauFlags::IDSCAN);} + void setSITRK() {setHLTAuthor(TrigTauFlags::SITRK);} + void setTRT() {setHLTAuthor(TrigTauFlags::TRTONLY);} + + // ---------------- data members ------------------------ + private: + + // Chain list + std::vector<TrigTauTrigChain> _chainList; + + // Trigger lists containing full chains passing trigger selectors + std::vector<const TrigTauTrigChain*> _tauL1; + std::vector<const TrigTauTrigChain*> _tauL2Cal; + std::vector<const TrigTauTrigChain*> _tauL2Trk; + std::vector<const TrigTauTrigChain*> _tauL2; + std::vector<const TrigTauTrigChain*> _tauEF; + + // Matching cuts + float _maxL1dR; + float _maxL2dR; + float _maxEFdR; + float _maxRedR; + + // How to perform matching + bool _useRoiWord; + + void fillChainListRoiWord(const TrigTauEvent* event); + void fillChainListdRMatch(const TrigTauEvent* event); + + // Radius utilities + // float dRadius2(const TrigTauL1Object& t1, const TLorentzVector& t2) const; + float dRadius2(const TLorentzVector& t1, const TLorentzVector& t2) const; + + TrigTauFlags::HLTAUTHOR _hltAuthorType; + +private: + + ClassDef(TrigTauTrigChainList, 2) ; +}; + +#endif diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/cmt/Makefile.standalone b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/cmt/Makefile.standalone new file mode 100755 index 0000000000000000000000000000000000000000..2d3b7a444a888df6462b006f9542ad2e2e425a4e --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/cmt/Makefile.standalone @@ -0,0 +1,118 @@ +# ------------------------------------------------------------- +# This makefile is designed to compile a ROOT library +# independent of the Atlas framework. You only need to +# have ROOTSYS pointing to a valid ROOT installation. +# This has been tested on Linux and OS X, but should work +# for any architecture supported in ROOT Makefile.arch + +# --- External configuration ---------------------------------- +include $(ROOTSYS)/test/Makefile.arch + +MFLAGS = -MM -Wall -W -Woverloaded-virtual + +# debug +#CXXFLAGS += -O0 -g + +# ------------------------------------------------------------- + +BASEDIR = .. +WORKDIR = $(BASEDIR)/tmp +LIBDIR = $(shell cd $(BASEDIR) && pwd) + +# Internal configuration +PACKAGE=TrigTauPerformAnalysis + +INCDIR=$(BASEDIR)/$(PACKAGE) +OBJDIR=$(WORKDIR) +SRCDIR=$(BASEDIR)/src + +# The following specifies where make looks for prerequisites +# VPATH=$(INCDIR) $(SRCDIR) $(OBJDIR) + +# Better to do it this way? +vpath %.h $(INCDIR) +vpath %.cxx $(SRCDIR) +vpath %.o $(OBJDIR) +vpath %.d $(WORKDIR) + +INCLUDES += -I$(INCDIR) -I$(ROOTSYS)/include + +# Add dependent packages +INCLUDES += -I$(BASEDIR) +INCLUDES += -I$(BASEDIR)/../TrigTauPerformNtuple + +HHLIST_EXCLUDE = $(PACKAGE)LinkDef.h +CXXFLAGS += -I$(BASEDIR) $(INCLUDES) +ROOTSYS ?= ERROR_RootSysIsNotDefined +HHLIST = $(filter-out $(HHLIST_EXCLUDE) , $(patsubst $(INCDIR)/%h, %h, $(wildcard $(INCDIR)/*.h))) + +CINTFILE = $(PACKAGE)Cint.cxx +CINTOBJ = $(PACKAGE)Cint.o +SHLIBFILE = lib$(PACKAGE).so + +ifeq ($(PLATFORM),macosx) +EXTRALDFLAGS = -install_name @rpath/$(SHLIBFILE) +endif + +# get libraries of ROOT +define ldlinksuffixROOT + $(addsuffix $(LDLINKSUFFIX),$(Lib)) $(shell if [ "$(findstring -Ldlink2,$(OPTIONS))" ]; then echo $(addsuffix _pkgid_$(ROOTVER),$(Lib)); fi) +endef + +default: shlib +#default: testvars + +# List of all source files to build +CCLIST=$(filter-out $(SKIPLIST),$(patsubst $(SRCDIR)/%cxx, %cxx, $(wildcard $(SRCDIR)/*.cxx))) + +# List of all object files to build +OLIST=$(patsubst %.cxx,%.o,$(CCLIST)) + +# List of all dependency file to make +DLIST=$(patsubst %.h,%.d,$(HHLIST)) + +testvars: + @echo $(HHLIST) + @echo $(CCLIST) + @echo $(OLIST) + @echo $(DLIST) + +# Implicit rule making all dependency Makefiles included at the end of this makefile +$(WORKDIR)/%.d: %.cxx $(HHLIST) + @echo "Making $@" + @mkdir -p $(WORKDIR) + @set -e; $(CC) $(MFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($(notdir $*)\)\.o[ :]*/\1.o $(notdir $@) : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +# Implicit rule to compile all classes +%.o : %.cxx + @echo "Compiling $<" + @mkdir -p $(OBJDIR) + @$(CXX) $(CXXFLAGS) -c $< -o $(OBJDIR)/$(notdir $@) + +# Rule to make ROOTCINT output file +$(OBJDIR)/$(CINTOBJ): $(HHLIST) $(INCDIR)/$(PACKAGE)LinkDef.h + @mkdir -p $(OBJDIR) + @echo "Running rootcint" + @$(ROOTSYS)/bin/rootcint -f $(WORKDIR)/$(CINTFILE) -c $(CXXFLAGS) \ + -I$(INCDIR) $(HHLIST) $(PACKAGE)LinkDef.h + @echo "Compiling $(CINTFILE)" + @$(CXX) $(CXXFLAGS) -I$(INCDIR) -c $(WORKDIR)/$(CINTFILE) -o $@ + +# Rule to combine objects into a shared library +$(LIBDIR)/$(SHLIBFILE): $(OLIST) $(OBJDIR)/$(CINTOBJ) + @echo "Making $(SHLIBFILE)" + @rm -f $(LIBDIR)/$(SHLIBFILE) + @cd $(WORKDIR) && $(LD) $(CXXFLAGS) $(SOFLAGS) $(EXTRALDFLAGS) $(addprefix $(OBJDIR)/, $(OLIST)) $(OBJDIR)/$(CINTOBJ) -o $(LIBDIR)/$(SHLIBFILE) + +# Useful build targets +shlib: $(LIBDIR)/$(SHLIBFILE) + +clean: + rm -rf $(WORKDIR) + rm -f $(LIBDIR)/$(SHLIBFILE) + +.PHONY : shlib lib default clean + +-include $(addprefix $(WORKDIR)/,$(DLIST)) diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/cmt/requirements b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/cmt/requirements new file mode 100755 index 0000000000000000000000000000000000000000..604a1d79604596ba7759b0ed251a2fc45f09060a --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/cmt/requirements @@ -0,0 +1,37 @@ +################################################# +package TrigTauPerformAnalysis + +author Eric Torrence <Eric.Torrence@cern.ch> + +use AtlasPolicy AtlasPolicy-* +use AtlasROOT AtlasROOT-* External +use TrigTauPerformNtuple TrigTauPerformNtuple-* Trigger/TrigAnalysis/TrigTauAnalysis + +apply_tag ROOTMathLibs + +apply_pattern installed_library +library TrigTauPerformAnalysis *.cxx + +private + +macro_append TrigTauPerformAnalysis_dependencies " TrigTauPerformAnalysisDict " + +apply_pattern have_root_headers \ + root_headers="TrigTauAnalyzer.h \ + TrigTauTrigChain.h \ + TrigTauTrigChainList.h \ + TrigTauSelectionManager.h \ + TrigTauHistHelper.h \ + TrigTauHistogram.h \ + TrigTauL1Sel.h \ + TrigTauEFSel.h \ + TrigTauL2CalSel.h \ + TrigTauL2TrkSel.h \ + TrigTauMETL1Sel.h \ + TrigTauL2BugFix.h \ + TrigTauL1BugFix.h \ + TrigTauBugFix.h \ + TrigTauDoubleTrigger.h \ + TrigTauPerformAnalysisLinkDef.h" \ + extra_includes=" ${RootDict_include} ${includes} " \ + headers_lib="TrigTauPerformAnalysis" diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/TTP_loop.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/TTP_loop.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c89d578b5b8318c7d2df38fafb15336d0ee455fc --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/TTP_loop.cxx @@ -0,0 +1,390 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +struct TauCuts +{ + + // L1 + float cut_L1_TauClus; + float cut_L1_EmIsol; + float cut_L1_HdIsol; + + // L2Calo + float cut_L2_EMRadius; + float cut_L2_isoFrac; + float cut_L2_stripWidth2; + float cut_L2_EtCalib; + + // L2ID + float cut_L2_minPt; + int cut_L2_nTrackMultiplicities; + int cut_L2_trackMultiplicities[20]; + bool cut_L2_charge; + bool cut_L2_nSlowTracks; + float cut_L2_slowPtMax; + float cut_L2_basicRoI; + float cut_L2_nIsoTracks; + float cut_L2_leadingPt; + bool cut_L2_centerLeadingPt; + float cut_L2_sumPtRatio; + + // L2Match + int cut_L2_nMatchedTrackMultiplicities; + int cut_L2_matchedTrackMultiplicities[20]; + float cut_L2_minTauPt; + + + // EF + float cut_EF_EMEt; + float cut_EF_EtCalib; + float cut_EF_EMRadius; + float cut_EF_isoFrac; + float cut_EF_nTracksMin; + float cut_EF_nTracksMax; + float cut_EF_EMFrac; + float cut_EF_PtMaxTrack; + + +}; + +int TTP_loop(TTree * tree, TrigTauFlags::TRIGGERMENU menu = TrigTauFlags::TAU16I)//int id) +{ + TauCuts cuts; + setCuts(menu, cuts); + + // -- Initialization ---------------------- + TrigTauEvent * event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch",&event) ; + + tree->SetBranchStatus("*",1) ; + + int nL1 = 0; + int nL2Calo = 0; + int nL2Track = 0; + int nEF = 0; + int nEvtL1 = 0; + int nEvtL2Calo = 0; + int nEvtL2Track = 0; + int nEvtEF = 0; + int nDecL1 = 0; + int nDecL2 = 0; + int nDecEF = 0; + + int nev = int(tree->GetEntries() ); + for(int iev = 0; iev<nev; ++iev) + { + event->reset() ; + tree->GetEvent(iev) ; + //=============================== Loop over event ================= + + // Check TriggerDecision + bool decL1 = event->decision.passedL1(menu); + bool decL2 = event->decision.passedL2(menu); + bool decEF = event->decision.passedEF(menu); + + nDecL1 += int(decL1); + nDecL2 += int(decL2); + nDecEF += int(decEF); + + // Start from L1 + bool foundL1 = false; + bool foundL2Calo = false; + bool foundL2Track = false; + bool foundEF = false; + for(unsigned int iL1 = 0; iL1 < event->nTauL1(); ++iL1) + { + const TrigTauL1Object * l1 = &event->tauL1Entry(iL1); + + + if( !passedL1(cuts,*l1) ) + { + // if(decL1 ){ cout << "found trigDec for "; printL1(*l1);}//be aware of other good L1 in the event + continue; + }//else if( !decL1 ) { cout << "no trigDec for "; printL1(*l1); } + nL1++; + foundL1 = true; + + // in C++ we can use bestMatch function, but not in the macro + //int iL2 = event->bestMatch(*l1, event->tauL2.begin() , event->tauL2.end() ); + const TrigTauL2Object * l2(0); + bool found = false; + for(unsigned int iL2 = 0; !found && iL2 < event->nTauL2(); ++iL2) + { + l2 = &(event->tauL2Entry(iL2)); + if( event->same(*l1, *l2) ) found = true; + } + if( !found ) continue; + if( !passedL2Calo(cuts,*l2) ) continue; + nL2Calo++; + foundL2Calo = true; + + if( !passedL2Track(cuts,*l2) ) + { + continue; + }//else if( !decL2 ) { cout << "no trigDec for :\n"; printL2Calo(*l2); printL2ID(cuts,*l2); } + + nL2Track++; + foundL2Track = true; + + const TrigTauRecEFObject * ef(0); + found = false; + for(unsigned int iEF = 0; !found && iEF < event->nTauEF(); ++iEF) + { + ef = &event->tauEFEntry(iEF); + if( ef->m_roiID == l2->m_roiID ){ found = true ;} + } + if( !found ) continue; + if( !passedEF(cuts,*ef) ) + { + //if( decEF ){ cout << "found trigDec for"; printEF(*ef);} + continue; + }//else if( !decEF ) { cout << "no trigDec for "; printEF(*ef); } + nEF++; + foundEF = true; + } // end L1 loop + + if( foundL1 ) nEvtL1++; + if( foundL2Calo ) nEvtL2Calo++; + if( foundL2Track ) nEvtL2Track++; + if( foundEF ) nEvtEF++; + + }// end loop over events + + + cout << " Nevt = " << nev << endl; + cout << " L1 eff/event = " << float(nEvtL1)/float(nev) << " TriggerDecision : " << float(nDecL1)/float(nev)<< endl; + cout << " L2Calo eff/event = " << float(nEvtL2Calo)/float(nev) <<endl; + cout << " L2Calo+Track eff/event = " << float(nEvtL2Track)/float(nev) << " TriggerDecision : " << float(nDecL2)/float(nev)<<endl; + cout << " EF eff/event = " << float(nEvtEF)/float(nev) << " TriggerDecision : " << float(nDecEF)/float(nev)<<endl; + + + return 0; +} + +//================================================================== +// yes, these functions can be added to TauCuts structure. +bool passedL1(const TauCuts& cuts, const TrigTauL1Object & ll1) +{ + if( cuts.cut_L1_TauClus >= ll1.m_TauEnergy ) return false; + if( cuts.cut_L1_EmIsol < ll1.m_EmIsol ) return false; + if( cuts.cut_L1_HdIsol < ll1.m_HdIsol ) return false; + return true; +} + +bool passedL2Calo(const TauCuts& cuts, const TrigTauL2Object & ll2) +{ + if( cuts.cut_L2_EMRadius <= ll2.m_EMRadius ) return false; + if( cuts.cut_L2_isoFrac <= ll2.m_isoFrac ) return false; + if( cuts.cut_L2_stripWidth2 <= ll2.m_stripWidth2 ) return false; ; + if( cuts.cut_L2_EtCalib > ll2.m_EtCalib ) return false; ; + return true; +} +bool passedL2Track(const TauCuts& cuts, const TrigTauL2Object & ll2) +{ + int nIso = 0; + int nSlow = 0; + int nTrack = 0; + int charge = 0; + float leadPt = 0; + + float sumPtCore = 0; + float sumPtIsol = 0; + + TLorentzVector base; + if( cuts.cut_L2_centerLeadingPt ) + { + for(unsigned int itr = 0; itr < ll2.nTracks(); ++itr ) + { + const TrigTauTrack * track = &ll2.track(itr); + float pt = track->Pt(); + if( pt < cuts.cut_L2_minPt ) continue; + if( leadPt < pt ) leadPt = pt; + base = *track; + } + + if( leadPt <1 ) base = ll2; + } + + + + for(unsigned int itr = 0; itr < ll2.nTracks(); ++itr ) + { + const TrigTauTrack * track = &ll2.track(itr); + float pt = track->Pt(); + if( pt < cuts.cut_L2_minPt ) continue; + + float dR = ll2.DeltaR(*track); + if( dR > 0.3*sqrt(2) ) { // something must be wrong here plot it + cout << " Strange track! dR="<< dR<<": TrigTau_phi= "<< ll2.Phi() << ", eta= "<<ll2.Eta() << endl + << " track _phi= "<< track->Phi() << ", eta= "<< track->Eta() + << ", pt="<< track->Pt() << endl; + } + if( dR > cuts.cut_L2_basicRoI ) { nIso++; sumPtIsol += track->Pt(); continue; } + else + nTrack++; + charge += track->charge(); + sumPtCore += track->Pt(); + if( pt < cuts.cut_L2_slowPtMax ) nSlow++; + } + + bool goodMultiplicity = false; + if( cuts.cut_L2_charge ) + { + if( nTrack %2 == 1 ) + { if( abs(charge) == 1 ) goodMultiplicity = true; } + else + { if( abs(charge) == 0 || abs(charge) == 2 ) goodMultiplicity = true; } + if( !goodMultiplicity ) return false; + } + + if( cuts.cut_L2_nSlowTracks < nSlow ) return false; + if( cuts.cut_L2_nIsoTracks < nIso ) return false; + if( cuts.cut_L2_leadingPt > leadPt ) return false; ; + + if( sumPtCore <1 ) sumPtCore = 40000; + if( cuts.cut_L2_sumPtRatio < sumPtIsol/sumPtCore ) return false; + + goodMultiplicity = false; + for(unsigned int imult = 0; !goodMultiplicity && imult < cuts.cut_L2_nTrackMultiplicities; ++imult ) + if( cuts.cut_L2_trackMultiplicities[imult] == nTrack ) goodMultiplicity = true; + if( !goodMultiplicity ) return false; + + goodMultiplicity = false; + for(unsigned int imult = 0;!goodMultiplicity && imult < cuts.cut_L2_nMatchedTrackMultiplicities; ++imult ) + if( cuts.cut_L2_matchedTrackMultiplicities[imult] == ll2.m_nMatchedTracks ) goodMultiplicity = true; + if( !goodMultiplicity ) return false; + + if( cuts.cut_L2_minTauPt > ll2.Pt() ) return false; ; + + return true; +} + +bool passedEF(const TauCuts& cuts, const TrigTauRecEFObject & lef) +{ + if( cuts.cut_EF_EMRadius < lef.m_EMRadius ) return false; + if( cuts.cut_EF_isoFrac < lef.m_isoFrac ) return false; + if( cuts.cut_EF_nTracksMin > lef.nTracks() ) return false; + if( cuts.cut_EF_nTracksMax < lef.nTracks() ) return false; + if( cuts.cut_EF_EtCalib > lef.Et() ) return false; + if( lef.leadingTrack() && cuts.cut_EF_PtMaxTrack > lef.leadingTrack()->Pt() ) return false; + float emet=lef.m_energy/cosh(lef.m_caloEta); + if( cuts.cut_EF_EMEt > emet ) return false; + + float EMFrac = lef.m_etEMCalib/(lef.m_etEMCalib+lef.m_etHadCalib); + if( cuts.cut_EF_EMFrac > EMFrac ) return false; + + return true; +} + +//============================================================================== + +void setCuts(TrigTauFlags::TRIGGERMENU menu, TauCuts &cuts) +{ + if( menu == TrigTauFlags::TAU16I ) + { + cuts.cut_L1_TauClus = 11000; + cuts.cut_L1_EmIsol = 6000; + cuts.cut_L1_HdIsol = 999000; + + cuts.cut_L2_EMRadius = 0.0160; + cuts.cut_L2_isoFrac = 0.65; + cuts.cut_L2_stripWidth2 = 0.051; + cuts.cut_L2_EtCalib = 17000; + + + cuts.cut_L2_minPt = 1500; + cuts.cut_L2_nTrackMultiplicities = 7; + cuts.cut_L2_trackMultiplicities[0] = 1; + cuts.cut_L2_trackMultiplicities[1] = 2; + cuts.cut_L2_trackMultiplicities[2] = 3; + cuts.cut_L2_trackMultiplicities[3] = 4; + cuts.cut_L2_trackMultiplicities[4] = 5; + cuts.cut_L2_trackMultiplicities[5] = 6; + cuts.cut_L2_trackMultiplicities[6] = 7; + cuts.cut_L2_charge = false; + cuts.cut_L2_nSlowTracks = 2; + cuts.cut_L2_slowPtMax = 7500; + cuts.cut_L2_basicRoI = 0.15; + cuts.cut_L2_nIsoTracks = 99; + cuts.cut_L2_leadingPt = 5000; + cuts.cut_L2_centerLeadingPt = true; + cuts.cut_L2_sumPtRatio = 0.1; + + cuts.cut_L2_nMatchedTrackMultiplicities = 7; + cuts.cut_L2_matchedTrackMultiplicities[0] = 1; + cuts.cut_L2_matchedTrackMultiplicities[1] = 2; + cuts.cut_L2_matchedTrackMultiplicities[2] = 3; + cuts.cut_L2_matchedTrackMultiplicities[3] = 4; + cuts.cut_L2_matchedTrackMultiplicities[4] = 5; + cuts.cut_L2_matchedTrackMultiplicities[5] = 6; + cuts.cut_L2_matchedTrackMultiplicities[6] = 7; + cuts.cut_L2_minTauPt = 0; + + + + cuts.cut_EF_EMEt = -10000; + cuts.cut_EF_EtCalib = 22000; + cuts.cut_EF_EMRadius = 0.1; + cuts.cut_EF_isoFrac = 0.3; + cuts.cut_EF_nTracksMin = 1; + cuts.cut_EF_nTracksMax = 8; + cuts.cut_EF_EMFrac = -10; + cuts.cut_EF_PtMaxTrack = 7000; + + }else{ + cout << " The cuts for this menu are not yet in this macro\n"; + } +} + +//====================================================================================== +// Print functions + +void printL1(const TrigTauL1Object & ll1 ) +{ + cout << "L1 : TauEn="<< ll1.m_TauEnergy<< ", EmIsol="<< ll1.m_EmIsol + << ", HdIsol="<< ll1.m_HdIsol << endl; +} +void printL2Calo(const TrigTauL2Object & ll2 ) +{ + cout << "L2Calo : EMRad="<<ll2.m_EMRadius << ", IsoFrac="<< ll2.m_isoFrac + << ", stripWidth2="<< ll2.m_stripWidth2 << ", EtCalib="<< ll2.m_EtCalib + << " " << ll2.m_eCalib/cosh(ll2.Eta())<< endl; +} + +void printL2ID(const TauCuts& cuts, const TrigTauL2Object & ll2 ) +{ + int nIso = 0; + int nSlow = 0; + int nTrack = 0; + int charge = 0; + float leadPt = 0; + + for(unsigned int itr = 0; itr < ll2.nTracks(); ++itr ) + { + const TrigTauTrack * track = &ll2.track(itr); + float pt = track->Pt(); + if( pt < cuts.cut_L2_minPt ) continue; + float dR = ll2.dRWithCluster(*track); + + if( dR > cuts.cut_L2_basicRoI ) { nIso++; continue; } + nTrack++; + charge += track->charge(); + if( pt < cuts.cut_L2_slowPtMax ) nSlow++; + if( leadPt < pt ) leadPt = pt; + } + + cout << "L2ID : nTracks="<< nTrack << ", nSlow(pT<"<<cuts.cut_L2_slowPtMax<<")="<< nSlow<<", nIso="<< nIso + << ", leadPt="<<leadPt<< endl; + cout << "L2Match : nMatchedTracks="<< ll2.m_nMatchedTracks<< endl; +} + +void printEF(const TrigTauRecEFObject & lef) +{ + float emet=lef.m_energy/cosh(lef.m_caloEta); + float EMFrac = lef.m_etEMCalib/(lef.m_etEMCalib+lef.m_etHadCalib); + cout << "EF : nTracks="<<lef.nTracks(); + if(lef.leadingTrack()) cout << ", leadPt="<<lef.leadingTrack()->Pt(); + cout << ", EtCalib="<<lef.Et()<<", EMEt="<<emet <<endl + << ", EmRad="<< lef.m_EMRadius<<", IsoFrac="<< lef.m_isoFrac<< ", EMFrac="<< EMFrac << endl; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/cutStudy.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/cutStudy.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0ed6b489081909d3670a2d44fca57462a104a3ac --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/cutStudy.cxx @@ -0,0 +1,468 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +void cutStudy() +{ + TrigTauFlags::TRIGGERMENU menu = TrigTauFlags::TAU25I; + + TChain * chain = new TChain("eventTree"); + oSampleTTP04(5107,chain); + oSampleTTP04(5862,chain); + oSampleTTP04(5189,chain); + + doSet(chain, menu, 0); + doSet(chain, menu, 1); + doSet(chain, menu, 3); + + TChain * chain1 = new TChain("eventTree"); + oSampleTTP04(5009,chain1); + oSampleTTP04(5010,chain1); + oSampleTTP04(5011,chain1); + oSampleTTP04(5012,chain1); + + int nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel; + //cutStudy(chain1, menu, nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel, false); + //plotAllEfficiencies(-1,"dijet"); + + + + +} + + +void doSet(TTree * chain, TrigTauFlags::TRIGGERMENU menu, int nprong) +{ + int nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel; + TString nprStr = ""; + if( nprong == 1 ) nprStr = ".1pr"; + else if ( nprong == 3 ) nprStr = ".3pr"; + + TString baseName = TString("signal_truth")+nprStr; + cout << baseName<<endl; + cutStudy(chain, menu, nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel, true, nprong, false, false, false); + plotAllEfficiencies(-1,baseName); + + baseName = TString("signal_offline")+nprStr; + cout << baseName<<endl; + cutStudy(chain, menu, nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel, true, nprong, true, true, false); + plotAllEfficiencies(-1,baseName); + + baseName = TString("signal_tauRec")+nprStr; + cout << baseName<<endl; + cutStudy(chain, menu, nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel, true, nprong, true, false, false); + plotAllEfficiencies(-1,baseName); + + baseName = TString("signal_tau1p3p")+nprStr; + cout << baseName<<endl; + cutStudy(chain, menu, nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel, true, nprong, false, true, false); + plotAllEfficiencies(-1,baseName ); + + baseName = TString("signal_bothoffline")+nprStr; + cout << baseName<<endl; + cutStudy(chain, menu, nEvent, nL1Sel, nL2Calo, nL2Sel, nEFSel, true, nprong, true, true, true); + plotAllEfficiencies(-1,baseName); +} + + +void cutStudy(TTree * tree, + TrigTauFlags::TRIGGERMENU menu1, + int & nEvent , int & nL1Sel, + int & nL2Calo, int & nL2Sel, int & nEFSel, + bool signal=false, bool nprong = 0, + bool dotauRec=false, bool dotau1p3p=false, bool bothoffline=false ) +{ + + TrigTauHistogram::HISTTYPE histType=TrigTauHistogram::PTHIST; + + //==================================================== + + //gROOT->cd(); + + // Open file +// TFile* file = new TFile(filename); +// if (!file->IsOpen()) { +// cerr << "Can't open file " << filename << endl; +// return; +// } + + // Initialize tree + // TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cout << " Usage .x cutStudy(tree, menu)\n"; + return; + } + + //=================================================== + // MC truth + + TrigTauMCTauList truthList; + truthList.setMaxVisEta(2.5); + truthList.setMinVisPt(menu1); + + if( nprong == 1 ) truthList.select1Prong(); + else if( nprong == 3 ) truthList.select3Prong(); + + truthList.setRecoMatchdR(0.2); + bool checkOffline = true; + // TAU1P3P, TAUREC, EITHERTAU, BOTHTAU + TrigTauMCTauList::OFFLINESELECTION offlineType; + if( dotauRec && dotau1p3p ) { + if( bothoffline ) offlineType= TrigTauMCTauList::BOTHTAU; + else offlineType= TrigTauMCTauList::EITHERTAU; + }else if (dotauRec ) offlineType= TrigTauMCTauList::TAUREC; + else if (dotau1p3p ) offlineType= TrigTauMCTauList::TAU1P3P; + else checkOffline = false; + + //=================================================== + + nEvent = 0; + nL1Sel = 0; + nL2Calo = 0; + nL2Sel = 0; + nEFSel = 0; + + + + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + tree->SetBranchStatus("mcEvent*", 1); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // Also set an L1 MET cut if desired + analyzer.trigMan.setL1MET(0.); + TrigTauSelectionManager trigMan1; + trigMan1.setMenuVersion(TrigTauSelectionManager::MENU13030pre); + trigMan1.setTauMenu(menu1); + + trigMan1.l1Sel.setHistDebug(histType); + trigMan1.l2CalSel.setHistDebug(histType); + trigMan1.l2TrkSel.setHistDebug(histType); + trigMan1.efSel.setHistDebug(histType); + + + //trigMan1.setL2CalOnly(false); + bool checkL2Cal = true; + + + // Loop over all events + int nev = int(tree->GetEntries()); + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + + // ============ Select type of events (e.g. signal) ================ + if( signal ) { + truthList.fillPureList(&event->mcEvent); + truthList.fillGoodList(); + if( checkOffline ) truthList.requireRecoMatch(*event, offlineType); + if( truthList.nMCTauGood() ==0 ) continue; + + //================================================================== + } + + nEvent++; + + + // Analyze this event + analyzer.chainList.fillChainList(event); + + bool pass = false; + + + // Look for L1 pass + unsigned int numCh = analyzer.chainList.nTrigChains(); + for (unsigned int iCh1=0; iCh1 < numCh; ++iCh1) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + if( !ch1.L1 ) continue; + + if( signal) // make sure that this is correct RoI + { + bool matchTruth = false; + const TrigTauL1Object* l1 = ch1.L1; + for(unsigned int iTrue = 0; iTrue < truthList.nMCTauGood(); ++iTrue) + { + const TrigTauMCTau * truth = &truthList.mcTauGoodEntry(iTrue); + if( truth->DeltaR(*l1)<0.2 ) matchTruth=true; + } + if( !matchTruth ) continue; + } + + if (!trigMan1.passedL1(ch1)){ + continue; + } + pass = true; + if (pass) break; + } + + + if (!pass) continue; + nL1Sel++; + + // Look for L2Calo pass + if( checkL2Cal ){ + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + if( !ch1.L2 ) continue; + + if( signal) // make sure that this is correct RoI + { + bool matchTruth = false; + const TrigTauL2Object* l2 = ch1.L2; + for(unsigned int iTrue = 0; iTrue < truthList.nMCTauGood(); ++iTrue) + { + const TrigTauMCTau * truth = &truthList.mcTauGoodEntry(iTrue); + if( truth->DeltaR(*l2)<0.2 ) matchTruth=true; + } + if( !matchTruth ) continue; + } + + if (!trigMan1.passedL2Cal(ch1)) continue; + + pass = true; + if (pass) break; + } + + if (!pass) continue; + nL2Calo++; + } + + // continue; + + // Look for L2 pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + if( !ch1.L2 ) continue; + + if( signal) // make sure that this is correct RoI + { + bool matchTruth = false; + const TrigTauL2Object* l2 = ch1.L2; + for(unsigned int iTrue = 0; iTrue < truthList.nMCTauGood(); ++iTrue) + { + const TrigTauMCTau * truth = &truthList.mcTauGoodEntry(iTrue); + if( truth->DeltaR(*l2)<0.2 ) matchTruth=true; + } + if( !matchTruth ) continue; + } + + if (!trigMan1.passedL2(ch1)) continue; + + pass = true; + if (pass) break; + } + + if (!pass) continue; + nL2Sel++; + + + + // Look for EF pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + if( !ch1.EF ) continue; + + if( signal) // make sure that this is correct RoI + { + bool matchTruth = false; + const TrigTauRecEFObject* ef = ch1.EF; + for(unsigned int iTrue = 0; iTrue < truthList.nMCTauGood(); ++iTrue) + { + const TrigTauMCTau * truth = &truthList.mcTauGoodEntry(iTrue); + if( truth->DeltaR(*ef)<0.2 ) matchTruth=true; + } + if( !matchTruth ) continue; + } + + if (!trigMan1.passedEF(ch1)) continue; + pass = true; + if (pass) break; + } + + if (!pass) continue; + nEFSel++; + + + } // end loop over events + + // trigMan1.print(); + // trigMan2.print(); + //trigMan1.l2CalSel.histManager()->plotAll(); + trigMan1.l1Sel.histManager()->plotAllEfficiencies(); + trigMan1.l2CalSel.histManager()->plotAllEfficiencies(); + trigMan1.l2TrkSel.histManager()->plotAllEfficiencies(); + trigMan1.efSel.histManager()->plotAllEfficiencies(); + + + cout << "N event " << nEvent << endl + << " L1 " << nL1Sel << " " << float(nL1Sel)/float(nEvent) << " " << float(nL1Sel)/float(nEvent)<< endl + << " L2Cal " << nL2Calo << " " << float(nL2Calo)/float(nEvent) << " " << float(nL2Calo)/float(nL1Sel)<< endl + << " L2Trk " << nL2Sel << " " << float(nL2Sel)/float(nEvent) << " " << float(nL2Sel)/float(nL2Calo)<< endl + << " EF " << nEFSel << " " << float(nEFSel)/float(nEvent) << " " << float(nEFSel)/float(nL2Sel)<< endl; + + cout << " \& "<< nEvent << " & " << setprecision(3) + << float(nL1Sel)/float(nEvent)<< " & " << setprecision(3) + << float(nL2Calo)/float(nL1Sel)<< " & "<< setprecision(3) + << float(nL2Sel)/float(nL2Calo) << " & "<< setprecision(3) + << float(nEFSel)/float(nL2Sel)<< " \\ \n"; + + + delete event; + //delete tree; + // delete file; + + cout << " Use menu " << menu1.menuName(menu1) << endl; + + + return; +} + + +int plotAllEfficiencies(int select == 3, TString baseFileName = "") +{ + + TString name = "_pt_eff"; + + TString histList[10]; + TString labels[10]; + int index = 0; + + gStyle->SetPadGridY(true); + gStyle->SetPadGridX(true); + + + if( select == 0 ) + { + //histList[index] ="EMEnergy_1"; labels[index] = "EMEnergy Cut"; index++; + histList[index] ="TauEnergy_2"; labels[index] = "TauEnergy Cut"; index++; + histList[index] ="EmIsol_3"; labels[index] = "EmIsol Cut"; index++; + //histList[index] ="HadIsol_4"; labels[index] = "HadIsol Cut"; index++; + //histList[index] ="EmCore_5"; labels[index] = "EmCore Cut"; index++; + //histList[index] ="HadCore_6"; labels[index] = "HadCore Cut"; index++; + + } else if( select == 1 ) { + //histList[index] ="et_1"; labels[index] = "Et Cut"; index++; + histList[index] ="etCalib_2"; labels[index] = "EtCalib Cut"; index++; + //histList[index] ="nStrips_3"; labels[index] = "nStrips Cut"; index++; + histList[index] ="stripWidth_4"; labels[index] = "stripWidth Cut"; index++; + histList[index] ="emrad_5"; labels[index] = "EMRad Cut"; index++; + histList[index] ="isoFrac_6"; labels[index] = "IsoFrac Cut"; index++; + //histList[index] ="EmEnWidth_7"; labels[index] = "EmEnWidth Cut"; index++; + + }else if ( select == 2 ) { + + histList[index] ="ntrkExist_1"; labels[index] = "Tracks found"; index++; + histList[index] ="ntrk_2"; labels[index] = "Ntrk Cut"; index++; + histList[index] ="leadPt_3"; labels[index] = "Leading Pt Cut"; index++; + histList[index] ="nSlow_4"; labels[index] = "nSlow Cut"; index++; + histList[index] ="nIso_5"; labels[index] = "nIso Cut"; index++; + histList[index] ="nMatched_6"; labels[index] = "nMatched Cut"; index++; + histList[index] ="Q_7"; labels[index] = "Charge Cut"; index++; + histList[index] ="sumPtCore_8"; labels[index] = "sumPtRatio Cut"; index++; + histList[index] ="Et_trkEM_9"; labels[index] = "Et(trk+EM) Cut"; index++; + + }else if(select == 3 ) { + histList[index] ="etCalibEF_1"; labels[index] = "EtCalib Cut"; index++; + histList[index] ="ntrkMinEF_2"; labels[index] = "ntrkMin Cut"; index++; + histList[index] ="ntrkMaxEF_3"; labels[index] = "ntrkMax Cut"; index++; + histList[index] ="emradEF_4"; labels[index] = "EMRadius Cut"; index++; + histList[index] ="isoFracEF_5"; labels[index] = "isoFraction Cut"; index++; + histList[index] ="emFracEF_6"; labels[index] = "EMFraction Cut"; index++; + histList[index] ="leadPtEF_7"; labels[index] = "Leading pT Cut"; index++; + //histList[index] ="emEtEF_8"; labels[index] = "EM Et Cut"; index++; + + }else if(select == 4 ) { + name = "_pt"; + histList[index] ="baseL1_0"; labels[index] = "After Soft L1"; index++; + histList[index] ="baseL2Cal_0"; labels[index] = "L2Calo input"; index++; + histList[index] ="baseL2Trk_0"; labels[index] = "L2Trk input"; index++; + histList[index] ="baseEF_0"; labels[index] = "EF input"; index++; + histList[index] ="emEtEF_8"; labels[index] = "EF output"; index++; + + }else if ( select == -1 ){ + if( baseFileName == "" ) + { + cout << " Please use .x plotAllEfficiencies.cxx(-1, baseFileName)\n"; + return 1; + } + TCanvas * c1 = (TCanvas * )gROOT->Get("c1"); + if( c1 ) delete c1; + c1 = new TCanvas("c1","Selected",10,10,800,620); + plotAllEfficiencies(0, baseFileName); + c1->Print(baseFileName+name+ ".eps("); + //c1->Print(baseFileName+".l1"+name+".eps"); + plotAllEfficiencies(1, baseFileName); + c1->Print(baseFileName+name+ ".eps"); + //c1->Print(baseFileName+".l2cal"+name+".eps"); + plotAllEfficiencies(2, baseFileName); + c1->Print(baseFileName+name+ ".eps"); + //c1->Print(baseFileName+".l2trk"+name+".eps"); + plotAllEfficiencies(3, baseFileName); + c1->Print(baseFileName+name+ ".eps"); + //c1->Print(baseFileName+".ef"+name+".eps"); + plotAllEfficiencies(4, baseFileName); + c1->Print(baseFileName+name+ ".eps)"); + //c1->Print(baseFileName+".level"+name+".eps"); + return 0; + } + + for(unsigned int i = 0; i < index ; ++i) + { + histList[i].Append(name); + } + + // set title + TH1 * h1 = (TH1*)gROOT->Get(histList[0]); + if( h1 == 0 ) {cout << " histogram " << histList[0] << " not found \n"; return 1;} + if( select == 0 ) h1->SetTitle(baseFileName+ " L1 selection"); + else if( select == 1 ) h1->SetTitle(baseFileName+ " L2 Calo selection"); + else if( select == 2 ) h1->SetTitle(baseFileName+ " L2 Trk selection"); + else if( select == 3 ) h1->SetTitle(baseFileName+ " EF selection"); + + + + // draw + + TH1F * hist = (TH1F*)gROOT->Get(histList[0]); + //float xmin = hist->GetXaxis()->GetXmin(); + TLegend *legend = new TLegend(0.5,0.2,0.7,0.5); + + hist->Draw(); legend->AddEntry(hist, labels[0], "l"); + for(unsigned int ihist = 1; ihist < index; ++ihist) + { + hist = (TH1F*)gROOT->Get(histList[ihist]); + hist->Draw("same"); + legend->AddEntry(hist, labels[ihist], "l"); + } + legend->Draw(); + return 0; +} + + + + +/* +TChain * chain = new TChain("eventTree") +oSampleTTP04(5107,chain) +oSampleTTP04(5862,chain) +oSampleTTP04(5189,chain) +.x cutStudy.cxx(chain, true) +.x plotAllEfficiencies.cxx(-1) + +TChain * chain = new TChain("eventTree") +oSampleTTP04(5009,chain) +oSampleTTP04(5010,chain) +oSampleTTP04(5011,chain) +oSampleTTP04(5012,chain) +.x cutStudy.cxx(chain) + +*/ + + + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effMultiPlots.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effMultiPlots.cxx new file mode 100755 index 0000000000000000000000000000000000000000..b4e79f5098c932823c089bec2c6d085bde3864a9 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effMultiPlots.cxx @@ -0,0 +1,462 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//void effMultiPlots(const char* filename="ntuples/trigtau.AOD.root", +// TString mode="all") { +void effMultiPlots(TTree * tree, + TString mode="all") { + + gROOT->cd(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + + /* + // Open file + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + // Initialize tree + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + */ + + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // We will use our own trigger manager (although we could just use + // the one in TrigTauAnalyzer). + TrigTauSelectionManager trigMan; + + // Pick a menu set (12.0.6 by default) + // trigMan.setMenuVersion(TrigTauSelectionManager:: MENU1206); + // trigMan.setMenuVersion(TrigTauSelectionManager::MENU13020); + //trigMan.setMenuVersion(TrigTauSelectionManager::MENU13030pre); + trigMan.setMenuVersion(TrigTauSelectionManager::MENU1400); + // trigMan.setMenuVersion(TrigTauSelectionManager::MENUJUNE07); + + // Also set an L1 MET cut if desired + trigMan.setL1MET(0.); + + // Set fiducial cuts + analyzer.truthList.setMinVisPt(12.); + analyzer.truthList.setMaxVisEta(2.5); + + // Select a particular tau decay mode (if desired) + // Could also add pi, rho, etc. + TString append; + if (mode == "all") { + } + else if (mode == "1pr") { + append += "_1pr"; + analyzer.truthList.select1Prong(); + } + else if (mode == "3pr") { + append += "_3pr"; + analyzer.truthList.select3Prong(); + } + else { + cout << "Unkown decay mode: " << mode << endl; + delete event; delete tree; delete file; + return; + } + + // Formatting commands + gStyle->SetOptTitle(0); + gStyle->SetOptStat(0); + gROOT->cd(); + + // Set up the different menus to plot + const int nMenus = 7; + TrigTauSelectionManager::CUTLEVEL cutLevel = TrigTauSelectionManager::LOOSE; + TrigTauFlags::TRIGGERMENU theMenu[nMenus]; + theMenu[0] = TrigTauFlags::TAU12; + theMenu[1] = TrigTauFlags::TAU16I; + theMenu[2] = TrigTauFlags::TAU20I; + theMenu[3] = TrigTauFlags::TAU29I; + theMenu[4] = TrigTauFlags::TAU38I; + theMenu[5] = TrigTauFlags::TAU50; + theMenu[6] = TrigTauFlags::TAU84; + + float Threshold[nMenus]={15.,20.,25.,35.,45.,60., 100.}; + + TrigTauMCTauList::OFFLINESELECTION offlineType = TrigTauMCTauList::EITHERTAU; + + TString test[nMenus]; + for(unsigned int im = 0; im < nMenus; ++im ) + test[im] = TrigTauFlags::menuName(theMenu[im]); + + + int npt =50; + float minpt = 0; + float maxpt = 120; + + // Create histograms to hold triggered object counts by pt and eta + TH1F* hMC_InVisPt = new TH1F("", "", npt, minpt, maxpt); // MC visible (denominator) + TH1F* hMCVisPt = new TH1F("", "", npt, minpt, maxpt); // MC visible (denominator) + TH1F* hL1VisPt[nMenus]; // L1 selected (numerator) + TH1F* hL2VisPt[nMenus]; // L2 selected (numerator) + TH1F* hEFVisPt[nMenus]; // EF selected (numerator) + TH1F* hL1PtEff[nMenus]; + TH1F* hL2PtEff[nMenus]; + TH1F* hEFPtEff[nMenus]; + + TH1F* hntrak = new TH1F("","",20,0.,10.); + + TH1F* hEFnTracks[nMenus]; + + TH1F* hL21PtEff[nMenus]; + TH1F* hEFL2PtEff[nMenus]; + + TH1F* hMC_InVisEta = new TH1F("", "", 31, -3.1, 3.1); + TH1F* hMCVisEta = new TH1F("", "", 31, -3.1, 3.1); + TH1F* hL1VisEta[nMenus]; + TH1F* hL2VisEta[nMenus]; + TH1F* hEFVisEta[nMenus]; + TH1F* hL1EtaEff[nMenus]; + TH1F* hL2EtaEff[nMenus]; + TH1F* hEFEtaEff[nMenus]; + + TH1F* hL21EtaEff[nMenus]; + TH1F* hEFL2EtaEff[nMenus]; + + int nMatch[nMenus]; + int nL1passed[nMenus]; + int nL2passed[nMenus]; + int nEFpassed[nMenus]; + int n_OfflineMatchEvent[nMenus]; + int n_L1MatchEvent[nMenus]; + int n_L2MatchEvent[nMenus]; + int n_EFMatchEvent[nMenus]; + + + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) { + nMatch[iMenu]=0; + nL1passed[iMenu]=0; + nL2passed[iMenu]=0; + nEFpassed[iMenu]=0; + n_OfflineMatchEvent[iMenu]=0; + n_L1MatchEvent[iMenu]=0; + n_L2MatchEvent[iMenu]=0; + n_EFMatchEvent[iMenu]=0; + + hEFnTracks[iMenu] = new TH1F(*hntrak); + hL1VisPt[iMenu] = new TH1F(*hMCVisPt); + hL2VisPt[iMenu] = new TH1F(*hMCVisPt); + hEFVisPt[iMenu] = new TH1F(*hMCVisPt); + hL1PtEff[iMenu] = new TH1F(*hMCVisPt); + hL2PtEff[iMenu] = new TH1F(*hMCVisPt); + hEFPtEff[iMenu] = new TH1F(*hMCVisPt); + hL21PtEff[iMenu] = new TH1F(*hMCVisPt); + hEFL2PtEff[iMenu] = new TH1F(*hMCVisPt); + hL1PtEff[iMenu]->Sumw2(); + hL2PtEff[iMenu]->Sumw2(); + hEFPtEff[iMenu]->Sumw2(); + hL21PtEff[iMenu]->Sumw2(); + hEFL2PtEff[iMenu]->Sumw2(); + + hL1VisEta[iMenu] = new TH1F(*hMCVisEta); + hL2VisEta[iMenu] = new TH1F(*hMCVisEta); + hEFVisEta[iMenu] = new TH1F(*hMCVisEta); + hL1EtaEff[iMenu] = new TH1F(*hMCVisEta); + hL2EtaEff[iMenu] = new TH1F(*hMCVisEta); + hEFEtaEff[iMenu] = new TH1F(*hMCVisEta); + hL21EtaEff[iMenu] = new TH1F(*hMCVisEta); + hEFL2EtaEff[iMenu] = new TH1F(*hMCVisEta); + hL1EtaEff[iMenu]->Sumw2(); + hL2EtaEff[iMenu]->Sumw2(); + hEFEtaEff[iMenu]->Sumw2(); + hL21EtaEff[iMenu]->Sumw2(); + hEFL2EtaEff[iMenu]->Sumw2(); + } + + // Counters + int nEvent = 0; + int nTrue = 0; + int nGood = 0; + int nMatched = 0; + + TrigTauBugFix bugfix (TrigTauBugFix::TTP9, TrigTauBugFix::RDO); + + // Loop over all events + int nev = int(tree->GetEntries()); + //nev = 1000; + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + bugfix.fix(event); + + // Analyze this event + analyzer.analyze(event, true, offlineType); + + nEvent++; + nTrue += analyzer.truthList.nMCTauPure(); + nGood += analyzer.truthList.nMCTauGood(); + + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) { + nMatch[iMenu]=0; + nL1passed[iMenu]=0; + nL2passed[iMenu]=0; + nEFpassed[iMenu]=0; + } + // Loop over all good truth taus in this event + unsigned int nTau = analyzer.truthList.nMCTauGood(); + for(unsigned int itau = 0; itau < nTau; ++itau ) { + TrigTauMCTau* tau = &analyzer.truthList.mcTauGoodEntry(itau); + + float visPt = tau->visible().Pt()/1000.; + float visEta = tau->visible().Eta(); + + // Fill denominator with all good taus + hMC_InVisPt->Fill(visPt); + hMC_InVisEta->Fill(visEta); + + nMatched++; + + hMCVisPt->Fill(visPt); + hMCVisEta->Fill(visEta); + + // Now, loop through defined menus, apply selections, and look for + // a matching trigger object within the allowed dR distance. + // Note: The object passing L2 doesn't necessarily need to come + // from the ROI passing L1, but I think that is OK. + for(unsigned int iMenu = 0; iMenu<nMenus; iMenu++) { + + if(visPt> Threshold[iMenu]) nMatch[iMenu]++; + + // Select the new menu + trigMan.setTauMenu(theMenu[iMenu], cutLevel); + + // Refill the selected chain list based on the new menu + analyzer.chainList.fillTriggerList(trigMan); + + // Find a matching L1 object + TrigTauL1Object* l1Tau = analyzer.chainList.getL1Tau(*tau); + if (l1Tau != 0) { + // Found a L1 trigger within dR range, fill numerator histograms + // with MC truth Pt and Eta + hL1VisPt[iMenu]->Fill(visPt); + hL1VisEta[iMenu]->Fill(visEta); + if(visPt> Threshold[iMenu]) nL1passed[iMenu]++; + } + + // Because the dR range might be different between L1 and L2 + // it is possible (if unlikely) to find a L2 match without a L1. + // In reality, this probably never happens... + + // Find a matching L2 object + TrigTauL2Object* l2Tau = analyzer.chainList.getL2Tau(*tau); + if (l2Tau != 0) { + hL2VisPt[iMenu]->Fill(visPt); + hL2VisEta[iMenu]->Fill(visEta); + if(visPt> Threshold[iMenu]) nL2passed[iMenu]++; + } + + // Find a matching EF object + TrigTauRecEFObject* efTau = analyzer.chainList.getEFTau(*tau); + if (efTau != 0) { + hEFVisPt[iMenu]->Fill(visPt); + hEFVisEta[iMenu]->Fill(visEta); + if(visPt> Threshold[iMenu]) nEFpassed[iMenu]++; + if(visPt> Threshold[iMenu]) hEFnTracks[iMenu]->Fill((*efTau)->nTracks()); + } + + } // End of loop over menus + } // End of loop over good taus in the event + + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) { + + if(nMatch[iMenu]>0) n_OfflineMatchEvent[iMenu]++; + if(nL1passed[iMenu]>0) n_L1MatchEvent[iMenu]++; + if(nL2passed[iMenu]>0) n_L2MatchEvent[iMenu]++; + if(nEFpassed[iMenu]>0) n_EFMatchEvent[iMenu]++; + } + + } // end loop over events + + gROOT->cd(); + + // Make ratios + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) { + hL1PtEff[iMenu]-> Divide(hL1VisPt[iMenu], hMCVisPt, 1., 1., "B"); + hL2PtEff[iMenu]-> Divide(hL2VisPt[iMenu], hMCVisPt, 1., 1., "B"); + hEFPtEff[iMenu]-> Divide(hEFVisPt[iMenu], hMCVisPt, 1., 1., "B"); + + hL21PtEff[iMenu]-> Divide(hL2VisPt[iMenu], hL1VisPt[iMenu], 1., 1., "B"); + hEFL2PtEff[iMenu]-> Divide(hEFVisPt[iMenu], hL2VisPt[iMenu], 1., 1.,"B"); + + hL1EtaEff[iMenu]-> Divide(hL1VisEta[iMenu], hMCVisEta, 1., 1., "B"); + hL2EtaEff[iMenu]-> Divide(hL2VisEta[iMenu], hMCVisEta, 1., 1., "B"); + hEFEtaEff[iMenu]-> Divide(hEFVisEta[iMenu], hMCVisEta, 1., 1., "B"); + + hL21EtaEff[iMenu]->Divide(hL2VisEta[iMenu], hL1VisEta[iMenu], 1., 1., "B"); + hEFL2EtaEff[iMenu]->Divide(hEFVisEta[iMenu], hL2VisEta[iMenu], 1., 1., "B"); + } + + TString plotfile = "effMultiPlots"; + plotfile += append; + + // Titles + for(int i=0; i<nMenus; i++){ + hL1PtEff[i]->GetXaxis()->SetTitle("True visible E_{T} (GeV)"); + hL1PtEff[i]->GetYaxis()->SetTitle("L1 efficiency"); + hL2PtEff[i]->GetXaxis()->SetTitle("True visible E_{T} (GeV)"); + hL2PtEff[i]->GetYaxis()->SetTitle("L2 efficiency"); + hEFPtEff[i]->GetXaxis()->SetTitle("True visible E_{T} (GeV)"); + hEFPtEff[i]->GetYaxis()->SetTitle("Efficiency"); + } + + hL21PtEff[0]->GetXaxis()->SetTitle("True visible E_{T} (GeV)"); + hL21PtEff[0]->GetYaxis()->SetTitle("L2/L1 efficiency"); + hEFL2PtEff[0]->GetXaxis()->SetTitle("True visible E_{T} (GeV)"); + hEFL2PtEff[0]->GetYaxis()->SetTitle("EF/L2 efficiency"); + + hL1EtaEff[0]->GetXaxis()->SetTitle("True Visible Eta"); + hL1EtaEff[0]->GetYaxis()->SetTitle("L1 Efficiency"); + hL2EtaEff[0]->GetXaxis()->SetTitle("True Visible Eta"); + hL2EtaEff[0]->GetYaxis()->SetTitle("L2 Efficiency"); + hEFEtaEff[0]->GetXaxis()->SetTitle("True Visible Eta"); + hEFEtaEff[0]->GetYaxis()->SetTitle("Efficiency"); + + hL21EtaEff[0]->GetXaxis()->SetTitle("True Visible Eta"); + hL21EtaEff[0]->GetYaxis()->SetTitle("L2/L1 Efficiency"); + hEFL2EtaEff[0]->GetXaxis()->SetTitle("True Visible Eta"); + hEFL2EtaEff[0]->GetYaxis()->SetTitle("EF/L2 Efficiency"); + + int color[nMenus]; + color[0] = 51; + color[1] = 8; + color[2] = 60; + color[3] = 96; + color[4] = 66; + color[5] = 100; + color[6] = 84; + int style[nMenus]; + style[0] = 20; + style[1] = 26; + style[2] = 21; + style[3] = 24; + style[4] = 23; + style[5] = 25; + style[6] = 22; + + + //gStyle->SetHistLineWidth(2); + gStyle->SetCanvasColor(0); + + TCanvas * c4 = (TCanvas *) gROOT->Get("c4"); + if( c4 ) delete c4; + c4 = new TCanvas("c4","EF Selected",10,10,800,620); + c4->cd(); + gStyle->SetHistLineColor(1); + TLegend *l = new TLegend(0.75,0.2,0.9,0.5); + l->SetFillStyle(0); + int id = 2; + gStyle->SetHistLineColor(color[id]); + gStyle->SetMarkerStyle(style[id]); + gStyle->SetMarkerColor(color[id]); + gStyle->SetLineColor(color[id]); + gStyle->SetFillColor(0); + hEFPtEff[id]->SetLineColor(color[id]); + hEFPtEff[id]->UseCurrentStyle(); + hEFPtEff[id]->SetMaximum(1.05); + hEFPtEff[id]->Draw("P"); + l->AddEntry(hEFPtEff[id],test[id],"p"); + + // TLegend *l = new TLegend(0.13,0.65,0.25,0.85); + //l->SetFillStyle(0); + //hEFPtEff[2]->UseCurrentStyle(); + //hEFPtEff[2]->Draw("P"); + //l->AddEntry(hEFPtEff[2],"tau20i","p"); + + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) { + gStyle->SetHistLineColor(color[iMenu]); + //if(iMenu==3 || iMenu==5) continue; + + gStyle->SetMarkerColor(color[iMenu]); + gStyle->SetMarkerStyle(style[iMenu]); + gStyle->SetLineColor(color[iMenu]); + hEFPtEff[iMenu]->SetLineColor(color[iMenu]); + hEFPtEff[iMenu]->UseCurrentStyle(); + hEFPtEff[iMenu]->Draw("PSAME"); + l->AddEntry(hEFPtEff[iMenu],test[iMenu],"p"); + + //gStyle->SetMarkerStyle(style[iMenu]); + //gStyle->SetMarkerColor(color[iMenu]); + //hEFPtEff[iMenu]->UseCurrentStyle(); + //hEFPtEff[iMenu]->Draw("PSAME"); + //l->AddEntry(hEFPtEff[iMenu],test[iMenu],"p"); + } + + l->Draw("SAME"); + + ATLAS_LABEL(0.15,0.85); + + c4->Print(plotfile + ".eps"); + + + + for(unsigned int iMenu = 0; iMenu<nMenus; iMenu++) { + // Select the new menu + cout << endl << "Menu selection " << iMenu << endl << endl; + trigMan.setTauMenu(theMenu[iMenu], cutLevel); + trigMan.print(); + } + + for(unsigned int iMenu = 0; iMenu<nMenus; iMenu++) { + + cout<< "n_L1MatchEvent[iMenu] "<<n_L1MatchEvent[iMenu]<<endl; + cout<< "n_OfflineMatchEvent[iMenu] "<<n_OfflineMatchEvent[iMenu]<<endl; + + cout << " L1 efficiency menu "<<iMenu<<" is "<< ((float)n_L1MatchEvent[iMenu])/((float)n_OfflineMatchEvent[iMenu]) <<endl; + cout << " L2 efficiency menu "<<iMenu<<" is "<< ((float)n_L2MatchEvent[iMenu])/((float)n_OfflineMatchEvent[iMenu]) <<endl; + cout << " EF efficiency menu "<<iMenu<<" is "<< ((float)n_EFMatchEvent[iMenu])/((float)n_OfflineMatchEvent[iMenu]) <<endl; + } + + // Print out matching statistics + cout << "Events: " << nEvent << endl; + cout << "True Taus: " << nTrue << endl; + cout << "Good Taus: " << nGood << endl; + cout << "Matched Taus: " << nMatched << " -> " + << float(nMatched)/nEvent << " Matched/Ev" << endl; + + delete event; + delete tree; + // delete file; + + return; +} + +// double DeltaRad( TrigTauRecObject* t1, TrigTauMCTau* t2){ +// double dEta = t1->Eta() - t2->Eta(); +// double dPhi = t1->Phi() - t2->Phi(); +// if (dPhi > +TMath::Pi()) dPhi -= TMath::TwoPi(); +// if (dPhi < -TMath::Pi()) dPhi += TMath::TwoPi(); +// return float(dEta*dEta + dPhi*dPhi); +// } +// double DeltaRad( TrigTau1p3pObject* t1, TrigTauMCTau* t2){ +// double dEta = t1->Eta() - t2->Eta(); +// double dPhi = t1->Phi() - t2->Phi(); +// if (dPhi > +TMath::Pi()) dPhi -= TMath::TwoPi(); +// if (dPhi < -TMath::Pi()) dPhi += TMath::TwoPi(); +// return float(dEta*dEta + dPhi*dPhi); +// } + +void ATLAS_LABEL(Double_t x,Double_t y,Color_t color=1) { + + TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextFont(72); + l.SetTextColor(color); + l.DrawLatex(x,y,"ATLAS"); +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effSequencePlots.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effSequencePlots.cxx new file mode 100755 index 0000000000000000000000000000000000000000..e107c4a6474430a71f50645f9b3a6ef3fa02130d --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effSequencePlots.cxx @@ -0,0 +1,346 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// The following picks one macro and plots the efficiency vs. PT +// for L1, L2, and EF on the same plot. +// + +//void effSequencePlots(const char* filename="ntuples/trigtau.AOD.root", +// TString menu="tau25i", TString menuMET="00", +// TString mode="all") { +void effSequencePlots(TTree * tree, + TrigTauFlags::TRIGGERMENU menu, + TString mode="all") { + + gROOT->cd(); + gROOT->SetStyle("ATLAS"); + gROOT->ForceStyle(); + + //mode = "3pr";//;"all"; + + TrigTauMCTauList::OFFLINESELECTION offlineType = TrigTauMCTauList::EITHERTAU; + + TrigTauSelectionManager::CUTLEVEL cutLevel = TrigTauSelectionManager::LOOSE; + TrigTauBugFix bugfix (TrigTauBugFix::TTP9, TrigTauBugFix::RDO); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // Set up selection manager and process selection options + TString append; + + //analyzer.trigMan.setMenuVersion(TrigTauSelectionManager::MENU13030pre); + analyzer.trigMan.setMenuVersion(TrigTauSelectionManager::MENU1400); + + + gStyle->SetPadGridY(true); + gStyle->SetPadGridX(true); + + + + //gROOT->cd(); + + // Open file + /* + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + */ + + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + + append +="_"; + append += TrigTauFlags::menuName(menu); + analyzer.trigMan.setTauMenu(menu, cutLevel); + + + // Set fiducial cuts + analyzer.truthList.setMinVisPt(12.); + analyzer.truthList.setMaxVisEta(2.5); + + // Select a particular tau decay mode (if desired) + // Could also add pi, rho, etc. + if (mode == "all") { + } + else if (mode == "1pr") { + append += "_1pr"; + analyzer.truthList.select1Prong(); + } + else if (mode == "3pr") { + append += "_3pr"; + analyzer.truthList.select3Prong(); + } + else { + cout << "Unkown decay mode: " << mode << endl; + delete event; delete tree; delete file; + return; + } + + + // Formatting commands + gStyle->SetOptTitle(0); + gStyle->SetOptStat(0); + //gROOT->cd(); + + int npt =50; + float minpt = 0; + float maxpt = 120; + + + // Create histograms to hold triggered object counts by pt and eta + TH1F* hMCVisPt = new TH1F("hMCVisPt", "", npt, minpt, maxpt); // MC visible (denominator) + TH1F* hOffVisPt = new TH1F("hOffVisPt", "", npt, minpt, maxpt); // MC visible (denominator) + TH1F* hL1VisPt = new TH1F("hL1VisPt", "", npt, minpt, maxpt); + TH1F* hL2VisPt = new TH1F("hL2VisPt", "", npt, minpt, maxpt); + TH1F* hEFVisPt = new TH1F("hEFVisPt", "", npt, minpt, maxpt); + TH1F* hL1PtEff = new TH1F("hL1PtEff", "", npt, minpt, maxpt); + TH1F* hL2PtEff = new TH1F("hL2PtEff", "", npt, minpt, maxpt); + TH1F* hEFPtEff = new TH1F("hEFPtEff", "", npt, minpt, maxpt); + + TH1F* hMCVisEta = new TH1F("hMCVisEta", "", 31, -3.1, 3.1); + TH1F* hOffVisEta = new TH1F("hOffVisEta", "", 31, -3.1, 3.1); + TH1F* hL1VisEta = new TH1F("hL1VisEta", "", 31, -3.1, 3.1); + TH1F* hL2VisEta = new TH1F("hL2VisEta", "", 31, -3.1, 3.1); + TH1F* hEFVisEta = new TH1F("hEFVisEta", "", 31, -3.1, 3.1); + TH1F* hL1EtaEff = new TH1F("hL1EtaEff", "", 31, -3.1, 3.1); + TH1F* hL2EtaEff = new TH1F("hL2EtaEff", "", 31, -3.1, 3.1); + TH1F* hEFEtaEff = new TH1F("hEFEtaEff", "", 31, -3.1, 3.1); + + + hL1PtEff->Sumw2(); + hL2PtEff->Sumw2(); + hEFPtEff->Sumw2(); + + hL1EtaEff->Sumw2(); + hL2EtaEff->Sumw2(); + hEFEtaEff->Sumw2(); + + TH1F* hOffOPt = new TH1F("", "", npt, minpt, maxpt); // MC visible (denominator) + TH1F* hL1OPt = new TH1F(*hOffOPt); // L1 selected (numerator) + TH1F* hL2OPt = new TH1F(*hOffOPt); // L2 selected (numerator) + TH1F* hEFOPt = new TH1F(*hOffOPt); // EF selected (numerator) + TH1F* hL1PtEff_off = new TH1F(*hOffOPt); + TH1F* hL2PtEff_off = new TH1F(*hOffOPt); + TH1F* hEFPtEff_off = new TH1F(*hOffOPt); + + hL1PtEff_off->Sumw2(); + hL2PtEff_off->Sumw2(); + hEFPtEff_off->Sumw2(); + + //TrigTauBugFix bugfix(TrigTauBugFix::TTP5, TrigTauBugFix::RDO); + //bugfix.setTTPVersion(filename); + + + // Counters + int nEvent = 0; + int nTrue = 0; + int nGood = 0; + int nMatched = 0; + + // Loop over all events + int nev = int(tree->GetEntries()); + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + bugfix.fix(event); + + // Analyze this event + analyzer.analyze(event, true, offlineType); + + nEvent++; + nTrue += analyzer.truthList.nMCTauPure(); + nGood += analyzer.truthList.nMCTauGood(); + + // Loop over all good truth taus in this event + unsigned int nTau = analyzer.truthList.nMCTauGood(); + for(unsigned int itau = 0; itau < nTau; ++itau ) { + TrigTauMCTau* tau = &analyzer.truthList.mcTauGoodEntry(itau); + + float visPt = tau->visible().Pt()/1000.; + float visEta = tau->visible().Eta(); + + // Fill denominator with all good taus + hMCVisPt->Fill(visPt); + hMCVisEta->Fill(visEta); + + + float OffPt=0; + + hOffVisPt->Fill(visPt); + hOffVisEta->Fill(visEta); + //hOffOPt->Fill(OffPt); + + // Find a matching L1 object + TrigTauL1Object* l1Tau = analyzer.chainList.getL1Tau(*tau); + if (l1Tau != 0) { + // Found a L1 trigger within dR range, fill numerator histograms + // with MC truth Pt and Eta + hL1VisPt->Fill(visPt); + //hL1OPt->Fill(OffPt); + hL1VisEta->Fill(visEta); + } + + // Because the dR range might be different between L1 and L2 + // it is possible (if unlikely) to find a L2 match without a L1. + // In reality, this probably never happens... + + // Find a matching L2 object + TrigTauL2Object* l2Tau = analyzer.chainList.getL2Tau(*tau); + if (l2Tau != 0) { + hL2VisPt->Fill(visPt); + //hL2OPt->Fill(OffPt); + hL2VisEta->Fill(visEta); + } + + // Find a matching EF object + TrigTauRecEFObject* efTau = analyzer.chainList.getEFTau(*tau); + if (efTau != 0) { + hEFVisPt->Fill(visPt); + //hEFOPt->Fill(OffPt); + hEFVisEta->Fill(visEta); + } + + } // End of loop over good taus in the event + } // end loop over events + + //gROOT->cd(); + + // Make ratios + //hL1PtEff_off->Divide(hL1OPt, hOffOPt, 1., 1., "B"); + //hL2PtEff_off->Divide(hL2OPt, hOffOPt, 1., 1., "B"); + //hEFPtEff_off->Divide(hEFOPt, hOffOPt, 1., 1., "B"); + + hL1PtEff->Divide(hL1VisPt, hOffVisPt, 1., 1., "B"); + hL2PtEff->Divide(hL2VisPt, hOffVisPt, 1., 1., "B"); + hEFPtEff->Divide(hEFVisPt, hOffVisPt, 1., 1., "B"); + + + hL1EtaEff->Divide(hL1VisEta, hOffVisEta, 1., 1., "B"); + hL2EtaEff->Divide(hL2VisEta, hOffVisEta, 1., 1., "B"); + hEFEtaEff->Divide(hEFVisEta, hOffVisEta, 1., 1., "B"); + + + TString plotfile = "effSequencePlots"; + plotfile += append; + + // Titles + hL1PtEff->GetXaxis()->SetTitle("True Visible E_{T} (GeV)"); + hL1PtEff->GetYaxis()->SetTitle("Efficiency"); + hL1PtEff_off->GetXaxis()->SetTitle("Off Visible E_{T} (GeV)"); + hL1PtEff_off->GetYaxis()->SetTitle("Efficiency"); + + hL1EtaEff->GetXaxis()->SetTitle("True visible eta"); + hL1EtaEff->GetYaxis()->SetTitle("Efficiency"); + + + int color[3]; + color[0] = 1;//2; + color[1] = 1;//3; + color[2] = 1;//4; + //gStyle->SetHistLineWidth(2); + + TCanvas * c1 = (TCanvas *) gROOT->Get("c1"); + if( c1 ) delete c1; + c1 = new TCanvas("c1","Selected",10,10,800,620); + // c1->Divide(1,2); + + TLegend * legend = new TLegend(0.5,0.2,0.7,0.45); + legend->SetFillStyle(0); + c1->cd(1); + hL1PtEff->SetMaximum(1.05); + gStyle->SetHistLineColor(color[0]); + gStyle->SetMarkerStyle(20); gStyle->SetMarkerColor(color[0]); + hL1PtEff->UseCurrentStyle(); hL1PtEff->Draw(); + legend->AddEntry(hL1PtEff,"L1","p"); + gStyle->SetHistLineColor(color[1]); + gStyle->SetMarkerStyle(26); gStyle->SetMarkerColor(color[1]); + hL2PtEff->UseCurrentStyle(); hL2PtEff->Draw("SAME"); + legend->AddEntry(hL2PtEff,"L2","p"); + gStyle->SetHistLineColor(color[2]); + gStyle->SetMarkerStyle(22); gStyle->SetMarkerColor(color[2]); + hEFPtEff->UseCurrentStyle(); hEFPtEff->Draw("SAME"); + legend->AddEntry(hEFPtEff,"EF","p"); + + legend->Draw("same"); + ATLAS_LABEL(0.55,0.55); + + + TCanvas * c2 = (TCanvas *) gROOT->Get("c2"); + if( c2 ) delete c2; + c2 = new TCanvas("c2","Selected",10,10,800,620); + + c2->cd(1); + + gStyle->SetHistLineColor(color[0]); + gStyle->SetMarkerStyle(20); gStyle->SetMarkerColor(color[0]); + hL1EtaEff->UseCurrentStyle(); hL1EtaEff->Draw(); + gStyle->SetHistLineColor(color[1]); + gStyle->SetMarkerStyle(26); gStyle->SetMarkerColor(color[1]); + hL2EtaEff->UseCurrentStyle(); hL2EtaEff->Draw("SAME"); + gStyle->SetHistLineColor(color[2]); + gStyle->SetMarkerStyle(22); gStyle->SetMarkerColor(color[2]); + hEFEtaEff->UseCurrentStyle(); hEFEtaEff->Draw("SAME"); + // legend->Draw(); + + + + /* + c1->cd(2); + gStyle->SetHistLineColor(color[0]); + hL1PtEff_off->UseCurrentStyle(); hL1PtEff_off->Draw(); + gStyle->SetHistLineColor(color[1]); + hL2PtEff_off->UseCurrentStyle(); hL2PtEff_off->Draw("SAME"); + gStyle->SetHistLineColor(color[2]); + hEFPtEff_off->UseCurrentStyle(); hEFPtEff_off->Draw("SAME"); + */ + + c1->Print(plotfile + ".pt.eps"); + c2->Print(plotfile + ".eta.eps"); + + + analyzer.trigMan.print(); + + + // Print out matching statistics + cout << "Events: " << nEvent << endl; + cout << "True Taus: " << nTrue << endl; + cout << "Good Taus: " << nGood << endl; + cout << "Matched Taus: " << nMatched << " -> " + << float(nMatched)/nEvent << " Match/Ev" << endl; + + delete event; + //delete tree; + + // delete file; + + return; +} + + /* +TChain * chain = new TChain("eventTree") +chain->Add("ntuples/TTP5/5107/user.ElizabethSPtacek.misal1_csc11.005107.pythia_Wtauhad.digit.RDO.v12003103.TTP05.2.root") +chain->Add("ntuples/TTP5/5188/trig1_misal1_mc12.005188.A3_Ztautau_filter.recon.ESD.v13003002_tid016457.0.TTP5.root") +chain->Add("ntuples/TTP5/5188/trig1_misal1_mc12.005188.A3_Ztautau_filter.recon.ESD.v13003002_tid016457.1.TTP5.root") +chain->Add("ntuples/TTP5/5188/trig1_misal1_mc12.005188.A3_Ztautau_filter.recon.ESD.v13003002_tid016457.2.TTP5.root") +chain->Add("ntuples/TTP5/5188/trig1_misal1_mc12.005188.A3_Ztautau_filter.recon.ESD.v13003002_tid016457.3.TTP5.root") + */ +void ATLAS_LABEL(Double_t x,Double_t y,Color_t color=1) { + + TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); + l.SetNDC(); + l.SetTextFont(72); + l.SetTextColor(color); + l.DrawLatex(x,y,"ATLAS"); +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effTable.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effTable.cxx new file mode 100755 index 0000000000000000000000000000000000000000..0ca3f309c9da50418e9252fd932f765399352f87 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/effTable.cxx @@ -0,0 +1,159 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +void effTable(const char* filename="ntuples/trigtau.AOD.root", + TString mode="all") { + + gROOT->cd(); + + // Open file + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + // Initialize tree + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // We will use our own trigger manager (although we could just use + // the one in TrigTauAnalyzer). + TrigTauSelectionManager trigMan; + + // Pick a menu set (12.0.6 by default) + // trigMan.setMenuVersion(TrigTauSelectionManager::MENUJUNE06); + + // Also set an L1 MET cut if desired + // trigMan.setL1MET(20000.); + + // Set fiducial cuts + analyzer.truthList.setMinVisPt(0.); + analyzer.truthList.setMaxVisEta(2.5); + + // Select a particular tau decay mode (if desired) + // Could also add pi, rho, etc. + if (mode == "all") { + } + else if (mode == "1pr") { + analyzer.truthList.select1Prong(); + } + else if (mode == "3pr") { + analyzer.truthList.select3Prong(); + } + else { + cout << "Unkown decay mode: " << mode << endl; + delete event; delete tree; delete file; + return; + } + + // Set up the different menus to plot + const int nMenus = 4; + TrigTauFlags::TRIGGERMENU theMenu[nMenus]; + theMenu[0] = TrigTauFlags::TAU16I; + theMenu[1] = TrigTauFlags::TAU20I; + theMenu[2] = TrigTauFlags::TAU29I; + theMenu[3] = TrigTauFlags::TAU50; + + TString menuName[nMenus]; + menuName[0] = "tau16i"; + menuName[1] = "tau20i"; + menuName[2] = "tau29i"; + menuName[3] = "tau50"; + + // Create counters to hold triggered object counts + long nEvent = 0; + long nTrue = 0; + long nGood = 0; + long nL1Sel[nMenus]; + long nL2Sel[nMenus]; + + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) { + nL1Sel[iMenu] = 0; + nL2Sel[iMenu] = 0; + } + + // Loop over all events + int nev = int(tree->GetEntries()); + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + + // Analyze this event + analyzer.analyze(event); + + nEvent++; + nTrue += analyzer.truthList.nMCTauPure(); + nGood += analyzer.truthList.nMCTauGood(); + + // Loop over all good truth taus in this event + unsigned int nTau = analyzer.truthList.nMCTauGood(); + for(unsigned int itau = 0; itau < nTau; ++itau ) { + TrigTauMCTau* tau = &analyzer.truthList.mcTauGoodEntry(itau); + + // Now, loop through defined menus, apply selections, and look for + // a matching trigger object within the allowed dR distance. + // Note: The object passing L2 doesn't necessarily need to come + // from the ROI passing L1, but I think that is OK. + for(unsigned int iMenu = 0; iMenu<nMenus; iMenu++) { + + // Select the new menu + trigMan.setTauMenu(theMenu[iMenu]); + + // Refill the selected chain list based on the new menu + analyzer.chainList.fillTriggerList(trigMan); + + // Find a matching L1 object + TrigTauL1Object* l1Tau = analyzer.chainList.getL1Tau(*tau); + if (l1Tau != 0) nL1Sel[iMenu]++; + + // Because the dR range might be different between L1 and L2 + // it is possible (if unlikely) to find a L2 match without a L1. + // In reality, this probably never happens... + + // Find a matching L2 object + TrigTauL2Object* l2Tau = analyzer.chainList.getL2Tau(*tau); + if (l2Tau != 0) nL2Sel[iMenu]++; + + } // End of loop over menus + } // End of loop over good taus in the event + } // end loop over events + + // Print out matching statistics + cout << "Events: " << nEvent << endl; + cout << "True Taus: " << nTrue << endl; + cout << "Good Taus: " << nGood << " -> " + << float(nGood)/nEvent << " Good/Ev" << endl; + + cout << "Trig Menus:"; + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) + cout << menuName[iMenu] << " "; + cout << endl; + + cout << "L1 Passed: " ; + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) + cout << nL1Sel[iMenu] << " (" << 100*float(nL1Sel[iMenu])/nGood << "%) "; + cout << endl; + + cout << "L2 Passed: " ; + for (unsigned int iMenu=0; iMenu<nMenus; iMenu++) + cout << nL2Sel[iMenu] << " (" << 100*float(nL2Sel[iMenu])/nGood << "%) "; + cout << endl; + + delete event; + delete tree; + delete file; + + return; +} + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/eventRates.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/eventRates.cxx new file mode 100755 index 0000000000000000000000000000000000000000..759492398371dfabaa36f473273059c460cff7bc --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/eventRates.cxx @@ -0,0 +1,217 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// Example macro to produce a plot of event rates (normalized according +// to some input argument) for a series of trigger menus. +// No MC information is used in producing these plots. +// +// Weight gives the event weight to be used in the weight plot. +// This could be a 1/sigma to give luminosity, or something +// similar to give rate in Hz. +// + +// Forward declaration +TH1F* intRateHist(const TH1F* hist); + +void eventRates(const char* filename="ntuples/trigtau.AOD.root", + TrigTauFlags::TRIGGERMENU menu, float weight=1) { + + gROOT->cd(); + + // Open file + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + // Initialize tree + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // Pick a menu set (12.0.6 by default) + // analyzer.trigMan.setMenuVersion(TrigTauSelectionManager::MENUJUNE06); + + // Set up selection manager and process selection options + TString append; + analyzer.trigMan.setTauMenu(menu); + append += "_"+TrigTauFlags::menuName(menu); + + // Could also add MET cut + // analyzer.trigMan.setL1MET(20000.); + + // Formatting commands + gStyle->SetOptTitle(0); + gStyle->SetOptStat(0); + gROOT->cd(); + + int nbins=50; + float ptlo=0.; + float pthi=100.; + + // L1 Rate Plots (both by ROI rate and event rate) + TH1F* hL1Pt = new TH1F("hL1Pt", "", nbins, ptlo, pthi); + hL1Pt->GetXaxis()->SetTitle("L1 Pt (GeV)"); + hL1Pt->GetYaxis()->SetTitle("L1 ROI Rate"); + + TH1F* hL1EvPt = new TH1F("hL1EvPt", "", nbins, ptlo, pthi); + hL1EvPt->GetXaxis()->SetTitle("L1 Pt (GeV)"); + hL1EvPt->GetYaxis()->SetTitle("Event Rate"); + + // L2 Rate Plots + TH1F* hL2Pt = new TH1F("hL2Pt", "", nbins, ptlo, pthi); + hL2Pt->GetXaxis()->SetTitle("L2 Pt (GeV)"); + hL2Pt->GetYaxis()->SetTitle("L2 ROI Rate"); + + TH1F* hL2EvPt = new TH1F("hL2EvPt", "", nbins, ptlo, pthi); + hL2EvPt->GetXaxis()->SetTitle("L2 Pt (GeV)"); + hL2EvPt->GetYaxis()->SetTitle("Event Rate"); + + // Counters + int nEvent = 0; + int nL1 = 0; + int nL1Ev = 0; + int nL2 = 0; + int nL2Ev = 0; + int nEF = 0; + + // Loop over all events + int nev = int(tree->GetEntries()); + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + + // Analyze this event + analyzer.analyze(event); + + nEvent++; + + // Loop over all objects passing L1 + unsigned int numL1 = analyzer.chainList.nPassL1Chains(); + if (numL1==0) continue; // No point going on + + nL1 += numL1; // Keep track separately the number of ROIs and events + nL1Ev++; + + float maxPt=0.; + for (unsigned int iL1=0; iL1 < numL1; iL1++) { + TrigTauTrigChain chain = analyzer.chainList.passL1ChainEntry(iL1); + + float l1Pt = chain.L1->m_TauEnergy/1000.; + if (l1Pt > maxPt) maxPt = l1Pt; + + // One entry per ROI + hL1Pt->Fill(l1Pt, weight); + } + // One entry per event, based on max Pt object found + hL1EvPt->Fill(maxPt, weight); + + // Loop over all L2 passing chains (independent of truth) + unsigned int numL2 = analyzer.chainList.nPassL2Chains(); + if (numL2==0) continue; + + nL2 += numL2; + nL2Ev++; + + maxPt = 0.; + for(unsigned int iL2 = 0; iL2 < numL2; iL2++) { + TrigTauTrigChain chain = analyzer.chainList.passL2ChainEntry(iL2); + + float l2Pt = chain.L2->Pt()/1000.; + if (l2Pt > maxPt) maxPt = l2Pt; + + // One entry per ROI + hL2Pt->Fill(l2Pt, weight); + } + + // One entry per event, based on max Pt object found + hL2EvPt->Fill(maxPt, weight); + + } // end loop over events + + + // Also make the integral rate histograms + TH1F* hL1PtInt = intRateHist(hL1Pt); + hL1PtInt->GetYaxis()->SetTitle("Integral ROI Rate"); + TH1F* hL1EvPtInt = intRateHist(hL1EvPt); + hL1EvPtInt->GetYaxis()->SetTitle("Integral Event Rate"); + TH1F* hL2PtInt = intRateHist(hL2Pt); + hL2PtInt->GetYaxis()->SetTitle("Integral ROI Rate"); + TH1F* hL2EvPtInt = intRateHist(hL2EvPt); + hL2EvPtInt->GetYaxis()->SetTitle("Integral Event Rate"); + + gROOT->cd(); + + TString plotfile = "eventRates"; + plotfile += append; + + TCanvas * c1 = (TCanvas *) gROOT->Get("c1"); + if( c1 ) delete c1; + c1 = new TCanvas("c1","L1 Selected",10,10,800,620); + c1->Divide(2,2); + c1->cd(1); hL1Pt->Draw(); gPad->SetLogy(); + c1->cd(2); hL1EvPt->Draw(); gPad->SetLogy(); + c1->cd(3); hL1PtInt->Draw(); gPad->SetLogy(); + c1->cd(4); hL1EvPtInt->Draw(); gPad->SetLogy(); + + c1->Print(plotfile + ".ps("); + + TCanvas * c2 = (TCanvas *) gROOT->Get("c2"); + if( c2 ) delete c2; + c2 = new TCanvas("c2","L2 Selected",10,10,800,620); + c2->Divide(2,2); + c2->cd(1); hL2Pt->Draw(); gPad->SetLogy(); + c2->cd(2); hL2EvPt->Draw(); gPad->SetLogy(); + c2->cd(3); hL2PtInt->Draw(); gPad->SetLogy(); + c2->cd(4); hL2EvPtInt->Draw(); gPad->SetLogy(); + c2->Print(plotfile + ".ps)"); + + // Print out matching statistics + analyzer.trigMan.print(); + cout << "Events: " << nEvent << " " << weight*nEvent << endl; + cout << "L1 Events: " << nL1Ev << " " << weight*nL1Ev << endl; + cout << "L1 ROIs: " << nL1 << " " << weight*nL1 << endl; + cout << "L2 Events: " << nL2Ev << " " << weight*nL2Ev << endl; + cout << "L2 ROIs: " << nL2 << " " << weight*nL2 << endl; + + if (nL1Ev>0) + cout << "L1 ROI/Ev: " << float(nL1)/nL1Ev << endl; + if (nL2Ev>0) + cout << "L2 ROI/Ev: " << float(nL2)/nL2Ev << endl; + + delete event; + delete tree; + delete file; + + // Output to plot + return; +} + +TH1F* intRateHist(const TH1F* h) { + + if (h == 0) return 0; + + TH1F* hint = new TH1F(*h); + hint->Clear(); + unsigned int lastbin = h->GetNbinsX()-1; + + hint->SetBinContent(lastbin, h->GetBinContent(lastbin)); + + // Now, go through and numerically integrate by adding previous bin + for (int ibin=lastbin-1; ibin>=0; ibin--) { + hint->SetBinContent(ibin, h->GetBinContent(ibin)+hint->GetBinContent(ibin+1)); + // Could also calculate errors, but not for now + } + return hint; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/l1ExamplePlots.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/l1ExamplePlots.cxx new file mode 100755 index 0000000000000000000000000000000000000000..a73344a35ac7def62dee140696f6ca343b7f2537 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/l1ExamplePlots.cxx @@ -0,0 +1,211 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +void l1ExamplePlots(const char* filename="ntuples/trigtau.AOD.root", + TrigTauFlags::TRIGGERMENU menu, TString mode="all") { + + gROOT->cd(); + + // Open file + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + // Initialize tree + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // Set up selection manager and process selection options + TString append; + + // Pick a menu set (12.0.6 by default) + // analyzer.trigMan.setMenuVersion(TrigTauSelectionManager::MENUJUNE06); + + analyzer.trigMan.setTauMenu(menu); + append += "_"+TrigTauFlags::menuName(menu); + + // Set fiducial cuts + analyzer.truthList.setMinVisPt(0.); + analyzer.truthList.setMaxVisEta(2.5); + + if (mode == "all") { + } + else if (mode == "1pr") { + append += "_1pr"; + analyzer.truthList.select1Prong(); + } + else if (mode == "3pr") { + append += "_3pr"; + analyzer.truthList.select3Prong(); + } + else { + cout << "Unkown decay mode: " << mode << endl; + delete event; delete tree; delete file; + return; + } + + // Formatting commands + gStyle->SetOptTitle(0); + gStyle->SetOptStat("emr"); + gROOT->cd(); + + // MC Truth histograms + TH1F* hVisPt = new TH1F("hVisPt", "", 50, 0, 100); + hVisPt->GetXaxis()->SetTitle("Visible Pt (GeV)"); + hVisPt->GetYaxis()->SetTitle("Good Taus"); + + TH1F* hVisEta = new TH1F("hVisEta", "", 61, -3.05, 3.05); + hVisEta->GetXaxis()->SetTitle("Vis Eta"); + hVisEta->GetYaxis()->SetTitle("Good Taus"); + + // L1 histograms + TH1F* hL1VisPt = new TH1F("hL1VisPt", "", 50, 0, 100); + hL1VisPt->GetXaxis()->SetTitle("True Vis Pt (GeV)"); + hL1VisPt->GetYaxis()->SetTitle("L1 Taus"); + hL1VisPt->Sumw2(); + + TH1F* hL1VisEta = new TH1F("hL1VisEta", "", 61, -3.05, 3.05); + hL1VisEta->GetXaxis()->SetTitle("True Vis Eta"); + hL1VisEta->GetYaxis()->SetTitle("L1 Taus"); + hL1VisEta->Sumw2(); + + TH1F* hL1PtEff = new TH1F("hL1PtEff", "", 50, 0, 100); + hL1PtEff->GetXaxis()->SetTitle("True Vis Pt (GeV)"); + hL1PtEff->GetYaxis()->SetTitle("L1/Good Taus"); + + TH1F* hL1EtaEff = new TH1F("hL1EtaEff", "", 61, -3.05, 3.05); + hL1EtaEff->GetXaxis()->SetTitle("True Vis Eta"); + hL1EtaEff->GetYaxis()->SetTitle("L1/Good Taus"); + + TH1F* hL1Pt = new TH1F("hL1Pt", "", 50, 0, 100); + hL1Pt->GetXaxis()->SetTitle("L1 Et (GeV)"); + hL1Pt->GetYaxis()->SetTitle("L1 Passed"); + + TH2F* hL1PtEt = new TH2F("hL1PtEt", "", 50, 0, 100, 50, 0, 100); + hL1PtEt->GetXaxis()->SetTitle("True Vis Pt (GeV)"); + hL1PtEt->GetYaxis()->SetTitle("L1 Et (GeV)"); + + TH1F* hL1Eta = new TH1F("hL1Eta", "", 61, -3.05, 3.05); + hL1Eta->GetXaxis()->SetTitle("L1 Eta"); + hL1Eta->GetYaxis()->SetTitle("L1 Taus"); + + // Resolution Plots + TH1F* hL1dPt = new TH1F("hL1dPt", "", 50, -50, 50); + hL1dPt->GetXaxis()->SetTitle("L1 - Vis Pt (GeV)"); + + TH1F* hL1dEta = new TH1F("hL1dEta", "", 50, -0.25, 0.25); + hL1dEta->GetXaxis()->SetTitle("L1 - Vis Eta"); + + + // Counters + int nEvent = 0; + int nTrue = 0; + int nGood = 0; + int nL1 = 0; + + // Loop over all events + int nev = int(tree->GetEntries()); + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + + // Analyze this event + analyzer.analyze(event); + + nEvent++; + nTrue += analyzer.truthList.nMCTauPure(); + nGood += analyzer.truthList.nMCTauGood(); + + // Loop over all good truth taus + unsigned int nTau = analyzer.truthList.nMCTauGood(); + for(unsigned int itau = 0; itau < nTau; ++itau ) { + TrigTauMCTau* tau = &analyzer.truthList.mcTauGoodEntry(itau); + + float visPt = tau->visible().Pt()/1000.; + float visEta = tau->visible().Eta(); + + hVisPt->Fill(visPt); + hVisEta->Fill(visEta); + + // + // Match truth with L1 trigger + TrigTauL1Object* l1Tau = analyzer.chainList.getL1Tau(*tau); + if (l1Tau == 0) continue; + + nL1++; + float l1Pt = l1Tau->m_TauEnergy/1000.; + float l1Eta = l1Tau->Eta(); + hL1VisPt->Fill(visPt); + hL1VisEta->Fill(visEta); + + hL1Pt->Fill(l1Pt); + hL1PtEt->Fill(visPt, l1Pt); + + hL1Eta->Fill(l1Eta); + + hL1dPt->Fill(l1Pt - visPt); + hL1dEta->Fill(l1Eta - visEta); + + } + + } // end loop over events + + gROOT->cd(); + + // Make ratios + hL1PtEff-> Divide(hL1VisPt, hVisPt, 1., 1., "B"); + hL1EtaEff-> Divide(hL1VisEta, hVisEta, 1., 1., "B"); + + TString plotfile = "l1EffPlots"; + plotfile += append; + + TCanvas * c1 = (TCanvas *) gROOT->Get("c1"); + if( c1 ) delete c1; + c1 = new TCanvas("c1","L1 Selected",10,10,800,620); + c1->Divide(2,2); + c1->cd(1); hL1Pt->Draw(); + c1->cd(2); hL1Eta->Draw(); + c1->cd(3); hL1dPt->Draw(); + c1->cd(4); hL1dEta->Draw(); + c1->Print(plotfile + ".ps("); + + TCanvas * c2 = (TCanvas *) gROOT->Get("c2"); + if( c2 ) delete c2; + c2 = new TCanvas("c2","L1 Selected",10,10,800,620); + c2->Divide(2,2); + gStyle->SetOptStat(0); + c2->cd(1); hL1Pt->Draw(); + c2->cd(2); hL1PtEt->Draw(); + c2->cd(3); hL1PtEff->Draw(); + c2->cd(4); hL1EtaEff->Draw(); + c2->Print(plotfile + ".ps)"); + + // Print out matching statistics + analyzer.trigMan.print(); + cout << "Events: " << nEvent << endl; + cout << "True Taus: " << nTrue << endl; + cout << "Good Taus: " << nGood << " -> " + << float(nGood)/nEvent << " Good/Ev" << endl; + cout << "L1 Matched: " << nL1 << " -> " + << (100.*nL1)/nGood << "% L1/Good" << endl; + + delete event; + delete tree; + delete file; + + // Output to plot + return; +} + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/rateTable.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/rateTable.cxx new file mode 100644 index 0000000000000000000000000000000000000000..103ee6310cfb8c99fa7bd095156e6dd9cb8e2f35 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/rateTable.cxx @@ -0,0 +1,390 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + // Create counters to hold triggered object counts +static long nEvent; +static long nL1Sel; +static long nL2Sel; +static long nL2CalSel; +static long nEFSel; + +static int nDecL1; +static int nDecL2; +static int nDecEF; + +static double nEventWt; +static double nL1SelWt; +static double nL2SelWt; +static double nL2SelCalWt; +static double nEFSelWt; + +void rateTable2EllClear(); +void rateTable2EllPrint(); + + +void rateTable(const char* fileName) +{ + bool signal = true; + rateTable1(fileName, TrigTauFlags::TAU12_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU16I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU20I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU29I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU38I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU50_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU84_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU125_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU12_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU16I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU20I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU29I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU38I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU50_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU84_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU125_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU12_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU16I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU20I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU29I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU38I_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU50_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU84_TIGHT,signal); + rateTable1(fileName, TrigTauFlags::TAU125_TIGHT,signal); + +} + + + + + + + + +// Menu2 should either be E10, Mu10, or tau +void rateTable1(const char* filename="ntuples/trigtau.5200.root", + TrigTauFlags::TRIGGERMENU menu1 = TrigTauFlags::TAU35I, bool signal = true) +{ + + TrigTauSelectionManager::MENUVERSION version = TrigTauSelectionManager::MENU13030pre; + //TrigTauSelectionManager::MENUVERSION version = TrigTauSelectionManager::MENU1206; + float met = 0.; + + //bool signal = true; + int nprong = 0; + bool checkOffline = true; + // TAU1P3P, TAUREC, EITHERTAU, BOTHTAU + TrigTauMCTauList::OFFLINESELECTION offlineType = TrigTauMCTauList::EITHERTAU; + + bool doDetailedPrinting= false; + + //TrigTauBugFix bugfix (TrigTauBugFix::TTP4, TrigTauBugFix::RDO); + TrigTauBugFix bugfix(TrigTauBugFix::TTP5, TrigTauBugFix::RDO); + bugfix.setTTPVersion(filename); + + //=================================================== + // MC truth + + TrigTauMCTauList truthList; + truthList.setMaxVisEta(2.5); + truthList.setMinVisPt(menu1); + + if( nprong == 1 ) truthList.select1Prong(); + else if( nprong == 3 ) truthList.select3Prong(); + truthList.setRecoMatchdR(0.2); + + rateTable2EllClear(); + gROOT->cd(); + + // Open file + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + + // Initialize tree + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + //tree->SetBranchStatus("mcEvent*", 0); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // Also set an L1 MET cut if desired + analyzer.trigMan.setL1MET(met); + TrigTauSelectionManager trigMan1; + trigMan1.setMenuVersion(version); + trigMan1.setTauMenu(menu1); + + //TrigTauHistogram::setHistLimits(TrigTauHistogram::PTHIST,30,0,90000); + //trigMan1.l2CalSel.setHistDebug(); + + + //trigMan1.setL2CalOnly(false); + bool checkL2Cal = true; + + int nPrintL1 = 0; + int nPrintL2 = 0; + int nPrintEF = 0; + + // Loop over all events + int nev = int(tree->GetEntries()); + //if( nev > 100 ) nev = 100; + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + bugfix.fix(event); + + + // ============ Select type of events (e.g. signal) ================ + if( signal ) { + truthList.fillPureList(&event->mcEvent); + truthList.fillGoodList(); + if( checkOffline ) truthList.requireRecoMatch(*event, offlineType); + if( truthList.nMCTauGood() ==0 ) continue; + + //================================================================== + } + + + bool decL1 = event->decision.passedL1(menu1); + bool decL2 = event->decision.passedL2(menu1); + bool decEF = event->decision.passedEF(menu1); + + nDecL1 += int(decL1); + nDecL2 += int(decL2); + nDecEF += int(decEF); + + bool ntL1 = false; + bool ntL2 = false; + bool ntEF = false; + + // Analyze this event + analyzer.chainList.fillChainList(event); + + nEvent++; + + bool pass = false; + + // Look for L1 pass + unsigned int numCh = analyzer.chainList.nTrigChains(); + for (unsigned int iCh1=0; iCh1 < numCh; ++iCh1) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedL1(ch1)){ + continue; + } + pass = true; + if (pass) break; + } + +// if( pass != decL1 ) continue; +// nDecL1 += int(decL1); +// nDecL2 += int(decL2); +// nDecEF += int(decEF); + + if (pass) { + nL1Sel++; + ntL1 = true; + } + + + // Look for L2Calo pass + if( checkL2Cal ){ + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedL2Cal(ch1)) continue; + + pass = true; + if (pass) break; + } + + if (pass) { + nL2CalSel++; + } + } + + // Look for L2 pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedL2(ch1)) continue; + + pass = true; + if (pass) break; + } + + if (pass) { + nL2Sel++; + ntL2 = true; + } + + + // Look for EF pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedEF(ch1)) continue; + pass = true; + if (pass) break; + } + + if (pass) { + nEFSel++; + ntEF=true; + } + + if( doDetailedPrinting){ + bool printChain=false; + if( decL1 != ntL1 ) { + cout << "Event " << event->eventNumber << " L1 decision does not match: NTUPLE " + << ntL1 << " + and HLTcode " << decL1 << endl; + printChain = true; + nPrintL1++; + + } + if( decL2 != ntL2 ) { + cout << "Event " << event->eventNumber << " L2 decision does not match: NTUPLE " + << ntL2 << " + and HLTcode " << decL2 << endl; + printChain = true; + nPrintL2++; + } + if( decEF != ntEF ) { + cout << "Event " << event->eventNumber << " EF decision does not match: NTUPLE " + << ntEF << " + and HLTcode " << decEF << endl; + printChain = true; + nPrintEF++; + } + if( printChain ) + { + analyzer.chainList.printChainList(); + cout << endl; + trigMan1.setDebug(true); + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + cout << " ==================================\n"; + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + if (!trigMan1.passedL1(ch1)) continue; + if (!trigMan1.passedL2(ch1)) continue; + if (!trigMan1.passedEF(ch1)) continue; + } + trigMan1.setDebug(false); + cout << endl; + } + }// end of doDetailedPrinting + + + } // end loop over events + + // trigMan1.print(); + // trigMan2.print(); + //trigMan1.l2CalSel.histManager()->plotAll(); + // trigMan1.l2CalSel.histManager()->plotAllEfficiencies(); + + delete event; + delete tree; + delete file; + + cout << " Use menu " << menu1.menuName(menu1) << endl; + //trigMan1.print(); +rateTable2EllPrint() ; + + cout << "Mistmatch found in L1 " << nPrintL1 << " , L2 " << nPrintL2 << ", EF " << nPrintEF << endl; + + cout << "Com Eff " << menu1.menuName(menu1) << " \& "<< nEvent << " & " //<< std::setprecision(3) + << float(nL1Sel)/float(nEvent)<< " & " //<< std::setprecision(3) + << float(nL2CalSel)/float(nEvent)<< " & "//<< std::setprecision(3) + << float(nL2Sel)/float(nEvent) << " & "//<< std::setprecision(3) + << float(nEFSel)/float(nEvent)<< " \\ \n"; + cout << "Lev Eff " << menu1.menuName(menu1) << " \& "<< nEvent << " & " //<< std::setprecision(3) + << float(nL1Sel)/float(nEvent)<< " & " //<< std::setprecision(3) + << float(nL2CalSel)/float(nL1Sel)<< " & "//<< std::setprecision(3) + << float(nL2Sel)/float(nL2CalSel) << " & "//<< std::setprecision(3) + << float(nEFSel)/float(nL2Sel)<< " \\ \n"; + + + return; +} + +void rateTable2EllPrint() { + + + // Print out matching statistics + cout << "Events: " << nEvent << endl; + + cout << "L1Sel L2CalSel L2TrkSel EFSel" << endl; + + cout << "Decision : " + << nDecL1 << " " + << nDecL2 << " " + << nDecEF << endl; + + + cout << "Number: " + << nL1Sel << " " + << nL2CalSel << " " + << nL2Sel << " " + << nEFSel << endl; + + //cout << "Rate: " + // << nL1SelWt << " " + // << nL2SelWt << " " + // << nEFSelWt << endl; + + cout << "Cum Eff: " + << 100*float(nL1Sel)/nEvent << " " + << 100*float(nL2CalSel)/nEvent << " " + << 100*float(nL2Sel)/nEvent << " " + << 100*float(nEFSel)/nEvent << endl; + +// cout << "Dif Eff: " +// << 100*float(nL1Sel)/nEvent << " " +// << (nL1Sel > 0 ? 100*float(nL2CalSel)/nL1Sel : 0) << " " +// << (nL2CalSel > 0 ? 100*float(nL2Sel)/nL2CalSel : 0) +// << (nL2Sel > 0 ? 100*float(nEFSel)/nL2Sel : 0) << endl; + +// cout << "Cum Rej: " +// << (nL1Sel > 0 ? nEvent/float(nL1Sel) : 0) << " " +// << (nL2CalSel > 0 ? nEvent/float(nL2CalSel) : 0) << " " +// << (nL2Sel > 0 ? nEvent/float(nL2Sel) : 0) << " " +// << (nEFSel > 0 ? nEvent/float(nEFSel) : 0) << endl; + +// cout << "Dif Rej: " +// << (nL1Sel > 0 ? nEvent/float(nL1Sel) : 0) << " " +// << (nL2CalSel > 0 ? nL1Sel/float(nL2CalSel) : 0) << " " +// << (nL2Sel > 0 ? nL2CalSel/float(nL2Sel) : 0) << " " +// << (nEFSel > 0 ? nL2Sel/float(nEFSel) : 0) << endl; + +} + +void rateTable2EllClear() { + // Create counters to hold triggered object counts + nEvent = 0; + nL1Sel = 0; + nL2CalSel = 0; + nL2Sel = 0; + nEFSel = 0; + nEventWt = 0.; + nL1SelWt = 0.; + nL2SelWt = 0.; + nEFSelWt = 0.; + + nDecL1= 0; + nDecL2= 0; + nDecEF= 0; + +} + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/resolutionPlots.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/resolutionPlots.cxx new file mode 100755 index 0000000000000000000000000000000000000000..b12ed03158c415f55229031fbaaffd2e37e06a55 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/resolutionPlots.cxx @@ -0,0 +1,365 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// +// Example macro to make a series of resolution plots. +// Plots include L1,L2,EF object with respect to MC truth +// as well as "data" plots of L1 vs L2 position. +// +void resolutionPlots(const char* filename="ntuples/trigtau.AOD.root", + TrigTauFlags::TRIGGERMENU menu, TString decayMode="all") { + + gROOT->cd(); + + // Open file + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + // Initialize tree + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // Pick a menu set (12.0.6 by default) + // analyzer.trigMan.setMenuVersion(TrigTauSelectionManager::MENUJUNE06); + + // Set up selection manager and process selection options + TString append; + + analyzer.trigMan.setTauMenu(menu); + append += "_"+TrigTauFlags::menuName(menu); + + // Could also add MET cut + // analyzer.trigMan.setL1MET(20000.); + + // Set fiducial cuts (only applies to MC truth resolutions) + analyzer.truthList.setMinVisPt(0.); + analyzer.truthList.setMaxVisEta(2.5); + + if (decayMode == "all") { + } + else if (decayMode == "1pr") { + append += "_1pr"; + analyzer.truthList.select1Prong(); + } + else if (decayMode == "3pr") { + append += "_3pr"; + analyzer.truthList.select3Prong(); + } + else { + cout << "Unkown decay decayMode: " << decayMode << endl; + delete event; delete tree; delete file; + return; + } + + // Formatting commands + gStyle->SetOptTitle(0); + gStyle->SetOptStat("emr"); + gROOT->cd(); + + // L1 Resolution Plots + TH1F* hL1dPt = new TH1F("hL1dPt", "", 50, -50, 50); + hL1dPt->GetXaxis()->SetTitle("L1 - Vis Pt (GeV)"); + + TH1F* hL1dR = new TH1F("hL1dR", "", 50, 0.0, 0.5); + hL1dR->GetXaxis()->SetTitle("L1 - Vis Radius"); + + TH1F* hL1dEta = new TH1F("hL1dEta", "", 50, -0.25, 0.25); + hL1dEta->GetXaxis()->SetTitle("L1 - Vis Eta"); + + TH1F* hL1dPhi = new TH1F("hL1dPhi", "", 50, -0.25, 0.25); + hL1dPhi->GetXaxis()->SetTitle("L1 - Vis Phi"); + + // L2 Resolution Plots + TH1F* hL2dPt = new TH1F("hL2dPt", "", 50, -50, 50); + hL2dPt->GetXaxis()->SetTitle("L2 - Vis Pt (GeV)"); + + TH1F* hL2dR = new TH1F("hL2dR", "", 50, 0.0, 0.5); + hL2dR->GetXaxis()->SetTitle("L2 - Vis Radius"); + + TH1F* hL2dEta = new TH1F("hL2dEta", "", 50, -0.25, 0.25); + hL2dEta->GetXaxis()->SetTitle("L2 - Vis Eta"); + + TH1F* hL2dPhi = new TH1F("hL2dPhi", "", 50, -0.25, 0.25); + hL2dPhi->GetXaxis()->SetTitle("L2 - Vis Phi"); + + // EF Resolution Plots + TH1F* hEFdPt = new TH1F("hEFdPt", "", 50, -50, 50); + hEFdPt->GetXaxis()->SetTitle("EF - Vis Pt (GeV)"); + + TH1F* hEFdR = new TH1F("hEFdR", "", 50, 0.0, 0.5); + hEFdR->GetXaxis()->SetTitle("EF - Vis Radius"); + + TH1F* hEFdEta = new TH1F("hEFdEta", "", 50, -0.25, 0.25); + hEFdEta->GetXaxis()->SetTitle("EF - Vis Eta"); + + TH1F* hEFdPhi = new TH1F("hEFdPhi", "", 50, -0.25, 0.25); + hEFdPhi->GetXaxis()->SetTitle("EF - Vis Phi"); + + // L2 Resolution vs L1 Plots + TH1F* hL2L1dPt = new TH1F("hL2L1dPt", "", 50, -50, 50); + hL2L1dPt->GetXaxis()->SetTitle("L2 - L1 Pt (GeV)"); + + TH1F* hL2L1dR = new TH1F("hL2L1dR", "", 50, 0.0, 0.5); + hL2L1dR->GetXaxis()->SetTitle("L2 - L1 Radius"); + + TH1F* hL2L1dEta = new TH1F("hL2L1dEta", "", 50, -0.25, 0.25); + hL2L1dEta->GetXaxis()->SetTitle("L2 - L1 Eta"); + + TH1F* hL2L1dPhi = new TH1F("hL2L1dPhi", "", 50, -0.25, 0.25); + hL2L1dPhi->GetXaxis()->SetTitle("L2 - L1 Phi"); + + // EF Resolution vs L2 Plots + TH1F* hEFL2dPt = new TH1F("hEFL2dPt", "", 50, -50, 50); + hEFL2dPt->GetXaxis()->SetTitle("EF - L2 Pt (GeV)"); + + TH1F* hEFL2dR = new TH1F("hEFL2dR", "", 50, 0.0, 0.5); + hEFL2dR->GetXaxis()->SetTitle("EF - L2 Radius"); + + TH1F* hEFL2dEta = new TH1F("hEFL2dEta", "", 50, -0.25, 0.25); + hEFL2dEta->GetXaxis()->SetTitle("EF - L2 Eta"); + + TH1F* hEFL2dPhi = new TH1F("hEFL2dPhi", "", 50, -0.25, 0.25); + hEFL2dPhi->GetXaxis()->SetTitle("EF - L2 Phi"); + + // L1 Resolution vs. Eta + TH2F* hL1EtadPt = new TH2F("hL1EtadPt", "", 50, -2.5, 2.5, 50, -50, 50); + hL1EtadPt->GetXaxis()->SetTitle("Visible Eta"); + hL1EtadPt->GetYaxis()->SetTitle("L1 - Vis Pt (GeV)"); + + TH2F* hL1EtadR = new TH2F("hL1EtadR", "", 50, -2.5, 2.5, 50, 0.0, 0.5); + hL1EtadR->GetXaxis()->SetTitle("Visible Eta"); + hL1EtadR->GetYaxis()->SetTitle("L1 - Vis Radius"); + + TH2F* hL1EtadEta = new TH2F("hL1EtadEta", "", 50, -2.5, 2.5, 50, -0.25, 0.25); + hL1EtadEta->GetXaxis()->SetTitle("Visible Eta"); + hL1EtadEta->GetYaxis()->SetTitle("L1 - Vis Eta"); + + TH2F* hL1EtadPhi = new TH2F("hL1EtadPhi", "", 50, -2.5, 2.5, 50, -0.25, 0.25); + hL1EtadPhi->GetXaxis()->SetTitle("Visible Eta"); + hL1EtadPhi->GetYaxis()->SetTitle("L1 - Vis Phi"); + + // Counters + int nEvent = 0; + int nTrue = 0; + int nGood = 0; + int nL1 = 0; + int nL2 = 0; + int nEF = 0; + + // Loop over all events + int nev = int(tree->GetEntries()); + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + + // Analyze this event + analyzer.analyze(event); + + nEvent++; + nTrue += analyzer.truthList.nMCTauPure(); + nGood += analyzer.truthList.nMCTauGood(); + + // Loop over all good truth taus + unsigned int nTau = analyzer.truthList.nMCTauGood(); + for(unsigned int itau = 0; itau < nTau; ++itau ) { + TrigTauMCTau* tau = &analyzer.truthList.mcTauGoodEntry(itau); + + float visPt = tau->visible().Pt()/1000.; + float visEta = tau->visible().Eta(); + float visPhi = tau->visible().Phi(); + + // + // Match truth with L1 trigger + TrigTauL1Object* l1Tau = analyzer.chainList.getL1Tau(*tau); + if (l1Tau == 0) continue; + + nL1++; + float dPt = l1Tau->Pt()/1000. - visPt; + float dEta = l1Tau->Eta() - visEta; + float dPhi = l1Tau->Phi() - visPhi; + if (dPhi < -TMath::Pi()) dPhi += TMath::TwoPi(); + if (dPhi > +TMath::Pi()) dPhi -= TMath::TwoPi(); + + hL1dPt->Fill(dPt); + hL1dEta->Fill(dEta); + hL1dPhi->Fill(dPhi); + hL1dR->Fill(TMath::Sqrt(dEta*dEta+dPhi*dPhi)); + + hL1EtadPt->Fill(visEta,dPt); + hL1EtadEta->Fill(visEta,dEta); + hL1EtadPhi->Fill(visEta,dPhi); + hL1EtadR->Fill(visEta,TMath::Sqrt(dEta*dEta+dPhi*dPhi)); + + // + // Match truth with L2 trigger + TrigTauL2Object* l2Tau = analyzer.chainList.getL2Tau(*tau); + if (l2Tau == 0) continue; + + nL2++; + dPt = l2Tau->Pt()/1000. - visPt; + dEta = l2Tau->Eta() - visEta; + dPhi = l2Tau->Phi() - visPhi; + if (dPhi < -TMath::Pi()) dPhi += TMath::TwoPi(); + if (dPhi > +TMath::Pi()) dPhi -= TMath::TwoPi(); + + hL2dPt->Fill(dPt); + hL2dEta->Fill(dEta); + hL2dPhi->Fill(dPhi); + hL2dR->Fill(TMath::Sqrt(dEta*dEta+dPhi*dPhi)); + + // + // Match truth with EF trigger + TrigTauRecEFObject* efTau = analyzer.chainList.getEFTau(*tau); + if (efTau == 0) continue; + + nEF++; + dPt = efTau->Pt()/1000. - visPt; + dEta = efTau->Eta() - visEta; + float dPhi = efTau->Phi() - visPhi; + if (dPhi < -TMath::Pi()) dPhi += TMath::TwoPi(); + if (dPhi > +TMath::Pi()) dPhi -= TMath::TwoPi(); + + hEFdPt->Fill(dPt); + hEFdEta->Fill(dEta); + hEFdPhi->Fill(dPhi); + hEFdR->Fill(TMath::Sqrt(dEta*dEta+dPhi*dPhi)); + + } + + // Loop over all L2 passing chains (independent of truth) + unsigned int numL2 = analyzer.chainList.nPassL2Chains(); + for(unsigned int iL2 = 0; iL2 < numL2; iL2++) { + TrigTauTrigChain chain = analyzer.chainList.passL2ChainEntry(iL2); + + float dPt = (chain.L2->Pt() - chain.L1->Pt())/1000.; + float dEta = chain.L2->Eta() - chain.L1->Eta(); + float dPhi = chain.L2->Phi() - chain.L1->Phi(); + if (dPhi < -TMath::Pi()) dPhi += TMath::TwoPi(); + if (dPhi > +TMath::Pi()) dPhi -= TMath::TwoPi(); + + hL2L1dPt->Fill(dPt); + hL2L1dEta->Fill(dEta); + hL2L1dPhi->Fill(dPhi); + hL2L1dR->Fill(TMath::Sqrt(dEta*dEta+dPhi*dPhi)); + } + + // Loop over all EF passing chains (independent of truth) + unsigned int numEF = analyzer.chainList.nPassEFChains(); + for(unsigned int iEF = 0; iEF < numEF; iEF++) { + TrigTauTrigChain chain = analyzer.chainList.passEFChainEntry(iEF); + + float dPt = (chain.EF->Pt() - chain.L2->Pt())/1000.; + float dEta = chain.EF->Eta() - chain.L2->Eta(); + float dEta = chain.EF->Phi() - chain.L2->Phi(); + if (dPhi < -TMath::Pi()) dPhi += TMath::TwoPi(); + if (dPhi > +TMath::Pi()) dPhi -= TMath::TwoPi(); + + hEFL2dPt->Fill(dPt); + hEFL2dEta->Fill(dEta); + hEFL2dPhi->Fill(dPhi); + hEFL2dR->Fill(TMath::Sqrt(dEta*dEta+dPhi*dPhi)); + } + + } // end loop over events + + gROOT->cd(); + + TString plotfile = "resPlots"; + plotfile += append; + + TCanvas * c1 = (TCanvas *) gROOT->Get("c1"); + if( c1 ) delete c1; + c1 = new TCanvas("c1","L1 Selected",10,10,800,620); + c1->Divide(2,2); + c1->cd(1); hL1dPt->Draw(); + c1->cd(2); hL1dR->Draw(); + c1->cd(3); hL1dEta->Draw(); + c1->cd(4); hL1dPhi->Draw(); + c1->Print(plotfile + ".ps("); + + TCanvas * c2 = (TCanvas *) gROOT->Get("c2"); + if( c2 ) delete c2; + c2 = new TCanvas("c2","L2 Selected",10,10,800,620); + c2->Divide(2,2); + c2->cd(1); hL2dPt->Draw(); + c2->cd(2); hL2dR->Draw(); + c2->cd(3); hL2dEta->Draw(); + c2->cd(4); hL2dPhi->Draw(); + c2->Print(plotfile + ".ps"); + + TCanvas * c3 = (TCanvas *) gROOT->Get("c3"); + if( c3 ) delete c3; + c3 = new TCanvas("c3","EF Selected",10,10,800,620); + c3->Divide(2,2); + c3->cd(1); hEFdPt->Draw(); + c3->cd(2); hEFdR->Draw(); + c3->cd(3); hEFdEta->Draw(); + c3->cd(4); hEFdPhi->Draw(); + c3->Print(plotfile + ".ps"); + + TCanvas * c4 = (TCanvas *) gROOT->Get("c4"); + if( c4 ) delete c4; + c4 = new TCanvas("c4","L2 Selected",10,10,800,620); + c4->Divide(2,2); + c4->cd(1); hL2L1dPt->Draw(); + c4->cd(2); hL2L1dR->Draw(); + c4->cd(3); hL2L1dEta->Draw(); + c4->cd(4); hL2L1dPhi->Draw(); + c4->Print(plotfile + ".ps"); + + TCanvas * c5 = (TCanvas *) gROOT->Get("c5"); + if( c5 ) delete c5; + c5 = new TCanvas("c5","EF Selected",10,10,800,620); + c5->Divide(2,2); + c5->cd(1); hEFL2dPt->Draw(); + c5->cd(2); hEFL2dR->Draw(); + c5->cd(3); hEFL2dEta->Draw(); + c5->cd(4); hEFL2dPhi->Draw(); + c5->Print(plotfile + ".ps)"); + +// TCanvas * c6 = (TCanvas *) gROOT->Get("c6"); +// if( c6 ) delete c6; +// c6 = new TCanvas("c6","L1 Selected",10,10,800,620); +// c6->Divide(2,2); +// c6->cd(1); hL1EtadPt->Draw(); +// c6->cd(2); hL1EtadR->Draw(); +// c6->cd(3); hL1EtadEta->Draw(); +// c6->cd(4); hL1EtadPhi->Draw(); +// c6->Print(plotfile + ".ps"); + + // Print out matching statistics + analyzer.trigMan.print(); + cout << "Events: " << nEvent << endl; + cout << "True Taus: " << nTrue << endl; + cout << "Good Taus: " << nGood << " -> " + << float(nGood)/nEvent << " Good/Ev" << endl; + if (nGood>0) { + cout << "L1 Matched: " << nL1 << " -> " + << (100.*nL1)/nGood << "% L1/Good" << endl; + cout << "L2 Matched: " << nL2 << " -> " + << (100.*nL2)/nGood << "% L2/Good" << endl; + cout << "EF Matched: " << nEF << " -> " + << (100.*nEF)/nGood << "% EF/Good" << endl; + } + + delete event; + delete tree; + delete file; + + // Output to plot + return; +} + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/runTrigTauEffTool.csh b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/runTrigTauEffTool.csh new file mode 100755 index 0000000000000000000000000000000000000000..e8dbbbcc73016408002e0387ce5d6d7381e5e59c --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/runTrigTauEffTool.csh @@ -0,0 +1,104 @@ +#!/bin/csh +source setup.csh +root -b <<EOF |& grep -v TVector + + // Not sure why, but I need this here + TFile tf; + + TrigTauEffTool tr; + tr.setRecoMatch(false); + + // Pick a selection + // tr.setDefaultVersion(TrigTauSelectionManager::MENU13030pre); + tr.setDefaultVersion(TrigTauSelectionManager::MENU1400); + + + tr.defineSelector("tau12", TrigTauFlags::TAU12); + tr.defineSelector("tau16i", TrigTauFlags::TAU16I); + tr.defineSelector("tau20i", TrigTauFlags::TAU20I); + tr.defineSelector("tau29i", TrigTauFlags::TAU29I); + tr.defineSelector("tau38", TrigTauFlags::TAU38); + tr.defineSelector("tau38i", TrigTauFlags::TAU38I); + tr.defineSelector("tau50", TrigTauFlags::TAU50); + tr.defineSelector("tau84", TrigTauFlags::TAU84); + tr.defineSelector("tau125", TrigTauFlags::TAU125); + + tr.defineSelector("tau12_medium", TrigTauFlags::TAU12_MEDIUM); + tr.defineSelector("tau16i_medium", TrigTauFlags::TAU16I_MEDIUM); + tr.defineSelector("tau20i_medium", TrigTauFlags::TAU20I_MEDIUM); + tr.defineSelector("tau29i_medium", TrigTauFlags::TAU29I_MEDIUM); + tr.defineSelector("tau38_medium", TrigTauFlags::TAU38_MEDIUM); + tr.defineSelector("tau38i_medium", TrigTauFlags::TAU38I_MEDIUM); + tr.defineSelector("tau50_medium", TrigTauFlags::TAU50_MEDIUM); + tr.defineSelector("tau84_medium", TrigTauFlags::TAU84_MEDIUM); + tr.defineSelector("tau125_medium", TrigTauFlags::TAU125_MEDIUM); + + tr.defineSelector("tau12_tight", TrigTauFlags::TAU12_TIGHT); + tr.defineSelector("tau16i_tight", TrigTauFlags::TAU16I_TIGHT); + tr.defineSelector("tau20i_tight", TrigTauFlags::TAU20I_TIGHT); + tr.defineSelector("tau29i_tight", TrigTauFlags::TAU29I_TIGHT); + tr.defineSelector("tau38_tight", TrigTauFlags::TAU38_TIGHT); + tr.defineSelector("tau38i_tight", TrigTauFlags::TAU38I_TIGHT); + tr.defineSelector("tau50_tight", TrigTauFlags::TAU50_TIGHT); + tr.defineSelector("tau84_tight", TrigTauFlags::TAU84_TIGHT); + tr.defineSelector("tau125_tight", TrigTauFlags::TAU125_TIGHT); + + +// tr.fillSample("5107", "ntuples/5107/trig1_misal1_csc11.005107.pythia_Wtauhad.recon.AOD.v13003003.TTP06.merged.0.root"); +// tr.fillSample("misal", "ntuples/5107_misal1day/misal_1day_5107.AOD.v13040.TTP06.2.root"); +// tr.fillSample("misal", "ntuples/5107_misal1day/misal_1day_5107.AOD.v13040.TTP06.3.root"); +// tr.fillSample("misal", "ntuples/5107_misal1day/misal_1day_5107.AOD.v13040.TTP06.4.root"); +// tr.fillSample("misal", "ntuples/5107_misal1day/misal_1day_5107.AOD.v13040.TTP06.5.root"); + + tr.fillSample("5200", "ntuples/trigtau.5200.TTP07.RDO.rel3.root"); + + + + + // tr.print(); + + + + tr.printSelector("tau12" , true); + tr.printSelector("tau16i", true); + tr.printSelector("tau20i", true); + tr.printSelector("tau29i", true); + tr.printSelector("tau38" , true); + tr.printSelector("tau38i", true); + tr.printSelector("tau50" , true); + tr.printSelector("tau84" , true); + tr.printSelector("tau125", true); + + + tr.printSelector("tau12_medium" , true); + tr.printSelector("tau16i_medium", true); + tr.printSelector("tau20i_medium", true); + tr.printSelector("tau29i_medium", true); + tr.printSelector("tau38_medium" , true); + tr.printSelector("tau38i_medium", true); + tr.printSelector("tau50_medium" , true); + tr.printSelector("tau84_medium" , true); + tr.printSelector("tau125_medium", true); + + + tr.printSelector("tau12_tight" , true); + tr.printSelector("tau16i_tight", true); + tr.printSelector("tau20i_tight", true); + tr.printSelector("tau29i_tight", true); + tr.printSelector("tau38_tight" , true); + tr.printSelector("tau38i_tight", true); + tr.printSelector("tau50_tight" , true); + tr.printSelector("tau84_tight" , true); + tr.printSelector("tau125_tight", true); + + + + + tr.printSummary(); + + tr.printCutFlow("tau20i"); + tr.printCutFlow("tau60"); + + // tr.printL1Summary(); + +EOF diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/validateDecision.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/validateDecision.cxx new file mode 100644 index 0000000000000000000000000000000000000000..aae72675fdc90763d71f738a34dafe7a5947d830 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/macros/validateDecision.cxx @@ -0,0 +1,287 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + // Create counters to hold triggered object counts +static long nEvent; +static long nL1Sel; +static long nL2Sel; +static long nL2CalSel; +static long nEFSel; + +static int nDecL1; +static int nDecL2; +static int nDecEF; + +static double nEventWt; +static double nL1SelWt; +static double nL2SelWt; +static double nL2SelCalWt; +static double nEFSelWt; + +void rateTable2EllClear(); +void rateTable2EllPrint(); + +// Menu2 should either be E10, Mu10, or tau +void validateDecision(const char* filename="ntuples/trigtau.5200.root", + TrigTauFlags::TRIGGERMENU menu1 = TrigTauFlags::TAU16I, float met = 0.) +{ + rateTable2EllClear(); + gROOT->cd(); + + // Open file + TFile* file = new TFile(filename); + if (!file->IsOpen()) { + cerr << "Can't open file " << filename << endl; + return; + } + + // Initialize tree + TTree* tree = (TTree*)file->Get("eventTree"); + if (tree == 0) { + cerr << "Can't find eventTree in " << filename << endl; + return; + } + TrigTauEvent* event = new TrigTauEvent(); + tree->SetBranchAddress("EventBranch", &event); + tree->SetBranchStatus("*", 1); + tree->SetBranchStatus("mcEvent*", 0); + + // Create our analyzer class + TrigTauAnalyzer analyzer; + + // Also set an L1 MET cut if desired + analyzer.trigMan.setL1MET(met); + TrigTauSelectionManager trigMan1; + trigMan1.setMenuVersion(TrigTauSelectionManager::MENU13030pre); + trigMan1.setTauMenu(menu1); + + //trigMan1.setL2CalOnly(false); + bool checkL2Cal = true; + + int nPrintL1 = 0; + int nPrintL2 = 0; + int nPrintEF = 0; + + // Loop over all events + int nev = int(tree->GetEntries()); + for(int iev = 0; iev<nev; ++iev) { + event->reset(); + tree->GetEvent(iev); + + bool decL1 = event->decision.passedL1(menu1); + bool decL2 = event->decision.passedL2(menu1); + bool decEF = event->decision.passedEF(menu1); + + nDecL1 += int(decL1); + nDecL2 += int(decL2); + nDecEF += int(decEF); + + bool ntL1 = false; + bool ntL2 = false; + bool ntEF = false; + + // Analyze this event + analyzer.chainList.fillChainList(event); + + nEvent++; + + bool pass = false; + + // Look for L1 pass + unsigned int numCh = analyzer.chainList.nTrigChains(); + if( event->eventNumber == 1195 ) cout << "1195 number of chains " << numCh << endl; + for (unsigned int iCh1=0; iCh1 < numCh; ++iCh1) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedL1(ch1)){ + continue; + } + pass = true; + if (pass) break; + } + +// if( pass != decL1 ) continue; +// nDecL1 += int(decL1); +// nDecL2 += int(decL2); +// nDecEF += int(decEF); + + if (pass) { + nL1Sel++; + ntL1 = true; + } + + + // Look for L2Calo pass + if( checkL2Cal ){ + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedL2Cal(ch1)) continue; + + pass = true; + if (pass) break; + } + + if (pass) { + nL2CalSel++; + } + } + + // Look for L2 pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedL2(ch1)) continue; + + pass = true; + if (pass) break; + } + + if (pass) { + nL2Sel++; + ntL2 = true; + } + + + // Look for EF pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedEF(ch1)) continue; + pass = true; + if (pass) break; + } + + if (pass) { + nEFSel++; + ntEF=true; + } + + bool printChain=false; + if( decL1 != ntL1 ) { + cout << "Event " << event->eventNumber << " L1 decision does not match: NTUPLE " << ntL1 << " + and HLTcode " << decL1 << endl; + printChain = true; + nPrintL1++; + + } + if( decL2 != ntL2 ) { + cout << "Event " << event->eventNumber << " L2 decision does not match: NTUPLE " << ntL2 << " + and HLTcode " << decL2 << endl; + printChain = true; + nPrintL2++; + } + if( decEF != ntEF ) { + cout << "Event " << event->eventNumber << " EF decision does not match: NTUPLE " << ntEF << " + and HLTcode " << decEF << endl; + printChain = true; + nPrintEF++; + } + if( printChain ) + { + analyzer.chainList.printChainList(); + cout << endl; + trigMan1.setDebug(true); + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + cout << " ==================================\n"; + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + if (!trigMan1.passedL1(ch1)) continue; + if (!trigMan1.passedL2(ch1)) continue; + if (!trigMan1.passedEF(ch1)) continue; + } + trigMan1.setDebug(false); + cout << endl; + } + + + } // end loop over events + + // trigMan1.print(); + // trigMan2.print(); + + delete event; + delete tree; + delete file; + + cout << " Use menu " << menu1.menuName(menu1) << endl; + //trigMan1.print(); +rateTable2EllPrint() ; + + cout << "Mistmatch found in L1 " << nPrintL1 << " , L2 " << nPrintL2 << ", EF " << nPrintEF << endl; + + + return; +} + +void rateTable2EllPrint() { + + + // Print out matching statistics + cout << "Events: " << nEvent << endl; + + cout << "L1Sel L2CalSel L2TrkSel EFSel" << endl; + + cout << "Decision : " + << nDecL1 << " " + << nDecL2 << " " + << nDecEF << endl; + + + cout << "Number: " + << nL1Sel << " " + << nL2CalSel << " " + << nL2Sel << " " + << nEFSel << endl; + + //cout << "Rate: " + // << nL1SelWt << " " + // << nL2SelWt << " " + // << nEFSelWt << endl; + + cout << "Cum Eff: " + << 100*float(nL1Sel)/nEvent << " " + << 100*float(nL2CalSel)/nEvent << " " + << 100*float(nL2Sel)/nEvent << " " + << 100*float(nEFSel)/nEvent << endl; + +// cout << "Dif Eff: " +// << 100*float(nL1Sel)/nEvent << " " +// << (nL1Sel > 0 ? 100*float(nL2CalSel)/nL1Sel : 0) << " " +// << (nL2CalSel > 0 ? 100*float(nL2Sel)/nL2CalSel : 0) +// << (nL2Sel > 0 ? 100*float(nEFSel)/nL2Sel : 0) << endl; + +// cout << "Cum Rej: " +// << (nL1Sel > 0 ? nEvent/float(nL1Sel) : 0) << " " +// << (nL2CalSel > 0 ? nEvent/float(nL2CalSel) : 0) << " " +// << (nL2Sel > 0 ? nEvent/float(nL2Sel) : 0) << " " +// << (nEFSel > 0 ? nEvent/float(nEFSel) : 0) << endl; + +// cout << "Dif Rej: " +// << (nL1Sel > 0 ? nEvent/float(nL1Sel) : 0) << " " +// << (nL2CalSel > 0 ? nL1Sel/float(nL2CalSel) : 0) << " " +// << (nL2Sel > 0 ? nL2CalSel/float(nL2Sel) : 0) << " " +// << (nEFSel > 0 ? nL2Sel/float(nEFSel) : 0) << endl; + +} + +void rateTable2EllClear() { + // Create counters to hold triggered object counts + nEvent = 0; + nL1Sel = 0; + nL2Sel = 0; + nEFSel = 0; + nEventWt = 0.; + nL1SelWt = 0.; + nL2SelWt = 0.; + nEFSelWt = 0.; + +nDecL1= 0; +nDecL2= 0; +nDecEF= 0; + +} + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauAnalyzer.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauAnalyzer.cxx new file mode 100755 index 0000000000000000000000000000000000000000..1ed988eef810da8c06e3723e28dbb0cd8ee6956f --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauAnalyzer.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauAnalyzer.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to manage the individual L1/L2/EF selectors. +/// Can also be used to define complete trigger menus +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauAnalyzer.h" + +#include "TrigTauPerformNtuple/TrigTauEvent.h" + +#include <iostream> +using namespace std; + +ClassImp(TrigTauAnalyzer) + +// +// ----------------------------------------------------------------------- +// + +TrigTauAnalyzer::TrigTauAnalyzer() : _debug(false) { +} + +TrigTauAnalyzer::~TrigTauAnalyzer() { +} + +void +TrigTauAnalyzer::analyze(const TrigTauEvent* event, bool signal, + TrigTauMCTauList::OFFLINESELECTION offline) { + truthList.setRecoSelection(offline); + analyze(event,signal); +} + +void +TrigTauAnalyzer::analyze(const TrigTauEvent* event, bool signal) { + + if (event == 0) { + cout << "TrigTauAnalyzer::analyze - event pointer is NULL!" << endl; + return; + } + + if (signal) { + + // Fill the MC truth list + if (_debug) cout << "Fill truth pure list" << endl; + truthList.fillPureList(&event->mcEvent); + if (_debug) cout << "Fill truth good list" << endl; + truthList.fillGoodList(); + if (_debug) cout << "Apply offline match" << endl; + truthList.requireRecoMatch(*event); + } + + // Fill trigger chains + if (_debug) cout << "Fill chain list" << endl; + chainList.fillChainList(event); + if (_debug) cout << "Fill trigger list" << endl; + chainList.fillTriggerList(trigMan); + +} + +void TrigTauAnalyzer::printSettings() const +{ + + truthList.printSettings(); + trigMan.printSettings(); +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauBugFix.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauBugFix.cxx new file mode 100644 index 0000000000000000000000000000000000000000..26eed3f315bf832da7b81094af6311a1c76fbada --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauBugFix.cxx @@ -0,0 +1,521 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauBugFix.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence, Olya Igonkina +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to manage the individual //EF selectors. +/// Can also be used to define complete trigger menus +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauBugFix.h" +#include "TrigTauPerformNtuple/TrigTauEvent.h" + +#include <math.h> +#include <iostream> +using namespace std; + +ClassImp(TrigTauBugFix) + +// +// ----------------------------------------------------------------------- +// + +int TrigTauBugFix::setTTPVersion(const TString & fileName) // sets both m_TTP and m_fileType +{ + // default + m_TTP = TTP12; m_fileType = RDO; + // --------------- 1 ---------------------------------- + // specific cases + //if( fileName.Contains("generic_part_of_name_of_the_set") ){ + // m_TTP = ; m_fileType = AOD; return 0; + // }else if( fileName.Contains("generic_part_of_name_of_the_set") ){ + // m_TTP = ; m_fileType = AOD; return 0; + // } + + + // --------------- 2 ---------------------------------- + // generic determination + if( fileName.Contains("TTP15",TString::kIgnoreCase) ) { + m_TTP = TTP15; + } else if( fileName.Contains("TTP14",TString::kIgnoreCase) ) { + m_TTP = TTP14; + } else if( fileName.Contains("TTP13",TString::kIgnoreCase) ) { + m_TTP = TTP13; + } else if( fileName.Contains("TTP12",TString::kIgnoreCase) ) { + m_TTP = TTP12; + } else if( fileName.Contains("TTP11",TString::kIgnoreCase) ) { + m_TTP = TTP11; + } else if( fileName.Contains("TTP10",TString::kIgnoreCase) ) { + m_TTP = TTP10; + } else if( fileName.Contains("TTP09",TString::kIgnoreCase) || + fileName.Contains("TTP9",TString::kIgnoreCase) ) { + m_TTP = TTP9; + } else if( fileName.Contains("TTP07",TString::kIgnoreCase) || + fileName.Contains("TTP7",TString::kIgnoreCase) ) { + m_TTP = TTP7; + } else if( fileName.Contains("TTP06",TString::kIgnoreCase) || + fileName.Contains("TTP6",TString::kIgnoreCase) ) { + m_TTP = TTP6; + } else if( fileName.Contains("TTP05",TString::kIgnoreCase) || + fileName.Contains("TTP5",TString::kIgnoreCase) ) { + m_TTP = TTP5; + }else if ( fileName.Contains("TTP04",TString::kIgnoreCase) || + fileName.Contains("TTP4", TString::kIgnoreCase) ){ + m_TTP = TTP4; m_fileType = AOD; return 0; + } + + if ( fileName.Contains("RDO") ) m_fileType = RDO; + else if ( fileName.Contains("ESD") ) m_fileType = ESD; + else if ( fileName.Contains("AOD") ) m_fileType = AOD; + else { + m_fileType = RDO; + cout << " TrigTauBugFix WARNING : can not identify file type of " << fileName << endl; + } + + + return 0; +} + +void +TrigTauBugFix::fix(TrigTauEvent* event) { + + if (event == 0) { + cout << "TrigTauBugFix::analyze - event pointer is NULL!" << endl; + return; + } + m_nTotal++; + + + //===================================== + if( m_TTP == TTP15 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP15, RDO - L1 units was GeV, now is MeV; \n"; + first=false; + } + correctL1GeVtoMev(event); + } + } + + //===================================== + else if( m_TTP == TTP14 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP14, RDO - L1 units was GeV, now is MeV; \n"; + first=false; + } + correctL1GeVtoMev(event); + } + } + + //===================================== + else if( m_TTP == TTP13 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP13, RDO - L1 units was GeV, now is MeV; \n"; + first=false; + } + correctL1GeVtoMev(event); + } + } + + //===================================== + else if( m_TTP == TTP12 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP12, RDO - L1 units was GeV, now is MeV; \n"; + first=false; + } + correctL1GeVtoMev(event); + attachTRTOnlyTracks(event); + } + } + + //===================================== + else if( m_TTP == TTP11 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP11, RDO - L1 units was GeV, now is MeV; \n" + <<" Events with ZeroTrack pointers are removed - might be an issue for high occupancy events\n"; + first=false; + } + correctL1GeVtoMev(event); + event->mcEvent.recalculateEtMissTrue(); + resetIfZeroPointerTracks(event); + } + } + + //===================================== + else if( m_TTP == TTP10 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP10, RDO - L1 units was GeV, now is MeV\n"; + first=false; + } + correctL1GeVtoMev(event); + } + } + + //===================================== + else if( m_TTP == TTP9 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP9, RDO - L1 units was GeV, now is MeV\n"; + //cout << " TEST!!! Correct EF EMRadius by 1./1.13!! (to conver dR=0.4 to dR=0.3 EMRad) \n"; + first=false; + } + correctL1GeVtoMev(event); + //removeDuplicateTracks(event); + //resetIfl2roiWordIs0(event); + + // TEST !!!! +// for(unsigned int iEF = 0; iEF < event->nTauEF(); ++iEF) +// { +// TrigTauRecEFObject * ef = &event->tauEFEntry(iEF); +// ef->m_EMRadius /= 1.13; +// } + + + + } + + + //===================================== + }else if( m_TTP == TTP7 ) + //===================================== + { + if( m_fileType == RDO ) + { + static bool first=true; + if (first) + { + cout <<" TrigTauBugFix::fix for TTP7, RDO - L1 units was GeV, now is MeV, track duplicates are removed\n"; + first=false; + } + correctL1GeVtoMev(event); + removeDuplicateTracks(event); + //resetIfl2roiWordIs0(event); + } + + + //===================================== + }else if( m_TTP == TTP5 || m_TTP == TTP6 || m_TTP == TTP4 ) + //===================================== + { + cout << " This version of TrigTauperformAnalysis is not compatible with ntuples before TTP08\n" + << " please use TrigTauPerformAnalysis-00-02-17 instead \n"; + + } + +} + + + + +float TrigTauBugFix::tauRec_et_corr_TTP4(double et_in, double eta_in, int ntrk) const +{ + + double m_ptetacorrectionsntr1[9] = { 0.8339, 0.8125, 0.8254, + 0.8747, 0.8583, 0.8594, + 0.9088, 0.9013, 0.8922}; + double m_ptetacorrectionsntr23[9]= { 0.9000, 0.8593, 0.9034, + 0.9208, 0.8791, 0.9132, + 0.9359, 0.9231, 0.9033}; + + const int m_nptbins = 3; + const int m_netabins = 3; + + double m_ptpoints[m_nptbins] = {15000, 35000, 150000}; + double m_etapoints[m_netabins] = {0.25, 1.0, 2.0}; + + double et = et_in; + double eta = fabs( eta_in ); + double corr = 1, fudge = 1.011; + + unsigned int lowpt_idx = 0; + unsigned int loweta_idx = 0; + + double lowpt_frac = 0; + double loweta_frac = 0; + + while ( lowpt_idx < m_nptbins-1 && et > m_ptpoints[lowpt_idx+1] ) + lowpt_idx++; + + if( lowpt_idx < m_nptbins-1) + lowpt_frac = ( m_ptpoints[lowpt_idx+1] - et ) / + ( m_ptpoints[lowpt_idx+1] - m_ptpoints[lowpt_idx] ); + + if ( lowpt_frac > 1 ) + lowpt_frac = 1; + if( lowpt_frac < 0 ) { //should never happen, only if ptNumberOfBins is set wrong (which is checked now) + std::cerr << "FIXME: lowpt_frac < 0 !!" << std::endl; + } + + while ( loweta_idx < m_netabins-1 && eta > m_etapoints[loweta_idx+1] ) + loweta_idx++; + + if( loweta_idx < m_netabins-1) + loweta_frac = ( m_etapoints[loweta_idx+1] - eta ) / + ( m_etapoints[loweta_idx+1] - m_etapoints[loweta_idx] ); + + if ( loweta_frac > 1) + loweta_frac = 1; + if( loweta_frac < 0 ) { //should never happen, only if etaNumberOfBins is set wrong + std::cerr << "FIXME: loweta_frac < 0 !!" << std::endl; + } + + double coeff_matrix[2][2] = { {0, 0}, {0, 0} }; + + if ( ntrk <= 1 ) { + coeff_matrix[0][0] = m_ptetacorrectionsntr1[lowpt_idx*m_netabins+loweta_idx]; + if( lowpt_idx < m_nptbins-1 ) + coeff_matrix[1][0] = m_ptetacorrectionsntr1[(lowpt_idx+1)*m_netabins+loweta_idx]; + if( loweta_idx < m_netabins-1 ) + coeff_matrix[0][1] = m_ptetacorrectionsntr1[lowpt_idx*m_netabins+(loweta_idx+1)]; + if( lowpt_idx < m_nptbins-1 && loweta_idx < m_netabins-1 ) + coeff_matrix[1][1] = m_ptetacorrectionsntr1[(lowpt_idx+1)*m_netabins+(loweta_idx+1)]; + } else { + coeff_matrix[0][0] = m_ptetacorrectionsntr23[lowpt_idx*m_netabins+loweta_idx]; + if( lowpt_idx < m_nptbins-1 ) + coeff_matrix[1][0] = m_ptetacorrectionsntr23[(lowpt_idx+1)*m_netabins+loweta_idx]; + if( loweta_idx < m_netabins-1 ) + coeff_matrix[0][1] = m_ptetacorrectionsntr23[lowpt_idx*m_netabins+(loweta_idx+1)]; + if( lowpt_idx < m_nptbins-1 && loweta_idx < m_netabins-1 ) + coeff_matrix[1][1] = m_ptetacorrectionsntr23[(lowpt_idx+1)*m_netabins+(loweta_idx+1)]; + } + + corr = ( coeff_matrix[0][0] * lowpt_frac * loweta_frac ) + ( coeff_matrix[1][0] * (1-lowpt_frac) * loweta_frac ); + corr += ( coeff_matrix[0][1] * lowpt_frac * (1-loweta_frac) ) + ( coeff_matrix[1][1] * (1-lowpt_frac) * (1-loweta_frac) ); + + et *= corr*fudge; + + return et; +} + + +bool TrigTauBugFix::correctL1GeVtoMev(TrigTauEvent* event ) +{ + bool corrected = false; + + for(std::vector<TrigTauL1Object*>::iterator + l2 = event->tauL1.begin(); l2 != event->tauL1.end(); ++l2) { + + if( (*l2)->m_TauEnergy > 3000. ) continue; // this was correct + corrected = true; + (*l2)->m_EmEnergy *= 1000.; + (*l2)->m_TauEnergy *= 1000.; + (*l2)->m_EmIsol *= 1000.; + (*l2)->m_HdIsol *= 1000.; + (*l2)->m_EmCore *= 1000.; + (*l2)->m_HdCore *= 1000.; + + } + + if( corrected ) m_nL1GeVtoMeV_Error++; + return corrected; +} + + +bool TrigTauBugFix::removeDuplicateTracks(TrigTauEvent* event) +{ + // fix of duplicate tracks + bool corrected = false; + for(unsigned int iL2 = 0; iL2 < event->nTauL2(); ++iL2) + corrected |= removeDuplicateTracks(&(event->tauL2Entry(iL2) )); + + //for(unsigned int iL3 = 0; iL3< event->nTauEF(); ++iL3) + //corrected |= removeDuplicateTracks(&(event->tauL2Entry(iL3) )); + + if( corrected ) m_nDuplicateTrack_Error++; + + return corrected; +} + +bool TrigTauBugFix::removeDuplicateTracks(TrigTauL2Object * l2) +{ + vector<TrigTauTrack> newList; + + unsigned int nTracks = l2->nTracks() ; + newList.reserve(nTracks); + for(unsigned int itr = 0; itr < nTracks; ++itr ) + { + const TrigTauTrack * track = &l2->track(itr); + bool ok = true; + for(std::vector<TrigTauTrack>::iterator jtrack = newList.begin(); + ok && jtrack != newList.end(); jtrack++ ) + { + if( fabs(jtrack->Px() - track->Px())<1.e-5 && + fabs(jtrack->Py() - track->Py())<1.e-5 && + fabs(jtrack->Pz() - track->Pz())<1.e-5 ) + { + ok = false; + } + } + if( ok ) newList.push_back(*track); + } + bool corrected = false; + if( newList.size() != nTracks ) // duplicates found + { + corrected = true; + l2->resetTracks(); + for(std::vector<TrigTauTrack>::iterator jtrack = newList.begin(); + jtrack != newList.end(); jtrack++) + l2->tracks.push_back(new TrigTauTrack(*jtrack)); + } + + return corrected; + +} + +bool TrigTauBugFix::resetIfl2roiWordIs0(TrigTauEvent* event) +{ + bool corrected = false; + + for(unsigned int iL2 = 0; !corrected && iL2 < event->nTauL2(); ++iL2) + { + TrigTauL2Object * l2 = &event->tauL2Entry(iL2); + if( l2->m_roiWord == 0 ) + { + corrected = true; + event->reset(); + } + } + + + if( corrected ) m_nDuplicateTrack_Error++; + return corrected; + +} + + +bool TrigTauBugFix::resetIfZeroPointerTracks(TrigTauEvent* event) +{ + bool corrected = false; + + for(unsigned int iEF = 0; !corrected && iEF < event->nTauEF(); ++iEF) + { + TrigTauRecEFObject * ef = &event->tauEFEntry(iEF); + + for(unsigned int itrk = 0; !corrected && itrk < ef->nTracks(); ++ itrk) + { + if( &ef->track(itrk) == 0 ){ // should be non-zero pointer, but.. + corrected = true; + event->reset(); + } + } + } + + + if( corrected ) m_nZeroPointerTracks_Error++; + return corrected; + +} + +bool TrigTauBugFix::attachTRTOnlyTracks(TrigTauEvent* event) +{ + bool corrected = false; + + for(unsigned int iEF = 0; iEF < event->nTauEF(); ++iEF) + { + TrigTauRecEFObject * ef = &event->tauEFEntry(iEF); + if( !ef->m_tags.isTau_TRTONLY() )continue; + + for(unsigned int itrRoI = 0; itrRoI < event->nTracksRoIEF(); ++ itrRoI) + { + TrigTauTrackCollection * trkRoI = &event->trackRoIEFEntry(itrRoI); + if( trkRoI->m_roiWord != ef->m_roiWord ) continue; + for(unsigned int itr = 0; itr < trkRoI->nTracks(); ++itr) + { + TrigTauTrack * track = &trkRoI->track(itr) ; + if( track->m_nTRTHits &&track->m_nStrawHits == 0 ) continue; + if( track->m_nPixelHits != 0 ) continue; + if( track->m_nSCTHits != 0 ) continue; + ef->r_tracks.Add(track); + ef->r_looseTracks.Add(track); + corrected = true; + } + + } + } + + + if( corrected ) m_nTRTOnlyTracks++; + return corrected; + +} + + + + +void TrigTauBugFix::printSummary() const +{ + cout << " The correction was applied for "; + switch (m_TTP) { + case TTP12 : cout << " TTP12 "; break; + case TTP11 : cout << " TTP11 "; break; + case TTP10 : cout << " TTP10 "; break; + case TTP9 : cout << " TTP09 "; break; + case TTP7 : cout << " TTP07 "; break; + case TTP6 : cout << " TTP06 "; break; + case TTP5 : cout << " TTP05 "; break; + case TTP4 : cout << " TTP04 "; break; + default : cout << " unknown TTP type"; break; + } + + switch (m_fileType){ + case RDO : cout << " RDO "; break; + case AOD : cout << " AOD "; break; + case ESD : cout << " ESD "; break; + } + + cout << "\nFound number of events with :\n" + << " L1 with MeV units - " << m_nL1GeVtoMeV_Error << endl + << " L2 with 0 roiWord - " << m_nL2roiWordIs0_Error << endl + << " with duplicated tracks - " << m_nDuplicateTrack_Error << endl + << " with EF pointing to non-existing track - " << m_nZeroPointerTracks_Error << endl + << " events where TRTOnly is attached to tauRec - " <<m_nTRTOnlyTracks << endl + << "out of total " << m_nTotal << " events "<< endl; + +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauDoubleTrigger.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauDoubleTrigger.cxx new file mode 100755 index 0000000000000000000000000000000000000000..b74b9838707ba2b14e4125232d2a2c6845b3705b --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauDoubleTrigger.cxx @@ -0,0 +1,253 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauAnalyzer.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Olga Igonkina (University of Oregon) +/// Created : April 2007 +/// +/// DESCRIPTION: +/// Class to manage the double triggers +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauDoubleTrigger.h" + +#include "TrigTauPerformNtuple/TrigTauEvent.h" + +#include <iostream> +using namespace std; + +ClassImp(TrigTauDoubleTrigger) + +TrigTauDoubleTrigger::~TrigTauDoubleTrigger(){} + +// Menu2 should either be E10, Mu10, or tau +TrigTauDoubleTrigger::TrigTauDoubleTrigger(TrigTauFlags::TRIGGERMENU item1, + TrigTauFlags::TRIGGERMENU item2) + : analyzer(), trigMan1(), trigMan2() +{ + bool tau1 = (item1 == TrigTauFlags::TAU12 || + item1 == TrigTauFlags::TAU16 || item1 == TrigTauFlags::TAU20 || + item1 == TrigTauFlags::TAU29 || item1 == TrigTauFlags::TAUNOCUT ); + + bool tau2 = ( + item2 == TrigTauFlags::TAU12 || + item2 == TrigTauFlags::TAU16 || item2 == TrigTauFlags::TAU20 || + item2 == TrigTauFlags::TAU29 || item2 == TrigTauFlags::TAUNOCUT ); + + menuWithTau = (tau1 || tau2); + bothMenuWithTau = tau1 && tau2; + if( !tau1 && tau2 ){ menu1 = item2; menu2= item1; } + else { menu1 = item1; menu2 = item2;} + +// cout << " menuWithTau " << menuWithTau << endl; +// cout << " bothMenuWithTau " << bothMenuWithTau << endl; +// cout << " menu1 " << menu1 << endl; +// cout << " menu2 " << menu2 << endl; + + + float met = 0; + menuWithMET = false; + if( item1 == TrigTauFlags::MET15 || item2 == TrigTauFlags::MET15 ) + {met = 15; menuWithMET = true; + if(!tau1 && item2 == TrigTauFlags::MET15 ){menu1=item2; menu2=item1;} + } + if( item1 == TrigTauFlags::MET20 || item2 == TrigTauFlags::MET20 ) + {met = 20; menuWithMET = true; + if(!tau1 && item2 == TrigTauFlags::MET20 ){menu1=item2; menu2=item1;} + } + if( item1 == TrigTauFlags::MET25 || item2 == TrigTauFlags::MET25 ) + {met = 25; menuWithMET = true; + if(!tau1 && item2 == TrigTauFlags::MET25 ){menu1=item2; menu2=item1;} + } + if( item1 == TrigTauFlags::MET30 || item2 == TrigTauFlags::MET30 ) + {met = 30; menuWithMET = true; + if(!tau1 && item2 == TrigTauFlags::MET30 ){menu1=item2; menu2=item1;} + } + if( item1 == TrigTauFlags::MET40 || item2 == TrigTauFlags::MET40 ) + {met = 40; menuWithMET = true; + if(!tau1 && item2 == TrigTauFlags::MET40 ){menu1=item2; menu2=item1;} + } + if( item1 == TrigTauFlags::MET50 || item2 == TrigTauFlags::MET50 ) + {met = 50; menuWithMET = true; + if(!tau1 && item2 == TrigTauFlags::MET50 ){menu1=item2; menu2=item1;} + } +// if( item1 == TrigTauFlags::MET70 || item2 == TrigTauFlags::MET70 ) +// {met = 70; menuWithMET = true; +// if(!tau1 && item2 == TrigTauFlags::MET70 ){menu1=item2; menu2=item1;} +// } +// if( item1 == TrigTauFlags::MET80 || item2 == TrigTauFlags::MET80 ) +// {met = 80; menuWithMET = true; +// if(!tau1 && item2 == TrigTauFlags::MET80 ){menu1=item2; menu2=item1;} +// } + + + // Also set an L1 MET cut if desired + analyzer.trigMan.setL1MET(met*1000.); + + // Set up our first selection + if( tau1 ) trigMan1.setTauMenu(menu1); + + // Now, look at our second selection + if( tau2 ) trigMan2.setTauMenu(menu2); + +// cout << " menu1 " << menu1 << endl; +// trigMan1.print(); +// cout << " menu2 " << menu2 << endl; +// trigMan2.print(); + +} + +void TrigTauDoubleTrigger::pass(const TrigTauEvent* event, + bool & passL1, bool & passL2, bool & passEF) +{ + if( !menuWithTau ) return passNoTauSignature(event, passL1, passL2, passEF); + + passL1 = false; + passL2 = false; + passEF = false; + + // this is for menus with taus + analyzer.chainList.fillChainList(event); + + bool pass = false; + //analyzer.chainList.printChainList(); + + // Look for L1 pass + unsigned int numCh = analyzer.chainList.nTrigChains(); + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedL1(ch1)) continue; + + if (bothMenuWithTau) { + + // Loop over chain list looking for another pass + for (unsigned int iCh2=0; iCh2 < numCh; iCh2++) { + if (iCh1 == iCh2) continue; + TrigTauTrigChain ch2 = analyzer.chainList.trigChainEntry(iCh2); + if (!trigMan2.passedL1(ch2)) continue; + pass = true; + } + + if (pass) break; + + } else if( !menuWithMET ) { + + // Loop over the extra ROI list + unsigned int nROI = event->nOtherTrigRoI(); + for (unsigned int iROI = 0; iROI<nROI; iROI++) { + TrigTauRoI roi = event->otherTrigRoIEntry(iROI); + + if (!roi.m_tags.passedL1(menu2)) continue; + if (roi.DeltaR(*(ch1.L1)) < 0.2) continue; + pass = true; + } + + if (pass) break; + + } + } // end of L1 chain + + passL1 = pass; + if( !passL1 ) return; + + // Look for L2 pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + + if (!trigMan1.passedL2(ch1)) continue; + + if (bothMenuWithTau) { + + // Loop over chain list looking for another pass + for (unsigned int iCh2=0; iCh2 < numCh; iCh2++) { + if (iCh1 == iCh2) continue; + TrigTauTrigChain ch2 = analyzer.chainList.trigChainEntry(iCh2); + if (!trigMan2.passedL2(ch2)) continue; + pass = true; + } + + if (pass) break; + + } else if( !menuWithMET) { + + // Loop over the extra ROI list + unsigned int nROI = event->nOtherTrigRoI(); + for (unsigned int iROI = 0; iROI<nROI; iROI++) { + TrigTauRoI roi = event->otherTrigRoIEntry(iROI); + + if (!roi.m_tags.passedL2(menu2)) continue; + if (roi.DeltaR(*(ch1.L2Cal)) < 0.2) continue; + pass = true; + } + + if (pass) break; + + } + + } + + passL2 = pass; + if( !passL2 ) return; + + // Look for EF pass + pass = false; + for (unsigned int iCh1=0; iCh1 < numCh; iCh1++) { + TrigTauTrigChain ch1 = analyzer.chainList.trigChainEntry(iCh1); + + if (!trigMan1.passedEF(ch1)) continue; + + if (bothMenuWithTau) { + + // Loop over chain list looking for another pass + for (unsigned int iCh2=0; iCh2 < numCh; iCh2++) { + if (iCh1 == iCh2) continue; + TrigTauTrigChain ch2 = analyzer.chainList.trigChainEntry(iCh2); + if (!trigMan2.passedEF(ch2)) continue; + pass = true; + } + + if (pass) break; + + } else if ( !menuWithMET ) { + + // Loop over the extra ROI list + unsigned int nROI = event->nOtherTrigRoI(); + for (unsigned int iROI = 0; iROI<nROI; iROI++) { + TrigTauRoI roi = event->otherTrigRoIEntry(iROI); + + if (!roi.m_tags.passedEF(menu2)) continue; + if (roi.DeltaR(*(ch1.EF)) < 0.2) continue; + pass = true; + } + + if (pass) break; + + } + + } + + passEF = pass; + return; +} + +void TrigTauDoubleTrigger::passNoTauSignature(const TrigTauEvent* event, + bool & passL1, bool & passL2, bool & passEF) +{ + if( menuWithMET ){ + passL1 = event->decision.passedL1(menu1) && event->decision.passedL1(menu2); + passL2 = event->decision.passedL1(menu1) && event->decision.passedL2(menu2); + passEF = event->decision.passedL1(menu1) && event->decision.passedEF(menu2); + }else{ + passL1 = event->decision.passedL1(menu1) && event->decision.passedL1(menu2); + passL2 = event->decision.passedL2(menu1) && event->decision.passedL2(menu2); + passEF = event->decision.passedEF(menu1) && event->decision.passedEF(menu2); + } + return; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauEFSel.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauEFSel.cxx new file mode 100755 index 0000000000000000000000000000000000000000..124206d2b16f404baf551a5f289e5e513723a3f3 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauEFSel.cxx @@ -0,0 +1,660 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauEFSel.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply EF selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#include "TrigTauPerformAnalysis/TrigTauEFSel.h" + +#include "TrigTauPerformNtuple/TrigTauRecEFObject.h" +#include "TrigTauPerformNtuple/TrigTauTrackCollection.h" + +#include <math.h> +#include <iostream> +using namespace std; + +// Need to add some code here... + +TrigTauEFSel::TrigTauEFSel() : + m_NTrackMin (0), + m_NTrackMax (0), + m_EMRadiusMax (0), + m_IsoFracMax (0), + m_EMFracMin (0), + m_PtMaxTrackMin (0), + m_EtCalibMin (0), + m_EMEtMin (0), + m_EMRadiusMaxMultiProng (0), + m_IsoFracMaxMultiProng (0), + m_EMFracMinMultiProng (0), + m_PtMaxTrackMinMultiProng (0), + m_EtCalibMinMultiProng (0), + m_EMEtMinMultiProng (0), + m_MassMax(0), + m_DrTrkAvgMax(0), + m_DrTrkAvgMaxMultiProng(0), + m_LowEtOverPtLeadTrkSP(0), + m_LowEtOverPtLeadTrkMP(0), + m_HighEtOverPtLeadTrkSP(0), + m_HighEtOverPtLeadTrkMP(0), + m_ETThresh(-1), + _debug(false), + menu(TrigTauFlags::SECONDATTEMPT), + m_histManager(0) + +{} + +TrigTauEFSel::TrigTauEFSel( const TrigTauEFSel& other) : + m_NTrackMin( other.m_NTrackMin), + m_NTrackMax( other.m_NTrackMax), + m_EMRadiusMax( other.m_EMRadiusMax), + m_IsoFracMax( other.m_IsoFracMax), + m_EMFracMin( other.m_EMFracMin), + m_PtMaxTrackMin( other.m_PtMaxTrackMin), + m_EtCalibMin( other.m_EtCalibMin), + m_EMEtMin( other.m_EMEtMin), + m_EMRadiusMaxMultiProng( other.m_EMRadiusMaxMultiProng), + m_IsoFracMaxMultiProng( other.m_IsoFracMaxMultiProng), + m_EMFracMinMultiProng( other.m_EMFracMinMultiProng), + m_PtMaxTrackMinMultiProng( other.m_PtMaxTrackMinMultiProng), + m_EtCalibMinMultiProng( other.m_EtCalibMinMultiProng), + m_EMEtMinMultiProng( other.m_EMEtMinMultiProng), + m_MassMax( other.m_MassMax), + m_DrTrkAvgMax( other.m_DrTrkAvgMax), + m_DrTrkAvgMaxMultiProng( other.m_DrTrkAvgMaxMultiProng), + m_LowEMRadSP( other.m_LowEMRadSP), + m_LowEMRadMP( other.m_LowEMRadMP), + m_LowTrkAvgDistSP( other.m_LowTrkAvgDistSP), + m_LowTrkAvgDistMP( other.m_LowTrkAvgDistMP), + m_LowEtOverPtLeadTrkSP( other.m_LowEtOverPtLeadTrkSP), + m_LowEtOverPtLeadTrkMP( other.m_LowEtOverPtLeadTrkMP), + m_HighEtOverPtLeadTrkSP( other.m_HighEtOverPtLeadTrkSP), + m_HighEtOverPtLeadTrkMP( other.m_HighEtOverPtLeadTrkMP), + m_ETThresh( other.m_ETThresh), + _debug( other._debug), + menu( other.menu), + m_histManager( new TrigTauHistogram( *m_histManager)) +{} + +TrigTauEFSel::~TrigTauEFSel() +{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} +} + + +void +TrigTauEFSel::setCuts(int NTrackMin, int NTrackMax, float EMRadiusMax, + float IsoFracMax, float EMFracMin, float PtMaxTrackMin, + float EtCalibMin, float EMEtMin, + float EMRadiusMaxMultiProng, + float IsoFracMaxMultiProng, float EMFracMinMultiProng, float PtMaxTrackMinMultiProng, + float EtCalibMinMultiProng, float EMEtMinMultiProng, float MassMax, + float DrTrkAvgMax, float DrTrkAvgMaxMultiProng) { + + m_NTrackMin = NTrackMin; + m_NTrackMax = NTrackMax; + m_EMRadiusMax = EMRadiusMax; + m_IsoFracMax = IsoFracMax; + m_EMFracMin = EMFracMin; + m_PtMaxTrackMin = PtMaxTrackMin; + m_EtCalibMin = EtCalibMin; + m_EMEtMin = EMEtMin; + + // this will switch between the old and the new pt parametrized cuts + m_ETThresh = -1; + + if(EMRadiusMaxMultiProng<0) m_EMRadiusMaxMultiProng = EMRadiusMax; + else m_EMRadiusMaxMultiProng = EMRadiusMaxMultiProng; + if(IsoFracMaxMultiProng<0) m_IsoFracMaxMultiProng = IsoFracMax; + else m_IsoFracMaxMultiProng = IsoFracMaxMultiProng; + if(EMFracMinMultiProng<0) m_EMFracMinMultiProng = EMFracMin; + else m_EMFracMinMultiProng = EMFracMinMultiProng; + if(PtMaxTrackMinMultiProng<0) m_PtMaxTrackMinMultiProng = PtMaxTrackMin; + else m_PtMaxTrackMinMultiProng = PtMaxTrackMinMultiProng; + if(EtCalibMinMultiProng<0) m_EtCalibMinMultiProng = EtCalibMin; + else m_EtCalibMinMultiProng = EtCalibMinMultiProng; + if(EMEtMinMultiProng<0) m_EMEtMinMultiProng = EMEtMin; + else m_EMEtMinMultiProng = EMEtMinMultiProng; + + m_MassMax = MassMax; + + m_DrTrkAvgMax = DrTrkAvgMax; + if(DrTrkAvgMaxMultiProng<0) m_DrTrkAvgMaxMultiProng = DrTrkAvgMax; + else m_DrTrkAvgMaxMultiProng = DrTrkAvgMaxMultiProng; +} + +// takes ownership of TrigTauSafeCutFunction objects +void +TrigTauEFSel::setParamSafeCuts( const CutFunctor& LowEMRadSP, + const CutFunctor& LowEMRadMP, + const CutFunctor& LowTrkAvgDistSP, + const CutFunctor& LowTrkAvgDistMP, + float LowEtOverPtLeadTrkSP, + float LowEtOverPtLeadTrkMP, + float HighEMRadSP, + float HighEMRadMP, + float HighTrkAvgDistSP, + float HighTrkAvgDistMP, + float HighEtOverPtLeadTrkSP, + float HighEtOverPtLeadTrkMP, + int NTrackMin, + int NTrackMax, + float EtCalibMinSP, + float EtCalibMinMP, + float ETThresh) +{ + m_LowEMRadSP = LowEMRadSP; + m_LowEMRadMP = LowEMRadMP; + m_LowTrkAvgDistSP = LowTrkAvgDistSP; + m_LowTrkAvgDistMP = LowTrkAvgDistMP; + m_LowEtOverPtLeadTrkSP = LowEtOverPtLeadTrkSP; + m_LowEtOverPtLeadTrkMP = LowEtOverPtLeadTrkMP; + m_EMRadiusMax = HighEMRadSP; + m_EMRadiusMaxMultiProng = HighEMRadMP; + m_DrTrkAvgMax = HighTrkAvgDistSP; + m_DrTrkAvgMaxMultiProng = HighTrkAvgDistMP; + m_HighEtOverPtLeadTrkSP = HighEtOverPtLeadTrkSP; + m_HighEtOverPtLeadTrkMP = HighEtOverPtLeadTrkMP; + m_NTrackMin = NTrackMin; + m_NTrackMax = NTrackMax; + m_EtCalibMin = EtCalibMinSP; + if( EtCalibMinMP < 0) + m_EtCalibMinMultiProng = EtCalibMinSP; + else + m_EtCalibMinMultiProng = EtCalibMinMP; + m_ETThresh = ETThresh; +} + + + +void +TrigTauEFSel::print() const { + + if (menu != TrigTauFlags::SECONDATTEMPT) { + cout << "LVL2 selection based on trigger decisision bits for " + << TrigTauFlags::menuName(menu) << endl; + return; + } + + cout << " EF cuts :" << endl; + + if (m_NTrackMin > 1.e-10) { + cout <<" NTrack >= " << m_NTrackMin << endl; + } else { + cout <<" NTrackMin: not applied" << endl; + } + + if (m_NTrackMax > 1.e-10) { + cout <<" NTrack <= " << m_NTrackMax << endl; + } else { + cout <<" NTrackMax: not applied" << endl; + } + + if (m_EMRadiusMax > 1.e-10) { + cout <<" EMRadius <= " << m_EMRadiusMax << " (MultiProng : "<<m_EMRadiusMaxMultiProng <<")"<< endl; + } else { + cout <<" EMRadius: not applied" << endl; + } + + if (m_IsoFracMax > 1.e-10) { + cout <<" IsoFrac <= " << m_IsoFracMax << " (MultiProng : "<< m_IsoFracMaxMultiProng<<")"<< endl; + } else { + cout <<" IsoFrac: not applied" << endl; + } + + if (m_EMFracMin > 1.e-10) { + cout <<" EMFrac >= " << m_EMFracMin << " (MultiProng : "<< m_EMFracMinMultiProng<<")"<< endl; + } else { + cout <<" EMFrac: not applied" << endl; + } + + if (m_PtMaxTrackMin > 1.e-10) { + cout <<" PtMaxTrack >= " << m_PtMaxTrackMin << " (MultiProng : "<< m_PtMaxTrackMinMultiProng <<")"<< endl; + } else { + cout <<" PtMaxTrack not applied" << endl; + } + + if (m_EtCalibMin > 1.e-10) { + cout <<" EtCalib >= " << m_EtCalibMin << " (MultiProng : "<< m_EtCalibMinMultiProng<<")"<< endl; + } else { + cout <<" EtCalib: not applied" << endl; + } + + if (m_EMEtMin > 1.e-10) { + cout <<" EMEt >= " << m_EMEtMin << " (MultiProng : "<< m_EMEtMinMultiProng<<")" << endl; + } else { + cout <<" EMEt: not applied" << endl; + } + + if( m_MassMax > 1.e-10 ){ + cout <<" MassMax <= " << m_MassMax << endl; + } else { + cout <<" MassMax: not applied" << endl; + } + + if( m_DrTrkAvgMax > 0) + { + cout <<" DrTrkAvgMax <= " << m_DrTrkAvgMax << endl; + } + else + { + cout <<" DrTrkAvgMax: not applied" << endl; + } +} + + + +void TrigTauEFSel::setHistDebug(TrigTauHistogram::HISTTYPE type) +{ + if( type != TrigTauHistogram::NONE ){ + //gROOT->cd(); + if( m_histManager ) delete m_histManager; + m_histManager = new TrigTauHistogram(type); + m_histManager->book("baseEF","Before any cut"); + m_histManager->book("etCalibEF","EF: Cut on EtCalib"); + m_histManager->book("ntrkMinEFID","EF: Cut on NtrkMin reconstructed by EFID"); + m_histManager->book("ntrkMinEF","EF: Cut on NtrkMin "); + m_histManager->book("ntrkMaxEF","EF: Cut on NtrkMax"); + m_histManager->book("emradEF","EF: Cut on EMRadius "); + m_histManager->book("isoFracEF","EF: Cut on IsoFraction "); + m_histManager->book("emFracEF","EF: Cut on EMFraction"); + m_histManager->book("leadPtEF","EF: Cut on leading track pT"); + m_histManager->book("emEtEF","EF: Cut on EM Et"); + m_histManager->book("massEF","EF: Cut on Mass"); + m_histManager->book("DrTrkAvgEF","EF: Cut on trk avg dist"); + m_histManager->book("EtOverPtTrk","EF: Cut on EtOverPtTrk"); + + }else{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} + } +} + + +bool +TrigTauEFSel::passed(const TrigTauRecEFObject& tau) const { + if (menu != TrigTauFlags::SECONDATTEMPT) return tau.m_tags.passedL2(menu); + + if( m_ETThresh > 0) return cutWordParamSafeCuts(tau) == 0; + + return (cutWord(tau) == 0); +} + +unsigned long +TrigTauEFSel::cutWord(const TrigTauRecEFObject& tau) const { + // return new cuts if Et threshold was set + if( m_ETThresh > 0) + return cutWordParamSafeCuts( tau); + + if( _debug ) cout << " In TrigTauEFSel::cutWord \n"; + unsigned long word = 0; + float varHist = 0; + if( m_histManager) + { + if( m_histManager->type() == TrigTauHistogram::PTHIST ) varHist = tau.Pt(); + else if( m_histManager->type() == TrigTauHistogram::ETAHIST ) varHist = tau.Eta(); + else if( m_histManager->type() == TrigTauHistogram::PHIHIST ) varHist = tau.Phi(); + } + if( m_histManager) m_histManager->fill(0, varHist); + + if( _debug ) cout << " hist are prepared \n"; + float emFrac = 0.; + float ptMax = 999999.; + float emEt = 0.; + + if (tau.m_etEMCalib+tau.m_etHadCalib>0.) + emFrac = tau.m_etEMCalib/(tau.m_etEMCalib + tau.m_etHadCalib); + if( _debug) cout << " emFrac = " << emFrac << endl; + if( _debug ) cout << " Ntrk = " << tau.nLooseTracks() << " recorded " << tau.m_nLooseTracksRecord << endl; + if( _debug ) cout << " leading track " << tau.m_leadPt << endl; + if ( tau.m_nLooseTracksRecord > 0 ) ptMax = tau.m_leadPt; + + emEt = tau.m_energy / cosh(tau.m_caloEta); + + if (_debug) cout << "TauEF: eta="<<tau.Eta() <<", phi="<<tau.Phi() << " RoIWord=" + << std::hex <<tau.m_roiWord << std::dec <<endl; + if( _debug ) { cout <<" EF : nTrk=" << tau.m_nLooseTracksRecord << ", EmRad="<< tau.m_EMRadius<<", isoFrac=" + <<tau.m_isoFrac << ", EMFrac="<<emFrac<<"\n LeadPt="<<ptMax<<", Et"<< tau.Et() + <<", emET="<<emEt<<endl;} + + //unsigned int nTrk = tau.nLooseTracks(); + unsigned int nTrk = tau.m_nLooseTracksRecord; + const TrigTauTrackCollection * EFID = (const TrigTauTrackCollection *) tau.r_EFIDtrackCollection.GetObject(); + unsigned int nTrkEFID = 1; + + // no check if EFID info is available and if the links are recorded (not available if avoidTrigDecision was set in TTPAThena + if( EFID && int(tau.nLooseTracks()) == tau.m_nLooseTracksRecord ) + { + nTrkEFID = EFID->nTracks(); + }else{ + if( _debug) cout << "No EFID track info recorded, proceed without \n"; + } + + + /* + static bool first = true; + if( first ){ + cout << "WARNING Use all EFID tracks instead of selected tracks\n"; + first = false; + } + nTrk = tau.nLooseTracks()+ tau.nRejectedEFTracks(); + */ + + + float etcorr = tau.Et(); + // float etcorr = tauRec_et_corr(tau.m_etHadCalib + tau.m_etEMCalib, + // tau.Eta(), tau.nLooseTracks() ); + if (_debug) cout << "Et="<<etcorr << " "; + if( m_EtCalibMin > 1.e-10 && nTrk <= 1 && m_EtCalibMin > etcorr ) { + if (_debug) cout << " - reject etcorr" << endl; + word |= EFCUT_ETCORR; + } + if( m_EtCalibMinMultiProng > 1.e-10 && nTrk > 1 && m_EtCalibMinMultiProng > etcorr ) { + if (_debug) cout << " - reject etcorr MultiProng" << endl; + word |= EFCUT_ETCORR; + } + if( m_histManager && word==0) m_histManager->fill(1, varHist); + + + + if (_debug) cout << "Ntrk="<< nTrk << " EFID Ntrk = " << nTrkEFID << " "; + if( m_NTrackMin > 1.e-10 && m_NTrackMin > nTrkEFID ) { + if (_debug) cout << " - reject min nTr due to EFID" << endl; + word |= EFCUT_EFIDNONZERO; + } + if( m_histManager && word==0) m_histManager->fill(2, varHist); + + if( m_NTrackMin > 1.e-10 && m_NTrackMin >nTrk ) { + if (_debug) cout << " - reject min nTr" << endl; + word |= EFCUT_NTRKMIN; + } + + if( m_histManager && word==0) m_histManager->fill(3, varHist); + + if( m_NTrackMax > 1.e-10 && m_NTrackMax < nTrk ) { + if (_debug) cout << " - reject max nTr" << endl; + word |= EFCUT_NTRKMAX; + } + if( m_histManager && word==0) m_histManager->fill(4, varHist); + + + if (_debug) cout << "Emrad="<<tau.m_EMRadius << " "; + if( m_EMRadiusMax > 1.e-10 && nTrk <= 1 && m_EMRadiusMax < tau.m_EMRadius ) { + if (_debug) cout << " - reject EMRadius" << endl; + word |= EFCUT_EMRAD; + } + if( m_EMRadiusMaxMultiProng > 1.e-10 && nTrk > 1 && m_EMRadiusMaxMultiProng < tau.m_EMRadius ) { + if (_debug) cout << " - reject EMRadius MultiProng" << endl; + word |= EFCUT_EMRAD; + } + + + + if( m_histManager && word==0) m_histManager->fill(5, varHist); + + if (_debug) cout << "IsoFrac="<<tau.m_isoFrac << " "; + if( m_IsoFracMax > 1.e-10 && nTrk <= 1&& m_IsoFracMax < tau.m_isoFrac ) { + if (_debug) cout << " - reject IsoFrac" << endl; + word |= EFCUT_ISOFRAC; + } + if( m_IsoFracMaxMultiProng > 1.e-10 && nTrk > 1 && m_IsoFracMaxMultiProng < tau.m_isoFrac ) { + if (_debug) cout << " - reject IsoFrac MultiProng" << endl; + word |= EFCUT_ISOFRAC; + } + + if( m_histManager && word==0) m_histManager->fill(6, varHist); + + if (_debug) cout << "EmFrac="<<emFrac << " "; + if( m_EMFracMin > 1.e-10 && nTrk <= 1 && m_EMFracMin > emFrac ) { + if (_debug) cout << " - reject emFrac" << endl; + word |= EFCUT_EMFRAC; + } + if( m_EMFracMinMultiProng > 1.e-10 && nTrk > 1 && m_EMFracMinMultiProng > emFrac ) { + if (_debug) cout << " - reject emFrac MultiProng" << endl; + word |= EFCUT_EMFRAC; + } + + + if( m_histManager && word==0) m_histManager->fill(7, varHist); + + if (_debug) cout << "LeadPt="<<ptMax << " "; + if( m_PtMaxTrackMin > 1.e-10 && nTrk <= 1 && m_PtMaxTrackMin > ptMax ) { + if (_debug) cout << " - reject ptMax" << endl; + word |= EFCUT_LEADPT; + } + if( m_PtMaxTrackMinMultiProng > 1.e-10 && nTrk > 1 && m_PtMaxTrackMinMultiProng > ptMax ) { + if (_debug) cout << " - reject ptMax MultiProng" << endl; + word |= EFCUT_LEADPT; + } + if( m_histManager && word==0) m_histManager->fill(8, varHist); + + + //if( m_EtCalibMin > 1.e-10 && m_EtCalibMin > tau.Et() ) return false; + if (_debug) cout << "EMEt="<< emEt << " "; + if( m_EMEtMin > 1.e-10 && nTrk <= 1 && m_EMEtMin > emEt ) { + if (_debug) cout << " - reject emEt" << endl; + word |= EFCUT_EMET; + } + if( m_EMEtMinMultiProng > 1.e-10 && nTrk > 1 && m_EMEtMinMultiProng > emEt ) { + if (_debug) cout << " - reject emEt MultiProng" << endl; + word |= EFCUT_EMET; + } + + if( m_histManager && word==0) m_histManager->fill(9, varHist); + + if( m_MassMax > 1.e-10 && nTrk > 1 ){ + + TLorentzVector p1(0,0,0,0), p2(0,0,0,0), p3(0,0,0,0); + for (unsigned int itrk = 0; itrk < tau.nLooseTracks(); ++itrk){ + const TrigTauTrack * itr = &tau.looseTrack(itrk); + float pt = itr->Pt(); + if(pt > p1.Pt() ){ + p3 = p2; + p2 = p1; + p1 = *itr; + }else if( pt > p2.Pt() ){ + p3 = p2; + p2 = *itr; + }else if( pt > p3.Pt() ){ + p3 = *itr; + } + } + p1 += p2; + p1 += p3; + + if( (nTrk == 2 && 0.75*m_MassMax < p1.M()) || ( m_MassMax < p1.M() ) ) { + if (_debug) cout << " - reject Mass" << endl; + word |= EFCUT_MASS; + } + } + + if( m_histManager && word==0) m_histManager->fill(10, varHist); + + if (_debug) cout << "DrTrkAvg="<< tau.m_trkAvgDist << " "; + if( m_DrTrkAvgMax > 1.e-10 && nTrk <= 1 && tau.m_trkAvgDist > m_DrTrkAvgMax) { + if (_debug) cout << " - reject DrTrkAvg" << endl; + word |= EFCUT_DRTRKAVG; + } + if( m_DrTrkAvgMaxMultiProng > 1.e-10 && nTrk > 1 && tau.m_trkAvgDist > m_DrTrkAvgMaxMultiProng) { + if (_debug) cout << " - reject DrTrkAvg MultiProng" << endl; + word |= EFCUT_DRTRKAVG; + } + + if( m_histManager && word==0) m_histManager->fill(11, varHist); + + if (_debug && (word==0)) cout << " accepted" << endl; + return word; +} + +unsigned long +TrigTauEFSel::cutWordParamSafeCuts(const TrigTauRecEFObject& tau) const +{ + if( _debug ) cout << " In TrigTauEFSel::cutWordParamSafeCuts \n"; + unsigned long word = 0; + float varHist = 0; + if( m_histManager) + { + if( m_histManager->type() == TrigTauHistogram::PTHIST ) + varHist = tau.Pt(); + else if( m_histManager->type() == TrigTauHistogram::ETAHIST ) + varHist = tau.Eta(); + else if( m_histManager->type() == TrigTauHistogram::PHIHIST ) + varHist = tau.Phi(); + } + if( m_histManager) m_histManager->fill(0, varHist); + + if( _debug ) cout << " hist are prepared \n"; + + float emFrac = 0.; + float emEt = tau.m_energy / cosh(tau.m_caloEta); + unsigned int nTrk = tau.m_nSeedCaloTracks; + float et = tau.Et(); + bool singleProng = (nTrk <= 1); + + if (tau.m_etEMCalib+tau.m_etHadCalib>0.) + emFrac = tau.m_etEMCalib/(tau.m_etEMCalib + tau.m_etHadCalib); + + if( _debug ) + cout << " EF: nTrk=" << nTrk << "," + << " EmRad=" << tau.m_EMRadius << "," + << " isoFrac=" << tau.m_isoFrac << "," + << " EMFrac=" << emFrac << endl + << " Et=" << et << "," + << " emET=" << emEt << endl + << " dRTrkAvg=" << tau.m_trkAvgDist << "," + << " eta=" << tau.Eta() <<", phi=" << tau.Phi() + << " RoIWord=" << std::hex << tau.m_roiWord << std::dec << endl; + + // Cut1: EtCalib + if( singleProng) + { + if( m_EtCalibMin > 0 && m_EtCalibMin > et ) + { + if (_debug) cout << " - reject etcorr" << endl; + word |= EFCUT_ETCORR; + } + } + else + { + if( m_EtCalibMinMultiProng > 0 && m_EtCalibMinMultiProng > et) + { + if (_debug) cout << " - reject etcorr MultiProng" << endl; + word |= EFCUT_ETCORR; + } + } + if( m_histManager && word==0) m_histManager->fill(1, varHist); + + // Cut2: nTrkEFID NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(2, varHist); + + // Cut3: nTrkMin + if( m_NTrackMin > 0 && m_NTrackMin > nTrk) + { + if (_debug) cout << " - reject min nTr" << endl; + word |= EFCUT_NTRKMIN; + } + if( m_histManager && word==0) m_histManager->fill(3, varHist); + + // Cut4: nTrkMax + if( m_NTrackMax > 0 && m_NTrackMax < nTrk) + { + if (_debug) cout << " - reject max nTr" << endl; + word |= EFCUT_NTRKMAX; + } + if( m_histManager && word==0) m_histManager->fill(4, varHist); + + // Cut5: EMRadius + float EMRadCut = -1; + if( singleProng) + { + if( et > m_ETThresh) + EMRadCut = m_EMRadiusMax; + else + EMRadCut = m_LowEMRadSP.eval( et/1000.); + } + else + { + if( et > m_ETThresh) + EMRadCut = m_EMRadiusMaxMultiProng; + else + EMRadCut = m_LowEMRadMP.eval( et/1000.); + } + if( EMRadCut > 0 && EMRadCut < tau.m_EMRadius) + { + if (_debug) cout << " - reject EMRadius" << endl; + word |= EFCUT_EMRAD; + } + if( m_histManager && word==0) m_histManager->fill(5, varHist); + + // Cut6: isoFrac NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(6, varHist); + + // Cut7: emFrac NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(7, varHist); + + // Cut8: leadPt NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(8, varHist); + + // Cut9: emEt NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(9, varHist); + + // Cut10: mass NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(10, varHist); + + // Cut11: DrTrkAvg + float DrTrkAvgDistCut = -1; + if( singleProng) + { + if( et > m_ETThresh) + DrTrkAvgDistCut = m_DrTrkAvgMax; + else + DrTrkAvgDistCut = m_LowTrkAvgDistSP.eval( et/1000.); + } + else + { + if( et > m_ETThresh) + DrTrkAvgDistCut = m_DrTrkAvgMaxMultiProng; + else + DrTrkAvgDistCut = m_LowTrkAvgDistMP.eval( et/1000.); + } + if( DrTrkAvgDistCut > 0 && tau.m_trkAvgDist > DrTrkAvgDistCut) + { + if (_debug) cout << " - reject DrTrkAvg" << endl; + word |= EFCUT_DRTRKAVG; + } + if( m_histManager && word==0) m_histManager->fill(11, varHist); + + // Cut12: EtOverPtTrk + float EtOverPtTrkCut = -1; + if( singleProng) + { + if( et > m_ETThresh) + EtOverPtTrkCut = m_HighEtOverPtLeadTrkSP; + else + EtOverPtTrkCut = m_LowEtOverPtLeadTrkSP; + } + else + { + if( et > m_ETThresh) + EtOverPtTrkCut = m_HighEtOverPtLeadTrkMP; + else + EtOverPtTrkCut = m_LowEtOverPtLeadTrkMP; + } + if( EtOverPtTrkCut > 0 && tau.m_etOverPtLeadTrk > EtOverPtTrkCut) + { + if (_debug) cout << " - reject EtOverPtTrk" << endl; + word |= EFCUT_ETOVERPTTRK; + } + if( m_histManager && word==0) m_histManager->fill(12, varHist); + + // end + if (_debug && (word==0)) cout << " accepted" << endl; + return word; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauHistHelper.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauHistHelper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cd0d0a7cb2e44e710480ca2a499059f2e28c61f7 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauHistHelper.cxx @@ -0,0 +1,388 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <algorithm> +using namespace std; + +#include "TFile.h" +#include "TObjArray.h" + +#include "TrigTauPerformAnalysis/TrigTauHistHelper.h" + +TrigTauHistHelper::TrigTauHistHelper() : + _nHist(1), + _debug(false), + _yAxisLabels(1, "") +{} + +TrigTauHistHelper::TrigTauHistHelper(unsigned long nh) : _nHist(nh), + _debug(false), + _yAxisLabels(nh, "") +{ + _h1D.clear(); + _h2D.clear(); + _opt.clear(); + _tags.clear(); +} + +TrigTauHistHelper::~TrigTauHistHelper() { + // clear(); +} + +void +TrigTauHistHelper::clear() { + for (map<TString, TH1D*>::iterator imap = _h1D.begin(); + imap != _h1D.end(); imap++) { + delete imap->second; + } + + for (map<TString, TH2D*>::iterator imap = _h2D.begin(); + imap != _h2D.end(); imap++) { + delete imap->second; + } + _h1D.clear(); + _h2D.clear(); + _logY.clear(); + _tags.clear(); + _opt.clear(); + _yAxisLabels.clear(); + +} + +void +TrigTauHistHelper::reset() { + for (map<TString, TH1D*>::iterator imap = _h1D.begin(); + imap != _h1D.end(); imap++) { + (imap->second)->Reset(); + } + + for (map<TString, TH2D*>::iterator imap = _h2D.begin(); + imap != _h2D.end(); imap++) { + (imap->second)->Reset(); + } +} + +void +TrigTauHistHelper::create(TString tag, long nbx, double xlo, double xhi, + TString xAxis) { + + if (_debug) cout << "Creating family with tag " << tag << endl; + // Check if this is a unique tag + if (find(_tags.begin(), _tags.end(), tag) != _tags.end()) { + cout << "TrigTauHistHelper::create - Histogram family with name " << tag + << " already exists!" << endl; + return; + } + + _tags.push_back(tag); + + TString title; + for (unsigned int iHist=0; iHist<_nHist; iHist++) { + title = tag; + title += iHist; + if (_debug) cout << " -- " << title << " " << xAxis << " " << _yAxisLabels[iHist] << endl; + + TH1D* h = new TH1D(title, "", nbx, xlo, xhi); + + // Set axis labels + h->GetXaxis()->SetTitle(xAxis); + h->GetYaxis()->SetTitle(_yAxisLabels[iHist]); + + // Check if this already exists + if (_h1D.find(title) != _h1D.end()) { + cout << "TrigTauHistHelper::create - Histogram with name " << title + << " already exists!" << endl; + return; + } + + // Safe to insert new element + _h1D[title] = h; + } + + _logY[tag] = false; + +} + +void +TrigTauHistHelper::create(TString tag, long nbx, double xlo, double xhi, + long nby, double ylo, double yhi, + TString xAxis, TString yAxis, TString opt) { + + if (_debug) cout << "Creating family with tag " << tag << endl; + // Check if this is a unique tag + if (std::find(_tags.begin(), _tags.end(), tag) != _tags.end()) { + cout << "TrigTauHistHelper::create - Histogram family with name " << tag + << " already exists!" << endl; + return; + } + + _tags.push_back(tag); + + TString title; + for (unsigned int iHist=0; iHist<_nHist; iHist++) { + title = tag; + title += iHist; + if (_debug) cout << " -- " << title << " " << xAxis << " " << yAxis << endl; + TH2D* h = new TH2D(title, "", nbx, xlo, xhi, nby, ylo, yhi); + h->GetXaxis()->SetTitle(xAxis); + h->GetYaxis()->SetTitle(yAxis); + + // Check if this already exists + if (_h2D.find(title) != _h2D.end()) { + cout << "TrigTauHistHelper::create - Histogram with name " << title + << " already exists!" << endl; + return; + } + + // Safe to insert new element + _h2D[title] = h; + _opt[title] = opt; + } + +} + +void +TrigTauHistHelper::fill1D(TString tag, long itype, double x, double wt) { + + TH1D* h = get1D(tag, itype); + if (h == 0) { + cout << "TrigTauHistHelper::fill - Histogram with name " << tag + << " and type " << itype + << " does not exist!" << endl; + return; + } + + h->Fill(x, wt); + return; +} + +void +TrigTauHistHelper::fill2D(TString tag, long itype, double x, double y, double wt) { + + TH2D* h = get2D(tag, itype); + if (h == 0) { + cout << "TrigTauHistHelper::fill - Histogram with name " << tag + << " and type " << itype + << " does not exist!" << endl; + return; + } + + h->Fill(x, y, wt); + return; +} + +TH1D* +TrigTauHistHelper::get1D(TString tag, long itype) { + + // Form the name + TString title = tag; + title += itype; + + // Check that this exists + map<TString, TH1D*>::iterator ih = _h1D.find(title); + if (ih == _h1D.end()) return 0; + + return ih->second; +} + +TH2D* +TrigTauHistHelper::get2D(TString tag, long itype) { + + // Form the name + TString title = tag; + title += itype; + + // Check that this exists + map<TString, TH2D*>::iterator ih = _h2D.find(title); + if (ih == _h2D.end()) return 0; + + return ih->second; +} + +void +TrigTauHistHelper::writeAll(TString outfile) { + + TObjArray hlist(0); // New array to hold histos to write + + // Add all to this list + for (map<TString, TH1D*>::iterator imap = _h1D.begin(); + imap != _h1D.end(); imap++) { + hlist.Add(imap->second); + } + + for (map<TString, TH2D*>::iterator imap = _h2D.begin(); + imap != _h2D.end(); imap++) { + hlist.Add(imap->second); + } + + TFile f(outfile, "recreate"); + hlist.Write(); + f.Close(); +} + +void +TrigTauHistHelper::draw(TString itag, long itype) { + + TString title = itag; + title += itype; + + if (_h1D.find(title) != _h1D.end()) { + TH1D* h = _h1D[title]; + h->DrawCopy(); + if (_debug) cout << "logY for " << *itag << " is " << _logY[*itag] << endl; + } else if (_h2D.find(title) != _h2D.end()) { + TH2D* h = _h2D[title]; + h->DrawCopy(_opt[title]); + } + +} + +void +TrigTauHistHelper::drawAll(TString plotfile, unsigned long nStart, unsigned long nEnd, TCanvas* c) { + + // Open the file + TString dummy; + dummy = plotfile + "["; + c->Print(dummy); + + TString title; + + for (list<TString>::iterator itag = _tags.begin(); + itag != _tags.end(); itag++) { + + if (_debug) cout << "Drawing family " << *itag << endl; + + long padCounter = 0; + for(unsigned int i=nStart; i<=nEnd; i++) { + if (i >= _nHist) continue; + + TVirtualPad* tp = c->cd(++padCounter); + + title = *itag; + title += i; + + if (_h1D.find(title) != _h1D.end()) { + TH1D* h = _h1D[title]; + h->DrawCopy(); + if (_debug) cout << "logY for " << *itag << " is " << _logY[*itag] << endl; + if (_logY[*itag]) tp->SetLogy(); + else tp->SetLogy(0); + } else if (_h2D.find(title) != _h2D.end()) { + TH2D* h = _h2D[title]; + tp->SetLogy(0); + h->DrawCopy(_opt[title]); + } + + } + c->Print(plotfile); + + } + + // Close the file + dummy = plotfile + "]"; + c->Print(dummy); +} + +void +TrigTauHistHelper::drawAll(TString plotfile, long nPerPage, TCanvas* c) { + + // Open the file + TString dummy; + dummy = plotfile + "["; + c->Print(dummy); + + TString title; + + for (list<TString>::iterator itag = _tags.begin(); + itag != _tags.end(); itag++) { + + if (_debug) cout << "Drawing family " << *itag << endl; + + long padCounter = 0; + for(unsigned int i=0; i<_nHist; i++) { + TVirtualPad* tp = c->cd(padCounter+1); + + title = *itag; + title += i; + + if (_debug) cout << "Drawing hist " << title ; + if (_h1D.find(title) != _h1D.end()) { + TH1D* h = _h1D[title]; + if (_debug) cout << " found in 1D list with pointer " << h << endl; + h->DrawCopy(); + if (_debug) cout << "logY for " << *itag << " is " << _logY[*itag] << endl; + if (_logY[*itag]) tp->SetLogy(); + else tp->SetLogy(0); + } else if (_h2D.find(title) != _h2D.end()) { + TH2D* h = _h2D[title]; + if (_debug) cout << " found in 2D list with pointer " << h << endl; + tp->SetLogy(0); + h->DrawCopy(_opt[title]); + } else { + if (_debug) cout << " - wasn't found!" << endl; + } + + if (++padCounter == nPerPage) { + padCounter = 0; + if (_debug) cout << "Writing page" << endl; + c->Print(plotfile); + } + } + } + + // Close the file + dummy = plotfile + "]"; + c->Print(dummy); +} + +void +TrigTauHistHelper::drawEffAll(TString plotfile, long nPerPage, long nDenom, TCanvas* c) { + + TString title; + + // Open the file + TString dummy; + dummy = plotfile + "["; + c->Print(dummy); + + for (list<TString>::iterator itag = _tags.begin(); + itag != _tags.end(); itag++) { + + title = *itag; + + long padCounter = nDenom; + const TH1D* hden = get1D(title, nDenom); + if (hden == 0) continue; + + for(unsigned int i=nDenom; i<_nHist; i++) { + TVirtualPad* tp = c->cd(padCounter+1); + + const TH1D* hnum = get1D(title, i); + if (hnum == 0) continue; + + if (long(i) == nDenom) { + hnum->DrawCopy("HIST"); + } else { + TH1D* heff = new TH1D(*hnum); + heff->Sumw2(); + heff->Divide(hnum, hden, 1, 1, "B"); + heff->DrawCopy(); + + delete heff; + } + tp->SetLogy(0); + + if (++padCounter == nPerPage) { + padCounter = nDenom; + c->Print(plotfile); + } + } + } + + // Close the file + dummy = plotfile + "]"; + c->Print(dummy); + +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauHistogram.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauHistogram.cxx new file mode 100644 index 0000000000000000000000000000000000000000..97114e977960e5c98b907a822e4b442eb6992e0f --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauHistogram.cxx @@ -0,0 +1,168 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TROOT.h" +#include "TrigTauPerformAnalysis/TrigTauHistogram.h" +#include <iostream> +using namespace std; + +TrigTauHistogram::Definition TrigTauHistogram::histDefinitions[TrigTauHistogram::NONE] = + { + Definition( PTHIST, "pt", "pT, MeV", 50, 0,100000), + Definition( ETAHIST, "eta","#eta", 61, -3,3), + Definition( PHIHIST, "phi","#phi", 65, -3.2,3.2), + Definition( EXTERNAL, "external","external var", 50, 0,100000) + }; + +TrigTauHistogram::TrigTauHistogram(HISTTYPE type ) + : m_type(type), m_externalVar(0) +{} + +TrigTauHistogram::~TrigTauHistogram() {} // we do not care about mem leak, but may be we should? + +void TrigTauHistogram::doHist( HISTTYPE type) // change histogramming type! +{ + m_type = type; + // clean old histograms + for(std::vector<TH1F*>::iterator ihist = m_hist.begin(); + ihist != m_hist.end(); ++ihist) + { delete *ihist; *ihist=0; } + m_hist.erase(m_hist.begin(), m_hist.end()); + return ; +} + + +void TrigTauHistogram::setHistLimits(HISTTYPE type, int nbin, float xmin, float xmax) +{ + histDefinitions[type].nbin = nbin; + histDefinitions[type].xmin = xmin; + histDefinitions[type].xmax = xmax; +} +void TrigTauHistogram::setHistLimits(HISTTYPE type, TString baseName, TString xaxistext, int nbin, float xmin, float xmax) +{ + histDefinitions[type].baseName = baseName; + histDefinitions[type].xaxistext = xaxistext; + histDefinitions[type].nbin = nbin; + histDefinitions[type].xmin = xmin; + histDefinitions[type].xmax = xmax; +} + +int TrigTauHistogram::book(const char * name, const char * title) +{ + if( m_type == NONE ){ cout << "can not book NONE type of histogram\n"; return 1;} +int index = m_hist.size(); + + TString histname(name); + char number[20]; + sprintf(number,"_%d", index); + histname.Append(number); + histname.Append("_"); + histname.Append(histDefinitions[m_type].baseName); + int nbin = histDefinitions[m_type].nbin; + double xmin = histDefinitions[m_type].xmin; + double xmax = histDefinitions[m_type].xmax; + gROOT->cd(); + //TH1F * h1 = new TH1F("h1","", nbin, xmin,xmax); + TH1F * h1 = new TH1F(histname, TString(title), nbin, xmin,xmax); + h1->GetXaxis()->SetTitle(histDefinitions[m_type].xaxistext); + h1->GetYaxis()->SetTitle("Nevents"); + h1->Sumw2(); + h1->SetLineColor(index+1); + + m_hist.push_back(h1); + + return index; // return index +} + +void TrigTauHistogram::fill(unsigned int index, float var) +{ + if( m_type == EXTERNAL ) var = m_externalVar; + if( index < m_hist.size() ){ m_hist[index]->Fill(var);} +} + +void TrigTauHistogram::fill(unsigned int index, const TLorentzVector & vec) +{ + if( index >= m_hist.size() )return; + + float var = 0; + switch ( m_type ) { + case PTHIST : var = vec.Pt(); break; + case ETAHIST : var = vec.Eta(); break; + case PHIHIST : var = vec.Phi(); break; + default : return; + } + + m_hist[index]->Fill(var); +} + +int TrigTauHistogram::nHists()const +{ + return m_hist.size(); +} + + +int TrigTauHistogram::plotHist(unsigned int index, const char * opt) +{ + if( index < m_hist.size() ) m_hist[index]->Draw(opt); + return 0; +} + +int TrigTauHistogram::plotEfficiency(unsigned int indexAfterCut, + unsigned int indexBeforeCut, const char * opt) +{ + if( indexAfterCut >= m_hist.size() || indexBeforeCut >= m_hist.size() ) return 1; + TString name= m_hist[indexAfterCut]->GetName(); + name.Append("_eff"); + TH1F * clone = (TH1F*)m_hist[indexAfterCut]->Clone(name); + //clone->Divide( m_hist[indexBeforeCut]); + + unsigned int nbin = clone->GetXaxis()->GetNbins(); + for( unsigned int i = 1; i <= nbin ; ++i ) + { + double Nbefore = m_hist[indexBeforeCut]->GetBinContent(i); + if( Nbefore < 0.1e-10) continue; + double Nafter = m_hist[indexAfterCut]->GetBinContent(i); + double eff = Nafter/Nbefore; + double effError = sqrt(eff*(1-eff)/Nbefore); + clone->SetBinContent(i,eff); + clone->SetBinError(i,effError); + } + + + clone->Draw(opt); + + return 0; +} + + +int TrigTauHistogram::plotAll() +{ + if( m_hist.empty() ) return 1; + std::vector<TH1F*>::iterator ihist = m_hist.begin(); + (*ihist)->Draw(); + ihist++; + + for( ; ihist != m_hist.end(); ++ihist ) + { + (*ihist)->Draw("same"); + } + + return 0; +} + +int TrigTauHistogram::plotAllEfficiencies(int opt) +{ + unsigned int nHist = m_hist.size(); + int color = 1; + for(unsigned int i = 1; i <nHist; ++i) + { + color++; + if( i == 1 ) plotEfficiency(i,0,""); + else{ + if( opt == -1 ) plotEfficiency(i,i-1,"same"); + else plotEfficiency(i,0,"same"); + } + } + return 0; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL1BugFIx.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL1BugFIx.cxx new file mode 100644 index 0000000000000000000000000000000000000000..40bc773b9c7830660274edae7e16afa7111a15fb --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL1BugFIx.cxx @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL1BugFix.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to manage the individual L1/L1/EF selectors. +/// Can also be used to define complete trigger menus +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauL1BugFix.h" + +#include "TrigTauPerformNtuple/TrigTauEvent.h" + +#include <iostream> +using namespace std; + +ClassImp(TrigTauL1BugFix) + +// +// ----------------------------------------------------------------------- +// + +TrigTauL1BugFix::TrigTauL1BugFix() { +} + +TrigTauL1BugFix::~TrigTauL1BugFix() { +} + +void +TrigTauL1BugFix::fix(TrigTauEvent* event) { + + if (event == 0) { + cout << "TrigTauL1BugFix::analyze - event pointer is NULL!" << endl; + return; + } + + // Loop over the L1 objects and replace eta/phi with calo eta/phi + for(std::vector<TrigTauL1Object*>::iterator + l2 = event->tauL1.begin(); l2 != event->tauL1.end(); ++l2) { + + if( (*l2)->m_TauEnergy > 3000. ) continue; // this was corrected + (*l2)->m_TauEnergy *= 1000.; + (*l2)->m_EmIsol *= 1000.; + (*l2)->m_HdIsol *= 1000.; + (*l2)->m_EmCore *= 1000.; + (*l2)->m_HdCore *= 1000.; + + } + +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL1Sel.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL1Sel.cxx new file mode 100755 index 0000000000000000000000000000000000000000..a3b279367b6f99f5533c06ccefb06a4fe4f580eb --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL1Sel.cxx @@ -0,0 +1,203 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL1Sel.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L1 selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#include "TrigTauPerformAnalysis/TrigTauL1Sel.h" + +#include "TrigTauPerformNtuple/TrigTauL1Object.h" + +#include <math.h> +#include <iostream> +using namespace std; + + +TrigTauL1Sel::TrigTauL1Sel() : cut_EmEnergy(0), cut_TauEnergy(0), + cut_EmIsol(0),cut_HdIsol(0), + cut_EmCore(0), cut_HdCore(0) , _debug(false) , + m_histManager(0) +{} + +TrigTauL1Sel::TrigTauL1Sel(const TrigTauL1Sel& other) : + cut_EmEnergy( other.cut_EmEnergy ), + cut_TauEnergy(other.cut_TauEnergy ), + cut_EmIsol( other.cut_EmIsol ), + cut_HdIsol( other.cut_HdIsol ), + cut_EmCore( other.cut_EmCore ), + cut_HdCore( other.cut_HdCore ), + _debug(other._debug), + m_histManager (other.m_histManager) +{} + + +TrigTauL1Sel::~TrigTauL1Sel() +{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} +} + +void +TrigTauL1Sel::setCuts(float emE, + float tauE, + float EmI, + float HdI, + float EmCore, + float hdCore) { + cut_EmEnergy = emE; + cut_TauEnergy = tauE; + cut_EmIsol = EmI; + cut_HdIsol = HdI; + cut_EmCore = EmCore; + cut_HdCore = hdCore; +} + +void TrigTauL1Sel::removeEmIsol() +{ + cut_EmIsol = 0; +} + + +void +TrigTauL1Sel::print() const { + cout << " LVL1 cuts :" << endl; + if (cut_EmEnergy > 1.e-10) { + cout << " EmEnergy > "<<cut_EmEnergy <<endl; + } else { + cout << " EmEnergy: not applied" <<endl; + } + + if (cut_TauEnergy > 1.e-10) { + cout << " TauEnergy > "<<cut_TauEnergy <<endl; + } else { + cout << " TauEnergy: not applied" << endl; + } + + if (cut_EmIsol > 1.e-10) { + cout << " EmIsol <= " << cut_EmIsol <<endl; + } else { + cout << " EmIsol: not applied" << endl; + } + + if (cut_HdIsol > 1.e-10) { + cout << " HdIsol <= " << cut_HdIsol <<endl; + } else { + cout << " HdIsol: not applied" << endl; + } + + if (cut_EmCore > 1.e-10) { + cout << " EmCore > "<<cut_EmCore <<endl; + } else { + cout << " EmCore: not applied" << endl; + } + + if (cut_HdCore > 1.e-10) { + cout << " HdCore > "<<cut_HdCore <<endl; + } else { + cout << " HdCore: not applied" << endl; + } +} + +bool +TrigTauL1Sel::passed(const TrigTauL1Object& tau) const { + return (cutWord(tau) == 0); +} + +void TrigTauL1Sel::setHistDebug(TrigTauHistogram::HISTTYPE type) +{ + if( type != TrigTauHistogram::NONE ){ + //gROOT->cd(); + if( m_histManager ) delete m_histManager; + m_histManager = new TrigTauHistogram(type); + m_histManager->book("baseL1","Before any cut"); + m_histManager->book("EmEnergy","L1: Cut on EmEnergy"); + m_histManager->book("TauEnergy","L1: Cut on TauEnergy (ET)"); + m_histManager->book("EmIsol","L1: Cut on EmIsol"); + m_histManager->book("HadIsol","L1: Cut on HadIsol"); + m_histManager->book("EmCore","L1: Cut on EmCore"); + m_histManager->book("HadCore","L1: Cut on HadCore"); + }else{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} + } +} + + + + +// L1 used the convention that E > Ecut for thresholds +// and EIso <= EIsoCut for isolation. +// For this reason, energy == cut will fail. +// Return bit pattern showing cuts failed + +// L1 used the convention that E > Ecut for thresholds +// and EIso <= EIsoCut for isolation. +// For this reason, energy == cut will fail. +unsigned long +TrigTauL1Sel::cutWord(const TrigTauL1Object& tau) const { + + float varHist = 0; + if( m_histManager) + { + if( m_histManager->type() == TrigTauHistogram::PTHIST ) varHist = tau.m_TauEnergy; + else if( m_histManager->type() == TrigTauHistogram::ETAHIST ) varHist = tau.Eta(); + else if( m_histManager->type() == TrigTauHistogram::PHIHIST ) varHist = tau.Phi(); + } + if( m_histManager) m_histManager->fill(0, varHist); + + unsigned long word = 0; + + if( _debug )cout << " L1: eta="<<tau.Eta() <<", phi="<<tau.Phi() << " RoIWord=" + << std::hex <<tau.m_roiWord << std::dec <<endl; + + if( _debug )cout <<" L1 candidate EmEnergy="<< tau.m_EmEnergy<< ", TauEnergy="<< tau.m_TauEnergy + <<", EmIsol="<< tau.m_EmIsol<< "\n HdIsol="<<tau.m_HdIsol<<", EmCore=" + << tau.m_EmCore<<", HdCore="<<tau.m_HdCore<<endl; + + if( cut_EmEnergy >1.e-10 && cut_EmEnergy >= tau.m_EmEnergy ){ + if( _debug )cout<<" -- EmEnergy reject \n"; + word |= L1CUT_EMENER; + } + if( (word == 0) && m_histManager) m_histManager->fill(1, varHist); + + if( cut_TauEnergy >1.e-10 && cut_TauEnergy >= tau.m_TauEnergy) { + if( _debug )cout<<" -- TauEnergy reject \n"; + word |= L1CUT_TAUCLUS; + } + if( (word == 0) && m_histManager) m_histManager->fill(2, varHist); + + if( cut_EmIsol >1.e-10 && cut_EmIsol < tau.m_EmIsol) { + if( _debug )cout<<" -- EmIsol reject \n"; + word |= L1CUT_EMISOL; + } + if( (word == 0) && m_histManager) m_histManager->fill(3, varHist); + + if( cut_HdIsol >1.e-10 && cut_HdIsol < tau.m_HdIsol) { + if( _debug )cout<<" --HdIsol reject \n"; + word |= L1CUT_HDISOL; + } + if( (word == 0) && m_histManager) m_histManager->fill(4, varHist); + + if( cut_EmCore >1.e-10 && cut_EmCore >= tau.m_EmCore) { + if( _debug )cout<<" -- EmCore reject \n"; + word |= L1CUT_EMCORE; + } + if( (word == 0) && m_histManager) m_histManager->fill(5, varHist); + + if( cut_HdCore >1.e-10 && cut_HdCore >= tau.m_HdCore) { + if( _debug )cout<<" -- HdCore reject \n"; + word |= L1CUT_HDCORE; + } + if( (word == 0) && m_histManager) m_histManager->fill(6, varHist); + + if( _debug && (word == 0)) cout << " -- accept\n"; + return word; +} + + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2BugFix.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2BugFix.cxx new file mode 100755 index 0000000000000000000000000000000000000000..64682958f8742e7911b0f3667008cbbeaccbeeab --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2BugFix.cxx @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL2BugFix.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to manage the individual L1/L2/EF selectors. +/// Can also be used to define complete trigger menus +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauL2BugFix.h" + +#include "TrigTauPerformNtuple/TrigTauEvent.h" + +#include <iostream> +using namespace std; + +ClassImp(TrigTauL2BugFix) + +// +// ----------------------------------------------------------------------- +// + +TrigTauL2BugFix::TrigTauL2BugFix() { +} + +TrigTauL2BugFix::~TrigTauL2BugFix() { +} + +void +TrigTauL2BugFix::fix(TrigTauEvent* event) { + + if (event == 0) { + cout << "TrigTauL2BugFix::analyze - event pointer is NULL!" << endl; + return; + } + + // Loop over the L2 objects and replace eta/phi with calo eta/phi + for(std::vector<TrigTauL2Object*>::iterator + l2 = event->tauL2.begin(); l2 != event->tauL2.end(); ++l2) { + + (*l2)->SetPtEtaPhiM((*l2)->Pt(), (*l2)->m_caloEta, (*l2)->m_caloPhi, (*l2)->M()); + + } + +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2CalSel.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2CalSel.cxx new file mode 100755 index 0000000000000000000000000000000000000000..1eace7849b1e215e28c52f8adc898e83302ab594 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2CalSel.cxx @@ -0,0 +1,400 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL2CalSel.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L2 selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#include "TrigTauPerformAnalysis/TrigTauL2CalSel.h" +#include "TrigTauPerformNtuple/TrigTauL2Object.h" + +#include <math.h> +#include <iostream> +using namespace std; + +TrigTauL2CalSel::TrigTauL2CalSel() + : cut_Et (0), + cut_EtCalib (0), + cut_EtNar (0), + cut_EtNor (0), + cut_nStrips (0), + cut_stripWidth (0), + cut_EMRadius (0), + cut_IsoFrac (0), + cut_EMEnergyWidth2 (0), + cut_nStripsMultiProng (0), + cut_stripWidthMultiProng (0), + cut_EMRadiusMultiProng (0), + cut_IsoFracMultiProng (0), + cut_EMEnergyWidth2MultiProng (0), + _debug(false), + menu(TrigTauFlags::SECONDATTEMPT), + m_histManager(0) +{} + +TrigTauL2CalSel::~TrigTauL2CalSel() +{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} +} + +TrigTauL2CalSel::TrigTauL2CalSel(const TrigTauL2CalSel& other) + : cut_Et (other.cut_Et ), + cut_EtCalib (other.cut_EtCalib ), + cut_EtNar (other.cut_EtNar ), + cut_EtNor (other.cut_EtNor ), + cut_nStrips (other.cut_nStrips ), + cut_stripWidth (other.cut_stripWidth ), + cut_EMRadius (other.cut_EMRadius ), + cut_IsoFrac (other.cut_IsoFrac ), + cut_EMEnergyWidth2 (other.cut_EMEnergyWidth2) , + cut_nStripsMultiProng (other.cut_nStripsMultiProng ), + cut_stripWidthMultiProng (other.cut_stripWidthMultiProng ), + cut_EMRadiusMultiProng (other.cut_EMRadiusMultiProng ), + cut_IsoFracMultiProng (other.cut_IsoFracMultiProng ), + cut_EMEnergyWidth2MultiProng (other.cut_EMEnergyWidth2MultiProng) , + _debug(other._debug), + menu(other.menu), + m_histManager (other.m_histManager) +{} + +void TrigTauL2CalSel::setHistDebug(TrigTauHistogram::HISTTYPE type) +{ + if( type != TrigTauHistogram::NONE ){ + //gROOT->cd(); + if( m_histManager ) delete m_histManager; + m_histManager = new TrigTauHistogram(type); + m_histManager->book("baseL2Cal","Before any cut"); + m_histManager->book("et","Cut on raw Et of cluster"); + m_histManager->book("etCalib","After Cut on EtCalib of cluster"); + m_histManager->book("nStrips","After Cut on nStrips of cluster"); + m_histManager->book("stripWidth","After Cut on stripWidth of cluster"); + m_histManager->book("emrad","After Cut on EMRadius of cluster"); + m_histManager->book("isoFrac","After Cut on IsoFrac of cluster"); + m_histManager->book("EmEnWidth","After Cut on EMEnergyWidth2 of cluster"); + m_histManager->book("EtRawNor","After Cut on EtRawNor"); + }else{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} + } +} + + + +void +TrigTauL2CalSel::setCuts( + float Et, + float EtCalib, + int nStrips, + float stripWidth, + float EMRadius, + float isoFrac, + float EMEnWidth2, + float EtNar, + int nStripsMultiProng, + float stripWidthMultiProng, + float EMRadiusMultiProng, + float isoFracMultiProng, + float EMEnWidth2MultiProng) { + cut_Et =Et; + cut_EtCalib =EtCalib; + cut_EtNar =EtNar; + cut_nStrips =nStrips; + cut_stripWidth =stripWidth; + cut_EMRadius =EMRadius; + cut_IsoFrac =isoFrac; + cut_EMEnergyWidth2 =EMEnWidth2; + + // this will switch between the old and the new cuts + cut_EtNor = 0; + + if( nStripsMultiProng<0) cut_nStripsMultiProng =nStrips; + else cut_nStripsMultiProng =nStripsMultiProng; + if( stripWidthMultiProng<0) cut_stripWidthMultiProng =stripWidth; + else cut_stripWidthMultiProng =stripWidthMultiProng; + if( EMRadiusMultiProng<0) cut_EMRadiusMultiProng =EMRadius; + else cut_EMRadiusMultiProng =EMRadiusMultiProng; + if( isoFracMultiProng<0) cut_IsoFracMultiProng =isoFrac; + else cut_IsoFracMultiProng =isoFracMultiProng; + if( EMEnWidth2MultiProng<0) cut_EMEnergyWidth2MultiProng =EMEnWidth2; + else cut_EMEnergyWidth2MultiProng =EMEnWidth2MultiProng; + + + +} + +void +TrigTauL2CalSel::setNewCuts( float RawEtNor, + float EMRadius, + float EMRadiusMultiProng) +{ + cut_EtNor = RawEtNor; + cut_EMRadius = EMRadius; + + if( EMRadiusMultiProng<0) + cut_EMRadiusMultiProng = EMRadius; + else + cut_EMRadiusMultiProng = EMRadiusMultiProng; +} + +void +TrigTauL2CalSel::print() const { + + if (menu != TrigTauFlags::SECONDATTEMPT) { + cout << "LVL2 selection based on trigger decisision bits for " + << TrigTauFlags::menuName(menu) << endl; + return; + } + + + cout << " L2Calo cuts :" << endl; + + if (cut_Et > 1.e-10) { + cout << " Et > " << cut_Et << endl; + } else { + cout << " Et: not applied" << endl; + } + + if (cut_EtCalib > 1.e-10) { + cout << " EtCalib > " << cut_EtCalib << endl; + } else { + cout << " EtCalib: not applied" << endl; + } + + if (cut_EtNar > 1.e-10) { + cout << " EtNar > " << cut_EtNar << endl; + } else { + cout << " EtNar: not applied" << endl; + } + if (cut_nStrips > 1.e-10) { + cout << " nStrips <= " << cut_nStrips <<" (MultiProng : "<< cut_nStripsMultiProng<< " )" << endl; + } else { + cout << " nStrips: not applied" << endl; + } + + if (cut_stripWidth > 1.e-10) { + cout << " stripWidth <= " << cut_stripWidth <<" (MultiProng : "<< cut_stripWidthMultiProng << " )" << endl; + } else { + cout << " stripWidth: not applied" << endl; + } + + if (cut_EMRadius > 1.e-10) { + cout << " EMRadius <= " << cut_EMRadius <<" (MultiProng : "<<cut_EMRadiusMultiProng << " )" << endl; + } else { + cout << " EMRadius: not applied" << endl; + } + + if (cut_IsoFrac > 1.e-10) { + cout << " IsoFrac <= " << cut_IsoFrac <<" (MultiProng : "<< cut_IsoFracMultiProng << " )"<< endl; + } else { + cout << " IsoFrac: not applied" << endl; + } + + if (cut_EMEnergyWidth2 > 1.e-10) { + cout << " EMEnergyWidth2 <= " << cut_EMEnergyWidth2 <<" (MultiProng : "<<cut_EMEnergyWidth2MultiProng << " )"<< endl; + } else { + cout << " EMEnergyWidth2: not applied" << endl; + } + + if (cut_EtNor > 0) { + cout << " RawEtNor <= " << cut_EtNor << endl; + } else { + cout << " RawEtNor: not applied" << endl; + } + +} + +bool +TrigTauL2CalSel::passed(const TrigTauL2Object& tau) const { + if (menu != TrigTauFlags::SECONDATTEMPT) return tau.m_tags.passedL2(menu); + + if( cut_EtNor > 0) return cutWordNew(tau) == 0; + + return (cutWord(tau) == 0); +} + +unsigned long +TrigTauL2CalSel::cutWord(const TrigTauL2Object& tau) const { + + if( cut_Et >1.e-10 && cut_EtCalib >1.e-10 ) + { + cout << "TrigTauL2CalSel::WARNING both cuts on Et and EtCalib are used \n"; + } + + if (_debug) cout << "L2Cal: eta="<<tau.m_caloEta <<", phi="<<tau.m_caloPhi << " RoIWord=" + << std::hex <<tau.m_roiWord << std::dec <<endl; + + float varHist = 0; + if( m_histManager) + { + if( m_histManager->type() == TrigTauHistogram::PTHIST ) varHist = tau.Pt(); + else if( m_histManager->type() == TrigTauHistogram::ETAHIST ) varHist = tau.Eta(); + else if( m_histManager->type() == TrigTauHistogram::PHIHIST ) varHist = tau.Phi(); + } + + if( m_histManager) m_histManager->fill(0, varHist); + + unsigned long word = 0; + int nTrk = tau.nTracksInDR(0.1); + + if (_debug) cout << "Et="<<tau.etClus() << " "; + if( cut_Et > 1.e-10 && cut_Et >= tau.etClus()) { + if (_debug) cout << " - failed Et" << endl; + word |= L2CUT_ET; + } + + if (_debug) cout << "EtNar="<<tau.etNarrow() << " "; + if( cut_EtNar > 1.e-10 && cut_EtNar >= tau.etNarrow()) { + if (_debug) cout << " - failed EtNar" << endl; + word |= L2CUT_ETNAR; + } + + if( m_histManager && word==0) m_histManager->fill(1, varHist); + + if (_debug) cout << "EtCalib="<<tau.etClusCalib() << " "; + if( cut_EtCalib > 1.e-10 && cut_EtCalib >= tau.etClusCalib() ) { + if (_debug) cout << " - failed EtCalib" << endl; + word |= L2CUT_ETCALIB; + } + + if( m_histManager && word==0) m_histManager->fill(2, varHist); + + if (_debug) cout << "nStrips="<<tau.m_nStrips << " "; + if( cut_nStrips > 1.e-10 && nTrk<=1 && cut_nStrips < tau.m_nStrips ) { + if (_debug) cout << " - failed nStrips" << endl; + word |= L2CUT_NSTRIP; + } + if( cut_nStripsMultiProng > 1.e-10 && nTrk > 1 && cut_nStripsMultiProng < tau.m_nStrips ) { + if (_debug) cout << " - failed nStrips MultiProng" << endl; + word |= L2CUT_NSTRIP; + } + + if( m_histManager && word==0) m_histManager->fill(3, varHist); + + if (_debug) cout << "strpWidth="<<tau.m_stripWidth2 << " "; + if( cut_stripWidth > 1.e-10 && nTrk<=1 && cut_stripWidth < tau.m_stripWidth2 ) { + if (_debug) cout << " - failed stripWidth" << endl; + word |= L2CUT_STRWID; + } + if( cut_stripWidthMultiProng > 1.e-10 && nTrk > 1 && cut_stripWidthMultiProng < tau.m_stripWidth2 ) { + if (_debug) cout << " - failed stripWidth MultiProng " << endl; + word |= L2CUT_STRWID; + } + + if( m_histManager && word==0) m_histManager->fill(4, varHist); + + if (_debug) cout << "EMRad="<<tau.m_EMRadius << " "; + if( cut_EMRadius > 1.e-10 && nTrk<=1 && cut_EMRadius < tau.m_EMRadius ) { + if (_debug) cout << " - failed EMRadius" << endl; + word |= L2CUT_EMRAD; + } + if( cut_EMRadiusMultiProng > 1.e-10 && nTrk > 1 && cut_EMRadiusMultiProng < tau.m_EMRadius ) { + if (_debug) cout << " - failed EMRadius MultiProng" << endl; + word |= L2CUT_EMRAD; + } + if( m_histManager && word==0) m_histManager->fill(5, varHist); + + if (_debug) cout << "IsoFrac="<<tau.m_isoFrac << " "; + if( cut_IsoFrac > 1.e-10 && nTrk<=1 && cut_IsoFrac < tau.m_isoFrac ) { + if (_debug) cout << " - failed IsoFrac" << endl; + word |= L2CUT_ISOFRAC; + } + if( cut_IsoFracMultiProng > 1.e-10 && nTrk > 1 && cut_IsoFracMultiProng < tau.m_isoFrac ) { + if (_debug) cout << " - failed IsoFrac MultiProng" << endl; + word |= L2CUT_ISOFRAC; + } + if( m_histManager && word==0) m_histManager->fill(6, varHist); + + if (_debug) cout << "EmEnWidth="<<tau.m_EMEnergyWidth[2] << " "; + if( cut_EMEnergyWidth2>1.e-10 && nTrk<=1 && cut_EMEnergyWidth2 < tau.m_EMEnergyWidth[2]) { + if (_debug) cout << " - failed EMWidth2" << endl; + word |= L2CUT_EMWID; + } + if( cut_EMEnergyWidth2MultiProng>1.e-10 && nTrk > 1 && cut_EMEnergyWidth2MultiProng < tau.m_EMEnergyWidth[2]) { + if (_debug) cout << " - failed EMWidth2 MultiProng" << endl; + word |= L2CUT_EMWID; + } + if( m_histManager && word==0) m_histManager->fill(7, varHist); + + if (_debug && (word==0)) cout << " accepted" << endl; + return word; +} + +unsigned long +TrigTauL2CalSel::cutWordNew(const TrigTauL2Object& tau) const +{ + if (_debug) + cout << "L2Cal: eta=" << tau.m_caloEta << ", phi=" << tau.m_caloPhi + << " RoIWord=" << std::hex << tau.m_roiWord << std::dec <<endl; + + float varHist = 0; + if( m_histManager) + { + if( m_histManager->type() == TrigTauHistogram::PTHIST) + varHist = tau.Pt(); + else if( m_histManager->type() == TrigTauHistogram::ETAHIST) + varHist = tau.Eta(); + else if( m_histManager->type() == TrigTauHistogram::PHIHIST) + varHist = tau.Phi(); + } + + if( m_histManager) m_histManager->fill(0, varHist); + + unsigned long word = 0; + int nTrk = tau.m_nCoreTracks + tau.m_nIsoTracks; + + // Cut1: EtNar NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(1, varHist); + + // Cut2: EtCalib NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(2, varHist); + + // Cut3: nStrips NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(3, varHist); + + // Cut4: StripWidth NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(4, varHist); + + // Cut5: EMRadius + float emRadius3S = tau.m_EMRadius3S; + if (_debug) + cout << "EMRadius3S=" << emRadius3S << " "; + if( cut_EMRadiusMultiProng > 1.e-10 && nTrk<=1 && + cut_EMRadiusMultiProng < emRadius3S) + { + if (_debug) cout << " - failed EMRadius3S" << endl; + word |= L2CUT_EMRAD; + } + if( cut_EMRadius > 1.e-10 && nTrk == 1 && cut_EMRadius < emRadius3S) + { + if (_debug) cout << " - failed EMRadius3S OneProng" << endl; + word |= L2CUT_EMRAD; + } + if( m_histManager && word==0) m_histManager->fill(5, varHist); + + // Cut6: IsoFrac NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(6, varHist); + + // Cut7: EMWidth2 NOT IMPLEMENTED + if( m_histManager && word==0) m_histManager->fill(7, varHist); + + // Cut8: RawEtNor + if(_debug) cout << "RawEtNor=" << tau.etWide() << " "; + if( cut_EtNor > 0 && cut_EtNor >= tau.etWide()) + { + if (_debug) cout << " - failed RawEtNor" << endl; + word |= L2CUT_ETNOR; + } + + if( m_histManager && word==0) m_histManager->fill(8, varHist); + + if (_debug && (word==0)) + cout << " accepted" << endl; + + return word; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2TrkSel.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2TrkSel.cxx new file mode 100755 index 0000000000000000000000000000000000000000..d750072c4db065cba953938bfed8aafe27502518 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauL2TrkSel.cxx @@ -0,0 +1,275 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauL2TrkSel.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L2 selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#include "TrigTauPerformAnalysis/TrigTauL2TrkSel.h" +#include "TrigTauPerformNtuple/TrigTauL2Object.h" +#include "TrigTauPerformAnalysis/TrigTauHistogram.h" + + +#include <math.h> +#include <iostream> +using namespace std; + +// +// ----------------------------------------------------------------------- +// + +TrigTauL2TrkSel::TrigTauL2TrkSel() + : cut_NtracksMin (0), + cut_NtracksMax (0), + cut_NtracksIsolation(0), + cut_NtracksSlow (0), + cut_NtracksMatched (0), + maxPtMin (0), + chargeCut (0), + sumPtRatio (100), + trkEmEtMin (0), + _debug(false), + menu(TrigTauFlags::SECONDATTEMPT), + m_histManager(0) +{} + +TrigTauL2TrkSel::~TrigTauL2TrkSel() +{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} +} + +TrigTauL2TrkSel::TrigTauL2TrkSel(const TrigTauL2TrkSel& other) + : cut_NtracksMin (other.cut_NtracksMin ), + cut_NtracksMax (other.cut_NtracksMax ), + cut_NtracksIsolation(other.cut_NtracksIsolation), + cut_NtracksSlow (other.cut_NtracksSlow ), + cut_NtracksMatched (other.cut_NtracksMatched ), + maxPtMin (other.maxPtMin ), + chargeCut (other.chargeCut ), + sumPtRatio (other.sumPtRatio ), + trkEmEtMin (other.trkEmEtMin ), + _debug (other._debug ), + menu (other.menu ), + m_histManager (other.m_histManager ) +{} + +void +TrigTauL2TrkSel::setCuts(int nTrMax, int nTrISO, int nTrSlow, int nTrkMatched, + float maPtSlow , float dRIso , float mPt , + float dRMatch, float dRt, float maxPt, bool charge, + float ssumPtRatio, float trkEmEt, int nTrMin) +{ + cut_NtracksMin = nTrMin; + cut_NtracksMax = nTrMax; + cut_NtracksIsolation= nTrISO; + cut_NtracksSlow = nTrSlow; + cut_NtracksMatched = nTrkMatched; + maxPtMin = maxPt; + chargeCut = charge; + sumPtRatio = ssumPtRatio; + trkEmEtMin = trkEmEt; + maPtSlow = maPtSlow; + dRIso = dRIso; + mPt = mPt; + dRMatch = dRMatch; + dRt = dRt; + + // Reset (these can no longer be set here) + maPtSlow = 0; + dRIso = 0.; + mPt = 0.; + dRMatch = 0.; + dRt = 0.; +} + +void +TrigTauL2TrkSel::print() const { + + if (menu != TrigTauFlags::SECONDATTEMPT) { + cout << "LVL2 selection based on trigger decisision bits for " + << TrigTauFlags::menuName(menu) << endl; + return; + } + + cout << " L2Track cuts :" << endl; + + if (cut_NtracksMax >= 0) { + cout << cut_NtracksMin << " <= Ntracks <= " << cut_NtracksMax << endl; + } else { + cout << " Ntracks: not applied" << endl; + } + + cout << " max(Pt_track) >= " << maxPtMin << endl; + + if (cut_NtracksIsolation >= 0) { + cout << " NtracksIsolation<= " << cut_NtracksIsolation<< endl; + } else { + cout << " NtracksIsolation: not applied" << endl; + } + + if (cut_NtracksSlow >= 0) { + cout << " NtracksSlow <= " << cut_NtracksSlow << endl; + } else { + cout << " NtracksSlow: not applied" << endl; + } + + if (cut_NtracksMatched >= 0) { + cout << " NtracksMatched <= " << cut_NtracksMatched << endl; + } else { + cout << " NtracksMatched: not applied" << endl; + } + + if (chargeCut) { + cout << " Charge cut applied " << endl; + } else { + cout << " Charge cut not applied " << endl; + } + + if (sumPtRatio < 100.) { + cout << " sumPtRatio <= " << sumPtRatio << endl; + } else { + cout << " sumPtRatio: not applied" << endl; + } + + if (trkEmEtMin > 0.) { + cout << " Et(trk+EM) > " << trkEmEtMin << endl; + } else { + cout << " trkEmEt: not applied" << endl; + } + +} + +void TrigTauL2TrkSel::setHistDebug(TrigTauHistogram::HISTTYPE type) +{ + if( type != TrigTauHistogram::NONE ){ + //gROOT->cd(); + if( m_histManager ) delete m_histManager; + m_histManager = new TrigTauHistogram(type); + m_histManager->book("baseL2Trk","Before any cut"); + m_histManager->book("ntrkExist","L2Trk: Ntrk>0 "); + m_histManager->book("ntrk","L2Trk: Cut on Ntrk "); + m_histManager->book("leadPt","L2Trk: Cut on leading Pt"); + m_histManager->book("nSlow","L2Trk: Cut on number of slow tracks"); + m_histManager->book("nIso","L2Trk: Cut on N isolation tracks"); + m_histManager->book("nMatched","L2Trk: Cut on N matched"); + m_histManager->book("Q","L2Trk: Cut on total charge"); + m_histManager->book("sumPtCore","L2Trk: Cut on sumPtCoree"); + m_histManager->book("Et_trkEM","L2Trk: Cut on Et(trk+EM)"); + + }else{ + if( m_histManager ) { delete m_histManager; m_histManager=0;} + } +} + + +bool +TrigTauL2TrkSel::passed(const TrigTauL2Object& tau) { + if (menu != TrigTauFlags::SECONDATTEMPT) return tau.m_tags.passedL2(menu); + return (cutWord(tau) == 0); +} + + +unsigned long +TrigTauL2TrkSel::cutWord(const TrigTauL2Object& tau) { + float varHist = 0; + if( m_histManager) + { + if( m_histManager->type() == TrigTauHistogram::PTHIST ) varHist = tau.Pt(); + else if( m_histManager->type() == TrigTauHistogram::ETAHIST ) varHist = tau.Eta(); + else if( m_histManager->type() == TrigTauHistogram::PHIHIST ) varHist = tau.Phi(); + } + + if( m_histManager) m_histManager->fill(0, varHist); + + if( tau.tracks.begin() != tau.tracks.end() ) + if( m_histManager) m_histManager->fill(1, varHist); + + if (_debug) cout << "L2Trk: eta="<<tau.Eta() <<", phi="<<tau.Phi() << " RoIWord=" + << std::hex <<tau.m_roiWord << std::dec <<endl; + + unsigned long word = 0; + if (_debug) cout << "nTrk="<< tau.m_nCoreTracks << " "; + if( cut_NtracksMin >=0 && tau.m_nCoreTracks < cut_NtracksMin ) { + if (_debug) cout << " - reject nTrMin" << endl; + word |= L2CUT_NTRK; + } + if( cut_NtracksMax >=0 && tau.m_nCoreTracks > cut_NtracksMax ) { + if (_debug) cout << " - reject nTrMax" << endl; + word |= L2CUT_NTRK; + } + if( m_histManager && word==0) m_histManager->fill(2, varHist); + + if (_debug) cout << "LeadPt="<<tau.m_leadingTrackPt << " "; + if ( tau.m_leadingTrackPt < maxPtMin) { + if (_debug) cout << " - reject maxPt" << endl; + word |= L2CUT_LEADPT; + } + if( m_histManager && word==0) m_histManager->fill(3, varHist); + + if (_debug) cout <<"nSlow="<< tau.m_nSlowTracks << " "; + if( cut_NtracksSlow >=0 && tau.m_nSlowTracks > cut_NtracksSlow ) { + if (_debug) cout << " - reject nSlow" << endl; + word |= L2CUT_NSLOW; + } + if( m_histManager && word==0) m_histManager->fill(4, varHist); + + if (_debug) cout << "nIso="<< tau.m_nIsoTracks << " "; + if( cut_NtracksIsolation>=0 && tau.m_nIsoTracks > cut_NtracksIsolation ) { + if (_debug) cout << " - reject nIso" << endl; + word |= L2CUT_NISO; + } + if( m_histManager && word==0) m_histManager->fill(5, varHist); + + if (_debug) cout << "nMatched="<< tau.m_nMatchedTracks << " "; + if( cut_NtracksMatched >=0 && tau.m_nMatchedTracks > cut_NtracksMatched ) { + if (_debug) cout << " - reject nMatch" << endl; + word |= L2CUT_NMATCHED; + } + if( m_histManager && word==0) m_histManager->fill(6, varHist); + + if (_debug) cout << "Q="<< tau.m_charge << " "; + if ( chargeCut && fabs(tau.m_charge) > 2) { + if (_debug) cout << " - reject totCh" << endl; + word |= L2CUT_CHARGE; + } + if( m_histManager && word==0) m_histManager->fill(7, varHist); + + float ratioIsoCore = 0; + if( tau.m_scalarPtSumCore > 0 ) ratioIsoCore = tau.m_scalarPtSumIso/tau.m_scalarPtSumCore; + + if (_debug) cout << "sumPtRatio="<< ratioIsoCore << " "; + if (sumPtRatio < 100.) { + if ( ratioIsoCore > sumPtRatio) { + if (_debug) cout << " - reject sumPtRatio" << endl; + word |= L2CUT_RISO; + } + } + if( m_histManager && word==0) m_histManager->fill(8, varHist); + + float emEt = tau.m_EMEnergyWide[0]+tau.m_EMEnergyWide[1]+tau.m_EMEnergyWide[2]; + emEt /= TMath::CosH(tau.m_caloEta); + + TLorentzVector trkEMSum; + trkEMSum.SetPtEtaPhiM(emEt, tau.m_caloEta, tau.m_caloPhi, 0.); + + trkEMSum += tau.m_3fastest; + float trkEM2Et = trkEMSum.Et(); + + + if (_debug) cout << "Et(trk+EM)=" << trkEM2Et << " "; + if (tau.m_nCoreTracks > 1 && trkEM2Et <= trkEmEtMin) { + if (_debug) cout << " - reject Et(trk+EM)" << endl; + word |= L2CUT_ETTRKEM; + } + if( m_histManager && word==0) m_histManager->fill(9, varHist); + + if (_debug && word==0) cout << " accepted" << endl; + return word; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauMETL1Sel.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauMETL1Sel.cxx new file mode 100755 index 0000000000000000000000000000000000000000..ee8ef8dbc7cb3dbbebfca8a9b4262da4d9b0f4c0 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauMETL1Sel.cxx @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauMETL1Sel.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to apply L1 MET selection to performance ntuple objects +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// +#include "TrigTauPerformAnalysis/TrigTauMETL1Sel.h" + +#include "TrigTauPerformNtuple/TrigTauEtMissL1Object.h" + +#include <math.h> +#include <iostream> +using namespace std; + +TrigTauMETL1Sel::TrigTauMETL1Sel() : cut_MET(0.), _debug(false) +{} + +TrigTauMETL1Sel::TrigTauMETL1Sel(const TrigTauMETL1Sel& other) : + cut_MET(other.cut_MET), + _debug(other._debug) +{} + +void +TrigTauMETL1Sel::setCuts(float MET) { + cut_MET = MET; +} + +void +TrigTauMETL1Sel::print() const { + cout << " L1 MET cuts :" << endl; + + if (cut_MET > 1.e-10) { + cout << " L1 MET > "<<cut_MET <<endl; + } else { + cout << " L1 MET: not applied" << endl; + } +} + +bool +TrigTauMETL1Sel::passed(const TrigTauEtMissL1Object& tau) const { + if( _debug ) cout << " L1 MET: event MET is : "<< tau.m_EtMiss << endl; + if( cut_MET >1.e-10 && cut_MET >= tau.m_EtMiss ) { + if( _debug ) cout << " --- rejected \n"; + return false;} + if( _debug ) cout << " --- accepted \n"; + return true; +} diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauSelectionManager.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauSelectionManager.cxx new file mode 100755 index 0000000000000000000000000000000000000000..c45379c9935bc3ec8447141ac7b1650391ea1774 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauSelectionManager.cxx @@ -0,0 +1,3206 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauSelectionManager.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Class to manage the individual L1/L2/EF selectors. +/// Can also be used to define complete trigger menus +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauSelectionManager.h" + +#include "TrigTauPerformNtuple/TrigTauL1Object.h" +#include "TrigTauPerformNtuple/TrigTauL2Object.h" +#include "TrigTauPerformNtuple/TrigTauRecEFObject.h" + +#include "TrigTauPerformAnalysis/TrigTauTrigChain.h" +#include "TrigTauPerformAnalysis/TrigTauL1Sel.h" +#include "TrigTauPerformAnalysis/TrigTauL2CalSel.h" +#include "TrigTauPerformAnalysis/TrigTauL2TrkSel.h" +#include "TrigTauPerformAnalysis/TrigTauEFSel.h" + +#include <math.h> +#include <iostream> +using namespace std; + +// +// ----------------------------------------------------------------------- +// + +TrigTauSelectionManager::TrigTauSelectionManager() : + _menuVersion( MENU1560), + _cutLevel( LOOSE), + _usedType( TrigTauFlags::TAU12), + _givenType( TrigTauFlags::TAU12), + l2CalOnly(false), + l2TrkOnly(false) { +} + +TrigTauSelectionManager::~TrigTauSelectionManager() { +} + + +TrigTauFlags::TRIGGERMENU TrigTauSelectionManager::usedTauMenu() const +{ + + switch( _cutLevel ){ + case LOOSE : + switch (_usedType ) + { + case TrigTauFlags::TAU12 : return TrigTauFlags::TAU12 ; + case TrigTauFlags::TAU16 : return TrigTauFlags::TAU16 ; + case TrigTauFlags::TAU20 : return TrigTauFlags::TAU20 ; + case TrigTauFlags::TAU29 : return TrigTauFlags::TAU29 ; + case TrigTauFlags::TAU29v2 : return TrigTauFlags::TAU29v2 ; + case TrigTauFlags::TAU38 : return TrigTauFlags::TAU38 ; + case TrigTauFlags::TAU50 : return TrigTauFlags::TAU50 ; + case TrigTauFlags::TAU84 : return TrigTauFlags::TAU84 ; + case TrigTauFlags::TAU100 : return TrigTauFlags::TAU100 ; + case TrigTauFlags::TAU125 : return TrigTauFlags::TAU125 ; + default : return _usedType; + } + break; + case MEDIUM : + switch (_usedType ) + { + case TrigTauFlags::TAU16 : return TrigTauFlags::TAU16_MEDIUM ; + case TrigTauFlags::TAU20 : return TrigTauFlags::TAU20_MEDIUM ; + case TrigTauFlags::TAU29 : return TrigTauFlags::TAU29_MEDIUM ; + case TrigTauFlags::TAU38 : return TrigTauFlags::TAU38_MEDIUM ; + case TrigTauFlags::TAU50 : return TrigTauFlags::TAU50_MEDIUM ; + case TrigTauFlags::TAU84 : return TrigTauFlags::TAU84_MEDIUM ; + case TrigTauFlags::TAU100 : return TrigTauFlags::TAU100_MEDIUM; + case TrigTauFlags::TAU125 : return TrigTauFlags::TAU125_MEDIUM; + default : return _usedType; + } + break; + case TIGHT : + switch (_usedType ) + { + case TrigTauFlags::TAU16 : return TrigTauFlags::TAU16_TIGHT ; + case TrigTauFlags::TAU20 : return TrigTauFlags::TAU20_TIGHT ; + case TrigTauFlags::TAU29 : return TrigTauFlags::TAU29_TIGHT ; + case TrigTauFlags::TAU38 : return TrigTauFlags::TAU38_TIGHT ; + case TrigTauFlags::TAU50 : return TrigTauFlags::TAU50_TIGHT ; + case TrigTauFlags::TAU84 : return TrigTauFlags::TAU84_TIGHT ; + case TrigTauFlags::TAU125 : return TrigTauFlags::TAU125_TIGHT; + default : return _usedType; + } + break; + case MEDIUM1 : + switch (_usedType ) + { + case TrigTauFlags::TAU16 : return TrigTauFlags::TAU16_MEDIUM1 ; + case TrigTauFlags::TAU20 : return TrigTauFlags::TAU20_MEDIUM1 ; + case TrigTauFlags::TAU29 : return TrigTauFlags::TAU29_MEDIUM1 ; + case TrigTauFlags::TAU100 : return TrigTauFlags::TAU100_MEDIUM1 ; + default : return _usedType; + } + default : return _usedType; + } +} + + +void +TrigTauSelectionManager::setTauMenu(TrigTauFlags::TRIGGERMENU givenType, CUTLEVEL level) { + + // ================================================================================== + // First of all, let us decide on which CUTLEVEl to use + // ================================================================================== + TrigTauFlags::TRIGGERMENU type = givenType; + + if( level == DEFAULT ) + { + level=LOOSE; + // guess level from the name + switch (givenType ) + { + case TrigTauFlags::TAUNOCUT :level = SOFT; break; + case TrigTauFlags::TAUNOCUT_CALO :level = SOFT; break; + case TrigTauFlags::TRK9 : level = LOOSE; break; + case TrigTauFlags::TAU12 : level = LOOSE; break; + case TrigTauFlags::TAU16 : level = LOOSE; break; + case TrigTauFlags::TAU20 : level = LOOSE; break; + case TrigTauFlags::TAU29 : level = LOOSE; break; + case TrigTauFlags::TAU29v2 : level = LOOSE; break; + case TrigTauFlags::TAU38 : level = LOOSE; break; + case TrigTauFlags::TAU50 : level = LOOSE; break; + case TrigTauFlags::TAU84 : level = LOOSE; break; + case TrigTauFlags::TAU100 : level = LOOSE; break; + case TrigTauFlags::TAU125 : level = LOOSE; break; + + case TrigTauFlags::TAU16_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU16 ; break; + case TrigTauFlags::TAU20_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU20 ; break; + case TrigTauFlags::TAU29_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU29 ; break; + case TrigTauFlags::TAU38_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU38 ; break; + case TrigTauFlags::TAU50_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU50 ; break; + case TrigTauFlags::TAU84_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU84 ; break; + case TrigTauFlags::TAU100_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU100; break; + case TrigTauFlags::TAU125_MEDIUM: + level = MEDIUM; type=TrigTauFlags::TAU125; break; + + case TrigTauFlags::TAU16_TIGHT: + level = TIGHT; type=TrigTauFlags::TAU16 ; break; + case TrigTauFlags::TAU20_TIGHT: + level = TIGHT; type=TrigTauFlags::TAU20 ; break; + case TrigTauFlags::TAU29_TIGHT: + level = TIGHT; type=TrigTauFlags::TAU29 ; break; + case TrigTauFlags::TAU38_TIGHT: + level = TIGHT; type=TrigTauFlags::TAU38 ; break; + case TrigTauFlags::TAU50_TIGHT: + level = TIGHT; type=TrigTauFlags::TAU50 ; break; + case TrigTauFlags::TAU84_TIGHT: + level = TIGHT; type=TrigTauFlags::TAU84 ; break; + case TrigTauFlags::TAU125_TIGHT: + level = TIGHT; type=TrigTauFlags::TAU125; break; + + case TrigTauFlags::TAU16_MEDIUM1: + level = MEDIUM1; type=TrigTauFlags::TAU16 ; break; + case TrigTauFlags::TAU20_MEDIUM1: + level = MEDIUM1; type=TrigTauFlags::TAU20 ; break; + case TrigTauFlags::TAU29_MEDIUM1: + level = MEDIUM1; type=TrigTauFlags::TAU29 ; break; + case TrigTauFlags::TAU100_MEDIUM1: + level = MEDIUM1; type=TrigTauFlags::TAU100 ; break; + + default: + cout << "ERROR: please specify single tau menu for" + << " TrigTauSelectionManager::setTauMenu" << std::endl; + break; + } + + + + }else{ + + static bool first = true; + switch (givenType ) + { + case TrigTauFlags::TAUNOCUT: + case TrigTauFlags::TRK9 : + case TrigTauFlags::TAU12 : + case TrigTauFlags::TAU16 : + case TrigTauFlags::TAU20 : + case TrigTauFlags::TAU29 : + case TrigTauFlags::TAU29v2 : + case TrigTauFlags::TAU38 : + case TrigTauFlags::TAU50 : + case TrigTauFlags::TAU84 : + case TrigTauFlags::TAU100 : + case TrigTauFlags::TAU125 : + if( level != LOOSE ) + { if (first){cout << "TrigTauSelectionManager ERROR : menu " + << TrigTauFlags::menuName(givenType) + << " should be used with LOOSE (" + << LOOSE<<") or DEFAULT level ("<< LOOSE <<") \n" + << " using " << level << "instead \n"; + first = false; + } + break; + } + break; + + case TrigTauFlags::TAU16_MEDIUM : + case TrigTauFlags::TAU20_MEDIUM : + case TrigTauFlags::TAU29_MEDIUM : + case TrigTauFlags::TAU38_MEDIUM : + case TrigTauFlags::TAU50_MEDIUM : + case TrigTauFlags::TAU84_MEDIUM : + case TrigTauFlags::TAU100_MEDIUM: + case TrigTauFlags::TAU125_MEDIUM: + if( level != MEDIUM ) + { if (first){ cout << "TrigTauSelectionManager ERROR : menu " + << TrigTauFlags::menuName(givenType) + << " should be used with MEDIUM (" + << MEDIUM<<") or DEFAULT level ("<< LOOSE <<") \n" + << " using " << level << "instead \n"; + first = false; + } + break; + } + break; + case TrigTauFlags::TAU16_TIGHT : + case TrigTauFlags::TAU20_TIGHT : + case TrigTauFlags::TAU29_TIGHT : + case TrigTauFlags::TAU38_TIGHT : + case TrigTauFlags::TAU50_TIGHT : + case TrigTauFlags::TAU84_TIGHT : + case TrigTauFlags::TAU125_TIGHT: + if( level != TIGHT ) + { if (first){ cout << "TrigTauSelectionManager ERROR : menu " + << TrigTauFlags::menuName(givenType) + << " should be used with TIGHT (" + << TIGHT<<") or DEFAULT level ("<< LOOSE <<") \n" + << " using " << level << "instead \n"; + first = false; + } + break; + } + break; + case TrigTauFlags::TAU16_MEDIUM1: + case TrigTauFlags::TAU20_MEDIUM1: + case TrigTauFlags::TAU29_MEDIUM1: + case TrigTauFlags::TAU100_MEDIUM1: + if( level != MEDIUM1 ) + { if (first){ cout << "TrigTauSelectionManager ERROR : menu " + << TrigTauFlags::menuName(givenType) + << " should be used with MEDIUM1 (" + << MEDIUM1<<") or DEFAULT level ("<< LOOSE <<") \n" + << " using " << level << "instead \n"; + first = false; + } + break; + } + break; + + default : cout << "ERROR: please specify single tau menu for TrigTauSelectionManager::setTauMenu\n"; break; + } + + if( givenType == TrigTauFlags::TAU16_MEDIUM1 || + givenType == TrigTauFlags::TAU16_MEDIUM || + givenType == TrigTauFlags::TAU16_TIGHT) + type = TrigTauFlags::TAU16 ; + if( givenType == TrigTauFlags::TAU20_MEDIUM1 || + givenType == TrigTauFlags::TAU20_MEDIUM || + givenType == TrigTauFlags::TAU20_TIGHT) + type = TrigTauFlags::TAU20 ; + if( givenType == TrigTauFlags::TAU29_MEDIUM1 || + givenType == TrigTauFlags::TAU29_MEDIUM || + givenType == TrigTauFlags::TAU29_TIGHT) + type = TrigTauFlags::TAU29 ; + if( givenType == TrigTauFlags::TAU38_MEDIUM || + givenType == TrigTauFlags::TAU38_TIGHT) + type = TrigTauFlags::TAU38 ; + if( givenType == TrigTauFlags::TAU50_MEDIUM || + givenType == TrigTauFlags::TAU50_TIGHT) + type = TrigTauFlags::TAU50 ; + if( givenType == TrigTauFlags::TAU84_MEDIUM || + givenType == TrigTauFlags::TAU84_TIGHT) + type = TrigTauFlags::TAU84 ; + if( givenType == TrigTauFlags::TAU100_MEDIUM || + givenType == TrigTauFlags::TAU100_MEDIUM1) + type = TrigTauFlags::TAU100 ; + if( givenType == TrigTauFlags::TAU125_MEDIUM || + givenType == TrigTauFlags::TAU125_TIGHT) + type = TrigTauFlags::TAU125 ; + } + + _cutLevel = level; + _givenType = givenType; + _usedType = type; + + + switch (_menuVersion ) { + + + case MENU1206 : setTauMenu1206 (_usedType, level ); break ; + case MENUJUNE06: + case MENUJUNE07: setTauMenuJUNE07 (_usedType, level ); break ; + case MENU13020: setTauMenu13020 (_usedType, level ); break ; + case MENUAUG07: setTauMenuAUG07 (_usedType, level ) ;break ; + case MENU13030pre: setTauMenu13030pre (_usedType, level ); break ; + case MENU1400: setTauMenu1400 (_usedType, level ); break ; + case MENU1560: setTauMenu1560 (_usedType, level ); break ; + case MENU1520test: setTauMenu1520test (_usedType, level ); break ; + case MENU1600: setTauMenu1600 (_usedType, level ); break ; + //TrigTauHypo-00-02-34 + case MENU1662: setTauMenu1662 (_usedType, level ); break ; + //TrigTauHypo-00-02-42, BUT TEMPORARILY TAU125_MEDIUM was modified and TAU100_MEDIUM1 was added + case MENU1666: setTauMenu1666 (_usedType, level ); break ; + //TrigTauHypo-00-03-02 + case MENUTEST: setTauMenuTest (_usedType, level ); break ; + + default : + cout << "Unknown menu version " << _menuVersion + << ", menus not set!" << endl; + break; + } + + +} + +//============================================================================================= +void TrigTauSelectionManager::useHLTTriggerBits(bool useBits) { + + if (useBits) { + l2CalSel.useBits(_givenType); + l2TrkSel.useBits(_givenType); + efSel.useBits(_givenType); + } else { + // Clear the selectors from using trigger bits + l2CalSel.useBits(TrigTauFlags::SECONDATTEMPT); + l2TrkSel.useBits(TrigTauFlags::SECONDATTEMPT); + efSel.useBits(TrigTauFlags::SECONDATTEMPT); + } + +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenu1206(TrigTauFlags::TRIGGERMENU type, CUTLEVEL /*level*/) { + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 13000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 11000, 0, 0.055, 0.0127, 0.425, 0); + l2TrkSel.setCuts(4, 0, 2, 3, 7500, 0.15, 1500, 0.15, 0.30); + efSel.setCuts(1, 3, 0.15, 0.4, 0., 5000.); + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 17000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 17000, 0, 0.055, 0.0127, 0.425, 0); +// l2TrkSel.setCuts(4, 0, 2, 3, 7500, 0.15, 1500, 0.15, 0.30); +// efSel.setCuts(1, 3, 0.08, 0.31, 0., 5000.); +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 22000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 20000, 0, 0.055, 0.0127, 0.425, 0); +// l2TrkSel.setCuts(4, 0, 2, 3, 7500, 0.15, 1500, 0.15, 0.30); +// efSel.setCuts(1, 3, 0.08, 0.31, 0., 5000.); +// break; + +// case TrigTauFlags::TAU29I: +// l1Sel.setCuts(0, 30000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 23300, 0, 0.055, 0.0127, 0.425, 0); +// l2TrkSel.setCuts(4, 0, 1, 3, 7500, 0.15, 1500, 0.15, 0.30); +// efSel.setCuts(1, 3, 0.08, 0.31, 0., 5000.); +// break; + + case TrigTauFlags::TAU38: +// case TrigTauFlags::TAU38I: +// if( type == TrigTauFlags::TAU38I) l1Sel.setCuts(0, 21000, 0, 0, 0, 0); +// else + l1Sel.setCuts(0, 21000, 0, 0, 0, 0); + // l2CalSel.setCuts(0, 33500, 0, 0.060, 0.0100, 0.60, 0); + l2CalSel.setCuts(0, 28500, 0, 0.060, 0.0100, 0.60, 0); + l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.14, 0.4, 0., 7000., 35000.); + break; + + default : + cout << ":setTauMenu can not deal with menu " << TrigTauFlags::menuName(type) << endl; + + } +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenuJUNE07(TrigTauFlags::TRIGGERMENU type, CUTLEVEL /*level*/) { + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 7000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 11000, 0, 0.2, 0.1, 1., 0); + l2TrkSel.setCuts(4, 0, 2, 3, 7500, 0.15, 1500, 0.15, 0.30, 2500.); + efSel.setCuts(1, 3, 0.15, 0.4, 0., 3000., 15000.); + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 9000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 14000, 0, 0.0670, 0.0218, 0.61500, 0); +// l2TrkSel.setCuts(4, 0, 2, 3, 7500, 0.15, 1500, 0.15, 0.30, 5000.); +// efSel.setCuts(1, 3, 0.08, 0.31, 0., 5000., 20000.); +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 11000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 18000, 0, 0.061, 0.01945, 0.6150, 0); +// l2TrkSel.setCuts(4, 0, 1, 3, 7500, 0.15, 1500, 0.15, 0.30, 5000.); +// efSel.setCuts(1, 3, 0.08, 0.31, 0., 5000., 25000.); +// break; + +// case TrigTauFlags::TAU29I: +// l1Sel.setCuts(0, 16000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 25000, 0, 0.052, 0.0124, 0.545, 0); +// l2TrkSel.setCuts(4, 0, 1, 3, 7500, 0.15, 1500, 0.15, 0.30, 5000.); +// efSel.setCuts(1, 3, 0.08, 0.31, 0., 5000., 35000.); +// break; + + case TrigTauFlags::TAU38: +// case TrigTauFlags::TAU38I: +// if( type == TrigTauFlags::TAU38I) l1Sel.setCuts(0, 21000, 0, 0, 0, 0); +// else + l1Sel.setCuts(0, 21000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.060, 0.0100, 0.60, 0); + l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 45000.); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.14, 0.4, 0., 7000., 35000.); + break; + + default : + cout << ":setTauMenu can not deal with menu " << TrigTauFlags::menuName(type) << endl; + + } + +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenu13020(TrigTauFlags::TRIGGERMENU type, CUTLEVEL /*level*/) { + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 9700, 0, 0.065, 0.0160, 0.71, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 2500, true, 0.1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.20, 0.4, 0., 5000., 15000.); + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 9000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 12200, 0, 0.055, 0.0150, 0.6000, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.11, 0.29, 0., 5000., 19000.); +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 11000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 17000, 0, 0.053, 0.0140, 0.56, 0); +// // l2CalSel.setCuts(0, 12000, 0, 0.053, 0.0140, 0.56, 0); +// l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.1, 0.27, 0., 7000., 19000.); +// break; + +// case TrigTauFlags::TAU29I: +// l1Sel.setCuts(0, 16000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 26500, 0, 0.053, 0.0095, 0.50, 0); +// // l2CalSel.setCuts(0, 21500, 0, 0.053, 0.0095, 0.50, 0); +// l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.10, 0.22, 0., 7000., 27000.); +// break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 25000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 33500, 0, 0.06, 0.01, 0.6, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.12, 0.3, 0., 8000., 36000.); + break; + +// case TrigTauFlags::TAU38I: +// l1Sel.setCuts(0, 21000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 33500, 0, 0.048, 0.0087, 0.43, 0); +// // l2CalSel.setCuts(0, 28500, 0, 0.048, 0.0087, 0.43, 0); +// l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.10, 0.22, 0., 7000., 35000.); +// break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 35000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 44900, 0, 0.043, 0.0046, 0.35, 0); + // l2CalSel.setCuts(0, 40000, 0, 0.043, 0.0046, 0.35, 0); + l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.14, 0.4, 0., 7000., 45000.); + break; + + default : + cout << ":setTauMenu can not deal with menu " << TrigTauFlags::menuName(type) << endl; + + } + +} + + + +//============================================================================================= +void TrigTauSelectionManager::setTauMenuAUG07(TrigTauFlags::TRIGGERMENU type, CUTLEVEL /*level*/) { + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.2, 0.1, 1., 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 2500, true, 0.1, 15000.); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.20, 0.4, 0., 5000., 15000.); + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 9000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 0, 0, 0.0670, 0.0218, 0.61500, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 20000.); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.11, 0.29, 0., 5000., 19000.); +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 11000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 0, 0, 0.061, 0.01945, 0.6150, 0); +// l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 25000.); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.1, 0.27, 0., 7000., 19000.); +// break; + +// case TrigTauFlags::TAU29I: +// l1Sel.setCuts(0, 16000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 0, 0, 0.052, 0.0124, 0.545, 0); +// l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 35000.); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.10, 0.22, 0., 7000., 27000.); +// break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 21000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.060, 0.0100, 0.60, 0); + l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 45000.); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.14, 0.4, 0., 7000., 35000.); + break; + +// case TrigTauFlags::TAU38I: +// l1Sel.setCuts(0, 21000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 0, 0, 0.048, 0.0087, 0.43, 0); +// l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 45000.); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.10, 0.22, 0., 7000., 35000.); +// break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 35000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.043, 0.0046, 0.35, 0); + l2TrkSel.setCuts(7, -1, 1, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 60000.); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.14, 0.4, 0., 7000., 45000.); + break; + + default : + cout << ":setTauMenu can not deal with menu " << TrigTauFlags::menuName(type) << endl; + } + +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenu13030pre(TrigTauFlags::TRIGGERMENU type, CUTLEVEL /*level*/) { + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 9700, 0, 0.0616, 0.022, 0.64, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 2500, true, 0.1,0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.15, 0.4, 0., 6000., 14000.); + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 9000, 6000, 0, 0, 0); +// // Et, EtCalib, nStrips, stripWidth, EMRad, IsoFrac, EMEnWidth2 +// l2CalSel.setCuts(0, 12200, 0, 0.055, 0.0190, 0.66, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1,0., 1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.11, 0.33, 0., 6000., 19000.); +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 11000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 17000, 0, 0.051, 0.0160, 0.65, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.1, 0.3, 0., 7000., 22000.); +// break; + +// case TrigTauFlags::TAU29I: +// l1Sel.setCuts(0, 16000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 26500, 0, 0.048, 0.015, 0.60, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 31000.); +// break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 25000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 33500, 0, 0.06, 0.01, 0.6, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.12, 0.3, 0., 8000., 36000.); + break; + +// case TrigTauFlags::TAU38I: +// l1Sel.setCuts(0, 25000, 6000, 0, 0, 0); +// l2CalSel.setCuts(0, 33500, 0, 0.0465, 0.0087, 0.43, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); +// l2TrkSel.setCoreFromLeading(true); +// break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 40000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 44900, 0, 0.04, 0.00345, 0.35, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 51000.); + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 40000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 75000, 0, 0.04, 0.00345, 0.35, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 90000.); + break; + + default : + cout << ":setTauMenu can not deal with menu " << TrigTauFlags::menuName(type) << endl; + } + +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenu1400(TrigTauFlags::TRIGGERMENU type, CUTLEVEL level) { + float EFETcut, L2IDETCut , EFMass; + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 12000; + L2IDETCut = 15000; + EFMass = 1600; + //l2CalSel.setCuts(0, 0, 0, 0., 0.022085, 0., 0,5740 ); + l2CalSel.setCuts(0, 0, 0, 1.,0.0163 , 1., 0, 7550); + switch (level ){ + case SOFT : //95% + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2000., EFETcut,0, 0.150, 0, 0., 3000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.016325 , 0., 0, 7540); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.105, 1, 0., 2500., EFETcut,0, 0.125, 1, 0., 3800., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.01353 , 0 , 0, 8380); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.075, 0, 0., 2000., EFETcut,0, 0.11, 0, 0., 5000.,EFETcut,0, EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.011555 , 0, 0, 9100); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.074, 0, 0., 4000., EFETcut,0, 0.11, 0, 0., 7000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + + case TrigTauFlags::TAU16: + l1Sel.setCuts(0, 9000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); + l2CalSel.setCuts(0, 0, 0, 1., 0.01470, 1., 0, 10400); + EFMass = 1600; + switch (level ){ + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000, 1); + efSel.setCuts(1, 5, 0.1, 1, 0., 2500., 16000.,0, 0.12, 1, 0., 2500., 16000.,0, 0. ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 9000, 6000, 0, 0, 0); +// l2TrkSel.setCoreFromLeading(true); +// //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); +// l2CalSel.setCuts(0, 0, 0, 1., 0.01470, 1., 0, 10400); +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000., 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., 16000.,0, 0.150, 0, 0., 4000., 16000.,0, 0. ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000, 1); +// efSel.setCuts(1, 5, 0.1, 1, 0., 2500., 16000.,0, 0.12, 1, 0., 2500., 16000.,0, 0. ); +// break; +// case MEDIUM: //85% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0 , 0,11575 ); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,26667., 1); +// efSel.setCuts(1, 5, 0.078, 1, 0., 2500., 16000.,0, 0.11, 1, 0., 7000., 16000.,0, EFMass ); +// break; +// case TIGHT: // 80% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.010565 , 0, 0, 12355); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,26667., 1); +// efSel.setCuts(1, 4, 0.074, 1, 0., 4500., 16000.,0, 0.10, 1, 0., 9000., 16000.,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl; break; +// } + +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 11000, 6000, 0, 0, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.1, 0.3, 0., 7000., 22000.); +// l2CalSel.setCuts(0, 0, 0, 1., 0.0136, 1., 0, 13000); +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.018575, 0., 0, 10750); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,25000., 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., 20000.,0, 0.150, 0, 0., 4000., 20000.,0, 0. ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.013625, 0., 0, 12990); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,25000, 1); +// efSel.setCuts(1, 5, 0.100, 1, 0., 2500., 20000.,0, 0.12, 1, 0., 4500., 20000.,0 , 0. ); +// break; +// case MEDIUM: //80% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.011375 , 0 , 0, 14250); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); +// efSel.setCuts(1, 5, 0.078, 1, 0., 3500., 20000.,0, 0.11, 1, 0., 8000., 20000.,0, EFMass ); +// break; +// case TIGHT: // 70% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.009845 , 0, 0, 15090); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); +// efSel.setCuts(1, 4, 0.073, 1, 0., 5500., 20000.,0, 0.1, 1, 0., 10000., 20000.,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl;break; +// } +// break; + + case TrigTauFlags::TAU29: +// case TrigTauFlags::TAU29I: +// if( type == TrigTauFlags::TAU29I) l1Sel.setCuts(0, 16000, 6000, 0, 0, 0); +// else + l1Sel.setCuts(0, 16000, 0, 0, 0, 0); + + //l2CalSel.setCuts(0, 26500, 0, 0.048, 0.015, 0.60, 0); + //l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); + l2TrkSel.setCoreFromLeading(true); + //efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 31000.); + //l2CalSel.setCuts(0, 0, 0, 0., 0.015155, 0., 0, 16040); + l2CalSel.setCuts(0, 0, 0, 0., 0.0115, 0., 0, 18700); + EFMass = 1600; + EFETcut = 29000; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.015155, 0., 0, 16040); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,35000., 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0 , 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.011465, 0., 0, 18760); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,35000, 1); + efSel.setCuts(1, 5, 0.100, 1, 0., 3000., EFETcut,0, 0.12, 1, 0., 5000., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.009575 , 0 , 0,20360 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 5000., EFETcut,0, 0.11, 1, 0., 10000., EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008225 , 0, 0, 21800); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 4, 0.073, 1, 0., 8000., EFETcut,0, 0.1, 1, 0., 13000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 25000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 38000; + L2IDETCut = 45000; + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2CalSel.setCuts(0, 0, 0, 0.,0.009 , 0., 0, 25800); + EFMass = 1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.100, 1, 0., 3800., EFETcut,0, 0.120, 1, 0., 5500., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007415 , 0 , 0, 27490); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 7000., EFETcut,0, 0.11, 1, 0., 12000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.072, 1, 0., 11000., EFETcut,0, 0.090, 1, 0., 15000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + +// case TrigTauFlags::TAU38I: +// l1Sel.setCuts(0, 25000, 6000, 0, 0, 0); +// l2TrkSel.setCoreFromLeading(true); +// EFETcut = 38000; +// l2CalSel.setCuts(0, 0, 0, 0.,0.009 , 0., 0, 25800); +// L2IDETCut = 45000; +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0 ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); +// efSel.setCuts(1, 5, 0.100, 1, 0., 3800., EFETcut,0, 0.120, 1, 0., 5500., EFETcut,0, 0. ); +// break; +// case MEDIUM: //80% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.007415 , 0 , 0, 27490); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 5, 0.078, 0, 0., 7000., EFETcut,0, 0.11, 0, 0., 12000.,EFETcut,0 , EFMass ); +// break; +// case TIGHT: // 70% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 4, 0.072, 0, 0., 11000., EFETcut,0, 0.090, 0, 0., 15000., EFETcut,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl;break; +// } +// break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 40000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.009125, 0., 0, 31645); + l2CalSel.setCuts(0, 0, 0, 0., 0.0049, 0., 0, 36000); + EFMass = 1600; + L2IDETCut = 60000; + EFETcut= 50000; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 6000., EFETcut,0, 0.180, 0, 0., 6000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.004895, 0., 0, 36055); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.090, 1, 0., 10000., EFETcut,0, 0.090, 1, 0., 10000., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003725 , 0 , 0, 38995); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.060, 1, 0., 17000., EFETcut,0, 0.068, 1, 0., 15000.,EFETcut,0, EFMass ); + break; + case TIGHT: // 70% + ///l2CalSel.setCuts(0, 0, 0, 0.,0.003095 , 0, 0, 41095); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.050, 1, 0., 21000., EFETcut,0, 0.065, 1, 0., 25000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 40000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 75000, 0, 0.04, 0.00345, 0.35, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 90000.); + EFETcut = 84000; + L2IDETCut = 100000; + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2CalSel.setCuts(0, 0, 0, 1.,0.0042 , 1., 0,56000 ); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.080, 1, 0., 12000., EFETcut,0, 0.085, 1, 0., 13000., EFETcut,0 , 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.060, 1, 0., 25000., EFETcut,0, 0.068, 1, 0., 25000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.046, 1, 0., 30000., EFETcut,0, 0.055, 1, 0., 31000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU125: + l1Sel.setCuts(0, 40000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut =125000; + L2IDETCut = 150000; + l2CalSel.setCuts(0, 0, 0, 1.,0.0034 , 1., 0, 93000.); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.07, 1, 0., 15000., EFETcut,0, 0.08, 1, 0., 16000., EFETcut,0 , 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.058, 1, 0., 32000., EFETcut,0, 0.055, 1, 0., 22000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.043, 1, 0., 41000., EFETcut,0, 0.050, 1, 0., 36000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + default : + cout << ":setTauMenu MENU1400 can not deal with menu " << TrigTauFlags::menuName(type) << endl; + break; + } + + +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenu1520test(TrigTauFlags::TRIGGERMENU type, CUTLEVEL level) { + float EFETcut, L2IDETCut , EFMass; + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 4000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 12000; + L2IDETCut = 15000; + EFMass = 1600; + //l2CalSel.setCuts(0, 0, 0, 0., 0.022085, 0., 0,5740 ); + l2CalSel.setCuts(0, 0, 0, 1.,0.0163 , 1., 0, 7550); + switch (level ){ + case SOFT : //95% + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2000., EFETcut,0, 0.150, 0, 0., 3000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.016325 , 0., 0, 7540); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.105, 1, 0., 2500., EFETcut,0, 0.125, 1, 0., 3800., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.01353 , 0 , 0, 8380); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.075, 0, 0., 2000., EFETcut,0, 0.11, 0, 0., 5000.,EFETcut,0, EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.011555 , 0, 0, 9100); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.074, 0, 0., 4000., EFETcut,0, 0.11, 0, 0., 7000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + + case TrigTauFlags::TAU16: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); + l2CalSel.setCuts(0, 0, 0, 1., 0.01470, 1., 0, 10400); + EFMass = 1600; + switch (level ){ + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000, 1); + efSel.setCuts(1, 5, 0.1, 1, 0., 2500., 16000.,0, 0.12, 1, 0., 2500., 16000.,0, 0. ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 6000, 4000, 0, 0, 0); +// l2TrkSel.setCoreFromLeading(true); +// //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); +// l2CalSel.setCuts(0, 0, 0, 1., 0.01470, 1., 0, 10400); +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000., 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., 16000.,0, 0.150, 0, 0., 4000., 16000.,0, 0. ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000, 1); +// efSel.setCuts(1, 5, 0.1, 1, 0., 2500., 16000.,0, 0.12, 1, 0., 2500., 16000.,0, 0. ); +// break; +// case MEDIUM: //85% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0 , 0,11575 ); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,26667., 1); +// efSel.setCuts(1, 5, 0.078, 1, 0., 2500., 16000.,0, 0.11, 1, 0., 7000., 16000.,0, EFMass ); +// break; +// case TIGHT: // 80% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.010565 , 0, 0, 12355); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,26667., 1); +// efSel.setCuts(1, 4, 0.074, 1, 0., 4500., 16000.,0, 0.10, 1, 0., 9000., 16000.,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl; break; +// } + +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 8000, 4000, 0, 0, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.1, 0.3, 0., 7000., 22000.); +// l2CalSel.setCuts(0, 0, 0, 1., 0.0136, 1., 0, 13000); +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.018575, 0., 0, 10750); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,25000., 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., 20000.,0, 0.150, 0, 0., 4000., 20000.,0, 0. ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.013625, 0., 0, 12990); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,25000, 1); +// efSel.setCuts(1, 5, 0.100, 1, 0., 2500., 20000.,0, 0.12, 1, 0., 4500., 20000.,0 , 0. ); +// break; +// case MEDIUM: //80% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.011375 , 0 , 0, 14250); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); +// efSel.setCuts(1, 5, 0.078, 1, 0., 3500., 20000.,0, 0.11, 1, 0., 8000., 20000.,0, EFMass ); +// break; +// case TIGHT: // 70% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.009845 , 0, 0, 15090); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); +// efSel.setCuts(1, 4, 0.073, 1, 0., 5500., 20000.,0, 0.1, 1, 0., 10000., 20000.,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl;break; +// } +// break; + + case TrigTauFlags::TAU29: +// case TrigTauFlags::TAU29I: +// if( type == TrigTauFlags::TAU29I) l1Sel.setCuts(0, 11000, 4000, 0, 0, 0); +// else + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + //l2CalSel.setCuts(0, 26500, 0, 0.048, 0.015, 0.60, 0); + //l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); + l2TrkSel.setCoreFromLeading(true); + //efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 31000.); + //l2CalSel.setCuts(0, 0, 0, 0., 0.015155, 0., 0, 16040); + l2CalSel.setCuts(0, 0, 0, 0., 0.0115, 0., 0, 18700); + EFMass = 1600; + EFETcut = 29000; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.015155, 0., 0, 16040); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,35000., 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0 , 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.011465, 0., 0, 18760); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,35000, 1); + efSel.setCuts(1, 5, 0.100, 1, 0., 3000., EFETcut,0, 0.12, 1, 0., 5000., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.009575 , 0 , 0,20360 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 5000., EFETcut,0, 0.11, 1, 0., 10000., EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008225 , 0, 0, 21800); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 4, 0.073, 1, 0., 8000., EFETcut,0, 0.1, 1, 0., 13000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 38000; + L2IDETCut = 45000; + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2CalSel.setCuts(0, 0, 0, 0.,0.009 , 0., 0, 25800); + EFMass = 1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.100, 1, 0., 3800., EFETcut,0, 0.120, 1, 0., 5500., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007415 , 0 , 0, 27490); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 7000., EFETcut,0, 0.11, 1, 0., 12000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.072, 1, 0., 11000., EFETcut,0, 0.090, 1, 0., 15000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + +// case TrigTauFlags::TAU38I: +// l1Sel.setCuts(0, 20000, 4000, 0, 0, 0); +// l2TrkSel.setCoreFromLeading(true); +// EFETcut = 38000; +// l2CalSel.setCuts(0, 0, 0, 0.,0.009 , 0., 0, 25800); +// L2IDETCut = 45000; +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0 ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); +// efSel.setCuts(1, 5, 0.100, 1, 0., 3800., EFETcut,0, 0.120, 1, 0., 5500., EFETcut,0, 0. ); +// break; +// case MEDIUM: //80% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.007415 , 0 , 0, 27490); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 5, 0.078, 0, 0., 7000., EFETcut,0, 0.11, 0, 0., 12000.,EFETcut,0 , EFMass ); +// break; +// case TIGHT: // 70% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 4, 0.072, 0, 0., 11000., EFETcut,0, 0.090, 0, 0., 15000., EFETcut,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl;break; +// } +// break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 30000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.009125, 0., 0, 31645); + l2CalSel.setCuts(0, 0, 0, 0., 0.0049, 0., 0, 36000); + EFMass = 1600; + L2IDETCut = 60000; + EFETcut= 50000; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 6000., EFETcut,0, 0.180, 0, 0., 6000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.004895, 0., 0, 36055); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.090, 1, 0., 10000., EFETcut,0, 0.090, 1, 0., 10000., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003725 , 0 , 0, 38995); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.060, 1, 0., 17000., EFETcut,0, 0.068, 1, 0., 15000.,EFETcut,0, EFMass ); + break; + case TIGHT: // 70% + ///l2CalSel.setCuts(0, 0, 0, 0.,0.003095 , 0, 0, 41095); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.050, 1, 0., 21000., EFETcut,0, 0.065, 1, 0., 25000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 30000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 75000, 0, 0.04, 0.00345, 0.35, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 90000.); + EFETcut = 84000; + L2IDETCut = 100000; + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2CalSel.setCuts(0, 0, 0, 1.,0.0042 , 1., 0,56000 ); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.080, 1, 0., 12000., EFETcut,0, 0.085, 1, 0., 13000., EFETcut,0 , 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.060, 1, 0., 25000., EFETcut,0, 0.068, 1, 0., 25000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.046, 1, 0., 30000., EFETcut,0, 0.055, 1, 0., 31000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU125: + l1Sel.setCuts(0, 30000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut =125000; + L2IDETCut = 150000; + l2CalSel.setCuts(0, 0, 0, 1.,0.0034 , 1., 0, 93000.); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.07, 1, 0., 15000., EFETcut,0, 0.08, 1, 0., 16000., EFETcut,0 , 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.058, 1, 0., 32000., EFETcut,0, 0.055, 1, 0., 22000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.043, 1, 0., 41000., EFETcut,0, 0.050, 1, 0., 36000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + default : + cout << ":setTauMenu MENU1520test can not deal with menu " << TrigTauFlags::menuName(type) << endl; + break; + } + + +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenu1560(TrigTauFlags::TRIGGERMENU type, CUTLEVEL level) { + float EFETcut, L2IDETCut , EFMass; + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(-1, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 12000; + L2IDETCut = 15000; + EFMass = 1600; + //l2CalSel.setCuts(0, 0, 0, 0., 0.022085, 0., 0,5740 ); + l2CalSel.setCuts(0, 0, 0, 1.,0.0163 , 1., 0, 7550); + switch (level ){ + case SOFT : //95% + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2000., EFETcut,0, 0.150, 0, 0., 3000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.016325 , 0., 0, 7540); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.105, 1, 0., 2500., EFETcut,0, 0.125, 1, 0., 3800., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.01353 , 0 , 0, 8380); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.075, 0, 0., 2000., EFETcut,0, 0.11, 0, 0., 5000.,EFETcut,0, EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.011555 , 0, 0, 9100); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.074, 0, 0., 4000., EFETcut,0, 0.11, 0, 0., 7000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + + case TrigTauFlags::TRK9: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); + l2CalSel.setCuts(0, 0, 0, 0., 0., 0., 0, 0.); + EFMass = 1600; + switch (level ){ + case SOFT : //90% + case LOOSE : //90% + case MEDIUM : //90% + case TIGHT : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); + l2TrkSel.setCuts(1, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 9000, false, 0.1,0, 1); + efSel.setCuts(1, 1, 100., 100., -10., 9000., -10.,0, 100, 100, 0., 9000., 0.,0, 0. ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + + break; + + case TrigTauFlags::TAU16: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); + l2CalSel.setCuts(0, 0, 0, 1., 0.01470, 1., 0, 10400); + EFMass = 1600; + switch (level ){ + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000, 1); + efSel.setCuts(1, 5, 0.1, 1, 0., 2500., 16000.,0, 0.12, 1, 0., 2500., 16000.,0, 0. ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + + break; + +// case TrigTauFlags::TAU16I: +// l1Sel.setCuts(0, 6000, 5000, 0, 0, 0); +// l2TrkSel.setCoreFromLeading(true); +// //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); +// l2CalSel.setCuts(0, 0, 0, 1., 0.01470, 1., 0, 10400); +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000., 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., 16000.,0, 0.150, 0, 0., 4000., 16000.,0, 0. ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,20000, 1); +// efSel.setCuts(1, 5, 0.1, 1, 0., 2500., 16000.,0, 0.12, 1, 0., 2500., 16000.,0, 0. ); +// break; +// case MEDIUM: //85% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0 , 0,11575 ); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,26667., 1); +// efSel.setCuts(1, 5, 0.078, 1, 0., 2500., 16000.,0, 0.11, 1, 0., 7000., 16000.,0, EFMass ); +// break; +// case TIGHT: // 80% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.010565 , 0, 0, 12355); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,26667., 1); +// efSel.setCuts(1, 4, 0.074, 1, 0., 4500., 16000.,0, 0.10, 1, 0., 9000., 16000.,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl; break; +// } + +// break; + +// case TrigTauFlags::TAU20I: +// l1Sel.setCuts(0, 6000, 5000, 0, 0, 0); +// l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); +// l2TrkSel.setCoreFromLeading(true); +// efSel.setCuts(1, 8, 0.1, 0.3, 0., 7000., 22000.); +// l2CalSel.setCuts(0, 0, 0, 1., 0.0136, 1., 0, 13000); +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.018575, 0., 0, 10750); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,25000., 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., 20000.,0, 0.150, 0, 0., 4000., 20000.,0, 0. ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.013625, 0., 0, 12990); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,25000, 1); +// efSel.setCuts(1, 5, 0.100, 1, 0., 2500., 20000.,0, 0.12, 1, 0., 4500., 20000.,0 , 0. ); +// break; +// case MEDIUM: //80% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.011375 , 0 , 0, 14250); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); +// efSel.setCuts(1, 5, 0.078, 1, 0., 3500., 20000.,0, 0.11, 1, 0., 8000., 20000.,0, EFMass ); +// break; +// case TIGHT: // 70% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.009845 , 0, 0, 15090); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); +// efSel.setCuts(1, 4, 0.073, 1, 0., 5500., 20000.,0, 0.1, 1, 0., 10000., 20000.,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl;break; +// } +// break; + + case TrigTauFlags::TAU29: +// case TrigTauFlags::TAU29I: +// if( type == TrigTauFlags::TAU29I) l1Sel.setCuts(0, 11000, 5000, 0, 0, 0); +// else + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + + //l2CalSel.setCuts(0, 26500, 0, 0.048, 0.015, 0.60, 0); + //l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); + l2TrkSel.setCoreFromLeading(true); + //efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 31000.); + //l2CalSel.setCuts(0, 0, 0, 0., 0.015155, 0., 0, 16040); + l2CalSel.setCuts(0, 0, 0, 0., 0.0115, 0., 0, 18700); + EFMass = 1600; + EFETcut = 29000; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.015155, 0., 0, 16040); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,35000., 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0 , 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.011465, 0., 0, 18760); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,35000, 1); + efSel.setCuts(1, 5, 0.100, 1, 0., 3000., EFETcut,0, 0.12, 1, 0., 5000., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.009575 , 0 , 0,20360 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 5000., EFETcut,0, 0.11, 1, 0., 10000., EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008225 , 0, 0, 21800); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 4, 0.073, 1, 0., 8000., EFETcut,0, 0.1, 1, 0., 13000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 38000; + L2IDETCut = 45000; + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2CalSel.setCuts(0, 0, 0, 0.,0.009 , 0., 0, 25800); + EFMass = 1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.100, 1, 0., 3800., EFETcut,0, 0.120, 1, 0., 5500., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007415 , 0 , 0, 27490); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 7000., EFETcut,0, 0.11, 1, 0., 12000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.072, 1, 0., 11000., EFETcut,0, 0.090, 1, 0., 15000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + +// case TrigTauFlags::TAU38I: +// l1Sel.setCuts(0, 11000, 5000, 0, 0, 0); +// l2TrkSel.setCoreFromLeading(true); +// EFETcut = 38000; +// l2CalSel.setCuts(0, 0, 0, 0.,0.009 , 0., 0, 25800); +// L2IDETCut = 45000; +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0 ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); +// efSel.setCuts(1, 5, 0.100, 1, 0., 3800., EFETcut,0, 0.120, 1, 0., 5500., EFETcut,0, 0. ); +// break; +// case MEDIUM: //80% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.007415 , 0 , 0, 27490); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 5, 0.078, 0, 0., 7000., EFETcut,0, 0.11, 0, 0., 12000.,EFETcut,0 , EFMass ); +// break; +// case TIGHT: // 70% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 4, 0.072, 0, 0., 11000., EFETcut,0, 0.090, 0, 0., 15000., EFETcut,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl;break; +// } +// break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.009125, 0., 0, 31645); + l2CalSel.setCuts(0, 0, 0, 0., 0.0049, 0., 0, 36000); + EFMass = 1600; + L2IDETCut = 60000; + EFETcut= 50000; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 6000., EFETcut,0, 0.180, 0, 0., 6000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.004895, 0., 0, 36055); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.090, 1, 0., 10000., EFETcut,0, 0.090, 1, 0., 10000., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003725 , 0 , 0, 38995); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.060, 1, 0., 17000., EFETcut,0, 0.068, 1, 0., 15000.,EFETcut,0, EFMass ); + break; + case TIGHT: // 70% + ///l2CalSel.setCuts(0, 0, 0, 0.,0.003095 , 0, 0, 41095); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.050, 1, 0., 21000., EFETcut,0, 0.065, 1, 0., 25000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 75000, 0, 0.04, 0.00345, 0.35, 0); + l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.2, 0., 1); + l2TrkSel.setCoreFromLeading(true); + efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 90000.); + EFETcut = 84000; + L2IDETCut = 100000; + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2CalSel.setCuts(0, 0, 0, 1.,0.0042 , 1., 0,56000 ); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.080, 1, 0., 12000., EFETcut,0, 0.085, 1, 0., 13000., EFETcut,0 , 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.060, 1, 0., 25000., EFETcut,0, 0.068, 1, 0., 25000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.046, 1, 0., 30000., EFETcut,0, 0.055, 1, 0., 31000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU125: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut =125000; + L2IDETCut = 150000; + l2CalSel.setCuts(0, 0, 0, 1.,0.0034 , 1., 0, 93000.); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.07, 1, 0., 15000., EFETcut,0, 0.08, 1, 0., 16000., EFETcut,0 , 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.058, 1, 0., 32000., EFETcut,0, 0.055, 1, 0., 22000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.043, 1, 0., 41000., EFETcut,0, 0.050, 1, 0., 36000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + default : + cout << ":setTauMenu MENU1560 can not deal with menu " << TrigTauFlags::menuName(type) << endl; + break; + } + + +} + +//============================================================================================= +void TrigTauSelectionManager::setTauMenu1600(TrigTauFlags::TRIGGERMENU type, CUTLEVEL level) { + float EFETcut, L2IDETCut , EFMass; + switch (type) { + case TrigTauFlags::TAUNOCUT: // Not really "no" cuts + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + l2TrkSel.setCuts(15, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30, 0, false); + efSel.setCuts(0, 100, 100., 10., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 12000; + L2IDETCut = 0; + EFMass = 1600; + //l2CalSel.setCuts(0, 0, 0, 0., 0.022085, 0., 0,5740 ); + l2CalSel.setCuts(0, 0, 0, 999.,0.0178 , 999., 0, 7550); + switch (level ){ + case SOFT : //95% + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2000., EFETcut,0, 0.150, 0, 0., 3000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.016325 , 0., 0, 7540); + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 10, 0.105, 999, 0., 2500., EFETcut,0, 0.125, 1, 0., 2500., EFETcut,0, 0. ); + break; + case MEDIUM: //80% + l2CalSel.setCuts(0, 0, 0, 999.,0.0124 , 999., 0, 7000); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 0, 0.15, 0.30, 0, false, 0.1, 0, 1); + efSel.setCuts( 1, 6, 0.082, 0, 0., 0., EFETcut, 0, 0.098, 0, 0., 0., -1, -1, 0, 0.086, 0.076 ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.011555 , 0, 0, 9100); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.074, 0, 0., 4000., EFETcut,0, 0.11, 0, 0., 7000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + + case TrigTauFlags::TRK9: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + //l2CalSel.setCuts(0, 0, 0, 0., 0.020105, 0., 0, 8585); + l2CalSel.setCuts(0, 0, 0, 0., 0., 0., 0, 0.); + EFMass = 1600; + switch (level ){ + case SOFT : //90% + case LOOSE : //90% + case MEDIUM : //90% + case TIGHT : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); + l2TrkSel.setCuts(1, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 9000, false, 0.1,0, 1); + efSel.setCuts(1, 1, 100., 100., -10., 9000., -10.,0, 100, 100, 0., 9000., 0.,0, 0. ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + + break; + + case TrigTauFlags::TAU16: +// case TrigTauFlags::TAU16I: +// if( type == TrigTauFlags::TAU16I) l1Sel.setCuts(0, 6000, 5000, 0, 0, 0); +// else + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + l2CalSel.setCuts(0, 0, 0, 999., 0.0162, 999., 0, 9000); + EFMass = 1600; + switch (level ){ + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.014705, 0., 0, 10405); + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1, 0, 1); + efSel.setCuts(1, 10, 0.1, 999, 0., 2500., 16000.,0, 0.12, 1, 0., 2500., 16000.,0, 0. ); + break; + case MEDIUM: //85% + l2CalSel.setCuts(0, 0, 0, 999., 0.0124, 999., 0, 9000); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1, 0., 1); + efSel.setCuts(1, 6, 0.080, 999., 0., 0., 16000.,0, 0.092, 1, 0., 0., 16000.,0, 0., 0.076, 0.062); + break; + case TIGHT: // 80% + //l2CalSel.setCuts(0, 0, 0, 0.,0.010565 , 0, 0, 12355); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,26667., 1); + efSel.setCuts(1, 4, 0.074, 1, 0., 4500., 16000.,0, 0.10, 1, 0., 9000., 16000.,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + + break; + + case TrigTauFlags::TAU20: +// case TrigTauFlags::TAU20I: +// if( type == TrigTauFlags::TAU20I) l1Sel.setCuts(0, 6000, 5000, 0, 0, 0); +// else + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + + l2TrkSel.setCoreFromLeading(true); + l2CalSel.setCuts(0, 0, 0, 999., 0.0151, 999., 0, 11500); + EFMass = 1600; + switch (level ){ + case LOOSE : //90% + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1, 0, 1); + efSel.setCuts(1, 10, 0.100, 999, 0., 2500., 20000.,0, 0.12, 1, 0., 4500., 20000.,0 , 0. ); + break; + case MEDIUM: //80% + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 3500., 20000.,0, 0.11, 1, 0., 8000., 20000.,0, EFMass ); + break; + case TIGHT: // 70% + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,33000., 1); + efSel.setCuts(1, 4, 0.073, 1, 0., 5500., 20000.,0, 0.1, 1, 0., 10000., 20000.,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU29: +// case TrigTauFlags::TAU29I: + case TrigTauFlags::TAU29v2: +// if( type == TrigTauFlags::TAU29I) l1Sel.setCuts(0, 11000, 5000, 0, 0, 0); +// else + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + + //l2CalSel.setCuts(0, 26500, 0, 0.048, 0.015, 0.60, 0); + //l2TrkSel.setCuts(7, -1, 2, 7, 7500, 0.15, 1500, 0.15, 0.30, 5000, true, 0.1, 0., 1); + l2TrkSel.setCoreFromLeading(true); + //efSel.setCuts(1, 8, 0.09, 0.24, 0., 8000., 31000.); + //l2CalSel.setCuts(0, 0, 0, 0., 0.015155, 0., 0, 16040); + l2CalSel.setCuts(0, 0, 0, 999, 0.0130, 999, 0, 17500); + EFMass = 1600; + EFETcut = 29000; + switch (level ){ + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.011465, 0., 0, 18760); + if( type == TrigTauFlags::TAU29v2) + { + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1, 0, 1); + efSel.setCuts(1, 3, 0.100, 999, 0., 3000., EFETcut,0, 0.120, 1, 0., 5000., EFETcut,0, 0., 100, 100); + } + else + { + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1, 0, 1); + efSel.setCuts(1, 10, 0.100, 999, 0., 3000., EFETcut,0, 0.120, 1, 0., 5000., EFETcut,0, 0., 100, 100); + } + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.009575 , 0 , 0,20360 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 5000., EFETcut,0, 0.11, 1, 0., 10000., EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008225 , 0, 0, 21800); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,46700., 1); + efSel.setCuts(1, 4, 0.073, 1, 0., 8000., EFETcut,0, 0.1, 1, 0., 13000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 38000; + L2IDETCut = 0; + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2CalSel.setCuts(0, 0, 0, 999.,0.0117 , 999., 0, 19000); + EFMass = 1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 20, 0.072, 1, 0., 0., EFETcut,0, 0.088, 1, 0., 0., EFETcut,0, 0., 0.060, 0.048); + break; + case MEDIUM: //80% + l2CalSel.setCuts(0, 0, 0, 1.,0.009, 1., 0, 25800); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05, 60000., 1); + efSel.setCuts(1, 5, 0.078, 1, 0., 7000., EFETcut,0, 0.11, 1, 0., 12000., EFETcut, 0, EFMass, 100, 100); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.072, 1, 0., 11000., EFETcut,0, 0.090, 1, 0., 15000., EFETcut,0, EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + +// case TrigTauFlags::TAU38I: +// l1Sel.setCuts(0, 11000, 5000, 0, 0, 0); +// l2TrkSel.setCoreFromLeading(true); +// EFETcut = 38000; +// l2CalSel.setCuts(0, 0, 0, 0.,0.009 , 0., 0, 25800); +// L2IDETCut = 45000; +// EFMass = 1600; +// switch (level ){ +// case SOFT : //95% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); +// l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); +// efSel.setCuts(1, 5, 0.180, 0, 0., 2500., EFETcut,0, 0.150, 0, 0., 4000., EFETcut,0, 0 ); +// break; +// case LOOSE : //90% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.008945 , 0., 0, 25870); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); +// efSel.setCuts(1, 5, 0.100, 1, 0., 3800., EFETcut,0, 0.120, 1, 0., 5500., EFETcut,0, 0. ); +// break; +// case MEDIUM: //80% +// //l2CalSel.setCuts(0, 0, 0, 0., 0.007415 , 0 , 0, 27490); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 5, 0.078, 0, 0., 7000., EFETcut,0, 0.11, 0, 0., 12000.,EFETcut,0 , EFMass ); +// break; +// case TIGHT: // 70% +// //l2CalSel.setCuts(0, 0, 0, 0.,0.006335 , 0, 0,29110 ); +// l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); +// efSel.setCuts(1, 4, 0.072, 0, 0., 11000., EFETcut,0, 0.090, 0, 0., 15000., EFETcut,0, EFMass ); +// break; +// default : +// cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) +// << " and level " << level << endl;break; +// } +// break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + l2CalSel.setCuts(0, 0, 0, 999., 0.01, 999., 0, 26500); + EFMass = 1600; + L2IDETCut = 0; + EFETcut= 50000; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.012185, 0., 0, 22630); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 6000., EFETcut,0, 0.180, 0, 0., 6000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0., 0.004895, 0., 0, 36055); + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 20, 0.062, 1, 0., 0., EFETcut, 0, 0.076, 1, 0., 0., EFETcut,0, 0., 0.044, 0.038); + break; + case MEDIUM: //80% + l2CalSel.setCuts(0, 0, 0, 1., 0.009, 1., 0, 35000); + //l2CalSel.setCuts(0, 0, 0, 0., 0.003725 , 0 , 0, 38995); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05, 0, 1); + efSel.setCuts(1, 6, 0.050, 1, 0., 0., EFETcut,0, 0.070, 1, 0., 0.,EFETcut,0, 0, 0.03, 0.03); + break; + case TIGHT: // 70% + l2CalSel.setCuts(0, 0, 0, 1., 0.0049, 1., 0, 36000); + ///l2CalSel.setCuts(0, 0, 0, 0.,0.003095 , 0, 0, 41095); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.050, 1, 0., 21000., EFETcut,0, 0.065, 1, 0., 25000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut = 84000; + L2IDETCut = 100000; + l2CalSel.setCuts(0, 0, 0, 999.,0.0072 , 999., 0, 47900 ); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1, 0, 1); + efSel.setCuts(1, 20, 0.050, 1, 0., 0., EFETcut,0, 0.064, 1, 0., 0., EFETcut,0 , 0., 0.030, 0.032); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2CalSel.setCuts(0, 0, 0, 1., 0.0070, 1., 0, 60000 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.02, 0, 1); + efSel.setCuts(1, 6, 0.045, 1, 0., 0., EFETcut,0, 0.060, 1, 0., 0.,EFETcut,0 , 0., 0.025, 0.027); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.046, 1, 0., 30000., EFETcut,0, 0.055, 1, 0., 31000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU125: + l1Sel.setCuts(0, 50000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + EFETcut =125000; + L2IDETCut = 150000; + l2CalSel.setCuts(0, 0, 0, 1.,0.0034 , 1., 0, 93000.); + EFMass=1600; + switch (level ){ + case SOFT : //95% + //l2CalSel.setCuts(0, 0, 0, 0., 0.007685, 0., 0, 47345); + l2TrkSel.setCuts(7, -1, -1, 7, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 0); + efSel.setCuts(1, 5, 0.180, 0, 0., 7000., EFETcut,0, 0.140, 0, 0., 9000., EFETcut,0, 0. ); + break; + case LOOSE : //90% + //l2CalSel.setCuts(0, 0, 0, 0.,0.004175 , 0., 0,56045 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.1,L2IDETCut, 1); + efSel.setCuts(1, 5, 0.07, 1, 0., 15000., EFETcut,0, 0.08, 1, 0., 16000., EFETcut,0 , 0. ); + break; + case MEDIUM: //80% + //l2CalSel.setCuts(0, 0, 0, 0., 0.003275 , 0 , 0,60105 ); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 5, 0.058, 1, 0., 32000., EFETcut,0, 0.055, 1, 0., 22000.,EFETcut,0 , EFMass ); + break; + case TIGHT: // 70% + //l2CalSel.setCuts(0, 0, 0, 0.,0.002735 , 0, 0, 63585); + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, 0.05,L2IDETCut*4./3., 1); + efSel.setCuts(1, 4, 0.043, 1, 0., 41000., EFETcut,0, 0.050, 1, 0., 36000., EFETcut,0 , EFMass ); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + default : + cout << ":setTauMenu MENU1600 can not deal with menu " << TrigTauFlags::menuName(type) << endl; + break; + } + + +} + +void +TrigTauSelectionManager::setParametrizedEFCuts( TrigTauEFSel& efSel, + CUTLEVEL level, float thresh) +{ + int nTrackMaxLoose = 10; + if( thresh > 49000) + nTrackMaxLoose = 20; + + switch( level) + { + case( LOOSE): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( 0.663, 0.063, -2.04e-4), // LowEMRad_OP + TrigTauEFSel::CutFunctor( 0.339, 0.179, -5.17e-4), // LowEMRad_MP + TrigTauEFSel::CutFunctor( 0.0328, 0.134, -2.72e-4), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( 0.695, 0.0565, -1.44e-4), // LowTrkAvgD_MP + 999., 4.55, 0.055, 0.142, // LowEtOPt_SP/_MP, EMRad_SP/_MP + 0.113, 0.0536, 999., 4.55, // TrkAvgD_SP/_MP, EtOPt_SP/_MP + 1, nTrackMaxLoose, thresh); // MinNTrack, MaxNtrack, MinEtCalib + break; + case( MEDIUM1): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( 0.715, 0.0522, -1.71e-4), // LowEMRad_OP + TrigTauEFSel::CutFunctor( 0.447, 0.162, -4.62e-4), // LowEMRad_MP + TrigTauEFSel::CutFunctor( 0.0328, 0.134, -2.72e-4), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( 0.810, 0.04, -9.90e-5), // LowTrkAvgD_MP + 8.33, 3.33, 0.0475, 0.13, // LowEtOPt_SP/_MP, EMRad_SP/_MP + 0.113, 0.04, 8.33, 3.33, // TrkAvgD_SP/_MP, EtOPt_SP/_MP + 1, 3, thresh); // MinNTrack, MaxNtrack, MinEtCalib + break; + case( MEDIUM): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( 0.715, 0.0522, -1.71e-4), // LowEMRad_OP + TrigTauEFSel::CutFunctor( 0.447, 0.162, -4.62e-4), // LowEMRad_MP + TrigTauEFSel::CutFunctor( 0.0328, 0.134, -2.72e-4), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( 0.810, 0.04, -9.90e-5), // LowTrkAvgD_MP + 8.33, 3.33, 0.0475, 0.13, // LowEtOPt_SP/_MP, EMRad_SP/_MP + 0.113, 0.04, 8.33, 3.33, // TrkAvgD_SP/_MP, EtOPt_SP/_MP + 1, 6, thresh); // MinNTrack, MaxNtrack, MinEtCalib + break; + case( TIGHT): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( 0.819, 0.0306, -1.03e-4), // LowEMRad_OP + TrigTauEFSel::CutFunctor( 0.930, 0.0833, -2.15e-4), // LowEMRad_MP + TrigTauEFSel::CutFunctor( 0.0328, 0.134, -2.72e-4), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( 0.879, 0.0146, -7.21e-5), // LowTrkAvgD_MP + 7.14, 2.5, 0.0325, 0.0777, // LowEtOPt_SP/_MP, EMRad_SP/_MP + 0.113, 0.0198, 7.14, 2.5, // TrkAvgD_SP/_MP, EtOPt_SP/_MP + 1, 6, thresh); // MinNTrack, MaxNtrack, MinEtCalib + default: + break; + } +} + +void +TrigTauSelectionManager::setParametrizedEFCuts_201104( TrigTauEFSel& efSel, + CUTLEVEL level, float thresh) +{ + int nTrackMaxLoose = 10; + if( thresh > 49000) + nTrackMaxLoose = 20; + + float c_0_EMRadius_1p_loose = 0.365 ;//0.197 ; + float c_1_EMRadius_1p_loose = 0.190 ;//0.157 ; + float c_2_EMRadius_1p_loose = -0.00085 ; + float c_3_EMRadius_1p_loose = 0.18 ;//0.109 ; + float c_0_trkAvgDist_1p_loose = 0.827 ;//0.447 ; + float c_1_trkAvgDist_1p_loose = 0.140 ;//0.116 ; + float c_2_trkAvgDist_1p_loose = -0.000213 ; + float c_3_trkAvgDist_1p_loose = 0.151 ;//0.111 ; + float EtOverPtLeadTrk_1p_loose = 999.0 ; + float c_0_EMRadius_1p_medium = 0.516 ; + float c_1_EMRadius_1p_medium = 0.20 ;//0.0818 ; + float c_2_EMRadius_1p_medium = -0.000376 ; + float c_3_EMRadius_1p_medium = 0.095 ;//0.0678 ; + float c_0_trkAvgDist_1p_medium = 0.626 ;//0.417 ; + float c_1_trkAvgDist_1p_medium = 0.27 ;//0.0924 ; + float c_2_trkAvgDist_1p_medium = -0.000392 ;//-0.000261 ; + float c_3_trkAvgDist_1p_medium = 0.158 ;//0.0837 ; + float EtOverPtLeadTrk_1p_medium = 8.33 ; + float c_0_EMRadius_1p_tight = 0.616 ; + float c_1_EMRadius_1p_tight = 0.0584 ; + float c_2_EMRadius_1p_tight = -0.000227 ; + float c_3_EMRadius_1p_tight = 0.055 ; + float c_0_trkAvgDist_1p_tight = 0.381 ; + float c_1_trkAvgDist_1p_tight = 0.0643 ; + float c_2_trkAvgDist_1p_tight = -0.000318 ; + float c_3_trkAvgDist_1p_tight = 0.0515 ; + float EtOverPtLeadTrk_1p_tight = 6.25 ; + float c_0_EMRadius_3p_loose = -0.00194 ; + float c_1_EMRadius_3p_loose = 0.203 ; + float c_2_EMRadius_3p_loose = -0.00115 ; + float c_3_EMRadius_3p_loose = 0.134 ; + float c_0_trkAvgDist_3p_loose = 0.441 ; + float c_1_trkAvgDist_3p_loose = 0.111 ; + float c_2_trkAvgDist_3p_loose = -0.000222 ; + float c_3_trkAvgDist_3p_loose = 0.105 ; + float EtOverPtLeadTrk_3p_loose = 5 ; + float c_0_EMRadius_3p_medium = 0.197 ; + float c_1_EMRadius_3p_medium = 0.157 ; + float c_2_EMRadius_3p_medium = -0.00085 ; + float c_3_EMRadius_3p_medium = 0.109 ; + float c_0_trkAvgDist_3p_medium = 0.375 ; + float c_1_trkAvgDist_3p_medium = 0.0596 ; + float c_2_trkAvgDist_3p_medium = -0.000328 ; + float c_3_trkAvgDist_3p_medium = 0.0461 ; + float EtOverPtLeadTrk_3p_medium = 3.33 ; + float c_0_EMRadius_3p_tight = 0.436 ; + float c_1_EMRadius_3p_tight = 0.1 ; + float c_2_EMRadius_3p_tight = -0.000494 ; + float c_3_EMRadius_3p_tight = 0.0781 ; + float c_0_trkAvgDist_3p_tight = 0.356 ; + float c_1_trkAvgDist_3p_tight = 0.0455 ; + float c_2_trkAvgDist_3p_tight = -0.000357 ; + float c_3_trkAvgDist_3p_tight = 0.03 ; + float EtOverPtLeadTrk_3p_tight = 2.78 ; + + + c_0_trkAvgDist_3p_medium *= 1.5; + c_1_trkAvgDist_3p_medium *= 1.5; + c_2_trkAvgDist_3p_medium *= 1.5; + c_3_trkAvgDist_3p_medium *= 1.5; + + switch( level) + { + case( LOOSE): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( c_0_EMRadius_1p_loose, c_1_EMRadius_1p_loose, c_2_EMRadius_1p_loose ), // LowEMRad_OP(am1,a0,a1): am1/pt + a0 + a1*pt ==> c0/pt + c1 +c2*pt + TrigTauEFSel::CutFunctor( c_0_EMRadius_3p_loose, c_1_EMRadius_3p_loose, c_2_EMRadius_3p_loose ), // LowEMRad_MP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_1p_loose, c_1_trkAvgDist_1p_loose, c_2_trkAvgDist_1p_loose), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_3p_loose, c_1_trkAvgDist_3p_loose, c_2_trkAvgDist_3p_loose), // Low TrkAvgD MP + EtOverPtLeadTrk_1p_loose, EtOverPtLeadTrk_3p_loose,// LowEtOPt_SP/_MP + c_3_EMRadius_1p_loose, c_3_EMRadius_3p_loose, // EMRad_SP/_MP + c_3_trkAvgDist_1p_loose, c_3_trkAvgDist_3p_loose, // TrkAvgD_SP/_MP, + EtOverPtLeadTrk_1p_loose, EtOverPtLeadTrk_3p_loose,// EtOPt_SP/_MP + 1, nTrackMaxLoose, // MinNTrack, MaxNtrack + thresh, thresh, // MinEtCalib, MinEtCalib + 60000);// EtThreshold + break; + case( MEDIUM1): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( c_0_EMRadius_1p_medium, c_1_EMRadius_1p_medium, c_2_EMRadius_1p_medium ), // LowEMRad_OP(am1,a0,a1): am1/pt + a0 + a1*pt ==> c0/pt + c1 +c2*pt + TrigTauEFSel::CutFunctor( c_0_EMRadius_3p_medium, c_1_EMRadius_3p_medium, c_2_EMRadius_3p_medium ), // LowEMRad_MP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_1p_medium, c_1_trkAvgDist_1p_medium, c_2_trkAvgDist_1p_medium), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_3p_medium, c_1_trkAvgDist_3p_medium, c_2_trkAvgDist_3p_medium), // Low TrkAvgD MP + EtOverPtLeadTrk_1p_medium, EtOverPtLeadTrk_3p_medium,// LowEtOPt_SP/_MP + c_3_EMRadius_1p_medium, c_3_EMRadius_3p_medium, // EMRad_SP/_MP + c_3_trkAvgDist_1p_medium, c_3_trkAvgDist_3p_medium, // TrkAvgD_SP/_MP, + EtOverPtLeadTrk_1p_medium, EtOverPtLeadTrk_3p_medium,// EtOPt_SP/_MP + 1, 3, // MinNTrack, MaxNtrack + thresh, thresh, // MinEtCalib, MinEtCalib + 60000);// EtThreshold + break; + case( MEDIUM): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( c_0_EMRadius_1p_medium, c_1_EMRadius_1p_medium, c_2_EMRadius_1p_medium ), // LowEMRad_OP(am1,a0,a1): am1/pt + a0 + a1*pt ==> c0/pt + c1 +c2*pt + TrigTauEFSel::CutFunctor( c_0_EMRadius_3p_medium, c_1_EMRadius_3p_medium, c_2_EMRadius_3p_medium ), // LowEMRad_MP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_1p_medium, c_1_trkAvgDist_1p_medium, c_2_trkAvgDist_1p_medium), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_3p_medium, c_1_trkAvgDist_3p_medium, c_2_trkAvgDist_3p_medium), // Low TrkAvgD MP + EtOverPtLeadTrk_1p_medium, EtOverPtLeadTrk_3p_medium,// LowEtOPt_SP/_MP + c_3_EMRadius_1p_medium, c_3_EMRadius_3p_medium, // EMRad_SP/_MP + c_3_trkAvgDist_1p_medium, c_3_trkAvgDist_3p_medium, // TrkAvgD_SP/_MP, + EtOverPtLeadTrk_1p_medium, EtOverPtLeadTrk_3p_medium,// EtOPt_SP/_MP + 1, 6, // MinNTrack, MaxNtrack + thresh, thresh, // MinEtCalib, MinEtCalib + 60000);// EtThreshold + break; + case( TIGHT): + efSel.setParamSafeCuts( + TrigTauEFSel::CutFunctor( c_0_EMRadius_1p_tight, c_1_EMRadius_1p_tight, c_2_EMRadius_1p_tight ), // LowEMRad_OP(am1,a0,a1): am1/pt + a0 + a1*pt ==> c0/pt + c1 +c2*pt + TrigTauEFSel::CutFunctor( c_0_EMRadius_3p_tight, c_1_EMRadius_3p_tight, c_2_EMRadius_3p_tight ), // LowEMRad_MP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_1p_tight, c_1_trkAvgDist_1p_tight, c_2_trkAvgDist_1p_tight), // LowTrkAvgD_OP + TrigTauEFSel::CutFunctor( c_0_trkAvgDist_3p_tight, c_1_trkAvgDist_3p_tight, c_2_trkAvgDist_3p_tight), // Low TrkAvgD MP + EtOverPtLeadTrk_1p_tight, EtOverPtLeadTrk_3p_tight,// LowEtOPt_SP/_MP + c_3_EMRadius_1p_tight, c_3_EMRadius_3p_tight, // EMRad_SP/_MP + c_3_trkAvgDist_1p_tight, c_3_trkAvgDist_3p_tight, // TrkAvgD_SP/_MP, + EtOverPtLeadTrk_1p_tight, EtOverPtLeadTrk_3p_tight,// EtOPt_SP/_MP + 1, 6, // MinNTrack, MaxNtrack + thresh, thresh, // MinEtCalib, MinEtCalib + 60000);// EtThreshold + default: + break; + } + + return; + } + +//============================================================================= +// MENU1662 corresponds to TrigTauHypo-00-02-34, +// https://svnweb.cern.ch/trac/atlasoff/browser/Trigger/TrigHypothesis/TrigTauHypo/tags/TrigTauHypo-00-02-34 +//============================================================================= +void +TrigTauSelectionManager::setTauMenu1662( TrigTauFlags::TRIGGERMENU type, + CUTLEVEL level) +{ + switch (type) + { + case TrigTauFlags::TAUNOCUT: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCuts( 1000, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30, 0, false); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + efSel.setCuts(0, 100, 100., 1000., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 12000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 4900, 0.0875, 0.141336); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 0, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 4900, 0.0837, 0.139087); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + break; + + case TrigTauFlags::TAU16: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 16000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 7800, 0.084327, 0.137957); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0., 1); + l2CalSel.setNewCuts( 7800, 0.08060, 0.135664); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0., 1); + l2CalSel.setNewCuts( 7800, 0.08060, 0.135664); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + break; + + case TrigTauFlags::TAU20: + l1Sel.setCuts(0, 8000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 20000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 9800, 0.08320, 0.137957); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 9800, 0.0795288, 0.135664); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 9800, 0.0795288, 0.135664); + break; + default: + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU29: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 29000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 16900, 0.07279, 0.124742); + break; + case MEDIUM: + l2TrkSel.setCuts( 7, -1, -1, 99, 7500, 0.1, 0, 0, 0, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 16900, 0.067706, 0.12162); + break; + case MEDIUM1: + l2TrkSel.setCuts( 4, -1, -1, 99, 7500, 0.1, 0, 0, 0, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 16900, 0.067706, 0.12162); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 38000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 22700, 0.06991, 0.119034); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 22700, 0.064107, 0.118296); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 50000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 31900, 0.0603379, 0.101723); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 31900, 0.05635, 0.11028); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 84000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 51000, 0.06033, 0.1); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 51000, 0.05634, 0.09); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU100: + l1Sel.setCuts(0, 50000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 100000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 60000, 0.0603379, 0.09); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 60000, 0.05635, 0.08); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU125: + l1Sel.setCuts(0, 50000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 125000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 75000, 0.0603379, 0.08); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 75000, 0.05635, 0.07); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; + break; + } + break; + default : + cout << ":setTauMenu MENU1662 can not deal with menu " + << TrigTauFlags::menuName(type) << endl; + break; + } +} + + +//============================================================================= +// TrigTauHypo-00-02-42 +// https://svnweb.cern.ch/trac/atlasoff/browser/Trigger/TrigHypothesis/TrigTauHypo/tags/TrigTauHypo-00-02-42 +//============================================================================= +void +TrigTauSelectionManager::setTauMenu1666( TrigTauFlags::TRIGGERMENU type, + CUTLEVEL level) +{ + switch (type) + { + case TrigTauFlags::TAUNOCUT: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCuts( 1000, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30, 0, false); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + efSel.setCuts(0, 100, 100., 1000., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 12000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 8100, 0.09, 0.16); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 0, 0.15, 0.30, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 8100, 0.09, 0.15); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + break; + + case TrigTauFlags::TAU16: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 16000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 11300, 0.08, 0.15); + + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 11300, 0.08, 0.14); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 11300, 0.08, 0.14); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + break; + + case TrigTauFlags::TAU20: + l1Sel.setCuts(0, 8000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 20000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 13800, 0.08, 0.13); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 13800, 0.07, 0.13); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 13800, 0.07, 0.13); + break; + default: + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU29: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 29000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 21600, 0.06, 0.12); + break; + case MEDIUM: + l2TrkSel.setCuts( 7, -1, -1, 99, 7500, 0.1, 0, 0, 0, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 21600, 0.06, 0.12); + break; + case MEDIUM1: + l2TrkSel.setCuts( 4, -1, -1, 99, 7500, 0.1, 0, 0, 0, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 21600, 0.06, 0.12); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 38000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 26900, 0.06, 0.12); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 26900, 0.05, 0.09); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 50000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 42400, 0.05, 0.09); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 42400, 0.05, 0.09); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 84000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 64700, 0.05, 0.08); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 64700, 0.04, 0.08); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU100: + l1Sel.setCuts(0, 50000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 100000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 81600, 0.05, 0.08); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 81600, 0.04, 0.08); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false,//lowered max N trk to 4 + 0.02, 0, 1); + l2CalSel.setNewCuts( 81600, 0.04, 0.08); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU125: + l1Sel.setCuts(0, 50000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts( efSel, level, 125000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 81600, 0.04, 0.08); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 81600, 0.04, 0.08); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; + break; + } + break; + default : + cout << ":setTauMenu MENU1666 can not deal with menu " + << TrigTauFlags::menuName(type) << endl; + break; + } +} + +//============================================================================= +// For now TrigTauHypo-00-03-02 +// https://svnweb.cern.ch/trac/atlasoff/browser/Trigger/TrigHypothesis/TrigTauHypo/tags/TrigTauHypo-00-03-02 +//============================================================================= +void +TrigTauSelectionManager::setTauMenuTest( TrigTauFlags::TRIGGERMENU type, + CUTLEVEL level) +{ + switch (type) + { + case TrigTauFlags::TAUNOCUT: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCuts( 1000, -1, -1, -1, 7500, 0.1, 1500, 0.15, 0.30, 0, false); + l2CalSel.setCuts(0, 0, 0, 0.0, 0.0, 0.0, 0); + efSel.setCuts(0, 100, 100., 1000., -10., 0.); + break; + + case TrigTauFlags::TAU12: + l1Sel.setCuts(0, 5000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 12000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 9400, 0.1074, 0.1411); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 0, 0.15, 0.30, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 9400, 0.0878, 0.1265); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + break; + + case TrigTauFlags::TAU16: + l1Sel.setCuts(0, 6000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 16000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 12400, 0.0996, 0.1310); + + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 12400, 0.0809, 0.1189); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 12400, 0.0809, 0.1189); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; break; + } + break; + + case TrigTauFlags::TAU20: + l1Sel.setCuts(0, 8000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 20000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 16700, 0.0833, 0.1179); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 16700, 0.0696, 0.1049); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 16700, 0.0696, 0.1049); + break; + default: + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU29: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 29000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 23200, 0.0705, 0.1015); + break; + case MEDIUM: + l2TrkSel.setCuts( 7, -1, -1, 99, 7500, 0.1, 0, 0, 0, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 23200, 0.0618, 0.0962); + break; + case MEDIUM1: + l2TrkSel.setCuts( 4, -1, -1, 99, 7500, 0.1, 0, 0, 0, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 23200, 0.0618, 0.0962); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU38: + l1Sel.setCuts(0, 11000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 38000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 28300, 0.0702, 0.0847); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0., 1); + l2CalSel.setNewCuts( 28300, 0.0521, 0.0823); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU50: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 50000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 44300, 0.0587, 0.0779); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.05, 0, 1); + l2CalSel.setNewCuts( 44300, 0.0495, 0.0726); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU84: + l1Sel.setCuts(0, 20000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 84000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 72100, 0.0494, 0.0686); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 72100, 0.0445, 0.0663); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU100: + l1Sel.setCuts(0, 50000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 100000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(10, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 88500, 0.0481, 0.0687); + break; + case MEDIUM: + + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 88500, 0.0426, 0.064); + break; + case MEDIUM1: + l2TrkSel.setCuts(4, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false,//lowered max N trk to 4 + 0.02, 0, 1); + l2CalSel.setNewCuts( 88500, 0.0426, 0.064); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl;break; + } + break; + + case TrigTauFlags::TAU125: + l1Sel.setCuts(0, 50000, 0, 0, 0, 0); + l2TrkSel.setCoreFromLeading(true); + setParametrizedEFCuts_201104( efSel, level, 125000); + switch(level) + { + case LOOSE: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.1, 0, 1); + l2CalSel.setNewCuts( 104300, 0.0463, 0.0654); + break; + case MEDIUM: + l2TrkSel.setCuts(7, -1, -1, 99, 7500, 0.1, 1500, 0.15, 0.30, 0, false, + 0.02, 0, 1); + l2CalSel.setNewCuts( 104300, 0.0414, 0.0621); + break; + default : + cout << "FIXME TrigTauSelectionManager has internal problem with menu " + << TrigTauFlags::menuName(type) + << " and level " << level << endl; + break; + } + break; + + default : + cout << ":setTauMenu MENUTEST can not deal with menu " + << TrigTauFlags::menuName(type) << endl; + break; + } +} + +// Cuts are: +// L1: +// EmEnergy, TauEnergy, EmIsol, HdIsol, EmCore, HdCore +// +// L2Cal: +// Et, EtCalib, nStrips, stripWidth, EMRad, IsoFrac, EMEnWidth2 , EtNar +// +// L2Cal (new): +// RawEtNor, EMRadiusSP, EMRadiusMP +// +// L2Trk: +// NtrkMax, NtrkIsol, NtrkSlow, NtrkMatch, +// maxPtSlow, dRIsol, mPt, dRMatched, dRtot, leadingPt, chargeCut, +// sumPtRatio,trkEmEt, NtrkMin +// +// EF: +// NTrackMin, NTrackMax, EMRadiusMax, IsoFracMax +// EMFracMin, PtMaxTrackMin, EtCalibMin, EMEtMin +// +// EF param: +// LowEMRadSP, LowEMRadMP, LowTrkAvgDistSP, LowTrkAvgDistMP, +// LowEtOverPtLeadTrkSP, LowEtOverPtLeadTrkMP, HighEMRadSP, HighEMRadMP, +// HighTrkAvgDistSP, HighTrkAvgDistMP, HighEtOverPtLeadTrkSP, +// HighEtOverPtLeadTrkMP, ETThresh, EtCalibMinSP, EtCalibMinMP, +// NTrackMin, NTrackMax + + +void +TrigTauSelectionManager::printSettings() const { + cout << "TTP Selection for "; + switch (_menuVersion){ + case MENU1206 : cout << " 12.0.6 "; break; + case MENUJUNE06 : cout << " June07 "; break; + case MENUJUNE07 : cout << " June07 "; break; + case MENU13020 : cout << " 13.0.20 "; break; + case MENUAUG07 : cout << " 13.0.20-dev "; break; + case MENU13030pre : cout << " 13.0.30.3 "; break; + case MENU1400 : cout << " 14.0.0 "; break; + case MENU1520test : cout << " 15.2.0 -test L1 EM scale "; break; + case MENU1600 : cout << " 16.0.0 "; break; + case MENU1662 : cout << " 16.6.2, TrigTauHypo-00-02-34"; break; + case MENU1666 : cout << " 16.6.2.6, TrigTauHypo-00-02-42, TAU125_MEDIUM temporarily modified"; break; + case MENUTEST : cout << " Test menu, TrigTauHypo-00-03-02"; break; + default : cout << " UNKNOWN "; break; + } + cout << "menu \n requested signature was "<< TrigTauFlags::menuName(_givenType) << ", used " <<TrigTauFlags::menuName(_usedType) << " with "; + switch (_cutLevel){ + case DEFAULT : cout << " DEFAULT "; break; + case SOFT : cout << " SOFT " ; break; + case LOOSE : cout << " LOOSE " ; break; + case MEDIUM : cout << " MEDIUM " ; break; + case MEDIUM1 : cout << " MEDIUM1 " ; break; + case TIGHT : cout << " TIGHT " ; break; + + } + cout << " level"; + if( l2CalOnly ) cout << " L2Trk is OFF"; + if( l2TrkOnly ) cout << " L2Cal is OFF"; + cout << endl; + + +} + +void +TrigTauSelectionManager::print() const { + l1Sel.print(); + l1METSel.print(); + l2CalSel.print(); + l2TrkSel.print(); + efSel.print(); +} + +// Selector functions +bool +TrigTauSelectionManager::passedL1(const TrigTauTrigChain& chain) { + if (chain.L1 == 0) return false; + return l1Sel.passed(*chain.L1) && l1METSel.passed(*chain.L1MET); +} + +bool +TrigTauSelectionManager::passedL2Cal(const TrigTauTrigChain& chain) { + if (chain.L2 == 0) return false; + return (passedL1(chain) && + l2CalSel.passed(*chain.L2)); +} + +bool +TrigTauSelectionManager::passedL2Trk(const TrigTauTrigChain& chain) { + if (chain.L2 == 0) return false; + return (passedL1(chain) && + l2TrkSel.passed(*chain.L2)); +} + +bool +TrigTauSelectionManager::passedL2(const TrigTauTrigChain& chain) { + if (chain.L2 == 0) return false; + + if (l2CalOnly) + return (passedL1(chain) && + l2CalSel.passed(*chain.L2)); + + if (l2TrkOnly) + return (passedL1(chain) && + l2TrkSel.passed(*chain.L2)); + + return (passedL1(chain) && + l2CalSel.passed(*chain.L2) && + l2TrkSel.passed(*chain.L2)); +} + +bool +TrigTauSelectionManager::passedEF(const TrigTauTrigChain& chain) { + if (chain.EF == 0) return false; + return (passedL2(chain) && + efSel.passed(*chain.EF)); +} + +void TrigTauSelectionManager::setDebug(bool val){ + l1Sel.setDebug(val); + l1METSel.setDebug(val); + l2CalSel.setDebug(val); + l2TrkSel.setDebug(val); + efSel.setDebug(val); +} + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauTrigChain.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauTrigChain.cxx new file mode 100755 index 0000000000000000000000000000000000000000..b71438133fc06c0bf3bbc508bb48ceb582c782e7 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauTrigChain.cxx @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauTrigChain.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// Container to associate L1-L2-EF into a trigger chain +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauTrigChain.h" +#include <iostream> +using namespace std; + +ClassImp(TrigTauTrigChain) + +TrigTauTrigChain::TrigTauTrigChain() : + L1(0), L2(0), L2Cal(0), L2Trk(0), EF(0), L1MET(0), tauRec(0) +{} + +TrigTauTrigChain::~TrigTauTrigChain() {} + +TrigTauTrigChain& +TrigTauTrigChain::operator = (const TrigTauTrigChain& other) +{ + L1 = other.L1; + L2Cal = other.L2Cal; + L2Trk = other.L2Trk; + L2 = other.L2; + EF = other.EF; + L1MET = other.L1MET; + tauRec = other.tauRec; + return *this; +} + +const TLorentzVector* +TrigTauTrigChain::trigger() const { + if (EF != 0) return EF; + if (L2 != 0) return L2; + if (L2Trk != 0) return L2Trk; + if (L2Cal != 0) return L2Cal; + return L1; // Will return null if L1 not assigned +} + + + +void TrigTauTrigChain::print() const +{ + cout << " Chain has "; + if( L1 ) cout << " L1 "; + if( L2Cal ) cout << " L2Cal "; + if( L2Trk ) cout << " L2Trk "; + if( L2 ) cout << "L2 "; + if( L1 && !(L2Cal or L2Trk) ) cout << " WARNING "; + if( EF ) cout << " EF "; + cout << endl; + if( L1 != 0 ) + cout << " L1 Et(GeV) RoiWord eta phi EmIsol: " + << L1->m_TauEnergy/1000. + << "\t\t" << std::hex << L1->m_roiWord << " "<<std::dec << L1->Eta() << "\t" << L1->Phi() << " " << L1->m_EmIsol/1000.<<endl; + if (L2Trk) + { + cout << " L2 Et(GeV) RoiWord eta phi: " + << L2Trk->Et()/1000; + if(L2) cout << "\t" << std::hex << L2->m_roiWord; + cout << " "<<std::dec << L2Trk->Eta() << "\t" << L2Trk->Phi() + << std::flush; + if( L1 && L2) cout << "\t-> dR = " << L1->DeltaR(*L2) << endl; + else cout << " NO L1 CASE \n"; + } + else if (L2Cal) + { + cout << " L2 Et(GeV) RoiWord eta phi: " + << L2Cal->Et()/1000; + if(L2) cout << "\t" << std::hex << L2->m_roiWord; + cout << " "<<std::dec << L2Cal->Eta() << "\t" << L2Cal->Phi() + << std::flush; + if( L1 && L2) cout << "\t-> dR = " << L1->DeltaR(*L2) << endl; + else cout << " NO L1 CASE \n"; + } + if (EF != 0) { + cout << " EF Et(GeV) eta phi: " + << EF->Et()/1000 + << "\t" << std::hex << EF->m_roiWord << " "<<std::dec << EF->Eta() << "\t" << EF->Phi() ; + if( L2 != 0 ) cout << "\t-> dR = " << L2->DeltaR(*EF) << endl; + else cout << " NO L2 CASE \n"; + } + cout << endl; + return ; +} + diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauTrigChainList.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauTrigChainList.cxx new file mode 100755 index 0000000000000000000000000000000000000000..ad5581a49a2c04922da25f5981111f7ca8623c25 --- /dev/null +++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauPerformAnalysis/src/TrigTauTrigChainList.cxx @@ -0,0 +1,670 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////////////////////////////////////////// +/// Name : TrigTauTrigChainList.cxx +/// Package : TrigTauPerformAnalysis +/// Author : Eric Torrence (University of Oregon) +/// Created : February 2007 +/// +/// DESCRIPTION: +/// List of trigger chains, and associated analysis functions +/// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "TrigTauPerformAnalysis/TrigTauTrigChainList.h" + +#include "TrigTauPerformAnalysis/TrigTauSelectionManager.h" + +#include <math.h> +#include <iostream> +#include <iomanip> + +using namespace std; + +ClassImp(TrigTauTrigChainList) + +// const bool _debug=true; +const bool _debug=false; + +TrigTauTrigChainList::TrigTauTrigChainList() : + _maxL1dR(0.15), + _maxL2dR(0.1), + _maxEFdR(0.1), // used for both MC->EF match and for L2->EF geometrical match + _maxRedR(0.2), + _useRoiWord(true), + _hltAuthorType(TrigTauFlags::ANYAUTHOR) {} + //_hltAuthorType(TrigTauFlags::IDSCAN) {} + +TrigTauTrigChainList::~TrigTauTrigChainList() {} + +void TrigTauTrigChainList::printChainList() const { + if (_chainList.size() == 1) { + cout << " There is " << _chainList.size() << " chain" << endl; + } else { + cout << " There are " << _chainList.size() << " chains" << endl; + } + + for (std::vector<TrigTauTrigChain>::const_iterator + itr = _chainList.begin(); + itr != _chainList.end(); ++itr) { + itr->print(); + } +} + +unsigned int +TrigTauTrigChainList::nTrigChains() const { + return _chainList.size(); +} + +const TrigTauTrigChain& +TrigTauTrigChainList::trigChainEntry(unsigned int i) const { + return _chainList[i]; +} + +unsigned int +TrigTauTrigChainList::nPassL1Chains() const { + return _tauL1.size(); +} + +const TrigTauTrigChain& +TrigTauTrigChainList::passL1ChainEntry(unsigned int i) const { + return *_tauL1[i]; +} + +unsigned int +TrigTauTrigChainList::nPassL2Chains() const { + return _tauL2.size(); +} +unsigned int +TrigTauTrigChainList::nPassL2TrkChains() const { + return _tauL2Trk.size(); +} +unsigned int +TrigTauTrigChainList::nPassL2CalChains() const { + return _tauL2Cal.size(); +} + +const TrigTauTrigChain& +TrigTauTrigChainList::passL2ChainEntry(unsigned int i) const { + return *_tauL2[i]; +} +const TrigTauTrigChain& +TrigTauTrigChainList::passL2TrkChainEntry(unsigned int i) const { + return *_tauL2Trk[i]; +} +const TrigTauTrigChain& +TrigTauTrigChainList::passL2CalChainEntry(unsigned int i) const { + return *_tauL2Cal[i]; +} + +unsigned int +TrigTauTrigChainList::nPassEFChains() const { + return _tauEF.size(); +} + +const TrigTauTrigChain& +TrigTauTrigChainList::passEFChainEntry(unsigned int i) const { + return *_tauEF[i]; +} + +const TrigTauTrigChain* +TrigTauTrigChainList::getChain(const TLorentzVector& goodTau) const { + float dRMin = 10000; + const TrigTauTrigChain* chain(0); + + for (std::vector<TrigTauTrigChain>::const_iterator + itr = _chainList.begin(); itr != _chainList.end(); ++itr ) { + + // Could also use the eta/phi of the highest defined trigger + // object in the chain... + float dR = goodTau.DeltaR(*itr->L1); + if (dR < dRMin) { dRMin = dR; chain = &(*itr); } + } + + if (dRMin < _maxL1dR) return chain; + return 0; +} + +const TrigTauTrigChain* +TrigTauTrigChainList::getL1Chain(const TLorentzVector& goodTau) const { + float dRMin = 10000; + const TrigTauTrigChain* chain(0); + + for (std::vector<const TrigTauTrigChain*>::const_iterator + itr = _tauL1.begin(); itr != _tauL1.end(); ++itr ) { + + // Could also use the eta/phi of the highest defined trigger + // object in the chain... + float dR = goodTau.DeltaR(*(*itr)->L1); + if (dR < dRMin) { dRMin = dR; chain = *itr; } + } + + if (dRMin < _maxL1dR) return chain; + return 0; +} + +const TrigTauTrigChain* +TrigTauTrigChainList::getL2CalChain(const TLorentzVector& goodTau) const { + // Match L2 eta/phi with visible truth + + float dRMin = 10000; + const TrigTauTrigChain* chain(0); + + for (std::vector<const TrigTauTrigChain*>::const_iterator + itr = _tauL2Cal.begin(); itr != _tauL2Cal.end(); ++itr ) { + + // Should really specify the calo-based 4-vector here + float dR = goodTau.DeltaR(*(*itr)->L2); + if (dR < dRMin) { dRMin = dR; chain = *itr; } + } + + if (dRMin < _maxL2dR) return chain; + return 0; +} + +const TrigTauTrigChain* +TrigTauTrigChainList::getL2TrkChain(const TLorentzVector& goodTau) const { + // Match L2 eta/phi with visible truth + + float dRMin = 10000; + const TrigTauTrigChain* chain(0); + + for (std::vector<const TrigTauTrigChain*>::const_iterator + itr = _tauL2Trk.begin(); itr != _tauL2Trk.end(); ++itr ) { + + // Should really specify the track-based 4-vector here + float dR = goodTau.DeltaR(*(*itr)->L2); + if (dR < dRMin) { dRMin = dR; chain = *itr; } + } + + if (dRMin < _maxL2dR) return chain; + return 0; +} + +const TrigTauTrigChain* +TrigTauTrigChainList::getL2Chain(const TLorentzVector& goodTau) const { + // Match L2 eta/phi with visible truth + + float dRMin = 10000; + const TrigTauTrigChain* chain(0); + + for (std::vector<const TrigTauTrigChain*>::const_iterator + itr = _tauL2.begin(); itr != _tauL2.end(); ++itr ) { + + // Should really specify the trk+calo-based 4-vector here + float dR = goodTau.DeltaR(*(*itr)->L2); // L2Cal is the same + if (dR < dRMin) { dRMin = dR; chain = *itr; } + } + + if (dRMin < _maxL2dR) return chain; + return 0; +} + +const TrigTauTrigChain* +TrigTauTrigChainList::getEFChain(const TLorentzVector& goodTau) const { + // Match EF eta/phi with visible truth + + float dRMin = 10000; + const TrigTauTrigChain* chain(0); + + for (std::vector<const TrigTauTrigChain*>::const_iterator + itr = _tauEF.begin(); itr != _tauEF.end(); ++itr ) { + + float dR = goodTau.DeltaR(*(*itr)->EF); + if (dR < dRMin) { dRMin = dR; chain = *itr; } + } + + if (dRMin < _maxEFdR) return chain; + return 0; +} + +const TrigTauL1Object* +TrigTauTrigChainList::getL1Tau(const TLorentzVector& goodTau) const { + const TrigTauTrigChain* chain = getL1Chain(goodTau); + if (chain == 0) return 0; + return chain->L1; +} + +const TrigTauL2Object* +TrigTauTrigChainList::getL2CalTau(const TLorentzVector& goodTau) const { + const TrigTauTrigChain* chain = getL2CalChain(goodTau); + if (chain == 0) return 0; + return chain->L2; +} + +const TrigTauL2Object* +TrigTauTrigChainList::getL2TrkTau(const TLorentzVector& goodTau) const { + const TrigTauTrigChain* chain = getL2TrkChain(goodTau); + if (chain == 0) return 0; + return chain->L2; +} + +const TrigTauL2Object* +TrigTauTrigChainList::getL2Tau(const TLorentzVector& goodTau) const { + const TrigTauTrigChain* chain = getL2Chain(goodTau); + if (chain == 0) return 0; + return chain->L2; // L2/L2Trk/L2Cal are all the same +} + +const TrigTauRecEFObject* +TrigTauTrigChainList::getEFTau(const TLorentzVector& goodTau) const { + const TrigTauTrigChain* chain = getEFChain(goodTau); + if (chain == 0) return 0; + return chain->EF; +} + +void +TrigTauTrigChainList::fillTriggerList(TrigTauSelectionManager& trigMan) { + + _tauL1.clear(); + _tauL2Cal.clear(); + _tauL2Trk.clear(); + _tauL2.clear(); + _tauEF.clear(); + if( _debug) cout << "Clearing is done \n"; + + int count = 0; + // Selections must be applied sequentially to the chain + for(std::vector<TrigTauTrigChain>::const_iterator + itr = _chainList.begin(); itr != _chainList.end(); ++itr) { + + if( _debug ) {cout << " analyse chain " << count << endl; } + count++; + + + // Apply L1 selection + if (!trigMan.passedL1(*itr)) continue; + _tauL1.push_back(&(*itr)); + if( _debug) cout << " L1 is passed \n"; + + // Apply L2 selection + bool l2CalOk = trigMan.passedL2Cal(*itr); + if( _debug) cout << " L2Calo is "<< l2CalOk<< " \n"; + bool l2TrkOk = trigMan.passedL2Trk(*itr); + if( _debug) cout << " L2Trk is "<< l2TrkOk<< " \n"; + if( l2CalOk ) _tauL2Cal.push_back(&(*itr)); + if( l2TrkOk ) _tauL2Trk.push_back(&(*itr)); + + if (!trigMan.passedL2(*itr) ) continue; + _tauL2.push_back(&(*itr)); + if( _debug) cout << " L2 is passed \n"; + + // Put EF selection here + if (!trigMan.passedEF(*itr)) continue; + _tauEF.push_back(&(*itr)); + if( _debug) cout << " EF is passed \n"; + + } + +} + +void +TrigTauTrigChainList::fillChainList(const TrigTauEvent* event) { + + _chainList.clear(); + + if( event == 0 ) { + cout << "TrigTauTrigChainList::fillChainList - No event available!" << endl; + return; + } + + // Check lists for consistency + int nL1 = event->tauL1.size(); + int nL2 = event->tauL2.size(); + int nL3 = event->tauEF.size(); + + // Note, this can now happen... + static bool firstL2 = true; + if (nL2 > nL1 && firstL2) { + cout << "TrigTauTrigChainList::fillChainList - Found nL2>nL1 :" + << nL2 << " > " << nL1 << endl; + cout << " last message of this type" << endl; + firstL2 = false; + } + + // Note, this can now happen... + static bool firstL3 = true; + if (nL3 > nL2 && firstL3 ){ + cout << "TrigTauTrigChainList::fillChainList - Found nEF>nL2 :" + << nL3 << " > " << nL2 << ", only closest cand. with best seed will be considered " << endl; + cout << " last message of this type\n"; + firstL3 = false; + } + if (_debug) cout << "nL1 " << nL1 << " nL2 " << nL2 << " nEF " << nL3 << endl; + + if (nL1 == 0) return; + + // Choose between using dR matching (old ntuples) + // or ROI Word matching (correct, TTP05 and beyond) + if (_useRoiWord) { + fillChainListRoiWord(event); + } else { + fillChainListdRMatch(event); + } + + // Also attach the offline tauRec and 1p3p objects + for(unsigned int itau = 0; itau < event->nTauRec(); ++itau){ + const TrigTauRecOfflineObject * tau = &event->tauRecEntry(itau) ; + + float dRMin = 10000; + std::vector<TrigTauTrigChain>::iterator closest = _chainList.end(); + + for(std::vector<TrigTauTrigChain>::iterator ich = _chainList.begin(); + ich != _chainList.end(); ++ich) { + + // Match to highest level trigger object available + float dR = tau->DeltaR(*(ich->trigger())); + if (dR < dRMin) {dRMin = dR; closest = ich;} + } + + // Asign this tauRec object to the closest chain + if (closest != _chainList.end()) closest->tauRec = &(*tau); + } + + +} + +void +TrigTauTrigChainList::fillChainListdRMatch(const TrigTauEvent* event) { + + // Start with one chain per level1 object + for(std::vector<TrigTauL1Object*>::const_iterator + l1tau = event->tauL1.begin(); + l1tau != event->tauL1.end(); ++l1tau) { + TrigTauTrigChain theChain; + // cout << "New L1 " << l1tau->m_eta << endl; + theChain.L1 = &(**l1tau); + theChain.L1MET = &event->etMissL1; + + _chainList.push_back(theChain); + } + + // Now loop through the L2 objects and attach each to the + // chain with the closest L1 object in dR + + // Fix this when data is available to associate L1 to L2 by ROI ID + for(std::vector<TrigTauL2Object*>::const_iterator + l2tau = event->tauL2.begin(); + l2tau != event->tauL2.end(); ++l2tau) { + + // Check for ROI author type + if (!(*l2tau)->m_tags.isTau_L2AuthorType(_hltAuthorType)) continue; + + float dRMin = 10000; + + // Vectors can't be 0, but lists can? Weird + std::vector<TrigTauTrigChain>::iterator closest = _chainList.end(); + + for(std::vector<TrigTauTrigChain>::iterator ich = _chainList.begin(); + ich != _chainList.end(); ++ich) { + + if (ich->L1 == 0) continue; + float dR = (*l2tau)->DeltaR(*(ich->L1)); + if (dR < dRMin) {dRMin = dR; closest = ich;} + // cout << "L2 " << l2tau->Eta() << " " << dR << " " << dRMin << endl; + } + + // Asign this L2 object to the closest chain + if (closest != _chainList.end()) + { closest->L2Cal = *l2tau; closest->L2Trk = *l2tau; closest->L2 = *l2tau; } + } + + //========================================================================= + // Now loop through the EF objects and attach each to the + // chain with the closest L2 object in dR + for(std::vector<TrigTauTrigChain>::iterator ich = _chainList.begin(); + ich != _chainList.end(); ++ich) { + if (ich->L1 == 0) continue; + + std::vector<TrigTauRecEFObject*>::const_iterator closest = event->tauEF.end(); + float dRMin = 10000; + + // look for EF candidates of type 3 first : + for(std::vector<TrigTauRecEFObject*>::const_iterator + l3tau = event->tauEF.begin(); + l3tau != event->tauEF.end(); ++l3tau) { + if( (*l3tau)->m_seedType != TrigTauTauObject::BOTH ) continue; + + // Check for ROI author type + if (!(*l3tau)->m_tags.isTau_AuthorType(_hltAuthorType)) continue; + + float dR = (*l3tau)->DeltaR(*(ich->L1)); + if (dR < dRMin) { + dRMin = dR; + closest = l3tau; + } + // cout << "L3 " << l3tau->Eta() << " " << dR << " " << dRMin << endl; + } + + if( dRMin < _maxEFdR && closest != event->tauEF.end() ) { + ich->EF = (*closest); + continue; + } + + // look if there is a better TauRec only candidate + for(std::vector<TrigTauRecEFObject*>::const_iterator + l3tau = event->tauEF.begin(); + l3tau != event->tauEF.end(); ++l3tau) { + if( (*l3tau)->m_seedType != TrigTauTauObject::CALOOBJECT ) continue; + + // Check for ROI author type + if (!(*l3tau)->m_tags.isTau_AuthorType(_hltAuthorType)) continue; + + float dR = (*l3tau)->DeltaR(*(ich->L1)); + if (dR < dRMin) { + dRMin = dR; + closest = l3tau; + } + // cout << "L3 " << (*l3tau)->Eta() << " " << dR << " " << dRMin << endl; + } + + if( dRMin < _maxEFdR && closest != event->tauEF.end() ) { + ich->EF = *closest; + continue; + } + + // now attach whatever remains from tau1p3p + for(std::vector<TrigTauRecEFObject*>::const_iterator + l3tau = event->tauEF.begin(); + l3tau != event->tauEF.end(); ++l3tau) { + if( (*l3tau)->m_seedType != TrigTauTauObject::TRACK ) continue; + + // Check for ROI author type + if (!(*l3tau)->m_tags.isTau_AuthorType(_hltAuthorType)) continue; + + float dR = (*l3tau)->DeltaR(*(ich->L1)); + if (dR < dRMin) { + dRMin = dR; + closest = l3tau; + } + // cout << "L3 " << l3tau->Eta() << " " << dR << " " << dRMin << endl; + } + + if( closest != event->tauEF.end() ) { + ich->EF = *closest; + continue; + } + + } // end of loop over chains + +} + +// We can now do this by using the m_roiWord, which should +// be a unique identifier. + +void +TrigTauTrigChainList::fillChainListRoiWord(const TrigTauEvent* event) { + + // Start with one chain per level1 object + for(std::vector<TrigTauL1Object*>::const_iterator + l1tau = event->tauL1.begin(); + l1tau != event->tauL1.end(); ++l1tau) { + TrigTauTrigChain theChain; + if (_debug) cout << "New L1 - eta: " << (*l1tau)->Eta() << " ID: " + << std::hex << (*l1tau)->m_roiWord << std::dec << endl; + theChain.L1 = *l1tau; + theChain.L1MET = &event->etMissL1; + + _chainList.push_back(theChain); + } + + // Now loop through the L2 objects and attach each to the + // chain with the same m_roiWord + + // Fix this when data is available to associate L1 to L2 by ROI ID + for(std::vector<TrigTauL2Object*>::const_iterator + l2tau = event->tauL2.begin(); + l2tau != event->tauL2.end(); ++l2tau) { + + // Check for ROI author type + if (!(*l2tau)->m_tags.isTau_L2AuthorType(_hltAuthorType)) continue; + + if (_debug) cout << "New L2 - eta: " << (*l2tau)->Eta() << " ID: " + << std::hex << (*l2tau)->m_roiWord << std::dec << endl; + + // Vectors can't be 0, but lists can? Weird + std::vector<TrigTauTrigChain>::iterator closest = _chainList.end(); + + for(std::vector<TrigTauTrigChain>::iterator ich = _chainList.begin(); + ich != _chainList.end(); ++ich) { + + if (ich->L1 == 0) continue; + if (ich->L1->m_roiWord == (*l2tau)->m_roiWord) closest = ich; + + } + + // Asign this L2 object to the closest chain + if (closest != _chainList.end()) { + closest->L2Cal = *l2tau; + closest->L2Trk = *l2tau; + closest->L2 = *l2tau; + if (_debug) cout << "Found L2 ROI Match" << endl; + } else { + cout << event->eventNumber << " TrigTauTrigChainList - Couldn't match L2 ROI! " << std::hex << (*l2tau)->m_roiWord << std::dec<< endl; + if (_debug) printChainList(); + } + } + + // Now loop through the EF objects and attach each to the + // chain with the closest L2 object in dR + for(std::vector<TrigTauTrigChain>::iterator ich = _chainList.begin(); + ich != _chainList.end(); ++ich) { + if (ich->L2 == 0) continue; + + std::vector<TrigTauRecEFObject*>::const_iterator closest = event->tauEF.end(); + + // Add bool so we get a match even if dR is crazy + float dRMin=1E40; + bool first = true; + + // look for EF candidates of type 3 first : + for(std::vector<TrigTauRecEFObject*>::const_iterator + l3tau = event->tauEF.begin(); + l3tau != event->tauEF.end(); ++l3tau) { + + if (ich->L1->m_roiWord != (*l3tau)->m_roiWord) continue; + if( (*l3tau)->m_seedType != TrigTauTauObject::BOTH ) continue; + + // Check for ROI author type + if (!(*l3tau)->m_tags.isTau_AuthorType(_hltAuthorType)) continue; + + float dR = (*l3tau)->DeltaR(*(ich->L2)); + if (first || dR < dRMin) { + first = false; + dRMin = dR; + closest = l3tau; + } + // cout << "L3 " << (*l3tau)->Eta() << " " << dR << " " << dRMin << endl; + } + + if( closest != event->tauEF.end() ) { + ich->EF = *closest; + continue; + } + + // look if there is a better TauRec only candidate + for(std::vector<TrigTauRecEFObject*>::const_iterator + l3tau = event->tauEF.begin(); + l3tau != event->tauEF.end(); ++l3tau) { + if (ich->L1->m_roiWord != (*l3tau)->m_roiWord) continue; + if( (*l3tau)->m_seedType != TrigTauTauObject::CALOOBJECT ) continue; + + // Check for ROI author type + if (!(*l3tau)->m_tags.isTau_AuthorType(_hltAuthorType)) continue; + + float dR = (*l3tau)->DeltaR(*(ich->L2)); + if (first || dR < dRMin) { + first = false; + dRMin = dR; + closest = l3tau; + } + // cout << "L3 " << l3tau->Eta() << " " << dR << " " << dRMin << endl; + } + + if( closest != event->tauEF.end() ) { + ich->EF = *closest; + continue; + } + + // now attach whatever remains from tau1p3p + for(std::vector<TrigTauRecEFObject*>::const_iterator + l3tau = event->tauEF.begin(); + l3tau != event->tauEF.end(); ++l3tau) { + if (ich->L1->m_roiWord != (*l3tau)->m_roiWord) continue; + if( (*l3tau)->m_seedType != TrigTauTauObject::TRACK ) continue; + + // Check for ROI author type + if (!(*l3tau)->m_tags.isTau_AuthorType(_hltAuthorType)) continue; + + float dR = (*l3tau)->DeltaR(*(ich->L2)); + if (first || dR < dRMin) { + first = false; + dRMin = dR; + closest = l3tau; + } + // cout << "L3 " << (*l3tau)->Eta() << " " << dR << " " << dRMin << endl; + } + + if( closest != event->tauEF.end() ) { + ich->EF = *closest; + continue; + } + if (_debug) + { + if( ich->EF != 0 ) + { + cout << "Found EF ROI Match" << endl; + } else { + cout << event->eventNumber<< " TrigTauTrigChainList - Couldn't match EF ROI! "<< std::hex << ich->L1->m_roiWord << std::dec << endl; + } + } + } // end of loop over chains + +} + +bool TrigTauTrigChainList::checkRoIWord() const +{ + bool ok = true; + for (std::vector<TrigTauTrigChain>::const_iterator itr = _chainList.begin(); + itr != _chainList.end(); ++itr) { + if( ! itr->L1 ) continue; + if( ( itr->L2 && itr->L1->m_roiWord != itr->L2->m_roiWord ) || + ( itr->EF && itr->L1->m_roiWord != itr->EF->m_roiWord ) || + ( itr->L2 && itr->EF && itr->L2->m_roiWord != itr->EF->m_roiWord ) ) + { + ok = false; + } + } + if( !ok ) + { + cout << " MISMATCH in chain RoIs found \n"; + printChainList(); + cout << "=========================================="; + } + + + return ok; +} +