diff --git a/DDG4/examples/CLICSidSimu.py b/DDG4/examples/CLICSidSimu.py index afbd69536b8b39e9644dfe5313dc7d542729e768..ee1bc43324d59541916db27b804b496936bbea27 100644 --- a/DDG4/examples/CLICSidSimu.py +++ b/DDG4/examples/CLICSidSimu.py @@ -66,11 +66,11 @@ def run(): # Setup particle gun gun = simple.setupGun('Gun','pi-',100*GeV,True) - + """ trk = DDG4.GeneratorAction(kernel,"Geant4ParticleHandler/ParticleHandler") kernel.generatorAction().add(trk) trk.enableUI() - + """ """ rdr = DDG4.GeneratorAction(kernel,"LcioGeneratorAction/Reader") diff --git a/DDG4/lcio/LCIOConversions.cpp b/DDG4/lcio/LCIOConversions.cpp index 05d4932cf662700945068c679faffc2a93460a87..ef099f64b1455a0a67c36d7310135c806e49c0f5 100644 --- a/DDG4/lcio/LCIOConversions.cpp +++ b/DDG4/lcio/LCIOConversions.cpp @@ -165,8 +165,14 @@ namespace DD4hep { pair<VolMgr,Geant4HitCollection*>, lcio::SimTrackerHitImpl>::operator()(const arg_t& args) const { - lcio::LCCollectionVec* lc = new lcio::LCCollectionVec(lcio::LCIO::SIMTRACKERHIT); - return moveEntries<lcio::SimTrackerHitImpl>(args.second,lc); + Geant4HitCollection* coll = args.second; + lcio::SimTrackerHitImpl* hit = coll->hit(0); + long long int id1 = hit->getCellID1(), id0=hit->getCellID0(); + long long int cellID = (((id1<<32)&0xFFFFFFFF00000000)|(id0&0xFFFFFFFF)); + string dsc = encoding(args.first, cellID); + lcio::LCCollectionVec* lc_coll = new lcio::LCCollectionVec(lcio::LCIO::SIMTRACKERHIT); + UTIL::CellIDEncoder<SimTrackerHit> decoder(dsc,lc_coll); + return moveEntries<lcio::SimTrackerHitImpl>(args.second,lc_coll); } /// Data conversion interface moving lcio::SimCalorimeterHitImpl objects from a Geant4HitCollection to a LCCollectionVec @@ -187,7 +193,13 @@ namespace DD4hep { pair<VolMgr,Geant4HitCollection*>, lcio::SimCalorimeterHitImpl>::operator()(const arg_t& args) const { + Geant4HitCollection* coll = args.second; + lcio::SimCalorimeterHitImpl* hit = coll->hit(0); output_t* lc = new lcio::LCCollectionVec(lcio::LCIO::SIMCALORIMETERHIT); + long long int id1 = hit->getCellID1(), id0=hit->getCellID0(); + long long int cellID = (((id1<<32)&0xFFFFFFFF00000000)|(id0&0xFFFFFFFF)); + string dsc = encoding(args.first, cellID); + UTIL::CellIDEncoder<SimCalorimeterHit> decoder(dsc,lc); lc->setFlag(UTIL::make_bitset32(LCIO::CHBIT_LONG,LCIO::CHBIT_STEP)); return moveEntries<tag_t>(args.second,lc); } diff --git a/DDG4/plugins/Geant4SDActions.cpp b/DDG4/plugins/Geant4SDActions.cpp index 5633a393b2022000972c1a31396d35127da6e6bb..7e0d9ec0d6bf227d876c6700def956cbf1368894 100644 --- a/DDG4/plugins/Geant4SDActions.cpp +++ b/DDG4/plugins/Geant4SDActions.cpp @@ -182,12 +182,12 @@ namespace DD4hep { Geant4TouchableHandler handler(step); //hit = new Hit(pos); hit = new Hit(h.prePos()); - hit->cellID = volumeID(step); + hit->cellID = cellID(step); coll->add(hit); print("SimpleCalorimeter","%s> CREATE hit with deposit:%7.3f MeV Pos:%8.2f %8.2f %8.2f %s", c_name(),contrib.deposit,pos.X(),pos.Y(),pos.Z(),handler.path().c_str()); if ( 0 == hit->cellID ) { - hit->cellID = volumeID(step); + hit->cellID = cellID(step); throw runtime_error("Invalid CELL ID for hit!"); } } @@ -196,7 +196,7 @@ namespace DD4hep { c_name(),contrib.deposit,pos.X(),pos.Y(),pos.Z()); } hit->truth.push_back(contrib); - hit->energyDeposit += contrib.deposit; + hit->energyDeposit += contrib.deposit; mark(h.track); return true; }