/* Generated by Together */ #include "FairMCApplication.h" #include "HadesShower.h" #include "FairVolume.h" #include "TGeoMCGeometry.h" #include "TGeoManager.h" #include "TGeoVolume.h" #include "TGeoMedium.h" #include "FairGeoInterface.h" #include "FairGeoBuilder.h" #include "FairGeoSet.h" #include "FairGeoNode.h" #include "TList.h" #include "HadesShowerPoint.h" #include "TLorentzVector.h" #include "TVirtualMC.h" #include "FairGeoLoader.h" #include "FairGeoRootBuilder.h" #include "hgeoshower.h" #include "iostream.h" #include "FairRootManager.h" ClassImp(HadesShower) void HadesShower::ConstructGeometry() { FairGeoLoader *geoLoad=FairGeoLoader::Instance(); FairGeoInterface *geoFace =geoLoad->getGeoInterface(); Bool_t rc = kTRUE; cout <<" -I Constructing Hades shower" << endl; FairGeoSet* gset=NULL; gset = new HGeoShower(); geoFace->addGeoModule(gset); gset->setGeomFile(GetGeometryFileName()); rc = geoFace->readSet(gset); if (rc) gset->create(geoLoad->getGeoBuilder()); TList* volList = gset->getListOfVolumes(); ProcessNodes ( volList ); } HadesShower::HadesShower(){ } HadesShower::~HadesShower() { } HadesShower::HadesShower(const char * name, Bool_t Active ) : FairDetector(name , Active), fShowerCollection(0) { fShowerCollection = new TClonesArray("HadesShowerPoint"); } void HadesShower::Initialize() { TRefArray *SDList = FairDetector::svList; Int_t NoOfEntries=SDList->GetEntries(); for (Int_t i = 0 ; i < NoOfEntries ; i++ ) { FairVolume* aVol = (FairVolume*) SDList->At(i); if ( aVol->getModId() == GetModId() ) { aVol->setMCid(gMC->VolId(aVol->getName())); } } } Bool_t HadesShower::ProcessHits(FairVolume *v) { Double_t fEdep = 0.0; Int_t copyNo; HadesShowerPoint *trdPoint=NULL; if ( gMC->IsTrackExiting() ) { // first test if E deposit is not null ! fEdep=gMC->Edep(); if (fEdep == 0.0 ) return kFALSE; trdPoint = AddHit(); // gMC->CurrentVolID(copyNo); trdPoint->SetDetectorID(v->getMCid()); trdPoint->SetELoss(fEdep); trdPoint->SetEtot(gMC->Etot()); trdPoint->SetTime(gMC->TrackTime()); trdPoint->SetLength(gMC->TrackLength()); trdPoint->SetTrackID(gMC->GetStack()->GetCurrentTrackNumber()); TLorentzVector pos; gMC->TrackPosition(pos); trdPoint->SetPos (TVector3(pos.X(), pos.Y(), pos.Z())); TLorentzVector mom; gMC->TrackMomentum(mom); trdPoint->SetMom (TVector3(mom.X(), mom.Y(), mom.Z())); } return kTRUE; } HadesShowerPoint* HadesShower::AddHit() { // Creates a new hit in the TClonesArray. // --- TClonesArray& ref = *fShowerCollection; Int_t size = ref.GetEntriesFast(); return new(ref[size]) HadesShowerPoint(); } void HadesShower::EndOfEvent() { Reset(); } void HadesShower::Register() { FairRootManager::Instance()->Register("ShowerPoint","SHOWER", fShowerCollection, kTRUE); } void HadesShower::Reset() { fShowerCollection->Clear(); }