DTNoiseComputation

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
#ifndef DTNoiseComputation_H
#define DTNoiseComputation_H

/*
 * \file DTNoiseComputation.h
 *
 * \author G. Mila - INFN Torino
 *
*/

#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "DataFormats/MuonDetId/interface/DTLayerId.h"
#include "DataFormats/MuonDetId/interface/DTWireId.h"
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

#include <string>
#include <map>
#include <vector>

namespace edm {
  class ParameterSet;
  class Event;
  class EventSetup;
}  // namespace edm

class DTGeometry;
class TFile;
class TH2F;
class TH1F;

class DTNoiseComputation : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
public:
  /// Constructor
  DTNoiseComputation(const edm::ParameterSet& ps);

  /// Destructor
  ~DTNoiseComputation() override;

  /// BeginJob
  void beginJob() override {}

  void beginRun(const edm::Run&, const edm::EventSetup& setup) override;

  void analyze(const edm::Event& event, const edm::EventSetup& setup) override {}

  void endRun(const edm::Run&, const edm::EventSetup& setup) override {}

  /// Endjob
  void endJob() override;

protected:
private:
  bool debug;
  int counter;
  int MaxEvents;
  bool fastAnalysis;

  // Get the DT Geometry
  edm::ESHandle<DTGeometry> dtGeom;
  const edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;

  // The file which contain the occupancy plot and the digi event plot
  TFile* theFile;

  // The file which will contain the occupancy plot and the digi event plot
  TFile* theNewFile;

  // Map of label to compute the average noise per layer
  std::map<DTLayerId, bool> toComputeNoiseAverage;

  // Map of the average noise per layer
  std::map<DTWireId, double> theAverageNoise;

  // Map of the histograms with the number of events per evt per wire
  std::map<DTLayerId, std::vector<TH2F*> > theEvtMap;

  // map of histos with the distance of event per wire
  std::map<DTWireId, TH1F*> theHistoEvtDistancePerWire;

  // Map of label for analysis histos
  std::map<DTWireId, bool> toDel;

  // Map of the Time Constants per wire
  std::map<DTWireId, double> theTimeConstant;

  /// Get the name of the layer
  std::string getLayerName(const DTLayerId& lId) const;

  /// Get the name of the superLayer
  std::string getSuperLayerName(const DTSuperLayerId& slId) const;

  /// Get the name of the chamber
  std::string getChamberName(const DTLayerId& lId) const;

  // map of histos with the average noise per chamber
  std::map<DTChamberId, TH1F*> AvNoisePerChamber;

  // map of histos with the average integrated noise per chamber
  std::map<DTChamberId, TH1F*> AvNoiseIntegratedPerChamber;

  // map of histos with the average noise per SuperLayer
  std::map<DTSuperLayerId, TH1F*> AvNoisePerSuperLayer;

  // map of histos with the average integrated noise per SuperLayer
  std::map<DTSuperLayerId, TH1F*> AvNoiseIntegratedPerSuperLayer;

  // get the maximum bin number
  int getMaxNumBins(const DTChamberId& chId) const;

  // get the Y axis maximum
  double getYMaximum(const DTSuperLayerId& slId) const;

  // map of noisy cell occupancy
  std::map<std::pair<int, int>, TH1F*> noisyC;

  // map of somehow noisy cell occupancy
  std::map<std::pair<int, int>, TH1F*> someHowNoisyC;
};
#endif