#define ProofEventProc_cxx
 
 
 
void ProofEventProc::Begin(
TTree *)
 
{
   
   
   
 
   Info(
"Begin", 
"starting a simple exercise with process option: %s", 
option.Data());
 
}
 
void ProofEventProc::SlaveBegin(
TTree * )
 
{
   
   
   
 
 
   
   if (fInput) {
      if ((nm = 
dynamic_cast<TNamed *
>(fInput->FindObject(
"ProofEventProc_Read")))) {
 
      }
   }
   if (!nm) {
      
   }
   Info(
"SlaveBegin", 
"'%s' reading", (fFullRead ? 
"full" : 
"optimized"));
 
 
   fPtHist = 
new TH1F(
"pt_dist",
"p_{T} Distribution",100,0,5);
 
   fPtHist->SetDirectory(0);
   fPtHist->GetXaxis()->SetTitle("p_{T}");
   fPtHist->GetYaxis()->SetTitle("dN/p_{T}dp_{T}");
 
   fOutput->Add(fPtHist);
 
   fPzHist = 
new TH1F(
"pz_dist",
"p_{Z} Distribution",100,0,5.);
 
   fPzHist->SetDirectory(0);
   fPzHist->GetXaxis()->SetTitle("p_{Z}");
   fPzHist->GetYaxis()->SetTitle("dN/dp_{Z}");
 
   fOutput->Add(fPzHist);
 
   fPxPyHist = 
new TH2F(
"px_py",
"p_{X} vs p_{Y} Distribution",100,-5.,5.,100,-5.,5.);
 
   fPxPyHist->SetDirectory(0);
   fPxPyHist->GetXaxis()->SetTitle("p_{X}");
   fPxPyHist->GetYaxis()->SetTitle("p_{Y}");
 
   fOutput->Add(fPxPyHist);
 
   
   if (fInput)
      pi = 
dynamic_cast<TParameter<Int_t> *
>(fInput->FindObject(
"ProofEventProc_TestAbort"));
 
   if (pi) fTestAbort = pi->
GetVal();
 
   if (fTestAbort < -1 || fTestAbort > 1) {
      Info(
"SlaveBegin", 
"unsupported value for the abort test: %d not in [-1,1] - ignore", fTestAbort);
 
      fTestAbort = -1;
   } else if (fTestAbort > -1) {
      Info(
"SlaveBegin", 
"running abort test: %d", fTestAbort);
 
   }
 
   if (fTestAbort == 0)
      Abort("Test abortion during init", kAbortProcess);
}
 
{
   
   
   
   
   
   
   
   
   
   
   
 
   
   
   
   
   
 
   if (fEntMin == -1 || entry < fEntMin) fEntMin = entry;
   if (fEntMax == -1 || entry > fEntMax) fEntMax = entry;
 
   if (fTestAbort == 1) {
      if (rr > 0.999) {
         Info(
"Process", 
"%lld -> %f", entry, rr);
 
         Abort("Testing file abortion", kAbortFile);
      }
   }
 
   if (fFullRead) {
      fChain->GetTree()->GetEntry(entry);
   } else {
      b_event_fNtrack->GetEntry(entry);
   }
 
   if (fNtrack > 0) {
      if (!fFullRead) b_fTracks->GetEntry(entry);
      if (fTracks) {
         for (
Int_t j=0;j<fTracks->GetEntries();j++){
 
            Track *curtrack = 
dynamic_cast<Track*
>(fTracks->At(j));
 
            if (curtrack) {
               fPtHist->Fill(curtrack->GetPt(),1./curtrack->GetPt());
               fPxPyHist->Fill(curtrack->GetPx(),curtrack->GetPy());
               if (j == 0) fPzHist->Fill(curtrack->GetPz());
            }
         }
      }
   }
 
}
 
void ProofEventProc::SlaveTerminate()
{
   
   
   
 
   
   if (fProcElem) fProcElem->Add(fEntMin, fEntMax);
 
   if (!fProcElems) {
      Warning(
"SlaveTerminate", 
"no proc elements list found!");
 
      return;
   }
 
   
   while ((o = nxpe())) { fOutput->Add(o); };
}
 
void ProofEventProc::Terminate()
{
   
   
   
 
   
   CheckRanges();
 
   if (
gROOT->IsBatch()) 
return;
 
 
 
   
   TH1F *
hi = 
dynamic_cast<TH1F*
>(fOutput->FindObject(
"pz_dist"));
 
   } 
else { 
Warning(
"Terminate", 
"no pz dist found"); }
 
 
   
   TH1F *hf = 
dynamic_cast<TH1F*
>(fOutput->FindObject(
"pt_dist"));
 
   if (hf) {
   } 
else { 
Warning(
"Terminate", 
"no pt dist found"); }
 
 
   
   TH2F *h2f = 
dynamic_cast<TH2F*
>(fOutput->FindObject(
"px_py"));
 
   if (h2f) {
      
      
   } else {
      Warning(
"Terminate", 
"no px py found");
 
   }
 
   
}
 
void ProofEventProc::CheckRanges()
{
   
   
 
   
   if (!fOutput || (fOutput && fOutput->GetSize() <= 0)) return;
 
   
   fOutput->Add(nout);
 
   
   if (!fInput || (fInput && fInput->GetSize() <= 0)) {
      return;
   }
   TNamed *ffst = 
dynamic_cast<TNamed *
>(fInput->FindObject(
"Range_First_File"));
 
   if (!ffst) {
      return;
   }
   TNamed *flst = 
dynamic_cast<TNamed *
>(fInput->FindObject(
"Range_Last_File"));
 
   if (!flst) {
      return;
   }
   if (!fnum) {
      return;
   }
 
   
   Ssiz_t ifst = fn.Index(
"?fst=");
 
      nout->
SetTitle(
"No first entry information in first file name");
 
      return;
   }
   fn.Remove(ifst);
   sfst.Remove(0, ifst + sizeof("?fst=") - 1);
   if (!sfst.IsDigit()) {
      nout->
SetTitle(
"Badly formatted first entry information in first file name");
 
      return;
   }
   ProcFileElements *pfef = dynamic_cast<ProcFileElements *>(fOutput->FindObject(fn));
   if (!pfef) {
      nout->
SetTitle(
"ProcFileElements for first file not found in the output list");
 
      return;
   }
   if (pfef->GetFirst() != fst) {
      return;
   }
 
   
   Ssiz_t ilst = fn.Index(
"?lst=");
 
      nout->
SetTitle(
"No last entry information in last file name");
 
      return;
   }
   fn.Remove(ilst);
   slst.Remove(0, ilst + sizeof("?lst=") - 1);
   if (!slst.IsDigit()) {
      nout->
SetTitle(
"Badly formatted last entry information in last file name");
 
      return;
   }
   ProcFileElements *pfel = dynamic_cast<ProcFileElements *>(fOutput->FindObject(fn));
   if (!pfel) {
      nout->
SetTitle(
"ProcFileElements for last file not found in the output list");
 
      return;
   }
   if (pfel->GetLast() != lst) {
      return;
   }
 
   
   while ((o = nxo())) {
      if (dynamic_cast<ProcFileElements *>(o)) nproc++;
   }
   if (fnum->
GetVal() != nproc) {
 
      nout->
SetTitle(
"Number of processed files differs");
 
      return;
   }
}
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.