SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Workbook Home Introduction Account Setup QuickTour Packages Modules Unwrap page!
Event Information Tcl Commands Editing Compile and Link Run the Job Debugging
Check this page with the
W3C Validator
(More checks...)
Parameters Tcl Files Find Data Batch Analysis ROOT Tutorial
Step 2: Declare and book histograms and ntuple          Go to Step 3

Header file: MyNeuAnalysis.hh



#ifndef MYNEUANALYSIS_HH
#define MYNEUANALYSIS_HH

#include "Framework/AppModule.hh"
#include "AbsEvent/AbsEvent.hh"
#include "HepTuple/Histogram.h"
#include "HepTuple/Tuple.h"

class MyNeuAnalysis : public AppModule {

public:

  // Constructors
  MyNeuAnalysis( const char* const theName, const char* const theDescription );
  // Destructor
  virtual ~MyNeuAnalysis( );

  // Operations

  virtual AppResult  beginJob( AbsEvent* anEvent );
  virtual AppResult  event( AbsEvent* anEvent );
  virtual AppResult  endJob  ( AbsEvent* anEvent );

protected:

private:

HepHistogram *_hpneu;
HepHistogram *_hthetaneu;

HepTuple *_ntuple;

};

#endif

Implementation file: MyNeuAnalysis.cc



#include "AbsEnv/AbsEnv.hh"
#include "GenEnv/GenEnv.hh"
#include "BaBar/BaBar.hh"
#include "BetaMiniUser/MyNeuAnalysis.hh"
#include "HepTuple/TupleManager.h"

// Constructors

MyNeuAnalysis::MyNeuAnalysis( const char* const theName,
                  const char* const theDescription )
  : AppModule( theName, theDescription )
{
}

// Destructor
MyNeuAnalysis::~MyNeuAnalysis( )
{
}

// Operations

AppResult MyNeuAnalysis::beginJob( AbsEvent* anEvent )
{

  HepTupleManager* manager = gblEnv->getGen()->ntupleManager();

  // book the histograms
  _hpneu = manager->histogram("Track momentum",  25, 0., 1.0 );
  _hthetaneu = manager->histogram("Track polar angle", 25, 0., 1.571);

  // book the ntuple
  _ntuple = manager->ntuple("MyNtuple");

  return AppResult::OK;
}

AppResult MyNeuAnalysis::endJob( AbsEvent* anEvent )
{
  return AppResult::OK;
}

AppResult MyNeuAnalysis::event( AbsEvent* anEvent )
{
  return AppResult::OK;
}

                                                                                          Go to Step 3