Annotated NTrkExample.hh File
This is C++ code.
Everything following a double slash '//' is a comment. Comments are meant
for individuals reading through code, and are completely ignored by the
compiler.
//--------------------------------------------------------------------------
// File and Version Information:
// NTrkExample.hh June 2005
//
// Description:
// Class NTrkExample
// This is an analysis module class used as the
// first example in the offline workbook.
// The workbook can be found on the web at the
// following URL:
// BFROOT/www/doc/workbook/workbook.html
//
// The NTrkExample class only plots a histogram of
// the number of tracks per event.
//
// Environment:
// Software developed for the BaBar Detector at the SLAC B-Factory
//
// Author List:
// Charles Young Original Author
// Tracey Marsh minimize module
// Sheila Mclachlin update 2005
//
//
// Copyright Information:
// Copyright (C) 1997
//
//------------------------------------------------------------------------
#ifndef NTRKEXAMPLE_HH
#define NTRKEXAMPLE_HH
These two lines are part of the preprocessor
syntax to ensure that header files do not get included multiple times.
//----------------------
// Base Class Headers --
//----------------------
#include "Framework/AppModule.hh"
#include "AbsParm/AbsParmIfdStrKey.hh"
#include "AbsEvent/AbsEvent.hh"
The classes and member functions defined in the
included header files can be used anywhere in this header file and
in the implementation file NTrkExample.cc. If there are commands or
classes that you do not recognize when looking through code, the
included header files are a reasonable first place to look. These are
all BaBar specific header files so they are enclosed by double
quotes.
//------------------------------------
// Collaborating Class Declarations --
//------------------------------------
At compile time all of the types used in the
declaration of the NTrkExample class must be known to the compiler.
Since the NTrkExample class only has pointers to these class types,
only the declaration and not the definition is needed at this time.
The implementation file NTrkExample.cc will #include the header
files that define these classes.
class HepHistogram;
//---------------------
//-- Class Interface --
//---------------------
class NTrkExample : public AppModule {
The NTrkExample class inherits from the AppModule class.
This means that it has a common interface and must supply implementation for
any virtual functions declared in the AppModule class. The structure of the
NTrkExample class will be defined within the open and closed curly brackets
'{' and '}'.
//--------------------
// Instance Members --
//--------------------
public:
Public members can be freely used by all code. For
general purposes constructors and destructors should be made public. The
member functions and data members that this class should "export" or make
available for use by other applications should also be made public.
// Constructors
NTrkExample( const char* const theName, const char* const theDescription );
// Destructor
virtual ~NTrkExample( );
// Operations
virtual AppResult beginJob( AbsEvent* anEvent );
virtual AppResult event( AbsEvent* anEvent );
virtual AppResult endJob ( AbsEvent* anEvent );
protected:
Protected members can only be used or altered by
classes that have been designated as friends of this class and by
friends of classes derived from this one. In this case there are no
protected members.
private:
Private members can only be used or altered by
friends of this class. A class is a friend of itself. Typically,
protected members contain the details of the class implementation.
AbsParmIfdStrKey _btaChargedList;
The first data member declared is named _btaChargedList
and is of type AbsParmIfdStrKey. This type (class) is defined in the
AbsParmIfdStrKey.hh file.
HepHistogram* _numTrkHisto;
The NTrkExample class declaration contains a pointer that is only
allowed to point to an object of type HepHistogram and is named _numTrkHisto.
Just the pointer is the data member of the class. The memory for the
object that is pointed to does not belong to the class.
};
The NTrkExample class declaration is completed, the
closed curly brace '}' ends the body and the semicolon ';' marks the end
of the declaration.
#endif
This is the final line of the preprocessor if
statement used to prevent multiple inclusion of header files.
The definition and implementation of this class's member functions are
found in the NTrkExample.cc file.
Back to
Editing Code.
Last modification: Jan 2006
Last significant update: ?1999
|