Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:34:56

0001 #ifndef DTNoiseComputation_H
0002 #define DTNoiseComputation_H
0003 
0004 /*
0005  * \file DTNoiseComputation.h
0006  *
0007  * \author G. Mila - INFN Torino
0008  *
0009 */
0010 
0011 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0014 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0015 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0016 #include "FWCore/Framework/interface/ESHandle.h"
0017 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0018 
0019 #include <string>
0020 #include <map>
0021 #include <vector>
0022 
0023 namespace edm {
0024   class ParameterSet;
0025   class Event;
0026   class EventSetup;
0027 }  // namespace edm
0028 
0029 class DTGeometry;
0030 class TFile;
0031 class TH2F;
0032 class TH1F;
0033 
0034 class DTNoiseComputation : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0035 public:
0036   /// Constructor
0037   DTNoiseComputation(const edm::ParameterSet& ps);
0038 
0039   /// Destructor
0040   ~DTNoiseComputation() override;
0041 
0042   /// BeginJob
0043   void beginJob() override {}
0044 
0045   void beginRun(const edm::Run&, const edm::EventSetup& setup) override;
0046 
0047   void analyze(const edm::Event& event, const edm::EventSetup& setup) override {}
0048 
0049   void endRun(const edm::Run&, const edm::EventSetup& setup) override {}
0050 
0051   /// Endjob
0052   void endJob() override;
0053 
0054 protected:
0055 private:
0056   bool debug;
0057   int counter;
0058   int MaxEvents;
0059   bool fastAnalysis;
0060 
0061   // Get the DT Geometry
0062   edm::ESHandle<DTGeometry> dtGeom;
0063   const edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
0064 
0065   // The file which contain the occupancy plot and the digi event plot
0066   TFile* theFile;
0067 
0068   // The file which will contain the occupancy plot and the digi event plot
0069   TFile* theNewFile;
0070 
0071   // Map of label to compute the average noise per layer
0072   std::map<DTLayerId, bool> toComputeNoiseAverage;
0073 
0074   // Map of the average noise per layer
0075   std::map<DTWireId, double> theAverageNoise;
0076 
0077   // Map of the histograms with the number of events per evt per wire
0078   std::map<DTLayerId, std::vector<TH2F*> > theEvtMap;
0079 
0080   // map of histos with the distance of event per wire
0081   std::map<DTWireId, TH1F*> theHistoEvtDistancePerWire;
0082 
0083   // Map of label for analysis histos
0084   std::map<DTWireId, bool> toDel;
0085 
0086   // Map of the Time Constants per wire
0087   std::map<DTWireId, double> theTimeConstant;
0088 
0089   /// Get the name of the layer
0090   std::string getLayerName(const DTLayerId& lId) const;
0091 
0092   /// Get the name of the superLayer
0093   std::string getSuperLayerName(const DTSuperLayerId& slId) const;
0094 
0095   /// Get the name of the chamber
0096   std::string getChamberName(const DTLayerId& lId) const;
0097 
0098   // map of histos with the average noise per chamber
0099   std::map<DTChamberId, TH1F*> AvNoisePerChamber;
0100 
0101   // map of histos with the average integrated noise per chamber
0102   std::map<DTChamberId, TH1F*> AvNoiseIntegratedPerChamber;
0103 
0104   // map of histos with the average noise per SuperLayer
0105   std::map<DTSuperLayerId, TH1F*> AvNoisePerSuperLayer;
0106 
0107   // map of histos with the average integrated noise per SuperLayer
0108   std::map<DTSuperLayerId, TH1F*> AvNoiseIntegratedPerSuperLayer;
0109 
0110   // get the maximum bin number
0111   int getMaxNumBins(const DTChamberId& chId) const;
0112 
0113   // get the Y axis maximum
0114   double getYMaximum(const DTSuperLayerId& slId) const;
0115 
0116   // map of noisy cell occupancy
0117   std::map<std::pair<int, int>, TH1F*> noisyC;
0118 
0119   // map of somehow noisy cell occupancy
0120   std::map<std::pair<int, int>, TH1F*> someHowNoisyC;
0121 };
0122 #endif