BGO Fully operational

This commit is contained in:
Peter DeRosa 2022-12-16 23:42:15 -05:00
parent bfa90c7459
commit ec632d911f
10 changed files with 318 additions and 113 deletions

View File

@ -30,6 +30,8 @@
TH1F * hEnergy[64]; TH1F * hEnergy[64];
TH1F * hAddback[16]; TH1F * hAddback[16];
//if you need to make the energy histograms then just copy how the addback histograms are made.
void Analyzer::Begin(TTree * /*tree*/) void Analyzer::Begin(TTree * /*tree*/)
{ {
// The Begin() function is called at the start of the query. // The Begin() function is called at the start of the query.
@ -39,10 +41,10 @@ void Analyzer::Begin(TTree * /*tree*/)
TString option = GetOption(); TString option = GetOption();
for( int i = 0; i < 64; i++){ for( int i = 0; i < 64; i++){
hEnergy[i] = new TH1F(Form("hE%02d", i), Form("hE%02d", i), 4000, 0, 4000); hEnergy[i] = new TH1F(Form("hE%02d", i), Form("hE%02d", i), 8000, 0, 8000);
if( i < 16 ){ if( i < 16 ){
hAddback[i] = new TH1F(Form("AE%02d",i), Form("AE%02d",i), 4000,0,4000); hAddback[i] = new TH1F(Form("AE%02d",i), Form("AE%02d",i), 8000,0,8000);
} }
} }
@ -79,19 +81,21 @@ Bool_t Analyzer::Process(Long64_t entry)
// //
// The return value is currently not used. // The return value is currently not used.
b_energy->GetEntry(entry); b_energy->GetEntry(entry);
b_bgoenergy->GetEntry(entry);
double addback[16] ={0}; double addback[16] ={0};
for(int i =0; i < 64; i++){ for(int i =0; i < 64; i++){
if((*energy)[i] <= 0.) { continue ; } if((*energy)[i] <= 0.) { continue ; } //Energy threshold Addback selector.
/// printf("%2d, %f \n", i, (*energy)[i]); /// printf("%2d, %f \n", i, (*energy)[i]);
hEnergy[i]->Fill((*energy)[i]); hEnergy[i]->Fill((*energy)[i]);
int iclover = i/4; int iclover = i/4;
if( entry < 1000 && (*bgoenergy)[iclover] > 10.) printf("%d , %f, %d, %f \n", i, (*energy)[i], iclover,(*bgoenergy)[iclover] );
if((*bgoenergy)[iclover] <= 0){
addback[iclover] += (*energy)[i]; addback[iclover] += (*energy)[i];
// if( entry < 10 ) printf("%d , %f, %d, %f \n", i, (*energy)[i], iclover, addback[iclover]); }
} }
for( int i = 0; i < 16; i++){ for( int i = 0; i < 16; i++){
if(addback[i] <= 0.){continue;} if(addback[i] <= 0.){continue;}
hAddback[i]->Fill(addback[i]); hAddback[i]->Fill(addback[i]);
@ -129,5 +133,5 @@ void Analyzer::Terminate()
// a query. It always runs on the client, it can be used to present // a query. It always runs on the client, it can be used to present
// the results graphically or save the results to file. // the results graphically or save the results to file.
hAddback[14]->Draw(); hAddback[0]->Draw();
} }

View File

@ -26,6 +26,8 @@ public :
Int_t nTraj; Int_t nTraj;
vector<double> *energy; vector<double> *energy;
vector<double> *stepLength; vector<double> *stepLength;
vector<double> *bgoenergy;
vector<double> *bgostepLength;
Double_t bEnergy; Double_t bEnergy;
Double_t theta; Double_t theta;
Double_t phi; Double_t phi;
@ -34,6 +36,8 @@ public :
TBranch *b_nTraj; //! TBranch *b_nTraj; //!
TBranch *b_energy; //! TBranch *b_energy; //!
TBranch *b_stepLength; //! TBranch *b_stepLength; //!
TBranch *b_bgoenergy; //!
TBranch *b_bgostepLength; //!
TBranch *b_bEnergy; //! TBranch *b_bEnergy; //!
TBranch *b_theta; //! TBranch *b_theta; //!
TBranch *b_phi; //! TBranch *b_phi; //!
@ -73,6 +77,8 @@ void Analyzer::Init(TTree *tree)
// Set object pointer // Set object pointer
energy = 0; energy = 0;
stepLength = 0; stepLength = 0;
bgoenergy = 0;
bgostepLength = 0;
// Set branch addresses and branch pointers // Set branch addresses and branch pointers
if (!tree) return; if (!tree) return;
fChain = tree; fChain = tree;
@ -81,6 +87,8 @@ void Analyzer::Init(TTree *tree)
fChain->SetBranchAddress("nTraj", &nTraj, &b_nTraj); fChain->SetBranchAddress("nTraj", &nTraj, &b_nTraj);
fChain->SetBranchAddress("energy", &energy, &b_energy); fChain->SetBranchAddress("energy", &energy, &b_energy);
fChain->SetBranchAddress("stepLength", &stepLength, &b_stepLength); fChain->SetBranchAddress("stepLength", &stepLength, &b_stepLength);
fChain->SetBranchAddress("bgoE", &bgoenergy, &b_bgoenergy);
fChain->SetBranchAddress("bgostep", &bgostepLength, &b_bgostepLength);
fChain->SetBranchAddress("bEnergy", &bEnergy, &b_bEnergy); fChain->SetBranchAddress("bEnergy", &bEnergy, &b_bEnergy);
fChain->SetBranchAddress("theta", &theta, &b_theta); fChain->SetBranchAddress("theta", &theta, &b_theta);
fChain->SetBranchAddress("phi", &phi, &b_phi); fChain->SetBranchAddress("phi", &phi, &b_phi);

133
AnalyzerCloveronly.C Normal file
View File

@ -0,0 +1,133 @@
#define Analyzer_cxx
// The class definition in Analyzer.h has been generated automatically
// by the ROOT utility TTree::MakeSelector(). This class is derived
// from the ROOT class TSelector. For more information on the TSelector
// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
// The following methods are defined in this file:
// Begin(): called every time a loop on the tree starts,
// a convenient place to create your histograms.
// SlaveBegin(): called after Begin(), when on PROOF called only on the
// slave servers.
// Process(): called for each event, in this function you decide what
// to read and fill your histograms.
// SlaveTerminate: called at the end of the loop on the tree, when on PROOF
// called only on the slave servers.
// Terminate(): called at the end of the loop on the tree,
// a convenient place to draw/fit your histograms.
//
// To use this file, try the following session on your Tree T:
//
// root> T->Process("Analyzer.C")
// root> T->Process("Analyzer.C","some options")
// root> T->Process("Analyzer.C+")
//
#include "Analyzer.h"
#include <TH2.h>
#include <TStyle.h>
TH1F * hEnergy[64];
TH1F * hAddback[16];
void Analyzer::Begin(TTree * /*tree*/)
{
// The Begin() function is called at the start of the query.
// When running with PROOF Begin() is only called on the client.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
for( int i = 0; i < 64; i++){
hEnergy[i] = new TH1F(Form("hE%02d", i), Form("hE%02d", i), 4000, 0, 4000);
if( i < 16 ){
hAddback[i] = new TH1F(Form("AE%02d",i), Form("AE%02d",i), 4000,0,4000);
}
}
}
void Analyzer::SlaveBegin(TTree * /*tree*/)
{
// The SlaveBegin() function is called after the Begin() function.
// When running with PROOF SlaveBegin() is called on each slave server.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
}
Bool_t Analyzer::Process(Long64_t entry)
{
// The Process() function is called for each entry in the tree (or possibly
// keyed object in the case of PROOF) to be processed. The entry argument
// specifies which entry in the currently loaded tree is to be processed.
// It can be passed to either Analyzer::GetEntry() or TBranch::GetEntry()
// to read either all or the required parts of the data. When processing
// keyed objects with PROOF, the object is already loaded and is available
// via the fObject pointer.
//
// This function should contain the "body" of the analysis. It can contain
// simple or elaborate selection criteria, run algorithms on the data
// of the event and typically fill histograms.
//
// The processing can be stopped by calling Abort().
//
// Use fStatus to set the return value of TTree::Process().
//
// The return value is currently not used.
b_energy->GetEntry(entry);
double addback[16] ={0};
for(int i =0; i < 64; i++){
if((*energy)[i] <= 0.) { continue ; }
/// printf("%2d, %f \n", i, (*energy)[i]);
hEnergy[i]->Fill((*energy)[i]);
int iclover = i/4;
addback[iclover] += (*energy)[i];
// if( entry < 10 ) printf("%d , %f, %d, %f \n", i, (*energy)[i], iclover, addback[iclover]);
}
for( int i = 0; i < 16; i++){
if(addback[i] <= 0.){continue;}
hAddback[i]->Fill(addback[i]);
// if( entry < 10 ) printf("=--==%d, %f \n", i, addback[i]);
}
return kTRUE;
}
void Analyzer::SlaveTerminate()
{
// The SlaveTerminate() function is called after all entries or objects
// have been processed. When running with PROOF SlaveTerminate() is called
// on each slave server.
}
void Analyzer::Terminate()
{
TFile * out = new TFile("CloverAddback.root","recreate");
out->cd();
for(int j = 0; j< 64; j++){
hEnergy[j]->Write();
}
for(int k = 0; k< 16; k++){
hAddback[k]->Write();
}
out->Close();
// The Terminate() function is the last function to be called during
// a query. It always runs on the client, it can be used to present
// the results graphically or save the results to file.
hAddback[14]->Draw();
}

100
AnalyzerCloveronly.h Normal file
View File

@ -0,0 +1,100 @@
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Mon Oct 17 14:56:21 2022 by ROOT version 6.26/06
// from TTree Clover/Edep and TrackL
// found on file: AllCrystal_Co60.root
//////////////////////////////////////////////////////////
#ifndef Analyzer_h
#define Analyzer_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
// Header file for the classes stored in the TTree if any.
#include "vector"
class Analyzer : public TSelector {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
// Fixed size dimensions of array or collections stored in the TTree if any.
// Declaration of leaf types
Int_t nTraj;
vector<double> *energy;
vector<double> *stepLength;
Double_t bEnergy;
Double_t theta;
Double_t phi;
// List of branches
TBranch *b_nTraj; //!
TBranch *b_energy; //!
TBranch *b_stepLength; //!
TBranch *b_bEnergy; //!
TBranch *b_theta; //!
TBranch *b_phi; //!
Analyzer(TTree * /*tree*/ =0) : fChain(0) { }
virtual ~Analyzer() { }
virtual Int_t Version() const { return 2; }
virtual void Begin(TTree *tree);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
virtual void SetOption(const char *option) { fOption = option; }
virtual void SetObject(TObject *obj) { fObject = obj; }
virtual void SetInputList(TList *input) { fInput = input; }
virtual TList *GetOutputList() const { return fOutput; }
virtual void SlaveTerminate();
virtual void Terminate();
ClassDef(Analyzer,0);
};
#endif
#ifdef Analyzer_cxx
void Analyzer::Init(TTree *tree)
{
// The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses and branch
// pointers of the tree will be set.
// It is normally not necessary to make changes to the generated
// code, but the routine can be extended by the user if needed.
// Init() will be called many times when running on PROOF
// (once per file to be processed).
// Set object pointer
energy = 0;
stepLength = 0;
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("nTraj", &nTraj, &b_nTraj);
fChain->SetBranchAddress("energy", &energy, &b_energy);
fChain->SetBranchAddress("stepLength", &stepLength, &b_stepLength);
fChain->SetBranchAddress("bEnergy", &bEnergy, &b_bEnergy);
fChain->SetBranchAddress("theta", &theta, &b_theta);
fChain->SetBranchAddress("phi", &phi, &b_phi);
}
Bool_t Analyzer::Notify()
{
// The Notify() function is called when a new file is opened. This
// can be either for a new TTree in a TChain or when when a new TTree
// is started when using PROOF. It is normally not necessary to make changes
// to the generated code, but the routine can be extended by the
// user if needed. The return value is currently not used.
return kTRUE;
}
#endif // #ifdef Analyzer_cxx

View File

@ -1,89 +0,0 @@
# DO NOT DELETE
./Analyzer_C.so: Analyzer.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TROOT.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDirectory.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TNamed.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TObject.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Rtypes.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RtypesCore.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RConfig.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RVersion.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RConfigure.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/DllImport.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/strtok.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/strlcpy.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/snprintf.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TGenericClassInfo.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSchemaHelper.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TIsAProxy.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualIsAProxy.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TStorage.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVersionCheck.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RVersion.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TString.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TMathBase.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RStringView.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TypeTraits.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TClass.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDictionary.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ESTLType.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TObjArray.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSeqCollection.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TCollection.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TIterator.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualRWMutex.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualMutex.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RRangeCast.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RSpan.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/span.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TUUID.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TList.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBuffer.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDataType.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Bytes.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Byteswap.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TChain.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TTree.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Compression.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TIOFeatures.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayD.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArray.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayI.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttFill.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttLine.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttMarker.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVirtualTreePlayer.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBranch.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBranchCacheInfo.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TBits.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TFile.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDirectoryFile.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TDatime.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TUrl.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/RConcurrentHashColl.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TRWSpinLock.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/TSpinMutex.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSelector.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TSelectorList.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/THashList.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TH2.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TH1.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAxis.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttAxis.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayC.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayS.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TArrayF.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/Foption.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/ROOT/EExecutionPolicy.hxx
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVectorFfwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TVectorDfwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TFitResultPtr.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TMatrixFBasefwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TMatrixDBasefwd.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TStyle.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TAttText.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/TColor.h
./Analyzer_C.so: /usr/local/Cellar/root/6.26.06_1/include/root/RVersion.h /usr/local/Cellar/root/6.26.06_1/include/root/RConfig.h /usr/local/Cellar/root/6.26.06_1/include/root/TClass.h /usr/local/Cellar/root/6.26.06_1/include/root/TDictAttributeMap.h /usr/local/Cellar/root/6.26.06_1/include/root/TInterpreter.h /usr/local/Cellar/root/6.26.06_1/include/root/TROOT.h /usr/local/Cellar/root/6.26.06_1/include/root/TBuffer.h /usr/local/Cellar/root/6.26.06_1/include/root/TMemberInspector.h /usr/local/Cellar/root/6.26.06_1/include/root/TError.h /usr/local/Cellar/root/6.26.06_1/include/root/RtypesImp.h /usr/local/Cellar/root/6.26.06_1/include/root/TIsAProxy.h /usr/local/Cellar/root/6.26.06_1/include/root/TFileMergeInfo.h /usr/local/Cellar/root/6.26.06_1/include/root/TCollectionProxyInfo.h /usr/local/bin/rootcling
Analyzer_C__ROOTBUILDVERSION= 6.26/06

Binary file not shown.

Binary file not shown.

View File

@ -89,6 +89,24 @@ void CloverDetectorConstruction::DefineMaterials()
// Aluminium // Aluminium
nistManager->FindOrBuildMaterial("G4_Al"); nistManager->FindOrBuildMaterial("G4_Al");
//nistManager->FindOrBuildMaterial("G4_Bi4-Ge3-O12");
auto a = 208.98*g/mole;
G4Element* bi = new G4Element("Bismuth","Bi",83.,a);
auto b = 72.64*g/mole;
G4Element* ge = new G4Element("Germanium","Ge",32.,b);
auto c = 16.0*g/mole;
G4Element* ox = new G4Element("Oxygen","ox",16.,c);
auto density = 7.13*g/cm3;
G4Material* bgocrystalmaterial = new G4Material("bgocrystalmaterial",density,3);
bgocrystalmaterial->AddElement(bi, 4);
bgocrystalmaterial->AddElement(ge, 3);
bgocrystalmaterial->AddElement(ox, 12);
// Ge // Ge
fCrystalMaterial = nistManager->FindOrBuildMaterial("G4_Ge"); fCrystalMaterial = nistManager->FindOrBuildMaterial("G4_Ge");
@ -215,16 +233,25 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
G4VSolid* bgo_u = new G4UnionSolid("bgo2 + bgo3",bgo2,bgo3,bgo3_m,bgo3_v); G4VSolid* bgo_u = new G4UnionSolid("bgo2 + bgo3",bgo2,bgo3,bgo3_m,bgo3_v);
G4Trd* bgoactive = new G4Trd("bgoactive", (bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut1 - 22*mm ,(bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut1 + 12*mm
, (bgoXYInner + bgoXYWallThickness)/2. - bgoanglecut1 - 22*mm, (bgoXYInner + bgoXYWallThickness)/2. - bgoanglecut1 +12*mm, zbgo1);
//G4Box* bgo2 = new G4Box("bgo2", (bgoXYInner+ bgoXYWallThickness)/2., (bgoXYInner + bgoXYWallThickness)/2., bgoZInner + bgoZWallThickness*2.); //G4Box* bgo2 = new G4Box("bgo2", (bgoXYInner+ bgoXYWallThickness)/2., (bgoXYInner + bgoXYWallThickness)/2., bgoZInner + bgoZWallThickness*2.);
G4Trd* bgo33 = new G4Trd("bgo33", (bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut0 + bgoanglecut2 - 10*mm,(bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut1
, (bgoXYInner + bgoXYWallThickness)/2. - bgoanglecut0 + bgoanglecut2 - 10*mm, (bgoXYInner + bgoXYWallThickness)/2.- bgoanglecut1, zbgo1);
G4Trd* bgowindow = new G4Trd("bgowindow", (bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut0 ,(bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut0 +bgoanglecut2 G4Trd* bgowindow1 = new G4Trd("bgowindow1", (bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut0 ,(bgoXYInner+ bgoXYWallThickness)/2. - bgoanglecut0 +bgoanglecut2
, (bgoXYInner + bgoXYWallThickness)/2. - bgoanglecut0, (bgoXYInner + bgoXYWallThickness)/2. -bgoanglecut0 +bgoanglecut2, zbgo2/2); , (bgoXYInner + bgoXYWallThickness)/2. - bgoanglecut0, (bgoXYInner + bgoXYWallThickness)/2. -bgoanglecut0 +bgoanglecut2, zbgo2/2);
G4Box* bgo11 = new G4Box("bgo11", bgoXYInner/2. - 10*mm, bgoXYInner/2.-10*mm, bgoZInner +zbgo1);
G4SubtractionSolid * bgowindow = new G4SubtractionSolid("bgowindow",bgowindow1,bgo11);
G4SubtractionSolid * bgoSH= new G4SubtractionSolid("bgoSH", bgo_u, bgo1);
G4SubtractionSolid * bgo = new G4SubtractionSolid("bgo", bgo_u, bgo1); G4SubtractionSolid * bgo = new G4SubtractionSolid("bgo", bgoactive, bgo33);
//G4SubtractionSolid * bgoSH= new G4SubtractionSolid("bgoSH", bgoSH0, bgo);
// creating the subtraction solid that will form the actual bgo sheild. // creating the subtraction solid that will form the actual bgo sheild.
@ -246,7 +273,7 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
auto caseLV = new G4LogicalVolume * [fNumOfCrystal/4]; auto caseLV = new G4LogicalVolume * [fNumOfCrystal/4];
// fLogicBGO = new G4LogicalVolume * [fNumOfCrystal/4]; auto bgoshieldLV = new G4LogicalVolume * [fNumOfCrystal/4];
auto bgowindowLV = new G4LogicalVolume * [fNumOfCrystal/4]; auto bgowindowLV = new G4LogicalVolume * [fNumOfCrystal/4];
fLogicCrystal[i]->SetVisAttributes(crystalVisAtt); fLogicCrystal[i]->SetVisAttributes(crystalVisAtt);
@ -271,13 +298,15 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
G4ThreeVector case_pos = G4ThreeVector(0,0,88*mm+crystalZPos); //The crystalZpos is the radius of the detector, G4ThreeVector case_pos = G4ThreeVector(0,0,88*mm+crystalZPos); //The crystalZpos is the radius of the detector,
//bgo uses an identical rotation matrix as the case, //bgo uses an identical rotation matrix as the case,
//you can also add in zmod if you want to shift the shielding. //you can also add in zmod if you want to shift the shielding.
G4ThreeVector bgo_pos = G4ThreeVector(0,0,115*mm+crystalZPos); G4ThreeVector bgoS_pos = G4ThreeVector(0,0,115*mm+crystalZPos);
G4ThreeVector bgoA_pos = G4ThreeVector(0,0,115*mm+crystalZPos - 80*mm);
G4ThreeVector bgowindow_pos = G4ThreeVector(0,0,-63*mm + crystalZPos); G4ThreeVector bgowindow_pos = G4ThreeVector(0,0,-63*mm + crystalZPos);
//Set rotation matrix settings for clovers. //Set rotation matrix settings for clovers.
G4RotationMatrix * bgowindowmat = new G4RotationMatrix(); G4RotationMatrix * bgowindowmat = new G4RotationMatrix();
G4RotationMatrix * bgomat = new G4RotationMatrix(); G4RotationMatrix * bgoSmat = new G4RotationMatrix();
G4RotationMatrix * bgoAmat = new G4RotationMatrix();
G4RotationMatrix * rotmat = new G4RotationMatrix(); G4RotationMatrix * rotmat = new G4RotationMatrix();
G4RotationMatrix * crystalmat= new G4RotationMatrix(); G4RotationMatrix * crystalmat= new G4RotationMatrix();
@ -291,8 +320,11 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
bgowindowmat->rotateZ(-dPsi*degree); bgowindowmat->rotateZ(-dPsi*degree);
bgowindowmat->rotateX(-dTheta*degree); bgowindowmat->rotateX(-dTheta*degree);
bgomat->rotateZ(-dPsi*degree); bgoSmat->rotateZ(-dPsi*degree);
bgomat->rotateX(-dTheta*degree); bgoSmat->rotateX(-dTheta*degree);
bgoAmat->rotateZ(-dPsi*degree);
bgoAmat->rotateX(-dTheta*degree);
rotmat->rotateZ(-dPsi*degree); rotmat->rotateZ(-dPsi*degree);
rotmat->rotateX(-dTheta*degree); rotmat->rotateX(-dTheta*degree);
@ -308,8 +340,11 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
case_pos.rotateX(dTheta *degree); case_pos.rotateX(dTheta *degree);
case_pos.rotateZ(dPsi*degree); case_pos.rotateZ(dPsi*degree);
bgo_pos.rotateX(dTheta *degree); bgoA_pos.rotateX(dTheta *degree);
bgo_pos.rotateZ(dPsi*degree); bgoA_pos.rotateZ(dPsi*degree);
bgoS_pos.rotateX(dTheta *degree);
bgoS_pos.rotateZ(dPsi*degree);
bgowindow_pos.rotateX(dTheta *degree); bgowindow_pos.rotateX(dTheta *degree);
bgowindow_pos.rotateZ(dPsi*degree); bgowindow_pos.rotateZ(dPsi*degree);
@ -327,8 +362,10 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
if( jCrystal == 0 ) { if( jCrystal == 0 ) {
caseLV[iClover] = new G4LogicalVolume(casing, G4Material::GetMaterial("G4_Al"), "Case"); caseLV[iClover] = new G4LogicalVolume(casing, G4Material::GetMaterial("G4_Al"), "Case");
fLogicBGO[iClover] = new G4LogicalVolume(bgo , G4Material::GetMaterial("G4_Al"), "BGOLV"); fLogicBGO[iClover] = new G4LogicalVolume(bgo , G4Material::GetMaterial("G4_Ge"), "BGOLV");
//fLogicBGO[iClover] = new G4LogicalVolume(bgo , bgocrystalmaterial, "BGOLV");
bgowindowLV[iClover] = new G4LogicalVolume(bgowindow, G4Material::GetMaterial("G4_Al"), "BGO WINDOW "); bgowindowLV[iClover] = new G4LogicalVolume(bgowindow, G4Material::GetMaterial("G4_Al"), "BGO WINDOW ");
bgoshieldLV[iClover] = new G4LogicalVolume(bgoSH, G4Material::GetMaterial("G4_Al"), "BGO SHIELD ");
new G4PVPlacement( rotmat , // case orientation new G4PVPlacement( rotmat , // case orientation
case_pos, // case location case_pos, // case location
@ -339,8 +376,8 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
iClover, // copy number iClover, // copy number
fCheckOverlaps); // checking overlaps fCheckOverlaps); // checking overlaps
new G4PVPlacement( bgomat , // bgo orientation new G4PVPlacement( bgoAmat , // bgo orientation
bgo_pos, // bgo location bgoA_pos, // bgo location
fLogicBGO[i/4], // its logical volume fLogicBGO[i/4], // its logical volume
"BGO", // its name "BGO", // its name
worldLV, // its mother volume worldLV, // its mother volume
@ -348,6 +385,15 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
iClover, // copy number iClover, // copy number
fCheckOverlaps); // checking overlaps fCheckOverlaps); // checking overlaps
new G4PVPlacement( bgoSmat , // bgo orientation
bgoS_pos, // bgo location
bgoshieldLV[i/4], // its logical volume
"BGO SHIELD", // its name
worldLV, // its mother volume
false, // no boolean operation
iClover, // copy number
fCheckOverlaps); // checking overlaps
new G4PVPlacement( bgowindowmat , // bgo orientation new G4PVPlacement( bgowindowmat , // bgo orientation
bgowindow_pos, // bgo location bgowindow_pos, // bgo location
bgowindowLV[i/4], // its logical volume bgowindowLV[i/4], // its logical volume
@ -358,8 +404,9 @@ G4VPhysicalVolume* CloverDetectorConstruction::DefineVolumes()
fCheckOverlaps); // checking overlaps fCheckOverlaps); // checking overlaps
caseLV[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,1.0,0.0))); caseLV[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,1.0,0.0)));
fLogicBGO[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(0.,1.0,0.0))); fLogicBGO[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(1.0,0.0,0.0)));
bgowindowLV[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(0.0,1.0,1.0))); bgowindowLV[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(0.0,1.0,1.0)));
bgoshieldLV[iClover]->SetVisAttributes(new G4VisAttributes(G4Colour(0.0,1.0,0.0)));
} }
//Set a i+1%4 for each //Set a i+1%4 for each
// //

View File

@ -43,9 +43,11 @@ CloverPrimaryGeneratorAction::CloverPrimaryGeneratorAction()
//Co60 //Co60
fEnergyList = {{1.173,99.973}, //fEnergyList = {{1.173,99.973},
{1.332,99.986}}; // {1.332,99.986}};
fEnergyList = {{4.173,99.973},
{4.332,99.986}};
//N16 iso //N16 iso
/* /*
fEnergyList = {{0.120, 100}, //energy, branch fEnergyList = {{0.120, 100}, //energy, branch