6 # include "AliGenerator.h" 7 # include "AliRunLoader.h" 9 # include "AliHeader.h" 10 # include "AliGenEventHeader.h" 12 # include "AliCollisionGeometry.h" 13 # include "AliGenPythiaEventHeader.h" 14 # include "AliGenDPMjetEventHeader.h" 15 # include "AliGenGeVSimEventHeader.h" 16 # include "AliGenHerwigEventHeader.h" 17 # include "AliGenHijingEventHeader.h" 18 # include "AliGenCocktailEventHeader.h" 23 # include <TParticle.h> 26 # include <TClonesArray.h> 30 # include <TParticlePDG.h> 31 # include <TStopwatch.h> 33 # include <TProofOutputFile.h> 39 # include <TSystemDirectory.h> 40 # include <TFileCollection.h> 41 # include <TPRegexp.h> 53 class AliGenEventHeader;
60 class TProofOutputFile;
97 Register(
"list/histograms/b",
"hist", 0,
false);
98 Register(
"list/histograms/cent",
"hist", 0,
false);
99 Register(
"list/histograms/timing",
"hist", 0x18,
false);
100 Register(
"list/histograms/dNdeta",
"", 0x18,
false);
101 Register(
"list/histograms/dNdy",
"", 0x18,
false);
102 Register(
"list/histograms/trigger",
"e", 0x10,
false);
103 Register(
"list/estimators/rawV0MP",
"e", 0x02,
false);
104 if (gProof) gProof->AddFeedback(
"list");
170 if (!fFileName.IsNull()) fn = fFileName;
172 TString egName = (fGenerator ? fGenerator->GetName() :
"");
173 if (egName.IsNull()) egName = fEGName;
175 fn = Form(
"%s_%09d", egName.Data(), fRunNo);
178 Int_t tgtA, tgtZ, projA, projZ;
179 fGenerator->GetTarget(tgt, tgtA, tgtZ);
180 fGenerator->GetProjectile(proj, projA, projZ);
181 fn.Append(Form(
"_%s%s", tgt.Data(), proj.Data()));
182 fn.Append(Form(
"_%05d",
Int_t(fGenerator->GetEnergyCMS())));
185 Long_t en = gROOT->ProcessLine(
"grp->energy");
188 fn.Append(Form(
"_%s%s", (fIsTgtA ?
"A" :
"p"),
189 (fIsProjA ?
"A" :
"p")));
190 fn.Append(Form(
"_%05ld", (fGRP ? en : 0)));
194 if (fNEvents >= 1000000)
195 fn.Append(Form(
"_%lldM", fNEvents/1000000));
196 else if (fNEvents >= 1000)
197 fn.Append(Form(
"_%lldk", fNEvents/1000));
199 fn.Append(Form(
"_%lld", fNEvents));
212 const char*
GetName()
const {
return "FastSim"; }
218 const char*
GetTitle()
const {
return "ALICE Event Generator simulation"; }
227 if (fGenerator) fsNN = fGenerator->GetEnergyCMS();
228 else fsNN = gROOT->ProcessLine(
"grp->energy");
230 UShort_t sNN = (TMath::Abs(fsNN - 2760) < 10 ? 2760 :
231 TMath::Abs(fsNN - 5023) < 10 ? 5023 :
232 TMath::Abs(fsNN - 5440) < 10 ? 5440 :
233 TMath::Abs(fsNN - 2360) < 10 ? 2360 :
234 TMath::Abs(fsNN - 900) < 10 ? 900 :
235 TMath::Abs(fsNN - 7000) < 10 ? 7000 :
236 TMath::Abs(fsNN - 8000) < 10 ? 8000 :
237 TMath::Abs(fsNN - 13000) < 10 ? 13000 :
249 if (fGenerator)
return fGenerator->GetTitle();
259 Printf(
"=== Output =============================\n" 261 "========================================", FileName());
263 if (fVerbose) Info(
"SetupOutput",
"First the file");
265 if (fInput && fInput->FindObject(
"PROOF_Ordinal"))
268 Info(
"SetupOutput",
"Making Proof File");
269 fProofFile =
new TProofOutputFile(FileName(),
"M");
272 fFile = fProofFile->OpenFile(
"RECREATE");
275 fFile = TFile::Open(FileName(),
"RECREATE");
279 if (fVerbose) Info(
"SetupOutput",
"Making our tree: %s", tit.Data());
280 fTree =
new TTree(
"T", tit.Data());
281 fParticles =
new TClonesArray(
"TParticle");
282 fTree->Branch(
"header", &fShortHead,
283 "run/i:event:ntgt:nproj:nbin:type:" 284 "ipx/D:ipy:ipz:b:c:phir:" 285 "nsnp/i:nsnt:nspp:nspt:mask");
286 fTree->Branch(
"particles", &fParticles);
287 fTree->SetAutoSave(500);
288 fTree->SetDirectory(fFile);
289 fTree->SetAlias(
"primary",
"(particles.fBits&(1<<14))");
290 fTree->SetAlias(
"weak",
"(particles.fBits&(1<<15))");
291 fTree->SetAlias(
"charged",
"(particles.fBits&(1<<16))");
292 fTree->SetAlias(
"pt",
"(sqrt(pow(particles.fPx,2)+" 293 "pow(particles.fPy,2)))");
294 fTree->SetAlias(
"eta",
"(particles.Pt()<1e-100?" 295 "(particles.fPz>0?100:-100):" 296 "-log(tan(atan2(particles.Pt(),particles.fPz)/2)))");
297 fTree->SetAlias(
"good",
"(primary&&charged&&abs(eta)<1000)");
298 fTree->SetAlias(
"sd",
"(header.fType & 0x1)");
299 fTree->SetAlias(
"dd",
"(header.fType & 0x2)");
300 fTree->SetAlias(
"pion",
"(abs(particles.fPdgCode)==211)");
301 fTree->SetAlias(
"kaon",
"(abs(particles.fPdgCode)==321)");
302 fTree->SetAlias(
"proton",
"(abs(particles.fPdgCode)==2212)");
303 fTree->SetAlias(
"electron",
"(abs(particles.fPdgCode)==11)");
304 fTree->SetAlias(
"other",
"(!pion&&!kaon&&!proton&&!electron)");
305 fTree->SetAlias(
"beta",
"(particles.P()/particle.Energy())");
306 fTree->SetAlias(
"gamma",
"(1./sqrt(1-beta*beta))");
307 fTree->SetAlias(
"npart",
"(header.ntgt+header.nproj)");
308 fTree->SetAlias(
"v0a",
"(header.mask&0x1)");
309 fTree->SetAlias(
"v0c",
"(header.mask&0x2)");
310 fTree->SetAlias(
"ada",
"(header.mask&0x4)");
311 fTree->SetAlias(
"adc",
"(header.mask&0x8)");
312 fTree->SetAlias(
"eta1",
"(header.mask&0x10)");
316 Info(
"SetupOutput",
"Making generator histogram: %s",tit.Data());
317 TH1* egTitle =
new TH1I(
"eg", tit.Data(), 1, 0, 1);
318 egTitle->SetDirectory(0);
320 egTitle->SetXTitle(
"N_{\\hbox{workers}}");
321 egTitle->SetYTitle(
"Count");
322 egTitle->SetFillColor(kYellow+4);
323 egTitle->SetLineColor(kYellow+4);
324 egTitle->SetMarkerColor(kYellow+4);
325 egTitle->SetFillStyle(1001);
326 egTitle->SetMarkerStyle(1);
327 egTitle->SetLineStyle(1);
328 egTitle->SetLineWidth(2);
329 egTitle->SetMarkerSize(1);
332 if (fVerbose) Info(
"SetupOutput",
"Making histograms");
335 fHEta =
new TH1D(
"dNdeta",
"Charged particle pseudo-rapidity density",
336 Int_t(2*maxEta/dEta+.5), -maxEta, +maxEta);
338 fHEta->SetXTitle(
"\\eta");
339 fHEta->SetYTitle(
"\\hbox{d}N_{\\hbox{ch}}/\\hbox{d}\\eta");
340 fHEta->SetMarkerColor(kRed+2);
341 fHEta->SetMarkerStyle(20);
342 fHEta->SetDirectory(0);
344 fHY =
new TH1D(
"dNdy",
"Charged particle rapidity density",
345 Int_t(2*maxEta/dEta+.5), -maxEta, +maxEta);
347 fHY->SetXTitle(
"\\mathit{y}");
348 fHY->SetYTitle(
"\\hbox{d}N_{\\hbox{ch}}/\\hbox{d}y");
349 fHY->SetMarkerColor(kRed+2);
350 fHY->SetMarkerStyle(20);
351 fHY->SetDirectory(0);
353 fHIpz =
new TH1D(
"ipZ",
"Z-coordinate of interaction point",
355 fHIpz->SetMarkerColor(kGreen+2);
356 fHIpz->SetFillColor(kGreen+2);
357 fHIpz->SetFillStyle(3001);
358 fHIpz->SetXTitle(
"IP_{#it{z}} [cm]");
359 fHIpz->SetDirectory(0);
361 fHType =
new TH1D(
"type",
"Diffractive", 3, .5, 3.5);
362 fHType->SetMarkerColor(kOrange+2);
363 fHType->SetFillColor(kOrange+2);
364 fHType->SetFillStyle(3001);
365 fHType->SetDirectory(0);
366 fHType->GetXaxis()->SetBinLabel(1,
"Non");
367 fHType->GetXaxis()->SetBinLabel(2,
"Single");
368 fHType->GetXaxis()->SetBinLabel(3,
"Double");
370 fHCent =
new TH1D(
"cent",
"Centrality", 20, 0, 100);
371 fHCent->SetMarkerColor(kPink+2);
372 fHCent->SetFillColor(kPink+2);
373 fHCent->SetFillStyle(3001);
374 fHCent->SetDirectory(0);
375 fHCent->SetYTitle(
"Events");
376 fHCent->SetXTitle(
"Centrality [%]");
378 fHB =
new TH1D(
"b",
"Impact parameter", 20, 0, 20);
379 fHB->SetMarkerColor(kYellow+2);
380 fHB->SetFillColor(kYellow+2);
381 fHB->SetFillStyle(3001);
382 fHB->SetYTitle(
"Events");
383 fHB->SetXTitle(
"#it{b} [fm]");
384 fHB->SetDirectory(0);
386 fHPhiR =
new TH1D(
"phiR",
"Event plane angle", 360, 0, 360);
387 fHPhiR->SetMarkerColor(kMagenta+2);
388 fHPhiR->SetFillColor(kMagenta+2);
389 fHPhiR->SetFillStyle(3001);
390 fHPhiR->SetXTitle(
"#it{#Phi}_{R} [degrees]");
391 fHPhiR->SetDirectory(0);
393 fHTime =
new TH1D(
"timing",
"Timing of processing", 5,0.5,5.5);
394 fHTime->SetMarkerColor(kBlue+2);
395 fHTime->SetFillColor(kBlue+2);
396 fHTime->SetFillStyle(3001);
397 fHTime->SetYTitle(
"seconds / event");
398 fHTime->GetXaxis()->SetBinLabel(1,
"Reset");
399 fHTime->GetXaxis()->SetBinLabel(2,
"Generate");
400 fHTime->GetXaxis()->SetBinLabel(3,
"Header");
401 fHTime->GetXaxis()->SetBinLabel(4,
"Particles");
402 fHTime->GetXaxis()->SetBinLabel(5,
"Filling");
403 fHTime->SetDirectory(0);
405 fHTrig =
new TH1D(
"trigger",
"Trigger bits set", 6, -0.5, 5.5);
406 fHTrig->SetMarkerColor(kMagenta+2);
407 fHTrig->SetFillColor(kMagenta+2);
408 fHTrig->SetFillStyle(3001);
409 fHTrig->SetYTitle(
"Events");
410 fHTrig->GetXaxis()->SetBinLabel(1,
"All");
411 fHTrig->GetXaxis()->SetBinLabel(2,
"V0A");
412 fHTrig->GetXaxis()->SetBinLabel(3,
"V0C");
413 fHTrig->GetXaxis()->SetBinLabel(4,
"ADA");
414 fHTrig->GetXaxis()->SetBinLabel(5,
"ADC");
415 fHTrig->GetXaxis()->SetBinLabel(6,
"N_{ch}|_{|#eta|<1}#ge1");
416 fHTrig->SetDirectory(0);
419 fList->SetName(
"list");
423 histos->SetName(
"histograms");
424 histos->SetOwner(
true);
437 estimators->SetName(
"estimators");
438 estimators->SetOwner(
true);
439 fList->Add(estimators);
442 TIter next(fCentEstimators);
444 while ((estimator = static_cast<FastCentEstimator*>(next()))) {
445 Info(
"SetupOutput",
"Setting up estimator %s", estimator->
GetName());
446 estimator->
Setup(estimators, fTree,sNN,fIsTgtA,fIsProjA);
451 if (fVerbose) Info(
"SetupOutput",
"Adding list ot outputs");
464 std::ifstream in(
"/dev/urandom");
466 in.read(reinterpret_cast<char*>(&seed),
sizeof(seed));
468 Printf(
"=== Random =============================\n" 469 " Random number seed: %d\n" 470 "========================================", seed);
475 Printf(
" === Setup ==============================");
476 Printf(
" Run #: %6d", fRunNo);
477 Printf(
" EG: %30s", fEGName.Data());
478 Printf(
" B range: %5.1ffm - %5.1ffm", fBMin, fBMax);
479 Printf(
" ========================================");
480 Printf(
"Macro path: %s", gROOT->GetMacroPath());
483 if (!fGRP && fInput) {
484 fGRP = fInput->FindObject(
"GRP");
485 std::ofstream* pout =
new std::ofstream(
"grp.dat");
488 Info(
"SetupGRP",
"Writing GRP line '%s' to \"grp.dat\"",
490 std::ostream& out = *pout;
491 out << fGRP->GetTitle() << std::endl;
496 Info(
"SetupGRP",
"Overrides: %p Input: %p", fOverrides, fInput);
497 if (!fOverrides && fInput) {
498 fOverrides =
static_cast<TList*
>(fInput->FindObject(
"overrides"));
499 if (!fOverrides && fVerbose)
500 Info(
"SetupGRP",
"No GRP overrides found in input:");
504 if (fVerbose) Info(
"SetupGRP",
"Loading scripts");
506 if (gROOT->ProcessLine(
"grp") == 0)
507 gROOT->Macro(Form(
"GRP.C(%d)", fRunNo));
508 if (fVerbose) Info(
"SetupGRP",
"Perhaps override");
510 gROOT->ProcessLine(
"grp->Print()");
520 if (fVerbose) Info(
"SetupGen",
"Load base config");
521 gROOT->Macro(
"BaseConfig.C");
522 if (fVerbose) Info(
"SetupGen",
"Load EG config");
523 gROOT->Macro(
"EGConfig.C");
525 gROOT->ProcessLine(Form(
"VirtualEGCfg::LoadGen(\"%s\")",fEGName.Data()));
529 TString egMk = Form(
"egCfg->MakeGenerator(\"%s\",%f,%f)",
530 fEGName.Data(), fBMin, fBMax);
531 Long64_t egPtr = gROOT->ProcessLine(egMk);
533 Error(
"SetupGen",
"Failed to make generator");
536 fGenerator =
reinterpret_cast<AliGenerator*
>(egPtr);
538 Int_t tgtA=0, tgtZ=0, projA=0, projZ=0;
539 fGenerator->GetTarget(tgt, tgtA, tgtZ);
540 fGenerator->GetProjectile(proj, projA, projZ);
541 fIsTgtA = !(tgtA == tgtZ && tgtA == 1);
542 fIsProjA = !(projA == projZ && projZ == 1);
544 Info(
"SetupGen",
"tgt=%s (%3d,%2d) proj=%s (%3d,%2d) CMS=%fGeV",
545 tgt.Data(), tgtA, tgtZ, proj.Data(), projA, projZ,
546 fGenerator->GetEnergyCMS());
547 Info(
"SetupGen",
"Generator: %s", fGenerator->GetTitle());
548 if (fFileName.IsNull()) FileName();
561 new AliRun(
"gAlice",
"The ALICE Off-line framework");
563 Long64_t nev = (fNEvents <= 0 ? 0xFFFFFFFF : fNEvents);
564 Printf(
"=== Run ================================\n" 565 " Number of events: %lld\n" 566 "========================================", nev);
567 TObject* ord = (fInput ? fInput->FindObject(
"PROOF_Ordinal") : 0);
572 TObject* save = fInput->FindObject(
"PROOF_SaveGALICE");
573 if (save && fVerbose) {
574 Info(
"SetupRun",
"Got save option:");
577 TString optSave(save ? save->GetTitle() :
"split");
579 if (optSave.EqualTo(
"none")) saveMode = 0;
580 else if (optSave.EqualTo(
"merge")) saveMode = 1;
581 else if (optSave.EqualTo(
"split")) saveMode = 2;
582 if (fProofFile && saveMode > 0)
583 dir = fProofFile->GetDir(
true);
585 post = Form(
"_%s", ord->GetTitle());
587 TString galiceName(Form(
"%sgalice.root",dir.Data()));
588 TString kineName(Form(
"%sKinematics.root",dir.Data()));
592 fRunLoader = AliRunLoader::Open(galiceName,
"FASTRUN",
"RECREATE");
593 fRunLoader->SetKineFileName(kineName);
594 fRunLoader->SetCompressionLevel(2);
595 fRunLoader->SetNumberOfEventsPerFile(nev);
596 fRunLoader->LoadKinematics(
"RECREATE");
597 fRunLoader->MakeTree(
"E");
598 gAlice->SetRunLoader(fRunLoader);
599 fRunLoader->MakeStack();
600 fStack = fRunLoader->Stack();
601 fHeader = fRunLoader->GetHeader();
606 fGenerator->SetStack(fStack);
610 Info(
"SetupRun",
"Not saving galice.root and Kinematics.root");
614 TString aliceOut = Form(
"galice%s.root", post.Data());
615 fAliceFile =
new TProofOutputFile(aliceOut,
"M");
617 TString kineOut = Form(
"Kinematics%s.root", post.Data());
618 fKineFile =
new TProofOutputFile(kineOut,
"M");
628 std::ifstream* pin =
new std::ifstream(
"grp.dat");
630 Warning(
"ReadGRPLine",
"Failed to open \"grp.dat\"");
633 std::istream& in = *pin;
638 if (line.IsNull())
continue;
639 if (line.BeginsWith(
"#"))
continue;
646 Warning(
"ReadGRPLine",
"Got no line from \"grp.dat\"");
650 fGRP =
new TNamed(
"GRP",env.Data());
651 if (fVerbose) Info(
"ReadGRPLine",
"Read \"%s\"", env.Data());
660 Long_t ret = gROOT->ProcessLine(
"grp");
662 Warning(
"OverrideGRP",
"GRP not set yet, cannot override");
666 if (fVerbose) Info(
"OverrideGRP",
"No overrides defined");
669 TIter next(fOverrides);
671 while ((o = next())) {
673 Info(
"OverrideGRP",
"Overriding GRP setting %s with %s",
674 o->GetName(), o->GetTitle());
675 gROOT->ProcessLine(Form(
"grp->%s = %s;",
676 o->GetName(), o->GetTitle()));
678 Info(
"OverrideGRP",
"After overriding:");
679 gROOT->ProcessLine(
"grp->Print()");
690 fOverrides =
new TList;
691 fOverrides->SetName(
"overrides");
693 fOverrides->Add(
new TNamed(field, value));
711 if (fVerbose) Info(
"Begin",
"Called for FastSim");
713 if (fMonitor > 0 && !gROOT->IsBatch()) {
717 gROOT->Macro(Form(
"GRP.C(%d)", fRunNo));
720 gProof->AddInput(fGRP);
721 if (fOverrides) gProof->AddInput(fOverrides);
724 if (fVerbose) Info(
"Begin",
"Perhaps override");
726 if (fVerbose) Info(
"Begin",
"Defining centrality estimators");
729 fCentEstimators =
new TList;
733 fCentEstimators->Add(fBEstimator);
752 TIter next(fCentEstimators);
754 while ((estimator = static_cast<FastCentEstimator*>(next()))) {
755 estimator->
Print(
"nah");
758 if (fVerbose) Info(
"Begin",
"End of begin");
766 if (fVerbose) Info(
"SlavesBegin",
"Called for FastSim");
782 fShortHead.Reset(fRunNo, iEv);
785 fHeader->Reset(fRunNo, iEv);
786 fRunLoader->SetEventNumber(iEv);
788 fRunLoader->MakeTree(
"K");
790 TIter next(fCentEstimators);
792 while ((estimator = static_cast<FastCentEstimator*>(next())))
806 fShortHead.fRunNo = fHeader->GetRun();
807 fShortHead.fEventId = fHeader->GetEvent();
809 fHeader->GenEventHeader()->PrimaryVertex(ip);
810 fShortHead.fIpX = ip[0];
811 fShortHead.fIpY = ip[1];
812 fShortHead.fIpZ = ip[2];
815 AliGenEventHeader* genHeader = fHeader->GenEventHeader();
816 AliCollisionGeometry* geometry =
817 dynamic_cast<AliCollisionGeometry*
>(genHeader);
818 AliGenPythiaEventHeader* pythia =
819 dynamic_cast<AliGenPythiaEventHeader*
>(genHeader);
820 AliGenDPMjetEventHeader* dpm =
821 dynamic_cast<AliGenDPMjetEventHeader*
>(genHeader);
822 AliGenGeVSimEventHeader* gev =
823 dynamic_cast<AliGenGeVSimEventHeader*
>(genHeader);
824 AliGenHerwigEventHeader* herwig =
825 dynamic_cast<AliGenHerwigEventHeader*
>(genHeader);
826 AliGenCocktailEventHeader* cocktail =
827 dynamic_cast<AliGenCocktailEventHeader*
>(genHeader);
828 AliGenHijingEventHeader* hijing =
829 dynamic_cast<AliGenHijingEventHeader*
>(genHeader);
831 TList* headers = cocktail->GetHeaders();
832 if (!headers) Warning(
"",
"No headers in cocktail!");
834 AliGenEventHeader* header = 0;
835 AliCollisionGeometry* geom = 0;
836 while ((header = static_cast<AliGenEventHeader*>(next()))) {
837 AliCollisionGeometry* g =
dynamic_cast<AliCollisionGeometry*
>(header);
839 hijing =
dynamic_cast<AliGenHijingEventHeader*
>(header);
841 if (geom) geometry = geom;
848 fShortHead.fB = geometry->ImpactParameter();
849 fShortHead.fNtgt = geometry->TargetParticipants();
850 fShortHead.fNproj = geometry->ProjectileParticipants();
851 fShortHead.fNbin = geometry->NN();
852 fShortHead.fPhiR = geometry->ReactionPlaneAngle();
853 fShortHead.fNSpecNproj = geometry->ProjSpectatorsn();
854 fShortHead.fNSpecPproj = geometry->ProjSpectatorsp();
855 fShortHead.fNSpecNtgt = geometry->TargSpectatorsn();
856 fShortHead.fNSpecPtgt = geometry->TargSpectatorsp();
862 Int_t type = pythia->ProcessType();
865 case 92:
case 93: sd =
true;
break;
866 case 94: dd =
true;
break;
871 case 103:
case 104: sd =
true;
break;
872 case 105: dd =
true;
break;
875 fShortHead.fB = pythia->GetImpactParameter();
876 fShortHead.fNtgt = 1;
877 fShortHead.fNproj = 1;
878 fShortHead.fNbin = 1;
886 Int_t nPart = fStack->GetNprimary();
887 for (
Int_t iPart = 0; iPart < nPart; iPart++) {
888 TParticle* particle = fStack->Particle(iPart);
889 Int_t ks = particle->GetStatusCode();
891 if (ks == 13) side = -1;
892 if (ks == 14) side = +1;
893 if (side == 0)
continue;
894 Int_t kf = particle->GetPdgCode();
896 if (side < 0) nSpecNproj++;
900 if (side < 0) nSpecPproj++;
904 fShortHead.fNSpecNtgt = nSpecNtgt;
905 fShortHead.fNSpecNproj = nSpecNproj;
906 fShortHead.fNSpecPtgt = nSpecPtgt;
907 fShortHead.fNSpecPproj = nSpecPproj;
910 Int_t type = dpm->ProcessType();
911 #ifndef NO_DPMJET_TYPE 913 case 5:
case 6: sd =
true;
917 static bool first =
true;
920 Func_t add =
gSystem->DynFindSymbol(
"*",
"dtglcp_");
922 Warning(
"",
"Didn't find dtglcp_");
933 Int_t nsd1=0, nsd2=0, ndd=0;
934 Int_t npP = dpm->ProjectileParticipants();
935 Int_t npT = dpm->TargetParticipants();
937 dpm->GetNDiffractive(nsd1,nsd2,ndd);
939 if ((ndd == 0) && ((npP == nsd1) || (npT == nsd2))) sd =
true;
940 else if (ndd == (npP + npT)) dd =
true;
941 Int_t ncp = dpm->NN();
942 Int_t nct = dpm->NNw();
943 Int_t nwp = dpm->NwN();
944 Int_t nwt = dpm->NwNw();
948 Printf(
"@ Npp sd1 Npt sd2 dd tpe Ncp Nct Nwp Nwt acc sam");
951 Printf(
"@ %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d",
952 npP, nsd1, npT, nsd2, ndd, type, ncp, nct, nwp, nwt,
956 if (gev) fShortHead.fPhiR = gev->GetEventPlane();
958 Int_t type = herwig->ProcessType();
960 case 5:
case 6: sd =
true;
break;
962 fShortHead.fNtgt = 1;
963 fShortHead.fNproj = 1;
964 fShortHead.fNbin = 1;
966 fShortHead.fType = (sd ? 0x1 : 0) | (dd ? 0x2 : 0);
970 Double_t c = fBEstimator->GetCentrality(b);
971 Info(
"ProcessHeader",
"b=%f isProjA=%d isTgtA=%d cms=%f",
972 b, fIsProjA, fIsTgtA, fGenerator ? fGenerator->GetEnergyCMS() : -1);
973 if (c >= 0) fShortHead.fC =
c;
976 Bool_t selected = (fShortHead.fIpZ <= fHIpz->GetXaxis()->GetXmax() &&
977 fShortHead.fIpZ >= fHIpz->GetXaxis()->GetXmin());
981 fHPhiR->Fill(fShortHead.fPhiR*TMath::RadToDeg());
982 fHB->Fill(fShortHead.fB);
983 fHIpz->Fill(fShortHead.fIpZ);
984 if (dd) fHType->Fill(3);
985 if (sd) fHType->Fill(2);
986 if (!dd && !sd) fHType->Fill(1);
988 fHEta ->AddBinContent(0);
989 fHY ->AddBinContent(0);
990 fHTime->AddBinContent(0);
993 TIter next(fCentEstimators);
995 while ((estimator = static_cast<FastCentEstimator*>(next())))
1007 if (eta < +5.1 && eta > +2.8)
1009 if (eta < -1.7 && eta > -3.7)
1011 if (eta < +6.3 && eta > +4.8)
1013 if (eta < -4.9 && eta > -7.0)
1015 if (TMath::Abs(eta) < 1)
1027 Int_t nPart = fStack->GetNprimary();
1028 for (
Int_t iPart = 0; iPart < nPart; iPart++) {
1029 TParticle* particle = fStack->Particle(iPart);
1030 TParticlePDG*
pdg = particle->GetPDG();
1031 Bool_t primary = fStack->IsPhysicalPrimary(iPart);
1032 Bool_t weakDecay = fStack->IsSecondaryFromWeakDecay(iPart);
1033 Bool_t charged = (pdg && TMath::Abs(pdg->Charge()) > 0);
1034 if (primary) particle->SetBit(BIT(14));
1035 if (weakDecay) particle->SetBit(BIT(15));
1036 if (charged) particle->SetBit(BIT(16));
1038 new ((*fParticles)[iPart]) TParticle(*particle);
1040 TIter next(fCentEstimators);
1042 while ((estimator = static_cast<FastCentEstimator*>(next())))
1045 if (!selected || !charged || !primary)
continue;
1048 if (y > fHY->GetXaxis()->GetXmin() &&
1049 y < fHY->GetXaxis()->GetXmax())
1054 if (pT < 1e-10)
continue;
1056 Double_t theta = TMath::ATan2(pT, pZ);
1057 Double_t eta = -TMath::Log(TMath::Tan(theta/2));
1059 if (eta > fHEta->GetXaxis()->GetXmin() &&
1060 eta < fHEta->GetXaxis()->GetXmax())
1072 fHeader->SetNprimary(fStack->GetNprimary());
1073 fHeader->SetNtrack(fStack->GetNtrack());
1082 TIter next(fCentEstimators);
1084 while ((estimator = static_cast<FastCentEstimator*>(next())))
1089 fStack->FinishEvent();
1090 fHeader->SetStack(fStack);
1092 fRunLoader->TreeE()->Fill();
1093 fRunLoader->WriteKinematics(
"OVERWRITE");
1110 fHTime->Fill(1, timer.RealTime());
1115 fHTime->Fill(2, timer.RealTime());
1119 Bool_t selected = ProcessHeader();
1120 fHTime->Fill(3, timer.RealTime());
1124 ProcessParticles(selected);
1125 fHTime->Fill(4, timer.RealTime());
1130 fHTime->Fill(5, timer.RealTime());
1136 fGenerator->FinishRun();
1137 fRunLoader->WriteHeader(
"OVERWRITE");
1138 fGenerator->Write();
1139 fRunLoader->Write();
1151 if (fVerbose) fProofFile->Print();
1152 fOutput->Add(fProofFile);
1153 fOutput->Add(
new TH1F(
"filename", fFileName.Data(),1,0,1));
1157 fTree->Write(0, TObject::kOverwrite);
1163 TFile* galice = GetGAlice();
1165 if (fVerbose) fAliceFile->Print();
1166 fAliceFile->AdoptFile(galice);
1167 fAliceFile->SetOutputFileName(fAliceFile->GetName());
1168 fOutput->Add(fAliceFile);
1173 TFile* kine = GetKine();
1175 if (fVerbose) fKineFile->Print();
1176 fKineFile->AdoptFile(kine);
1177 fKineFile->SetOutputFileName(fKineFile->GetName());
1178 fOutput->Add(fKineFile);
1184 Info(
"SlaveTerminate",
"Content of output list");
1185 gROOT->IncreaseDirLevel();
1187 gROOT->DecreaseDirLevel();
1189 gSystem->Exec(
"echo \"Content of working directory\"");
1190 gSystem->Exec(
"ls -l1 | sed 's/^/ /'");
1205 while ((o = next())) {
1206 if (o->IsA()->InheritsFrom(TCollection::Class())) {
1207 if (fVerbose) Info(
"FlushList",
"Got collection: %s", c->GetName());
1208 TDirectory* cur = dir->mkdir(o->GetName());
1209 FlushList(static_cast<TCollection*>(o), cur);
1224 if (gProof) gProof->ClearFeedback();
1227 fList =
static_cast<TList*
>(fOutput->FindObject(
"histograms"));
1229 Error(
"Terminate",
"No output list");
1234 TObject* fn = fOutput->FindObject(
"filename");
1235 if (fn) fFileName = fn->GetTitle();
1237 static_cast<TProofOutputFile*
>(fOutput->FindObject(FileName()));
1240 fFile = fProofFile->OpenFile(
"UPDATE");
1242 fFile = TFile::Open(FileName(),
"UPDATE");
1244 TList* estimators =
static_cast<TList*
>(fList->FindObject(
"estimators"));
1245 TList* histos =
static_cast<TList*
>(fList->FindObject(
"histograms"));
1247 Warning(
"Terminate",
"No histogram list found in output");
1250 TIter next(fCentEstimators);
1252 while ((estimator = static_cast<FastCentEstimator*>(next())))
1255 fHEta =
static_cast<TH1*
>(histos->FindObject(
"dNdeta"));
1256 fHY =
static_cast<TH1*
>(histos->FindObject(
"dNdy"));
1257 fHIpz =
static_cast<TH1*
>(histos->FindObject(
"ipZ"));
1258 fHType =
static_cast<TH1*
>(histos->FindObject(
"type"));
1259 fHCent =
static_cast<TH1*
>(histos->FindObject(
"cent"));
1260 fHB =
static_cast<TH1*
>(histos->FindObject(
"b"));
1261 fHPhiR =
static_cast<TH1*
>(histos->FindObject(
"phiR"));
1262 fHTime =
static_cast<TH1*
>(histos->FindObject(
"timing"));
1263 fHTrig =
static_cast<TH1*
>(histos->FindObject(
"trigger"));
1265 if (!(fHEta && fHY && fHIpz && fHType && fHB && fHPhiR && fHTime)) {
1266 Warning(
"Terminate",
"Missing histograms (%p,%p,%p,%p,%p,%p,%p)",
1267 fHEta, fHY, fHIpz, fHType, fHB, fHPhiR, fHTime);
1271 Int_t nTotal = fHIpz->GetEntries();
1272 fHEta ->Scale(1./nTotal,
"width");
1273 fHY ->Scale(1./nTotal,
"width");
1274 fHB ->Scale(1./nTotal,
"width");
1275 fHPhiR->Scale(1./nTotal,
"width");
1276 fHTime->Scale(1./nTotal,
"width");
1277 fHTrig->Scale(1./nTotal,
"width");
1280 Warning(
"Terminate",
"No file to write to");
1284 FlushList(fList, fFile);
1286 fTree =
static_cast<TTree*
>(fFile->Get(
"T"));
1287 if (!fTree) Warning(
"Terminate",
"No tree");
1289 if (fVerbose) fFile->ls();
1301 if (!fRunLoader)
return 0;
1302 TString galiceName = fRunLoader->GetFileName();
1303 TFile*
file = gROOT->GetFile(galiceName);
1305 Warning(
"GetGAlice",
"Didn't find galice file \"%s\"", galiceName.Data());
1306 gROOT->GetListOfFiles()->ls();
1318 if (!fRunLoader)
return 0;
1319 TString kineName =
"Kinematics.root";
1320 TString galiceName = fRunLoader->GetFileName();
1322 if (dir.EqualTo(
".")) dir =
"";
1323 if (!dir.IsNull() && dir[dir.Length()-1] !=
'/') dir.Append(
"/");
1324 kineName.Prepend(dir);
1326 TFile*
file = gROOT->GetFile(kineName);
1328 Warning(
"GetKine",
"Didn't find kinematics file \"%s\"", kineName.Data());
1329 gROOT->GetListOfFiles()->ls();
1342 if (!fInput)
return;
1344 TObject* save = fInput->FindObject(
"PROOF_SaveGALICE");
1347 TString sMode = save->GetTitle();
1348 if (!sMode.EqualTo(
"split", TString::kIgnoreCase))
return;
1351 TSystemDirectory*
dir =
new TSystemDirectory(
".",
1353 TList* files = dir->GetListOfFiles();
1354 TSystemFile*
file = 0;
1356 while ((file = static_cast<TSystemFile*>(next()))) {
1357 if (file->IsDirectory())
continue;
1359 if (!fn.BeginsWith(
"galice") && !fn.BeginsWith(
"Kinematics"))
1362 TPRegexp regex(
"(.*)_([^_]+)\\.root");
1364 if (matches->GetEntriesFast() < 3) {
1368 TString ord = matches->At(2)->GetName();
1369 TString bse = matches->At(1)->GetName();
1371 if (
gSystem->AccessPathName(ord,kFileExists))
1375 Info(
"MoveAliceFiles",
"Moving %s to %s/%s.root",
1376 fn.Data(), ord.Data(), bse.Data());
1377 file->Move(Form(
"%s/%s.root", ord.Data(), bse.Data()));
1379 if (!bse.EqualTo(
"galice"))
continue;
1380 TObjString*
url =
new TObjString(Form(
"file://%s/%s/%s.root?#TE",
1385 Info(
"MoveAliceFiles",
"Adding \"%s\" to file list",
1389 if (lst->GetEntries() <= 0)
return;
1390 if (fVerbose) lst->ls();
1392 TFile* out = TFile::Open(
"index.root",
"RECREATE");
1393 lst->Write(
"TE",TObject::kSingleKey);
1497 SetOverrides(sim, overrides);
1503 Printf(
"=== Event # %6lld/%6lld ==========================",
1517 if (!gProof)
return;
1521 clsLib.Add(
new TNamed(
"TVirtualMC",
"libVMC"));
1522 clsLib.Add(
new TNamed(
"TLorentzVector",
"libPhysics"));
1523 clsLib.Add(
new TNamed(
"TLinearFitter",
"libMinuit"));
1524 clsLib.Add(
new TNamed(
"TTree",
"libTree"));
1525 clsLib.Add(
new TNamed(
"TProof",
"libProof"));
1526 clsLib.Add(
new TNamed(
"TGFrame",
"libGui"));
1527 clsLib.Add(
new TNamed(
"TSAXParser",
"libXMLParser"));
1528 clsLib.Add(
new TNamed(
"AliVEvent",
"libSTEERBase"));
1529 clsLib.Add(
new TNamed(
"AliESDEvent",
"libESD"));
1530 clsLib.Add(
new TNamed(
"AliAODEvent",
"libAOD"));
1531 clsLib.Add(
new TNamed(
"AliAnalysisManager",
"libANALYSIS"));
1532 clsLib.Add(
new TNamed(
"AliCDBManager",
"libCDB"));
1533 clsLib.Add(
new TNamed(
"AliRawVEvent",
"libRAWDatabase"));
1534 clsLib.Add(
new TNamed(
"AliHit",
"libSTEER"));
1535 clsLib.Add(
new TNamed(
"AliGenMC",
"libEVGEN"));
1536 clsLib.Add(
new TNamed(
"AliFastEvent",
"libFASTSIM"));
1538 TIter next(&clsLib);
1540 while ((obj = next())) {
1541 gProof->Exec(Form(
"gROOT->LoadClass(\"%s\",\"%s\");",
1542 obj->GetName(), obj->GetTitle()));
1574 TProof::Reset(url.GetUrl());
1575 TProof::Open(url.GetUrl());
1576 gProof->ClearCache();
1581 TString fwd = phy +
"/PWGLF/FORWARD/analysis2";
1583 gProof->AddIncludePath(Form(
"%s/include", ali.Data()));
1584 gProof->AddIncludePath(Form(
"%s/include", phy.Data()));
1586 gProof->Load(Form(
"%s/sim/GRP.C",fwd.Data()),
true);
1587 gProof->Load(Form(
"%s/sim/BaseConfig.C",fwd.Data()),
true);
1588 gProof->Load(Form(
"%s/sim/EGConfig.C",fwd.Data()),
true);
1591 gProof->Load(Form(
"%s/sim/FastShortHeader.C", fwd.Data()));
1592 gProof->Load(Form(
"%s/sim/FastCentEstimators.C+%s",fwd.Data(),
opt));
1593 gProof->Load(Form(
"%s/sim/FastMonitor.C+%s",fwd.Data(),
opt));
1594 gProof->Load(Form(
"%s/sim/FastSim.C+%s", fwd.Data(),
opt),
true);
1595 gProof->SetParameter(
"PROOF_SaveGALICE", save);
1598 SetOverrides(sim, overrides);
1600 gProof->Process(sim, nev,
"");
1619 Int_t idx = in.Index(sep);
1620 if (idx == kNPOS)
return false;
1623 val = in(idx+1, in.Length()-idx-1);
1628 if (
override.IsNull())
return;
1630 const char* valid[] = {
"beamEnergy",
1639 TObjArray* tokens =
override.Tokenize(
",");
1640 TObjString* token = 0;
1642 while ((token = static_cast<TObjString*>(next()))) {
1643 TString& str = token->String();
1644 if (str.IsNull())
continue;
1647 if (!Str2KeyVal(str,key,val,
':')) {
1648 Printf(
"Warning: FastSim::Run: incomplete override '%s'",str.Data());
1651 const char** pvalid = valid;
1653 if (key.EqualTo(*pvalid, TString::kIgnoreCase)) {
1659 Printf(
"Warning: FastSim::Run: Invalid override '%s'", key.Data());
1663 if (key.EqualTo(
"period",TString::kIgnoreCase))
1664 val = Form(
"\"%s\"", val.Data());
1702 Printf(
"Will run fast simulation with:\n\n\t%s\n\n",url);
1715 TObjString* token = 0;
1716 TIter nextToken(opts);
1717 while ((token = static_cast<TObjString*>(nextToken()))) {
1718 TString& str = token->String();
1719 if (str.IsNull())
continue;
1721 if (str.EqualTo(
"verbose")) { verbose =
true; str =
""; }
1723 if (str.IsNull())
continue;
1726 if (!Str2KeyVal(str,key,val)) {
1727 if (!out.IsNull()) out.Append(
"&");
1732 if (key.EqualTo(
"events")) nev = val.Atoll();
1733 else if (key.EqualTo(
"run")) run = val.Atoi();
1734 else if (key.EqualTo(
"eg")) eg = val;
1735 else if (key.EqualTo(
"override"))
override = val;
1736 else if (key.EqualTo(
"save")) save = val;
1737 else if (key.EqualTo(
"monitor")) monitor = val.Atoi();
1738 else if (key.EqualTo(
"b")) {
1740 if (Str2KeyVal(val, min, max,
'-')) {
1746 if (!out.IsNull()) out.Append(
"&");
1753 Printf(
"Error: FastSim::Run: URL %s is invalid", u.GetUrl());
1759 Printf(
"Run %s for %lld events anchored at %d\n" 1760 " Impact paramter range: %5.1f-%5.1f fm\n" 1761 " Monitor frequency: %d sec\n" 1762 " Execution url: %s",
1763 eg.Data(), nev, run, bMin, bMax, monitor, u.GetUrl());
1771 ret = LocalRun(nev, run, eg, bMin, bMax, monitor, verbose,
override);
1773 ret = ProofRun(u, nev, run, eg, bMin, bMax,
1774 monitor, verbose,
override, save,
opt);
1787 :
FastSim(
"epos", run, 0, 20, 100000, monitor),
1811 fInNTot = fInTree->GetLeaf(
"nPart");
1812 fInB = fInTree->GetLeaf(
"ImpactParameter");
1813 fInPDG = fInTree->GetLeaf(
"pdgid");
1814 fInStatus = fInTree->GetLeaf(
"status");
1815 fInPx = fInTree->GetLeaf(
"px");
1816 fInPy = fInTree->GetLeaf(
"py");
1817 fInPz = fInTree->GetLeaf(
"pz");
1818 fInE = fInTree->GetLeaf(
"E");
1819 fInM = fInTree->GetLeaf(
"m");
1821 fInNcollH = fInTree->GetLeaf(
"Ncoll_hard");
1822 fInNpartP = fInTree->GetLeaf(
"Npart_proj");
1823 fInNpartT = fInTree->GetLeaf(
"Npart_targ");
1824 fInNcoll = fInTree->GetLeaf(
"Ncoll");
1825 fInNSpcPN = fInTree->GetLeaf(
"Nspec_proj_neut");
1826 fInNSpcTN = fInTree->GetLeaf(
"Nspec_targ_neut");
1827 fInNSpcPP = fInTree->GetLeaf(
"Nspec_proj_prot");
1828 fInNSpcTP = fInTree->GetLeaf(
"Nspec_targ_prot");
1829 fInPhiR = fInTree->GetLeaf(
"phiR");
1833 return (fInNTot && fInB && fInPDG && fInPx && fInPy && fInPz && fInE);
1838 TIter next(fCentEstimators);
1840 while ((estimator = static_cast<FastCentEstimator*>(next()))) {
1841 if (!estimator->IsA()->InheritsFrom(V0CentEstimator::Class()))
1850 Info(
"Init",
"Initializing with tree %p (%s)",
1851 tree, (tree ? tree->ClassName() :
""));
1854 TFile*
file = tree->GetCurrentFile();
1855 Info(
"Init",
"Current file: (%p) %s", file,
1856 (file ? file->GetName() :
""));
1859 if (!SetupBranches())
1860 Fatal(
"Init",
"Failed to set-up branches");
1872 Warning(
"Notify",
"No tree set yet!");
1875 TFile*
file = fInTree->GetCurrentFile();
1876 Info(
"Notify",
"processing file: (%p) %s", file,
1877 (file ? file->GetName() :
""));
1878 if (!file)
return true;
1879 if (!SetupBranches()) {
1880 Warning(
"Notify",
"Failed to set-up branches");
1888 if (!tmp.IsNull())
return tmp.Data();
1891 gROOT->ProcessLine(
"Form(\"%s(%d,%d)+%s(%d,%d) @ %5d b in[%4.1f,%4.1f]\"," 1892 "grp->beam1.Name(), grp->beam1.a, grp->beam1.z," 1893 "grp->beam2.Name(), grp->beam2.a, grp->beam2.z," 1894 "Int_t(grp->energy))");
1895 tmp.Append(reinterpret_cast<const char*>(ret));
1896 Printf(
"EG title set to %s", tmp.Data());
1902 fIsTgtA = gROOT->ProcessLine(
"grp->beam1.IsA()");
1903 fIsProjA = gROOT->ProcessLine(
"grp->beam2.IsA()");
1910 Int_t read = fInTree->GetTree()->GetEntry(iEv);
1911 if (read <= 0)
return false;
1914 fShortHead.Reset(fRunNo, iEv);
1915 fParticles->Clear();
1918 TIter next(fCentEstimators);
1920 while ((estimator = static_cast<FastCentEstimator*>(next())))
1927 fShortHead.fIpX = 0;
1928 fShortHead.fIpY = 0;
1929 fShortHead.fIpZ = 0;
1930 fShortHead.fB = fInB->GetValue();
1931 fShortHead.fNtgt = (fInNpartT ? fInNpartT->GetValue() : 0);
1932 fShortHead.fNproj = (fInNpartP ? fInNpartP->GetValue() : 0);
1933 fShortHead.fNbin = (fInNcoll ? fInNcoll ->GetValue() : 0);
1934 fShortHead.fPhiR = (fInPhiR ? fInPhiR ->GetValue() : 0);
1935 fShortHead.fNSpecNproj = (fInNSpcPN ? fInNSpcPN->GetValue() : 0);
1936 fShortHead.fNSpecNtgt = (fInNSpcTN ? fInNSpcTN->GetValue() : 0);
1937 fShortHead.fNSpecPproj = (fInNSpcPP ? fInNSpcPP->GetValue() : 0);
1938 fShortHead.fNSpecPtgt = (fInNSpcTP ? fInNSpcTP->GetValue() : 0);
1941 Double_t c = fBEstimator->GetCentrality(fShortHead.fB);
1942 if (c >= 0) fShortHead.fC =
c;
1945 Bool_t selected = (fShortHead.fIpZ <= fHIpz->GetXaxis()->GetXmax() &&
1946 fShortHead.fIpZ >= fHIpz->GetXaxis()->GetXmin());
1950 fHPhiR->Fill(fShortHead.fPhiR*TMath::RadToDeg());
1951 fHB->Fill(fShortHead.fB);
1952 fHIpz->Fill(fShortHead.fIpZ);
1956 TIter next(fCentEstimators);
1958 while ((estimator = static_cast<FastCentEstimator*>(next())))
1964 Int_t nTot = fInNTot->GetValue();
1965 for (
Int_t iPart = 0; iPart < nTot; iPart++) {
1966 Int_t status = fInStatus->GetValue(iPart);
1967 Int_t pdg = fInPDG->GetValue(iPart);
1968 Double_t px = fInPx->GetValue(iPart);
1969 Double_t py = fInPy->GetValue(iPart);
1970 Double_t pz = fInPz->GetValue(iPart);
1972 Double_t e = fInE->GetValue(iPart);
1975 TParticle* particle =
1976 new ((*fParticles)[iPart]) TParticle(pdg, status,-1,-1,-1,-1,
1977 px, py, pz, e, 0, 0, 0, 0);
1978 TParticlePDG* pdgP = particle->GetPDG();
1979 Bool_t primary = status == 1;
1980 Bool_t weakDecay =
false;
1981 Bool_t charged = (pdgP && TMath::Abs(pdgP->Charge()) > 0);
1982 if (primary) particle->SetBit(BIT(14));
1983 if (weakDecay) particle->SetBit(BIT(15));
1984 if (charged) particle->SetBit(BIT(16));
1986 TIter next(fCentEstimators);
1988 while ((estimator = static_cast<FastCentEstimator*>(next())))
1991 if (!selected || !charged || !primary)
continue;
1992 fHY ->Fill(particle->Y());
1994 if (pT < 1e-10)
continue;
1996 Double_t theta = TMath::ATan2(pT, pZ);
1997 Double_t eta = -TMath::Log(TMath::Tan(theta/2));
2007 TIter next(fCentEstimators);
2009 while ((estimator = static_cast<FastCentEstimator*>(next())))
2056 Printf(
"=== Event # %6lld/%6lld ==========================",
2076 TProof::Reset(url.GetUrl());
2077 TProof::Open(url.GetUrl());
2078 gProof->ClearCache();
2083 TString fwd = phy +
"/PWGLF/FORWARD/analysis2";
2085 gProof->AddIncludePath(Form(
"%s/include", ali.Data()));
2086 gProof->AddIncludePath(Form(
"%s/include", phy.Data()));
2088 gProof->Load(Form(
"%s/sim/GRP.C",fwd.Data()),
true);
2089 gProof->Load(Form(
"%s/sim/BaseConfig.C",fwd.Data()),
true);
2090 gProof->Load(Form(
"%s/sim/EGConfig.C",fwd.Data()),
true);
2093 gProof->Load(Form(
"%s/sim/FastMonitor.C+%s",fwd.Data(),
opt));
2094 gProof->Load(Form(
"%s/sim/FastShortHeader.C", fwd.Data()));
2095 gProof->Load(Form(
"%s/sim/FastCentEstimators.C+%s",fwd.Data(),
opt));
2096 gProof->Load(Form(
"%s/sim/FastSim.C+%s", fwd.Data(),
opt),
true);
2133 Printf(
"Will run fast simulation with:\n\n\t%s\n\n",url);
2141 TObjString* token = 0;
2142 TIter nextToken(opts);
2143 while ((token = static_cast<TObjString*>(nextToken()))) {
2144 TString& str = token->String();
2145 if (str.IsNull())
continue;
2147 if (str.EqualTo(
"verbose")) { verbose =
true; str =
""; }
2149 if (str.IsNull())
continue;
2152 if (!Str2KeyVal(str,key,val)) {
2153 if (!out.IsNull()) out.Append(
"&");
2158 if (key.EqualTo(
"run")) run = val.Atoi();
2159 else if (key.EqualTo(
"monitor")) monitor = val.Atoi();
2160 else if (key.EqualTo(
"events")) nev = val.Atoi();
2162 if (!out.IsNull()) out.Append(
"&");
2169 Printf(
"Error: FastSim::Run: URL %s is invalid", u.GetUrl());
2173 Printf(
"Run EPos anchored at %d\n" 2174 " Monitor frequency: %d sec\n" 2175 " Execution url: %s",
2176 run, monitor, u.GetUrl());
2178 TString treeName = u.GetAnchor();
2179 if (treeName.IsNull()) treeName =
"Particle";
2180 TFile*
file = TFile::Open(u.GetFile(),
"READ");
2182 Printf(
"Error: FastAnalysis::Run: Failed to open %s",
2188 TObject* o = file->Get(treeName);
2190 Printf(
"Error: FastAnalysis::Run: Couldn't get %s from %s",
2191 treeName.Data(), u.GetFile());
2196 if (o->IsA()->InheritsFrom(TChain::Class()))
2197 cret = chain->Add(static_cast<TChain*>(o));
2198 else if (o->IsA()->InheritsFrom(TTree::Class()))
2199 cret = chain->AddFile(u.GetFile());
2200 else if (o->IsA()->InheritsFrom(TCollection::Class()))
2201 cret = chain->AddFileInfoList(static_cast<TCollection*>(o));
2202 else if (o->IsA()->InheritsFrom(TFileCollection::Class()))
2203 cret = chain->AddFileInfoList(static_cast<TFileCollection*>(o)
2207 Printf(
"Error: FastAnalysis::Run: Failed to create chain");
2211 TString proto = u.GetProtocol();
2212 Bool_t isProof = (proto.EqualTo(
"proof") || proto.EqualTo(
"lite"));
2214 if (!SetupProof(u,
opt))
return false;
2220 if (nev < 0) nev = TChain::kBigNumber;
2225 Long64_t ret = chain->Process(sim,
"", nev, 0);
Bool_t PreEvent(Long64_t iEv)
static void ProofLoadLibs()
virtual Bool_t SetupGRP()
Bool_t fIsProjA
True if target beam is nuclei.
const char * GetEGTitle() const
static Bool_t Run(const char *url, const char *opt="")
virtual void Init(TTree *)
virtual Bool_t Process(Long64_t iEv)
virtual void Begin(TTree *)
void FlushList(TCollection *c, TDirectory *dir)
static Bool_t SetupProof(const TUrl &url, const char *opt="")
AliStack * fStack
Loader of trees.
static Bool_t LocalRun(Long64_t nev, UInt_t run, Int_t monitor, Bool_t verbose)
virtual void Terminate(TCollection *out)=0
AliGenerator * fGenerator
virtual void CheckTrigger(Double_t eta)
TProofOutputFile * fAliceFile
Proof output file.
const char * GetName() const
TList * fOverrides
GRP in one line.
virtual void ProcessHeader(FastShortHeader &)
const char * GetTitle() const
TProofOutputFile * fProofFile
Bool_t fVerbose
Output file name.
void Connect(Int_t freq=-1)
virtual void Print(Option_t *option="") const
const char * FileName() const
static Bool_t Str2KeyVal(const TString &in, TString &key, TString &val, const char sep='=')
TH1 * fHB
Event type histogram.
BCentEstimator * fBEstimator
void Flip(Bool_t onlySign=true)
FastShortHeader fShortHead
const char * GetName() const
virtual UShort_t GetSNN() const
FastSim(const char *eg="", ULong_t runNo=0, Double_t bMin=0, Double_t bMax=20, Long64_t nEvents=0, Int_t monitor=0)
TH1 * fHType
IPz histogram.
Double_t nEvents
plot quality messages
TProofOutputFile * fKineFile
AliHeader * fHeader
Stack of particles.
TH1 * fHEta
List of outputs.
static Bool_t Run(const char *url, const char *opt="")
virtual Bool_t SetupGen()
TH1 * fHTime
Reaction plane.
void SetVerbose(Bool_t verb)
TList * GetListOfFiles(const char *input=".")
virtual void Process(const TParticle *p)=0
void Register(TObject *descr, Bool_t proof=true)
virtual Bool_t PreEvent(Long64_t iEv)
EPosSim(UInt_t run=0, Int_t monitor=0)
static Bool_t ProofRun(const TUrl &url, Long64_t nev, UInt_t run, const TString &gen, Double_t bMin, Double_t bMax, Int_t monitor=-1, Bool_t verbose=false, const TString &overrides="", const TString &save="none", const char *opt="")
FastSimMonitor(TSelector *s=0)
AliRunLoader * fRunLoader
Event generator.
TFile * file
TList with histograms for a given trigger.
TString fFileName
Output file.
static Bool_t LocalRun(Long64_t nev, UInt_t run, const TString &gen, Double_t bMin, Double_t bMax, Int_t monitor, Bool_t verbose, const TString &overrides="")
TClonesArray * fParticles
Custom tree.
virtual Bool_t SetupRun()
void AddOverride(const TString &field, const TString &value)
virtual const char * GetEGTitle() const
virtual Bool_t ProcessHeader()
virtual Bool_t ProcessParticles(Bool_t selected)
virtual Bool_t ProcessParticles(Bool_t selected)
virtual void Setup(TCollection *out, TTree *tree, UShort_t sNN, Bool_t tgtA, Bool_t projA)=0
TH1 * fHCent
Event type histogram.
Long64_t fNEvents
GRP setting to override.
static void SetOverrides(FastSim *sim, const TString &override)