Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:32

0001 #include "PhysicsTools/IsolationUtils/interface/FixedAreaIsolationCone.h"
0002 
0003 // -*- C++ -*-
0004 //
0005 // Package:
0006 // Class:      FixedAreaIsolationCone
0007 //
0008 /**\class FixedAreaIsolationCone FixedAreaIsolationCone.cc PhysicsTools/IsolationUtils/src/FixedAreaIsolationCone.cc
0009 
0010  Description: highest level class to compute size of isolation cone 
0011               such that area weighted by particle density 
0012               (proportional to dEta/dTheta = 1/sin(theta)) 
0013               is constant
0014 
0015  Implementation:
0016      imported into CMSSW on 05/18/2007
0017 */
0018 //
0019 // Original Author: Christian Veelken, UC Davis
0020 //         Created: Wed May 16 13:47:40 CST 2007
0021 //
0022 //
0023 
0024 // C++ standard library include files
0025 #include <string>
0026 
0027 // ROOT include files
0028 #include <TMath.h>
0029 
0030 // CMSSW include files
0031 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0032 
0033 FixedAreaIsolationCone::FixedAreaIsolationCone() : areaFunctionSignalCone_(), areaRootFunctionIsolationCone_() {
0034   //--- nothing to be done yet
0035   //
0036   //    WARNING: do NOT call ROOT::Math::RootFinder<ROOT::Math::Roots::Brent>::SetFunction here;
0037   //             this will cause the function to be evaluated before all function parameters are set,
0038   //             leading to an error message first and erroneous behaviour of the root-finding later on !!!
0039   //
0040 }
0041 
0042 FixedAreaIsolationCone::~FixedAreaIsolationCone() {
0043   //--- nothing to be done yet
0044 }
0045 
0046 void FixedAreaIsolationCone::setAcceptanceLimit(double etaMaxTrackingAcceptance) {
0047   areaFunctionSignalCone_.SetAcceptanceLimit(etaMaxTrackingAcceptance);
0048   areaRootFunctionIsolationCone_.SetAcceptanceLimit(etaMaxTrackingAcceptance);
0049 }
0050 
0051 double FixedAreaIsolationCone::operator()(
0052     double coneAxisTheta, double coneAxisPhi, double openingAngleSignalCone, double areaIsolationCone, int& error) {
0053   areaFunctionSignalCone_.SetParameterTheta0(coneAxisTheta);
0054   areaFunctionSignalCone_.SetParameterPhi0(coneAxisPhi);
0055   double areaSignalCone = areaFunctionSignalCone_(openingAngleSignalCone);
0056 
0057   areaRootFunctionIsolationCone_.SetParameterTheta0(coneAxisTheta);
0058   areaRootFunctionIsolationCone_.SetParameterPhi0(coneAxisPhi);
0059   areaRootFunctionIsolationCone_.SetParameterConeArea(areaIsolationCone + areaSignalCone);
0060   areaRootFinderIsolationCone_.SetFunction(areaRootFunctionIsolationCone_, 0., TMath::Pi());
0061   int statusIsolationCone = areaRootFinderIsolationCone_.Solve();
0062   double openingAngleIsolationCone = areaRootFinderIsolationCone_.Root();
0063 
0064   if (debugLevel_ > 0) {
0065     const std::string category = "FixedAreaIsolationCone::operator()";
0066     edm::LogVerbatim(category) << "openingAngleSignalCone = " << openingAngleSignalCone << std::endl;
0067     edm::LogVerbatim(category) << "areaSignalCone = " << areaSignalCone << std::endl;
0068     edm::LogVerbatim(category) << "areaIsolationCone = " << areaIsolationCone << std::endl;
0069     edm::LogVerbatim(category) << "openingAngleIsolationCone = " << openingAngleIsolationCone << std::endl;
0070     edm::LogVerbatim(category) << "statusIsolationCone = " << statusIsolationCone << std::endl;
0071   }
0072 
0073   if (statusIsolationCone == 0) {
0074     error = 0;
0075     return openingAngleIsolationCone;
0076   } else {
0077     error = 1;
0078     return 0.;
0079   }
0080 }