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.8 by loizides, Mon Jun 15 15:00:25 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 "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) :
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",true))
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines