CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQMOffline/EGamma/plugins/PhotonAnalyzer.h

Go to the documentation of this file.
00001 #ifndef PhotonAnalyzer_H
00002 #define PhotonAnalyzer_H
00003 
00004 #include "FWCore/ServiceRegistry/interface/Service.h"
00005 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00006 //
00007 #include "FWCore/Framework/interface/Frameworkfwd.h"
00008 #include "FWCore/Framework/interface/MakerMacros.h"
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "FWCore/Utilities/interface/Exception.h"
00011 // DataFormats
00012 #include "DataFormats/Math/interface/deltaR.h"
00013 #include "DataFormats/Common/interface/Handle.h"
00014 #include "DataFormats/TrackReco/interface/Track.h"
00015 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00016 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00017 #include "DataFormats/Common/interface/ValueMap.h"
00018 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00019 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00020 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00021 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00022 
00023 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00024 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00025 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
00026 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
00027 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00028 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00029 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00030 #include "DataFormats/DetId/interface/DetId.h"
00031 
00032 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00033 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
00034 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
00035 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00036 
00038 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
00039 #include "RecoEcal/EgammaCoreTools/interface/EcalEtaPhiRegion.h"
00040 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
00041 
00042 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
00043 
00044 // Geometry
00045 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00046 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00047 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00048 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00049 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00050 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00051 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00052 #include "Geometry/CaloTopology/interface/EcalEndcapTopology.h"
00053 #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
00054 //
00055 #include "TFile.h"
00056 #include "TH1.h"
00057 #include "TH2.h"
00058 #include "TTree.h"
00059 #include "TVector3.h"
00060 #include "TProfile.h"
00061 //
00062 
00063 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00064 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00065 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00066 #include "FWCore/Framework/interface/EDAnalyzer.h"
00067 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00068 #include "FWCore/Framework/interface/Event.h"
00069 #include "FWCore/Framework/interface/EventSetup.h"
00070 #include "FWCore/Framework/interface/ESHandle.h"
00071 
00072 //
00073 //DQM services
00074 #include "DQMServices/Core/interface/DQMStore.h"
00075 #include "FWCore/ServiceRegistry/interface/Service.h"
00076 #include "DQMServices/Core/interface/MonitorElement.h"
00077 
00078 //
00079 
00080 #include <vector>
00081 #include <string>
00082 
00095 // forward declarations
00096 class TFile;
00097 class TH1F;
00098 class TH2F;
00099 class TProfile;
00100 class TTree;
00101 class SimVertex;
00102 class SimTrack;
00103 
00104 
00105 class PhotonAnalyzer : public edm::EDAnalyzer
00106 {
00107 
00108 
00109  public:
00110    
00111   //
00112   explicit PhotonAnalyzer( const edm::ParameterSet& ) ;
00113   virtual ~PhotonAnalyzer();
00114                                    
00115       
00116   virtual void analyze( const edm::Event&, const edm::EventSetup& ) ;
00117   virtual void beginJob() ;
00118   virtual void endJob() ;
00119   virtual void endRun(const edm::Run& , const edm::EventSetup& ) ;
00120 
00121  
00122  private:
00123   //
00124 
00125   float  phiNormalization( float& a);
00126 
00127   MonitorElement* bookHisto(std::string histoName, std::string title, int bin, double min, double max);
00128 
00129   void book2DHistoVector(std::vector<std::vector<MonitorElement*> > & toFill,
00130                          std::string histoType, std::string histoName, std::string title,                        
00131                                                                int xbin, double xmin, double xmax,
00132                                                                int ybin=1,double ymin=1, double ymax=2);
00133 
00134   void book3DHistoVector( std::vector<std::vector<std::vector<MonitorElement*> > > & toFill,
00135                           std::string histoType, std::string histoName, std::string title, 
00136                                                                int xbin, double xmin, double xmax,
00137                                                                int ybin=1,double ymin=1, double ymax=2);
00138 
00139 
00140   void fill2DHistoVector(std::vector<std::vector<MonitorElement*> >& histoVector,double x, int cut, int type);
00141   void fill2DHistoVector(std::vector<std::vector<MonitorElement*> >& histoVector,double x, double y, int cut, int type);
00142 
00143   void fill3DHistoVector(std::vector<std::vector<std::vector<MonitorElement*> > >& histoVector,double x, int cut, int type, int part);
00144   void fill3DHistoVector(std::vector<std::vector<std::vector<MonitorElement*> > >& histoVector,double x, double y, int cut, int type, int part);
00145 
00146 
00147 
00149 
00150   std::string fName_;
00151   int verbosity_;
00152 
00153   unsigned int prescaleFactor_;
00154 
00155   std::string photonProducer_;       
00156   std::string photonCollection_;
00157 
00158   std::string barrelRecHitProducer_;
00159   std::string barrelRecHitCollection_;
00160 
00161   std::string endcapRecHitProducer_;
00162   std::string endcapRecHitCollection_;
00163 
00164   edm::InputTag triggerEvent_;
00165 
00166   double minPhoEtCut_;
00167   double invMassEtCut_;
00168 
00169   double cutStep_;
00170   int numberOfSteps_;
00171 
00172   bool useBinning_;
00173   bool useTriggerFiltering_;
00174   bool standAlone_;
00175   std::string outputFileName_;
00176   
00177 
00178   int isolationStrength_; 
00179 
00180   bool isHeavyIon_;
00181 
00182   edm::ParameterSet parameters_;
00183            
00185 
00186   DQMStore *dbe_;
00187   std::stringstream currentFolder_;
00188 
00189   int histo_index_photons_;
00190   int histo_index_conversions_;
00191   int histo_index_efficiency_;
00192   int histo_index_invMass_;
00193 
00194 
00195   int nEvt_;
00196   int nEntry_;
00197 
00198   std::vector<std::string> types_;
00199   std::vector<std::string> parts_;
00200 
00202 
00203   MonitorElement* totalNumberOfHistos_efficiencyFolder;
00204   MonitorElement* totalNumberOfHistos_invMassFolder;
00205   MonitorElement* totalNumberOfHistos_photonsFolder;
00206   MonitorElement* totalNumberOfHistos_conversionsFolder;
00207 
00208 
00209   MonitorElement* h_phoEta_Loose_;
00210   MonitorElement* h_phoEta_Tight_;
00211   MonitorElement* h_phoEt_Loose_;
00212   MonitorElement* h_phoEt_Tight_;
00213 
00214   MonitorElement* h_phoEta_preHLT_;
00215   MonitorElement* h_phoEta_postHLT_;
00216   MonitorElement* h_phoEt_preHLT_;
00217   MonitorElement* h_phoEt_postHLT_;
00218 
00219   MonitorElement* h_convEta_Loose_;
00220   MonitorElement* h_convEta_Tight_;
00221   MonitorElement* h_convEt_Loose_;
00222   MonitorElement* h_convEt_Tight_;
00223 
00224 
00225   MonitorElement* h_phoEta_Vertex_;
00226 
00227   MonitorElement* h_invMassTwoWithTracks_;
00228   MonitorElement* h_invMassOneWithTracks_;
00229   MonitorElement* h_invMassZeroWithTracks_;
00230   MonitorElement* h_invMassAllPhotons_;
00231 
00233 
00234 
00235   std::vector<std::vector<MonitorElement*> > h_nTrackIsolSolidVsEta_;
00236   std::vector<std::vector<MonitorElement*> > h_trackPtSumSolidVsEta_;
00237   std::vector<std::vector<MonitorElement*> > h_nTrackIsolHollowVsEta_;
00238   std::vector<std::vector<MonitorElement*> > h_trackPtSumHollowVsEta_;
00239   std::vector<std::vector<MonitorElement*> > h_ecalSumVsEta_;
00240   std::vector<std::vector<MonitorElement*> > h_hcalSumVsEta_;
00241 
00242 
00243   std::vector<std::vector<MonitorElement*> > h_nTrackIsolSolidVsEt_;
00244   std::vector<std::vector<MonitorElement*> > h_trackPtSumSolidVsEt_;
00245   std::vector<std::vector<MonitorElement*> > h_nTrackIsolHollowVsEt_;
00246   std::vector<std::vector<MonitorElement*> > h_trackPtSumHollowVsEt_;
00247   std::vector<std::vector<MonitorElement*> > h_ecalSumVsEt_;
00248   std::vector<std::vector<MonitorElement*> > h_hcalSumVsEt_;
00249 
00250 
00251   std::vector<std::vector<MonitorElement*> > h_nTrackIsolSolid_;
00252   std::vector<std::vector<MonitorElement*> > h_trackPtSumSolid_;
00253   std::vector<std::vector<MonitorElement*> > h_nTrackIsolHollow_;
00254   std::vector<std::vector<MonitorElement*> > h_trackPtSumHollow_;
00255   std::vector<std::vector<MonitorElement*> > h_ecalSum_;
00256   std::vector<std::vector<MonitorElement*> > h_hcalSum_;
00257 
00258 
00259   std::vector<std::vector<MonitorElement*> > p_nTrackIsolSolidVsEta_;
00260   std::vector<std::vector<MonitorElement*> > p_trackPtSumSolidVsEta_;
00261   std::vector<std::vector<MonitorElement*> > p_nTrackIsolHollowVsEta_;
00262   std::vector<std::vector<MonitorElement*> > p_trackPtSumHollowVsEta_;
00263   std::vector<std::vector<MonitorElement*> > p_ecalSumVsEta_;
00264   std::vector<std::vector<MonitorElement*> > p_hcalSumVsEta_;
00265 
00266   std::vector<std::vector<MonitorElement*> > p_nTrackIsolSolidVsEt_;
00267   std::vector<std::vector<MonitorElement*> > p_trackPtSumSolidVsEt_;
00268   std::vector<std::vector<MonitorElement*> > p_nTrackIsolHollowVsEt_;
00269   std::vector<std::vector<MonitorElement*> > p_trackPtSumHollowVsEt_;
00270 
00271   std::vector<std::vector<MonitorElement*> > p_r9VsEt_;
00272   std::vector<std::vector<MonitorElement*> > p_r9VsEta_;
00273 
00274   std::vector<std::vector<MonitorElement*> > p_e1x5VsEt_;
00275   std::vector<std::vector<MonitorElement*> > p_e1x5VsEta_;
00276 
00277   std::vector<std::vector<MonitorElement*> > p_e2x5VsEt_;
00278   std::vector<std::vector<MonitorElement*> > p_e2x5VsEta_;
00279 
00280   std::vector<std::vector<MonitorElement*> > p_maxEXtalOver3x3VsEt_;
00281   std::vector<std::vector<MonitorElement*> > p_maxEXtalOver3x3VsEta_;
00282 
00283   std::vector<std::vector<MonitorElement*> > p_r1x5VsEt_;
00284   std::vector<std::vector<MonitorElement*> > p_r1x5VsEta_;
00285 
00286   std::vector<std::vector<MonitorElement*> > p_r2x5VsEt_;
00287   std::vector<std::vector<MonitorElement*> > p_r2x5VsEta_;
00288 
00289   std::vector<std::vector<MonitorElement*> > p_sigmaIetaIetaVsEta_;
00290 
00291   std::vector<std::vector<MonitorElement*> > p_dCotTracksVsEta_;
00292 
00293   std::vector<std::vector<MonitorElement*> > p_hOverEVsEta_;
00294   std::vector<std::vector<MonitorElement*> > p_hOverEVsEt_;
00295 
00296   std::vector<std::vector<MonitorElement*> > h_phoEta_;
00297   std::vector<std::vector<MonitorElement*> > h_scEta_;
00298 
00299 
00300   std::vector<std::vector<MonitorElement*> > h_phoConvEtaForEfficiency_;
00301 
00302   std::vector<std::vector<MonitorElement*> > h_phoEta_BadChannels_;
00303   std::vector<std::vector<MonitorElement*> > h_phoEt_BadChannels_;
00304   std::vector<std::vector<MonitorElement*> > h_phoPhi_BadChannels_;
00305 
00306   std::vector<std::vector<MonitorElement*> > h_phoConvEta_;
00307 
00308   std::vector<std::vector<MonitorElement*> > h_convVtxRvsZ_;
00309   std::vector<std::vector<MonitorElement*> > h_convVtxZEndcap_;
00310   std::vector<std::vector<MonitorElement*> > h_convVtxZ_;
00311   std::vector<std::vector<MonitorElement*> > h_convVtxYvsX_;
00312   std::vector<std::vector<MonitorElement*> > h_convVtxR_;
00313 
00314   std::vector<std::vector<MonitorElement*> > h_r9VsEt_;
00315   std::vector<std::vector<MonitorElement*> > h_r9VsEta_;
00316 
00317 
00318   std::vector<std::vector<MonitorElement*> > h_e1x5VsEt_;
00319   std::vector<std::vector<MonitorElement*> > h_e1x5VsEta_;
00320 
00321   std::vector<std::vector<MonitorElement*> > h_e2x5VsEt_;
00322   std::vector<std::vector<MonitorElement*> > h_e2x5VsEta_;
00323 
00324   std::vector<std::vector<MonitorElement*> > h_maxEXtalOver3x3VsEt_;
00325   std::vector<std::vector<MonitorElement*> > h_maxEXtalOver3x3VsEta_;
00326 
00327   std::vector<std::vector<MonitorElement*> > h_r1x5VsEt_;
00328   std::vector<std::vector<MonitorElement*> > h_r1x5VsEta_;
00329 
00330   std::vector<std::vector<MonitorElement*> > h_r2x5VsEt_;
00331   std::vector<std::vector<MonitorElement*> > h_r2x5VsEta_;
00332 
00333   std::vector<std::vector<MonitorElement*> > h_sigmaIetaIetaVsEta_;
00334 
00335   std::vector<std::vector<MonitorElement*> > h_tkChi2_;
00336 
00337   std::vector<std::vector<MonitorElement*> > h_vertexChi2Prob_;
00338 
00339   std::vector<std::vector<MonitorElement*> > p_nHitsVsEta_;
00340 
00341   std::vector<std::vector<MonitorElement*> > p_tkChi2VsEta_;
00342 
00343 
00345 
00346   std::vector<std::vector<std::vector<MonitorElement*> > > p_ecalSumVsEt_;
00347   std::vector<std::vector<std::vector<MonitorElement*> > > p_hcalSumVsEt_;
00348 
00349   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoE_;
00350   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoEt_;
00351   std::vector<std::vector<std::vector<MonitorElement*> > > h_r9_;
00352   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoPhi_;
00353   std::vector<std::vector<std::vector<MonitorElement*> > > h_scPhi_;
00354   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoConvPhiForEfficiency_;
00355   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoConvPhi_;
00356 
00357 
00358 
00359   std::vector<std::vector<std::vector<MonitorElement*> > > h_hOverE_;
00360   std::vector<std::vector<std::vector<MonitorElement*> > > h_h1OverE_;
00361   std::vector<std::vector<std::vector<MonitorElement*> > > h_h2OverE_;
00362 
00363   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoSigmaIetaIeta_;
00364 
00365   std::vector<std::vector<std::vector<MonitorElement*> > > h_nPho_;
00366 
00367   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoConvE_;
00368   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoConvEt_;
00369   std::vector<std::vector<std::vector<MonitorElement*> > > h_phoConvR9_;
00370 
00371   std::vector<std::vector<std::vector<MonitorElement*> > > h_nConv_;
00372 
00373   std::vector<std::vector<std::vector<MonitorElement*> > > h_eOverPTracks_;
00374   std::vector<std::vector<std::vector<MonitorElement*> > > h_pOverETracks_;
00375 
00376   std::vector<std::vector<std::vector<MonitorElement*> > > h_dCotTracks_;
00377 
00378   std::vector<std::vector<std::vector<MonitorElement*> > > h_dPhiTracksAtVtx_;
00379   std::vector<std::vector<std::vector<MonitorElement*> > > h_dPhiTracksAtEcal_;
00380 
00381   std::vector<std::vector<std::vector<MonitorElement*> > > h_dEtaTracksAtEcal_;
00382 
00383 };
00384 
00385 
00386 
00387 
00388 
00389 #endif
00390 
00391 
00392 
00393