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");
}
void ProofNtuple::Begin(
TTree * )
{
if (out) fPlotNtuple =
kFALSE;
}
void ProofNtuple::SlaveBegin(
TTree * )
{
TNamed *nm =
dynamic_cast<TNamed *
>(fInput->FindObject(
"SimpleNtuple.root"));
if (nm) {
} 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) {
fProofFile->Print();
fOutput->Add(fProofFile);
} else {
}
fNtp->SetDirectory(0);
if (fNtp2) fNtp2->SetDirectory(0);
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,...)
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.