File indexing completed on 2024-04-06 11:56:31
0001
0002
0003
0004
0005 #ifndef MILLEPEDETREES_H
0006 #define MILLEPEDETREES_H
0007
0008 #include "TString.h"
0009
0010 class TTree;
0011 class TGraph;
0012 class TH1;
0013 class TH2;
0014 class TProfile;
0015
0016 class MillePedeTrees
0017 {
0018 public:
0019 explicit MillePedeTrees(const char *fileName, Int_t iter = 1, const char *treeNameAdd = "");
0020 virtual ~MillePedeTrees();
0021
0022 TH1* Draw(const char *exp, const char *selection, const char *hDef = "", Option_t *opt = "");
0023 TH1* CreateHist(const char *exp, const char *select, const char *hDef = "", Option_t *opt = "");
0024 TH2* CreateHist2D(const char *expX, const char *expY, const char *select,
0025 const char *hDef = "", Option_t *opt = "");
0026 TProfile* CreateHistProf(const char *expX, const char *expY, const char *select,
0027 const char *hDef = "", Option_t *opt = "");
0028 TGraph* CreateGraph(const char *expX, const char *expY, const char *select, Option_t *option="");
0029
0030
0031
0032
0033 TString Pos() const { return "Pos";}
0034 TString Pos(UInt_t ui) const { return Pos() += Bracket(ui);}
0035 TString XPos() const { return Pos(0);}
0036 TString YPos() const { return Pos(1);}
0037 TString ZPos() const { return Pos(2);}
0038 TString RPos2(const TString &tree) const;
0039
0040 TString RPos(const TString &tree) const;
0041
0042 bool SetUseSignedR(bool use = true) {bool buf = fUseSignedR; fUseSignedR = use; return buf;}
0043 bool SetBowsParameters(bool use = true) {bool buf = fBowsParameters; fBowsParameters = use; return buf;}
0044 bool SetSurfDefDeltaBows(bool deltaBows) {const bool buf = fSurfDefDeltaBows; fSurfDefDeltaBows = deltaBows; return buf;}
0045
0046 TString Phi(const TString &tree) const;
0047 TString OrgPos(const TString &pos) const;
0048
0049 TString PhiSwaps(double swapAround, const TString &tree1, const TString &tree2) const;
0050 TString Theta(const TString &tree) const;
0051 TString Alpha(const TString &tree, bool betaMpiPpi) const;
0052 TString Beta (const TString &tree, bool betaMpiPpi) const;
0053 TString Gamma(const TString &tree, bool betaMpiPpi) const;
0054
0055
0056 TString Par() const { return "Par";}
0057 TString Par(UInt_t ui) const { return Par() += Bracket(ui);}
0058 TString XPar() const { return Par(0);}
0059 TString YPar() const { return Par(1);}
0060 TString ZPar() const { return Par(2);}
0061 TString Alpha() const { return Par(3);}
0062 TString Beta() const { return Par(4);}
0063 TString Gamma() const { return Par(5);}
0064 TString DiffPar(const TString &t1, const TString &t2, UInt_t iPar) const {
0065 return Parenth(t1 + Par(iPar) += Min() += t2 + Par(iPar));}
0066
0067 TString ParSi(const TString &tree, UInt_t ui) const;
0068 TString XParSi(const TString &tree) const { return ParSi(tree, 0);}
0069 TString YParSi(const TString &tree) const { return ParSi(tree, 1);}
0070 TString ZParSi(const TString &tree) const { return ParSi(tree, 2);}
0071 TString AlphaSi(const TString &tree) const { return ParSi(tree, 3);}
0072 TString BetaSi(const TString &tree) const { return ParSi(tree, 4);}
0073 TString GammaSi(const TString &tree) const { return ParSi(tree, 5);}
0074
0075
0076 TString DelPos(UInt_t ui, const TString &tree1, const TString &tree2) const;
0077 TString DelR(const TString &tree1, const TString &tree2) const;
0078 TString DelRphi(const TString &tree1, const TString &tree2) const;
0079
0080 TString DelPhi(const TString &tree1, const TString &tree2) const;
0081
0082 TString DelPos(UInt_t ui, const TString &tree) const { return DelPos(ui, tree, OrgPosT());}
0083 TString DelR(const TString &tree) const { return DelR(tree, OrgPosT());}
0084 TString DelRphi(const TString &tree) const { return DelRphi(tree, OrgPosT());}
0085 TString DelPhi(const TString &tree) const { return DelPhi(tree, OrgPosT());}
0086
0087
0088
0089 TString SubDetId() const { return "(" + OrgPosT() += "Id>>25)&0x7";}
0090 TString AlignableTypeId() const { return OrgPosT() += "ObjId";}
0091 TString HieraLev(const TString &tree, Int_t level) const {
0092 return Parenth(tree + "HieraLevel==" + Int(level));}
0093 TString HieraLev(Int_t level) const {return HieraLev(ParT(), level);}
0094
0095 TString Valid(UInt_t iParam) const;
0096 TString Fixed(UInt_t iParam, bool isFixed = true) const;
0097 TString AnyFreePar() const;
0098 TString Label(UInt_t iParam) const;
0099 TString Cor(UInt_t iParam) const;
0100 TString Diff(UInt_t iParam) const;
0101 TString PreSi(UInt_t iParam) const;
0102 TString ParSi(UInt_t iParam) const;
0103 TString ParSiOk(UInt_t iParam) const;
0104 TString XParSi() const { return ParSi(0);}
0105 TString YParSi() const { return ParSi(1);}
0106 TString ZParSi() const { return ParSi(2);}
0107 TString AlphaSi() const { return ParSi(3);}
0108 TString BetaSi() const { return ParSi(4);}
0109 TString GammaSi() const { return ParSi(5);}
0110 TString HitsX() const { return MpT() += "HitsX";}
0111 TString HitsY() const { return MpT() += "HitsY";}
0112 TString DeformValue(UInt_t i, const TString &whichOne) const;
0113 TString NumDeformValues(const TString &whichOne) const;
0114
0115
0116 TString Dot() const { return ".";}
0117 TString Plu() const { return "+";}
0118 TString Min() const { return "-";}
0119 TString Mal() const { return "*";}
0120 TString Div() const { return "/";}
0121 TString AndL() const {return "&&";}
0122 TString OrL() const {return "||";}
0123
0124 TString Int(Int_t i) const { return Form("%d", i);}
0125 TString Int(UInt_t ui) const { return Form("%u", ui);}
0126 TString Flt(Float_t f) const { return Form("%f", f);}
0127
0128 TString Bra() const { return "[";}
0129 TString Ket() const { return "]";}
0130 TString Bracket(UInt_t ui) const { return Bra() += Int(ui) += Ket();}
0131 TString Bracket(Int_t i) const { return Bra() += Int(i) += Ket();}
0132 TString Bracket(const char *s) const { return (Bra() += s) += Ket();}
0133 TString Paren() const { return "(";}
0134 TString Thesis() const { return ")";}
0135 TString Parenth(const char *s) const { return (Paren() += s) += Thesis();}
0136 TString Abs(const char *s) const {return Fun("TMath::Abs", s);}
0137
0138 TString Fun(const char *fun, const char *s) const { return fun + Parenth(s);}
0139 TString Sqrt(const char *s) const { return Fun("sqrt", s);}
0140
0141
0142 TString ToMumMuRad(UInt_t iParam) const { return (iParam < 3 ? "*10000" : "*1000000");}
0143 TString ToMumMuRadPede(UInt_t iParam) const;
0144 TString ToMumMuRadSurfDef(UInt_t iParam) const;
0145 TString Name(UInt_t iParam) const;
0146 TString NamePede(UInt_t iParam) const;
0147 TString NameSurfDef(UInt_t iParam) const;
0148 TString DelName(UInt_t iParam) const { return "#Delta"+Name(iParam);}
0149 TString DelNameU(UInt_t iParam) const { return DelName(iParam) += Unit(iParam);}
0150 TString Unit(UInt_t iParam) const { return (iParam < 3
0151 ? " [#mum]"
0152 : (iParam < kNpar ? " [#murad]" : ""));}
0153 TString UnitPede(UInt_t iParam) const;
0154 TString UnitSurfDef(UInt_t iParam) const;
0155
0156 TString ToMumMuRad(const TString &pos) const;
0157 TString Name(const TString &pos) const;
0158 TString NamePos(UInt_t iPos) const;
0159 TString DelName(const TString &pos) const;
0160 TString DelNameU(const TString &pos) const { return DelName(pos) += Unit(pos);}
0161 TString Unit(const TString &pos) const;
0162
0163 TString DeltaPos(const TString &pos, const TString &tree ) const;
0164 TString SelIs1D() const;
0165 TString SelIs2D() const;
0166
0167
0168 TString OrgPosT() const { return fOrgPos + Dot();}
0169 TString MisPosT() const { return fMisPos + Dot();}
0170 TString MisParT() const { return fMisPar + Dot();}
0171 TString PosT() const { return fPos + Dot();}
0172 TString ParT() const { return fPar + Dot();}
0173 TString MpT() const { return fMp + Dot();}
0174
0175 TTree* GetMainTree() {return fTree;}
0176
0177 enum {kLocX = 0, kLocY, kLocZ, kNpar = 6};
0178 protected:
0179
0180 private:
0181 MillePedeTrees();
0182
0183 TTree* CreateTree(const char *fileName, const TString &treeNameAdd);
0184
0185
0186
0187 TTree *fTree;
0188
0189
0190 TString fOrgPos;
0191 TString fMisPos;
0192 TString fMisPar;
0193 TString fPos;
0194 TString fPar;
0195 TString fMp;
0196
0197
0198 bool fUseSignedR;
0199 bool fBowsParameters;
0200 bool fSurfDefDeltaBows;
0201 };
0202 #endif