DTVDriftAnalyzer

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

/** \class DTVDriftAnalyzer
 *  Plot the vdrift from the DB
 *
 *  \author S. Bolognesi - INFN Torino
 */

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/MuonDetId/interface/DTWireId.h"
#include "CondFormats/DataRecord/interface/DTMtimeRcd.h"
#include "CondFormats/DataRecord/interface/DTRecoConditionsVdriftRcd.h"

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

class DTMtime;
class DTRecoConditions;
class TFile;
class TH1D;

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

  /// Destructor
  virtual ~DTVDriftAnalyzer();

  /// Operations
  //Read the DTGeometry and the vdrift DB
  virtual void beginRun(const edm::Run& run, const edm::EventSetup& setup);
  void analyze(const edm::Event& event, const edm::EventSetup& setup) {}
  //Do the real work
  void endJob();

protected:
private:
  std::string getHistoName(const DTWireId& lId) const;
  std::string getDistribName(const DTWireId& wId) const;

  // The file which will contain the histos
  TFile* theFile;

  //The t0 map
  const DTMtime* mTimeMap;             // legacy DB object
  const DTRecoConditions* vDriftMap_;  // DB object in new format
  bool readLegacyVDriftDB;             // which one to use

  // Map of the vdrift, reso histos by wheel/sector/SL
  std::map<std::pair<int, int>, TH1D*> theVDriftHistoMap;
  std::map<std::pair<int, int>, TH1D*> theResoHistoMap;
  // Map of the vdrift, reso distributions by wheel/station/SL
  std::map<std::vector<int>, TH1D*> theVDriftDistribMap;
  std::map<std::vector<int>, TH1D*> theResoDistribMap;

  edm::ESGetToken<DTMtime, DTMtimeRcd> mTimeMapToken_;
  edm::ESGetToken<DTRecoConditions, DTRecoConditionsVdriftRcd> vDriftMapToken_;
};
#endif