Selector to fill a simple ntuple.
#define ProofNtuple_cxx
ProofNtuple::~ProofNtuple()
{
}
void ProofNtuple::PlotNtuple(
TNtuple *ntp,
const char *ntptitle)
{
ntp->
Draw(
"3*px+2",
"px**2+py**2>1");
ntp->
Draw(
"2*px+2",
"pz>2",
"same");
ntp->
Draw(
"1.3*px+2",
"(px^2+py^2>4) && py>0",
"same");
ntp->
Draw(
"pz:py:px",
"(pz<10 && pz>6)+(pz<4 && pz>3)");
ntp->
Draw(
"pz:py:px",
"pz<6 && pz>4",
"same");
ntp->
Draw(
"pz:py:px",
"pz<4 && pz>3",
"same");
l2->
AddText(
"You can interactively rotate this view in 2 ways:");
l2->
AddText(
" - With the RotateCube in clicking in this pad");
l2->
AddText(
" - Selecting View with x3d in the View menu");
}
{
if (out) fPlotNtuple =
kFALSE;
}
void ProofNtuple::SlaveBegin(
TTree * )
{
TNamed *
nm =
dynamic_cast<TNamed *
>(fInput->FindObject(
"SimpleNtuple.root"));
} else {
Info(
"SlaveBegin",
"PROOF_OUTPUTFILE_LOCATION: %s", (out ? out->
GetTitle() :
"undef"));
if (out) fProofFile->SetOutputFileName(out->
GetTitle());
}
fFile = fProofFile->OpenFile("RECREATE");
if (fFile && fFile->IsZombie())
SafeDelete(fFile);
if (!fFile) {
Info(
"SlaveBegin",
"could not create '%s': instance is invalid!", fProofFile->GetName());
return;
}
fNtp =
new TNtuple(
"ntuple",
"Demo ntuple",
"px:py:pz:random:i");
fNtp->SetDirectory(fFile);
fNtp->AutoSave();
fNtp2 =
new TNtuple(
"ntuple2",
"Demo ntuple2",
"vx:vy:vz");
fNtp2->SetDirectory(fFile);
fNtp2->AutoSave();
if (unr) {
if (!(fNtpRndm =
dynamic_cast<TNtuple *
>(fInput->FindObject(
"NtpRndm")))) {
"asked to use rndm ntuple but 'NtpRndm' not found in the"
" input list! Using the random generator");
fInput->Print();
} else {
Info(
"SlaveBegin",
"taking randoms from input ntuple 'NtpRndm'");
}
}
if (!fNtpRndm) fRandom =
new TRandom3(0);
}
{
if (fNtpRndm) {
Long64_t ent = entry % fNtpRndm->GetEntries();
fNtpRndm->GetEntry(ent);
random = ar[0];
} else if (fRandom) {
fRandom->Rannor(px,py);
random = fRandom->Rndm();
} else {
Abort("no way to get random numbers! Stop processing", kAbortProcess);
}
fNtp->Fill(px,py,pz,random,i);
if (!fNtp2)
return kTRUE;
fNtp2->Fill(px,py,vz);
}
void ProofNtuple::SlaveTerminate()
{
if (fFile) {
if (!fNtp) {
Error(
"SlaveTerminate",
"'ntuple' is undefined!");
return;
}
if (fNtp->GetEntries() > 0) {
fFile->cd();
fProofFile->Print();
fOutput->Add(fProofFile);
} else {
}
fNtp->SetDirectory(0);
if (fNtp2) fNtp2->SetDirectory(0);
if (cleanup) {
TUrl uf(*(fFile->GetEndpointUrl()));
}
}
}
void ProofNtuple::Terminate()
{
if (!fPlotNtuple) return;
if ((fProofFile =
TString outputFile(fProofFile->GetOutputFileName());
TString outputName(fProofFile->GetName());
outputName += ".root";
Printf(
"outputFile: %s", outputFile.Data());
if (fFile) {
Printf(
"Managed to open file: %s", outputFile.Data());
fNtp = (
TNtuple *) fFile->Get(
"ntuple");
} else {
Error(
"Terminate",
"could not open file: %s", outputFile.Data());
}
if (!fFile) return;
} else {
Error(
"Terminate",
"TProofOutputFile not found");
return;
}
if (fNtp) PlotNtuple(fNtp, "proof ntuple");
}
Selector to fill a simple ntuple.
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
void Warning(const char *location, const char *msgfmt,...)
char * Form(const char *fmt,...)
void Printf(const char *fmt,...)
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.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
A simple TTree restricted to a list of float variables only.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
@ kOverwrite
overwrite existing object with same name
The most important graphics class in the ROOT system.
virtual void SetLogy(Int_t value=1)
Set Lin/Log scale for Y.
virtual void RedrawAxis(Option_t *option="")
Redraw the frame axis Redrawing axis may be necessary in case of superimposed histograms when one or ...
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
TFrame * GetFrame()
Get frame.
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.
virtual void Draw(Option_t *option="")
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.
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
This class represents a WWW compatible URL.
static constexpr double nm
Double_t ErfInverse(Double_t x)
returns the inverse error function x must be <-1<x<1
Double_t Sqrt(Double_t x)