]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MFT/AliMuonForwardTrack.cxx
Add new global configuration for prod shuttle.
[u/mrichter/AliRoot.git] / MFT / AliMuonForwardTrack.cxx
index 6f219e7c04899f58a5fb3bf91b6b4d729261294a..46851a10c2bfb3b80f7923f5668930d1a778c4ab 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliMFTConstants.h"
 #include "TLorentzVector.h"
 #include "TDatabasePDG.h"
+#include "AliMUONConstants.h"
 
 ClassImp(AliMuonForwardTrack)
 
@@ -47,7 +48,8 @@ AliMuonForwardTrack::AliMuonForwardTrack():
   fNWrongClustersMC(-1),
   fTrackMCId(-1),
   fKinem(0,0,0,0),
-  fParamCovMatrix(5,5)
+  fParamCovMatrix(5,5),
+  fRAtAbsorberEnd(0)
 {
 
   // default constructor
@@ -72,7 +74,8 @@ AliMuonForwardTrack::AliMuonForwardTrack(AliMUONTrack *MUONTrack):
   fNWrongClustersMC(-1),
   fTrackMCId(-1),
   fKinem(0,0,0,0),
-  fParamCovMatrix(5,5)
+  fParamCovMatrix(5,5),
+  fRAtAbsorberEnd(0)
 {
 
   SetMUONTrack(MUONTrack);
@@ -96,7 +99,8 @@ AliMuonForwardTrack::AliMuonForwardTrack(const AliMuonForwardTrack& track):
   fNWrongClustersMC(track.fNWrongClustersMC),
   fTrackMCId(track.fTrackMCId),
   fKinem(track.fKinem),
-  fParamCovMatrix(track.fParamCovMatrix)
+  fParamCovMatrix(track.fParamCovMatrix),
+  fRAtAbsorberEnd(track.fRAtAbsorberEnd)
 {
 
   // copy constructor
@@ -135,6 +139,7 @@ AliMuonForwardTrack& AliMuonForwardTrack::operator=(const AliMuonForwardTrack& t
   fTrackMCId        = track.fTrackMCId;
   fKinem            = track.fKinem;
   fParamCovMatrix   = track.fParamCovMatrix;
+  fRAtAbsorberEnd   = track.fRAtAbsorberEnd;
 
   for (Int_t iPlane=0; iPlane<AliMFTConstants::fNMaxPlanes; iPlane++) fPlaneExists[iPlane] = (track.fPlaneExists)[iPlane];
   for (Int_t iParent=0; iParent<fgkNParentsMax; iParent++) {
@@ -431,52 +436,176 @@ Double_t AliMuonForwardTrack::GetOffset(Double_t x, Double_t y, Double_t z) {
 
 //====================================================================================================================================================
 
-Bool_t AliMuonForwardTrack::IsFromResonance() {
+Double_t AliMuonForwardTrack::GetDCA(Double_t x, Double_t y, Double_t z) {
 
-  Bool_t result = kFALSE;
+  // Distance of Closest Approach, according to the standard MUON terminology. Actually, the offset of the track w.r.t. the primary vertex,
+  // where the extrapolation of the track DOES NOT include the MFT information
+
+  AliMUONTrackParam param = (*((AliMUONTrackParam*)(GetTrackParamAtMUONCluster(0))));
+
+  AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(&param, z);
+  Double_t dX = param.GetNonBendingCoor() - x;
+  Double_t dY = param.GetBendingCoor()    - y;
+  return TMath::Sqrt(dX*dX + dY*dY);
+
+}
+
+//====================================================================================================================================================
 
-  if ( GetParentPDGCode(0) ==    113 ||
-       GetParentPDGCode(0) ==    221 ||
-       GetParentPDGCode(0) ==    223 ||
-       GetParentPDGCode(0) ==    331 ||
-       GetParentPDGCode(0) ==    333 ||
-       GetParentPDGCode(0) ==    443 ||
-       GetParentPDGCode(0) == 100443 ||
-       GetParentPDGCode(0) ==    553 ||
-       GetParentPDGCode(0) == 100553 ) result = kTRUE;
+Double_t AliMuonForwardTrack::GetMomentumSpectrometer(Double_t z) {
+
+  // Momentum of the track at the primary vertex plane, where the extrapolation of the track DOES NOT include the MFT information
+
+  AliMUONTrackParam param = (*((AliMUONTrackParam*)(GetTrackParamAtMUONCluster(0))));
+
+  AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(&param, z);
+  return param.P();
+
+}
+
+//====================================================================================================================================================
+
+Double_t AliMuonForwardTrack::GetThetaAbs() {
+
+  // it is the angle defined by the imaginary line goingo from the vertex to the exit point of the track at the end of the hadron absorber
   
-  if (result) AliDebug(1, Form("Muon comes from a resonance %d", GetParentPDGCode(0)));
+  Double_t z = AliMUONConstants::AbsZEnd();
+
+  AliMUONTrackParam param = (*((AliMUONTrackParam*)(GetTrackParamAtMUONCluster(0))));
+
+  AliMUONTrackExtrap::ExtrapToZ(&param, z);
+  Double_t x = param.GetNonBendingCoor();
+  Double_t y = param.GetBendingCoor();
+
+  return 180. +TMath::ATan(TMath::Sqrt(x*x + y*y)/z)*TMath::RadToDeg();
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsFromDirectResonance() {
+
+  if (!IsMuon()) return kFALSE;
+
+  for (Int_t i=GetFirstMotherID(); i>=0; i--) if (!IsPDGResonance(GetParentPDGCode(i))) return kFALSE;  // the decay chain finds a non-resonance particle
+
+  return kTRUE; 
   
-  return result; 
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsFromChainResonance() {
+
+  if (!IsMuon()) return kFALSE;
+
+  if (GetFirstMotherID() == 0) return kFALSE;   // it is not a chain
+
+  if (!IsPDGResonance(GetParentPDGCode(GetFirstMotherID()))) return kFALSE;  // primordial is not a resonance
+
+  for (Int_t i=GetFirstMotherID()-1; i>=0; i--) if (!IsPDGResonance(GetParentPDGCode(i))) return kTRUE;  // the decay chain finds a non-resonance particle
+
+  return kFALSE;
   
 }
 
 //====================================================================================================================================================
 
-Bool_t AliMuonForwardTrack::IsFromCharm() {
+Bool_t AliMuonForwardTrack::IsFromDirectCharm() {
+
+  if (!IsMuon()) return kFALSE;
+
+  for (Int_t i=GetFirstMotherID(); i>=0; i--) if (!IsPDGCharm(GetParentPDGCode(i))) return kFALSE;  // the decay chain finds a non-charmed particle
+
+  return kTRUE; 
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsFromChainCharm() {
+
+  if (!IsMuon()) return kFALSE;
+
+  if (GetFirstMotherID() == 0) return kFALSE;   // it is not a chain
+
+  if (!IsPDGCharm(GetParentPDGCode(GetFirstMotherID()))) return kFALSE;  // primordial is not a charmed hadron
+
+  for (Int_t i=GetFirstMotherID()-1; i>=0; i--) if (!IsPDGCharm(GetParentPDGCode(i))) return kTRUE;  // the decay chain finds a non-charmed particle
+
+  return kFALSE;
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsFromDirectBeauty() {
+
+  if (!IsMuon()) return kFALSE;
+
+  for (Int_t i=GetFirstMotherID(); i>=0; i--) if (!IsPDGBeauty(GetParentPDGCode(i))) return kFALSE;  // the decay chain finds a non-beauty particle
+
+  return kTRUE; 
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsFromChainBeauty() {
+
+  if (!IsMuon()) return kFALSE;
+
+  if (GetFirstMotherID() == 0) return kFALSE;   // it is not a chain
+
+  if (!IsPDGBeauty(GetParentPDGCode(GetFirstMotherID()))) return kFALSE;  // primordial is not a beauty hadron
+
+  for (Int_t i=GetFirstMotherID()-1; i>=0; i--) if (!IsPDGBeauty(GetParentPDGCode(i))) return kTRUE;  // the decay chain finds a non-beauty particle
+
+  return kFALSE;
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsMuon() {
+
+  if (IsFake()) return kFALSE;
+
+  if (TMath::Abs(fMCTrackRef->GetPdgCode())==13) return kTRUE;
+
+  return kFALSE;
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsFake() {
+
+  if (!fMCTrackRef) return kTRUE;
+
+  return kFALSE;
+
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsPDGResonance(Int_t pdg) {
+
+  // if (pdg<10) return kFALSE; 
+  // Int_t id = pdg%100000; 
+  // return (!((id-id%10)%110));
 
   Bool_t result = kFALSE;
 
-  if ( GetParentPDGCode(0) ==   411 ||
-       GetParentPDGCode(0) ==   421 ||
-       GetParentPDGCode(0) == 10411 ||
-       GetParentPDGCode(0) == 10421 ||
-       GetParentPDGCode(0) ==   413 ||
-       GetParentPDGCode(0) ==   423 ||
-       GetParentPDGCode(0) == 10413 ||
-       GetParentPDGCode(0) == 10423 ||
-       GetParentPDGCode(0) == 20413 ||
-       GetParentPDGCode(0) == 20423 ||
-       GetParentPDGCode(0) ==   415 ||
-       GetParentPDGCode(0) ==   425 ||
-       GetParentPDGCode(0) ==   431 ||
-       GetParentPDGCode(0) == 10431 ||
-       GetParentPDGCode(0) ==   433 ||
-       GetParentPDGCode(0) == 10433 ||
-       GetParentPDGCode(0) == 20433 ||
-       GetParentPDGCode(0) ==   435 ) result = kTRUE;
-  
-  if (result) AliDebug(1, Form("Muon comes from a charmed hadron %d", GetParentPDGCode(0)));
+  if ( pdg ==    113 ||
+       pdg ==    221 ||
+       pdg ==    223 ||
+       pdg ==    331 ||
+       pdg ==    333 ||
+       pdg ==    443 ||
+       pdg == 100443 ||
+       pdg ==    553 ||
+       pdg == 100553 ) result = kTRUE;
   
   return result; 
   
@@ -484,36 +613,63 @@ Bool_t AliMuonForwardTrack::IsFromCharm() {
 
 //====================================================================================================================================================
 
-Bool_t AliMuonForwardTrack::IsFromBeauty() {
+Bool_t AliMuonForwardTrack::IsPDGCharm(Int_t pdg) {
 
   Bool_t result = kFALSE;
 
-  if ( GetParentPDGCode(0) ==   511 ||
-       GetParentPDGCode(0) ==   521 ||
-       GetParentPDGCode(0) == 10511 ||
-       GetParentPDGCode(0) == 10521 ||
-       GetParentPDGCode(0) ==   513 ||
-       GetParentPDGCode(0) ==   523 ||
-       GetParentPDGCode(0) == 10513 ||
-       GetParentPDGCode(0) == 10523 ||
-       GetParentPDGCode(0) == 20513 ||
-       GetParentPDGCode(0) == 20523 ||
-       GetParentPDGCode(0) ==   515 ||
-       GetParentPDGCode(0) ==   525 ||
-       GetParentPDGCode(0) ==   531 ||
-       GetParentPDGCode(0) == 10531 ||
-       GetParentPDGCode(0) ==   533 ||
-       GetParentPDGCode(0) == 10533 ||
-       GetParentPDGCode(0) == 20533 ||
-       GetParentPDGCode(0) ==   535 ||
-       GetParentPDGCode(0) ==   541 ||
-       GetParentPDGCode(0) == 10541 ||
-       GetParentPDGCode(0) ==   543 ||
-       GetParentPDGCode(0) == 10543 ||
-       GetParentPDGCode(0) == 20543 ||
-       GetParentPDGCode(0) ==   545 ) result = kTRUE;
+  if ( TMath::Abs(pdg) ==   411 ||
+       TMath::Abs(pdg) ==   421 ||
+       TMath::Abs(pdg) == 10411 ||
+       TMath::Abs(pdg) == 10421 ||
+       TMath::Abs(pdg) ==   413 ||
+       TMath::Abs(pdg) ==   423 ||
+       TMath::Abs(pdg) == 10413 ||
+       TMath::Abs(pdg) == 10423 ||
+       TMath::Abs(pdg) == 20413 ||
+       TMath::Abs(pdg) == 20423 ||
+       TMath::Abs(pdg) ==   415 ||
+       TMath::Abs(pdg) ==   425 ||
+       TMath::Abs(pdg) ==   431 ||
+       TMath::Abs(pdg) == 10431 ||
+       TMath::Abs(pdg) ==   433 ||
+       TMath::Abs(pdg) == 10433 ||
+       TMath::Abs(pdg) == 20433 ||
+       TMath::Abs(pdg) ==   435 ) result = kTRUE;
   
-  if (result) AliDebug(1, Form("Muon comes from a beauty hadron %d", GetParentPDGCode(0)));
+  return result; 
+  
+}
+
+//====================================================================================================================================================
+
+Bool_t AliMuonForwardTrack::IsPDGBeauty(Int_t pdg) {
+
+  Bool_t result = kFALSE;
+
+  if ( TMath::Abs(pdg) ==   511 ||
+       TMath::Abs(pdg) ==   521 ||
+       TMath::Abs(pdg) == 10511 ||
+       TMath::Abs(pdg) == 10521 ||
+       TMath::Abs(pdg) ==   513 ||
+       TMath::Abs(pdg) ==   523 ||
+       TMath::Abs(pdg) == 10513 ||
+       TMath::Abs(pdg) == 10523 ||
+       TMath::Abs(pdg) == 20513 ||
+       TMath::Abs(pdg) == 20523 ||
+       TMath::Abs(pdg) ==   515 ||
+       TMath::Abs(pdg) ==   525 ||
+       TMath::Abs(pdg) ==   531 ||
+       TMath::Abs(pdg) == 10531 ||
+       TMath::Abs(pdg) ==   533 ||
+       TMath::Abs(pdg) == 10533 ||
+       TMath::Abs(pdg) == 20533 ||
+       TMath::Abs(pdg) ==   535 ||
+       TMath::Abs(pdg) ==   541 ||
+       TMath::Abs(pdg) == 10541 ||
+       TMath::Abs(pdg) ==   543 ||
+       TMath::Abs(pdg) == 10543 ||
+       TMath::Abs(pdg) == 20543 ||
+       TMath::Abs(pdg) ==   545 ) result = kTRUE;
   
   return result; 
   
@@ -521,11 +677,13 @@ Bool_t AliMuonForwardTrack::IsFromBeauty() {
 
 //====================================================================================================================================================
 
-Bool_t AliMuonForwardTrack::IsFromBackground() {
+Bool_t AliMuonForwardTrack::IsMuonFromBackground() {
 
   Bool_t result = kFALSE;
 
-  if (!IsFromResonance() && !IsFromCharm() && !IsFromBeauty()) result = kTRUE;
+  if (!IsMuon()) return result;
+
+  if (!IsFromDirectResonance() && !IsFromChainResonance() && !IsFromDirectCharm() && !IsFromChainCharm() && !IsFromDirectBeauty() && !IsFromChainBeauty()) result = kTRUE;
 
   if (result) AliDebug(1, Form("Muon comes from a background source %d", GetParentPDGCode(0)));
 
@@ -551,3 +709,33 @@ void AliMuonForwardTrack::EvalKinem(Double_t z) {
 
 //====================================================================================================================================================
 
+Int_t AliMuonForwardTrack::GetFirstMotherID() {
+
+  Int_t motherLevel = 0; 
+  Int_t motherMCLabel = GetParentMCLabel(motherLevel); 
+  while (motherMCLabel >= 0) { 
+    motherLevel++; 
+    motherMCLabel = GetParentMCLabel(motherLevel); 
+  }
+  return motherLevel-1;
+
+}
+
+//====================================================================================================================================================
+
+void AliMuonForwardTrack::PrintHistory() {
+
+  if (IsFake()) printf("Track is a fake MUON\n");
+  else {
+    TString history = "";
+    for (Int_t i=GetFirstMotherID(); i>=0; i--) {
+      history += TDatabasePDG::Instance()->GetParticle(GetParentPDGCode(i))->GetName();
+      history += " -> ";
+    }
+    history += TDatabasePDG::Instance()->GetParticle(fMCTrackRef->GetPdgCode())->GetName();
+    printf("%s\n",history.Data());
+  }
+
+}
+
+//====================================================================================================================================================