Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
morsch committed Aug 12, 2013
2 parents 3d5bd10 + 61dedb8 commit 2370866
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
53 changes: 52 additions & 1 deletion STEER/STEER/AliTransportMonitor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,27 @@ PMonData &AliTransportMonitor::AliTransportMonitorVol::GetPMonData(Int_t pdg)
return *data;
}

void AliTransportMonitor::AliTransportMonitorVol::Merge(AliTransportMonitorVol* volM)
{
//
// Merging
//
fTotalTime = (fTotalTime + volM->GetTotalTime());
if (fTimeRZ && volM->GetHistogram()) {
fTimeRZ->Add(volM->GetHistogram());
} else if (volM->GetHistogram()) {
fTimeRZ = (TH2F*)(volM->GetHistogram()->Clone());
}

Int_t ntypes = volM->GetNtypes();
for (Int_t i = 0; i < ntypes; i++) {
Int_t pdg = volM->GetPDG(i);
PMonData &data = GetPMonData(pdg);
data.fEdt += (volM->GetEmed(i) * volM->GetTotalTime());
data.fTime += (volM->GetTime(i));
}
}

ClassImp(AliTransportMonitor)

//______________________________________________________________________________
Expand Down Expand Up @@ -182,7 +203,8 @@ void AliTransportMonitor::Print(Option_t *volName) const
timeperpart[i] = volMon->GetTime(i);
timepervol += timeperpart[i];
}
printf("Volume %s: Transport time: %g%% of %g [s]\n", volMon->GetName(), 100.*timepervol/fTotalTime, fTotalTime);
printf("Volume %s: Transport time: %g%% of %g %g [s]\n", volMon->GetName(), 100.*timepervol/fTotalTime, fTotalTime,
volMon->GetTotalTime());
TMath::Sort(ntypes, timeperpart, isort, kTRUE);
TString particle;
TDatabasePDG *pdgDB = TDatabasePDG::Instance();
Expand Down Expand Up @@ -283,7 +305,36 @@ void AliTransportMonitor::Export(const char *fname)
file->Write();
file->Close();
}
//______________________________________________________________________________
void AliTransportMonitor::Merge(AliTransportMonitor* mergeMon)
{

// merge with monitor
if (!fVolumeMon)
{
TObjArray* arr = mergeMon->GetVolumes();
Int_t nvol = arr->GetEntriesFast();
fVolumeMon = new TObjArray(nvol);
fVolumeMon->SetOwner();
for (Int_t i = 0; i < nvol; i++) {
AliTransportMonitorVol *volMon = new AliTransportMonitorVol();
volMon->SetName(arr->At(i)->GetName());
fVolumeMon->Add(volMon);
}
} // first time


Int_t n = fVolumeMon->GetEntriesFast();
TObjArray* mergeVols = mergeMon->GetVolumes();
fTotalTime = 0;
for (Int_t i = 0; i < n; i++)
{
AliTransportMonitorVol *volMon1 = (AliTransportMonitorVol*)fVolumeMon->At(i);
AliTransportMonitorVol *volMon2 = (AliTransportMonitorVol*)mergeVols->At(i);
volMon1->Merge(volMon2);
fTotalTime += (volMon1->GetTotalTime());
}
}
//______________________________________________________________________________
AliTransportMonitor *AliTransportMonitor::Import(const char *fname)
{
Expand Down
9 changes: 8 additions & 1 deletion STEER/STEER/AliTransportMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
#include "TStopwatch.h"
#endif

#ifndef ROOT_TH2F
#include "TH2F.h"
#endif

// Class that can be plugged in the simulation to monitor transport timing per
// particle for each geometry volume.
//
// [email protected]

class TH2F;


//______________________________________________________________________________
Expand Down Expand Up @@ -51,6 +54,8 @@ class AliTransportMonitor : public TObject {
Double_t GetEmed(Int_t itype) const {return (fTotalTime>0)?fPData[itype].fEdt/fTotalTime : 0.;}
Int_t GetPDG(Int_t itype) const {return fPData[itype].fPDG;}
TH2F *GetHistogram() const {return fTimeRZ;}
AliPMonData *GetPMonData(Int_t itype) const {AliPMonData obj = fPData[itype]; return &obj;}
void Merge(AliTransportMonitorVol* volM);
private:
AliPMonData &GetPMonData(Int_t pdg);
AliTransportMonitorVol(const AliTransportMonitorVol& other) : TNamed(other), fNtypes(0), fTotalTime(0), fPData(0), fTimeRZ(0), fParticles() {}
Expand Down Expand Up @@ -84,6 +89,8 @@ class AliTransportMonitor : public TObject {
void Start();
void Stop();
void Export(const char *fname);
TObjArray* GetVolumes() const {return fVolumeMon;}
void Merge(AliTransportMonitor* mergeMon);
static AliTransportMonitor *Import(const char *fname);
private:
Double_t fTotalTime; // Total simulation time
Expand Down
9 changes: 8 additions & 1 deletion TRD/AliTRDonlineTrackMatching.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,14 @@ Int_t AliTRDonlineTrackMatching::EstimateTrackDistance(AliESDtrack *esd_track, A
}
Double_t n[3] = {n0[0]/n_len, n0[1]/n_len, n0[2]/n_len}; // normal vector of plane

AliExternalTrackParam *outerTPC = new AliExternalTrackParam(*(esd_track->GetOuterParam()));
const AliExternalTrackParam *trackParam = esd_track->GetOuterParam();
if (!trackParam) {
trackParam = esd_track->GetInnerParam();
if (!trackParam)
trackParam = esd_track;
}

AliExternalTrackParam *outerTPC = new AliExternalTrackParam(*trackParam);
Bool_t isects = TrackPlaneIntersect(outerTPC, layer_ref_global2, n, mag); // find intersection point between track and TRD layer
delete outerTPC;
outerTPC = NULL;
Expand Down

0 comments on commit 2370866

Please sign in to comment.