Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-16 00:33:30

0001 #ifndef SiStripRecHitsValid_h
0002 #define SiStripRecHitsValid_h
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/ESHandle.h"
0008 #include "FWCore/Utilities/interface/EDGetToken.h"
0009 #include "FWCore/Framework/interface/ESWatcher.h"
0010 //only mine
0011 #include "DataFormats/Common/interface/Handle.h"
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 
0016 //DQM services for histogram
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018 
0019 #include "FWCore/ServiceRegistry/interface/Service.h"
0020 
0021 //--- for SimHit association
0022 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0023 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0024 
0025 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0026 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0027 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0028 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
0029 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0030 #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h"
0031 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0032 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0033 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0034 #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h"
0035 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
0036 
0037 // -- for es tokens
0038 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0039 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0040 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0041 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0042 
0043 #include <string>
0044 #include <DQMServices/Core/interface/DQMEDAnalyzer.h>
0045 //For RecHit
0046 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
0047 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
0048 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0049 
0050 class SiStripDetCabling;
0051 class SiStripDCSStatus;
0052 
0053 class SiStripRecHitsValid : public DQMEDAnalyzer {
0054 public:
0055   SiStripRecHitsValid(const edm::ParameterSet& conf);
0056 
0057   ~SiStripRecHitsValid() override;
0058 
0059   struct TotalMEs {  // MEs for total detector Level
0060     MonitorElement* meNumTotrphi;
0061     MonitorElement* meNumTotStereo;
0062     MonitorElement* meNumTotMatched;
0063   };
0064 
0065   struct SubDetMEs {  // MEs for Subdetector Level
0066     MonitorElement* meNumrphi;
0067     MonitorElement* meBunchrphi;
0068     MonitorElement* meEventrphi;
0069     MonitorElement* meNumStereo;
0070     MonitorElement* meBunchStereo;
0071     MonitorElement* meEventStereo;
0072     MonitorElement* meNumMatched;
0073     MonitorElement* meBunchMatched;
0074     MonitorElement* meEventMatched;
0075   };
0076 
0077   struct LayerMEs {  // MEs for Layer Level
0078     MonitorElement* meWclusrphi;
0079     MonitorElement* meAdcrphi;
0080     MonitorElement* mePosxrphi;
0081     MonitorElement* meResolxrphi;
0082     MonitorElement* meResrphi;
0083     MonitorElement* mePullLFrphi;
0084     MonitorElement* mePullMFrphi;
0085     MonitorElement* meChi2rphi;
0086     MonitorElement* meNsimHitrphi;
0087   };
0088 
0089   struct StereoAndMatchedMEs {  // MEs for Layer Level
0090     MonitorElement* meWclusStereo;
0091     MonitorElement* meAdcStereo;
0092     MonitorElement* mePosxStereo;
0093     MonitorElement* meResolxStereo;
0094     MonitorElement* meResStereo;
0095     MonitorElement* mePullLFStereo;
0096     MonitorElement* mePullMFStereo;
0097     MonitorElement* meChi2Stereo;
0098     MonitorElement* meNsimHitStereo;
0099     MonitorElement* mePosxMatched;
0100     MonitorElement* mePosyMatched;
0101     MonitorElement* meResolxMatched;
0102     MonitorElement* meResolyMatched;
0103     MonitorElement* meResxMatched;
0104     MonitorElement* meResyMatched;
0105     MonitorElement* meChi2Matched;
0106     MonitorElement* meNsimHitMatched;
0107   };
0108 
0109   struct RecHitProperties {
0110     float x;
0111     float y;
0112     //    float z;
0113     float resolxx;
0114     //    float resolxy;
0115     float resolyy;
0116     float resx;
0117     float resy;
0118     float pullMF;
0119     int clusiz;
0120     float cluchg;
0121     float chi2;
0122     int NsimHit;
0123     int bunch;
0124     int event;
0125   };
0126 
0127 protected:
0128   void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0129   void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& es) override;
0130 
0131 private:
0132   const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> m_geomToken;
0133   const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> m_topoToken, m_topoTokenBR;
0134   const edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> m_SiStripDetCablingToken;
0135 
0136   edm::ESWatcher<SiStripDetCablingRcd> watchSiStripDetCablingRcd_;
0137 
0138   TotalMEs totalMEs;
0139 
0140   bool switchNumTotrphi;
0141   bool switchNumTotStereo;
0142   bool switchNumTotMatched;
0143 
0144   bool switchNumrphi;
0145   bool switchBunchrphi;
0146   bool switchEventrphi;
0147   bool switchNumStereo;
0148   bool switchBunchStereo;
0149   bool switchEventStereo;
0150   bool switchNumMatched;
0151   bool switchBunchMatched;
0152   bool switchEventMatched;
0153 
0154   bool switchWclusrphi;
0155   bool switchAdcrphi;
0156   bool switchPosxrphi;
0157   bool switchResolxrphi;
0158   bool switchResrphi;
0159   bool switchPullLFrphi;
0160   bool switchPullMFrphi;
0161   bool switchChi2rphi;
0162   bool switchNsimHitrphi;
0163   bool switchWclusStereo;
0164   bool switchAdcStereo;
0165   bool switchPosxStereo;
0166   bool switchResolxStereo;
0167   bool switchResStereo;
0168   bool switchPullLFStereo;
0169   bool switchPullMFStereo;
0170   bool switchChi2Stereo;
0171   bool switchNsimHitStereo;
0172   bool switchPosxMatched;
0173   bool switchPosyMatched;
0174   bool switchResolxMatched;
0175   bool switchResolyMatched;
0176   bool switchResxMatched;
0177   bool switchResyMatched;
0178   bool switchChi2Matched;
0179   bool switchNsimHitMatched;
0180 
0181   std::string topFolderName_;
0182   std::vector<std::string> SubDetList_;
0183 
0184   std::map<std::string, LayerMEs> LayerMEsMap;
0185   std::map<std::string, StereoAndMatchedMEs> StereoAndMatchedMEsMap;
0186   std::map<std::string, SubDetMEs> SubDetMEsMap;
0187   std::map<std::string, std::vector<uint32_t> > LayerDetMap;
0188   std::map<std::string, std::vector<uint32_t> > StereoAndMatchedDetMap;
0189 
0190   edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
0191 
0192   std::pair<LocalPoint, LocalVector> projectHit(const PSimHit& hit,
0193                                                 const StripGeomDetUnit* stripDet,
0194                                                 const BoundPlane& plane);
0195   void createMEs(DQMStore::IBooker& ibooker, const edm::EventSetup& es);
0196   void createTotalMEs(DQMStore::IBooker& ibooker);
0197   void createLayerMEs(DQMStore::IBooker& ibooker, std::string label);
0198   void createSubDetMEs(DQMStore::IBooker& ibooker, std::string label);
0199   void createStereoAndMatchedMEs(DQMStore::IBooker& ibooker, std::string label);
0200 
0201   MonitorElement* bookME1D(DQMStore::IBooker& ibooker,
0202                            const char* ParameterSetLabel,
0203                            const char* HistoName,
0204                            const char* HistoTitle);
0205 
0206   inline void fillME(MonitorElement* ME, float value1) {
0207     if (ME != nullptr)
0208       ME->Fill(value1);
0209   }
0210   inline void fillME(MonitorElement* ME, float value1, float value2) {
0211     if (ME != nullptr)
0212       ME->Fill(value1, value2);
0213   }
0214   inline void fillME(MonitorElement* ME, float value1, float value2, float value3) {
0215     if (ME != nullptr)
0216       ME->Fill(value1, value2, value3);
0217   }
0218   inline void fillME(MonitorElement* ME, float value1, float value2, float value3, float value4) {
0219     if (ME != nullptr)
0220       ME->Fill(value1, value2, value3, value4);
0221   }
0222 
0223   edm::ParameterSet conf_;
0224   TrackerHitAssociator::Config trackerHitAssociatorConfig_;
0225   //const StripTopology* topol;
0226 
0227   /* static const int MAXHIT = 1000; */
0228 
0229   //  std::vector<RecHitProperties> rechitrphi;
0230   //  std::vector<RecHitProperties> rechitstereo;
0231   //  std::vector<RecHitProperties> rechitmatched;
0232   RecHitProperties rechitpro;
0233 
0234   void rechitanalysis(SiStripRecHit2D const rechit, const StripTopology& topol, TrackerHitAssociator& associate);
0235   void rechitanalysis_matched(SiStripMatchedRecHit2D const rechit,
0236                               const GluedGeomDet* gluedDet,
0237                               TrackerHitAssociator& associate);
0238 
0239   edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> matchedRecHitsToken_;
0240   edm::EDGetTokenT<SiStripRecHit2DCollection> rphiRecHitsToken_;
0241   edm::EDGetTokenT<SiStripRecHit2DCollection> stereoRecHitsToken_;
0242 };
0243 
0244 #endif