1 |
auterman |
1.1 |
#ifndef IsolationAlgos_CalIsolationAlgo_h
|
2 |
|
|
#define IsolationAlgos_CalIsolationAlgo_h
|
3 |
|
|
/* Partial spacialization of parameter set adapeter helper
|
4 |
|
|
*
|
5 |
|
|
*/
|
6 |
|
|
#include "PhysicsTools/IsolationUtils/interface/CalIsolationAlgo.h"
|
7 |
|
|
#include "PhysicsTools/UtilAlgos/interface/ParameterAdapter.h"
|
8 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
9 |
|
|
#include "FWCore/Framework/interface/EventSetup.h"
|
10 |
|
|
#include "FWCore/Framework/interface/ESHandle.h"
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
namespace helper {
|
14 |
|
|
|
15 |
|
|
template<typename Alg>
|
16 |
|
|
struct BFieldIsolationAlgorithmSetup {
|
17 |
|
|
static void init( Alg & algo, const edm::EventSetup& es ) {
|
18 |
|
|
edm::ESHandle<MagneticField> bFieldHandle;
|
19 |
|
|
es.template get<IdealMagneticFieldRecord>().get( bFieldHandle );
|
20 |
|
|
algo.setBfield( bFieldHandle.product() );
|
21 |
|
|
}
|
22 |
|
|
};
|
23 |
|
|
|
24 |
|
|
template<typename T1, typename C2>
|
25 |
|
|
struct IsolationAlgorithmSetup<CalIsolationAlgo<T1, C2> > {
|
26 |
|
|
typedef BFieldIsolationAlgorithmSetup<CalIsolationAlgo<T1, C2> >
|
27 |
|
|
type;
|
28 |
|
|
};
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
namespace reco {
|
33 |
|
|
namespace modules {
|
34 |
|
|
|
35 |
|
|
template<typename T, typename C>
|
36 |
|
|
struct ParameterAdapter<CalIsolationAlgo<T, C> > {
|
37 |
|
|
static CalIsolationAlgo<T, C> make( const edm::ParameterSet & cfg ) {
|
38 |
|
|
bool propagate = cfg.template getParameter<bool>( "PropagateToCal" );
|
39 |
|
|
double r=0.0, minz=0.0, maxz=0.0;
|
40 |
|
|
bool material = false;
|
41 |
|
|
//allow for undefined propagation-parameters, if no propagation is wanted
|
42 |
|
|
if ( propagate ) {
|
43 |
|
|
r = cfg.template getParameter<double>( "CalRadius" );
|
44 |
|
|
minz = cfg.template getParameter<double>( "CalMinZ" );
|
45 |
|
|
maxz = cfg.template getParameter<double>( "CalMaxZ" );
|
46 |
|
|
material = cfg.template getParameter<bool>( "IgnoreMaterial" );
|
47 |
|
|
}
|
48 |
|
|
return CalIsolationAlgo<T, C>( cfg.template getParameter<double>( "dRMin" ),
|
49 |
|
|
cfg.template getParameter<double>( "dRMax" ),
|
50 |
|
|
propagate, r, minz, maxz, material );
|
51 |
|
|
}
|
52 |
|
|
};
|
53 |
|
|
}
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
#endif
|