More information on this package is here.
#include "TClasTool.h"

TClasTool


class description - header file - source file

class TClasTool: public TObject

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TClasTool()
TClasTool(const TClasTool&)
virtual~TClasTool()
voidTObject::AbstractMethod(const char* method) const
Int_tAdd(const Char_t* filename)
Int_tAddEPICFile(const char* filename, Int_t nentries)
Int_tAddFile(const Char_t* filename)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
Int_tCheck_Reader_Defined()
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
Int_tCorrect_ECPB_bank(TEVNTClass* e)
Int_tCorrect_ECPB_bank(TECPBClass* eco)
virtual voidTObject::Delete(Option_t* option = "")
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
TObject*GetBankRow(const Char_t* bankname, Int_t nrow)
Float_tGetBeamEnergy()
Int_tGetCurrentEvent()
TDCPBClass*GetDCPB(Int_t nrow)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Double_tGetEntries()
Double_tGetEntriesFast()
Int_tGetEntry(Int_t entry = -1, Int_t getall = 0)
TEPICClass*GetEPICClass()
Float_tGetEPICValue(const char* fName)
Int_tGetEventNumber()
TEVNTClass*GetEVNT(Int_t nrow)
THEADERClass*GetHEADER()
Int_tGetHelicity()
virtual const char*TObject::GetIconName() const
voidGetInvariants(Float_t* Q2, Float_t* W2)
virtual const char*TObject::GetName() const
Int_tGetNFiles()
TObject*GetNotify()
Int_tGetNPart()
Int_tGetNRows(const Char_t* bankname = "EVNT")
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
TVector3GetPart3Vector(Int_t indx)
TLorentzVectorGetPart4Vector(Int_t indx)
Int_tGetPartCharge(Int_t indx)
Int_tGetPartID(Int_t indx)
TVector3GetPartVertex(Int_t indx)
TVirtualReader*GetReader()
virtual const char*TObject::GetTitle() const
TChain*GetTree(Char_t* treename = "EVNT")
virtual UInt_tTObject::GetUniqueID() const
TVERTClass*GetVert(Int_t part1, Int_t part2)
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
Int_tInitDSTReader(const Char_t* readertype = "ROOTDSTR")
Int_tInitDSTReader(TVirtualReader* reader)
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
Int_tNext()
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TClasTool&operator=(const TClasTool&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
voidPrint(Int_t full = 0)
voidPrintEPICPosition()
voidPrintEventStatus()
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidSetBeamEnergy(Float_t fbm)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
voidSetNoScalers()
voidSetNotify(TObject* Notify)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
TVERTClass*Vert_Error_Handler(Int_t NRows, Int_t track1, Int_t track2)

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
public:
TVirtualReader*fReaderThis is a pointer to the actual reader used.
Int_tfDebug_ModeSets the verbosity of the code.
protected:
Float_tfEBeamBeam energy. Set with SetBeamEnergy().
Int_tisReaderDefinedTrue is reader is initialized.

Class Description

____________________ 

TClasTool

A framework for ROOT based analysis of CLAS data.

Created at UNH by Maurik Holtrop and Gagik Gavalian

This class provides a flexible way to analyze CLAS data using the ROOT system. It was originally intended to read ROOT based DST files created by the WriteRootDST utility, but has since then been expanded to handle other data formats as well. See the TNT10Reader class for a reader of ntuple-10 hbook files.

Implementation Philosophy

I have doubted for quite some time whether the layered approach of TClasTool is the best way to implement an analysis. Why not put everything in the reader, and so have only one class to deal with? In the end I stuck to this segmented approach for several reasons:
  1. It gives more flexibility to write readers for different data formats.
  2. Methods that are useful for all data formats can be implemented in TClasTool, those that apply only to specific data formats go in to the reader.
  3. If you don't like this implementation of TClasTool, you can create your own.
  4. You can always revert to using only the reader, by passing the TClasTool.

The penalty is an additional layer of classes, and the overhead (very slight) in passing calls from one layer to the underlying layer.

Note that in general this framework is not build to be the fastest code with the smallest DST. The idea is to have something that is reliable, understandable and comprehensive.

Implementation

The TClasTool class acts as an interface to the data through a DST reader class. You start by connecting to a reader with a call to InitDSTReader(). Then you open one or more DST files with Add(). After this you can loop through the data (with Next()) and retreive the relevant physics 3 and 4 vectors with various other methods.

I hope that eventually this class can be expanded to also connect to a TFiducialCut class to provide CLAS fiducial cuts, a TMomentumCorrection class to provide momentum corrections and perhaps even particle id corrections, kinematic fitting any other common tasks that form a complete analysis.

ClasTool Namespace

The implementation of TClasTool also includes a ClasTool namespace which currently includes some general use arrays and some functions:
  1. Int_t GetTypeFromPid(Int_t pid); // Finds the index (internally used type) from PDG PID
  2. Int_t GetPidFromType(Int_t type);// Finds the PDG PID from the index.
  3. Float_t GetPartMassID(Int_t pid); // Finds the mass of a particle with PDG PID.
  4. const char * GetPartName(Int_t pid); // Finds the name of a particle with PDG PID.
  5. const char * GetShortPartName(Int_t pid); // Same, but get the short name.
  6. static const Float_t fgParticle_Mass[]= // Masses of particles, indexed by internal type.
  7. static const Int_t fgParticle_Id[]= // Id's of particles. , indexed by internal type.
  8. static const char *fgParticle_Name[]= // Names of the particles.
  9. static const char *fgParticle_ShortName[]= // Short Names (abbreviations) of the particles, 4 chars or less each.
  10. static const char *fgParticle_Symbol[]= // Symbols (as in "#pi^{+}" for pi+.

Additional information about this package, including an overview, can be found at the ClasTool Documentation web pages.

 
 
   
TClasTool()
 Class default constructor.

~TClasTool()
 Class default destructor.
Int_t InitDSTReader(const Char_t *readertype)
 Initialize the DST reader if not already defined.

 Argument can be:
    ROOTDSTR   -- start a TDSTReader [default]


Int_t InitDSTReader(TVirtualReader *reader)
 Set the current DST reader to reader.
 Argument can be any DST class derived from TVirtualReader
 
 Example:
 TClasTool *ct=new TClasTool();
 TNT10Reader *nt=new TNT10Reader();
 ct->InitDSTReader(nt);
 ct->Add("myfile.hbook");
 ....

Int_t Add(const Char_t *filename)
 Add one or more files to the chain of files to be analyzed, using
 wildcard format.
 This filename is passed on to the DST reader that is 
 currently initialized.

Int_t AddFile(const Char_t *filename)
 Add a single file to the chain of files to be analyzed. 
 This filename is passed on to the DST reader that is 
 currently initialized.

Int_t AddEPICFile(const Char_t *filename, Int_t nentries)
Add a single file to the EPIC chain of files.
Files must be added in order of run number for
GetEPICValue to work correctly. Only for use with TDSTReader

Int_t Check_Reader_Defined()
 Internal function that checks if the reader is ok.

Int_t Next()
 Read the next event from the currently attached file.
TObject * GetBankRow(const Char_t *bankname,Int_t nrow)
 Return the bank with bankname (i.e. "EVNT") at row nrow.
Int_t GetCurrentEvent()
 Return the sequence number of the current event.
Double_t GetEntries()
 Return the number of events (entries) in all files loaded.
Double_t GetEntriesFast()
 Return the number of events (entries) in all files,
 without checking. This is faster, but could return
 the wrong number is GetEntries() was not called
 earlier.
Int_t GetEntry(Int_t entry, Int_t getall)
 Get a specific entry from the file with sequence number entry.
THEADERClass * GetHEADER()
 Return a pointer to the current HEADER bank.
Float_t GetEPICValue(const char* fName)
Get the EPIC value corresponding to fName
TEPICClass * GetEPICClass()
 Return a pointer to the current EPIC bank.
 Returns the current EPIC without checking to see 
 if it corresponds to the current physics event.
 Calling GETEPICValue first will ensure the EPIC bank
 corresponds to the physics bank.
Int_t GetEventNumber()
 Return the (physics) event number for current event.
Int_t GetNFiles()
 Return the number of files currently loaded.
TObject * GetNotify()
 Return a pointer to the Notify class.
Int_t GetNPart()
 Calls GetNPart on the attached DST Reader, which should return
 the number of particles that this event contains.
Int_t GetNRows(const Char_t *bankname)
 Get the number of rows for the bank in bankname.
Int_t GetPartID(Int_t indx)
 Calls the GetPartID on the attached DST Reader, which should return
 the particle id of the the particle at index indx.
Int_t GetPartCharge(Int_t indx)
 Calls the GetPartCharge on the attached DST Reader, which should return
 the charge of the particle at index indx.
TVector3 GetPart3Vector(Int_t indx)
 Call the GetPart3Vector on the attached DST Reader, which should return
 the TVector3 momentum vector of the particle.
TLorentzVector GetPart4Vector(Int_t indx)
 Returns the TLorentzVector (4-vector) of the particle's 4-momentum.
 Calls GetPart3Vector and GetPartMassID(GetPartID(indx)) to construct
 the 4-momentum from the 3-momentum and the mass. 
 
TVector3 GetPartVertex(Int_t indx)
 Call the GetPartVertex on the attached DST Reader, which should return
 the TVector3 vertex vector of the particle.
Int_t Correct_ECPB_bank(TEVNTClass *e)
 See TClasTool::Correct_ECPB_bank(TECPBClass *eco)

Int_t Correct_ECPB_bank(TECPBClass *eco)
 Correct the incorrect values for Ein or Eout (or both) in the ECPB bank for the
 particle stored in the TEVNTClass bank given. 

 This routine is needed because of an error in the ECPB bank construction which
 occasionally has multiple copies for the same EC hit, but some of these copies
 are missing Ein or Eout or both. They WILL have Innstr and Outstr, which indicates
 that there SHOULD be a non zero entry for Ein and Eout.

 Further documentation can be found at:
 http://clasweb.jlab.org/cgi-bin/ENOTE/enote.pl?nb=eg2&action=view&page=84

 So before using Ein and/or Eout from the ECPB you want to make the following
 lines of code, assuming *evnt is your TEVNTClass object for the event, and 
 *ec is the TECPBObject for that event:

 if( ( (ec->Ein ==0 && ec->Innstr>0) || (ec->Eout == 0 && ec->Outstr>0) ) && ec->Etot>0.){
     Int_t stat = cltool->Correct_ECPB_bank(evnt);
 }  

 Returns in stat whether 0, 1 or 2 corrections were made to the ECPB banks values.

 (Created by Maurik Holtrop, UNH, 2006-03-24 )

void GetInvariants(Float_t *Q2, Float_t *W2)
 Returns four momentum square and the invariant mass square in *Q2 and *W2.
 
/* The routines calculates the Q2 as 2 Pe Ebeam (1 - cos q) and the invariant mass W2 as Mp2+ 2 Mp (Ebeam-Pe ) - Q2, where Pe is the momentum of the scattered electron and q is the angle with respect to the beam, and Ebeam is the beam energy, Mp is the mass of the proton.

Note: To get meaningful results from this routine you must have set the beam energy correctly with SetBeamEnergy.
The code assumes that the zero-index particle is the electron.

  */
TVERTClass* GetVert(Int_t part1, Int_t part2)
 This function will return a pointer to the correct TVERTClass bank 
 that is associated with the two tracks that are pointed to 
 by the integer indexes into the EVNT bank, part1 and part2.

 Among other methods, you can locate the correct indexes 
 for particle type X, using the TPartSieve::GetIndex()

TVERTClass* Vert_Error_Handler(Int_t NRows,Int_t track1, Int_t track2)
Int_t GetHelicity()
 A simple interface to read the helicity. This routine will NOT work for
 experiments with delayed helicity reporting.
 Calls the DST Readers GetHelicity() function.
TVirtualReader * GetReader(void)
 Returns a pointer to the reader.
 Usefull for directly manipulating the reader.

TChain * GetTree(Char_t *treename)
 Returns a pointer to the actual tree that was created by the reader.
 If the reader is incapable of returning a TTree, it will return NULL.
void Print(Int_t full)
 Overrides the standard print with a bit more information.
 Set full=1 to get even more information.

void PrintEventStatus()
 Print the event status to the terminal. (Useful for debugging.)
 Calls the DST Readers PrintEventStatus().
void PrintEPICPosition()
 Print the position of the current EPIC in terms of its range of
 event numbers and run number
void SetNotify(TObject *Notify)
 Set the Notify() class to Notify.
 This is a class that contains a routine called Notify()
 This method of this call will be called when the Reader loads the
 next file of the chain. This allows you to perform certain tasks,
 like loading new constants, when the file changes.
void SetNoScalers()
 Tell the reader (TDSTReader) that you don't want to read the
 scaler chain, even if it exists.
 This is useful when filtering on data.
 You can only call this after the reader has been initialized.
TClasTool()
void SetBeamEnergy(Float_t fbm)
{fEBeam=fbm;}
Float_t GetBeamEnergy()
{return(fEBeam);}
TEVNTClass * GetEVNT(Int_t nrow)
 
 Inlines.

{return (TEVNTClass *)GetBankRow("EVNT",nrow);}
TDCPBClass * GetDCPB(Int_t nrow)
{return (TDCPBClass *)GetBankRow("DCPB",nrow);}


Author: Maurik Holtrop
Last update: ClasTool/TClasTool:$Name: $:$Id: TClasTool.cc,v 1.15 2007/03/01 22:27:00 holtrop Exp $
CopyLeft - This code is freely available.

ROOT Home page - ClasTool Class index - Class Hierarchy - Top of the page