Secondary particle histogram

Dear experts

I would like to get the optical photons histgrams in each part of my detector in my code; please could you get any idea about this? this is the code in in order that you appreciatesD1.02.09.2018.tar.gz (590.3 KB)

great thanks advance
ebode

Hi, please be more specific. I tried compiling your code, but it doesn’t compile for me. There are also many files in the tarball you sent, so I don’t understand what you need because I don’t know in which file to look.

in fact me, firstly for compile my code, I used the following command lines:

1- I create a folder inside where I will compile and execute my code;
2- Inside the folder build, I open a terminal where I run the following commande lines:

a) cmake -DGeant4_DIR=/home/ebode/Geant4/geant4.10.02.p02-install/lib64/Geant4-10.2.2 /home/ebode/EBODE/D1

b) make

here I have this answer:

Similar command is: ‘root’
[ebode@localhost build] cmake -DGeant4_DIR=/home/ebode/Geant4/geant4.10.02.p02-install/lib64/Geant4-10.2.2 /home/ebode/EBODE/D1 -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/ebode/EBODE/D1/build [ebode@localhost build] make
Scanning dependencies of target exampleD1
[ 9%] Building CXX object CMakeFiles/exampleD1.dir/exampleD1.cc.o
[ 18%] Building CXX object CMakeFiles/exampleD1.dir/src/D1ActionInitialization.cc.o
[ 27%] Building CXX object CMakeFiles/exampleD1.dir/src/D1DetectorConstruction.cc.o
[ 36%] Building CXX object CMakeFiles/exampleD1.dir/src/D1EMPhysics.cc.o
[ 45%] Building CXX object CMakeFiles/exampleD1.dir/src/D1EventAction.cc.o
/home/ebode/EBODE/D1/src/D1EventAction.cc: In member function ‘void D1EventAction::PrintEventStatistics(G4double, G4double, G4double, G4double, G4double, G4double) const’:
/home/ebode/EBODE/D1/src/D1EventAction.cc:107:37: warning: left operand of comma operator has no effect [-Wunused-value]
<< std::setw(7) << (nOptical1, “opticalphoton”)
^
/home/ebode/EBODE/D1/src/D1EventAction.cc:114:37: warning: left operand of comma operator has no effect [-Wunused-value]
<< std::setw(7) << (nOptical2, “opticalphoton”)
^
[ 54%] Building CXX object CMakeFiles/exampleD1.dir/src/D1GeneralPhysics.cc.o
[ 63%] Building CXX object CMakeFiles/exampleD1.dir/src/D1MuonPhysics.cc.o
[ 72%] Building CXX object CMakeFiles/exampleD1.dir/src/D1PhysicsList.cc.o
[ 81%] Building CXX object CMakeFiles/exampleD1.dir/src/D1PrimaryGeneratorAction.cc.o
[ 90%] Building CXX object CMakeFiles/exampleD1.dir/src/D1RunAction.cc.o
[100%] Linking CXX executable exampleD1
[100%] Built target exampleD1

c) ./exampleD1

now I run the following command lines in the interface:

/gun/particle mu+

/gun/energy 2 GeV

/run/beamOn 1000D1.17.09.2018…tar.gz (323.0 KB)

I think that the problem in my code is located in my D1RunAction.cc and D1EvenAction.cc because in

when I compile my code, I have this answer for my D1EvenAction.cc:

[ 36%] Building CXX object CMakeFiles/exampleD1.dir/src/D1EMPhysics.cc.o
[ 45%] Building CXX object CMakeFiles/exampleD1.dir/src/D1EventAction.cc.o
/home/ebode/EBODE/D1/src/D1EventAction.cc: In member function ‘void D1EventAction::PrintEventStatistics(G4double, G4double, G4double, G4double, G4double, G4double) const’:
/home/ebode/EBODE/D1/src/D1EventAction.cc:107:37: warning: left operand of comma operator has no effect [-Wunused-value]
<< std::setw(7) << (nOptical1, “opticalphoton”)
^
/home/ebode/EBODE/D1/src/D1EventAction.cc:114:37: warning: left operand of comma operator has no effect [-Wunused-value]
<< std::setw(7) << (nOptical2, “opticalphoton”)
^
[ 54%] Building CXX object CMakeFiles/exampleD1.dir/src/

Please Professor, can you help at this step in order that I get my secondary particle histogram?

great thanks advance Professor. I have attached the code in order that you appreciates.

In the “src/D1EventAction.cc”, try to use:

<< std::setw(7) << nOptical1
// ...
<< std::setw(7) << nOptical2

great thanks Professor, I try it now

best regards

ebode

this is the answer that I have after the compiltation and excution for an event:

Number of events processed : 1000

User=7.16s Real=7.51s Sys=0.17s

----> print histograms statistic for the entire run

ESha1 : mean = 314.727 MeV rms = 76.6421 MeV

ESha2 : mean = 1.42469 MeV rms = 1.27002 MeV

LSha1 : mean = 4.19892 cm rms = 1.00977 cm

LSha2 : mean = 698.98 um rms = 632.311 um

NSha1 : mean = opticalphoton rms = opticalphoton

NSha2 : mean = opticalphoton rms = opticalphoton

I don’t know if it is because I have written in my D1RunAction.cc:

G4cout << " NSha1 : mean = " << (analysisManager->GetH1(5)->mean(), “opticalphoton”)
<< " rms = " << (analysisManager->GetH1(5)->rms(), “opticalphoton”)
<< G4endl;

 G4cout << " NSha2 : mean = " << (analysisManager->GetH1(6)->mean(), "opticalphoton")
  << " rms = " << (analysisManager->GetH1(6)->rms(), "opticalphoton")
<< G4endl;

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.