AMSDST
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
myChain Class Reference

This class provides access to the Ntuplize Events
Only one instance of this class exists (singleton) you can access it with the static method: myChain::gethead() More...

#include <myChain.h>

Inheritance diagram for myChain:

Classes

class  Section
 

Public Member Functions

 ~myChain ()
 Default destructor.
 
virtual Int_t Add (const char *name, Long64_t nentries=kBigNumber)
 Add ROOT file(s) to the chain.
 
Int_t AddFromFile (const char *name)
 Add the ROOT_files listed on a text file.
 
myEventGetEvent (Long64_t entry=0, Int_t getall=0)
 Read the event in memory for analysis.
 
myEventGetEventPointer ()
 Returns the pointer to the event object.
 
Int_t GetThisEntry (Int_t getall=0)
 (re)Read the current event
 
Int_t GetNextEntry (Int_t getall=0)
 Get the nextEvent.
 
virtual Long64_t LoadTree (Long64_t entry)
 It calls the TChain::LoadEntry after some checks.
 
virtual Long64_t Draw (const char *varexp, const TCut &selection, Option_t *option="", Long64_t nentries=kBigNumber, Long64_t firstentry=0)
 It calls the TChain::Draw after some hacks.
 
virtual Long64_t Draw (const char *varexp, const char *selection, Option_t *option="", Long64_t nentries=kBigNumber, Long64_t firstentry=0)
 
virtual void Draw (Option_t *opt)
 
void CloneTrees (const char *outpath="./", int single=0)
 Creates a new file(s) in the specified directory to store the selected events If Single different from 0, just one file containing all the trees is produced.
 
void FillOutput ()
 Fills the tree(s) containing the filtered data.
 
void CloseOutput ()
 Close the files containing the Filtered data.
 
void PrintEverything ()
 does really need an explanation?
 
void PrintEntries ()
 
void PrintMyInfo ()
 
void AddSection (const char *Name, const char *DirName=0, bool enable=true)
 
void ListSections ()
 
myChain::SectionGetSection (const char *Name)
 
bool HasSection (const char *Name)
 
bool HasSectionActivated (const char *Name)
 
void EnableSection (const char *Name)
 
void DisableSection (const char *Name)
 
void SectionSetDirName (const char *SectionName, const char *DirName)
 
virtual void Clear (Option_t *option="")
 

Static Public Member Functions

static myChaingethead ()
 returns the pointer to the myChain singleton and it creates the object if needed
 
static char * ExtractFileNameWithoutExtension (TTree *_InputTree)
 
static void CloneSingleTree (TChain *_InputTree, TFile *ff, TChain *&_OutputTree)
 
static void CloneSingleTree (TTree *_InputTree, TFile *ff, TTree *&_OutputTree)
 
static bool checkCastorFile (TString fn)
 Check stage state of castor file.
 
static int checkWildcardList (TString fn, std::vector< TString > &list, TString treeName="AMSRootNtuplized")
 A universal function to retrive file list from a wildcard pattern,.
 

Private Member Functions

 myChain (const char *name="AMSRootNtuplized", const char *title="")
 Constructor private beacuse it is a singleton.
 
void init ()
 
void AddActiveFriends ()
 
 ClassDef (myChain, 0)
 

Private Attributes

std::vector< Section * > sections
 
std::vector< TFile * > filesoutput
 useful for filtering
 
myEventme
 
bool kIndexValid
 
bool kInitializationDone
 
bool kGetAll
 

Static Private Attributes

static myChainptr =0
 

Detailed Description

This class provides access to the Ntuplize Events
Only one instance of this class exists (singleton) you can access it with the static method: myChain::gethead()

Definition at line 13 of file myChain.h.

Constructor & Destructor Documentation

myChain::myChain ( const char *  name = "AMSRootNtuplized",
const char *  title = "" 
)
private

Constructor private beacuse it is a singleton.

Definition at line 54 of file myChain.cxx.

References init(), and ptr.

Referenced by gethead().

myChain::~myChain ( )

Default destructor.

Definition at line 62 of file myChain.cxx.

References Clear(), CloseOutput(), filesoutput, and ptr.

Member Function Documentation

Int_t myChain::Add ( const char *  name,
Long64_t  nentries = kBigNumber 
)
virtual

Add ROOT file(s) to the chain.

It assumes that your ROOT file name contains the string "MainTree" Will also add the friend trees to friend chain, either in a seperated file in the same directory of the main file, or in the same file with the main tree. Wildcard file name is also accepted. If a friend file is not found or can't load, the corresponding section will be disabled.

Parameters
namefile name
nentriesnumber of entries to be add to chain, kBigNumber means all entries. If file name is wildcard, the number will be applyed to every file.
See Also
TChain::Add
Returns
number of trees in the chain after operation
See Also
checkWildcardList

Definition at line 226 of file myChain.cxx.

References AddActiveFriends(), checkWildcardList(), DisableSection(), kIndexValid, kInitializationDone, me, myEvent::ms, myEvent::RTI, sections, myEvent::us1, myEvent::vmbhp, myEvent::vmbp, myEvent::vmep, myEvent::vmrp, myEvent::vmtp, myEvent::vmuktp, myEvent::vmukup, myEvent::vmup, and myEvent::vmuqtp.

Referenced by AddFromFile().

void myChain::AddActiveFriends ( )
private

Definition at line 139 of file myChain.cxx.

References sections.

Referenced by Add().

Int_t myChain::AddFromFile ( const char *  name)

Add the ROOT_files listed on a text file.

Definition at line 772 of file myChain.cxx.

References Add().

void myChain::AddSection ( const char *  Name,
const char *  DirName = 0,
bool  enable = true 
)
bool myChain::checkCastorFile ( TString  fn)
static

Check stage state of castor file.

Currently use external command stager_qry and grep to check the status. Could change to castor functions if possible.

Parameters
fnfile name, could be in full URL like castor://castor/... or root://stage.server//castor/...
Returns
true if castor file is staged, or not a castor file at all

Definition at line 156 of file myChain.cxx.

Referenced by checkWildcardList().

int myChain::checkWildcardList ( TString  fn,
std::vector< TString > &  list,
TString  treeName = "AMSRootNtuplized" 
)
static

A universal function to retrive file list from a wildcard pattern,.

Making use the feature of TChain::Add(). With current AMS ROOT, or any ROOT with Netx plugin, rootd protocal ("root://") is also supported. The expantion of wildcard file name will be stored in a vector<TString>, but no check with the file will be made. If the input is a simple file, then connect and check existance of the tree inside the file. Besides that, also convert to root protocol for eos and castor files, and add svcClass=amsuser for castor file if needed. Also check the stage status of a single castor file, and fail if file not staged. This feature may be better moved to a seperated function.

Parameters
fnfile name pattern to be parsed
lista TString vector to store the resulting file list
treeNamethe default tree name if not specified in fn
Returns
number of file in the list. 0 if single file check failed.
See Also
checkCastorFile

Definition at line 171 of file myChain.cxx.

References checkCastorFile(), and ShowError().

Referenced by Add().

myChain::ClassDef ( myChain  ,
 
)
private
void myChain::Clear ( Option_t *  option = "")
virtual

Definition at line 76 of file myChain.cxx.

References filesoutput, me, and sections.

Referenced by ~myChain().

void myChain::CloneSingleTree ( TChain *  _InputTree,
TFile *  ff,
TChain *&  _OutputTree 
)
static

Definition at line 700 of file myChain.cxx.

Referenced by CloneTrees().

void myChain::CloneSingleTree ( TTree *  _InputTree,
TFile *  ff,
TTree *&  _OutputTree 
)
static

Definition at line 708 of file myChain.cxx.

void myChain::CloneTrees ( const char *  outpath = "./",
int  single = 0 
)

Creates a new file(s) in the specified directory to store the selected events If Single different from 0, just one file containing all the trees is produced.

Definition at line 661 of file myChain.cxx.

References CloneSingleTree(), ExtractFileNameWithoutExtension(), filesoutput, and sections.

void myChain::CloseOutput ( )

Close the files containing the Filtered data.

Definition at line 608 of file myChain.cxx.

References filesoutput, and sections.

Referenced by ~myChain().

void myChain::DisableSection ( const char *  Name)

Definition at line 805 of file myChain.cxx.

References sections.

Referenced by Add(), and init().

Long64_t myChain::Draw ( const char *  varexp,
const TCut &  selection,
Option_t *  option = "",
Long64_t  nentries = kBigNumber,
Long64_t  firstentry = 0 
)
virtual

It calls the TChain::Draw after some hacks.

Definition at line 974 of file myChain.cxx.

References kGetAll.

Long64_t myChain::Draw ( const char *  varexp,
const char *  selection,
Option_t *  option = "",
Long64_t  nentries = kBigNumber,
Long64_t  firstentry = 0 
)
virtual

Definition at line 987 of file myChain.cxx.

References kGetAll.

virtual void myChain::Draw ( Option_t *  opt)
inlinevirtual

Definition at line 96 of file myChain.h.

References Draw().

Referenced by Draw().

void myChain::EnableSection ( const char *  Name)

Definition at line 791 of file myChain.cxx.

References sections.

char * myChain::ExtractFileNameWithoutExtension ( TTree *  _InputTree)
static

Definition at line 730 of file myChain.cxx.

Referenced by CloneTrees().

void myChain::FillOutput ( )

Fills the tree(s) containing the filtered data.

Definition at line 644 of file myChain.cxx.

References me, myEvent::RTI, sections, and myRTI::utime.

myEvent * myChain::GetEvent ( Long64_t  entry = 0,
Int_t  getall = 0 
)

Read the event in memory for analysis.

Definition at line 872 of file myChain.cxx.

References me.

myEvent* myChain::GetEventPointer ( )
inline

Returns the pointer to the event object.

Definition at line 76 of file myChain.h.

References me.

myChain * myChain::gethead ( )
static

returns the pointer to the myChain singleton and it creates the object if needed

Definition at line 68 of file myChain.cxx.

References myChain(), and ptr.

Referenced by myEvent::LoadRTI().

Int_t myChain::GetNextEntry ( Int_t  getall = 0)
inline

Get the nextEvent.

Returns
  • the total number of bytes read,
  • 0 bytes read indicates a failure

Definition at line 88 of file myChain.h.

myChain::Section * myChain::GetSection ( const char *  Name)

Definition at line 841 of file myChain.cxx.

References sections.

Referenced by myEvent::LoadRTI().

Int_t myChain::GetThisEntry ( Int_t  getall = 0)
inline

(re)Read the current event

Returns
  • the total number of bytes read,
  • 0 bytes read indicates a failure

Definition at line 82 of file myChain.h.

bool myChain::HasSection ( const char *  Name)

Definition at line 851 of file myChain.cxx.

References sections.

bool myChain::HasSectionActivated ( const char *  Name)

Definition at line 861 of file myChain.cxx.

References sections.

void myChain::init ( )
private
void myChain::ListSections ( )

Definition at line 834 of file myChain.cxx.

References sections.

Long64_t myChain::LoadTree ( Long64_t  entry)
virtual

It calls the TChain::LoadEntry after some checks.

Definition at line 879 of file myChain.cxx.

References kGetAll, kIndexValid, kInitializationDone, and sections.

void myChain::PrintEntries ( )

Definition at line 502 of file myChain.cxx.

References sections.

void myChain::PrintEverything ( )

does really need an explanation?

Definition at line 513 of file myChain.cxx.

References sections.

void myChain::PrintMyInfo ( )

Definition at line 596 of file myChain.cxx.

void myChain::SectionSetDirName ( const char *  SectionName,
const char *  DirName 
)

Definition at line 820 of file myChain.cxx.

References sections.

Member Data Documentation

std::vector<TFile*> myChain::filesoutput
private

useful for filtering

Definition at line 32 of file myChain.h.

Referenced by Clear(), CloneTrees(), CloseOutput(), and ~myChain().

bool myChain::kGetAll
private

Definition at line 165 of file myChain.h.

Referenced by Draw(), init(), and LoadTree().

bool myChain::kIndexValid
private

Definition at line 162 of file myChain.h.

Referenced by Add(), init(), and LoadTree().

bool myChain::kInitializationDone
private

Definition at line 163 of file myChain.h.

Referenced by Add(), init(), and LoadTree().

myEvent* myChain::me
private

Definition at line 35 of file myChain.h.

Referenced by Add(), Clear(), FillOutput(), GetEvent(), GetEventPointer(), and init().

myChain * myChain::ptr =0
staticprivate

Definition at line 34 of file myChain.h.

Referenced by gethead(), myChain(), and ~myChain().

std::vector<Section*> myChain::sections
private

The documentation for this class was generated from the following files: