AliPhysics  ff1d528 (ff1d528)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FastAnalysis.C
Go to the documentation of this file.
1 
10 #ifndef FASTANALYSIS_C
11 #define FASTANALYSIS_C
12 #include <TSelector.h>
13 #include <TQObject.h>
14 #ifndef __CINT__
15 # include <TParticle.h>
16 # include <TMath.h>
17 # include <TTree.h>
18 # include <TFile.h>
19 # include <THStack.h>
20 # include <TH1.h>
21 # include <TH2.h>
22 # include <TClonesArray.h>
23 # include <TAxis.h>
24 # include <TCanvas.h>
25 # include <TStopwatch.h>
26 # include <TStyle.h>
27 # include <TLegend.h>
28 # include <TLegendEntry.h>
29 # include <TMultiGraph.h>
30 # include <TGraph.h>
31 # include <TArrayI.h>
32 # include <TChain.h>
33 # include <TParameter.h>
34 # include <TSystem.h>
35 # include <TUrl.h>
36 # include <TGraph.h>
37 # include <TMap.h>
38 # include "FastShortHeader.C"
39 # include "FastMonitor.C"
40 // # include <TProof.h>
41 #else
42 class TTree;
43 class TH1;
44 class TH2;
45 class TH1D;
46 class THStack;
47 class TCanvas;
48 class TAxis;
49 class TStopwatch;
50 class TLegend;
51 class TMultiGraph;
52 class TParticle;
53 class TArrayI;
54 class TProof;
55 class TUrl;
56 class TVirtualPad;
57 class TMap;
58 class FastShortHeader;
59 #endif
60 
61 //====================================================================
65 struct FastAnalysis : public TSelector
66 {
69 
71 
72  TClonesArray* fParticles;
73 
77 
79 
80  ULong64_t fEventMult;
85 
98  FastAnalysis(Bool_t verb=false, Int_t monitor=0)
99  : fTree(0),
100  fHeader(0),
101  fParticles(0),
102  fVerbose(verb),
103  fEventMult(0),
104  fCentMethod(""),
105  fCentHist(0),
106  fOK(0),
107  fMonitor(monitor),
108  fCompatB(false),
109  fTrigMask(0xFFFF)
110  {
111  }
115  virtual ~FastAnalysis()
116  {
117  if (fHeader) delete fHeader;
118  if (fParticles) delete fParticles;
119  }
125  void SetTrigger(UInt_t mask) { fTrigMask = mask; }
132  void SetTrigger(UInt_t mask, Bool_t isAnd)
133  {
134  if (isAnd)
135  fTrigMask = ((mask & 0xFFFF) << 16) | 0xFFFF;
136  else
137  fTrigMask = ((mask & 0xFFFF) << 0) | 0xFFFF0000;
138  }
148  void SetTrigger(const char* what)
149  {
150  TString w(what);
151  w.ToUpper();
152  if (w.EqualTo("INEL") || w.EqualTo("MBOR"))
155  FastShortHeader::kEta1, false);
156  else if (w.EqualTo("INEL>0") || w.EqualTo("INELGT0")) {
160  }
161  else if (w.EqualTo("V0AND") || w.EqualTo("MBAND")) {
162  SetTrigger(0xFFFF, false);
164  }
165  else
166  Warning("SetTrigger", "Unknown trigger: %s", what);
167  }
174  {
175  UInt_t bits = fHeader->fTrigMask & 0xFFFF;
176  UInt_t orMask = (fTrigMask >> 0) & 0xFFFF;
177  UInt_t andMask = (fTrigMask >> 16) & 0xFFFF;
178  if (orMask != 0 && (orMask & bits) == 0) return false;
179  if (andMask != 0 && (andMask & bits) != andMask) return false;
180  return true;
181  }
187  void SetVerbose(Bool_t verb) { fVerbose = verb; }
192  {
193  // We disable monitoring in batch mode
194  if (gROOT->IsBatch()) {
195  Warning("SetupMonitor", "Batch processing, no monitoring");
196  return;
197  }
198 
199  // If the monitor frequency is 0 or negative, do nothing
200  if (fMonitor <= 0) {
201  Info("SetupMonitor", "Monitoring frequency too low");
202  return;
203  }
204 
205  // Get list of names of monitor objects.
206  TList* objs = GetMonitorObjects();
207  // If there's no monitored objects defined, do nothing
208  if (!objs || objs->GetEntries() < 1) {
209  Info("SetupMonitor", "No monitored objects defined");
210  return;
211  }
212  Printf("Monitor objects are:");
213  objs->Print();
214 
215  FastMonitor* monitor = new FastMonitor(this, "FastMonitor");
216  TObject* obj = 0;
217  TIter next(objs);
218  while ((obj = next())) monitor->Register(obj);
219  monitor->Connect(fMonitor);
220  }
231  {
232  fHeader = new FastShortHeader;
233  fParticles = new TClonesArray("TParticle");
234  fTree->SetBranchAddress("header", &(fHeader->fRunNo));
235  fTree->SetBranchAddress("particles", &fParticles);
236  if (!fCentMethod.IsNull()) {
237  if (fCentMethod.EqualTo("B") && !fTree->GetBranch("B"))
238  fCompatB = true;
239  else
240  fTree->SetBranchAddress(fCentMethod, &fEventMult);
241  }
242  return true;
243  }
251  {
252  if (fCentMethod.IsNull()) return true;
253  if (fCompatB) {
254  Warning("SetupEstimator", "Using fixed estimator");
255  Double_t bs[] = { 0, 1.57, 2.22, 2.71, 3.13,
256  3.50, 4.94, 6.05, 6.98, 7.81,
257  8.55, 9.23, 9.88, 10.47, 11.04,
258  11.58, 12.09, 12.58, 13.05, 13.52,
259  13.97, 14.43, 14.96, 15.67, 20.00 };
260  Double_t cs[] = { 0.5, 1.5, 2.5, 3.5, 4.5,
261  7.5, 12.5, 17.5, 22.5, 27.5,
262  32.5, 37.5, 42.5, 47.5, 52.5,
263  57.5, 62.5, 67.5, 72.5, 77.5,
264  82.5, 87.5, 92.5, 97.5 };
265  TH1* h = new TH1D("rawB", "B to Centrality", 28, bs);
266  h->SetDirectory(0);
267  h->SetXTitle("b\\hbox{ [fm]}");
268  h->SetYTitle("c\\hbox{ [\\%]}");
269  h->SetBinContent(0,1);
270  for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
271  h->SetBinContent(i, cs[i-1]);
272  }
273  // fCentHist = h;
274  return true;
275  }
276 
277  if (!fTree) {
278  Warning("SetupEstimator", "No tree defined!");
279  return false;
280  }
281  TFile* f = fTree->GetCurrentFile();
282  if (!f) {
283  Warning("SetupEstimator", "Failed to get current file from tree");
284  return false;
285  }
286  // TList* l = static_cast<TList*>(f->Get("estimators"));
287  // if (!l) {
288  // Warning("SetupEstimator",
289  // "Failed to get list of estimators from file %s",
290  // f->GetPath());
291  // f->ls();
292  // return false;
293  // }
294  // TObject* o = l->FindObject(fCentMethod);
295  TObject* o = f->Get(Form("estimators/%s",fCentMethod.Data()));
296  if (!o) {
297  Warning("SetupEstimator", "Failed to get %s from estimator list:",
298  fCentMethod.Data());
299  // l->ls();
300  f->ls();
301  return false;
302  }
303  if (!o->IsA()->InheritsFrom(TH1::Class())) {
304  Warning("SetupEstimator", "Estimator object %s is not a histogram "
305  "but a %s", o->GetName(), o->ClassName());
306  return false;
307  }
308  fCentHist = static_cast<TH1*>(o);
309  fCentHist->SetDirectory(0);
310  fTree->SetBranchAddress(fCentMethod, &fEventMult);
311  return true;
312  }
318  void Init(TTree* tree)
319  {
320  Info("Init", "Initializing with tree %p (%s)",
321  tree, (tree ? tree->ClassName() : ""));
322  if (!tree) return;
323 
324  TFile* file = tree->GetCurrentFile();
325  Info("Init", "Current file: (%p) %s", file,
326  (file ? file->GetName() : ""));
327 
328  fTree = tree;
329  if (!SetupBranches())
330  Fatal("Init", "Failed to set-up branches");
331  // if (!SetupEstimator())
332  // Fatal("Init", "Failed to set-up estimator");
333  }
338  virtual void Begin(TTree*)
339  {
340  SetupMonitor();
341  }
348  {
349  TFile* file = fTree->GetCurrentFile();
350  Info("Notify", "processing file: (%p) %s", file,
351  (file ? file->GetName() : ""));
352  if (!file) return true;
353  CopyEgHistogram();
354  if (!SetupBranches()) {
355  Warning("Notify", "Failed to set-up branches");
356  return false;
357  }
358  if (!SetupEstimator()) {
359  Warning("Notify", "Failed to set-up estimator");
360  return false;
361  }
362  return true;
363  }
371  virtual Bool_t Process(Long64_t entry)
372  {
373  Clear();
374  Int_t read = fTree->GetTree()->GetEntry(entry);
375  if (read <= 0) return false;
376 
377  if (fVerbose)
378  printf("Process event %7lld (0x%x) ",
379  entry, fHeader->fType);
380  if (!ProcessHeader()) {
381  if (fVerbose) Printf("No accepted");
382  return true;
383  }
384  fOK++;
385 
387 
388  return true;
389  }
395  virtual void SlaveTerminate()
396  {
397  Printf("A total of %ld events accepted", fOK);
398  TParameter<Long_t>* cnt = new TParameter<Long_t>("count",fOK,'+');
399  fOutput->Add(cnt);
400  fOutput->ls();
401  }
402  Int_t Version() const { return 2; }
403  virtual void Print(Option_t* option="") const
404  {
405  Printf("Analysis object %s (%s)", GetName(), ClassName());
406  Printf(" Tree: %p", fTree);
407  Printf(" Header: %p", fHeader);
408  Printf(" Particles: %p", fParticles);
409  Printf(" Verbose: %s", fVerbose ? "yes" : "no");
410  Printf(" Timer: %s", fTimer.GetName());
411  Printf(" Event multiplicity: %d", fEventMult);
412  Printf(" Centrality method: %s", fCentMethod.Data());
413  Printf(" Centrality histogram: %p", fCentHist);
414  Printf(" # accepted events: %d", fOK);
415  Printf(" Monitor frequency: %d s", fMonitor);
416  Printf(" Compatibility impact: %s", fCompatB ? "yes" : "no");
417  Printf(" Trigger mask: And: 0x%04x Or: 0x%04x",
418  ((fTrigMask >> 16) & 0xFFFF), (fTrigMask & 0xFFFF));
419  }
420  /* @} */
421 
443  {
444 #if 0
445  Info("GetCentrality", "fCentHist=%p, fCentMethod=%s cent=%f",
446  fCentHist, fCentMethod.Data(), fHeader->fC);
447 #endif
448  if (!fCentHist) return fHeader->fC;
449  Int_t nBin = fCentHist->GetNbinsX();
450  Int_t bin = fCentHist->GetXaxis()->FindBin(fEventMult);
451  if (bin <= 0) {
452  Warning("", "Look-up of %f failed (%d)", fEventMult, bin);
453  return -1;
454  }
455  if (bin-1 == nBin && fEventMult == fCentHist->GetXaxis()->GetXmax()) {
456  bin = nBin;
457  }
458  if (bin > nBin) {
459  Warning("", "Look-up of %f failed (%d > %d)", fEventMult, bin, nBin);
460  return 200;
461  }
462  Double_t cent = fCentHist->GetBinContent(bin);
463  // Info("", "Look-up of %ld -> %d -> %5.1f%%", fEventMult, bin, cent);
464  return cent;
465  }
472  Long_t GetEventCount()
473  {
474  if (fOK > 0) return fOK;
475 
476  typedef TParameter<Long_t> Param_t;
477  Param_t* p = static_cast<Param_t*>(GetOutputObject("count",
478  Param_t::Class()));
479  if (!p) return 0;
480  return fOK = p->GetVal();
481  }
490  TObject* GetOutputObject(const char* name, TClass* cls)
491  {
492  TObject* o = fOutput->FindObject(name);
493  if (!o) {
494  Warning("GetOutputObject", "Object %s not found in output", name);
495  fOutput->ls();
496  return 0;
497  }
498  if (cls && !o->IsA()->InheritsFrom(cls)) {
499  Warning("GetOutputObject", "Object %s from output is not a %s, but a %s",
500  o->GetName(), cls->GetName(), o->ClassName());
501  return o;
502  }
503  return o;
504  }
506  {
507  if (fOutput->FindObject("eg")) return;
508  TFile* file = (fTree ? fTree->GetCurrentFile() : 0);
509  Info("CopyEgHistogram", "Current file: (%p) %s", file,
510  (file ? file->GetName() : ""));
511  if (!file) return;
512  TH1* egTitle = static_cast<TH1*>(file->Get("eg"));
513  if (!egTitle) {
514  Warning("CopyEgHistogram", "No EG histogram");
515  return;
516  }
517  TH1* copy = static_cast<TH1*>(egTitle->Clone());
518  copy->SetDirectory(0);
519  copy->Reset();
520  copy->Fill(0.5);
521  fOutput->Add(copy);
522  }
523  /* @} */
524 
541  virtual TList* GetMonitorObjects() { return 0; }
546  virtual void Clear(Option_t* option="")
547  {
548  fHeader->Clear(option);
549  fParticles->Clear();
550  fEventMult = 0;
551  }
561  virtual void ProcessParticles()
562  {
563  Int_t nParticles = fParticles->GetEntriesFast();
564  Int_t nOK = 0;
565  Int_t nSec = 0;
566  Int_t nNeut = 0;
567  Int_t nOut = 0;
568  for (Int_t iPart = 0; iPart < nParticles; iPart++) {
569  TObject* oPart = fParticles->At(iPart);
570  if (!oPart) continue;
571  if (!oPart->TestBit((1<<14)) || oPart->TestBit(1<<15)) {
572  // If this is a secondary, increment counter
573  nSec++;
574  if (!AcceptSecondaries()) continue;
575  }
576  if (!oPart->TestBit((1<<16))) {
577  // If this is neutral, increment counter
578  nNeut++;
579  if (!AcceptNeutrals()) continue;
580  }
581 
582  if (!ProcessParticle(static_cast<TParticle*>(oPart))) {
583  nOut++;
584  continue;
585  }
586  nOK++;
587  }
588  if (fVerbose)
589  Printf("ok:%7d sec:%7d neu=%7d out:%7d total:%7d",
590  nOK, nSec, nNeut, nOut, nParticles);
591 
592  }
605  virtual Bool_t AcceptSecondaries() const { return false; }
618  virtual Bool_t AcceptNeutrals() const { return false; }
631  virtual Bool_t ProcessParticle(const TParticle* p) = 0;
638  virtual Bool_t ProcessHeader() { return CheckTrigger(); }
639  /* @} */
640 
653  static Long_t ProofExec(const char* cmd=0)
654  {
655  Bool_t hasCmd = (cmd && cmd[0] != '\0');
656  TString lne;
657  lne.Form("gProof%s%s", (hasCmd ? "->" : ""), (hasCmd ? cmd : ""));
658  Printf("FastAnalysis::ProofExec: %s", lne.Data());
659  return gROOT->ProcessLine(lne);
660  }
661  static Bool_t ProofLoad(const char* file, const char* opt)
662  {
663  const char* real = gSystem->Which(gROOT->GetMacroPath(),
664  file, kReadPermission);
665  if (!real) {
666  ::Warning("ProofLoad", "%s not found in load path: %s",
667  file, gROOT->GetMacroPath());
668  delete real;
669  return false;
670  }
671  TString cc(opt); if (cc == "-") cc = "" ; else cc.Prepend("+");
672  Long_t ret = ProofExec(Form("Load(\"%s%s\",true)",real, cc.Data()));
673  if (ret != 0) {
674  ::Warning("ProofLoad", "Failed to load %s%s", real, cc.Data());
675  delete real;
676  return false;
677  }
678  delete real;
679  return true;
680  }
691  static Bool_t Str2KeyVal(const TString& in,
692  TString& key,
693  TString& val,
694  const char sep='=')
695  {
696  Int_t idx = in.Index(sep);
697  if (idx == kNPOS) return false;
698 
699  key = in(0,idx);
700  val = in(idx+1, in.Length()-idx-1);
701  return true;
702  }
708  static Bool_t SetupProof(TUrl& url, const char* opt,
709  const char* extra)
710  {
711  Long_t ret = 0;
712  gROOT->LoadClass("TProof", "libProof");
713  ret = gROOT->ProcessLine(Form("TProof::Reset(\"%s\")",url.GetUrl()));
714  ret = gROOT->ProcessLine(Form("TProof::Open(\"%s\")",url.GetUrl()));
715  if (!ret) {
716  Printf("Error: FastAnalysis::SetupProof: Failed to connect");
717  return false;
718  }
719  ret = ProofExec("ClearCache()");
720 
721  TString phy = gSystem->ExpandPathName("$(ALICE_PHYSICS)");
722  TString ali = gSystem->ExpandPathName("$(ALICE_ROOT)");
723  TString fwd = phy + "/PWGLF/FORWARD/analysis2";
724  TString mkLib = gSystem->GetMakeSharedLib();
725  mkLib.ReplaceAll("-std=c++14", "-std=c++98");
726  gROOT->SetMacroPath(Form("%s:%s/sim",
727  gROOT->GetMacroPath(), fwd.Data()));
728  ProofExec(Form("Exec(\"gSystem->SetMakeSharedLib(\\\"%s\\\")\")",
729  mkLib.Data()));
730 
731  if (!ProofLoad("FastMonitor.C", opt)) return false;
732  if (!ProofLoad("FastShortHeader.C", opt)) return false;
733  if (!ProofLoad("FastAnalysis.C", opt)) return false;
734  if (!ProofLoad("FastCentHelper.C", opt)) return false;
735  if (!extra || extra[0] == '\0') return true;
736  if (!ProofLoad(extra, opt)) return false;
737 
738  return true;
739  }
740 
741  //==================================================================
748  struct Maker : public TNamed
749  {
751  virtual ~Maker() {}
762  virtual FastAnalysis* Make(const TString& subtype,
763  Int_t monitor,
764  Bool_t verbose,
765  TMap& uout) = 0;
769  virtual void List() const = 0;
773  virtual const char* Script() const = 0;
774  protected:
776  Maker(const char* type="");
777  ClassDef(Maker,0);
778  };
779  //==================================================================
780 #ifndef __CINT__
781 
784  struct Factory : public TObject
785  {
789  static Factory& Instance()
790  {
791  static Factory* instance = 0;
792  if (!instance) instance = new Factory;
793  return *instance;
794  }
808  FastAnalysis* Make(const TString& type,
809  const TString& subtype,
810  Int_t monitor,
811  Bool_t verbose,
812  TMap& uout)
813  {
814  Bool_t help = (type.EqualTo("help",TString::kIgnoreCase) ||
815  type.EqualTo("list",TString::kIgnoreCase));
816  TIter next(&fList);
817  Maker* maker = 0;
818  while ((maker = static_cast<Maker*>(next()))) {
819  if (!help && !type.EqualTo(maker->GetName(), TString::kIgnoreCase))
820  continue;
821  if (help) Printf("%s", maker->GetName());
822  if (help ||
823  subtype.EqualTo("help", TString::kIgnoreCase) ||
824  subtype.EqualTo("list", TString::kIgnoreCase)) {
825  maker->List();
826  continue;
827  }
828 
829  FastAnalysis* a = maker->Make(subtype,monitor,verbose,uout);
830  if (a) return a;
831  }
832  return 0;
833  }
834  const char* Script(const TString& type) const
835  {
836  TIter next(&fList);
837  Maker* maker = 0;
838  while ((maker = static_cast<Maker*>(next()))) {
839  if (!type.EqualTo(maker->GetName(), TString::kIgnoreCase))
840  continue;
841  return maker->Script();
842  }
843  return 0;
844  }
850  void Register(Maker* m)
851  {
852  fList.Add(m);
853  }
854  private:
855  Factory() : fList() {}
857  };
858 #endif
859 
886  static Bool_t Run(const char* url,
887  const char* output,
888  FastAnalysis* a,
889  const char* script,
890  Long64_t nev=-1,
891  Long64_t offset=0,
892  Int_t monitor=-1,
893  Bool_t verbose=false,
894  const char* opt="")
895 
896  {
897  if (!a) {
898  Printf("Error: FastAnalysis::Run: No analyser given");
899  return false;
900  }
901  TUrl u(url);
902  if (!u.IsValid()) {
903  Printf("Error: FastAnalysis::Run: URL %s is invalid", u.GetUrl());
904  return false;
905  }
906 
907  TString treeName = u.GetAnchor();
908  if (treeName.IsNull()) treeName = "T";
909  TFile* file = TFile::Open(u.GetFile(), "READ");
910  if (!file) {
911  Printf("Error: FastAnalysis::Run: Failed to open %s",
912  u.GetFile());
913  return false;
914  }
915 
916  TChain* chain = new TChain(treeName, treeName);
917  TObject* o = file->Get(treeName);
918  if (!o) {
919  Printf("Error: FastAnalysis::Run: Couldn't get %s from %s",
920  treeName.Data(), u.GetFile());
921  file->Close();
922  return false;
923  }
924  Int_t cret = 0;
925  if (o->IsA()->InheritsFrom(TChain::Class()))
926  cret = chain->Add(static_cast<TChain*>(o));
927  else if (o->IsA()->InheritsFrom(TTree::Class()))
928  cret = chain->AddFile(u.GetFile());
929  else if (o->IsA()->InheritsFrom(TCollection::Class()))
930  cret = chain->AddFileInfoList(static_cast<TCollection*>(o));
931  file->Close();
932  if (cret <= 0 || chain->GetListOfFiles()->GetEntries() <= 0) {
933  Printf("Error: FastAnalysis::Run: Failed to create chain");
934  return false;
935  }
936 
937  TString proto = u.GetProtocol();
938  Bool_t isProof = (proto.EqualTo("proof") || proto.EqualTo("lite"));
939  if (isProof) {
940  if (!SetupProof(u,opt,script)) return false;
941  chain->SetProof();
942  }
943 
944  Printf("===================================================\n"
945  "\n"
946  " Processing chain %s with selector %s\n"
947  " Max events: %lld\n"
948  " Event offset: %lld\n"
949  " URL: %s\n"
950  "\n"
951  "===================================================",
952  chain->GetName(), a->GetName(), nev, offset, u.GetUrl());
953  a->Print();
954  if (nev < 0) nev = TChain::kBigNumber;
955  Long64_t ret = chain->Process(a, "", nev, offset);
956 
957  if (output && output[0] != '\0') {
958  TFile* out = TFile::Open(output, "RECREATE");
959  a->GetOutputList()->Write("out",TObject::kSingleKey);
960  out->Write();
961  Printf("Saved in %s", out->GetName());
962  }
963 
964  return ret > 0;
965  }
966 
976  static Bool_t Run(const char* url,
977  const char* output,
978  const char* opt="g")
979  {
980  Long64_t nev = -1;
981  Long64_t off = 0;
982  TString type = "";
983  TString sub = "";
984  Int_t monitor = -1;
985  Bool_t verbose = false;
986  TUrl u(url);
987  TMap uopt;
988  TObjArray* opts = TString(u.GetOptions()).Tokenize("&");
989  TObjString* token = 0;
990  TIter nextToken(opts);
991  while ((token = static_cast<TObjString*>(nextToken()))) {
992  TString& str = token->String();
993  if (str.IsNull()) continue;
994 
995  if (str.EqualTo("verbose")) {
996  verbose = true;
997  continue;
998  }
999  TString key, val;
1000  if (!Str2KeyVal(str,key,val)) {
1001  uopt.Add(new TObjString(key), new TObjString(val));
1002  // if (!uout.IsNull()) uout.Append("&");
1003  // uout.Append(str);
1004  continue;
1005  }
1006 
1007  if (key.EqualTo("events")) nev = val.Atoll();
1008  else if (key.EqualTo("offset")) off = val.Atoll();
1009  else if (key.EqualTo("type")) type = val;
1010  else if (key.EqualTo("subtype")) sub = val;
1011  else if (key.EqualTo("monitor")) monitor = val.Atoi();
1012  else {
1013  uopt.Add(new TObjString(key), new TObjString(val));
1014  // if (!uout.IsNull()) uout.Append("&");
1015  // uout.Append(str);
1016  }
1017  }
1018  opts->Delete();
1019  FastAnalysis* a = Factory::Instance().Make(type,sub, monitor,verbose,uopt);
1020  const char* s = Factory::Instance().Script(type);
1021  if (type.EqualTo("help",TString::kIgnoreCase) ||
1022  type.EqualTo("list",TString::kIgnoreCase) ||
1023  sub .EqualTo("help",TString::kIgnoreCase) ||
1024  sub .EqualTo("list",TString::kIgnoreCase)) return false;
1025  TString uout;
1026  TIter next(&uopt);
1027  TObject* k = 0;
1028  while ((k = static_cast<TPair*>(next()))) {
1029  TObject* v = uopt.GetValue(k);
1030  if (!v) continue;
1031  if (!uout.IsNull()) uout.Append("&");
1032  uout.Append(Form("%s=%s",k->GetName(),v->GetName()));
1033  }
1034  u.SetOptions(uout);
1035 
1036  return Run(u.GetUrl(), output, a, s, nev, off, monitor, verbose, opt);
1037  }
1038 
1040 };
1041 
1043  : TNamed(type, "")
1044 {
1045  // Automatically register
1047 }
1048 
1049 #endif
1050 //
1051 // EOF
1052 //
1053 
TObject * GetOutputObject(const char *name, TClass *cls)
Definition: FastAnalysis.C:490
return jsonbuilder str().c_str()
Bool_t CheckTrigger() const
Definition: FastAnalysis.C:173
const Color_t cc[]
Definition: DrawKs.C:1
static Factory & Instance()
Definition: FastAnalysis.C:789
double Double_t
Definition: External.C:58
virtual void List() const =0
static Bool_t ProofLoad(const char *file, const char *opt)
Definition: FastAnalysis.C:661
void SetTrigger(const char *what)
Definition: FastAnalysis.C:148
FastAnalysis * Make(const TString &type, const TString &subtype, Int_t monitor, Bool_t verbose, TMap &uout)
Definition: FastAnalysis.C:808
const char * url
FastShortHeader * fHeader
Definition: FastAnalysis.C:70
long long Long64_t
Definition: External.C:43
virtual Bool_t SetupEstimator()
Definition: FastAnalysis.C:250
void Clear(Option_t *option="")
ClassDef(FastAnalysis, 1)
TSystem * gSystem
TTree * fTree
Definition: FastAnalysis.C:68
void Init(TTree *tree)
Definition: FastAnalysis.C:318
TH1 * fCentHist
Definition: FastAnalysis.C:84
virtual ~FastAnalysis()
Definition: FastAnalysis.C:115
Int_t Version() const
Definition: FastAnalysis.C:402
virtual void Begin(TTree *)
Definition: FastAnalysis.C:338
static Bool_t SetupProof(TUrl &url, const char *opt, const char *extra)
Definition: FastAnalysis.C:708
Int_t fMonitor
Definition: FastAnalysis.C:88
TStopwatch fTimer
Definition: FastAnalysis.C:76
virtual Bool_t Process(Long64_t entry)
Definition: FastAnalysis.C:371
void Register(Maker *m)
Definition: FastAnalysis.C:850
Definition: External.C:92
void Connect(Int_t freq=-1)
Definition: FastMonitor.C:136
virtual FastAnalysis * Make(const TString &subtype, Int_t monitor, Bool_t verbose, TMap &uout)=0
int Int_t
Definition: External.C:63
virtual Bool_t ProcessHeader()
Definition: FastAnalysis.C:638
unsigned int UInt_t
Definition: External.C:33
void CopyEgHistogram()
Definition: FastAnalysis.C:505
void SetVerbose(Bool_t verb)
Definition: FastAnalysis.C:187
Definition: External.C:212
const char * Script(const TString &type) const
Definition: FastAnalysis.C:834
unsigned long ULong_t
Definition: External.C:38
virtual void Print(Option_t *option="") const
Definition: FastAnalysis.C:403
Long_t GetEventCount()
Definition: FastAnalysis.C:472
Double_t GetCentrality() const
Definition: FastAnalysis.C:442
TString fName
Definition: FastAnalysis.C:78
TClonesArray * fParticles
Definition: FastAnalysis.C:72
static Bool_t Run(const char *url, const char *output, FastAnalysis *a, const char *script, Long64_t nev=-1, Long64_t offset=0, Int_t monitor=-1, Bool_t verbose=false, const char *opt="")
Definition: FastAnalysis.C:886
static Bool_t Run(const char *url, const char *output, const char *opt="g")
Definition: FastAnalysis.C:976
virtual void ProcessParticles()
Definition: FastAnalysis.C:561
Bool_t fVerbose
Definition: FastAnalysis.C:74
void SetTrigger(UInt_t mask, Bool_t isAnd)
Definition: FastAnalysis.C:132
static Bool_t Str2KeyVal(const TString &in, TString &key, TString &val, const char sep='=')
Definition: FastAnalysis.C:691
const char * fwd
TList * GetListOfFiles(const char *input=".")
Definition: RunFinalQA.C:114
void Register(TObject *descr, Bool_t proof=true)
Definition: FastMonitor.C:186
ULong64_t fEventMult
Definition: FastAnalysis.C:80
ULong_t fOK
Definition: FastAnalysis.C:86
Definition: External.C:220
virtual const char * Script() const =0
void SetupMonitor()
Definition: FastAnalysis.C:191
virtual Bool_t ProcessParticle(const TParticle *p)=0
Bool_t Notify()
Definition: FastAnalysis.C:347
Bool_t fCompatB
Definition: FastAnalysis.C:89
TFile * file
virtual TList * GetMonitorObjects()
Definition: FastAnalysis.C:541
const char Option_t
Definition: External.C:48
virtual void SlaveTerminate()
Definition: FastAnalysis.C:395
bool Bool_t
Definition: External.C:53
void SetTrigger(UInt_t mask)
Definition: FastAnalysis.C:125
virtual Bool_t AcceptNeutrals() const
Definition: FastAnalysis.C:618
FastAnalysis(Bool_t verb=false, Int_t monitor=0)
Definition: FastAnalysis.C:98
UInt_t fTrigMask
Definition: FastAnalysis.C:90
Maker(const char *type="")
TString fCentMethod
Definition: FastAnalysis.C:82
Bool_t SetupBranches()
Definition: FastAnalysis.C:230
Definition: External.C:196
virtual Bool_t AcceptSecondaries() const
Definition: FastAnalysis.C:605
virtual void Clear(Option_t *option="")
Definition: FastAnalysis.C:546
static Long_t ProofExec(const char *cmd=0)
Definition: FastAnalysis.C:653