92 cout <<
"\n PiZeroDiscriminatorProducer: ....... Event " << evt.
id() <<
" with Number = " <<
nEvt_+1
93 <<
" is analyzing ....... " << endl << endl;
100 cout <<
"\n PiZeroDiscriminatorProducer: pPreshowerShapeClustersX->size() = " << clustersX->size() << endl;
107 cout <<
"\n PiZeroDiscriminatorProducer: pPreshowerShapeClustersY->size() = " << clustersY->size() << endl;
132 cout <<
" PiZeroDiscriminatorProducer: Photon Collection size : " << corrPhoCollection.size() << endl;
135 for( PhotonCollection::const_iterator iPho = corrPhoCollection.begin(); iPho != corrPhoCollection.end(); iPho++) {
137 float Phot_En = iPho->energy();
138 float Phot_Et = Phot_En*
sin(2*atan(
exp(-iPho->eta())));
139 float Phot_eta = iPho->eta();
140 float Phot_phi = iPho->phi();
141 float Phot_R9 = iPho->r9();
144 cout <<
" PiZeroDiscriminatorProducer: Photon index : " << iPho - corrPhoCollection.begin()
145 <<
" with Energy = " << Phot_En
146 <<
" Et = " << Phot_Et
147 <<
" ETA = " << Phot_eta
148 <<
" PHI = " << Phot_phi
149 <<
" R9 = " << Phot_R9 << endl;
153 float SC_En = it_super->energy();
154 float SC_Et = SC_En*
sin(2*atan(
exp(-it_super->eta())));
155 float SC_eta = it_super->eta();
156 float SC_phi = it_super->phi();
159 cout <<
" PiZeroDiscriminatorProducer: superE = " << SC_En
160 <<
" superEt = " << SC_Et
161 <<
" superETA = " << SC_eta
162 <<
" superPHI = " << SC_phi << endl;
172 float nnoutput = -1.;
173 if(fabs(SC_eta) >= 1.65 && fabs(SC_eta) <= 2.5) {
174 const GlobalPoint pointSC(it_super->x(),it_super->y(),it_super->z());
176 double SC_seed_energy = it_super->seed()->energy();
180 EcalClusterTools::eMax( *seed, ebRecHits );
182 double SC_seed_Shape_E1 = EcalClusterTools::eMax( *seed, eeRecHits );
183 double SC_seed_Shape_E3x3 = EcalClusterTools::e3x3( *seed, eeRecHits, topology );
184 double SC_seed_Shape_E5x5 = EcalClusterTools::e5x5( *seed, eeRecHits, topology );
187 cout <<
"PiZeroDiscriminatorProducer: ( SeedBC_energy, E1, E3x3, E5x5) = "
188 << SC_seed_energy <<
" "
189 << SC_seed_Shape_E1 <<
" "
190 << SC_seed_Shape_E3x3 <<
" "
191 << SC_seed_Shape_E5x5 << endl;
195 vector<float> vout_stripE1;
196 vector<float> vout_stripE2;
197 for(reco::PreshowerClusterShapeCollection::const_iterator esClus = clustersX->begin();
198 esClus !=clustersX->end(); esClus++) {
200 float dR =
sqrt((SC_eta-sc_ref->eta())*(SC_eta-sc_ref->eta()) +
201 (SC_phi-sc_ref->phi())*(SC_phi-sc_ref->phi()));
204 vout_stripE1 = esClus->getStripEnergies();
208 for(reco::PreshowerClusterShapeCollection::const_iterator esClus = clustersY->begin();
209 esClus !=clustersY->end(); esClus++) {
211 float dR =
sqrt((SC_eta-sc_ref->eta())*(SC_eta-sc_ref->eta()) +
212 (SC_phi-sc_ref->phi())*(SC_phi-sc_ref->phi()));
215 vout_stripE2 = esClus->getStripEnergies();
220 if(vout_stripE1.size() == 0 || vout_stripE2.size() == 0 ) {
222 cout <<
" PiZeroDiscriminatorProducer: Attention!!!!! Not Valid ES NN input Variables Return NNout = -1" << endl;
223 Pi0Assocs_p->insert(
Ref<PhotonCollection>(correctedPhotonHandle,iPho - corrPhoCollection.begin()), nnoutput);
228 cout <<
"PiZeroDiscriminatorProducer : vout_stripE1.size = " << vout_stripE1.size()
229 <<
" vout_stripE2.size = " << vout_stripE2.size() << endl;
230 cout <<
"PiZeroDiscriminatorProducer : ES_input_vector = " ;
231 for(
int k1=0;k1<11;k1++) {
232 cout << vout_stripE1[k1] <<
" " ;
234 for(
int k1=0;k1<11;k1++) {
235 cout << vout_stripE2[k1] <<
" " ;
241 SC_seed_Shape_E1, SC_seed_Shape_E3x3, SC_seed_Shape_E5x5,
EScorr_);
245 cout <<
" PiZeroDiscriminatorProducer: Attention!!!!! Not Valid ES NN input Variables Return NNout = -1" << endl;
246 Pi0Assocs_p->insert(
Ref<PhotonCollection>(correctedPhotonHandle,iPho - corrPhoCollection.begin()), nnoutput);
253 cout <<
" PiZeroDiscriminatorProducer: NN_ESEndcap_input_vector+Et+Eta+Phi+R9 = " ;
254 for(
int k1=0;k1<25;k1++) {
255 cout << nn_input_var[k1] <<
" " ;
257 cout << SC_Et <<
" " << SC_eta <<
" " << SC_phi <<
" " << Phot_R9 << endl;
263 cout <<
" PiZeroDiscriminatorProducer: Event : " << evt.
id()
264 <<
" SC id = " << iPho - corrPhoCollection.begin()
265 <<
" with Pt = " << SC_Et
266 <<
" eta = " << SC_eta
267 <<
" phi = " << SC_phi
268 <<
" contains: " << it_super->clustersSize() <<
" BCs "
269 <<
" has NNout = " << nnoutput << endl;
272 Pi0Assocs_p->insert(
Ref<PhotonCollection>(correctedPhotonHandle,iPho - corrPhoCollection.begin()), nnoutput);
274 }
else if((fabs(SC_eta) <= 1.4442) || (fabs(SC_eta) < 1.65 && fabs(SC_eta) >= 1.566) || fabs(SC_eta) >= 2.5) {
278 double SC_seed_Shape_E1 = EcalClusterTools::eMax( *seed, ebRecHits );
279 double SC_seed_Shape_E3x3 = EcalClusterTools::e3x3( *seed, ebRecHits, topology );
280 double SC_seed_Shape_E5x5 = EcalClusterTools::e5x5( *seed, ebRecHits, topology );
281 double SC_seed_Shape_E2 = EcalClusterTools::e2nd( *seed, ebRecHits );
283 std::vector<float> vCov = EcalClusterTools::covariances( *seed, ebRecHits , topology, geometry,
w0_ );
285 double SC_seed_Shape_cEE = vCov[0];
286 double SC_seed_Shape_cEP = vCov[1];
287 double SC_seed_Shape_cPP = vCov[2];
289 double SC_seed_Shape_E2x2 = EcalClusterTools::e2x2( *seed, ebRecHits, topology );
290 double SC_seed_Shape_E3x2 = EcalClusterTools::e3x2( *seed, ebRecHits, topology );
292 double SC_seed_Shape_E3x2r = 0.0;
293 double SC_seed_Shape_ELeft = EcalClusterTools::eLeft( *seed, ebRecHits, topology );
294 double SC_seed_Shape_ERight = EcalClusterTools::eRight( *seed, ebRecHits, topology );
295 double SC_seed_Shape_ETop = EcalClusterTools::eTop( *seed, ebRecHits, topology );
296 double SC_seed_Shape_EBottom = EcalClusterTools::eBottom( *seed, ebRecHits, topology );
298 double DA = SC_seed_Shape_E2x2 - SC_seed_Shape_E2 - SC_seed_Shape_E1;
300 if(SC_seed_Shape_E2==SC_seed_Shape_ETop || SC_seed_Shape_E2==SC_seed_Shape_EBottom) {
301 if( SC_seed_Shape_ELeft > SC_seed_Shape_ERight ) {
302 SC_seed_Shape_E3x2r = (DA - SC_seed_Shape_ELeft)/(0.25+SC_seed_Shape_ELeft);
304 SC_seed_Shape_E3x2r = (DA - SC_seed_Shape_ERight)/(0.25+SC_seed_Shape_ERight);
307 }
else if(SC_seed_Shape_E2==SC_seed_Shape_ELeft || SC_seed_Shape_E2==SC_seed_Shape_ERight) {
309 if( SC_seed_Shape_ETop > SC_seed_Shape_EBottom ) {
310 SC_seed_Shape_E3x2r = (DA - SC_seed_Shape_ETop)/(0.25+SC_seed_Shape_ETop);
312 SC_seed_Shape_E3x2r = (DA - SC_seed_Shape_EBottom)/(0.25+SC_seed_Shape_EBottom);
317 double SC_seed_Shape_xcog = EcalClusterTools::eRight( *seed, ebRecHits, topology ) - EcalClusterTools::e2x5Left( *seed, ebRecHits, topology );
318 double SC_seed_Shape_ycog = EcalClusterTools::e2x5Top( *seed, ebRecHits, topology ) - EcalClusterTools::e2x5Bottom( *seed, ebRecHits, topology );
322 cout <<
"PiZeroDiscriminatorProduce: lazyTool (E1,E3x3,E5x5,E2,cEE,cEP,cPP,E2x2,E3x2_E3x2r,Xcog,Ycog,E2x5Bottom,E2x5Top,Et,Eta,PhiR9) = ( "
323 << SC_seed_Shape_E1 <<
" "
324 << SC_seed_Shape_E3x3 <<
" "
325 << SC_seed_Shape_E5x5 <<
" "
326 << SC_seed_Shape_E2 <<
" "
327 << SC_seed_Shape_cEE <<
" "
328 << SC_seed_Shape_cEP <<
" "
329 << SC_seed_Shape_cPP <<
" "
330 << SC_seed_Shape_E2x2 <<
" "
331 << SC_seed_Shape_E3x2 <<
" "
332 << SC_seed_Shape_E3x2r <<
" "
333 << SC_seed_Shape_xcog <<
" "
334 << SC_seed_Shape_ycog <<
" "
335 << EcalClusterTools::e2x5Bottom( *seed, ebRecHits, topology ) <<
" "
336 << EcalClusterTools::e2x5Top( *seed, ebRecHits, topology ) <<
" "
340 << Phot_R9 <<
" )" << endl;
343 float SC_et = it_super->energy()*
sin(2*atan(
exp(-it_super->eta())));
346 SC_seed_Shape_E5x5, SC_seed_Shape_E2,
347 SC_seed_Shape_cEE, SC_seed_Shape_cEP,
348 SC_seed_Shape_cPP, SC_seed_Shape_E2x2,
349 SC_seed_Shape_E3x2, SC_seed_Shape_E3x2r,
350 SC_seed_Shape_xcog, SC_seed_Shape_ycog);
355 cout <<
" PiZeroDiscriminatorProducer : NN_barrel_nonESEndcap_variables+Et+Eta+Phi+R9 = " ;
356 for(
int k3=0;k3<12;k3++) {
357 cout << nn_input_var[k3] <<
" " ;
359 cout << SC_Et <<
" " << SC_eta <<
" " << SC_phi <<
" " << Phot_R9 << endl;
367 cout <<
"PiZeroDiscriminatorProducer : Event : " << evt.
id()
368 <<
" SC id = " << iPho - corrPhoCollection.begin()
369 <<
" with Pt = " << SC_Et
370 <<
" eta = " << SC_eta
371 <<
" phi = " << SC_phi
372 <<
" contains: " << it_super->clustersSize() <<
" BCs "
373 <<
" has NNout = " << nnoutput
377 Pi0Assocs_p->insert(
Ref<PhotonCollection>(correctedPhotonHandle,iPho - corrPhoCollection.begin()), nnoutput);
378 }
else { Pi0Assocs_p->insert(
Ref<PhotonCollection>(correctedPhotonHandle,iPho - corrPhoCollection.begin()), -1.);}
382 if (
debugL_pi0 <=
pDEBUG )
cout <<
"PiZeroDiscriminatorProducer: PhotonPi0DiscriminatorAssociationMap added to the event" << endl;
386 LogDebug(
"PiZeroDiscriminatorDebug") << ostr.str();
float * get_input_vector()
float GetNNOutput(float EE_Et)
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Sin< T >::type sin(const T &t)
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)
DebugLevel_pi0 debugL_pi0
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollectionToken_
edm::EDGetTokenT< reco::PreshowerClusterShapeCollection > pPreshowerShapeClustersYToken_
edm::EDGetTokenT< reco::PhotonCollection > correctedPhotonToken_
edm::EDGetTokenT< reco::PreshowerClusterShapeCollection > pPreshowerShapeClustersXToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< PreshowerClusterShape > PreshowerClusterShapeCollection
collection of PreshowerClusterShape objects
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollectionToken_
float GetBarrelNNOutput(float EB_Et)
T const * product() const
std::string PhotonPi0DiscriminatorAssociationMap_
std::vector< Photon > PhotonCollection
collectin of Photon objects
T const * product() const
ESHandle< TrackerGeometry > geometry
bool calculateNNInputVariables(std::vector< float > &vph1, std::vector< float > &vph2, float pS1_max, float pS9_max, float pS25_max, int EScorr)
EndcapPiZeroDiscriminatorAlgo * presh_pi0_algo