Access geometry information
Access B field value
#include "DD4hep/LCDD.h"
#include "DD4hep/DD4hepUnits.h"
DD4hep::Geometry::LCDD& lcdd = DD4hep::Geometry::LCDD::getInstance();
const double position[3]={0,0,0}; // position to calculate magnetic field at (the origin in this case)
double bField[3]={0,0,0};
lcdd.field().magneticField(position,bField);
_Bz = bField[2]/dd4hep::tesla;
Access subdetector/layer/module ID given a hit collection
#include <UTIL/CellIDDecoder.h>
CellIDDecoder<SimTrackerHit> cellid_decoder( hitCol );
for(int i=0; i<nhits; i++){
SimTrackerHit *hit =dynamic_cast <SimTrackerHit*>( hitCol->getElementAt(i) );
int subdetectorID = cellid_decoder( hit )["subdet"];
int layerID = cellid_decoder( hit )["layer"];
int moduleID = cellid_decoder( hit )["module"];
}
--
RosaSimoniello - 2015-10-19