Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-03-08 03:06:57

0001 #ifndef Validation_TrackingMCTruth_SimDoubletsAnalyzer_h
0002 #define Validation_TrackingMCTruth_SimDoubletsAnalyzer_h
0003 
0004 // Package:    Validation/TrackingMCTruth
0005 // Class:      SimDoubletsAnalyzer
0006 //
0007 /**\class SimDoubletsAnalyzer SimDoubletsAnalyzer.cc Validation/TrackingMCTruth/plugins/SimDoubletsAnalyzer.cc
0008 
0009  Description: DQM analyzer for true RecHit doublets (SimDoublets) of the inner tracker
0010 
0011  Implementation:
0012     This analyzer takes as input collection SimDoublets produced by the SimDoubletsProducer. Like the producer,
0013     you have two versions, one for Phase 1 and one for Phase 2.
0014     The analyzer's main purpose is to study the goodness of the pixel RecHit doublet creation in the patatrack
0015     pixel track reconstruction. This depends on a bunch of cuts, meaning a doublet of two RecHits is only formed
0016     if it passes all of those cuts. The SimDoublets represent the true and therefore ideal doublets of 
0017     simulated TrackingParticles (Note that in the SimDoublet production you may apply selections on the TPs).
0018     
0019     For this study, the analyzer produces histograms for the variables that are cut on during the real 
0020     reconstruction. Each distribution is produced twice:
0021      1. for all SimDoublets (name = `{variablename}`)
0022      2. for those SimDoublets which actually pass all selection cuts (name = `pass_{variablename}`)
0023     The cut values can be passed in the configuration of the analyzer and should default to the ones used in 
0024     reconstruction. The distributions of the cut variables can be found in the folder:
0025         SimDoublets/cutParameters/
0026     In there, you have one subfolder global/ where you find the cut parameters which are set globally for the 
0027     entire pixel detector. Additionally, you have for each configured layer pair a subfolder with all layer-pair-
0028     dependent cut parameters. Those are labeled `lp_{innerLayerId}_{outerLayerId}`.
0029 
0030     Besides this, also general distributions can be found in 
0031         SimDoublets/general/
0032     These are e.g. histograms for the number of SimDoublets per layer pair or SimDoublet efficiencies depending 
0033     on the cut values set in the configuration.
0034 
0035 */
0036 //
0037 // Original Author:  Luca Ferragina, Elena Vernazza, Jan Schulz
0038 //         Created:  Thu, 16 Jan 2025 13:46:21 GMT
0039 //
0040 //
0041 
0042 // includes
0043 #include "FWCore/Framework/interface/Frameworkfwd.h"
0044 #include "FWCore/Framework/interface/Event.h"
0045 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0046 #include "DQMServices/Core/interface/MonitorElement.h"
0047 #include "Geometry/CommonTopologies/interface/SimplePixelTopology.h"
0048 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0049 
0050 #include "SimDataFormats/TrackingAnalysis/interface/SimDoublets.h"
0051 
0052 #include <vector>
0053 #include <string>
0054 #include <map>
0055 
0056 // -------------------------------------------------------------------------------------------------------------
0057 // class declaration
0058 // -------------------------------------------------------------------------------------------------------------
0059 
0060 template <typename TrackerTraits>
0061 class SimDoubletsAnalyzer : public DQMEDAnalyzer {
0062 public:
0063   explicit SimDoubletsAnalyzer(const edm::ParameterSet&);
0064   ~SimDoubletsAnalyzer() override;
0065 
0066   void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override;
0067   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0068 
0069 private:
0070   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0071 
0072   void analyze(const edm::Event&, const edm::EventSetup&) override;
0073 
0074   // ------------ member data ------------
0075 
0076   const TrackerTopology* trackerTopology_ = nullptr;
0077   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topology_getToken_;
0078   const edm::EDGetTokenT<SimDoubletsCollection> simDoublets_getToken_;
0079 
0080   // map that takes the layerPairId as defined in the SimDoublets
0081   // and gives the position of the histogram in the histogram vector
0082   std::map<int, int> layerPairId2Index_;
0083 
0084   // cutting parameters
0085   std::vector<double> cellMinz_;
0086   std::vector<double> cellMaxz_;
0087   std::vector<int> cellPhiCuts_;
0088   std::vector<double> cellMaxr_;
0089   int cellMinYSizeB1_;
0090   int cellMinYSizeB2_;
0091   int cellMaxDYSize12_;
0092   int cellMaxDYSize_;
0093   int cellMaxDYPred_;
0094   double cellZ0Cut_;
0095   double cellPtCut_;
0096 
0097   std::string folder_;  // main folder in the DQM file
0098 
0099   // monitor elements
0100   // profiles to be filled
0101   MonitorElement* h_effSimDoubletsPerTPVsPt_;
0102   MonitorElement* h_effSimDoubletsPerTPVsEta_;
0103   // histograms to be filled
0104   MonitorElement* h_layerPairs_;
0105   MonitorElement* h_numSkippedLayers_;
0106   MonitorElement* h_numSimDoubletsPerTrackingParticle_;
0107   MonitorElement* h_numLayersPerTrackingParticle_;
0108   MonitorElement* h_numTPVsPt_;
0109   MonitorElement* h_pass_numTPVsPt_;
0110   MonitorElement* h_numTPVsEta_;
0111   MonitorElement* h_pass_numTPVsEta_;
0112   MonitorElement* h_numVsPt_;
0113   MonitorElement* h_pass_numVsPt_;
0114   MonitorElement* h_numVsEta_;
0115   MonitorElement* h_pass_numVsEta_;
0116   MonitorElement* h_z0_;
0117   MonitorElement* h_curvatureR_;
0118   MonitorElement* h_pTFromR_;
0119   MonitorElement* h_YsizeB1_;
0120   MonitorElement* h_YsizeB2_;
0121   MonitorElement* h_DYsize12_;
0122   MonitorElement* h_DYsize_;
0123   MonitorElement* h_DYPred_;
0124   MonitorElement* h_pass_layerPairs_;
0125   MonitorElement* h_pass_z0_;
0126   MonitorElement* h_pass_pTFromR_;
0127   MonitorElement* h_pass_YsizeB1_;
0128   MonitorElement* h_pass_YsizeB2_;
0129   MonitorElement* h_pass_DYsize12_;
0130   MonitorElement* h_pass_DYsize_;
0131   MonitorElement* h_pass_DYPred_;
0132   // vectors of histograms (one hist per layer pair)
0133   std::vector<MonitorElement*> hVector_dr_;
0134   std::vector<MonitorElement*> hVector_dphi_;
0135   std::vector<MonitorElement*> hVector_idphi_;
0136   std::vector<MonitorElement*> hVector_innerZ_;
0137   std::vector<MonitorElement*> hVector_Ysize_;
0138   std::vector<MonitorElement*> hVector_DYsize_;
0139   std::vector<MonitorElement*> hVector_DYPred_;
0140   std::vector<MonitorElement*> hVector_pass_dr_;
0141   std::vector<MonitorElement*> hVector_pass_idphi_;
0142   std::vector<MonitorElement*> hVector_pass_innerZ_;
0143 };
0144 
0145 #endif