File indexing completed on 2024-04-06 12:22:39
0001 #ifndef MUSCLEFITBASE_H
0002 #define MUSCLEFITBASE_H
0003
0004
0005
0006
0007
0008 #include <map>
0009 #include <string>
0010 #include "TFile.h"
0011 #include "Histograms.h"
0012 #include "MuScleFitUtils.h"
0013 #include "FWCore/Utilities/interface/InputTag.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "MuonAnalysis/MomentumScaleCalibration/interface/MuonPair.h"
0016 #include "MuonAnalysis/MomentumScaleCalibration/interface/GenMuonPair.h"
0017
0018 class MuScleFitBase {
0019 public:
0020 MuScleFitBase(const edm::ParameterSet& iConfig)
0021 : probabilitiesFileInPath_(iConfig.getUntrackedParameter<std::string>(
0022 "ProbabilitiesFileInPath", "MuonAnalysis/MomentumScaleCalibration/test/Probs_new_Horace_CTEQ_1000.root")),
0023 probabilitiesFile_(iConfig.getUntrackedParameter<std::string>("ProbabilitiesFile", "")),
0024 theMuonType_(iConfig.getParameter<int>("MuonType")),
0025 theMuonLabel_(iConfig.getParameter<edm::InputTag>("MuonLabel")),
0026 theCompressionSettings_(iConfig.getUntrackedParameter<int>("compressionSettings", -1)),
0027 theRootFileName_(iConfig.getUntrackedParameter<std::string>("OutputFileName")),
0028 theGenInfoRootFileName_(
0029 iConfig.getUntrackedParameter<std::string>("OutputGenInfoFileName", "genSimRecoPlots.root")),
0030 debug_(iConfig.getUntrackedParameter<int>("debug", 0)) {}
0031 virtual ~MuScleFitBase() noexcept(false) {}
0032
0033 protected:
0034
0035 void fillHistoMap(TFile* outputFile, unsigned int iLoop);
0036
0037 void clearHistoMap();
0038
0039 void writeHistoMap(const unsigned int iLoop);
0040
0041
0042 void readProbabilityDistributionsFromFile();
0043
0044 std::string probabilitiesFileInPath_;
0045 std::string probabilitiesFile_;
0046
0047 int theMuonType_;
0048 edm::InputTag theMuonLabel_;
0049 int theCompressionSettings_;
0050 std::string theRootFileName_;
0051 std::string theGenInfoRootFileName_;
0052
0053 int debug_;
0054
0055
0056 class ProbForIntegral {
0057 public:
0058 ProbForIntegral(const double& massResol, const int iRes, const int iY, const bool isZ)
0059 : massResol_(massResol), iRes_(iRes), iY_(iY), isZ_(isZ) {}
0060 double operator()(const double* mass, const double*) {
0061 if (isZ_) {
0062 return (MuScleFitUtils::probability(
0063 *mass, massResol_, MuScleFitUtils::GLZValue, MuScleFitUtils::GLZNorm, iRes_, iY_));
0064 }
0065 return (
0066 MuScleFitUtils::probability(*mass, massResol_, MuScleFitUtils::GLValue, MuScleFitUtils::GLNorm, iRes_, iY_));
0067 }
0068
0069 protected:
0070 double massResol_;
0071 int iRes_, iY_;
0072 bool isZ_;
0073 };
0074
0075
0076 std::vector<TFile*> theFiles_;
0077
0078
0079 std::map<std::string, Histograms*> mapHisto_;
0080
0081
0082 std::vector<MuonPair> muonPairs_;
0083
0084 std::vector<GenMuonPair> genMuonPairs_;
0085 };
0086
0087 #endif