test
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  delete[] line;
296 }
297 
298 //=====================================================================================
299 // EndcapPiZeroDiscriminatorAlgo::getNNoutput(int sel_wfile), a method that calculated the NN output
300 // INPUT: sel_wfile -> Weight file selection
301 // OUTPUT : nnout -> the NN output
302 //=====================================================================================
303 
305 {
306  float* I_SUM;
307  float* OUT;
308  float nnout=0.0;
309  int mij;
310 
311  I_SUM = new float[Hidden];
312  OUT = new float[Outdim];
313 
314  for(int k=0;k<Hidden;k++) I_SUM[k]=0.0;
315  for(int k1=0;k1<Outdim;k1++) OUT[k1]=0.0;
316 
317  for (int h = 0; h<Hidden; h++){
318  mij = h - Hidden;
319  for (int i = 0; i<Indim; i++){
320  mij = mij + Hidden;
321  I_SUM[h] += I_H_Weight_all[mij+sel_wfile*Indim*Hidden + barrelstart*Nfiles_EE*EE_Indim*EE_Hidden] * input_var[i];
322  }
323  I_SUM[h] += H_Thresh_all[h+sel_wfile*Hidden + barrelstart*Nfiles_EE*EE_Hidden];
324  for (int o1 = 0; o1<Outdim; o1++) {
325  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]);
326 
327  }
328  }
329  for (int o2 = 0; o2<Outdim; o2++){
330  OUT[o2] += O_Thresh_all[barrelstart*Nfiles_EE*EE_Outdim + o2 + sel_wfile*Outdim];
331  }
332  nnout = Activation_fun(OUT[0]);
333  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: getNNoutput :: -> NNout = " << nnout ;
334 
335 
336  delete[] I_SUM;
337  delete[] OUT;
338  delete[] input_var;
339 
340  return (nnout);
341 }
342 
343 
345  return( 1.0 / ( 1.0 + exp(-2.0*SUM) ) );
346 }
347 //=====================================================================================
348 // EndcapPiZeroDiscriminatorAlgo::calculateNNInputVariables(...), a method that calculates the 25 input variables
349 // INPUTS:
350 // vph1 -> vector of the stip energies in 1st Preshower plane
351 // vph2 -> vector of the stip energies in 2nd Preshower plane
352 // pS1_max -> E1
353 // pS9_max -> E9
354 // pS25_max -> E25
355 // OUTPUT:
356 // input_var[25] -> the 25 input to the NN variables array
357 //=====================================================================================
358 bool EndcapPiZeroDiscriminatorAlgo::calculateNNInputVariables(vector<float>& vph1, vector<float>& vph2,
359  float pS1_max, float pS9_max, float pS25_max, int EScorr)
360 {
361  input_var = new float[EE_Indim];
362 
363  bool valid_NNinput = true;
364 
365  /*
366  for(int i = 0; i<11;i++) {
367  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Energies of the Preshower Strips in X plane = " << vph1[i] ;
368  }
369 
370  for(int i = 0; i<11;i++) {
371  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Energies of the Preshower Strips in Y plane = " << vph2[i] ;
372  }
373  */
374 
375  // check if all Preshower info is availabla - If NOT use remaning info
376  for(int k = 0; k<11; k++) {
377  if(vph1[k] < 0 ) {
378 
379  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Oops!!! Preshower Info for strip : " << k << " of X plane Do not exists" ;
380 
381  vph1[k] = 0.0;
382  }
383  if(vph2[k] < 0 ) {
384  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Oops!!! Preshower Info for strip : " << k << " of Y plane Do not exists" ;
385 
386  vph2[k] = 0.0;
387  }
388  }
389 
390  /*
391  for(int i = 0; i<11;i++) {
392  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: After: Energies of the Preshower Strips in X plane = " << vph1[i] ;
393  }
394 
395  for(int i = 0; i<11;i++) {
396 
397  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: After: Energies of the Preshower Strips in Y plane = " << vph2[i] ;
398  }
399  */
400 
401 
402 // FIRST : Produce the 22 NN variables related with the Preshower
403 // --------------------------------------------------------------
404 // New normalization of the preshower strip energies Aris 8/11/2004
405  for(int kk=0;kk<11;kk++){
406  input_var[kk] = fabs(vph1[kk]/0.01);
407  input_var[kk + 11] = fabs(vph2[kk]/0.02);
408  if(input_var[kk] < 0.0001) input_var[kk] = 0.;
409  if(input_var[kk + 11] < 0.0001) input_var[kk + 11] = 0.;
410  }
411  input_var[0] = fabs(input_var[0]/2.);
412  input_var[1] = fabs(input_var[1]/2.);
413  input_var[6] = fabs(input_var[6]/2.);
414  input_var[11] = fabs(input_var[11]/2.);
415  input_var[12] = fabs(input_var[12]/2.);
416  input_var[17] = fabs(input_var[17]/2.);
417 
418 // correction for version > CMSSW_3_1_0_pre5 where extra enegry is given to the ES strips
419 // Aris 18/5/2009
420  if( EScorr == 1) {
421  input_var[0] -= 0.05;
422  input_var[1] -= 0.035;
423  input_var[2] -= 0.035;
424  input_var[3] -= 0.02;
425  input_var[4] -= 0.015;
426  input_var[5] -= 0.0075;
427  input_var[6] -= 0.035;
428  input_var[7] -= 0.035;
429  input_var[8] -= 0.02;
430  input_var[9] -= 0.015;
431  input_var[10] -= 0.0075;
432 
433  input_var[11] -= 0.05;
434  input_var[12] -= 0.035;
435  input_var[13] -= 0.035;
436  input_var[14] -= 0.02;
437  input_var[15] -= 0.015;
438  input_var[16] -= 0.0075;
439  input_var[17] -= 0.035;
440  input_var[18] -= 0.035;
441  input_var[19] -= 0.02;
442  input_var[20] -= 0.015;
443  input_var[21] -= 0.0075;
444 
445  for(int kk1=0;kk1<22;kk1++){
446  if(input_var[kk1] < 0 ) input_var[kk1] = 0.0;
447  }
448  }
449 // SECOND: Take the final NN variable related to the ECAL
450 // -----------------------------------------------
451  float ECAL_norm_factor = 500.;
452  if(pS25_max>500&&pS25_max<=1000) ECAL_norm_factor = 1000;
453  if(pS25_max>1000) ECAL_norm_factor = 7000;
454 
455  input_var[22] = pS1_max/ECAL_norm_factor;
456  input_var[23] = pS9_max/ECAL_norm_factor;
457  input_var[24] = pS25_max/ECAL_norm_factor;
458 
459  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: S1/ECAL_norm_factor = " << input_var[22];
460  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: S9/ECAL_norm_factor = " << input_var[23];
461  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: S25/ECAL_norm_factor = " << input_var[24] ;
462 
463  for(int i=0;i<EE_Indim;i++){
464  if(input_var[i] > 1.0e+00) {
465  valid_NNinput = false;
466  break;
467  }
468  }
469 
470  LogTrace("EcalClusters") << " valid_NNinput = " << valid_NNinput ;
471 
472 
473  return valid_NNinput;
474 }
475 
476 
477 //=====================================================================================
478 // EndcapPiZeroDiscriminatorAlgo::calculateBarrelNNInputVariables(...), a method that calculates
479 // the 12 barrel NN input
480 // OUTPUT:
481 // input_var[12] -> the 12 input to the barrel NN variables array
482 //=====================================================================================
483 
484 void EndcapPiZeroDiscriminatorAlgo::calculateBarrelNNInputVariables(float et, double s1, double s9, double s25,
485  double m2, double cee, double cep,double cpp,
486  double s4, double s6, double ratio,
487  double xcog, double ycog)
488 {
489  input_var = new float[EB_Indim];
490 
491  double lam, lam1, lam2;
492 
493  if(xcog < 0.) {
494  input_var[0] = -xcog/s25;
495  } else {
496  input_var[0] = xcog/s25;
497  }
498 
499  input_var[1] = cee/0.0004;
500 
501  if(cpp<.001) {
502  input_var[2] = cpp/.001;
503  } else {
504  input_var[2] = 0.;
505  }
506 
507  if(s9!=0.) {
508  input_var[3] = s1/s9;
509  input_var[8] = s6/s9;
510  input_var[10] = (m2+s1)/s9;
511  }
512  else {
513  input_var[3] = 0.;
514  input_var[8] = 0.;
515  input_var[10] = 0.;
516  }
517 
518  if(s25-s1>0.) {
519  input_var[4] = (s9-s1)/(s25-s1);
520  } else {
521  input_var[4] = 0.;
522  }
523 
524  if(s25>0.) {
525  input_var[5] = s4/s25;
526  } else {
527  input_var[5] = 0.;
528  }
529 
530  if(ycog < 0.) {
531  input_var[6] = -ycog/s25;
532  } else {
533  input_var[6] = ycog/s25;
534  }
535 
536  input_var[7] = ratio;
537 
538  lam=sqrt((cee -cpp)*(cee -cpp)+4*cep*cep);
539  lam1=(cee + cpp + lam)/2;
540  lam2=(cee + cpp - lam)/2;
541 
542  if(lam1 == 0) {
543  input_var[9] = .0;
544  } else {
545  input_var[9] = lam2/lam1;
546  }
547  if(s4!=0.) {
548  input_var[11] = (m2+s1)/s4;
549  } else {
550  input_var[11] = 0.;
551  }
552 
553 }
554 
555 
556 //=====================================================================================
557 // EndcapPiZeroDiscriminatorAlgo::GetNNOutput(...), a method that calculates the NNoutput
558 // INPUTS: Super Cluster Energy
559 // OUTPUTS : NNoutput
560 //=====================================================================================
562 {
564 
565  float nnout = -1;
566 // Print the NN input variables that are related to the Preshower + ECAL
567 // ------------------------------------------------------------------------
568  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo::GetNNoutput :nn_invar_presh = " ;
569 
570  for(int k1=0;k1<Indim;k1++) {
571  LogTrace("EcalClusters") << input_var[k1] << " " ;
572 
573  }
574  LogTrace("EcalClusters") << " " ;
575 
576  // select the appropriate Weigth file
577  int sel_wfile;
578  if(EE_Et<25.0) {sel_wfile = 0;}
579  else if(EE_Et>=25.0 && EE_Et<35.0) {sel_wfile = 1;}
580  else if(EE_Et>=35.0 && EE_Et<45.0) {sel_wfile = 2;}
581  else if(EE_Et>=45.0 && EE_Et<55.0) {sel_wfile = 3;}
582  else {sel_wfile = 4;}
583 
584  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: Et_SC = " << EE_Et << " and I select Weight file Number = " << sel_wfile ;
585 
586 
587  nnout = getNNoutput(sel_wfile); // calculate the nnoutput for the given ECAL object
588 
589  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: ===================> GetNNOutput : NNout = " << nnout ;
590 
591 
592  return nnout;
593 }
594 
595 
596 //=====================================================================================
597 // EndcapPiZeroDiscriminatorAlgo::GetBarrelNNOutput(...), a method that calculates the barrel NNoutput
598 // INPUTS: Super Cluster Energy
599 // OUTPUTS : NNoutput
600 //=====================================================================================
602 {
603 
605 
606  float nnout = -1;
607 // Print the NN input variables that are related to the ECAL Barrel
608 // ------------------------------------------------------------------------
609  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo::GetBarrelNNoutput :nn_invar_presh = " ;
610 
611  for(int k1=0;k1<Indim;k1++) {
612  LogTrace("EcalClusters") << input_var[k1] << " " ;
613 
614  }
615  LogTrace("EcalClusters") << " " ;
616 
617  // select the appropriate Weigth file
618  int sel_wfile;
619  if(EB_Et<25.0) {sel_wfile = 0;}
620  else if(EB_Et>=25.0 && EB_Et<35.0) {sel_wfile = 1;}
621  else if(EB_Et>=35.0 && EB_Et<45.0) {sel_wfile = 2;}
622  else if(EB_Et>=45.0 && EB_Et<55.0) {sel_wfile = 3;}
623  else {sel_wfile = 4;}
624  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: E_SC = " << EB_Et << " and I select Weight file Number = " << sel_wfile ;
625 
626  nnout = getNNoutput(sel_wfile); // calculate the nnoutput for the given ECAL object
627 
628  LogTrace("EcalClusters") << "EndcapPiZeroDiscriminatorAlgo: ===================> GetNNOutput : NNout = " << nnout ;
629 
630  return nnout;
631 }
632 
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
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
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:18
int j
Definition: DBlmapReader.cc:9
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