00001
00002
00003
00004
00005 #ifndef MILLEPEDETREES_H
00006 #define MILLEPEDETREES_H
00007
00008 #include "TString.h"
00009
00010 class TTree;
00011 class TGraph;
00012 class TH1;
00013 class TH2;
00014 class TProfile;
00015
00016 class MillePedeTrees
00017 {
00018 public:
00019 explicit MillePedeTrees(const char *fileName, Int_t iter = 1, const char *treeNameAdd = "");
00020 virtual ~MillePedeTrees();
00021
00022 TH1* Draw(const char *exp, const char *selection, const char *hDef = "", Option_t *opt = "");
00023 TH1* CreateHist(const char *exp, const char *select, const char *hDef = "", Option_t *opt = "");
00024 TH2* CreateHist2D(const char *expX, const char *expY, const char *select,
00025 const char *hDef = "", Option_t *opt = "");
00026 TProfile* CreateHistProf(const char *expX, const char *expY, const char *select,
00027 const char *hDef = "", Option_t *opt = "");
00028 TGraph* CreateGraph(const char *expX, const char *expY, const char *select, Option_t *option="");
00029
00030
00031
00032
00033 TString Pos() const { return "Pos";}
00034 TString Pos(UInt_t ui) const { return Pos() += Bracket(ui);}
00035 TString XPos() const { return Pos(0);}
00036 TString YPos() const { return Pos(1);}
00037 TString ZPos() const { return Pos(2);}
00038 TString RPos2(const TString &tree) const;
00039
00040 TString RPos(const TString &tree) const;
00041
00042 bool SetUseSignedR(bool use = true) {bool buf = fUseSignedR; fUseSignedR = use; return buf;}
00043 bool SetBowsParameters(bool use = true) {bool buf = fBowsParameters; fBowsParameters = use; return buf;}
00044
00045 TString Phi(const TString &tree) const;
00046 TString OrgPos(const TString &pos) const;
00047
00048 TString PhiSwaps(double swapAround, const TString &tree1, const TString &tree2) const;
00049 TString Theta(const TString &tree) const;
00050 TString Alpha(const TString &tree, bool betaMpiPpi) const;
00051 TString Beta (const TString &tree, bool betaMpiPpi) const;
00052 TString Gamma(const TString &tree, bool betaMpiPpi) const;
00053
00054
00055 TString Par() const { return "Par";}
00056 TString Par(UInt_t ui) const { return Par() += Bracket(ui);}
00057 TString XPar() const { return Par(0);}
00058 TString YPar() const { return Par(1);}
00059 TString ZPar() const { return Par(2);}
00060 TString Alpha() const { return Par(3);}
00061 TString Beta() const { return Par(4);}
00062 TString Gamma() const { return Par(5);}
00063 TString DiffPar(const TString &t1, const TString &t2, UInt_t iPar) const {
00064 return Parenth(t1 + Par(iPar) += Min() += t2 + Par(iPar));}
00065
00066 TString ParSi(const TString &tree, UInt_t ui) const;
00067 TString XParSi(const TString &tree) const { return ParSi(tree, 0);}
00068 TString YParSi(const TString &tree) const { return ParSi(tree, 1);}
00069 TString ZParSi(const TString &tree) const { return ParSi(tree, 2);}
00070 TString AlphaSi(const TString &tree) const { return ParSi(tree, 3);}
00071 TString BetaSi(const TString &tree) const { return ParSi(tree, 4);}
00072 TString GammaSi(const TString &tree) const { return ParSi(tree, 5);}
00073
00074
00075 TString DelPos(UInt_t ui, const TString &tree1, const TString &tree2) const;
00076 TString DelR(const TString &tree1, const TString &tree2) const;
00077 TString DelRphi(const TString &tree1, const TString &tree2) const;
00078
00079 TString DelPhi(const TString &tree1, const TString &tree2) const;
00080
00081 TString DelPos(UInt_t ui, const TString &tree) const { return DelPos(ui, tree, OrgPosT());}
00082 TString DelR(const TString &tree) const { return DelR(tree, OrgPosT());}
00083 TString DelRphi(const TString &tree) const { return DelRphi(tree, OrgPosT());}
00084 TString DelPhi(const TString &tree) const { return DelPhi(tree, OrgPosT());}
00085
00086
00087
00088 TString SubDetId() const { return "(" + OrgPosT() += "Id>>25)&0x7";}
00089 TString AlignableTypeId() const { return OrgPosT() += "ObjId";}
00090 TString HieraLev(const TString &tree, Int_t level) const {
00091 return Parenth(tree + "HieraLevel==" + Int(level));}
00092 TString HieraLev(Int_t level) const {return HieraLev(ParT(), level);}
00093
00094 TString Valid(UInt_t iParam) const;
00095 TString Fixed(UInt_t iParam, bool isFixed = true) const;
00096 TString AnyFreePar() const;
00097 TString Label(UInt_t iParam) const;
00098 TString Cor(UInt_t iParam) const;
00099 TString Diff(UInt_t iParam) const;
00100 TString PreSi(UInt_t iParam) const;
00101 TString ParSi(UInt_t iParam) const;
00102 TString ParSiOk(UInt_t iParam) const;
00103 TString XParSi() const { return ParSi(0);}
00104 TString YParSi() const { return ParSi(1);}
00105 TString ZParSi() const { return ParSi(2);}
00106 TString AlphaSi() const { return ParSi(3);}
00107 TString BetaSi() const { return ParSi(4);}
00108 TString GammaSi() const { return ParSi(5);}
00109 TString HitsX() const { return MpT() += "HitsX";}
00110 TString HitsY() const { return MpT() += "HitsY";}
00111
00112
00113 TString Dot() const { return ".";}
00114 TString Plu() const { return "+";}
00115 TString Min() const { return "-";}
00116 TString Mal() const { return "*";}
00117 TString Div() const { return "/";}
00118 TString AndL() const {return "&&";}
00119 TString OrL() const {return "||";}
00120
00121 TString Int(Int_t i) const { return Form("%d", i);}
00122 TString Int(UInt_t ui) const { return Form("%u", ui);}
00123 TString Flt(Float_t f) const { return Form("%f", f);}
00124
00125 TString Bra() const { return "[";}
00126 TString Ket() const { return "]";}
00127 TString Bracket(UInt_t ui) const { return Bra() += Int(ui) += Ket();}
00128 TString Bracket(Int_t i) const { return Bra() += Int(i) += Ket();}
00129 TString Bracket(const char *s) const { return (Bra() += s) += Ket();}
00130 TString Paren() const { return "(";}
00131 TString Thesis() const { return ")";}
00132 TString Parenth(const char *s) const { return (Paren() += s) += Thesis();}
00133 TString Abs(const char *s) const {return Fun("TMath::Abs", s);}
00134
00135 TString Fun(const char *fun, const char *s) const { return fun + Parenth(s);}
00136 TString Sqrt(const char *s) const { return Fun("sqrt", s);}
00137
00138
00139 TString ToMumMuRad(UInt_t iParam) const { return (iParam < 3 ? "*10000" : "*1000000");}
00140 TString ToMumMuRadPede(UInt_t iParam) const;
00141 TString Name(UInt_t iParam) const;
00142 TString NamePede(UInt_t iParam) const;
00143 TString DelName(UInt_t iParam) const { return "#Delta"+Name(iParam);}
00144 TString DelNameU(UInt_t iParam) const { return DelName(iParam) += Unit(iParam);}
00145 TString Unit(UInt_t iParam) const { return (iParam < 3
00146 ? " [#mum]"
00147 : (iParam < kNpar ? " [#murad]" : ""));}
00148 TString UnitPede(UInt_t iParam) const;
00149
00150 TString ToMumMuRad(const TString &pos) const;
00151 TString Name(const TString &pos) const;
00152 TString DelName(const TString &pos) const;
00153 TString DelNameU(const TString &pos) const { return DelName(pos) += Unit(pos);}
00154 TString Unit(const TString &pos) const;
00155
00156 TString DeltaPos(const TString &pos, const TString &tree ) const;
00157 TString SelIs1D() const;
00158 TString SelIs2D() const;
00159
00160
00161 TString OrgPosT() const { return fOrgPos + Dot();}
00162 TString MisPosT() const { return fMisPos + Dot();}
00163 TString MisRelPosT() const { return fMisRelPos + Dot();}
00164 TString MisParT() const { return fMisPar + Dot();}
00165 TString PosT() const { return fPos + Dot();}
00166 TString RelPosT() const { return fRelPos + Dot();}
00167 TString ParT() const { return fPar + Dot();}
00168 TString MpT() const { return fMp + Dot();}
00169
00170 TTree* GetMainTree() {return fTree;}
00171
00172 enum {kLocX = 0, kLocY, kLocZ, kNpar = 6};
00173 protected:
00174
00175 private:
00176 MillePedeTrees();
00177
00178 TTree* CreateTree(const char *fileName, const TString &treeNameAdd);
00179
00180
00181
00182 TTree *fTree;
00183
00184
00185 TString fOrgPos;
00186 TString fMisPos;
00187 TString fMisRelPos;
00188 TString fMisPar;
00189 TString fPos;
00190 TString fRelPos;
00191 TString fPar;
00192 TString fMp;
00193
00194
00195 bool fUseSignedR;
00196 bool fBowsParameters;
00197 };
00198 #endif