CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IsolationProducer.h
Go to the documentation of this file.
1 #ifndef IsolationAlgos_IsolationProducer_h
2 #define IsolationAlgos_IsolationProducer_h
3 /* \class IsolationProducer<C1, C2, Algo>
4  *
5  * \author Francesco Fabozzi, INFN
6  *
7  * template class to store isolation
8  *
9  */
18 #include <vector>
19 
20 namespace helper {
21 
22  template<typename Alg>
24  static void init( Alg &, const edm::EventSetup& ) { }
25  };
26 
27  template<typename Alg>
30  };
31 }
32 
33 template <typename C1, typename C2, typename Alg,
35  std::vector<typename Alg::value_type> >,
36  typename Setup = typename helper::IsolationAlgorithmSetup<Alg>::type>
38 public:
41 
42 private:
43  void produce( edm::Event&, const edm::EventSetup& );
45  Alg alg_;
46 };
47 
48 template <typename C1, typename C2, typename Alg, typename OutputCollection, typename Setup>
50  src_( cfg.template getParameter<edm::InputTag>( "src" ) ),
51  elements_( cfg.template getParameter<edm::InputTag>( "elements" ) ),
52  alg_( reco::modules::make<Alg>( cfg ) ) {
53  produces<OutputCollection>();
54 }
55 
56 template <typename C1, typename C2, typename Alg, typename OutputCollection, typename Setup>
58 }
59 
60 template <typename C1, typename C2, typename Alg, typename OutputCollection, typename Setup>
62  using namespace edm;
63  using namespace std;
66  evt.getByLabel( src_, src );
67  evt.getByLabel( elements_, elements );
68 
69  Setup::init( alg_, es );
70 
71  typename OutputCollection::refprod_type ref( src );
72  auto_ptr<OutputCollection> isolations( new OutputCollection( ref ) );
73 
74  size_t i = 0;
75  for( typename C1::const_iterator lep = src->begin(); lep != src->end(); ++ lep ) {
76  typename Alg::value_type iso= alg_(*lep,*elements);
77  isolations->setValue( i++, iso );
78  }
79  evt.put( isolations );
80 }
81 
82 #endif
int i
Definition: DBlmapReader.cc:9
std::vector< ProtoJet > OutputCollection
Definition: JetRecoTypes.h:63
static void init(Alg &, const edm::EventSetup &)
int init
Definition: HydjetWrapper.h:63
S make(const edm::ParameterSet &cfg)
list elements
Definition: asciidump.py:414
edm::InputTag elements_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
void produce(edm::Event &, const edm::EventSetup &)
edm::InputTag src_
IsolationProducer(const edm::ParameterSet &)
NullIsolationAlgorithmSetup< Alg > type
def template
Definition: svgfig.py:520
tuple src
Definition: align_tpl.py:87