Hello, I wrote this macro calotb21.cpp (2.3 KB)
with whom I’m able to plot deposited energy by all particles in each of my simulated Geant4 detectors (named 0,1,2…23).
For example here the deposited energy in detector 0
To distinguish the deposited energy by each particle typology i.e. I’ve to plot Calo_EnDep[n] for positrons, for electrons, for muons etc.
then I wrote a vector writing the PDG names of particle (positron==-11, electron==11, etc) in this way
int Idpart[10];
Idpart[0]= {-11,11,-13,13,22}
and I tried to use a while to read the values of Idpart[0]
root [1] .x calotb21.cpp
In file included from input_line_65:1:
/TestBeam21/2021/03-03-05/LEMMA-TB2021/calotb21.cpp:37:17: error: excess elements in scalar initializer
Idpart[0]= {-11,11,-13,13,22}
Lastly (if possible) I would add an if for the c01->Print(outputname);
to save plots only if I’ve deposited energy i.e., if I don’t have deposited energy by particles x into the detector y, I don’t want to save the graph. Then, the macro should read the Calo_EnDep[x] using the TString selection = TString::Format("Idp==%d", Idpart[0]);
and if this particle doesn’t deposit energy in the detector x, it doesn’t have to save the graph
Here the root file
Notice that I’m uploading a root file created by simulating just 1000 events (to have just few MB)…then the deposited energy stored in this file is different by the one showed in the graph (obtained by simulating 10^5 events)
root [4] .x calotb21.cpp
In file included from input_line_73:1:
TestBeam21/2021/03-03-05/LEMMA-TB2021/calotb21.cpp:37:17: error: excess elements in scalar initializer
Idpart[5]= {-11,11,-13,13,22};
Hello @couet I mean that I want plots for all the Idpart[5] values. I.e.
I need the plots of Calo_EnDep[0], Calo_EnDep[1] etc for Idpart=-11, Idpart=11 etc
it means I’ve 24 detectors and 5 particles, I neet 24*5= 125 different plots
Then
the macro must start for particle Idpart -11 and produce all the Calo_EnDep[0], Calo_EnDep[1] etc
2 the macro must switch to particle Idpart 11 and produce all the Calo_EnDep[0], Calo_EnDep[1] etc
3.the macro must switch to particle Idpart -13 and produce all the Calo_EnDep[0], Calo_EnDep[1] etc
the macro must switch to particle Idpart 13 and produce all the Calo_EnDep[0], Calo_EnDep[1] etc
the macro must switch to particle Idpart 22 and produce all the Calo_EnDep[0], Calo_EnDep[1] etc
Laslty, if possible, I would save (in pdf) only graphs that have a no zero energy