#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 "AliLog.h"
#include "TDatabasePDG.h"
#include "TParticle.h"
fWeight(1)
{
/// constructor
- //AliMUONTrackLight();
- FillFromESD(muonTrack);
+ fPgen.SetPxPyPzE(0.,0.,0.,0.);
+ for (Int_t npar = 0; npar < fgkNParentsMax; npar++){
+ fParentPDGCode[npar] = -1;
+ fParentPythiaLine[npar] = -1;
+ }
+ for (Int_t i = 0; i < 4; i++){
+ fQuarkPDGCode[i] = -1;
+ fQuarkPythiaLine[i] = -1;
+ }
+ FillFromESD(muonTrack);
}
//============================================
void AliMUONTrackLight::FillFromAliMUONTrack(AliMUONTrack *trackReco,Double_t zvert){
/// this method sets the muon reconstructed momentum according to the value given by AliMUONTrack
- AliMUONTrackParam trPar;
- if (trackReco->GetTrackParamAtVertex()) trPar = *(trackReco->GetTrackParamAtVertex());
- else {
- trPar = *((AliMUONTrackParam*) trackReco->GetTrackParamAtCluster()->First());
- AliMUONTrackExtrap::ExtrapToVertex(&trPar,0.,0.,0.,0.,0.);
+ AliMUONTrackParam* trPar = trackReco->GetTrackParamAtVertex();
+ if (!trPar) {
+ AliError("The track must contain the parameters at vertex");
+ return;
}
- this->SetCharge(Int_t(TMath::Sign(1.,trPar.GetInverseBendingMomentum())));
- this->SetPxPyPz(trPar.Px(),trPar.Py(), trPar.Pz());
+ 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(),
- trPar.GetZ()};
+ Double_t xyz[3] = { trPar->GetNonBendingCoor(),
+ trPar->GetBendingCoor(),
+ trPar->GetZ()};
if (zvert!=-9999) xyz[2] = zvert;
this->SetVertex(xyz);
}
fPrec.SetPxPyPzE(px,py,pz,energy);
}
-//============================================
-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 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:
- 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->GetTrackID();
- this->SetTrackPythiaLine(trackID);
- part = stack->Particle(trackID);
- fTrackPDGCode = part->GetPdgCode();
- }
- }
- if (compPart>1) {
- AliFatal("More than one particle compatible with the reconstructed track.");
- }
- return part;
-}
-
-//============================================
-Int_t AliMUONTrackLight::TrackCheck(Bool_t *compTrack){
- /// 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;
-
- // apply reconstruction requirements
- if (compTrack[0] || compTrack[1]) iTrack++; // at least one hit in st. 0
- if (compTrack[2] || compTrack[3]) iTrack++; // at least one hit in st. 1
- if (compTrack[4] || compTrack[5]) iTrack++; // at least one hit in st. 2
- for (Int_t ch = 6; ch < AliMUONConstants::NTrackingCh(); ch++) {
- if (compTrack[ch]) hitsInLastStations++;
- }
- if (hitsInLastStations > 2) iTrack++; // at least 3 hits in st. 3 & 4
- return iTrack;
-}
-
//============================================
void AliMUONTrackLight::FillMuonHistory(AliStack *stack, TParticle *part){
/// scans the muon history to determine parents pdg code and pythia line