Discrimination between Photons and PiZeros

Complete: 2

Authors: Aristotelis Kyriakis, Dimitrije Maletic


A tool for discriminating photons from neutral pions(piZeros) using neural network technique is available under CMSSW_1_6_x. This tool uses information from both ECAL and Preshower sub-detectors and covers |eta| < 2.5 (overlapping region between ECAL barrel and Endcap is not covered). The tool should be applied to isolated and unconverted photon like objects.

Algorithm Description

The algorithm uses neural network techniques based on Jetnet software for both ECAL Barrel and Endcap region.

  • In the Endcaps the algorithm is mainly based in the Preshower information and works as follows: It starts from an ECAL Endcap Supercluster. Then defines a line connecting the Supercluster's barycenter with point (0,0,0) and finds the intersection with the two Preshower planes.The Preshower strip that is closest to the intersection point is the central strip. The algorithms also takes into account the +/-5 strips around the central strip. It then forms the quantities: Eix = Ei/Enormx and Eiy = Ei/Enormy where Ei is the energy of strip i and Enormx(y) is a normalization factor that depends on the strip. So, 11 quantities are used from the 1st Preshower plane and 11 from the 2nd plane. Three more quantities are taken from the ECAL, E1/EnormECAL, E9/EnormECAL, E25/EnormECAL, where E1(9)(25) is the energy of the central crystal, the energy of the 3x3 matrix crystal around the central crystal and the energy of the 5x5 matrix crystal around the central crystal correspondingly. EnormECAL = 500GeV is the normalization factor. These 25 variables are then fed into the Neural Network and its output is used as discrimination quantity(close to 1 for photons and close to zero for neutral pions). More details about the discrimination variables used for the ECAL Endcap region can be seen in page 6 of Endcap Discrimination Variables.

  • For more information have a look at CMS AN-2008/063

Algorithm Performance

The algorithm has been tested using full H-> 2gamma and CMS.GammaJet. For keeping 90% of the photons an overall rejection greater than 30% can be achieved for transverse momenta up to 60GeV/c (page 11 of results) mainly dominated by the barrel performance. In the pages 15,16 of results the CMS.GammaJet background can be reduced by almost 60% keeping 88% of the H-> 2gamma signal in case of both photons candidates being unconverted.

How to Run

For running with CMSSW_1_6_12, go to your working area and type the following commands:
scramv1 project -n  CMSSW_1_6_12_Pi0 CMSSW CMSSW_1_6_12
cd CMSSW_1_6_12_Pi0/src
project CMSSW
cvs co -r  CMSSW_1_6_12 DataFormats/EgammaCandidates
cvs co -r  CMSSW_1_6_12 DataFormats/EgammaReco
cvs co -r  CMSSW_1_6_12 RecoEcal/EgammaClusterProducers
cvs co -r  CMSSW_1_6_12 RecoEcal/EgammaClusterAlgos
cvs co -r  CMSSW_1_6_12 RecoEgamma/Examples
cvs co UserCode/AKyriaki
source UserCode/AKyriaki/copy_files.csh
rm -r UserCode
eval `scramv1 ru -csh`
scramv1 b
cd RecoEgamma/Examples/test/
cmsRun  SimplePi0DiscAnalyzer.cfg (*Do Not forget to change the root file directory to point to your area *)

Example code

The example: RecoEgamma/Examples/plugins/SimplePi0DiscAnalyzer.cc loops over all the PhotonCollection objects and produces some histograms of the discrimination variable for various eta regions.

It takes the discrimination variable:

   float nn = -10;
    mapIter = map->find(edm::Ref(PhotonHandle,PhoInd));
    if(mapIter!=map->end()) {
      nn = mapIter->val;
Then checks if the photon candidate is converted using the PhotonConversion code or the R9 variable:
    bool isPhotConv  = localPho.hasConversionTracks();
    float Photon_r9 = localPho.r9();

and fills various plots. The discrimination variable has a distribution peaking close to zero for unconverted neutral pions and close to one for unconverted photons. The user could use a simple cut on the discrimination variable or the whole distribution as input in a multivariate analysis

Update for CMSSW_2_2_X

The code has been updated to work under CMSSW_2_2_X. Since the Preshower in not simulated in these versions of CMSSW only the algorithm is valid only in the ECAL Barrel region. For running with CMSSW_2_2_X go to your working area and type the following commands:
scramv1 project -n  CMSSW_2_2_11_piZeroDisc CMSSW CMSSW_2_2_11
cd CMSSW_2_2_11_piZeroDisc/src
project CMSSW
cvs co -r CMSSW_2_2_11  EgammaAnalysis/PhotonIDProducers
cvs co -r CMSSW_2_2_11  RecoEcal/EgammaClusterAlgos
cvs co -r CMSSW_2_2_11  RecoEcal/EgammaClusterProducers
cvs co -r CMSSW_2_2_11  RecoEgamma/Examples
cp ~akyriaki/public/Pi0Rejection_For_CMSSW_2_2_X/CMSSW_2_2_11_Pi0RejectionCode.tar .
tar xfvz  CMSSW_2_2_11_Pi0RejectionCode.tar
rm CMSSW_2_2_11_Pi0RejectionCode.tar
eval `scramv1 ru -csh`
scramv1 b
cd RecoEgamma/Examples/test/
cmsRun  SimplePi0DiscAnalyzer_cfg.py

Update for CMSSW_3_3_X

The code has been updated to work under CMSSW_3_3_X. There are major changes that take into account the change in the calculation of the Preshower energy deposition and the change from EcalClusterLazyTools to EcalClusterTools for calculating the ClusterShape variables needed for the ECAL Barrel region. This last change permits the user the define the W0 parameter from a python file. For running with CMSSW_3_3_X go to your working area and type the following commands:
scramv1 project -n  CMSSW_3_3_6_piZeroDisc CMSSW CMSSW_3_3_6
cd CMSSW_3_3_6_piZeroDisc/src
project CMSSW
cvs co -r CMSSW_3_3_6 EgammaAnalysis/PhotonIDProducers
cvs co -r CMSSW_3_3_6 RecoEcal/EgammaClusterAlgos
cvs co -r CMSSW_3_3_6 RecoEcal/EgammaClusterProducers
cvs co -r CMSSW_3_3_6 RecoEgamma/Examples
cvs co -r aris_5_2_2010 EgammaAnalysis/PhotonIDProducers/python/piZeroDiscriminators_cfi.py
cvs co -r aris_5_2_2010 EgammaAnalysis/PhotonIDProducers/interface/PiZeroDiscriminatorProducer.h
cvs co -r aris_5_2_2010 EgammaAnalysis/PhotonIDProducers/src/PiZeroDiscriminatorProducer.cc
cvs co -r aris_5_2_2010 RecoEgamma/Examples/plugins/SimplePi0DiscAnalyzer.h
cvs co -r aris_5_2_2010 RecoEgamma/Examples/plugins/SimplePi0DiscAnalyzer.cc
cvs co -r aris_5_2_2010 RecoEgamma/Examples/test/SimplePi0DiscAnalyzer_cfg.py
cvs co -r aris_5_2_2010 RecoEcal/EgammaClusterProducers/data/barrelPiZeroDiscriminatorWeights_et50.wts
cvs co -r aris_5_2_2010 RecoEcal/EgammaClusterProducers/data/barrelPiZeroDiscriminatorWeights_et60.wts
cvs co -r aris_5_2_2010 RecoEcal/EgammaClusterProducers/python/preshowerClusterShape_cfi.py
cvs co -r aris_5_2_2010 RecoEcal/EgammaClusterAlgos/interface/EndcapPiZeroDiscriminatorAlgo.h
cvs co -r aris_5_2_2010 RecoEcal/EgammaClusterAlgos/src/EndcapPiZeroDiscriminatorAlgo.cc
eval `scramv1 ru -csh`
scramv1 b
cd RecoEgamma/Examples/test/
cmsRun  SimplePi0DiscAnalyzer_cfg.py

---++ Update for CMSSW_3_6_X The algorithm is part of the CMSSW_3_6_X and no need for extra packages.All you have to do is to run:

cmsRun  RecoEgamma/Examples/test/SimplePi0DiscAnalyzer_cfg.py
after changing the input root file name.

Update for CMSSW_3_8_X

A small bug found by L.Gray and J.Veverka so a new tag is created
scramv1 project -n  CMSSW_3_8_4_piZeroDisc CMSSW CMSSW_3_8_4
cd CMSSW_3_8_4_piZeroDisc/src
cvs co -r CMSSW_3_8_4 EgammaAnalysis/PhotonIDProducers
cvs co -r CMSSW_3_8_4 RecoEgamma/Examples
cvs co -r aris_28_9_2010 EgammaAnalysis/PhotonIDProducers/src/PiZeroDiscriminatorProducer.cc
cvs co -r aris_28_9_2010 RecoEgamma/Examples/plugins/SimplePi0DiscAnalyzer.cc
eval `scramv1 ru -csh`
scramv1 b
cd RecoEgamma/Examples/test/
cmsRun  SimplePi0DiscAnalyzer_cfg.py
after changing the input root file name.

Use the variable in your analysis

To use the Pi0Disc variable in your analysis code do the following:

  float  S_phot_nnout[100];
  // Loop over the SelectedPAT Photons with iterator "S_phot_iter" and  counter "S_nphot" 
  // take the pi0 rejection info from RECO
  Handle map;
 iEvent.getByLabel("piZeroDiscriminators","PhotonPi0DiscriminatorAssociationMap", map);
 reco::PhotonPi0DiscriminatorAssociationMap::const_iterator mapIter;
  edm::Handle R_PhotonHandle;
  iEvent.getByLabel("photons", "", R_PhotonHandle);
  const reco::PhotonCollection R_photons = *(R_PhotonHandle.product());

   float nn = -10;
    for( reco::PhotonCollection::const_iterator R_phot_iter = R_photons.begin(); R_phot_iter != R_photons.end(); R_phot_iter++)
    mapIter = map->find(edm::Ref(R_PhotonHandle, R_phot_iter - R_photons.begin()));
    if(mapIter!=map->end()) {
     nn = mapIter->val;
    if(S_phot_iter->p4() == R_phot_iter->p4()) S_phot_nnout[S_nphot] = nn;

Review Status

Reviewer/Editor and Date (copy from screen) Comments
DavidFutyan - 22 Oct 2007 page author
AristotelisKyriakis - 23 Oct 2007 page content last edited
AristotelisKyriakis - 10 Dec 2007 page content last edited
AristotelisKyriakis - 21 Dec 2007 page content last edited
AristotelisKyriakis - 4 Dec 2008 page content last edited
AristotelisKyriakis - 28 May 2009 page content last edited
AristotelisKyriakis - 5 Feb 2010 page content last edited

Responsible: AristotelisKyriakis
Last reviewed by: Reviewer --

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r15 - 2013-05-27 - AristotelisKyriakis

    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback