//----------------------------------------------------------------------------- // Jul 26 2001 P.Murat: STNTUPLE utility routines //----------------------------------------------------------------------------- #include "TObject.h" #include "Experiment/Experiment.hh" #include "AbsEnv/AbsEnv.hh" #include "Edm/EventRecord.hh" #include "TrackingObjects/Storable/CdfTrackColl.hh" #include "TrackingObjects/Storable/CdfTrackView.hh" #include //_____________________________________________________________________________ Int_t StntupleCreateTrackView(AbsEvent* Event, const char* CollName, CdfTrackView_h& ViewHandle) { // create track view corresponding to a collection with the given name 'Name' // if Name="default", return 'defTracks' // if name == 'all', return 'allTracks' char process[100], description[100]; CdfTrackView::Error ok = CdfTrackView::VIEW_NOT_FOUND; StntupleGetProcessName(CollName,process,description); if (strcmp(description,"default") == 0) { // default track collection has been // requested ok = CdfTrackView::defTracks(ViewHandle,process); } else if (strcmp(description,"all") == 0) { // all tracks have been requested ok = CdfTrackView::allTracks(ViewHandle,process); } else { ViewHandle = new CdfTrackView; ViewHandle->set_description("junk"); // collection with the given name // has been requested EventRecord::ConstIterator ci( AbsEnv::instance()->theEvent(), "CdfTrackColl" ); for ( ; ci.is_valid() ; ++ci ) { CdfTrackColl_ch chColl( ci ); if ((chColl->process_name() == "")||(chColl->process_name() == process)){ if (chColl->description() == description) { const CdfTrackColl::CollType & cont = chColl->contents(); for(CdfTrackColl::const_iterator i = cont.begin();i!=cont.end();++i){ ViewHandle->contents().push_back(*i); } ok = CdfTrackView::OK; break; } } } } return (ok == CdfTrackView::OK) ? 0 : -1; }