FEDRA emulsion software from the OPERA Collaboration
EdbShowAlgE_Simple Class Reference

#include <EdbShowAlgE_Simple.h>

Inheritance diagram for EdbShowAlgE_Simple:
Collaboration diagram for EdbShowAlgE_Simple:

Public Member Functions

 ClassDef (EdbShowAlgE_Simple, 1)
 
void CreateANN ()
 
void DoRun ()
 
void DoRun (EdbTrackP *shower)
 
void DoRun (TObjArray *trackarray)
 
void DumpNeuralNetworkWeight (TString weight, Int_t ANNType=0)
 
 EdbShowAlgE_Simple ()
 
 EdbShowAlgE_Simple (EdbTrackP *track)
 CONSTRUCTOR USED FOR libShowRec with EdbShowerP class available. More...
 
 EdbShowAlgE_Simple (TObjArray *RecoShowerArray)
 
Int_t FindClosestEfficiencyParametrization (Double_t TestAngle, Double_t ReferenceEff)
 
TF1 * GetEffFunc_all ()
 
TF1 * GetEffFunc_edefault ()
 
TF1 * GetEffFunc_elletroni ()
 
TF1 * GetEffFunc_LowEff ()
 
TF1 * GetEffFunc_MiddleFix ()
 
TF1 * GetEffFunc_neuchmicro ()
 
TF1 * GetEffFunc_UserEfficiency ()
 
TSpline3 * GetEfficiencyParametrisation ()
 
Float_t GetEnergy ()
 
Float_t GetEnergy (EdbTrackP *track)
 
TArrayF * GetEnergyArray ()
 
TArrayF * GetEnergyArrayUnCorrected ()
 
TMultiLayerPerceptron * GetNeuralNetwork (Int_t ANNType=0)
 
void GetNplIndexNr (Int_t sh_npl, Int_t &check_Npl_index, Int_t ePlateNumberType)
 
void GetPara (EdbTrackP *track)
 
Int_t GetRecoShowerArrayN () const
 
void GetSpecifications ()
 
Int_t GetSpecType (Int_t SpecificationType)
 
void Help ()
 
void InitStrings ()
 
void LoadSpecificationWeightFile ()
 
void Print ()
 
void PrintEfficiencyParametrisation ()
 
void PrintSpecifications ()
 
void ReadCorrectionFactors (TString weigthstring, Float_t &p0, Float_t &p1)
 
void ReadTables ()
 
void ReadTables_Energy ()
 
void SetCalibrationOffset (Float_t CalibrationOffset)
 
void SetCalibrationSlope (Float_t CalibrationSlope)
 
void SetEfficiencyParametrisation (TSpline3 *EfficiencyParametrisation)
 
void SetEfficiencyParametrisationAngles ()
 
void SetEfficiencyParametrisationValues (Double_t *Angles, Double_t *EffValuesAtAngles)
 
void SetPlateNumber (Int_t PlateNumber)
 
void SetPlateNumberType (Int_t PlateNumberType)
 
void SetRecoShowerArray (TObjArray *RecoShowerArray)
 
void SetRecoShowerArrayN (Int_t RecoShowerArrayN)
 
void SetSpecifications (Int_t sp0, Int_t sp1, Int_t sp2, Int_t sp3, Int_t sp4, Int_t sp5)
 
void SetSpecificationType (Int_t SpecificationType, Int_t SpecificationTypeVal)
 
void SetWeightFileString (TString weightstring)
 
void TrainNeuralNetwork (TString weight, Int_t ANNType=0)
 
void Update ()
 
void WriteNewRootFile ()
 
virtual ~EdbShowAlgE_Simple ()
 

Protected Member Functions

void Init ()
 
void Set0 ()
 

Protected Attributes

TString ANN_Layout
 
TMultiLayerPerceptron * ANN_MLP
 
TMultiLayerPerceptron * ANN_MLP_ARRAY [15]
 
Int_t ANN_n_InputNeurons
 
Int_t ANN_n_InputNeurons_ARRAY [15]
 
Int_t ANN_nPlates_ARRAY [15]
 
TString ANN_WeightFile_ARRAY [15]
 
TTree * ANNTree
 
Float_t eANN_MLP_CORR_0 [15]
 
Float_t eANN_MLP_CORR_1 [15]
 
Float_t eCalibrationOffset
 
Float_t eCalibrationSlope
 
TSpline3 * eEfficiencyParametrisation
 
Float_t eEnergy
 
TArrayF * eEnergyArray
 
Int_t eEnergyArrayCount
 
TArrayF * eEnergyArraySigmaCorrected
 
TArrayF * eEnergyArrayUnCorrected
 
Float_t eEnergyCorr
 
Float_t eEnergySigmaCorr
 
Float_t eEnergyUnCorr
 
TF1 * EffFunc_all
 
TF1 * EffFunc_edefault
 
TF1 * EffFunc_elletroni
 
TF1 * EffFunc_LowEff
 
TF1 * EffFunc_MiddleFix
 
TF1 * EffFunc_neuchmicro
 
TF1 * EffFunc_UserEfficiency
 
TH1D * eHisto_deltaR
 
TH1D * eHisto_deltaR_mean
 
TH1D * eHisto_deltaR_rms
 
TH1D * eHisto_deltaT
 
TH1D * eHisto_deltaT_mean
 
TH1D * eHisto_deltaT_rms
 
TH1D * eHisto_longprofile
 
TH1D * eHisto_longprofile_av
 
TH1D * eHisto_nbtk
 
TH1D * eHisto_nbtk_av
 
TH1D * eHisto_transprofile
 
TH1D * eHisto_transprofile_av
 
Float_t eParaBT_deltaR_mean
 
Float_t eParaBT_deltaR_rms
 
Float_t eParaBT_deltaT_mean
 
Float_t eParaBT_deltaT_rms
 
Int_t eParalongprofile [57]
 
Int_t eParaName
 
Int_t eParanseg
 
Float_t eParaShowerAxisAngle
 
Int_t ePlateBinning [15]
 
Int_t ePlateNumber
 
Int_t ePlateNumberType
 
TObjArray * eRecoShowerArray
 
Int_t eRecoShowerArrayN
 
Bool_t eSpecificationIsChanged
 
Int_t eSpecificationType [6]
 
TString eSpecificationTypeString [6]
 
TString eSpecificationTypeStringArray [6][6]
 
TObjArray * eSplineArray_Energy_Stat_Electron
 
TObjArray * eSplineArray_Energy_Stat_Gamma
 
TObjArray * eSplineArray_Energy_Sys_Electron
 
TObjArray * eSplineArray_Energy_Sys_Gamma
 
TSpline3 * eSplineCurrent
 
TString eWeightFileString
 
Double_t inANN [70]
 
Double_t outANN
 

Constructor & Destructor Documentation

◆ EdbShowAlgE_Simple() [1/3]

EdbShowAlgE_Simple::EdbShowAlgE_Simple ( )

◆ EdbShowAlgE_Simple() [2/3]

EdbShowAlgE_Simple::EdbShowAlgE_Simple ( EdbTrackP track)

CONSTRUCTOR USED FOR libShowRec with EdbShowerP class available.

39 {
40  // Default Constructor...
41  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::EdbShowAlgE_Simple(EdbTrackP* track) Default Constructor"<<endl;
42  Set0();
43  Init();
44  // ... with Shower:
45  eRecoShowerArray=new TObjArray();
46  eRecoShowerArray->Add(track);
48  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::EdbShowAlgE_Simple(EdbTrackP* track) Default Constructor...done."<<endl;
49 }
void SetRecoShowerArrayN(Int_t RecoShowerArrayN)
Definition: EdbShowAlgE_Simple.h:160
void Set0()
Definition: EdbShowAlgE_Simple.cxx:90
void Init()
Definition: EdbShowAlgE_Simple.cxx:129
TObjArray * eRecoShowerArray
Definition: EdbShowAlgE_Simple.h:41
Definition: bitview.h:14
gEDBDEBUGLEVEL
Definition: energy.C:7

◆ EdbShowAlgE_Simple() [3/3]

EdbShowAlgE_Simple::EdbShowAlgE_Simple ( TObjArray *  RecoShowerArray)
55 {
56  // Default Constructor
57  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::EdbShowAlgE_Simple(TObjArray* RecoShowerArray) Default Constructor"<<endl;
58  Set0();
59  Init();
60  // ... with ShowerArray:
62  eRecoShowerArrayN=eRecoShowerArray->GetEntries();
63  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::EdbShowAlgE_Simple(TObjArray* RecoShowerArray) Default Constructor...done."<<endl;
64 }
TObjArray * RecoShowerArray
Definition: Shower_E_FromShowerRoot.C:12
Int_t eRecoShowerArrayN
Definition: EdbShowAlgE_Simple.h:42

◆ ~EdbShowAlgE_Simple()

EdbShowAlgE_Simple::~EdbShowAlgE_Simple ( )
virtual
69 {
70  // Default Destructor
71  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::~EdbShowAlgE_Simple()"<<endl;
72  // Delete Histograms (on heap):
73  delete eHisto_nbtk_av;
74  delete eHisto_longprofile_av;
76  delete eHisto_deltaR_mean;
77  delete eHisto_deltaT_mean;
78  delete eHisto_deltaR_rms;
79  delete eHisto_deltaT_rms;
80  delete eHisto_nbtk;
81  delete eHisto_longprofile;
82  delete eHisto_transprofile;
83  delete eHisto_deltaR;
84  delete eHisto_deltaT;
85  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::~EdbShowAlgE_Simple()...done."<<endl;
86 }
TH1D * eHisto_deltaR_rms
Definition: EdbShowAlgE_Simple.h:100
TH1D * eHisto_nbtk_av
Definition: EdbShowAlgE_Simple.h:95
TH1D * eHisto_deltaR
Definition: EdbShowAlgE_Simple.h:105
TH1D * eHisto_longprofile_av
Definition: EdbShowAlgE_Simple.h:96
TH1D * eHisto_transprofile_av
Definition: EdbShowAlgE_Simple.h:97
TH1D * eHisto_deltaT
Definition: EdbShowAlgE_Simple.h:106
TH1D * eHisto_transprofile
Definition: EdbShowAlgE_Simple.h:104
TH1D * eHisto_longprofile
Definition: EdbShowAlgE_Simple.h:103
TH1D * eHisto_deltaT_rms
Definition: EdbShowAlgE_Simple.h:101
TH1D * eHisto_deltaR_mean
Definition: EdbShowAlgE_Simple.h:98
TH1D * eHisto_deltaT_mean
Definition: EdbShowAlgE_Simple.h:99
TH1D * eHisto_nbtk
Definition: EdbShowAlgE_Simple.h:102

Member Function Documentation

◆ ClassDef()

EdbShowAlgE_Simple::ClassDef ( EdbShowAlgE_Simple  ,
 
)

◆ CreateANN()

void EdbShowAlgE_Simple::CreateANN ( )
245 {
246  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::CreateANN()"<<endl;
247 
248  // Create ANN Tree and MLP:
249  eParaName=2; // Standard Labeling taken over from EdbShowerP
250  ANNTree = new TTree("ANNTree", "ANNTree");
251  ANNTree->SetDirectory(0);
252  ANNTree->Branch("inANN", inANN, "inANN[70]/D");
253 
254  // Plate Binning: 10,12,14,16,18,20,23,26,29,32,35,40,45,45
255  // see ePlateBinning[]
256 
257  for (int k=0; k<15; k++) {
258  //cout << "creating ANN " << k << endl;
259  ANN_Layout="";
262  for (Int_t i=1; i<ANN_n_InputNeurons; ++i) ANN_Layout += "@inANN["+TString(Form("%d",i))+"],";
263  ANN_Layout += "@inANN["+TString(Form("%d",ANN_n_InputNeurons))+"]:"+TString(Form("%d",ANN_n_InputNeurons+1))+":"+TString(Form("%d",ANN_n_InputNeurons));
264  ANN_Layout+=":inANN[0]/1000";
265  //---------------------------
266  ANN_MLP_ARRAY[k] = new TMultiLayerPerceptron(ANN_Layout,ANNTree,"","");
268  ANN_Layout=ANN_MLP_ARRAY[k]->GetStructure();
269  //---------------------------
270  if (gEDBDEBUGLEVEL>2) {
271  ANN_MLP->Print();
272  cout << ANN_Layout << endl;
273  }
274  }
275  //---------------------------
276 
277  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::CreateANN()...done."<<endl;
278  return;
279 }
Double_t inANN[70]
Definition: EdbShowAlgE_Simple.h:72
Int_t eParaName
Definition: EdbShowAlgE_Simple.h:43
Int_t ePlateBinning[15]
Definition: EdbShowAlgE_Simple.h:66
TTree * ANNTree
Definition: EdbShowAlgE_Simple.h:71
Int_t ANN_n_InputNeurons_ARRAY[15]
Definition: EdbShowAlgE_Simple.h:75
Int_t ANN_n_InputNeurons
Definition: EdbShowAlgE_Simple.h:76
TMultiLayerPerceptron * ANN_MLP
Definition: EdbShowAlgE_Simple.h:69
TMultiLayerPerceptron * ANN_MLP_ARRAY[15]
Definition: EdbShowAlgE_Simple.h:70
TString ANN_Layout
Definition: EdbShowAlgE_Simple.h:77

◆ DoRun() [1/3]

void EdbShowAlgE_Simple::DoRun ( )
284 {
285  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun()" << endl;
286 
287  for (int i=0; i<eRecoShowerArrayN; i++) {
288  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() Doing i= " << i << endl;
289  continue;
291 
292  //EdbShowerP* shower=(EdbShowerP*) eRecoShowerArray->At(i);
293  EdbTrackP* shower=(EdbTrackP*) eRecoShowerArray->At(i);
294 
295  DoRun(shower);
296 
297  } // (int i=0; i<eRecoShowerArrayN; i++)
298 
299  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun()...done." << endl;
300  return;
301 }
Int_t eEnergyArrayCount
Definition: EdbShowAlgE_Simple.h:131
void DoRun()
Definition: EdbShowAlgE_Simple.cxx:283
Definition: EdbPattern.h:118

◆ DoRun() [2/3]

void EdbShowAlgE_Simple::DoRun ( EdbTrackP shower)
332 {
333 
334  if (gEDBDEBUGLEVEL>2) cout << "EdbShowAlgE_Simple::DoRun(EdbTrackP* shower)" << endl;
335 
336  // Get internal variables from the parametrisation filled:
337  GetPara(shower);
338 
339 
341 
342  // Check if efficiency is the one we have or
343  // if we have to change/reload the ANN weightfiles:
344  if (GetSpecType(2)!=EffNr) {
345  cout << "EdbShowAlgE_Simple::DoRun() Hello! Calulated Efficiency is more compatible with another one: Change Specifiaction! Call SetSpecificationType(2,"<< EffNr <<")." << endl;
346  SetSpecificationType(2,EffNr);
347  }
348 
349 
350 
351  // This is to select the suited ANN to the shower, i.e.
352  // the one that matches closest the number of plates:
353  int check_Npl_index =0;
354  GetNplIndexNr(shower->Npl(),check_Npl_index,ePlateNumberType);
355 
356 
358  ANN_MLP=ANN_MLP_ARRAY[check_Npl_index];
359  eWeightFileString=ANN_WeightFile_ARRAY[check_Npl_index];
360  eCalibrationOffset = eANN_MLP_CORR_0[check_Npl_index];
361  eCalibrationSlope = eANN_MLP_CORR_1[check_Npl_index];
362 
363  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() ANN_n_InputNeurons_ARRAY[check_Npl_index]="<< ANN_n_InputNeurons_ARRAY[check_Npl_index] << endl;
364  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() ANN_MLP_ARRAY[check_Npl_index]="<< ANN_MLP_ARRAY[check_Npl_index] << endl;
365  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() Using the following layout: " << endl;
366  if (gEDBDEBUGLEVEL >2) cout << ANN_MLP->GetStructure() << endl;
367  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() And the following weightfile: " << endl;
368  if (gEDBDEBUGLEVEL >2) cout << eWeightFileString << endl;
369 
370  // Reset InputVariables:
371  for (int k=0; k<70; k++) {
372  inANN[k]=0;
373  }
374 
375 
376  // inANN[0] is ALWAYS reserved for the quantity value to be estimated
377  // (E,Id,...)
378  // Test with private variables:
380  inANN[2]=eParanseg;
385  for (int ii=0; ii<57; ii++) {
386  inANN[7+ii]= eParalongprofile[ii];
387  }
388 
389 
390  // Fill Tree:
391  ANNTree->Fill();
392 
393  Double_t params[70];
394  Double_t val;
395 
396  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() Print Inputvariables: " << endl;
397  for (Int_t j=1; j<=ANN_n_InputNeurons; ++j) {
398  params[j-1]=inANN[j];
399  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() : j params[j-1]=inANN[j] " << j<< " " << params[j-1] << endl;
400  }
401  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() Print Inputvariables...done." << endl;
402  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() Evaluate Neural Network Output:" << endl;
403 
404  // ---------------------------------
405  // Evaluation of the ANN:
406  val=(ANN_MLP->Evaluate(0,params));
407  // ---------------------------------
408 
409  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() Before Correction: ANN_MLP->Evaluate(0,params)= " << ANN_MLP->Evaluate(0,params) << " (Inputvar=" << inANN[0] << ")." << endl;
410 
411  if ( ::isnan(val) ) {
412  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() ERROR! ANN_MLP->Evaluate(0,params) is NAN! Setting value to -1. " << endl;
413  val=-1;
414  }
415  eEnergyUnCorr=val;
416 
417  // Linear Correction According to the Parameters matching the right weightfile.
419 
420  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() After Correction: ANN_MLP->Evaluate(0,params)= " << val << " (Inputvar=" << inANN[0] << ")." << endl;
421 
422 
423 
424  // ---------------------------------
425  // Evaluation of the statistical and systematical errors by lookup tables and splines:
426  // For further info and more details, I will report the methology in the thesis, and at
427  // some next collaboration meetings.. (As of october 2010,fwm.)
428  TSpline3* spline;
429  Float_t val_sigma_stat, val_sigma_sys, val_sigma_tot;
430  cout << "TSpline3* spline=eSplineArray_Energy_Stat_Gamma[check_Npl_index];" << endl;
431  spline=(TSpline3*)eSplineArray_Energy_Stat_Gamma->At(check_Npl_index);
432  cout << "Float_t val_sigma_stat=spline->Eval(val); " << spline->Eval(val) << endl;
433  val_sigma_stat=spline->Eval(val);
434 
435  cout << "TSpline3* spline=eSplineArray_Energy_Sys_Gamma[check_Npl_index];" << endl;
436  spline=(TSpline3*)eSplineArray_Energy_Sys_Gamma->At(check_Npl_index);
437  cout << "Float_t val_sigma_sys=spline->Eval(val); " << spline->Eval(val) << endl;
438  val_sigma_sys=spline->Eval(val);
439 
440  // Addition of errors: stat(+)sys. (+)=quadratic addition.
441  val_sigma_tot=TMath::Sqrt(val_sigma_stat*val_sigma_stat+val_sigma_sys*val_sigma_sys);
442  cout << "Float_t val_sigma_tot=... " << val_sigma_tot << endl;
443 
444 
445  cout << "Doing only statistics and one source of systematics at the moment! " << endl;
446  cout << "Notice also that we dont have storage variable in EdbTrackP for the error of P() ... " << endl;
447  // ---------------------------------
448 
449  // Quick Estimation of the sigma (from ANN_MEGA_ENERGY)
450  // This is later to be read from a lookup table....
451  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun() ERROR! Sigma ONLY FROM STATISTICAL UNCERTATINTY NOWNOT correctly set up to now."<<endl;
452  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun() ERROR! Sigma will be fully implemented when lookup tables for all"<<endl;
453  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun() ERROR! systematic uncertainties are availible!"<<endl;
454  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun() Estimated Energy = " << val << " +- " << val_sigma_tot << "..." << endl;
455 
456 
457 
458  // Finally, set values...
459  shower->SetP(val);
460  eEnergy=val;
461  eEnergyCorr=val;
462  eEnergySigmaCorr=val_sigma_stat;
463 
467 
468 
469  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() ...Done." << endl;
470  return;
471 }
void SetP(float p)
Definition: EdbSegP.h:130
TString eWeightFileString
Definition: EdbShowAlgE_Simple.h:55
Float_t eParaBT_deltaT_mean
Definition: EdbShowAlgE_Simple.h:91
void GetPara(EdbTrackP *track)
Definition: EdbShowAlgE_Simple.cxx:830
TArrayF * eEnergyArrayUnCorrected
Definition: EdbShowAlgE_Simple.h:124
Int_t eParanseg
Definition: EdbShowAlgE_Simple.h:88
TArrayF * eEnergyArraySigmaCorrected
Definition: EdbShowAlgE_Simple.h:125
Float_t eCalibrationOffset
Definition: EdbShowAlgE_Simple.h:46
Float_t eEnergyCorr
Definition: EdbShowAlgE_Simple.h:127
Int_t GetSpecType(Int_t SpecificationType)
Definition: EdbShowAlgE_Simple.h:235
Float_t eEnergy
Definition: EdbShowAlgE_Simple.h:126
Float_t eParaBT_deltaR_mean
Definition: EdbShowAlgE_Simple.h:89
void GetNplIndexNr(Int_t sh_npl, Int_t &check_Npl_index, Int_t ePlateNumberType)
Definition: EdbShowAlgE_Simple.cxx:534
Float_t eANN_MLP_CORR_1[15]
Definition: EdbShowAlgE_Simple.h:82
Float_t eParaBT_deltaR_rms
Definition: EdbShowAlgE_Simple.h:90
TObjArray * eSplineArray_Energy_Sys_Gamma
Definition: EdbShowAlgE_Simple.h:137
TSpline3 * eEfficiencyParametrisation
Definition: EdbShowAlgE_Simple.h:120
Int_t eParalongprofile[57]
Definition: EdbShowAlgE_Simple.h:93
Float_t eANN_MLP_CORR_0[15]
Definition: EdbShowAlgE_Simple.h:81
TArrayF * eEnergyArray
Definition: EdbShowAlgE_Simple.h:123
void SetSpecificationType(Int_t SpecificationType, Int_t SpecificationTypeVal)
Definition: EdbShowAlgE_Simple.cxx:698
Int_t ePlateNumberType
Definition: EdbShowAlgE_Simple.h:49
TString ANN_WeightFile_ARRAY[15]
Definition: EdbShowAlgE_Simple.h:78
Float_t eParaBT_deltaT_rms
Definition: EdbShowAlgE_Simple.h:92
Float_t eEnergyUnCorr
Definition: EdbShowAlgE_Simple.h:128
Int_t FindClosestEfficiencyParametrization(Double_t TestAngle, Double_t ReferenceEff)
Definition: EdbShowAlgE_Simple.cxx:476
TObjArray * eSplineArray_Energy_Stat_Gamma
Definition: EdbShowAlgE_Simple.h:135
Float_t eEnergySigmaCorr
Definition: EdbShowAlgE_Simple.h:129
Float_t eCalibrationSlope
Definition: EdbShowAlgE_Simple.h:47
Float_t eParaShowerAxisAngle
Definition: EdbShowAlgE_Simple.h:87
Int_t Npl() const
Definition: EdbPattern.h:176
Double_t params[3]
Definition: testBGReduction_By_ANN.C:84

◆ DoRun() [3/3]

void EdbShowAlgE_Simple::DoRun ( TObjArray *  trackarray)
307 {
308  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun(TObjArray* trackarray)" << endl;
309 
310  eRecoShowerArrayN=trackarray->GetEntries();
311  eRecoShowerArray=trackarray;
312 
313  for (int i=0; i<eRecoShowerArrayN; i++) {
314  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::DoRun() Doing i= " << i << endl;
315 
317 
318  //EdbShowerP* shower=(EdbShowerP*) eRecoShowerArray->At(i);
319  EdbTrackP* shower=(EdbTrackP*) eRecoShowerArray->At(i);
320 
321  DoRun(shower);
322 
323  } // (int i=0; i<eRecoShowerArrayN; i++)
324 
325  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::DoRun(TObjArray* trackarray)...done." << endl;
326  return;
327 }

◆ DumpNeuralNetworkWeight()

void EdbShowAlgE_Simple::DumpNeuralNetworkWeight ( TString  weight,
Int_t  ANNType = 0 
)
inline
216  {
217  if (ANNType>=15) ANNType=14;
218  ANN_MLP_ARRAY[ANNType]->DumpWeights(weight);
219  return;
220  }

◆ FindClosestEfficiencyParametrization()

Int_t EdbShowAlgE_Simple::FindClosestEfficiencyParametrization ( Double_t  TestAngle = 0.0,
Double_t  ReferenceEff = 1.0 
)
477 {
478  // Returns the number of the closest EfficiencyParametrization to use. Supported are:
479  // ((in this order numbering, different from the ordering, fwm used for his calculations!:))
480  // 0:Neuch
481  // 1:All
482  // 2:MiddleFix
483  // 3:Low
484 
485  // 4: UserEfficiency (can take input from eda, for example; or user measured input)
486 
487  if (gEDBDEBUGLEVEL >2) cout << "TestAngle " << TestAngle << endl;
488  if (gEDBDEBUGLEVEL >2) cout << "ReferenceEff " << ReferenceEff << endl;
489  if (gEDBDEBUGLEVEL >2) cout << "neuchmicro->Eval(TestAngle) "<< EffFunc_neuchmicro->Eval(TestAngle)<< endl;
490  if (gEDBDEBUGLEVEL >2) cout << "all->Eval(TestAngle) "<< EffFunc_all->Eval(TestAngle)<< endl;
491  if (gEDBDEBUGLEVEL >2) cout << "MiddleFix->Eval(TestAngle) "<< EffFunc_MiddleFix->Eval(TestAngle)<< endl;
492  if (gEDBDEBUGLEVEL >2) cout << "LowEff->Eval(TestAngle) "<< EffFunc_LowEff->Eval(TestAngle)<< endl;
493  if (gEDBDEBUGLEVEL >2) cout << " eEfficiencyParametrisation->Eval(TestAngle) "<< eEfficiencyParametrisation->Eval(TestAngle)<< endl;
494 
495 //Measure distance of angle to estimated angle:
496  Double_t dist[9];
497  dist[0]=TMath::Abs(ReferenceEff-EffFunc_neuchmicro->Eval(TestAngle));
498  dist[1]=TMath::Abs(ReferenceEff-EffFunc_all->Eval(TestAngle));
499  dist[2]=TMath::Abs(ReferenceEff-EffFunc_MiddleFix->Eval(TestAngle));
500  dist[3]=TMath::Abs(ReferenceEff-EffFunc_LowEff->Eval(TestAngle));
501  dist[4]=TMath::Abs(ReferenceEff-eEfficiencyParametrisation->Eval(TestAngle));
502 
503  Double_t dist_min=1;
504  Int_t best_i=-1;
505  for (int i=0; i<5; i++) if (abs(dist[i])<dist_min) {
506  dist_min=dist[i];
507  best_i=i;
508  }
509 
510  if (gEDBDEBUGLEVEL >2) {
511  cout << "Miminum distance = " << dist_min << ", best matching efficiency is = ";
512  if (best_i==0) cout << " neuchmicro " <<endl;
513  if (best_i==2) cout << " MiddleFix " <<endl;
514  if (best_i==3) cout << " LowEff " <<endl;
515  if (best_i==1) cout << " All " <<endl;
516  if (best_i==4) cout << " User Set eEfficiencyParametrisation " <<endl;
517  }
518 
519  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::FindClosestEfficiencyParametrization() ...Done." << endl;
520  return best_i;
521 }
TF1 * EffFunc_all
Definition: EdbShowAlgE_Simple.h:109
TF1 * EffFunc_neuchmicro
Definition: EdbShowAlgE_Simple.h:112
TF1 * EffFunc_LowEff
Definition: EdbShowAlgE_Simple.h:114
TF1 * EffFunc_MiddleFix
Definition: EdbShowAlgE_Simple.h:113

◆ GetEffFunc_all()

TF1* EdbShowAlgE_Simple::GetEffFunc_all ( )
inline
183  {
184  return EffFunc_all;
185  }

◆ GetEffFunc_edefault()

TF1* EdbShowAlgE_Simple::GetEffFunc_edefault ( )
inline
186  {
187  return EffFunc_edefault;
188  }
TF1 * EffFunc_edefault
Definition: EdbShowAlgE_Simple.h:110

◆ GetEffFunc_elletroni()

TF1* EdbShowAlgE_Simple::GetEffFunc_elletroni ( )
inline
189  {
190  return EffFunc_elletroni;
191  }
TF1 * EffFunc_elletroni
Definition: EdbShowAlgE_Simple.h:111

◆ GetEffFunc_LowEff()

TF1* EdbShowAlgE_Simple::GetEffFunc_LowEff ( )
inline
198  {
199  return EffFunc_LowEff;
200  }

◆ GetEffFunc_MiddleFix()

TF1* EdbShowAlgE_Simple::GetEffFunc_MiddleFix ( )
inline
195  {
196  return EffFunc_MiddleFix;
197  }

◆ GetEffFunc_neuchmicro()

TF1* EdbShowAlgE_Simple::GetEffFunc_neuchmicro ( )
inline
192  {
193  return EffFunc_neuchmicro;
194  }

◆ GetEffFunc_UserEfficiency()

TF1* EdbShowAlgE_Simple::GetEffFunc_UserEfficiency ( )
inline
201  {
202  return EffFunc_UserEfficiency;
203  }
TF1 * EffFunc_UserEfficiency
Definition: EdbShowAlgE_Simple.h:115

◆ GetEfficiencyParametrisation()

TSpline3* EdbShowAlgE_Simple::GetEfficiencyParametrisation ( )
inline
245  {
247  }

◆ GetEnergy() [1/2]

Float_t EdbShowAlgE_Simple::GetEnergy ( )
inline
172  {
173  return eEnergy;
174  }

◆ GetEnergy() [2/2]

Float_t EdbShowAlgE_Simple::GetEnergy ( EdbTrackP track)
inline
175  {
176  return track->P();
177  }

◆ GetEnergyArray()

TArrayF* EdbShowAlgE_Simple::GetEnergyArray ( )
inline
166  {
167  return eEnergyArray;
168  }

◆ GetEnergyArrayUnCorrected()

TArrayF* EdbShowAlgE_Simple::GetEnergyArrayUnCorrected ( )
inline
169  {
171  }

◆ GetNeuralNetwork()

TMultiLayerPerceptron* EdbShowAlgE_Simple::GetNeuralNetwork ( Int_t  ANNType = 0)
inline
205  {
206  if (ANNType>=15) ANNType=14;
207  return ANN_MLP_ARRAY[ANNType];
208  }

◆ GetNplIndexNr()

void EdbShowAlgE_Simple::GetNplIndexNr ( Int_t  sh_npl,
Int_t &  check_Npl_index,
Int_t  ePlateNumberType 
)
535 {
536  // --- What is the sense of this?
537  // --- According to the shower it can have any different length between [1..57] plates.
538  // --- We cannot produce weights for each plate....
539  // --- So we have only some weights for different plates: acoording to the array set in plateBinning:
540  // --- 10,12,14,16,18,20,23,26,29,32,35,40,45,50
541  // --- So what if a shower has npl() of 19? take the weight for 18 or for 20 plates?
542  // --- therefore, we introduced ePlateNumberType. This will take the weight as like:
543  // --- In case ePlateNumberType > 0 the it will take he trained ANN file with Npl >= shower->Npl();
544  // --- in such a way that |ePlateNumberType| is the difference to the ePlateBinning[].
545  // --- Example: ePlateNumberType=1 -> 1st next availible weight will be taken: (npl==19->nplANN==20);
546  // --- Example: ePlateNumberType=2 -> 2nd next availible weight will be taken: (npl==19->nplANN==23);
547  // --- Example: ePlateNumberType=3 -> 3rd next availible weight will be taken: (npl==19->nplANN==26);
548  // --- Example: ePlateNumberType=-1-> 1st befo availible weight will be taken: (npl==19->nplANN==18);
549  // --- Example: ePlateNumberType=-2-> 2nd befo availible weight will be taken: (npl==19->nplANN==16);
550 
551  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::GetNplIndexNr("<<check_Npl<<","<<check_Npl_index<<","<<ePlateNumberType<<")"<<endl;
552 
553  // The Neural Network Training was done in a way that we had always Npl(Train)>=shower->Npl()
554 
555  // First we find closest (bigger) ePlateBinning index:
556  int diff=9999;
557  int closestIndex=-1;
558  for (int i=0; i<15; i++) {
559  if (ePlateBinning[i]-check_Npl>0) {
560  closestIndex=i;
561  break;
562  }
563  }
564  cout << "closestIndex= " << closestIndex << " ePlateBinning[closestIndex]= " << ePlateBinning[closestIndex] << endl;
565  //-----------------------------------
566  // for ePlateNumberType we have it already exact:
567  ePlateNumber = closestIndex + ePlateNumberType;
568  if (ePlateNumberType==1) ePlateNumber = closestIndex;
569  cout << "ePlateNumber = closestIndex + ePlateNumberType = " << ePlateNumber << endl;
570 
571  // check for over/underbound
572  if (ePlateNumber<0) ePlateNumber=0;
573  if (ePlateNumber>14) ePlateNumber=14;
574  check_Npl_index=ePlateNumber;
575  //-----------------------------------
576 // // This Plate Binnning is the _final_binning and will not be refined furthermore!
577 // ePlateBinning[0]=10;// ePlateBinning[1]=12;
578 // ePlateBinning[2]=14;// ePlateBinning[3]=16;
579 // ePlateBinning[4]=18;// ePlateBinning[5]=20;
580 // ePlateBinning[6]=23;// ePlateBinning[7]=26;
581 // ePlateBinning[8]=29;// ePlateBinning[9]=32;
582 // ePlateBinning[10]=35;// ePlateBinning[11]=40;
583 // ePlateBinning[12]=45;// ePlateBinning[13]=45;
584 // ePlateBinning[14]=45;
585  //-----------------------------------
586  cout << "All plates:"<<endl;
587  cout << "Shower Npl:"<<endl;
588  cout << "Available weights:"<<endl;
589  cout << "Taken weight:"<<endl;
590  cout << "[";
591  for (int i=1; i<=57; i++) {
592  cout << ".";
593  }
594  cout << "]" << endl;
595  //-----------------------------------
596  cout << "[";
597  for (int i=1; i<=check_Npl; i++) {
598  cout << ".";
599  }
600  cout << "]" << endl;
601  //-----------------------------------
602  cout << "[";
603  for (int i=1; i<=57; i++) {
604  Bool_t isExact=kFALSE;
605  for (int j=0; j<15; j++) {
606  if (i==ePlateBinning[j]) isExact=kTRUE;
607  }
608  if (isExact) {
609  cout << "x";
610  }
611  else {
612  cout << ".";
613  }
614  }
615  cout << "]" << endl;
616  //-----------------------------------
617  cout << "[";
618  for (int i=1; i<=57; i++) {
619  if (i==ePlateBinning[ePlateNumber]) {
620  cout << "X";
621  }
622  else {
623  cout << ".";
624  }
625  }
626  cout << "]" << endl;
627  //-----------------------------------
628 
629  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::check_Npl_index Shower:Npl()=" << check_Npl << "."<< endl;
630  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::check_Npl_index ePlateNumber=" << ePlateNumber << "."<< endl;
631  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple::check_Npl_index ePlateBinning[=" << ePlateBinning[ePlateNumber] << "."<< endl;
632 
633 
634  check_Npl=ePlateBinning[ePlateNumber];
635  return;
636 }
Int_t ePlateNumber
Definition: EdbShowAlgE_Simple.h:52

◆ GetPara()

void EdbShowAlgE_Simple::GetPara ( EdbTrackP track)

--— IMPORTANT:: these areopen cut values for best combifinding of pair BT deltaR/Theta values --— IMPORTANT:: then you do NOT necessarily get back your values which you put in durign --— IMPORTANT:: your shower reconstruction cone ( deltaR/Theta cutvalues could be NO cutvalues --— IMPORTANT:: for some reconstruction algorithms for example, but we wanna have these values anyway. In Any Case: Frederics Cut looks only for best min_shower_deltar so we do also.

831 {
832  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::GetPara Fill the Para structure with values from a track." << endl;
833 
834  // This parametrisation consists of these variables:
835  // 0) Axis TanTheta
836  // 1) NBT
837  // 2) BT_deltaR_mean
838  // 3) BT_deltaR_rms
839  // 4) BT_deltaT_mean
840  // 5) BT_deltaT_rms
841  // 6) longprofile[0]=eHisto_longprofile->GetBinContent(1) // number of basetracks in the SAME plate as the Initiator basetrack.
842  // 7) longprofile[1]=eHisto_longprofile->GetBinContent(2)
843  // ...
844  // 5+Npl()) longprofile[Npl()-1]=eHisto_longprofile->GetBinContent(Npl()) // number of basetracks in the LAST plate of the reconstructed shower.
845  //
846  //==C== DUMMY routine to get the values deltarb and deltathetab filled:
847  //==C== necessary since its an old relict from old times where this was saved only
848  //==C== as root TTree.
849 
850  EdbSegP* seg;
851  Float_t shower_xb[5000];
852  Float_t shower_yb[5000];
853  Float_t shower_zb[5000];
854  Float_t shower_txb[5000];
855  Float_t shower_tyb[5000];
856  Float_t shower_deltathetab[5000];
857  Float_t shower_deltarb[5000];
858  Float_t min_shower_deltathetab=99999; // Reset
859  Float_t min_shower_deltar=99999; // Reset
860  Float_t extrapo_diffz=0;
861  Float_t extrapol_x=0;
862  Float_t extrapol_y=0;
863 
864  Float_t test_shower_deltathetab;
865  Float_t test_shower_deltar;
866  Float_t test_shower_deltax;
867  Float_t test_shower_deltay;
868 
869  Int_t TrackNSeg=track->N();
870 
871  for (int ii=0; ii<TrackNSeg; ii++) {
872  // the ii<N() => ii<TrackNSeg replacement is just an adaption from the
873  // code snipplet taken from EdbShowRec
874  seg=(EdbSegP*)track->GetSegment(ii);
875  shower_xb[ii]=seg->X();
876  shower_yb[ii]=seg->Y();
877  shower_txb[ii]=seg->TX();
878  shower_tyb[ii]=seg->TY();
879  shower_zb[ii]=seg->Z();
880  shower_deltathetab[ii]=0.5;
881  shower_deltarb[ii]=200;
882  }
883 
884  //-------------------------------------
885  for (int ii=0; ii<TrackNSeg; ii++) {
886  seg=(EdbSegP*)track->GetSegment(ii);
887  if (gEDBDEBUGLEVEL>2) {
888  if (gEDBDEBUGLEVEL >2) cout << "====== --- DOING " << ii << endl;
889  seg->PrintNice();
890  }
891  //-------------------------------------
892  // InBT:
893  if (ii==0) {
894  shower_deltathetab[ii]=0.5;
895  shower_deltarb[ii]=200;
896  }
897  // All other BTs:
898  if (ii>0) {
899 
900  // PUT HERE: calculation routine for shower_deltathetab, shower_deltarb
901  // Exrapolate the BT [ii] to the position [jj] and then calc the
902  // position and slope differences for the best matching next segment.
903  // For the backward extrapolation of the shower_deltathetab and shower_deltarb
904  // calulation for BaseTrack(ii), Basetrack(jj)->Z() hast to be smaller.
905  min_shower_deltathetab=99999; // Reset
906  min_shower_deltar=99999; // Reset
907 
908  for (int jj=0; jj<track->N(); jj++) {
909  if (ii==jj) continue;
910 
911  // since we do not know if BTs are ordered by their Z positions:
912  // and cannot cut directly on the number in the shower entry:
913  if (shower_zb[ii]<shower_zb[jj]) continue;
914 
915  extrapo_diffz=shower_zb[ii]-shower_zb[jj];
916  if (TMath::Abs(extrapo_diffz)>4*1300+1.0) continue;
917  if (TMath::Abs(extrapo_diffz)<1.0) continue; // remove same positions.
918 
919  extrapol_x=shower_xb[ii]-shower_txb[ii]*extrapo_diffz; // minus, because its ii after jj.
920  extrapol_y=shower_yb[ii]-shower_tyb[ii]*extrapo_diffz; // minus, because its ii after jj.
921 
922  // Delta radius we need to extrapolate.
923  test_shower_deltax=extrapol_x;//shower_txb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_xb[ii];
924  test_shower_deltay=extrapol_y;//shower_tyb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_yb[ii];
925  test_shower_deltax=test_shower_deltax-shower_xb[jj];
926  test_shower_deltay=test_shower_deltay-shower_yb[jj];
927  test_shower_deltar=TMath::Sqrt(test_shower_deltax*test_shower_deltax+test_shower_deltay*test_shower_deltay);
928 
929  // Delta theta we do not need to extrapolate. (old version...)
930  //test_shower_deltathetab=TMath::Sqrt(shower_txb[ii]*shower_txb[ii]+shower_tyb[ii]*shower_tyb[ii]);
931  //test_shower_deltathetab=test_shower_deltathetab-TMath::Sqrt(shower_txb[jj]*shower_txb[jj]+shower_tyb[jj]*shower_tyb[jj]);
932  //test_shower_deltathetab=TMath::Abs(test_shower_deltathetab);
933  //----
934  // As before in ShowRec this way of calculation is not equivalent as calculating
935  // DeltaTheta domponentwise:
936  // Code from libShower:
937  // delta = sqrt((SX0-a->GetTXb(l2))*(SX0-a->GetTXb(l2))+((SY0-a->GetTYb(l2))*(SY0-a->GetTYb(l2))));
938  test_shower_deltathetab=TMath::Sqrt(TMath::Power(shower_txb[ii]-shower_txb[jj],2)+TMath::Power(shower_tyb[ii]-shower_tyb[jj],2));
939 
940  // Check if both dr,dt match parameter criteria and then just take these values.....
941  // Maybe a change is necessary because it is not exactly the same as in the off. algorithm:
942  if (test_shower_deltar<1000 && test_shower_deltathetab<2.0 ) { // open cut values
943  // Make these values equal to the one in the "official algorithm"..... 150microns and 100mrad.
944  //if (test_shower_deltar<150 && test_shower_deltathetab<0.15 ) { // frederics cut values
951  if (test_shower_deltar<min_shower_deltar) {
952  min_shower_deltathetab=test_shower_deltathetab;
953  min_shower_deltar=test_shower_deltar;
954  shower_deltathetab[ii]=min_shower_deltathetab;
955  shower_deltarb[ii]=min_shower_deltar;
956  }
957  }
958  }
959  }
960  //-------------------------------------
961 
962  } // for (int ii=0;ii<N();ii++)
963  //-------------------------------------
964 
965  //-------------------------------------
966  if (gEDBDEBUGLEVEL>2) {
967  if (gEDBDEBUGLEVEL >2) cout << "EdbTrackP: N() nsegments= " << track->N() << endl;
968  for (int ii=0; ii<track->N(); ii++) {
969  if (gEDBDEBUGLEVEL >2) cout << "Shower: nentry= " << ii << " shower_zb[ii] = " << shower_zb[ii] << " shower_deltathetab[ii] = " << shower_deltathetab[ii] << " shower_deltarb[ii] = " << shower_deltarb[ii] <<endl;
970  }
971  }
972  //-------------------------------------
973 
974  // Profile starting with (arrayindex ==0): number of basetracks in the SAME plate as the Initiator basetrack.
975  // Profile ending with (arrayindex ==56): // number of basetracks in the LAST plate of the reconstructed shower.
976  Int_t longprofile[57];
977 
978  //Int_t numberofilms=Npl(); // Historical reasons why there are more names for the same variable...
979  //Int_t nbfilm=Npl(); // Historical reasons why there are more names for the same variable...
980  Int_t nbfilm=track->Npl();
981 
982  // Int_t numberoffilsforlongprofile=numberofilms+1; // it is one more going from [1..nbfilm] !!!// Not used in this routine.
983 
984  Float_t Dr[57];
985  Float_t X0[57];
986  Float_t Y0[57];
987  Float_t TX0,TY0;
988  Float_t theta[57];
989  Float_t dist;
990  Float_t xb[5000];
991  Float_t yb[5000];
992  Float_t zb[5000];
993  Float_t txb[5000];
994  Float_t tyb[5000];
995  Int_t nfilmb[5000];
996  //Float_t deltathetab[5000]; // Not used in this routine.
997  //Float_t deltarb[5000]; // Not used in this routine.
998 // Int_t sizeb=N();
999  Int_t sizeb=track->N();
1000  //Int_t nentries_withisizeb=0;
1001 
1002  //=C= =====================================================================
1003  eHisto_nbtk_av ->Reset();
1004  eHisto_nbtk ->Reset();
1005  eHisto_longprofile_av ->Reset();
1006  eHisto_deltaR_mean ->Reset();
1007  eHisto_deltaT_mean ->Reset();
1008  eHisto_deltaR_rms ->Reset();
1009  eHisto_deltaT_rms ->Reset();
1010  eHisto_longprofile ->Reset();
1011  eHisto_deltaR ->Reset();
1012  eHisto_deltaT ->Reset();
1013  //=C= =====================================================================
1014  for (int id=0; id<57; id++) {
1015  theta[id]= 0;
1016  X0[id] = id*1300.*track->GetSegment(0)->TX() + track->GetSegment(0)->X();
1017  Y0[id] = id*1300.*track->GetSegment(0)->TY() + track->GetSegment(0)->Y();
1018  longprofile[id]=-1;
1019  // this is important, cause it means that where is -1 there is no BT reconstructed anymore
1020  // this is different for example to holese where N=0 , so one can distinguish!
1021  }
1022 
1023  if (gEDBDEBUGLEVEL>3) if (gEDBDEBUGLEVEL >2) cout << "eHisto_longprofile->GetBinWidth() " << eHisto_longprofile->GetBinWidth(1) << endl;
1024  if (gEDBDEBUGLEVEL>3) if (gEDBDEBUGLEVEL >2) cout << "eHisto_longprofile->GetBinCenter() " << eHisto_longprofile->GetBinCenter(1) << endl;
1025  if (gEDBDEBUGLEVEL>3) if (gEDBDEBUGLEVEL >2) cout << "eHisto_longprofile->GetNbinsX() " << eHisto_longprofile->GetNbinsX() << endl;
1026 
1027  TX0 = track->GetSegment(0)->TX();
1028  TY0 = track->GetSegment(0)->TY();
1029  for (Int_t j = 0; j<57; ++j) {
1030  Dr[j] = 0.03*j*1300. +20.0;
1031  //if (gEDBDEBUGLEVEL >2) cout << " DEBUG j= " << j << " Dr[j]= " << Dr[j] << endl;
1032  } // old relict from FJ. Do not remove. //
1033  // it represents somehow conesize......(??)
1034 
1035  //=C= =====================================================================
1036  for (Int_t ibtke = 0; ibtke < track->N(); ibtke++) {
1037  xb[ibtke]=track->GetSegment(ibtke)->X();
1038  yb[ibtke]=track->GetSegment(ibtke)->Y();
1039  zb[ibtke]=track->GetSegment(ibtke)->Z();
1040  txb[ibtke]=track->GetSegment(ibtke)->TX();
1041  tyb[ibtke]=track->GetSegment(ibtke)->TY();
1042  // abs() of filmPID with respect to filmPID of first BT, plus 1: (nfilmb(0):=1 per definition):
1043  // Of course PID() have to be read correctly (by ReadEdbPVrec) correctly.
1044  // Fedra should do it.
1045  nfilmb[ibtke]=TMath::Abs(track->GetSegment(ibtke)->PID()-track->GetSegment(0)->PID())+1;
1046 
1047  if (gEDBDEBUGLEVEL>2) {
1048  if (gEDBDEBUGLEVEL >2) cout << "ibtke= " <<ibtke << " xb[ibtke]= " << xb[ibtke] << " nfilmb[ibtke]= " << nfilmb[ibtke] << endl;
1049  }
1050  }
1051  //=C= =====================================================================
1052  //=C= loop over the basetracks in the shower (boucle sur les btk)
1053  for (Int_t ibtke = 0; ibtke < track->N(); ibtke++) {
1054  dist = sqrt((xb[ibtke]- X0[nfilmb[ibtke]-1])*(xb[ibtke]- X0[nfilmb[ibtke]-1])+(yb[ibtke]- Y0[nfilmb[ibtke]-1])*(yb[ibtke]- Y0[nfilmb[ibtke]-1]));
1055 
1056  // inside the cone
1057  //if (gEDBDEBUGLEVEL >2) cout << "ibtke= " <<ibtke << " dist = " << dist << " Dr[nfilmb[ibtke]-1] = " << Dr[nfilmb[ibtke]-1] << endl;
1058  //if (gEDBDEBUGLEVEL >2) cout << " nfilmb[ibtke] = " << nfilmb[ibtke] << " nbfilm = " << nbfilm << endl;
1059 
1060  // In old times there was here an additional condition which checked the BTs for the ConeDistance.
1061  // Since at this point in buildparametrisation_FJ the shower is -already fully reconstructed -
1062  // (by either EdbShoAlgo, or ShowRec program or manual list) this intruduces an additional cut
1063  // which is not correct because conetube size is algorithm specifiv (see Version.log.txt #20052010)
1064  // Thats wy we drop it here....
1065  // if (dist<Dr[nfilmb[ibtke]-1]&&nfilmb[ibtke]<=nbfilm) { // original if line comdition
1066  if (dist>Dr[nfilmb[ibtke]-1]) {
1067  if (gEDBDEBUGLEVEL>2) {
1068  if (gEDBDEBUGLEVEL >2) cout << " WARNING , In old times this cut (dist>Dr[nfilmb[ibtke]-1]) (had also to be fulfilled!"<<endl;
1069  if (gEDBDEBUGLEVEL >2) cout << " For this specific shower it seems not the case....." << endl;
1070  if (gEDBDEBUGLEVEL >2) cout << " You might want to check this shower again manualy to make sure everything is correct....." << endl;
1071  }
1072  }
1073  if (nfilmb[ibtke]<=nbfilm) {
1074  //if (gEDBDEBUGLEVEL >2) cout << "DEBUG CUTCONDITION WITHOUT THE (?_?_? WRONG ?_?_?) CONE DIST CONDITION....." << endl;
1075  // if (gEDBDEBUGLEVEL >2) cout << yes, this additional cut is not necessary anymore, see above....
1076 
1077  eHisto_longprofile ->Fill(nfilmb[ibtke]);
1078  eHisto_longprofile_av ->Fill(nfilmb[ibtke]);
1079 
1080  Double_t DR=0; //Extrapolate the old stlye way:
1081  Double_t Dx=xb[ibtke]-(xb[0]+(zb[ibtke]-zb[0])*txb[0]);
1082  Double_t Dy=yb[ibtke]-(yb[0]+(zb[ibtke]-zb[0])*tyb[0]);
1083  DR=TMath::Sqrt(Dx*Dx+Dy*Dy);
1084  eHisto_transprofile_av->Fill(DR);
1085  eHisto_transprofile->Fill(DR);
1086 
1087  theta[nfilmb[ibtke]]+= (TX0-txb[ibtke])*(TX0-txb[ibtke])+(TY0-tyb[ibtke])*(TY0-tyb[ibtke]);
1088  if (ibtke>0&&nfilmb[ibtke]<=nbfilm) {
1089  // eHisto_deltaR ->Fill(deltarb[ibtke]);
1090  // eHisto_deltaT ->Fill(deltathetab[ibtke]);
1091  // uses shower_deltarb,shower_deltathetab just calculated in dummy routine above.
1092  // The first BT is NOT used for this filling since the extrapolated values of
1093  // shower_deltarb and shower_deltathetab are set manually to 0.5 and 200, due to
1094  // historical reasons (these variables com from the e/pi separation stuff).
1095  eHisto_deltaR ->Fill(shower_deltarb[ibtke]);
1096  eHisto_deltaT ->Fill(shower_deltathetab[ibtke]);
1097  }
1098  }
1099  }//==C== END OF loop over the basetracks in the shower
1100  //if (gEDBDEBUGLEVEL >2) cout <<"---------------------------------------"<<endl;
1101  //=======================================================================================
1102  //==C== Fill NumberBT Histogram for all showers:
1103  eHisto_nbtk ->Fill(sizeb);
1104  eHisto_nbtk_av ->Fill(sizeb);
1105  //==C== Fill dR,dT Mean and RMS Histos for all showers:
1106  eHisto_deltaR_mean ->Fill(eHisto_deltaR->GetMean());
1107  eHisto_deltaT_mean ->Fill(eHisto_deltaT->GetMean());
1108  eHisto_deltaR_rms ->Fill(eHisto_deltaR->GetRMS());
1109  eHisto_deltaT_rms ->Fill(eHisto_deltaT->GetRMS());
1110  //=======================================================================================
1111 
1112  // Fill the longprofile array: (NEW VERSION (arrayindex 0 is same plate as Initiator BT))
1113  for (Int_t i=1; i<=nbfilm; ++i) {
1114  // longprofile[i-1] = eHisto_longprofile->GetBinContent(i); /// OLD VERSION for (Int_t i=1; i<=nbfilm+1; ++i)
1115  longprofile[i-1] = (Int_t)(eHisto_longprofile->GetBinContent(i+1)); // NEW VERSION (arrayindex 0 is same plate as Initiator BT)
1116  //test+=longprofile[i-1] ;
1117  if (gEDBDEBUGLEVEL>1) {
1118  if (gEDBDEBUGLEVEL >2) cout << "i= " << i << " longprofile[i-1] "<< longprofile[i-1] << " eHisto_longprofile->GetBinContent(i) " << eHisto_longprofile->GetBinContent(i+1)<< endl;
1119  }
1120  if (i==nbfilm) {
1121  if (gEDBDEBUGLEVEL >2) cout << "i==nbfilm:" << endl;
1122  longprofile[i-1] = (Int_t)(eHisto_longprofile->GetBinContent(i+1));
1123  }
1124  //
1125  }
1126  // Rather strange but I have to put it explicetly here, otherwise last bin isnt filled...
1127  longprofile[nbfilm] = (Int_t)(eHisto_longprofile->GetBinContent(nbfilm+1));
1128  for (Int_t i=nbfilm+2; i<57; ++i) {
1129  longprofile[i-1] = -1;
1130  }
1131  //----------------------------------------------------------------------------------------
1132 
1133  // - Inclusion. only for libShower, EdbShowerRec class!
1134  Float_t eShowerAxisAngle=track->GetSegment(0)->Theta();
1135  // - Inclusion. only for libShower, EdbShowerRec class; END;
1136 
1137 
1138  // Now set parametrisation values:
1139  eParaShowerAxisAngle=eShowerAxisAngle;
1140  eParanseg=track->N();
1141  eParaBT_deltaR_mean = eHisto_deltaR->GetMean();
1142  eParaBT_deltaR_rms = eHisto_deltaR->GetRMS();
1143  eParaBT_deltaT_mean = eHisto_deltaT->GetMean();
1144  eParaBT_deltaT_rms = eHisto_deltaT->GetRMS();
1145  for (int ii=0; ii<57; ii++) eParalongprofile[ii]=longprofile[ii];
1146 
1147  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::GetPara Fill the Para structure with values from a track.... done." << endl;
1148  return;
1149 }
Float_t shower_yb[5000]
Definition: ShowRec.h:374
Float_t shower_tyb[5000]
Definition: ShowRec.h:377
Float_t shower_deltathetab[5000]
Definition: ShowRec.h:379
Float_t shower_zb[5000]
Definition: ShowRec.h:375
Float_t shower_deltarb[5000]
Definition: ShowRec.h:378
Float_t shower_xb[5000]
Definition: ShowRec.h:373
Float_t shower_txb[5000]
Definition: ShowRec.h:376
int sizeb
Definition: check_shower.C:38
Definition: EdbSegP.h:18
Float_t TX() const
Definition: EdbSegP.h:172
Float_t X() const
Definition: EdbSegP.h:170
Float_t Z() const
Definition: EdbSegP.h:150
Float_t Y() const
Definition: EdbSegP.h:171
void PrintNice() const
Definition: EdbSegP.cxx:418
Float_t TY() const
Definition: EdbSegP.h:173
float X0
Definition: emthickness.cpp:69
float Y0
Definition: emthickness.cpp:70
UInt_t id
Definition: tlg2pattern.C:118

◆ GetRecoShowerArrayN()

Int_t EdbShowAlgE_Simple::GetRecoShowerArrayN ( ) const
inline
163  {
164  return eRecoShowerArrayN;
165  }

◆ GetSpecifications()

void EdbShowAlgE_Simple::GetSpecifications ( )
640  {
641  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::GetSpecifications" << endl;
642  cout << "EdbShowAlgE_Simple::GetSpecifications ... nothing done here yet ... " << endl;
643  return;
644 }

◆ GetSpecType()

Int_t EdbShowAlgE_Simple::GetSpecType ( Int_t  SpecificationType)
inline
235  {
236  return eSpecificationType[SpecificationType];
237  }
Int_t eSpecificationType[6]
Definition: EdbShowAlgE_Simple.h:59

◆ Help()

void EdbShowAlgE_Simple::Help ( )
1393 {
1394  cout << "-------------------------------------------------------------------------------------------"<< endl<< endl;
1395  cout << "EdbShowAlgE_Simple::Help:"<<endl;
1396  cout << "EdbShowAlgE_Simple::Help:"<<endl;
1397  cout << "EdbShowAlgE_Simple::Help: The easiest way: "<<endl;
1398  cout << "EdbShowAlgE_Simple::Help: EdbShowAlgE_Simple* ShowerAlgE1 = new EdbShowAlgE_Simple(); "<<endl;
1399  cout << "EdbShowAlgE_Simple::Help: ShowerAlgE1->DoRun(RecoShowerArray); // RecoShowerArray an TObjArray of EdbTrackP* "<<endl;
1400  cout << "EdbShowAlgE_Simple::Help: ShowerAlgE1->WriteNewRootFile(); "<<endl;
1401  cout << "EdbShowAlgE_Simple::Help: "<<endl;
1402  cout << "EdbShowAlgE_Simple::Help: In shower_E.C // E.C you find more hints...."<<endl;
1403  cout << "EdbShowAlgE_Simple::Help: Updates will follow........"<<endl;
1404  cout << "-------------------------------------------------------------------------------------------"<< endl<< endl;
1405 }

◆ Init()

void EdbShowAlgE_Simple::Init ( void  )
protected
130 {
131  // This Plate Binnning is the _final_binning and will not be refined furthermore!
132  ePlateBinning[0]=10;
133  ePlateBinning[1]=12;
134  ePlateBinning[2]=14;
135  ePlateBinning[3]=16;
136  ePlateBinning[4]=18;
137  ePlateBinning[5]=20;
138  ePlateBinning[6]=23;
139  ePlateBinning[7]=26;
140  ePlateBinning[8]=29;
141  ePlateBinning[9]=32;
142  ePlateBinning[10]=35;
143  ePlateBinning[11]=40;
144  ePlateBinning[12]=45;
145  ePlateBinning[13]=45;
146  ePlateBinning[14]=45; // 12,13,14 are the same, cause I have seen that it makes no sense to produce these,
147  // since E,and sigmaE for 45 plates doesnt change anymore at all...
148 
149  ePlateNumber=20; // 20 plates by default...
150  eSpecificationType[0] = 1; // cp files by default...
151  eSpecificationType[1] = 1; // ele by default...
152  eSpecificationType[2] = 0; // neuch eff by default...
153  eSpecificationType[3] = 0; // 0..20 GeV by default...
154  eSpecificationType[4] = 0; // next before weight by default...
155  eSpecificationType[5] = 5; // 20 plates by default...
156 
157  eSpecificationTypeString[0]="CP";
158  eSpecificationTypeString[1]="GAMMA";
159  eSpecificationTypeString[2]="Neuch";
160  eSpecificationTypeString[3]="TypeA";
161  eSpecificationTypeString[4]="Next";
162  eSpecificationTypeString[5]="20";
163 
164  for (int i=0; i<15; i++) {
166  }
167 
168  EffFunc_all = new TF1("all","1.0-0.00000001*x",0,0.95);
169  EffFunc_edefault = new TF1("default","0.94-0.216*x-0.767*x*x+1.865*x*x*x",0,0.95);
170  EffFunc_elletroni = new TF1("elletroni","0.79+0.38*x-7.63*x*x+25.13*x*x*x-24.6*x*x*x*x",0,0.95);
171  EffFunc_neuchmicro = new TF1("neuchmicro","0.94-0.955*x+1.80*x*x-0.95*x*x*x",0,0.95);
172  EffFunc_MiddleFix = new TF1("MiddleFix","0.5*(0.888361-1.299*x+1.49198*x*x+1.64668*x*x*x-2.63758*x*x*x*x+0.79+0.38*x-7.63*x*x+25.13*x*x*x-24.6*x*x*x*x)",0,0.95);
173  EffFunc_LowEff = new TF1("LowEff","0.85*0.5*(0.888361-1.299*x+1.49198*x*x+1.64668*x*x*x-2.63758*x*x*x*x+0.79+0.38*x-7.63*x*x+25.13*x*x*x-24.6*x*x*x*x)",0,0.95);
174  EffFunc_UserEfficiency = new TF1("EffFunc_UserEfficiency","0.94-0.955*x+1.80*x*x-0.95*x*x*x",0,0.95); //new TSpline3();
175 
176 
177  // Standard supposed efficiency of the showers/tracks that are to be evaluated:
178  // The correct EffFunc_* is then choosen by taking the closes eff func to that one.
179  // Initial parameters are the efficiency parameters for the "Neuch" parametrisation
180  Double_t xarr[7]= {0,0.1,0.2,0.3,0.4,0.5,0.6};
181  Double_t yarr[7]= {0.95,0.9,0.80,0.75,0.6,0.5,0.4};
183  eEfficiencyParametrisation = new TSpline3("",xarr,yarr,5,0,0,0.65);
184 
185  eHisto_nbtk_av = new TH1D("eHisto_nbtk_av","Average basetrack numbers",21,0.0,10.0);
186  eHisto_longprofile_av = new TH1D("eHisto_longprofile_av","Basetracks per emulsion number",57,0.0,57.0);
187  eHisto_transprofile_av = new TH1D("eHisto_transprofile_av","Basetracks in trans distance",8,0.0,800.0);
188  eHisto_deltaR_mean = new TH1D("eHisto_deltaR_mean","Mean #deltar of all BTs in one shower",100,0.0,100.0);
189  eHisto_deltaT_mean = new TH1D("eHisto_deltaT_mean","Mean #delta#theta of all BTs in one shower",100,0.0,0.1);
190  eHisto_deltaR_rms = new TH1D("eHisto_deltaR_rms","RMS #deltar of all BTs in one shower",100,0.0,100.0);
191  eHisto_deltaT_rms = new TH1D("eHisto_deltaT_rms","RMS #delta#theta of all BTs in one shower",100,0.0,0.1);
192  eHisto_nbtk = new TH1D("eHisto_nbtk","Basetracks in the shower",50,0.0,100.0);
193  eHisto_longprofile = new TH1D("eHisto_longprofile","Basetracks per emulsion number",57,0.0,57.0);
194  eHisto_deltaR = new TH1D("eHisto_deltaR","Single #deltar of all BTs in Shower",100,0.0,150.0);
195  eHisto_deltaT = new TH1D("eHisto_deltaT","Single #delta#theta of all BTs in Shower",150,0.0,0.15);
196  eHisto_transprofile = new TH1D("eHisto_transprofile","Basetracks in trans distance",8,0.0,800.0);
197 
198  // CreateANN
199  CreateANN();
200 
201  //First Time, we also Update()
202  Update();
203 
204  // Set Strings:
205  InitStrings();
206 
207  // Create EnergyArray
208  eEnergyArray=new TArrayF(99999); // no way to adapt tarrayF on the fly...
209  eEnergyArrayUnCorrected=new TArrayF(99999);
210  eEnergyArraySigmaCorrected=new TArrayF(99999);
211 
212  // Read Energy Resolution Lookup tables:
213  ReadTables();
214 
215  cout << "EdbShowAlgE_Simple::Init()...done."<< endl;
216  return;
217 }
void Update()
Definition: EdbShowAlgE_Simple.cxx:718
Int_t ANN_nPlates_ARRAY[15]
Definition: EdbShowAlgE_Simple.h:74
void CreateANN()
Definition: EdbShowAlgE_Simple.cxx:244
void ReadTables()
Definition: EdbShowAlgE_Simple.cxx:1428
TString eSpecificationTypeString[6]
Definition: EdbShowAlgE_Simple.h:60
void InitStrings()
Definition: EdbShowAlgE_Simple.cxx:222

◆ InitStrings()

void EdbShowAlgE_Simple::InitStrings ( )
223 {
224  cout << "EdbShowAlgE_Simple::InitStrings()"<< endl;
227  eSpecificationTypeStringArray[1][0]="GAMMA";
228  eSpecificationTypeStringArray[1][1]="ELECTRON";
229  eSpecificationTypeStringArray[2][0]="Neuch";
230  eSpecificationTypeStringArray[2][1]="All";
231  eSpecificationTypeStringArray[2][2]="MiddleFix";
232  eSpecificationTypeStringArray[2][3]="Low";
233  eSpecificationTypeStringArray[3][0]="TypeA";
234  eSpecificationTypeStringArray[3][1]="TypeABCD";
235  eSpecificationTypeStringArray[4][0]="Next";
236  eSpecificationTypeStringArray[4][1]="Before";
238  cout << "EdbShowAlgE_Simple::InitStrings()...done."<< endl;
239  return;
240 }
TString eSpecificationTypeStringArray[6][6]
Definition: EdbShowAlgE_Simple.h:61

◆ LoadSpecificationWeightFile()

void EdbShowAlgE_Simple::LoadSpecificationWeightFile ( )
673  {
674  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::LoadSpecificationWeightFile from the following specifications:" << endl;
676  TString weigth="NULL";
677  return;
678 }
void PrintSpecifications()
Definition: EdbShowAlgE_Simple.cxx:648

◆ Print()

void EdbShowAlgE_Simple::Print ( )
1180  {
1181  cout << "-------------------------------------------------------------------------------------------"<< endl;
1182  cout << "EdbShowAlgE_Simple::Print " << endl;
1184 
1185  cout << "EdbShowAlgE_Simple::Print Now correction factors and weightfilestrings:" << endl;
1186  for (int i=0; i<15; i++) {
1187  cout << "EdbShowAlgE_Simple::Print eANN_MLP_CORR_0[" << i << "]="<<eANN_MLP_CORR_0[i] << endl;
1188  cout << "EdbShowAlgE_Simple::Print eANN_MLP_CORR_1[" << i << "]="<<eANN_MLP_CORR_1[i] << endl;
1189  cout << "EdbShowAlgE_Simple::Print ANN_WeightFile_ARRAY[" << i << "]="<<ANN_WeightFile_ARRAY[i] << endl;
1190  }
1191 
1192  cout << "EdbShowAlgE_Simple::Print ...done." << endl;
1193  cout << "-------------------------------------------------------------------------------------------"<< endl << endl;
1194  return;
1195 }

◆ PrintEfficiencyParametrisation()

void EdbShowAlgE_Simple::PrintEfficiencyParametrisation ( )
1412 {
1413  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation for angles theta=0,0.1,..,0.6:" << endl;
1414  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0): "<< eEfficiencyParametrisation->Eval(0)<< endl;
1415  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.1): "<< eEfficiencyParametrisation->Eval(0.1)<< endl;
1416  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.2): "<< eEfficiencyParametrisation->Eval(0.2)<< endl;
1417  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.3): "<< eEfficiencyParametrisation->Eval(0.3)<< endl;
1418  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.4): "<< eEfficiencyParametrisation->Eval(0.4)<< endl;
1419  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.5): "<< eEfficiencyParametrisation->Eval(0.5)<< endl;
1420  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.6): "<< eEfficiencyParametrisation->Eval(0.6)<< endl;
1421  return;
1422 }

◆ PrintSpecifications()

void EdbShowAlgE_Simple::PrintSpecifications ( )
648  {
649  cout << "EdbShowAlgE_Simple::PrintSpecifications" << endl;
650  cout << "EdbShowAlgE_Simple:: eSpecificationType[0] (Dataset: (linked tracks/full cp) LT/CP) = " << GetSpecType(0) << endl;
651  cout << "EdbShowAlgE_Simple:: eSpecificationType[1] (ShowerID: gamma/electron/pion weight) = " << GetSpecType(1) << endl;
652  cout << "EdbShowAlgE_Simple:: eSpecificationType[2] (ScanEff: Neuch/All/MiddleFix/LowEff) = " << GetSpecType(2) << endl;
653  cout << "EdbShowAlgE_Simple:: eSpecificationType[3] (E range: 0..20/0..40) = " << GetSpecType(3) << endl;
654  cout << "EdbShowAlgE_Simple:: eSpecificationType[4] (Npl weight: next before/after) = " <<GetSpecType(4) << endl;
655  cout << "EdbShowAlgE_Simple:: eSpecificationType[5] (Npl weight: 10,12,...,45) = " << GetSpecType(5) << endl;
656  cout << "EdbShowAlgE_Simple:: " << endl;
657  cout << "EdbShowAlgE_Simple:: eSpecificationTypeString[0] (take CP or linked_tracks) = " << eSpecificationTypeString[0] << endl;
658  cout << "EdbShowAlgE_Simple:: eSpecificationTypeString[1] (gamma/electron/pion weight) = " << eSpecificationTypeString[1] << endl;
659  cout << "EdbShowAlgE_Simple:: eSpecificationTypeString[2] (ScanEff: Neuch/All/MiddleFix/LowEff) = " << eSpecificationTypeString[2] << endl;
660  cout << "EdbShowAlgE_Simple:: eSpecificationTypeString[3] (E range: 0..20/0..40) = " << eSpecificationTypeString[3] << endl;
661  cout << "EdbShowAlgE_Simple:: eSpecificationTypeString[4] (Npl weight: next before/after) = " << eSpecificationTypeString[4] << endl;
662  cout << "EdbShowAlgE_Simple:: eSpecificationTypeString[5] (Npl weight: 10,12,...,45) = " << eSpecificationTypeString[5] << endl;
663  cout << "EdbShowAlgE_Simple:: " << endl;
664  cout << "EdbShowAlgE_Simple:: In case you want to change a specification then do for example:" << endl;
665  cout << "EdbShowAlgE_Simple:: EdbShowAlgE_Simple->SetSpecification(2,3) " << endl;
666  cout << "EdbShowAlgE_Simple:: It will change the ScanEff from the actual value to _Low_." << endl;
667 
668  return;
669 }

◆ ReadCorrectionFactors()

void EdbShowAlgE_Simple::ReadCorrectionFactors ( TString  weigthstring,
Float_t &  p0,
Float_t &  p1 
)
1153  {
1154  // Read Linear Correction factors p0 p1 from this file.
1155  // Format: p0 p1
1156  float pp0,pp1;
1157  const char* name=weigthstring.Data();
1158  FILE * pFile=NULL;
1159  if (gEDBDEBUGLEVEL >2) cout << " open file " << endl;
1160  pFile = fopen (name,"r");
1161  if (NULL==pFile) return;
1162  int dummy = fscanf (pFile, "%f %f", &pp0, &pp1);
1163  if (dummy!=2) {
1164  cout << "EdbShowAlgE_Simple::ReadCorrectionFactors ERROR! Wrong formatted file! Could not read the two parameters! Set them to default values! Please check if the weightfiles in...: "<< endl;
1165  cout << weigthstring.Data() << endl;
1166  cout << "EdbShowAlgE_Simple::ReadCorrectionFactors ... exist!"<< endl;
1167  p0=0.0;
1168  p1=1.0;
1169  }
1170  p0=pp0;
1171  p1=pp1;
1172  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::ReadCorrectionFactors p0: " << p0 << " p1 " << p1 << endl;
1173  if (gEDBDEBUGLEVEL >2) printf ("I have read: %f and %f , in total %d arguments.\n",pp0,pp1,dummy);
1174  fclose (pFile);
1175  return;
1176 }
Int_t dummy
Definition: merge_Energy_SytematicSources_Electron.C:7
fclose(pFile)
pFile
Definition: merge_Energy_SytematicSources_Electron.C:25
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24
#define NULL
Definition: nidaqmx.h:84

◆ ReadTables()

void EdbShowAlgE_Simple::ReadTables ( )
1429 {
1430  cout << "EdbShowAlgE_Simple::ReadTables"<<endl;
1431 
1433 
1434  cout << "EdbShowAlgE_Simple::ReadTables...done."<<endl;
1435  return;
1436 }
void ReadTables_Energy()
Definition: EdbShowAlgE_Simple.cxx:1440

◆ ReadTables_Energy()

void EdbShowAlgE_Simple::ReadTables_Energy ( )
1441 {
1442  cout << "EdbShowAlgE_Simple::ReadTables_Energy"<<endl;
1443 
1444  char name [100];
1445  FILE * fFile;
1446 
1447  Int_t N_E=12;
1448  Int_t N_NPL=13;
1449  Int_t NPL[13]= {10,12,14,16,18,20,23,26,29,32,35,40,45};
1450  Double_t E[12] = {0.5,1.0,2.0, 4.0, 0.75, 1.5, 3.0, 6.0, 8.0, 16.0, 32.0 ,64.0};
1451  Int_t E_ASCEND[12] = {0,4,1,5,2,6,3,7,8,9,10,11};
1452  Int_t npl;
1453  Float_t energyresolution;
1454  Double_t E_Array_Ascending[12]= {0.5,0.75,1.0,1.5,2.0,3.0,4.0,6.0, 8.0, 16.0, 32.0 ,64.0};
1455  Double_t E_Resolution[12]= {0.5,0.75,1.0,1.5,2.0,3.0,4.0,6.0, 8.0, 16.0, 32.0 ,64.0}; // initialize with 100% resolution...
1456 
1457  // First Create the ObjArray storing the Splines...
1458  eSplineArray_Energy_Stat_Electron = new TObjArray();
1459  eSplineArray_Energy_Stat_Gamma = new TObjArray();
1460  eSplineArray_Energy_Sys_Electron = new TObjArray();
1461  eSplineArray_Energy_Sys_Gamma = new TObjArray();
1462 
1463  // A) Table: Statistics: Electrons: "libShower_Energy_Statistics_Electron.txt"
1464  sprintf(name,"tables/libShower_Energy_Statistics_Electron.txt");
1465  fFile = fopen (name,"r");
1466  cout << "EdbShowAlgE_Simple::ReadTables_Energy() name = " << name << endl;
1467 
1468  for (int i=0; i<N_NPL; i++) {
1469  // Read energy values into array:
1470  int narg=fscanf(fFile, "%d ",&npl);
1471  cout << "NPL= " << npl << endl;
1472  for (int j=0; j<N_E-1; j++) {
1473  int narg=fscanf(fFile, "%f",&energyresolution);
1474  E_Resolution[j]=(Double_t)energyresolution;
1475  cout << " energyresolution @ " << E_Array_Ascending[j] << " = " << energyresolution << endl;
1476  }
1477  narg=fscanf(fFile, "%f \n",&energyresolution);
1478  E_Resolution[N_E-1]=(Double_t)energyresolution;
1479  cout << " energyresolution @ " << E_Array_Ascending[N_E-1] << " = " << energyresolution << endl;
1480 
1481  TString splinename=TString(Form("Spline_Stat_Electron_Npl_%d",NPL[i]));
1482  TSpline3* Spline = new TSpline3(splinename,E_Array_Ascending,E_Resolution,10);
1483 
1484  cout << "Created Spline. Add Spline to ObjArray." << endl;
1485  eSplineArray_Energy_Stat_Electron->Add(Spline);
1486  }
1487  fclose (fFile);
1488 
1489 
1490  // B) Table: Statistics: Gamma: "libShower_Energy_Statistics_Gamma.txt"
1491  sprintf(name,"tables/libShower_Energy_Statistics_Gamma.txt");
1492  fFile = fopen (name,"r");
1493  cout << "EdbShowAlgE_Simple::ReadTables_Energy() name = " << name << endl;
1494 
1495  for (int i=0; i<N_NPL; i++) {
1496  // Read energy values into array:
1497  int narg=fscanf(fFile, "%d ",&npl);
1498  cout << "NPL= " << npl << endl;
1499  for (int j=0; j<N_E-1; j++) {
1500  int narg=fscanf(fFile, "%f",&energyresolution);
1501  E_Resolution[j]=(Double_t)energyresolution;
1502  cout << " energyresolution @ " << E_Array_Ascending[j] << " = " << energyresolution << endl;
1503  }
1504  narg=fscanf(fFile, "%f \n",&energyresolution);
1505  E_Resolution[N_E-1]=(Double_t)energyresolution;
1506  cout << " energyresolution @ " << E_Array_Ascending[N_E-1] << " = " << energyresolution << endl;
1507 
1508  TString splinename=TString(Form("Spline_Stat_Electron_Npl_%d",NPL[i]));
1509  TSpline3* Spline = new TSpline3(splinename,E_Array_Ascending,E_Resolution,10);
1510 
1511  cout << "Created Spline. Add Spline to ObjArray." << endl;
1512  eSplineArray_Energy_Stat_Gamma->Add(Spline);
1513  }
1514  fclose (fFile);
1515 
1516 
1517 
1518  // C) Table: Systematics: Electrons: "libShower_Energy_Systematics_Electron.txt"
1519  sprintf(name,"tables/libShower_Energy_Systematics_Electron.txt");
1520  fFile = fopen (name,"r");
1521  cout << "EdbShowAlgE_Simple::ReadTables_Energy() name = " << name << endl;
1522 
1523  for (int i=0; i<N_NPL; i++) {
1524  // Read energy values into array:
1525  int narg=fscanf(fFile, "%d ",&npl);
1526  cout << "NPL= " << npl << endl;
1527  for (int j=0; j<N_E-1; j++) {
1528  int narg=fscanf(fFile, "%f",&energyresolution);
1529  E_Resolution[j]=(Double_t)energyresolution;
1530  cout << " energyresolution @ " << E_Array_Ascending[j] << " = " << energyresolution << endl;
1531  }
1532  narg=fscanf(fFile, "%f \n",&energyresolution);
1533  E_Resolution[N_E-1]=(Double_t)energyresolution;
1534  cout << " energyresolution @ " << E_Array_Ascending[N_E-1] << " = " << energyresolution << endl;
1535 
1536  TString splinename=TString(Form("Spline_Sysy_Electron_Npl_%d",NPL[i]));
1537  TSpline3* Spline = new TSpline3(splinename,E_Array_Ascending,E_Resolution,10);
1538 
1539  cout << "Created Spline. Add Spline to ObjArray." << endl;
1540  eSplineArray_Energy_Sys_Electron->Add(Spline);
1541  }
1542  fclose (fFile);
1543 
1544 
1545  // D) Table: Systematics: Gamma: "libShower_Energy_Systematics_Gamma.txt"
1546  sprintf(name,"tables/libShower_Energy_Systematics_Gamma.txt");
1547  fFile = fopen (name,"r");
1548  cout << "EdbShowAlgE_Simple::ReadTables_Energy() name = " << name << endl;
1549 
1550  for (int i=0; i<N_NPL; i++) {
1551  // Read energy values into array:
1552  int narg=fscanf(fFile, "%d ",&npl);
1553  cout << "NPL= " << npl << endl;
1554  for (int j=0; j<N_E-1; j++) {
1555  int narg=fscanf(fFile, "%f",&energyresolution);
1556  E_Resolution[j]=(Double_t)energyresolution;
1557  cout << " energyresolution @ " << E_Array_Ascending[j] << " = " << energyresolution << endl;
1558  }
1559  narg=fscanf(fFile, "%f \n",&energyresolution);
1560  E_Resolution[N_E-1]=(Double_t)energyresolution;
1561  cout << " energyresolution @ " << E_Array_Ascending[N_E-1] << " = " << energyresolution << endl;
1562 
1563  TString splinename=TString(Form("Spline_Sysy_Electron_Npl_%d",NPL[i]));
1564  TSpline3* Spline = new TSpline3(splinename,E_Array_Ascending,E_Resolution,10);
1565 
1566  cout << "Created Spline. Add Spline to ObjArray." << endl;
1567  eSplineArray_Energy_Sys_Gamma->Add(Spline);
1568  }
1569  fclose (fFile);
1570 
1571 
1572  cout << "EdbShowAlgE_Simple::ReadTables_Energy...done."<<endl;
1573  return;
1574 }
TObjArray * eSplineArray_Energy_Stat_Electron
Definition: EdbShowAlgE_Simple.h:134
TObjArray * eSplineArray_Energy_Sys_Electron
Definition: EdbShowAlgE_Simple.h:136

◆ Set0()

void EdbShowAlgE_Simple::Set0 ( )
protected
91 {
92  // Reset Values
98  ePlateNumber=20;
100 
101  eWeightFileString="NULL";
102  for (int i=0; i<6; i++) {
103  eSpecificationType[i]=-1;
105  }
106  for (int i=0; i<15; i++) {
107  ANN_MLP_ARRAY[i]=NULL;
108  eANN_MLP_CORR_0[i]=0.0;
109  eANN_MLP_CORR_1[i]=1.0;
110  }
112 
113  // Reset "eEfficiencyParametrisation" to the "Neuch" eff.
114  cout << "EdbShowAlgE_Simple::Set0() Reset to the Neuch eff." << endl;
115  Double_t xarr[6]= {0,0.1,0.2,0.3,0.4,0.5};
116  Double_t yarr[6]= {0.95,0.9,0.80,0.75,0.6,0.5};
118  eEfficiencyParametrisation = new TSpline3("",xarr,yarr,5,0,0,0.6);
119  cout << "EdbShowAlgE_Simple::Set0() Reset to the Neuch eff. ...done." << endl;
120 
121 
122  cout << "EdbShowAlgE_Simple::Set0()...done."<< endl;
123  return;
124 }
Bool_t eSpecificationIsChanged
Definition: EdbShowAlgE_Simple.h:62

◆ SetCalibrationOffset()

void EdbShowAlgE_Simple::SetCalibrationOffset ( Float_t  CalibrationOffset)
inline
222  {
223  eCalibrationOffset=CalibrationOffset;
224  }

◆ SetCalibrationSlope()

void EdbShowAlgE_Simple::SetCalibrationSlope ( Float_t  CalibrationSlope)
inline
225  {
226  eCalibrationSlope=CalibrationSlope;
227  }

◆ SetEfficiencyParametrisation()

void EdbShowAlgE_Simple::SetEfficiencyParametrisation ( TSpline3 *  EfficiencyParametrisation)
inline
241  {
242  eEfficiencyParametrisation=EfficiencyParametrisation;
243  EfficiencyParametrisation->Print();
244  }

◆ SetEfficiencyParametrisationAngles()

void EdbShowAlgE_Simple::SetEfficiencyParametrisationAngles ( )
1581 {
1582  //EffFunc_UserEfficiency->Set
1583  return;
1584 }

◆ SetEfficiencyParametrisationValues()

void EdbShowAlgE_Simple::SetEfficiencyParametrisationValues ( Double_t *  Angles,
Double_t *  EffValuesAtAngles 
)
1589 {
1590  cout << "EdbShowAlgE_Simple::SetEfficiencyParametrisationValues()" << endl;
1591  cout << "ATTENTION: Array has to consist of efficiencies at !seven! angles: 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6..." << endl;
1592  cout << "ATTENTION: If not, then it might crash! " << endl;
1593  // Set User Efficiency Angles by hand!
1594  // This is interface routine which than can be used by eda...
1596  eEfficiencyParametrisation = new TSpline3("",Angles,EffValuesAtAngles,5,0,0,0.6);
1597 
1598  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation for angles theta=0,0.1,..,0.6:" << endl;
1599  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0): "<< eEfficiencyParametrisation->Eval(0)<< endl;
1600  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.1): "<< eEfficiencyParametrisation->Eval(0.1)<< endl;
1601  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.2): "<< eEfficiencyParametrisation->Eval(0.2)<< endl;
1602  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.3): "<< eEfficiencyParametrisation->Eval(0.3)<< endl;
1603  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.4): "<< eEfficiencyParametrisation->Eval(0.4)<< endl;
1604  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.5): "<< eEfficiencyParametrisation->Eval(0.5)<< endl;
1605  cout << "EdbShowAlgE_Simple::eEfficiencyParametrisation->Eval(0.6): "<< eEfficiencyParametrisation->Eval(0.6)<< endl;
1606  return;
1607 }

◆ SetPlateNumber()

void EdbShowAlgE_Simple::SetPlateNumber ( Int_t  PlateNumber)
inline
232  {
233  ePlateNumber=PlateNumber;
234  }

◆ SetPlateNumberType()

void EdbShowAlgE_Simple::SetPlateNumberType ( Int_t  PlateNumberType)
inline
229  {
230  ePlateNumberType=PlateNumberType;
231  }

◆ SetRecoShowerArray()

void EdbShowAlgE_Simple::SetRecoShowerArray ( TObjArray *  RecoShowerArray)
inline
156  {
158  eRecoShowerArrayN=eRecoShowerArray->GetEntriesFast();
159  }

◆ SetRecoShowerArrayN()

void EdbShowAlgE_Simple::SetRecoShowerArrayN ( Int_t  RecoShowerArrayN)
inline
160  {
161  eRecoShowerArrayN=RecoShowerArrayN;
162  }

◆ SetSpecifications()

void EdbShowAlgE_Simple::SetSpecifications ( Int_t  sp0,
Int_t  sp1,
Int_t  sp2,
Int_t  sp3,
Int_t  sp4,
Int_t  sp5 
)
682  {
683  eSpecificationType[0]=sp0;
684  eSpecificationType[1]=sp1;
685  eSpecificationType[2]=sp2;
686  eSpecificationType[3]=sp3;
687  eSpecificationType[4]=sp4;
688  eSpecificationType[5]=sp5;
691  Update();
692  return;
693 }

◆ SetSpecificationType()

void EdbShowAlgE_Simple::SetSpecificationType ( Int_t  SpecificationType,
Int_t  SpecificationTypeVal 
)
699 {
700  if (GetSpecType(SpecificationType)==SpecificationTypeVal) return;
701  if (gEDBDEBUGLEVEL >1) cout << "EdbShowAlgE_Simple:: Change Specification (" << SpecificationType << ") from " << GetSpecType(SpecificationType) << " -> " << SpecificationTypeVal << " . Reprint the changed Specification String: " << endl;
702 
703  eSpecificationType[SpecificationType]=SpecificationTypeVal;
704 
705  eSpecificationTypeString[SpecificationType] = eSpecificationTypeStringArray[SpecificationType][SpecificationTypeVal];
706  if (gEDBDEBUGLEVEL >1) cout << eSpecificationTypeString[SpecificationType] << endl;
708 
709  cout << "Reprint Specifications: " << endl;
711 
712  Update();
713  return;
714 }

◆ SetWeightFileString()

void EdbShowAlgE_Simple::SetWeightFileString ( TString  weightstring)
526 {
527  eWeightFileString=weightstring;
528  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::SetWeightFileString() eWeightFileString = " << eWeightFileString << endl;
529  return;
530 }

◆ TrainNeuralNetwork()

void EdbShowAlgE_Simple::TrainNeuralNetwork ( TString  weight,
Int_t  ANNType = 0 
)
inline
210  {
211  if (ANNType>=15) ANNType=14;
212  ANN_MLP_ARRAY[ANNType]->Train(100);
213  return;
214  }

◆ Update()

void EdbShowAlgE_Simple::Update ( )
718  {
719  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update Does the following things in the order:" << endl;
720  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update * According to the switch: set the right ANN of the Array as generic one." << endl;
721  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update * According to the switch: load the right weightfile as generic one." << endl;
722  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update * According to the switch: set the right correction parameters...." << endl;
723 
724  TString basicstring = TString(gSystem->ExpandPathName("$FEDRA_ROOT"));
725  TString addstring = ("/src/libShower/weights/Energy/");
726 
727  // (*) SpecType 0 :
728  if (eSpecificationType[0]==1) {
729  addstring+="volumeSpec_CP/";
730  eSpecificationTypeString[0]="CP";
731  }
732  else {
733  addstring+="volumeSpec_LT/";
734  eSpecificationTypeString[0]="LT";
735  cout << "EdbShowAlgE_Simple::Update WARNING::eSpecificationTypeString[0]=LT NOT YET SUPPORTED!" << endl;
736  }
737 
738  // (*) SpecType 1 :
739  if (eSpecificationType[1]==2) {
740  addstring+="particleSpec_pion/";
741  eSpecificationTypeString[1]="pion";
742  cout << "EdbShowAlgE_Simple::Update WARNING::eSpecificationTypeString[1]=pion NOT YET SUPPORTED!" << endl;
743  }
744  else if (eSpecificationType[1]==1) {
745  addstring+="particleSpec_electron/";
746  eSpecificationTypeString[1]="electron";
747  }
748  else {
749  addstring+="particleSpec_gamma/";
750  eSpecificationTypeString[1]="gamma";
751  }
752 
753  // (*) SpecType 2 :
754  if (eSpecificationType[2]==3) {
755  addstring+="efficiencySpec_LowEff/";
756  eSpecificationTypeString[2]="LowEff";
757  }
758  else if (eSpecificationType[2]==2) {
759  addstring+="efficiencySpec_MiddleFix/";
760  eSpecificationTypeString[2]="MiddleFix";
761  }
762  else if (eSpecificationType[2]==1) {
763  addstring+="efficiencySpec_All/";
764  eSpecificationTypeString[2]="All";
765  }
766  else {
767  addstring+="efficiencySpec_Neuch/";
768  eSpecificationTypeString[2]="Neuch";
769  }
770 
771  // (*) SpecType 3 :
772  if (eSpecificationType[3]==1) {
773  addstring+="trainrangeSpec_extended/";
774  eSpecificationTypeString[3]="extended";
775  cout << "EdbShowAlgE_Simple::Update WARNING::eSpecificationTypeString[3]=extended NOT YET SUPPORTED!" << endl;
776  }
777  else {
778  addstring+="trainrangeSpec_normal/";
779  eSpecificationTypeString[3]="normal";
780  }
781 
782  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update " << addstring << endl;
783 
784  if (NULL==ANN_MLP_ARRAY[0]) {
785  CreateANN();
786  }
787 
788  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update Now load the different ANN weightstrings:" << endl;
789  // This was the loading part for the ANN and
790  // this is the loading part for the Correction Factors, which we take from the
791  // generic file EnergyCorrections_Npl_%d.txt
792  for (int ll=0; ll<15; ll++) {
793  TString weigthstring=basicstring+addstring+TString(Form("weights_Npl_%d.txt",ANN_nPlates_ARRAY[ll]));
794  if (gEDBDEBUGLEVEL >2) cout << "weigthstring = " << weigthstring << endl;
795  ANN_MLP_ARRAY[ll]->LoadWeights(weigthstring);
796  ANN_WeightFile_ARRAY[ll]=weigthstring;
797 
798  TString correctionsfactorstring=basicstring+addstring+TString(Form("EnergyCorrections_Npl_%d.txt",ANN_nPlates_ARRAY[ll]));
799  if (gEDBDEBUGLEVEL >2) cout << "correctionsfactorstring = " << correctionsfactorstring << endl;
800  Float_t p0,p1;
801  p0=0.0;
802  p1=1.0;
803  if (ll<10) ReadCorrectionFactors(correctionsfactorstring,p0,p1);
804 // Correction files for ll>11 dont exist yet..
805  eANN_MLP_CORR_0[ll]=p0;
806  eANN_MLP_CORR_1[ll]=p1;
807 
808  }
809  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update * According to the switch: set the right ANN of the Array as generic one." << endl;
810 
811  // (*) SpecType 4:
812  // Get NplIndexNr:
813  int check_Npl_index=0;
814  GetNplIndexNr(ePlateNumber,check_Npl_index, eSpecificationType[4]);
815 
816  if (check_Npl_index==0) eSpecificationTypeString[4]="Next";
817  if (check_Npl_index==1) eSpecificationTypeString[4]="Before";
818  eSpecificationTypeString[5]=TString(Form("%d",ePlateNumber));
819 
820  // Set Generic ANN_Layout
821  ANN_MLP=ANN_MLP_ARRAY[check_Npl_index];
822 
823  if (gEDBDEBUGLEVEL >2) cout << "EdbShowAlgE_Simple::Update WARNING:: Weightfiles for _LT_ not produced yet!...." << endl;
824  return;
825 }
void ReadCorrectionFactors(TString weigthstring, Float_t &p0, Float_t &p1)
Definition: EdbShowAlgE_Simple.cxx:1153

◆ WriteNewRootFile()

void EdbShowAlgE_Simple::WriteNewRootFile ( )

eShowerTree->SetBranchAddress("output", &shower_output);

1200 {
1201  cout << "-------------------------------------------------------------------------------------------"<< endl;
1202  cout << endl;
1203  cout << "EdbShowAlgE_Simple::WriteNewRootFile -------------------------------------------"<< endl;
1204  cout << "EdbShowAlgE_Simple::WriteNewRootFile This is NOT a good solution! But what shall" << endl;
1205  cout << "EdbShowAlgE_Simple::WriteNewRootFile I do?" << endl;
1206  cout << "EdbShowAlgE_Simple::WriteNewRootFile We rewrite completely the new tree and add " << endl;
1207  cout << "EdbShowAlgE_Simple::WriteNewRootFile the new calculated energy values to it..." << endl;
1208  cout << "EdbShowAlgE_Simple::WriteNewRootFile -------------------------------------------"<< endl;
1209  cout << endl;
1210 
1211  //- VARIABLES: shower_ "treebranch" reconstruction
1215  Float_t shower_xb[5000];
1216  Float_t shower_yb[5000];
1217  Float_t shower_zb[5000];
1218  Float_t shower_txb[5000];
1219  Float_t shower_tyb[5000];
1220  Float_t shower_deltarb[5000];
1221  Float_t shower_deltathetab[5000];
1222  Float_t shower_deltaxb[5000];
1223  Float_t shower_deltayb[5000];
1224  Int_t shower_nfilmb[5000];
1225  Float_t shower_chi2btkb[5000];
1226  Int_t shower_ntrace1simub[5000]; // MCEvt
1227  Int_t shower_ntrace2simub[5000]; // s->W()
1228  Float_t shower_ntrace3simub[5000]; // s->P()
1229  Int_t shower_ntrace4simub[5000]; // s->Flag()
1230  Float_t shower_tagprimary[5000];
1231  Int_t shower_idb[5000];
1232  Int_t shower_plateb[5000];
1233  Float_t shower_deltasigmathetab[58];
1234  Int_t shower_numberofilms;
1235  Float_t shower_purb; // purity of shower
1236  Int_t shower_eProb90;
1237  Int_t shower_eProb1;
1238  Int_t shower_Size; // number of BT in the shower
1239  Int_t shower_Size15; // number of BT in the shower (for 15 films crossed)
1240  Int_t shower_Size20; // number of BT in the shower (for 20 films crossed)
1241  Int_t shower_Size30; // number of BT in the shower (for 30 films crossed)
1242  Float_t shower_output; // Neural Network output for e/pi separation
1243  Float_t shower_output15; // Neural Network output for e/pi separation (for 15 films crossed)
1244  Float_t shower_output20; // Neural Network output for e/pi separation (for 20 films crossed)
1245  Float_t shower_output30; // Neural Network output for e/pi separation (for 30 films crossed)
1246  Float_t shower_output50; // Neural Network output for e/pi separation (for 50 films crossed)
1247  Float_t shower_purityb;
1248  Float_t shower_trackdensb;
1249  Float_t shower_E_MC;
1250  Float_t shower_EnergyCorrectedb;
1251  Float_t shower_EnergyUnCorrectedb;
1252  Float_t shower_EnergySigmaCorrectedb;
1253  Float_t shower_EnergySigmaUnCorrectedb;
1254 
1255  Float_t shower_OldEnergyCorrectedb;
1256  Float_t shower_OldEnergyUnCorrectedb;
1257  Float_t shower_OldEnergySigmaCorrectedb;
1258  Float_t shower_OldEnergySigmaUnCorrectedb;
1259 
1260  //- Old Shower File:
1261  TFile* fileOld = new TFile("Shower.root","READ");
1262  // Set Addresses of treebranch tree:
1263  TTree* eShowerTree = (TTree*)fileOld->Get("treebranch");
1264  cout << "eShowerTree = " << eShowerTree << endl;
1265  eShowerTree->SetBranchAddress("number_eventb",&shower_number_eventb);
1266  eShowerTree->SetBranchAddress("sizeb",&shower_sizeb);
1267  eShowerTree->SetBranchAddress("sizeb15",&shower_sizeb15);
1268  eShowerTree->SetBranchAddress("sizeb20",&shower_sizeb20);
1269  eShowerTree->SetBranchAddress("sizeb30",&shower_sizeb30);
1271  eShowerTree->SetBranchAddress("output15", &shower_output15);
1272  eShowerTree->SetBranchAddress("output20", &shower_output20);
1273  eShowerTree->SetBranchAddress("output30", &shower_output30);
1274  eShowerTree->SetBranchAddress("output50", &shower_output50);
1275  eShowerTree->SetBranchAddress("eProb1", &shower_eProb1);
1276  eShowerTree->SetBranchAddress("eProb90", &shower_eProb90);
1277  eShowerTree->SetBranchAddress("isizeb",&shower_isizeb);
1278  eShowerTree->SetBranchAddress("xb",shower_xb);
1279  eShowerTree->SetBranchAddress("yb",shower_yb);
1280  eShowerTree->SetBranchAddress("zb",shower_zb);
1281  eShowerTree->SetBranchAddress("txb",shower_txb);
1282  eShowerTree->SetBranchAddress("tyb",shower_tyb);
1283  eShowerTree->SetBranchAddress("nfilmb",shower_nfilmb);
1284  eShowerTree->SetBranchAddress("ntrace1simub",shower_ntrace1simub); // s.eMCEvt
1285  eShowerTree->SetBranchAddress("ntrace2simub",shower_ntrace2simub); // s.eW
1286  eShowerTree->SetBranchAddress("ntrace3simub",shower_ntrace3simub); // s.eP
1287  eShowerTree->SetBranchAddress("ntrace4simub",shower_ntrace4simub); // s.eFlag
1288  eShowerTree->SetBranchAddress("chi2btkb",shower_chi2btkb);
1289  eShowerTree->SetBranchAddress("deltarb",shower_deltarb);
1290  eShowerTree->SetBranchAddress("deltathetab",shower_deltathetab);
1291  eShowerTree->SetBranchAddress("deltaxb",shower_deltaxb);
1292  eShowerTree->SetBranchAddress("deltayb",shower_deltayb);
1293  eShowerTree->SetBranchAddress("tagprimary",shower_tagprimary);
1294 // eShowerTree->SetBranchAddress("energy_shot_particle",&shower_energy_shot_particle);
1295  eShowerTree->SetBranchAddress("E_MC",&shower_E_MC);
1296  eShowerTree->SetBranchAddress("showerID",&shower_showerID);
1297  eShowerTree->SetBranchAddress("idb",shower_idb);
1298  eShowerTree->SetBranchAddress("plateb",shower_plateb);
1299 // eShowerTree->SetBranchAddress("deltasigmathetab",shower_deltasigmathetab);
1300 // eShowerTree->SetBranchAddress("lenghtfilmb",&shower_numberofilms);
1301  eShowerTree->SetBranchAddress("purityb",&shower_purityb);
1302  eShowerTree->SetBranchAddress("Energy",&shower_OldEnergyCorrectedb);
1303  eShowerTree->SetBranchAddress("EnergyUnCorrected",&shower_OldEnergyUnCorrectedb);
1304  eShowerTree->SetBranchAddress("EnergySigma",&shower_OldEnergySigmaCorrectedb);
1305  eShowerTree->SetBranchAddress("EnergySigmaUnCorrected",&shower_OldEnergySigmaUnCorrectedb);
1306 
1307 
1308  Int_t nent=eShowerTree->GetEntries();
1309  cout << "EdbShowAlgE_Simple::WriteNewRootFile eShowerTree="<< eShowerTree <<" ------"<< endl;
1310  cout << "EdbShowAlgE_Simple::WriteNewRootFile eShowerTree->GetEntries()="<< nent <<" ------"<< endl;
1311 
1312 
1313  // Create the new File
1314  TFile* fileNew = new TFile("New.root","RECREATE");
1315  // Create the new Tree
1316  TTree* ShowerTreeNew=new TTree("treebranch","treebranch");
1317  cout << "EdbShowAlgE_Simple::WriteNewRootFile ShowerTreeNew="<< ShowerTreeNew <<" ------"<< endl;
1318  // Create the new Branches:
1319  ShowerTreeNew->Branch("number_eventb",&shower_number_eventb,"number_eventb/I");
1320  ShowerTreeNew->Branch("sizeb",&shower_sizeb,"sizeb/I");
1321  ShowerTreeNew->Branch("sizeb15",&shower_sizeb15,"sizeb15/I");
1322  ShowerTreeNew->Branch("sizeb20",&shower_sizeb20,"sizeb20/I");
1323  ShowerTreeNew->Branch("sizeb30",&shower_sizeb30,"sizeb30/I");
1324  ShowerTreeNew->Branch("output15",&shower_output15,"output15/F");
1325  ShowerTreeNew->Branch("output20",&shower_output20,"output20/F");
1326  ShowerTreeNew->Branch("output30",&shower_output30,"output30/F");
1327  ShowerTreeNew->Branch("output50",&shower_output50,"output50/F");
1328  ShowerTreeNew->Branch("eProb90",&shower_eProb90,"eProb90/I");
1329  ShowerTreeNew->Branch("eProb1",&shower_eProb1,"eProb1/I");
1330  ShowerTreeNew->Branch("E_MC",&shower_E_MC,"E_MC/F");
1331  ShowerTreeNew->Branch("idb",shower_idb,"idb[sizeb]/I");
1332  ShowerTreeNew->Branch("plateb",shower_plateb,"plateb[sizeb]/I");
1333  ShowerTreeNew->Branch("showerID",&shower_showerID,"showerID/I");
1334  ShowerTreeNew->Branch("isizeb",&shower_isizeb,"isizeb/I");
1335  ShowerTreeNew->Branch("xb",shower_xb,"xb[sizeb]/F");
1336  ShowerTreeNew->Branch("yb",shower_yb,"yb[sizeb]/F");
1337  ShowerTreeNew->Branch("zb",shower_zb,"zb[sizeb]/F");
1338  ShowerTreeNew->Branch("txb",shower_txb,"txb[sizeb]/F");
1339  ShowerTreeNew->Branch("tyb",shower_tyb,"tyb[sizeb]/F");
1340  ShowerTreeNew->Branch("nfilmb",shower_nfilmb,"nfilmb[sizeb]/I");
1341  ShowerTreeNew->Branch("ntrace1simub",shower_ntrace1simub,"ntrace1simu[sizeb]/I");
1342  ShowerTreeNew->Branch("ntrace2simub",shower_ntrace2simub,"ntrace2simu[sizeb]/I");
1343  ShowerTreeNew->Branch("ntrace3simub",shower_ntrace3simub,"ntrace3simu[sizeb]/F");
1344  ShowerTreeNew->Branch("ntrace4simub",shower_ntrace4simub,"ntrace4simu[sizeb]/I");
1345  ShowerTreeNew->Branch("chi2btkb",shower_chi2btkb,"chi2btkb[sizeb]/F");
1346  ShowerTreeNew->Branch("deltarb",shower_deltarb,"deltarb[sizeb]/F");
1347  ShowerTreeNew->Branch("deltathetab",shower_deltathetab,"deltathetab[sizeb]/F");
1348  ShowerTreeNew->Branch("deltaxb",shower_deltaxb,"deltaxb[sizeb]/F");
1349  ShowerTreeNew->Branch("deltayb",shower_deltayb,"deltayb[sizeb]/F");
1350  ShowerTreeNew->Branch("tagprimary",shower_tagprimary,"tagprimary[sizeb]/F");
1351  ShowerTreeNew->Branch("purityb",&shower_purityb,"purityb/F");
1352  ShowerTreeNew->Branch("trackdensb",&shower_trackdensb,"trackdensb/F");
1353 
1354  ShowerTreeNew->Branch("Energy",&shower_EnergyCorrectedb,"EnergyCorrectedb/F");
1355  ShowerTreeNew->Branch("EnergyUnCorrected",&shower_EnergyUnCorrectedb,"EnergyUnCorrectedb/F");
1356  ShowerTreeNew->Branch("EnergySigma",&shower_EnergySigmaCorrectedb,"EnergySigmaCorrectedb/F");
1357  ShowerTreeNew->Branch("EnergySigmaUnCorrected",&shower_EnergySigmaUnCorrectedb,"EnergySigmaUnCorrectedb/F");
1358 
1359  ShowerTreeNew->Branch("OldEnergy",&shower_OldEnergyCorrectedb,"OldEnergy/F");
1360  ShowerTreeNew->Branch("OldEnergyUnCorrected",&shower_OldEnergyUnCorrectedb,"OldEnergyUnCorrected/F");
1361  ShowerTreeNew->Branch("OldEnergySigma",&shower_OldEnergySigmaCorrectedb,"OldEnergySigma/F");
1362  ShowerTreeNew->Branch("OldEnergySigmaUnCorrected",&shower_OldEnergySigmaUnCorrectedb,"OldEnergySigmaUnCorrected/F");
1363 
1364 
1365  // Loop over Tree Entries (==different showers):
1366  for (int i=0; i<nent; ++i) {
1367  eShowerTree->GetEntry(i);
1368  //cout << "i = " << i << " " << eEnergyArrayCount << endl;
1369 // eShowerTree->Show(i);
1370  shower_EnergyCorrectedb=eEnergyArray->At(i);
1371  shower_EnergyUnCorrectedb=eEnergyArrayUnCorrected->At(i);
1372  shower_EnergySigmaCorrectedb=eEnergyArraySigmaCorrected->At(i);
1373  shower_EnergySigmaUnCorrectedb=-12345;
1374 
1375  // Fill new Tree
1376  ShowerTreeNew->Fill();
1377  }
1378  ShowerTreeNew->Write();
1379  fileNew->Close();
1380  fileOld->Close();
1381 
1382 
1383  gSystem->Exec("mv -vf Shower.root Shower.Orig.root");
1384  gSystem->Exec("mv -vf New.root Shower.root");
1385  cout << "EdbShowAlgE_Simple::WriteNewRootFile...done."<<endl;
1386  cout << "-------------------------------------------------------------------------------------------"<< endl<< endl;
1387  return;
1388 }
Int_t shower_nfilmb[5000]
Definition: ShowRec.h:382
Int_t shower_showerID
Definition: ShowRec.h:370
Float_t shower_ntrace3simub[5000]
Definition: ShowRec.h:387
Float_t shower_deltaxb[5000]
Definition: ShowRec.h:380
Int_t shower_sizeb20
Definition: ShowRec.h:371
Float_t shower_purb
Definition: ShowRec.h:394
Int_t shower_numberofilms
Definition: ShowRec.h:393
Int_t shower_ntrace2simub[5000]
Definition: ShowRec.h:386
Float_t shower_energy_shot_particle
Definition: ShowRec.h:372
Float_t shower_trackdensb
Definition: ShowRec.h:395
Int_t shower_idb[5000]
Definition: ShowRec.h:390
Int_t shower_number_eventb
Definition: ShowRec.h:370
Int_t shower_sizeb15
Definition: ShowRec.h:371
Float_t shower_deltasigmathetab[58]
Definition: ShowRec.h:392
Float_t shower_tagprimary[5000]
Definition: ShowRec.h:389
Int_t shower_isizeb
Definition: ShowRec.h:370
Float_t shower_deltayb[5000]
Definition: ShowRec.h:381
Int_t shower_sizeb30
Definition: ShowRec.h:371
Int_t shower_ntrace4simub[5000]
Definition: ShowRec.h:388
Int_t shower_sizeb
Definition: ShowRec.h:370
Float_t shower_chi2btkb[5000]
Definition: ShowRec.h:384
Int_t shower_plateb[5000]
Definition: ShowRec.h:391
Int_t shower_ntrace1simub[5000]
Definition: ShowRec.h:385

Member Data Documentation

◆ ANN_Layout

TString EdbShowAlgE_Simple::ANN_Layout
protected

◆ ANN_MLP

TMultiLayerPerceptron* EdbShowAlgE_Simple::ANN_MLP
protected

◆ ANN_MLP_ARRAY

TMultiLayerPerceptron* EdbShowAlgE_Simple::ANN_MLP_ARRAY[15]
protected

◆ ANN_n_InputNeurons

Int_t EdbShowAlgE_Simple::ANN_n_InputNeurons
protected

◆ ANN_n_InputNeurons_ARRAY

Int_t EdbShowAlgE_Simple::ANN_n_InputNeurons_ARRAY[15]
protected

◆ ANN_nPlates_ARRAY

Int_t EdbShowAlgE_Simple::ANN_nPlates_ARRAY[15]
protected

◆ ANN_WeightFile_ARRAY

TString EdbShowAlgE_Simple::ANN_WeightFile_ARRAY[15]
protected

◆ ANNTree

TTree* EdbShowAlgE_Simple::ANNTree
protected

◆ eANN_MLP_CORR_0

Float_t EdbShowAlgE_Simple::eANN_MLP_CORR_0[15]
protected

◆ eANN_MLP_CORR_1

Float_t EdbShowAlgE_Simple::eANN_MLP_CORR_1[15]
protected

◆ eCalibrationOffset

Float_t EdbShowAlgE_Simple::eCalibrationOffset
protected

◆ eCalibrationSlope

Float_t EdbShowAlgE_Simple::eCalibrationSlope
protected

◆ eEfficiencyParametrisation

TSpline3* EdbShowAlgE_Simple::eEfficiencyParametrisation
protected

◆ eEnergy

Float_t EdbShowAlgE_Simple::eEnergy
protected

◆ eEnergyArray

TArrayF* EdbShowAlgE_Simple::eEnergyArray
protected

◆ eEnergyArrayCount

Int_t EdbShowAlgE_Simple::eEnergyArrayCount
protected

◆ eEnergyArraySigmaCorrected

TArrayF* EdbShowAlgE_Simple::eEnergyArraySigmaCorrected
protected

◆ eEnergyArrayUnCorrected

TArrayF* EdbShowAlgE_Simple::eEnergyArrayUnCorrected
protected

◆ eEnergyCorr

Float_t EdbShowAlgE_Simple::eEnergyCorr
protected

◆ eEnergySigmaCorr

Float_t EdbShowAlgE_Simple::eEnergySigmaCorr
protected

◆ eEnergyUnCorr

Float_t EdbShowAlgE_Simple::eEnergyUnCorr
protected

◆ EffFunc_all

TF1* EdbShowAlgE_Simple::EffFunc_all
protected

◆ EffFunc_edefault

TF1* EdbShowAlgE_Simple::EffFunc_edefault
protected

◆ EffFunc_elletroni

TF1* EdbShowAlgE_Simple::EffFunc_elletroni
protected

◆ EffFunc_LowEff

TF1* EdbShowAlgE_Simple::EffFunc_LowEff
protected

◆ EffFunc_MiddleFix

TF1* EdbShowAlgE_Simple::EffFunc_MiddleFix
protected

◆ EffFunc_neuchmicro

TF1* EdbShowAlgE_Simple::EffFunc_neuchmicro
protected

◆ EffFunc_UserEfficiency

TF1* EdbShowAlgE_Simple::EffFunc_UserEfficiency
protected

◆ eHisto_deltaR

TH1D* EdbShowAlgE_Simple::eHisto_deltaR
protected

◆ eHisto_deltaR_mean

TH1D* EdbShowAlgE_Simple::eHisto_deltaR_mean
protected

◆ eHisto_deltaR_rms

TH1D* EdbShowAlgE_Simple::eHisto_deltaR_rms
protected

◆ eHisto_deltaT

TH1D* EdbShowAlgE_Simple::eHisto_deltaT
protected

◆ eHisto_deltaT_mean

TH1D* EdbShowAlgE_Simple::eHisto_deltaT_mean
protected

◆ eHisto_deltaT_rms

TH1D* EdbShowAlgE_Simple::eHisto_deltaT_rms
protected

◆ eHisto_longprofile

TH1D* EdbShowAlgE_Simple::eHisto_longprofile
protected

◆ eHisto_longprofile_av

TH1D* EdbShowAlgE_Simple::eHisto_longprofile_av
protected

◆ eHisto_nbtk

TH1D* EdbShowAlgE_Simple::eHisto_nbtk
protected

◆ eHisto_nbtk_av

TH1D* EdbShowAlgE_Simple::eHisto_nbtk_av
protected

◆ eHisto_transprofile

TH1D* EdbShowAlgE_Simple::eHisto_transprofile
protected

◆ eHisto_transprofile_av

TH1D* EdbShowAlgE_Simple::eHisto_transprofile_av
protected

◆ eParaBT_deltaR_mean

Float_t EdbShowAlgE_Simple::eParaBT_deltaR_mean
protected

◆ eParaBT_deltaR_rms

Float_t EdbShowAlgE_Simple::eParaBT_deltaR_rms
protected

◆ eParaBT_deltaT_mean

Float_t EdbShowAlgE_Simple::eParaBT_deltaT_mean
protected

◆ eParaBT_deltaT_rms

Float_t EdbShowAlgE_Simple::eParaBT_deltaT_rms
protected

◆ eParalongprofile

Int_t EdbShowAlgE_Simple::eParalongprofile[57]
protected

◆ eParaName

Int_t EdbShowAlgE_Simple::eParaName
protected

◆ eParanseg

Int_t EdbShowAlgE_Simple::eParanseg
protected

◆ eParaShowerAxisAngle

Float_t EdbShowAlgE_Simple::eParaShowerAxisAngle
protected

◆ ePlateBinning

Int_t EdbShowAlgE_Simple::ePlateBinning[15]
protected

◆ ePlateNumber

Int_t EdbShowAlgE_Simple::ePlateNumber
protected

◆ ePlateNumberType

Int_t EdbShowAlgE_Simple::ePlateNumberType
protected

◆ eRecoShowerArray

TObjArray* EdbShowAlgE_Simple::eRecoShowerArray
protected

◆ eRecoShowerArrayN

Int_t EdbShowAlgE_Simple::eRecoShowerArrayN
protected

◆ eSpecificationIsChanged

Bool_t EdbShowAlgE_Simple::eSpecificationIsChanged
protected

◆ eSpecificationType

Int_t EdbShowAlgE_Simple::eSpecificationType[6]
protected

◆ eSpecificationTypeString

TString EdbShowAlgE_Simple::eSpecificationTypeString[6]
protected

◆ eSpecificationTypeStringArray

TString EdbShowAlgE_Simple::eSpecificationTypeStringArray[6][6]
protected

◆ eSplineArray_Energy_Stat_Electron

TObjArray* EdbShowAlgE_Simple::eSplineArray_Energy_Stat_Electron
protected

◆ eSplineArray_Energy_Stat_Gamma

TObjArray* EdbShowAlgE_Simple::eSplineArray_Energy_Stat_Gamma
protected

◆ eSplineArray_Energy_Sys_Electron

TObjArray* EdbShowAlgE_Simple::eSplineArray_Energy_Sys_Electron
protected

◆ eSplineArray_Energy_Sys_Gamma

TObjArray* EdbShowAlgE_Simple::eSplineArray_Energy_Sys_Gamma
protected

◆ eSplineCurrent

TSpline3* EdbShowAlgE_Simple::eSplineCurrent
protected

◆ eWeightFileString

TString EdbShowAlgE_Simple::eWeightFileString
protected

◆ inANN

Double_t EdbShowAlgE_Simple::inANN[70]
protected

◆ outANN

Double_t EdbShowAlgE_Simple::outANN
protected

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