FairRoot/PandaRoot
Public Member Functions | Public Attributes | Protected Attributes | List of all members
TProtoUnpackEvent Class Reference

#include <TProtoUnpackEvent.h>

Inheritance diagram for TProtoUnpackEvent:
TGo4EventElement

Public Member Functions

 TProtoUnpackEvent ()
 
 TProtoUnpackEvent (const char *name)
 
virtual ~TProtoUnpackEvent ()
 
void Clear (Option_t *t="")
 
 ClassDef (TProtoUnpackEvent, 3)
 
void SetValid (Bool_t on)
 
Bool_t IsValid () const
 
void SetEventSource (TGo4EventSource *src)
 
void SetParent (TGo4EventElement *par)
 
TGo4EventElementGetParent () const
 
TGo4EventSource * GetEventSource () const
 
Bool_t CheckEventSource (const char *classname)
 
virtual Int_t Fill ()
 
virtual Int_t Init ()
 
virtual void PrintEvent ()
 
virtual void makeBranch (TBranch *parent)
 
virtual void deactivate ()
 
virtual void activate ()
 
virtual void clearAll (Int_t)
 
virtual Bool_t isComposed ()
 
virtual Short_t getId ()
 
virtual void setDebug (Bool_t debug)
 
virtual TGo4EventElementoperator[] (Int_t)
 
virtual void Print (Option_t *option="") const
 
virtual void synchronizeWithTree (TTree *tree, TGo4EventElement **var_ptr=0)
 
virtual Int_t activateBranch (TBranch *branch, Int_t index=0, TGo4EventElement **var_ptr=0)
 

Public Attributes

Double_t amplitude [ConfiguredProtoChannels]
 
Double_t energy [ConfiguredProtoChannels]
 
Double_t time [ConfiguredProtoChannels]
 
Int_t waveform [ConfiguredProtoChannels][256]
 
Int_t trigger [ConfiguredProtoChannels/16+1]
 
Int_t rawData [1024]
 
Int_t rawDataLength
 

Protected Attributes

Short_t fIdentifier
 
Bool_t fDebug
 

Detailed Description

Definition at line 20 of file TProtoUnpackEvent.h.

Constructor & Destructor Documentation

TProtoUnpackEvent::TProtoUnpackEvent ( )

Definition at line 17 of file TProtoUnpackEvent.cxx.

17  :
19 {
20 }
TProtoUnpackEvent::TProtoUnpackEvent ( const char *  name)

Definition at line 22 of file TProtoUnpackEvent.cxx.

22  :
24 {
25 }
TString name
TProtoUnpackEvent::~TProtoUnpackEvent ( )
virtual

Definition at line 27 of file TProtoUnpackEvent.cxx.

28 {
29 }

Member Function Documentation

void TGo4EventElement::activate ( )
virtualinherited

Definition at line 168 of file TGo4EventElement.cxx.

References gTree, name, and TString.

169 {
170  TString name=GetName();
171 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,34,19)
172  name+=".";
173  gTree->SetBranchStatus(name.Data(), 1);
174  name+="*";
175  gTree->SetBranchStatus(name.Data(), 1);
176 #else
177  std::cout << "-W- Could not activate() element %s in this ROOT Version, do not use!" << name.Data() << std::endl;
178 #endif
179 }
R__EXTERN TTree * gTree
TString name
Int_t TGo4EventElement::activateBranch ( TBranch *  branch,
Int_t  index = 0,
TGo4EventElement **  var_ptr = 0 
)
virtualinherited
THIS WAS OLD CODE FROM TGo4FileSource

void TGo4EventElement::synchronizeWithTree(TTree *tree, TGo4EventElement** var_ptr)

TString topname; Bool_t masterbranch=kFALSE; TString branchName = dest->GetName(); if(!fxBranchName.Contains(".")) { fxBranchName+="."; // for master branch, add dot. Subbranch names with dot separators do not get final dot masterbranch=kTRUE; } TObjArray* blist = tree->GetListOfBranches(); TBranch* topb = (TBranch*) blist->At(0); if(topb) { topname = topb->GetName(); cout <<"Activating top branch "<<topname.Data() << endl; tree->SetBranchAddress(topname.Data(),(void**) var_ptr); topb->SetAddress(&fxTopEvent); // this will not set address of possible cloned tree. we use the set address of the tree } tree->SetBranchStatus("*",0); // note: only deactivate subleafs after address of top branch is set! tree->SetBranchStatus(topname.Data(),1); // required to process any of the subbranches! TString wildbranch = branchName; wildbranch += "*"; tree->SetBranchStatus(wildbranch.Data(),1); cout <<"Build event activates: "<<wildbranch.Data() << endl; wildbranch = branchName; if(!masterbranch) wildbranch+="."; wildbranch+="*"; tree->SetBranchStatus(wildbranch.Data(),1); cout <<"Build event activates: "<<wildbranch.Data() << endl; fbActivated = kTRUE;

Definition at line 137 of file TGo4EventElement.cxx.

References tree, and TString.

Referenced by TGo4EventElement::synchronizeWithTree().

138 {
139  if (branch==0) return 0;
140 
141  TString cad = branch->GetName();
142 
143  TTree* tree = branch->GetTree();
144 
145  if (var_ptr!=0)
146  tree->SetBranchAddress(cad.Data(), (void**)var_ptr);
147 
148  tree->SetBranchStatus(cad.Data(), 1);
149  cad+="*";
150  tree->SetBranchStatus(cad.Data(), 1);
151 
152  return 0;
153 }
TTree * tree
Definition: plot_dirc.C:12
Bool_t TGo4EventElement::CheckEventSource ( const char *  classname)
inherited

Check if event source is valid. Tests the pointer for zero, and if not zero, compares classname of the event source with given string. To be used from the Fill method and from the analysis method init event classes.

Definition at line 57 of file TGo4EventElement.cxx.

58 {
59  return kFALSE;
60 }
TProtoUnpackEvent::ClassDef ( TProtoUnpackEvent  ,
 
)
void TProtoUnpackEvent::Clear ( Option_t *  t = "")
virtual

Method called by the event owner (analysis step) to clear the event element.

Reimplemented from TGo4EventElement.

Definition at line 33 of file TProtoUnpackEvent.cxx.

References amplitude, energy, rawData, rawDataLength, time, trigger, and waveform.

34 {
35  void* destfield;
36  //cout << "+++ event clear" << endl;
37 
38  destfield = (void*) &amplitude[0];
39  memset(destfield, 0, sizeof(amplitude));
40 
41  destfield = (void*) &energy[0];
42  memset(destfield, 0, sizeof(energy));
43 
44  destfield = (void*) &time[0];
45  memset(destfield, 0, sizeof(time));
46 
47  destfield = (void*) &waveform[0];
48  memset(destfield, 0, sizeof(waveform));
49 
50  destfield = (void*) &trigger[0];
51  memset(destfield, 0, sizeof(trigger));
52 
53  rawDataLength = 0;
54  destfield = (void*) &rawData[0];
55  memset(destfield, 0, sizeof(rawData));
56 
57  return;
58 }
Double_t energy[ConfiguredProtoChannels]
Int_t waveform[ConfiguredProtoChannels][256]
Double_t amplitude[ConfiguredProtoChannels]
Int_t trigger[ConfiguredProtoChannels/16+1]
Double_t time[ConfiguredProtoChannels]
virtual void TGo4EventElement::clearAll ( Int_t  )
inlinevirtualinherited

Definition at line 91 of file TGo4EventElement.h.

91 {}
void TGo4EventElement::deactivate ( )
virtualinherited

Definition at line 155 of file TGo4EventElement.cxx.

References gTree, name, and TString.

156 {
157  TString name = GetName();
158 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,34,19)
159  name+=".";
160  gTree->SetBranchStatus(name.Data(), 0);
161  name+="*";
162  gTree->SetBranchStatus(name.Data(), 0);
163 #else
164  std::cout << "-W- Could not deactivate() event element %s in this ROOT Version, do not use!" << name.Data() << std::endl;
165 #endif
166 }
R__EXTERN TTree * gTree
TString name
Int_t TGo4EventElement::Fill ( )
virtualinherited

Method called by the event owner (analysis step) to fill the event element from the set event source. Event source can be the source of the analysis step (if this is a raw event) or the event processor (if this is a reduced event). Fill method has to specify how the event source writes to the members of this event structure. Either by calling methods of the source (like myevent.a=fxEventSource->GetA(); etc ), or by direct copy to the member (like fxEventSource->FillMemoryAt(&myevent.a);)

Definition at line 197 of file TGo4EventElement.cxx.

References TGo4EventElement::Clear(), TGo4EventElement::fxEventSource, res, and TGo4EventElement::SetValid().

198 {
199  Clear();
200 
201  if (fxEventSource==0) { SetValid(kFALSE); return 1; }
202 
203 
204  Int_t res =0;
205  SetValid(kFALSE);
206 
207  return res==0 ? 1 : res;
208 }
Int_t res
Definition: anadigi.C:166
void SetValid(Bool_t on)
virtual void Clear(Option_t *t="")
TGo4EventSource * fxEventSource
TGo4EventSource* TGo4EventElement::GetEventSource ( ) const
inlineinherited

Definition at line 60 of file TGo4EventElement.h.

References TGo4EventElement::fxEventSource.

60 { return fxEventSource; }
TGo4EventSource * fxEventSource
virtual Short_t TGo4EventElement::getId ( )
inlinevirtualinherited

Definition at line 93 of file TGo4EventElement.h.

References TGo4EventElement::fIdentifier.

93 { return fIdentifier;}
TGo4EventElement* TGo4EventElement::GetParent ( ) const
inlineinherited

Definition at line 58 of file TGo4EventElement.h.

References TGo4EventElement::fxParent.

58 { return fxParent; }
TGo4EventElement * fxParent
Int_t TGo4EventElement::Init ( )
virtualinherited

Method called on initialization of event classes. User might check the correct type of the eventsource here and assign this to a subclass pointer.

Definition at line 185 of file TGo4EventElement.cxx.

References TGo4EventElement::Clear(), TGo4EventElement::fxEventSource, res, and TGo4EventElement::SetValid().

186 {
187  Int_t res(0);
188  Clear();
189  SetValid(kTRUE);
190  if (fxEventSource) {
191  } else {
192  res = 1;
193  }
194  return res;
195 }
Int_t res
Definition: anadigi.C:166
void SetValid(Bool_t on)
virtual void Clear(Option_t *t="")
TGo4EventSource * fxEventSource
virtual Bool_t TGo4EventElement::isComposed ( )
inlinevirtualinherited

Definition at line 92 of file TGo4EventElement.h.

92 { return kFALSE; }
Bool_t TGo4EventElement::IsValid ( ) const
inlineinherited

Returns the valid state of this event.

Definition at line 50 of file TGo4EventElement.h.

References TGo4EventElement::fbIsValid.

50 { return fbIsValid; }
void TGo4EventElement::makeBranch ( TBranch *  parent)
virtualinherited

Definition at line 71 of file TGo4EventElement.cxx.

72 {
73  // method for recursive branching algorithm
74 
75 }
virtual TGo4EventElement& TGo4EventElement::operator[] ( Int_t  )
inlinevirtualinherited

Definition at line 95 of file TGo4EventElement.h.

95 { return *this; }
void TGo4EventElement::Print ( Option_t *  option = "") const
virtualinherited

Definition at line 66 of file TGo4EventElement.cxx.

References TGo4EventElement::PrintEvent().

67 {
68  ((TGo4EventElement*)this) -> PrintEvent();
69 }
virtual void PrintEvent()
void TGo4EventElement::PrintEvent ( )
virtualinherited

Method prints content of the event

Definition at line 62 of file TGo4EventElement.cxx.

Referenced by TGo4EventElement::Print().

63 {
64 }
virtual void TGo4EventElement::setDebug ( Bool_t  debug)
inlinevirtualinherited

Definition at line 94 of file TGo4EventElement.h.

References TGo4EventElement::fDebug.

94 { fDebug=debug;}
void TGo4EventElement::SetEventSource ( TGo4EventSource *  src)
inlineinherited

Setter for the event source that is currently used by the Fill method.

Definition at line 53 of file TGo4EventElement.h.

References TGo4EventElement::fxEventSource.

53 { fxEventSource=src; }
TGo4EventSource * fxEventSource
void TGo4EventElement::SetParent ( TGo4EventElement par)
inlineinherited

Setter for the parent event structure reference.

Definition at line 56 of file TGo4EventElement.h.

References TGo4EventElement::fxParent, and par.

56 { fxParent=par; }
Double_t par[3]
TGo4EventElement * fxParent
void TGo4EventElement::SetValid ( Bool_t  on)
inlineinherited

Switches the valid state of this event.

Definition at line 47 of file TGo4EventElement.h.

References TGo4EventElement::fbIsValid.

Referenced by TGo4EventElement::Fill(), and TGo4EventElement::Init().

47 { fbIsValid=on; }
void TGo4EventElement::synchronizeWithTree ( TTree *  tree,
TGo4EventElement **  var_ptr = 0 
)
virtualinherited

Use this method to map event structure with the Tree branch(es)

Definition at line 77 of file TGo4EventElement.cxx.

References TGo4EventElement::activateBranch(), and TString.

78 {
79 
80  if (tree==0) return;
81 
82  TBranch* topb = 0;
83  TString searchname = GetName();
84  if (searchname.Length()>0) {
85  searchname += ".";
86  topb = tree->FindBranch(searchname.Data());
87  }
88 
89  // if no appropriate branches found, use first branch for the event
90  // TODO: should we check class name of the branch?
91  if (topb==0) topb = (TBranch*) tree->GetListOfBranches()->First();
92 
93  Int_t index = tree->GetListOfBranches()->IndexOf(topb);
94 
95  // FIXME SL: should we activate other branches, reading not working when all branches disabled in the beginning
96  // note: only deactivate subleafs _after_ address of top branch is set!
97  // tree->SetBranchStatus("*",0);
98 
99  activateBranch(topb, index, var_ptr);
100 }
TTree * tree
Definition: plot_dirc.C:12
virtual Int_t activateBranch(TBranch *branch, Int_t index=0, TGo4EventElement **var_ptr=0)

Member Data Documentation

Double_t TProtoUnpackEvent::amplitude[ConfiguredProtoChannels]

Definition at line 32 of file TProtoUnpackEvent.h.

Referenced by Clear().

Double_t TProtoUnpackEvent::energy[ConfiguredProtoChannels]

Definition at line 33 of file TProtoUnpackEvent.h.

Referenced by Clear().

Bool_t TGo4EventElement::fDebug
protectedinherited

Definition at line 124 of file TGo4EventElement.h.

Referenced by TGo4EventElement::setDebug().

Short_t TGo4EventElement::fIdentifier
protectedinherited

Definition at line 123 of file TGo4EventElement.h.

Referenced by TGo4EventElement::getId().

Int_t TProtoUnpackEvent::rawData[1024]

Definition at line 37 of file TProtoUnpackEvent.h.

Referenced by Clear(), and PndEmcReadProto192Data::Exec().

Int_t TProtoUnpackEvent::rawDataLength

Definition at line 38 of file TProtoUnpackEvent.h.

Referenced by Clear().

Double_t TProtoUnpackEvent::time[ConfiguredProtoChannels]

Definition at line 34 of file TProtoUnpackEvent.h.

Referenced by Clear().

Int_t TProtoUnpackEvent::trigger[ConfiguredProtoChannels/16+1]

Definition at line 36 of file TProtoUnpackEvent.h.

Referenced by Clear().

Int_t TProtoUnpackEvent::waveform[ConfiguredProtoChannels][256]

Definition at line 35 of file TProtoUnpackEvent.h.

Referenced by Clear(), and PndEmcReadProto192Data::Exec().


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