63 GammaRayTelAnalysis* GammaRayTelAnalysis::instance = 0;
68 GammaRayTelAnalysis::GammaRayTelAnalysis()
69 :GammaRayTelDetector(0),histo2DMode(
"strip")
78 analysisMessenger =
new GammaRayTelAnalysisMessenger(
this);
79 histoFileName =
"gammaraytel";
87 GammaRayTelAnalysis::~GammaRayTelAnalysis() {
95 void GammaRayTelAnalysis::Finish()
98 delete analysisMessenger;
99 analysisMessenger = 0;
103 GammaRayTelAnalysis* GammaRayTelAnalysis::getInstance()
105 if (instance == 0) instance =
new GammaRayTelAnalysis();
110 void GammaRayTelAnalysis::InsertPositionXZ(
double x,
double z)
112 #ifdef G4ANALYSIS_USE
119 void GammaRayTelAnalysis::InsertPositionYZ(
double y,
double z)
121 #ifdef G4ANALYSIS_USE
128 void GammaRayTelAnalysis::InsertEnergy(
double en)
130 #ifdef G4ANALYSIS_USE
137 void GammaRayTelAnalysis::InsertHits(
int nplane)
139 #ifdef G4ANALYSIS_USE
141 man->FillH1(2,nplane);
145 void GammaRayTelAnalysis::setNtuple(
float E,
float p,
float x,
float y,
float z)
147 #ifdef G4ANALYSIS_USE
150 man->FillNtupleDColumn(0,E);
151 man->FillNtupleDColumn(1,p);
152 man->FillNtupleDColumn(2,x);
153 man->FillNtupleDColumn(3,y);
154 man->FillNtupleDColumn(4,z);
168 void GammaRayTelAnalysis::BeginOfRun()
170 #ifdef G4ANALYSIS_USE
175 G4cout <<
"Opening output file " << histoFileName <<
" ... ";
176 man->OpenFile(histoFileName);
177 man->SetFirstHistoId(1);
181 int Nplane = GammaRayTelDetector->GetNbOfTKRLayers();
182 int Nstrip = GammaRayTelDetector->GetNbOfTKRStrips();
183 int Ntile = GammaRayTelDetector->GetNbOfTKRTiles();
184 double sizexy = GammaRayTelDetector->GetTKRSizeXY();
185 double sizez = GammaRayTelDetector->GetTKRSizeZ();
186 int N = Nstrip*Ntile;
194 man->CreateH1(
"1",
"Edep in the last X plane (keV)", 100, 50, 200);
198 man->CreateH1(
"2",
"Hits dist in TKR X planes",Nplane, 0, Nplane-1);
205 if (histo2DMode ==
"strip")
207 man->CreateH2(
"1",
"Tracker Hits XZ (strip,plane)",
209 2*Nplane, 0, Nplane-1);
213 man->CreateH2(
"1",
"Tracker Hits XZ (x,z) in mm",
214 int(sizexy/5), -sizexy/2, sizexy/2,
215 int(sizez/5), -sizez/2, sizez/2);
220 if (histo2DMode ==
"strip")
222 man->CreateH2(
"2",
"Tracker Hits YZ (strip,plane)",
224 2*Nplane, 0, Nplane-1);
228 man->CreateH2(
"2",
"Tracker Hits YZ (x,z) in mm",
229 int(sizexy/5), -sizexy/2, sizexy/2,
230 int(sizez/5), -sizez/2, sizez/2);
237 man->CreateNtuple(
"1",
"Track ntuple");
238 man->CreateNtupleDColumn(
"energy");
239 man->CreateNtupleDColumn(
"plane");
240 man->CreateNtupleDColumn(
"x");
241 man->CreateNtupleDColumn(
"y");
242 man->CreateNtupleDColumn(
"z");
253 void GammaRayTelAnalysis::EndOfRun()
255 #ifdef G4ANALYSIS_USE
262 delete G4AnalysisManager::Instance();
269 void GammaRayTelAnalysis::EndOfEvent(
G4int )
272 #ifdef G4ANALYSIS_USE
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
G4GLOB_DLL std::ostream G4cout
ExG4HbookAnalysisManager G4AnalysisManager
static G4RunManager * GetRunManager()