FEDRA emulsion software from the OPERA Collaboration
EdbShowAlgE Class Reference

#include <EdbShowAlgE.h>

Inheritance diagram for EdbShowAlgE:
Collaboration diagram for EdbShowAlgE:

Public Member Functions

void AddWeightFile (TString tmpString, Int_t Plate, TString tmpString2)
 
Int_t CheckPlateAndPlateBinning (Int_t Plate)
 
 ClassDef (EdbShowAlgE, 1)
 
void Create_MLP ()
 DEBUG ---------------------------— TEST DEVOPLEMENT. More...
 
void Create_MLPTree ()
 
void CreateInputNeuronsArray ()
 
void CreateInputNeuronsArray_XX ()
 
void CreateInputNeuronsArray_YC ()
 
void CreateInputNeuronsArray_YY ()
 
void CreateMLPArray ()
 
void CreateMLPLayout_XX (Int_t nr)
 
void CreateMLPLayout_YC (Int_t nr)
 
void CreateMLPLayout_YY (Int_t nr)
 
void CreateMLPLayouts ()
 
void CreateMLPLayouts_FJ ()
 
void CreateMLPLayouts_JC ()
 
void CreateMLPLayouts_LT ()
 
void CreateMLPLayouts_XX ()
 
void CreateMLPLayouts_YC ()
 
void CreateMLPLayouts_YY ()
 
void CreateMLPs ()
 
void CreateStandardMLPArrayN ()
 
void CreateStandardWeightFileStrings ()
 
void DumpWeights ()
 
 EdbShowAlgE ()
 
 EdbShowAlgE (TObjArray *RecoShowerArray)
 
 EdbShowAlgE (TObjArray *RecoShowerArray, TString ShowAlgEParaName)
 
 EdbShowAlgE (TString ShowAlgEParaName)
 
virtual void Execute ()
 
void Fill_MLPTree ()
 
void FillInputNeuronsArray_XX ()
 
void FillInputNeuronsArray_YC ()
 
void FillInputNeuronsArray_YY ()
 
void FillMLP_SimpleTree ()
 
void FillMLP_SimpleTree_XX ()
 
void FillMLP_SimpleTree_XX (EdbShowerP *show, Int_t ShowAlgEParaNr)
 
void FillMLP_SimpleTree_YC ()
 
void FillMLP_SimpleTree_YC (EdbShowerP *show, Int_t ShowAlgEParaNr)
 
void FillMLP_SimpleTree_YY ()
 
void FillMLP_SimpleTree_YY (EdbShowerP *show, Int_t ShowAlgEParaNr)
 
virtual void Finalize ()
 
TH1F * GetHistInANN (Int_t nr) const
 
TCanvasGetHistoCanvas ()
 
TMultiLayerPerceptron * GetMLP () const
 
int GetMLPArrayNr (Int_t NPlToCheck)
 
TString GetMLPInputFileName ()
 
TString GetMLPLayout ()
 
TString GetMLPWeightFileName ()
 
virtual void Initialize ()
 
void LoadMLPWeights ()
 
void LoadMLPWeights (Int_t nr)
 
void Print ()
 
void PrintWeightFileStrings ()
 
void ReadMLPInputFile ()
 
int ReadShowAlgEPar (const char *file)
 DEBUG ---------------------------— TEST DEVOPLEMENT. More...
 
void ResetPlateBinning ()
 
void Run ()
 
void SetBinsInputHistos ()
 
void SetBinsInputHistos_FJ ()
 
void SetBinsInputHistos_XX ()
 
void SetBinsInputHistos_YC ()
 
void SetBinsInputHistos_YY ()
 
void SetDoRun (Int_t type)
 
void SetDoTrain (Int_t type)
 
void SetInputHistos (TH1F *h, Int_t nbin, Double_t lower, Double_t upper)
 
void SetInputHistosPara (Int_t ParaType)
 
void SetInputHistosPara_FJ ()
 
void SetInputHistosPara_XX ()
 
void SetInputHistosPara_YC ()
 
void SetInputHistosPara_YY ()
 
void SetMLPArrayN (Int_t MLPArrayN)
 
void SetMLPInputFileName (TString MLP_InputFileName)
 
void SetMLPLayout (TString layout)
 
Int_t SetMLPTrainEpochs ()
 
void SetMLPTrainEpochs (Int_t nep)
 
void SetMLPWeightFileName (TString weightfilename)
 
void SetPlatesN (Int_t ShowAlgEPlatesN)
 
void SetReadMLPInputFile (Int_t type)
 
void SetRecoShowerArray (TObjArray *RecoShowerArray)
 
void SetWriteMLPInputFile (Int_t type)
 
void SetWriteMLPWeightFile (Int_t type)
 
void TESTRUN ()
 
void Train ()
 
void WriteMLP_SimpleTree (TString filename)
 
void WriteMLPInputFile ()
 
virtual ~EdbShowAlgE ()
 

Private Member Functions

void AddWeightFilePlate (TString tmpString, Int_t dospec)
 
Bool_t CheckStringToShowAlgEParaName (TString tmpString2)
 
void ClearPlateBinning ()
 
void CreateInputHistos ()
 
TString CreateMLPLayout (Int_t NrOfANNInputNeurons)
 
void FillInputHistosPara_XX ()
 
int GetLastBinHistoFilles (TH1 *h)
 
void Init ()
 
void Init (TString ParaName)
 
void ResetWeightFileNameArray ()
 
void Set0 ()
 

Private Attributes

Bool_t eDoANNRun
 
Bool_t eDoANNTrain
 
Float_t * eInANN = new Float_t[70]
 
TH1F * eInANN_Hist [70]
 
Float_t * eInfoANN = new Float_t[70]
 
TString eMLP_InputFileName
 
Int_t eMLP_InputNeurons
 
TArrayI * eMLP_InputNeuronsArray
 
Int_t eMLP_InputNeuronsArrayN
 
TString eMLP_Layout
 
TObjArray * eMLP_LayoutArray
 
Bool_t eMLP_LayoutArrayIsDone
 
Bool_t eMLP_ReadMLPInputFile
 
TMultiLayerPerceptron * eMLP_Simple
 
Bool_t eMLP_SimpleIsDone
 
TTree * eMLP_SimpleTree
 
Int_t eMLP_TrainEpochs
 
TString eMLP_WeightFileName
 
TString eMLP_WeightFileNameArray [10]
 
Bool_t eMLP_WriteMLPInputFile
 
Bool_t eMLP_WriteWeightFile
 
TObjArray * eMLPArray
 
Int_t eMLPArrayN
 
Float_t eOutANN
 
TObjArray * eRecoShowerArray
 
Int_t eRecoShowerArrayN
 
TString eShowAlgEParaName
 
Int_t eShowAlgEParaNr
 
TArrayI * eShowAlgEPlateBinning
 
Int_t eShowAlgEPlatesN
 

Constructor & Destructor Documentation

◆ EdbShowAlgE() [1/4]

EdbShowAlgE::EdbShowAlgE ( )

◆ EdbShowAlgE() [2/4]

EdbShowAlgE::EdbShowAlgE ( TString  ShowAlgEParaName = "XX")
31 {
32  // Default Constructor
33  cout << "EdbShowAlgE::EdbShowAlgE() Default Constructor with Paraname ="<< paraname<< endl;
34 
35  // Reset all:
36  Set0();
37 
38  // Init now with given parametrization
39  Init(paraname);
40 }
void Set0()
Definition: EdbShowAlgE.cxx:100
void Init()
Definition: EdbShowAlgE.cxx:163

◆ EdbShowAlgE() [3/4]

EdbShowAlgE::EdbShowAlgE ( TObjArray *  RecoShowerArray)
49 {
50  // Default Constructor
51  cout << "EdbShowAlgE::EdbShowAlgE(TObjArray* RecoShowerArray) Default Constructor"<<endl;
52 
53  // Reset all:
54  Set0();
55 
56  // Init now with default parametrization (XX)
57  Init();
58 
60  eRecoShowerArrayN=eRecoShowerArray->GetEntries();
61 
62  cout << "EdbShowAlgE::EdbShowAlgE(TObjArray* RecoShowerArray) Default Constructor...done."<<endl;
63 }
TObjArray * RecoShowerArray
Definition: Shower_E_FromShowerRoot.C:12
TObjArray * eRecoShowerArray
Definition: EdbShowAlgE.h:58
Int_t eRecoShowerArrayN
Definition: EdbShowAlgE.h:59

◆ EdbShowAlgE() [4/4]

EdbShowAlgE::EdbShowAlgE ( TObjArray *  RecoShowerArray,
TString  ShowAlgEParaName = "XX" 
)
71 {
72  // Default Constructor
73  cout << "EdbShowAlgE::EdbShowAlgE(TObjArray* RecoShowerArray,TString paraname) Default Constructor with Paraname ="<< paraname<< endl;
74 
75  // Reset all:
76  Set0();
77 
78  // Init now with given parametrization
79  Init(paraname);
80 
82  eRecoShowerArrayN=eRecoShowerArray->GetEntries();
83 
84  cout << "EdbShowAlgE::EdbShowAlgE(TObjArray* RecoShowerArray) Default Constructor...done."<<endl;
85 }

◆ ~EdbShowAlgE()

EdbShowAlgE::~EdbShowAlgE ( )
virtual
92 {
93  // Default Destructor
94  cout << "EdbShowAlgE::~EdbShowAlgE()"<<endl;
95 }

Member Function Documentation

◆ AddWeightFile()

void EdbShowAlgE::AddWeightFile ( TString  tmpString,
Int_t  Plate,
TString  tmpString2 
)
1499 {
1500  cout << "void EdbShowAlgE::AddWeightFile()." << endl;
1501 
1502  // Check if the weightfile type and the ShowAlgeE paratye match!
1503  // (otherwise a weightfile for a wrong parametrisation is maybe taken)
1504  if (tmpString!=eShowAlgEParaName) {
1505  cout << tmpString << " != "<< eShowAlgEParaName << endl;
1506  cout << "void EdbShowAlgE::AddWeightFilePlate() WARNING: WRONG PARANAME. WeightFilePlate NOT ADDED!" << endl;
1507  return;
1508  }
1509 
1510  // Things to do when called the first time....
1511  if (eMLPArrayN<1) ClearPlateBinning();
1512 
1513 
1514 
1515 
1516  // Not more than 10 values of weightfiles will be allowed!!!
1517  if (eMLPArrayN>=10) {
1518  cout << "void EdbShowAlgE::AddWeightFile() WARNING: Not more than 10 values of weightfiles will be allowed!!. WeightFilePlate NOT ADDED!" << endl;
1519  return;
1520  }
1521 
1522  // Check if this weightfile to be added (for the plates) is not added already:
1523  Int_t tmpint;
1524  tmpint=CheckPlateAndPlateBinning(Plate);
1525 
1526  if (tmpint==1) {
1527  cout << "void EdbShowAlgE::AddWeightFile() WARNING: A weightfile for this plate Number was alread added. NOT ADDED!" << endl;
1528  return;
1529  }
1530 
1531 
1532  // Set weightfilename string and increase number of weightfile options
1533  eShowAlgEPlateBinning->AddAt(Plate,eMLPArrayN);
1534  tmpint=eShowAlgEPlateBinning->At(eMLPArrayN);
1536 
1537  cout << "eMLP_WeightFileNameArray[eMLPArrayN] = " << eMLP_WeightFileNameArray[eMLPArrayN] << endl;
1538 
1539 
1540 
1541  // Increase now...
1542  ++eMLPArrayN;
1543 
1544  cout << "------"<< endl;
1545  cout << "eMLPArrayN = " << eMLPArrayN << endl;
1546 
1547  // These two variables are always same!
1549 
1550 
1551  cout << "void EdbShowAlgE::AddWeightFile() done." << endl;
1552 
1553  return;
1554 }
TString eShowAlgEParaName
Definition: EdbShowAlgE.h:47
Int_t eMLP_InputNeuronsArrayN
Definition: EdbShowAlgE.h:115
Int_t eMLPArrayN
Definition: EdbShowAlgE.h:64
Int_t CheckPlateAndPlateBinning(Int_t Plate)
Definition: EdbShowAlgE.cxx:1581
TString eMLP_WeightFileNameArray[10]
Definition: EdbShowAlgE.h:109
void ClearPlateBinning()
Definition: EdbShowAlgE.cxx:1338
TArrayI * eShowAlgEPlateBinning
Definition: EdbShowAlgE.h:53

◆ AddWeightFilePlate()

void EdbShowAlgE::AddWeightFilePlate ( TString  tmpString,
Int_t  dospec 
)
private
1438 {
1439  cout << "void EdbShowAlgE::AddWeightFilePlate() " << endl;
1440 
1441  cout << "eMLPArrayN = " << eMLPArrayN << endl;
1442  cout << "tmpString = " << tmpString << endl;
1443  cout << "Plate = " << Plate << endl;
1444 
1445 
1446  // Check if the weightfile type and the ShowAlgeE paratye match!
1447  // (otherwise a weightfile for a wrong parametrisation is maybe taken)
1448  if (tmpString!=eShowAlgEParaName) {
1449  cout << tmpString << " != "<< eShowAlgEParaName << endl;
1450  cout << "void EdbShowAlgE::AddWeightFilePlate() WARNING: WRONG PARANAME. WeightFilePlate NOT ADDED!" << endl;
1451  return;
1452  }
1453 
1454 
1455  // Things to do when called the first time....
1456  if (eMLPArrayN<1) ClearPlateBinning();
1457 
1458  // Not more than 10 values of weightfiles will be allowed!!!
1459  if (eMLPArrayN>=10) {
1460  cout << "void EdbShowAlgE::AddWeightFilePlate() WARNING: Not more than 10 values of weightfiles will be allowed!!. WeightFilePlate NOT ADDED!" << endl;
1461  return;
1462  }
1463 
1464 
1465  // Check if this weightfile to be added (for the plates) is not added already:
1466  Int_t tmpint;
1467  tmpint=CheckPlateAndPlateBinning(Plate);
1468 
1469  if (tmpint==1) {
1470  cout << "void EdbShowAlgE::AddWeightFilePlate() WARNING: A weightfile for this plate Number was alread added. NOT ADDED!" << endl;
1471  return;
1472  }
1473 
1474 
1475  // Set weightfilename string and increase number of weightfile options
1476  eShowAlgEPlateBinning->AddAt(Plate,eMLPArrayN);
1477  tmpint=eShowAlgEPlateBinning->At(eMLPArrayN);
1478  eMLP_WeightFileNameArray[eMLPArrayN]="ANN_Weights_Energy_"+tmpString+TString(Form("_%d.txt",tmpint));
1479 
1480  cout << "eMLP_WeightFileNameArray[eMLPArrayN] = " << eMLP_WeightFileNameArray[eMLPArrayN] << endl;
1481 
1482  // Increase now...
1483  ++eMLPArrayN;
1484 
1485  cout << "------"<< endl;
1486  cout << "eMLPArrayN = " << eMLPArrayN << endl;
1487 
1488  // These two variables are always same!
1490  cout << "void EdbShowAlgE::AddWeightFilePlate() done." << endl;
1491  return;
1492 }

◆ CheckPlateAndPlateBinning()

Int_t EdbShowAlgE::CheckPlateAndPlateBinning ( Int_t  Plate)
1582 {
1583  if (eMLPArrayN<1) return 0;
1584 
1585  Int_t tmpint;
1586  for (Int_t i=0; i<eMLPArrayN; ++i) {
1587  tmpint=eShowAlgEPlateBinning->At(i);
1588  //cout <<"CheckPlateAndPlateBinning , Plate, i =eShowAlgEPlateBinning->At(i) " << Plate << " " << i << " " << tmpint<< endl;
1589  if (Plate==tmpint) return 1;
1590  }
1591  return 0;
1592 }

◆ CheckStringToShowAlgEParaName()

Bool_t EdbShowAlgE::CheckStringToShowAlgEParaName ( TString  tmpString2)
private
2481 {
2482  if ( tmpString2 == eShowAlgEParaName ) return kTRUE;
2483  cout <<"Bool_t EdbShowAlgE::CheckStringToShowAlgEParaName() " <<tmpString2 << " does not matcht to " << eShowAlgEParaName;
2484  cout << " Return False."<< endl;
2485  return kFALSE;
2486 }

◆ ClassDef()

EdbShowAlgE::ClassDef ( EdbShowAlgE  ,
 
)

◆ ClearPlateBinning()

void EdbShowAlgE::ClearPlateBinning ( )
private
1339 {
1340  cout << "void EdbShowAlgE::ClearPlateBinning() " << endl;
1341  // Restore Standard Plate Binning
1342  if (eShowAlgEPlateBinning) {
1343  delete eShowAlgEPlateBinning;
1345 
1346  }
1347  else {
1348  // do nothing;
1349  }
1350 
1351  // Not more than 10 values of weightfiles will be allowed!!!
1352  eShowAlgEPlateBinning = new TArrayI(10);
1353  for (Int_t i=0; i<10; ++i) eShowAlgEPlateBinning->AddAt(0,i);
1354 
1355  cout << "void EdbShowAlgE::ClearPlateBinning()...done. " << endl;
1356  return;
1357 }

◆ Create_MLP()

void EdbShowAlgE::Create_MLP ( )

DEBUG ---------------------------— TEST DEVOPLEMENT.

775 {
776  cout << "EdbShowAlgE::Create_MLP()" << endl;
777 
778  TString testlayout="HALLO";
779  // This class implementation of TMultiLayerPerceptron has strange behaviors...
780  // The usual eMLP_Simple=0 resetings dont take effect and in the header file this has to be declared with
781  // Brackets.....I do not know why and try to keep it working in the standard way as much as possible!
782  TMultiLayerPerceptron* eMLP_Simple = new TMultiLayerPerceptron(testlayout);
783 
784  eMLP_Simple->Print();
785 
786  eMLP_SimpleIsDone=kTRUE;
787 
788  cout << "EdbShowAlgE::Create_MLP()...done." << endl;
789  return;
790 }
Bool_t eMLP_SimpleIsDone
Definition: EdbShowAlgE.h:99
TMultiLayerPerceptron * eMLP_Simple
Definition: EdbShowAlgE.h:97

◆ Create_MLPTree()

void EdbShowAlgE::Create_MLPTree ( )
1048 {
1049 
1050  Log(2,"EdbShowAlgE::Create_MLPTree","EdbShowAlgE::Create_MLPTree.");
1051 
1052  if (eMLP_SimpleTree) {
1053  delete eMLP_SimpleTree;
1054  eMLP_SimpleTree=0;
1055  cout << "deletion done"<<endl;
1056  }
1057 
1058  if (!eMLP_SimpleTree) {
1059  eMLP_SimpleTree = new TTree("eMLP_SimpleTree","eMLP_SimpleTree");
1060  eMLP_SimpleTree -> Branch("eInANN", eInANN, "eInANN[70]/F");
1061  eMLP_SimpleTree -> Branch("eInfoANN", eInfoANN, "eInfoANN[70]/F");
1062  }
1063 
1064  Log(2,"EdbShowAlgE::Create_MLPTree","EdbShowAlgE::Create_MLPTree....done");
1065  return;
1066 }
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
ParaSet Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D")
Float_t * eInANN
Definition: EdbShowAlgE.h:85
Float_t * eInfoANN
Definition: EdbShowAlgE.h:89
TTree * eMLP_SimpleTree
Definition: EdbShowAlgE.h:100

◆ CreateInputHistos()

void EdbShowAlgE::CreateInputHistos ( )
private
1146 {
1147  // Create Input Histos:
1148  // Bin Width and Bounds have to be overwritten later when parametrization is specified
1149  for (Int_t j=0; j<70; j++) {
1150  char hname[40];
1151  sprintf(hname,"Hist_eInANN_Hist_%d",j);
1152  if (!eInANN_Hist[j]) eInANN_Hist[j] = new TH1F(hname,hname,100,0, 1000.0);
1153  }
1154  return;
1155 }
TH1F * eInANN_Hist[70]
Definition: EdbShowAlgE.h:92

◆ CreateInputNeuronsArray()

void EdbShowAlgE::CreateInputNeuronsArray ( )
1916 {
1917  cout << "void EdbShowAlgE::CreateInputNeuronsArray() " << endl;
1918 
1919  switch (eShowAlgEParaNr) {
1920  case 0 : //CreateInputNeuronsArray_FJ();
1921  break;
1922  case 1 : //CreateInputNeuronsArray_LT();
1923  break;
1924  case 2 :
1926  break;
1927  case 3 : //CreateInputNeuronsArray_JC();
1928  break;
1929  case 4 :
1931  break;
1932 
1933  case 5 :
1935  break;
1936 
1937  default :
1939  break;
1940  }
1941 
1942  cout << "void EdbShowAlgE::CreateInputNeuronsArray() done..." << endl;
1943  return;
1944 }
void CreateInputNeuronsArray_YC()
Definition: EdbShowAlgE.cxx:1951
void CreateInputNeuronsArray_YY()
Definition: EdbShowAlgE.cxx:2044
Int_t eShowAlgEParaNr
Definition: EdbShowAlgE.h:48
void CreateInputNeuronsArray_XX()
Definition: EdbShowAlgE.cxx:1996

◆ CreateInputNeuronsArray_XX()

void EdbShowAlgE::CreateInputNeuronsArray_XX ( )
1997 {
1998  cout << "void EdbShowAlgE::CreateInputNeuronsArray_XX() " << endl;
1999  // Restore Standard Plate Binning
2000  if (eMLP_InputNeuronsArray) {
2001  delete eMLP_InputNeuronsArray;
2003  }
2004  else {
2005  // do nothing;
2006  }
2007 
2008  // Not more than 10 values of weightfiles will be allowed!
2009  eMLP_InputNeuronsArray = new TArrayI(10);
2010  for (Int_t i=0; i<10; ++i) eMLP_InputNeuronsArray->AddAt(0,i);
2011 
2012  cout << "void EdbShowAlgE::CreateInputNeuronsArray_XX()...done. " << endl;
2013  return;
2014 }
TArrayI * eMLP_InputNeuronsArray
Definition: EdbShowAlgE.h:114

◆ CreateInputNeuronsArray_YC()

void EdbShowAlgE::CreateInputNeuronsArray_YC ( )
1952 {
1953  cout << "void EdbShowAlgE::CreateInputNeuronsArray_YC() " << endl;
1954  // Restore Standard Plate Binning
1955  if (eMLP_InputNeuronsArray) {
1956  delete eMLP_InputNeuronsArray;
1958  }
1959  else {
1960  // do nothing;
1961  }
1962 
1963  // Not more than 10 values of weightfiles will be allowed!
1964  eMLP_InputNeuronsArray = new TArrayI(10);
1965  for (Int_t i=0; i<10; ++i) eMLP_InputNeuronsArray->AddAt(0,i);
1966 
1967  cout << "void EdbShowAlgE::CreateInputNeuronsArray_YC()...done. " << endl;
1968  return;
1969 }

◆ CreateInputNeuronsArray_YY()

void EdbShowAlgE::CreateInputNeuronsArray_YY ( )
2045 {
2046  cout << "void EdbShowAlgE::CreateInputNeuronsArray_YY() " << endl;
2047  // Restore Standard Plate Binning
2048  if (eMLP_InputNeuronsArray) {
2049  delete eMLP_InputNeuronsArray;
2051  }
2052  else {
2053  // do nothing;
2054  }
2055 
2056  // Not more than 10 values of weightfiles will be allowed!
2057  eMLP_InputNeuronsArray = new TArrayI(10);
2058  for (Int_t i=0; i<10; ++i) eMLP_InputNeuronsArray->AddAt(0,i);
2059 
2060  cout << "void EdbShowAlgE::CreateInputNeuronsArray_YY()...done. " << endl;
2061  return;
2062 }

◆ CreateMLPArray()

void EdbShowAlgE::CreateMLPArray ( )
2148 {
2149  if (!eMLPArray) eMLPArray = new TObjArray(10);
2150  return;
2151 }
TObjArray * eMLPArray
Definition: EdbShowAlgE.h:63

◆ CreateMLPLayout()

TString EdbShowAlgE::CreateMLPLayout ( Int_t  NrOfANNInputNeurons)
private
1300 {
1301  TString layout;
1302 
1303  for (Int_t i=1; i<NrOfANNInputNeurons; ++i) layout += "@eInANN["+TString(Form("%d",i))+"],";
1304  layout +="@eInANN["+TString(Form("%d",NrOfANNInputNeurons))+"]:"+TString(Form("%d",NrOfANNInputNeurons+1))+":"+TString(Form("%d",NrOfANNInputNeurons));
1305 
1306  //layout+=":eInANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1307  layout+=":eInfoANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1308 
1309  return layout;
1310 }

◆ CreateMLPLayout_XX()

void EdbShowAlgE::CreateMLPLayout_XX ( Int_t  nr)
1800 {
1801  // This Implementation if now depending on the parametrization:
1802  // Either it is depending on the numer of reconstructed plates;
1803  // FJ,LT,YY it is.
1804  // YC,JC,XX it is not.
1805 
1806  if (gEDBDEBUGLEVEL>2) cout << "void EdbShowAlgE::CreateMLPLayout_XX("<<nr<<") " << endl;
1807 
1808 // cout << "eShowAlgEPlateBinning->GetSize() " << eShowAlgEPlateBinning->GetSize() <<endl;
1809 // cout << "eMLPArrayN " <<eMLPArrayN <<endl;
1810 // cout << "eShowAlgEPlateBinning->At(nr) " << eShowAlgEPlateBinning->At(nr) <<endl;
1811 // cout << "eMLP_InputNeuronsArray->At(nr) " << eMLP_InputNeuronsArray->At(nr) <<endl;
1812 
1813 
1814  // Here the important change it acoording to the needs of the parametrization:
1815  Int_t NrOfANNInputNeurons=eMLP_InputNeuronsArray->At(nr);
1816  //XX:
1817  NrOfANNInputNeurons=7;
1818  //FJ:
1819  //NrOfANNInputNeurons=eMLP_InputNeuronsArray->At(nr)+1+2+2;
1820  // Simple Test
1821  //NrOfANNInputNeurons=eMLP_InputNeuronsArray->At(nr);
1822 
1823 
1824  TString layout;
1825  for (Int_t i=1; i<NrOfANNInputNeurons; ++i) layout += "@eInANN["+TString(Form("%d",i))+"],";
1826  layout +="@eInANN["+TString(Form("%d",NrOfANNInputNeurons))+"]:"+TString(Form("%d",NrOfANNInputNeurons+1))+":"+TString(Form("%d",NrOfANNInputNeurons));
1827  //layout+=":eInANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1828  layout+=":eInfoANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1829 
1831 
1832 
1833  // Add layout to the arrays of layouts:
1834  // -------------
1835  // TString
1836  // Basic string class.
1837  // Cannot be stored in a TCollection... use TObjString instead.
1838  // -------------
1839  eMLP_Layout=layout;
1840  TObjString* objstr = new TObjString(eMLP_Layout.Data());
1841  eMLP_LayoutArray->Add(objstr);
1842 
1843 
1844 
1845  if (gEDBDEBUGLEVEL>3) eMLP_LayoutArray->Print();
1846 
1847  if (gEDBDEBUGLEVEL>2) cout << "void EdbShowAlgE::CreateMLPLayout_XX("<<nr<<") ...done." << endl;
1848  return;
1849 }
TString eMLP_Layout
Definition: EdbShowAlgE.h:102
TObjArray * eMLP_LayoutArray
Definition: EdbShowAlgE.h:103
gEDBDEBUGLEVEL
Definition: energy.C:7

◆ CreateMLPLayout_YC()

void EdbShowAlgE::CreateMLPLayout_YC ( Int_t  nr)
1741 {
1742  // This Implementation if now depending on the parametrization:
1743  // Either it is depending on the numer of reconstructed plates;
1744  // FJ,LT,YY it is.
1745  // YC,JC,XX it is not.
1746 
1747  if (gEDBDEBUGLEVEL>2) cout << "void EdbShowAlgE::CreateMLPLayout_YC("<<nr<<") " << endl;
1748 
1749 // cout << "eShowAlgEPlateBinning->GetSize() " << eShowAlgEPlateBinning->GetSize() <<endl;
1750 // cout << "eMLPArrayN " <<eMLPArrayN <<endl;
1751 // cout << "eShowAlgEPlateBinning->At(nr) " << eShowAlgEPlateBinning->At(nr) <<endl;
1752 // cout << "eMLP_InputNeuronsArray->At(nr) " << eMLP_InputNeuronsArray->At(nr) <<endl;
1753 
1754 
1755  // Here the important change it acoording to the needs of the parametrization:
1756  Int_t NrOfANNInputNeurons=0;
1757  //XX:
1758  //NrOfANNInputNeurons=7;
1759  //FJ:
1760  //NrOfANNInputNeurons=eMLP_InputNeuronsArray->At(nr)+1+2+2;
1761  // Simple Test
1762  //NrOfANNInputNeurons=eMLP_InputNeuronsArray->At(nr);
1763  //YY:
1764  //NrOfANNInputNeurons=1+5+eMLP_InputNeuronsArray->At(nr);
1765  //YC:
1766  NrOfANNInputNeurons=1+2+2;
1767  //---
1768 
1769  TString layout;
1770  for (Int_t i=1; i<NrOfANNInputNeurons; ++i) layout += "@eInANN["+TString(Form("%d",i))+"],";
1771  layout +="@eInANN["+TString(Form("%d",NrOfANNInputNeurons))+"]:"+TString(Form("%d",NrOfANNInputNeurons+1))+":"+TString(Form("%d",NrOfANNInputNeurons));
1772  //layout+=":eInANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1773  layout+=":eInfoANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1774 
1776 
1777 
1778  // Add layout to the arrays of layouts:
1779  // -------------
1780  // TString
1781  // Basic string class.
1782  // Cannot be stored in a TCollection... use TObjString instead.
1783  // -------------
1784  eMLP_Layout=layout;
1785  TObjString* objstr = new TObjString(eMLP_Layout.Data());
1786  eMLP_LayoutArray->Add(objstr);
1787 
1788 
1789  if (gEDBDEBUGLEVEL>3) eMLP_LayoutArray->Print();
1790  if (gEDBDEBUGLEVEL>3) cout << "void EdbShowAlgE::CreateMLPLayout_YC layout = " << layout << endl;
1791 
1792  if (gEDBDEBUGLEVEL>2) cout << "void EdbShowAlgE::CreateMLPLayout_YC("<<nr<<") ...done." << endl;
1793  return;
1794 }

◆ CreateMLPLayout_YY()

void EdbShowAlgE::CreateMLPLayout_YY ( Int_t  nr)
1856 {
1857  // This Implementation if now depending on the parametrization:
1858  // Either it is depending on the numer of reconstructed plates;
1859  // FJ,LT,YY it is.
1860  // YC,JC,XX it is not.
1861 
1862  if (gEDBDEBUGLEVEL>2) cout << "void EdbShowAlgE::CreateMLPLayout_YY("<<nr<<") " << endl;
1863 
1864 // cout << "eShowAlgEPlateBinning->GetSize() " << eShowAlgEPlateBinning->GetSize() <<endl;
1865 // cout << "eMLPArrayN " <<eMLPArrayN <<endl;
1866 // cout << "eShowAlgEPlateBinning->At(nr) " << eShowAlgEPlateBinning->At(nr) <<endl;
1867 // cout << "eMLP_InputNeuronsArray->At(nr) " << eMLP_InputNeuronsArray->At(nr) <<endl;
1868 
1869 
1870  // Here the important change it acoording to the needs of the parametrization:
1871  Int_t NrOfANNInputNeurons=0;
1872  //XX:
1873  //NrOfANNInputNeurons=7;
1874  //FJ:
1875  //NrOfANNInputNeurons=eMLP_InputNeuronsArray->At(nr)+1+2+2;
1876  // Simple Test
1877  //NrOfANNInputNeurons=eMLP_InputNeuronsArray->At(nr);
1878  //YY:
1879  NrOfANNInputNeurons=1+5+eMLP_InputNeuronsArray->At(nr);
1880  //---
1881 
1882 
1883  TString layout;
1884  for (Int_t i=1; i<NrOfANNInputNeurons; ++i) layout += "@eInANN["+TString(Form("%d",i))+"],";
1885  layout +="@eInANN["+TString(Form("%d",NrOfANNInputNeurons))+"]:"+TString(Form("%d",NrOfANNInputNeurons+1))+":"+TString(Form("%d",NrOfANNInputNeurons));
1886  //layout+=":eInANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1887  layout+=":eInfoANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
1888 
1890 
1891 
1892  // Add layout to the arrays of layouts:
1893  // -------------
1894  // TString
1895  // Basic string class.
1896  // Cannot be stored in a TCollection... use TObjString instead.
1897  // -------------
1898  eMLP_Layout=layout;
1899  TObjString* objstr = new TObjString(eMLP_Layout.Data());
1900  eMLP_LayoutArray->Add(objstr);
1901 
1902 
1903  if (gEDBDEBUGLEVEL>3) eMLP_LayoutArray->Print();
1904  if (gEDBDEBUGLEVEL>3) cout << "void EdbShowAlgE::CreateMLPLayout_YY layout = " << layout << endl;
1905 
1906  if (gEDBDEBUGLEVEL>2) cout << "void EdbShowAlgE::CreateMLPLayout_YY("<<nr<<") ...done." << endl;
1907  return;
1908 }

◆ CreateMLPLayouts()

void EdbShowAlgE::CreateMLPLayouts ( )
1600 {
1601  cout << "void EdbShowAlgE::CreateMLPLayouts() " << endl;
1602 
1603  cout << "void EdbShowAlgE::CreateMLPLayouts() Calling fuction suited to the eShowAlgEParaName" << endl;
1604  cout << "void EdbShowAlgE::CreateMLPLayouts() Respectively to the eShowAlgEParaNr" << endl;
1605 
1606  switch (eShowAlgEParaNr) {
1607  case 0 :
1609  break;
1610  case 1 :
1612  break;
1613  case 2 :
1615  break;
1616  case 3 :
1618  break;
1619  case 4 :
1621  break;
1622  case 5 :
1624  break;
1625  default :
1627  break;
1628  }
1629 
1630  return;
1631 }
void CreateMLPLayouts_YC()
Definition: EdbShowAlgE.cxx:1660
void CreateMLPLayouts_JC()
Definition: EdbShowAlgE.cxx:1684
void CreateMLPLayouts_LT()
Definition: EdbShowAlgE.cxx:1650
void CreateMLPLayouts_YY()
Definition: EdbShowAlgE.cxx:1717
void CreateMLPLayouts_XX()
Definition: EdbShowAlgE.cxx:1694
void CreateMLPLayouts_FJ()
Definition: EdbShowAlgE.cxx:1640

◆ CreateMLPLayouts_FJ()

void EdbShowAlgE::CreateMLPLayouts_FJ ( )
1641 {
1642  cout << "void EdbShowAlgE::CreateMLPLayouts_FJ() " << endl;
1643  return;
1644 }

◆ CreateMLPLayouts_JC()

void EdbShowAlgE::CreateMLPLayouts_JC ( )
1685 {
1686  cout << "void EdbShowAlgE::CreateMLPLayouts_JC() " << endl;
1687  return;
1688 }

◆ CreateMLPLayouts_LT()

void EdbShowAlgE::CreateMLPLayouts_LT ( )
1651 {
1652  cout << "void EdbShowAlgE::CreateMLPLayouts_LT() " << endl;
1653  return;
1654 }

◆ CreateMLPLayouts_XX()

void EdbShowAlgE::CreateMLPLayouts_XX ( )
1695 {
1696  cout << "void EdbShowAlgE::CreateMLPLayouts_XX() " << endl;
1697 
1699 
1701 
1702  // This is the loop for the number of eMLPs to be availible. For each plate number weightfile
1703  // a new layout is created.
1704  for (Int_t i=0; i<eMLPArrayN; ++i) CreateMLPLayout_XX(i);
1705 
1706  // Now we know that it was done.
1707  // But no check if layouts are correctly, only the function steps have been done!
1708  eMLP_LayoutArrayIsDone=kTRUE;
1709 
1710  cout << "void EdbShowAlgE::CreateMLPLayouts_XX()...done." << endl;
1711  return;
1712 }
void CreateInputNeuronsArray()
Definition: EdbShowAlgE.cxx:1915
void CreateMLPLayout_XX(Int_t nr)
Definition: EdbShowAlgE.cxx:1799
Bool_t eMLP_LayoutArrayIsDone
Definition: EdbShowAlgE.h:104
void FillInputNeuronsArray_XX()
Definition: EdbShowAlgE.cxx:2020

◆ CreateMLPLayouts_YC()

void EdbShowAlgE::CreateMLPLayouts_YC ( )
1661 {
1662  cout << "void EdbShowAlgE::CreateMLPLayouts_YY() " << endl;
1663 
1665 
1667 
1668  // This is the loop for the number of eMLPs to be availible. For each plate number weightfile
1669  // a new layout is created.
1670  for (Int_t i=0; i<eMLPArrayN; ++i) CreateMLPLayout_YC(i);
1671 
1672  // Now we know that it was done.
1673  // But no check if layouts are correctly, only the function steps have been done!
1674  eMLP_LayoutArrayIsDone=kTRUE;
1675 
1676  cout << "void EdbShowAlgE::CreateMLPLayouts_YC()...done." << endl;
1677  return;
1678 }
void FillInputNeuronsArray_YC()
Definition: EdbShowAlgE.cxx:1975
void CreateMLPLayout_YC(Int_t nr)
Definition: EdbShowAlgE.cxx:1740

◆ CreateMLPLayouts_YY()

void EdbShowAlgE::CreateMLPLayouts_YY ( )
1718 {
1719  cout << "void EdbShowAlgE::CreateMLPLayouts_YY() " << endl;
1720 
1722 
1724 
1725  // This is the loop for the number of eMLPs to be availible. For each plate number weightfile
1726  // a new layout is created.
1727  for (Int_t i=0; i<eMLPArrayN; ++i) CreateMLPLayout_YY(i);
1728 
1729  // Now we know that it was done.
1730  // But no check if layouts are correctly, only the function steps have been done!
1731  eMLP_LayoutArrayIsDone=kTRUE;
1732 
1733  return;
1734 }
void CreateMLPLayout_YY(Int_t nr)
Definition: EdbShowAlgE.cxx:1855
void FillInputNeuronsArray_YY()
Definition: EdbShowAlgE.cxx:2068

◆ CreateMLPs()

void EdbShowAlgE::CreateMLPs ( )
2094 {
2095  // Since the layout if sixed by the parametrisation, this function
2096  // can be equall for all types of parametrisations:
2097 
2098  // Check if layouts have been done:
2099  if (!eMLP_LayoutArrayIsDone) {
2100  cout << "void EdbShowAlgE::CreateMLPs() ERROR: eMLP_LayoutArrayIsDone HAS NOT BEEN DONE. RETURN!" << endl;
2101  return;
2102  }
2103 
2104 
2105  Log(3,"EdbShowAlgE::CreateMLPs()","Since the layout if sixed by the parametrisation, this function ");
2106  Log(3,"EdbShowAlgE::CreateMLPs()","can be equall for all types of parametrisations.");
2107  Log(3,"EdbShowAlgE::CreateMLPs()","It is now only different for some parametrisations by the number of plates. ");
2108  Log(2,"EdbShowAlgE::CreateMLPs()","If you see now a message like:");
2109  Log(2,"EdbShowAlgE::CreateMLPs()","Data not set. Cannot define datasets.");
2110  Log(2,"EdbShowAlgE::CreateMLPs()","Then this means that we have not yet defined the eMLP_SimpleTree for the ANN. This has to be done later. In any case the ANN can be created without it.");
2111 
2112 
2113  Int_t tmpint;
2114 
2115  if (!eMLPArray) CreateMLPArray();
2116 
2117 
2118  for (Int_t i=0; i<eMLP_InputNeuronsArrayN; ++i) {
2119 
2120  tmpint= eMLP_InputNeuronsArray->At(i);
2121 
2122  TString layout = ((TObjString*)eMLP_LayoutArray->At(i))->GetString();
2123 
2124  eMLP_Simple = new TMultiLayerPerceptron(layout, eMLP_SimpleTree,"Entry$%2","(Entry$+1)%2");
2125 
2126  //cout << " eMLP_Simple = " << eMLP_Simple << endl;
2127 
2128  eMLPArray->Add(eMLP_Simple);
2129  }
2130 
2131  cout << " eMLP_Simple = " << eMLP_Simple << endl;
2132  cout << " eMLPArray->GetEntries() = " << eMLPArray->GetEntries() << endl;
2133  cout << " eMLPArrayN = " << eMLPArrayN << endl;
2134 
2135  // This should have no effect since eMLPArrayN is already filled with correct value;
2136  SetMLPArrayN(eMLPArray->GetEntries());
2137 
2138  cout << " eMLPArrayN = " << eMLPArrayN << endl;
2139 
2140  return;
2141 }
void SetMLPArrayN(Int_t MLPArrayN)
Definition: EdbShowAlgE.h:187
void CreateMLPArray()
Definition: EdbShowAlgE.cxx:2147

◆ CreateStandardMLPArrayN()

void EdbShowAlgE::CreateStandardMLPArrayN ( )
1375 {
1376  cout << "void EdbShowAlgE::CreateStandardMLPArrayN() " << endl;
1377  cout << "void EdbShowAlgE::CreateStandardMLPArrayN() According to the standard weightfile strings" << endl;
1378  cout << "void EdbShowAlgE::CreateStandardMLPArrayN() (weights_energy_11.txt,...,weights_energy_46.txt)." << endl;
1379 
1381 
1382  // Set Number that tells how many MLPs are instantiated.
1383  // 11,16,21,26,31,36,41,46 (51,56)
1384  // the array itsself contains 10 entries but for 51 and 56 plate the weightfiles do not exist yet.
1385  eMLPArrayN=10;
1386 
1387  // These two variables are always same!
1389 
1390 // cout << "------"<< endl;
1391 // cout << "eMLPArrayN = " << eMLPArrayN << endl;
1392 // cout << "eMLP_InputNeuronsArrayN = " << eMLP_InputNeuronsArrayN << endl;
1393 
1394  cout << "void EdbShowAlgE::CreateStandardMLPArrayN() done." << endl;
1395  return;
1396 }
void ResetPlateBinning()
Definition: EdbShowAlgE.cxx:1316

◆ CreateStandardWeightFileStrings()

void EdbShowAlgE::CreateStandardWeightFileStrings ( )
1403 {
1404  cout << "void EdbShowAlgE::CreateStandardWeightFileStrings() " << endl;
1405 
1406 
1408 
1409  // There can be some cases when default par is read in and eShowAlgEPlateBinning was creadted, but due to wrong input settings
1410  // of default.par. In this case, eShowAlgEPlateBinning is there, but Cleared (filled with zeros).
1411  // So if this, we have to ResetPlateBinning again:
1412  if (eShowAlgEPlateBinning && eShowAlgEPlateBinning->At(0)==0 && eShowAlgEPlateBinning->At(9)==0 ) {
1413  cout << "void EdbShowAlgE::CreateStandardWeightFileStrings() ResetPlateBinning again, cause eShowAlgEPlateBinning is filled with zeros." << endl;
1415  }
1416 
1417  cout << "void EdbShowAlgE::CreateStandardWeightFileStrings() ResetPlateBinning done" << endl;
1418 
1419  // Create Standard weight file strings:
1420  // weight_energy_YY_"i".txt, i=11,16,21,26,31,36,41,46,51,56
1421  // .Data() to convert to const char
1422  Int_t tmpint;
1423  for (Int_t i=0; i<10; ++i) {
1424  tmpint=eShowAlgEPlateBinning->At(i);
1425  eMLP_WeightFileNameArray[i]=TString(Form("weights_energy_%s_%d.txt",eShowAlgEParaName.Data(),tmpint));
1426  //cout << eMLP_WeightFileNameArray[i] << endl;
1427  }
1428 
1429  cout << "void EdbShowAlgE::CreateStandardWeightFileStrings() ...done." << endl;
1430  return;
1431 }

◆ DumpWeights()

void EdbShowAlgE::DumpWeights ( )
669 {
670  if (!eMLP_WriteWeightFile) {
671  cout << "void EdbShowAlgE::DumpWeights() eMLP_WriteWeightFile="<< eMLP_WriteWeightFile << " . So write nothing. RETURN"<<endl;
672  return;
673  }
674  if (GetMLPWeightFileName()==""||GetMLPWeightFileName()=="EMPTY") SetMLPWeightFileName("weights.txt");
675 
676  cout << "void EdbShowAlgE::DumpWeights() "<< endl;
677  cout << eMLP_WeightFileName << endl;
678  eMLP_Simple->DumpWeights(eMLP_WeightFileName);
679  cout << "void EdbShowAlgE::DumpWeights() ... done."<< endl;
680  return;
681 }
TString GetMLPWeightFileName()
Definition: EdbShowAlgE.h:225
void SetMLPWeightFileName(TString weightfilename)
Definition: EdbShowAlgE.h:178
TString eMLP_WeightFileName
Definition: EdbShowAlgE.h:108
Bool_t eMLP_WriteWeightFile
Definition: EdbShowAlgE.h:107

◆ Execute()

void EdbShowAlgE::Execute ( )
virtual
249 {
250  return;
251 }

◆ Fill_MLPTree()

void EdbShowAlgE::Fill_MLPTree ( )

DRPECIATED !!!!!!!!!!!!

Get Suited Parametrization: TO BE ADAPTED FOR ALL PARAMETRIZATIONS !!!!!

1073 {
1074 
1076 
1077  return;
1078 
1079 
1080  cout << "EdbShowAlgE::Fill_MLPTree()" << endl;
1081 
1082  cout << "EdbShowAlgE::Fill_MLPTree() // Get correct Parametrisation. ONLY XX IS SUPPORTED AT THE RIGHT MOMENT !!!" << endl;
1083 
1084  // Get correct Parametrisation. ONLY XX IS SUPPORTED AT THE RIGHT MOMENT !!!
1085 
1086 
1087  // Create and Clear Tree:
1089  eMLP_SimpleTree->Clear();
1090 
1091 
1092 
1093  EdbShowerP* show=0;
1094  for (int i=0; i<eRecoShowerArrayN; i++ ) {
1095  cout << "EdbShowAlgE::TESTTRAIN i= " << i << endl;
1096  show=(EdbShowerP*)eRecoShowerArray->At(i);
1097  show->PrintNice();
1098  if (! show->GetParametrisationIsDone(4)) show->BuildParametrisation(4);
1099 
1102  EdbShowerP::Para_XX ePara_XX;
1103  ePara_XX=show->GetPara_XX();
1104 
1105  // Get each Variables: InputType
1106  // Energy
1107  eInANN[0]=show->GetSegment(0)->P();
1108  // This can be different in later modifications (for example gamma Showers, where the Energy is not defined by single BT P(), but
1109  // by both starting BT close to each other (e+,e-)pair.
1110 
1111  // Variables: TestingType
1112  eInANN[1]=ePara_XX.nseg;
1113  eInANN[2]=ePara_XX.Mean_ProfileLongitudinal;
1114  eInANN[3]=ePara_XX.RMS_ProfileLongitudinal;
1115  eInANN[4]=ePara_XX.Max_ProfileLongitudinal;
1116  eInANN[5]=ePara_XX.Mean_ProfileTransversal;
1117  eInANN[6]=ePara_XX.RMS_ProfileTransversal;
1118  eInANN[7]=ePara_XX.Max_ProfileTransversal;
1119 
1120  if (gEDBDEBUGLEVEL>3) {
1121  for (int i=0; i<eRecoShowerArrayN; i++ ) cout << "EdbShowAlgE::_XX() eInANN["<<i<<"]= " << eInANN[i] << endl;
1122  cout << "EdbShowAlgE:: ...."<<endl;
1123  cout << "EdbShowAlgE:: ...."<<endl;
1124  cout << "EdbShowAlgE:: eInANN[69]= " << eInANN[69] << endl;
1125  }
1126 
1127  eMLP_SimpleTree->Fill();
1128  }
1129 
1130 
1131  if (gEDBDEBUGLEVEL>2) cout << "EdbShowAlgE:: Fill_MLPTree done." << endl;
1132  if (gEDBDEBUGLEVEL>2) eMLP_SimpleTree->Print();
1133 
1134 
1135  cout << "EdbShowAlgE::Fill_MLPTree()...done." << endl;
1136  return;
1137 }
Float_t P() const
Definition: EdbSegP.h:149
void Create_MLPTree()
Definition: EdbShowAlgE.cxx:1047
Definition: EdbShowerP.h:28
void PrintNice()
Definition: EdbShowerP.cxx:2339
Bool_t GetParametrisationIsDone(Int_t nr) const
Definition: EdbShowerP.h:546
void BuildParametrisation(Int_t ParaNr)
Definition: EdbShowerP.cxx:1190
Para_XX GetPara_XX() const
Definition: EdbShowerP.h:563
EdbSegP * GetSegment(int i) const
Definition: EdbShowerP.h:435
Definition: EdbShowerP.h:200
Float_t Max_ProfileLongitudinal
Definition: EdbShowerP.h:206
Int_t nseg
Definition: EdbShowerP.h:203
Float_t Max_ProfileTransversal
Definition: EdbShowerP.h:209
Float_t RMS_ProfileLongitudinal
Definition: EdbShowerP.h:205
Float_t Mean_ProfileLongitudinal
Definition: EdbShowerP.h:204
Float_t RMS_ProfileTransversal
Definition: EdbShowerP.h:208
Float_t Mean_ProfileTransversal
Definition: EdbShowerP.h:207

◆ FillInputHistosPara_XX()

void EdbShowAlgE::FillInputHistosPara_XX ( )
private
1270 {
1271  // Reset
1272  for (Int_t j=0; j<70; j++) eInANN_Hist[j]->Reset();
1273  //Set bins:
1275 
1276  //Fill with entries from the tree:
1277 
1278 
1279  for (int i=0; i<eMLP_SimpleTree->GetEntries(); ++i) {
1280  eMLP_SimpleTree->GetEntry(i);
1281  // Fill InputHistograms now...
1282  for (Int_t j=0; j<70; j++) {
1283  eInANN_Hist[j]->Fill(eInANN[j]);
1284  }
1285  }
1286 
1287 
1288  return;
1289 }
void SetInputHistosPara_XX()
Definition: EdbShowAlgE.cxx:1223

◆ FillInputNeuronsArray_XX()

void EdbShowAlgE::FillInputNeuronsArray_XX ( )
2021 {
2022  cout << "void EdbShowAlgE::FillInputNeuronsArray_XX() " << endl;
2023  // Restore Standard Plate Binning
2024  if (!eMLP_InputNeuronsArray) return;
2025 
2026  // Not more than 10 values of weightfiles will be allowed!
2027  Int_t tmpint;
2028 
2029  for (Int_t i=0; i<10; ++i) {
2030  tmpint=eShowAlgEPlateBinning->At(i);
2031  eMLP_InputNeuronsArray->AddAt(tmpint,i);
2032  //cout << i << " " << tmpint << endl;
2033  }
2034 
2035  cout << "void EdbShowAlgE::FillInputNeuronsArray_XX()...done. " << endl;
2036  return;
2037 }

◆ FillInputNeuronsArray_YC()

void EdbShowAlgE::FillInputNeuronsArray_YC ( )
1976 {
1977  cout << "void EdbShowAlgE::FillInputNeuronsArray_YC() " << endl;
1978  // Restore Standard Plate Binning
1979  if (!eMLP_InputNeuronsArray) return;
1980 
1981  // Not more than 10 values of weightfiles will be allowed!
1982  Int_t tmpint;
1983 
1984  for (Int_t i=0; i<10; ++i) {
1985  tmpint=eShowAlgEPlateBinning->At(i);
1986  eMLP_InputNeuronsArray->AddAt(tmpint,i);
1987  //cout << i << " " << tmpint << endl;
1988  }
1989 
1990  cout << "void EdbShowAlgE::FillInputNeuronsArray_YC()...done. " << endl;
1991  return;
1992 }

◆ FillInputNeuronsArray_YY()

void EdbShowAlgE::FillInputNeuronsArray_YY ( )
2069 {
2070  cout << "void EdbShowAlgE::FillInputNeuronsArray_YY() " << endl;
2071  // Restore Standard Plate Binning
2072  if (!eMLP_InputNeuronsArray) return;
2073 
2074  // Not more than 10 values of weightfiles will be allowed!
2075  Int_t tmpint;
2076 
2077  for (Int_t i=0; i<10; ++i) {
2078  tmpint=eShowAlgEPlateBinning->At(i);
2079  eMLP_InputNeuronsArray->AddAt(tmpint,i);
2080  //cout << i << " " << tmpint << endl;
2081  }
2082 
2083  cout << "void EdbShowAlgE::FillInputNeuronsArray_YY()...done. " << endl;
2084  return;
2085 }

◆ FillMLP_SimpleTree()

void EdbShowAlgE::FillMLP_SimpleTree ( )
541 {
542  cout << "EdbShowAlgE::FillMLP_SimpleTree()" << endl;
543 
544 
545  cout <<"===============" << GetMLPInputFileName() << endl;
546 
547  // ---------
548  if (!eMLP_SimpleTree) {
549  cout << "EdbShowAlgE::FillMLP_SimpleTree() NO eMLP_SimpleTree. Create now. " << endl;
550  Create_MLPTree();
551  }
552 
553 
554  cout <<"===============" << GetMLPInputFileName() << endl;
555 
556  if (!eMLPArray) {
557  cout << "EdbShowAlgE::FillMLP_SimpleTree() NO eMLPArray " << endl;
558  return;
559  }
560 
561 
562  cout <<"===============" << GetMLPInputFileName() << endl;
563 
564  // Do this in case that eMLP_SimpleTree is read by ReadMLPInputFile
565  if (eMLP_ReadMLPInputFile) {
566  cout << "EdbShowAlgE::FillMLP_SimpleTree() Read eMLP_SimpleTree from file:" << endl;
568  return;
569  }
570 
571  cout << "EdbShowAlgE::FillMLP_SimpleTree() Call FillMLP_SimpleTree___() now:"<< endl;
575 
576 
577  cout <<"===============" << GetMLPInputFileName() << endl;
578 
579  cout << "EdbShowAlgE::FillMLP_SimpleTree() done." << endl;
580  return;
581 }
void FillMLP_SimpleTree_YY()
Definition: EdbShowAlgE.cxx:629
TString GetMLPInputFileName()
Definition: EdbShowAlgE.h:228
void ReadMLPInputFile()
Definition: EdbShowAlgE.cxx:527
void FillMLP_SimpleTree_XX()
Definition: EdbShowAlgE.cxx:607
Bool_t eMLP_ReadMLPInputFile
Definition: EdbShowAlgE.h:119
void FillMLP_SimpleTree_YC()
Definition: EdbShowAlgE.cxx:584

◆ FillMLP_SimpleTree_XX() [1/2]

void EdbShowAlgE::FillMLP_SimpleTree_XX ( )
608 {
609  cout << "EdbShowAlgE::FillMLP_SimpleTree_XX()" << endl;
610 
611 
612 
613  // Do this in case that eMLP_SimpleTree is filled by eRecoShowerArrayN
614  EdbShowerP* show=0;
615  for (int i=0; i<eRecoShowerArrayN; i++ ) {
616  //cout << "EdbShowAlgE::FILL i= " << i << endl;
617  show=(EdbShowerP*)eRecoShowerArray->At(i);
619  }
620  eMLP_SimpleTree->Print();
621  cout << "eMLP_SimpleTree>GetEntries():"<< eMLP_SimpleTree->GetEntries() << endl;
622 
623  eMLP_SimpleTree->Show(eMLP_SimpleTree->GetEntries()-1);
624  cout << "EdbShowAlgE::FillMLP_SimpleTree_XX()...done." << endl;
625  return;
626 }

◆ FillMLP_SimpleTree_XX() [2/2]

void EdbShowAlgE::FillMLP_SimpleTree_XX ( EdbShowerP show,
Int_t  ShowAlgEParaNr 
)
2340  {
2341 
2342  if (! show->GetParametrisationIsDone(ShowAlgEParaNr)) show->BuildParametrisation(ShowAlgEParaNr);
2343 
2344  // Get Suited Parametrization:
2345  EdbShowerP::Para_XX ePara_XX;
2346  ePara_XX=show->GetPara_XX();
2347 
2348  // Get each Variables: InputType
2349  // Energy
2350  eInANN[0]=show->GetSegment(0)->P();
2351  // This can be different in later modifications (for example gamma Showers, where the Energy is not defined by single BT P(), but
2352  // by both starting BT close to each other (e+,e-)pair.
2353 
2354  // Variables: TestingType
2355  eInANN[1]=ePara_XX.nseg;
2356  eInANN[2]=ePara_XX.Mean_ProfileLongitudinal;
2357  eInANN[3]=ePara_XX.RMS_ProfileLongitudinal;
2358  eInANN[4]=ePara_XX.Max_ProfileLongitudinal;
2359  eInANN[5]=ePara_XX.Mean_ProfileTransversal;
2360  eInANN[6]=ePara_XX.RMS_ProfileTransversal;
2361  eInANN[7]=ePara_XX.Max_ProfileTransversal;
2362 
2363  // Fill also related eInfoANN variables:
2364  eInfoANN[0]=show->GetSegment(0)->P();
2365  eInfoANN[1]=show->Npl();
2366 
2367 
2368  if (gEDBDEBUGLEVEL>3) {
2369  for (int i=0; i<13; i++ ) cout << "EdbShowAlgE::_XX() eInANN["<<i<<"]= " << eInANN[i] << endl;
2370  cout << "EdbShowAlgE:: ...."<<endl;
2371  for (int i=70-13; i<70; i++ ) cout << "EdbShowAlgE::_XX() eInANN["<<i<<"]= " << eInANN[i] << endl;
2372 
2373  cout << "EdbShowAlgE::_XX() eInfoANN[0]= " << eInfoANN[0] << endl;
2374  cout << "EdbShowAlgE::_XX() eInfoANN[1]= " << eInfoANN[1] << endl;
2375  }
2376 
2377  // Fill InputHistograms now...
2378  for (Int_t j=0; j<70; j++) {
2379  eInANN_Hist[j]->Fill(eInANN[j]);
2380  }
2381 
2382 
2383  if (gEDBDEBUGLEVEL>3) {
2384  cout << "EdbShowAlgE:: eMLP_SimpleTree " << eMLP_SimpleTree << endl;
2385  cout << "EdbShowAlgE:: eMLP_SimpleTree->ClassName() " << eMLP_SimpleTree->ClassName() << endl;
2386  cout << "EdbShowAlgE:: eMLP_SimpleTree->GetEntries():" << endl;
2387  cout << eMLP_SimpleTree->GetEntries() <<endl;
2388  }
2389 
2390 
2391  if (gEDBDEBUGLEVEL>3) cout << "EdbShowAlgE:: eMLP_SimpleTree->Fill() do:" << endl;
2392 // gDebug=2;
2393  eMLP_SimpleTree->Fill();
2394 // gDebug=1;
2395  if (gEDBDEBUGLEVEL>3) cout << "EdbShowAlgE:: eMLP_SimpleTree->Fill() done." << endl;
2396 
2397  return;
2398 }
Int_t Npl() const
Definition: EdbShowerP.h:409

◆ FillMLP_SimpleTree_YC() [1/2]

void EdbShowAlgE::FillMLP_SimpleTree_YC ( )
585 {
586  cout << "EdbShowAlgE::FillMLP_SimpleTree_YC()" << endl;
587 
588 
589 
590  // Do this in case that eMLP_SimpleTree is filled by eRecoShowerArrayN
591  EdbShowerP* show=0;
592  for (int i=0; i<eRecoShowerArrayN; i++ ) {
593  //cout << "EdbShowAlgE::FILL i= " << i << endl;
594  show=(EdbShowerP*)eRecoShowerArray->At(i);
596  }
597  eMLP_SimpleTree->Print();
598  cout << "eMLP_SimpleTree>GetEntries():"<< eMLP_SimpleTree->GetEntries() << endl;
599 
600  eMLP_SimpleTree->Show(eMLP_SimpleTree->GetEntries()-1);
601  cout << "EdbShowAlgE::FillMLP_SimpleTree_YC()...done." << endl;
602  return;
603 }

◆ FillMLP_SimpleTree_YC() [2/2]

void EdbShowAlgE::FillMLP_SimpleTree_YC ( EdbShowerP show,
Int_t  ShowAlgEParaNr 
)
2270  {
2271 
2272  if (! show->GetParametrisationIsDone(ShowAlgEParaNr)) show->BuildParametrisation(ShowAlgEParaNr);
2273 
2274  // Get Suited Parametrization:
2275  EdbShowerP::Para_YC ePara_YC;
2276  ePara_YC=show->GetPara_YC();
2277 
2278 
2279  cout << "EdbShowerP::FillMLP_SimpleTree_YC() ePara_YC.nseg= " << ePara_YC.nseg << endl;
2280  cout << "EdbShowerP::FillMLP_SimpleTree_YC() ePara_YC.C1= " << ePara_YC.C1 << endl;
2281  cout << "EdbShowerP::FillMLP_SimpleTree_YC() ePara_YC.a1= " << ePara_YC.a1 << endl;
2282  cout << "EdbShowerP::FillMLP_SimpleTree_YC() ePara_YC.alpha= " << ePara_YC.alpha << endl;
2283  cout << "EdbShowerP::FillMLP_SimpleTree_YC() ePara_YC.nmax= " << ePara_YC.nmax << endl;
2284 
2285  // Get each Variables: InputType
2286  // Energy
2287  eInANN[0]=show->GetSegment(0)->P();
2288  // This can be different in later modifications (for example gamma Showers, where the Energy is not defined by single BT P(), but
2289  // by both starting BT close to each other (e+,e-)pair.
2290 
2291  // Variables: TestingType
2292  eInANN[1]=ePara_YC.nseg;
2293  eInANN[2]=ePara_YC.C1;
2294  eInANN[3]=ePara_YC.a1;
2295  eInANN[4]=ePara_YC.alpha;
2296  eInANN[5]=ePara_YC.nmax;
2297 
2298  // Fill also related eInfoANN variables:
2299  eInfoANN[0]=show->GetSegment(0)->P();
2300  eInfoANN[1]=show->Npl();
2301 
2302 
2303  if (gEDBDEBUGLEVEL>3) {
2304  for (int i=0; i<13; i++ ) cout << "EdbShowAlgE::_YC() eInANN["<<i<<"]= " << eInANN[i] << endl;
2305  cout << "EdbShowAlgE:: ...."<<endl;
2306  for (int i=70-13; i<70; i++ ) cout << "EdbShowAlgE::_YC() eInANN["<<i<<"]= " << eInANN[i] << endl;
2307 
2308  cout << "EdbShowAlgE::_YC() eInfoANN[0]= " << eInfoANN[0] << endl;
2309  cout << "EdbShowAlgE::_YC() eInfoANN[1]= " << eInfoANN[1] << endl;
2310  }
2311 
2312  // Fill InputHistograms now...
2313  for (Int_t j=0; j<70; j++) {
2314  eInANN_Hist[j]->Fill(eInANN[j]);
2315  }
2316 
2317 
2318  if (gEDBDEBUGLEVEL>3) {
2319  cout << "EdbShowAlgE:: eMLP_SimpleTree " << eMLP_SimpleTree << endl;
2320  cout << "EdbShowAlgE:: eMLP_SimpleTree->ClassName() " << eMLP_SimpleTree->ClassName() << endl;
2321  cout << "EdbShowAlgE:: eMLP_SimpleTree->GetEntries():" << endl;
2322  cout << eMLP_SimpleTree->GetEntries() <<endl;
2323  }
2324 
2325 
2326  if (gEDBDEBUGLEVEL>3) cout << "EdbShowAlgE:: eMLP_SimpleTree->Fill() do:" << endl;
2327 // gDebug=2;
2328  eMLP_SimpleTree->Fill();
2329 // gDebug=1;
2330  if (gEDBDEBUGLEVEL>3) cout << "EdbShowAlgE:: eMLP_SimpleTree->Fill() done." << endl;
2331 
2332  return;
2333 }
Para_YC GetPara_YC() const
Definition: EdbShowerP.h:557
Definition: EdbShowerP.h:169
Float_t C1
Definition: EdbShowerP.h:173
Float_t alpha
Definition: EdbShowerP.h:175
Int_t nseg
Definition: EdbShowerP.h:172
Float_t a1
Definition: EdbShowerP.h:174
Float_t nmax
Definition: EdbShowerP.h:176

◆ FillMLP_SimpleTree_YY() [1/2]

void EdbShowAlgE::FillMLP_SimpleTree_YY ( )
630 {
631  cout << "EdbShowAlgE::FillMLP_SimpleTree_YY()" << endl;
632 
633  // Do this in case that eMLP_SimpleTree is filled by eRecoShowerArrayN
634  EdbShowerP* show=0;
635  for (int i=0; i<eRecoShowerArrayN; i++ ) {
636  //cout << "EdbShowAlgE::FILL i= " << i << endl;
637  show=(EdbShowerP*)eRecoShowerArray->At(i);
639  }
640  eMLP_SimpleTree->Print();
641  cout << "eMLP_SimpleTree>GetEntries():"<< eMLP_SimpleTree->GetEntries() << endl;
642 
643  eMLP_SimpleTree->Show(eMLP_SimpleTree->GetEntries()-1);
644  cout << "EdbShowAlgE::FillMLP_SimpleTree_YY()...done." << endl;
645  return;
646 }

◆ FillMLP_SimpleTree_YY() [2/2]

void EdbShowAlgE::FillMLP_SimpleTree_YY ( EdbShowerP show,
Int_t  ShowAlgEParaNr 
)
2408 {
2409 
2410  cout << "DEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUGDEBUG"<<endl;
2411  if (! show->GetParametrisationIsDone(ShowAlgEParaNr)) {
2412  show->PrintNice();
2413  cout << "NO PARAMETRISATION DONE FOR show= " << show << "with " << show->N() << "Baestracks"<< endl;
2414  }
2415 
2416  if (! show->GetParametrisationIsDone(ShowAlgEParaNr)) show->BuildParametrisation(ShowAlgEParaNr);
2417 
2418  // Get Suited Parametrization:
2419  EdbShowerP::Para_YY ePara_YY;
2420  ePara_YY=show->GetPara_YY();
2421 
2422  // Get each Variables: InputType
2423  // Energy
2424  eInANN[0]=show->GetSegment(0)->P();
2425  // This can be different in later modifications (for example gamma Showers, where the Energy is not defined by single BT P(), but
2426  // by both starting BT close to each other (e+,e-)pair.
2427 
2428  // Variables: TestingType
2429  eInANN[1]=ePara_YY.nseg;
2430  for (Int_t j=0; j<5; j++) eInANN[2+j]=ePara_YY.ProfileTransversalBincontent[1+j]; // 0 is Underflow bin.
2431  for (Int_t j=0; j<57; j++) eInANN[7+j]=ePara_YY.ProfileLongitudinalBincontent[1+j]; // 0 is Underflow bin.
2432 
2433  // Fill also related eInfoANN variables:
2434  eInfoANN[0]=show->GetSegment(0)->P();
2435  eInfoANN[1]=show->Npl();
2436 
2437 
2438  if (gEDBDEBUGLEVEL>3) {
2439  for (int i=0; i<13; i++ ) cout << "EdbShowAlgE::_YY() eInANN["<<i<<"]= " << eInANN[i] << endl;
2440  cout << "EdbShowAlgE:: ...."<<endl;
2441  for (int i=70-13; i<70; i++ ) cout << "EdbShowAlgE::_YY() eInANN["<<i<<"]= " << eInANN[i] << endl;
2442 
2443  cout << "EdbShowAlgE::_YY() eInfoANN[0]= " << eInfoANN[0] << endl;
2444  cout << "EdbShowAlgE::_YY() eInfoANN[1]= " << eInfoANN[1] << endl;
2445  }
2446 
2447 
2448  if (gEDBDEBUGLEVEL>3) show->PrintBasics();
2449  if (gEDBDEBUGLEVEL>3) show->PrintNice();
2450  if (gEDBDEBUGLEVEL>3) ;
2451  show->PrintParametrisation_YY();
2452 
2453 
2454 
2455  // Fill InputHistograms now...
2456  for (Int_t j=0; j<70; j++) {
2457  eInANN_Hist[j]->Fill(eInANN[j]);
2458  }
2459 
2460 
2461  if (gEDBDEBUGLEVEL>3) {
2462  cout << "EdbShowAlgE:: eMLP_SimpleTree " << eMLP_SimpleTree << endl;
2463  cout << "EdbShowAlgE:: eMLP_SimpleTree->ClassName() " << eMLP_SimpleTree->ClassName() << endl;
2464  cout << "EdbShowAlgE:: eMLP_SimpleTree->GetEntries():" << endl;
2465  cout << eMLP_SimpleTree->GetEntries() <<endl;
2466  }
2467 
2468 
2469  if (gEDBDEBUGLEVEL>3) cout << "EdbShowAlgE:: eMLP_SimpleTree->Fill() do:" << endl;
2470 // gDebug=2;
2471  eMLP_SimpleTree->Fill();
2472 // gDebug=1;
2473  if (gEDBDEBUGLEVEL>3) cout << "EdbShowAlgE:: eMLP_SimpleTree->Fill() done." << endl;
2474 
2475  return;
2476 }
for(int i=0;i< nentries;i++)
Definition: check_shower.C:42
Int_t N() const
Definition: EdbShowerP.h:412
Para_YY GetPara_YY() const
Definition: EdbShowerP.h:566
void PrintParametrisation_YY()
Definition: EdbShowerP.cxx:2533
void PrintBasics()
Definition: EdbShowerP.cxx:2360
Definition: EdbShowerP.h:215
Int_t ProfileLongitudinalBincontent[57]
Definition: EdbShowerP.h:219
Int_t ProfileTransversalBincontent[8]
Definition: EdbShowerP.h:220
Int_t nseg
Definition: EdbShowerP.h:218

◆ Finalize()

void EdbShowAlgE::Finalize ( )
virtual
256 {
257  return;
258 }

◆ GetHistInANN()

TH1F* EdbShowAlgE::GetHistInANN ( Int_t  nr) const
inline
218  {
219  return eInANN_Hist[nr];
220  }

◆ GetHistoCanvas()

TCanvas * EdbShowAlgE::GetHistoCanvas ( )
1162 {
1163  TCanvas* canv= new TCanvas();
1164 
1166  Int_t n=TMath::Sqrt(eMLP_InputNeurons)+1;
1167  //cout << "n= " << n << endl;
1168  canv->Divide(n,n);
1169  for (Int_t j=1; j<=eMLP_InputNeurons+1; j++) {
1170  canv->cd(j);
1171  eInANN_Hist[j-1]->Draw();
1172  }
1173 
1174  return canv;
1175 
1176 }
Int_t eMLP_InputNeurons
Definition: EdbShowAlgE.h:113
new TCanvas()
TCanvas * canv
Definition: testBGReduction_By_ANN.C:43

◆ GetLastBinHistoFilles()

int EdbShowAlgE::GetLastBinHistoFilles ( TH1 *  h)
private
2491 {
2492  int nbin=h1->GetNbinsX(); //overflow=nbin
2493  for (int i=nbin-1; i>0; i--) if (h1->GetBinContent(i)>0) return i;
2494  return 0;
2495 }
TH1F * h1
Definition: energy.C:16

◆ GetMLP()

TMultiLayerPerceptron* EdbShowAlgE::GetMLP ( ) const
inline
214  {
215  return eMLP_Simple;
216  }

◆ GetMLPArrayNr()

Int_t EdbShowAlgE::GetMLPArrayNr ( Int_t  NPlToCheck)
398 {
399  cout <<"dbShowAlgE::GetMLPArray"<<endl;
400 
401  Int_t n=-1;
402  for (Int_t i=0; i<10; ++i) {
403  //cout << "i = eShowAlgEPlateBinning->At(i) = NPlToCheck " << i << " " << eShowAlgEPlateBinning->At(i) << " " << NPlToCheck << endl;
404  n=i;
405  if ( eShowAlgEPlateBinning->At(i) >= NPlToCheck) return n;
406  }
407 
408  // In standard case it retuns 0 for the first MLP
409  return 0;
410 }

◆ GetMLPInputFileName()

TString EdbShowAlgE::GetMLPInputFileName ( )
inline
228  {
229  return eMLP_InputFileName;
230  }
TString eMLP_InputFileName
Definition: EdbShowAlgE.h:117

◆ GetMLPLayout()

TString EdbShowAlgE::GetMLPLayout ( )
inline
222  {
223  return eMLP_Layout;
224  }

◆ GetMLPWeightFileName()

TString EdbShowAlgE::GetMLPWeightFileName ( )
inline
225  {
226  return eMLP_WeightFileName;
227  }

◆ Init() [1/2]

void EdbShowAlgE::Init ( void  )
private

eInANN = new Float_t[70]; eInfoANN = new Float_t[70];

164 {
165  cout << "EdbShowAlgE::Init()"<<endl;
166  // default ShowAlge name is set to "XX" (cause it is implemented now.)
167  // later its gonna be "FJ".. or the one parametrisation, which performs best.
168  eShowAlgEParaName="XX";
169  eShowAlgEParaNr=4;
170 
171  // Create the Arrays
174 
175 
176  // Init to set Paraname and ParaNr
178 
179  return;
180 }

◆ Init() [2/2]

void EdbShowAlgE::Init ( TString  ParaName)
private
185 {
186 
187  cout << "EdbShowAlgE::Init("<<ParaName<<")"<<endl;
188 
189  if (ParaName=="FJ") eShowAlgEParaNr=0;
190  if (ParaName=="LT") eShowAlgEParaNr=1;
191  if (ParaName=="YC") eShowAlgEParaNr=2;
192  if (ParaName=="JC") eShowAlgEParaNr=3;
193  if (ParaName=="XX") eShowAlgEParaNr=4;
194  if (ParaName=="YY") eShowAlgEParaNr=5;
195  if (ParaName=="PP") eShowAlgEParaNr=6;
196  if (ParaName=="AS") eShowAlgEParaNr=7;
197 
198  eShowAlgEParaName=ParaName;
199 
200  cout << "EdbShowAlgE::Init("<<eShowAlgEParaNr<<")"<<endl;
201 
202 
203  // Now be careful !!
204  // These functions have to be called in THE RIGHT ORDER to have the necessary variables correctly filled:
205 
206  // Read Parameter Values for settings to be taken into account:
207  ReadShowAlgEPar("default.par");
208 
209 
210  // If by "default.par" still no weightfiles and therefore no eMLPArrays are given,
211  // create them by the standard way:
212  if (eMLPArrayN==0) {
215  }
216  if (eMLP_InputFileName=="EMPTY") {
217  // jaja ich weiss, super stil...
218  // Set Input file name (default)
219  TString tmpString="MLPInput_"+TString(Form("%d_",eShowAlgEPlatesN))+ParaName+".root";
220  SetMLPInputFileName(tmpString);
221  }
222 
223  // Create (on heap) input histograms:
225  // Specific bins for Parametrization:
227 
228  // Make Layouts (default);
230 
231  // Make MLPs (default);
232  CreateMLPs();
233 
234  return;
235 }
void CreateInputHistos()
Definition: EdbShowAlgE.cxx:1145
int ReadShowAlgEPar(const char *file)
DEBUG ---------------------------— TEST DEVOPLEMENT.
Definition: EdbShowAlgE.cxx:802
void CreateMLPLayouts()
Definition: EdbShowAlgE.cxx:1599
void CreateMLPs()
Definition: EdbShowAlgE.cxx:2093
Int_t eShowAlgEPlatesN
Definition: EdbShowAlgE.h:49
void SetBinsInputHistos()
Definition: EdbShowAlgE.cxx:2185
void CreateStandardWeightFileStrings()
Definition: EdbShowAlgE.cxx:1402
void CreateStandardMLPArrayN()
Definition: EdbShowAlgE.cxx:1374
void SetMLPInputFileName(TString MLP_InputFileName)
Definition: EdbShowAlgE.h:181

◆ Initialize()

void EdbShowAlgE::Initialize ( )
virtual
243 {
244  return;
245 }

◆ LoadMLPWeights() [1/2]

void EdbShowAlgE::LoadMLPWeights ( )
2158 {
2159  // Since the layout if sixed by the parametrisation, this function
2160  // can be equall for all types of parametrisations:
2161 
2162  cout << "void EdbShowAlgE::LoadMLPWeights() " << endl;
2163  if (!eMLPArray) {
2164  cout << "void EdbShowAlgE::LoadMLPWeights() ERROR: eMLPArray IS EMPTY. RETURN!" << endl;
2165  return;
2166  }
2167  for (Int_t i=0; i<eMLPArrayN; ++i) LoadMLPWeights(i);
2168 
2169  return;
2170 }
void LoadMLPWeights()
Definition: EdbShowAlgE.cxx:2157

◆ LoadMLPWeights() [2/2]

void EdbShowAlgE::LoadMLPWeights ( Int_t  nr)
2175 {
2176  TMultiLayerPerceptron* mlp;
2177  mlp = (TMultiLayerPerceptron*)eMLPArray->At(nr);
2178  cout << "void EdbShowAlgE::LoadMLPWeights() Name ("<< nr <<"): "<< eMLP_WeightFileNameArray[nr] << endl;
2179  mlp->LoadWeights( eMLP_WeightFileNameArray[nr]);
2180  return;
2181 }
TMultiLayerPerceptron * mlp
Definition: testBGReduction_By_ANN.C:61

◆ Print()

void EdbShowAlgE::Print ( )
263 {
264  cout << "EdbShowAlgE::Print()" << endl;
265  cout << "EdbShowAlgE::Print()...done." << endl;
266  return;
267 }

◆ PrintWeightFileStrings()

void EdbShowAlgE::PrintWeightFileStrings ( )
1561 {
1562  if (!eShowAlgEPlateBinning) return;
1563  if (eMLPArrayN<1) return;
1564 
1565  cout << "void EdbShowAlgE::PrintWeightFileStrings() " << endl;
1566 
1567  // Create Standard weight file strings:
1568  // weights_energy_"i".txt, i=11,16,21,26,31,36,41,46
1569  for (Int_t i=0; i<eMLPArrayN; ++i) {
1570  cout << "void EdbShowAlgE::PrintWeightFileStrings() Name ("<<i<<"): "<< eMLP_WeightFileNameArray[i] << endl;
1571  }
1572 
1573  return;
1574 }

◆ ReadMLPInputFile()

void EdbShowAlgE::ReadMLPInputFile ( )
528 {
529  if (!eMLP_ReadMLPInputFile) return;
530  cout << eMLP_InputFileName << endl;
531  TFile* file= new TFile(eMLP_InputFileName,"READ");
532  eMLP_SimpleTree=(TTree*)file->Get("eMLP_SimpleTree");
533  eMLP_SimpleTree->Print();
534  cout <<"void EdbShowAlgE::ReadMLPInputFile()...done."<<endl;
535  return;
536 }
TFile * file
Definition: write_pvr.C:3

◆ ReadShowAlgEPar()

int EdbShowAlgE::ReadShowAlgEPar ( const char *  file = "default.par")

DEBUG ---------------------------— TEST DEVOPLEMENT.

TO IMPLEMENT TAHTS ITS REALLY WRITTEN !!!! sakjdhskjadhlaskjdhlasdlsakdhaslkd

TO IMPLEMENT TAHTS ITS REALLY WRITTEN !!!! sakjdhskjadhlaskjdhlasdlsakdhaslkd

803 {
804  // read parameters from par-file
805  // return: 0 if ok
806  // -1 if file access failed
807  char buf[256];
808  char key[256];
809  char name[256];
810 
811  FILE *fp = fopen(file,"r");
812  if (!fp) {
813  Log(1,"ReadShowAlgEPar","ERROR open file: %s", file);
814  return -1;
815  }
816  else Log(2,"ReadShowAlgEPar","Read shower parameters from file: %s", file );
817 
818  int dospec;
819  int narg;
820  TString tmpString;
821  char tmpchar[256];
822  TString tmpString2;
823  char tmpchar2[256];
824 
825  // Since ShowerParametrisation if Fixed by default in the Constructor,
826  // we can check here already if in a String the correct parametrisation is contained.
827 
828  while (fgets(buf, sizeof(buf), fp)) {
829  for (Int_t i = 0; i < (Int_t)strlen(buf); i++)
830  if (buf[i]=='#') {
831  buf[i]='\0'; // cut out comments starting from #
832  break;
833  }
834 
835  if ( sscanf(buf,"%s",key)!=1 ) continue;
836 
837  if ( !strcmp(key,"INCLUDE") )
838  {
839  sscanf(buf+strlen(key),"%s",name);
841  }
842 
843  else if ( !strcmp(key,"SHOW_ENERGY_TRAIN") )
844  {
845  narg=sscanf(buf+strlen(key),"%d",&dospec);
846  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_TRAIN = " << dospec << " narg= " << narg << endl;
847  if (dospec==0 || dospec==1) SetDoTrain(dospec);
848  }
849  else if ( !strcmp(key,"SHOW_ENERGY_RUN") )
850  {
851  sscanf(buf+strlen(key),"%d",&dospec);
852  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_RUN = " << dospec << endl;
853  if (dospec==0 || dospec==1) SetDoRun(dospec);
854  }
855 
856  else if ( !strcmp(key,"SHOW_ENERGY_PLATES") )
857  {
858  sscanf(buf+strlen(key),"%d",&dospec);
859  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_PLATES = " << dospec << endl;
860  SetPlatesN(dospec);
861  }
862 
863 
864 
865 
866 
867  else if ( !strcmp(key,"SHOW_ENERGY_FILE_WEIGHTFILE") )
868  {
869  sscanf(buf+strlen(key),"%s %s",tmpchar2, tmpchar);
870  tmpString=TString(tmpchar);
871  tmpString2=TString(tmpchar2);
872  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_FILE_WEIGHTFILE = " << tmpString << endl;
873  if (!CheckStringToShowAlgEParaName(tmpString2)) continue;
874 // if (!CheckStringToShowAlgEParaName(tmpString2)) break;
875 
876  SetMLPWeightFileName(tmpString);
877  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_FILE_WEIGHTFILE = " << eMLP_WeightFileName << endl;
878  }
879 
880 
881  else if ( !strcmp(key,"SHOW_ENERGY_WRITE_WEIGHTFILE") )
882  {
883  sscanf(buf+strlen(key),"%s %d",tmpchar2, &dospec);
884  tmpString2=TString(tmpchar2);
885  if (!CheckStringToShowAlgEParaName(tmpString2)) continue;
886  SetWriteMLPWeightFile(dospec);
887  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_WRITE_WEIGHTFILE = " << dospec << endl;
888  }
889 
890 
893 
894 
895 
896 
897  else if ( !strcmp(key,"SHOW_ENERGY_FILE_MLPINPUTFILE") )
898  {
899  sscanf(buf+strlen(key),"%s %s",tmpchar2, tmpchar);
900  tmpString=TString(tmpchar);
901  tmpString2=TString(tmpchar2);
902  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_FILE_MLPINPUTFILE = " << tmpString << endl;
903  cout << CheckStringToShowAlgEParaName(tmpString2) << endl;
904  if (!CheckStringToShowAlgEParaName(tmpString2)) continue;
905 // if (!CheckStringToShowAlgEParaName(tmpString2)) break;
906  SetMLPInputFileName(tmpString);
907  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_FILE_MLPINPUTFILE = " << eMLP_InputFileName << endl;
908  }
909 
910 
911  else if ( !strcmp(key,"SHOW_ENERGY_WRITE_MLPINPUTFILE") )
912  {
913  sscanf(buf+strlen(key),"%s %d",tmpchar2, &dospec);
914  tmpString2=TString(tmpchar2);
915  if (!CheckStringToShowAlgEParaName(tmpString2)) continue;
916  SetWriteMLPInputFile(dospec);
917  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_WRITE_MLPINPUTFILE = " << dospec << endl;
918  }
919 
920 
921  else if ( !strcmp(key,"SHOW_ENERGY_READ_MLPINPUTFILE") )
922  {
923  sscanf(buf+strlen(key),"%s %d",tmpchar2, &dospec);
924  tmpString2=TString(tmpchar2);
925  if (!CheckStringToShowAlgEParaName(tmpString2)) continue;
926  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_READ_MLPINPUTFILE = " << dospec << endl;
927  SetReadMLPInputFile(dospec);
928  }
929 
930 
933 
934 
935 
936 
937 
938 
939  else if ( !strcmp(key,"SHOW_ENERGY_TRAINEPOCHS") )
940  {
941  sscanf(buf+strlen(key),"%d",&dospec);
942  SetMLPTrainEpochs(dospec);
943  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_TRAINEPOCHS = " << dospec << endl;
944  }
945 
946 
947 
948  else if ( !strcmp(key,"SHOW_ENERGY_ADD_WEIGHTFILE_PLATE") )
949  {
950  sscanf(buf+strlen(key),"%s %d",tmpchar, &dospec);
951  tmpString=TString(tmpchar);
952  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_ADD_WEIGHTFILE_PLATE = " << tmpString << " " << dospec << endl;
953  AddWeightFilePlate(tmpString,dospec);
954  }
955 
956  else if ( !strcmp(key,"SHOW_ENERGY_READ_WEIGHTFILE_PLATES") )
957  {
958  int nspec;
959  int spec[10];
960  nspec=sscanf(buf+strlen(key),"%s %d %d %d %d %d %d %d %d %d %d " ,tmpchar, &spec[0], &spec[1], &spec[2], &spec[3], &spec[4], &spec[5], &spec[6], &spec[7], &spec[8], &spec[9]);
961  cout << "nspec= " << nspec << endl;
962  tmpString=TString(tmpchar);
963  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_ADD_WEIGHTFILE_PLATES = " << tmpString;
964  for (int i=0; i<nspec-1; i++ ) {
965  cout <<" " << spec[i];
966  }
967  for (int i=0; i<nspec-1; i++ ) AddWeightFilePlate(tmpString,spec[i]);
968  }
969 
970  else if ( !strcmp(key,"SHOW_ENERGY_ADD_WEIGHTFILE") )
971  {
972  sscanf(buf+strlen(key),"%s %d %s",tmpchar, &dospec, tmpchar2);
973  tmpString=TString(tmpchar);
974  tmpString2=TString(tmpchar2);
975  cout << "EdbShowRec::ReadShowAlgEPar SHOW_ENERGY_ADD_WEIGHTFILE_PLATE = " << tmpString << " " << dospec << " " << tmpString2 <<endl;
976  AddWeightFile(tmpString,dospec,tmpString2);
977  }
978 
979 
980 
981  }
982  fclose(fp);
983 
984 
986  cout <<"===============" << GetMLPInputFileName() << endl;
987 
988  Log(2,"ReadShowAlgEPar","Read shower parameters...done.");
989  return 0;
990 }
Int_t SetMLPTrainEpochs()
Definition: EdbShowAlgE.h:231
void SetWriteMLPWeightFile(Int_t type)
Definition: EdbShowAlgE.cxx:1015
void PrintWeightFileStrings()
Definition: EdbShowAlgE.cxx:1560
void SetDoTrain(Int_t type)
Definition: EdbShowAlgE.cxx:995
void SetWriteMLPInputFile(Int_t type)
Definition: EdbShowAlgE.cxx:1026
void AddWeightFile(TString tmpString, Int_t Plate, TString tmpString2)
Definition: EdbShowAlgE.cxx:1498
void SetDoRun(Int_t type)
Definition: EdbShowAlgE.cxx:1004
void SetReadMLPInputFile(Int_t type)
Definition: EdbShowAlgE.cxx:1036
void SetPlatesN(Int_t ShowAlgEPlatesN)
Definition: EdbShowAlgE.h:191
Bool_t CheckStringToShowAlgEParaName(TString tmpString2)
Definition: EdbShowAlgE.cxx:2480
void AddWeightFilePlate(TString tmpString, Int_t dospec)
Definition: EdbShowAlgE.cxx:1437
fclose(pFile)
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24

◆ ResetPlateBinning()

void EdbShowAlgE::ResetPlateBinning ( )
1317 {
1318  Log(2,"EdbShowAlgE::ResetPlateBinning","EdbShowAlgE::ResetPlateBinning.");
1319 
1320 
1321  // Restore Standard Plate Binning:
1322  // (11,16,21..51,56)
1323  if (!eShowAlgEPlateBinning) eShowAlgEPlateBinning = new TArrayI(10);
1324 
1325  cout << "void EdbShowAlgE::ResetPlateBinning(): Steps for:";
1326  for (Int_t i=0; i<10; ++i) {
1327  eShowAlgEPlateBinning->AddAt(11+5*i,i);
1328  cout << eShowAlgEPlateBinning->At(i);
1329  }
1330  cout << " plates availible."<<endl;
1331  Log(2,"EdbShowAlgE::ResetPlateBinning","EdbShowAlgE::ResetPlateBinning...done.");
1332  return;
1333 }

◆ ResetWeightFileNameArray()

void EdbShowAlgE::ResetWeightFileNameArray ( )
private
1364 {
1365  for (Int_t i=0; i<10; ++i) eMLP_WeightFileNameArray[i]="";
1366  return;
1367 }

◆ Run()

void EdbShowAlgE::Run ( )

Load Weights : Absolutely neccessary! MISSING: A CHECK IF THE WEIGHTFILE IS IN THE CURRENT DIRECTORY AND THERE AT ALL !!! (otherwise link from source dir)

Weights have to be already loaded ??????

286 {
287  cout << "void EdbShowAlgE::Run() "<< endl;
288 
289  if (!eMLP_SimpleTree) {
290  cout << "void EdbShowAlgE::Run() NO eMLP_SimpleTree Read eMLP_SimpleTree from file:";
291  cout << "void EdbShowAlgE::Run() "<< eMLP_InputFileName << endl;
293  }
294 
295  if (!eMLP_SimpleTree) {
296  cout << "void EdbShowAlgE::Run() NO eMLP_SimpleTree Some Error has occured! RETURN."<< endl;
297  return;
298  }
299 
300  // Set Branch Addresses for the tree:
301  eMLP_SimpleTree->SetBranchAddress("eInANN",eInANN);
302  eMLP_SimpleTree->SetBranchAddress("eInfoANN",eInfoANN);
303 
304 
305  PrintWeightFileStrings(); // DEBUG()
306 
307 
308 
309  //------------------------------
313  LoadMLPWeights();
314  //------------------------------
315 
316 
317  // Set TTree as source for the MLP:
318  // Absolutely neccessary otherwise its empty.
319  for (Int_t i=0; i<10; ++i) {
320  TEventList* list;
321  list= (TEventList*)eMLP_SimpleTree->GetEventList();
322  eMLP_Simple= (TMultiLayerPerceptron*)eMLPArray->At(i);
323  cout << eMLP_Simple->GetStructure() << endl;
324  cout << eMLP_SimpleTree->GetEntries() << endl;
325  eMLP_Simple->Print();
326  eMLP_Simple->SetData(eMLP_SimpleTree);
327  eMLP_Simple->SetTrainingDataSet(list);
328  eMLP_Simple->SetTestDataSet(list);
329  eMLP_Simple->SetTrainingDataSet("Entry$%2");
330  eMLP_Simple->SetTestDataSet("(Entry$+1)%2");
331  }
332 
333 
334  Int_t nMLPArray=-1;
335  Double_t params[70]; // MLP works only with Double_t
336  Float_t val;
337 
338 
339  TH1F* h1= new TH1F("h1","h1",100,0,10);
340  // Loop over entries:
341 // for (Int_t i=1; i<eMLP_SimpleTree->GetEntries(); ++i) {
342  for (Int_t i=0; i<3; ++i) {
343  eMLP_SimpleTree->GetEntry(i);
344 
345  eMLP_SimpleTree->Show(i);
346  cout << "i= " << i << " " << eInfoANN[0] << " " << eInfoANN[1] << endl;
347  cout << "i= " << i << " " << eInANN[0] << " " << eInANN[1] << endl;
348 
349  // Get Right ANN (depending on reconstructed plates).
351  nMLPArray=GetMLPArrayNr(eInfoANN[1]);
352 
353  cout << nMLPArray << endl;
354 
355  eMLP_Simple= (TMultiLayerPerceptron*)eMLPArray->At(nMLPArray);
356  cout << eMLP_Simple->GetStructure() << endl;
357 
358 
359 
360 
361 
362 
363 
364  for (Int_t j=1; j<=70; ++j) {
365 // cout << "DEBUG eInANN[j] " << eInANN[j] << endl;
366  params[j-1]=eInANN[j];
367  }
368  val=(eMLP_Simple->Evaluate(0,params));
369 
370 
371  h1->Fill(val);
372 
373  cout << "DEBUG " << eInANN[1] << " " << eInANN[2] << " " << eInANN[3] << " " << eInANN[4] << " " << eInANN[5] << " " << eInANN[6] << " " << eInANN[7] << " " << endl;
374  cout << "DEBUG: i, val (=mlp1->Evaluate(0,params)) == real energy " << i << " " << val << " == " << eInANN[0] << endl;
375 
376 
377  }
378 
379 
380 
381  h1->Draw();
382 
383 
384 // eMLP_Simple= (TMultiLayerPerceptron*)eMLPArray->At(0);
385 
386 // cout << eMLP_Simple->GetStructure() << endl;
387 // cout << eMLP_SimpleTree->GetEntries() << endl;
388 
389 
390  return;
391 }
int GetMLPArrayNr(Int_t NPlToCheck)
Definition: EdbShowAlgE.cxx:397
Double_t params[3]
Definition: testBGReduction_By_ANN.C:84

◆ Set0()

void EdbShowAlgE::Set0 ( )
private
101 {
102  // Set0()
105 
106  eDoANNTrain=kFALSE;
107  eDoANNRun=kFALSE;
108 
109  cout << " Test if Neural Network is loaded: " << endl;
110  if (!gROOT->GetClass("TMultiLayerPerceptron")) cout << "NOT"<<endl;
111  if (gROOT->GetClass("TMultiLayerPerceptron")) cout << "YES"<<endl;
112  cout << " So now we know if the TMultiLayerPerceptron class is loaded... " << endl;
113 
114  eMLP_Simple=0;
115  eMLP_Layout="";
117  eMLP_LayoutArrayIsDone=kFALSE;
119  eMLP_SimpleTree=0;
120  eMLP_TrainEpochs=100;
121 
122 
123  // Reset All eInANN Values to Zero:
124 
125  for (Int_t j=0; j<70; j++) {
126  eInANN[j]=0;
127  eInfoANN[j]=0;
128  eInANN_Hist[j]=0;
129  }
130  eOutANN=0;
131 
132  // WHEN COMPILING THE LIBRARY, AN ERROR APPEARS HERE:
133 // Error: *** Datamember EdbShowAlgE::eInANN: no size indication!
134 // Error: *** Datamember EdbShowAlgE::eInANN: pointer to fundamental type (need manual intervention)
135 // Error: *** Datamember EdbShowAlgE::eInfoANN: no size indication!
136 // Error: *** Datamember EdbShowAlgE::eInfoANN: pointer to fundamental type (need manual intervention)
137 
138 
139 
143 
144  eMLP_ReadMLPInputFile=kFALSE;
145  eMLP_WriteMLPInputFile=kFALSE;
146  eMLP_InputFileName="EMPTY";
147 
148  eMLP_WriteWeightFile=kFALSE;
149  eMLP_WeightFileName="EMPTY";
150 
151  eMLPArrayN=0;
152  eMLPArray=0;
153 
155 
157 
158  return;
159 }
Int_t eMLP_TrainEpochs
Definition: EdbShowAlgE.h:111
Float_t eOutANN
Definition: EdbShowAlgE.h:87
Bool_t eDoANNRun
Definition: EdbShowAlgE.h:68
Bool_t eMLP_WriteMLPInputFile
Definition: EdbShowAlgE.h:118
Bool_t eDoANNTrain
Definition: EdbShowAlgE.h:67

◆ SetBinsInputHistos()

void EdbShowAlgE::SetBinsInputHistos ( )
2185  {
2186 
2187  switch (eShowAlgEParaNr) {
2188  case 0 :
2190  break;
2191  case 1 : //CreateInputNeuronsArray_LT();
2192  break;
2193  case 2 :
2195  break;
2196  case 3 : //CreateInputNeuronsArray_JC();
2197  break;
2198  case 4 :
2200  break;
2201  case 5 :
2203  break;
2204  default :
2206  break;
2207  }
2208  return;
2209 }
void SetBinsInputHistos_FJ()
Definition: EdbShowAlgE.cxx:2216
void SetBinsInputHistos_YY()
Definition: EdbShowAlgE.cxx:2254
void SetBinsInputHistos_XX()
Definition: EdbShowAlgE.cxx:2239

◆ SetBinsInputHistos_FJ()

void EdbShowAlgE::SetBinsInputHistos_FJ ( )
2216  {
2217  // Specific bins for FJ Parametrization:
2218  return;
2219 }

◆ SetBinsInputHistos_XX()

void EdbShowAlgE::SetBinsInputHistos_XX ( )
2239  {
2240  // Specific bins for XX Parametrization:
2241  SetInputHistos(eInANN_Hist[0],100,0,20000);
2242  SetInputHistos(eInANN_Hist[1],200,0,1000);
2243  SetInputHistos(eInANN_Hist[2],100,0,70000);
2244  SetInputHistos(eInANN_Hist[3],100,0,30000);
2245  SetInputHistos(eInANN_Hist[4],30,0,30);
2246  SetInputHistos(eInANN_Hist[5],100,0,5000);
2247  SetInputHistos(eInANN_Hist[6],100,0,5000);
2248  SetInputHistos(eInANN_Hist[7],30,0,30);
2249  return;
2250 }
void SetInputHistos(TH1F *h, Int_t nbin, Double_t lower, Double_t upper)
Definition: EdbShowAlgE.cxx:1180

◆ SetBinsInputHistos_YC()

void EdbShowAlgE::SetBinsInputHistos_YC ( )
2225  {
2226  // Specific bins for YC Parametrization:
2227  SetInputHistos(eInANN_Hist[0],100,0,20000);
2228  SetInputHistos(eInANN_Hist[1],200,0,1000);
2229  SetInputHistos(eInANN_Hist[2],100,0,100);
2230  SetInputHistos(eInANN_Hist[3],100,0,100);
2231  SetInputHistos(eInANN_Hist[4],100,0,100);
2232  SetInputHistos(eInANN_Hist[5],100,0,100);
2233  return;
2234 }

◆ SetBinsInputHistos_YY()

void EdbShowAlgE::SetBinsInputHistos_YY ( )
2254  {
2255  // Specific bins for YY Parametrization:
2256  SetInputHistos(eInANN_Hist[0],100,0,20000);
2257  SetInputHistos(eInANN_Hist[1],200,0,1000);
2258  SetInputHistos(eInANN_Hist[2],100,0,100);
2259  SetInputHistos(eInANN_Hist[3],100,0,100);
2260  SetInputHistos(eInANN_Hist[4],100,0,100);
2261  SetInputHistos(eInANN_Hist[5],100,0,100);
2262  SetInputHistos(eInANN_Hist[6],100,0,100);
2263  for (int i=0; i<56; i++) SetInputHistos(eInANN_Hist[6+i],100,0,100);
2264  return;
2265 }

◆ SetDoRun()

void EdbShowAlgE::SetDoRun ( Int_t  type)
1005 {
1006  if (type==1) eDoANNRun=kTRUE;
1007  else eDoANNRun=kFALSE;
1008  return;
1009 }
Int_t type
Definition: testBGReduction_By_ANN.C:15

◆ SetDoTrain()

void EdbShowAlgE::SetDoTrain ( Int_t  type)
996 {
997  if (type==1) eDoANNTrain=kTRUE;
998  else eDoANNTrain=kFALSE;
999  return;
1000 }

◆ SetInputHistos()

void EdbShowAlgE::SetInputHistos ( TH1F *  h,
Int_t  nbin,
Double_t  lower,
Double_t  upper 
)
1181 {
1182  h->SetBins(nbin,lower,upper);
1183  return;
1184 }

◆ SetInputHistosPara()

void EdbShowAlgE::SetInputHistosPara ( Int_t  ParaType)

TO IMPLEMENT ALSO THE OTHERS....

1191 {
1192  if (ParaType==0) SetInputHistosPara_FJ();
1193 
1194  if (ParaType==2) SetInputHistosPara_YC();
1195  if (ParaType==4) SetInputHistosPara_XX();
1196  if (ParaType==5) SetInputHistosPara_YY();
1197 
1198 
1200 
1201  return;
1202 }
void SetInputHistosPara_YC()
Definition: EdbShowAlgE.cxx:1205
void SetInputHistosPara_YY()
Definition: EdbShowAlgE.cxx:1247
void SetInputHistosPara_FJ()
Definition: EdbShowAlgE.cxx:1214

◆ SetInputHistosPara_FJ()

void EdbShowAlgE::SetInputHistosPara_FJ ( )
1215 {
1216 
1217  return;
1218 }

◆ SetInputHistosPara_XX()

void EdbShowAlgE::SetInputHistosPara_XX ( )
1224 {
1225 
1226  // ---------
1227  // Specific bins for XX Parametrization:
1228  SetInputHistos(eInANN_Hist[0],100,0,20000);
1229 
1230  SetInputHistos(eInANN_Hist[1],200,0,1000);
1231 
1232  SetInputHistos(eInANN_Hist[2],100,0,70000);
1233  SetInputHistos(eInANN_Hist[3],100,0,30000);
1234  SetInputHistos(eInANN_Hist[4],30,0,30);
1235 
1236  SetInputHistos(eInANN_Hist[5],100,0,5000);
1237  SetInputHistos(eInANN_Hist[6],100,0,5000);
1238  SetInputHistos(eInANN_Hist[7],100,0,100);
1239  // ---------
1240 
1241 
1242  return;
1243 }

◆ SetInputHistosPara_YC()

void EdbShowAlgE::SetInputHistosPara_YC ( )
1206 {
1207  // ---------
1208 
1209  return;
1210 }

◆ SetInputHistosPara_YY()

void EdbShowAlgE::SetInputHistosPara_YY ( )
1248 {
1249  // ---------
1250  // Specific bins for XX Parametrization:
1251  SetInputHistos(eInANN_Hist[0],100,0,20000);
1252 
1253  SetInputHistos(eInANN_Hist[1],200,0,1000);
1254 
1255  SetInputHistos(eInANN_Hist[2],100,0,100);
1256  SetInputHistos(eInANN_Hist[3],100,0,100);
1257  SetInputHistos(eInANN_Hist[4],100,0,100);
1258  SetInputHistos(eInANN_Hist[5],100,0,100);
1259  SetInputHistos(eInANN_Hist[6],100,0,100);
1260  for (int i=0; i<56; i++) SetInputHistos(eInANN_Hist[6+i],100,0,100);
1261  // ---------
1262  return;
1263 }

◆ SetMLPArrayN()

void EdbShowAlgE::SetMLPArrayN ( Int_t  MLPArrayN)
inline
187  {
188  eMLPArrayN = MLPArrayN;
189  }

◆ SetMLPInputFileName()

void EdbShowAlgE::SetMLPInputFileName ( TString  MLP_InputFileName)
inline
181  {
182  eMLP_InputFileName = MLP_InputFileName;
183  }

◆ SetMLPLayout()

void EdbShowAlgE::SetMLPLayout ( TString  layout)
inline
175  {
176  eMLP_Layout = layout;
177  }

◆ SetMLPTrainEpochs() [1/2]

Int_t EdbShowAlgE::SetMLPTrainEpochs ( )
inline
231  {
232  return eMLP_TrainEpochs;
233  }

◆ SetMLPTrainEpochs() [2/2]

void EdbShowAlgE::SetMLPTrainEpochs ( Int_t  nep)
inline
184  {
185  eMLP_TrainEpochs = nep;
186  }

◆ SetMLPWeightFileName()

void EdbShowAlgE::SetMLPWeightFileName ( TString  weightfilename)
inline
178  {
179  eMLP_WeightFileName = weightfilename;
180  }

◆ SetPlatesN()

void EdbShowAlgE::SetPlatesN ( Int_t  ShowAlgEPlatesN)
inline
191  {
192  eShowAlgEPlatesN = ShowAlgEPlatesN;
193  }

◆ SetReadMLPInputFile()

void EdbShowAlgE::SetReadMLPInputFile ( Int_t  type)
1037 {
1038  if (type==1) eMLP_ReadMLPInputFile=kTRUE;
1039  else eMLP_ReadMLPInputFile=kFALSE;
1040  return;
1041 }

◆ SetRecoShowerArray()

void EdbShowAlgE::SetRecoShowerArray ( TObjArray *  RecoShowerArray)
inline
171  {
173  }

◆ SetWriteMLPInputFile()

void EdbShowAlgE::SetWriteMLPInputFile ( Int_t  type)
1027 {
1028  if (type==1) eMLP_WriteMLPInputFile=kTRUE;
1029  else eMLP_WriteMLPInputFile=kFALSE;
1030  return;
1031 }

◆ SetWriteMLPWeightFile()

void EdbShowAlgE::SetWriteMLPWeightFile ( Int_t  type)
1016 {
1017  if (type==1) eMLP_WriteWeightFile=kTRUE;
1018  else eMLP_WriteWeightFile=kFALSE;
1019  return;
1020 }

◆ TESTRUN()

void EdbShowAlgE::TESTRUN ( )

DEBUG DEBUG DEBUG

DEBUG DEBUG DEBUG

421 {
422 
423  // Fill Tree with existing entries of para of eRecoShowerArray :
424  Fill_MLPTree();
425 
426 
427 
429 
430 
431 
432 
433 
434  TString layout;
435  int NrOfANNInputNeurons=7;
436  layout=CreateMLPLayout(NrOfANNInputNeurons);
437 
438 
439 
440 
441  SetMLPLayout(layout);
442 
443 
444  cout <<"__________"<<endl;
445  cout << layout << endl;
446  cout <<"__________"<<endl;
447 
448  Double_t params[70]; // MLP works only with Double_t
449  Float_t val;
450 
451 
452 
454 
455  cout << " eMLP_Simple = " << eMLP_Simple << endl;
456 
457  eMLP_Simple =0;
458 
459  cout << " eMLP_Simple = " << eMLP_Simple << endl;
460 
461 // TMultiLayerPerceptron*
462  eMLP_Simple = new TMultiLayerPerceptron(layout,eMLP_SimpleTree,"Entry$%2","(Entry$+1)%2");
463 
464 
465 
466  cout << " eMLP_Simple = " << eMLP_Simple << endl;
467 
468 
470 
471 
472  eMLP_Simple->LoadWeights("weights.txt");
473 
474  eMLP_Simple->Print();
475 
476 
477  TH1F* h1 = new TH1F("hh","hh",100,0,10);
478 
479 
480  for (Int_t i=1; i<eMLP_SimpleTree->GetEntries(); ++i) {
481  eMLP_SimpleTree->GetEntry(i);
482 
483  for (Int_t j=1; j<=NrOfANNInputNeurons; ++j) {
484  params[j-1]=eInANN[j];
485  }
486  val=(eMLP_Simple->Evaluate(0,params));
487 
488 
489  h1->Fill(val);
490 
491  cout << "DEBUG " << eInANN[1] << " " << eInANN[2] << " " << eInANN[3] << " " << eInANN[4] << " " << eInANN[5] << " " << eInANN[6] << " " << eInANN[7] << " " << endl;
492  cout << "DEBUG: i, val (=mlp1->Evaluate(0,params)) == real energy " << i << " " << val << " == " << eInANN[0] << endl;
493  }
494 
495 
496  TCanvas* cc= new TCanvas();
497  h1->Draw();
498 
499  return;
500 }
void Fill_MLPTree()
Definition: EdbShowAlgE.cxx:1072
void SetMLPLayout(TString layout)
Definition: EdbShowAlgE.h:175
TString CreateMLPLayout(Int_t NrOfANNInputNeurons)
Definition: EdbShowAlgE.cxx:1299
void FillInputHistosPara_XX()
Definition: EdbShowAlgE.cxx:1269

◆ Train()

void EdbShowAlgE::Train ( )
691 {
692  cout << "void EdbShowAlgE::Train() "<< endl;
693  cout << "void EdbShowAlgE::Train() We have to set the tree data from the ANN since at "<< endl;
694  cout << "void EdbShowAlgE::Train() creation time the eMLP_SimpleTree was empty."<< endl;
695 
696  if (!eMLP_SimpleTree) {
697  cout << "void EdbShowAlgE::Train() NO eMLP_SimpleTree Read eMLP_SimpleTree from file:"<< endl;
699  }
700  if (!eMLP_SimpleTree) {
701  cout << "void EdbShowAlgE::Train() NO eMLP_SimpleTree Some ERROR has occured! RETURN."<< endl;
702  return;
703  }
704 
705 
706  // In order not to tell which plates we have to train the ANN, we grep out the information
707  // out of eINfoAnn[1], which contains plates. The maximumBin is used for the layout structure:
708  eMLP_SimpleTree->Draw("eInfoANN[1]>>h1");
709  TH1F *h1 = (TH1F*)gDirectory->Get("h1");
710  h1->Draw();
711 
712  int MaxBinCenter = h1->GetBinCenter(h1->GetMaximumBin()) ;
713  int MaxBinEntryCenter=h1->GetBinCenter(GetLastBinHistoFilles(h1));
714  int MLPArrayNr = GetMLPArrayNr(MaxBinEntryCenter);
715 
716 
717 
718  cout << " MaxBinCenter = " << MaxBinCenter << endl;
719  cout << " MLPArrayNr = " << MLPArrayNr << endl;
720  cout << " MaxBinEntryCenter = " << MaxBinEntryCenter << endl;
721 
722 
723 
724  // check MaxBinCenter for Bounds
725  if (MaxBinEntryCenter>57 || MaxBinEntryCenter<1) {
726  cout << "void EdbShowAlgE::Train() Something is wrong with MaxBinEntryCenter. Check your data (especially eInfoANN[1]) RETURN! "<<endl;
727  return;
728  }
729  cout << "void EdbShowAlgE::Train() MLPArrayNr= " << MLPArrayNr << " So use this eMLPArray for Training."<<endl;
730 
731 
732  TEventList* list;
733  list= (TEventList*)eMLP_SimpleTree->GetEventList();
734  eMLP_Simple= (TMultiLayerPerceptron*)eMLPArray->At(MLPArrayNr);
735 
736  cout << eMLP_Simple->GetStructure() << endl;
737  cout << eMLP_SimpleTree->GetEntries() << endl;
738 
739 // eMLP_SimpleTree->Show(0);
740 // eMLP_SimpleTree->Show(eMLP_SimpleTree->GetEntries()-1);
741 // cout << eMLP_TrainEpochs << endl;
742 
743  eMLP_Simple->Print();
744 
745  eMLP_Simple->SetData(eMLP_SimpleTree);
746  eMLP_Simple->SetTrainingDataSet(list);
747  eMLP_Simple->SetTestDataSet(list);
748  eMLP_Simple->SetTrainingDataSet("Entry$%2");
749  eMLP_Simple->SetTestDataSet("(Entry$+1)%2");
750  eMLP_Simple->Train(eMLP_TrainEpochs, "text,graph,update=10");
751 
752 
753 
754  TCanvas* mlpa_canvas = new TCanvas("mlpa_canvas","Network analysis");
755  mlpa_canvas->Divide(1,2);
756  TMLPAnalyzer ana(eMLP_Simple);
757  ana.GatherInformations();
758  ana.CheckNetwork();
759  mlpa_canvas->cd(1);
760  ana.DrawDInputs();
761  mlpa_canvas->cd(2);
762  eMLP_Simple->Draw();
763 
764  cout << "void EdbShowAlgE::Train() ...done."<< endl;
765  return;
766 }
int GetLastBinHistoFilles(TH1 *h)
Definition: EdbShowAlgE.cxx:2490
TCanvas * mlpa_canvas
Definition: testBGReduction_By_ANN.C:66
TMLPAnalyzer ana(mlp)

◆ WriteMLP_SimpleTree()

void EdbShowAlgE::WriteMLP_SimpleTree ( TString  filename)
653 {
654  if (!eMLP_WriteMLPInputFile) return;
655 // TFile* file= new TFile(filename,"RECREATE");
656  TFile* file= new TFile(eMLP_InputFileName,"RECREATE");
657  eMLP_SimpleTree->Write();
658  file->Close();
659  delete file;
660  return;
661 }

◆ WriteMLPInputFile()

void EdbShowAlgE::WriteMLPInputFile ( )
507 {
508  cout <<"void EdbShowAlgE::WriteMLPInputFile() " << eMLP_InputFileName << endl;
509 
510  if (!eMLP_WriteMLPInputFile) {
511  cout <<"void EdbShowAlgE::WriteMLPInputFile() WARNING::eMLP_WriteMLPInputFile= " << eMLP_WriteMLPInputFile << " RETURN." << endl;
512  return;
513  }
514 
515  TFile* file= new TFile(eMLP_InputFileName,"RECREATE");
516  eMLP_SimpleTree->Write();
517  eMLP_SimpleTree->Print();
518  file->Close();
519  delete file;
520  cout <<"void EdbShowAlgE::WriteMLPInputFile()...done."<<endl;
521  return;
522 }

Member Data Documentation

◆ eDoANNRun

Bool_t EdbShowAlgE::eDoANNRun
private

◆ eDoANNTrain

Bool_t EdbShowAlgE::eDoANNTrain
private

◆ eInANN

Float_t* EdbShowAlgE::eInANN = new Float_t[70]
private

◆ eInANN_Hist

TH1F* EdbShowAlgE::eInANN_Hist[70]
private

◆ eInfoANN

Float_t* EdbShowAlgE::eInfoANN = new Float_t[70]
private

◆ eMLP_InputFileName

TString EdbShowAlgE::eMLP_InputFileName
private

◆ eMLP_InputNeurons

Int_t EdbShowAlgE::eMLP_InputNeurons
private

◆ eMLP_InputNeuronsArray

TArrayI* EdbShowAlgE::eMLP_InputNeuronsArray
private

◆ eMLP_InputNeuronsArrayN

Int_t EdbShowAlgE::eMLP_InputNeuronsArrayN
private

◆ eMLP_Layout

TString EdbShowAlgE::eMLP_Layout
private

◆ eMLP_LayoutArray

TObjArray* EdbShowAlgE::eMLP_LayoutArray
private

◆ eMLP_LayoutArrayIsDone

Bool_t EdbShowAlgE::eMLP_LayoutArrayIsDone
private

◆ eMLP_ReadMLPInputFile

Bool_t EdbShowAlgE::eMLP_ReadMLPInputFile
private

◆ eMLP_Simple

TMultiLayerPerceptron* EdbShowAlgE::eMLP_Simple
private

◆ eMLP_SimpleIsDone

Bool_t EdbShowAlgE::eMLP_SimpleIsDone
private

◆ eMLP_SimpleTree

TTree* EdbShowAlgE::eMLP_SimpleTree
private

◆ eMLP_TrainEpochs

Int_t EdbShowAlgE::eMLP_TrainEpochs
private

◆ eMLP_WeightFileName

TString EdbShowAlgE::eMLP_WeightFileName
private

◆ eMLP_WeightFileNameArray

TString EdbShowAlgE::eMLP_WeightFileNameArray[10]
private

◆ eMLP_WriteMLPInputFile

Bool_t EdbShowAlgE::eMLP_WriteMLPInputFile
private

◆ eMLP_WriteWeightFile

Bool_t EdbShowAlgE::eMLP_WriteWeightFile
private

◆ eMLPArray

TObjArray* EdbShowAlgE::eMLPArray
private

◆ eMLPArrayN

Int_t EdbShowAlgE::eMLPArrayN
private

◆ eOutANN

Float_t EdbShowAlgE::eOutANN
private

◆ eRecoShowerArray

TObjArray* EdbShowAlgE::eRecoShowerArray
private

◆ eRecoShowerArrayN

Int_t EdbShowAlgE::eRecoShowerArrayN
private

◆ eShowAlgEParaName

TString EdbShowAlgE::eShowAlgEParaName
private

◆ eShowAlgEParaNr

Int_t EdbShowAlgE::eShowAlgEParaNr
private

◆ eShowAlgEPlateBinning

TArrayI* EdbShowAlgE::eShowAlgEPlateBinning
private

◆ eShowAlgEPlatesN

Int_t EdbShowAlgE::eShowAlgEPlatesN
private

The documentation for this class was generated from the following files: