UserUtils
EDNtupleProducer.hpp
1#include "CommonTools/UtilAlgos/interface/TFileService.h"
2#include "FWCore/Framework/interface/one/EDAnalyzer.h"
3#include "FWCore/ServiceRegistry/interface/Service.h"
4
5#include "UserUtils/EDMUtils/interface/PluginAlias.hpp"
6
7#include <memory>
8#include <vector>
9
10#include "TTree.h"
11
12namespace usr
13{
14
16{
17public:
18 EDNtupleProducer( const edm::ParameterSet&, const std::string& treename );
20
21protected:
22 edm::Service<TFileService> fs;
23 TTree* tree;
24
25 std::map<std::string,
26 std::unique_ptr<std::vector<float> > > _float_collection;
27 std::map<std::string, std::unique_ptr<std::vector<int> > > _int_collection;
28 std::map<std::string, std::unique_ptr<std::vector<bool> > > _bool_collection;
29
30 std::map<std::string, std::unique_ptr<float> > _float_map;
31 std::map<std::string, std::unique_ptr<int> > _int_map;
32 std::map<std::string, std::unique_ptr<bool> > _bool_map;
33
34 template<typename>
35 void AddCollection( const std::string& );
36
37 template<typename T>
38 std::vector<T>& Col( const std::string& );
39
40 template<typename>
41 void AddValue( const std::string& );
42
43 template<typename T>
44 void SetValue( const std::string&, const T );
45
46private:
47 void analyze( const edm::Event&, const edm::EventSetup& ) final;
48 virtual bool np_analyze( const edm::Event&, const edm::EventSetup& ) = 0;
49 void clear_collections();
50};
51
52}// namespace usr
Definition: EDNtupleProducer.hpp:16
class for reducing the verbosity of the various edm plugin calls.
Definition: PluginAlias.hpp:37