Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-10 22:32:49

0001 // -*- C++ -*-
0002 //
0003 // Package:    CalibTracker/SiStripChannelGain
0004 // Class:      SiStripGainsPCLWorker
0005 //
0006 /**\class SiStripGainsPCLWorker SiStripGainsPCLWorker.cc 
0007    Description: Fill DQM histograms with SiStrip Charge normalized to path length
0008  
0009 */
0010 //
0011 //  Original Author: L. Quertermont (calibration algorithm)
0012 //  Contributors:    M. Verzetti    (data access)
0013 //                   A. Di Mattia   (PCL multi stream processing and monitoring)
0014 //                   M. Delcourt    (monitoring)
0015 //                   M. Musich      (migration to thread-safe DQMStore access)
0016 //                   P. David       (merge ShallowGainCalibration with SiStripGainsPCLWorker)
0017 //
0018 //  Created:  Wed, 12 Apr 2017 14:46:48 GMT
0019 //
0020 
0021 // CMSSW includes
0022 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0023 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
0024 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
0025 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0026 #include "CalibTracker/Records/interface/SiStripGainRcd.h"
0027 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
0028 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0029 #include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h"
0030 #include "DQMServices/Core/interface/DQMStore.h"
0031 #include "DataFormats/DetId/interface/DetId.h"
0032 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0033 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0034 #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
0035 #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
0036 #include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
0037 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0038 #include "DataFormats/TrackReco/interface/Track.h"
0039 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0040 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
0041 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
0042 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h"
0043 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
0044 #include "FWCore/Framework/interface/Event.h"
0045 #include "FWCore/Framework/interface/Frameworkfwd.h"
0046 #include "FWCore/Framework/interface/MakerMacros.h"
0047 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0048 #include "FWCore/ServiceRegistry/interface/Service.h"
0049 #include "FWCore/Utilities/interface/EDGetToken.h"
0050 #include "FWCore/Utilities/interface/Exception.h"
0051 #include "FWCore/Framework/interface/ESWatcher.h"
0052 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
0053 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0054 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
0055 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0056 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0057 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0058 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0059 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0060 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0061 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
0062 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0063 
0064 /// user includes
0065 #include "CalibTracker/SiStripChannelGain/interface/APVGainStruct.h"
0066 #include "CalibTracker/SiStripChannelGain/interface/APVGainHelpers.h"
0067 
0068 // System includes
0069 #include <unordered_map>
0070 
0071 //
0072 // class declaration
0073 //
0074 
0075 class SiStripGainsPCLWorker : public DQMGlobalEDAnalyzer<APVGain::APVGainHistograms> {
0076 public:
0077   explicit SiStripGainsPCLWorker(const edm::ParameterSet &);
0078 
0079   void bookHistograms(DQMStore::IBooker &,
0080                       edm::Run const &,
0081                       edm::EventSetup const &,
0082                       APVGain::APVGainHistograms &) const override;
0083   void dqmAnalyze(edm::Event const &, edm::EventSetup const &, APVGain::APVGainHistograms const &) const override;
0084 
0085   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0086 
0087 private:
0088   void dqmBeginRun(edm::Run const &, edm::EventSetup const &, APVGain::APVGainHistograms &) const override;
0089   void checkBookAPVColls(const TrackerGeometry *bareTkGeomPtr,
0090                          const TrackerTopology *bareTkTopoPtr,
0091                          APVGain::APVGainHistograms &histograms) const;
0092 
0093   std::vector<std::string> dqm_tag_;
0094 
0095   int statCollectionFromMode(const char *tag) const;
0096 
0097   double MinTrackMomentum;
0098   double MaxTrackMomentum;
0099   double MinTrackEta;
0100   double MaxTrackEta;
0101   unsigned int MaxNrStrips;
0102   unsigned int MinTrackHits;
0103   double MaxTrackChiOverNdf;
0104   int MaxTrackingIteration;
0105   bool AllowSaturation;
0106   bool FirstSetOfConstants;
0107   bool Validation;
0108   bool OldGainRemoving;
0109   bool useCalibration;
0110   bool doChargeMonitorPerPlane; /*!< Charge monitor per detector plane */
0111 
0112   std::string m_DQMdir;                  /*!< DQM folder hosting the charge statistics and the monitor plots */
0113   std::string m_calibrationMode;         /*!< Type of statistics for the calibration */
0114   std::vector<std::string> VChargeHisto; /*!< Charge monitor plots to be output */
0115 
0116   edm::EDGetTokenT<edm::View<reco::Track>> m_tracks_token;
0117   edm::EDGetTokenT<TrajTrackAssociationCollection> m_association_token;
0118 
0119   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoTokenBR_, tTopoToken_;
0120   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tkGeomTokenBR_, tkGeomToken_;
0121   edm::ESGetToken<SiStripGain, SiStripGainRcd> gainToken_;
0122   edm::ESGetToken<SiStripQuality, SiStripQualityRcd> qualityToken_;
0123 
0124   // maps histograms index to topology
0125   std::map<unsigned int, APVloc> theTopologyMap;
0126 };
0127 
0128 inline int SiStripGainsPCLWorker::statCollectionFromMode(const char *tag) const {
0129   std::vector<std::string>::const_iterator it = dqm_tag_.begin();
0130   while (it != dqm_tag_.end()) {
0131     if (*it == std::string(tag))
0132       return it - dqm_tag_.begin();
0133     it++;
0134   }
0135 
0136   if (std::string(tag).empty())
0137     return 0;  // return StdBunch calibration mode for backward compatibility
0138 
0139   return None;
0140 }