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 3: Get and loop over a HepAList<BtaCandidate>*      Go to Step 4

Header file: MyNeuAnalysis.hh


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

class MyNeuAnalysis : public AppModule {


  // 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 );



HepHistogram *_hpneu;
HepHistogram *_hthetaneu;

HepTuple *_ntuple;



Implementation file:

#include "AbsEnv/AbsEnv.hh"
#include "GenEnv/GenEnv.hh"
#include "BaBar/BaBar.hh"
#include "BetaMiniUser/MyNeuAnalysis.hh"
#include "HepTuple/TupleManager.h"
#include "Beta/BtaCandidate.hh"
#include "CLHEP/Alist/AList.h"
#include "ProxyDict/Ifd.hh"
#include "CLHEP/Alist/AIterator.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("Cluster momentum",  25, 0., 1.0 );
  _hthetaneu = manager->histogram("Cluster polar angle", 25, 0., 1.571);

  _ntuple = manager->ntuple("MyNtuple");

  return AppResult::OK;

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

AppResult MyNeuAnalysis::event( AbsEvent* anEvent )

  // get list of neutral particle candidates
  HepAList<BtaCandidate>* neuList  =
      Ifd<HepAList< BtaCandidate > >::get(anEvent, "CalorNeutral");

  // loop over the neutral list
  HepAListIterator<BtaCandidate> iterNeu(*neuList);
   BtaCandidate* neu(0);
   while ( neu = iterNeu() ) {
   // will soon put code here...

  return AppResult::OK;

                                                                                          Go to Step 4