|
||||
File indexing completed on 2024-04-06 11:56:32
0001 #ifndef PLOTMILLEPEDE_H 0002 #define PLOTMILLEPEDE_H 0003 // Original Author: Gero Flucke 0004 // last change : $Date: 2012/06/25 13:19:30 $ 0005 // by : $Author: flucke $ 0006 // 0007 // PlotMillePede is a class to interprete the content of the ROOT 0008 // TTrees that are stored as output of the millepede alignment algorithm. 0009 // The histograms are created by the methods inherited from the 0010 // MillePedeTrees class. Drawn quantities and selections are handled 0011 // as strings as they can be understood by TTree::Draw(..) commands. 0012 // 0013 // The main methods all start with 'Draw', so you can use tab completion 0014 // on what is available: 0015 // PlotMillePede p("treeFile.root"); // file form pede step 0016 // p.Draw<tab> 0017 // 0018 // Management of the created histograms is done using the ('ancient') 0019 // class GFHistManager. A pointer to that class can be accessed by 0020 // GFHistManager *man = p.GetHistManager(); 0021 // and then be used manipulate the drawings, e.g. by 0022 // man->SetLogY(); 0023 // or 0024 // man->SetNumHistsXY(3,1); 0025 // man->Draw(); 0026 // 0027 // By calling new p.Draw..(..) commands, usually previously drawn canvases are 0028 // deleted. But most methods provide either a boolean flag 'addPlots' or 0029 // understand the option 'add'. If the flag is true or the option string 0030 // contains 'add', canvases from previous Draw-commands are kept (in fact they 0031 // are re-drawn). 0032 // 0033 // General Options 0034 // =============== 0035 // A title can be set by 'void SetTitle(const char *title)': 0036 // The title will appear as part of all histogram titles. 0037 // 0038 // The x-axis ranges of many histograms can be controlled by calling one of 0039 // void SetMaxDev(Float_t maxDevDown, Float_t maxDevUp); // set x-axis range for result plots 0040 // void SetMaxDev(Float_t maxDev); // set symmetric x-axis range for result plots 0041 // before calling a Draw-method. Similarly, the number of bins can be controlled via 0042 // Int_t SetNbins(Int_t nBins); // set number of bins for some result plots 0043 // that returns the previous setting (default: 101) 0044 // 0045 // When drawing pede parameters using DrawPede<...>, the class cannot know 0046 // what type of parameters that are, e.g. RigidBodyParameters or 0047 // (Two)BowedSurface(s)Parameters. To get correct axis labels and units you 0048 // can switch between these two using p.SetBowsParameters(bool). 0049 // If you do not choose, RigidBodyParameters are expected. 0050 // 0051 // If something is plotted versus the radius, you can choose to use the signed 0052 // radius instead that uses the sign of the y-coordinate: 0053 // p.SetUseSignedR(bool) 0054 // 0055 // When drawing surface deformation values of double sensor modules (TOB, TEC R5-7), 0056 // by default the bow parameters as stored in TwoBowedSurfacesDeformations are plotted, 0057 // i.e. the average w_20, w_11, w_02 and their differences. You might want to see 0058 // instead the full bow of sensor one and two instead, e.g. w_20^1 and w_20^2. 0059 // This can be chosen by calling p.SetSurfDefDeltaBows(false). 0060 // 0061 // 0062 // Alignable Selections 0063 // ==================== 0064 // Several cuts can be set and are active until reset for all drawing routines 0065 // called after setting them. Active selections are mentioned in histogram titles. 0066 // The possibilites to set cuts are: 0067 // 0068 // 1) Select subdetector(s): 0069 // void SetSubDetId(Int_t subDetId); 0070 // * 1-6 are TPB, TPE, TIB, TID, TOB, TEC, 0071 // * -1 means: reset, i.e. take all 0072 // * using (repeated) calls of 0073 // void AddSubDetId(Int_t subDetId); 0074 // leads to an OR selection of subdetectors 0075 // * can use void SetSubDetIds(Int_t id1, Int_t id2, 0076 // Int_t id3 = -1, Int_t id4 = -1, Int_t id5 = -1); 0077 // i.e. call 'SetSubDetId(id1)' and subsequently AddSubDetId(id<n>) for all 0078 // n > 1 with id<n> > 0. 0079 // 0080 // 2) Special alignable types: 0081 // Int_t SetAlignableTypeId(Int_t alignableTypeId); 0082 // * DetUnit=1, 0083 // * Det=2, 0084 // * TIBString=15, 0085 // * etc. from CommonAlignment/interface/StructureType.h 0086 // * -1 resets 0087 // The methods returns the previous setting. 0088 // 0089 // 3) Select hierarchy level: 0090 // In case of hierarchical alignment, one can look at the parameters etc. of each 0091 // (active!) hierarchy level separately: 0092 // Int_t SetHieraLevel(Int_t hieraLevel); 0093 // * 0 (default!): lowest level only 0094 // * 1,2,...: first, second,... larger structures only 0095 // * -1: resets, shows all levels 0096 // The methods returns the previous setting. 0097 // 0098 // 4) General selection: 0099 // void AddAdditionalSel(const char *selection); 0100 // * whatever selection string that is valid on the TTree's... 0101 // * ... therefore for experts 0102 // * current setting cleared by 'ClearAdditionalSel()' 0103 // 0104 // 4a) Strip stereo, rphi, 1Dlayer/double sided selection: 0105 // * Known keywords for AddAdditionalSel(..) 0106 // * StripStereo: only Id's of stereo modules in 2D layers/rings 0107 // * StripRphi: only Id's of rphi modules in 2D layers/rings 0108 // * StripDoubleOr1D: only Id's from 1D layers or composed Dets in 2D layers/rings 0109 // * Not<one of above>: the opposite of the above three selections 0110 // 0111 // 4b) Geometrical and N(hit) selection: 0112 // void AddAdditionalSel(const TString &xyzrPhiNhit, Float_t min, Float_t max); 0113 // This method makes internal use of the above "AddAdditionalSel(const char *)". 0114 // Selects quantity 'xyzrPhiNhit' between 'min' and 'max' where 0115 // 'xyzrPhiNhit' can be any of x, y, z, r, phi, Nhit. 0116 // (Concerning 'Nhit' see also the comment about IOV handling below.) 0117 // Also cleared by 'ClearAdditionalSel()'. 0118 // 0119 // 5) Selecting predefined detector layers 0120 // bool SetDetLayerCuts(unsigned int detLayer, bool silent = false); 0121 // This makes use of SetSubDetId(..) and AddAdditionalSel(..) 0122 // to select detector layers (or rings), e.g. TIB L1 stereo or TID R3. 0123 // Note this changes the internal state of cuts defined by previous calls 0124 // to these two methods! Therefore a warning is printed if such cuts are 0125 // set before. If this silent == true, this warning is suppressed. 0126 // Returns false if 'detLayer' not supported. 0127 // 0128 // 0129 // IOV handling 0130 // ============ 0131 // In case of IOV dependent alignment, results are stored for each IOV. 0132 // The second argument of the constructor decides which IOV is used. 0133 // The default is 1 that is also valid in case there is no IOV dependence. 0134 // To draw the time dependence of parameters vs IOV numbers, use the class 0135 // PlotMillePedeIOV. 0136 // 0137 // Note that the hit statistics is (unfortunately) counted without 0138 // taking care of IOV boundaries, i.e. whatever IOV is chosen, the number of 0139 // hits per alignable is always the same, i.e. the sum of all IOVs. 0140 0141 0142 #include "MillePedeTrees.h" 0143 #include <TArrayI.h> 0144 0145 class GFHistManager; 0146 0147 class PlotMillePede : public MillePedeTrees 0148 { 0149 public: 0150 explicit PlotMillePede(const char *fileName, Int_t iov = 1, Int_t hieraLevel = 0, 0151 bool useDiff = false);// iter=1/2: singlerun/merged; heiraLev: -1 ignore, 0 lowest level, etc.; useDiff = true only for before2007_02_26 0152 PlotMillePede(const char *fileName, Int_t iov, Int_t hieraLevel, const char *treeNameAdd); 0153 virtual ~PlotMillePede(); 0154 0155 void SetTitle(const char *title) {fTitle = title;} 0156 const TString& GetTitle() const { return fTitle;} 0157 GFHistManager* GetHistManager() { return fHistManager;} 0158 0159 void DrawAll(Option_t *opt = "rogpmeh"); // r=ParamResult,o=OrigParam,g=GlobCorr,p=Pull,m=MisVsLocation,e=ErrorVsHit,h=HitMaps 0160 0161 void DrawParam(bool addPlots = false, const TString &sel = ""); // default: not fixed params 0162 void DrawPedeParam(Option_t *option = "", unsigned int nNonRigidParam = 12);//"add": add plots, "vs": p_i vs p_j; params beyond rigid body 0163 void DrawPedeParamVsLocation(Option_t *option = "", unsigned int nNonRigidParam = 12);//"add" to add plots; params beyond rigid body 0164 void DrawSurfaceDeformations(const TString &whichOne = "result start", Option_t *option = "", 0165 unsigned int maxNumPars = 12, unsigned int firstPar = 0);//"start result diff"; "add" to add plots, "all" to erase selection to be valid, "nolimit" w/o axis limits 0166 void DrawSurfaceDeformationsVsLocation(const TString &whichOne = "result", 0167 Option_t *option = "", 0168 unsigned int maxNumPar = 11, 0169 unsigned int firstPar = 0); // 0170 0171 void DrawSurfaceDeformationsLayer(Option_t *option = "", const unsigned int firstDetLayer = 22, 0172 const unsigned int lastDetLayer = 33, 0173 const TString &whichOne = "result", 0174 unsigned int maxNumPars = 12);//"add", "verbose", "verboseByParam", "nolimit", "spread"; which det layers; "start", "result", "diff" 0175 0176 0177 0178 void DrawOrigParam(bool addPlots = false, const TString &sel = ""); //this->AnyFreePar() 0179 void DrawOrigPos(bool addPlots = false, const TString &sel = ""); 0180 0181 /* void DrawParamDiff(bool addPlots = false); */ 0182 void DrawParamResult(Option_t *option = ""); // 'add' to add plots, 'withFixed' to plot also fixed 0183 void DrawPosResult(bool addPlots = false, const TString &selection = "");// sel=SelIs2D()/SelIs1D() 0184 void DrawPosMisVsLocation(bool addPlots=false, const TString &selection="", Option_t *option="");// sel=e.g. SelIs2D()/SelIs1D(), opt="start" starting misalignment profile 0185 void DrawGlobCorr(bool addPlots = false, const TString &sel = "", Option_t *opt = "", 0186 Float_t min = 0., Float_t max = 1.);// opt "nal" (no axis limit), otherwise take min/max; opt 'valid' for pede rad OK 0187 0188 void DrawPull(Option_t *opt = "");// 'add' to add plots, 'valid' to select only valid parameter, 'nolimit' for pulls without prior axis limits 0189 0190 void DrawMisVsLocation(bool addPlots = false, const TString &sel = "", Option_t *opt = "");//opt: vse0,vse1,mis,withfixed 0191 void DrawLabelDiffAbove(UInt_t iPar, float minDiff, bool addPlots = false); 0192 void DrawErrorVsHit(bool addPlots = false, const TString &sel = ""); 0193 void DrawHitMaps(bool addPlots = false, bool inclFullFixed = true); 0194 void DrawBigPullLabel(float minPull, bool addPlots = false); 0195 void DrawBigPullPos(float minPull, bool addPlots = false); 0196 void DrawSubDetId(bool addPlots = false); 0197 void DrawXyArrow(Double_t factor, Option_t *option = ""); // opt. "add", "zcirc" 0198 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 0199 void ScanPedeParAbove(UInt_t iPar, float absMin = 1.e5); // scan tree, selecting large parameters 0200 0201 void DrawCheck(); 0202 TString Unique(const char *name) const; 0203 0204 void SetMaxDev(Float_t maxDev); // set symmetric x-axis range around 0 for some result plots 0205 void SetMaxDev(Float_t maxDevDown, Float_t maxDevUp); // set x-axis range for some result plots 0206 Int_t SetNbins(Int_t nBins) {const Int_t buf = fNbins; fNbins = nBins; return buf;} // set number of bins for some result plots 0207 Float_t GetMaxDevDown() const {return fMaxDevDown;}// lower x-axis range for some result plots 0208 Float_t GetMaxDevUp() const {return fMaxDevUp;} // upper x-axis range for some result plots 0209 Int_t GetNbins() const {return fNbins;} // number of bins for some result plots 0210 const TArrayI* GetSubDetIds() const { return &fSubDetIds;} // selected subdets 0211 void SetSubDetId(Int_t subDetId); // 1-6 are TPB, TPE, TIB, TID, TOB, TEC, -1 means: take all 0212 void AddSubDetId(Int_t subDetId); // 1-6 are TPB, TPE, TIB, TID, TOB, TEC 0213 void SetSubDetIds(Int_t id1, Int_t id2, Int_t id3 = -1, Int_t id4 = -1, Int_t id5 = -1); // ignores id<n> <= 0 0214 Int_t SetAlignableTypeId(Int_t alignableTypeId);//detunit=1,det=2,...,TIBString=15,etc. from StructureType.h (-1: all) 0215 Int_t SetHieraLevel(Int_t hieraLevel); // select hierarchical level (-1: all) 0216 void AddAdditionalSel(const char *selection);// special select; StripDoubleOr1D,StripRphi,StripStereo (may be prepended by 'Not') 0217 void AddAdditionalSel(const TString &xyzrPhiNhit, Float_t min, Float_t max); // min <= x,y,z,r,phi,Nhit < max 0218 0219 const TString GetAdditionalSel () const { return fAdditionalSel;} 0220 void ClearAdditionalSel () { fAdditionalSel = ""; fAdditionalSelTitle = "";} 0221 0222 bool SetDetLayerCuts(unsigned int detLayer, bool silent = false); // e.g. TIB L1 stereo (false if 'detLayer' not supported); if silent, no warnings 0223 TString DetLayerLabel(unsigned int detLayer) const; // e.g. 'TIB L1S' 0224 0225 0226 void AddBasicSelection(TString &sel) const; 0227 0228 TString FinalMisAlignment(UInt_t iPar) const; 0229 TString TitleAdd() const; // for subdet settings etc. 0230 TString AlignableObjIdString(Int_t objId) const; 0231 0232 void CopyAddBinning(TString &name, const TH1 *hist) const;// extend 'name' taking binning from hist 0233 void SetOutName(const TString& name); 0234 0235 private: 0236 Int_t PrepareAdd(bool addPlots); 0237 0238 TString fTitle; // added to hist titles 0239 GFHistManager *fHistManager; 0240 Int_t fHieraLevel; // which hierarchical level to require (-1: all) 0241 bool fUseDiff; // true: result is diff between MisParT() and ParT() 0242 // false: result is ParT() (from 2007-02-27th on...) 0243 TArrayI fSubDetIds; // select subdets (empty: take all) 0244 Int_t fAlignableTypeId; // select ony alignables of type det,detunit,rod,etc.(-1: take all) 0245 TString fAdditionalSel; // selection to be set by user, used in AddBasicSelection 0246 TString fAdditionalSelTitle; // title add-on for fAdditionalSel 0247 Float_t fMaxDevUp; // max deviation in result plot (upwards) 0248 Float_t fMaxDevDown; // max deviation in result plot (downwards) 0249 Int_t fNbins; // number of bins between fMaxDevDown and fMaxDevUp 0250 }; 0251 0252 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |