Logo ROOT  
Reference Guide
No Matches
ProofEventProc.h File Reference

Detailed Description

Selector to process trees containing Event structures.

#ifndef ProofEventProc_h
#define ProofEventProc_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
#include "Event.h"
class TH1F;
class TH2F;
class ProofEventProc : public TSelector {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
// Declaration of leave types
Event *event;
Char_t fType[20];
Char_t *fEventName;
Int_t fNtrack;
Int_t fNseg;
Int_t fNvertex;
UInt_t fFlag;
Double32_t fTemperature;
Int_t fMeasures[10];
Double32_t fMatrix[4][4];
Double32_t fClosestDistance[21]; //[fNvertex]
EventHeader fEvtHdr;
TClonesArray *fTracks;
TRefArray *fHighPt;
TRefArray *fMuons;
TRef fLastTrack;
TRef fWebHistogram;
TH1F *fH;
TBits fTriggerBits;
Bool_t fIsValid;
void InitEvent() { event = 0 ; fEventName = 0; fTracks = 0;
fHighPt = 0; fMuons = 0; fH = 0; fIsValid = kFALSE; }
// Read controller
Bool_t fFullRead;
// Abortion test
Int_t fTestAbort; // -1 none, 0 init, 1 file
// Event ranges
Long64_t fEntMin; // Min entry num of the current element
Long64_t fEntMax; // Max entry num of the current element
TList *fProcElems; // List of ProcFileElements processed so far
ProcFileElements *fProcElem; // Element currently processed
void CheckRanges();
//Output hist
TH1F* fPtHist;
TH1F* fPzHist;
TH2F* fPxPyHist;
// List of branches
TBranch *b_event_fType; //!
TBranch *b_fEventName; //!
TBranch *b_event_fNtrack; //!
TBranch *b_event_fNseg; //!
TBranch *b_event_fNvertex; //!
TBranch *b_event_fFlag; //!
TBranch *b_event_fTemperature; //!
TBranch *b_event_fMeasures; //!
TBranch *b_event_fMatrix; //!
TBranch *b_fClosestDistance; //!
TBranch *b_event_fEvtHdr; //!
TBranch *b_fTracks; //!
TBranch *b_fHighPt; //!
TBranch *b_fMuons; //!
TBranch *b_event_fLastTrack; //!
TBranch *b_event_fWebHistogram; //!
TBranch *b_fH; //!
TBranch *b_event_fTriggerBits; //!
TBranch *b_event_fIsValid; //!
ProofEventProc(TTree *) { InitEvent(); fFullRead = kTRUE; fTestAbort = -1;
fPtHist = 0; fPzHist = 0; fPxPyHist = 0;
fEntMin = -1; fEntMax = -1; fProcElems = 0; fProcElem = 0;}
ProofEventProc() { InitEvent(); fFullRead = kTRUE; fTestAbort = -1;
fPtHist = 0; fPzHist = 0; fPxPyHist = 0;
fEntMin = -1; fEntMax = -1; fProcElems = 0; fProcElem = 0;}
virtual ~ProofEventProc() {if (fProcElems) { fProcElems->SetOwner(kFALSE);
delete fProcElems;} }
virtual Int_t Version() const {return 2;}
virtual void Begin(TTree *);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual void SetOption(const char *option) { fOption = option; }
virtual void SetObject(TObject *obj) { fObject = obj; }
virtual void SetInputList(TList *input) {fInput = input;}
virtual TList *GetOutputList() const { return fOutput; }
virtual void SlaveTerminate();
virtual void Terminate();
#ifdef ProofEventProc_cxx
void ProofEventProc::Init(TTree *tree)
// The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses of the tree
// will be set. It is normaly not necessary to make changes to the
// generated code, but the routine can be extended by the user if needed.
// Init() will be called many times when running with PROOF.
// Set branch addresses
if (tree == 0) return;
fChain = tree;
Bool_t ProofEventProc::Notify()
// The Notify() function is called when a new file is opened. This
// can be either for a new TTree in a TChain or when when a new TTree
// is started when using PROOF. Typically here the branch pointers
// will be retrieved. It is normaly not necessary to make changes
// to the generated code, but the routine can be extended by the
// user if needed.
TString fn;
if (fChain) {
fn = fChain->GetCurrentFile()->GetName();
Info("Notify", "processing file: %s", fn.Data());
// Save information about previous element, if any
if (fProcElem) fProcElem->Add(fEntMin, fEntMax);
// Reset counters
fEntMin = -1;
fEntMax = -1;
// Point to current element
if (fProcElems) fProcElem = (ProcFileElements *) fProcElems->FindObject(fn);
if (!fProcElem) {
Info("Notify", "assigned new file: create ProcFileElements entry");
fProcElem = new ProcFileElements(fn.Data());
if (!fProcElems) fProcElems = new TList;
if (fProcElems) fProcElems->Add(fProcElem);
// Get branch pointers
b_event_fType = fChain->GetBranch("fType[20]");
b_fEventName = fChain->GetBranch("fEventName");
b_event_fNtrack = fChain->GetBranch("fNtrack");
b_event_fNseg = fChain->GetBranch("fNseg");
b_event_fNvertex = fChain->GetBranch("fNvertex");
b_event_fFlag = fChain->GetBranch("fFlag");
b_event_fTemperature = fChain->GetBranch("fTemperature");
b_event_fMeasures = fChain->GetBranch("fMeasures[10]");
b_event_fMatrix = fChain->GetBranch("fMatrix[4][4]");
b_fClosestDistance = fChain->GetBranch("fClosestDistance");
b_event_fEvtHdr = fChain->GetBranch("fEvtHdr");
b_fTracks = fChain->GetBranch("fTracks");
b_fHighPt = fChain->GetBranch("fHighPt");
b_fMuons = fChain->GetBranch("fMuons");
b_event_fLastTrack = fChain->GetBranch("fLastTrack");
b_event_fWebHistogram = fChain->GetBranch("fWebHistogram");
b_fH = fChain->GetBranch("fH");
b_event_fTriggerBits = fChain->GetBranch("fTriggerBits");
b_event_fIsValid = fChain->GetBranch("fIsValid");
return kTRUE;
#endif // #ifdef ProofEventProc_cxx
Class to hold information about the processed elements of a file.
double Double32_t
Definition RtypesCore.h:60
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
long long Long64_t
Definition RtypesCore.h:73
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassDef(name, id)
Definition Rtypes.h:325
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:220
Container of bits.
Definition TBits.h:26
A TTree is a list of TBranches.
Definition TBranch.h:89
An array of clone (identical) objects.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
1-D histogram with a float per channel (see TH1 documentation)}
Definition TH1.h:575
2-D histogram with a float per channel (see TH1 documentation)}
Definition TH2.h:251
A doubly linked list.
Definition TList.h:44
virtual void Add(TObject *obj)
Definition TList.h:87
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition TList.cxx:578
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:37
An array of references to TObjects.
Definition TRefArray.h:39
Persistent Reference link to a TObject A TRef is a lightweight object pointing to any TObject.
Definition TRef.h:32
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
virtual void SetObject(TObject *obj)
Definition TSelector.h:65
virtual void Init(TTree *)
Definition TSelector.h:53
virtual int Version() const
Definition TSelector.h:52
TSelectorList * fOutput
! List of objects created during processing
Definition TSelector.h:42
virtual Bool_t Process(Long64_t)
virtual void SlaveBegin(TTree *)
Definition TSelector.h:55
virtual void SetOption(const char *option)
Definition TSelector.h:64
virtual void SetInputList(TList *input)
Definition TSelector.h:66
virtual TList * GetOutputList() const
Definition TSelector.h:69
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition TSelector.h:56
virtual void SlaveTerminate()
Definition TSelector.h:70
virtual void Begin(TTree *)
Definition TSelector.h:54
virtual void Terminate()
Definition TSelector.h:71
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
A TTree represents a columnar dataset.
Definition TTree.h:79
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition TTree.cxx:5275
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition TTree.cxx:5459
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
Definition TTree.cxx:8349
virtual void SetMakeClass(Int_t make)
Set all the branches in this TTree to be in decomposed object mode (also known as MakeClass mode).
Definition TTree.cxx:9136
Definition tree.py:1
Gerardo Ganis (gerar.nosp@m.do.g.nosp@m.anis@.nosp@m.cern.nosp@m..ch)

Definition in file ProofEventProc.h.