CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PlotMillePede.h
Go to the documentation of this file.
1 #ifndef PLOTMILLEPEDE_H
2 #define PLOTMILLEPEDE_H
3 // Original Author: Gero Flucke
4 // last change : $Date: 2010/10/26 21:34:25 $
5 // by : $Author: flucke $
6 //
7 // PlotMillePede is a class to interprete the content of the ROOT
8 // TTrees that are stored as output of the millepede alignment algorithm.
9 // The histograms are created by the methods inherited from the
10 // MillePedeTrees class. Drawn quantities and selections are handled
11 // as strings as they can be understood by TTree::Draw(..) commands.
12 //
13 // The main methods all start with 'Draw', so you can use tab completion
14 // on what is available:
15 // PlotMillePede p("treeFile.root"); // file form pede step
16 // p.Draw<tab>
17 //
18 // Management of the created histograms is done using the ('ancient')
19 // class GFHistManager. A pointer to that class can be accessed by
20 // GFHistManager *man = p.GetHistManager();
21 // and then be used manipulate the drawings, e.g. by
22 // man->SetLogY();
23 // or
24 // man->SetNumHistsXY(3,1);
25 // man->Draw();
26 //
27 // By calling new p.Draw..(..) commands, usually previously drawn canvases are
28 // deleted. But most methods provide either a boolean flag 'addPlots' or
29 // understand the option 'add'. If the flag is true or the optione string
30 // contains 'add', canvases from previous Draw-commands are kept (in fact they
31 // are re-drawn).
32 //
33 // A title can be set by 'void SetTitle(const char *title)':
34 // The title will appear as part of all histogram titles.
35 //
36 // Several cuts can be set and are active until reset for all drawing routines
37 // called after setting them. Active selections are mentioned in histogram titles.
38 // The possibilites to set cuts are:
39 //
40 // 1) Select subdetector(s):
41 // void SetSubDetId(Int_t subDetId);
42 // * 1-6 are TPB, TPE, TIB, TID, TOB, TEC,
43 // * -1 means: reset, i.e. take all
44 // * using (repeated) calls of
45 // void AddSubDetId(Int_t subDetId);
46 // leads to an OR selection of subdetectors
47 //
48 // 2) Special alignable types:
49 // Int_t SetAlignableTypeId(Int_t alignableTypeId);
50 // * DetUnit=1,
51 // * Det=2,
52 // * TIBString=15,
53 // * etc. from CommonAlignment/interface/StructureType.h
54 // * -1 resets
55 // The methods returns the previous setting.
56 //
57 // 3) Select hierarchy level:
58 // In case of hierarchical alignment, one can look at the parameters etc. of each
59 // (active!) hierarchy level separately:
60 // Int_t SetHieraLevel(Int_t hieraLevel);
61 // * 0 (default!): lowest level only
62 // * 1,2,...: first, second,... larger structures only
63 // * -1: resets, shows all levels
64 // The methods returns the previous setting.
65 //
66 // 4) General selection:
67 // void AddAdditionalSel(const char *selection);
68 // * whatever selection string that is valid on the TTree's...
69 // * ... therefore for experts
70 // * current setting cleared by 'ClearAdditionalSel()'
71 //
72 // 4a) Strip stereo, rphi, 1Dlayer/double sided selection:
73 // * Known keywords for AddAdditionalSel(..)
74 // * StripStereo: only Id's of stereo modules in 2D layers/rings
75 // * StripRphi: only Id's of rphi modules in 2D layers/rings
76 // * StripDoubleOr1D: only Id's from 1D layers or composed Dets in 2D layers/rings
77 //
78 // 4b) Geometrical and N(hit) selection:
79 // void AddAdditionalSel(const TString &xyzrPhiNhit, Float_t min, Float_t max);
80 // This method makes internal use of the above "AddAdditionalSel(const char *)".
81 // Selects quantity 'xyzrPhiNhit' between 'min' and 'max' where
82 // 'xyzrPhiNhit' can be any of x, y, z, r, phi, Nhit.
83 // Also cleared by 'ClearAdditionalSel()'.
84 
85 #include "MillePedeTrees.h"
86 #include <TArrayI.h>
87 
88 class GFHistManager;
89 
91 {
92  public:
93  explicit PlotMillePede(const char *fileName, Int_t iter = 2, Int_t hieraLevel = 0,
94  bool useDiff = false);// iter=1/2: singlerun/merged; heiraLev: -1 ignore, 0 lowest level, etc.; useDiff = true only for before2007_02_26
95  PlotMillePede(const char *fileName, Int_t iter, Int_t hieraLevel, const char *treeNameAdd);
96  virtual ~PlotMillePede();
97 
98  void SetTitle(const char *title) {fTitle = title;}
99  const TString& GetTitle() const { return fTitle;}
101 
102  void DrawAll(Option_t *opt = "rogpmeh"); // r=ParamResult,o=OrigParam,g=GlobCorr,p=Pull,m=MisVsLocation,e=ErrorVsHit,h=HitMaps
103 
104  void DrawParam(bool addPlots = false, const TString &sel = ""); // default: not fixed params
105  void DrawPedeParam(Option_t *option = "", unsigned int nNonRigidParam = 12);//"add": add plots, "vs": p_i vs p_j; params beyond rigid body
106  void DrawPedeParamVsLocation(Option_t *option = "", unsigned int nNonRigidParam = 12);//"add" to add plots; params beyond rigid body
107  //void DrawTwoSurfaceDeltas(Option_t *option = "");
108  void DrawSurfaceDeformations(const TString &whichOne = "result",
109  Option_t *option = "", unsigned int maxNumPars = 13);//start,result,diff
110 
111 
112  void DrawOrigParam(bool addPlots = false, const TString &sel = ""); //this->AnyFreePar()
113  void DrawOrigPos(bool addPlots = false, const TString &sel = "");
114 
115 /* void DrawParamDiff(bool addPlots = false); */
116  void DrawParamResult(bool addPlots = false);
117  void DrawPosResult(bool addPlots = false, const TString &selection = "");// sel=SelIs2D()/SelIs1D()
118  void DrawPosMisVsLocation(bool addPlots=false, const TString &selection="", Option_t *option="");// sel=e.g. SelIs2D()/SelIs1D(), opt="start" starting misalignment profile
119  void DrawGlobCorr(bool addPlots = false, const TString &sel = "", Option_t *opt = "",
120  Float_t min = 0., Float_t max = 1.);// opt "nal" (no axis limit), otherwise take min/max; opt 'valid' for pede rad OK
121 
122  void DrawPull(Option_t *opt = "");// 'add' to add plots, 'valid' to select only valid parameter, 'nolimit' for pulls without prior axis limits
123 
124  void DrawMisVsLocation(bool addPlots = false, const TString &sel = "", Option_t *opt = "");//opt: vse0,vse1,mis,withfixed
125  void DrawLabelDiffAbove(UInt_t iPar, float minDiff, bool addPlots = false);
126  void DrawErrorVsHit(bool addPlots = false, const TString &sel = "");
127  void DrawHitMaps(bool addPlots = false, bool inclFullFixed = true);
128  void DrawBigPullLabel(float minPull, bool addPlots = false);
129  void DrawBigPullPos(float minPull, bool addPlots = false);
130  void DrawSubDetId(bool addPlots = false);
131  void DrawXyArrow(Double_t factor, Option_t *option = ""); // opt. "add", "zcirc"
132  void ScanSelection(const char *sel = 0, const char *addColumns = 0); // scan tree with selection, if !sel, take basic selection, addColumns like ":ObjId:HitsY" to add columns ObjId and HitsY
133  void ScanPedeParAbove(UInt_t iPar, float absMin = 1.e5); // scan tree, selecting large parameters
134 
135  void DrawCheck();
136  TString Unique(const char *name) const;
137 
138  Float_t SetMaxDev(Float_t maxDev); // set x-axis range for result plots
139  const TArrayI* GetSubDetIds() const { return &fSubDetIds;} // selected subdets
140  void SetSubDetId(Int_t subDetId); // 1-6 are TPB, TPE, TIB, TID, TOB, TEC, -1 means: take all
141  void AddSubDetId(Int_t subDetId); // 1-6 are TPB, TPE, TIB, TID, TOB, TEC
142  Int_t SetAlignableTypeId(Int_t alignableTypeId);//detunit=1,det=2,...,TIBString=15,etc. from StructureType.h (-1: all)
143  Int_t SetHieraLevel(Int_t hieraLevel); // select hierarchical level (-1: all)
144  void AddAdditionalSel(const char *selection);// special select; StripDoubleOr1D,StripRphi,StripStereo
145  void AddAdditionalSel(const TString &xyzrPhiNhit, Float_t min, Float_t max); // x,y,z,r,phi,Nhit
146 
147  const TString GetAdditionalSel () const { return fAdditionalSel;}
149  void AddBasicSelection(TString &sel) const;
150 
151  TString FinalMisAlignment(UInt_t iPar) const;
152  TString TitleAdd() const; // for subdet settings etc.
153 
154  void CopyAddBinning(TString &name, const TH1 *hist) const;// extend 'name' taking binning from hist
155  private:
156  Int_t PrepareAdd(bool addPlots);
157 
158  TString fTitle; // added to hist titles
160  Int_t fHieraLevel; // which hierarchical level to require (-1: all)
161  bool fUseDiff; // true: result is diff between MisParT() and ParT()
162  // false: result is ParT() (from 2007-02-27th on...)
163  TArrayI fSubDetIds; // select subdets (empty: take all)
164  Int_t fAlignableTypeId; // select ony alignables of type det,detunit,rod,etc.(-1: take all)
165  TString fAdditionalSel; // selection to be set by user, used in AddBasicSelection
166  TString fAdditionalSelTitle; // title add-on for fAdditionalSel
167  Float_t fMaxDev; // max deviation in result plot - so far only there...
168 };
169 
170 #endif
void DrawPedeParamVsLocation(Option_t *option="", unsigned int nNonRigidParam=12)
void DrawAll(Option_t *opt="rogpmeh")
void AddAdditionalSel(const char *selection)
void DrawPosMisVsLocation(bool addPlots=false, const TString &selection="", Option_t *option="")
void DrawBigPullLabel(float minPull, bool addPlots=false)
void DrawXyArrow(Double_t factor, Option_t *option="")
void DrawMisVsLocation(bool addPlots=false, const TString &sel="", Option_t *opt="")
void SetSubDetId(Int_t subDetId)
virtual ~PlotMillePede()
void DrawErrorVsHit(bool addPlots=false, const TString &sel="")
Int_t SetHieraLevel(Int_t hieraLevel)
void DrawPedeParam(Option_t *option="", unsigned int nNonRigidParam=12)
#define min(a, b)
Definition: mlp_lapack.h:161
Int_t SetAlignableTypeId(Int_t alignableTypeId)
void CopyAddBinning(TString &name, const TH1 *hist) const
GFHistManager * GetHistManager()
Float_t SetMaxDev(Float_t maxDev)
void DrawPosResult(bool addPlots=false, const TString &selection="")
void ClearAdditionalSel()
void DrawSurfaceDeformations(const TString &whichOne="result", Option_t *option="", unsigned int maxNumPars=13)
void DrawCheck()
const T & max(const T &a, const T &b)
TString fAdditionalSelTitle
TArrayI fSubDetIds
const TString GetAdditionalSel() const
const TArrayI * GetSubDetIds() const
TString Unique(const char *name) const
void DrawGlobCorr(bool addPlots=false, const TString &sel="", Option_t *opt="", Float_t min=0., Float_t max=1.)
void DrawPull(Option_t *opt="")
void ScanPedeParAbove(UInt_t iPar, float absMin=1.e5)
void DrawOrigParam(bool addPlots=false, const TString &sel="")
Int_t fAlignableTypeId
unsigned int UInt_t
Definition: FUTypes.h:12
void AddBasicSelection(TString &sel) const
void DrawParam(bool addPlots=false, const TString &sel="")
void SetTitle(const char *title)
Definition: PlotMillePede.h:98
const TString & GetTitle() const
Definition: PlotMillePede.h:99
void AddSubDetId(Int_t subDetId)
PlotMillePede(const char *fileName, Int_t iter=2, Int_t hieraLevel=0, bool useDiff=false)
void DrawHitMaps(bool addPlots=false, bool inclFullFixed=true)
void DrawBigPullPos(float minPull, bool addPlots=false)
void ScanSelection(const char *sel=0, const char *addColumns=0)
void DrawLabelDiffAbove(UInt_t iPar, float minDiff, bool addPlots=false)
void DrawOrigPos(bool addPlots=false, const TString &sel="")
TString fAdditionalSel
void DrawSubDetId(bool addPlots=false)
Int_t PrepareAdd(bool addPlots)
GFHistManager * fHistManager
TString TitleAdd() const
TString FinalMisAlignment(UInt_t iPar) const
void DrawParamResult(bool addPlots=false)