![]() |
![]() |
#include <EgammaAnalysis/PhotonIDProducers/interface/PiZeroDiscriminatorProducer.h>
Definition at line 25 of file PiZeroDiscriminatorProducer.h.
Definition at line 31 of file PiZeroDiscriminatorProducer.h.
PiZeroDiscriminatorProducer::PiZeroDiscriminatorProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
----
Definition at line 36 of file PiZeroDiscriminatorProducer.cc.
References barrelRecHitCollection_, correctedPhotonCollection_, debugL_pi0, endcapRecHitCollection_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), nEvt_, EndcapPiZeroDiscriminatorAlgo::pDEBUG, EndcapPiZeroDiscriminatorAlgo::pERROR, photonCorrCollectionProducer_, PhotonPi0DiscriminatorAssociationMap_, EndcapPiZeroDiscriminatorAlgo::pINFO, presh_pi0_algo, preshClusterShapeCollectionX_, preshClusterShapeCollectionY_, and preshClusterShapeProducer_.
00036 { 00037 // use configuration file to setup input/output collection names 00038 00039 preshClusterShapeCollectionX_ = ps.getParameter<std::string>("preshClusterShapeCollectionX"); 00040 preshClusterShapeCollectionY_ = ps.getParameter<std::string>("preshClusterShapeCollectionY"); 00041 preshClusterShapeProducer_ = ps.getParameter<std::string>("preshClusterShapeProducer"); 00042 00043 photonCorrCollectionProducer_ = ps.getParameter<string>("corrPhoProducer"); 00044 correctedPhotonCollection_ = ps.getParameter<string>("correctedPhotonCollection"); 00045 00046 barrelRecHitCollection_ = ps.getParameter<edm::InputTag>("barrelRecHitCollection"); 00047 endcapRecHitCollection_ = ps.getParameter<edm::InputTag>("endcapRecHitCollection"); 00048 00049 float preshStripECut = ps.getParameter<double>("preshStripEnergyCut"); 00050 int preshNst = ps.getParameter<int>("preshPi0Nstrip"); 00051 00052 PhotonPi0DiscriminatorAssociationMap_ = ps.getParameter<string>("Pi0Association"); 00053 00054 string debugString = ps.getParameter<string>("debugLevel"); 00055 00056 if (debugString == "DEBUG") debugL_pi0 = EndcapPiZeroDiscriminatorAlgo::pDEBUG; 00057 else if (debugString == "INFO") debugL_pi0 = EndcapPiZeroDiscriminatorAlgo::pINFO; 00058 else debugL_pi0 = EndcapPiZeroDiscriminatorAlgo::pERROR; 00059 00060 string tmpPath = ps.getUntrackedParameter<string>("pathToWeightFiles","RecoEcal/EgammaClusterProducers/data/"); 00061 00062 presh_pi0_algo = new EndcapPiZeroDiscriminatorAlgo(preshStripECut, preshNst, tmpPath.c_str(), debugL_pi0); 00063 00064 produces< PhotonPi0DiscriminatorAssociationMap >(PhotonPi0DiscriminatorAssociationMap_); 00065 00066 nEvt_ = 0; 00067 00068 }
PiZeroDiscriminatorProducer::~PiZeroDiscriminatorProducer | ( | ) |
Definition at line 71 of file PiZeroDiscriminatorProducer.cc.
References presh_pi0_algo.
00071 { 00072 delete presh_pi0_algo; 00073 }
PiZeroDiscriminatorProducer::PiZeroDiscriminatorProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
PiZeroDiscriminatorProducer::~PiZeroDiscriminatorProducer | ( | ) |
virtual void PiZeroDiscriminatorProducer::produce | ( | edm::Event & | evt, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Implements edm::EDProducer.
void PiZeroDiscriminatorProducer::produce | ( | edm::Event & | evt, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 76 of file PiZeroDiscriminatorProducer.cc.
References barrelRecHitCollection_, EndcapPiZeroDiscriminatorAlgo::calculateBarrelNNInputVariables(), EndcapPiZeroDiscriminatorAlgo::calculateNNInputVariables(), correctedPhotonCollection_, GenMuonPlsPt100GeV_cfg::cout, EcalClusterLazyTools::covariances(), debugL_pi0, EcalClusterLazyTools::e2nd(), EcalClusterLazyTools::e2x2(), EcalClusterLazyTools::e2x5Bottom(), EcalClusterLazyTools::e2x5Left(), EcalClusterLazyTools::e2x5Right(), EcalClusterLazyTools::e2x5Top(), EcalClusterLazyTools::e3x2(), EcalClusterLazyTools::e3x3(), EcalClusterLazyTools::e5x5(), EcalClusterLazyTools::eMax(), endcapRecHitCollection_, lat::endl(), funct::exp(), EndcapPiZeroDiscriminatorAlgo::get_input_vector(), EndcapPiZeroDiscriminatorAlgo::GetBarrelNNOutput(), edm::Event::getByLabel(), EndcapPiZeroDiscriminatorAlgo::GetNNOutput(), edm::Event::id(), LogDebug, nEvt_, EndcapPiZeroDiscriminatorAlgo::pDEBUG, photonCorrCollectionProducer_, PhotonPi0DiscriminatorAssociationMap_, presh_pi0_algo, preshClusterShapeCollectionX_, preshClusterShapeCollectionY_, preshClusterShapeProducer_, edm::Handle< T >::product(), edm::Event::put(), funct::sin(), and funct::sqrt().
00076 { 00077 00078 ostringstream ostr; // use this stream for all messages in produce 00079 00080 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) 00081 cout << "\n ....... Event " << evt.id() << " with Number = " << nEvt_+1 00082 << " is analyzing ....... " << endl << endl; 00083 00084 // Get ES clusters in X plane 00085 Handle<reco::PreshowerClusterShapeCollection> pPreshowerShapeClustersX; 00086 evt.getByLabel(preshClusterShapeProducer_, preshClusterShapeCollectionX_, pPreshowerShapeClustersX); 00087 const reco::PreshowerClusterShapeCollection *clustersX = pPreshowerShapeClustersX.product(); 00088 cout << "\n pPreshowerShapeClustersX->size() = " << clustersX->size() << endl; 00089 00090 // Get ES clusters in Y plane 00091 Handle<reco::PreshowerClusterShapeCollection> pPreshowerShapeClustersY; 00092 evt.getByLabel(preshClusterShapeProducer_, preshClusterShapeCollectionY_, pPreshowerShapeClustersY); 00093 const reco::PreshowerClusterShapeCollection *clustersY = pPreshowerShapeClustersY.product(); 00094 cout << "\n pPreshowerShapeClustersY->size() = " << clustersY->size() << endl; 00095 00096 auto_ptr<PhotonPi0DiscriminatorAssociationMap> Pi0Assocs_p(new PhotonPi0DiscriminatorAssociationMap); 00097 00098 //make cycle over Photon Collection 00099 int Photon_index = 0; 00100 Handle<PhotonCollection> correctedPhotonHandle; 00101 evt.getByLabel(photonCorrCollectionProducer_, correctedPhotonCollection_ , correctedPhotonHandle); 00102 const PhotonCollection corrPhoCollection = *(correctedPhotonHandle.product()); 00103 cout << " Photon Collection size : " << corrPhoCollection.size() << endl; 00104 for( PhotonCollection::const_iterator iPho = corrPhoCollection.begin(); iPho != corrPhoCollection.end(); iPho++) { 00105 //float Phot_R9 = iPho->r9(); 00106 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00107 cout << " Photon index : " << Photon_index 00108 << " with Energy = " << iPho->energy() 00109 << " Et = " << iPho->energy()*sin(2*atan(exp(-iPho->eta()))) 00110 << " ETA = " << iPho->eta() 00111 << " PHI = " << iPho->phi() << endl; 00112 } 00113 SuperClusterRef it_super = iPho->superCluster(); 00114 00115 float SC_Et = it_super->energy()*sin(2*atan(exp(-it_super->eta()))); 00116 float SC_eta = it_super->eta(); 00117 float SC_phi = it_super->phi(); 00118 00119 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00120 cout << " superE = " << it_super->energy() 00121 << " superEt = " << it_super->energy()*sin(2*atan(exp(-it_super->eta()))) 00122 << " superETA = " << it_super->eta() 00123 << " superPHI = " << it_super->phi() << endl; 00124 } 00125 00126 // New way to get ClusterShape info 00127 //BasicClusterShapeAssociationCollection::const_iterator seedShpItr; 00128 // Find the entry in the map corresponding to the seed BasicCluster of the SuperCluster 00129 DetId id = it_super->seed()->getHitsByDetId()[0]; 00130 00131 // get on-the-fly the cluster shapes 00132 EcalClusterLazyTools lazyTool( evt, es, barrelRecHitCollection_, endcapRecHitCollection_ ); 00133 00134 float nnoutput = -1.; 00135 if(fabs(SC_eta) >= 1.65 && fabs(SC_eta) <= 2.5) { // Use Preshower region only 00136 const GlobalPoint pointSC(it_super->x(),it_super->y(),it_super->z()); // get the centroid of the SC 00137 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) cout << "SC centroind = " << pointSC << endl; 00138 double SC_seed_energy = it_super->seed()->energy(); 00139 00140 const BasicClusterRef seed = it_super->seed(); 00141 double SC_seed_Shape_E1 = lazyTool.eMax( *seed ); 00142 double SC_seed_Shape_E3x3 = lazyTool.e3x3( *seed ); 00143 double SC_seed_Shape_E5x5 = lazyTool.e5x5( *seed ); 00144 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00145 cout << "BC energy_max = " << SC_seed_energy << endl; 00146 cout << "ClusterShape E1_max_New = " << SC_seed_Shape_E1 << endl; 00147 cout << "ClusterShape E3x3_max_New = " << SC_seed_Shape_E3x3 << endl; 00148 cout << "ClusterShape E5x5_max_New = " << SC_seed_Shape_E5x5 << endl; 00149 } 00150 // Get the Preshower 2-planes energy vectors associated with the given SC 00151 vector<float> vout_stripE1; 00152 vector<float> vout_stripE2; 00153 for(reco::PreshowerClusterShapeCollection::const_iterator esClus = clustersX->begin(); 00154 esClus !=clustersX->end(); esClus++) { 00155 SuperClusterRef sc_ref = esClus->superCluster(); 00156 float dR = sqrt((SC_eta-sc_ref->eta())*(SC_eta-sc_ref->eta()) + 00157 (SC_phi-sc_ref->phi())*(SC_phi-sc_ref->phi())); 00158 // if( it_super == esClus->superCluster()) { 00159 if(dR < 0.01 ) { 00160 00161 vout_stripE1 = esClus->getStripEnergies(); 00162 00163 } 00164 } 00165 for(reco::PreshowerClusterShapeCollection::const_iterator esClus = clustersY->begin(); 00166 esClus !=clustersY->end(); esClus++) { 00167 SuperClusterRef sc_ref = esClus->superCluster(); 00168 float dR = sqrt((SC_eta-sc_ref->eta())*(SC_eta-sc_ref->eta()) + 00169 (SC_phi-sc_ref->phi())*(SC_phi-sc_ref->phi())); 00170 // if( it_super == esClus->superCluster()) { 00171 if(dR < 0.01 ) { 00172 00173 vout_stripE2 = esClus->getStripEnergies(); 00174 00175 } 00176 } 00177 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00178 cout << "PiZeroDiscriminatorProducer : ES_input_vector = " ; 00179 for(int k1=0;k1<11;k1++) { 00180 cout << vout_stripE1[k1] << " " ; 00181 } 00182 for(int k1=0;k1<11;k1++) { 00183 cout << vout_stripE2[k1] << " " ; 00184 } 00185 cout << endl; 00186 } 00187 00188 bool valid_NNinput = presh_pi0_algo->calculateNNInputVariables(vout_stripE1, vout_stripE2, 00189 SC_seed_Shape_E1, SC_seed_Shape_E3x3, SC_seed_Shape_E5x5); 00190 00191 if(!valid_NNinput) { 00192 cout << " PiZeroDiscProducer: Attention!!!!! Not Valid NN input Variables Return " << endl; 00193 continue; 00194 } 00195 00196 float* nn_input_var = presh_pi0_algo->get_input_vector(); 00197 00198 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00199 cout << " PiZeroDiscProducer: NN_input_vector = " ; 00200 for(int k1=0;k1<25;k1++) { 00201 cout << nn_input_var[k1] << " " ; 00202 } 00203 cout << endl; 00204 } 00205 00206 nnoutput = presh_pi0_algo->GetNNOutput(SC_Et); 00207 00208 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00209 cout << "PreshowerPi0NNProducer:Event : " << evt.id() 00210 << " SC id = " << Photon_index 00211 << " with Pt = " << SC_Et 00212 << " eta = " << SC_eta 00213 << " phi = " << SC_phi 00214 << " contains: " << it_super->clustersSize() << " BCs " 00215 // << " R9 = " << Phot_R9 00216 << " has NNout = " << nnoutput << endl; 00217 } 00218 Pi0Assocs_p->insert(Ref<PhotonCollection>(correctedPhotonHandle,Photon_index), nnoutput); 00219 00220 } else if((fabs(SC_eta) <= 1.4442) || (fabs(SC_eta) < 1.65 && fabs(SC_eta) >= 1.566) || fabs(SC_eta) >= 2.5) { 00221 00222 const BasicClusterRef seed = it_super->seed(); 00223 00224 double SC_seed_Shape_E1 = lazyTool.eMax( *seed ); 00225 double SC_seed_Shape_E3x3 = lazyTool.e3x3( *seed ); 00226 double SC_seed_Shape_E5x5 = lazyTool.e5x5( *seed ); 00227 double SC_seed_Shape_E2 = lazyTool.e2nd( *seed ); 00228 double SC_seed_Shape_cEE = lazyTool.covariances( *seed )[0]; 00229 double SC_seed_Shape_cEP = lazyTool.covariances( *seed )[1]; 00230 double SC_seed_Shape_cPP = lazyTool.covariances( *seed )[2]; 00231 double SC_seed_Shape_E2x2 = lazyTool.e2x2( *seed ); 00232 double SC_seed_Shape_E3x2 = lazyTool.e3x2( *seed ); 00233 // double SC_seed_Shape_E3x2r = lazyTool.e3x2Ratio( *seed ); // FIXME temporarily unavailable 00234 // waiting for explanations 00235 double SC_seed_Shape_E3x2r = 0; 00236 00237 double SC_seed_Shape_xcog = lazyTool.e2x5Right( *seed ) - lazyTool.e2x5Left( *seed ); 00238 double SC_seed_Shape_ycog = lazyTool.e2x5Bottom( *seed ) - lazyTool.e2x5Top( *seed ); 00239 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00240 cout << "ClusterShape E1_max_New = " << SC_seed_Shape_E1 << endl; 00241 cout << "ClusterShape E3x3_max_New = " << SC_seed_Shape_E3x3 << endl; 00242 cout << "ClusterShape E5x5_max_New = " << SC_seed_Shape_E5x5 << endl; 00243 cout << "ClusterShape E2_max_New = " << SC_seed_Shape_E2 << endl; 00244 cout << "ClusterShape EE_max_New = " << SC_seed_Shape_cEE << endl; 00245 cout << "ClusterShape EP_max_New = " << SC_seed_Shape_cEP << endl; 00246 cout << "ClusterShape PP_max_New = " << SC_seed_Shape_cPP << endl; 00247 cout << "ClusterShape E2x2_max_New = " << SC_seed_Shape_E2x2 << endl; 00248 cout << "ClusterShape E3x2_max_New = " << SC_seed_Shape_E3x2 << endl; 00249 cout << "ClusterShape E3x2r_max_New = " << SC_seed_Shape_E3x2r << endl; 00250 cout << "ClusterShape xcog_max_New = " << SC_seed_Shape_xcog << endl; 00251 cout << "ClusterShape ycog_max_New = " << SC_seed_Shape_ycog << endl; 00252 } 00253 00254 float SC_et = it_super->energy()*sin(2*atan(exp(-it_super->eta()))); 00255 00256 presh_pi0_algo->calculateBarrelNNInputVariables(SC_et, SC_seed_Shape_E1, SC_seed_Shape_E3x3, 00257 SC_seed_Shape_E5x5, SC_seed_Shape_E2, 00258 SC_seed_Shape_cEE, SC_seed_Shape_cEP, 00259 SC_seed_Shape_cPP, SC_seed_Shape_E2x2, 00260 SC_seed_Shape_E3x2, SC_seed_Shape_E3x2r, 00261 SC_seed_Shape_xcog, SC_seed_Shape_ycog); 00262 00263 float* nn_input_var = presh_pi0_algo->get_input_vector(); 00264 00265 nnoutput = presh_pi0_algo->GetBarrelNNOutput(SC_et); 00266 00267 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) { 00268 cout << " PiZeroDiscProducer: NN_barrel_Endcap_variables = " ; 00269 for(int k3=0;k3<12;k3++) { 00270 cout << nn_input_var[k3] << " " ; 00271 } 00272 cout << endl; 00273 00274 cout << "EndcapPi0NNProducer:Event : " << evt.id() 00275 << " SC id = " << Photon_index 00276 << " with Pt = " << SC_Et 00277 << " eta = " << SC_eta 00278 << " phi = " << SC_phi 00279 << " contains: " << it_super->clustersSize() << " BCs " 00280 //<< " R9 = " << Phot_R9 00281 << " has NNout = " << nnoutput 00282 << endl; 00283 } 00284 Pi0Assocs_p->insert(Ref<PhotonCollection>(correctedPhotonHandle,Photon_index), nnoutput); 00285 } else { Pi0Assocs_p->insert(Ref<PhotonCollection>(correctedPhotonHandle,Photon_index), -1.);} 00286 Photon_index++; 00287 } // end of cycle over Photons 00288 00289 evt.put(Pi0Assocs_p,PhotonPi0DiscriminatorAssociationMap_); 00290 if ( debugL_pi0 <= EndcapPiZeroDiscriminatorAlgo::pDEBUG ) cout << "PhotonPi0DiscriminatorAssociationMap added to the event" << endl; 00291 00292 nEvt_++; 00293 00294 LogDebug("PiZeroDiscriminatorDebug") << ostr.str(); 00295 00296 00297 }
std::string PiZeroDiscriminatorProducer::barrelClusterShapeMapCollection_ [private] |
Definition at line 49 of file PiZeroDiscriminatorProducer.h.
std::string PiZeroDiscriminatorProducer::barrelClusterShapeMapProducer_ [private] |
Definition at line 48 of file PiZeroDiscriminatorProducer.h.
Definition at line 50 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
std::string PiZeroDiscriminatorProducer::correctedPhotonCollection_ [private] |
Definition at line 47 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
Definition at line 55 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
std::string PiZeroDiscriminatorProducer::endcapClusterShapeMapCollection_ [private] |
Definition at line 51 of file PiZeroDiscriminatorProducer.h.
std::string PiZeroDiscriminatorProducer::endcapClusterShapeMapProducer_ [private] |
Definition at line 50 of file PiZeroDiscriminatorProducer.h.
Definition at line 51 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
int PiZeroDiscriminatorProducer::nEvt_ [private] |
Definition at line 39 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
std::string PiZeroDiscriminatorProducer::photonCorrCollectionProducer_ [private] |
Definition at line 46 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
std::string PiZeroDiscriminatorProducer::PhotonPi0DiscriminatorAssociationMap_ [private] |
Definition at line 48 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
Definition at line 57 of file PiZeroDiscriminatorProducer.h.
Definition at line 53 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), produce(), and ~PiZeroDiscriminatorProducer().
std::string PiZeroDiscriminatorProducer::preshClusterShapeCollectionX_ [private] |
Definition at line 42 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
std::string PiZeroDiscriminatorProducer::preshClusterShapeCollectionY_ [private] |
Definition at line 43 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().
std::string PiZeroDiscriminatorProducer::preshClusterShapeProducer_ [private] |
Definition at line 44 of file PiZeroDiscriminatorProducer.h.
Referenced by PiZeroDiscriminatorProducer(), and produce().