Tags:
create new tag
,
view all tags
---+How to Access Data via Cafe _by Pedro Mercadante - Last update on 15-Dec-2005_ *How To Make a Processor and Access the Data via Cafe* On d0server copy the following files to your work directory: ==/home/mercadan/Analises/cafe/zpeak/AddProcessor.sh== ==/home/mercadan/Analises/cafe/zpeak/TClass.cpp== ==/home/mercadan/Analises/cafe/zpeak/TClass.hpp== ==/home/mercadan/Analises/cafe/zpeak/TClass_linkdef.h== ==/home/mercadan/Analises/cafe/zpeak/TClass_t.cpp== Execute: ==./AddProcessor.sh inv_mass !InvMass== The first argument is the package name and the second is the processor name. The !AddProcessor.sh creates all the necessary .cpp, .hpp and linkdef.h. We should edit the inv_mass/src/InvMass.cpp. Basically in !InvMass::begin() we initialize the histograms; in !InvMass::processEvent(cafe::Event& event) we process events, do whatever we need and fill the histograms; and in !InvMass::finish() we write the histograms. To access the data we should look at <a href="http://www-d0.fnal.gov/Run2Physics/working_group/data_format/caf/"> http://www-d0.fnal.gov/Run2Physics/working_group/data_format/caf/</a> %BR% under the class list. We can click on cafe::Event and see all the objects. For exemple getEMscone is a Collection <TMBEMCluster>. To access it we need to define a object that is a collection and access the collection via a pointer: ==Collection<TMBEMCluster> fro(event.getEMscone());== ==for(Collection<TMBEMCluster>::const_iterator it = fro.begin() ;== ==it != fro.end(); ++it)== Now we can access all objects defined in the class TMBEMCluster. For example, Px, Py, Pz: ==float ele_pt = it->Pt() ;== ==float ele_px = it->Px() ;== ==float ele_py = it->Py() ;== ==float ele_pz = it->Pz() ;== ==float ele_E = it->E() ;== One note for the histograms: we define the histograms in the !InvMass::begin() function and fill in the bool !InvMass::processEvent(cafe::Event& event) function. So don't forget to declare the global variables in the .hpp file.
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r2 - 2006-09-18
-
SergioLietti
Home
Site map
Main web
Sandbox web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback