File indexing completed on 2024-04-06 11:59:40
0001 #ifndef CalibTracker_SiStripChannelGain_SiStripGainCosmicCalculator_h
0002 #define CalibTracker_SiStripChannelGain_SiStripGainCosmicCalculator_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h"
0013 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0014 #include <vector>
0015 #include "TF1.h"
0016 #include "TH1F.h"
0017 #include "TObjArray.h"
0018 #include "TFile.h"
0019 #include "TString.h"
0020 #include <fstream>
0021 #include <sstream>
0022 #include <memory>
0023
0024 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0025 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0026 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0027
0028 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0029 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0030 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0031
0032 class SiStripGainCosmicCalculator : public ConditionDBWriter<SiStripApvGain> {
0033 public:
0034 explicit SiStripGainCosmicCalculator(const edm::ParameterSet&);
0035 ~SiStripGainCosmicCalculator() override;
0036
0037 private:
0038 void algoAnalyze(const edm::Event&, const edm::EventSetup&) override;
0039 void algoBeginJob(const edm::EventSetup&) override;
0040 void algoEndJob() override;
0041 std::unique_ptr<SiStripApvGain> getNewObject() override;
0042
0043 private:
0044 std::pair<double, double> getPeakOfLandau(TH1F* inputHisto);
0045 double moduleWidth(const uint32_t detid);
0046 double moduleThickness(const uint32_t detid);
0047
0048 private:
0049 std::string TrackProducer;
0050 std::string TrackLabel;
0051
0052 TObjArray* HlistAPVPairs;
0053 TObjArray* HlistOtherHistos;
0054 uint32_t total_nr_of_events;
0055 double ExpectedChargeDeposition;
0056 std::map<uint32_t, double> thickness_map;
0057 std::vector<uint32_t> SelectedDetIds;
0058 std::vector<uint32_t> detModulesToBeExcluded;
0059 unsigned int MinNrEntries;
0060 double MaxChi2OverNDF;
0061 bool outputHistogramsInRootFile;
0062 TString outputFileName;
0063 bool printdebug_;
0064
0065 edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0066 edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> detCablingToken_;
0067 edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tkGeomToken_;
0068 const TrackerTopology* tTopo_ = nullptr;
0069 const SiStripDetCabling* siStripDetCabling_ = nullptr;
0070 const TrackerGeometry* tkGeom_ = nullptr;
0071 };
0072 #endif