ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/BaseFiller.cc
(Generate patch)

Comparing UserCode/MitProd/TreeFiller/src/BaseFiller.cc (file contents):
Revision 1.3 by loizides, Thu Jun 19 16:53:43 2008 UTC vs.
Revision 1.7 by loizides, Sun Mar 15 11:20:41 2009 UTC

# Line 1 | Line 1
1   // $Id$
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 <TSystem.h>
8 + #include <TError.h>
9  
10   using namespace std;
11   using namespace edm;
12   using namespace mithep;
13  
14   //--------------------------------------------------------------------------------------------------
15 < BaseFiller::BaseFiller(const ParameterSet &cfg, const char *name) :
15 > BaseFiller::BaseFiller(const ParameterSet &cfg, const char *name, bool active) :
16    name_(name),
17 +  brtname_(cfg.getUntrackedParameter<string>("brTabName",Names::gkBranchTable)),
18    config_(cfg.exists(name) ? cfg.getUntrackedParameter<ParameterSet>(name) : ParameterSet()),
19 <  active_(config_.getUntrackedParameter<bool>("active",true))
19 >  active_(config_.getUntrackedParameter<bool>("active",active)),
20 >  verify_(config_.getUntrackedParameter<bool>("verify",false)),
21 >  verbose_(config_.getUntrackedParameter<int>("verbose",0)),
22 >  brtable_(0)
23   {
24 +  // Constructor.
25 + }
26 +
27 + //--------------------------------------------------------------------------------------------------
28 + void BaseFiller::AddBranchDep(const char *n, const char *d)
29 + {
30 +  // Add dependency between to given branch names to branch table if present.
31 +
32 +  if (!n || !d)
33 +    return;
34 +
35 +  if (!brtable_) {
36 +    brtable_ = OS()->mod<BranchTable>(brtname_.c_str());
37 +    if (!brtable_)
38 +      return;
39 +  }
40 +
41 +  std::string nstr(n);
42 +  if (nstr.empty())
43 +    return;
44 +
45 +  std::string dstr(d);
46 +  if (dstr.empty())
47 +    return;
48 +
49 +  if (!brtable_->Find(n,d))
50 +    brtable_->Add(new BranchName(n,d));
51 + }
52 +
53 + //--------------------------------------------------------------------------------------------------
54 + void BaseFiller::PrintErrorAndExit(const char *msg) const
55 + {
56 +  // Print error message, and then terminate.
57 +
58 +  Error("PrintErrorAndExit", msg);
59 +  gSystem->Exit(1);
60   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines