Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-30 04:13:36

0001 // -*- C++ -*-
0002 
0003 // Package:    PixelLumiDQM
0004 // Class:      PixelLumiDQM
0005 
0006 /**\class PixelLumiDQM PixelLumiDQM.h
0007  PixelLumi/PixelLumiDQM/plugins/PixelLumiDQM.h
0008 
0009  Description: DQM Module producing Pixel Cluster Count Luminosity
0010 
0011  Implementation notes:
0012      1) Filling scheme is put in by 'hand' for now.
0013         Can obtain it from the cluster count but need higher rate in trigger;
0014         Best would be to have filling scheme in the DB.
0015      2) Afterglow correction is put in by hand.
0016      3) Currently barrel layer 0 is excluded, but a version using all pixel
0017  layers and disks is also in place. 4) A stable beam flag should be obtained
0018  from the DB to turn on actual checks. (Pixel Lumi does not make sense outside
0019  stable beams.) 5) Need a top module to correlate the info from the three
0020  trigger categories. NB: at present the module only uses the ZeroBias trigger
0021  providing about 85 Hz.
0022 */
0023 
0024 // Original author:   Amita Raval
0025 
0026 #ifndef __PixelLumi_PixelLumiDQM_PixelLumiDQM_h__
0027 #define __PixelLumi_PixelLumiDQM_PixelLumiDQM_h__
0028 
0029 #include <fstream>
0030 #include <map>
0031 #include <string>
0032 #include <vector>
0033 
0034 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0035 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0036 #include "FWCore/Framework/interface/Frameworkfwd.h"
0037 
0038 class ConfigurationDescriptions;
0039 class TrackerGeometry;
0040 class TrackerDigiGeometryRecord;
0041 class PixelLumiDQM : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0042 public:
0043   explicit PixelLumiDQM(const edm::ParameterSet &);
0044   ~PixelLumiDQM() override;
0045   static constexpr double FREQ_ORBIT = 11245.5;
0046   static constexpr double SECONDS_PER_LS = double(0x40000) / double(FREQ_ORBIT);
0047 
0048   // Using all pixel clusters:
0049   static constexpr double XSEC_PIXEL_CLUSTER = 10.08e-24;  // in cm^2
0050   static constexpr double XSEC_PIXEL_CLUSTER_UNC = 0.17e-24;
0051 
0052   // Excluding the inner barrel layer.
0053   static constexpr double rXSEC_PIXEL_CLUSTER = 9.4e-24;  // in cm^2
0054   static constexpr double rXSEC_PIXEL_CLUSTER_UNC = 0.119e-24;
0055   static constexpr double CM2_TO_NANOBARN = 1.0 / 1.e-33;
0056   static const unsigned int lastBunchCrossing = 3564;
0057 
0058   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0059 
0060 private:
0061   void analyze(const edm::Event &, const edm::EventSetup &) override;
0062   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0063   void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override;
0064   void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override;
0065 
0066   // This is a kludge method to infer the filled bunches from the cluster count;
0067   // notice that this cannot be used with random triggers.
0068   // The filling scheme should be acquired from the database once it's there.
0069 
0070   unsigned int calculateBunchMask(MonitorElement *, std::vector<bool> &);
0071   unsigned int calculateBunchMask(std::vector<float> &, unsigned int, std::vector<bool> &);
0072   // ---------- Member data ----------
0073 
0074   // Hard-coded numbers of layers and disks...
0075   static constexpr size_t kNumLayers = 5;
0076   static constexpr size_t kNumDisks = 12;
0077   static constexpr size_t kOffsetLayers = 0;
0078   static constexpr size_t kOffsetDisks = 4;
0079 
0080   class PixelClusterCount {
0081     // B for barrel, F for forwared, M for minus, P for plus side,
0082     // O for outer and I for inner. Numbers used for layers.
0083   public:
0084     PixelClusterCount()
0085         : numB(kNumLayers, 0),
0086           numFM(kNumDisks, 0),
0087           numFP(kNumDisks, 0),
0088           dnumB(kNumLayers, 0.0),
0089           dnumFM(kNumDisks, 0.0),
0090           dnumFP(kNumDisks, 0.0)
0091 
0092     {}
0093     void Reset() {
0094       for (unsigned int i = 0; i < numB.size(); i++) {
0095         numB[i] = 0;
0096         dnumB[i] = 0.0;
0097       }
0098       for (unsigned int i = 0; i < numFM.size(); i++) {
0099         numFM[i] = 0;
0100         numFP[i] = 0;
0101         dnumFM[i] = 0.0;
0102         dnumFP[i] = 0.0;
0103       }
0104     }
0105     std::vector<UInt_t> numB;
0106     std::vector<UInt_t> numFM;
0107     std::vector<UInt_t> numFP;
0108     std::vector<double> dnumB;
0109     std::vector<double> dnumFM;
0110     std::vector<double> dnumFP;
0111 
0112   private:
0113   };
0114 
0115   edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster>> fPixelClusterLabel;
0116   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tkGeomToken_;
0117 
0118   UInt_t fRunNo;
0119   UInt_t fEvtNo;
0120   UInt_t fLSNo;
0121   UInt_t fBXNo;
0122   UInt_t fTimestamp;
0123   UInt_t fNumVtx;
0124   UInt_t fNumVtxGood;
0125   UInt_t fNumTrkPerVtx;
0126   Double_t fVtxX;
0127   Double_t fVtxY;
0128   Double_t fVtxZ;
0129   Double_t fChi2;
0130   Double_t fNdof;
0131   std::map<int, PixelClusterCount> fNumPixelClusters;
0132 
0133   bool fIncludeVertexInfo;
0134   bool fIncludePixelClusterInfo;
0135   bool fIncludePixelQualCheckHistos;
0136   int fResetIntervalInLumiSections;
0137 
0138   std::map<std::string, MonitorElement *> fHistContainerThisRun;
0139 
0140   // This is a list of modules to be ignored, either because they were
0141   // dead or are dead in part of the data-taking period.
0142   std::vector<uint32_t> fDeadModules;
0143 
0144   // The minimum number of pixels that should live in a cluster in
0145   // order for the cluster to be counted as a real cluster
0146   // (as opposed to, e.g., a noise pixel).
0147   int fMinPixelsPerCluster;
0148 
0149   // The minimum pixel cluster charge for a cluster to be counted.
0150   double fMinClusterCharge;
0151 
0152   // Use the module label to distinguish the three different streams.
0153 
0154   MonitorElement *fIntActiveCrossingsFromDB;
0155   MonitorElement *fHistnBClusVsLS[3];
0156   MonitorElement *fHistnFPClusVsLS[2];
0157   MonitorElement *fHistnFMClusVsLS[2];
0158   MonitorElement *fHistBunchCrossings;
0159   MonitorElement *fHistBunchCrossingsLastLumi;
0160   MonitorElement *fHistClusterCountByBxLastLumi;
0161   MonitorElement *fHistClusterCountByBxCumulative;
0162   MonitorElement *fHistClusByLS;
0163   MonitorElement *fHistTotalRecordedLumiByLS;
0164   MonitorElement *fHistRecordedByBxLastLumi;
0165   MonitorElement *fHistRecordedByBxCumulative;
0166 
0167   std::vector<bool> bunchTriggerMask;
0168   unsigned int filledAndUnmaskedBunches;
0169   bool useInnerBarrelLayer;
0170   unsigned int fFillNumber;
0171   std::string fLogFileName_;
0172 
0173   std::ofstream logFile_;
0174 };
0175 
0176 #endif