CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Validation/RecoVertex/interface/V0Validator.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    V0Validator
00004 // Class:      V0Validator
00005 // 
00013 //
00014 // Original Author:  Brian Drell
00015 //         Created:  Wed Feb 18 17:21:04 MST 2009
00016 // $Id: V0Validator.h,v 1.6 2010/02/25 20:15:42 drell Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 
00024 // user include files
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDAnalyzer.h"
00027 
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030 
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032 #include "FWCore/ServiceRegistry/interface/Service.h"
00033 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00034 
00035 #include "DQMServices/Core/interface/DQMStore.h"
00036 #include "DQMServices/Core/interface/MonitorElement.h"
00037 #include "FWCore/ServiceRegistry/interface/Service.h"
00038 
00039 #include "DataFormats/TrackReco/interface/Track.h"
00040 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00041 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00042 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00043 #include "SimTracker/TrackAssociation/interface/TrackAssociatorByChi2.h"
00044 #include "SimTracker/TrackAssociation/interface/TrackAssociatorByHits.h"
00045 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
00046 #include "SimTracker/Records/interface/TrackAssociatorRecord.h"
00047 #include "SimTracker/Records/interface/VertexAssociatorRecord.h"
00048 #include "SimTracker/TrackAssociation/interface/TrackAssociatorBase.h"
00049 #include "SimTracker/VertexAssociation/interface/VertexAssociatorBase.h"
00050 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
00051 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h"
00052 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00053 #include "TrackingTools/PatternTools/interface/TrajectoryStateClosestToBeamLineBuilder.h"
00054 #include "TrackingTools/PatternTools/interface/ClosestApproachInRPhi.h"
00055 
00056 #include "DataFormats/Candidate/interface/Candidate.h"
00057 #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"
00058 #include "DataFormats/V0Candidate/interface/V0Candidate.h"
00059 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
00060 #include "RecoVertex/V0Producer/interface/V0Producer.h"
00061 
00062 #include "SimTracker/TrackHistory/interface/TrackClassifier.h"
00063 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
00064 
00065 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
00066 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00067 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00068 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00069 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00070 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00071 
00072 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00073 #include "MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h"
00074 
00075 #include "RecoVertex/VertexTools/interface/VertexDistance3D.h"
00076 #include "DataFormats/VertexReco/interface/Vertex.h"
00077 
00078 
00079 #include "HepMC/GenVertex.h"
00080 #include "HepMC/GenParticle.h"
00081 
00082 #include "TROOT.h"
00083 #include "TMath.h"
00084 #include "TH1F.h"
00085 #include "TH1I.h"
00086 #include "TH2F.h"
00087 
00088 class V0Validator : public edm::EDAnalyzer {
00089 
00090 public:
00091   explicit V0Validator(const edm::ParameterSet&);
00092   ~V0Validator();
00093 
00094 
00095 private:
00096   //virtual void beginJob(const edm::EventSetup&) ;
00097   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00098   //virtual void endJob() ;
00099   virtual void beginRun(const edm::Run&, const edm::EventSetup&);
00100   virtual void endRun(const edm::Run&, const edm::EventSetup&);
00101 
00102   //Quantities that are to be histogrammed
00103   float K0sGenEta, LamGenEta, K0sGenpT, LamGenpT, K0sGenR, LamGenR;
00104   float LamGenX, LamGenY, LamGenZ, KsGenX, KsGenY, KsGenZ;
00105   float K0sCandEta, LamCandEta, K0sCandpT, LamCandpT, K0sCandR, LamCandR;
00106   unsigned int K0sGenStatus, LamGenStatus, K0sCandStatus, LamCandStatus;
00107   unsigned int K0sPiCandStatus[2], LamPiCandStatus[2], K0sPiEff[2], LamPiEff[2];
00108 
00109   //Bookkeeping quantities
00110   int genLam, genK0s, realLamFound, realK0sFound, realLamFoundEff, realK0sFoundEff;
00111   int lamTracksFound, k0sTracksFound, lamCandFound, k0sCandFound, noTPforK0sCand, noTPforLamCand;
00112 
00113   //Temporary histograms so that we can divide them for efficiencies.
00114   //  They are turned into MonitorElements in endJob()
00115   /*  TH1F* ksEffVsRHist;
00116   TH1F* ksEffVsEtaHist;
00117   TH1F* ksEffVsPtHist;
00118   TH1F* ksTkEffVsRHist;
00119   TH1F* ksTkEffVsEtaHist;
00120   TH1F* ksTkEffVsPtHist;
00121   TH1F* ksFakeVsRHist;
00122   TH1F* ksFakeVsEtaHist;
00123   TH1F* ksFakeVsPtHist;
00124   TH1F* ksTkFakeVsRHist;
00125   TH1F* ksTkFakeVsEtaHist;
00126   TH1F* ksTkFakeVsPtHist;
00127 
00128   TH1F* ksEffVsRHist_denom;
00129   TH1F* ksEffVsEtaHist_denom;
00130   TH1F* ksEffVsPtHist_denom;
00131   TH1F* ksFakeVsRHist_denom;
00132   TH1F* ksFakeVsEtaHist_denom;
00133   TH1F* ksFakeVsPtHist_denom;
00134 
00135   TH1F* ksXResolutionHist;
00136   TH1F* ksYResolutionHist;
00137   TH1F* ksZResolutionHist;
00138   TH1F* ksAbsoluteDistResolutionHist;
00139   TH1F* lamXResolutionHist;
00140   TH1F* lamYResolutionHist;
00141   TH1F* lamZResolutionHist;
00142   TH1F* lamAbsoluteDistResolutionHist;
00143 
00144   TH1F* lamEffVsRHist;
00145   TH1F* lamEffVsEtaHist;
00146   TH1F* lamEffVsPtHist;
00147   TH1F* lamTkEffVsRHist;
00148   TH1F* lamTkEffVsEtaHist;
00149   TH1F* lamTkEffVsPtHist;
00150   TH1F* lamFakeVsRHist;
00151   TH1F* lamFakeVsEtaHist;
00152   TH1F* lamFakeVsPtHist;
00153   TH1F* lamTkFakeVsRHist;
00154   TH1F* lamTkFakeVsEtaHist;
00155   TH1F* lamTkFakeVsPtHist;
00156 
00157   TH1F* lamEffVsRHist_denom;
00158   TH1F* lamEffVsEtaHist_denom;
00159   TH1F* lamEffVsPtHist_denom;
00160   TH1F* lamFakeVsRHist_denom;
00161   TH1F* lamFakeVsEtaHist_denom;
00162   TH1F* lamFakeVsPtHist_denom;
00163 
00164   TH1F* nKsHist;
00165   TH1F* nLamHist;
00166 
00167   TH1F* lamCandStatusHist;
00168   TH1F* ksCandStatusHist;
00169 
00170   TH1F* fakeKsMassHisto;
00171   TH1F* goodKsMassHisto;
00172   TH1F* fakeLamMassHisto;
00173   TH1F* goodLamMassHisto;
00174 
00175   TH1F* ksFakeDauRadDistHisto;
00176   TH1F* lamFakeDauRadDistHisto;*/
00177 
00178   // DQMStore and MonitorElements for final histograms
00179   DQMStore* theDQMstore;
00180 
00181   MonitorElement* ksEffVsR;
00182   MonitorElement* ksEffVsEta;
00183   MonitorElement* ksEffVsPt;
00184   MonitorElement* ksTkEffVsR;
00185   MonitorElement* ksTkEffVsEta;
00186   MonitorElement* ksTkEffVsPt;
00187   MonitorElement* ksFakeVsR;
00188   MonitorElement* ksFakeVsEta;
00189   MonitorElement* ksFakeVsPt;
00190   MonitorElement* ksTkFakeVsR;
00191   MonitorElement* ksTkFakeVsEta;
00192   MonitorElement* ksTkFakeVsPt;
00193 
00194   MonitorElement* ksEffVsR_num;
00195   MonitorElement* ksEffVsEta_num;
00196   MonitorElement* ksEffVsPt_num;
00197   MonitorElement* ksTkEffVsR_num;
00198   MonitorElement* ksTkEffVsEta_num;
00199   MonitorElement* ksTkEffVsPt_num;
00200   MonitorElement* ksFakeVsR_num;
00201   MonitorElement* ksFakeVsEta_num;
00202   MonitorElement* ksFakeVsPt_num;
00203   MonitorElement* ksTkFakeVsR_num;
00204   MonitorElement* ksTkFakeVsEta_num;
00205   MonitorElement* ksTkFakeVsPt_num;
00206 
00207   MonitorElement* ksFakeVsR_denom;
00208   MonitorElement* ksFakeVsEta_denom;
00209   MonitorElement* ksFakeVsPt_denom;
00210   MonitorElement* ksEffVsR_denom;
00211   MonitorElement* ksEffVsEta_denom;
00212   MonitorElement* ksEffVsPt_denom;
00213 
00214   MonitorElement* lamFakeVsR_denom;
00215   MonitorElement* lamFakeVsEta_denom;
00216   MonitorElement* lamFakeVsPt_denom;
00217   MonitorElement* lamEffVsR_denom;
00218   MonitorElement* lamEffVsEta_denom;
00219   MonitorElement* lamEffVsPt_denom;
00220 
00221   MonitorElement* lamEffVsR;
00222   MonitorElement* lamEffVsEta;
00223   MonitorElement* lamEffVsPt;
00224   MonitorElement* lamTkEffVsR;
00225   MonitorElement* lamTkEffVsEta;
00226   MonitorElement* lamTkEffVsPt;
00227   MonitorElement* lamFakeVsR;
00228   MonitorElement* lamFakeVsEta;
00229   MonitorElement* lamFakeVsPt;
00230   MonitorElement* lamTkFakeVsR;
00231   MonitorElement* lamTkFakeVsEta;
00232   MonitorElement* lamTkFakeVsPt;
00233 
00234   MonitorElement* lamEffVsR_num;
00235   MonitorElement* lamEffVsEta_num;
00236   MonitorElement* lamEffVsPt_num;
00237   MonitorElement* lamTkEffVsR_num;
00238   MonitorElement* lamTkEffVsEta_num;
00239   MonitorElement* lamTkEffVsPt_num;
00240   MonitorElement* lamFakeVsR_num;
00241   MonitorElement* lamFakeVsEta_num;
00242   MonitorElement* lamFakeVsPt_num;
00243   MonitorElement* lamTkFakeVsR_num;
00244   MonitorElement* lamTkFakeVsEta_num;
00245   MonitorElement* lamTkFakeVsPt_num;
00246 
00247   MonitorElement* ksXResolution;
00248   MonitorElement* ksYResolution;
00249   MonitorElement* ksZResolution;
00250   MonitorElement* ksAbsoluteDistResolution;
00251   MonitorElement* lamXResolution;
00252   MonitorElement* lamYResolution;
00253   MonitorElement* lamZResolution;
00254   MonitorElement* lamAbsoluteDistResolution;
00255 
00256   MonitorElement* nKs;
00257   MonitorElement* nLam;
00258 
00259   MonitorElement* ksCandStatus;
00260   MonitorElement* lamCandStatus;
00261 
00262   MonitorElement* fakeKsMass;
00263   MonitorElement* goodKsMass;
00264   MonitorElement* fakeLamMass;
00265   MonitorElement* goodLamMass;
00266 
00267   MonitorElement* ksMassAll;
00268   MonitorElement* lamMassAll;
00269 
00270 
00271   MonitorElement* ksFakeDauRadDist;
00272   MonitorElement* lamFakeDauRadDist;
00273 
00274 
00275   std::string theDQMRootFileName;
00276   edm::InputTag k0sCollectionTag;
00277   edm::InputTag lamCollectionTag;
00278   std::string dirName;
00279 
00280 };
00281