//*-- Created : 04/12/2009 by J.Markert //_HADES_CLASS_DESCRIPTION /////////////////////////////////////////////////////////////////////////////// // // HStart2HitFSim // // This class implements the hit finder for the Start2 detector in simulation. // Since there is no START in simulation only the sartr hit with the given // time resultion is generated to give realistic resultion of the TOF and RPC. // // /////////////////////////////////////////////////////////////////////////////// #include "hades.h" #include "hcategory.h" #include "hcategorymanager.h" #include "hevent.h" #include "hstart2hit.h" #include "hstart2hitfsim.h" #include "hstartdef.h" #include "TRandom.h" #include #include using namespace std; ClassImp(HStart2HitFSim) HStart2HitFSim* HStart2HitFSim::fHitFinder = NULL; HStart2HitFSim::HStart2HitFSim(void) : HReconstructor() { // default constructor fCatHit = NULL; fresolution= 0.006; fHitFinder = this; } HStart2HitFSim::HStart2HitFSim(const Text_t *name, const Text_t *title, Double_t resol) : HReconstructor(name, title) { // constructor fCatHit = NULL; fresolution = resol; fHitFinder = this; } Bool_t HStart2HitFSim::init(void) { // creates the Start2Hit category fCatHit = HCategoryManager::getCategory(catStart2Hit,2); if(!fCatHit) fCatHit = HCategoryManager::addCategory(catStart2Hit,"HStart2Hit",10,"Start",kFALSE); return kTRUE; } Int_t HStart2HitFSim::execute(void) { // fills the HStartHit category if(!fCatHit) return 0; HStart2Hit* pHit = NULL; Int_t module = 0; Int_t strip = 0; Bool_t exists = kFALSE; pHit = (HStart2Hit*) fCatHit->getObject(0); if(!pHit){ Int_t index=-1; pHit = HCategoryManager::newObject(pHit,fCatHit,index); } else exists = kTRUE; if (NULL != pHit) { Float_t res = gRandom->Gaus(0,fresolution); if(exists){ pHit->setResolution(res); } else { pHit->setAddress(module, strip); pHit->setTimeAndWidth(res, 1); pHit->setResolution(res); pHit->setFlag(kTRUE); pHit->setCorrFlag(2); pHit->setMultiplicity(1); } } else { Error("execute", "Can't get slot"); return 0; } return 0; }