1 |
|
// $Id$ |
2 |
|
|
3 |
+ |
#include "MitProd/TreeFiller/interface/FillMitTree.h" |
4 |
|
#include "FWCore/MessageLogger/interface/MessageLogger.h" |
4 |
– |
#include "FWCore/Framework/interface/ESHandle.h" |
5 |
– |
#include "DataFormats/Common/interface/Handle.h" |
5 |
|
#include "FWCore/ServiceRegistry/interface/Service.h" |
6 |
< |
|
7 |
< |
#include "MitProd/TreeFiller/interface/FillMitTree.h" |
6 |
> |
#include "MitProd/TreeService/interface/TreeService.h" |
7 |
> |
#include "MitProd/TreeFiller/interface/FillerMetaInfos.h" |
8 |
|
#include "MitProd/TreeFiller/interface/FillerGlobalMuons.h" |
9 |
|
|
10 |
|
using namespace std; |
16 |
|
{ |
17 |
|
// Constructor: initialize fillers |
18 |
|
|
19 |
< |
FillerGlobalMuons *fillerGlobalMuons = new FillerGlobalMuons(cfg); |
20 |
< |
if (fillerGlobalMuons->Active()) |
21 |
< |
fillers_.push_back(fillerGlobalMuons); |
22 |
< |
else |
24 |
< |
delete fillerGlobalMuons; |
19 |
> |
if (!configure(cfg)) { |
20 |
> |
throw edm::Exception(edm::errors::Configuration, "FillMitTree::FillMitTree()\n") |
21 |
> |
<< "Could not configure fillers." << "\n"; |
22 |
> |
} |
23 |
|
} |
24 |
|
|
25 |
|
//------------------------------------------------------------------------------------------------- |
29 |
|
} |
30 |
|
|
31 |
|
//------------------------------------------------------------------------------------------------- |
32 |
< |
void FillMitTree::beginJob(edm::EventSetup const &event) |
32 |
> |
void FillMitTree::analyze(const edm::Event &event, |
33 |
> |
const edm::EventSetup &setup) |
34 |
> |
{ |
35 |
> |
// Access and copy event content. |
36 |
> |
|
37 |
> |
// First step: Loop over the data fillers of the various components |
38 |
> |
for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) { |
39 |
> |
(*iF)->FillDataBlock(event,setup); |
40 |
> |
} |
41 |
> |
|
42 |
> |
// Second step: Loop over the link resolution of the various components |
43 |
> |
for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) { |
44 |
> |
(*iF)->ResolveLinks(event,setup); |
45 |
> |
} |
46 |
> |
} |
47 |
> |
|
48 |
> |
//------------------------------------------------------------------------------------------------- |
49 |
> |
void FillMitTree::beginJob(const edm::EventSetup &event) |
50 |
|
{ |
51 |
|
// Access the tree and book branches. |
52 |
|
|
66 |
|
} |
67 |
|
|
68 |
|
//------------------------------------------------------------------------------------------------- |
69 |
< |
void FillMitTree::analyze(const edm::Event &event, |
55 |
< |
const edm::EventSetup &setup) |
69 |
> |
bool FillMitTree::configure(const edm::ParameterSet &cfg) |
70 |
|
{ |
71 |
< |
// Access and copy event content. |
71 |
> |
// Configure our fillers. |
72 |
|
|
59 |
– |
// First step: Loop over the data fillers of the various components |
60 |
– |
for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) { |
61 |
– |
(*iF)->FillDataBlock(event,setup); |
62 |
– |
} |
73 |
|
|
74 |
< |
// Second step: Loop over the link resolution of the various components |
75 |
< |
for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) { |
76 |
< |
(*iF)->ResolveLinks(event,setup); |
77 |
< |
} |
74 |
> |
FillerMetaInfos *fillerMetaInfos = new FillerMetaInfos(cfg); |
75 |
> |
if (fillerMetaInfos->Active()) |
76 |
> |
fillers_.push_back(fillerMetaInfos); |
77 |
> |
else |
78 |
> |
delete fillerMetaInfos; |
79 |
> |
|
80 |
> |
FillerGlobalMuons *fillerGlobalMuons = new FillerGlobalMuons(cfg); |
81 |
> |
if (fillerGlobalMuons->Active()) |
82 |
> |
fillers_.push_back(fillerGlobalMuons); |
83 |
> |
else |
84 |
> |
delete fillerGlobalMuons; |
85 |
> |
|
86 |
> |
return 1; |
87 |
|
} |
88 |
|
|
89 |
|
//------------------------------------------------------------------------------------------------- |