32 #include <AIDA/AIDA.h>
35 #ifdef G4ANALYSIS_USE_ROOT
37 #include "TApplication.h"
56 :fHistName(
"exrdm"), fHistType(
"root"),
57 fNHisto(0), fNTuple(0), fVerbose(0),
65 #ifdef G4ANALYSIS_USE_ROOT
95 #ifdef G4ANALYSIS_USE_ROOT
115 #ifdef G4ANALYSIS_USE
118 fAida = AIDA_createAnalysisFactory();
124 {AIDA::ITreeFactory* tf = fAida->createTreeFactory();
128 fTree = tf->create(fileName,fHistType,
false,
true,
"");
134 G4cout <<
"Tree store : " << fTree->storeName() <<
G4endl;}
136 {AIDA::IHistogramFactory* hf = fAida->createHistogramFactory(*fTree);
152 {AIDA::ITupleFactory* tpf = fAida->createTupleFactory( *fTree );
165 #ifdef G4ANALYSIS_USE_ROOT
168 fHfileROOT =
new TFile(fileNameROOT.c_str() ,
"RECREATE",
"ROOT file for exRDM");
173 G4String
id = G4String(
"h")+
fIds[i];
182 G4String
id = G4String(
"t")+
fTupleId[i];
198 #ifdef G4ANALYSIS_USE
211 #ifdef G4ANALYSIS_USE_ROOT
230 G4cout <<
"New histogram will be booked: #" <<
id <<
" <" << name
231 <<
" " << nb <<
" " << x1 <<
" " << x2 <<
" " << u
244 #ifdef G4ANALYSIS_USE
247 #ifdef G4ANALYSIS_USE_ROOT
248 fROOThisto.push_back(0);
258 G4cout <<
"Update histogram: #" << i
259 <<
" " << nb <<
" " << x1 <<
" " << x2 <<
" " << u
267 G4cout <<
"exrdmHisto::setexrdmHisto1D: WARNING! wrong histogram index "
277 G4cout <<
"fill histogram: #" << i <<
" at x= " << x
281 #ifdef G4ANALYSIS_USE
283 fHisto[i]->fill(x/
fUnit[i], w);
285 G4cout <<
"exrdmHisto::fill: WARNING! wrong AIDA histogram index "
289 #ifdef G4ANALYSIS_USE_ROOT
291 fROOThisto[i]->Fill(x/
fUnit[i],w);
293 G4cout <<
"exrdmHisto::fill: WARNING! wrong ROOT histogram index "
304 G4cout <<
"Scale histogram: #" << i <<
" by factor " << x <<
G4endl;
306 #ifdef G4ANALYSIS_USE
309 G4cout <<
"exrdmHisto::scale: WARNING! wrong AIDA histogram index "
313 #ifdef G4ANALYSIS_USE_ROOT
315 fROOThisto[i]->Scale(x);
317 G4cout <<
"exrdmHisto::scale: WARNING! wrong ROOT histogram index "
325 #ifdef G4ANALYSIS_USE
329 #ifdef G4ANALYSIS_USE_ROOT
341 fTupleId.push_back(w1);
342 fTupleName.push_back(w2) ;
343 #ifdef G4ANALYSIS_USE
344 fTupleList.push_back(w3);
348 #ifdef G4ANALYSIS_USE_ROOT
349 std::vector<float> ar;
351 for (
size_t i = 0; i < 20; i++) ar.push_back(0.);
352 fRarray.push_back(ar);
358 while ( token !=
"") {
360 if (token ==
",") token = next();
362 ROOTList1 = ROOTList1 + token +
G4String(
":");
365 G4String ROOTList = ROOTList1.substr(0,ROOTList1.length()-2);
367 fTupleListROOT.push_back(ROOTList);
368 fROOTntup.push_back(0);
369 fRcol.push_back(col-1);
378 G4cout <<
"fill tuple # " << i
379 <<
" with parameter <" << parname <<
"> = " << x <<
G4endl;
380 #ifdef G4ANALYSIS_USE
381 if(fNtup[i]) fNtup[i]->fill(fNtup[i]->findColumn(parname), x);
390 G4cout <<
"fill tuple # " << i
391 <<
" in column < " << col <<
"> = " << x <<
G4endl;
393 #ifdef G4ANALYSIS_USE
394 if(fNtup[i]) fNtup[i]->fill(col,
double(x));
397 #ifdef G4ANALYSIS_USE_ROOT
398 if(fROOTntup[i]) (fRarray[i])[col] =
float(x);
408 G4cout <<
"fill tuple # " << i
409 <<
" with parameter <" << parname <<
"> = " << x <<
G4endl;
411 #ifdef G4ANALYSIS_USE
412 if(fNtup[i]) fNtup[i]->fill(fNtup[i]->findColumn(parname), x);
422 #ifdef G4ANALYSIS_USE
423 if(fNtup[i]) fNtup[i]->addRow();
426 #ifdef G4ANALYSIS_USE_ROOT
427 float *ar=
new float[fRcol[i]];
428 for (
G4int j=0; j < fRcol[i]; j++) {
430 ar[j] = fRarray[i][j];
432 if(fROOTntup[i]) fROOTntup[i]->Fill(ar);
std::vector< G4double > fXmin
const G4String & GetFileName() const
void FillTuple(G4int, const G4String &, G4double)
G4String & remove(str_size)
Definition of the exrdmHisto class.
const G4String & FileType() const
void SetFileType(const G4String &)
std::vector< G4String > fTupleId
void FillHisto(G4int, G4double, G4double)
Definition of the exrdmHistoMessenger class.
void AddTuple(const G4String &, const G4String &, const G4String &)
std::vector< G4String > fTitles
void SetHisto1D(G4int, G4int, G4double, G4double, G4double)
void SetFileName(const G4String &)
G4GLOB_DLL std::ostream G4cout
std::vector< G4int > fActive
std::vector< G4String > fIds
G4bool contains(const std::string &) const
std::vector< G4double > fUnit
std::vector< G4double > fXmax
std::vector< G4String > fTupleListROOT
std::vector< G4String > fTupleName
std::vector< G4String > fTupleList
void ScaleHisto(G4int, G4double)
void Add1D(const G4String &, const G4String &, G4int nb=100, G4double x1=0., G4double x2=1., G4double u=1.)
exrdmHistoMessenger * fMessenger
std::vector< G4int > fBins