![]() |
![]() |
00001 #ifndef PLOTMILLEPEDE_H 00002 #define PLOTMILLEPEDE_H 00003 // Original Author: Gero Flucke 00004 // last change : $Date: 2012/02/24 13:38:42 $ 00005 // by : $Author: flucke $ 00006 // 00007 // PlotMillePede is a class to interprete the content of the ROOT 00008 // TTrees that are stored as output of the millepede alignment algorithm. 00009 // The histograms are created by the methods inherited from the 00010 // MillePedeTrees class. Drawn quantities and selections are handled 00011 // as strings as they can be understood by TTree::Draw(..) commands. 00012 // 00013 // The main methods all start with 'Draw', so you can use tab completion 00014 // on what is available: 00015 // PlotMillePede p("treeFile.root"); // file form pede step 00016 // p.Draw<tab> 00017 // 00018 // Management of the created histograms is done using the ('ancient') 00019 // class GFHistManager. A pointer to that class can be accessed by 00020 // GFHistManager *man = p.GetHistManager(); 00021 // and then be used manipulate the drawings, e.g. by 00022 // man->SetLogY(); 00023 // or 00024 // man->SetNumHistsXY(3,1); 00025 // man->Draw(); 00026 // 00027 // By calling new p.Draw..(..) commands, usually previously drawn canvases are 00028 // deleted. But most methods provide either a boolean flag 'addPlots' or 00029 // understand the option 'add'. If the flag is true or the option string 00030 // contains 'add', canvases from previous Draw-commands are kept (in fact they 00031 // are re-drawn). 00032 // 00033 // A title can be set by 'void SetTitle(const char *title)': 00034 // The title will appear as part of all histogram titles. 00035 // 00036 // The x-axis ranges of many histograms can be controlled by calling 00037 // Float_t SetMaxDev(Float_t maxDev); // set x-axis range for result plots 00038 // before calling s Draw-method. SetMaxDev returns the previous set value. 00039 // 00040 // Several cuts can be set and are active until reset for all drawing routines 00041 // called after setting them. Active selections are mentioned in histogram titles. 00042 // The possibilites to set cuts are: 00043 // 00044 // 1) Select subdetector(s): 00045 // void SetSubDetId(Int_t subDetId); 00046 // * 1-6 are TPB, TPE, TIB, TID, TOB, TEC, 00047 // * -1 means: reset, i.e. take all 00048 // * using (repeated) calls of 00049 // void AddSubDetId(Int_t subDetId); 00050 // leads to an OR selection of subdetectors 00051 // * can use void SetSubDetIds(Int_t id1, Int_t id2, 00052 // Int_t id3 = -1, Int_t id4 = -1, Int_t id5 = -1); 00053 // i.e. call 'SetSubDetId(id1)' and subsequently AddSubDetId(id<n>) for all 00054 // n > 1 with id<n> > 0. 00055 // 00056 // 2) Special alignable types: 00057 // Int_t SetAlignableTypeId(Int_t alignableTypeId); 00058 // * DetUnit=1, 00059 // * Det=2, 00060 // * TIBString=15, 00061 // * etc. from CommonAlignment/interface/StructureType.h 00062 // * -1 resets 00063 // The methods returns the previous setting. 00064 // 00065 // 3) Select hierarchy level: 00066 // In case of hierarchical alignment, one can look at the parameters etc. of each 00067 // (active!) hierarchy level separately: 00068 // Int_t SetHieraLevel(Int_t hieraLevel); 00069 // * 0 (default!): lowest level only 00070 // * 1,2,...: first, second,... larger structures only 00071 // * -1: resets, shows all levels 00072 // The methods returns the previous setting. 00073 // 00074 // 4) General selection: 00075 // void AddAdditionalSel(const char *selection); 00076 // * whatever selection string that is valid on the TTree's... 00077 // * ... therefore for experts 00078 // * current setting cleared by 'ClearAdditionalSel()' 00079 // 00080 // 4a) Strip stereo, rphi, 1Dlayer/double sided selection: 00081 // * Known keywords for AddAdditionalSel(..) 00082 // * StripStereo: only Id's of stereo modules in 2D layers/rings 00083 // * StripRphi: only Id's of rphi modules in 2D layers/rings 00084 // * StripDoubleOr1D: only Id's from 1D layers or composed Dets in 2D layers/rings 00085 // * Not<one of above>: the opposite of the above three selections 00086 // 00087 // 4b) Geometrical and N(hit) selection: 00088 // void AddAdditionalSel(const TString &xyzrPhiNhit, Float_t min, Float_t max); 00089 // This method makes internal use of the above "AddAdditionalSel(const char *)". 00090 // Selects quantity 'xyzrPhiNhit' between 'min' and 'max' where 00091 // 'xyzrPhiNhit' can be any of x, y, z, r, phi, Nhit. 00092 // Also cleared by 'ClearAdditionalSel()'. 00093 // 00094 // 5) Selecting predefined detector layers 00095 // bool SetDetLayerCuts(unsigned int detLayer, bool silent = false); 00096 // This makes use of SetSubDetId(..) and AddAdditionalSel(..) 00097 // to select detector layers (or rings), e.g. TIB L1 stereo or TID R3. 00098 // Note this changes the internal state of cuts defined by previous calls 00099 // to these two methods! Therefore a warning is printed if such cuts are 00100 // set before. If this silent == true, this warning is suppressed. 00101 // Returns false if 'detLayer' not supported. 00102 // 00103 // 00104 // IOV handling 00105 // ============ 00106 // In case of IOV dependent alignment, results are stored for each IOV. 00107 // The second argument of the constructor decides which IOV is used. 00108 // The default is 1 that is also valid in case there is no IOV dependence. 00109 // 00110 // Note that the hit statistics is (unfortunately) counted without 00111 // taking care of IOV boundaries, i.e. whatever IOV is chosen, the number of 00112 // hits per alignable is always the same, i.e. the sum of all IOVs. 00113 00114 00115 #include "MillePedeTrees.h" 00116 #include <TArrayI.h> 00117 00118 class GFHistManager; 00119 00120 class PlotMillePede : public MillePedeTrees 00121 { 00122 public: 00123 explicit PlotMillePede(const char *fileName, Int_t iov = 1, Int_t hieraLevel = 0, 00124 bool useDiff = false);// iter=1/2: singlerun/merged; heiraLev: -1 ignore, 0 lowest level, etc.; useDiff = true only for before2007_02_26 00125 PlotMillePede(const char *fileName, Int_t iov, Int_t hieraLevel, const char *treeNameAdd); 00126 virtual ~PlotMillePede(); 00127 00128 void SetTitle(const char *title) {fTitle = title;} 00129 const TString& GetTitle() const { return fTitle;} 00130 GFHistManager* GetHistManager() { return fHistManager;} 00131 00132 void DrawAll(Option_t *opt = "rogpmeh"); // r=ParamResult,o=OrigParam,g=GlobCorr,p=Pull,m=MisVsLocation,e=ErrorVsHit,h=HitMaps 00133 00134 void DrawParam(bool addPlots = false, const TString &sel = ""); // default: not fixed params 00135 void DrawPedeParam(Option_t *option = "", unsigned int nNonRigidParam = 12);//"add": add plots, "vs": p_i vs p_j; params beyond rigid body 00136 void DrawPedeParamVsLocation(Option_t *option = "", unsigned int nNonRigidParam = 12);//"add" to add plots; params beyond rigid body 00137 void DrawSurfaceDeformations(const TString &whichOne = "result start", 00138 Option_t *option = "", unsigned int maxNumPars = 12);//"start result diff"; "add" to add plots, "all" to erase selection to be valid 00139 void DrawSurfaceDeformationsLayer(Option_t *option = "", const unsigned int firstDetLayer = 22, 00140 const unsigned int lastDetLayer = 33, 00141 const TString &whichOne = "result", 00142 unsigned int maxNumPars = 12);//"add", "verbose", "verboseByParam", "nolimit", "spread"; which det layers; "start", "result", "diff" 00143 00144 00145 00146 void DrawOrigParam(bool addPlots = false, const TString &sel = ""); //this->AnyFreePar() 00147 void DrawOrigPos(bool addPlots = false, const TString &sel = ""); 00148 00149 /* void DrawParamDiff(bool addPlots = false); */ 00150 void DrawParamResult(Option_t *option = ""); // 'add' to add plots, 'withFixed' to plot also fixed 00151 void DrawPosResult(bool addPlots = false, const TString &selection = "");// sel=SelIs2D()/SelIs1D() 00152 void DrawPosMisVsLocation(bool addPlots=false, const TString &selection="", Option_t *option="");// sel=e.g. SelIs2D()/SelIs1D(), opt="start" starting misalignment profile 00153 void DrawGlobCorr(bool addPlots = false, const TString &sel = "", Option_t *opt = "", 00154 Float_t min = 0., Float_t max = 1.);// opt "nal" (no axis limit), otherwise take min/max; opt 'valid' for pede rad OK 00155 00156 void DrawPull(Option_t *opt = "");// 'add' to add plots, 'valid' to select only valid parameter, 'nolimit' for pulls without prior axis limits 00157 00158 void DrawMisVsLocation(bool addPlots = false, const TString &sel = "", Option_t *opt = "");//opt: vse0,vse1,mis,withfixed 00159 void DrawLabelDiffAbove(UInt_t iPar, float minDiff, bool addPlots = false); 00160 void DrawErrorVsHit(bool addPlots = false, const TString &sel = ""); 00161 void DrawHitMaps(bool addPlots = false, bool inclFullFixed = true); 00162 void DrawBigPullLabel(float minPull, bool addPlots = false); 00163 void DrawBigPullPos(float minPull, bool addPlots = false); 00164 void DrawSubDetId(bool addPlots = false); 00165 void DrawXyArrow(Double_t factor, Option_t *option = ""); // opt. "add", "zcirc" 00166 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 00167 void ScanPedeParAbove(UInt_t iPar, float absMin = 1.e5); // scan tree, selecting large parameters 00168 00169 void DrawCheck(); 00170 TString Unique(const char *name) const; 00171 00172 Float_t SetMaxDev(Float_t maxDev); // set x-axis range for some result plots 00173 Float_t GetMaxDev() const {return fMaxDev;} // x-axis range for some result plots 00174 const TArrayI* GetSubDetIds() const { return &fSubDetIds;} // selected subdets 00175 void SetSubDetId(Int_t subDetId); // 1-6 are TPB, TPE, TIB, TID, TOB, TEC, -1 means: take all 00176 void AddSubDetId(Int_t subDetId); // 1-6 are TPB, TPE, TIB, TID, TOB, TEC 00177 void SetSubDetIds(Int_t id1, Int_t id2, Int_t id3 = -1, Int_t id4 = -1, Int_t id5 = -1); // ignores id<n> <= 0 00178 Int_t SetAlignableTypeId(Int_t alignableTypeId);//detunit=1,det=2,...,TIBString=15,etc. from StructureType.h (-1: all) 00179 Int_t SetHieraLevel(Int_t hieraLevel); // select hierarchical level (-1: all) 00180 void AddAdditionalSel(const char *selection);// special select; StripDoubleOr1D,StripRphi,StripStereo (may be prepended by 'Not') 00181 void AddAdditionalSel(const TString &xyzrPhiNhit, Float_t min, Float_t max); // min <= x,y,z,r,phi,Nhit < max 00182 00183 const TString GetAdditionalSel () const { return fAdditionalSel;} 00184 void ClearAdditionalSel () { fAdditionalSel = ""; fAdditionalSelTitle = "";} 00185 00186 bool SetDetLayerCuts(unsigned int detLayer, bool silent = false); // e.g. TIB L1 stereo (false if 'detLayer' not supported); if silent, no warnings 00187 TString DetLayerLabel(unsigned int detLayer) const; // e.g. 'TIB L1S' 00188 00189 00190 void AddBasicSelection(TString &sel) const; 00191 00192 TString FinalMisAlignment(UInt_t iPar) const; 00193 TString TitleAdd() const; // for subdet settings etc. 00194 00195 void CopyAddBinning(TString &name, const TH1 *hist) const;// extend 'name' taking binning from hist 00196 private: 00197 Int_t PrepareAdd(bool addPlots); 00198 00199 TString fTitle; // added to hist titles 00200 GFHistManager *fHistManager; 00201 Int_t fHieraLevel; // which hierarchical level to require (-1: all) 00202 bool fUseDiff; // true: result is diff between MisParT() and ParT() 00203 // false: result is ParT() (from 2007-02-27th on...) 00204 TArrayI fSubDetIds; // select subdets (empty: take all) 00205 Int_t fAlignableTypeId; // select ony alignables of type det,detunit,rod,etc.(-1: take all) 00206 TString fAdditionalSel; // selection to be set by user, used in AddBasicSelection 00207 TString fAdditionalSelTitle; // title add-on for fAdditionalSel 00208 Float_t fMaxDev; // max deviation in result plot - so far only there... 00209 }; 00210 00211 #endif