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 TString DeformValue(UInt_t i, const TString &whichOne) const;
00112 TString NumDeformValues(const TString &whichOne) const;
00113
00114
00115 TString Dot() const { return ".";}
00116 TString Plu() const { return "+";}
00117 TString Min() const { return "-";}
00118 TString Mal() const { return "*";}
00119 TString Div() const { return "/";}
00120 TString AndL() const {return "&&";}
00121 TString OrL() const {return "||";}
00122
00123 TString Int(Int_t i) const { return Form("%d", i);}
00124 TString Int(UInt_t ui) const { return Form("%u", ui);}
00125 TString Flt(Float_t f) const { return Form("%f", f);}
00126
00127 TString Bra() const { return "[";}
00128 TString Ket() const { return "]";}
00129 TString Bracket(UInt_t ui) const { return Bra() += Int(ui) += Ket();}
00130 TString Bracket(Int_t i) const { return Bra() += Int(i) += Ket();}
00131 TString Bracket(const char *s) const { return (Bra() += s) += Ket();}
00132 TString Paren() const { return "(";}
00133 TString Thesis() const { return ")";}
00134 TString Parenth(const char *s) const { return (Paren() += s) += Thesis();}
00135 TString Abs(const char *s) const {return Fun("TMath::Abs", s);}
00136
00137 TString Fun(const char *fun, const char *s) const { return fun + Parenth(s);}
00138 TString Sqrt(const char *s) const { return Fun("sqrt", s);}
00139
00140
00141 TString ToMumMuRad(UInt_t iParam) const { return (iParam < 3 ? "*10000" : "*1000000");}
00142 TString ToMumMuRadPede(UInt_t iParam) const;
00143 TString ToMumMuRadSurfDef(UInt_t iParam) const;
00144 TString Name(UInt_t iParam) const;
00145 TString NamePede(UInt_t iParam) const;
00146 TString NameSurfDef(UInt_t iParam) const;
00147 TString DelName(UInt_t iParam) const { return "#Delta"+Name(iParam);}
00148 TString DelNameU(UInt_t iParam) const { return DelName(iParam) += Unit(iParam);}
00149 TString Unit(UInt_t iParam) const { return (iParam < 3
00150 ? " [#mum]"
00151 : (iParam < kNpar ? " [#murad]" : ""));}
00152 TString UnitPede(UInt_t iParam) const;
00153 TString UnitSurfDef(UInt_t iParam) const;
00154
00155 TString ToMumMuRad(const TString &pos) const;
00156 TString Name(const TString &pos) const;
00157 TString DelName(const TString &pos) const;
00158 TString DelNameU(const TString &pos) const { return DelName(pos) += Unit(pos);}
00159 TString Unit(const TString &pos) const;
00160
00161 TString DeltaPos(const TString &pos, const TString &tree ) const;
00162 TString SelIs1D() const;
00163 TString SelIs2D() const;
00164
00165
00166 TString OrgPosT() const { return fOrgPos + Dot();}
00167 TString MisPosT() const { return fMisPos + Dot();}
00168 TString MisRelPosT() const { return fMisRelPos + Dot();}
00169 TString MisParT() const { return fMisPar + Dot();}
00170 TString PosT() const { return fPos + Dot();}
00171 TString RelPosT() const { return fRelPos + Dot();}
00172 TString ParT() const { return fPar + Dot();}
00173 TString MpT() const { return fMp + Dot();}
00174
00175 TTree* GetMainTree() {return fTree;}
00176
00177 enum {kLocX = 0, kLocY, kLocZ, kNpar = 6};
00178 protected:
00179
00180 private:
00181 MillePedeTrees();
00182
00183 TTree* CreateTree(const char *fileName, const TString &treeNameAdd);
00184
00185
00186
00187 TTree *fTree;
00188
00189
00190 TString fOrgPos;
00191 TString fMisPos;
00192 TString fMisRelPos;
00193 TString fMisPar;
00194 TString fPos;
00195 TString fRelPos;
00196 TString fPar;
00197 TString fMp;
00198
00199
00200 bool fUseSignedR;
00201 bool fBowsParameters;
00202 };
00203 #endif