/* $Id$ */
-//===================================================================
-//This class was prepared by INFN Cagliari, July 2006
-//(authors: H.Woehri, A.de Falco)
-//
-//
+//-----------------------------------------------------------------------------
// Compact information for the muon generated tracks in the MUON arm
// useful at the last stage of the analysis chain
// provides a link between the reconstructed track and the generated particle
// mother process
//
// To be used together with AliMUONPairLight
-//===================================================================
+//
+// This class was prepared by INFN Cagliari, July 2006
+// (authors: H.Woehri, A.de Falco)
+//-----------------------------------------------------------------------------
+
+// 13 Nov 2007:
+// Added a temporary fix to FindRefTrack to be able to handle reconstructed tracks
+// generated from ESD muon track information. The problem is that the ESD data at
+// the moment only contains the first hit on chamber 1. Hopefully in the near future
+// this will be fixed and all hit information will be available.
+// - Artur Szostak <artursz@iafrica.com>
#include "AliMUONTrackLight.h"
#include "AliMUONTrack.h"
#include "AliMUONConstants.h"
+#include "AliMUONVTrackStore.h"
+#include "AliMUONTrackExtrap.h"
+#include "AliMUONTrackParam.h"
#include "AliESDMuonTrack.h"
#include "AliRunLoader.h"
#include "AliStack.h"
#include "AliHeader.h"
-#include "AliMUONTrackExtrap.h"
#include "TDatabasePDG.h"
-#include "TClonesArray.h"
#include "TParticle.h"
#include "TString.h"
void AliMUONTrackLight::FillFromAliMUONTrack(AliMUONTrack *trackReco,Double_t zvert){
/// this method sets the muon reconstructed momentum according to the value given by AliMUONTrack
- AliMUONTrackParam trPar(*((AliMUONTrackParam*) (trackReco->GetTrackParamAtHit()->First())));
- // AliMUONTrackParam *trPar = trackReco->GetTrackParamAtVertex();
- AliMUONTrackExtrap::ExtrapToVertex(&trPar,0.,0.,0.);
+ AliMUONTrackParam trPar;
+ if (trackReco->GetTrackParamAtVertex()) trPar = *(trackReco->GetTrackParamAtVertex());
+ else {
+ trPar = *((AliMUONTrackParam*) trackReco->GetTrackParamAtCluster()->First());
+ AliMUONTrackExtrap::ExtrapToVertex(&trPar,0.,0.,0.,0.,0.);
+ }
this->SetCharge(Int_t(TMath::Sign(1.,trPar.GetInverseBendingMomentum())));
this->SetPxPyPz(trPar.Px(),trPar.Py(), trPar.Pz());
this->SetTriggered(trackReco->GetMatchTrigger());
Double_t xyz[3] = { trPar.GetNonBendingCoor(),
trPar.GetBendingCoor(),
- zvert};
+ trPar.GetZ()};
+ if (zvert!=-9999) xyz[2] = zvert;
this->SetVertex(xyz);
}
}
//============================================
-TParticle* AliMUONTrackLight::FindRefTrack(AliMUONTrack* trackReco, TClonesArray* trackRefArray, AliRunLoader *runLoader){
- /// find the MC particle that corresponds to a given rec track
+TParticle* AliMUONTrackLight::FindRefTrack(
+ AliMUONTrack* trackReco, AliMUONVTrackStore* trackRefArray,
+ AliStack* stack)
+{
+ /// Find the Monte Carlo (MC) particle that corresponds to a given reconstructed track.
+ /// @param trackReco This is the reconstructed track for which we want to find a
+ /// corresponding MC particle.
+ /// @param trackRefArray The list of MC reference tracks as generated by
+ /// AliMUONRecoCheck::ReconstructedTracks for example.
+ /// @param stack The MC stack of simulated particles.
+
TParticle *part = 0;
- const Double_t kSigma2Cut = 16; // 4 sigmas cut, kSigma2Cut = 4*4
- Int_t nTrackRef = trackRefArray->GetEntriesFast();
- Int_t compPart = 0;
- for (Int_t iref = 0; iref < nTrackRef; iref++) {
- AliMUONTrack *trackRef = (AliMUONTrack *)trackRefArray->At(iref);
+ const Double_t kSigmaCut = 4; // 4 sigmas cut
+ Int_t compPart = 0;
+ Bool_t compTrack;
+
+ TIter next(trackRefArray->CreateIterator());
+ AliMUONTrack* trackRef;
+ while ( (trackRef = static_cast<AliMUONTrack*>(next())) ) {
// check if trackRef is compatible with trackReco:
- //routine returns for each chamber a yes/no information if the
- //hit of rec. track and hit of referenced track are compatible
- Bool_t *compTrack = trackRef->CompatibleTrack(trackReco,kSigma2Cut);
- Int_t iTrack = this->TrackCheck(compTrack); //returns number of validated conditions
- if (iTrack==4) {
- compPart++;
- Int_t trackID = trackRef->GetTrackID();
+ compTrack = kFALSE;
+
+ if (trackReco->GetNClusters() > 1) {
+
+ // check cluster by cluster if trackReco contain info at each cluster
+ Bool_t compTrackArray[10];
+ trackRef->CompatibleTrack(trackReco,kSigmaCut,compTrackArray);
+ if (TrackCheck(compTrackArray) == 4) compTrack = kTRUE;
+
+ } else {
+
+ // otherwise check only parameters at the z position of the first trackRef
+ AliMUONTrackParam *refParam = (AliMUONTrackParam*) trackRef->GetTrackParamAtCluster()->First();
+ AliMUONTrackParam recoParam(*((AliMUONTrackParam*) trackReco->GetTrackParamAtCluster()->First()));
+ AliMUONTrackExtrap::ExtrapToZCov(&recoParam, refParam->GetZ());
+ Double_t chi2;
+ if (refParam->CompatibleTrackParam(recoParam, kSigmaCut, chi2)) compTrack = kTRUE;
+
+ }
+
+ if (compTrack) {
+ compPart++;
+ Int_t trackID = trackRef->GetUniqueID();
this->SetTrackPythiaLine(trackID);
- part = ((AliStack *)(((AliHeader *) runLoader->GetHeader())->Stack()))->Particle(trackID);
+ part = stack->Particle(trackID);
fTrackPDGCode = part->GetPdgCode();
}
}
- if (compPart>1) {
- printf ("<AliMUONTrackLight::FindRefTrack> ERROR: more than one particle compatible to the reconstructed track.\n");
- Int_t i=0, j=1/i;
- printf ("j=%d \n",j);
+ if (compPart>1) {
+ AliFatal("More than one particle compatible with the reconstructed track.");
}
- return part;
+ return part;
}
//============================================
/// Apply reconstruction requirements
/// Return number of validated conditions
/// If all the tests are verified then TrackCheck = 4 (good track)
+
Int_t iTrack = 0;
Int_t hitsInLastStations = 0;
return iTrack;
}
-//============================================
-void AliMUONTrackLight::FillMuonHistory(AliRunLoader *runLoader, TParticle *part){
- /// scans the muon history to determine parents pdg code and pythia line
- // kept for backward compatibility
- // see the overloaded method FillMuonHistory(AliStack *stack, TParticle *part)
- AliStack *stack = runLoader->GetHeader()->Stack();
- FillMuonHistory(stack,part);
-}
-
//============================================
void AliMUONTrackLight::FillMuonHistory(AliStack *stack, TParticle *part){
/// scans the muon history to determine parents pdg code and pythia line
if(this->GetQuarkPythiaLine(countP) > -1 && (this->GetParentFlavour(0)==4 || this->GetParentFlavour(0)==5)){
if(this->GetParentFlavour(0) != TMath::Abs(this->GetQuarkPDGCode(countP))){
- printf("quark flavour of parent and that of quark do not correspond: %d %d --> correcting\n", this->GetParentFlavour(0), TMath::Abs(this->GetQuarkPDGCode(countP)));
- Int_t pdg = this->GetQuarkPDGCode(countP), line = this->GetQuarkPythiaLine(countP);
+ AliWarning(Form("quark flavour of parent and that of quark do not correspond: %d %d --> correcting\n",
+ this->GetParentFlavour(0), TMath::Abs(this->GetQuarkPDGCode(countP)))
+ );
+
+ pdg = this->GetQuarkPDGCode(countP);
+ Int_t line = this->GetQuarkPythiaLine(countP);
this->ResetQuarkInfo();
while(TMath::Abs(pdg) != this->GetParentFlavour(0)){//pdg of q,g in Pythia listing following the wrong string end
//must coincide with the flavour of the last fragmented mother