Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ProofSimple.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_ProofSimple
3///
4/// Selector to fill a set of histograms
5///
6/// \macro_code
7///
8/// \author Gerardo Ganis (gerardo.ganis@cern.ch)
9
10#define ProofSimple_cxx
11
12#include "ProofSimple.h"
13#include <TCanvas.h>
14#include <TFrame.h>
15#include <TPaveText.h>
16#include <TFormula.h>
17#include <TF1.h>
18#include <TH1F.h>
19#include <TH3F.h>
20#include <TMath.h>
21#include <TRandom3.h>
22#include <TString.h>
23#include <TStyle.h>
24#include <TSystem.h>
25#include <TParameter.h>
26#include <TSortedList.h>
27#include "TProof.h"
28#include <TFile.h>
29#include <TProofOutputFile.h>
30#include <TNtuple.h>
31#include <TFileCollection.h>
32#include <TFileInfo.h>
33#include <THashList.h>
34
35//_____________________________________________________________________________
36ProofSimple::ProofSimple()
37{
38 // Constructor
39
40 fNhist = -1;
41 fHist = 0;
42 fNhist3 = -1;
43 fHist3 = 0;
44 fRandom = 0;
45 fHLab = 0;
46 fFile = 0;
47 fProofFile = 0;
48 fNtp = 0;
49 fHasNtuple = 0;
50 fPlotNtuple = kFALSE;
51}
52
53//_____________________________________________________________________________
54ProofSimple::~ProofSimple()
55{
56 // Destructor
57
58 if (fFile) {
59 SafeDelete(fNtp);
60 SafeDelete(fFile);
61 }
62 SafeDelete(fRandom);
63}
64
65//_____________________________________________________________________________
66void ProofSimple::Begin(TTree * /*tree*/)
67{
68 // The Begin() function is called at the start of the query.
69 // When running with PROOF Begin() is only called on the client.
70 // The tree argument is deprecated (on PROOF 0 is passed).
71
72 TString option = GetOption();
73 Ssiz_t iopt = kNPOS;
74
75 // Histos array
76 if (fInput->FindObject("ProofSimple_NHist")) {
78 dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist"));
79 fNhist = (p) ? (Int_t) p->GetVal() : fNhist;
80 } else if ((iopt = option.Index("nhist=")) != kNPOS) {
81 TString s;
82 Ssiz_t from = iopt + strlen("nhist=");
83 if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist = s.Atoi();
84 }
85 if (fNhist < 1) {
86 Abort("fNhist must be > 0! Hint: proof->SetParameter(\"ProofSimple_NHist\","
87 " (Long_t) <nhist>)", kAbortProcess);
88 return;
89 }
90
91 if (fInput->FindObject("ProofSimple_NHist3")) {
93 dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist3"));
94 fNhist3 = (p) ? (Int_t) p->GetVal() : fNhist3;
95 } else if ((iopt = option.Index("nhist3=")) != kNPOS) {
96 TString s;
97 Ssiz_t from = iopt + strlen("nhist3=");
98 if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist3 = s.Atoi();
99 }
100
101 // Ntuple
102 TNamed *nm = dynamic_cast<TNamed *>(fInput->FindObject("ProofSimple_Ntuple"));
103 if (nm) {
104
105 // Title is in the form
106 // merge merge via file
107 // |<fout> location of the output file if merge
108 // |retrieve retrieve to client machine
109 // dataset create a dataset
110 // |<dsname> dataset name (default: dataset_ntuple)
111 // |plot for a final plot
112 // <empty> or other keep in memory
113
114 fHasNtuple = 1;
115
116 TString ontp(nm->GetTitle());
117 if (ontp.Contains("|plot") || ontp == "plot") {
118 fPlotNtuple = kTRUE;
119 ontp.ReplaceAll("|plot", "");
120 if (ontp == "plot") ontp = "";
121 }
122 if (ontp.BeginsWith("dataset")) fHasNtuple = 2;
123 }
124}
125
126//_____________________________________________________________________________
127void ProofSimple::SlaveBegin(TTree * /*tree*/)
128{
129 // The SlaveBegin() function is called after the Begin() function.
130 // When running with PROOF SlaveBegin() is called on each slave server.
131 // The tree argument is deprecated (on PROOF 0 is passed).
132
133 TString option = GetOption();
134 Ssiz_t iopt = kNPOS;
135
136 // Histos array
137 if (fInput->FindObject("ProofSimple_NHist")) {
139 dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist"));
140 fNhist = (p) ? (Int_t) p->GetVal() : fNhist;
141 } else if ((iopt = option.Index("nhist=")) != kNPOS) {
142 TString s;
143 Ssiz_t from = iopt + strlen("nhist=");
144 if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist = s.Atoi();
145 }
146 if (fNhist < 1) {
147 Abort("fNhist must be > 0! Hint: proof->SetParameter(\"ProofSimple_NHist\","
148 " (Long_t) <nhist>)", kAbortProcess);
149 return;
150 }
151 fHist = new TH1F*[fNhist];
152
153 TString hn;
154 // Create the histogram
155 for (Int_t i=0; i < fNhist; i++) {
156 hn.Form("h%d",i);
157 fHist[i] = new TH1F(hn.Data(), hn.Data(), 100, -3., 3.);
158 fHist[i]->SetFillColor(kRed);
159 fOutput->Add(fHist[i]);
160 }
161
162 // 3D Histos array
163 if (fInput->FindObject("ProofSimple_NHist3")) {
165 dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist3"));
166 fNhist3 = (p) ? (Int_t) p->GetVal() : fNhist3;
167 } else if ((iopt = option.Index("nhist3=")) != kNPOS) {
168 TString s;
169 Ssiz_t from = iopt + strlen("nhist3=");
170 if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist3 = s.Atoi();
171 }
172 if (fNhist3 > 0) {
173 fHist3 = new TH3F*[fNhist3];
174 Info("Begin", "%d 3D histograms requested", fNhist3);
175 // Create the 3D histogram
176 for (Int_t i=0; i < fNhist3; i++) {
177 hn.Form("h%d_3d",i);
178 fHist3[i] = new TH3F(hn.Data(), hn.Data(),
179 100, -3., 3., 100, -3., 3., 100, -3., 3.);
180 fOutput->Add(fHist3[i]);
181 }
182 }
183
184 // Histo with labels
185 if (fInput->FindObject("ProofSimple_TestLabelMerging")) {
186 fHLab = new TH1F("hlab", "Test merging of histograms with automatic labels", 10, 0., 10.);
187 fOutput->Add(fHLab);
188 }
189
190 // Ntuple
191 TNamed *nm = dynamic_cast<TNamed *>(fInput->FindObject("ProofSimple_Ntuple"));
192 if (nm) {
193
194 // Title is in the form
195 // merge merge via file
196 // |<fout> location of the output file if merge
197 // |retrieve retrieve to client machine
198 // dataset create a dataset
199 // |<dsname> dataset name (default: dataset_ntuple)
200 // |plot for a final plot
201 // <empty> or other keep in memory
202
203 fHasNtuple = 1;
204
205 TString ontp(nm->GetTitle());
206 if (ontp.Contains("|plot") || ontp == "plot") {
207 fPlotNtuple = kTRUE;
208 ontp.ReplaceAll("|plot", "");
209 if (ontp == "plot") ontp = "";
210 }
211 TString locfn("SimpleNtuple.root");
212 if (ontp.BeginsWith("merge")) {
213 ontp.Replace(0,5,"");
214 fProofFile = new TProofOutputFile(locfn, "M");
215 TString fn;
216 Ssiz_t iret = ontp.Index("|retrieve");
217 if (iret != kNPOS) {
218 fProofFile->SetRetrieve(kTRUE);
219 TString rettag("|retrieve");
220 if ((iret = ontp.Index("|retrieve=")) != kNPOS) {
221 rettag += "=";
222 fn = ontp(iret + rettag.Length(), ontp.Length() - iret - rettag.Length());
223 if ((iret = fn.Index('|')) != kNPOS) fn.Remove(iret);
224 rettag += fn;
225 }
226 ontp.ReplaceAll(rettag, "");
227 }
228 Ssiz_t iof = ontp.Index('|');
229 if (iof != kNPOS) ontp.Remove(0, iof + 1);
230 if (!ontp.IsNull()) {
231 fProofFile->SetOutputFileName(ontp.Data());
232 if (fn.IsNull()) fn = gSystem->BaseName(TUrl(ontp.Data(), kTRUE).GetFile());
233 }
234 if (fn.IsNull()) fn = locfn;
235 // This will be the final file on the client, the case there is one
236 fProofFile->SetTitle(fn);
237 } else if (ontp.BeginsWith("dataset")) {
238 ontp.Replace(0,7,"");
239 Ssiz_t iof = ontp.Index("|");
240 if (iof != kNPOS) ontp.Remove(0, iof + 1);
241 TString dsname = (!ontp.IsNull()) ? ontp.Data() : "dataset_ntuple";
243 fProofFile = new TProofOutputFile("SimpleNtuple.root",
244 TProofOutputFile::kDataset, opt, dsname.Data());
245 fHasNtuple = 2;
246 } else if (!ontp.IsNull()) {
247 Warning("SlaveBegin", "ntuple options unknown: ignored (%s)", ontp.Data());
248 }
249
250 // Open the file, if required
251 if (fProofFile) {
252 // Open the file
253 fFile = fProofFile->OpenFile("RECREATE");
254 if (fFile && fFile->IsZombie()) SafeDelete(fFile);
255
256 // Cannot continue
257 if (!fFile) {
258 Info("SlaveBegin", "could not create '%s': instance is invalid!", fProofFile->GetName());
259 return;
260 }
261 }
262
263 // Now we create the ntuple
264 fNtp = new TNtuple("ntuple","Demo ntuple","px:py:pz:random:i");
265 // File resident, if required
266 if (fFile) {
267 fNtp->SetDirectory(fFile);
268 fNtp->AutoSave();
269 } else {
270 fOutput->Add(fNtp);
271 }
272 }
273
274 // Set random seed
275 fRandom = new TRandom3(0);
276}
277
278//_____________________________________________________________________________
279Bool_t ProofSimple::Process(Long64_t entry)
280{
281 // The Process() function is called for each entry in the tree (or possibly
282 // keyed object in the case of PROOF) to be processed. The entry argument
283 // specifies which entry in the currently loaded tree is to be processed.
284 // It can be passed to either ProofSimple::GetEntry() or TBranch::GetEntry()
285 // to read either all or the required parts of the data. When processing
286 // keyed objects with PROOF, the object is already loaded and is available
287 // via the fObject pointer.
288 //
289 // This function should contain the "body" of the analysis. It can contain
290 // simple or elaborate selection criteria, run algorithms on the data
291 // of the event and typically fill histograms.
292 //
293 // The processing can be stopped by calling Abort().
294 //
295 // Use fStatus to set the return value of TTree::Process().
296 //
297 // The return value is currently not used.
298
299 for (Int_t i=0; i < fNhist; i++) {
300 if (fRandom && fHist[i]) {
301 Double_t x = fRandom->Gaus(0.,1.);
302 fHist[i]->Fill(x);
303 }
304 }
305 for (Int_t i=0; i < fNhist3; i++) {
306 if (fRandom && fHist3[i]) {
307 Double_t x = fRandom->Gaus(0.,1.);
308 fHist3[i]->Fill(x,x,x);
309 }
310 }
311 if (fHLab && fRandom) {
312 TSortedList sortl;
313 Float_t rr[10];
314 fRandom->RndmArray(10, rr);
315 for (Int_t i=0; i < 10; i++) {
316 sortl.Add(new TParameter<Int_t>(TString::Format("%f",rr[i]), i));
317 }
318 TIter nxe(&sortl);
319 TParameter<Int_t> *pi = 0;
320 while ((pi = (TParameter<Int_t> *) nxe())) {
321 fHLab->Fill(TString::Format("hl%d", pi->GetVal()), pi->GetVal());
322 }
323 }
324 if (fNtp) FillNtuple(entry);
325
326 return kTRUE;
327}
328
329//_____________________________________________________________________________
330void ProofSimple::FillNtuple(Long64_t entry)
331{
332 // The Process() function is called for each entry in the tree (or possibly
333 // keyed object in the case of PROOF) to be processed. The entry argument
334 // specifies which entry in the currently loaded tree is to be processed.
335 // It can be passed to either ProofNtuple::GetEntry() or TBranch::GetEntry()
336 // to read either all or the required parts of the data. When processing
337 // keyed objects with PROOF, the object is already loaded and is available
338 // via the fObject pointer.
339 //
340 // This function should contain the "body" of the analysis. It can contain
341 // simple or elaborate selection criteria, run algorithms on the data
342 // of the event and typically fill histograms.
343 //
344 // The processing can be stopped by calling Abort().
345 //
346 // Use fStatus to set the return value of TTree::Process().
347 //
348 // The return value is currently not used.
349
350 if (!fNtp) return;
351
352 // Fill ntuple
353 Float_t px, py, random;
354 if (fRandom) {
355 fRandom->Rannor(px,py);
356 random = fRandom->Rndm();
357 } else {
358 Abort("no way to get random numbers! Stop processing", kAbortProcess);
359 return;
360 }
361 Float_t pz = px*px + py*py;
362 Int_t i = (Int_t) entry;
363 fNtp->Fill(px,py,pz,random,i);
364
365 return;
366}
367
368
369//_____________________________________________________________________________
370void ProofSimple::SlaveTerminate()
371{
372 // The SlaveTerminate() function is called after all entries or objects
373 // have been processed. When running with PROOF SlaveTerminate() is called
374 // on each slave server.
375
376 // Write the ntuple to the file
377 if (fFile) {
378 if (!fNtp) {
379 Error("SlaveTerminate", "'ntuple' is undefined!");
380 return;
381 }
383 TDirectory *savedir = gDirectory;
384 if (fNtp->GetEntries() > 0) {
385 fFile->cd();
386 fNtp->Write();
387 fProofFile->Print();
388 fOutput->Add(fProofFile);
389 } else {
390 cleanup = kTRUE;
391 }
392 fNtp->SetDirectory(0);
393 gDirectory = savedir;
394 fFile->Close();
395 // Cleanup, if needed
396 if (cleanup) {
397 TUrl uf(*(fFile->GetEndpointUrl()));
398 SafeDelete(fFile);
399 gSystem->Unlink(uf.GetFile());
400 SafeDelete(fProofFile);
401 }
402 }
403}
404
405//_____________________________________________________________________________
406void ProofSimple::Terminate()
407{
408 // The Terminate() function is the last function to be called during
409 // a query. It always runs on the client, it can be used to present
410 // the results graphically or save the results to file.
411
412 //
413 // Create a canvas, with 100 pads
414 //
415 TCanvas *c1 = (TCanvas *) gDirectory->FindObject("c1");
416 if (c1) {
417 gDirectory->Remove(c1);
418 delete c1;
419 }
420 c1 = new TCanvas("c1","Proof ProofSimple canvas",200,10,700,700);
421 Int_t nside = (Int_t)TMath::Sqrt((Float_t)fNhist);
422 nside = (nside*nside < fNhist) ? nside+1 : nside;
423 c1->Divide(nside,nside,0,0);
424
425 Bool_t tryfc = kFALSE;
426 TH1F *h = 0;
427 for (Int_t i=0; i < fNhist; i++) {
428 if (!(h = dynamic_cast<TH1F *>(TProof::GetOutput(Form("h%d",i), fOutput)))) {
429 // Not found: try TFileCollection
430 tryfc = kTRUE;
431 break;
432 }
433 c1->cd(i+1);
434 h->DrawCopy();
435 }
436
437 // If the histograms are not found they may be in files: is there a file collection?
438 if (tryfc && GetHistosFromFC(c1) != 0) {
439 Warning("Terminate", "histograms not found");
440 } else {
441 // Final update
442 c1->cd();
443 c1->Update();
444 }
445
446 // Analyse hlab, if there
447 if (fHLab && !gROOT->IsBatch()) {
448 // Printout
449 Int_t nb = fHLab->GetNbinsX();
450 if (nb > 0) {
451 Double_t entb = fHLab->GetEntries() / nb;
452 if (entb) {
453 for (Int_t i = 0; i < nb; i++) {
454 TString lab = TString::Format("hl%d", i);
455 Int_t ib = fHLab->GetXaxis()->FindBin(lab);
456 Info("Terminate"," %s [%d]:\t%f", lab.Data(), ib, fHLab->GetBinContent(ib)/entb);
457 }
458 } else
459 Warning("Terminate", "no entries in the hlab histogram!");
460 }
461 }
462
463 // Process the ntuple, if required
464 if (fHasNtuple != 1 || !fPlotNtuple) return;
465
466 if (!(fNtp = dynamic_cast<TNtuple *>(TProof::GetOutput("ntuple", fOutput)))) {
467 // Get the ntuple from the file
468 if ((fProofFile =
469 dynamic_cast<TProofOutputFile*>(fOutput->FindObject("SimpleNtuple.root")))) {
470
471 TString outputFile(fProofFile->GetOutputFileName());
472 TString outputName(fProofFile->GetName());
473 outputName += ".root";
474 Printf("outputFile: %s", outputFile.Data());
475
476 // Read the ntuple from the file
477 fFile = TFile::Open(outputFile);
478 if (fFile) {
479 Printf("Managed to open file: %s", outputFile.Data());
480 fNtp = (TNtuple *) fFile->Get("ntuple");
481 } else {
482 Error("Terminate", "could not open file: %s", outputFile.Data());
483 }
484 if (!fFile) return;
485
486 } else {
487 Error("Terminate", "TProofOutputFile not found");
488 return;
489 }
490 }
491 // Plot ntuples
492 if (fNtp) PlotNtuple(fNtp, "proof ntuple");
493}
494
495//_____________________________________________________________________________
496void ProofSimple::PlotNtuple(TNtuple *ntp, const char *ntptitle)
497{
498 // Make some plots from the ntuple 'ntp'
499
500 //
501 // Create a canvas, with 2 pads
502 //
503 TCanvas *c1 = new TCanvas(Form("cv-%s", ntp->GetName()), ntptitle,800,10,700,780);
504 c1->Divide(1,2);
505 TPad *pad1 = (TPad *) c1->GetPad(1);
506 TPad *pad2 = (TPad *) c1->GetPad(2);
507 //
508 // Display a function of one ntuple column imposing a condition
509 // on another column.
510 pad1->cd();
511 pad1->SetGrid();
512 pad1->SetLogy();
513 pad1->GetFrame()->SetFillColor(15);
514 ntp->SetLineColor(1);
515 ntp->SetFillStyle(1001);
516 ntp->SetFillColor(45);
517 ntp->Draw("3*px+2","px**2+py**2>1");
518 ntp->SetFillColor(38);
519 ntp->Draw("2*px+2","pz>2","same");
520 ntp->SetFillColor(5);
521 ntp->Draw("1.3*px+2","(px^2+py^2>4) && py>0","same");
522 pad1->RedrawAxis();
523
524 //
525 // Display a 3-D scatter plot of 3 columns. Superimpose a different selection.
526 pad2->cd();
527 ntp->Draw("pz:py:px","(pz<10 && pz>6)+(pz<4 && pz>3)");
528 ntp->SetMarkerColor(4);
529 ntp->Draw("pz:py:px","pz<6 && pz>4","same");
530 ntp->SetMarkerColor(5);
531 ntp->Draw("pz:py:px","pz<4 && pz>3","same");
532 TPaveText *l2 = new TPaveText(0.,0.6,0.9,0.95);
533 l2->SetFillColor(42);
534 l2->SetTextAlign(12);
535 l2->AddText("You can interactively rotate this view in 2 ways:");
536 l2->AddText(" - With the RotateCube in clicking in this pad");
537 l2->AddText(" - Selecting View with x3d in the View menu");
538 l2->Draw();
539
540 // Final update
541 c1->cd();
542 c1->Update();
543}
544
545//_____________________________________________________________________________
546Int_t ProofSimple::GetHistosFromFC(TCanvas *cv)
547{
548 // Check for the histograms in the files of a possible TFileCollection
549
550 TIter nxo(fOutput);
551 TFileCollection *fc = 0;
552 Bool_t fc_found = kFALSE, hs_found = kFALSE;
553 while ((fc = (TFileCollection *) nxo())) {
554 if (strcmp(fc->ClassName(), "TFileCollection")) continue;
555 fc_found = kTRUE;
556 if (!fHist) {
557 fHist = new TH1F*[fNhist];
558 for (Int_t i = 0; i < fNhist; i++) { fHist[i] = 0; }
559 } else {
560 for (Int_t i = 0; i < fNhist; i++) { SafeDelete(fHist[i]); }
561 }
562 // Go through the list of files
563 TIter nxf(fc->GetList());
564 TFileInfo *fi = 0;
565 while ((fi = (TFileInfo *) nxf())) {
567 if (f) {
568 for (Int_t i = 0; i < fNhist; i++) {
569 TString hn = TString::Format("h%d", i);
570 TH1F *h = (TH1F *) f->Get(hn);
571 if (h) {
572 hs_found = kTRUE;
573 if (!fHist[i]) {
574 fHist[i] = (TH1F *) h->Clone();
575 fHist[i]->SetDirectory(0);
576 } else {
577 fHist[i]->Add(h);
578 }
579 } else {
580 Error("GetHistosFromFC", "histo '%s' not found in file '%s'",
581 hn.Data(), fi->GetCurrentUrl()->GetUrl());
582 }
583 }
584 f->Close();
585 } else {
586 Error("GetHistosFromFC", "file '%s' could not be open", fi->GetCurrentUrl()->GetUrl());
587 }
588 }
589 if (hs_found) break;
590 }
591 if (!fc_found) return -1;
592 if (!hs_found) return -1;
593
594 for (Int_t i = 0; i < fNhist; i++) {
595 cv->cd(i+1);
596 if (fHist[i]) {
597 fHist[i]->DrawCopy();
598 }
599 }
600 Info("GetHistosFromFC", "histograms read from %d files in TFileCollection '%s'",
601 fc->GetList()->GetSize(), fc->GetName());
602 // Done
603 return 0;
604}
Selector to fill a set of histograms.
#define SafeDelete(p)
Definition RConfig.hxx:540
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
static void cleanup()
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
int Ssiz_t
Definition RtypesCore.h:67
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:124
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ kRed
Definition Rtypes.h:66
#define gDirectory
Definition TDirectory.h:386
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:230
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:197
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:241
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
#define gROOT
Definition TROOT.h:405
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2467
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Definition TString.cxx:2481
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:39
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition TAttMarker.h:38
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition TAttText.h:42
The Canvas class.
Definition TCanvas.h:23
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
Definition TCanvas.cxx:714
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
virtual Bool_t cd()
Change current directory to "this" directory.
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
THashList * GetList()
Class describing a generic file including meta information.
Definition TFileInfo.h:39
TUrl * GetCurrentUrl() const
Return the current url.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:51
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:4053
1-D histogram with a float per channel (see TH1 documentation)}
Definition TH1.h:577
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
Definition TH1.cxx:3107
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
Definition TH1.cxx:2727
3-D histogram with a float per channel (see TH1 documentation)}
Definition TH3.h:268
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
A simple TTree restricted to a list of float variables only.
Definition TNtuple.h:28
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:207
The most important graphics class in the ROOT system.
Definition TPad.h:28
void SetGrid(Int_t valuex=1, Int_t valuey=1) override
Definition TPad.h:330
void SetLogy(Int_t value=1) override
Set Lin/Log scale for Y.
Definition TPad.cxx:5934
void RedrawAxis(Option_t *option="") override
Redraw the frame axis.
Definition TPad.cxx:5297
TObject * FindObject(const char *name) const override
Search if object named name is inside this pad or in pads inside this pad.
Definition TPad.cxx:2595
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:597
TFrame * GetFrame() override
Get frame.
Definition TPad.cxx:2831
TVirtualPad * GetPad(Int_t subpadnumber) const override
Get a pointer to subpadnumber of this pad.
Definition TPad.cxx:2876
Named parameter, streamable and storable.
Definition TParameter.h:35
const AParamType & GetVal() const
Definition TParameter.h:67
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
Class to steer the merging of files produced on the workers.
TObject * GetOutput(const char *name)
Get specified object that has been produced during the processing (see Process()).
Definition TProof.cxx:9762
Random number generator class based on M.
Definition TRandom3.h:27
A sorted doubly linked list.
Definition TSortedList.h:28
void Add(TObject *obj) override
Add object in sorted list.
Basic string class.
Definition TString.h:139
Int_t Atoi() const
Return integer value of string.
Definition TString.cxx:1966
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Definition TString.h:694
const char * Data() const
Definition TString.h:380
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition TString.cxx:1808
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
Bool_t IsNull() const
Definition TString.h:418
TString & Remove(Ssiz_t pos)
Definition TString.h:685
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2356
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2334
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:937
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1384
A TTree represents a columnar dataset.
Definition TTree.h:79
void Draw(Option_t *opt) override
Default Draw method for all objects.
Definition TTree.h:428
This class represents a WWW compatible URL.
Definition TUrl.h:33
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition TUrl.cxx:390
const char * GetFile() const
Definition TUrl.h:69
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:660