10#define ProofSimple_cxx
36ProofSimple::ProofSimple()
54ProofSimple::~ProofSimple()
66void ProofSimple::Begin(
TTree * )
76 if (fInput->FindObject(
"ProofSimple_NHist")) {
86 Abort(
"fNhist must be > 0! Hint: proof->SetParameter(\"ProofSimple_NHist\","
87 " (Long_t) <nhist>)", kAbortProcess);
91 if (fInput->FindObject(
"ProofSimple_NHist3")) {
102 TNamed *nm =
dynamic_cast<TNamed *
>(fInput->FindObject(
"ProofSimple_Ntuple"));
117 if (
ontp.Contains(
"|plot") ||
ontp ==
"plot") {
119 ontp.ReplaceAll(
"|plot",
"");
127void ProofSimple::SlaveBegin(
TTree * )
137 if (fInput->FindObject(
"ProofSimple_NHist")) {
147 Abort(
"fNhist must be > 0! Hint: proof->SetParameter(\"ProofSimple_NHist\","
148 " (Long_t) <nhist>)", kAbortProcess);
157 fHist[i] =
new TH1F(
hn.Data(),
hn.Data(), 100, -3., 3.);
158 fHist[i]->SetFillColor(
kRed);
159 fOutput->Add(fHist[i]);
163 if (fInput->FindObject(
"ProofSimple_NHist3")) {
174 Info(
"Begin",
"%d 3D histograms requested",
fNhist3);
179 100, -3., 3., 100, -3., 3., 100, -3., 3.);
185 if (fInput->FindObject(
"ProofSimple_TestLabelMerging")) {
186 fHLab =
new TH1F(
"hlab",
"Test merging of histograms with automatic labels", 10, 0., 10.);
191 TNamed *nm =
dynamic_cast<TNamed *
>(fInput->FindObject(
"ProofSimple_Ntuple"));
206 if (
ontp.Contains(
"|plot") ||
ontp ==
"plot") {
208 ontp.ReplaceAll(
"|plot",
"");
212 if (
ontp.BeginsWith(
"merge")) {
213 ontp.Replace(0,5,
"");
230 if (!
ontp.IsNull()) {
237 }
else if (
ontp.BeginsWith(
"dataset")) {
238 ontp.Replace(0,7,
"");
246 }
else if (!
ontp.IsNull()) {
247 Warning(
"SlaveBegin",
"ntuple options unknown: ignored (%s)",
ontp.Data());
254 if (fFile && fFile->IsZombie())
SafeDelete(fFile);
258 Info(
"SlaveBegin",
"could not create '%s': instance is invalid!",
fProofFile->GetName());
264 fNtp =
new TNtuple(
"ntuple",
"Demo ntuple",
"px:py:pz:random:i");
267 fNtp->SetDirectory(fFile);
300 if (fRandom && fHist[i]) {
306 if (fRandom &&
fHist3[i]) {
311 if (
fHLab && fRandom) {
314 fRandom->RndmArray(10,
rr);
315 for (
Int_t i=0; i < 10; i++) {
355 fRandom->Rannor(px,py);
358 Abort(
"no way to get random numbers! Stop processing", kAbortProcess);
370void ProofSimple::SlaveTerminate()
379 Error(
"SlaveTerminate",
"'ntuple' is undefined!");
384 if (
fNtp->GetEntries() > 0) {
392 fNtp->SetDirectory(
nullptr);
397 TUrl uf(*(fFile->GetEndpointUrl()));
406void ProofSimple::Terminate()
420 c1 =
new TCanvas(
"c1",
"Proof ProofSimple canvas",200,10,700,700);
439 Warning(
"Terminate",
"histograms not found");
453 for (
Int_t i = 0; i <
nb; i++) {
459 Warning(
"Terminate",
"no entries in the hlab histogram!");
469 dynamic_cast<TProofOutputFile*
>(fOutput->FindObject(
"SimpleNtuple.root")))) {
487 Error(
"Terminate",
"TProofOutputFile not found");
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");
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");
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");
554 if (
strcmp(
fc->ClassName(),
"TFileCollection"))
continue;
558 for (
Int_t i = 0; i <
fNhist; i++) { fHist[i] =
nullptr; }
574 fHist[i] = (
TH1F *)
h->Clone();
575 fHist[i]->SetDirectory(
nullptr);
580 Error(
"GetHistosFromFC",
"histo '%s' not found in file '%s'",
581 hn.Data(),
fi->GetCurrentUrl()->GetUrl());
586 Error(
"GetHistosFromFC",
"file '%s' could not be open",
fi->GetCurrentUrl()->GetUrl());
597 fHist[i]->DrawCopy();
600 Info(
"GetHistosFromFC",
"histograms read from %d files in TFileCollection '%s'",
601 fc->GetList()->GetSize(),
fc->GetName());
Selector to fill a set of histograms.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
R__EXTERN TSystem * gSystem
Describe directory structure in memory.
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
Class describing a generic file including meta information.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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.
1-D histogram with a float per channel (see TH1 documentation)
3-D histogram with a float per channel (see TH1 documentation)
The TNamed class is the base class for all named ROOT classes.
const char * GetTitle() const override
Returns title of object.
A simple TTree restricted to a list of float variables only.
The most important graphics class in the ROOT system.
A Pave (see TPave) with text, lines or/and boxes inside.
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()).
Random number generator class based on M.
A sorted doubly linked list.
Int_t Atoi() const
Return integer value of string.
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual int Unlink(const char *name)
Unlink, i.e.
A TTree represents a columnar dataset.
This class represents a WWW compatible URL.
const char * GetFile() const
Double_t Sqrt(Double_t x)
Returns the square root of x.