CMS 3D CMS Logo

HistoPhoton.cc

Go to the documentation of this file.
00001 #include "PhysicsTools/StarterKit/interface/HistoPhoton.h"
00002 
00003 
00004 //#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00005 
00006 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00007 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00008 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00009 
00010 
00011 using namespace std;
00012 
00013 // Constructor:
00014 
00015 using pat::HistoPhoton;
00016 
00017 HistoPhoton::HistoPhoton( std::string dir, std::string role,std::string pre,
00018                               double pt1, double pt2, double m1, double m2,
00019                           TFileDirectory * parentDir ) :
00020   HistoGroup<Photon>( dir, role, pre, pt1, pt2, m1, m2, parentDir)
00021 {
00022   // book relevant photon histograms
00023 
00024   addHisto( h_trackIso_      =
00025             new PhysVarHisto(pre + "TrackIso",       "Photon Track Isolation"    , 100, 0, 100., currDir_, "", "vD")
00026             );
00027   addHisto( h_caloIso_       =
00028             new PhysVarHisto(pre + "CaloIso",        "Photon Calo Isolation"     , 100, 0, 1, currDir_, "", "vD")
00029             );
00030 
00031 /*
00032 // bookProfile
00033   std::string histname = "nIsoTracks";
00034   addHisto( p_nTrackIsol_       =
00035             new PhysVarHisto(pre + histname,        "Avg Number Of Tracks in the Iso Cone"     , 100, 0, 1, currDir_, "", "vD")
00036             );
00037 
00038   histname = "isoPtSum";
00039   addHisto( p_trackPtSum_       =
00040             new PhysVarHisto(pre + histname,        "Avg Tracks Pt Sum in the Iso Cone"     , 100, 0, 1, currDir_, "", "vD")
00041             );
00042 
00043   histname = "ecalSum";
00044   addHisto( p_ecalSum_          =
00045             new PhysVarHisto(pre + histname,        "Avg Ecal Sum in the Iso Cone"     , 100, 0, 1, currDir_, "", "vD")
00046             );
00047 
00048   histname = "hcalSum";
00049   addHisto( p_hcalSum_          =
00050             new PhysVarHisto(pre + histname,        "Avg Hcal Sum in the Iso Cone"     , 100, 0, 1, currDir_, "", "vD")
00051             );
00052 */
00053 
00054 
00055 
00056   std::string histname = "nPho";
00057   addHisto( h_nPho_[0][0]       =
00058             new PhysVarHisto(pre + histname+"All",        "Number Of Isolated Photon candidates per events: All Ecal  "     , 10, -0.5, 9.5, currDir_, "", "vD")
00059             );
00060 
00061   addHisto( h_nPho_[0][1]       =
00062             new PhysVarHisto(pre + histname+"Barrel",        "Number Of Isolated Photon candidates per events: Ecal Barrel  "     , 10, -0.5, 9.5, currDir_, "", "vD")
00063             );
00064   addHisto( h_nPho_[0][2]       =
00065             new PhysVarHisto(pre + histname+"Endcap",        "Number Of Isolated Photon candidates per events: Ecal Endcap "     , 10, -0.5, 9.5, currDir_, "", "vD")
00066             );
00067 
00068   histname = "scE";
00069   addHisto(  h_scE_[0][0]           =
00070             new PhysVarHisto(pre + histname+"All",        "Isolated SC Energy: All Ecal  "     , 100, 0., 100., currDir_, "", "vD")
00071             );
00072   addHisto(  h_scE_[0][1]           =
00073             new PhysVarHisto(pre + histname+"Barrel",        "Isolated SC Energy: Barrel "     , 100, 0., 100., currDir_, "", "vD")
00074             );
00075   addHisto( h_scE_[0][2]            =
00076             new PhysVarHisto(pre + histname+"Endcap",        "Isolated SC Energy: Endcap "     , 100, 0., 100., currDir_, "", "vD")
00077             );
00078 
00079   histname = "scEt";
00080   addHisto( h_scEt_[0][0]            =
00081             new PhysVarHisto(pre + histname+"All",        "Isolated SC Et: All Ecal "     , 100, 0., 100., currDir_, "", "vD")
00082             );
00083   addHisto( h_scEt_[0][1]            =
00084             new PhysVarHisto(pre + histname+"Barrel",        "Isolated SC Et: Barrel"     , 100, 0., 100., currDir_, "", "vD")
00085             );
00086   addHisto( h_scEt_[0][2]            =
00087             new PhysVarHisto(pre + histname+"Endcap",        "Isolated SC Et: Endcap"     , 100, 0., 100., currDir_, "", "vD")
00088             );
00089 
00090   histname = "r9";
00091   addHisto( h_r9_[0][0]            =
00092             new PhysVarHisto(pre + histname+"All",        "Isolated r9: All Ecal"     , 100, 0, 1, currDir_, "", "vD")
00093             );
00094   addHisto( h_r9_[0][1]            =
00095             new PhysVarHisto(pre + histname+"Barrel",        "Isolated r9: Barrel "     , 100, 0, 1, currDir_, "", "vD")
00096             );
00097   addHisto( h_r9_[0][2]            =
00098             new PhysVarHisto(pre + histname+"Endcap",        "Isolated r9: Endcap "     , 100, 0, 1, currDir_, "", "vD")
00099             );
00100 
00101   addHisto( h_scEta_[0]            =
00102             new PhysVarHisto(pre + "scEta",        "Isolated SC Eta "     , 100, -3.5, 3.5, currDir_, "", "vD")
00103             );
00104   addHisto( h_scPhi_[0]            =
00105             new PhysVarHisto(pre + "scPhi",        "Isolated SC Phi "     , 100, -3.14, 3.14, currDir_, "", "vD")
00106             );
00108 /*  addHisto( h_scEtaPhi_[0]            =
00109             new PhysVarHisto(pre + "scEtaPhi",        "Isolated SC Phi vs Eta "     , 100, 0, 1, currDir_, "", "vD")
00110             );
00111 */
00112 
00113 
00114  histname = "phoE";
00115   addHisto( h_phoE_[0][0]            =
00116             new PhysVarHisto(pre + histname+"All",        "Isolated Photon Energy: All ecal "     , 100, 0., 100., currDir_, "", "vD")
00117             );
00118   addHisto( h_phoE_[0][1]            =
00119             new PhysVarHisto(pre + histname+"Barell",        "Isolated Photon Energy: barrel "     , 100, 0., 100., currDir_, "", "vD")
00120             );
00121   addHisto( h_phoE_[0][2]            =
00122             new PhysVarHisto(pre + histname+"Endcap",        "Isolated Photon Energy: Endcap "     , 100, 0, 100., currDir_, "", "vD")
00123             );
00124 
00125   histname = "phoEt";
00126   addHisto( h_phoEt_[0][0]            =
00127             new PhysVarHisto(pre + histname+"All",        "Isolated Photon Transverse Energy: All ecal "     , 100, 0, 100., currDir_, "", "vD")
00128             );
00129   addHisto( h_phoEt_[0][1]            =
00130             new PhysVarHisto(pre + histname+"Barell",        "Isolated Photon Transverse Energy: Barrel "     , 100, 0, 100., currDir_, "", "vD")
00131             );
00132   addHisto( h_phoEt_[0][2]            =
00133             new PhysVarHisto(pre + histname+"Endcap",        "Isolated Photon Transverse Energy: Endcap "     , 100, 0, 100., currDir_, "", "vD")
00134             );
00135   addHisto( h_phoEta_[0]            =
00136             new PhysVarHisto(pre + "phoEta",        "Isolated Photon Eta "     , 100, -3.5, 3.5, currDir_, "", "vD")
00137             );
00138   addHisto( h_phoPhi_[0]            =
00139             new PhysVarHisto(pre + "phoPhi",        "Isolated Photon Phi"     , 100, -3.14, 3.14, currDir_, "", "vD")
00140             );
00141 
00142   histname="nConv";
00143   addHisto( h_nConv_[0][0]            =
00144             new PhysVarHisto(pre + histname+"All",        "Number Of Conversions per isolated candidates per events: All Ecal  "     , 10, -0.5, 9.5, currDir_, "", "vD")
00145             );
00146   addHisto( h_nConv_[0][1]            =
00147             new PhysVarHisto(pre + histname+"Barrel",        "Number Of Conversions per isolated candidates per events: Ecal Barrel"     , 10, -0.5, 9.5, currDir_, "", "vD")
00148             );
00149   addHisto( h_nConv_[0][2]            =
00150             new PhysVarHisto(pre + histname+"Endcap",        "Number Of Conversions per isolated candidates per events: Ecal Endcap"     , 100, -0.5, 9.5, currDir_, "", "vD")
00151             );
00152   addHisto( h_convEta_[0]            =
00153             new PhysVarHisto(pre + "convEta",        "Isolated converted Photon Eta "     , 100, -3.5, 3.5, currDir_, "", "vD")
00154             );
00155   addHisto( h_convPhi_[0]            =
00156             new PhysVarHisto(pre + "convPhi",        "Isolated converted Photon  Phi"     , 100, -3.14, 3.14, currDir_, "", "vD")
00157             );
00158 
00160 /*  histname="r9VsTracks";
00161   addHisto( h_r9VsNofTracks_[0][0]            =
00162             new PhysVarHisto(pre + histname+"All",        "Isolated photons r9 vs nTracks from conversions: All Ecal"     , 100, 0, 1, currDir_, "", "vD")
00163             );
00164   addHisto( h_r9VsNofTracks_[0][1]            =
00165             new PhysVarHisto(pre + histname+"Barrel",        "Isolated photons r9 vs nTracks from conversions: Barrel Ecal"     , 100, 0, 1, currDir_, "", "vD")
00166             );
00167   addHisto( h_r9VsNofTracks_[0][2]            =
00168             new PhysVarHisto(pre + histname+"Endcap",        "Isolated photons r9 vs nTracks from conversions: Endcap Ecal"     , 100, 0, 1, currDir_, "", "vD")
00169             );
00170 */
00171 
00172 
00173   histname="EoverPtracks";
00174   addHisto( h_EoverPTracks_[0][0]            =
00175             new PhysVarHisto(pre + histname+"All",        "Isolated photons conversion E/p: all Ecal "     , 100, 0, 5., currDir_, "", "vD")
00176             );
00177   addHisto( h_EoverPTracks_[0][1]            =
00178             new PhysVarHisto(pre + histname+"Barrel",        "Isolated photons conversion E/p: Barrel Ecal "     , 100, 0, 5., currDir_, "", "vD")
00179             );
00180   addHisto( h_EoverPTracks_[0][2]            =
00181             new PhysVarHisto(pre + histname+"Endcap",        "Isolated photons conversion E/p: Endcap Ecal "     , 100, 0, 5., currDir_, "", "vD")
00182             );
00183 
00184 /* bookProfile
00185   histname="pTknHitsVsEta";
00186   addHisto( p_tk_nHitsVsEta_[0]            =
00187             new PhysVarHisto(pre + histname,        "Isolated Photons:Tracks from conversions: mean numb of  Hits vs Eta"     , 100, 0, 1, currDir_, "", "vD")
00188             );
00189 */
00190 
00191   addHisto( h_tkChi2_[0]            =
00192             new PhysVarHisto(pre + "tkChi2",        "Isolated Photons:Tracks from conversions: #chi^{2} of tracks"     , 100, 0, 20., currDir_, "", "vD")
00193             );
00194 
00195   histname="hDPhiTracksAtVtx";
00196   addHisto( h_DPhiTracksAtVtx_[0][0]            =
00197             new PhysVarHisto(pre + histname+"All",        "Isolated Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal"     , 100, 0, 1, currDir_, "", "vD")
00198             );
00199   addHisto( h_DPhiTracksAtVtx_[0][1]            =
00200             new PhysVarHisto(pre + histname+"Barrel",        "Isolated Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal"     , 100, 0, 1, currDir_, "", "vD")
00201             );
00202   addHisto( h_DPhiTracksAtVtx_[0][2]            =
00203             new PhysVarHisto(pre + histname+"Endcap",        "Isolated Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal"     , 100, 0, 1, currDir_, "", "vD")
00204             );
00205 
00206   histname="hDCotTracks";
00207   addHisto( h_DCotTracks_[0][0]            =
00208             new PhysVarHisto(pre + histname+"All",        "Isolated Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Ecal "     , 100, 0, 1, currDir_, "", "vD")
00209             );
00210 
00211   addHisto( h_DCotTracks_[0][1]            =
00212             new PhysVarHisto(pre + histname+"Barrel",        "Isolated Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal "     , 100, 0, 1, currDir_, "", "vD")
00213             );
00214   addHisto( h_DCotTracks_[0][2]            =
00215             new PhysVarHisto(pre + histname+"Endcap",        "Isolated Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Ecal "     , 100, 0, 1, currDir_, "", "vD")
00216             );
00217 
00218   histname="hInvMass";
00219   addHisto( h_invMass_[0][0]            =
00220             new PhysVarHisto(pre + histname+"All",        "Isolated Photons:Tracks from conversion: Pair invariant mass: all Ecal "     , 100, 0, 1.5, currDir_, "", "vD")
00221             );
00222   addHisto( h_invMass_[0][1]            =
00223             new PhysVarHisto(pre + histname+"Barrel",        "Isolated Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal "     , 100, 0, 1.5, currDir_, "", "vD")
00224             );
00225   addHisto( h_invMass_[0][2]            =
00226             new PhysVarHisto(pre + histname+"Endcap",        "Isolated Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal "     , 100, 0, 1.5, currDir_, "", "vD")
00227             );
00228 
00229   histname="hDPhiTracksAtEcal";
00230   addHisto( h_DPhiTracksAtEcal_[0][0]            =
00231             new PhysVarHisto(pre + histname+"All",        "Isolated Photons:Tracks from conversions:  #delta#phi at Ecal : all Ecal "     , 100, 0, 1, currDir_, "", "vD")
00232             );
00233   addHisto( h_DPhiTracksAtEcal_[0][1]            =
00234             new PhysVarHisto(pre + histname+"Barrel",        "Isolated Photons:Tracks from conversions:  #delta#phi at Ecal : Barrel Ecal "     , 100, 0, 1, currDir_, "", "vD")
00235             );
00236   addHisto( h_DPhiTracksAtEcal_[0][2]            =
00237             new PhysVarHisto(pre + histname+"Endcap",        "Isolated Photons:Tracks from conversions:  #delta#phi at Ecal : Endcap Ecal "     , 100, 0, 1, currDir_, "", "vD")
00238             );
00239 
00240   histname="hDEtaTracksAtEcal";
00241   addHisto( h_DEtaTracksAtEcal_[0][0]            =
00242             new PhysVarHisto(pre + histname+"All",        "Isolated Photons:Tracks from conversions:  #delta#eta at Ecal : all Ecal "     , 100, 0, 1, currDir_, "", "vD")
00243             );
00244   addHisto( h_DEtaTracksAtEcal_[0][1]            =
00245             new PhysVarHisto(pre + histname+"Barrel",        "Isolated Photons:Tracks from conversions:  #delta#eta at Ecal : Barrel Ecal "     , 100, 0, 1, currDir_, "", "vD")
00246             );
00247   addHisto( h_DEtaTracksAtEcal_[0][2]            =
00248             new PhysVarHisto(pre + histname+"Endcap",        "Isolated Photons:Tracks from conversions:  #delta#eta at Ecal : Endcap Ecal "     , 100, 0, 1, currDir_, "", "vD")
00249             );
00250 
00252 /*  addHisto( h_convVtxRvsZ_[0]            =
00253             new PhysVarHisto(pre + "convVtxRvsZ",        "Isolated Photon Reco conversion vtx position"     , 100, 0, 1, currDir_, "", "vD")
00254             );
00255 */
00256 
00257 
00258   addHisto( h_zPVFromTracks_[0]            =
00259             new PhysVarHisto(pre + "zPVFromTracks",        "Isolated Photons: PV z from conversion tracks"     , 100, -25.,  25., currDir_, "", "vD")
00260             );
00261 
00262   histname = "nPhoNoIs";
00263   addHisto( h_nPho_[1][0]            =
00264             new PhysVarHisto(pre + histname+"All",        "Number Of Non Isolated Photon candidates per events: All Ecal  "     , 10, -0.5, 9.5, currDir_, "", "vD")
00265             );
00266   addHisto( h_nPho_[1][1]            =
00267             new PhysVarHisto(pre + histname+"Barrel",        "Number Of Non Isolated Photon candidates per events: Ecal Barrel "     , 100, -0.5, 9.5, currDir_, "", "vD")
00268             );
00269   addHisto( h_nPho_[1][2]            =
00270             new PhysVarHisto(pre + histname+"Endcap",        "Number Of Non Isolated Photon candidates per events: Ecal Endcap "     , 100, -0.5, 9.5, currDir_, "", "vD")
00271             );
00272 
00273   histname = "scENoIs";
00274   addHisto( h_scE_[1][0]            =
00275             new PhysVarHisto(pre + histname+"All",        "Non Isolated SC Energy: All Ecal  "     , 100, 0, 100., currDir_, "", "vD")
00276             );
00277   addHisto( h_scE_[1][1]            =
00278             new PhysVarHisto(pre + histname+"Barrel",        "Non Isolated SC Energy: Barrel  "     , 100, 0, 100., currDir_, "", "vD")
00279             );
00280   addHisto( h_scE_[1][2]            =
00281             new PhysVarHisto(pre + histname+"Endcap",        "Non Isolated SC Energy: Endcap "     , 100, 0, 100., currDir_, "", "vD")
00282             );
00283 
00284   histname = "scEtNoIs";
00285   addHisto( h_scEt_[1][0]            =
00286             new PhysVarHisto(pre + histname+"All",        "Non Isolated SC Et: All Ecal "     , 100, 0, 100., currDir_, "", "vD")
00287             );
00288   addHisto( h_scEt_[1][1]            =
00289             new PhysVarHisto(pre + histname+"Barrel",        "Non Isolated SC Et: Barel "     , 100, 0, 100., currDir_, "", "vD")
00290             );
00291   addHisto( h_scEt_[1][2]            =
00292             new PhysVarHisto(pre + histname+"Endcap",        "Non Isolated SC Et: Endcap "     , 100, 0, 100., currDir_, "", "vD")
00293             );
00294 
00295   histname = "r9NoIs";
00296   addHisto( h_r9_[1][0]            =
00297             new PhysVarHisto(pre + histname+"All",        "Non Isolated r9: All Ecal"     , 100, 0, 1, currDir_, "", "vD")
00298             );
00299   addHisto( h_r9_[1][1]            =
00300             new PhysVarHisto(pre + histname+"Barrel",        "Non Isolated r9: Barrel"     , 100, 0, 1, currDir_, "", "vD")
00301             );
00302   addHisto( h_r9_[1][2]            =
00303             new PhysVarHisto(pre + histname+"Endcap",        "Non Isolated r9: Endcap"     , 100, 0, 1, currDir_, "", "vD")
00304             );
00305 
00306 
00307   addHisto( h_scEta_[1]            =
00308             new PhysVarHisto(pre + "scEtaNoIs",        "Non Isolated SC Eta "     , 100, -3.5, 3.5, currDir_, "", "vD")
00309             );
00310   addHisto( h_scPhi_[1]            =
00311             new PhysVarHisto(pre + "scPhiNoIs",        "Non Isolated SC Phi "     , 100, -3.14, 3.14, currDir_, "", "vD")
00312             );
00314 /*  addHisto( h_scEtaPhi_[1]            =
00315             new PhysVarHisto(pre + "scEtaPhiNoIs",        "Non Isolated SC Phi vs Eta "     , 100, 0, 1, currDir_, "", "vD")
00316             );
00317 */
00318 
00319 //
00320   histname = "phoENoIs";
00321   addHisto( h_phoE_[1][0]            =
00322             new PhysVarHisto(pre + histname+"All",        "Non Isolated Photon Energy: All ecal "     , 100, 0, 100., currDir_, "", "vD")
00323             );
00324   addHisto( h_phoE_[1][1]            =
00325             new PhysVarHisto(pre + histname+"Barrel",        "Non Isolated Photon Energy: Barrel  "     , 100, 0, 100., currDir_, "", "vD")
00326             );
00327   addHisto( h_phoE_[1][2]            =
00328             new PhysVarHisto(pre + histname+"Endcap",        "Non Isolated Photon Energy: Endcap "     , 100, 0, 100., currDir_, "", "vD")
00329             );
00330 
00331   histname = "phoEtNoIs";
00332   addHisto( h_phoEt_[1][0]            =
00333             new PhysVarHisto(pre + histname+"All","Non Isolated Photon Transverse Energy: All ecal "      , 100, 0, 100., currDir_, "", "vD")
00334             );
00335   addHisto( h_phoEt_[1][1]            =
00336             new PhysVarHisto(pre + histname+"Barrel","Non Isolated Photon Transverse Energy: Barrel "     , 100, 0, 100., currDir_, "", "vD")
00337             );
00338   addHisto( h_phoEt_[1][2]            =
00339             new PhysVarHisto(pre + histname+"Endcap","Non Isolated Photon Transverse Energy: Endcap "     , 100, 0, 100., currDir_, "", "vD")
00340             );
00341 
00342   addHisto( h_phoEta_[1]            =
00343             new PhysVarHisto(pre + "EtaNoIs","Non Isolated Photon Eta "     , 100, -3.5, 3.5, currDir_, "", "vD")
00344             );
00345   addHisto( h_phoPhi_[1]            =
00346             new PhysVarHisto(pre + "PhiNoIs","Non Isolated Photon  Phi "     , 100, -3.14, 3.14, currDir_, "", "vD")
00347             );
00348 
00349   histname="nConvNoIs";
00350   addHisto( h_nConv_[1][0]            =
00351             new PhysVarHisto(pre + histname+"All","Number Of Conversions per non isolated candidates per events: All Ecal  "     , 10, -0.5, 9.5, currDir_, "", "vD")
00352             );
00353   addHisto( h_nConv_[1][1]            =
00354             new PhysVarHisto(pre + histname+"Barrel","Number Of Conversions per non isolated candidates per events: Ecal Barrel  "     , 100, -0.5, 9.5, currDir_, "", "vD")
00355             );
00356   addHisto( h_nConv_[1][2]            =
00357             new PhysVarHisto(pre + histname+"Endcap","Number Of Conversions per non isolated candidates per events: Ecal Endcap "     , 100, -0.5, 9.5, currDir_, "", "vD")
00358             );
00359 
00360 
00361   addHisto( h_convEta_[1]            =
00362             new PhysVarHisto(pre + "convEtaNoIs","Non Isolated converted Photon Eta "     , 100, -3.5, 3.5, currDir_, "", "vD")
00363             );
00364   addHisto( h_convPhi_[1]            =
00365             new PhysVarHisto(pre + "convPhiNoIs","Non Isolated converted Photon  Phi "     , 100, -3.14, 3.14, currDir_, "", "vD")
00366             );
00367 
00369 /*  histname="r9VsTracksNoIs";
00370   addHisto( h_r9VsNofTracks_[1][0]            =
00371             new PhysVarHisto(pre + histname+"All","Non Isolated photons r9 vs nTracks from conversions: All Ecal"     , 100, 0, 1, currDir_, "", "vD")
00372             );
00373   addHisto( h_r9VsNofTracks_[1][1]            =
00374             new PhysVarHisto(pre + histname+"Barrel","Non Isolated photons r9 vs nTracks from conversions: Barrel Ecal"     , 100, 0, 1, currDir_, "", "vD")
00375             );
00376   addHisto( h_r9VsNofTracks_[1][2]            =
00377             new PhysVarHisto(pre + histname+"Endcap","Non Isolated photons r9 vs nTracks from conversions: Endcap Ecal"     , 100, 0, 1, currDir_, "", "vD")
00378             );
00379 */
00380 
00381 
00382   histname="EoverPtracksNoIs";
00383   addHisto( h_EoverPTracks_[1][0]            =
00384             new PhysVarHisto(pre + histname+"All","Non Isolated photons conversion E/p: all Ecal "     , 100, 0, 10., currDir_, "", "vD")
00385             );
00386   addHisto( h_EoverPTracks_[1][1]            =
00387             new PhysVarHisto(pre + histname+"Barrel","Non Isolated photons conversion E/p: Barrel Ecal"     , 100, 0, 10., currDir_, "", "vD")
00388             );
00389   addHisto( h_EoverPTracks_[1][2]            =
00390             new PhysVarHisto(pre + histname+"Endcap","Non Isolated photons conversion E/p: Endcap Ecal "     , 100, 0, 10., currDir_, "", "vD")
00391             );
00392 
00393 /* bookProfile
00394   addHisto( p_tk_nHitsVsEta_[1]            =
00395             new PhysVarHisto(pre + "pTknHitsVsEtaNoIs","Non Isolated Photons:Tracks from conversions: mean numb of  Hits vs Eta"     , 100, 0, 1, currDir_, "", "vD")
00396             );
00397 */
00398 
00399   addHisto( h_tkChi2_[1]            =
00400             new PhysVarHisto(pre + "tkChi2NoIs","NonIsolated Photons:Tracks from conversions: #chi^{2} of tracks"     , 100, 0, 20., currDir_, "", "vD")
00401             );
00402 
00403   histname="hDPhiTracksAtVtxNoIs";
00404   addHisto( h_DPhiTracksAtVtx_[1][0]            =
00405             new PhysVarHisto(pre + histname+"All", "Isolated Photons:Tracks from conversions: #delta#phi Tracks at vertex: all Ecal"     , 100, -2., 2., currDir_, "", "vD")
00406             );
00407   addHisto( h_DPhiTracksAtVtx_[1][1]            =
00408             new PhysVarHisto(pre + histname+"Barrel", "Isolated Photons:Tracks from conversions: #delta#phi Tracks at vertex: Barrel Ecal"     , 100, -2., 2., currDir_, "", "vD")
00409             );
00410   addHisto( h_DPhiTracksAtVtx_[1][2]            =
00411             new PhysVarHisto(pre + histname+"Endcap", "Isolated Photons:Tracks from conversions: #delta#phi Tracks at vertex: Endcap Ecal"     , 100, -2-2., 2., currDir_, "", "vD")
00412             );
00413 
00414   histname="hDCotTracksNoIs";
00415   addHisto( h_DCotTracks_[1][0]            =
00416             new PhysVarHisto(pre + histname+"All","Non Isolated Photons:Tracks from conversions #delta cotg(#Theta) Tracks: all Eca "     , 100, -1.0, 1.0, currDir_, "", "vD")
00417             );
00418   addHisto( h_DCotTracks_[1][1]            =
00419             new PhysVarHisto(pre + histname+"Barrel","Non Isolated Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Barrel Ecal "     , 100, -1.0, 1.0, currDir_, "", "vD")
00420             );
00421   addHisto( h_DCotTracks_[1][2]            =
00422             new PhysVarHisto(pre + histname+"Encap","Non Isolated Photons:Tracks from conversions #delta cotg(#Theta) Tracks: Endcap Eca "     , 100, -1.0, 1.0, currDir_, "", "vD")
00423             );
00424 
00425   histname="hInvMassNoIs";
00426   addHisto( h_invMass_[1][0]            =
00427             new PhysVarHisto(pre + histname+"All","Non Isolated Photons:Tracks from conversion: Pair invariant mass: all Ecal "     , 100, 0, 1.5, currDir_, "", "vD")
00428             );
00429   addHisto( h_invMass_[1][1]            =
00430             new PhysVarHisto(pre + histname+"Barrel","Non Isolated Photons:Tracks from conversion: Pair invariant mass: Barrel Ecal "     , 100, 0, 1.5, currDir_, "", "vD")
00431             );
00432   addHisto( h_invMass_[1][2]            =
00433             new PhysVarHisto(pre + histname+"Endcap","Non Isolated Photons:Tracks from conversion: Pair invariant mass: Endcap Ecal "     , 100, 0, 1.5, currDir_, "", "vD")
00434             );
00435 
00436   histname="hDPhiTracksAtEcalNoIs";
00437   addHisto( h_DPhiTracksAtEcal_[1][0]            =
00438             new PhysVarHisto(pre + histname+"All","Non Isolated Photons:Tracks from conversions: #delta#phi at Ecal : all Ecal "     , 100, -0.2,  0.2, currDir_, "", "vD")
00439             );
00440   addHisto( h_DPhiTracksAtEcal_[1][1]            =
00441             new PhysVarHisto(pre + histname+"Barrel","Non Isolated Photons:Tracks from conversions: #delta#phi at Ecal : Barrel Ecal "     , 100, -0.2,  0.2, currDir_, "", "vD")
00442             );
00443   addHisto( h_DPhiTracksAtEcal_[1][2]            =
00444             new PhysVarHisto(pre + histname+"Endcap","Non Isolated Photons:Tracks from conversions: #delta#phi at Ecal : Endcap Ecal "     , 100, -0.2,  0.2, currDir_, "", "vD")
00445             );
00446 
00447   histname="hDEtaTracksAtEcalNoIs";
00448   addHisto( h_DEtaTracksAtEcal_[1][0]            =
00449             new PhysVarHisto(pre + histname+"All","Non Isolated Photons:Tracks from conversions: #delta#eta at Ecal : all Ecal "     , 100, -0.2,  0.2, currDir_, "", "vD")
00450             );
00451   addHisto( h_DEtaTracksAtEcal_[1][1]            =
00452             new PhysVarHisto(pre + histname+"Barrel","Non Isolated Photons:Tracks from conversions: #delta#eta at Ecal : Barrel Ecal "     , 100, -0.2,  0.2, currDir_, "", "vD")
00453             );
00454   addHisto( h_DEtaTracksAtEcal_[1][2]            =
00455             new PhysVarHisto(pre + histname+"Endcap","Non Isolated Photons:Tracks from conversions: #delta#eta at Ecal : Endcap Ecal "     , 100, -0.2,  0.2, currDir_, "", "vD")
00456             );
00457 
00459 /*  addHisto( h_convVtxRvsZ_[1]            =
00460             new PhysVarHisto(pre + "convVtxRvsZNoIs","Non Isolated Photon Reco conversion vtx position"     , 100, 0, 1, currDir_, "", "vD")
00461             );
00462 */
00463 
00464   addHisto( h_zPVFromTracks_[1]            =
00465             new PhysVarHisto(pre + "zPVFromTracksNoIs","Non Isolated Photons: PV z from conversion tracks"     , 100, -25.,  25., currDir_, "", "vD")
00466             );
00467 
00468 
00469 }
00470 
00471 HistoPhoton::~HistoPhoton()
00472 {
00473 }
00474 
00475 
00476 void HistoPhoton::fill( const Photon * photon, uint iE, double weight )
00477 {
00478 
00479   // First fill common 4-vector histograms
00480   HistoGroup<Photon>::fill( photon, iE, weight );
00481 
00482   // fill relevant photon histograms
00483   h_trackIso_       ->fill( photon->trackIso(), iE, weight );
00484   h_caloIso_        ->fill( photon->caloIso(), iE, weight );
00485 
00486 
00488   using namespace edm;
00489 //  const float etaPhiDistance=0.01;
00490   // Fiducial region
00491 //  const float TRK_BARL =0.9;
00492 //  const float BARL = 1.4442; // DAQ TDR p.290
00493 //  const float END_LO = 1.566;
00494 //  const float END_HI = 2.5;
00495   // Electron mass
00496   const Float_t mElec= 0.000511;
00497 
00498 
00499   std::vector<int> nPho(2);
00500   std::vector<int> nPhoBarrel(2);
00501   std::vector<int> nPhoEndcap(2);
00502   for ( int i=0; i<nPho.size(); i++ ) nPho[i]=0;
00503   for ( int i=0; i<nPhoBarrel.size(); i++ ) nPhoBarrel[i]=0;
00504   for ( int i=0; i<nPhoEndcap.size(); i++ ) nPhoEndcap[i]=0;
00505 
00506 
00507 
00508 
00509 
00510     reco::Photon aPho = reco::Photon(*photon);
00511 
00512     bool  phoIsInBarrel=false;
00513     bool  phoIsInEndcap=false;
00514 
00516     float etaPho=aPho.eta();
00517     float phiPho=aPho.phi();
00518     if ( fabs(etaPho) <  1.479 ) {
00519       phoIsInBarrel=true;
00520     } else {
00521       phoIsInEndcap=true;
00522     }
00523 
00524 
00525 //    float phiClu=aPho.superCluster()->phi();
00526     float etaClu=aPho.superCluster()->eta();
00527 
00528 
00529 
00530     bool  scIsInBarrel=false;
00531     bool  scIsInEndcap=false;
00532     if ( fabs(etaClu) <  1.479 ) 
00533       scIsInBarrel=true;
00534     else
00535       scIsInEndcap=true;
00536 
00537 
00538 
00539     int nTracks=0;
00540     double ptSum=0.;
00541     double ecalSum=0.;
00542     double hcalSum=0.;
00543 
00544 
00545 
00546 /*    bookProfile
00547     p_nTrackIsol_->fill( (*photon).superCluster()->eta(),  float(nTracks));
00548     p_trackPtSum_->fill((*photon).superCluster()->eta(),  ptSum);
00549     p_ecalSum_->fill((*photon).superCluster()->eta(),  ecalSum);
00550     p_hcalSum_->fill((*photon).superCluster()->eta(),  hcalSum);
00551 */
00552 
00553 
00554     bool isIsolated=false;
00555 //    if ( (nTracks < numOfTracksInCone_) && 
00556 //           ( ptSum < trkPtSumCut_) &&
00557 //           ( ecalSum < ecalEtSumCut_ ) &&  ( hcalSum < hcalEtSumCut_ ) ) isIsolated = true;
00558 
00559 
00560 
00561     int type=0;
00562     if ( !isIsolated ) type=1;
00563 
00564     nPho[type]++; 
00565     if (phoIsInBarrel) nPhoBarrel[type]++;
00566     if (phoIsInEndcap) nPhoEndcap[type]++;
00567 
00568 
00569 
00571     float e3x3= 0; // EcalClusterTools::e3x3(  *(   (*photon).superCluster()->seed()  ), &ecalRecHitCollection, &(*topology));
00572     float r9 =e3x3/( (*photon).superCluster()->rawEnergy()+ (*photon).superCluster()->preshowerEnergy());
00573 
00574 
00575     h_scEta_[type]->fill( (*photon).superCluster()->eta() ,iE, weight );
00576     h_scPhi_[type]->fill( (*photon).superCluster()->phi() ,iE, weight);
00577 
00578 
00580 //    h_scEtaPhi_[type]->fill( (*photon).superCluster()->eta(), (*photon).superCluster()->phi() );
00581 
00582     h_scE_[type][0]->fill( (*photon).superCluster()->energy() ,iE, weight);
00583     h_scEt_[type][0]->fill( (*photon).superCluster()->energy()/cosh( (*photon).superCluster()->eta()) ,iE, weight);
00584     h_r9_[type][0]->fill( r9 ,iE, weight);
00585 
00586     h_phoEta_[type]->fill( (*photon).eta() ,iE, weight);
00587     h_phoPhi_[type]->fill( (*photon).phi() ,iE, weight);
00588 
00589     h_phoE_[type][0]->fill( (*photon).energy() ,iE, weight);
00590     h_phoEt_[type][0]->fill( (*photon).energy()/ cosh( (*photon).eta()) ,iE, weight);
00591 
00592 
00593     h_nConv_[type][0]->fill(float( (*photon).conversions().size()),iE, weight);
00594 
00595     if ( scIsInBarrel ) {
00596       h_scE_[type][1]->fill( (*photon).superCluster()->energy() ,iE, weight);
00597       h_scEt_[type][1]->fill( (*photon).superCluster()->energy()/cosh( (*photon).superCluster()->eta()) ,iE, weight);
00598       h_r9_[type][1]->fill( r9 ,iE, weight);
00599      }
00600 
00601     if ( scIsInEndcap ) {
00602       h_scE_[type][2]->fill( (*photon).superCluster()->energy() ,iE, weight);
00603       h_scEt_[type][2]->fill( (*photon).superCluster()->energy()/cosh( (*photon).superCluster()->eta()) ,iE, weight);
00604       h_r9_[type][2]->fill( r9 ,iE, weight);
00605      }
00606 
00607     if ( phoIsInBarrel ) {
00608       h_phoE_[type][1]->fill( (*photon).energy() ,iE, weight);
00609       h_phoEt_[type][1]->fill( (*photon).energy()/ cosh( (*photon).eta()) ,iE, weight);
00610       h_nConv_[type][1]->fill(float( (*photon).conversions().size()),iE, weight);
00611      }
00612     
00613     if ( phoIsInEndcap ) {
00614       h_phoE_[type][2]->fill( (*photon).energy() ,iE, weight);
00615       h_phoEt_[type][2]->fill( (*photon).energy()/ cosh( (*photon).eta()) ,iE, weight);
00616       h_nConv_[type][2]->fill(float( (*photon).conversions().size()),iE, weight);
00617      }
00618 
00620     std::vector<reco::ConversionRef> conversions = (*photon).conversions();
00621  
00622     for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
00623 
00624 // two dimensional histogram
00625 //      h_r9VsNofTracks_[type][0]->fill( r9, conversions[iConv]->nTracks() ) ; 
00626  
00627 //      if ( phoIsInBarrel ) h_r9VsNofTracks_[type][1]->fill( r9,  conversions[iConv]->nTracks() ) ; 
00628  
00629 //      if ( phoIsInEndcap ) h_r9VsNofTracks_[type][2]->fill( r9,  conversions[iConv]->nTracks() ) ; 
00630 
00631       if ( conversions[iConv]->nTracks() <2 ) continue; 
00632  
00633       h_convEta_[type]->fill( conversions[iConv]-> caloCluster()[0]->eta() );
00634       h_convPhi_[type]->fill( conversions[iConv]-> caloCluster()[0]->phi() );
00635       h_EoverPTracks_[type][0] ->fill( conversions[iConv]->EoverP() ,iE, weight) ;
00636       if ( phoIsInBarrel ) h_EoverPTracks_[type][1] ->fill( conversions[iConv]->EoverP() ,iE, weight) ;
00637       if ( phoIsInEndcap ) h_EoverPTracks_[type][2] ->fill( conversions[iConv]->EoverP() ,iE, weight) ;
00638  
00639  
00640 /* /// two dimensional histogram      
00641       if ( conversions[iConv]->conversionVertex().isValid() ) 
00642         h_convVtxRvsZ_[type] ->fill ( fabs (conversions[iConv]->conversionVertex().position().z() ),  sqrt(conversions[iConv]->conversionVertex().position().perp2())  ) ;
00643 */         
00644  
00645        h_zPVFromTracks_[type]->fill ( conversions[iConv]->zOfPrimaryVertexFromTracks() ,iE, weight);
00646 
00647        std::vector<reco::TrackRef> tracks = conversions[iConv]->tracks();
00648 
00649        float px=0;
00650        float py=0;
00651        float pz=0;
00652        float e=0;
00653        for (unsigned int i=0; i<tracks.size(); i++) {
00654 //         two dimensional histo
00655 //         p_tk_nHitsVsEta_[type]->fill(  conversions[iConv]->caloCluster()[0]->eta(),   float(tracks[i]->recHitsSize() ) );
00656          h_tkChi2_[type] ->fill (tracks[i]->normalizedChi2() ,iE, weight); 
00657          px+= tracks[i]->innerMomentum().x();
00658          py+= tracks[i]->innerMomentum().y();
00659          pz+= tracks[i]->innerMomentum().z();
00660          e +=  sqrt (  tracks[i]->innerMomentum().x()*tracks[i]->innerMomentum().x() +
00661                        tracks[i]->innerMomentum().y()*tracks[i]->innerMomentum().y() +
00662                        tracks[i]->innerMomentum().z()*tracks[i]->innerMomentum().z() +
00663                        +  mElec*mElec ) ;
00664        }
00665        float totP = sqrt(px*px +py*py + pz*pz);
00666        float invM=  (e + totP) * (e-totP) ;
00667  
00668        if ( invM> 0.) {
00669          invM= sqrt( invM);
00670        } else {
00671          invM=-1;
00672        }
00673  
00674        h_invMass_[type][0] ->fill( invM,iE, weight);
00675        if ( phoIsInBarrel ) h_invMass_[type][1] ->fill(invM,iE, weight);
00676        if ( phoIsInEndcap ) h_invMass_[type][2] ->fill(invM,iE, weight);
00677 
00678 
00679        float  dPhiTracksAtVtx = -99;
00680        
00681        float phiTk1= tracks[0]->innerMomentum().phi();
00682        float phiTk2= tracks[1]->innerMomentum().phi();
00683        dPhiTracksAtVtx = phiTk1-phiTk2;
00684        dPhiTracksAtVtx = phiNormalization( dPhiTracksAtVtx );
00685        h_DPhiTracksAtVtx_[type][0]->fill( dPhiTracksAtVtx,iE, weight);
00686        if ( phoIsInBarrel ) h_DPhiTracksAtVtx_[type][1]->fill( dPhiTracksAtVtx,iE, weight);
00687        if ( phoIsInEndcap ) h_DPhiTracksAtVtx_[type][2]->fill( dPhiTracksAtVtx,iE, weight);
00688        h_DCotTracks_[type][0] ->fill ( conversions[iConv]->pairCotThetaSeparation() ,iE, weight);
00689        if ( phoIsInBarrel ) h_DCotTracks_[type][1] ->fill ( conversions[iConv]->pairCotThetaSeparation() ,iE, weight);
00690        if ( phoIsInEndcap ) h_DCotTracks_[type][2] ->fill ( conversions[iConv]->pairCotThetaSeparation() ,iE, weight);
00691        
00692        
00693        float  dPhiTracksAtEcal=-99;
00694        float  dEtaTracksAtEcal=-99;
00695        if (conversions[iConv]-> bcMatchingWithTracks()[0].isNonnull() && conversions[iConv]->bcMatchingWithTracks()[1].isNonnull() ) {
00696          
00697          
00698          float recoPhi1 = conversions[iConv]->ecalImpactPosition()[0].phi();
00699          float recoPhi2 = conversions[iConv]->ecalImpactPosition()[1].phi();
00700          float recoEta1 = conversions[iConv]->ecalImpactPosition()[0].eta();
00701          float recoEta2 = conversions[iConv]->ecalImpactPosition()[1].eta();
00702          float bcPhi1 = conversions[iConv]->bcMatchingWithTracks()[0]->phi();
00703          float bcPhi2 = conversions[iConv]->bcMatchingWithTracks()[1]->phi();
00704 //         float bcEta1 = conversions[iConv]->bcMatchingWithTracks()[0]->eta();
00705 //         float bcEta2 = conversions[iConv]->bcMatchingWithTracks()[1]->eta();
00706          recoPhi1 = phiNormalization(recoPhi1);
00707          recoPhi2 = phiNormalization(recoPhi2);
00708          bcPhi1 = phiNormalization(bcPhi1);
00709          bcPhi2 = phiNormalization(bcPhi2);
00710          dPhiTracksAtEcal = recoPhi1 -recoPhi2;
00711          dPhiTracksAtEcal = phiNormalization( dPhiTracksAtEcal );
00712          dEtaTracksAtEcal = recoEta1 -recoEta2;
00713          
00714          h_DPhiTracksAtEcal_[type][0]->fill( dPhiTracksAtEcal,iE, weight);
00715          h_DEtaTracksAtEcal_[type][0]->fill( dEtaTracksAtEcal,iE, weight);
00716          if ( phoIsInBarrel ) {
00717            h_DPhiTracksAtEcal_[type][1]->fill( dPhiTracksAtEcal,iE, weight);
00718            h_DEtaTracksAtEcal_[type][1]->fill( dEtaTracksAtEcal,iE, weight);
00719          }
00720          if ( phoIsInEndcap ) {
00721            h_DPhiTracksAtEcal_[type][2]->fill( dPhiTracksAtEcal,iE, weight);
00722            h_DEtaTracksAtEcal_[type][2]->fill( dEtaTracksAtEcal,iE, weight);
00723          }
00724      }
00725 
00726     } // loop over conversions
00727 
00728 
00729 //  }/// End loop over Reco  particles
00730 
00731   h_nPho_[0][0]-> fill (float(nPho[0]),iE, weight);
00732   h_nPho_[0][1]-> fill (float(nPhoBarrel[0]),iE, weight);
00733   h_nPho_[0][2]-> fill (float(nPhoEndcap[0]),iE, weight);
00734   h_nPho_[1][0]-> fill (float(nPho[1]),iE, weight);
00735   h_nPho_[1][1]-> fill (float(nPhoBarrel[1]),iE, weight);
00736   h_nPho_[1][2]-> fill (float(nPhoEndcap[1]),iE, weight);
00737 
00738 
00739 
00740 
00741 }
00742 
00743 
00744 
00745 void HistoPhoton::fill( const reco::ShallowClonePtrCandidate * pshallow, uint iE, double weight )
00746 {
00747 
00748 
00749   // Get the underlying object that the shallow clone represents
00750   const pat::Photon * photon = dynamic_cast<const pat::Photon*>(pshallow);
00751 
00752   if ( photon == 0 ) {
00753     cout << "Error! Was passed a shallow clone that is not at heart a photon" << endl;
00754     return;
00755   }
00756 
00757   // first fill common 4-vector histograms
00758   HistoGroup<Photon>::fill( pshallow, iE, weight );
00759 
00760   // fill relevant photon histograms
00761   h_trackIso_       ->fill( photon->trackIso(), iE, weight );
00762   h_caloIso_        ->fill( photon->caloIso(), iE, weight );
00763 
00764 
00766   using namespace edm;
00767 //  const float etaPhiDistance=0.01;
00768   // Fiducial region
00769 //  const float TRK_BARL =0.9;
00770 //  const float BARL = 1.4442; // DAQ TDR p.290
00771 //  const float END_LO = 1.566;
00772 //  const float END_HI = 2.5;
00773   // Electron mass
00774   const Float_t mElec= 0.000511;
00775 
00776 
00777   std::vector<int> nPho(2);
00778   std::vector<int> nPhoBarrel(2);
00779   std::vector<int> nPhoEndcap(2);
00780   for ( int i=0; i<nPho.size(); i++ ) nPho[i]=0;
00781   for ( int i=0; i<nPhoBarrel.size(); i++ ) nPhoBarrel[i]=0;
00782   for ( int i=0; i<nPhoEndcap.size(); i++ ) nPhoEndcap[i]=0;
00783 
00784 
00785 
00786     reco::Photon aPho = reco::Photon(*photon);
00787 
00788     bool  phoIsInBarrel=false;
00789     bool  phoIsInEndcap=false;
00790 
00792     float etaPho=aPho.eta();
00793     float phiPho=aPho.phi();
00794     if ( fabs(etaPho) <  1.479 ) {
00795       phoIsInBarrel=true;
00796     } else {
00797       phoIsInEndcap=true;
00798     }
00799 
00800 
00801 //    float phiClu=aPho.superCluster()->phi();
00802     float etaClu=aPho.superCluster()->eta();
00803 
00804 
00805 
00806     bool  scIsInBarrel=false;
00807     bool  scIsInEndcap=false;
00808     if ( fabs(etaClu) <  1.479 ) 
00809       scIsInBarrel=true;
00810     else
00811       scIsInEndcap=true;
00812 
00813 
00814 
00815     int nTracks=0;
00816     double ptSum=0.;
00817     double ecalSum=0.;
00818     double hcalSum=0.;
00819 
00820 
00821 
00822 /*    bookProfile
00823     p_nTrackIsol_->fill( (*photon).superCluster()->eta(),   float(nTracks));
00824     p_trackPtSum_->fill((*photon).superCluster()->eta(),  ptSum);
00825     p_ecalSum_->fill((*photon).superCluster()->eta(),  ecalSum);
00826     p_hcalSum_->fill((*photon).superCluster()->eta(),  hcalSum);
00827 */
00828 
00829 
00830     bool isIsolated=false;
00831 //    if ( (nTracks < numOfTracksInCone_) && 
00832 //           ( ptSum < trkPtSumCut_) &&
00833 //           ( ecalSum < ecalEtSumCut_ ) &&  ( hcalSum < hcalEtSumCut_ ) ) isIsolated = true;
00834 
00835 
00836 
00837     int type=0;
00838     if ( !isIsolated ) type=1;
00839 
00840     nPho[type]++; 
00841     if (phoIsInBarrel) nPhoBarrel[type]++;
00842     if (phoIsInEndcap) nPhoEndcap[type]++;
00843 
00844 
00845 
00846 //   e3x3 needs to be calculated
00847     float e3x3= 0; // EcalClusterTools::e3x3(  *(   (*photon).superCluster()->seed()  ), &ecalRecHitCollection, &(*topology));
00848     float r9 =e3x3/( (*photon).superCluster()->rawEnergy()+ (*photon).superCluster()->preshowerEnergy());
00849 
00850 
00851     h_scEta_[type]->fill( (*photon).superCluster()->eta() ,iE, weight );
00852     h_scPhi_[type]->fill( (*photon).superCluster()->phi() ,iE, weight);
00853 
00854 
00856 //    h_scEtaPhi_[type]->fill( (*photon).superCluster()->eta(), (*photon).superCluster()->phi() );
00857 
00858     h_scE_[type][0]->fill( (*photon).superCluster()->energy() ,iE, weight);
00859     h_scEt_[type][0]->fill( (*photon).superCluster()->energy()/cosh( (*photon).superCluster()->eta()) ,iE, weight);
00860     h_r9_[type][0]->fill( r9 ,iE, weight);
00861 
00862     h_phoEta_[type]->fill( (*photon).eta() ,iE, weight);
00863     h_phoPhi_[type]->fill( (*photon).phi() ,iE, weight);
00864 
00865     h_phoE_[type][0]->fill( (*photon).energy() ,iE, weight);
00866     h_phoEt_[type][0]->fill( (*photon).energy()/ cosh( (*photon).eta()) ,iE, weight);
00867 
00868 
00869     h_nConv_[type][0]->fill(float( (*photon).conversions().size()),iE, weight);
00870 
00871     if ( scIsInBarrel ) {
00872       h_scE_[type][1]->fill( (*photon).superCluster()->energy() ,iE, weight);
00873       h_scEt_[type][1]->fill( (*photon).superCluster()->energy()/cosh( (*photon).superCluster()->eta()) ,iE, weight);
00874       h_r9_[type][1]->fill( r9 ,iE, weight);
00875      }
00876 
00877     if ( scIsInEndcap ) {
00878       h_scE_[type][2]->fill( (*photon).superCluster()->energy() ,iE, weight);
00879       h_scEt_[type][2]->fill( (*photon).superCluster()->energy()/cosh( (*photon).superCluster()->eta()) ,iE, weight);
00880       h_r9_[type][2]->fill( r9 ,iE, weight);
00881      }
00882 
00883     if ( phoIsInBarrel ) {
00884       h_phoE_[type][1]->fill( (*photon).energy() ,iE, weight);
00885       h_phoEt_[type][1]->fill( (*photon).energy()/ cosh( (*photon).eta()) ,iE, weight);
00886       h_nConv_[type][1]->fill(float( (*photon).conversions().size()),iE, weight);
00887      }
00888     
00889     if ( phoIsInEndcap ) {
00890       h_phoE_[type][2]->fill( (*photon).energy() ,iE, weight);
00891       h_phoEt_[type][2]->fill( (*photon).energy()/ cosh( (*photon).eta()) ,iE, weight);
00892       h_nConv_[type][2]->fill(float( (*photon).conversions().size()),iE, weight);
00893      }
00894 
00896     std::vector<reco::ConversionRef> conversions = (*photon).conversions();
00897  
00898     for (unsigned int iConv=0; iConv<conversions.size(); iConv++) {
00899 
00900 // two dimensional histogram
00901 //      h_r9VsNofTracks_[type][0]->fill( r9, conversions[iConv]->nTracks() ) ; 
00902  
00903 //      if ( phoIsInBarrel ) h_r9VsNofTracks_[type][1]->fill( r9,  conversions[iConv]->nTracks() ) ; 
00904  
00905 //      if ( phoIsInEndcap ) h_r9VsNofTracks_[type][2]->fill( r9,  conversions[iConv]->nTracks() ) ; 
00906 
00907       if ( conversions[iConv]->nTracks() <2 ) continue; 
00908  
00909  
00910       h_convEta_[type]->fill( conversions[iConv]-> caloCluster()[0]->eta() );
00911       h_convPhi_[type]->fill( conversions[iConv]-> caloCluster()[0]->phi() );
00912       h_EoverPTracks_[type][0] ->fill( conversions[iConv]->EoverP() ,iE, weight) ;
00913       if ( phoIsInBarrel ) h_EoverPTracks_[type][1] ->fill( conversions[iConv]->EoverP() ,iE, weight) ;
00914       if ( phoIsInEndcap ) h_EoverPTracks_[type][2] ->fill( conversions[iConv]->EoverP() ,iE, weight) ;
00915  
00916  
00917 /* /// two dimensional histogram      
00918       if ( conversions[iConv]->conversionVertex().isValid() ) 
00919         h_convVtxRvsZ_[type] ->fill ( fabs (conversions[iConv]->conversionVertex().position().z() ),  sqrt(conversions[iConv]->conversionVertex().position().perp2())  ) ;
00920 */         
00921  
00922        h_zPVFromTracks_[type]->fill ( conversions[iConv]->zOfPrimaryVertexFromTracks() ,iE, weight);
00923 
00924        std::vector<reco::TrackRef> tracks = conversions[iConv]->tracks();
00925 
00926        float px=0;
00927        float py=0;
00928        float pz=0;
00929        float e=0;
00930        for (unsigned int i=0; i<tracks.size(); i++) {
00931 //         two dimensional histo
00932 //         p_tk_nHitsVsEta_[type]->fill(  conversions[iConv]->caloCluster()[0]->eta(),   float(tracks[i]->recHitsSize() ) );
00933          h_tkChi2_[type] ->fill (tracks[i]->normalizedChi2() ,iE, weight); 
00934          px+= tracks[i]->innerMomentum().x();
00935          py+= tracks[i]->innerMomentum().y();
00936          pz+= tracks[i]->innerMomentum().z();
00937          e +=  sqrt (  tracks[i]->innerMomentum().x()*tracks[i]->innerMomentum().x() +
00938                        tracks[i]->innerMomentum().y()*tracks[i]->innerMomentum().y() +
00939                        tracks[i]->innerMomentum().z()*tracks[i]->innerMomentum().z() +
00940                        +  mElec*mElec ) ;
00941        }
00942        float totP = sqrt(px*px +py*py + pz*pz);
00943        float invM=  (e + totP) * (e-totP) ;
00944  
00945        if ( invM> 0.) {
00946          invM= sqrt( invM);
00947        } else {
00948          invM=-1;
00949        }
00950  
00951        h_invMass_[type][0] ->fill( invM,iE, weight);
00952        if ( phoIsInBarrel ) h_invMass_[type][1] ->fill(invM,iE, weight);
00953        if ( phoIsInEndcap ) h_invMass_[type][2] ->fill(invM,iE, weight);
00954 
00955 
00956        float  dPhiTracksAtVtx = -99;
00957        
00958        float phiTk1= tracks[0]->innerMomentum().phi();
00959        float phiTk2= tracks[1]->innerMomentum().phi();
00960        dPhiTracksAtVtx = phiTk1-phiTk2;
00961        dPhiTracksAtVtx = phiNormalization( dPhiTracksAtVtx );
00962        h_DPhiTracksAtVtx_[type][0]->fill( dPhiTracksAtVtx,iE, weight);
00963        if ( phoIsInBarrel ) h_DPhiTracksAtVtx_[type][1]->fill( dPhiTracksAtVtx,iE, weight);
00964        if ( phoIsInEndcap ) h_DPhiTracksAtVtx_[type][2]->fill( dPhiTracksAtVtx,iE, weight);
00965        h_DCotTracks_[type][0] ->fill ( conversions[iConv]->pairCotThetaSeparation() ,iE, weight);
00966        if ( phoIsInBarrel ) h_DCotTracks_[type][1] ->fill ( conversions[iConv]->pairCotThetaSeparation() ,iE, weight);
00967        if ( phoIsInEndcap ) h_DCotTracks_[type][2] ->fill ( conversions[iConv]->pairCotThetaSeparation() ,iE, weight);
00968        
00969        
00970        float  dPhiTracksAtEcal=-99;
00971        float  dEtaTracksAtEcal=-99;
00972        if (conversions[iConv]-> bcMatchingWithTracks()[0].isNonnull() && conversions[iConv]->bcMatchingWithTracks()[1].isNonnull() ) {
00973          
00974          
00975          float recoPhi1 = conversions[iConv]->ecalImpactPosition()[0].phi();
00976          float recoPhi2 = conversions[iConv]->ecalImpactPosition()[1].phi();
00977          float recoEta1 = conversions[iConv]->ecalImpactPosition()[0].eta();
00978          float recoEta2 = conversions[iConv]->ecalImpactPosition()[1].eta();
00979          float bcPhi1 = conversions[iConv]->bcMatchingWithTracks()[0]->phi();
00980          float bcPhi2 = conversions[iConv]->bcMatchingWithTracks()[1]->phi();
00981 //         float bcEta1 = conversions[iConv]->bcMatchingWithTracks()[0]->eta();
00982 //         float bcEta2 = conversions[iConv]->bcMatchingWithTracks()[1]->eta();
00983          recoPhi1 = phiNormalization(recoPhi1);
00984          recoPhi2 = phiNormalization(recoPhi2);
00985          bcPhi1 = phiNormalization(bcPhi1);
00986          bcPhi2 = phiNormalization(bcPhi2);
00987          dPhiTracksAtEcal = recoPhi1 -recoPhi2;
00988          dPhiTracksAtEcal = phiNormalization( dPhiTracksAtEcal );
00989          dEtaTracksAtEcal = recoEta1 -recoEta2;
00990          
00991          h_DPhiTracksAtEcal_[type][0]->fill( dPhiTracksAtEcal,iE, weight);
00992          h_DEtaTracksAtEcal_[type][0]->fill( dEtaTracksAtEcal,iE, weight);
00993          if ( phoIsInBarrel ) {
00994            h_DPhiTracksAtEcal_[type][1]->fill( dPhiTracksAtEcal,iE, weight);
00995            h_DEtaTracksAtEcal_[type][1]->fill( dEtaTracksAtEcal,iE, weight);
00996          }
00997          if ( phoIsInEndcap ) {
00998            h_DPhiTracksAtEcal_[type][2]->fill( dPhiTracksAtEcal,iE, weight);
00999            h_DEtaTracksAtEcal_[type][2]->fill( dEtaTracksAtEcal,iE, weight);
01000          }
01001      }
01002 
01003     } // loop over conversions
01004 
01005 
01006 //  }/// End loop over Reco  particles
01007 
01008   h_nPho_[0][0]-> fill (float(nPho[0]),iE, weight);
01009   h_nPho_[0][1]-> fill (float(nPhoBarrel[0]),iE, weight);
01010   h_nPho_[0][2]-> fill (float(nPhoEndcap[0]),iE, weight);
01011   h_nPho_[1][0]-> fill (float(nPho[1]),iE, weight);
01012   h_nPho_[1][1]-> fill (float(nPhoBarrel[1]),iE, weight);
01013   h_nPho_[1][2]-> fill (float(nPhoEndcap[1]),iE, weight);
01014 
01015 
01016 
01017 
01018 
01019 
01020 
01021 }
01022 
01023 
01024 void HistoPhoton::fillCollection( const std::vector<Photon> & coll, double weight ) 
01025 {
01026 
01027   h_size_->fill( coll.size(), 1, weight );     
01028 
01029   std::vector<Photon>::const_iterator
01030     iobj = coll.begin(),
01031     iend = coll.end();
01032 
01033   uint i = 1;              
01034   for ( ; iobj != iend; ++iobj, ++i ) {
01035     fill( &*iobj, i, weight);      
01036   } 
01037 }
01038 
01039 void HistoPhoton::clearVec()
01040 {
01041   HistoGroup<Photon>::clearVec();
01042 
01043   h_trackIso_->clearVec();
01044   h_caloIso_->clearVec();
01045 
01046 
01047 /*
01048   p_nTrackIsol_->clearVec();
01049   p_trackPtSum_->clearVec();
01050   p_ecalSum_->clearVec();
01051   p_hcalSum_->clearVec();
01052 */
01053 
01054  for (int i=0; i<2; i++){
01055     for(int j=0; j<3; j++){
01056           h_nPho_[i][j]->clearVec();
01057           h_scE_[i][j]->clearVec();
01058           h_scEt_[i][j]->clearVec();
01059 
01060           h_r9_[i][j]->clearVec();
01061           h_phoE_[i][j]->clearVec();
01062           h_phoEt_[i][j]->clearVec();
01063           h_nConv_[i][j]->clearVec();
01064 //        h_r9VsNofTracks_[i][j]->clearVec();
01065           h_EoverPTracks_[i][j]->clearVec();
01066           h_DPhiTracksAtVtx_[i][j]->clearVec();
01067           h_DCotTracks_[i][j]->clearVec();
01068           h_invMass_[i][j]->clearVec();
01069           h_DPhiTracksAtEcal_[i][j]->clearVec();
01070           h_DEtaTracksAtEcal_[i][j]->clearVec();
01071      }// loop j
01072     h_scEta_[i]->clearVec();
01073     h_scPhi_[i]->clearVec();
01074 //    h_scEtaPhi_[i]->clearVec();
01075 
01076     h_phoEta_[i]->clearVec();
01077     h_phoPhi_[i]->clearVec();
01078 
01079     h_convEta_[i]->clearVec();
01080     h_convPhi_[i]->clearVec();
01081 //    p_tk_nHitsVsEta_[i]->clearVec();
01082     h_tkChi2_[i]->clearVec();
01083 
01084 //    h_convVtxRvsZ_[i]->clearVec();
01085     h_zPVFromTracks_[i]->clearVec();
01086   } // loop i
01087 
01088 
01089 }
01090 
01091 
01092 float HistoPhoton::phiNormalization(float & phi)
01093 {
01094 //---Definitions
01095   const float PI    = 3.1415927;
01096   const float TWOPI = 2.0*PI;
01097  
01098 
01099   if(phi >  PI) {phi = phi - TWOPI;}
01100   if(phi < -PI) {phi = phi + TWOPI;}
01101  
01102   //  cout << " Float_t PHInormalization out " << PHI << endl;
01103   return phi;
01104  
01105 }
01106 

Generated on Tue Jun 9 17:41:55 2009 for CMSSW by  doxygen 1.5.4