ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/BaseFiller.cc
Revision: 1.8
Committed: Mon Jun 15 15:00:25 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, HEAD
Branch point for: Mit_025c_branch
Changes since 1.7: +11 -1 lines
Log Message:
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

File Contents

# Content
1 // $Id: BaseFiller.cc,v 1.7 2009/03/15 11:20:41 loizides Exp $
2
3 #include "MitProd/TreeFiller/interface/BaseFiller.h"
4 #include "MitAna/DataTree/interface/BranchName.h"
5 #include "MitAna/DataTree/interface/BranchTable.h"
6 #include "MitAna/DataTree/interface/Names.h"
7 #include "MitProd/TreeFiller/interface/FillMitTree.h"
8 #include "MitProd/ObjectService/interface/ObjectService.h"
9 #include <TSystem.h>
10 #include <TError.h>
11
12 using namespace std;
13 using namespace edm;
14 using namespace mithep;
15
16 //--------------------------------------------------------------------------------------------------
17 BaseFiller::BaseFiller(const ParameterSet &cfg, const char *name, bool active) :
18 name_(name),
19 brtname_(cfg.getUntrackedParameter<string>("brTabName",Names::gkBranchTable)),
20 config_(cfg.exists(name) ? cfg.getUntrackedParameter<ParameterSet>(name) : ParameterSet()),
21 active_(config_.getUntrackedParameter<bool>("active",active)),
22 verify_(config_.getUntrackedParameter<bool>("verify",false)),
23 verbose_(config_.getUntrackedParameter<int>("verbose",0)),
24 brtable_(0)
25 {
26 // Constructor.
27 }
28
29 //--------------------------------------------------------------------------------------------------
30 void BaseFiller::AddBranchDep(const char *n, const char *d)
31 {
32 // Add dependency between to given branch names to branch table if present.
33
34 if (!n || !d)
35 return;
36
37 if (!brtable_) {
38 brtable_ = OS()->mod<BranchTable>(brtname_.c_str());
39 if (!brtable_)
40 return;
41 }
42
43 std::string nstr(n);
44 if (nstr.empty())
45 return;
46
47 std::string dstr(d);
48 if (dstr.empty())
49 return;
50
51 if (!brtable_->Find(n,d))
52 brtable_->Add(new BranchName(n,d));
53 }
54
55 //--------------------------------------------------------------------------------------------------
56 ObjectService *BaseFiller::OS()
57 {
58 // Return ObjectService.
59
60 return FillMitTree::os();
61 }
62
63 //--------------------------------------------------------------------------------------------------
64 void BaseFiller::PrintErrorAndExit(const char *msg) const
65 {
66 // Print error message, and then terminate.
67
68 Error("PrintErrorAndExit", msg);
69 gSystem->Exit(1);
70 }