/[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.1 - (show annotations) (download)
Fri Nov 13 16:37:13 2009 UTC (15 years, 2 months ago) by pam-fi
Branch: MAIN
Added to repository.

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 delete _outFile;
16 _outFile = NULL;
17 }
18
19 void TreeOutputAction::Setup(PamLevel2 *events) {
20
21 _outFile = new TFile(_outFileName, "RECREATE");
22 _InitBranches(events);
23
24 }
25
26 void TreeOutputAction::OnGood(PamLevel2 *event) {
27
28 _ComputeBranches(event);
29 _outFile->cd();
30 _tree->Fill();
31
32 }
33
34 void TreeOutputAction::Finalize() {
35
36 _outFile->cd();
37 //cout << _tree->GetEntries() << endl;
38 _tree->Write();
39
40 _outFile->Close();
41
42 }

  ViewVC Help
Powered by ViewVC 1.1.23