61 GammaRayTelAnalysis* GammaRayTelAnalysis::instance = 0;
66 GammaRayTelAnalysis::GammaRayTelAnalysis()
67 :GammaRayTelDetector(0),analysisFactory(0),
tree(0)
70 ,histo1DDraw(
"enable"),histo1DSave(
"enable"),histo2DDraw(
"enable")
71 ,histo2DSave(
"enable"),histo2DMode(
"strip")
80 analysisMessenger =
new GammaRayTelAnalysisMessenger(
this);
82 analysisFactory = AIDA_createAnalysisFactory();
84 AIDA::ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
93 tree = treeFactory->create(
"gammaraytel.aida",
"xml",
false,
true,
"");
96 ITupleFactory* tupleFactory = analysisFactory->createTupleFactory(*
tree);
99 tuple = tupleFactory->create(
"1",
"1",
"float energy, plane, x, y, z");
105 IHistogramFactory* histoFactory = analysisFactory->createHistogramFactory(*
tree);
110 int Nplane = GammaRayTelDetector->GetNbOfTKRLayers();
111 int Nstrip = GammaRayTelDetector->GetNbOfTKRStrips();
112 int Ntile = GammaRayTelDetector->GetNbOfTKRTiles();
113 double sizexy = GammaRayTelDetector->GetTKRSizeXY();
114 double sizez = GammaRayTelDetector->GetTKRSizeZ();
115 int N = Nstrip*Ntile;
120 energy = histoFactory->createHistogram1D(
"10",
"Edep in the last X plane (keV)", 100, 50, 200);
124 hits = histoFactory->createHistogram1D(
"20",
"Hits dist in TKR X planes",Nplane, 0, Nplane-1);
127 if (histo2DMode ==
"strip"){
128 posXZ = histoFactory->createHistogram2D(
"30",
"Tracker Hits XZ (strip,plane)",
130 2*Nplane, 0, Nplane-1);
134 posXZ = histoFactory->createHistogram2D(
"30",
"Tracker Hits XZ (x,z) in mm",
135 int(sizexy/5), -sizexy/2, sizexy/2,
136 int(sizez/5), -sizez/2, sizez/2);
140 if(histo2DMode==
"strip")
141 posYZ = histoFactory->createHistogram2D(
"40",
"Tracker Hits YZ (strip,plane)",
143 2*Nplane, 0, Nplane-1);
145 posYZ = histoFactory->createHistogram2D(
"40",
"Tracker Hits YZ (y,z) in mm",
146 int(sizexy/5), -sizexy/2, sizexy/2,
147 int(sizez/5), -sizez/2, sizez/2);
173 GammaRayTelAnalysis::~GammaRayTelAnalysis() {
178 void GammaRayTelAnalysis::Init()
182 void GammaRayTelAnalysis::Finish()
184 #ifdef G4ANALYSIS_USE
188 delete analysisMessenger;
190 analysisMessenger = 0;
194 GammaRayTelAnalysis* GammaRayTelAnalysis::getInstance()
196 if (instance == 0) instance =
new GammaRayTelAnalysis();
201 void GammaRayTelAnalysis::InsertPositionXZ(
double x,
double z)
203 #ifdef G4ANALYSIS_USE
209 void GammaRayTelAnalysis::InsertPositionYZ(
double y,
double z)
211 #ifdef G4ANALYSIS_USE
212 if(posYZ) posYZ->fill(y, z);
217 void GammaRayTelAnalysis::InsertEnergy(
double en)
219 #ifdef G4ANALYSIS_USE
225 void GammaRayTelAnalysis::InsertHits(
int nplane)
227 #ifdef G4ANALYSIS_USE
232 void GammaRayTelAnalysis::setNtuple(
float E,
float p,
float x,
float y,
float z)
234 #ifdef G4ANALYSIS_USE
235 tuple->fill(tuple->findColumn(
"energy"),E);
236 tuple->fill(tuple->findColumn(
"plane"),
p);
237 tuple->fill(tuple->findColumn(
"x"),
x);
238 tuple->fill(tuple->findColumn(
"y"),
y);
239 tuple->fill(tuple->findColumn(
"z"),
z);
252 void GammaRayTelAnalysis::BeginOfRun()
254 #ifdef G4ANALYSIS_USE
259 if(posYZ) posYZ->reset();
269 void GammaRayTelAnalysis::EndOfRun(
G4int)
271 #ifdef G4ANALYSIS_USE
319 void GammaRayTelAnalysis::EndOfEvent(
G4int flag)
324 #ifdef G4ANALYSIS_USE