//////////////////////////////////////////////////////////////////////////// // SmearingClass.h -- ATLAS Experiment Software // //////////////////////////////////////////////////////////////////////////// /// /// class providing corrections to the simulated muon pT to match pT in data. /// Resolution smearing and scale shift numbers are preliminary /// /// Version for simulation and data from /// PLHC 2011 (1st round, preliminary numbers, an update will be provided). /// /// responsible: atlas-perf-muons-conveners (at) cern.ch /// #ifndef MuonMomentumCorrections_SmearingClass_H #define MuonMomentumCorrections_SmearingClass_H #include #include #include #include #include #include #include #include #include #include #include #include "TRandom3.h" namespace MuonSmear{ /** Smearing and scaling types (enums are used for faster access) */ typedef enum { SMEAR_PT=1, SMEAR_QPT=2 } SMEARTYPE; typedef enum { SCALE_DEFAULT=1, SCALE_KPKM=2, SCALE_KC=3, SCALE_K=4, SCALE_C=5 } SCALETYPE; /** Smearing Class */ class SmearingClass{ public: /*Constructors*/ SmearingClass(); SmearingClass(std::string Data, std::string Algo="muid", std::string SmearType="q_pT", std::string Rel="Rel16.6", std::string Dir=""); SmearingClass(const SmearingClass&); virtual ~SmearingClass(); /************/ /* Methods */ /**********/ /** configure smearing **/ void SetSeed(int); void SetSeed(int, int, int offset=680049); void UseTan2(bool); void UseGeV(); void UseScale(bool); void RestrictCurvatureCorrections(double nsigma=2.5); void UseImprovedCombine(); void ApplyToData(bool U=true); void SetAlgoSmearRelDir(std::string, std::string, std::string SmearType="q_pT", std::string Rel="Rel16.6", std::string Dir=""); void FillValues(); void FillScales(std::string ScaleType="KC", bool ApplyToData=false); void PrintValues(); void Event(double Pt, double Eta, std::string DetType, double Charge=0); void Event(double PtMS, double PtID, double PtCB, double Eta, double Charge=0); void Event(); double Smearing(std::string); double ICombine(double, double); double Combine(double, double); double Combine2(double, double); void ErrorMatrix(); double ScaleApply(double pt, double S1, double S2, double S=1.0) const; double ScaleMS(double pt) const {return scaleBins.empty() ? pt : ScaleApply(pt,S1_MS[scaleRegion],S2_MS[scaleRegion]); } double ScaleID(double pt) const {return scaleBins.empty() ? pt : ScaleApply(pt,S1_ID[scaleRegion],S2_ID[scaleRegion]); } double ScaleCB(double pt) const { const double SCB = (detRegion<0 || detRegion>3) ? 1.0 : scale_CB[detRegion]; return scaleBins.empty() ? ScaleApply(pt,0,0,SCB) : ScaleApply(pt,S1_CB[scaleRegion],S2_CB[scaleRegion],SCB); } double pTMS(); double pTMS(double); double pTID(); double pTID(double); double pTCB(); double pTCB(double); double ChargeFlip(double); double ChargeFlipMS(); double ChargeFlipID(); double ChargeFlipCB(); double SMS(); double SID(); double SCB(); double VMS(); double VID(); double Corr(); void MSUP(double&); void MSUP(double&, double&, double&); void MSLOW(double&); void MSLOW(double&, double&, double&); void IDUP(double&); void IDUP(double&, double&, double&); void IDLOW(double&); void IDLOW(double&, double&, double&); void PTVar(double&, std::string); void PTVar(double&, double&, double&, std::string); double Sign(double); /** simple methods for retrieving input values (not needed since all members are public) **/ double ptms_orig(); double ptid_orig(); double ptcb_orig(); double ETA(); int DetRegion(); int GetScaleRegion(); /*members*/ TRandom3* gRand; double ptms,ptid,ptcb,eta,charge; double vms,vid,corr; double smearMS,smearID,smearCB; bool useTan2; std::string detType; int detRegion; int scaleRegion; double GeV; double g1,g2,g3,g4; double wMS,wID; bool useScale; double restrictCurvCorrSigma; ifstream InValues; bool useImprovedCombine; bool apply_to_data; std::vector getScale_CB(); std::vector getScaleSyst_CB(); std::vector getp1_ID(); std::vector getp2_ID(); std::vector getp2_ID_TAN(); std::vector getp1_MS(); std::vector getp2_MS(); std::vector getE_p1_ID(); std::vector getE_p2_ID(); std::vector getE_p2_ID_TAN(); std::vector getE_p1_MS(); std::vector getE_p2_MS(); std::vector getS_p1_ID(); std::vector getS_p2_ID(); std::vector getS_p2_ID_TAN(); std::vector getS_p1_MS(); std::vector getS_p2_MS(); std::vector getMC_p1_ID(); std::vector getMC_p2_ID(); std::vector getMC_p2_ID_TAN(); std::vector getMC_p0_MS(); std::vector getMC_p1_MS(); std::vector getMC_p2_MS(); std::vector getCorrMatC0(); std::vector getCorrMatC1(); std::vector getCorrMatC2(); std::vector getCorrMatC3(); std::vector getCorrMatC4(); std::vector getCorrMatC5(); std::vector getCorrMatTanC0(); std::vector getCorrMatTanC1(); std::vector getCorrMatTanC2(); std::vector getCorrMatTanC3(); std::vector getCorrMatTanC4(); std::vector getCorrMatTanC5(); protected: bool CallSetClass; double pTmax; std::string DataYear; std::string Fdir; std::string Release; SMEARTYPE Tsmear; SCALETYPE Tscale; std::string Algorithm; /* overall scale correction */ std::vector scale_CB; std::vector scaleSyst_CB; /* charge-dependent momentum corrections */ std::vector scaleBins; std::vector S1_ID; std::vector S2_ID; std::vector S1_MS; std::vector S2_MS; std::vector S1_CB; std::vector S2_CB; /* correlated and anti-correlated errors on the above */ std::vector S1Corr_ID; std::vector S2Corr_ID; std::vector S1Corr_MS; std::vector S2Corr_MS; std::vector S1Corr_CB; std::vector S2Corr_CB; std::vector S1ACorr_ID; std::vector S2ACorr_ID; std::vector S1ACorr_MS; std::vector S2ACorr_MS; std::vector S1ACorr_CB; std::vector S2ACorr_CB; std::vector p1_ID; std::vector p2_ID; std::vector p2_ID_TAN; std::vector p1_MS; std::vector p2_MS; std::vector E_p1_ID; std::vector E_p2_ID; std::vector E_p2_ID_TAN; std::vector E_p1_MS; std::vector E_p2_MS; std::vector S_p1_ID; std::vector S_p2_ID; std::vector S_p2_ID_TAN; std::vector S_p1_MS; std::vector S_p2_MS; std::vector MC_p1_ID; std::vector MC_p2_ID; std::vector MC_p2_ID_TAN; std::vector MC_p0_MS; std::vector MC_p1_MS; std::vector MC_p2_MS; std::vector CorrMatC0; std::vector CorrMatC1; std::vector CorrMatC2; std::vector CorrMatC3; std::vector CorrMatC4; std::vector CorrMatC5; std::vector CorrMatTanC0; std::vector CorrMatTanC1; std::vector CorrMatTanC2; std::vector CorrMatTanC3; std::vector CorrMatTanC4; std::vector CorrMatTanC5; private: void Initialize(std::string data, std::string algo, std::string smearType, std::string rel, std::string dir); void Finalize(); void Clean(); void CleanScales(); }; } #endif