2#include "KVSpiderIdentificator.h"
5#include "KVSpiderLineSiCsI.h"
19 _is_initialized =
false;
32 Init(h_, Xm, Ym, pdx, pdy);
82 if (!strcmp(
option,
"ON EN A MARRE DES WARNING !!!!"))
return;
133 while ((!foundx) && (j >= 0)) {
142 while (!foundy && (j >= 0)) {
153 if ((!foundx) || (!foundy)) {
154 cout <<
"ERROR: KVSpiderIdentificator::Init(): Invalid Histogram !" << endl;
160 if (Xm > 0.)
_xm = Xm;
161 if (Ym > 0.)
_ym = Ym;
200 double a0 = d_->
GetA0();
208 if (th <= thetam) mma =
_xmax / costh;
209 else mma =
_ymax / sinth;
211 int mmb = (int)mma / (rebin_ *
_bfactor);
217 int nbins =
xbins * ybins;
218 if (
_debug)cout <<
"DEBUG: GetProjection(): total number of bins : '" << nbins <<
"'." << endl;
224 if (xx == bmaxx) xx = bminx;
226 for (
int y = 0;
y <= ybins;
y++) {
230 if (yy == bmaxy) yy = bminy;
237 if (content > 0.)
h1->
Fill(
x1, content);
262 cout <<
"ERROR: KVSpiderIdentificator::TestHistogram(): Invalid pointer on 'TH2F' histogram !" << endl;
266 cout <<
"ERROR: KVSpiderIdentificator::SetHistogram(): Invalid histogram for SpIDer identification !" << endl;
293 cout <<
"ERROR: KVSpiderIdentificator::CreateHistogram(): Invalid range of theta [" << thmin_ <<
";" << thmax_ <<
"] !" << endl;
296 else if ((thmin_ > thmax_) || (thmin_ < 0.) || (thmin_ >= 90.) || (thmax_ <= 0.) || (thmax_ > 90.)) {
297 cout <<
"ERROR: KVSpiderIdentificator::CreateHistogram(): Invalid range of theta [" << thmin_ <<
";" << thmax_ <<
"] !" << endl;
300 else if (nth_ <= 0) {
301 cout <<
"ERROR: KVSpiderIdentificator::CreateHistogram(): Invalid number of step '" << nth_ <<
"' !" << endl;
324 if ((thmin_ == thmax_) || (nth_ == 1)) step = 10;
325 else step = (
max -
min) / ((nth_ - 1) * 1.);
333 for (
int y = 0;
y <= ybins;
y++) {
340 for (
int i = 0; i < content; i++) {
343 if (xx == bmaxx) xx = bminx;
344 if (yy == bmaxy) yy = bminy;
346 for (
double cth =
min; cth <
max + 0.0001 * step; cth += step) {
358 if ((yy <=
_y0 + (xx -
_x0)*tmax) && (yy >=
_y0 + (xx -
_x0)*tmin)) {
389 Warning(
"SearchPeack",
"Bad histo...");
406 h1_->
SaveAs(
"/home/dgruyer/e613/thesis/doc/proj.root");
426#if ROOT_VERSION_CODE > ROOT_VERSION(5,99,01)
432 for (
int p = 0;
p < nfound;
p++) {
433 double xp = xpeaks[
p];
448 list<double>::iterator it;
449 for (it = lx.begin(); it != lx.end(); ++it) {
453 double xx = xp * costh;
454 double yy = ff->
Eval(xx);
460 bool TrueAss =
false;
465 double d =
TMath::Sqrt((xx - ox) * (xx - ox) + (yy - oy) * (yy - oy));
478 if (create_ == 0) caca = 0.6;
480 if ((
p >= 4) && (
d <= caca *
dist) && (valid)) {
486 double xmoy = (
_spline->
GetX() * npp + xx) / (npp + 1);
487 double ymoy = (
_spline->
GetY() * npp + yy) / (npp + 1);
499 if ((
p >= 4) && (valid)) {
500 if ((yy >= 4000.) || (xx >= 4000.)) valid =
false;
503 if ((create_ == 0) && (valid)) {
504 if ((
p >= 10) && (
d >= 1.7 *
dist)) {
520 if ((create_ != 0) && (valid)) {
530 while ((!assoc) && (valid)) {
535 if ((d2 > d1) ||
test) {
559 if (!valid)
p += ii - 2;
562 if (TrueZ == OTZ) npp++;
577 dist =
TMath::Sqrt((xx - ox) * (xx - ox) + (yy - oy) * (yy - oy)) / (TrueZ - OTZ);
581 if (TrueAss) OTZ = TrueZ;
600 Int_t angle_proc = 0;
718 if (npoints_ == 1)
return false;
750 if (
option.Contains(
"R")) {
760 if (
option.Contains(
"D")) {
774 if (
id % 3 == 0) ff->
Draw(
"same");
783 if (
option.Contains(
"F")) {
809 cc->Print(
Form(
"%s/%s.pdf", path_, cc->GetName()),
"pdf");
834 cout <<
"WARNING: KVSpiderIdentificator::GetLine(): unknown line 'Z=" << z_ <<
"' !" << endl;
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
TCanvas with mouse-controlled dynamic zoom and pan & scan.
Apparently, a straight line.
Semi-automatic identification grid generator.
void Increment(Float_t x)
TList * CreateHistograms(double thmin_, double thmax_, int nth_, bool cos_=true, double alpha_=-1.)
bool CheckPath(const Char_t *path_)
void Init(TH2F *h_=0, Double_t Xm=-1, Double_t Ym=-1, Double_t X0=-1, Double_t Y0=-1)
void SaveAsPdf(Option_t *opt_="", const Char_t *path_=".")
bool SearchPeack(TH1F *h1_, double theta_, int create_, double sigma_=2., double peakmin_=1., int rebin_=10, int smooth_=5, TString opt_="goff")
bool ProcessIdentification()
TH1F * GetProjection(TH2F *h_, KVDroite *d_, int rebin_=10)
virtual ~KVSpiderIdentificator()
void SetHistogram(TH2F *h_=0, Double_t Xm=-1, Double_t Ym=-1)
bool GetLines(int npoints_=1, double alpha_=1.)
TH2F * CreateHistogram(double th_, double alpha_=-1.)
KVSpiderLine * GetLine(int z_)
void Clear(Option_t *option="")
bool TestHistogram(TH1 *h_=0)
void SetParameters(double bining_=1.)
void Draw(Option_t *opt_="")
KVSpiderLine specialized for PSA matrix.
Part of Spider Identification.
void Sort(bool ascending_=true)
double GetX(int n_) const
bool ReplaceLastPoint(double x_, double y_)
void Draw(Option_t *opt_="")
double GetY(int n_) const
double GetInterpolateY(int n_) const
virtual bool TestPoint(double x_, double y_, double dy_=-1., bool fit=true)
int GetInterpolateN() const
double GetInterpolateX(int n_) const
double GetDistance(double x_, double y_)
void SetAcceptedPoints(Int_t n)
bool AddPoint(double x_, double y_, bool test_=false, int n_=-1)
virtual TF1 * GetFunction(double min_=-1., double max_=-1.)
void SetStatus(bool filled_=true)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColor(Color_t lcolor)
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
virtual Double_t GetBinLowEdge(Int_t bin) const
virtual Double_t GetBinUpEdge(Int_t bin) const
virtual void SetOwner(Bool_t enable=kTRUE)
void Draw(Option_t *option="") override
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
void Draw(Option_t *chopt="") override
virtual void Smooth(Int_t ntimes=1, Option_t *option="")
virtual Int_t GetNbinsY() const
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
virtual Int_t GetNbinsX() const
void Draw(Option_t *option="") override
virtual Int_t Fill(const char *name, Double_t w)
virtual Double_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const
virtual Int_t GetMaximumBin() const
virtual Double_t GetBinContent(Int_t bin) const
virtual void SetStats(Bool_t stats=kTRUE)
TH1D * ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
TH2 * RebinX(Int_t ngroup=2, const char *newname="") override
TH1D * ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const
virtual Double_t GetBinContent(Int_t bin) const
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
void Clear(Option_t *option="") override
TObject * FindObject(const char *name) const override
void AddLast(TObject *obj) override
TObject * Remove(const TObjLinkPtr_t &lnk)
TObject * At(Int_t idx) const override
virtual void Sort(Bool_t order=kSortAscending)
const char * GetName() const override
const char * GetTitle() const override
virtual void SetName(const char *name)
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void SaveAs(const char *filename="", Option_t *option="") const
virtual Double_t Uniform(Double_t x1, Double_t x2)
virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
Double_t * GetPositionX() const
const char * Data() const
virtual void * OpenDirectory(const char *name)
virtual int MakeDirectory(const char *name)
virtual Bool_t ProcessEvents()
double dist(AxisAngle const &r1, AxisAngle const &r2)
double min(double x, double y)
double max(double x, double y)
constexpr Double_t DegToRad()
Double_t Sqrt(Double_t x)
constexpr Double_t RadToDeg()
const double xbins[xbins_n]