10#define ProofNtuple_cxx
27ProofNtuple::~ProofNtuple()
38void ProofNtuple::PlotNtuple(
TNtuple *ntp,
const char *ntptitle)
59 ntp->
Draw(
"3*px+2",
"px**2+py**2>1");
61 ntp->
Draw(
"2*px+2",
"pz>2",
"same");
63 ntp->
Draw(
"1.3*px+2",
"(px^2+py^2>4) && py>0",
"same");
69 ntp->
Draw(
"pz:py:px",
"(pz<10 && pz>6)+(pz<4 && pz>3)");
71 ntp->
Draw(
"pz:py:px",
"pz<6 && pz>4",
"same");
73 ntp->
Draw(
"pz:py:px",
"pz<4 && pz>3",
"same");
77 l2->
AddText(
"You can interactively rotate this view in 2 ways:");
78 l2->
AddText(
" - With the RotateCube in clicking in this pad");
79 l2->
AddText(
" - Selecting View with x3d in the View menu");
88void ProofNtuple::Begin(
TTree * )
97 if (out) fPlotNtuple =
kFALSE;
101void ProofNtuple::SlaveBegin(
TTree * )
110 TNamed *nm =
dynamic_cast<TNamed *
>(fInput->FindObject(
"SimpleNtuple.root"));
120 Info(
"SlaveBegin",
"PROOF_OUTPUTFILE_LOCATION: %s", (out ? out->
GetTitle() :
"undef"));
123 if (out) fProofFile->SetOutputFileName(out->
GetTitle());
127 fFile = fProofFile->OpenFile(
"RECREATE");
128 if (fFile && fFile->IsZombie())
SafeDelete(fFile);
132 Info(
"SlaveBegin",
"could not create '%s': instance is invalid!", fProofFile->GetName());
137 fNtp =
new TNtuple(
"ntuple",
"Demo ntuple",
"px:py:pz:random:i");
139 fNtp->SetDirectory(fFile);
143 fNtp2 =
new TNtuple(
"ntuple2",
"Demo ntuple2",
"vx:vy:vz");
145 fNtp2->SetDirectory(fFile);
152 if (!(fNtpRndm =
dynamic_cast<TNtuple *
>(fInput->FindObject(
"NtpRndm")))) {
154 "asked to use rndm ntuple but 'NtpRndm' not found in the"
155 " input list! Using the random generator");
158 Info(
"SlaveBegin",
"taking randoms from input ntuple 'NtpRndm'");
163 if (!fNtpRndm) fRandom =
new TRandom3(0);
187 if (!fNtp)
return kTRUE;
193 Float_t *ar = fNtpRndm->GetArgs();
194 Long64_t ent = entry % fNtpRndm->GetEntries();
195 fNtpRndm->GetEntry(ent);
199 }
else if (fRandom) {
200 fRandom->Rannor(px,py);
201 random = fRandom->Rndm();
203 Abort(
"no way to get random numbers! Stop processing", kAbortProcess);
208 fNtp->Fill(px,py,pz,random,i);
210 if (!fNtp2)
return kTRUE;
214 fNtp2->Fill(px,py,vz);
220void ProofNtuple::SlaveTerminate()
229 Error(
"SlaveTerminate",
"'ntuple' is undefined!");
234 if (fNtp->GetEntries() > 0) {
239 fOutput->Add(fProofFile);
243 fNtp->SetDirectory(0);
244 if (fNtp2) fNtp2->SetDirectory(0);
249 TUrl uf(*(fFile->GetEndpointUrl()));
258void ProofNtuple::Terminate()
265 if (!fPlotNtuple)
return;
269 dynamic_cast<TProofOutputFile*
>(fOutput->FindObject(
"SimpleNtuple.root")))) {
271 TString outputFile(fProofFile->GetOutputFileName());
272 TString outputName(fProofFile->GetName());
273 outputName +=
".root";
274 Printf(
"outputFile: %s", outputFile.Data());
279 Printf(
"Managed to open file: %s", outputFile.Data());
280 fNtp = (
TNtuple *) fFile->Get(
"ntuple");
282 Error(
"Terminate",
"could not open file: %s", outputFile.Data());
287 Error(
"Terminate",
"TProofOutputFile not found");
292 if (fNtp) PlotNtuple(fNtp,
"proof ntuple");
Selector to fill a simple ntuple.
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.
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
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Describe directory structure in memory.
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.
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.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
A simple TTree restricted to a list of float variables only.
@ kOverwrite
overwrite existing object with same name
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
The most important graphics class in the ROOT system.
void SetGrid(Int_t valuex=1, Int_t valuey=1) override
void SetLogy(Int_t value=1) override
Set Lin/Log scale for Y.
void RedrawAxis(Option_t *option="") override
Redraw the frame axis.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
TFrame * GetFrame() override
Get frame.
TVirtualPad * GetPad(Int_t subpadnumber) const override
Get a pointer to subpadnumber of this pad.
A Pave (see TPave) with text, lines or/and boxes inside.
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.
Random number generator class based on M.
virtual int Unlink(const char *name)
Unlink, i.e.
A TTree represents a columnar dataset.
void Draw(Option_t *opt) override
Default Draw method for all objects.
This class represents a WWW compatible URL.
Double_t ErfInverse(Double_t x)
Returns the inverse error function.
Double_t Sqrt(Double_t x)
Returns the square root of x.