CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EndcapPiZeroDiscriminatorAlgo.cc
Go to the documentation of this file.
1 
5 
8 #include <fstream>
9 #include <iostream>
10 
11 using namespace std;
12 
13 EndcapPiZeroDiscriminatorAlgo::EndcapPiZeroDiscriminatorAlgo(double stripEnergyCut, int nStripCut, const string& path) :
14  preshStripEnergyCut_(stripEnergyCut), preshSeededNstr_(nStripCut), pathToFiles_(path)
15 {
16 
17  // Read all Weight files
18  Nfiles_EB = 5;
19  Nfiles_EE = 5;
20  string file_pt[5] = {"20","30","40","50","60"};
21  string file_barrel_pt[5] = {"20","30","40","50","60"};
22 
23  string nn_paterns_file = "";
24  for(int j=0;j<Nfiles_EE;j++) {
25  nn_paterns_file = "endcapPiZeroDiscriminatorWeights_et"+file_pt[j]+".wts";
26  edm::FileInPath WFile(pathToFiles_+nn_paterns_file);
27  readWeightFile(WFile.fullPath().c_str()); // read the weights' file
28 
29  EE_Layers = Layers;
30  EE_Indim = Indim;
31  EE_Hidden = Hidden;
32  EE_Outdim = Outdim;
33 
34  for(int i=0;i<Indim*Hidden;i++) I_H_Weight_all.push_back(I_H_Weight[i]);
35  for(int i=0;i<Hidden;i++) H_Thresh_all.push_back(H_Thresh[i]);
36  for(int i=0;i<Outdim*Hidden;i++) H_O_Weight_all.push_back(H_O_Weight[i]);
37  for(int i=0;i<Outdim;i++) O_Thresh_all.push_back(O_Thresh[i]);
38  }
39 
40  for(int k=0;k<Nfiles_EB;k++) {
41  nn_paterns_file = "barrelPiZeroDiscriminatorWeights_et"+file_barrel_pt[k]+".wts";
42  edm::FileInPath WFile(pathToFiles_+nn_paterns_file);
43  readWeightFile(WFile.fullPath().c_str()); // read the weights' file
44 
45  EB_Layers = Layers;
46  EB_Indim = Indim;
47  EB_Hidden = Hidden;
48  EB_Outdim = Outdim;
49 
50  for(int i=0;i<Indim*Hidden;i++) I_H_Weight_all.push_back(I_H_Weight[i]);
51  for(int i=0;i<Hidden;i++) H_Thresh_all.push_back(H_Thresh[i]);
52  for(int i=0;i<Outdim*Hidden;i++) H_O_Weight_all.push_back(H_O_Weight[i]);
53  for(int i=0;i<Outdim;i++) O_Thresh_all.push_back(O_Thresh[i]);
54  }
55  delete [] I_H_Weight;
56  delete [] H_Thresh;
57  delete [] H_O_Weight;
58  delete [] O_Thresh;
59 }
60 
61 
63  CaloSubdetectorTopology *topology_p)
64 {
65  vector<float> vout_stripE;
66 
67  // skip if rechits_map contains no hits
68  if ( rechits_map->size() == 0 ) {
69  edm::LogWarning("EndcapPiZeroDiscriminatorAlgo") << "RecHitsMap has size 0.";
70  return vout_stripE;
71  }
72 
73  vout_stripE.clear();
74 
75  vector<ESDetId> road_2d;
76  road_2d.clear();
77 
78  int plane = strip.plane();
79 
80  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPreshVectors: Preshower Seeded Algorithm - looking for clusters" << "n"<< "findPreshVectors: Preshower is intersected at strip " << strip.strip() << ", at plane " << plane ;
81 
82 
83  if ( strip == ESDetId(0) ) { //works in case of no intersected strip found
84  for(int i=0;i<11;i++) {
85  vout_stripE.push_back(-100.);
86  }
87  }
88 
89  // Add to the road the central strip
90  road_2d.push_back(strip);
91 
92  //Make a navigator, and set it to the strip cell.
93  EcalPreshowerNavigator navigator(strip, topology_p);
94  navigator.setHome(strip);
95  //search for neighbours in the central road
96  findPi0Road(strip, navigator, plane, road_2d);
97 
98  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo:findPreshVectors: Total number of strips in the central road: " << road_2d.size() ;
99 
100  // Find the energy of each strip
101  RecHitsMap::iterator final_strip = rechits_map->end();
102  // very dangerous, added a protection on the rechits_map->size()
103  // at the beginning of the method
104  final_strip--;
105  ESDetId last_stripID = final_strip->first;
106 
107  float E = 0;
108  vector<ESDetId>::iterator itID;
109  for (itID = road_2d.begin(); itID != road_2d.end(); itID++) {
110  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPreshVectors: ID = " << *itID ;
111 
112  RecHitsMap::iterator strip_it = rechits_map->find(*itID);
113  if(goodPi0Strip(strip_it,last_stripID)) { // continue if strip not found in rechit_map
114  E = strip_it->second.energy();
115  } else E = 0;
116  vout_stripE.push_back(E);
117  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPreshVectors: E = " << E ;
118 
119  }
120 
121  // ***ML beg***
122  // vector of size=11, content of vout_stripE is copied into vout_ElevenStrips_Energy
123  // to avoid problem in case number of strips is less than 11
124  vector<float> vout_ElevenStrips_Energy;
125  for(int i=0;i<11;i++)
126  {
127  vout_ElevenStrips_Energy.push_back(0.);
128  }
129 
130  for(unsigned int i=0;i<vout_stripE.size();i++)
131  {
132  vout_ElevenStrips_Energy[i] = vout_stripE.at(i);
133  }
134 
135  //return vout_stripE;
136  return vout_ElevenStrips_Energy;
137  // ***ML end***
138 
139 }
140 
141 // returns true if the candidate strip fulfills the requirements to be added to the cluster:
142 bool EndcapPiZeroDiscriminatorAlgo::goodPi0Strip(RecHitsMap::iterator candidate_it, ESDetId lastID)
143 {
144  RecHitsMap::iterator candidate_tmp = candidate_it;
145  candidate_tmp--;
146 
147  if (candidate_tmp->first == lastID )
148  LogTrace("EcalClusters") <<"EndcapPiZeroDiscriminatorAlgo: goodPi0Strip No such a strip in rechits_map " ;
149  if (candidate_it->second.energy() <= preshStripEnergyCut_)
150  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: goodPi0Strip Strip energy " << candidate_it->second.energy() <<" is below threshold " ;
151 
152  // crystal should not be included...
153  if ( (candidate_tmp->first == lastID ) || // ...if it corresponds to a hit
154  (candidate_it->second.energy() <= preshStripEnergyCut_ ) ) // ...if it has a negative or zero energy
155  {
156  return false;
157  }
158 
159  return true;
160 }
161 
162 // find strips in the road of size +/- preshSeededNstr_ from the central strip
164  int plane, vector<ESDetId>& vout) {
165  if ( strip == ESDetId(0) ) return;
166  ESDetId next;
167  theESNav.setHome(strip);
168  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: starts from strip " << strip ;
169 
170  if (plane == 1) {
171  // east road
172  int n_east= 0;
173  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: Go to the East " ;
174 
175  while ( ((next=theESNav.east()) != ESDetId(0) && next != strip) ) {
176  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: East: " << n_east << " current strip is " << next ;
177 
178  vout.push_back(next);
179  ++n_east;
180  if (n_east == preshSeededNstr_) break;
181  }
182  // west road
183  int n_west= 0;
184  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: Go to the West " ;
185 
186  theESNav.home();
187  while ( ((next=theESNav.west()) != ESDetId(0) && next != strip )) {
188  LogTrace("EcalClusters") << "findPi0Road: West: " << n_west << " current strip is " << next ;
189 
190  vout.push_back(next);
191  ++n_west;
192  if (n_west == preshSeededNstr_) break;
193  }
194  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: Total number of strips found in the road at 1-st plane is " << n_east+n_west ;
195 
196  }
197  else if (plane == 2) {
198  // north road
199  int n_north= 0;
200  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: Go to the North " ;
201 
202  while ( ((next=theESNav.north()) != ESDetId(0) && next != strip) ) {
203  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: North: " << n_north << " current strip is " << next;
204 
205  vout.push_back(next);
206  ++n_north;
207  if (n_north == preshSeededNstr_) break;
208  }
209  // south road
210  int n_south= 0;
211  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: Go to the South " ;
212 
213  theESNav.home();
214  while ( ((next=theESNav.south()) != ESDetId(0) && next != strip) ) {
215  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: South: " << n_south << " current strip is " << next ;
216 
217  vout.push_back(next);
218  ++n_south;
219  if (n_south == preshSeededNstr_) break;
220  }
221  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: Total number of strips found in the road at 2-nd plane is " << n_south+n_north ;
222 
223  }
224  else {
225  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: findPi0Road: Wrong plane number, null cluster will be returned! " ;
226 
227  } // end of if
228 
229  theESNav.home();
230 }
231 
232 
233 //===================================================================
234 // EndcapPiZeroDiscriminatorAlgo::readWeightFile(...), a method that reads the weigths of the NN
235 // INPUT: Weights_file
236 // OUTPUT: I_H_Weight, H_Thresh, H_O_Weight, O_Thresh arrays
237 //===================================================================
238 void EndcapPiZeroDiscriminatorAlgo::readWeightFile(const char *Weights_file){
239  FILE *weights;
240 
241  char *line;
242  line = new char[80];
243 
244  bool checkinit=false;
245 // Open the weights file, generated by jetnet, and read
246 // in the nodes and weights
247 //*******************************************************
248  weights = fopen(Weights_file, "r");
249  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: I opeded the Weights file = " << Weights_file ;
250 
251 
252  while( !feof(weights) ){
253  fscanf(weights, "%s", line);
254  if (line[0] == 'A') { //Read in ANN nodes: Layers, input , Hidden, Output
255  fscanf(weights, "%d", &Layers); // # of NN Layers used
256  fscanf(weights, "%d", &Indim); // # of Inputs actually used
257  fscanf(weights, "%d", &Hidden); // # of hidden nodes
258  fscanf(weights, "%d", &Outdim); // # of output nodes
259 
260  inp_var = Indim + 1;
261 
262  I_H_Weight = new float[Indim*Hidden];
263  H_Thresh = new float[Hidden];
264  H_O_Weight = new float[Hidden*Outdim];
265  O_Thresh = new float[Outdim];
266  checkinit=true;
267  }else if (line[0] == 'B') { // read in weights between hidden and intput nodes
268  assert(checkinit);
269  for (int i = 0; i<Indim; i++){
270  for (int j = 0; j<Hidden; j++){
271  fscanf(weights, "%f", &I_H_Weight[i*Hidden+j]);
272  }
273  }
274  }else if (line[0] == 'C'){ // Read in the thresholds for hidden nodes
275  assert(checkinit);
276  for (int i = 0; i<Hidden; i++){
277  fscanf(weights, "%f", &H_Thresh[i]);
278  }
279  }else if (line[0] == 'D'){ // read in weights between hidden and output nodes
280  assert(checkinit);
281  for (int i = 0; i<Hidden*Outdim; i++){
282  fscanf(weights, "%f", &H_O_Weight[i]);
283  }
284  }else if (line[0] == 'E'){ // read in the threshold for the output nodes
285  assert(checkinit);
286  for (int i = 0; i<Outdim; i++){
287  fscanf(weights, "%f", &O_Thresh[i]);
288 
289  }
290  }
291  else{edm::LogError("EEPi0Discrim")<< "EndcapPiZeroDiscriminatorAlgo: Not a Net file of Corrupted Net file " << endl;
292  }
293  }
294  fclose(weights);
295 }
296 
297 //=====================================================================================
298 // EndcapPiZeroDiscriminatorAlgo::getNNoutput(int sel_wfile), a method that calculated the NN output
299 // INPUT: sel_wfile -> Weight file selection
300 // OUTPUT : nnout -> the NN output
301 //=====================================================================================
302 
304 {
305  float* I_SUM;
306  float* OUT;
307  float nnout=0.0;
308  int mij;
309 
310  I_SUM = new float[Hidden];
311  OUT = new float[Outdim];
312 
313  for(int k=0;k<Hidden;k++) I_SUM[k]=0.0;
314  for(int k1=0;k1<Outdim;k1++) OUT[k1]=0.0;
315 
316  for (int h = 0; h<Hidden; h++){
317  mij = h - Hidden;
318  for (int i = 0; i<Indim; i++){
319  mij = mij + Hidden;
320  I_SUM[h] += I_H_Weight_all[mij+sel_wfile*Indim*Hidden + barrelstart*Nfiles_EE*EE_Indim*EE_Hidden] * input_var[i];
321  }
322  I_SUM[h] += H_Thresh_all[h+sel_wfile*Hidden + barrelstart*Nfiles_EE*EE_Hidden];
323  for (int o1 = 0; o1<Outdim; o1++) {
324  OUT[o1] += H_O_Weight_all[barrelstart*Nfiles_EE*EE_Outdim*EE_Hidden + h*Outdim+o1 + sel_wfile*Outdim*Hidden]*Activation_fun(I_SUM[h]);
325 
326  }
327  }
328  for (int o2 = 0; o2<Outdim; o2++){
329  OUT[o2] += O_Thresh_all[barrelstart*Nfiles_EE*EE_Outdim + o2 + sel_wfile*Outdim];
330  }
331  nnout = Activation_fun(OUT[0]);
332  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: getNNoutput :: -> NNout = " << nnout ;
333 
334 
335  delete[] I_SUM;
336  delete[] OUT;
337  delete[] input_var;
338 
339  return (nnout);
340 }
341 
342 
344  return( 1.0 / ( 1.0 + exp(-2.0*SUM) ) );
345 }
346 //=====================================================================================
347 // EndcapPiZeroDiscriminatorAlgo::calculateNNInputVariables(...), a method that calculates the 25 input variables
348 // INPUTS:
349 // vph1 -> vector of the stip energies in 1st Preshower plane
350 // vph2 -> vector of the stip energies in 2nd Preshower plane
351 // pS1_max -> E1
352 // pS9_max -> E9
353 // pS25_max -> E25
354 // OUTPUT:
355 // input_var[25] -> the 25 input to the NN variables array
356 //=====================================================================================
357 bool EndcapPiZeroDiscriminatorAlgo::calculateNNInputVariables(vector<float>& vph1, vector<float>& vph2,
358  float pS1_max, float pS9_max, float pS25_max, int EScorr)
359 {
360  input_var = new float[EE_Indim];
361 
362  bool valid_NNinput = true;
363 
364  /*
365  for(int i = 0; i<11;i++) {
366  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Energies of the Preshower Strips in X plane = " << vph1[i] ;
367  }
368 
369  for(int i = 0; i<11;i++) {
370  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Energies of the Preshower Strips in Y plane = " << vph2[i] ;
371  }
372  */
373 
374  // check if all Preshower info is availabla - If NOT use remaning info
375  for(int k = 0; k<11; k++) {
376  if(vph1[k] < 0 ) {
377 
378  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Oops!!! Preshower Info for strip : " << k << " of X plane Do not exists" ;
379 
380  vph1[k] = 0.0;
381  }
382  if(vph2[k] < 0 ) {
383  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Oops!!! Preshower Info for strip : " << k << " of Y plane Do not exists" ;
384 
385  vph2[k] = 0.0;
386  }
387  }
388 
389  /*
390  for(int i = 0; i<11;i++) {
391  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: After: Energies of the Preshower Strips in X plane = " << vph1[i] ;
392  }
393 
394  for(int i = 0; i<11;i++) {
395 
396  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: After: Energies of the Preshower Strips in Y plane = " << vph2[i] ;
397  }
398  */
399 
400 
401 // FIRST : Produce the 22 NN variables related with the Preshower
402 // --------------------------------------------------------------
403 // New normalization of the preshower strip energies Aris 8/11/2004
404  for(int kk=0;kk<11;kk++){
405  input_var[kk] = fabs(vph1[kk]/0.01);
406  input_var[kk + 11] = fabs(vph2[kk]/0.02);
407  if(input_var[kk] < 0.0001) input_var[kk] = 0.;
408  if(input_var[kk + 11] < 0.0001) input_var[kk + 11] = 0.;
409  }
410  input_var[0] = fabs(input_var[0]/2.);
411  input_var[1] = fabs(input_var[1]/2.);
412  input_var[6] = fabs(input_var[6]/2.);
413  input_var[11] = fabs(input_var[11]/2.);
414  input_var[12] = fabs(input_var[12]/2.);
415  input_var[17] = fabs(input_var[17]/2.);
416 
417 // correction for version > CMSSW_3_1_0_pre5 where extra enegry is given to the ES strips
418 // Aris 18/5/2009
419  if( EScorr == 1) {
420  input_var[0] -= 0.05;
421  input_var[1] -= 0.035;
422  input_var[2] -= 0.035;
423  input_var[3] -= 0.02;
424  input_var[4] -= 0.015;
425  input_var[5] -= 0.0075;
426  input_var[6] -= 0.035;
427  input_var[7] -= 0.035;
428  input_var[8] -= 0.02;
429  input_var[9] -= 0.015;
430  input_var[10] -= 0.0075;
431 
432  input_var[11] -= 0.05;
433  input_var[12] -= 0.035;
434  input_var[13] -= 0.035;
435  input_var[14] -= 0.02;
436  input_var[15] -= 0.015;
437  input_var[16] -= 0.0075;
438  input_var[17] -= 0.035;
439  input_var[18] -= 0.035;
440  input_var[19] -= 0.02;
441  input_var[20] -= 0.015;
442  input_var[21] -= 0.0075;
443 
444  for(int kk1=0;kk1<22;kk1++){
445  if(input_var[kk1] < 0 ) input_var[kk1] = 0.0;
446  }
447  }
448 // SECOND: Take the final NN variable related to the ECAL
449 // -----------------------------------------------
450  float ECAL_norm_factor = 500.;
451  if(pS25_max>500&&pS25_max<=1000) ECAL_norm_factor = 1000;
452  if(pS25_max>1000) ECAL_norm_factor = 7000;
453 
454  input_var[22] = pS1_max/ECAL_norm_factor;
455  input_var[23] = pS9_max/ECAL_norm_factor;
456  input_var[24] = pS25_max/ECAL_norm_factor;
457 
458  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: S1/ECAL_norm_factor = " << input_var[22];
459  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: S9/ECAL_norm_factor = " << input_var[23];
460  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: S25/ECAL_norm_factor = " << input_var[24] ;
461 
462  for(int i=0;i<EE_Indim;i++){
463  if(input_var[i] > 1.0e+00) {
464  valid_NNinput = false;
465  break;
466  }
467  }
468 
469  LogTrace("EcalClusters") << " valid_NNinput = " << valid_NNinput ;
470 
471 
472  return valid_NNinput;
473 }
474 
475 
476 //=====================================================================================
477 // EndcapPiZeroDiscriminatorAlgo::calculateBarrelNNInputVariables(...), a method that calculates
478 // the 12 barrel NN input
479 // OUTPUT:
480 // input_var[12] -> the 12 input to the barrel NN variables array
481 //=====================================================================================
482 
483 void EndcapPiZeroDiscriminatorAlgo::calculateBarrelNNInputVariables(float et, double s1, double s9, double s25,
484  double m2, double cee, double cep,double cpp,
485  double s4, double s6, double ratio,
486  double xcog, double ycog)
487 {
488  input_var = new float[EB_Indim];
489 
490  double lam, lam1, lam2;
491 
492  if(xcog < 0.) {
493  input_var[0] = -xcog/s25;
494  } else {
495  input_var[0] = xcog/s25;
496  }
497 
498  input_var[1] = cee/0.0004;
499 
500  if(cpp<.001) {
501  input_var[2] = cpp/.001;
502  } else {
503  input_var[2] = 0.;
504  }
505 
506  if(s9!=0.) {
507  input_var[3] = s1/s9;
508  input_var[8] = s6/s9;
509  input_var[10] = (m2+s1)/s9;
510  }
511  else {
512  input_var[3] = 0.;
513  input_var[8] = 0.;
514  input_var[10] = 0.;
515  }
516 
517  if(s25-s1>0.) {
518  input_var[4] = (s9-s1)/(s25-s1);
519  } else {
520  input_var[4] = 0.;
521  }
522 
523  if(s25>0.) {
524  input_var[5] = s4/s25;
525  } else {
526  input_var[5] = 0.;
527  }
528 
529  if(ycog < 0.) {
530  input_var[6] = -ycog/s25;
531  } else {
532  input_var[6] = ycog/s25;
533  }
534 
535  input_var[7] = ratio;
536 
537  lam=sqrt((cee -cpp)*(cee -cpp)+4*cep*cep);
538  lam1=(cee + cpp + lam)/2;
539  lam2=(cee + cpp - lam)/2;
540 
541  if(lam1 == 0) {
542  input_var[9] = .0;
543  } else {
544  input_var[9] = lam2/lam1;
545  }
546  if(s4!=0.) {
547  input_var[11] = (m2+s1)/s4;
548  } else {
549  input_var[11] = 0.;
550  }
551 
552 }
553 
554 
555 //=====================================================================================
556 // EndcapPiZeroDiscriminatorAlgo::GetNNOutput(...), a method that calculates the NNoutput
557 // INPUTS: Super Cluster Energy
558 // OUTPUTS : NNoutput
559 //=====================================================================================
561 {
563 
564  float nnout = -1;
565 // Print the NN input variables that are related to the Preshower + ECAL
566 // ------------------------------------------------------------------------
567  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo::GetNNoutput :nn_invar_presh = " ;
568 
569  for(int k1=0;k1<Indim;k1++) {
570  LogTrace("EcalClusters") << input_var[k1] << " " ;
571 
572  }
573  LogTrace("EcalClusters") << " " ;
574 
575  // select the appropriate Weigth file
576  int sel_wfile;
577  if(EE_Et<25.0) {sel_wfile = 0;}
578  else if(EE_Et>=25.0 && EE_Et<35.0) {sel_wfile = 1;}
579  else if(EE_Et>=35.0 && EE_Et<45.0) {sel_wfile = 2;}
580  else if(EE_Et>=45.0 && EE_Et<55.0) {sel_wfile = 3;}
581  else {sel_wfile = 4;}
582 
583  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Et_SC = " << EE_Et << " and I select Weight file Number = " << sel_wfile ;
584 
585 
586  nnout = getNNoutput(sel_wfile); // calculate the nnoutput for the given ECAL object
587 
588  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: ===================> GetNNOutput : NNout = " << nnout ;
589 
590 
591  return nnout;
592 }
593 
594 
595 //=====================================================================================
596 // EndcapPiZeroDiscriminatorAlgo::GetBarrelNNOutput(...), a method that calculates the barrel NNoutput
597 // INPUTS: Super Cluster Energy
598 // OUTPUTS : NNoutput
599 //=====================================================================================
601 {
602 
604 
605  float nnout = -1;
606 // Print the NN input variables that are related to the ECAL Barrel
607 // ------------------------------------------------------------------------
608  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo::GetBarrelNNoutput :nn_invar_presh = " ;
609 
610  for(int k1=0;k1<Indim;k1++) {
611  LogTrace("EcalClusters") << input_var[k1] << " " ;
612 
613  }
614  LogTrace("EcalClusters") << " " ;
615 
616  // select the appropriate Weigth file
617  int sel_wfile;
618  if(EB_Et<25.0) {sel_wfile = 0;}
619  else if(EB_Et>=25.0 && EB_Et<35.0) {sel_wfile = 1;}
620  else if(EB_Et>=35.0 && EB_Et<45.0) {sel_wfile = 2;}
621  else if(EB_Et>=45.0 && EB_Et<55.0) {sel_wfile = 3;}
622  else {sel_wfile = 4;}
623  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: E_SC = " << EB_Et << " and I select Weight file Number = " << sel_wfile ;
624 
625  nnout = getNNoutput(sel_wfile); // calculate the nnoutput for the given ECAL object
626 
627  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: ===================> GetNNOutput : NNout = " << nnout ;
628 
629  return nnout;
630 }
631 
void findPi0Road(ESDetId strip, EcalPreshowerNavigator &theESNav, int plane, std::vector< ESDetId > &vout)
int i
Definition: DBlmapReader.cc:9
int strip() const
Definition: ESDetId.h:52
assert(m_qm.get())
void calculateBarrelNNInputVariables(float et, double s1, double s9, double s25, double m2, double cee, double cep, double cpp, double s4, double s6, double ratio, double xcog, double ycog)
std::map< DetId, EcalRecHit > RecHitsMap
void setHome(const T &startingPoint)
set the starting position
tuple path
else: Piece not in the list, fine.
std::vector< float > findPreshVector(ESDetId strip, RecHitsMap *rechits_map, CaloSubdetectorTopology *topology_p)
T west() const
move the navigator west
Definition: CaloNavigator.h:59
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T south() const
move the navigator south
Definition: CaloNavigator.h:45
#define LogTrace(id)
T east() const
move the navigator east
Definition: CaloNavigator.h:52
void home() const
move the navigator back to the starting point
bool goodPi0Strip(RecHitsMap::iterator candidate_it, ESDetId lastID)
#define SUM(A, B)
int plane() const
Definition: ESDetId.h:46
bool calculateNNInputVariables(std::vector< float > &vph1, std::vector< float > &vph2, float pS1_max, float pS9_max, float pS25_max, int EScorr)
T north() const
move the navigator north
Definition: CaloNavigator.h:38