14 #include "TSpectrum.h"
17 #include "TVirtualFitter.h"
18 #include "TPavesText.h"
21 #include "BashColor.h"
34 ListOfCurrentGraphs(new TList()),
56 for(
int i=0 ; i<
fNLib ; i++)
61 l->SetName(Form(
"Lib_%d",i));
63 for(
int j=0 ; j<
fNSg+1 ; j++)
91 TString opt = (TString)option;
93 if(opt.Contains(
"a",TString::kIgnoreCase))
96 TString Title =
"Mapping of the signals for crystal " +
fCrystalName;
103 fCanvas->Connect(
"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
106 "HandleMovement(Int_t, Int_t, Int_t, TObject*)");
109 else fCanvas = gPad->GetCanvas();
118 for(
int i=0 ; i<
fNSg+1 ; i++)
126 if(Myg==0x0)
continue;
128 TGraph *graph = (TGraph*)Myg->
GetGraph();
130 TPaveText *p = (TPaveText*)pad->GetListOfPrimitives()->FindObject(
"InfoPad");
131 MyGraph *OldGraph = (
MyGraph*)pad->GetListOfPrimitives()->FindObject(Myg->GetName());
132 if(p) pad->GetListOfPrimitives()->Remove(p);
137 pad->GetListOfPrimitives()->Remove(OldGraph);
140 if(graph==0x0)
continue;
143 for(
int k=0 ; k<pad->GetListOfPrimitives()->GetSize() ; k++)
145 if(pad->GetListOfPrimitives()->At(k)->InheritsFrom(
"MyGraph"))col++;
155 if(!redraw)this->
UpdateGraphs(Form(
"Init_%d",LibraryNbr));
166 double MinY = 100000., MaxY = -100000;
167 double MinX = 100000., MaxX = -100000;
169 bool OnlySeg =
false;
171 TString OptToToken = opt;
172 TObjArray *token = OptToToken.Tokenize(
" ");
173 TObject *an_obj = 0x0;
175 while ( (an_obj = it.Next()) )
177 TString Name = an_obj->GetName();
178 if(Name.Contains(
"seg")) OnlySeg =
true;
183 TPad *CurrentPad = (TPad*)
fCanvas->cd(i);
185 TPaveText *t = (TPaveText*)gPad->FindObject(
"InfoPad");
187 else if(((TString)t->GetLine(1)->GetTitle()).Contains(
"Core") && OnlySeg)
continue;
189 TIter iter((TList*)CurrentPad->GetListOfPrimitives());
192 while( (o = iter()) )
194 if(o->InheritsFrom(
"MyGraph"))
196 graph = ((
MyGraph*)o)->GetGraph();
203 for(
int j=0 ; j<graph->GetN() ; j++)
205 if(x[j]<MinX) MinX = x[j];
206 if(x[j]>MaxX) MaxX = x[j];
207 if(y[j]<MinY) MinY = y[j];
208 if(y[j]>MaxY) MaxY = y[j];
214 if(opt.Contains(
"y"))
216 double shift = TMath::Abs((MaxY-MinY)*0.05);
217 SetRange(MinY-shift,MaxY+shift,
"y");
219 if(opt.Contains(
"x"))
SetRange(MinX,MaxX,
"x");
250 TString opt = (TString)option;
252 for(
int i=0 ; i<
fNLib ; i++)
254 for(
int j=0 ; j<
fNSg+1 ; j++)
260 if(NewGraph == 0x0 || myg == 0x0)
continue;
262 if(opt == Form(
"Init_%d",i))
267 if(this->InheritsFrom(
"SignalWatcherTracesPsa") && i==1) myg->
SetLS(2);
272 NewGraph->GetXaxis()->SetLabelSize(0.07);
273 NewGraph->GetYaxis()->SetLabelSize(0.07);
275 NewGraph->SetLineColor(myg->GetLineColor());
276 NewGraph->SetLineStyle(myg->GetLineStyle());
277 NewGraph->SetLineWidth(myg->GetLineWidth());
279 NewGraph->SetMarkerColor(myg->GetMarkerColor());
280 NewGraph->SetMarkerStyle(myg->GetMarkerStyle());
281 NewGraph->SetMarkerSize(myg->GetMarkerSize());
283 NewGraph->SetFillColor(myg->GetFillColor());
284 NewGraph->SetFillStyle(myg->GetFillStyle());
298 if(XScale==0.) XScale = 1e-20;
299 if(YScale==0.) YScale = 1e-20;
301 for(
int i=0 ; i<
fNLib ; i++)
303 for(
int j=0 ; j<
fNSg+1 ; j++)
307 if(myg==0x0)
continue;
311 if(Graph==0x0)
continue;
313 double *X = Graph->GetX();
314 double *Y = Graph->GetY();
316 for(
int k=0 ; k<Graph->GetN() ; k++)
318 X[k] = XScale * (X[k] + XShift);
319 Y[k] = YScale * (Y[k] + YShift);
342 if(Store) cout<<
"Initial signal restored for wacher "<<GetName()<<
endl;
357 if( eventType == kKeyPress )
361 if(select->InheritsFrom(
"MyGraph"))
368 if((EKeySym)eventX == kKey_e && (EKeySym)eventY == kKey_e)
381 if((EKeySym)eventX == kKey_e-96 && (EKeySym)eventY == kKey_e)
383 TList *ListOfWatchers;
384 ListOfWatchers =
new TList();
385 TList *ListOfMyGraphs =
fCanvas->cd(1)->GetListOfPrimitives();
386 for(
int i=0 ; i<ListOfMyGraphs->GetSize() ; i++)
388 TObject *o = ListOfMyGraphs->At(i);
390 if(o->InheritsFrom(
"MyGraph")) MyG = (
MyGraph*)o;
391 if(MyG!=0x0 && MyG->
GetWatcher()->InheritsFrom(
"SignalWatcher") && !ListOfWatchers->FindObject(MyG->
GetWatcher())) ListOfWatchers->Add(MyG->
GetWatcher());
403 delete ListOfWatchers;
415 cout<<
"Mode Xhift activated with shift factor at "<<
fShiftFact<<
endl;
424 cout<<
"Mode YShift activated with shift factor at "<<
fShiftFact<<
endl;
448 cout<<
"Mode XScale activated with shift factor at "<<
fScaleFact<<
endl;
455 cout<<
"Mode YScale activated with shift factor at "<<
fScaleFact<<
endl;
471 if((EKeySym)eventY == kKey_m && (EKeySym)
fLasteventY == kKey_r)
477 if((EKeySym)eventX == kKey_m-96 && (EKeySym)eventY == kKey_m)
479 TList *ListOfWatchers;
480 ListOfWatchers =
new TList();
481 TList *ListOfMyGraphs =
fCanvas->cd(1)->GetListOfPrimitives();
482 for(
int i=0 ; i<ListOfMyGraphs->GetSize() ; i++)
484 TObject *o = ListOfMyGraphs->At(i);
486 if(o->InheritsFrom(
"MyGraph")) MyG = (
MyGraph*)o;
487 if(MyG!=0x0 && MyG->
GetWatcher()->InheritsFrom(
"SignalWatcher") && !ListOfWatchers->FindObject(MyG->
GetWatcher())) ListOfWatchers->Add(MyG->
GetWatcher());
494 delete ListOfWatchers;
498 if( (eventType == kWheelUp || eventType == kWheelDown ) &&
fLastSelect!=0x0 )
501 if(eventType == kWheelDown) fact = -
fShiftFact;
505 if(eventType == kWheelDown) fact = 1-
fScaleFact;
518 cout<<
"Editor mode stoped !"<<
endl;
553 graph = (TGraph*)ListOfHists->At(SegNbr);
578 graph = (TGraph*)ListOfHists->At(SegNbr);
586 TString Opt = Exp_Sim_Both;
589 TString DrawOpt = option;
623 graph = (TGraph*)ListOfHists->At(SegNbr);
631 TString Opt = Exp_Sim_Both;
634 TString DrawOpt = option;
TList * ListOfCurrentGraphs
virtual void ShiftAndScale(double XShift=0., double YShift=0., double XScale=1., double YScale=1., bool Store=true)
******************************************************************************************/// ...
virtual TGraph * GetGraph(int LibraryNbr, int SegNbr, int SigNbr)
******************************************************************************************/// ...
virtual TGraph * GetGraph(int, int, int)
vector< PadPos > fHistPositionList
SignalWatcherTracesPrepProd(const char *name, const char *title)
*/
virtual ~SignalWatcher()
******************************************************************************************/// ...
void RestoreModifs(bool Store=true)
******************************************************************************************/// ...
void SetLW(Width_t lwidth)
TList * fListOfLibrairies
virtual void ShiftX(double XShift)
virtual void PreviousEvent()
SignalWatcherTracesPsa(const char *name, const char *title)
*/
SignalWatcher(const char *name, const char *title)
*/
virtual void Exec(const char *)
******************************************************************************************/// ...
void Init()
******************************************************************************************/// ...
LoupOnPad, a class to Loupe on a Pad in a Canvas with many pads in it.
virtual void GlobalAutoRange(const char *opt="xy")
******************************************************************************************/// ...
virtual void SetRange(double min, double max, const char *x_y="x")
TCanvas * BuildSegmentedCanvas(TString CanvasName, TString CanvasTitle)
void ShowTraces(const char *option="apl", const char *Exp_Sim_Both="Both")
******************************************************************************************/// ...
virtual void ScaleY(double YScale)
SignalWatcherAverSinglesPsa(const char *name, const char *title)
*/
void ShowTraces(const char *option="apl", const char *Exp_Sim_Both="Both")
******************************************************************************************/// ...
void HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TObject *select)
******************************************************************************************/// ...
virtual TGraph * GetGraph(int LibraryNbr, int SegNbr, int SigNbr)
******************************************************************************************/// ...
virtual TGraph * GetGraph(int LibraryNbr, int SegNbr, int SigNbr)
******************************************************************************************/// ...
ADF::LogMessage & endl(ADF::LogMessage &log)
virtual void GoToEvent(int EvtNbr)
******************************************************************************************/// ...
virtual void ScaleX(double XScale)
void SetMC(Color_t mcolor)
void SetWatcher(TTask *t)
void SetLS(Style_t lstyle)
virtual void ShowSignalsMap(int LibraryNbr=0, const char *option="apl")
******************************************************************************************/// ...
void SetLC(Color_t lcolor)
SignalWatcher * fLastSelect
virtual void ShiftY(double YShift)
virtual void UpdateGraphs(const char *opt="")
******************************************************************************************/// ...
virtual void SetLoupe(bool loupeon=true)