CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQMOffline/JetMET/interface/JPTJetAnalyzer.h

Go to the documentation of this file.
00001 #ifndef JPTJetAnalyzer_H
00002 #define JPTJetAnalyzer_H
00003 
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "DQMOffline/JetMET/interface/JetAnalyzerBase.h"
00015 #include "FWCore/Utilities/interface/InputTag.h"
00016 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00017 #include "DQMServices/Core/interface/MonitorElement.h"
00018 #include "DataFormats/JetReco/interface/JPTJet.h"
00019 #include "DataFormats/JetReco/interface/JPTJetCollection.h"
00020 #include <memory>
00021 
00022 
00023 #include "GlobalVariables.h"
00024 
00025 
00026 // forward declare classes which do not need to be defined for interface
00027 class DQMStore;
00028 namespace reco {
00029   namespace helper {
00030     class JetIDHelper;
00031   }
00032 }
00033 namespace jptJetAnalysis {
00034   class TrackPropagatorToCalo;
00035   class StripSignalOverNoiseCalculator;
00036 }
00037 namespace jpt {
00038   class MatchedTracks;
00039 }
00040 class JetPlusTrackCorrector;
00041 class JetCorrector;
00042 class TrackingRecHit;
00043 class SiStripRecHit2D;
00044 
00045 
00047 class JPTJetAnalyzer : public JetAnalyzerBase {
00048  public:
00050   JPTJetAnalyzer(const edm::ParameterSet& config);
00051   
00053   virtual ~JPTJetAnalyzer();
00054   
00056   void beginJob(DQMStore * dbe);
00057   
00059   void analyze(const edm::Event& event, const edm::EventSetup& eventSetup, const reco::JPTJet& jptJet, double& pt1, double& pt2, double& pt3, const int numPV);
00060   void analyze(const edm::Event& event, const edm::EventSetup& eventSetup, const reco::JPTJetCollection& jptJets, const int numPV);
00061   
00063   virtual void endJob();
00064   
00065  private:
00066    
00067   // Helper classes
00069   struct HistogramConfig {
00070     bool enabled;
00071     unsigned int nBins;
00072     double min;
00073     double max;
00074     unsigned int nBinsY;
00075     double minY;
00076     double maxY;
00077     HistogramConfig();
00078     HistogramConfig(const unsigned int theNBins, const double theMin, const double theMax);
00079     HistogramConfig(const unsigned int theNBinsX, const double theMinX, const double theMaxX,
00080                     const unsigned int theNBinsY, const double theMinY, const double theMaxY);
00081   };
00083   struct TrackHistograms {
00084     MonitorElement* nTracksHisto;
00085     MonitorElement* ptHisto;
00086     MonitorElement* phiHisto;
00087     MonitorElement* etaHisto;
00088     MonitorElement* nHitsHisto;
00089     MonitorElement* nLayersHisto;
00090     MonitorElement* ptVsEtaHisto;
00091     MonitorElement* dzHisto;
00092     MonitorElement* dxyHisto;
00093     MonitorElement* trackDirectionJetDRHisto;
00094     MonitorElement* trackImpactPointJetDRHisto;
00095     TrackHistograms();
00096     TrackHistograms(MonitorElement* theNTracksHisto, MonitorElement* thePtHisto, MonitorElement* thePhiHisto, MonitorElement* theEtaHisto,
00097                     MonitorElement* theNHitsHisto, MonitorElement* theNLayersHisto, MonitorElement* thePtVsEtaHisto,
00098                     MonitorElement* dzHisto, MonitorElement* dxyHisto,
00099                     MonitorElement* theTrackDirectionJetDRHisto, MonitorElement* theTrackImpactPointJetDRHisto);
00100   };
00101   
00102   // Private methods
00104   void getConfigForHistogram(const std::string& configName, const edm::ParameterSet& psetContainingConfigPSet, std::ostringstream* pDebugStream = NULL);
00106   void getConfigForTrackHistograms(const std::string& tag, const edm::ParameterSet& psetContainingConfigPSet,std::ostringstream* pDebugStream = NULL);
00108   MonitorElement* bookHistogram(const std::string& name, const std::string& title, const std::string& xAxisTitle, DQMStore* dqm);
00109   MonitorElement* book2DHistogram(const std::string& name, const std::string& title, const std::string& xAxisTitle, const std::string& yAxisTitle, DQMStore* dqm);
00110   MonitorElement* bookProfile(const std::string& name, const std::string& title, const std::string& xAxisTitle, const std::string& yAxisTitle, DQMStore* dqm);
00112   void bookHistograms(DQMStore* dqm);
00114   void bookTrackHistograms(TrackHistograms* histos, const std::string& tag, const std::string& titleTag,
00115                            MonitorElement* trackDirectionJetDRHisto, MonitorElement* trackImpactPointJetDRHisto, DQMStore* dqm);
00117   void fillHistogram(MonitorElement* histogram, const double value);
00118   void fillHistogram(MonitorElement* histogram, const double valueX, const double valueY);
00120   void fillTrackHistograms(TrackHistograms& allTracksHistos, TrackHistograms& inCaloInVertexHistos,
00121                            TrackHistograms& inCaloOutVertexHistos, TrackHistograms& outCaloInVertexHistos,
00122                            const reco::TrackRefVector& inVertexInCalo,
00123                            const reco::TrackRefVector& outVertexInCalo,
00124                            const reco::TrackRefVector& inVertexOutCalo,
00125                            const reco::Jet& rawJet);
00126   void fillTrackHistograms(TrackHistograms& histos, const reco::TrackRefVector& tracks, const reco::Jet& rawJet);
00128   void fillSiStripSoNForTracks(const reco::TrackRefVector& tracks);
00129   void fillSiStripHitSoN(const TrackingRecHit& hit);
00130   void fillSiStripHitSoNForSingleHit(const SiStripRecHit2D& hit);
00132   static double findPtFractionInCone(const reco::TrackRefVector& inConeTracks, const reco::TrackRefVector& outOfConeTracks);
00133   
00135   static const char* messageLoggerCatregory;
00136   
00137   // Config
00139   const std::string histogramPath_;
00141   const bool verbose_;
00143   std::map<std::string,HistogramConfig> histogramConfig_;
00144   
00146   const bool writeDQMStore_;
00148   std::string dqmStoreFileName_;
00149   
00151   const int n90HitsMin_;
00152   const double fHPDMax_;
00153   const double resEMFMin_;
00154   const double correctedPtMin_;
00155   
00157   std::auto_ptr<jptJetAnalysis::TrackPropagatorToCalo> trackPropagator_;
00159   std::auto_ptr<jptJetAnalysis::StripSignalOverNoiseCalculator> sOverNCalculator_;
00161   std::auto_ptr<reco::helper::JetIDHelper> jetID_;
00162   
00163   // Histograms
00164   MonitorElement *JetE_, *JetEt_, *JetP_, *JetMass_, *JetPt_;
00165   MonitorElement *JetPt1_, *JetPt2_, *JetPt3_;
00166   MonitorElement *JetPx_, *JetPy_, *JetPz_;
00167   MonitorElement *JetEta_, *JetPhi_, *JetDeltaEta_, *JetDeltaPhi_, *JetPhiVsEta_;
00168   MonitorElement *JetN90Hits_, *JetfHPD_, *JetResEMF_, *JetfRBX_;
00169   MonitorElement *TrackSiStripHitStoNHisto_;
00170   MonitorElement *InCaloTrackDirectionJetDRHisto_, *OutCaloTrackDirectionJetDRHisto_;
00171   MonitorElement *InVertexTrackImpactPointJetDRHisto_, *OutVertexTrackImpactPointJetDRHisto_;
00172   MonitorElement *NTracksPerJetHisto_, *NTracksPerJetVsJetEtHisto_, *NTracksPerJetVsJetEtaHisto_;
00173   MonitorElement *PtFractionInConeHisto_, *PtFractionInConeVsJetRawEtHisto_, *PtFractionInConeVsJetEtaHisto_;
00174   MonitorElement *CorrFactorHisto_, *CorrFactorVsJetEtHisto_, *CorrFactorVsJetEtaHisto_;
00175   MonitorElement *ZSPCorrFactorHisto_, *ZSPCorrFactorVsJetEtHisto_, *ZSPCorrFactorVsJetEtaHisto_;
00176   MonitorElement *JPTCorrFactorHisto_, *JPTCorrFactorVsJetEtHisto_, *JPTCorrFactorVsJetEtaHisto_;
00177   TrackHistograms allPionHistograms_, inCaloInVertexPionHistograms_, inCaloOutVertexPionHistograms_, outCaloInVertexPionHistograms_;
00178   TrackHistograms allMuonHistograms_, inCaloInVertexMuonHistograms_, inCaloOutVertexMuonHistograms_, outCaloInVertexMuonHistograms_;
00179   TrackHistograms allElectronHistograms_, inCaloInVertexElectronHistograms_, inCaloOutVertexElectronHistograms_, outCaloInVertexElectronHistograms_;
00180 
00181 
00183   DQMStore* dqm_;
00184 };
00185 
00186 inline void JPTJetAnalyzer::fillHistogram(MonitorElement* histogram, const double value)
00187 {
00188   if (histogram) histogram->Fill(value);
00189 }
00190 
00191 inline void JPTJetAnalyzer::fillHistogram(MonitorElement* histogram, const double valueX, const double valueY)
00192 {
00193   if (histogram) histogram->Fill(valueX,valueY);
00194 }
00195 
00196 #endif