diff --git a/Reconstruction/Jet/JetCalibTools/JetCalibTools/CalibrationMethods/GlobalSequentialCorrection.h b/Reconstruction/Jet/JetCalibTools/JetCalibTools/CalibrationMethods/GlobalSequentialCorrection.h index 8fa4d0272cbd18e82cb644d7b74ad778f7febf81..be5be8a7b70f000d18470bfc3f491cf07eb6d70d 100644 --- a/Reconstruction/Jet/JetCalibTools/JetCalibTools/CalibrationMethods/GlobalSequentialCorrection.h +++ b/Reconstruction/Jet/JetCalibTools/JetCalibTools/CalibrationMethods/GlobalSequentialCorrection.h @@ -50,9 +50,10 @@ class GlobalSequentialCorrection double getPunchThroughResponse(double E, double eta_det, int Nsegments) const; double getCaloWIDTHResponse(double pT, uint etabin, double caloWIDTH) const; double getN90ConstituentsResponse(double pT, uint etabin, double N90Constituents) const; + double getTileGap3Response(double pT, uint etabin, double TileGap3) const; double getGSCCorrection(xAOD::JetFourMom_t jetP4, double eta, - double trackWIDTH, double nTrk, double Tile0, double EM3, int Nsegments, double ChargedFraction, double caloWIDTH, double N90Constituents) const; + double trackWIDTH, double nTrk, double Tile0, double EM3, int Nsegments, double ChargedFraction, double caloWIDTH, double N90Constituents, double TileGap3) const; double getJetPropertyMax(TString jetPropName, unsigned int etabin) { if ( jetPropName.Contains("EM3") && etabin < m_EM3MaxEtaBin ) return m_respFactorsEM3[etabin]->GetYaxis()->GetXmax(); @@ -61,6 +62,7 @@ class GlobalSequentialCorrection else if ( jetPropName.Contains("trackWIDTH") && etabin < m_trackWIDTHMaxEtaBin ) return m_respFactorstrackWIDTH[etabin]->GetYaxis()->GetXmax(); else if ( jetPropName.Contains("N90Constituents") && etabin < m_N90ConstituentsMaxEtaBin ) return m_respFactorsN90Constituents[etabin]->GetYaxis()->GetXmax(); else if ( jetPropName.Contains("caloWIDTH") && etabin < m_caloWIDTHMaxEtaBin ) return m_respFactorscaloWIDTH[etabin]->GetYaxis()->GetXmax(); + else if ( jetPropName.Contains("TileGap3") && etabin < m_TileGap3MaxEtaBin ) return m_respFactorsTileGap3[etabin]->GetYaxis()->GetXmax(); else return 1; } @@ -80,7 +82,7 @@ class GlobalSequentialCorrection TH2F *respFactors) const; private: - enum m_GSCSeq { ApplyChargedFraction = 1, ApplyTile0 = 2, ApplyEM3 = 4, ApplynTrk = 8, ApplytrackWIDTH = 16, ApplyPunchThrough = 32, ApplyN90Constituents = 64, ApplycaloWIDTH = 128 }; + enum m_GSCSeq { ApplyChargedFraction = 1, ApplyTile0 = 2, ApplyEM3 = 4, ApplynTrk = 8, ApplytrackWIDTH = 16, ApplyPunchThrough = 32, ApplyN90Constituents = 64, ApplyTileGap3 = 128, ApplycaloWIDTH = 256 }; //Private members set in the constructor TEnv * m_config; @@ -88,9 +90,9 @@ class GlobalSequentialCorrection bool m_dev; //Private members set during initialization - VecTH2F m_respFactorsEM3, m_respFactorsnTrk, m_respFactorstrackWIDTH, m_respFactorsTile0, m_respFactorsPunchThrough, m_respFactorsChargedFraction, m_respFactorsN90Constituents, m_respFactorscaloWIDTH; + VecTH2F m_respFactorsEM3, m_respFactorsnTrk, m_respFactorstrackWIDTH, m_respFactorsTile0, m_respFactorsPunchThrough, m_respFactorsChargedFraction, m_respFactorsN90Constituents, m_respFactorscaloWIDTH, m_respFactorsTileGap3; double m_binSize; - uint m_depth, m_trackWIDTHMaxEtaBin, m_nTrkMaxEtaBin, m_Tile0MaxEtaBin, m_EM3MaxEtaBin, m_chargedFractionMaxEtaBin, m_caloWIDTHMaxEtaBin, m_N90ConstituentsMaxEtaBin; + uint m_depth, m_trackWIDTHMaxEtaBin, m_nTrkMaxEtaBin, m_Tile0MaxEtaBin, m_EM3MaxEtaBin, m_chargedFractionMaxEtaBin, m_caloWIDTHMaxEtaBin, m_N90ConstituentsMaxEtaBin, m_TileGap3MaxEtaBin; VecD m_punchThroughEtaBins; double m_punchThroughMinPt; bool m_turnOffTrackCorrections; diff --git a/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx b/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx index 7e3516a402db5cf044db0a8ec24c3ffd3d0a4e2f..8a8c6320f2f306195b763d6028e1b1259bd60dab 100644 --- a/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx +++ b/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx @@ -30,7 +30,7 @@ GlobalSequentialCorrection::GlobalSequentialCorrection() : JetCalibrationToolBase::JetCalibrationToolBase("GlobalSequentialCorrection::GlobalSequentialCorrection"), m_config(NULL), m_jetAlgo(""), m_calibAreaTag(""), m_dev(false), m_binSize(0.1), m_depth(0), - m_trackWIDTHMaxEtaBin(25), m_nTrkMaxEtaBin(25), m_Tile0MaxEtaBin(17), m_EM3MaxEtaBin(35), m_chargedFractionMaxEtaBin(27), m_caloWIDTHMaxEtaBin(35), m_N90ConstituentsMaxEtaBin(35), + m_trackWIDTHMaxEtaBin(25), m_nTrkMaxEtaBin(25), m_Tile0MaxEtaBin(17), m_EM3MaxEtaBin(35), m_chargedFractionMaxEtaBin(27), m_caloWIDTHMaxEtaBin(35), m_N90ConstituentsMaxEtaBin(35), m_TileGap3MaxEtaBin(16), m_punchThroughMinPt(50) { } @@ -39,16 +39,15 @@ GlobalSequentialCorrection::GlobalSequentialCorrection(const std::string& name) : JetCalibrationToolBase::JetCalibrationToolBase( name ), m_config(NULL), m_jetAlgo(""), m_calibAreaTag(""), m_dev(false), m_binSize(0.1), m_depth(0), - m_trackWIDTHMaxEtaBin(25), m_nTrkMaxEtaBin(25), m_Tile0MaxEtaBin(17), m_EM3MaxEtaBin(35), m_chargedFractionMaxEtaBin(27), m_caloWIDTHMaxEtaBin(35), m_N90ConstituentsMaxEtaBin(35), + m_trackWIDTHMaxEtaBin(25), m_nTrkMaxEtaBin(25), m_Tile0MaxEtaBin(17), m_EM3MaxEtaBin(35), m_chargedFractionMaxEtaBin(27), m_caloWIDTHMaxEtaBin(35), m_N90ConstituentsMaxEtaBin(35), m_TileGap3MaxEtaBin(16), m_punchThroughMinPt(50) - { } GlobalSequentialCorrection::GlobalSequentialCorrection(const std::string& name, TEnv * config, TString jetAlgo, TString calibAreaTag, bool dev) : JetCalibrationToolBase::JetCalibrationToolBase( name ), m_config(config), m_jetAlgo(jetAlgo), m_calibAreaTag(calibAreaTag), m_dev(dev), m_binSize(0.1), m_depth(0), - m_trackWIDTHMaxEtaBin(25), m_nTrkMaxEtaBin(25), m_Tile0MaxEtaBin(17), m_EM3MaxEtaBin(35), m_chargedFractionMaxEtaBin(27), m_caloWIDTHMaxEtaBin(35), m_N90ConstituentsMaxEtaBin(35), + m_trackWIDTHMaxEtaBin(25), m_nTrkMaxEtaBin(25), m_Tile0MaxEtaBin(17), m_EM3MaxEtaBin(35), m_chargedFractionMaxEtaBin(27), m_caloWIDTHMaxEtaBin(35), m_N90ConstituentsMaxEtaBin(35), m_TileGap3MaxEtaBin(16), m_punchThroughMinPt(50) { } @@ -58,15 +57,14 @@ GlobalSequentialCorrection::~GlobalSequentialCorrection() { StatusCode GlobalSequentialCorrection::initializeTool(const std::string&) { - ATH_MSG_INFO("Initializing the Global Sequential Calibration tool"); - // Set m_PFlow if( m_jetAlgo == "AntiKt4EMPFlow" ) m_PFlow = true; else{m_PFlow=false;} // Set m_caloBased - if( m_jetAlgo == "AntiKt4EMTopoTrig" && !m_PFlow ) {m_caloBased = true; ATH_MSG_INFO("Using calo based GSC");} - else{m_caloBased = false;} + if( m_jetAlgo == "AntiKt4EMTopoTrig" && !m_PFlow ) m_caloBased = true; + // better to read from config which type of GSC: caloBased for trigger jets. + else{ m_caloBased = m_config->GetValue("caloBasedGSC", false); } m_jetStartScale = m_config->GetValue("GSCStartingScale","JetEtaJESScaleMomentum"); m_turnOffTrackCorrections = m_config->GetValue("TurnOffTrackCorrections", false); @@ -103,7 +101,7 @@ StatusCode GlobalSequentialCorrection::initializeTool(const std::string&) { } TString depthString = m_config->GetValue("GSCDepth","Full"); - if ( !depthString.Contains("ChargedFraction") && !depthString.Contains("Tile0") && !depthString.Contains("EM3") && !depthString.Contains("nTrk") && !depthString.Contains("trackWIDTH") && !depthString.Contains("PunchThrough") && !depthString.Contains("N90Constituents") && !depthString.Contains("N90Constituents") && !depthString.Contains("caloWIDTH") && !depthString.Contains("Full") ) { + if ( !depthString.Contains("ChargedFraction") && !depthString.Contains("Tile0") && !depthString.Contains("EM3") && !depthString.Contains("nTrk") && !depthString.Contains("trackWIDTH") && !depthString.Contains("PunchThrough") && !depthString.Contains("N90Constituents") && !depthString.Contains("TileGap3") && !depthString.Contains("caloWIDTH") && !depthString.Contains("Full") ) { ATH_MSG_FATAL("depthString flag not properly set, please check your config file."); return StatusCode::FAILURE; } @@ -114,6 +112,12 @@ StatusCode GlobalSequentialCorrection::initializeTool(const std::string&) { return StatusCode::FAILURE; } + // Protection against requesting nTrk or trackWIDTH corrections for HLT trigger jets when m_caloBased is true + if ( m_caloBased && (depthString.Contains("nTrk")||depthString.Contains("trackWIDTH")) ){ + ATH_MSG_FATAL("depthString flag not properly set, please check your config file. nTrk or trackWIDTH corrections not available for trigger jets"); + return StatusCode::FAILURE; + } + //ATH_MSG_INFO(" for " << m_jetAlgo << " jets\n\n"); if ( depthString.Contains("PunchThrough") || depthString.Contains("Full") ) { @@ -131,8 +135,9 @@ StatusCode GlobalSequentialCorrection::initializeTool(const std::string&) { else { ATH_MSG_FATAL("depthString flag not properly set, please check your config file."); return StatusCode::FAILURE; } } else if (m_caloBased){ - if ( depthString.Contains("PunchThrough") || depthString.Contains("Full") ) m_depth = ApplyTile0 | ApplyEM3 | ApplyN90Constituents | ApplycaloWIDTH; - else if ( depthString.Contains("caloWIDTH") ) m_depth = ApplyTile0 | ApplyEM3 | ApplyN90Constituents | ApplycaloWIDTH; + if ( depthString.Contains("PunchThrough") || depthString.Contains("Full") ) m_depth = ApplyTile0 | ApplyEM3 | ApplyN90Constituents | ApplyTileGap3 | ApplycaloWIDTH; + else if ( depthString.Contains("caloWIDTH") ) m_depth = ApplyTile0 | ApplyEM3 | ApplyN90Constituents | ApplyTileGap3 | ApplycaloWIDTH; + else if ( depthString.Contains("TileGap3") ) m_depth = ApplyTile0 | ApplyEM3 | ApplyN90Constituents | ApplyTileGap3; else if ( depthString.Contains("N90Constituents") ) m_depth = ApplyTile0 | ApplyEM3 | ApplyN90Constituents; else if ( depthString.Contains("EM3") ) m_depth = ApplyTile0 | ApplyEM3; else if ( depthString.Contains("Tile0") ) m_depth = ApplyTile0; @@ -184,6 +189,8 @@ StatusCode GlobalSequentialCorrection::initializeTool(const std::string&) { m_respFactorsN90Constituents.push_back( (TH2F*)JetCalibUtils::GetHisto2(inputFile,histoNames[ihisto]) ); else if ( histoNames[ihisto].Contains("caloWIDTH") && m_respFactorscaloWIDTH.size() < m_caloWIDTHMaxEtaBin) m_respFactorscaloWIDTH.push_back( (TH2F*)JetCalibUtils::GetHisto2(inputFile,histoNames[ihisto]) ); + else if ( histoNames[ihisto].Contains("TileGap3") && m_respFactorsTileGap3.size() < m_TileGap3MaxEtaBin ) + m_respFactorsTileGap3.push_back( (TH2F*)JetCalibUtils::GetHisto2(inputFile,histoNames[ihisto]) ); } //Make sure we put something in the vectors of TH2Fs @@ -227,6 +234,11 @@ StatusCode GlobalSequentialCorrection::initializeTool(const std::string&) { ATH_MSG_FATAL("Vector of caloWIDTH histograms may be empty. Please check your GSCFactors file: " << GSCFile); return StatusCode::FAILURE; } + else if ( (m_depth & ApplyTileGap3) && m_respFactorsTileGap3.size() < 3 ) { + ATH_MSG_FATAL("Vector of TileGap3 histograms may be empty. Please check your GSCFactors file: " << GSCFile); + return StatusCode::FAILURE; + } + else ATH_MSG_INFO("GSC Tool has been initialized with binning and eta fit factors from: " << fileName << "\n"); } else{ @@ -367,8 +379,15 @@ double GlobalSequentialCorrection::getN90ConstituentsResponse(double pT, uint et return N90ConstituentsResponse; } +double GlobalSequentialCorrection::getTileGap3Response(double pT, uint etabin, double TileGap3 ) const { + if (TileGap3<0) return 1; //TileGap3 < 0 is unphysical, so we return 1 + if ( etabin >= m_respFactorsTileGap3.size() ) return 1.; + double TileGap3Response = readPtJetPropertyHisto(pT, TileGap3, m_respFactorsTileGap3[etabin]); + return TileGap3Response; +} + double GlobalSequentialCorrection::getGSCCorrection(xAOD::JetFourMom_t jetP4, double eta, - double trackWIDTH, double nTrk, double Tile0, double EM3, int Nsegments, double ChargedFraction, double caloWIDTH, double N90Constituents) const { + double trackWIDTH, double nTrk, double Tile0, double EM3, int Nsegments, double ChargedFraction, double caloWIDTH, double N90Constituents, double TileGap3) const { //eta bins have size m_binSize=0.1 and are numbered sequentially from 0, so |eta|=2.4 is in eta bin #24 int etabin = eta/m_binSize; double Corr=1; @@ -389,6 +408,7 @@ double GlobalSequentialCorrection::getGSCCorrection(xAOD::JetFourMom_t jetP4, do if (m_depth & ApplyTile0) Corr*=1./getTile0Response(jetP4.pt()/m_GeV*Corr, etabin, Tile0); if (m_depth & ApplyEM3) Corr*=1./getEM3Response(jetP4.pt()/m_GeV*Corr, etabin, EM3); if (m_depth & ApplyN90Constituents) Corr*=1/getN90ConstituentsResponse(jetP4.pt()/m_GeV*Corr, etabin, N90Constituents); + if (m_depth & ApplyTileGap3) Corr*=1/getTileGap3Response(jetP4.pt()/m_GeV*Corr,etabin, TileGap3); if (m_depth & ApplycaloWIDTH) Corr*=1/getCaloWIDTHResponse(jetP4.pt()/m_GeV*Corr,etabin,caloWIDTH); } else{ // PFlow @@ -505,6 +525,7 @@ StatusCode GlobalSequentialCorrection::calibrateImpl(xAOD::Jet& jet, JetEventInf double N90Constituents = 0; double caloWIDTH = 0; + float TG3 = 0; if (m_caloBased) { if (m_depth & ApplyN90Constituents) { //numConstituents = jet.numConstituents(); @@ -513,9 +534,12 @@ StatusCode GlobalSequentialCorrection::calibrateImpl(xAOD::Jet& jet, JetEventInf if (m_depth & ApplycaloWIDTH) { caloWIDTH = jet.getAttribute<double>("Width"); } + if (m_depth & ApplyTileGap3) { + TG3 = (samplingFrac[17])/jetE_constitscale; + } } - xAOD::JetFourMom_t calibP4 = jetStartP4*getGSCCorrection( jetStartP4, fabs(detectorEta), trackWIDTHPV0, nTrkPV0, Tile0, EM3, Nsegments, ChargedFraction, caloWIDTH, N90Constituents); + xAOD::JetFourMom_t calibP4 = jetStartP4*getGSCCorrection( jetStartP4, fabs(detectorEta), trackWIDTHPV0, nTrkPV0, Tile0, EM3, Nsegments, ChargedFraction, caloWIDTH, N90Constituents, TG3); //Transfer calibrated jet properties to the Jet object jet.setAttribute<xAOD::JetFourMom_t>("JetGSCScaleMomentum",calibP4);