Selector used for auxiliary actions in the PROOF tutorials.
#define ProofAux_cxx
ProofAux::ProofAux()
{
fAction = -1;
fNEvents= -1;
fMainList = 0;
fFriendList = 0;
fDir = "";
}
ProofAux::~ProofAux()
{
}
{
if (ntype) {
if (act == "GenerateTreesSameFile") {
action = 1;
} else if (act.BeginsWith("GenerateTrees")) {
action = 0;
action = 2;
act.Remove(0, icol+1);
if (!act.IsNull()) fDir = act;
}
} else {
}
}
return action;
}
void ProofAux::Begin(
TTree * )
{
}
void ProofAux::SlaveBegin(
TTree * )
{
fAction = GetAction(fInput);
if (
a) fNEvents =
a->GetVal();
if (fAction < 2) {
}
}
{
if (fAction < 0) {
Error(
"Process",
"action not specified!");
}
if (fInput && (elemPair =
dynamic_cast<TPair *
>(fInput->FindObject(
"PROOF_CurrentElement")))) {
Info(
"Process",
"entry %lld: file: '%s'", entry, fCurrent->
GetName());
} else {
Error(
"Process",
"entry %lld: no file specified!", entry);
}
}
if (fAction == 0) {
if (GenerateTree(fCurrent->
GetName(), fNEvents, fnt) != 0) {
Error(
"Process",
"problems generating tree (%lld, %s, %lld)",
entry, fCurrent->
GetName(), fNEvents);
}
} else {
} else {
xf += "_friend";
}
}
if (GenerateFriend(fnt, fnf) != 0) {
Error(
"Process",
"problems generating friend tree for %s (%s)",
}
} else if (fAction == 1) {
if (GenerateTree(fCurrent->
GetName(), fNEvents, fnt) != 0) {
Error(
"Process",
"problems generating tree (%lld, %s, %lld)",
entry, fCurrent->
GetName(), fNEvents);
}
if (GenerateFriend(fnt) != 0) {
Error(
"Process",
"problems generating friend tree for %s (%s)",
}
} else if (fAction == 2) {
if (GenerateTree(fCurrent->
GetName(), fNEvents, fnt) != 0) {
Error(
"Process",
"problems generating tree (%lld, %s, %lld)",
entry, fCurrent->
GetName(), fNEvents);
}
} else {
Warning(
"Process",
"do not know how to process action %d - do nothing", fAction);
}
}
void ProofAux::SlaveTerminate()
{
if (fMainList && fMainList->GetSize() > 0) fOutput->Add(fMainList);
if (fFriendList && fFriendList->GetSize() > 0) fOutput->Add(fFriendList);
}
void ProofAux::Terminate()
{
}
{
fn = fnt;
Error(
"GenerateTree",
"file name undefined!");
return rc;
}
if (!strcmp(uu.GetProtocol(),
"file") && !fn.
BeginsWith(
"/")) {
Error(
"GenerateTree",
"data directory undefined!");
return rc;
}
Error(
"GenerateTree",
"problems creating directory %s to store the file", dir.
Data());
return rc;
}
}
}
if (!
f ||
f->IsZombie()) {
Error(
"GenerateTree",
"problems opening file %s", fn.
Data());
return rc;
}
if (!fDir.IsNull()) {
if (
f->mkdir(fDir.Data())) {
Info(
"GenerateTree",
"sub-directory '%s' successfully created", fDir.Data());
} else {
Error(
"GenerateTree",
"creating sub-directory '%s'", fDir.Data());
return rc;
}
}
rc = 0;
TTree *
T =
new TTree(
"Tmain",
"Main tree for tutorial friends");
T->SetDirectory(destdir);
T->Branch(
"Run",&Run,
"Run/I");
T->Branch(
"Event",&
Event,
"Event/L");
if (i > 0 && i%1000 == 0) Run++;
}
Info(
"GenerateTree",
"file '%s' successfully created", fn.
Data());
if (!strcmp(uu.GetProtocol(), "file")) {
} else {
}
}
return rc;
}
Int_t ProofAux::GenerateFriend(
const char *fnt,
const char *fnf)
{
if (fin.IsNull()) {
Error(
"GenerateFriend",
"file name for the main tree undefined!");
return rc;
}
Error(
"GenerateFriend",
"input file does not exist or cannot be read: %s", fin.Data());
return rc;
}
const char *openMain = "UPDATE";
if (!fout.IsNull()) {
openMain = "READ";
Error(
"GenerateFriend",
"problems creating directory %s to store the file", dir.
Data());
return rc;
}
}
} else {
fout = fin;
}
Error(
"GenerateFriend",
"problems opening input file %s", fin.Data());
return rc;
}
if (!Tin) {
Error(
"GenerateFriend",
"problems getting tree 'Tmain' from file %s", fin.Data());
delete fi;
return rc;
}
if (!sameFile) {
fo =
new TFile(fout,
"RECREATE");
Error(
"GenerateFriend",
"problems opening file %s", fout.Data());
delete fi;
return rc;
}
} else {
fo = fi;
}
rc = 0;
TTree *Tfrnd =
new TTree(
"Tfrnd",
"Friend tree for tutorial 'friends'");
}
if (!sameFile) {
delete fi;
}
delete fo;
delete Tfrnd;
Info(
"GenerateFriend",
"friend file '%s' successfully created", fout.Data());
if (!strcmp(uu.GetProtocol(), "file")) {
} else {
}
}
return rc;
}
Selector used for auxiliary actions in the PROOF tutorials.
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.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
R__EXTERN TProofServ * gProofServ
R__EXTERN TSystem * gSystem
A TTree is a list of TBranches.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
void SetName(const char *name)
Manages an element of a TDSet.
Bool_t cd() override
Change current directory to "this" directory.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
virtual Bool_t cd()
Change current directory to "this" directory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
void Close(Option_t *option="") override
Close 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.
Collectable string class.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
R__ALWAYS_INLINE Bool_t IsZombie() const
Class used by TMap to store (key,value) pairs.
Named parameter, streamable and storable.
const char * GetOrdinal() const
const char * GetDataDir() const
This is the base class for the ROOT Random number generators.
TString & Insert(Ssiz_t pos, const char *s)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * HostName()
Return the system's host name.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
void Print(Option_t *option="") const override
Print a summary of the tree contents.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
virtual Long64_t GetEntries() const
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write this object to the current directory.
This class represents a WWW compatible URL.
const char * GetProtocol() const
Double_t Sqrt(Double_t x)
Returns the square root of x.