23 #include "TDatabasePDG.h" 28 #include "THashList.h" 30 #include "TGeoManager.h" 32 #include "TVirtualMC.h" 67 Double_t x, Double_t y, Double_t z)
76 Bool_t status = TH1::AddDirectoryStatus();
77 TH1::AddDirectory(kFALSE);
78 fTimeRZ =
new TH2F(
"h2rz",
"", 100, -5000., 5000, 100, 0., 1000.);
79 TH1::AddDirectory(status);
81 Double_t r = TMath::Sqrt(x*x+y*y);
96 Int_t apdg = TMath::Abs(pdg);
98 && (apdg != 1000010020)
99 && (apdg != 1000010030)
100 && (apdg != 1000020030)
101 && (apdg != 1000020040)
102 && (apdg != 50000050)
103 && (apdg != 50000051)
110 for (Int_t i=0; i<
fNtypes; i++) {
121 data = &
fPData[it->second];
124 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
126 Int_t size = pdgDB->ParticleList()->GetSize();
150 for (Int_t i = 0; i < ntypes; i++) {
151 Int_t pdg = volM->
GetPDG(i);
180 for (Int_t i=0; i<nvolumes; i++) {
182 if (TVirtualMC::GetMC()) volMon->SetName(TVirtualMC::GetMC()->VolName(i));
201 Info(
"Inspect",
"Transport monitor is empty !");
204 if (strlen(volName)) {
205 TString svname = volName;
207 for (i=1; i<ntotal; i++)
if (svname ==
fVolumeMon->At(i)->GetName())
break;
209 Error(
"Inspect",
"No monitoring info stored for volume %s", volName);
216 Info(
"Inspect",
"No particles crossed volume %s", volName);
219 Double_t *timeperpart =
new Double_t[ntypes];
220 Int_t *isort =
new Int_t[ntypes];
221 Double_t timepervol = 0.;
222 for (i=0; i<ntypes; i++) {
223 timeperpart[i] = volMon->
GetTime(i);
224 timepervol += timeperpart[i];
228 TMath::Sort(ntypes, timeperpart, isort, kTRUE);
230 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
232 for (i=0; i<ntypes; i++) {
233 timeperpart[i] /= timepervol;
234 TParticlePDG* pdgP = pdgDB->GetParticle(volMon->
GetPDG(isort[i]));
236 particle = pdgDB->GetParticle(volMon->
GetPDG(isort[i]))->GetName();
238 particle = Form(
"pdg code not in DB: %d", volMon->
GetPDG(isort[i]));
240 printf(
" %s: %g%% mean energy: %g\n", particle.Data(), 100.*timeperpart[i], volMon->
GetEmed(i));
243 TCanvas *c1 = (TCanvas*)
gROOT->GetListOfCanvases()->FindObject(
"crz");
244 if (!c1) c1 =
new TCanvas(
"crz");
248 volMon->
GetHistogram()->SetTitle(Form(
"RZ plot weighted by time spent in %s",volMon->GetName()));
257 TH1F *hnames =
new TH1F(
"volume_timing",
"relative volume timing", 3,0,3);
259 hnames->SetFillColor(38);
260 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,0) 261 hnames->SetBit(TH1::kCanRebin);
265 hnames->Fill(volMon->GetName(), volMon->
GetTotalTime());
270 hnames->LabelsDeflate();
271 hnames->GetXaxis()->LabelsOption(
">");
273 TCanvas *c = (TCanvas*)
gROOT->GetListOfCanvases()->FindObject(
"cvol_timing");
274 if (!c) c =
new TCanvas(
"cvol_timing");
279 printf(
"=============================================================================\n");
281 printf(
"Number of crossed volumes: %d from %d\n", ncrossed,
fVolumeMon->GetEntriesFast());
282 printf(
"=============================================================================\n");
297 Double_t x, Double_t y, Double_t z)
304 volMon->
StepInfo(pdg,energy,dt,x,y,z);
313 Info(
"Start",
"Cannot start twice");
343 Int_t nvol = arr->GetEntriesFast();
346 for (Int_t i = 0; i < nvol; i++) {
348 volMon->SetName(arr->At(i)->GetName());
357 for (Int_t i = 0; i < n; i++)
361 volMon1->
Merge(volMon2);
371 ::Error(
"Import",
"File %s could not be opened", fname);
376 ::Error(
"Import",
"No AliTransportMonitor object found n file %s", fname);
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TFile * Open(const char *filename, Long64_t &nevents)
Double_t GetEmed(Int_t itype) const
TObjArray * GetVolumes() const
void StepInfo(Int_t pdg, Double_t energy, Double_t dt, Double_t x, Double_t y, Double_t z)
ParticleMap_t::iterator ParticleMapIt_t
void Merge(AliTransportMonitor *mergeMon)
static void AddParticlesToPdgDataBase()
virtual ~AliTransportMonitor()
virtual ~AliTransportMonitorVol()
TH2F * GetHistogram() const
void StepInfo(Int_t volId, Int_t pdg, Double_t energy, Double_t x, Double_t y, Double_t z)
void Print(Option_t *volName="") const
TObjArray * fVolumeMon
Global timer.
AliPMonData * GetPMonData(Int_t itype) const
static AliTransportMonitor * Import(const char *fname)
Double_t GetTime(Int_t itype) const
Int_t GetPDG(Int_t itype) const
void Export(const char *fname)
Double_t GetTotalTime() const
void Merge(AliTransportMonitorVol *volM)