/[PAMELA software]/PamCut/CollectionActions/TreeOutputActions/TreeOutputAction/TreeOutputAction.cpp
ViewVC logotype

Contents of /PamCut/CollectionActions/TreeOutputActions/TreeOutputAction/TreeOutputAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Nov 24 09:56:52 2009 UTC (15 years ago) by pam-fi
Branch: MAIN
CVS Tags: Root_V8, MergedToHEAD_1, nuclei_reproc, MergedFromV8_1, BeforeMergingFromV8_1, V9, HEAD
Branch point for: V8
Changes since 1.1: +1 -3 lines
Bug (post-main segfault) fixed.

1 /*
2 * TreeOutputAction.cpp
3 *
4 * Created on: 03/nov/2009
5 * Author: Nicola Mori
6 */
7
8 #include "TreeOutputAction.h"
9
10 TreeOutputAction::TreeOutputAction(const char *actionName, TString outFileName) :
11 CollectionAction(actionName), _outFileName(outFileName) {
12 }
13
14 TreeOutputAction::~TreeOutputAction() {
15 _outFile->Close();
16 delete _outFile;
17 _outFile = NULL;
18 }
19
20 void TreeOutputAction::Setup(PamLevel2 *events) {
21
22 _outFile = new TFile(_outFileName, "RECREATE");
23 _InitBranches(events);
24
25 }
26
27 void TreeOutputAction::OnGood(PamLevel2 *event) {
28
29 _ComputeBranches(event);
30 _outFile->cd();
31 _tree->Fill();
32
33 }
34
35 void TreeOutputAction::Finalize() {
36
37 _outFile->cd();
38 _tree->Write();
39
40 }

  ViewVC Help
Powered by ViewVC 1.1.23