DTTTrigWriter

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
#ifndef DTTTrigWriter_H
#define DTTTrigWriter_H

/* Program to evaluate ttrig and sigma ttrig from TB histograms
 *  and write the results to a file for each SL
 
 *  \author S. Bolognesi
 */

#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/ESHandle.h"
// #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"

#include <string>

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

class TFile;
class DTTimeBoxFitter;
class DTSuperLayerId;
class DTTtrig;

class DTTTrigWriter : public edm::one::EDAnalyzer<> {
public:
  /// Constructor
  DTTTrigWriter(const edm::ParameterSet& pset);

  /// Destructor
  ~DTTTrigWriter() override;

  // Operations

  /// Compute the ttrig by fiting the TB rising edge
  void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override;

  /// Write ttrig in the DB
  void endJob() override;

protected:
private:
  // Generate the time box name
  std::string getTBoxName(const DTSuperLayerId& slId) const;

  // Debug flag
  bool debug;
  // the kfactor to be uploaded in the ttrig DB
  double kFactor;

  // The file which contains the tMax histograms
  TFile* theFile;

  // The name of the input root file which contains the tMax histograms
  std::string theRootInputFile;

  // The fitter
  DTTimeBoxFitter* theFitter;

  // The object to be written to DB
  DTTtrig* tTrig;

  //geom
  edm::ESHandle<DTGeometry> dtGeom;
  const edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
};
#endif