10#define ProofEventProc_cxx
26void ProofEventProc::Begin(
TTree *)
33 Info(
"Begin",
"starting a simple exercise with process option: %s",
option.Data());
37void ProofEventProc::SlaveBegin(
TTree * )
49 if ((nm =
dynamic_cast<TNamed *
>(fInput->FindObject(
"ProofEventProc_Read")))) {
57 Info(
"SlaveBegin",
"'%s' reading", (fFullRead ?
"full" :
"optimized"));
59 fPtHist =
new TH1F(
"pt_dist",
"p_{T} Distribution",100,0,5);
60 fPtHist->SetDirectory(0);
61 fPtHist->GetXaxis()->SetTitle(
"p_{T}");
62 fPtHist->GetYaxis()->SetTitle(
"dN/p_{T}dp_{T}");
64 fOutput->Add(fPtHist);
66 fPzHist =
new TH1F(
"pz_dist",
"p_{Z} Distribution",100,0,5.);
67 fPzHist->SetDirectory(0);
68 fPzHist->GetXaxis()->SetTitle(
"p_{Z}");
69 fPzHist->GetYaxis()->SetTitle(
"dN/dp_{Z}");
71 fOutput->Add(fPzHist);
73 fPxPyHist =
new TH2F(
"px_py",
"p_{X} vs p_{Y} Distribution",100,-5.,5.,100,-5.,5.);
74 fPxPyHist->SetDirectory(0);
75 fPxPyHist->GetXaxis()->SetTitle(
"p_{X}");
76 fPxPyHist->GetYaxis()->SetTitle(
"p_{Y}");
78 fOutput->Add(fPxPyHist);
83 pi =
dynamic_cast<TParameter<Int_t> *
>(fInput->FindObject(
"ProofEventProc_TestAbort"));
84 if (pi) fTestAbort = pi->
GetVal();
85 if (fTestAbort < -1 || fTestAbort > 1) {
86 Info(
"SlaveBegin",
"unsupported value for the abort test: %d not in [-1,1] - ignore", fTestAbort);
88 }
else if (fTestAbort > -1) {
89 Info(
"SlaveBegin",
"running abort test: %d", fTestAbort);
93 Abort(
"Test abortion during init", kAbortProcess);
117 if (fEntMin == -1 || entry < fEntMin) fEntMin = entry;
118 if (fEntMax == -1 || entry > fEntMax) fEntMax = entry;
120 if (fTestAbort == 1) {
123 Info(
"Process",
"%lld -> %f", entry, rr);
124 Abort(
"Testing file abortion", kAbortFile);
130 fChain->GetTree()->GetEntry(entry);
132 b_event_fNtrack->GetEntry(entry);
136 if (!fFullRead) b_fTracks->GetEntry(entry);
138 for (
Int_t j=0;j<fTracks->GetEntries();j++){
139 Track *curtrack =
dynamic_cast<Track*
>(fTracks->At(j));
141 fPtHist->Fill(curtrack->GetPt(),1./curtrack->GetPt());
142 fPxPyHist->Fill(curtrack->GetPx(),curtrack->GetPy());
143 if (j == 0) fPzHist->Fill(curtrack->GetPz());
154void ProofEventProc::SlaveTerminate()
161 if (fProcElem) fProcElem->Add(fEntMin, fEntMax);
164 Warning(
"SlaveTerminate",
"no proc elements list found!");
169 TIter nxpe(fProcElems);
171 while ((o = nxpe())) { fOutput->Add(o); };
175void ProofEventProc::Terminate()
184 if (
gROOT->IsBatch())
return;
196 TH1F *
hi =
dynamic_cast<TH1F*
>(fOutput->FindObject(
"pz_dist"));
202 }
else {
Warning(
"Terminate",
"no pz dist found"); }
207 TH1F *hf =
dynamic_cast<TH1F*
>(fOutput->FindObject(
"pt_dist"));
213 }
else {
Warning(
"Terminate",
"no pt dist found"); }
216 TH2F *h2f =
dynamic_cast<TH2F*
>(fOutput->FindObject(
"px_py"));
225 Warning(
"Terminate",
"no px py found");
234void ProofEventProc::CheckRanges()
240 if (!fOutput || (fOutput && fOutput->GetSize() <= 0))
return;
247 if (!fInput || (fInput && fInput->GetSize() <= 0)) {
251 TNamed *ffst =
dynamic_cast<TNamed *
>(fInput->FindObject(
"Range_First_File"));
256 TNamed *flst =
dynamic_cast<TNamed *
>(fInput->FindObject(
"Range_Last_File"));
264 nout->
SetTitle(
"No number of files");
270 Ssiz_t ifst = fn.Index(
"?fst=");
272 nout->
SetTitle(
"No first entry information in first file name");
276 sfst.Remove(0, ifst +
sizeof(
"?fst=") - 1);
277 if (!sfst.IsDigit()) {
278 nout->
SetTitle(
"Badly formatted first entry information in first file name");
282 ProcFileElements *pfef =
dynamic_cast<ProcFileElements *
>(fOutput->FindObject(fn));
284 nout->
SetTitle(
"ProcFileElements for first file not found in the output list");
287 if (pfef->GetFirst() != fst) {
296 Ssiz_t ilst = fn.Index(
"?lst=");
298 nout->
SetTitle(
"No last entry information in last file name");
302 slst.Remove(0, ilst +
sizeof(
"?lst=") - 1);
303 if (!slst.IsDigit()) {
304 nout->
SetTitle(
"Badly formatted last entry information in last file name");
308 ProcFileElements *pfel =
dynamic_cast<ProcFileElements *
>(fOutput->FindObject(fn));
310 nout->
SetTitle(
"ProcFileElements for last file not found in the output list");
313 if (pfel->GetLast() != lst) {
314 nout->
SetTitle(
"Last entry differs");
322 while ((o = nxo())) {
323 if (
dynamic_cast<ProcFileElements *
>(o)) nproc++;
325 if (fnum->
GetVal() != nproc) {
326 nout->
SetTitle(
"Number of processed files differs");
Empty file to test TProof::Load in runProof.C and StressProof.cxx in conjunction with ProcFileElement...
Selector to process trees containing Event structures.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
R__EXTERN TRandom * gRandom
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
void Update() override
Update canvas pad buffers.
1-D histogram with a float per channel (see TH1 documentation)}
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
2-D histogram with a float per channel (see TH1 documentation)}
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
virtual void Clear(Option_t *="")
The most important graphics class in the ROOT system.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
void SetLogy(Int_t value=1) override
Set Lin/Log scale for Y.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
TVirtualPad * GetPad(Int_t subpadnumber) const override
Get a pointer to subpadnumber of this pad.
Named parameter, streamable and storable.
const AParamType & GetVal() const
Double_t Rndm() override
Machine independent random number generator.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
A TTree represents a columnar dataset.