From bfa90c74599c1f98cefdc3547f163c12a756e57b Mon Sep 17 00:00:00 2001 From: Peter DeRosa <54421997+MagnusSnowleopard@users.noreply.github.com> Date: Thu, 15 Dec 2022 14:53:07 -0500 Subject: [PATCH] BGO done and working --- .Detector_Parameters.hh.swp | Bin 12288 -> 0 bytes .gitignore | 1 + BGOSD.cc | 34 +++++++++++++++++++++------------- CloverDetectorConstruction.cc | 8 ++++---- CloverEventAction.cc | 15 ++++++++------- 5 files changed, 34 insertions(+), 24 deletions(-) delete mode 100644 .Detector_Parameters.hh.swp diff --git a/.Detector_Parameters.hh.swp b/.Detector_Parameters.hh.swp deleted file mode 100644 index fd8ed3340192b44cd6e70c4a1c6cb1e38cb6cefb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&5IOA6u?UZdhjbm6Jt)#tcM(Ws=sGuSrv2@Sy0!HanXnjHQhCKK~MLlx_V_@ zKaL(H;63D=Q@}(13;zLg%|ZVG45-mgVLb_w*YKlfUcG+r)vx!mOpTnil`GKa z9>eQf#@_vPCE9=Bp-!S%uU zQl+uIe0gnf@#ese(tJbe;Y1YJzWHWfz*!=b>)|z_#iSan;7RfsO(}&8kO9U@Gw$>c zG2e5YO2@*_C*kOKx5x|`AOmE843GgbKnBPF86X4yBLilA4||IH-P`QB)7fDDiUGC&5%02v?yWPl8Og$6{-*y#g|9XyD`|f+H@&frC*+c}gf;h-=efh4Cec@ z{B3d1TExWA<$>2uck8h4^m*88$DO8(?{nX6EiBggZWwT{-wOAqVaMbBdd6m&p5=zv z)pfh`ZM&B1ySx`#+sn^(>xCZg2CW9cY#y)6yY0??)!DH;C*-~Mp!I$+9`?A~F62%} z@&doLV;1FEVIa=SQ7U11dK&t29tnfTtnV)C&BBOuc(t6^!M(e|JvakfTh6CF;7E(z z>8$m;sb1Vpmu<71!n2rd!}J_BWaVTeHCSL0X@mvqiLyY;6vx?+@URmroF|JUn7m4X z8zNR^u}kr^*$%|Q2oPF}O&I4Iq==GFjiro>s_IBWAq^x_%cXfa(_U!6a~!?|w*4zy zTfMn5SXsT=>42^$0r8+JuJZ{Pq3=s$fy!W_Qq>$I$G`5Ts>%$s{9@g1P*sIQ%m#_o zhALF`Vn&+~aC~$@Wl>tj5>9W_C)CfjB8AZ^yU&yPSe&ZSd@L$V6>O(fA(giyb)bGO tmSdGk7!H+~h%!^Zl~TpSWH`ju;|y1KT4J_+Da}VBg*Bm-z%3Lw{zo3^PlNyf diff --git a/.gitignore b/.gitignore index 9d0f0fd..3a3106e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.d *.so *.swp +*.swo diff --git a/BGOSD.cc b/BGOSD.cc index 2260fc8..b1b752d 100644 --- a/BGOSD.cc +++ b/BGOSD.cc @@ -1,5 +1,6 @@ -#include "CloverCrystalSD.hh" +//#include "CloverCrystalSD.hh" +#include "BGOSD.hh" #include "G4HCofThisEvent.hh" #include "G4Step.hh" @@ -10,7 +11,8 @@ ///....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -CloverCrystalSD::CloverCrystalSD(const G4String& name, const G4String& hitsCollectionName, const G4int nCrystal) +//CloverCrystalSD::CloverCrystalSD(const G4String& name, const G4String& hitsCollectionName, const G4int nCrystal) +BGOSD::BGOSD(const G4String& name, const G4String& hitsCollectionName, const G4int nCrystal) : G4VSensitiveDetector(name), fHitsCollection(nullptr), fNDet(nCrystal) @@ -20,23 +22,26 @@ CloverCrystalSD::CloverCrystalSD(const G4String& name, const G4String& hitsColle ///....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -CloverCrystalSD::~CloverCrystalSD() +//CloverCrystalSD::~CloverCrystalSD() +BGOSD::~BGOSD() { } ///....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void CloverCrystalSD::Initialize(G4HCofThisEvent* hce) +//void CloverCrystalSD::Initialize(G4HCofThisEvent* hce) +void BGOSD::Initialize(G4HCofThisEvent* hce) { // Create hits collection - fHitsCollection = new CloverCrystalHitsCollection(SensitiveDetectorName, collectionName[0]); + //fHitsCollection = new CloverCrystalHitsCollection(SensitiveDetectorName, collectionName[0]); + fHitsCollection = new BGOHitsCollection(SensitiveDetectorName, collectionName[0]); // Add this collection in hce G4int hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); hce->AddHitsCollection( hcID, fHitsCollection ); for (G4int i=0; iinsert(new CloverCrystalHit()); + fHitsCollection->insert(new BGOHit()); } //G4cout << "######### size of fHitCollection : " << fHitsCollection->GetSize() << G4endl; @@ -45,7 +50,8 @@ void CloverCrystalSD::Initialize(G4HCofThisEvent* hce) ///....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4bool CloverCrystalSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/) +//G4bool CloverCrystalSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/) +G4bool BGOSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/) { // energy deposit @@ -59,22 +65,23 @@ G4bool CloverCrystalSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history* if ( edep==0. && stepLength == 0. ) return false; - G4int crystalID = step->GetPreStepPoint()->GetTouchableHandle() ->GetCopyNumber(); + G4int BGOID = step->GetPreStepPoint()->GetTouchableHandle() ->GetCopyNumber(); //----------- save hit in each crystal - CloverCrystalHit * hit = (*fHitsCollection)[crystalID]; + BGOHit * hit = (*fHitsCollection)[BGOID]; hit->SetTrackID (step->GetTrack()->GetTrackID()); hit->SetEdep(edep); hit->SetPos (step->GetPostStepPoint()->GetPosition()); hit->SetStepLength( stepLength); - hit->SetCrystalID(crystalID); + hit->SetBGOID(BGOID); //---------- Save indivual hit - CloverCrystalHit* newHit = new CloverCrystalHit(); + // CloverCrystalHit* newHit = new CloverCrystalHit(); + BGOHit* newHit = new BGOHit(); newHit->SetTrackID (step->GetTrack()->GetTrackID()); - newHit->SetCrystalID(crystalID); + newHit->SetBGOID(BGOID); newHit->SetEdep(edep); newHit->SetPos (step->GetPostStepPoint()->GetPosition()); newHit->SetStepLength( stepLength); @@ -87,7 +94,8 @@ G4bool CloverCrystalSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history* ///....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void CloverCrystalSD::EndOfEvent(G4HCofThisEvent*) +//void CloverCrystalSD::EndOfEvent(G4HCofThisEvent*) +void BGOSD::EndOfEvent(G4HCofThisEvent*) { if ( verboseLevel > 1 ) { G4int nofHits = fHitsCollection->GetSize(); diff --git a/CloverDetectorConstruction.cc b/CloverDetectorConstruction.cc index bb7a62a..b91fe53 100644 --- a/CloverDetectorConstruction.cc +++ b/CloverDetectorConstruction.cc @@ -44,7 +44,7 @@ G4GlobalMagFieldMessenger* CloverDetectorConstruction::fMagFieldMessenger = 0; CloverDetectorConstruction::CloverDetectorConstruction() : G4VUserDetectorConstruction(), fNumOfCrystal(0), - fLogicBGO(NULL), fLogicCrystal(NULL), fCrystalMaterial(NULL), + fLogicCrystal(NULL), fLogicBGO(NULL), fCrystalMaterial(NULL), fCheckOverlaps(true) { fNumOfCrystal = Crystal_Num; //also need to change the fNDet in CloverEventAction.cc @@ -56,7 +56,7 @@ CloverDetectorConstruction::CloverDetectorConstruction() CloverDetectorConstruction::~CloverDetectorConstruction() { delete [] fLogicCrystal; - delete [] fLogicCrystal; + delete [] fLogicBGO; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -327,7 +327,7 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() if( jCrystal == 0 ) { caseLV[iClover] = new G4LogicalVolume(casing, G4Material::GetMaterial("G4_Al"), "Case"); - fLogicBGO[iClover] = new G4LogicalVolume(bgo , G4Material::GetMaterial("G4_Al"), "BGO "); + fLogicBGO[iClover] = new G4LogicalVolume(bgo , G4Material::GetMaterial("G4_Al"), "BGOLV"); bgowindowLV[iClover] = new G4LogicalVolume(bgowindow, G4Material::GetMaterial("G4_Al"), "BGO WINDOW "); new G4PVPlacement( rotmat , // case orientation @@ -342,7 +342,7 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes() new G4PVPlacement( bgomat , // bgo orientation bgo_pos, // bgo location fLogicBGO[i/4], // its logical volume - "Bgo", // its name + "BGO", // its name worldLV, // its mother volume false, // no boolean operation iClover, // copy number diff --git a/CloverEventAction.cc b/CloverEventAction.cc index 053a3d1..2c31947 100644 --- a/CloverEventAction.cc +++ b/CloverEventAction.cc @@ -28,9 +28,9 @@ CloverEventAction::CloverEventAction() : G4UserEventAction(), fCrystalHCID(-1), - fNDet(Crystal_Num), // number of crystal fBGOHCID(-1), - fNBGODet(Crystal_Num/4) // number of bgo + fNBGODet(Crystal_Num/4), // number of bgo + fNDet(Crystal_Num) // number of crystal { fdEList.clear(); fdLList.clear(); @@ -173,12 +173,12 @@ void CloverEventAction::EndOfEventAction(const G4Event* event) */ fdEList[i] = edep * resol * 1000; // to keV fdLList[i] = crystalHit->GetStepLength(); - + // std::cout<< "crystalhere "<< i << ", " << fdEList[i] << std::endl; } auto BGOHC = GetHitsBGOCollection(fBGOHCID, event); //this is G4VHitsCollection - for( int i = 0 ; i < fNDet ; i++){ + for( int i = 0 ; i < fNBGODet ; i++){ BGOHit * bgoHit = (*BGOHC)[i]; //this is CloverCrystalHit :: G4VHit //add detector resolution of 1% @@ -206,6 +206,7 @@ void CloverEventAction::EndOfEventAction(const G4Event* event) fBEList[i] = edep * resol * 1000; // to keV fBLList[i] = bgoHit->GetStepLength(); + // std::cout<< "bgohere "<< i << ", " << fBEList[i] << std::endl; } // get analysis manager @@ -214,9 +215,9 @@ void CloverEventAction::EndOfEventAction(const G4Event* event) // fill ntuple analysisManager->FillNtupleIColumn(0, n_trajectories); - analysisManager->FillNtupleDColumn(3, beamEnergy); - analysisManager->FillNtupleDColumn(4, beamTheta); - analysisManager->FillNtupleDColumn(5, beamPhi); + analysisManager->FillNtupleDColumn(5, beamEnergy); + analysisManager->FillNtupleDColumn(6, beamTheta); + analysisManager->FillNtupleDColumn(7, beamPhi); analysisManager->AddNtupleRow();