// // Couple.C - header for Couple class. // // author: richard.t.jones at uconn.edu // version: june 28, 2019 // ////////////////////////////////////////////////////////////////////////// // // // Couple class // // // // The Couple class provides a robust toolkit for relating pairs of // // rocking curve topographical maps within the root framework. It is // // based on the underlying Map2D class that extends the basic ROOT // // TH2D class with functionality related to treating 2D histograms as // // representations of 2D surfaces. A Couple consists of two rocking // // curve topographs of the same Bragg reflection from the same sample // // taken along orthogonal directions, within which a projection of the // // crystal strain pattern across the entire crystal onto a 2D surface // // is visualized. // // // // The class currently supports the following on pairs of maps: // // * association of complementary pairs // // * arbitrary transformations (shifts, rotations etc.) // // * masking of blank or random portions of the maps // // * taking the curl, divergence in 2D // // * solving Poisson's equation in 2D // // * plotting pretty pictures // // // // This package was developed at the University of Connecticut by // // Richard T. Jones, as part of the analysis suite for the analysis // // of diamond crystal rocking curve scans at taken at CHESS and CLS, // // for the purpose of assessing coherent bremsstrahlung radiators for // // the GlueX experiment at Jefferson Lab. // // // // This work is supported by the U.S. National Science Foundation // // under grant 1812415. // // // ////////////////////////////////////////////////////////////////////////// #ifndef COUPLE_H #define COUPLE_H #include #include #include #include "Map2D.h" class Couple: public TNamed { public: Couple(); Couple(const char *name, const char *title); Couple(const Couple &src); virtual ~Couple(); Couple &operator=(const Couple &src); void select(int p, const char *resultsfile); void setresol(int xpixels, int ypixels); void setxrange(double xmax, double xmin=0); void setyrange(double ymax, double ymin=0); void shift(int p, double xshift, double yshift); void rotate(int p, double phi, int deg=0); void invert(int p, int ix, int iy); void zoom(int p, double fzoom); void stretch(int p, double aspectratio); void setclean(int p, Map2D *mask); void setmask(const Map2D *mask); void lineup(); Map2D *getmask(); Map2D *getclean(int p); Map2D *getmap(int p, const char *name=0); Map2D *cleanup(int p); void polycrop(int p, const char *name=0); Double_t getchi(int p); void setchi(int p, double chi, int deg=0); Double_t uncurl(const Map2D *gx, const Map2D *gy, Map2D **silhouette=0); Map2D *zerocurl(const Map2D *gx, const Map2D *gy, Map2D **silhouette=0); Map2D *divergence(const Map2D *gx, const Map2D *gy); void draw(const char* name=0); void dump(); static void select_palette(int p); ClassDef(Couple, 2); protected: TString fResultsPath[2]; // path to XXX_results.root TString fResultsName[2]; // name of Map2D in raw image set Double_t fXshift[2]; // offset x (mm) Double_t fYshift[2]; // offset y (mm) Double_t fPsirot[2]; // rotation psi (rad) Double_t fXscale[2]; // x scale factor Double_t fYscale[2]; // y scale factor Double_t fXYskew[2]; // skew factor (x/y) Double_t fXrange[2]; // x axis range low, high (mm) Double_t fYrange[2]; // y axis range low, high (mm) Double_t fChirot[2]; // chi angle of scan (rad) Double_t fPhirot[2]; // phi angle of scan (rad) Int_t fPixels[2]; // final map height, width (pixels) Map2D *fCleanMask[2]; // clean-up masks for image 0, 1 Map2D *fZeroMask; // final map zero mask Map2D *fMap[2]; // current maps std::vector > fPolyVertex; //! cropping polygon private: void copy(const Couple &src); TFile *open(const char *filename); TCanvas *select_canvas(int p); void polycropper(int p); void deletemap(int p) { if (fMap[p]) { delete fMap[p]; fMap[p] = 0; } } public: static void polypicker(int p); static Couple *fPicking; }; #endif