70{
71 cout << "EdbShowAlgID_E_G_Simple::Execute()"<<endl;
73 cout << "EdbShowAlgID_E_G_Simple::Execute() eRecoShowerArrayN==0"<<endl;
74 return;
75 }
76
79
80 TTree *ANNTree = new TTree("ANNTree", "ANNTree");
81 ANNTree->SetDirectory(0);
82
83 Float_t inANN[70];
84 ANNTree->Branch("inANN", inANN, "inANN[70]/F");
85
86 TMultiLayerPerceptron *ANN_MLP;
87 TMultiLayerPerceptron *ANN_MLP_ARRAY[15];
88
89 TString layout="";
90 int NrOfANNInputNeurons=12;
91
92 int n_ANN_Neurons_FJ[15];
93 n_ANN_Neurons_FJ[0]=6+10;
94 n_ANN_Neurons_FJ[1]=6+12;
95 n_ANN_Neurons_FJ[2]=6+14;
96 n_ANN_Neurons_FJ[3]=6+16;
97 n_ANN_Neurons_FJ[4]=6+18;
98 n_ANN_Neurons_FJ[5]=6+20;
99 n_ANN_Neurons_FJ[6]=6+23;
100 n_ANN_Neurons_FJ[7]=6+26;
101 n_ANN_Neurons_FJ[8]=6+29;
102 n_ANN_Neurons_FJ[9]=6+32;
103 n_ANN_Neurons_FJ[10]=6+35;
104 n_ANN_Neurons_FJ[11]=6+40;
105 n_ANN_Neurons_FJ[12]=6+45;
106 n_ANN_Neurons_FJ[13]=6+50;
107 n_ANN_Neurons_FJ[14]=6+57;
108
109
110 for (int k=0; k<15; k++) {
111 layout="";
112 NrOfANNInputNeurons=n_ANN_Neurons_FJ[k];
113 for (Int_t i=1; i<NrOfANNInputNeurons; ++i) layout += "@inANN["+TString(Form("%d",i))+"],";
114 layout += "@inANN["+TString(Form("%d",NrOfANNInputNeurons))+"]:"+TString(Form("%d",NrOfANNInputNeurons+1))+":"+TString(Form("%d",NrOfANNInputNeurons));
115 layout+=":inANN[0]";
116
117
118 ANN_MLP_ARRAY[k] = new TMultiLayerPerceptron(layout,ANNTree,"","");
119 ANN_MLP=ANN_MLP_ARRAY[k];
120
121 cout << "=== DEBUG === ANN_MLP->GetStructure() : " << ANN_MLP->GetStructure() << endl;
122 TString ANN_LAYOUT=ANN_MLP_ARRAY[k]->GetStructure();
123 }
124
125
126
127
128 for (
int ll=0; ll<15; ll++) ANN_MLP_ARRAY[ll]->
LoadWeights(
"/home/meisel/Software/ANN_MEGA_ID/weigths_ID_E_GAMMA.txt");
129 cout << "/home/meisel/Software/ANN_MEGA_ID/weigths_ID_E_GAMMA.txt" << endl;
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148 TH1F* hist_E = new TH1F("hist_E","hist_E",100,0,10);
149
151
152
155
158
160
161 cout <<
"shower->Npl() " << shower->
Npl() << endl;
162 int check_Npl= shower->
Npl();
163 int check_Npl_index=0;
164 if (check_Npl<=10) check_Npl_index=0;
165 if (check_Npl>=11 && check_Npl<=12) check_Npl_index=1;
166 if (check_Npl>=13 && check_Npl<=14) check_Npl_index=2;
167 if (check_Npl>=15 && check_Npl<=16) check_Npl_index=3;
168 if (check_Npl>=17 && check_Npl<=18) check_Npl_index=4;
169 if (check_Npl>=19 && check_Npl<=20) check_Npl_index=5;
170 if (check_Npl>=21 && check_Npl<=23) check_Npl_index=6;
171 if (check_Npl>=24 && check_Npl<=26) check_Npl_index=7;
172 if (check_Npl>=27 && check_Npl<=29) check_Npl_index=8;
173 if (check_Npl>=30 && check_Npl<=32) check_Npl_index=9;
174 if (check_Npl>=33 && check_Npl<=35) check_Npl_index=10;
175 cout << "check_Npl_index " << check_Npl_index << endl;
176
177
178
179
180
181
182
183
184
185
186
187
188 if (check_Npl>20) check_Npl_index=9;
189 if (check_Npl<=20) check_Npl_index=5;
190 if (check_Npl<=10) check_Npl_index=0;
191
192
193 check_Npl_index=5;
194
195 cout << " =========================== check_Npl_index= " << check_Npl_index << " ; !!! ======================="<<endl;
196
197 NrOfANNInputNeurons=n_ANN_Neurons_FJ[check_Npl_index];
198 ANN_MLP=ANN_MLP_ARRAY[check_Npl_index];
199 cout << "Using the following layout: " << ANN_MLP->GetStructure() << endl;
200 ANN_MLP->Print();
201
202
203
204
206 inANN[2]=eShowAlgE_Para_FJ.
nseg;
211 for (int ii=0; ii<57; ii++) {
212 cout << setw(3) << eShowAlgE_Para_FJ.
longprofile[ii];
214 }
215 cout << endl;
216
217 ANNTree->Fill();
218
220 Double_t val;
221 Double_t EnergyCalibration_Offset=0.8;
222 Double_t EnergyCalibration_Slope=0.94;
223
224
225 EnergyCalibration_Offset=0.0;
226 EnergyCalibration_Slope=1.0;
227
228
229 for (Int_t j=1; j<=NrOfANNInputNeurons; ++j) {
231 cout <<
"=== DEBUG === : j params[j-1]=inANN[j] " << j<<
" " <<
params[j-1] << endl;
232 }
233 val=(ANN_MLP->Evaluate(0,
params));
234 cout << "DEBUG: i, val (=mlp1->Evaluate(0,params)) ======================= real energy " << i << " " << val << " == " << inANN[0] << endl;
235
236 if ( ::isnan(val) ) cout << " val is NAN " << endl;
237
238
239 val=(val-EnergyCalibration_Offset)/EnergyCalibration_Slope;
240 cout << "---- With Correctiono factor val=(val-EnergyCalibration_Offset)/EnergyCalibration_Slope: " << EnergyCalibration_Offset << " " << EnergyCalibration_Slope << " " << val<< endl;
241
242
243
244
245 Double_t sigma=0.83*TMath::Sqrt(val)-0.45;
246
247 cout << "Estimated Energy = " << val << " +- " << sigma << "..." << endl;
248
249
250
251
252
253 }
254
255
256
257 return;
258}
Int_t eParaName
Definition: EdbShowAlgID_E_G_Simple.h:39
Definition: EdbShowerP.h:28
void Print()
-— EXPERIMENTAL STATUS —
Definition: EdbShowerP.cxx:2333
Int_t Npl() const
Definition: EdbShowerP.h:409
void BuildParametrisation_FJ()
Definition: EdbShowerP.cxx:1235
void PrintParametrisation_FJ()
Definition: EdbShowerP.cxx:2392
Para_FJ GetPara_FJ() const
Definition: EdbShowerP.h:551
Definition: EdbShowerP.h:143
Float_t BT_deltaT_rms
Definition: EdbShowerP.h:150
Int_t nseg
Definition: EdbShowerP.h:146
Float_t BT_deltaR_rms
Definition: EdbShowerP.h:148
Float_t BT_deltaR_mean
Definition: EdbShowerP.h:147
Int_t longprofile[57]
Definition: EdbShowerP.h:151
Float_t ShowerAxisAngle
Definition: EdbShowerP.h:145
Float_t BT_deltaT_mean
Definition: EdbShowerP.h:149
mlp LoadWeights("testweights.txt")
Double_t params[3]
Definition: testBGReduction_By_ANN.C:84