c++ - Ambiguous pointer; <SiHCollection> is ambiguous -
below i've posted code meant store hits collections in hce (hit collection of events). code compiles on running program, following error printed terminal 7 times: < sihcollection> ambiguous.
i have feeling because using namespace std although don't know how amend code. thoughts?
#include "sisd.h" #include "sihit.h" #include "g4hcofthisevent.hh" #include "g4step.hh" #include "g4threevector.hh" #include "g4sdmanager.hh" #include "g4ios.hh" #include "g4unitstable.hh" #include <fstream> #include <iostream> #include <sstream> using namespace std; extern ofstream outfile; sisd::sisd(g4string name) :g4vsensitivedetector(name) { collectionname.insert("sihcollection"); } sisd::~sisd(){ } void sisd::initialize(g4hcofthisevent* hce) { sihcollection = new sihitscollection(sensitivedetectorname, collectionname[0]); static g4int hcid = -1; if(hcid<0) { hcid = g4sdmanager::getsdmpointer()->getcollectionid(collectionname[0]); } hce->addhitscollection(hcid, sihcollection); } g4bool sisd::processhits(g4step* astep, g4touchablehistory*) { if(astep->gettrack()->gettrackid() > 0) { g4double edep = astep->gettotalenergydeposit(); if(edep==0) return false; sihit* ahit = new sihit(); ahit->setedep(edep); sihcollection->insert(ahit); return true; } else return false; }
Comments
Post a Comment