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

Comparing UserCode/MitProd/TreeFiller/src/FillMitTree.cc (file contents):
Revision 1.37 by loizides, Thu Mar 19 16:15:35 2009 UTC vs.
Revision 1.41 by bendavid, Fri Mar 20 18:47:46 2009 UTC

# Line 11 | Line 11
11   #include "MitProd/TreeFiller/interface/FillerBeamSpot.h"
12   #include "MitProd/TreeFiller/interface/FillerCaloJets.h"
13   #include "MitProd/TreeFiller/interface/FillerCaloMet.h"
14 + #include "MitProd/TreeFiller/interface/FillerCaloTaus.h"
15   #include "MitProd/TreeFiller/interface/FillerCaloTowers.h"
16   #include "MitProd/TreeFiller/interface/FillerConversionElectrons.h"
17   #include "MitProd/TreeFiller/interface/FillerConversions.h"
# Line 26 | Line 27
27   #include "MitProd/TreeFiller/interface/FillerPFCandidates.h"
28   #include "MitProd/TreeFiller/interface/FillerPFJets.h"
29   #include "MitProd/TreeFiller/interface/FillerPFMet.h"
30 + #include "MitProd/TreeFiller/interface/FillerPFTaus.h"
31   #include "MitProd/TreeFiller/interface/FillerPhotons.h"
32   #include "MitProd/TreeFiller/interface/FillerStableParts.h"
33   #include "MitProd/TreeFiller/interface/FillerSuperClusters.h"
# Line 43 | Line 45 | mithep::ObjectService *mithep::FillMitTr
45   //--------------------------------------------------------------------------------------------------
46   FillMitTree::FillMitTree(const edm::ParameterSet &cfg) :
47    defactive_(cfg.getUntrackedParameter<bool>("defactive",1)),
48 <  brtable_(new BranchTable)
48 >  brtable_(0),
49 >  acfnumber_(-1)
50   {
51    // Constructor.
52  
# Line 51 | Line 54 | FillMitTree::FillMitTree(const edm::Para
54      throw edm::Exception(edm::errors::Configuration, "FillMitTree::FillMitTree()\n")
55        << "Could not configure fillers." << "\n";
56    }
54
55  brtable_->SetName(Names::gkBranchTable);
56  brtable_->SetOwner();
57   }
58  
59   //--------------------------------------------------------------------------------------------------
# Line 97 | Line 97 | void FillMitTree::analyze(const edm::Eve
97    for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
98      (*iF)->ResolveLinks(event,setup);
99    }
100 +
101 +  if (brtable_) { // only the first FillMitTree object has to deal with the branch table
102 +    if (acfnumber_==-1) {
103 +      brtable_->Rehash(brtable_->GetSize());
104 +      if (0)
105 +        brtable_->Print();
106 +    }
107 +    if (acfnumber_ != tws_->GetFileNumber()) {
108 +      tws_->StoreObject(brtable_);
109 +      acfnumber_ = tws_->GetFileNumber();
110 +    }
111 +  }
112   }
113  
114   //--------------------------------------------------------------------------------------------------
# Line 105 | Line 117 | void FillMitTree::beginJob(const edm::Ev
117    // Access the tree and book branches.
118  
119    Service<TreeService> ts;
120 <  TreeWriter *tws = ts->get();
121 <  if (! tws) {
120 >  tws_ = ts->get();
121 >  if (!tws_) {
122      throw edm::Exception(edm::errors::Configuration, "FillMitTree::beginJob()\n")
123        << "Could not get pointer to tree. "
124        << "Do you have the TreeServie define in your config?" << "\n";
125      return;
126    }
127  
128 <  if (os_==0) {
128 >  if (os_==0) { // only the first FillMitTree object has to deal with this
129      Service<ObjectService> os;
130      if (!os.isAvailable()) {
131        throw edm::Exception(edm::errors::Configuration, "FillMitTree::beginJob()\n")
# Line 122 | Line 134 | void FillMitTree::beginJob(const edm::Ev
134        return;
135      }
136      os_ = &(*os);
137 +    brtable_ = new BranchTable;
138 +    brtable_->SetName(Names::gkBranchTable);
139 +    brtable_->SetOwner();
140      os->add(brtable_, brtable_->GetName());
141    }
142  
143    // loop over the various components and book the branches
144    for (std::vector<BaseFiller*>::iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
145      edm::LogInfo("FillMitTree::beginJob") << "Booking for " << (*iF)->Name() << endl;
146 <    (*iF)->BookDataBlock(*tws);
146 >    (*iF)->BookDataBlock(*tws_);
147    }
148   }
149  
# Line 187 | Line 202 | bool FillMitTree::configure(const edm::P
202        addActiveFiller(fillerBeamSpot);
203        continue;
204      }
205 +  
206      if (ftype.compare("FillerVertexes")==0) {
207        FillerVertexes *fillerVertexes = new FillerVertexes(cfg, name.c_str(), defactive_);
208        addActiveFiller(fillerVertexes);
# Line 303 | Line 319 | bool FillMitTree::configure(const edm::P
319        addActiveFiller(fillerPFJets);
320        continue;
321      }  
322 +
323 +    if (ftype.compare("FillerCaloTaus")==0) {
324 +      FillerCaloTaus *fillerCaloTaus = new FillerCaloTaus(cfg, name.c_str(), defactive_);
325 +      addActiveFiller(fillerCaloTaus);
326 +      continue;
327 +    }
328 +    
329 +    if (ftype.compare("FillerPFTaus")==0) {
330 +      FillerPFTaus *fillerPFTaus = new FillerPFTaus(cfg, name.c_str(), defactive_);
331 +      addActiveFiller(fillerPFTaus);
332 +      continue;
333 +    }  
334      
335      edm::LogError("FillMitTree")
336        << "Unknown fillerType " << ftype << " for pset named " << name << std::endl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines