CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/PhysicsTools/IsolationAlgos/interface/CalIsolationExtrapolate.h

Go to the documentation of this file.
00001 #ifndef IsolationAlgos_CalIsolationAlgo_h
00002 #define IsolationAlgos_CalIsolationAlgo_h
00003 /* Partial spacialization of parameter set adapeter helper
00004  *
00005  */
00006 #include "PhysicsTools/IsolationAlgos/interface/CalIsolationAlgo.h"
00007 #include "CommonTools/UtilAlgos/interface/ParameterAdapter.h"
00008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00009 #include "FWCore/Framework/interface/EventSetup.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 
00012 
00013 namespace helper {
00014 
00015   template<typename Alg>
00016   struct BFieldIsolationAlgorithmSetup {
00017     static void init( Alg & algo, const edm::EventSetup& es ) {
00018       edm::ESHandle<MagneticField> bFieldHandle;
00019       es.template get<IdealMagneticFieldRecord>().get( bFieldHandle );
00020       algo.setBfield( bFieldHandle.product() );
00021     }
00022   };
00023 
00024   template<typename T1, typename C2>
00025   struct IsolationAlgorithmSetup<CalIsolationAlgo<T1, C2> > {
00026     typedef BFieldIsolationAlgorithmSetup<CalIsolationAlgo<T1, C2> >
00027       type;
00028   };
00029 }
00030 
00031 
00032 namespace reco {
00033   namespace modules {
00034     
00035     template<typename T, typename C> 
00036     struct ParameterAdapter<CalIsolationAlgo<T, C> > { 
00037       static CalIsolationAlgo<T, C> make( const edm::ParameterSet & cfg ) {
00038           bool propagate = cfg.template getParameter<bool>( "PropagateToCal" );
00039           double r=0.0, minz=0.0, maxz=0.0;
00040           bool   material = false;
00041           //allow for undefined propagation-parameters, if no propagation is wanted
00042           if ( propagate ) {
00043             r        = cfg.template getParameter<double>( "CalRadius" );
00044             minz     = cfg.template getParameter<double>( "CalMinZ" );
00045             maxz     = cfg.template getParameter<double>( "CalMaxZ" );
00046             material = cfg.template getParameter<bool>( "IgnoreMaterial" );
00047           }  
00048           return CalIsolationAlgo<T, C>( cfg.template getParameter<double>( "dRMin" ), 
00049                                          cfg.template getParameter<double>( "dRMax" ),
00050                                          propagate, r, minz, maxz, material );
00051       }
00052     };
00053   }
00054 }
00055 
00056 #endif