#include "TList.h"
#include "TString.h"
#include "TDirectory.h"
#include "QDatReader.h"
#include "QList.h"
#include "QSigExDis.h"
#include "QSigExF2EDataHolder.h"
#include "debugger.h"
ClassImp(QSigExF2EDataHolder)
QSigExDis** QSigExF2EDataHolder::fFlux2Events=NULL;
TString** QSigExF2EDataHolder::fAxesNames=NULL;
TString* QSigExF2EDataHolder::fFluxes=NULL;
Int_t** QSigExF2EDataHolder::fAxesIndex=NULL;
Int_t* QSigExF2EDataHolder::fNAxes=NULL;
Int_t* QSigExF2EDataHolder::fTreeIndex=NULL;
Int_t QSigExF2EDataHolder::fNFluxes=0;
Int_t QSigExF2EDataHolder::fNTrees=0;
Int_t QSigExF2EDataHolder::fNEntries=0;
Int_t QSigExF2EDataHolder::fNInstances=0;
Int_t QSigExF2EDataHolder::AddMapping(TList* aF2EList)
{
try{
CheckRights();
if(aF2EList){
fNTrees++;
Int_t nF2EList=aF2EList->GetSize();
for(Int_t i=0; i<nF2EList; i++){
fNEntries++;
TDirectory *af2emapdir = dynamic_cast<TDirectory*> (aF2EList->At(i));
QSigExDis *af2emap = NULL;
if((af2emap=dynamic_cast<QSigExDis*>(af2emapdir->Get(af2emapdir->GetName())))){
fFlux2Events=(QSigExDis**)realloc(fFlux2Events,fNEntries*sizeof(QSigExDis*));
fFlux2Events[fNEntries-1]=af2emap;
fTreeIndex=(Int_t*)realloc(fTreeIndex,fNEntries*sizeof(Int_t));
fTreeIndex[fNEntries-1]=fNTrees-1;
fAxesNames=(TString**) realloc(fAxesNames,fNEntries*sizeof(TString*));
TDirectory *inputsdir = dynamic_cast<TDirectory*> (af2emapdir->Get("Inputs"));
Int_t nInputs = inputsdir->GetList()->GetSize();
fNAxes = (Int_t*) realloc(fNAxes,fNEntries*sizeof(Int_t));
fAxesNames[fNEntries-1] = new TString[nInputs];
fNAxes[fNEntries-1] = nInputs;
for(Int_t j=0; j<nInputs; j++){
fAxesNames[fNEntries-1][j]=inputsdir->GetList()->At(j)->GetTitle();
}
}
else{
cout << "ERROR in <QSigExF2EDataHolder::AddMapping> no TF object found" << endl;
throw 3000;
}
}
}
}catch(Int_t e){
cout << "Exception handled by QSigExF2EDataHolder::AddMapping " << e << "\n";
throw e;
}
return 0;
}
Int_t QSigExF2EDataHolder::AddFluxIndexing(const Char_t* cardfilename)
{
PRINTF2(this,"\tvoid QSigExF2EDataHolder::AddFluxIndexing()\n")
QList<QList<TString> > aFluxCard;
const Int_t fluxgroupindex = 1;
if(cardfilename){
QDatReader aReader;
aReader.SetFilename(cardfilename);
aReader.SetKeyword("flux");
aFluxCard = aReader.GetMany();
}
else {
cout << "<QSigExF2EDataHolder::AddFluxIndexing> ERROR: cardfile not specified.\n";
throw 3333;
}
CheckRights();
fNFluxes = aFluxCard.Count();
fFluxes = new TString[fNFluxes];
for(Int_t i=0; i<fNFluxes; i++){
fFluxes[i] = aFluxCard[i][fluxgroupindex].Data();
}
fAxesIndex = new Int_t*[fNEntries];
for(Int_t i=0; i<fNEntries; i++){
fAxesIndex[i] = new Int_t[fNAxes[i]];
for(Int_t j=0; j<fNAxes[i]; j++){
fAxesIndex[i][j]=-999;
for(Int_t k=0; k<fNFluxes; k++){
if (fAxesNames[i][j]==fFluxes[k]) {
fAxesIndex[i][j]=k;
}
}
if(fAxesIndex[i][j]<0){
cout << "<QSigExF2EDataHolder::AddFluxIndexing> ERROR, axes name " << fAxesNames[i][j] << " not found among fluxes.\n";
throw 999;
}
}
}
return 0;
}
void QSigExF2EDataHolder::CheckRights()
{
PRINTF2(this,"\tvoid QSigExF2EDataHolder::CheckRights()\n")
if(fNInstances!=1){
cout << "QSigExF2EDataHolder::CheckRights: Cannot set variables using this instance, only the first instance can\n";
throw 2001;
}
}
#include "debugger.h"
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.