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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines