KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVIDGridEditor.cpp
1//Created by KVClassFactory on Fri Feb 17 11:05:30 2012
2//Author: dgruyer
3
4#include "KVIDGridEditor.h"
5
6#include "TObjString.h"
7#include "TSpectrum.h"
8#include "TStyle.h"
9#include "TROOT.h"
10#include <iostream>
11#include <sstream>
12
13#include <KeySymbols.h>
14#include <KVSpIdGUI.h>
15#include <KVZAFinderDialog.h>
16#include "KVTreeAnalyzer.h"
17#include <KVHistogram.h>
18#include "KVTestIDGridDialog.h"
19#include "KVItvFinderDialog.h"
20#include "TFrame.h"
21
22using namespace std;
23
25
26
27KVIDGridEditor* gIDGridEditor = nullptr;
28
29
32
34{
35 // Default constructor
36 fSpiderOption = "DRLF";
37 gStyle->SetPalette(55);
38
39 // Style
46 gStyle->SetNdivisions(310, "xyz");
47 gStyle->SetLabelSize(0.05, "xyz");
48 gStyle->SetTitleSize(0.05, "xyz");
49 gStyle->SetTitleOffset(1., "xzy");
50 gStyle->SetTitleFont(42, "xyz");
51 gStyle->SetLabelFont(42, "xyz");
54 gROOT->ForceStyle();
55
56 fPointStyle = 4;
57 fPointSize = 0.8;
58
59 gIDGridEditor = this;
60
61 SetName("gIDGridEditor");
62 SetDefault();
63
64 fListOfMethods = "";
65 fDefaultMethod = "";
66
67 AddMethod("AutoFit");
68 AddMethod("SaveCurrentGrid");
69 AddMethod("SpiderIdentification");
70 AddMethod("ChangeMasses");
71 AddMethod("ChangeCharges");
72 AddMethod("SelectLinesByZ");
73 AddMethod("MakeScaleX");
74 AddMethod("MakeScaleY");
75 AddMethod("SetSelectedColor");
76 AddMethod("SetPointStyle");
77 AddMethod("SetPointSize");
78 AddMethod("SetVarXVarY");
79 AddMethod("SetRunList");
80 AddMethod("AddParameter");
81 AddMethod("SetXScaleFactor");
82 AddMethod("SetYScaleFactor");
83 AddMethod("SetSVGMode");
84
85 ft = new TF1("tranlation", "(x+[0])", 0, 50000);
86 fs = new TF1("scale", "(x-[0])*[1]+[0]", 0, 50000);
87 fsy = new TF1("scale_y", "(x-[0])*[1]+[0]", 0, 50000);
88
89 frx = new TF2("rotation_x", "(x-[0])*TMath::Cos([2])-(y-[1])*TMath::Sin([2])+[0]", 0, 50000);
90 fry = new TF2("rotation_y", "(x-[0])*TMath::Sin([2])+(y-[1])*TMath::Cos([2])+[1]", 0, 50000);
91
92 ListOfLines = new KVList;
94
95 lplabel = new KVHashList();
97 lplabel2 = new KVHashList();
99 lplabel3 = new KVHashList();
101 lplabel4 = new KVHashList();
103 lplabel5 = new KVHashList();
105
107
108// MakeCustomMenuForLines();
109
110}
111
112
113
116
118{
119 // Close();
120
121 if (IsClosed()) {
122 fCanvas = new KVIDGridEditorCanvas(Form("%sCanvas", GetName()), Form("%sCanvas", GetName()), 800, 600);
123 fCanvas->AddExec("transform", "gIDGridEditor->MakeTransformation()");
124 fCanvas->AddExec("recommence", "gIDGridEditor->SelectLabel()");
125 // connect canvas' Closed() signal to method CanvasWasClosed().
126 // this way we always know if the canvas is closed by user closing the window
127 //fCanvas->Connect("Closed()", "KVIDGridEditor", this, "CanvasWasClosed()");
128 dynamic_cast<TGMainFrame*>(fCanvas->GetCanvasImp())->Connect("CloseWindow()", "KVIDGridEditor", this, "CanvasWasClosed()");
129 fPad = fCanvas->cd();
130
131 if (!ready) init();
132 if (TheHisto) TheHisto->Draw("col");
133 if (TheGrid) TheGrid->Draw();
134 DrawAtt(false);
135 }
136}
137
138
139
144
146{
147 // Slot connected to the 'Closed()' signal of the canvas.
148 // If the user closes the canvas window this method gets called.
149
150 //Info("CanvasWasClosed","now");
151 fCanvas->Close();
152 delete fCanvas;
153 fCanvas = 0;
154 fPad = 0;
155}
156
157
158
160
162{
163 TheHisto = 0;
164 TheGrid = 0;
165 fPivot = 0;
166 fPiedestal = 0;
167 fPad = 0;
168 x0 = y0 = 0.;
169 fCanvas = 0;
170 fKeyShow = 0;
171
172 fSpiderFactor = -1.;
173 fSpiderZp = -1;
174
175 itrans = iact = iopt = 0;
176 imod = 20;
177
178 ownhisto = false;
179 dlmode = false;
180 drawmode = false;
181 selectmode = false;
182 aoemode = false;
183 moved = false;
184 venermode = false;
185 fDebug = false;
186 ready = false;
187 is_col = false;
188
189 fSVGMode = false;
190 fBlackMode = false;
191 fJoelMode = false;
192 fSVGIndex = 0;
193
195}
196
197
198
200
202{
203 return (!fCanvas);
204}
205
206
207
209
211{
212 if (!IsClosed()) {
213 //fCanvas->Disconnect("Closed()", this, "CanvasWasClosed()");
214 dynamic_cast<TGMainFrame*>(fCanvas->GetCanvasImp())->Disconnect("CloseWindow()", "KVIDGridEditor", this, "CanvasWasClosed()");
215 fCanvas->Close();
216 delete fCanvas;
217 fCanvas = 0;
218 fPad = 0;
219 }
220 return;
221}
222
223
224
226
228{
229 TString option(opt);
230 option.ToUpper();
231
232 dlmode = false;
233 drawmode = false;
234 selectmode = false;
235 moved = false;
236
238
241
242 if (option.Contains("AL")) {
243 if ((TheHisto)) {
244 if (ownhisto) {
245 //TheHisto->Delete();
246 delete TheHisto;
247 ownhisto = false;
248 }
249 //TheHisto->Delete();
250 TheHisto = nullptr;
251 }
252 if (TheGrid) {
253 if (!IsClosed()) TheGrid->UnDraw();
254 TheGrid = 0;
255 }
256 fPad->Clear();
257 }
258
259 SetPivot(0., 0.);
260
261 lplabel->Execute("SetTextSize", "0.625");
262 lplabel->Execute("SetFillColor", "kWhite");
263 lplabel2->Execute("SetTextSize", "0.625");
264 lplabel2->Execute("SetFillColor", "kWhite");
265 lplabel3->Execute("SetTextSize", "0.6");
266 lplabel3->Execute("SetFillColor", "kWhite");
267 lplabel4->Execute("SetTextSize", "0.6");
268 lplabel4->Execute("SetFillColor", "kWhite");
269
270 lplabel->Execute("SetBorderSize", "1");
271 lplabel2->Execute("SetBorderSize", "1");
272 lplabel3->Execute("SetBorderSize", "1");
273 lplabel4->Execute("SetBorderSize", "1");
274 lplabel5->Execute("SetBorderSize", "1");
275
276 DrawAtt(true);
277 UpdateViewer();
278}
279
280
281
283
285{
286 if (!IsClosed()) {
287 fPad->Modified();
288 fPad->Update();
289 if (fSVGMode) {
290 TString dir("$SVGDOC");
291 if (gSystem->ExpandPathName(dir)) dir = ".";
292 fCanvas->SaveAs(Form("%s/gIDGridEditorPrint-%d.png", dir.Data(), fSVGIndex));
293 // gROOT->ProcessLine(Form(".! import -window root %s/gIDGridEditorPrint-%d.png",dir.Data(),fSVGIndex));
294 if (!gSystem->AccessPathName(Form("%s/gIDGridEditorPrint-%d.png", dir.Data(), fSVGIndex))) fSVGIndex++;
295 }
296 }
297}
298
299
300
307
309{
310 // Copy constructor
311 // This ctor is used to make a copy of an existing object (for example
312 // when a method returns an object), and it is always a good idea to
313 // implement it.
314 // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
315
316 obj.Copy(*this);
317}
318
319
320
323
325{
326 // Destructor
327
328 if (ownhisto) delete TheHisto;
329 if (fCanvas) delete fCanvas;
330 if (lplabel) {
331 lplabel->Delete("all");
332 delete lplabel;
333 }
334 if (lplabel2) {
335 lplabel2->Delete("all");
336 delete lplabel2;
337 }
338 if (lplabel3) {
339 lplabel3->Delete("all");
340 delete lplabel3;
341 }
342 if (lplabel4) {
343 lplabel4->Delete("all");
344 delete lplabel4;
345 }
346 if (lplabel5) {
347 lplabel5->Delete("all");
348 delete lplabel5;
349 }
350 if (gIDGridEditor == this) gIDGridEditor = 0x0;
351 dynamic_cast<TGMainFrame*>(fCanvas->GetCanvasImp())->Disconnect("CloseWindow()", "KVIDGridEditor", this, "CanvasWasClosed()");
352
353}
354
355
356
364
366{
367 // This method copies the current state of 'this' object Int_to 'obj'
368 // You should add here any member variables, for example:
369 // (supposing a member variable KVIDGridEditor::fToto)
370 // CastedObj.fToto = fToto;
371 // or
372 // CastedObj.SetToto( GetToto() );
373
374 KVBase::Copy(obj);
375 //KVIDGridEditor& CastedObj = (KVIDGridEditor&)obj;
376}
377
378
379
381
383{
384 AddTransformation("T_{X}");
385 AddTransformation("T_{Y}");
386 AddTransformation("R_{Z}");
387 AddTransformation("S_{X}");
388 AddTransformation("S_{Y}");
389 AddTransformation("S_{XY}");
390 AddTransformation("S_{C}");
391
392 AddAction("#odot");
393 // AddAction("0");
394 AddAction("#Leftarrow");
395 AddAction("Lz");
396 AddAction("Ly");
397 AddAction("Lx");
398
399 // AddGridOption("All",lplabel3);
400 AddGridOption("Select", lplabel3);
401
402 AddGridOption("Edit", lplabel4);
403 AddGridOption("Delete", lplabel4);
404 AddGridOption("Line", lplabel4);
405 AddGridOption("Cut", lplabel4);
406 AddGridOption("Info", lplabel4);
407 AddGridOption("Fit", lplabel4);
408 AddGridOption("Test", lplabel4);
409 AddGridOption("Mass", lplabel4);
410 AddGridOption("More", lplabel4);
411
413
415 gStyle->SetOptStat(0);
416 fCanvas->Clear();
417
418 SetPivot(0., 0.);
419 SetPiedestal(0., 0.);
420 Clear("ALL");
421 ready = true;
422
423 return;
424}
425
426
427
429
431{
432 Int_t i = 0;
433
434 Double_t x1 = 0.92;
435 Double_t x2 = 0.99;
436
437 Double_t y1 = 0.90 - i * 0.06;
438 Double_t y2 = y1 - 0.05;
439
440 TPaveLabel* templabel = 0;
441
442 templabel = new TPaveLabel(x1, y1, x2, y2, "+", "NDC");
443 templabel->SetName(templabel->GetTitle());
444 templabel->SetFillColor(kWhite);
445 lplabel5->Add(templabel);
446
447 i++;
448 y1 = 0.90 - i * 0.06;
449 y2 = y1 - 0.05;
450
451 modulator = new TPaveLabel(x1, y1, x2, y2, Form("%d", imod), "NDC");
452 modulator->SetName(templabel->GetTitle());
455
456 i++;
457 y1 = 0.90 - i * 0.06;
458 y2 = y1 - 0.05;
459
460 templabel = new TPaveLabel(x1, y1, x2, y2, "-", "NDC");
461 templabel->SetName(templabel->GetTitle());
462 templabel->SetFillColor(kWhite);
463 lplabel5->Add(templabel);
464
465 lplabel5->Execute("SetTextSize", "0.625");
466}
467
468
469
471
473{
474 Double_t y1 = 0.92;
475 Double_t y2 = 0.99;
476
477 Double_t x1 = 0.10 + itrans * 0.06;
478 Double_t x2 = x1 + 0.05;
479
480 TPaveLabel* templabel = 0;
481
482 templabel = new TPaveLabel(x1, y1, x2, y2, label.Data(), "NDC");
483 templabel->SetName(templabel->GetTitle());
484 lplabel->Add(templabel);
485
486 itrans++;
487 return;
488}
489
490
491
493
495{
496 Double_t y1 = 0.92;
497 Double_t y2 = 0.99;
498
499 Double_t x2 = 0.90 - iact * 0.06;
500 Double_t x1 = x2 - 0.05;
501
502 TPaveLabel* templabel = 0;
503
504 templabel = new TPaveLabel(x1, y1, x2, y2, label.Data(), "NDC");
505 templabel->SetName(templabel->GetTitle());
506 lplabel2->Add(templabel);
507
508 iact++;
509 return;
510}
511
512
513
515
517{
518 Double_t x1 = 0.92;
519 Double_t x2 = 0.99;
520
521 Double_t y1 = 0.10 + iopt * 0.06;
522 Double_t y2 = y1 + 0.05;
523
524 TPaveLabel* templabel = 0;
525
526 templabel = new TPaveLabel(x1, y1, x2, y2, label.Data(), "NDC");
527 templabel->SetName(templabel->GetTitle());
528 thelist->Add(templabel);
529
530 iopt++;
531 return;
532}
533
534
535
539
541{
542 // Recursively scan folders in a file looking for all TH2-derived objects.
543 // Their names are added to the TString.
544
545 if (!the_directory) return;
546 TIter next_key(the_directory->GetListOfKeys());
547 TKey* key;
548 while ((key = (TKey*)next_key())) {
549 if (key->IsFolder()) {
550 RecurseFileStructureFindHistos(hist_names, the_directory->GetDirectory(key->GetName()));
551 }
552 else {
553 TString key_class = key->GetClassName();
554 if (key_class.Contains("TH2")) hist_names += Form(" %s", key->GetName());
555 }
556 }
557}
558
559
560
568
570{
571 // Fill a TString with the names of all histograms in
572 // - ROOT memory (gROOT)
573 // - all open files
574 // - all canvases
575 // - any instance of KVTreeAnalyzer
576 // The list is sorted lexographically
577
578 KVString HistosNames = "";
579 KVList histos;
580
581 // histos in memory
582 TIter nextmem(gROOT->GetList());
583 TObject* obj;
584 while ((obj = nextmem())) {
585 //if (obj->InheritsFrom("TH2")) HistosNames += Form(" %s", obj->GetName());
586 if (obj->InheritsFrom("TH2")) histos.Add(new TObjString(obj->GetName()));
587 }
588
589 // histos in files
590 TFile* f;
591 TIter next(gROOT->GetListOfFiles());
592 while ((f = (TFile*)next())) {
593 // beware KV database file!!!
594 if (!strcmp(gSystem->BaseName(f->GetName()), "DataBase.root")) continue;
595 RecurseFileStructureFindHistos(HistosNames, f);
596 }
597 HistosNames.Begin(" ");
598 while (!HistosNames.End()) {
599 KVString g = HistosNames.Next();
600 if (g != "gIDGridEditorDefaultHistogram") histos.Add(new TObjString(g.Data()));
601 }
602 HistosNames = "";
603
604 // histos in canvases
605 TIter nextc(gROOT->GetListOfCanvases());
606 TCanvas* canv = 0;
607 while ((canv = (TCanvas*)nextc())) {
608 //printf("%s\n",canv->GetName());
609 if (strcmp(canv->GetName(), "gIDGridEditorCanvas")) {
610 TIter next_step1(canv->GetListOfPrimitives());
611 TObject* obj1 = 0;
612 while ((obj1 = next_step1())) {
613 //printf("%s\n",obj1->GetName());
614 if (obj1->InheritsFrom("TPad")) {
615 TObject* obj2 = 0;
616 TIter next_step2(((TPad*)obj1)->GetListOfPrimitives());
617 while ((obj2 = next_step2())) {
618 printf("%s\n", obj2->GetName());
619 if (obj2->InheritsFrom("TH2")) {
620 //HistosNames += Form(" %s", obj2->GetName());
621 histos.Add(new TObjString(obj2->GetName()));
622 }
623 }
624 }
625 else if (obj1->InheritsFrom("TH2")) {
626 //HistosNames += Form(" %s", ((TH2*)obj1)->GetName());
627 histos.Add(new TObjString(obj1->GetName()));
628 }
629 }
630 }
631 }
632
633 // KVTreeAnalyzer
634 if (gTreeAnalyzer) {
635 // Get all 2-D histograms from current KVTreeAnalyzer instance
636 TIter nexthist(gTreeAnalyzer->GetHistoList());
637 KVHistogram* obj = 0;
638 while ((obj = (KVHistogram*)nexthist())) {
639 if (obj->IsType("Histo") && obj->GetHisto()->InheritsFrom("TH2")) {
640 //HistosNames += Form(" %s", obj->GetName());
641 histos.Add(new TObjString(obj->GetName()));
642 }
643 }
644 }
645 //if (HistosNames.Contains("gIDGridEditorDefaultHistogram")) HistosNames.ReplaceAll("gIDGridEditorDefaultHistogram", "");
646 TObjString* s = (TObjString*)histos.FindObject("gIDGridEditorDefaultHistogram");
647 if (s) {
648 histos.Remove(s);
649 delete s;
650 }
651 // sort list of histograms by name
652 histos.Sort();
653 TIter ith(&histos);
654 while ((s = (TObjString*)ith())) {
655 HistosNames += Form(" %s", s->GetString().Data());
656 }
657
658 return HistosNames;
659}
660
661
662
666
668{
669 // Look in list of histogram names for one containing the name of
670 // the current grid. If found, return it.
671
672 if (!TheGrid) return "";
673 TString result = "";
674 TString Iter;
675
676 KVString str(ListOfName.Data());
677 str.Begin(" ");
678 while (!str.End()) {
679 Iter = str.Next(kTRUE);
680 if (Iter.EqualTo(TheGrid->GetName())) {
681 result = Iter.Data();
682 return result;
683 }
684 }
685
686 str.Begin(" ");
687 while (!str.End()) {
688 Iter = str.Next(kTRUE);
689 if (Iter.Contains(TheGrid->GetName())) {
690 result = Iter.Data();
691 return result;
692 }
693 }
694
695 return result;
696}
697
698
699
701
703{
704
705 if (!hh) {
707 TString Select = PreselectHistogram(Listo);
708
709 TString Choices;
710 TString Default;
711 Choices = "Dummy ";
712 if (TheHisto) {
713 Default = "Current";
714 Choices += "Current ";
715 }
716 else Default = "Dummy";
717
718 if (Listo == "") {
719 }
720 else if (Select == "") {
721 Choices += Listo;
722 }
723 else {
724 Default = Select;
725 Choices += Select.Data();
726 Choices += " ";
727 //Choices += Listo.ReplaceAll(Select.Data(), "");
728 Listo.Begin(" ");//in case list contains a histo with a similar name to Select
729 // if Select="SI_CSI_0801" and the list contains "SI_CSI_0801_GG"
730 while (!Listo.End()) {
731 KVString s = Listo.Next();
732 if (s != Select) Choices += Form("%s ", s.Data());
733 }
734 }
735
736 TString Answer;
737 Bool_t okpressed;
738
739 if (Choices.Contains(" ")) {
740 new KVDropDownDialog(gClient->GetDefaultRoot(), "Choose a histogram :", Choices.Data(), Default.Data(), &Answer, &okpressed);
741 if (!okpressed) {
742 Answer = "Current";
743 return;
744 }
745 }
746 else Answer = Default;
747
748 if (!Answer.Contains("Current") && ownhisto) {
749 delete TheHisto;
750 TheHisto = nullptr;
751 ownhisto = false;
752 }
753
754 if ((!Answer.Contains("Current")) && (!Answer.Contains("Dummy"))) {
755 TheHistoChoice = 0;
756 if ((TheHistoChoice = (TH2*)gROOT->FindObject(Answer.Data()))) TheHisto = TheHistoChoice;
757 else if (gFile && (TheHistoChoice = (TH2*)gFile->Get(Answer.Data()))) TheHisto = TheHistoChoice;
758 else if (gFile && (TheHistoChoice = (TH2*)gFile->FindObjectAnyFile(Answer.Data()))) TheHisto = TheHistoChoice;
759 else if (gFile && (TheHistoChoice = (TH2*)gFile->FindObjectAny(Answer.Data()))) TheHisto = TheHistoChoice;
760 else if (gTreeAnalyzer && (TheHistoChoice = (TH2*)gTreeAnalyzer->GetHistogram(Answer.Data()))) TheHisto = TheHistoChoice;
761 else if ((TheHistoChoice = FindInCanvases(Answer.Data()))) TheHisto = TheHistoChoice;
762 else Answer = "Dummy";
763 }
764
765 if (Answer.Contains("Dummy")) {
766 TString hname = Form("%sDefaultHistogram", GetName());
767 Double_t Xmax = 4096.;
768 Double_t Ymax = 4096;
769 if (TheGrid) {
771 // pour pouvoir utiliser un pointeur KVIDGraph* au lieu de KVIDZAGrid*
772 // Xmax = TheGrid->GetZmaxLine()->GetXaxis()->GetXmax();
773 // Ymax = TheGrid->GetZmaxLine()->GetYaxis()->GetXmax();
775 Xmax = TheGrid->GetXmax();
776 Ymax = TheGrid->GetYmax();
777 }
778 TH2* TmpH = 0;
779 if ((TmpH = (TH2*)gROOT->FindObject(hname.Data()))) delete TmpH;
780 TheHisto = new TH2F(hname.Data(), hname.Data(), 2048, 0, Xmax, 2048, 0, Ymax);
781 ownhisto = true;
782 }
783 }
784 else if (!hh->InheritsFrom("TH2")) {
785 cout << "ERROR: KVIDGridEditor::SetHisto(): '" << hh->GetName() << "' must be a 2D histogram !" << endl;
786 return;
787 }
788 else {
789 if ((ownhisto) && (TheHisto)) {
790 delete TheHisto;
791 TheHisto = 0;
792 }
793 TheHisto = hh;
794 ownhisto = false;
795 }
796
797 if (!IsClosed() && (TheHisto)) {
798 fPad = fCanvas->cd();//au cas ou il y a plusieurs canvas ouverts
799 // set axes range of histo to grid size
800 if (TheGrid) {
804 }
805 TheHisto->Draw("col");
806 fPad->SetLogz(true);
808 }
809 DrawAtt(true);
810 return;
811
812}
813
814
815
817
819{
820
821 TIter nextc(gROOT->GetListOfCanvases());
822 TCanvas* cc = 0;
823 TObject* obj = 0;
824 while ((cc = (TCanvas*)nextc())) {
825 if (strcmp(cc->GetName(), "gIDGridEditorCanvas")) {
826 if ((obj = cc->FindObject(histoname))) {
827 return (TH2*)obj;
828 }
829 }
830 }
831 return 0;
832
833}
834
835
836
838
840{
841 if ((!ready) || IsClosed()) return;
842
843 lplabel->Execute("Draw", "");
844 lplabel2->Execute("Draw", "");
845 lplabel3->Execute("Draw", "");
846 lplabel4->Execute("Draw", "");
847 lplabel5->Execute("Draw", "");
848
849 if (!piv) SetPivot(0., 0.);
850 else fPivot->Draw("P");
851
852 if (!piv) SetPiedestal(0., 0.);
853 else fPivot->Draw("P");
854
855
856 UpdateViewer();
857 return;
858}
859
860
861
863
865{
866 if (!gg) {
867 cout << "ERROR: KVIDGridEditor::SetHisto(): invalid pointer on the grid !" << endl;
868 return;
869 }
871
872 Clear();
873
874 TheGrid = gg;
875 if (histo) SetHisto(0);
876 if (!IsClosed()) TheGrid->Draw();
877
878 fSpiderFactor = -1.;
879 fSpiderZp = -1;
880
881 // DrawAtt(true);
882
883 UpdateViewer();
884
886
887 return;
888}
889
890
891
893
895{
896 Bool_t sethisto = true;
897
898 if (!strcmp(GridName.Data(), "")) {
899 TString Answer;
900 Bool_t proposename = false;
901 if (TheGrid) Answer = TheGrid->GetName();
902 else if (TheHisto) {
903 Answer = TheHisto->GetName();
904 proposename = true;
905 }
906 Bool_t okpressed;
907 new KVInputDialog(gClient->GetDefaultRoot(), "Enter the name of your grid :", &Answer, &okpressed);
908 if (!okpressed) return;
909 GridName = Answer.Data();
910 if (proposename && (!strcmp(TheHisto->GetName(), Answer.Data()))) sethisto = false;
911 }
912
913 KVIDGraph* tempgrid = 0;
914 if (!gIDGridManager) return;
915 if (!(tempgrid = (KVIDGraph*)gIDGridManager->GetGrids()->FindObject(GridName.Data()))) {
916 cout << "WARNING: KVIDGridEditor::SetGrid(): Unknown grid named '" << GridName.Data() << "' !" << endl;
917 return;
918 }
919 else SetGrid(tempgrid, sethisto);
920 return;
921}
922
923
924
926
928{
929
930 if (!fPivot) {
931 fPivot = new TGraph;
935 fPivot->SetName("ThePivot");
936 }
937 else fPivot->SetPoint(0, xx0, yy0);
938}
939
940
941
944
946{
947 // piedestal used during SpiderIdentification
948 if (!fPivot) {
949 // fPiedestal = new TGraph;
953 fPivot->SetName("ThePiedestal");
954 }
955 else fPivot->SetPoint(1, ppdx, ppdy);
956}
957
958
959
961
963{
964 Int_t event = fPad->GetEvent();
965 if (event == kMouseMotion) return;
966 TObject* select = fPad->GetSelected();
967
968 if (!select) return;
969 if (!select->InheritsFrom("TPaveLabel")) return;
970
971 if (fSVGMode && ((event == kButton1Down) || (event == kButton1Double) || (event == kButton1Shift))) {
972 TString tmpStr;
973 if (event == kButton1Down) tmpStr = "click";
974 else if (event == kButton1Double) tmpStr = "double click";
975 else if (event == kButton1Shift) tmpStr = "shift click";
976
979
980 TLatex* mouse = new TLatex(px, py, tmpStr.Data());
981
982 if (mouse->GetX() >= 0.5) mouse->SetTextAlign(32);
983 else mouse->SetTextAlign(12);
984
985 mouse->Draw();
986 UpdateViewer();
987 delete mouse;
988 mouse = 0;
989 }
990
991 TPaveLabel* label = (TPaveLabel*)select;
992 if (event == kButton1Down) {
993 Int_t color = label->GetFillColor();
994 if (lplabel->Contains(label)) {
995 lplabel->Execute("SetFillColor", fBlackMode ? "kBlack" : "kWhite");
996 if (color == kWhite || color == kBlack) label->SetFillColor(kRed);
997 else if (color == kRed) label->SetFillColor(fBlackMode ? kBlack : kWhite);
998 UpdateViewer();
999 }
1000 else if (lplabel2->Contains(label)) {
1001 label->SetFillColor(kRed);
1002 UpdateViewer();
1003 DispatchOrder(label);
1004 }
1005 else if (lplabel4->Contains(label)) {
1006 DispatchOrder(label);
1007 }
1008 else if (lplabel3->Contains(label)) {
1009 lplabel3->Execute("SetFillColor", fBlackMode ? "kBlack" : "kWhite");
1010 if (color == kWhite || color == kBlack) label->SetFillColor(kGreen);
1011 if (color == kGreen) label->SetFillColor(fBlackMode ? kBlack : kWhite);
1012 // SelectLines(label);
1013 SelectLines("Select");
1014 UpdateViewer();
1015 }
1016 else if (lplabel5->Contains(label) && (label != modulator)) {
1017 label->SetFillColor(kGreen);
1018 ChangeStep(label->GetTitle());
1019 UpdateViewer();
1020 }
1021 }
1022 else if (event == kButton1Up) {
1023 if (lplabel2->Contains(label)) {
1025 UpdateViewer();
1026 }
1027 else if (lplabel5->Contains(label) && (label != modulator)) {
1029 UpdateViewer();
1030 }
1031 }
1032 else if (event == kButton1Double) {
1033 if (lplabel5->Contains(label) && (label != modulator)) {
1034 label->SetFillColor(kGreen);
1035 ChangeStep(label->GetTitle(), 9);
1036 UpdateViewer();
1037 }
1038 }
1039 else if (event == kButton1Shift) {
1040 if (lplabel5->Contains(label) && (label != modulator)) {
1041 label->SetFillColor(kGreen);
1042 ChangeStep(label->GetTitle(), 100);
1043 UpdateViewer();
1044 }
1045 else if (lplabel3->Contains(label)) {
1046 lplabel3->Execute("SetFillColor", "kGreen");
1047 // if(color==kWhite) label->SetFillColor(kGreen);
1048 // if(color==kGreen) label->SetFillColor(kWhite);
1049 // SelectLines(label);
1050 SelectLines("All");
1051 UpdateViewer();
1052 }
1053 }
1054}
1055
1056
1057
1059
1061{
1062 Int_t event = fPad->GetEvent();
1063 TObject* select = fPad->GetSelected();
1064
1065 if (fSVGMode && ((event == kButton1Down) || (event == kButton1Double) || (event == kButton1Shift) || (event == kWheelUp) || (event == kWheelDown))) {
1066 TString tmpStr;
1067 if (event == kButton1Down) tmpStr = "click";
1068 else if (event == kButton1Double) tmpStr = "double click";
1069 else if (event == kButton1Shift) tmpStr = "shift click";
1070 else if (event == kWheelUp) tmpStr = "wheel up";
1071 else if (event == kWheelDown) tmpStr = "wheel down";
1072
1075
1076 TLatex* mouse = new TLatex(px, py, tmpStr.Data());
1077
1078 if (mouse->GetX() >= 0.5) mouse->SetTextAlign(32);
1079 else mouse->SetTextAlign(12);
1080
1081 mouse->Draw();
1082 UpdateViewer();
1083 delete mouse;
1084 mouse = 0;
1085 UpdateViewer();
1086 }
1087
1088 if (((event == kMouseMotion) || (event == kButton1Motion)) && (TheHisto)) {
1089 if (!(aoemode)) return;
1090
1091 Double_t size = 0.4 - 0.35 * venermode;
1092
1093 Int_t dX = 0;
1094 Int_t dY = 0;
1095
1096 Int_t px = fPad->GetEventX();
1097 Int_t py = fPad->GetEventY();
1098
1099 Double_t ppx = fPad->AbsPixeltoX(px);
1100 Double_t ppy = fPad->AbsPixeltoY(py);
1101
1102 TAxis* ax = TheHisto->GetXaxis();
1103 Int_t X0 = ax->GetFirst();
1104 Int_t X1 = ax->GetLast();
1105 Int_t NbinsX = ax->GetNbins();
1106 px = ax->FindBin(ppx);
1107
1108 Double_t ddX = (X1 + X0) * 0.5 - px;
1109 Double_t distX = TMath::Abs(ddX) / (X1 - X0);
1110 if (distX >= 0.5) return;
1111
1112 TAxis* ay = TheHisto->GetYaxis();
1113 Int_t Y0 = ay->GetFirst();
1114 Int_t Y1 = ay->GetLast();
1115 Int_t NbinsY = ay->GetNbins();
1116 py = ay->FindBin(ppy);
1117
1118 Double_t ddY = (Y1 + Y0) * 0.5 - py;
1119 Double_t distY = TMath::Abs(ddY) / (Y1 - Y0);
1120 if (distY >= 0.5) return;
1121
1122 if ((distX <= size) && (distY <= size)) return;
1123
1124 dX = TMath::Nint(ddX * (0.05 + 0.05 * venermode));
1125 dY = TMath::Nint(ddY * (0.05 + 0.05 * venermode));
1126
1127 if (TMath::Abs(dX) < 1) dX = TMath::Sign(1., ddX);
1128 if (TMath::Abs(dY) < 1) dY = TMath::Sign(1., ddY);
1129
1130 Bool_t up = false;
1131
1132 if ((X0 - dX > 0) && (X1 - dX < NbinsX)) {
1133 ax->SetRange(X0 - dX, X1 - dX);
1134 up = true;
1135 }
1136 if ((Y0 - dY > 0) && (Y1 - dY < NbinsY)) {
1137 ay->SetRange(Y0 - dY, Y1 - dY);
1138 up = true;
1139 }
1140
1141 if (up) UpdateViewer();
1142 }
1143
1144 if (!select) {}
1145 else {
1146 if (select->InheritsFrom("TPaveLabel")) return;
1147 }
1148
1149 if ((event == kButton1Up) && (dlmode) && (select)) {
1150
1151 if (select->InheritsFrom("KVIDentifier")) DeleteObject((KVIDentifier*)select);
1152
1154// if (select->InheritsFrom("KVIDCutLine") || select->InheritsFrom("KVIDCutContour")) {
1155// DeleteObject((KVIDentifier*)select);
1157// }
1158// else if (select->InheritsFrom("KVIDQAMarker")) select->Delete();
1159// else if (select->InheritsFrom("KVIDentifier")) {
1160// DeleteLine((KVIDentifier*)select);
1161// }
1162 }
1163 if ((event == kButton1Up) && (select) && (!dlmode)) {
1164 if (select->InheritsFrom("KVIDentifier")) {
1165 KVIDentifier* line = (KVIDentifier*)select;
1166 if (selectmode) {
1167 if (!ListOfLines->Contains(line)) {
1170 UpdateViewer();
1171 }
1172 else {
1175 UpdateViewer();
1176 }
1177 }
1178 else if (ListOfLines->Contains(line)) {
1181 // TPaveLabel* tmplabel = (TPaveLabel*)lplabel3->FindObject("All");
1182 // tmplabel->SetFillColor(kWhite);
1183 // TPaveLabel* tmplabel = (TPaveLabel*)lplabel3->At(0);
1184 // tmplabel->SetFillColor(kGreen);
1185 // SelectLines(tmplabel);
1186 SelectLines("Select");
1187 UpdateViewer();
1188 }
1189 }
1190 }
1191
1192 if ((event == kButton1Shift) && (select) && (!dlmode)) {
1193 if (!select->InheritsFrom("KVIDZALine") || ListOfLines->IsEmpty());
1194 else {
1195 KVIDZALine* line = (KVIDZALine*)select;
1196 if (ListOfLines->Contains(select)) return;
1197 Int_t LastZ = ((KVIDZALine*)ListOfLines->At(ListOfLines->GetSize() - 1))->GetZ();
1198 Int_t SeleZ = line->GetZ();
1199 Int_t LastA = ((KVIDZALine*)ListOfLines->At(ListOfLines->GetSize() - 1))->GetA();
1200 Int_t SeleA = line->GetA();
1201 Int_t zmin, zmax, amin, amax;
1202 if (LastZ == SeleZ) {
1203 zmin = LastZ;
1204 zmax = LastZ;
1205 amin = TMath::Min(LastA, SeleA);
1206 amax = TMath::Max(LastA, SeleA);
1207 }
1208 else if (LastZ < SeleZ) {
1209 zmin = LastZ;
1210 amin = LastA;
1211 zmax = SeleZ;
1212 amax = SeleA;
1213 }
1214 else {
1215 zmax = LastZ;
1216 amax = LastA;
1217 zmin = SeleZ;
1218 amin = SeleA;
1219 }
1220
1221
1222 for (int Z = zmin; Z <= zmax; Z++) {
1223 KVList* tmpl = (KVList*)TheGrid->GetIdentifiers()->GetSubListWithMethod(Form("%d", Z), "GetZ");
1224 TIter it(tmpl);
1225 line = 0;
1226 while ((line = (KVIDZALine*)it())) {
1227 if (ListOfLines->Contains(line)) continue;
1228 if (zmax == zmin) {
1229 if ((line->GetA() > amin) && (line->GetA() < amax)) {
1232 }
1233 continue;
1234 }
1235 if ((line->GetZ() == zmin) && (line->GetA() > amin)) {
1238 continue;
1239 }
1240 if ((line->GetZ() == zmax) && (line->GetA() < amax)) {
1243 continue;
1244 }
1245 if ((line->GetZ() != zmax) && (line->GetZ() != zmin)) {
1248 continue;
1249 }
1250 }
1251 delete tmpl;
1252 }
1253 }
1254 }
1255 if (event == kButton1Double) {
1256 if (drawmode) drawmode = false;
1257 else if (!select->InheritsFrom("KVIDentifier")) {
1258 Int_t xx = fPad->GetEventX();
1259 Int_t yy = fPad->GetEventY();
1260
1261 x0 = fPad->AbsPixeltoX(xx);
1262 y0 = fPad->AbsPixeltoY(yy);
1263
1264 SetPivot(x0, y0);
1265 fPivot->Draw("P");
1266 UpdateViewer();
1267 }
1268 }
1269 if ((event == kButton1Shift) && (!drawmode)) {
1270 if (!select->InheritsFrom("KVIDentifier")) {
1271 Int_t xx = fPad->GetEventX();
1272 Int_t yy = fPad->GetEventY();
1273
1274 x0 = fPad->AbsPixeltoX(xx);
1275 y0 = fPad->AbsPixeltoY(yy);
1276
1277 SetPiedestal(x0, y0);
1278 fPivot->Draw("P");
1279 UpdateViewer();
1280 }
1281 }
1282 if ((event == kWheelUp) || (event == kWheelDown)) {
1283 Int_t sign = (event == kWheelUp ? 1 : -1);
1284 const char* who = WhoIsSelected();
1285
1287 else if (!strcmp(who, "")) DynamicZoom(sign, fPad->GetEventX(), fPad->GetEventY());
1288 else if (!strcmp(who, "T_{X}")) TranslateX(sign);
1289 else if (!strcmp(who, "T_{Y}")) TranslateY(sign);
1290 else if (!strcmp(who, "R_{Z}")) RotateZ(sign);
1291 else if (!strcmp(who, "S_{X}")) ScaleX(sign);
1292 else if (!strcmp(who, "S_{Y}")) ScaleY(sign);
1293 else if (!strcmp(who, "S_{XY}")) ScaleXY(sign);
1294 else if (!strcmp(who, "S_{C}")) ScaleCurvature(sign);
1295 }
1296
1297 //if(event==kButton2Up) ForceUpdate();
1298 if ((event == kESC) && (TheHisto)) Unzoom();
1299
1300 return;
1301}
1302
1303
1304
1306
1308{
1309 if (!TheHisto) return;
1310 TAxis* ax = TheHisto->GetXaxis();
1311
1312 Double_t ratio1 = (xmin - fPad->GetUxmin()) / (fPad->GetUxmax() - fPad->GetUxmin());
1313 Double_t ratio2 = (xmax - fPad->GetUxmin()) / (fPad->GetUxmax() - fPad->GetUxmin());
1314
1315 if ((ratio2 - ratio1 > 0.05)) {
1316 ax->SetRangeUser(xmin, xmax);
1317 }
1318
1319 ax = TheHisto->GetYaxis();
1320
1321 ratio1 = (ymin - fPad->GetUymin()) / (fPad->GetUymax() - fPad->GetUymin());
1322 ratio2 = (ymax - fPad->GetUymin()) / (fPad->GetUymax() - fPad->GetUymin());
1323
1324 if ((ratio2 - ratio1 > 0.05)) {
1325 ax->SetRangeUser(ymin, ymax);
1326 }
1327
1328 xmax = xmin = ymax = ymin = 0.;
1329 return;
1330}
1331
1332
1333
1335
1337{
1338 TString commande(label->GetName());
1339
1340 if (commande.Contains("#Leftarrow")) Undo();
1341 else if (commande.Contains("0")) SetPivot(0, 0);
1342 else if (commande.Contains("#odot")) Unzoom();
1343 else if (commande.Contains("Lz")) SetLogz();
1344 else if (commande.Contains("Ly")) SetLogy();
1345 else if (commande.Contains("Lx")) SetLogx();
1346 else if (commande.Contains("Cut")) NewCut();
1347 else if (commande.Contains("Line")) NewLine();
1348 else if (commande.Contains("Edit")) SetEditable(label);
1349 else if (commande.Contains("Fit")) {
1350 label->SetFillColor(kRed);
1351 UpdateViewer();
1352 FitGrid();
1354 UpdateViewer();
1355 }
1356 else if (commande.Contains("Test")) {
1357 label->SetFillColor(kRed);
1358 UpdateViewer();
1359 TestGrid();
1361 UpdateViewer();
1362 }
1363 else if (commande.Contains("Mass")) {
1364 label->SetFillColor(kRed);
1365 UpdateViewer();
1366 FindZALines();
1368 UpdateViewer();
1369 }
1370 else if (commande.Contains("Info")) {
1371 label->SetFillColor(kRed);
1372 NewInfo();
1373// UpdateViewer();
1374// SpiderIdentification();
1375// label->SetFillColor(fBlackMode ? kBlack : kWhite);
1376// UpdateViewer();
1377 }
1378 else if (commande.Contains("More")) {
1379 label->SetFillColor(kRed);
1380 UpdateViewer();
1383 UpdateViewer();
1384 }
1385 else if (commande.Contains("Delete")) {
1386 if (!TheGrid) return;
1387 Int_t color = label->GetFillColor();
1388 if (color == kRed) {
1390 dlmode = false;
1391 UpdateViewer();
1392 }
1393 else if (color == kWhite || color == kBlack) {
1394 label->SetFillColor(kRed);
1395 dlmode = true;
1396 UpdateViewer();
1397 }
1398 }
1399 else cout << "WARNING: KVIDGridEditor::DispatchOrder(): unknown order '" << commande << "' !" << endl;
1400}
1401
1402
1403
1405
1407{
1408 if (TheGrid) {
1409 Bool_t iseditable = TheGrid->IsEditable();
1410 TheGrid->SetEditable(!iseditable);
1411 if (iseditable) label->SetFillColor(fBlackMode ? kBlack : kWhite);
1412 else label->SetFillColor(kRed);
1413 }
1414 else label->SetFillColor(fBlackMode ? kBlack : kWhite);
1415 UpdateViewer();
1416 return;
1417}
1418
1419
1420//void KVIDGridEditor::SelectLines(TPaveLabel* label)
1421
1423
1425{
1426 if (!TheGrid) return;
1427 // TString title(label->GetTitle());
1428 TString title(label);
1429 Int_t color = ((TPaveLabel*)lplabel3->At(0))->GetFillColor();
1430
1431 if (title.Contains("All")) {
1432 // if(color==kWhite)
1433 // {
1434 // ResetColor(ListOfLines);
1435 // ListOfLines->Clear();
1436 // }
1437 // else if(color==kGreen)
1438 // {
1444 // }
1445 selectmode = false;
1446 }
1447 if (title.Contains("Select")) {
1448 if (color == kWhite || color == kBlack) {
1449 selectmode = false;
1451 ListOfLines->Clear();
1452 }
1453 if (color == kGreen) {
1455 selectmode = true;
1456 }
1457 }
1458 UpdateViewer();
1459 return;
1460}
1461
1462
1463
1465
1467{
1468 if (!TheGrid) return;
1469 TPaveLabel* label = (TPaveLabel*)lplabel4->FindObject("Line");
1470 label->SetFillColor(kRed);
1471 UpdateViewer();
1472
1473 drawmode = true;
1474
1475 TString resname;
1476 resname.Form("%s.IDClass", TheGrid->ClassName());
1477 TString cut_choices = gEnv->GetValue(resname.Data(), "");
1478 resname.Form("%s.DefaultIDClass", TheGrid->ClassName());
1479 TString cut_default = gEnv->GetValue(resname.Data(), "");
1480 TString cut_class;
1481 Bool_t okpressed;
1482
1483 if (cut_choices.Contains(" ")) {
1484 new KVDropDownDialog(gClient->GetDefaultRoot(),
1485 "Choose class of new identifier :",
1486 cut_choices.Data(),
1487 cut_default.Data(),
1488 &cut_class,
1489 &okpressed);
1490 if (!okpressed) return;
1491 }
1492 else cut_class = cut_choices;
1493
1494 TheGrid->DrawAndAdd("ID", cut_class.Data());
1495
1498
1499 UpdateViewer();
1500 if (fDebug) cout << "INFO: KVIDGridEditor::NewLine(): New Line has been added to the current grid..." << endl;
1501 return;
1502}
1503
1504
1506
1507
1508
1509
1510{
1511 if (!TheGrid) return;
1512 TPaveLabel* label = (TPaveLabel*)lplabel4->FindObject("Cut");
1513 label->SetFillColor(kRed);
1514 UpdateViewer();
1515
1516 drawmode = true;
1517
1518 TString resname;
1519 resname.Form("%s.CutClass", TheGrid->ClassName());
1520 TString cut_choices = gEnv->GetValue(resname.Data(), "");
1521 resname.Form("%s.DefaultCutClass", TheGrid->ClassName());
1522 TString cut_default = gEnv->GetValue(resname.Data(), "");
1523 cut_default.ReplaceAll(" ", "");
1524 cut_default.ReplaceAll("KVID", "");
1525 TString cut_class;
1526 KVString cut_types = cut_choices;
1527 cut_types.ReplaceAll("KVID", "");
1528 Bool_t okpressed;
1529
1530 if (cut_choices.Contains(" ")) {
1531 if (!strcmp(cut_default, "")) {
1532 cut_types.Begin(" ");
1533 cut_default = cut_types.Next();
1534 }
1535 new KVDropDownDialog(gClient->GetDefaultRoot(),
1536 "Choose class of new cut :",
1537 cut_types.Data(),
1538 cut_default.Data(),
1539 &cut_class,
1540 &okpressed);
1541 if (!okpressed) {
1542 label->SetFillColor(kWhite);
1543 UpdateViewer();
1544 drawmode = false;
1545 return;
1546 }
1547 }
1548 else cut_class = cut_types;
1549
1550 cut_class.Prepend("KVID");
1551 if (!cut_class.Contains("ZoneContour")) TheGrid->DrawAndAdd("CUT", cut_class.Data());
1552 else TheGrid->DrawAndAdd("ID", cut_class.Data());
1553
1555 UpdateViewer();
1556
1557 if (fDebug) cout << "INFO: KVIDGridEditor::NewCut(): New Cut has been added to the current grid..." << endl;
1558 return;
1559}
1560
1561
1562
1564
1566{
1567
1568 if (!TheGrid) return;
1569 TPaveLabel* label = (TPaveLabel*)lplabel4->FindObject("Info");
1570 label->SetFillColor(kRed);
1571 UpdateViewer();
1572
1573 drawmode = true;
1574
1575 TString info_choices = gEnv->GetValue(Form("%s.InfoClass", TheGrid->ClassName()), "");
1576 if (info_choices == "") info_choices = gEnv->GetValue(Form("%s.InfoClass", "KVIDGraph"), "");
1577
1578 TString info_default = gEnv->GetValue(Form("%s.DefaultInfoClass", TheGrid->ClassName()), "");
1579 if (info_choices == "") info_choices = gEnv->GetValue(Form("%s.DefaultInfoClass", "KVIDGraph"), "");
1580
1581 info_default.ReplaceAll(" ", "");
1582 info_default.ReplaceAll("KVID", "");
1583 TString info_class;
1584 KVString info_types = info_choices;
1585 info_types.ReplaceAll("KVID", "");
1586 Bool_t okpressed;
1587
1588 if (info_choices.Contains(" ")) {
1589 if (!strcmp(info_default, "")) {
1590 info_types.Begin(" ");
1591 info_default = info_types.Next();
1592 }
1593 new KVDropDownDialog(gClient->GetDefaultRoot(),
1594 "Choose class of new info :",
1595 info_types.Data(),
1596 info_default.Data(),
1597 &info_class,
1598 &okpressed);
1599 if (!okpressed) {
1600 label->SetFillColor(kWhite);
1601 UpdateViewer();
1602 drawmode = false;
1603 return;
1604 }
1605 }
1606 else info_class = info_types;
1607
1608 info_class.Prepend("KVID");
1609 TheGrid->DrawAndAdd("INFO", info_class.Data());
1610
1611 Info("NewInfo", "Adding new info contour or line of class '%s'", info_class.Data());
1612
1614 UpdateViewer();
1615
1616 if (fDebug) cout << "INFO: KVIDGridEditor::NewInfo(): New info has been added to the current grid..." << endl;
1617 return;
1618}
1619
1620
1621
1623
1625{
1626 return fPivot->GetX()[0];
1627}
1628
1629
1630
1632
1634{
1635 return fPivot->GetY()[0];
1636
1637}
1638
1639
1640
1642
1644{
1645 return fPivot->GetX()[1];
1646
1647}
1648
1649
1650
1652
1654{
1655 return fPivot->GetY()[1];
1656
1657}
1658
1659
1660
1662
1664{
1665 if (!TheGrid) return;
1666 if (!TheHisto) return;
1667
1668 x0 = GetX0();
1669 y0 = GetY0();
1670
1671 Double_t pdx = GetPdx();
1672 Double_t pdy = GetPdy();
1673
1674 // TheGrid->UnDraw();
1675 // TheGrid->Clear();
1676
1677 new KVSpIdGUI(TheGrid, TheHisto, x0, y0, pdx, pdy, fSpiderOption.Data());
1678
1679 // fSpiderFactor = Factor;
1680 // fSpiderZp = Zp;
1681 //
1682 // if(TheGrid->GetIdentifiers()->GetSize()!=0)
1683 // {
1684 //
1685 // Int_t ret_val;
1686 // new TGMsgBox(gClient->GetDefaultRoot(), gClient->GetDefaultRoot(), "ID Grid Editor",
1687 // "This will delete all existing lines. Are you sure ?",
1688 // kMBIconExclamation, kMBOk | kMBCancel, &ret_val);
1689 //
1690 // if (ret_val & kMBOk)
1691 // {
1692 // TheGrid->Clear();
1693 // }
1694 // else return;
1695 // }
1696 //
1697 // double ScaleFactorX = TheHisto->GetNbinsX()*1./(TheHisto->GetXaxis()->GetXmax());
1698 // double ScaleFactorY = TheHisto->GetNbinsY()*1/(TheHisto->GetYaxis()->GetXmax());
1699 //
1700 // Double_t factor = fSpiderFactor;
1701 // if(fSpiderZp>0)
1702 // {
1703 // factor = TMath::Sqrt(x0*x0*(ScaleFactorX*ScaleFactorX)+y0*y0*(ScaleFactorY*ScaleFactorY))/(20.*fSpiderZp*12.);
1704 // fSpiderFactor = factor;
1705 // }
1706 //
1707 // if(fDebug) cout << "DEBUG: KVIDGridEditor::SpiderIdentification(): " << fSpiderZp << " " << fSpiderFactor << endl;
1708 // fSpiderZp = -1;
1709 //
1710 // // SetPivot(0.,0.);
1711 // Unzoom();
1712 // UpdateViewer();
1713 //
1714 // KVHistoManipulator hm;
1715 // TF1 RtLt("RtLt",Form("x*%lf",ScaleFactorX),0,TheHisto->GetXaxis()->GetXmax());
1716 // TF1 RtLty("RtLty",Form("x*%lf",ScaleFactorY),0,TheHisto->GetXaxis()->GetXmax());
1717 // TH2F* hh = (TH2F*)hm.ScaleHisto(TheHisto,&RtLt,&RtLty);
1718 //
1719 // KVSpiderIdentificator* tata = 0;
1720 // tata = new KVSpiderIdentificator(hh, x0*ScaleFactorX, y0*ScaleFactorY);
1721 //
1722 // if((tata->GetX0()>100)||(tata->GetY0()>100))
1723 // {
1724 // tata->SetX0(0.);
1725 // tata->SetY0(0.);
1726 // }
1727 //
1728 // if(pdx>=0.) tata->SetX0(pdx*ScaleFactorX);
1729 // if(pdy>=0.) tata->SetY0(pdy*ScaleFactorY);
1730 //
1731 // tata->SetParameters(factor);
1732 // // tata->UseFit(useFit);
1733 // tata->ProcessIdentification();
1734 //
1735 // if(debug) tata->Draw("DRLF");
1736 //
1737 // TList* ll = (TList*)tata->GetListOfLines();
1738 //
1739 // KVIDZALine* TheLine = 0;
1740 // int zmax = 0;
1741 //
1742 // KVSpiderLine* spline = 0;
1743 // TIter next_line(ll);
1744 // while((spline = (KVSpiderLine*)next_line()))
1745 // {
1746 // if((spline->GetN()>10))//&&(spline->GetX(0)<=tata->GetX0()+200.))
1747 // {
1748 // TF1* ff1 = 0;
1749 // if(type==kSiCsI) ff1 =
1750 // spline->GetFunction(tata->GetX0()*0.01,TMath::Max(hh->GetXaxis()->GetXmax()*0.95,spline->GetX(spline->GetN()-1)));
1751 // if(type==kSiSi) ff1 = spline->GetFunction(tata->GetX0()*0.01,TMath::Min(hh->GetXaxis()->GetXmax()*0.99,spline->GetX(spline->GetN()-1)*1.5));
1752 // else ff1 = spline->GetFunction();
1753 // if((type==kSiCsI)&&(ff1->GetParameter(1)>=3000.||(ff1->GetParameter(2)<=0.35)||(ff1->GetParameter(2)>=1.)))
1754 // {
1755 // Info("SpiderIdentification","Z = %d has been rejected (fit parameters)",spline->GetZ());
1756 // continue;
1757 // }
1758 // TheLine = (KVIDZALine*)((KVIDZAGrid*)TheGrid)->NewLine("ID");
1759 // TheLine->SetZ(spline->GetZ());
1760 // double min,max;
1761 // ff1->GetRange(min,max);
1762 // double step = 20.;
1763 // double stepmax = 800.;
1764 // double x = 0.;
1765 // for(x=min+1; x<max+0.0001*step; x+=step)
1766 // {
1767 // if(step<=stepmax) step*=1.3;
1768 // if(ff1->Eval(x)<4000) TheLine->SetPoint(TheLine->GetN(),x,ff1->Eval(x));
1769 // }
1770 // if(max>x)TheLine->SetPoint(TheLine->GetN(),max,ff1->Eval(max));
1771 //
1772 // TheGrid->Add("ID",TheLine);
1773 // if(spline->GetZ()>=zmax) zmax = spline->GetZ();
1774 // }
1775 // else
1776 // {
1777 // Info("SpiderIdentification","Z = %d has been rejected (too few points)",spline->GetZ());
1778 // }
1779 // }
1780 //
1781 // if(fDebug)Info("SpiderIdentification","last line generated : Z = %d.",zmax);
1782 //
1783 // TF1 fx("fx12",Form("x/%lf",ScaleFactorX),0.,hh->GetNbinsX()*1.);
1784 // TF1 fy("fy12",Form("x/%lf",ScaleFactorY),0.,hh->GetNbinsY()*1.);
1785 // TheGrid->Scale(&fx,&fy);
1786 //
1787 // // SetPivot(tata->GetX0(),tata->GetY0());
1788 //
1789 // if(!debug) delete tata;
1790 // if(!debug) delete hh;
1791
1792 // fPad->cd();
1793 // TheGrid->UnDraw();
1794 // TheGrid->Draw();
1795
1796 // UpdateViewer();
1797 // cout << "toto " << endl;
1798
1799 return;
1800}
1801
1802
1803
1805
1807{
1808 if (!TheGrid) return;
1809 if (!TheHisto) return;
1810
1811 new KVTestIDGridDialog(gClient->GetDefaultRoot(), gClient->GetDefaultRoot(), 10, 10, TheGrid, TheHisto);
1812
1813 if (fDebug) cout << "INFO: KVIDGridEditor::TestGrid(): testing the current grid..." << endl;
1814}
1815
1816
1817
1819
1821{
1822 if (!TheGrid) return;
1823
1825 fitter->SetGrid(TheGrid);
1826 fitter->SetPad(TheGrid->GetPad());
1827 TMethod* m = fitter->IsA()->GetMethodAny("FitPanel");
1828 TContextMenu* cm = new TContextMenu("FitPanel", "Context menu for KVVirtualIDFitter::FitPanel");
1829 cm->Action(fitter, m);
1830 delete cm;
1831
1832 if (fDebug) cout << "INFO: KVIDGridEditor::FitGrid(): fitting grid '" << TheGrid->GetName() << "'..." << endl;
1833}
1834
1835
1836
1838
1840{
1842
1843 TString Default = fDefaultMethod.Data();
1844 TString Choices = fListOfMethods.Data();
1845
1846 TString Answer;
1847 Bool_t okpressed;
1848 new KVDropDownDialog(gClient->GetDefaultRoot(), "Choose an action :", Choices.Data(), Default.Data(), &Answer, &okpressed);
1849 if (!okpressed) return;
1850
1851 TMethod* m = 0;
1852 if (!TheGrid) return;
1853 else if ((m = TheGrid->IsA()->GetMethodAllAny(Answer.Data()))) {
1854 TContextMenu* cm = new TContextMenu(Answer.Data(), Form("Context menu for KVIDGridEditor::%s", Answer.Data()));
1855 cm->Action(TheGrid, m);
1856 delete cm;
1857 }
1858 else if ((m = IsA()->GetMethodAllAny(Answer.Data()))) {
1859 TContextMenu* cm = new TContextMenu(Answer.Data(), Form("Context menu for KVIDGridEditor::%s", Answer.Data()));
1860 cm->Action(this, m);
1861 delete cm;
1862 }
1863 else cout << "INFO: KVIDGridEditor::SuggestMoreAction(): '" << Answer << "' not implemented..." << endl;
1864
1865}
1866
1867
1868
1869
1871
1873{
1874 if (!TheGrid) return;
1875 if (!ListOfLines) return;
1876
1878 ListOfLines->Clear();
1879
1880 Int_t found;
1881 KVNumberList ZL(ListOfZ);
1882 ZL.Begin();
1883 while (!ZL.End()) {
1884 Int_t Z = ZL.Next();
1885 KVIDZALine* line = ((KVIDZAGrid*)TheGrid)->GetZLine(Z, found);
1886 if ((found == -1) || (!line)) continue;
1887 if (!ListOfLines->Contains(line)) {
1890 }
1891 }
1892 return;
1893}
1894
1895
1896
1897
1899
1901{
1902 if (!TheGrid) return;
1903
1904 TString currentdir(gSystem->ExpandPathName("."));
1905
1906 TString fn = TheHisto->GetName();
1907 fn += ".dat";
1908
1909 Int_t ret_code;
1910 new TGMsgBox(
1911 gClient->GetRoot(),
1912 gClient->GetDefaultRoot(),
1913 "KVIDGridEditor::SaveCurrentGrid", Form("Do you wat to save the grid here : %s", fn.Data()),
1914 kMBIconExclamation, kMBYes | kMBNo, &ret_code
1915 );
1916
1917 if (ret_code == kMBYes) {
1918 TheGrid->WriteAsciiFile(Form("%s", fn.Data()));
1919 return;
1920 }
1921
1922 static TString dir(gSystem->ExpandPathName("."));
1923 const char* filetypes[] = {
1924 "ID Grid files", "*.dat",
1925 "All files", "*",
1926 0, 0
1927 };
1928 TGFileInfo fi;
1929 fi.fFileTypes = filetypes;
1930 fi.fIniDir = StrDup(dir);
1931 // fi.fFilename = Form("%s.dat",TheGrid->GetName());
1932 new TGFileDialog(gClient->GetDefaultRoot(), gClient->GetDefaultRoot(), kFDSave, &fi);
1933 if (fi.fFilename) {
1934 //if no ".xxx" ending given, we add ".dat"
1935 TString filenam(fi.fFilename);
1936 if (filenam.Contains("toto")) filenam.ReplaceAll("toto", TheHisto->GetName());
1937 if (!filenam.Contains('.')) filenam += ".dat";
1938 TheGrid->WriteAsciiFile(filenam.Data());
1939 }
1940 dir = fi.fIniDir;
1941 gSystem->cd(currentdir.Data());
1942}
1943
1944
1945
1947
1949{
1951 int nbin = 2;
1952 int threshold = 10;
1953 TSpectrum spec;
1954 KVIDentifier* id = 0;
1955 TIter it(ListOfLines);
1956 while ((id = (KVIDentifier*)it())) {
1957 KVIDentifier* ref = TheGrid->GetIdentifier(id->GetZ(), id->GetA() + 1);
1958 if (!ref) ref = TheGrid->GetIdentifier(id->GetZ(), id->GetA() - 1);
1959 for (int ii = 0; ii < id->GetN(); ii++) {
1960 double xx = id->GetX()[ii];
1961 double yy = id->GetY()[ii];
1962 double dyref = .5;
1963 if (ref) dyref = abs(yy - ref->Eval(xx)) / 2;
1964 int xbin = TheHisto->GetXaxis()->FindBin(xx);
1965 TH1* hh = TheHisto->ProjectionY("toto", xbin - nbin, xbin + nbin, "goff");
1966 if (dyref > 0) hh->GetXaxis()->SetRangeUser(yy - dyref * 2, yy + dyref * 2);
1967 int nfound = spec.Search(hh, dyref, "goff", 0.05);
1968 Double_t* xpeaks = spec.GetPositionX();
1969 Double_t* ypeaks = spec.GetPositionY();
1970 TList markers;
1971 markers.SetOwner(kTRUE);
1972 double dy = 1e20;
1973 double ygood = -1.;
1974 for (int ip = 0; ip < nfound; ip++) {
1976 TheGrid->Identify(xx, xpeaks[ip], &idr);
1977
1978 if (ypeaks[ip] > threshold && (idr.Z == id->GetZ() && idr.A == id->GetA())) {}
1979 else continue;
1980
1981 if (abs(xpeaks[ip] - yy) < dy) {
1982 dy = abs(xpeaks[ip] - yy);
1983 ygood = xpeaks[ip];
1984 }
1985 }
1986 if (ygood > 0) id->GetY()[ii] = ygood;
1987 delete hh;
1988 }
1989 }
1990}
1991
1992
1993
1995
1997{
1998 static TString dir("$HISTOROOT");
1999 TString currentdir(gSystem->ExpandPathName("."));
2000
2001 if (gSystem->ExpandPathName(dir)) dir = ".";
2002
2003 const char* filetypes[] = {"Root files", "*.root", "All files", "*", 0, 0};
2004 TGFileInfo fi;
2005 fi.fFileTypes = filetypes;
2006 fi.fIniDir = StrDup(dir);
2007 new TGFileDialog(gClient->GetDefaultRoot(), gClient->GetDefaultRoot(), kFDOpen, &fi);
2008 if (fi.fFilename) {
2009 if (!(TFile::Open(fi.fFilename))) {
2010 new TGMsgBox(gClient->GetDefaultRoot(), gClient->GetDefaultRoot(), "ID Grid Editor", Form("Could not open file %s", fi.fFilename), 0, kMBOk);
2011 }
2012 }
2013 dir = fi.fIniDir;
2014 gSystem->cd(currentdir.Data());
2015}
2016
2017
2018
2020
2022{
2023 TString Default = "kOrange";
2024 TString Choices = Default;
2025 Choices += " ";
2026 Choices += "kBlack kGreen kBlue kRed kYellow kCyan kMagenta";
2027
2028 TString Answer;
2029 Bool_t okpressed;
2030 new KVDropDownDialog(gClient->GetDefaultRoot(), "Choose an action :", Choices.Data(), Default.Data(), &Answer, &okpressed);
2031 if (!okpressed) return;
2032
2033 if (!strcmp(Answer.Data(), "kOrange")) SetSelectedColor(kOrange + 1);
2034 else if (!strcmp(Answer.Data(), "kGreen")) SetSelectedColor(kGreen);
2035 else if (!strcmp(Answer.Data(), "kBlack")) SetSelectedColor(kBlack);
2036 else if (!strcmp(Answer.Data(), "kBlue")) SetSelectedColor(kBlue);
2037 else if (!strcmp(Answer.Data(), "kRed")) SetSelectedColor(kRed);
2038 else if (!strcmp(Answer.Data(), "kYellow")) SetSelectedColor(kYellow);
2039 else if (!strcmp(Answer.Data(), "kCyan")) SetSelectedColor(kCyan);
2040 else if (!strcmp(Answer.Data(), "kMagenta")) SetSelectedColor(kMagenta);
2041
2042 return;
2043}
2044
2045
2046
2048
2050{
2051 if (!TheGrid) return;
2052 if (TheGrid->GetCuts()->Contains(obj)) {
2053 if (ListOfLines->Contains(obj)) ListOfLines->Remove(obj);
2054 TheGrid->RemoveCut(obj);
2055 }
2056 else if (TheGrid->GetIdentifiers()->Contains(obj)) {
2057 if (ListOfLines->Contains(obj)) ListOfLines->Remove(obj);
2059 }
2060 else if (TheGrid->GetInfos()->Contains(obj)) {
2061 if (ListOfLines->Contains(obj)) ListOfLines->Remove(obj);
2062 TheGrid->RemoveInfo(obj);
2063
2064 }
2065}
2066
2067
2068
2070
2071void KVIDGridEditor::ChangeStep(const char* title, Int_t dstep)
2072{
2073 TString commande(title);
2074 if (commande.Contains("+")) {
2075 imod += dstep;
2076 }
2077 else if (commande.Contains("-")) {
2078 imod -= dstep;
2079 if (imod <= 0)imod = 1;
2080 }
2081 modulator->SetLabel(Form("%d", imod));
2082 UpdateViewer();
2083 return;
2084}
2085
2086
2087
2089
2091{
2092 if (fCanvas->IsLogz()) fPad->SetLogz(0);
2093 else fPad->SetLogz(1);
2094}
2095
2096
2097
2099
2101{
2102 if (fCanvas->IsLogy()) fPad->SetLogy(0);
2103 else fPad->SetLogy(1);
2104}
2105
2106
2107
2109
2111{
2112 if (fCanvas->IsLogx()) fPad->SetLogx(0);
2113 else fPad->SetLogx(1);
2114}
2115
2116
2117
2119
2121{
2122 if (TheHisto) {
2123 TheHisto->GetXaxis()->UnZoom();
2124 TheHisto->GetYaxis()->UnZoom();
2125 }
2126}
2127
2128
2129
2134
2136{
2137 // Revert current grid to its last saved version
2138 // Normally this will be the state of the grid before starting
2139 // the current editing session
2140
2141 if (!TheGrid) return;
2142
2143 TString username = gSystem->GetUserInfo()->fRealName;
2144 username.ReplaceAll(",", "");
2145 Int_t ret_val;
2146 new TGMsgBox(gClient->GetDefaultRoot(), gClient->GetDefaultRoot(), "ID Grid Editor",
2147 Form("This will undo all changes to the grid. Are you sure, %s?", username.Data()),
2148 kMBIconExclamation, kMBOk | kMBCancel, &ret_val);
2149
2150 if (ret_val & kMBOk) {
2152 Clear();
2153 }
2155 }
2156 TPaveLabel* tmplabel = (TPaveLabel*)lplabel2->FindObject("#Leftarrow");
2157 tmplabel->SetFillColor(kWhite);
2158 UpdateViewer();
2159}
2160
2161
2162
2164
2166{
2167 TPaveLabel* label = 0;
2168 TIter nextlabel(lplabel);
2169 while ((label = (TPaveLabel*)nextlabel())) {
2170 if (label->GetFillColor() == kRed) return label->GetName();
2171 }
2172 return "";
2173}
2174
2175
2176
2178
2180{
2181 if (!TheGrid) return;
2182 if (!ListOfLines) return;
2183 if (ListOfLines->IsEmpty()) return;
2184
2185 Double_t step = TheHisto->GetXaxis()->GetBinWidth(1) * (imod) * 0.02;
2186 Double_t factor = Sign * step;
2187
2188 ft->SetParameter(0, factor);
2189 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(ft, 0);
2190
2191 UpdateViewer();
2192 if (fDebug) cout << "INFO: KVIDGridEditor::TranslateX(): translation on the X axis (" << (Sign > 0 ? "+" : "-") << step << ") !" << endl;
2193 return;
2194}
2195
2196
2197
2199
2201{
2202 if (!TheGrid) return;
2203 if (!ListOfLines) return;
2204 if (ListOfLines->IsEmpty()) return;
2205
2206 Double_t step = TheHisto->GetXaxis()->GetBinWidth(1) * (imod) * 0.02;
2207 Double_t factor = Sign * step;
2208
2209 ft->SetParameter(0, factor);
2210 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(0, ft);
2211
2212 UpdateViewer();
2213 if (fDebug) cout << "INFO: KVIDGridEditor::TranslateY(): translation on the Y axis (" << (Sign > 0 ? "+" : "-") << step << ") !" << endl;
2214 return;
2215}
2216
2217
2218
2221
2223{
2224 // Zoom in or out of histogram with mouse wheel
2225
2226 if (!TheHisto) return;
2227
2228 Double_t percent = TMath::Abs(0.15 * speed - Sign * 0.05);
2229
2230 Int_t dX = 0;
2231 Int_t dY = 0;
2232
2233 if (px == 0) px = (TheHisto->GetXaxis()->GetFirst() + TheHisto->GetXaxis()->GetLast()) / 2;
2234 else px = fPad->AbsPixeltoX(px);
2235
2236 if (py == 0) py = (TheHisto->GetYaxis()->GetFirst() + TheHisto->GetYaxis()->GetLast()) / 2;
2237 else py = fPad->AbsPixeltoY(py);
2238
2239 TAxis* ax = TheHisto->GetXaxis();
2240 Int_t NbinsX = ax->GetNbins();
2241 Int_t X0 = ax->GetFirst();
2242 Int_t X1 = ax->GetLast();
2243 Int_t step = TMath::Min(TMath::Max(1, (Int_t)(percent * (X1 - X0))), NbinsX / 2);
2244 step *= Sign;
2245 X0 = TMath::Min(TMath::Max(X0 + step, 1), X1 - step);
2246 X1 = TMath::Max(TMath::Min(X1 - step, NbinsX), X0);
2247 if (X0 >= X1) X0 = X1 - 1;
2248 if (Sign > 0) dX = (Int_t)(X0 + (X1 - X0) * 0.5 - ax->FindBin(px));
2249 if ((X0 - dX) < 0) ax->SetRange(0, X1 - X0);
2250 else if ((X1 - dX) > ax->GetNbins()) ax->SetRange(ax->GetNbins() - (X1 - X0), ax->GetNbins());
2251 else ax->SetRange(X0 - dX, X1 - dX);
2252
2253 ax = TheHisto->GetYaxis();
2254 Int_t NbinsY = ax->GetNbins();
2255 Int_t Y0 = ax->GetFirst();
2256 Int_t Y1 = ax->GetLast();
2257 step = TMath::Min(TMath::Max(1, (Int_t)(percent * (Y1 - Y0))), NbinsY / 2);
2258 step *= Sign;
2259 Y0 = TMath::Min(TMath::Max(Y0 + step, 1), Y1 - step);
2260 Y1 = TMath::Max(TMath::Min(Y1 - step, NbinsY), Y0);
2261 if (Y0 >= Y1) Y0 = Y1 - 1;
2262 if (Sign > 0) dY = (Int_t)(Y0 + (Y1 - Y0) * 0.5 - ax->FindBin(py));
2263 if ((Y0 - dY) < 0) ax->SetRange(0, Y1 - Y0);
2264 else if ((Y1 - dY) > ax->GetNbins()) ax->SetRange(ax->GetNbins() - (Y1 - Y0), ax->GetNbins());
2265 else ax->SetRange(Y0 - dY, Y1 - dY);
2266
2267 UpdateViewer();
2268 return;
2269}
2270
2271
2272
2274
2276{
2277 if (!TheGrid) return;
2278 if (!ListOfLines) return;
2279 if (ListOfLines->IsEmpty()) return;
2280
2281 Double_t step = 1.*(imod / 100.);
2282 if (step >= 45.) step = 45.;
2283 Double_t theta = Sign * step * TMath::DegToRad();
2284
2285 x0 = fPivot->GetX()[0];
2286 y0 = fPivot->GetY()[0];
2287
2288 frx->SetParameters(x0, y0, theta);
2289 fry->SetParameters(x0, y0, theta);
2290
2291 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(frx, fry);
2292
2293 UpdateViewer();
2294 if (fDebug) cout << "INFO: KVIDGridEditor::RotateZ(): rotation around the Z axis (" << (Sign > 0 ? "+" : "-") << step << ") !" << endl;
2295 return;
2296}
2297
2298
2299
2300
2302
2304{
2305 if (!TheGrid) return;
2306 if (!ListOfLines) return;
2307 if (ListOfLines->IsEmpty()) return;
2308
2309 x0 = fPivot->GetX()[0];
2310
2311 fs->SetParameters(x0, scaleFactor);
2312 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(fs, 0);
2313
2314 UpdateViewer();
2315
2316 fAx *= scaleFactor;
2317 fBx = fs->Eval(fBx);
2318
2319 return;
2320}
2321
2322
2323
2324
2326
2328{
2329 if (!TheGrid) return;
2330 if (!ListOfLines) return;
2331 if (ListOfLines->IsEmpty()) return;
2332
2333 y0 = fPivot->GetY()[0];
2334
2335 fs->SetParameters(y0, scaleFactor);
2336 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(0, fs);
2337
2338 UpdateViewer();
2339
2340 fAy *= scaleFactor;
2341 fBy = fs->Eval(fBy);
2342
2343 return;
2344}
2345
2346
2347
2348
2350
2352{
2353 if (!TheGrid) return;
2354 if (!ListOfLines) return;
2355 if (ListOfLines->IsEmpty()) return;
2356
2357 Double_t step = 0.05 * (imod / 100.);
2358 Double_t factor = 1. + Sign * step;
2359 MakeScaleX(factor);
2360
2361 x0 = fPivot->GetX()[0];
2362
2363 fs->SetParameters(x0, factor);
2364 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(fs, 0);
2365
2366 UpdateViewer();
2367 if (fDebug) Info("ScaleX", "scaling on the X axis (*%f) !", factor);
2368 return;
2369}
2370
2371
2372
2374
2376{
2377 if (!TheGrid) return;
2378 if (!ListOfLines) return;
2379 if (ListOfLines->IsEmpty()) return;
2380
2381 Double_t step = 0.05 * (imod / 100.);
2382 Double_t factor = 1. + Sign * step;
2383 MakeScaleY(factor);
2384
2385 y0 = fPivot->GetY()[0];
2386
2387 fs->SetParameters(y0, factor);
2388 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(0, fs);
2389
2390 UpdateViewer();
2391 if (fDebug) Info("ScaleY", "scaling on the Y axis (*%f) !", factor);
2392 return;
2393}
2394
2395
2396
2398
2400{
2401 if (!TheGrid) return;
2402 if (!ListOfLines) return;
2403 if (ListOfLines->IsEmpty()) return;
2404
2405 Double_t step = 0.05 * (imod / 100.);
2406 Double_t factor = 1. + Sign * step;
2407
2408 x0 = fPivot->GetX()[0];
2409 y0 = fPivot->GetY()[0];
2410
2411 fs->SetParameters(x0, factor);
2412 fsy->SetParameters(y0, factor);
2413
2414 ListOfLines->R__FOR_EACH(KVIDentifier, Scale)(fs, fsy);
2415
2416 UpdateViewer();
2417
2418 fAx *= factor;
2419 fBx = fs->Eval(fBx);
2420 fAy *= factor;
2421 fBy = fsy->Eval(fBy);
2422
2423 if (fDebug) Info("ScaleXY", "scaling (*%f) !", factor);
2424 return;
2425}
2426
2427
2428
2430
2432{
2433 if (!TheGrid) return;
2434 if (!ListOfLines) return;
2435 if (ListOfLines->IsEmpty()) return;
2436
2437 Double_t step = 0.05 * (imod / 100.);
2438 Double_t factor = 1. + Sign * step;
2439
2440 KVIDentifier* idd = 0;
2441 TIter nextidd(ListOfLines);
2442
2443 while ((idd = (KVIDentifier*)nextidd())) {
2444 Double_t x1 = idd->GetX()[0];
2445 Double_t x2 = idd->GetX()[idd->GetN() - 1];
2446 Double_t y1 = idd->GetY()[0];
2447 Double_t y2 = idd->GetY()[idd->GetN() - 1];
2448
2449 Double_t a = (y2 - y1) / (x2 - x1);
2450 // Double_t b = y1 - a*x1;
2451 Double_t theta = TMath::ATan(a);
2452
2453 frx->SetParameters(x1, y1, -theta);
2454 fry->SetParameters(x1, y1, -theta);
2455 idd->Scale(frx, fry);
2456
2457 fs->SetParameters(y1, factor);
2458 idd->Scale(0, fs);
2459
2460 frx->SetParameters(x1, y1, theta);
2461 fry->SetParameters(x1, y1, theta);
2462 idd->Scale(frx, fry);
2463 }
2464
2465 UpdateViewer();
2466 return;
2467
2468}
2469
2470
2471
2473
2475{
2476 if (!TheGrid) return;
2477 if (TheGrid->GetIdentifiers()->Contains(Ident)) {
2478 Ident->SetLineColor(fBlackMode ? kBlue : kBlack);
2480 }
2481 else if (TheGrid->GetCuts()->Contains(Ident)) {
2482 Ident->SetLineColor(kRed);
2483 Ident->SetMarkerColor(kRed);
2484 }
2485 else if (TheGrid->GetInfos()->Contains(Ident)) {
2486 Ident->SetLineColor(kBlue);
2487 Ident->SetMarkerColor(kBlue);
2488 }
2489 return;
2490}
2491
2492
2493
2495
2497{
2498 KVIDentifier* idd = 0;
2499 TIter nextidd(IdentList);
2500 while ((idd = (KVIDentifier*)nextidd())) {
2501 ResetColor(idd);
2502 }
2503}
2504
2505
2506
2508
2510{
2511 if (IsClosed()) return;
2512 fCanvas->cd();
2513 fCanvas->Clear();
2514 if (TheHisto) {
2515 TheHisto->Draw("col");
2516 }
2517 if (TheGrid) {
2518 TheGrid->Draw();
2519 }
2520 if (fPivot) fPivot->Draw("P");
2521 DrawAtt(false);
2522
2523 fPad->Modified();
2524 fPad->Update();
2525 if (fDebug) cout << "INFO: KVIDGridEditor::ForceUpdate(): Canvas and Co has been updated !" << endl;
2526}
2527
2528
2529
2532
2534{
2535 // Handle keys
2536
2537 char tmp[3];
2538 // UInt_t keysym;
2539 // gVirtualX->LookupString(event, tmp, sizeof(tmp), keysym);
2540 TPaveLabel* label = 0;
2541 Int_t color;
2542
2543 if (fSVGMode) {
2544 TString tmpStr(tmp);
2545 // if((keysym>=4144)&&(keysym<=4155)) tmpStr.Form("f%d",keysym-4143);
2546 tmpStr.ToUpper();
2547 fKeyShow = new TPaveText(0.8, 0.8, 0.9, 0.9, "brNDC");
2551 fKeyShow->AddText(tmpStr.Data());
2552 fKeyShow->Draw();
2553 UpdateViewer();
2554 }
2555 // if (event->fType == kGKeyPress) {
2556 // switch ((EKeySym)keysym) {
2557 switch ((EKeySym)py) {
2558 case kKey_F1:
2559 label = (TPaveLabel*)lplabel->At(0);
2560 SelectTrans(label);
2561 UpdateViewer();
2562 break;
2563
2564 case kKey_F2:
2565 label = (TPaveLabel*)lplabel->At(1);
2566 SelectTrans(label);
2567 UpdateViewer();
2568 break;
2569
2570 case kKey_F3:
2571 label = (TPaveLabel*)lplabel->At(2);
2572 SelectTrans(label);
2573 UpdateViewer();
2574 break;
2575
2576 case kKey_F4:
2577 label = (TPaveLabel*)lplabel->At(3);
2578 SelectTrans(label);
2579 UpdateViewer();
2580 break;
2581
2582 case kKey_F5:
2583 label = (TPaveLabel*)lplabel->At(4);
2584 SelectTrans(label);
2585 UpdateViewer();
2586 break;
2587
2588 case kKey_F6:
2589 label = (TPaveLabel*)lplabel->At(5);
2590 SelectTrans(label);
2591 UpdateViewer();
2592 break;
2593
2594 case kKey_F7:
2595 label = (TPaveLabel*)lplabel->At(6);
2596 SelectTrans(label);
2597 UpdateViewer();
2598 break;
2599
2600 case kKey_F8:
2601 SetLogy();
2602 UpdateViewer();
2603 break;
2604
2605 case kKey_F9:
2606 SetLogz();
2607 UpdateViewer();
2608 break;
2609
2610 case kKey_F12:
2611 Unzoom();
2612 UpdateViewer();
2613 break;
2614
2615 case kKey_s:
2617 UpdateViewer();
2618 break;
2619
2620 case kKey_l:
2621 label = (TPaveLabel*)lplabel4->FindObject("Line");
2622 DispatchOrder(label);
2623 UpdateViewer();
2624 break;
2625
2626 case kKey_u:
2627 UpdateViewer();
2628 break;
2629
2630 case kKey_e:
2631 label = (TPaveLabel*)lplabel4->FindObject("Edit");
2632 SetEditable(label);
2633 UpdateViewer();
2634 break;
2635
2636 case kKey_o:
2637 DynamicZoom(-1, 0, 0, 0.1);
2638// x0 = 0.;
2639// y0 = 0.;
2640// SetPivot(x0, y0);
2641// SetPiedestal(0.0, 0.0);
2642// UpdateViewer();
2643 break;
2644
2645 case kKey_i:
2646 DynamicZoom(1, 0, 0, 0.1);
2647 break;
2648
2649 case kKey_b:
2650 if (fBlackMode) {
2651 fBlackMode = false;
2652 if (fJoelMode) {
2653 fPad->SetFillStyle(1001);
2654 fPad->GetFrame()->SetFillStyle(1001);
2655 }
2659 gROOT->ForceStyle();
2660 gStyle->SetPalette(55);
2665
2666 SelectedColor = kOrange + 1;
2667
2668 lplabel->Execute("SetFillColor", "kWhite");
2669 lplabel->Execute("SetTextColor", "kBlack");
2670 lplabel->Execute("SetLineColor", "kBlack");
2671
2672 lplabel2->Execute("SetFillColor", "kWhite");
2673 lplabel2->Execute("SetTextColor", "kBlack");
2674 lplabel2->Execute("SetLineColor", "kBlack");
2675
2676 lplabel3->Execute("SetFillColor", "kWhite");
2677 lplabel3->Execute("SetTextColor", "kBlack");
2678 lplabel3->Execute("SetLineColor", "kBlack");
2679
2680 lplabel4->Execute("SetFillColor", "kWhite");
2681 lplabel4->Execute("SetTextColor", "kBlack");
2682 lplabel4->Execute("SetLineColor", "kBlack");
2683
2684 TIter it(lplabel5);
2685 TPaveLabel* dummy = 0;
2686 while ((dummy = (TPaveLabel*)it()))
2687 if (dummy != modulator) {
2688 dummy->SetFillColor(kWhite);
2689 dummy->SetTextColor(kBlack);
2690 dummy->SetLineColor(kBlack);
2691 }
2692
2693 }
2694 else {
2695 fBlackMode = true;
2696 if (fJoelMode) {
2697 fPad->SetFillStyle(3905);
2699 fPad->GetFrame()->SetFillStyle(3905);
2703 }
2704 else {
2708 gROOT->ForceStyle();
2709 gStyle->SetPalette(56);
2714
2716
2717 lplabel->Execute("SetFillColor", "kBlack");
2718 lplabel->Execute("SetTextColor", "kWhite");
2719 lplabel->Execute("SetLineColor", "kWhite");
2720
2721 lplabel2->Execute("SetFillColor", "kBlack");
2722 lplabel2->Execute("SetTextColor", "kWhite");
2723 lplabel2->Execute("SetLineColor", "kWhite");
2724
2725 lplabel3->Execute("SetFillColor", "kBlack");
2726 lplabel3->Execute("SetTextColor", "kWhite");
2727 lplabel3->Execute("SetLineColor", "kWhite");
2728
2729 lplabel4->Execute("SetFillColor", "kBlack");
2730 lplabel4->Execute("SetTextColor", "kWhite");
2731 lplabel4->Execute("SetLineColor", "kWhite");
2732
2733 TIter it(lplabel5);
2734 TPaveLabel* dummy = 0;
2735 while ((dummy = (TPaveLabel*)it()))
2736 if (dummy != modulator) {
2737 dummy->SetFillColor(kBlack);
2738 dummy->SetTextColor(kWhite);
2739 dummy->SetLineColor(kWhite);
2740 }
2741
2742 }
2743 }
2745 UpdateViewer();
2746 break;
2747
2748 case kKey_d:
2749 label = (TPaveLabel*)lplabel4->FindObject("Delete");
2750 DispatchOrder(label);
2751 UpdateViewer();
2752 break;
2753
2754 case kKey_f:
2755// ZoomOnMouser();
2757 break;
2758
2759 case kKey_a:
2760 lplabel3->Execute("SetFillColor", "kGreen");
2761 SelectLines("All");
2762 UpdateViewer();
2763 break;
2764
2765 case kKey_x:
2766 ChangeZoomRatio(-1);
2767 UpdateViewer();
2768 break;
2769
2770 case kKey_y:
2771 ChangeZoomRatio(1);
2772 UpdateViewer();
2773 break;
2774
2775 case kKey_m:
2776 if (fPointStyle == 4) {
2777 fPointStyle = 20;
2778 fPointSize = 1.;
2779 }
2780 else {
2781 fPointStyle = 4;
2782 fPointSize = .8;
2783 }
2784 TheGrid->GetIdentifiers()->Execute("SetMarkerStyle", Form("%d", fPointStyle));
2785 TheGrid->GetCuts()->Execute("SetMarkerStyle", Form("%d", fPointStyle));
2786 TheGrid->GetInfos()->Execute("SetMarkerStyle", Form("%d", fPointStyle));
2787 TheGrid->GetIdentifiers()->Execute("SetMarkerSize", Form("%lf", fPointSize));
2788 TheGrid->GetCuts()->Execute("SetMarkerSize", Form("%lf", fPointSize));
2789 TheGrid->GetInfos()->Execute("SetMarkerSize", Form("%lf", fPointSize));
2790 UpdateViewer();
2791 break;
2792
2793 case kKey_z:
2794 label = (TPaveLabel*)lplabel3->FindObject("Select");
2795 color = label->GetFillColor();
2796 lplabel3->Execute("SetFillColor", fBlackMode ? "kBlack" : "kWhite");
2797 if (color == kWhite || color == kBlack) label->SetFillColor(kGreen);
2798 if (color == kGreen) label->SetFillColor(fBlackMode ? kBlack : kWhite);
2799 SelectLines("Select");
2800 UpdateViewer();
2801 break;
2802
2803 case kKey_w:
2804 aoemode = !aoemode;
2805 break;
2806
2807 case kKey_v:
2809 break;
2810
2811 case kKey_Plus:
2812 if (TheHisto) {
2814 UpdateViewer();
2815 }
2816 break;
2817 case kKey_Minus:
2818 if (TheHisto) {
2820 UpdateViewer();
2821 }
2822 break;
2823
2824 case kKey_c:
2825 SetLogz();
2826 UpdateViewer();
2827 break;
2828
2829 case kKey_t:
2830 MoveHor(1, .2, false);
2831 break;
2832
2833 case kKey_Left:
2834 case kKey_4:
2835 MoveHor(1, 0.1);
2836 break;
2837
2838 case kKey_r:
2839 MoveHor(-1, .2, false);
2840 break;
2841
2842
2843 case kKey_Right:
2844 case kKey_6:
2845 MoveHor(-1, 0.1);
2846 break;
2847
2848 case kKey_n:
2849 MoveVert(1, .25, false);
2850 break;
2851
2852 case kKey_Down:
2853 case kKey_2:
2854 MoveVert(1, 0.1);
2855 break;
2856
2857 case kKey_p:
2858 MoveVert(-1, .25, false);
2859 break;
2860
2861 case kKey_Up:
2862 case kKey_8:
2863 MoveVert(-1, 0.1);
2864 break;
2865
2866 case kKey_Space:
2867 break;
2868 default:
2869 return kTRUE;
2870 }
2871 //}
2872 if (fSVGMode && fKeyShow) {
2873 delete fKeyShow;
2874 fKeyShow = 0;
2875 UpdateViewer();
2876 }
2877 return kTRUE;
2878}
2879
2880
2881
2883
2885{
2886 if (!TheHisto) return;
2887
2888 TAxis* xAxis = TheHisto->GetXaxis();
2889
2890 Int_t XX1 = xAxis->GetFirst();
2891 Int_t XX2 = xAxis->GetLast();
2892
2893 if ((XX1 == 1) && (sign == 1)) return;
2894 if ((XX2 == xAxis->GetNbins() - 1) && (sign == -1)) return;
2895
2896 Int_t dX = (Int_t)sign * (XX1 - XX2) * 0.25 * speed;
2897
2898 xAxis->SetRange(XX1 + dX, XX2 + dX);
2899 if (update) UpdateViewer();
2900}
2901
2902
2903
2905
2907{
2908 if (!TheHisto) return;
2909
2910 TAxis* axis = 0;
2911 if (sign < 0) axis = TheHisto->GetXaxis();
2912 else axis = TheHisto->GetYaxis();
2913
2914 Int_t XX1 = axis->GetFirst();
2915 Int_t XX2 = axis->GetLast();
2916
2917 Int_t dX = (Int_t) - 1 * (XX1 - XX2) * 0.1 * speed;
2918
2919 axis->SetRange(XX1 + dX, XX2 - dX);
2920 UpdateViewer();
2921}
2922
2923
2924
2925
2927
2929{
2930 if (!TheHisto) return;
2931
2932 TAxis* yAxis = TheHisto->GetYaxis();
2933
2934 Int_t XX1 = yAxis->GetFirst();
2935 Int_t XX2 = yAxis->GetLast();
2936
2937 if ((XX1 == 1) && (sign == 1)) return;
2938 if ((XX2 == yAxis->GetNbins() - 1) && (sign == -1)) return;
2939
2940 Int_t dX = (Int_t)sign * (XX1 - XX2) * 0.25 * speed;
2941
2942 yAxis->SetRange(XX1 + dX, XX2 + dX);
2943 if (update) UpdateViewer();
2944}
2945
2946
2947
2949
2951{
2952
2953}
2954
2955
2956
2957
2959
2961{
2962 if (!label) return;
2963
2964 Int_t color = label->GetFillColor();
2965 lplabel->Execute("SetFillColor", fBlackMode ? "kBlack" : "kWhite");
2966 if (color == kWhite || color == kBlack) label->SetFillColor(kRed);
2967 else if (color == kRed) label->SetFillColor(fBlackMode ? kBlack : kWhite);
2968
2969 return;
2970}
2971
2972
2973
2975
2977{
2978 fPointStyle = pstyle;
2979 TheGrid->GetIdentifiers()->Execute("SetMarkerStyle", Form("%d", fPointStyle));
2980 TheGrid->GetCuts()->Execute("SetMarkerStyle", Form("%d", fPointStyle));
2981 fPad->Modified();
2982 fPad->Update();
2983}
2984
2985
2986
2988
2990{
2991 fPointSize = psize;
2992 TheGrid->GetIdentifiers()->Execute("SetMarkerSize", Form("%lf", fPointSize));
2993 TheGrid->GetCuts()->Execute("SetMarkerSize", Form("%lf", fPointSize));
2994 fPad->Modified();
2995 fPad->Update();
2996}
2997
2998
2999
3001
3003{
3004 if ((!TheHisto) || (!TheGrid)) return;
3005
3006 if (TheGrid->InheritsFrom("KVIDZAFromZGrid")) new KVItvFinderDialog((KVIDZAFromZGrid*)TheGrid, TheHisto);
3008 // KVZALineFinder toto((KVIDZAGrid*)TheGrid, TheHisto);
3009 // toto.SetAList(A);
3010 // toto.SetNbinsByZ(binByZ);
3011 // toto.ProcessIdentification(zmin,zmax);
3012 //
3013 // SetHisto(toto.GetHisto());
3014 // SetGrid(toto.GetGrid(),kFALSE);
3015 // UpdateViewer();
3016}
3017
3018
3019
3021
3023{
3024 KVNumberList ZL(Zl);
3025 ZL.Begin();
3026 while (!ZL.End()) {
3027 Int_t Z = ZL.Next();
3028 KVList* ll = (KVList*) TheGrid->GetIdentifiers()->GetSubListWithMethod(Form("%d", Z), "GetZ");
3029 Info("ChangeMasses", "%d lines found for Z=%d", ll->GetSize(), Z);
3030
3031 KVIDentifier* id = 0;
3032 TIter next(ll);
3033 while ((id = (KVIDentifier*)next())) {
3034 Info("ChangeMasses", "A=%d -> A=%d", id->GetA(), id->GetA() + dA);
3035 id->SetA(id->GetA() + dA);
3036 }
3037 delete ll;
3038 }
3039}
3040
3041
3042
3044
3046{
3047 KVNumberList ZL(Zl);
3048
3049 IntArray ztab = ZL.GetArray();
3050 Int_t n = ztab.size();
3051 if (!n) return;
3052
3053 for (int i = n - 1; i > 0; i--) {
3054 Int_t Z = ztab[i];
3055 KVList* ll = (KVList*) TheGrid->GetIdentifiers()->GetSubListWithMethod(Form("%d", Z), "GetZ");
3056 Info("ChangeMasses", "%d lines found for Z=%d", ll->GetSize(), Z);
3057
3058 KVIDentifier* id = 0;
3059 TIter next(ll);
3060 while ((id = (KVIDentifier*)next())) {
3061 Info("ChangeMasses", "Z=%d -> Z=%d", id->GetZ(), id->GetZ() + dZ);
3062 id->SetZ(id->GetZ() + dZ);
3063 }
3064 delete ll;
3065
3066 }
3067}
3068
3069
3070
3072
3073void KVIDGridEditor::AddMethod(const char* theMethod)
3074{
3075 if (fListOfMethods.IsNull()) fDefaultMethod += theMethod;
3076 fListOfMethods += theMethod;
3077 fListOfMethods += " ";
3078 return;
3079}
3080
3081
3082
3086
3088{
3089 // Print a summary of X and Y scaling transformations (Sx, Sy, Sxy)
3090 // made since the last call of ResetScalingRecap();
3091 Info("PrintScalingRecap",
3092 "Scaling recap:\n X --> %f X + %f\n Y --> %f Y + %f"
3093 , fAx, fBx, fAy, fBy);
3094}
3095
3096
kMouseMotion
kWheelUp
kButton1Double
kButton1Shift
kButton1Motion
kButton1Up
kWheelDown
kButton1Down
kESC
int Int_t
EKeySym
kKey_Right
kKey_Down
kKey_o
kKey_Space
kKey_F1
kKey_f
kKey_F9
kKey_F4
kKey_F5
kKey_F12
kKey_F6
kKey_F8
kKey_Up
kKey_r
kKey_v
kKey_l
kKey_2
kKey_x
kKey_p
kKey_F3
kKey_Left
kKey_6
kKey_4
kKey_y
kKey_z
kKey_s
kKey_e
kKey_w
kKey_8
kKey_c
kKey_u
kKey_Plus
kKey_t
kKey_i
kKey_a
kKey_F2
kKey_Minus
kKey_d
kKey_b
kKey_F7
kKey_m
kKey_n
#define f(i)
size_t size(const MatrixT &matrix)
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
kGray
kRed
kOrange
kBlack
kGreen
kMagenta
kWhite
kCyan
kBlue
kYellow
R__EXTERN TEnv * gEnv
#define gFile
#define gClient
kFDOpen
kFDSave
kMBNo
kMBYes
kMBCancel
kMBOk
kMBIconExclamation
Option_t Option_t option
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 result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
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 g
Option_t Option_t TPoint TPoint percent
Option_t Option_t TPoint TPoint const char y1
#define gROOT
char * Form(const char *fmt,...)
char * StrDup(const char *str)
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
Base class for KaliVeda framework.
Definition KVBase.h:142
virtual Bool_t IsType(const Char_t *typ) const
Definition KVBase.h:185
virtual void Copy(TObject &) const
Make a copy of this object.
Definition KVBase.cpp:394
Bool_t IsLogy()
Definition KVCanvas.cpp:106
Bool_t IsLogz()
Definition KVCanvas.cpp:97
Bool_t IsLogx()
Definition KVCanvas.cpp:115
Ask user to choose between several options in a drop-down list.
Extended version of ROOT THashList.
Definition KVHashList.h:29
Wrapper for histograms and graphical cuts used by KVTreeAnalyzer.
Definition KVHistogram.h:20
TH1 * GetHisto() const
Definition KVHistogram.h:37
Base class for particle identification in a 2D map.
Definition KVIDGraph.h:32
Axis_t GetYmax() const
Definition KVIDGraph.h:397
void RemoveIdentifier(KVIDentifier *)
Remove and destroy identifier.
void UpdateLastSavedVersion()
update last saved version. mkae copy of current state of graph.
Axis_t GetXmax() const
Definition KVIDGraph.h:393
void RemoveInfo(KVIDentifier *)
Remove and destroy cut.
void Draw(Option_t *opt="")
void RevertToLastSavedVersion()
void UnDraw()
virtual void Identify(Double_t, Double_t, KVIdentificationResult *) const =0
KVIDentifier * GetIdentifier(Int_t Z, Int_t A) const
TVirtualPad * GetPad() const
Definition KVIDGraph.h:133
void FindAxisLimits()
Calculate X/Y min/max of all objects in graph.
Axis_t GetYmin() const
Definition KVIDGraph.h:389
const KVList * GetIdentifiers() const
Definition KVIDGraph.h:298
virtual void DrawAndAdd(const Char_t *type="ID", const Char_t *classname="KVIDentifier")
const Char_t * GetName() const
void WriteAsciiFile(const Char_t *filename)
Open, write and close ascii file containing this grid.
const KVList * GetInfos() const
Definition KVIDGraph.h:318
Axis_t GetXmin() const
Definition KVIDGraph.h:385
const KVList * GetCuts() const
Definition KVIDGraph.h:308
virtual void SetEditable(Bool_t editable=kTRUE)
virtual void Initialize()=0
void RemoveCut(KVIDentifier *)
Remove and destroy cut.
Identification grid editor GUI ,.
Bool_t drawmode
true si mode draw (line, cut)
void SelectLinesByZ(const Char_t *ListOfZ)
Int_t imod
utilise pour le placement des boutons
void DrawAtt(Bool_t piv)
void AddTransformation(TString label)
void DynamicZoom(Int_t Sign, Int_t px=0, Int_t py=0, Double_t speed=.5)
Zoom in or out of histogram with mouse wheel.
void Copy(TObject &) const
void SelectLines(const Char_t *label)
void RotateZ(Int_t Sign)
KVIDGridEditor()
Default constructor.
void ScaleY(Int_t Sign)
TF2 * frx
rotation
KVHashList * lplabel5
contient la liste des TPaveLabel pour moduler les pas (vert)
KVHashList * lplabel4
contient la liste des TPaveLabel pour editer la grille (rouge)
void SetGrid(KVIDGraph *gg, Bool_t histo=true)
void SetPiedestal(Double_t ppdx, Double_t ppdy)
piedestal used during SpiderIdentification
Bool_t moved
utilise pour les differents zooms
KVString fListOfMethods
void MoveHor(Int_t sign, Double_t speed=1, Bool_t update=true)
TVirtualPad * fPad
Bool_t aoemode
true si mode age of empire
void RecurseFileStructureFindHistos(TString &hist_names, TDirectory *the_directory)
TString ListOfHistogramInMemory()
void ChangeZoomRatio(Int_t sign, Double_t speed=.5)
TString PreselectHistogram(TString ListOfName, Int_t ipert=0)
void TranslateX(Int_t Sign)
void ScaleX(Int_t Sign)
void ScaleCurvature(Int_t Sign)
void ChangeCharges(const Char_t *Zl, Int_t dZ)
void MakeScaleX(Double_t scaleFactor)
const char * WhoIsSelected()
void ChangeStep(const char *title, Int_t dstep=1)
void AddGridOption(TString label, KVHashList *thelist)
TH2 * FindInCanvases(const Char_t *name)
void SetPointStyle(int pstyle)
void StartViewer()
Close();.
void DispatchOrder(TPaveLabel *label)
void ScaleXY(Int_t Sign)
virtual ~KVIDGridEditor()
Destructor.
TF1 * fsy
scaling
void TranslateY(Int_t Sign)
void MakeScaleY(Double_t scaleFactor)
KVList * ListOfLines
liste des lignes selectionnees
TF1 * fs
scaling
void SetSelectedColor(Int_t color)
TH2 * TheHisto
pointeur sur l'histogramme
void SelectTrans(TPaveLabel *label)
void ResetColor(KVIDentifier *Ident)
void Clear(const Option_t *opt="")
KVIDGridEditorCanvas * fCanvas
void AddMethod(const char *theMethod)
KVIDGraph * TheGrid
pointeur sur la grille courante
Bool_t HandleKey(Int_t px, Int_t py)
Handle keys.
TPaveText * fKeyShow
KVHashList * lplabel2
contient la liste des TPaveLabel pour les actions (rouge)
void SetHisto(TH2 *hh)
KVString fDefaultMethod
KVHashList * lplabel3
contient la liste des TPaveLabel pour les selections de lignes (vert)
void MoveVert(Int_t sign, Double_t speed=1, Bool_t update=true)
TF1 * ft
translation
void SetPointSize(double psize)
void ChangeMasses(const Char_t *Zl, Int_t dA)
Int_t SelectedColor
couleur des lignes selectionnees
Bool_t venermode
true si mode select
TF2 * fry
rotation
TPaveLabel * modulator
Bool_t ownhisto
true si histo par defaut
void SetPivot(Double_t xx0, Double_t yy0)
void SetEditable(TPaveLabel *label)
Bool_t selectmode
true si mode vener
Double_t fBy
scaling recap for current grid
Double_t ymax
utilises pour les differents zooms
TGraph * fPiedestal
KVHashList * lplabel
contient la liste des TPaveLabel pour les transformations (rouge)
Double_t x0
coordonne x du pivot
void DeleteObject(KVIDentifier *obj)
Double_t fSpiderFactor
Double_t y0
coordonne y du pivot
friend class KVIDGridEditorCanvas
friend class KeyHandler;
Bool_t dlmode
true si mode delete
void AddAction(TString label)
KVList * GetGrids()
Hybrid charge & mass identification grid.
Identification grid with lines corresponding to different nuclear isotopes (KVIDZALine)
Definition KVIDZAGrid.h:66
Base class for identification ridge lines corresponding to different nuclear species.
Definition KVIDZALine.h:33
Base class for graphical cuts used in particle identification.
virtual void Scale(Double_t sx=-1, Double_t sy=-1)
Full result of one attempted particle identification.
Int_t A
A of particle found (if Aident==kTRUE)
Int_t Z
Z of particle found (if Zident==kTRUE)
General purpose dialog box asking for some input in the form of a string.
GUI for finding/fixing mass identification intervals.
Extended TList class which owns its objects by default.
Definition KVList.h:28
void Sort(Bool_t order=kSortAscending)
Definition KVList.h:35
Strings used to represent a set of ranges of values.
Bool_t End(void) const
void Begin(void) const
IntArray GetArray() const
Int_t Next(void) const
virtual TObject * FindObject(const char *name) const
KVSeqCollection * GetSubListWithMethod(const Char_t *retvalue, const Char_t *method) const
virtual void AddLast(TObject *obj)
virtual void SetOwner(Bool_t enable=kTRUE)
virtual void Clear(Option_t *option="")
virtual Int_t GetSize() const
virtual void Execute(const char *method, const char *params, Int_t *error=0)
virtual TObject * At(Int_t idx) const
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
virtual void Delete(Option_t *option="")
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition KVString.h:73
void Begin(TString delim) const
Definition KVString.cpp:565
Bool_t End() const
Definition KVString.cpp:634
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition KVString.cpp:695
GUI for testing identification grids.
const KVList * GetHistoList() const
TH1 * GetHistogram(const Char_t *name) const
Return histogram with given name.
ABC for fitting ID grids with functionals.
static KVVirtualIDFitter * GetDefaultFitter()
void SetPad(TVirtualPad *p)
void SetGrid(KVIDGraph *g)
Dialog box for KVZALineFinder class.
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
virtual Color_t GetFillColor() const
virtual void SetFillColor(Color_t fcolor)
virtual void SetFillStyle(Style_t fstyle)
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 void SetTextAlign(Short_t align=11)
virtual void SetTextColor(Color_t tcolor=1)
virtual Int_t FindBin(const char *label)
virtual void UnZoom()
Int_t GetLast() const
Int_t GetNbins() const
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
virtual void SetRange(Int_t first=0, Int_t last=0)
virtual Double_t GetBinWidth(Int_t bin) const
Int_t GetFirst() const
void Clear(Option_t *option="") override
TCanvasImp * GetCanvasImp() const override
void Close(Option_t *option="") override
TVirtualPad * cd(Int_t subpadnumber=0) override
TMethod * GetMethodAllAny(const char *method)
TMethod * GetMethodAny(const char *method)
virtual void AddAll(const TCollection *col)
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
virtual Bool_t IsEmpty() const
Bool_t Contains(const char *name) const
TClass * IsA() const override
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
virtual TList * GetListOfKeys() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetParameters(const Double_t *params)
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual void SetParameter(const TString &name, Double_t value)
char * fFilename
const char ** fFileTypes
char * fIniDir
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Double_t * GetY() const
virtual Bool_t IsEditable() const
Int_t GetN() const
Double_t * GetX() const
virtual Double_t Eval(Double_t x, TSpline *spline=nullptr, Option_t *option="") const
void SetName(const char *name="") override
void Draw(Option_t *chopt="") override
TAxis * GetXaxis()
TAxis * GetYaxis()
void Draw(Option_t *option="") override
virtual void SetMinimum(Double_t minimum=-1111)
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
TH1D * ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
Bool_t IsFolder() const override
virtual const char * GetClassName() const
const char * GetName() const override
virtual void SetName(const char *name)
TClass * IsA() const override
virtual const char * GetName() const
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
virtual Bool_t InheritsFrom(const char *classname) const
virtual void Draw(Option_t *option="")
virtual void Info(const char *method, const char *msgfmt,...) const
void AddExec(const char *name, const char *command) override
TList * GetListOfPrimitives() const override
void SaveAs(const char *filename="", Option_t *option="") const override
const char * GetName() const override
virtual void SetLabel(const char *label)
const char * GetTitle() const override
virtual TText * AddText(const char *label)
void Draw(Option_t *option="") override
const char * GetName() const override
virtual void SetName(const char *name="")
virtual void SetBorderSize(Int_t bordersize=4)
Double_t * GetPositionY() const
virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
Double_t * GetPositionX() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
const char * Data() const
Bool_t EqualTo(const char *cs, ECaseCompare cmp=kExact) const
void ToUpper()
Bool_t IsNull() const
TString & Prepend(char c, Ssiz_t rep=1)
virtual Int_t Sizeof() const
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
void SetOptTitle(Int_t tit=1)
void SetPadTopMargin(Float_t margin=0.1)
void SetOptStat(Int_t stat=1)
void SetPadBottomMargin(Float_t margin=0.1)
void SetFrameFillColor(Color_t color=1)
void SetPadRightMargin(Float_t margin=0.1)
void SetTitleFont(Style_t font=62, Option_t *axis="X")
void SetPadTickY(Int_t ticky)
void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
void SetPadTickX(Int_t tickx)
void SetPalette(Int_t ncolors=kBird, Int_t *colors=nullptr, Float_t alpha=1.)
void SetLabelFont(Style_t font=62, Option_t *axis="X")
void SetPadLeftMargin(Float_t margin=0.1)
void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
void SetNdivisions(Int_t n=510, Option_t *axis="X")
void SetHatchesSpacing(Double_t h)
void SetHatchesLineWidth(Int_t l)
void SetLabelSize(Float_t size=0.04, Option_t *axis="X")
Bool_t cd(const char *path)
virtual UserGroup_t * GetUserInfo(const char *user=nullptr)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
virtual const char * BaseName(const char *pathname)
virtual char * ExpandPathName(const char *path)
Double_t GetX() const
virtual void Modified(Bool_t flag=1)=0
virtual void SetLogx(Int_t value=1)=0
virtual Double_t GetUymax() const=0
virtual TFrame * GetFrame()=0
virtual Int_t GetEventX() const=0
virtual void Update()=0
virtual TObject * GetSelected() const=0
virtual void SetLogz(Int_t value=1)=0
virtual Double_t AbsPixeltoX(Int_t px)=0
virtual Double_t GetUxmax() const=0
virtual Double_t AbsPixeltoY(Int_t py)=0
virtual Double_t GetUymin() const=0
virtual Int_t GetEvent() const=0
virtual Double_t GetUxmin() const=0
virtual void SetLogy(Int_t value=1)=0
virtual Int_t GetEventY() const=0
void Clear(Option_t *option="") override=0
TLine * line
RVec< PromoteType< T > > abs(const RVec< T > &v)
const Int_t n
void update(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData, double factorWeightDecay, EnumRegularization regularization)
Double_t Min(Double_t a, Double_t b)
Int_t Nint(T x)
Double_t Sign(Double_t a, Double_t b)
Double_t ATan(Double_t)
constexpr Double_t DegToRad()
Double_t Abs(Double_t d)
Double_t Max(Double_t a, Double_t b)
TString fRealName
m SetMarkerColor(kBlue)
TMarker m
TArc a
ClassImp(TPyArg)