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

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2015-10-19 - RosaSimoniello
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CLIC All webs login

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