Skip to content

Commit c3b988b

Browse files
authored
Merge pull request #70 from urasantonio/muonDev
update in MIDdetector class
2 parents e071f8a + 91e9386 commit c3b988b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/MIDdetector.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "TDatime.h"
1212
#include "TFile.h"
1313
#include "TVector3.h"
14+
#include "TMath.h"
15+
#include "TAxis.h"
1416

1517
namespace o2 {
1618
namespace delphes {
@@ -38,6 +40,8 @@ namespace o2 {
3840
printf("Object %s not found, quitting\n",Form("mAccEffMuonPID_%s",partLabel[iPart]));
3941
return kFALSE;
4042
}
43+
mMomMin[iPart] = TMath::Max(1.2, mAccEffMuonPID[iPart]->GetAxis(1)->GetXmin());
44+
mMomMax[iPart] = mAccEffMuonPID[iPart]->GetAxis(1)->GetXmax();
4145
}
4246

4347
printf("Setup of MIDdetector successfully completed\n");
@@ -49,8 +53,10 @@ namespace o2 {
4953

5054
bool MIDdetector::hasMID(const Track &track) {
5155

56+
auto pdg = std::abs(track.PID);
57+
auto part = pidmap[pdg];
5258
TVector3 v(track.XOuter, track.YOuter, track.ZOuter);
53-
return (TMath::Abs(v.Eta()) < mEtaMax);
59+
return ((TMath::Abs(v.Eta()) < mEtaMax) && (track.P > mMomMin[part]));
5460

5561
}
5662

@@ -64,7 +70,9 @@ namespace o2 {
6470

6571
auto particle = (GenParticle*) track.Particle.GetObject();
6672

67-
Double_t var[4] = {track.P, track.Eta, particle->Z, double(multiplicity)};
73+
Double_t mom = TMath::Min(track.P, mMomMax[part]);
74+
75+
Double_t var[4] = {track.Eta, mom, particle->Z, double(multiplicity)};
6876
Double_t probMuonPID = mAccEffMuonPID[part]->GetBinContent(mAccEffMuonPID[part]->GetBin(var));
6977
return (gRandom->Uniform() < probMuonPID);
7078

src/MIDdetector.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ namespace o2 {
3434
TFile *mFileAccEffMuonPID;
3535
THnSparse *mAccEffMuonPID[kNPart];
3636
const double mEtaMax = 1.6;
37+
double mMomMin[kNPart];
38+
double mMomMax[kNPart];
3739
const char *partLabel[kNPart] = {"electron","muon","pion","kaon","proton"};
3840
std::map<int, int> pidmap = { {11, kElectron}, {13, kMuon}, {211, kPion}, {321, kKaon}, {2212, kProton} };
3941

0 commit comments

Comments
 (0)