CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/PhysicsTools/IsolationUtils/src/FixedAreaIsolationCone.cc

Go to the documentation of this file.
00001 #include "PhysicsTools/IsolationUtils/interface/FixedAreaIsolationCone.h"
00002 
00003 // -*- C++ -*-
00004 //
00005 // Package:    
00006 // Class:      FixedAreaIsolationCone
00007 // 
00018 //
00019 // Original Author: Christian Veelken, UC Davis
00020 //         Created: Wed May 16 13:47:40 CST 2007
00021 // $Id: FixedAreaIsolationCone.cc,v 1.1 2007/05/23 20:21:38 veelken Exp $
00022 //
00023 //
00024 
00025 // C++ standard library include files
00026 #include <string>
00027 
00028 // ROOT include files
00029 #include <TMath.h>
00030 
00031 // CMSSW include files
00032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00033 
00034 FixedAreaIsolationCone::FixedAreaIsolationCone()
00035   : areaFunctionSignalCone_(), areaRootFunctionIsolationCone_()
00036 {
00037 //--- nothing to be done yet
00038 //
00039 //    WARNING: do NOT call ROOT::Math::RootFinder<ROOT::Math::Roots::Brent>::SetFunction here;
00040 //             this will cause the function to be evaluated before all function parameters are set,
00041 //             leading to an error message first and erroneous behaviour of the root-finding later on !!!
00042 //
00043 }
00044 
00045 FixedAreaIsolationCone::~FixedAreaIsolationCone()
00046 {
00047 //--- nothing to be done yet
00048 }
00049 
00050 void FixedAreaIsolationCone::setAcceptanceLimit(double etaMaxTrackingAcceptance)
00051 {
00052   areaFunctionSignalCone_.SetAcceptanceLimit(etaMaxTrackingAcceptance);
00053   areaRootFunctionIsolationCone_.SetAcceptanceLimit(etaMaxTrackingAcceptance);
00054 }
00055 
00056 double FixedAreaIsolationCone::operator() (double coneAxisTheta, double coneAxisPhi,
00057                                            double openingAngleSignalCone, double areaIsolationCone, int& error)
00058 {
00059   areaFunctionSignalCone_.SetParameterTheta0(coneAxisTheta);
00060   areaFunctionSignalCone_.SetParameterPhi0(coneAxisPhi);
00061   double areaSignalCone = areaFunctionSignalCone_(openingAngleSignalCone);
00062 
00063   areaRootFunctionIsolationCone_.SetParameterTheta0(coneAxisTheta);
00064   areaRootFunctionIsolationCone_.SetParameterPhi0(coneAxisPhi);
00065   areaRootFunctionIsolationCone_.SetParameterConeArea(areaIsolationCone + areaSignalCone);
00066   areaRootFinderIsolationCone_.SetFunction(areaRootFunctionIsolationCone_, 0. , TMath::Pi());
00067   int statusIsolationCone = areaRootFinderIsolationCone_.Solve();
00068   double openingAngleIsolationCone = areaRootFinderIsolationCone_.Root();
00069 
00070   if ( debugLevel_ > 0 ) {
00071     const std::string category = "FixedAreaIsolationCone::operator()";
00072     edm::LogVerbatim(category) << "openingAngleSignalCone = " << openingAngleSignalCone << std::endl;
00073     edm::LogVerbatim(category) << "areaSignalCone = " << areaSignalCone << std::endl;
00074     edm::LogVerbatim(category) << "areaIsolationCone = " << areaIsolationCone << std::endl;
00075     edm::LogVerbatim(category) << "openingAngleIsolationCone = " << openingAngleIsolationCone << std::endl;
00076     edm::LogVerbatim(category) << "statusIsolationCone = " << statusIsolationCone << std::endl;
00077   }
00078 
00079   if ( statusIsolationCone == 0 ) { 
00080     error = 0;
00081     return openingAngleIsolationCone;
00082   } else {
00083     error = 1;
00084     return 0.;
00085   }
00086 }