CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
EndcapPiZeroDiscriminatorAlgo Class Reference

#include <EndcapPiZeroDiscriminatorAlgo.h>

Public Types

typedef std::map< DetId,
EcalRecHit
RecHitsMap
 

Public Member Functions

float Activation_fun (float SUM)
 
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)
 
bool calculateNNInputVariables (std::vector< float > &vph1, std::vector< float > &vph2, float pS1_max, float pS9_max, float pS25_max, int EScorr)
 
 EndcapPiZeroDiscriminatorAlgo ()
 
 EndcapPiZeroDiscriminatorAlgo (double stripEnergyCut, int nStripCut, const std::string &path)
 
void findPi0Road (ESDetId strip, EcalPreshowerNavigator &theESNav, int plane, std::vector< ESDetId > &vout)
 
std::vector< float > findPreshVector (ESDetId strip, RecHitsMap *rechits_map, CaloSubdetectorTopology *topology_p)
 
float * get_input_vector ()
 
float GetBarrelNNOutput (float EB_Et)
 
float getNNoutput (int sel_wfile)
 
float GetNNOutput (float EE_Et)
 
bool goodPi0Strip (RecHitsMap::iterator candidate_it, ESDetId lastID)
 
void readWeightFile (const char *WFile)
 
 ~EndcapPiZeroDiscriminatorAlgo ()
 

Private Attributes

int barrelstart
 
int debugLevel_
 
int EB_Hidden
 
int EB_Indim
 
int EB_Layers
 
int EB_Outdim
 
int EE_Hidden
 
int EE_Indim
 
int EE_Layers
 
int EE_Outdim
 
float * H_O_Weight
 
std::vector< float > H_O_Weight_all
 
float * H_Thresh
 
std::vector< float > H_Thresh_all
 
int Hidden
 
float * I_H_Weight
 
std::vector< float > I_H_Weight_all
 
int Indim
 
int inp_var
 
float * input_var
 
int Layers
 
int Nfiles_EB
 
int Nfiles_EE
 
float * O_Thresh
 
std::vector< float > O_Thresh_all
 
int Outdim
 
std::string pathToFiles_
 
int preshSeededNstr_
 
double preshStripEnergyCut_
 
RecHitsMaprechits_map
 

Detailed Description

Definition at line 16 of file EndcapPiZeroDiscriminatorAlgo.h.

Member Typedef Documentation

Definition at line 20 of file EndcapPiZeroDiscriminatorAlgo.h.

Constructor & Destructor Documentation

EndcapPiZeroDiscriminatorAlgo::EndcapPiZeroDiscriminatorAlgo ( )
inline
EndcapPiZeroDiscriminatorAlgo::EndcapPiZeroDiscriminatorAlgo ( double  stripEnergyCut,
int  nStripCut,
const std::string &  path 
)
EndcapPiZeroDiscriminatorAlgo::~EndcapPiZeroDiscriminatorAlgo ( )
inline

Definition at line 29 of file EndcapPiZeroDiscriminatorAlgo.h.

29 {};

Member Function Documentation

float EndcapPiZeroDiscriminatorAlgo::Activation_fun ( float  SUM)

Definition at line 343 of file EndcapPiZeroDiscriminatorAlgo.cc.

References create_public_lumi_plots::exp.

Referenced by getNNoutput().

343  {
344  return( 1.0 / ( 1.0 + exp(-2.0*SUM) ) );
345 }
#define SUM(A, B)
void EndcapPiZeroDiscriminatorAlgo::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 
)

Definition at line 483 of file EndcapPiZeroDiscriminatorAlgo.cc.

References EB_Indim, input_var, and mathSSE::sqrt().

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 }
T sqrt(T t)
Definition: SSEVec.h:48
bool EndcapPiZeroDiscriminatorAlgo::calculateNNInputVariables ( std::vector< float > &  vph1,
std::vector< float > &  vph2,
float  pS1_max,
float  pS9_max,
float  pS25_max,
int  EScorr 
)

Definition at line 357 of file EndcapPiZeroDiscriminatorAlgo.cc.

References alignCSCRings::e, EE_Indim, input_var, relval_steps::k, GetRecoTauVFromDQM_MC_cff::kk, and LogTrace.

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 }
int i
Definition: DBlmapReader.cc:9
#define LogTrace(id)
void EndcapPiZeroDiscriminatorAlgo::findPi0Road ( ESDetId  strip,
EcalPreshowerNavigator theESNav,
int  plane,
std::vector< ESDetId > &  vout 
)

Definition at line 163 of file EndcapPiZeroDiscriminatorAlgo.cc.

References CaloNavigator< T, TOPO >::east(), CaloNavigator< T, TOPO >::home(), LogTrace, GetRecoTauVFromDQM_MC_cff::next, CaloNavigator< T, TOPO >::north(), preshSeededNstr_, CaloNavigator< T, TOPO >::setHome(), CaloNavigator< T, TOPO >::south(), and CaloNavigator< T, TOPO >::west().

Referenced by findPreshVector().

164  {
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 }
void setHome(const T &startingPoint)
set the starting position
T west() const
move the navigator west
Definition: CaloNavigator.h:59
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
T north() const
move the navigator north
Definition: CaloNavigator.h:38
vector< float > EndcapPiZeroDiscriminatorAlgo::findPreshVector ( ESDetId  strip,
RecHitsMap rechits_map,
CaloSubdetectorTopology topology_p 
)

Definition at line 62 of file EndcapPiZeroDiscriminatorAlgo.cc.

References findPi0Road(), goodPi0Strip(), i, LogTrace, HLT_25ns14e33_v1_cff::navigator, ESDetId::plane(), CaloNavigator< T, TOPO >::setHome(), and ESDetId::strip().

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 }
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
#define LogTrace(id)
bool goodPi0Strip(RecHitsMap::iterator candidate_it, ESDetId lastID)
int plane() const
Definition: ESDetId.h:46
float* EndcapPiZeroDiscriminatorAlgo::get_input_vector ( )
inline
float EndcapPiZeroDiscriminatorAlgo::GetBarrelNNOutput ( float  EB_Et)

Definition at line 600 of file EndcapPiZeroDiscriminatorAlgo.cc.

References barrelstart, EB_Hidden, EB_Indim, EB_Layers, EB_Outdim, getNNoutput(), Indim, input_var, Layers, LogTrace, and Outdim.

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 }
#define LogTrace(id)
float EndcapPiZeroDiscriminatorAlgo::getNNoutput ( int  sel_wfile)

Definition at line 303 of file EndcapPiZeroDiscriminatorAlgo.cc.

References Activation_fun(), barrelstart, EE_Hidden, EE_Indim, EE_Outdim, h, H_O_Weight_all, H_Thresh_all, Hidden, i, I_H_Weight_all, Indim, input_var, relval_steps::k, LogTrace, O_Thresh_all, and Outdim.

Referenced by GetBarrelNNOutput(), and GetNNOutput().

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 }
int i
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
#define LogTrace(id)
float EndcapPiZeroDiscriminatorAlgo::GetNNOutput ( float  EE_Et)

Definition at line 560 of file EndcapPiZeroDiscriminatorAlgo.cc.

References barrelstart, EE_Hidden, EE_Indim, EE_Layers, EE_Outdim, getNNoutput(), Indim, input_var, Layers, LogTrace, and Outdim.

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 }
#define LogTrace(id)
bool EndcapPiZeroDiscriminatorAlgo::goodPi0Strip ( RecHitsMap::iterator  candidate_it,
ESDetId  lastID 
)

Definition at line 142 of file EndcapPiZeroDiscriminatorAlgo.cc.

References LogTrace, and preshStripEnergyCut_.

Referenced by findPreshVector().

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 }
#define LogTrace(id)
void EndcapPiZeroDiscriminatorAlgo::readWeightFile ( const char *  WFile)

Definition at line 238 of file EndcapPiZeroDiscriminatorAlgo.cc.

References assert(), H_O_Weight, H_Thresh, Hidden, I_H_Weight, Indim, inp_var, j, Layers, geometryCSVtoXML::line, LogTrace, O_Thresh, Outdim, and create_public_pileup_plots::weights.

238  {
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 }
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
int j
Definition: DBlmapReader.cc:9
#define LogTrace(id)

Member Data Documentation

int EndcapPiZeroDiscriminatorAlgo::barrelstart
private

Definition at line 65 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by GetBarrelNNOutput(), getNNoutput(), and GetNNOutput().

int EndcapPiZeroDiscriminatorAlgo::debugLevel_
private

Definition at line 62 of file EndcapPiZeroDiscriminatorAlgo.h.

int EndcapPiZeroDiscriminatorAlgo::EB_Hidden
private

Definition at line 72 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by GetBarrelNNOutput().

int EndcapPiZeroDiscriminatorAlgo::EB_Indim
private
int EndcapPiZeroDiscriminatorAlgo::EB_Layers
private

Definition at line 72 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by GetBarrelNNOutput().

int EndcapPiZeroDiscriminatorAlgo::EB_Outdim
private

Definition at line 72 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by GetBarrelNNOutput().

int EndcapPiZeroDiscriminatorAlgo::EE_Hidden
private

Definition at line 71 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by getNNoutput(), and GetNNOutput().

int EndcapPiZeroDiscriminatorAlgo::EE_Indim
private
int EndcapPiZeroDiscriminatorAlgo::EE_Layers
private

Definition at line 71 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by GetNNOutput().

int EndcapPiZeroDiscriminatorAlgo::EE_Outdim
private

Definition at line 71 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by getNNoutput(), and GetNNOutput().

float* EndcapPiZeroDiscriminatorAlgo::H_O_Weight
private

Definition at line 75 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by readWeightFile().

std::vector<float> EndcapPiZeroDiscriminatorAlgo::H_O_Weight_all
private

Definition at line 80 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by getNNoutput().

float* EndcapPiZeroDiscriminatorAlgo::H_Thresh
private

Definition at line 76 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by readWeightFile().

std::vector<float> EndcapPiZeroDiscriminatorAlgo::H_Thresh_all
private

Definition at line 81 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by getNNoutput().

int EndcapPiZeroDiscriminatorAlgo::Hidden
private

Definition at line 70 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by getNNoutput(), and readWeightFile().

float* EndcapPiZeroDiscriminatorAlgo::I_H_Weight
private

Definition at line 74 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by readWeightFile().

std::vector<float> EndcapPiZeroDiscriminatorAlgo::I_H_Weight_all
private

Definition at line 79 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by getNNoutput().

int EndcapPiZeroDiscriminatorAlgo::Indim
private
int EndcapPiZeroDiscriminatorAlgo::inp_var
private

Definition at line 64 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by readWeightFile().

float* EndcapPiZeroDiscriminatorAlgo::input_var
private
int EndcapPiZeroDiscriminatorAlgo::Layers
private

Definition at line 70 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by GetBarrelNNOutput(), GetNNOutput(), and readWeightFile().

int EndcapPiZeroDiscriminatorAlgo::Nfiles_EB
private

Definition at line 67 of file EndcapPiZeroDiscriminatorAlgo.h.

int EndcapPiZeroDiscriminatorAlgo::Nfiles_EE
private

Definition at line 68 of file EndcapPiZeroDiscriminatorAlgo.h.

float* EndcapPiZeroDiscriminatorAlgo::O_Thresh
private

Definition at line 77 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by readWeightFile().

std::vector<float> EndcapPiZeroDiscriminatorAlgo::O_Thresh_all
private

Definition at line 82 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by getNNoutput().

int EndcapPiZeroDiscriminatorAlgo::Outdim
private
std::string EndcapPiZeroDiscriminatorAlgo::pathToFiles_
private

Definition at line 92 of file EndcapPiZeroDiscriminatorAlgo.h.

int EndcapPiZeroDiscriminatorAlgo::preshSeededNstr_
private

Definition at line 61 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by findPi0Road().

double EndcapPiZeroDiscriminatorAlgo::preshStripEnergyCut_
private

Definition at line 56 of file EndcapPiZeroDiscriminatorAlgo.h.

Referenced by goodPi0Strip().

RecHitsMap* EndcapPiZeroDiscriminatorAlgo::rechits_map
private

Definition at line 89 of file EndcapPiZeroDiscriminatorAlgo.h.