11 #include "TEveManager.h"
12 #include "TEveStraightLineSet.h"
13 #include "TEvePointSet.h"
17 #include "EVENT/LCEvent.h"
18 #include "EVENT/LCCollection.h"
19 #include "EVENT/SimCalorimeterHit.h"
20 #include "EVENT/SimTrackerHit.h"
21 #include "EVENT/CalorimeterHit.h"
22 #include "EVENT/TrackerHit.h"
23 #include "UTIL/Operators.h"
34 TEveElement*
createPointSet( lcio::LCCollection* col,
const std::string& name,
unsigned color=kMagenta,
unsigned size=1,
unsigned style=4 ) ;
54 static int count = 1 ;
56 static LCReader* rdr = 0 ;
58 std::string lcioFileName =
"teve_infile.slcio" ;
60 std::cout <<
" next_event_lcio called ..." << std::endl ;
64 rdr = LCFactory::getInstance()->createLCReader() ;
68 rdr->open( lcioFileName ) ;
70 }
catch(lcio::IOException& e) {
72 std::cout <<
" ------------------------------------------------------------------------------------------------ " << std::endl
73 <<
"*** file " << lcioFileName <<
" does not exist - can't read LCIO events ! " << std::endl
74 <<
" will display detector geometry only. Link LCIO file to " << lcioFileName <<
" to display events ! "<< std::endl
75 <<
" -------------------------------------------------------------------------------------------------"
90 tevent->DestroyElements() ;
92 LCEvent* evt = rdr->readNextEvent() ;
96 const std::vector< std::string >& colNames = * evt->getCollectionNames() ;
98 for(
unsigned icol=0, ncol = colNames.size() ; icol < ncol ; ++icol ){
100 LCCollection* col = evt->getCollection( colNames[ icol ] ) ;
102 std::cout <<
" **** reading collection " << colNames[ icol ] << std::endl ;
105 if( col->getTypeName() == LCIO::SIMTRACKERHIT ){
109 else if( col->getTypeName() == LCIO::SIMCALORIMETERHIT ){
113 else if( col->getTypeName() == LCIO::TRACKERHIT ){
117 else if( col->getTypeName() == LCIO::CALORIMETERHIT ){
126 std::cout <<
"WARNING: can't read LCEvent from input file ! " << std::endl ;
139 TEveElement*
createPointSet( lcio::LCCollection* col,
const std::string& name,
unsigned color,
unsigned size,
unsigned style ) {
141 TEvePointSet* ps =
new TEvePointSet( name.c_str() );
142 ps->SetOwnIds(kTRUE);
144 int nHit = col->getNumberOfElements() ;
146 for(
int i=0 ; i< nHit ; ++i ){
148 T* hit = (T*) col->getElementAt( i ) ;
150 double pos[3] = { hit->getPosition()[0], hit->getPosition()[1] , hit->getPosition()[2] } ;
155 ps->SetNextPoint( pos[0]*dd4hep::mm , pos[1]*dd4hep::mm, pos[2]*dd4hep::mm );
158 id[0] = hit->getCellID0() ;
159 id[1] = hit->getCellID1() ;
161 ps->SetPointIntIds(
id ) ;
166 ps->SetMarkerColor( color ) ;
167 ps->SetMarkerSize( size );
168 ps->SetMarkerStyle( style );