ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/macros/examples/runSimpleExample.C
Revision: 1.2
Committed: Tue Jun 3 07:21:28 2008 UTC (16 years, 11 months ago) by paus
Content type: text/plain
Branch: MAIN
Changes since 1.1: +11 -11 lines
Log Message:
Minor cleanup and adding examples (see MitSoft TWiki).

File Contents

# User Rev Content
1 paus 1.2 // $Id: runSimpleExample.C,v 1.1 2008/05/27 19:59:54 loizides Exp $
2 loizides 1.1
3     #if !defined(__CINT__) || defined(__MAKECINT__)
4     #include "MitAna/DataUtil/interface/Debug.h"
5     #include "MitAna/TreeMod/interface/ParticleExampleMod.h"
6     #include "MitAna/TreeMod/interface/Analysis.h"
7     #endif
8    
9 paus 1.2 //--------------------------------------------------------------------------------------------------
10     void runSimpleExample(const char *files = "mit-gen_000.root", const char *tname = "MitTree")
11 loizides 1.1 {
12     using namespace mithep;
13 paus 1.2 gDebugMask = Debug::kAnalysis;
14     gDebugLevel = 1;
15 loizides 1.1
16     ParticleExampleMod *mod = new ParticleExampleMod;
17    
18 paus 1.2 // set up analysis
19 loizides 1.1 Analysis *ana = new Analysis;
20     ana->SetTreeName(tname);
21     ana->SetSuperModule(mod);
22     ana->AddFile(files);
23 paus 1.2 ana->SetOutputName("mit-gen-hist.root");
24 loizides 1.1
25 paus 1.2 // run the analysis after successful initialisation
26     if (ana->Init()) {
27 loizides 1.1 ana->Run();
28     ana->Terminate();
29     } else {
30     ::Error("runAna", "Could not initialize analysis.");
31 paus 1.2 }
32 loizides 1.1
33 paus 1.2 // cleanup ( someone is really worried here :-) )
34 loizides 1.1 delete ana;
35     delete mod;
36     }