20   std::vector<TH1*> outputHistos;
 
   24     cout << 
"ERROR: activation function is different from one. Only one is supported..." << endl;
 
   31   Int_t nHidden=nHiddenLayerSize.size();
 
   33   for (Int_t o=0;o<nHidden;++o)
 
   35     cout << 
" Hidden lay: " << o << 
" size: " << nHiddenLayerSize[o];
 
   39   cout << 
" Output size: " << nOutput << endl;
 
   42   std::vector<TMatrixD*> weightMatrices=trainedNetwork->
weightMatrices();
 
   46   TH1F* histoLayersInfo=
new TH1F(
"LayersInfo",
 
   52   histoLayersInfo->SetBinContent(1,nInput);
 
   54   for (Int_t 
i=0;
i<nHidden;++
i)
 
   56     histoLayersInfo->SetBinContent(2+
i,nHiddenLayerSize[
i]);
 
   59   histoLayersInfo->SetBinContent(2+nHidden,nOutput);
 
   64     histoLayersInfo->SetBinContent(0,1);
 
   69     histoLayersInfo->SetBinContent(nHidden+3,1);
 
   72   outputHistos.push_back(histoLayersInfo);
 
   76   for (Int_t 
i=0;
i<nHidden+1;++
i)
 
   78     TString threName(
"Layer");
 
   80     threName+=
"_thresholds";
 
   82     Int_t layerSize=(
i<nHidden)?nHiddenLayerSize[
i]:nOutput;
 
   83     Int_t previousLayerSize=(
i==0)?nInput:nHiddenLayerSize[
i-1];
 
   85     TH1F* histoThreshLayer=
new TH1F(threName,
 
   91     for (Int_t 
s=0;
s<layerSize;
s++)
 
   93       histoThreshLayer->SetBinContent(
s+1,thresholdVectors[
i]->
operator()(
s));
 
   96     TString weightsName(
"Layer");
 
   98     weightsName+=
"_weights";
 
  100     outputHistos.push_back(histoThreshLayer);
 
  102     TH2F* histoWeightsLayer=
new TH2F(weightsName,
 
  111     for (Int_t 
s=0;
s<layerSize;
s++)
 
  113       for (Int_t 
p=0;
p<previousLayerSize;++
p)
 
  115         histoWeightsLayer->SetBinContent(
p+1,
s+1,weightMatrices[
i]->
operator()(
p,
s));
 
  119     outputHistos.push_back(histoWeightsLayer);
 
  129                                      std::vector<TH1*> & inputHistos)
 const 
  132   std::vector<TH1*>::const_iterator inputBegin=inputHistos.begin();
 
  133   std::vector<TH1*>::const_iterator inputEnd=inputHistos.end();
 
  135   for ( std::vector<TH1*>::const_iterator inputIter=inputBegin;inputIter!=inputEnd;++inputIter)
 
  137     if ((*inputIter)->GetName()==nameOfHisto)
 
  152   TH1F* histoLayersInfo=
dynamic_cast<TH1F*
>(findHisto(
"LayersInfo",inputHistos));
 
  154   if (histoLayersInfo==0)
 
  156     cout << 
" Could not find LayersInfo histogram... Aborting " << endl;
 
  160   bool linearOutput=
false;
 
  161   bool normalizeOutput=
false;
 
  164   Int_t nHidden=histoLayersInfo->GetNbinsX()-2;
 
  165   Int_t nInput=(Int_t)std::floor(histoLayersInfo->GetBinContent(1)+0.5);
 
  167   vector<Int_t> nHiddenLayerSize;
 
  168   for (Int_t 
i=0;
i<nHidden;++
i)
 
  170     nHiddenLayerSize.push_back( (Int_t)std::floor(histoLayersInfo->GetBinContent(2+
i)+0.5));
 
  173   for (Int_t o=0;o<nHidden;++o)
 
  175     cout << 
" Hidden lay: " << o << 
" size: " << nHiddenLayerSize[o];
 
  178   Int_t nOutput=(Int_t)std::floor(histoLayersInfo->GetBinContent(2+nHidden)+0.5);
 
  179   cout << 
" Output size: " << nOutput << endl;
 
  181   if (histoLayersInfo->GetBinContent(0)>0.5)
 
  185   if (histoLayersInfo->GetBinContent(nHidden+3)>0.5)
 
  187     normalizeOutput=
true;
 
  190   std::vector<TVectorD*> thresholdVectors;
 
  191   std::vector<TMatrixD*> weightMatrices;
 
  195   for (Int_t 
i=0;
i<nHidden+1;++
i)
 
  197     TString threName(
"Layer");
 
  199     threName+=
"_thresholds";
 
  201     Int_t layerSize=(
i<nHidden)?nHiddenLayerSize[
i]:nOutput;
 
  202     Int_t previousLayerSize=(
i==0)?nInput:nHiddenLayerSize[
i-1];
 
  204     TVectorD* thresholdVector=
new TVectorD(layerSize);
 
  205     TMatrixD* weightMatrix=
new TMatrixD(previousLayerSize,layerSize);
 
  207     TH1F* histoThreshLayer=
dynamic_cast<TH1F*
>(findHisto(threName,inputHistos));
 
  208     if (histoThreshLayer==0)
 
  210       cout << 
" Could not find " << threName << 
"  histogram... Aborting (mem leak also...)" << endl;
 
  215     for (Int_t 
s=0;
s<layerSize;
s++)
 
  217       thresholdVector->operator()(
s)=histoThreshLayer->GetBinContent(
s+1);
 
  220     TString weightsName(
"Layer");
 
  222     weightsName+=
"_weights";
 
  224     TH2F* histoWeightsLayer=
dynamic_cast<TH2F*
>(findHisto(weightsName,inputHistos));
 
  225     if (histoWeightsLayer==0)
 
  227       cout << 
" Could not find " << weightsName << 
"  histogram... Aborting (mem leak also...)" << endl;
 
  231     for (Int_t 
s=0;
s<layerSize;
s++)
 
  233       for (Int_t 
p=0;
p<previousLayerSize;++
p)
 
  235         weightMatrix->operator()(
p,
s)=histoWeightsLayer->GetBinContent(
p+1,
s+1);
 
  239     thresholdVectors.push_back(thresholdVector);
 
  240     weightMatrices.push_back(weightMatrix);
 
  254   return trainedNetwork;