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 http://www-d0.fnal.gov/Run2Physics/working_group/data_format/caf/
under the class list. We can click on cafe::Event and see all the objects. For exemple getEMscone is a Collection . To access it we need to define a object that is a collection and access the collection via a pointer:

Collection fro(event.getEMscone());

for(Collection::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.

Topic revision: r2 - 2006-09-18 - SergioLietti
 

This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback

antalya escort bursa escort eskisehir escort istanbul escort izmir escort