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.23 by sixie, Mon Sep 29 17:07:56 2008 UTC vs.
Revision 1.55 by bendavid, Wed Feb 24 17:38:27 2010 UTC

# Line 2 | Line 2
2  
3   #include "MitProd/TreeFiller/interface/FillMitTree.h"
4   #include "FWCore/MessageLogger/interface/MessageLogger.h"
5 + #include "FWCore/ParameterSet/interface/ParameterSet.h"
6   #include "FWCore/ServiceRegistry/interface/Service.h"
6 #include "MitProd/TreeService/interface/TreeService.h"
7   #include "MitProd/ObjectService/interface/ObjectService.h"
8   #include "MitProd/TreeFiller/interface/AssociationMaps.h"
9 #include "MitProd/TreeFiller/interface/FillerMetaInfos.h"
10 #include "MitProd/TreeFiller/interface/FillerTracks.h"
11 #include "MitProd/TreeFiller/interface/FillerGsfTracks.h"
9   #include "MitProd/TreeFiller/interface/FillerBasicClusters.h"
10 < #include "MitProd/TreeFiller/interface/FillerSuperClusters.h"
14 < #include "MitProd/TreeFiller/interface/FillerCaloTowers.h"
15 < #include "MitProd/TreeFiller/interface/FillerMuons.h"
16 < #include "MitProd/TreeFiller/interface/FillerElectrons.h"
17 < #include "MitProd/TreeFiller/interface/FillerGenJets.h"
10 > #include "MitProd/TreeFiller/interface/FillerBeamSpot.h"
11   #include "MitProd/TreeFiller/interface/FillerCaloJets.h"
12   #include "MitProd/TreeFiller/interface/FillerCaloMet.h"
13 + #include "MitProd/TreeFiller/interface/FillerCaloTaus.h"
14 + #include "MitProd/TreeFiller/interface/FillerCaloTowers.h"
15   #include "MitProd/TreeFiller/interface/FillerConversions.h"
21 #include "MitProd/TreeFiller/interface/FillerConversionElectrons.h"
22 #include "MitProd/TreeFiller/interface/FillerPhotons.h"
23 #include "MitProd/TreeFiller/interface/FillerMCParticles.h"
16   #include "MitProd/TreeFiller/interface/FillerDecayParts.h"
17 + #include "MitProd/TreeFiller/interface/FillerElectrons.h"
18 + #include "MitProd/TreeFiller/interface/FillerEvtSelData.h"
19 + #include "MitProd/TreeFiller/interface/FillerGenJets.h"
20 + #include "MitProd/TreeFiller/interface/FillerGenMet.h"
21 + #include "MitProd/TreeFiller/interface/FillerMCEventInfo.h"
22 + #include "MitProd/TreeFiller/interface/FillerMCParticles.h"
23 + #include "MitProd/TreeFiller/interface/FillerMCVertexes.h"
24 + #include "MitProd/TreeFiller/interface/FillerMet.h"
25 + #include "MitProd/TreeFiller/interface/FillerMetaInfos.h"
26 + #include "MitProd/TreeFiller/interface/FillerMetaInfos.h"
27 + #include "MitProd/TreeFiller/interface/FillerMuons.h"
28 + #include "MitProd/TreeFiller/interface/FillerPFCandidates.h"
29 + #include "MitProd/TreeFiller/interface/FillerPFJets.h"
30 + #include "MitProd/TreeFiller/interface/FillerPFMet.h"
31 + #include "MitProd/TreeFiller/interface/FillerPFTaus.h"
32 + #include "MitProd/TreeFiller/interface/FillerPhotons.h"
33 + #include "MitProd/TreeFiller/interface/FillerPixelHits.h"
34   #include "MitProd/TreeFiller/interface/FillerStableParts.h"
35 < #include "MitProd/TreeFiller/interface/FillerPATMuons.h"
36 < #include "MitProd/TreeFiller/interface/FillerPATElectrons.h"
35 > #include "MitProd/TreeFiller/interface/FillerStripHits.h"
36 > #include "MitProd/TreeFiller/interface/FillerSuperClusters.h"
37 > #include "MitProd/TreeFiller/interface/FillerTrackJets.h"
38 > #include "MitProd/TreeFiller/interface/FillerTracks.h"
39 > #include "MitProd/TreeFiller/interface/FillerVertexes.h"
40 > #include "MitAna/DataTree/interface/Names.h"
41 > #include "MitAna/DataTree/interface/BranchTable.h"
42 > #include "MitCommon/OptIO/interface/OptInt.h"
43  
44   using namespace std;
45   using namespace edm;
# Line 34 | Line 49 | mithep::ObjectService *mithep::FillMitTr
49  
50   //--------------------------------------------------------------------------------------------------
51   FillMitTree::FillMitTree(const edm::ParameterSet &cfg) :
52 <  defactive_(cfg.getUntrackedParameter<bool>("defactive",1))
52 >  defactive_(cfg.getUntrackedParameter<bool>("defactive",1)),
53 >  brtable_(0),
54 >  acfnumber_(-1),
55 >  tws_(new TreeWriter(Names::gkEvtTreeName,0))
56   {
57    // Constructor.
58  
# Line 47 | Line 65 | FillMitTree::FillMitTree(const edm::Para
65   //--------------------------------------------------------------------------------------------------
66   FillMitTree::~FillMitTree()
67   {
68 <  // Destructor: nothing to be done here.
68 >  // Destructor.
69 >
70 >  delete brtable_;
71 >  delete tws_;
72   }
73  
74   //--------------------------------------------------------------------------------------------------
# Line 55 | Line 76 | bool FillMitTree::addActiveFiller(BaseFi
76   {
77    // Check if filler is active and add it to list of fillers. Otherwise delete it.
78  
79 +  if (!bf)
80 +    return 0;
81 +
82    if (bf->Active()) {
83      fillers_.push_back(bf);
84      return 1;
# Line 66 | Line 90 | bool FillMitTree::addActiveFiller(BaseFi
90   }
91  
92   //--------------------------------------------------------------------------------------------------
93 + void FillMitTree::beginRun(edm::Run const &run, edm::EventSetup const &setup)
94 + {
95 +
96 +  // loop over the various components and book the branches
97 +  for (std::vector<BaseFiller*>::iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
98 +    edm::LogInfo("FillMitTree::beginJob") << "Booking for " << (*iF)->Name() << endl;
99 +    (*iF)->BookDataBlock(*tws_, setup);
100 +  }
101 +
102 +  // call branch ref for the event tree
103 +  if (brtable_ && tws_->GetTree())
104 +    tws_->GetTree()->BranchRef();
105 +
106 +  // Access and copy event content.
107 +
108 +  // first step: Loop over the data fillers of the various components
109 +  for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
110 +    (*iF)->FillRunBlock(run,setup);
111 +  }
112 +
113 + }
114 +
115 + //--------------------------------------------------------------------------------------------------
116   void FillMitTree::analyze(const edm::Event      &event,
117                            const edm::EventSetup &setup)
118   {
119    // Access and copy event content.
120 +  
121 +  //tree writer begin event actions
122 +  tws_->BeginEvent(kTRUE);
123  
124 <  // First step: Loop over the data fillers of the various components
124 >  // first step: Loop over the data fillers of the various components
125    for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
126      (*iF)->FillDataBlock(event,setup);
127    }
128  
129 <  // Second step: Loop over the link resolution of the various components
129 >  // second step: Loop over the link resolution of the various components
130    for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
131      (*iF)->ResolveLinks(event,setup);
132    }
133 +
134 +  if (brtable_) { // only the first FillMitTree object has to deal with the branch table
135 +    if (acfnumber_==-1) {
136 +      brtable_->Rehash(brtable_->GetSize());
137 +      if (0)
138 +        brtable_->Print();
139 +    }
140 +    if (acfnumber_ != tws_->GetFileNumber()) {
141 +      tws_->StoreObject(brtable_);
142 +      acfnumber_ = tws_->GetFileNumber();
143 +    }
144 +  }
145 +  
146 +  //tree writer end of event actions
147 +  tws_->EndEvent(kTRUE);
148 +  
149   }
150  
151   //--------------------------------------------------------------------------------------------------
152 < void FillMitTree::beginJob(const edm::EventSetup &event)
152 > void FillMitTree::beginJob()
153   {
154    // Access the tree and book branches.
155  
156 <  Service<TreeService> ts;
91 <  TreeWriter *tws = ts->get();
92 <  if (! tws) {
93 <    throw edm::Exception(edm::errors::Configuration, "FillMitTree::beginJob()\n")
94 <      << "Could not get pointer to tree. "
95 <      << "Do you have the TreeServie define in your config?" << "\n";
96 <    return;
97 <  }
98 <
99 <  if (os_==0) {
156 >  if (os_==0) { // only the first FillMitTree object has to deal with this
157      Service<ObjectService> os;
158      if (!os.isAvailable()) {
159        throw edm::Exception(edm::errors::Configuration, "FillMitTree::beginJob()\n")
# Line 105 | Line 162 | void FillMitTree::beginJob(const edm::Ev
162        return;
163      }
164      os_ = &(*os);
165 +    brtable_ = new BranchTable;
166 +    brtable_->SetName(Names::gkBranchTable);
167 +    brtable_->SetOwner();
168 +    os->add(brtable_, brtable_->GetName());
169    }
170  
110  // Loop over the various components and book the branches
111  for (std::vector<BaseFiller*>::iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
112    edm::LogInfo("FillMitTree::beginJob") << "Booking for " << (*iF)->Name() << endl;
113    (*iF)->BookDataBlock(*tws);
114  }
171   }
172  
173   //--------------------------------------------------------------------------------------------------
174   bool FillMitTree::configure(const edm::ParameterSet &cfg)
175   {
120  // Configure our fillers.
121
122  FillerMetaInfos *fillerMetaInfos = new FillerMetaInfos(cfg,defactive_);
123  addActiveFiller(fillerMetaInfos);
124
125  FillerMCParticles *fillerMCParticles = new FillerMCParticles(cfg,"MCParticles",defactive_);
126  addActiveFiller(fillerMCParticles);
176  
177 <  FillerCaloTowers *fillerCaloTowers =
178 <    new FillerCaloTowers(cfg, "CaloTowers", defactive_);
179 <  addActiveFiller(fillerCaloTowers);
180 <
181 <  FillerGenJets *fillerIC5GenJets = new FillerGenJets(cfg,"IC5GenJets",defactive_);
133 <  addActiveFiller(fillerIC5GenJets);
134 <
135 <  FillerGenJets *fillerSC5GenJets = new FillerGenJets(cfg,"SC5GenJets",defactive_);
136 <  addActiveFiller(fillerSC5GenJets);
177 >  // Configure TreeWriter
178 >  const std::string twsConfigName("TreeWriter");
179 >  ParameterSet twsConfig;
180 >  if (cfg.existsAs<ParameterSet>(twsConfigName,0))
181 >    twsConfig = cfg.getUntrackedParameter<ParameterSet>(twsConfigName);
182    
183 <  FillerGenJets *fillerSC7GenJets = new FillerGenJets(cfg,"SC7GenJets",defactive_);
139 <  addActiveFiller(fillerSC7GenJets);
140 <
141 <  FillerGenJets *fillerKT4GenJets = new FillerGenJets(cfg,"KT4GenJets",defactive_);
142 <  addActiveFiller(fillerKT4GenJets);
183 >  configureTreeWriter(twsConfig);
184    
185 <  FillerGenJets *fillerKT6GenJets = new FillerGenJets(cfg,"KT6GenJets",defactive_);
145 <  addActiveFiller(fillerKT6GenJets);
146 <
147 <  FillerCaloJets *fillerCaloJets = new FillerCaloJets(cfg,"CaloJets",defactive_);
148 <  addActiveFiller(fillerCaloJets);
149 <
150 <  FillerCaloJets *fillerItrCone5Jets = new FillerCaloJets(cfg,"ItrCone5Jets",defactive_);
151 <  addActiveFiller(fillerItrCone5Jets);
185 >  // Configure our fillers according to given parameter ("fillers").
186  
187 <  FillerCaloJets *fillerSisCone5Jets = new FillerCaloJets(cfg,"SisCone5Jets",defactive_);
188 <  addActiveFiller(fillerSisCone5Jets);
189 <
190 <  FillerCaloJets *fillerSisCone7Jets = new FillerCaloJets(cfg,"SisCone7Jets",defactive_);
191 <  addActiveFiller(fillerSisCone7Jets);
187 >  std::vector<std::string> pars;
188 >  if (cfg.exists("fillers"))
189 >    pars=cfg.getUntrackedParameter<vector<string> >("fillers");
190 >  else
191 >    cfg.getParameterSetNames(pars, false);
192 >
193 >  // loop over psets
194 >  for (unsigned int i = 0; i<pars.size(); ++i) {
195 >
196 >    const string name(pars.at(i));
197 >
198 >    string ftype("Filler" + name);
199 >    if (cfg.existsAs<ParameterSet>(name,0)) {
200 >      ParameterSet next(cfg.getUntrackedParameter<ParameterSet>(name));
201 >      if (!next.exists("fillerType")) {
202 >        edm::LogError("FillMitTree") << "Cannot determine fillerType for pset named "
203 >                                     << name << std::endl;
204 >        throw edm::Exception(edm::errors::Configuration, "FillMitTree::configure\n")
205 >          << "Cannot determine fillerType for pset named "
206 >          << name << std::endl;
207 >      }
208 >      ftype = next.getUntrackedParameter<string>("fillerType");
209 >    }
210  
211 <  FillerCaloJets *fillerKt4Jets = new FillerCaloJets(cfg,"Kt4Jets",defactive_);
212 <  addActiveFiller(fillerKt4Jets);    
161 <  
162 <  FillerCaloJets *fillerKt6Jets = new FillerCaloJets(cfg,"Kt6Jets",defactive_);
163 <  addActiveFiller(fillerKt6Jets);
211 >    edm::LogInfo("FillMitTree") << "Attempting to configure '" << ftype
212 >                                << "' for '" << name << "'" << std::endl;
213  
214 <  FillerCaloMet *fillerCaloMet = new FillerCaloMet(cfg,"CaloMet",defactive_);
215 <  addActiveFiller(fillerCaloMet);
214 >    if (ftype.compare("FillerMetaInfos")==0) {
215 >      FillerMetaInfos *fillerMetaInfos = new FillerMetaInfos(cfg, name.c_str(), defactive_);
216 >      addActiveFiller(fillerMetaInfos);
217 >      continue;
218 >    }
219  
220 <  FillerCaloMet *fillerItrCone5Met = new FillerCaloMet(cfg,"ItrCone5Met",defactive_);
221 <  addActiveFiller(fillerItrCone5Met);
222 <  
223 <  FillerCaloMet *fillerSisCone5Met = new FillerCaloMet(cfg,"SisCone5Met",defactive_);
224 <  addActiveFiller(fillerSisCone5Met);
173 <  
174 <  FillerCaloMet *fillerSisCone7Met = new FillerCaloMet(cfg,"SisCone7Met",defactive_);
175 <  addActiveFiller(fillerSisCone7Met);
220 >    if (ftype.compare("FillerMCParticles")==0) {
221 >      FillerMCParticles *fillerMCParticles = new FillerMCParticles(cfg, name.c_str(), defactive_);
222 >      addActiveFiller(fillerMCParticles);
223 >      continue;
224 >    }
225  
226 <  FillerCaloMet *fillerKt4Met = new FillerCaloMet(cfg,"Kt4Met",defactive_);
227 <  addActiveFiller(fillerKt4Met);
228 <  
229 <  FillerCaloMet *fillerKt6Met = new FillerCaloMet(cfg,"Kt6Met",defactive_);
230 <  addActiveFiller(fillerKt6Met);  
226 >    if (ftype.compare("FillerMCEventInfo")==0) {
227 >      FillerMCEventInfo *fillerMCEventInfo = new FillerMCEventInfo(cfg, name.c_str(), defactive_);
228 >      addActiveFiller(fillerMCEventInfo);
229 >      continue;
230 >    }
231  
232 <  FillerTracks *fillerGeneralTracks = new FillerTracks(cfg,"GeneralTracks",defactive_);
233 <  addActiveFiller(fillerGeneralTracks);
232 >    if (ftype.compare("FillerMCVertexes")==0) {
233 >      FillerMCVertexes *fillerMCVertexes = new FillerMCVertexes(cfg, name.c_str(), defactive_);
234 >      addActiveFiller(fillerMCVertexes);
235 >      continue;
236 >    }  
237 >
238 >    if (ftype.compare("FillerEvtSelData")==0) {
239 >      FillerEvtSelData *fillerEvtSelData = new FillerEvtSelData(cfg, name.c_str(), defactive_);
240 >      addActiveFiller(fillerEvtSelData);
241 >      continue;
242 >    }
243  
244 <  FillerTracks *fillerStandaloneMuonTracks =
245 <    new FillerTracks(cfg,"StandaloneMuonTracks",defactive_);
246 <  addActiveFiller(fillerStandaloneMuonTracks);
247 <
248 <  FillerTracks *fillerStandaloneMuonTracksVtx =
191 <    new FillerTracks(cfg,"StandaloneMuonTracksWVtxConstraint",defactive_);
192 <  addActiveFiller(fillerStandaloneMuonTracksVtx);
244 >    if (ftype.compare("FillerBeamSpot")==0) {
245 >      FillerBeamSpot *fillerBeamSpot = new FillerBeamSpot(cfg, name.c_str(), defactive_);
246 >      addActiveFiller(fillerBeamSpot);
247 >      continue;
248 >    }
249  
250 <  FillerTracks *fillerGlobalMuonTracks = new FillerTracks(cfg,"GlobalMuonTracks",defactive_);
251 <  addActiveFiller(fillerGlobalMuonTracks);
250 >    if (ftype.compare("FillerVertexes")==0) {
251 >      FillerVertexes *fillerVertexes = new FillerVertexes(cfg, name.c_str(), defactive_);
252 >      addActiveFiller(fillerVertexes);
253 >      continue;
254 >    }  
255 >
256 >    if (ftype.compare("FillerCaloTowers")==0) {
257 >      FillerCaloTowers *fillerCaloTowers = new FillerCaloTowers(cfg, name.c_str(), defactive_);
258 >      addActiveFiller(fillerCaloTowers);
259 >      continue;
260 >    }  
261 >
262 >    if (ftype.compare("FillerGenJets")==0) {
263 >      FillerGenJets *fillerGenJets = new FillerGenJets(cfg, name.c_str(), defactive_);
264 >      addActiveFiller(fillerGenJets);
265 >      continue;
266 >    }  
267 >
268 >    if (ftype.compare("FillerCaloJets")==0) {
269 >      FillerCaloJets *fillerCaloJets = new FillerCaloJets(cfg, name.c_str(), defactive_);
270 >      addActiveFiller(fillerCaloJets);
271 >      continue;
272 >    }  
273      
274 <  FillerTracks *fillerConversionInOutTracks =
275 <    new FillerTracks(cfg,"ConversionInOutTracks",defactive_);
276 <  addActiveFiller(fillerConversionInOutTracks);
277 <
278 <  FillerTracks *fillerConversionOutInTracks =
279 <    new FillerTracks(cfg,"ConversionOutInTracks",defactive_);
280 <  addActiveFiller(fillerConversionOutInTracks);
281 <
282 <  FillerGsfTracks *fillerGsfTracks = new FillerGsfTracks(cfg,"GsfTracks",defactive_);
283 <  addActiveFiller(fillerGsfTracks);
284 <
285 <  FillerBasicClusters *fillerBarrelBasicClusters =
286 <    new FillerBasicClusters(cfg, "BarrelBasicClusters", defactive_);
287 <  addActiveFiller(fillerBarrelBasicClusters);
288 <
289 <  FillerSuperClusters *fillerBarrelSuperClusters =  
290 <    new FillerSuperClusters(cfg,"BarrelSuperClusters", defactive_);
291 <  addActiveFiller(fillerBarrelSuperClusters);
292 <
293 <  FillerBasicClusters *fillerEndcapBasicClusters =
294 <    new FillerBasicClusters(cfg,"EndcapBasicClusters", defactive_);
295 <  addActiveFiller(fillerEndcapBasicClusters);
296 <  
297 <  FillerSuperClusters *fillerEndcapSuperClusters =  
298 <    new FillerSuperClusters(cfg,"EndcapSuperClusters", defactive_);
299 <  addActiveFiller(fillerEndcapSuperClusters);
300 <  
301 <  FillerMuons *fillerMuons = new FillerMuons(cfg,defactive_);
302 <  addActiveFiller(fillerMuons);
303 <  
304 <  FillerElectrons *fillerElectrons = new FillerElectrons(cfg,defactive_);
305 <  addActiveFiller(fillerElectrons);
306 <
307 <  FillerConversionElectrons *fillerConversionElectrons =
308 <    new FillerConversionElectrons(cfg,defactive_);
309 <  addActiveFiller(fillerConversionElectrons);
274 >    if (ftype.compare("FillerMet")==0) {
275 >      FillerMet *fillerMet = new FillerMet(cfg, name.c_str(), defactive_);
276 >      addActiveFiller(fillerMet);
277 >      continue;
278 >    }  
279 >    
280 >    if (ftype.compare("FillerGenMet")==0) {
281 >      FillerGenMet *fillerGenMet = new FillerGenMet(cfg, name.c_str(), defactive_);
282 >      addActiveFiller(fillerGenMet);
283 >      continue;
284 >    }  
285 >
286 >    if (ftype.compare("FillerCaloMet")==0) {
287 >      FillerCaloMet *fillerCaloMet = new FillerCaloMet(cfg, name.c_str(), defactive_);
288 >      addActiveFiller(fillerCaloMet);
289 >      continue;
290 >    }
291 >    
292 >    if (ftype.compare("FillerPFMet")==0) {
293 >      FillerPFMet *fillerPFMet = new FillerPFMet(cfg, name.c_str(), defactive_);
294 >      addActiveFiller(fillerPFMet);
295 >      continue;
296 >    }  
297 >
298 >    if (ftype.compare("FillerBasicClusters")==0) {
299 >      FillerBasicClusters *fillerBasicClusters =
300 >        new FillerBasicClusters(cfg, name.c_str(), defactive_);
301 >      addActiveFiller(fillerBasicClusters);
302 >      continue;
303 >    }  
304 >
305 >    if (ftype.compare("FillerSuperClusters")==0) {
306 >      FillerSuperClusters *fillerSuperClusters =  
307 >        new FillerSuperClusters(cfg, name.c_str(), defactive_);
308 >      addActiveFiller(fillerSuperClusters);
309 >      continue;
310 >    }  
311 >
312 >    if (ftype.compare("FillerPixelHits")==0) {
313 >      FillerPixelHits *fillerPixelHits =  
314 >        new FillerPixelHits(cfg, name.c_str(), defactive_);
315 >      addActiveFiller(fillerPixelHits);
316 >      continue;
317 >    }  
318 >
319 >    if (ftype.compare("FillerStripHits")==0) {
320 >      FillerStripHits *fillerStripHits =  
321 >        new FillerStripHits(cfg, name.c_str(), defactive_);
322 >      addActiveFiller(fillerStripHits);
323 >      continue;
324 >    }  
325 >
326 >    if (ftype.compare("FillerTracks")==0) {
327 >      FillerTracks *fillerTracks = new FillerTracks(cfg, name.c_str(), defactive_);
328 >      addActiveFiller(fillerTracks);
329 >      continue;
330 >    }  
331 >
332 >    if (ftype.compare("FillerMuons")==0) {
333 >      FillerMuons *fillerMuons = new FillerMuons(cfg, name.c_str(), defactive_);
334 >      addActiveFiller(fillerMuons);
335 >      continue;
336 >    }  
337 >
338 >    if (ftype.compare("FillerElectrons")==0) {
339 >      FillerElectrons *fillerElectrons = new FillerElectrons(cfg, name.c_str(), defactive_);
340 >      addActiveFiller(fillerElectrons);
341 >      continue;
342 >    }  
343 >
344 >    if (ftype.compare("FillerConversions")==0) {
345 >      FillerConversions *fillerConversions = new FillerConversions(cfg, name.c_str(), defactive_);
346 >      addActiveFiller(fillerConversions);
347 >      continue;
348 >    }  
349 >
350 >    if (ftype.compare("FillerPhotons")==0) {
351 >      FillerPhotons *fillerPhotons = new FillerPhotons(cfg, name.c_str(), defactive_);
352 >      addActiveFiller(fillerPhotons);
353 >      continue;
354 >    }  
355 >
356 >    if (ftype.compare("FillerStableParts")==0) {
357 >      FillerStableParts *fillerStableParts = new FillerStableParts(cfg, name.c_str(), defactive_);
358 >      addActiveFiller(fillerStableParts);
359 >      continue;
360 >    }  
361 >
362 >    if (ftype.compare("FillerDecayParts")==0) {
363 >      FillerDecayParts *fillerDecayParts = new FillerDecayParts(cfg, name.c_str(), defactive_);
364 >      addActiveFiller(fillerDecayParts);
365 >      continue;
366 >    }  
367 >    
368 >    if (ftype.compare("FillerPFCandidates")==0) {
369 >      FillerPFCandidates *fillerPFCands = new FillerPFCandidates(cfg, name.c_str(), defactive_);
370 >      addActiveFiller(fillerPFCands);
371 >      continue;
372 >    }  
373 >
374 >    if (ftype.compare("FillerPFJets")==0) {
375 >      FillerPFJets *fillerPFJets = new FillerPFJets(cfg, name.c_str(), defactive_);
376 >      addActiveFiller(fillerPFJets);
377 >      continue;
378 >    }  
379 >
380 >    if (ftype.compare("FillerCaloTaus")==0) {
381 >      FillerCaloTaus *fillerCaloTaus = new FillerCaloTaus(cfg, name.c_str(), defactive_);
382 >      addActiveFiller(fillerCaloTaus);
383 >      continue;
384 >    }
385 >    
386 >    if (ftype.compare("FillerPFTaus")==0) {
387 >      FillerPFTaus *fillerPFTaus = new FillerPFTaus(cfg, name.c_str(), defactive_);
388 >      addActiveFiller(fillerPFTaus);
389 >      continue;
390 >    }  
391 >    
392 >    if (ftype.compare("FillerTrackJets")==0) {
393 >      FillerTrackJets *fillerTrackJets = new FillerTrackJets(cfg, name.c_str(), defactive_);
394 >      addActiveFiller(fillerTrackJets);
395 >      continue;
396 >    }  
397 >
398 >    edm::LogError("FillMitTree")
399 >      << "Unknown fillerType " << ftype << " for pset named " << name << std::endl;
400 >    throw edm::Exception(edm::errors::Configuration, "FillMitTree::configure\n")
401 >      << "Unknown fillerType " << ftype << " for pset named " << name << std::endl;
402 >  }
403  
404 <  FillerConversions *fillerConversions = new FillerConversions(cfg,defactive_);
405 <  addActiveFiller(fillerConversions);
404 >  return 1;
405 > }
406  
407 <  FillerPhotons *fillerPhotons = new FillerPhotons(cfg,defactive_);
408 <  addActiveFiller(fillerPhotons);
407 > //--------------------------------------------------------------------------------------------------
408 > bool FillMitTree::configureTreeWriter(const edm::ParameterSet &cfg)
409 > {
410 >  // Configure tree writer with options from config file.
411  
412 <  FillerStableParts *fillerStableParts = new FillerStableParts(cfg,"StableParts",defactive_);
413 <  addActiveFiller(fillerStableParts);
412 >  tws_->SetPrefix(cfg.getUntrackedParameter<string>("fileName","mit-test"));
413 >  tws_->SetBaseURL(cfg.getUntrackedParameter<string>("pathName","."));
414 >  tws_->SetMaxSize((Long64_t)cfg.getUntrackedParameter<unsigned>("maxSize",1024)*1024*1024);
415 >  tws_->SetCompressLevel(cfg.getUntrackedParameter<unsigned>("compLevel",9));
416 >  tws_->SetDefaultSL(cfg.getUntrackedParameter<unsigned>("splitLevel",99));
417 >  tws_->SetDefaultBrSize(cfg.getUntrackedParameter<unsigned>("brSize",16*1024));
418 >  
419 >  if (OptInt::IsActivated()) {
420 >    OptInt::SetZipMode(cfg.getUntrackedParameter<unsigned>("zipMode",99));
421 >    OptInt::SetGzipFraction(cfg.getUntrackedParameter<double>("gZipThres",1.0));
422 >    OptInt::SetBzipFraction(cfg.getUntrackedParameter<double>("bZipThres",-1.0));
423 >    OptInt::SetLzoFraction(cfg.getUntrackedParameter<double>("lzoThres",-1.0));
424 >    OptInt::SetLzmaFraction(cfg.getUntrackedParameter<double>("lzmaThres",0.95));
425 >    OptInt::SetVerbose(cfg.getUntrackedParameter<unsigned>("optIOVerbose",0));
426 >
427 >  } else {
428 >
429 >    if (cfg.exists("zipMode")   || cfg.exists("bZipThres") ||
430 >        cfg.exists("gZipThres") || cfg.exists("lzoThres")  ||
431 >        cfg.exists("lzmaThres")) {
432 >      edm::LogError("FillMitTree") <<
433 >        "OptIO interface not properly pre-loaded, ignoring given settings." << std::endl;
434 >    }
435 >  }
436    
243  FillerDecayParts *fillerDecayParts = new FillerDecayParts(cfg,"DecayParts",defactive_);
244  addActiveFiller(fillerDecayParts);
245
437    return 1;
438   }
439  
# Line 255 | Line 446 | void FillMitTree::endJob()
446      delete *iF;
447    }
448  
449 +  tws_->Clear();
450 +  
451    edm::LogInfo("FillMitTree::endJob") << "Ending Job" << endl;
452   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines