#include "AliMUONEventReconstructor.h"
#include "AliMUON.h"
+#include "AliMUONConstants.h"
#include "AliMUONHit.h"
#include "AliMUONHitForRec.h"
#include "AliMUONTriggerTrack.h"
#include "AliLoader.h"
#include "AliMUONTrackK.h" //AZ
#include "AliMC.h"
+#include "AliLog.h"
+#include "AliTrackReference.h"
//************* Defaults parameters for reconstruction
const Double_t AliMUONEventReconstructor::fgkDefaultMinBendingMomentum = 3.0;
const Double_t AliMUONEventReconstructor::fgkDefaultSimpleBValue = 7.0;
const Double_t AliMUONEventReconstructor::fgkDefaultSimpleBLength = 428.0;
const Double_t AliMUONEventReconstructor::fgkDefaultSimpleBPosition = 1019.0;
-const Int_t AliMUONEventReconstructor::fgkDefaultRecGeantHits = 0;
+const Int_t AliMUONEventReconstructor::fgkDefaultRecTrackRefHits = 0;
const Double_t AliMUONEventReconstructor::fgkDefaultEfficiency = 0.95;
const Int_t AliMUONEventReconstructor::fgkDefaultPrintLevel = -1;
fNRecTriggerTracks = 0; // really needed or GetEntriesFast sufficient ????
// Memory allocation for the TClonesArray of hits on reconstructed tracks
// Is 100 the right size ????
- fRecTrackHitsPtr = new TClonesArray("AliMUONTrack", 100);
+ //AZ fRecTrackHitsPtr = new TClonesArray("AliMUONTrack", 100);
+ fRecTrackHitsPtr = new TClonesArray("AliMUONTrackHit", 100);
fNRecTrackHits = 0; // really needed or GetEntriesFast sufficient ????
// Sign of fSimpleBValue according to sign of Bx value at (50,50,-950).
cout << endl;
}
- // Initializions for GEANT background events
- fBkgGeantFile = 0;
- fBkgGeantTK = 0;
- fBkgGeantParticles = 0;
- fBkgGeantTH = 0;
- fBkgGeantHits = 0;
- fBkgGeantEventNumber = -1;
+ // Initializions for track ref. background events
+ fBkgTrackRefFile = 0;
+ fBkgTrackRefTK = 0;
+ fBkgTrackRefParticles = 0;
+ fBkgTrackRefTTR = 0;
+ fBkgTrackRefEventNumber = -1;
// Initialize to 0 pointers to RecoEvent, tree and tree file
fRecoEvent = 0;
{
// Protected copy constructor
- Fatal("AliMUONEventReconstructor", "Not implemented.");
+ AliFatal("Not implemented.");
}
AliMUONEventReconstructor &
if (this == &rhs) return *this;
- Fatal("operator=", "Not implemented.");
+ AliFatal("Not implemented.");
return *this;
}
// scaled to the real distance between chambers in a station
fSegmentMaxDistBending[0] = TMath::Abs( 1.5 *
((&(pMUON->Chamber(1)))->Z() - (&(pMUON->Chamber(0)))->Z()) / 20.0);
- fSegmentMaxDistBending[1] = TMath::Abs( 1.5 *
+ fSegmentMaxDistBending[1] = TMath::Abs( 1.5 *
((&(pMUON->Chamber(3)))->Z() - (&(pMUON->Chamber(2)))->Z()) / 20.0);
- fSegmentMaxDistBending[2] = TMath::Abs( 3.0 *
+ fSegmentMaxDistBending[2] = TMath::Abs( 3.0 *
((&(pMUON->Chamber(5)))->Z() - (&(pMUON->Chamber(4)))->Z()) / 20.0);
- fSegmentMaxDistBending[3] = TMath::Abs( 6.0 *
+ fSegmentMaxDistBending[3] = TMath::Abs( 6.0 *
((&(pMUON->Chamber(7)))->Z() - (&(pMUON->Chamber(6)))->Z()) / 20.0);
- fSegmentMaxDistBending[4] = TMath::Abs( 6.0 *
+ fSegmentMaxDistBending[4] = TMath::Abs( 6.0 *
((&(pMUON->Chamber(9)))->Z() - (&(pMUON->Chamber(8)))->Z()) / 20.0);
fBendingResolution = fgkDefaultBendingResolution;
fSimpleBValue = fgkDefaultSimpleBValue;
fSimpleBLength = fgkDefaultSimpleBLength;
fSimpleBPosition = fgkDefaultSimpleBPosition;
- fRecGeantHits = fgkDefaultRecGeantHits;
+ fRecTrackRefHits = fgkDefaultRecTrackRefHits;
fEfficiency = fgkDefaultEfficiency;
fPrintLevel = fgkDefaultPrintLevel;
return;
}
//__________________________________________________________________________
-void AliMUONEventReconstructor::SetBkgGeantFile(Text_t *BkgGeantFileName)
+void AliMUONEventReconstructor::SetBkgTrackRefFile(Text_t *BkgTrackRefFileName)
{
- // Set background file ... for GEANT hits
+ // Set background file ... for track ref. hits
// Must be called after having loaded the firts signal event
if (fPrintLevel >= 0) {
- cout << "Enter SetBkgGeantFile with BkgGeantFileName ``"
- << BkgGeantFileName << "''" << endl;}
- if (strlen(BkgGeantFileName)) {
- // BkgGeantFileName not empty: try to open the file
+ cout << "Enter SetBkgTrackRefFile with BkgTrackRefFileName ``"
+ << BkgTrackRefFileName << "''" << endl;}
+ if (strlen(BkgTrackRefFileName)) {
+ // BkgTrackRefFileName not empty: try to open the file
if (fPrintLevel >= 2) {cout << "Before File(Bkg)" << endl; gDirectory->Dump();}
- fBkgGeantFile = new TFile(BkgGeantFileName);
+ fBkgTrackRefFile = new TFile(BkgTrackRefFileName);
if (fPrintLevel >= 2) {cout << "After File(Bkg)" << endl; gDirectory->Dump();}
- if (fBkgGeantFile-> IsOpen()) {
+ if (fBkgTrackRefFile-> IsOpen()) {
if (fPrintLevel >= 0) {
- cout << "Background for GEANT hits in file: ``" << BkgGeantFileName
+ cout << "Background for Track ref. hits in file: ``" << BkgTrackRefFileName
<< "'' successfully opened" << endl;}
}
else {
- cout << "Background for GEANT hits in file: " << BkgGeantFileName << endl;
+ cout << "Background for Track Ref. hits in file: " << BkgTrackRefFileName << endl;
cout << "NOT FOUND: EXIT" << endl;
exit(0); // right instruction for exit ????
}
// Arrays for "particles" and "hits"
- fBkgGeantParticles = new TClonesArray("TParticle", 200);
- fBkgGeantHits = new TClonesArray("AliMUONHit", 2000);
+ fBkgTrackRefParticles = new TClonesArray("TParticle", 200);
// Event number to -1 for initialization
- fBkgGeantEventNumber = -1;
+ fBkgTrackRefEventNumber = -1;
// Back to the signal file:
// first signal event must have been loaded previously,
// otherwise, Segmentation violation at the next instruction
}
//__________________________________________________________________________
-void AliMUONEventReconstructor::NextBkgGeantEvent(void)
+void AliMUONEventReconstructor::NextBkgTrackRefEvent(void)
{
- // Get next event in background file for GEANT hits
+ // Get next event in background file for track ref. hits
// Goes back to event number 0 when end of file is reached
char treeName[20];
- TBranch *branch;
if (fPrintLevel >= 0) {
- cout << "Enter NextBkgGeantEvent" << endl;}
+ cout << "Enter NextBkgTrackRefEvent" << endl;}
// Clean previous event
- if(fBkgGeantTK) delete fBkgGeantTK;
- fBkgGeantTK = NULL;
- if(fBkgGeantParticles) fBkgGeantParticles->Clear();
- if(fBkgGeantTH) delete fBkgGeantTH;
- fBkgGeantTH = NULL;
- if(fBkgGeantHits) fBkgGeantHits->Clear();
+ if(fBkgTrackRefTK) delete fBkgTrackRefTK;
+ fBkgTrackRefTK = NULL;
+ if(fBkgTrackRefParticles) fBkgTrackRefParticles->Clear();
+ if(fBkgTrackRefTTR) delete fBkgTrackRefTTR;
+ fBkgTrackRefTTR = NULL;
// Increment event number
- fBkgGeantEventNumber++;
+ fBkgTrackRefEventNumber++;
// Get access to Particles and Hits for event from background file
if (fPrintLevel >= 2) {cout << "Before cd(Bkg)" << endl; gDirectory->Dump();}
- fBkgGeantFile->cd();
+ fBkgTrackRefFile->cd();
if (fPrintLevel >= 2) {cout << "After cd(Bkg)" << endl; gDirectory->Dump();}
// Particles: TreeK for event and branch "Particles"
- sprintf(treeName, "TreeK%d", fBkgGeantEventNumber);
- fBkgGeantTK = (TTree*)gDirectory->Get(treeName);
- if (!fBkgGeantTK) {
+ sprintf(treeName, "TreeK%d", fBkgTrackRefEventNumber);
+ fBkgTrackRefTK = (TTree*)gDirectory->Get(treeName);
+ if (!fBkgTrackRefTK) {
if (fPrintLevel >= 0) {
cout << "Cannot find Kine Tree for background event: " <<
- fBkgGeantEventNumber << endl;
+ fBkgTrackRefEventNumber << endl;
cout << "Goes back to event 0" << endl;
}
- fBkgGeantEventNumber = 0;
- sprintf(treeName, "TreeK%d", fBkgGeantEventNumber);
- fBkgGeantTK = (TTree*)gDirectory->Get(treeName);
- if (!fBkgGeantTK) {
- cout << "ERROR: cannot find Kine Tree for background event: " <<
- fBkgGeantEventNumber << endl;
- exit(0);
+ fBkgTrackRefEventNumber = 0;
+ sprintf(treeName, "TreeK%d", fBkgTrackRefEventNumber);
+ fBkgTrackRefTK = (TTree*)gDirectory->Get(treeName);
+ if (!fBkgTrackRefTK) {
+ AliError(Form("cannot find Kine Tree for background event: %d",fBkgTrackRefEventNumber));
+ exit(0);
}
}
- if (fBkgGeantTK)
- fBkgGeantTK->SetBranchAddress("Particles", &fBkgGeantParticles);
- fBkgGeantTK->GetEvent(0); // why event 0 ???? necessary ????
+ if (fBkgTrackRefTK)
+ fBkgTrackRefTK->SetBranchAddress("Particles", &fBkgTrackRefParticles);
+ fBkgTrackRefTK->GetEvent(0); // why event 0 ???? necessary ????
// Hits: TreeH for event and branch "MUON"
- sprintf(treeName, "TreeH%d", fBkgGeantEventNumber);
- fBkgGeantTH = (TTree*)gDirectory->Get(treeName);
- if (!fBkgGeantTH) {
- cout << "ERROR: cannot find Hits Tree for background event: " <<
- fBkgGeantEventNumber << endl;
+ sprintf(treeName, "TreeTR%d", fBkgTrackRefEventNumber);
+ fBkgTrackRefTTR = (TTree*)gDirectory->Get(treeName);
+ if (!fBkgTrackRefTTR) {
+ AliError(Form("cannot find Hits Tree for background event: %d",fBkgTrackRefEventNumber));
exit(0);
}
- if (fBkgGeantTH && fBkgGeantHits) {
- branch = fBkgGeantTH->GetBranch("MUON");
- if (branch) branch->SetAddress(&fBkgGeantHits);
- }
- fBkgGeantTH->GetEntries(); // necessary ????
+ fBkgTrackRefTTR->GetEntries(); // necessary ????
// Back to the signal file
((gAlice->TreeK())->GetCurrentFile())->cd();
if (fPrintLevel >= 2) {cout << "After cd(gAlice)" << endl; gDirectory->Dump();}
void AliMUONEventReconstructor::MakeEventToBeReconstructed(void)
{
// To make the list of hits to be reconstructed,
- // either from the GEANT hits or from the raw clusters
+ // either from the track ref. hits or from the raw clusters
// according to the parameter set for the reconstructor
// TString evfoldname = AliConfig::GetDefaultEventFolderName();//to be interfaced properly
// Error("MakeEventToBeReconstructed","Can not get MUON Loader from Run Loader.");
// return;
// }
-
+ AliRunLoader *runLoader = fLoader->GetRunLoader();
+
if (fPrintLevel >= 1) cout << "enter MakeEventToBeReconstructed" << endl;
ResetHitsForRec();
- if (fRecGeantHits == 1) {
- // Reconstruction from GEANT hits
+ if (fRecTrackRefHits == 1) {
+ // Reconstruction from track ref. hits
// Back to the signal file
- TTree* treeH = fLoader->TreeH();
- if (treeH == 0x0)
- {
- Int_t retval = fLoader->LoadHits();
- if ( retval)
+ TTree* treeTR = runLoader->TreeTR();
+ if (treeTR == 0x0)
+ {
+ Int_t retval = runLoader->LoadTrackRefs("READ");
+ if ( retval)
{
- Error("MakeEventToBeReconstructed","Error occured while loading hits.");
+ AliError("Error occured while loading hits.");
return;
}
- treeH = fLoader->TreeH();
- if (treeH == 0x0)
+ treeTR = runLoader->TreeTR();
+ if (treeTR == 0x0)
{
- Error("MakeEventToBeReconstructed","Can not get TreeH");
- return;
+ AliError("Can not get TreeTR");
+ return;
}
- }
- fMUONData->SetTreeAddress("H");
- AddHitsForRecFromGEANT(treeH);
+ }
+
+ AddHitsForRecFromTrackRef(treeTR,1);
// Background hits
- AddHitsForRecFromBkgGEANT(fBkgGeantTH, fBkgGeantHits);
+ AddHitsForRecFromTrackRef(fBkgTrackRefTTR,0);
// Sort HitsForRec in increasing order with respect to chamber number
SortHitsForRecWithIncreasingChamber();
}
}
//__________________________________________________________________________
-void AliMUONEventReconstructor::AddHitsForRecFromGEANT(TTree *TH)
+void AliMUONEventReconstructor::AddHitsForRecFromTrackRef(TTree *TTR, Int_t signal)
{
// To add to the list of hits for reconstruction
- // the GEANT signal hits from a hit tree TH.
- Int_t hitBits, chamBits; //AZ
- if (fPrintLevel >= 2)
- cout << "enter AddHitsForRecFromGEANT with TH: " << TH << endl;
- if (TH == NULL) return;
- // AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
- //AliMUONData * muondata = pMUON->GetMUONData();
- // Security on MUON ????
- // See whether it could be the same for signal and background ????
- // Loop over tracks in tree
- Int_t ntracks = (Int_t) TH->GetEntries();
+ // the signal hits from a track reference tree TreeTR.
+ TClonesArray *listOfTrackRefs = NULL;
+ AliTrackReference *trackRef;
+
+ Int_t track = 0;
if (fPrintLevel >= 2)
- cout << "ntracks: " << ntracks << endl;
- fMuons = 0; //AZ
- for (Int_t track = 0; track < ntracks; track++) {
- fMUONData->ResetHits();
- TH->GetEvent(track);
- // Loop over hits
- Int_t hit = 0;
- hitBits = 0; // AZ
- chamBits = 0; // AZ
- Int_t itrack = track; //AZ
-
- Int_t ihit, nhits=0;
- nhits = (Int_t) fMUONData->Hits()->GetEntriesFast();
- AliMUONHit* mHit=0x0;
-
- for(ihit=0; ihit<nhits; ihit++) {
- mHit = static_cast<AliMUONHit*>(fMUONData->Hits()->At(ihit));
- Int_t ipart = TMath::Abs ((Int_t) mHit->Particle()); //AZ
- if (NewHitForRecFromGEANT(mHit,track, hit, 1) && ipart == 13
- //if (NewHitForRecFromGEANT(mHit,itrack-1, hit, 1) && ipart == 13
- && itrack <= 2 && !BIT(mHit->Chamber()-1) ) chamBits |= BIT(mHit->Chamber()-1); //AZ - set bit
- }
+ cout << "enter AddHitsForRecFromTrackRef with TTR: " << TTR << endl;
+ if (TTR == NULL) return;
+
+ listOfTrackRefs = CleanTrackRefs(TTR);
- if (chamBits&3 && chamBits>>2&3 && chamBits>>4&3 && chamBits>>6&3 &&
- chamBits>>8&3 && ((chamBits>>6&3)==3 || (chamBits>>8&3)==3))
- fMuons += 1; //AZ
- //if (chamBits&3 && chamBits>>2&3 && chamBits>>4&3 && chamBits>>6&3 &&
- // chamBits>>8&3 && ((chamBits>>6&3)==3 || (chamBits>>8&3)==3) &&
- // ((chamBits&3)==3 || (chamBits>>2&3)==3)) fMuons += 1;
- } // end of track loop
- return;
-}
+ Int_t ntracks = listOfTrackRefs->GetEntriesFast();
- //__________________________________________________________________________
-void AliMUONEventReconstructor::AddHitsForRecFromBkgGEANT(TTree *TH, TClonesArray *Hits)
-{
- // To add to the list of hits for reconstruction
- // the GEANT background hits from a hit tree TH and a pointer Hits to a hit list.
- // How to have only one function "AddHitsForRecFromGEANT" ????
- if (fPrintLevel >= 2)
- cout << "enter AddHitsForRecFromBkgGEANT with TH: " << TH << endl;
- if (TH == NULL) return;
- // Loop over tracks in tree
- Int_t ntracks = (Int_t) TH->GetEntries();
if (fPrintLevel >= 2)
cout << "ntracks: " << ntracks << endl;
- for (Int_t track = 0; track < ntracks; track++) {
- if (Hits) Hits->Clear();
- TH->GetEvent(track);
- // Loop over hits
- for (Int_t hit = 0; hit < Hits->GetEntriesFast(); hit++) {
- NewHitForRecFromGEANT((AliMUONHit*) (*Hits)[hit], track, hit, 0);
- } // end of hit loop
- } // end of track loop
+
+ for (Int_t index = 0; index < ntracks; index++) {
+ trackRef = (AliTrackReference*) listOfTrackRefs->At(index);
+ track = trackRef->GetTrack();
+
+ NewHitForRecFromTrackRef(trackRef,track,signal);
+ } // end of track ref.
+
+ listOfTrackRefs->Delete();
+ delete listOfTrackRefs;
return;
}
+
//__________________________________________________________________________
-AliMUONHitForRec* AliMUONEventReconstructor::NewHitForRecFromGEANT(AliMUONHit* Hit, Int_t TrackNumber, Int_t HitNumber, Int_t Signal)
+AliMUONHitForRec* AliMUONEventReconstructor::NewHitForRecFromTrackRef(AliTrackReference* Hit, Int_t TrackNumber, Int_t Signal)
{
- // To make a new hit for reconstruction from a GEANT hit pointed to by "Hit",
- // with hit number "HitNumber" in the track numbered "TrackNumber",
+ // To make a new hit for reconstruction from a track ref. hit pointed to by "Hit",
+ // with the track numbered "TrackNumber",
// either from signal ("Signal" = 1) or background ("Signal" = 0) event.
// Selects hits in tracking (not trigger) chambers.
// Takes into account the efficiency (fEfficiency)
// like in Fortran TRACKF_STAT.
AliMUONHitForRec* hitForRec;
Double_t bendCoor, nonBendCoor, radius;
- Int_t chamber = Hit->Chamber() - 1; // chamber(0...)
+ Int_t chamber = AliMUONConstants::ChamberNumber(Hit->Z()); // chamber(0...)
+ if (chamber < 0) return NULL;
// only in tracking chambers (fChamber starts at 1)
if (chamber >= fgkMaxMuonTrackingChambers) return NULL;
// only if hit is efficient (keep track for checking ????)
radius = TMath::Sqrt((bendCoor * bendCoor) + (nonBendCoor * nonBendCoor));
// This cut is not needed with a realistic chamber geometry !!!!
// if ((radius < fRMin[chamber]) || (radius > fRMax[chamber])) return NULL;
- // new AliMUONHitForRec from GEANT hit and increment number of AliMUONHitForRec's
+ // new AliMUONHitForRec from track ref. hit and increment number of AliMUONHitForRec's
hitForRec = new ((*fHitsForRecPtr)[fNHitsForRec]) AliMUONHitForRec(Hit);
fNHitsForRec++;
// add smearing from resolution
// resolution: angular effect to be added here ????
hitForRec->SetBendingReso2(fBendingResolution * fBendingResolution);
hitForRec->SetNonBendingReso2(fNonBendingResolution * fNonBendingResolution);
- // GEANT track info
- hitForRec->SetHitNumber(HitNumber);
- hitForRec->SetTHTrack(TrackNumber);
- hitForRec->SetGeantSignal(Signal);
+ // track ref. info
+ hitForRec->SetTTRTrack(TrackNumber);
+ hitForRec->SetTrackRefSignal(Signal);
if (fPrintLevel >= 10) {
- cout << "track: " << TrackNumber << " hit: " << HitNumber << endl;
+ cout << "track: " << TrackNumber << endl;
Hit->Dump();
cout << "AliMUONHitForRec number (1...): " << fNHitsForRec << endl;
hitForRec->Dump();}
return hitForRec;
}
-
+ //__________________________________________________________________________
+TClonesArray* AliMUONEventReconstructor::CleanTrackRefs(TTree *treeTR)
+{
+ // Make hits from track ref..
+ // Re-calculate hits parameters because two AliTrackReferences are recorded for
+ // each chamber (one when particle is entering + one when particle is leaving
+ // the sensitive volume)
+
+ AliTrackReference *trackReference;
+ Float_t x1, y1, z1, pX1, pY1, pZ1;
+ Float_t x2, y2, z2, pX2, pY2, pZ2;
+ Int_t track1, track2;
+ Int_t nRec = 0;
+ Float_t maxGasGap = 1.; // cm
+ Int_t iHit1 = 0;
+ Int_t iHitMin = 0;
+
+ AliTrackReference *trackReferenceNew = new AliTrackReference();
+
+ TClonesArray* trackRefs = new TClonesArray("AliTrackReference", 10);
+ TClonesArray* cleanTrackRefs = new TClonesArray("AliTrackReference", 10);
+
+ if (treeTR == NULL) return NULL;
+ TBranch* branch = treeTR->GetBranch("MUON");
+ if (branch == NULL) return NULL;
+ branch->SetAddress(&trackRefs);
+
+ Int_t nTrack = (Int_t)treeTR->GetEntries();
+ for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
+ treeTR->GetEntry(iTrack);
+ iHitMin = 0;
+ iHit1 = 0;
+ while (iHit1 < trackRefs->GetEntries()) {
+ trackReference = (AliTrackReference*)trackRefs->At(iHit1);
+ x1 = trackReference->X();
+ y1 = trackReference->Y();
+ z1 = trackReference->Z();
+ pX1 = trackReference->Px();
+ pY1 = trackReference->Py();
+ pZ1 = trackReference->Pz();
+ track1 = trackReference->GetTrack();
+ nRec = 1;
+ iHitMin = iHit1+1;
+ for (Int_t iHit2 = iHit1+1; iHit2 < trackRefs->GetEntries(); iHit2++) {
+ trackReference = (AliTrackReference*)trackRefs->At(iHit2);
+ x2 = trackReference->X();
+ y2 = trackReference->Y();
+ z2 = trackReference->Z();
+ pX2 = trackReference->Px();
+ pY2 = trackReference->Py();
+ pZ2 = trackReference->Pz();
+ track2 = trackReference->GetTrack();
+ if (track2 == track1 && TMath::Abs(z2-z1) < maxGasGap ) {
+ nRec++;
+ x1 += x2;
+ y1 += y2;
+ z1 += z2;
+ pX1 += pX2;
+ pY1 += pY2;
+ pZ1 += pZ2;
+ iHitMin = iHit2+1;
+ }
+
+ } // for iHit2
+ x1 /= (Float_t)nRec;
+ y1 /= (Float_t)nRec;
+ z1 /= (Float_t)nRec;
+ pX1 /= (Float_t)nRec;
+ pY1 /= (Float_t)nRec;
+ pZ1 /= (Float_t)nRec;
+ trackReferenceNew->SetPosition(x1,y1,z1);
+ trackReferenceNew->SetMomentum(pX1,pY1,pZ1);
+ trackReferenceNew->SetTrack(track1);
+ {new ((*cleanTrackRefs)[cleanTrackRefs->GetEntriesFast()]) AliTrackReference(*trackReferenceNew);}
+ iHit1 = iHitMin;
+ } // while iHit1
+ } // for track
+
+ trackRefs->Delete();
+ delete trackRefs;
+ delete trackReferenceNew;
+ return cleanTrackRefs;
+
+}
//__________________________________________________________________________
void AliMUONEventReconstructor::SortHitsForRecWithIncreasingChamber()
{
// // more information into HitForRec
// hitForRec->SetChamberNumber(ch);
// hitForRec->SetHitNumber(cor);
-// // Z coordinate of the chamber (cm) with sign opposite to GEANT sign
+// // Z coordinate of the chamber (cm) with sign opposite to TRACKREF sign
// // could (should) be more exact from chamber geometry ????
// hitForRec->SetZ(-(&(MUON->Chamber(ch)))->Z());
// if (fPrintLevel >= 10) {
nTRentries = Int_t(TR->GetEntries());
if (nTRentries != 1) {
- cout << "Error in AliMUONEventReconstructor::AddHitsForRecFromRawClusters"
- << endl;
- cout << "nTRentries = " << nTRentries << " not equal to 1" << endl;
+ AliError(Form("nTRentries = %d not equal to 1 ",nTRentries));
exit(0);
}
fLoader->TreeR()->GetEvent(0); // only one entry
Bool_t last2st;
Double_t bendingSlope, distBend, distNonBend, extBendCoor, extNonBendCoor,
impactParam = 0., maxImpactParam = 0., minImpactParam = 0.; // =0 to avoid compilation warnings.
- AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
if (fPrintLevel >= 1)
cout << "enter MakeSegmentsPerStation (0...) " << Station << endl;
// first and second chambers (0...) in the station
else last2st = kFALSE;
// extrapolation factor from Z of first chamber to Z of second chamber
// dZ to be changed to take into account fine structure of chambers ????
- Double_t extrapFact =
- (&(pMUON->Chamber(ch2)))->Z() / (&(pMUON->Chamber(ch1)))->Z();
+ Double_t extrapFact;
// index for current segment
Int_t segmentIndex = 0;
// Loop over HitsForRec in the first chamber of the station
// extrapolation,
// on the straight line joining the HitForRec to the vertex (0,0,0),
// to the Z of the second chamber of the station
- extBendCoor = extrapFact * hit1Ptr->GetBendingCoor();
- extNonBendCoor = extrapFact * hit1Ptr->GetNonBendingCoor();
// Loop over HitsForRec in the second chamber of the station
for (Int_t hit2 = fIndexOfFirstHitForRecPerChamber[ch2];
hit2 < fIndexOfFirstHitForRecPerChamber[ch2] + fNHitsForRecPerChamber[ch2];
// absolute values of distances, in bending and non bending planes,
// between the HitForRec in the second chamber
// and the previous extrapolation
+ extrapFact = hit2Ptr->GetZ()/ hit1Ptr->GetZ();
+ extBendCoor = extrapFact * hit1Ptr->GetBendingCoor();
+ extNonBendCoor = extrapFact * hit1Ptr->GetNonBendingCoor();
distBend = TMath::Abs(hit2Ptr->GetBendingCoor() - extBendCoor);
distNonBend = TMath::Abs(hit2Ptr->GetNonBendingCoor() - extNonBendCoor);
if (last2st) {
ResetTrackHits();
if (fTrackMethod == 2) { //AZ - Kalman filter
MakeTrackCandidatesK();
+ if (fRecTracksPtr->GetEntriesFast() == 0) return;
// Follow tracks in stations(1..) 3, 2 and 1
FollowTracksK();
// Remove double tracks
RemoveDoubleTracksK();
// Propagate tracks to the vertex thru absorber
GoToVertex();
+ // Fill AliMUONTrack data members
+ FillMUONTrack();
} else {
// Look for candidates from at least 3 aligned points in stations(1..) 4 and 5
MakeTrackCandidates();
// Remove double tracks
RemoveDoubleTracks();
UpdateTrackParamAtHit();
+ UpdateHitForRecAtHit();
}
return;
}
treeR->GetEvent(0); // only one entry
if (!(fMUONData->IsTriggerBranchesInTree())) {
- cout << "Warning in AliMUONEventReconstructor::MakeTriggerTracks"
- << endl;
- cout << "Trigger information is not avalaible, nTRentries = " << nTRentries << " not equal to 1" << endl;
+ AliWarning(Form("Trigger information is not avalaible, nTRentries = %d not equal to 1",nTRentries));
return kFALSE;
}
gloTrigPat = 0;
globalTrigger = fMUONData->GlobalTrigger();
gloTrg = (AliMUONGlobalTrigger*)globalTrigger->UncheckedAt(0);
- if (gloTrg->SinglePlusLpt()) gloTrigPat|= 0x1;
- if (gloTrg->SinglePlusHpt()) gloTrigPat|= 0x2;
- if (gloTrg->SinglePlusApt()) gloTrigPat|= 0x4;
-
- if (gloTrg->SingleMinusLpt()) gloTrigPat|= 0x8;
- if (gloTrg->SingleMinusHpt()) gloTrigPat|= 0x10;
- if (gloTrg->SingleMinusApt()) gloTrigPat|= 0x20;
-
- if (gloTrg->SingleUndefLpt()) gloTrigPat|= 0x40;
- if (gloTrg->SingleUndefHpt()) gloTrigPat|= 0x80;
- if (gloTrg->SingleUndefApt()) gloTrigPat|= 0x100;
-
- if (gloTrg->PairUnlikeLpt()) gloTrigPat|= 0x200;
- if (gloTrg->PairUnlikeHpt()) gloTrigPat|= 0x400;
- if (gloTrg->PairUnlikeApt()) gloTrigPat|= 0x800;
-
- if (gloTrg->PairLikeLpt()) gloTrigPat|= 0x1000;
- if (gloTrg->PairLikeHpt()) gloTrigPat|= 0x2000;
- if (gloTrg->PairLikeApt()) gloTrigPat|= 0x4000;
+ if (gloTrg) {
+ if (gloTrg->SinglePlusLpt()) gloTrigPat|= 0x1;
+ if (gloTrg->SinglePlusHpt()) gloTrigPat|= 0x2;
+ if (gloTrg->SinglePlusApt()) gloTrigPat|= 0x4;
+
+ if (gloTrg->SingleMinusLpt()) gloTrigPat|= 0x8;
+ if (gloTrg->SingleMinusHpt()) gloTrigPat|= 0x10;
+ if (gloTrg->SingleMinusApt()) gloTrigPat|= 0x20;
+
+ if (gloTrg->SingleUndefLpt()) gloTrigPat|= 0x40;
+ if (gloTrg->SingleUndefHpt()) gloTrigPat|= 0x80;
+ if (gloTrg->SingleUndefApt()) gloTrigPat|= 0x100;
+
+ if (gloTrg->PairUnlikeLpt()) gloTrigPat|= 0x200;
+ if (gloTrg->PairUnlikeHpt()) gloTrigPat|= 0x400;
+ if (gloTrg->PairUnlikeApt()) gloTrigPat|= 0x800;
+
+ if (gloTrg->PairLikeLpt()) gloTrigPat|= 0x1000;
+ if (gloTrg->PairLikeHpt()) gloTrigPat|= 0x2000;
+ if (gloTrg->PairLikeApt()) gloTrigPat|= 0x4000;
+ }
// the first segment being pointed to by "BegSegment".
// Returns the number of such track candidates.
Int_t endStation, iEndSegment, nbCan2Seg;
- AliMUONSegment *endSegment, *extrapSegment;
+ AliMUONSegment *endSegment;
+ AliMUONSegment *extrapSegment = NULL;
AliMUONTrack *recTrack;
Double_t mcsFactor;
if (fPrintLevel >= 1) cout << "enter MakeTrackCandidatesWithTwoSegments" << endl;
GetBendingMomentumFromImpactParam(BegSegment->GetBendingImpact());
mcsFactor = fChamberThicknessInX0 * mcsFactor * mcsFactor;
// linear extrapolation to end station
- extrapSegment =
- BegSegment->CreateSegmentFromLinearExtrapToStation(endStation, mcsFactor);
// number of candidates with 2 segments to 0
nbCan2Seg = 0;
// Loop over segments in the end station
endSegment = (AliMUONSegment*) ((*fSegmentsPtr[endStation])[iEndSegment]);
// test compatibility between current segment and "extrapSegment"
// 4 because 4 quantities in chi2
+ extrapSegment =
+ BegSegment->CreateSegmentFromLinearExtrapToStation(endSegment->GetZ(), mcsFactor);
if ((endSegment->
NormalizedChi2WithSegment(extrapSegment,
fMaxSigma2Distance)) <= 4.0) {
// in stations(1..) 4 and 5,
// the segment being pointed to by "BegSegment".
Int_t ch, ch1, ch2, endStation, iHit, iHitMax, iHitMin, nbCan1Seg1Hit;
- AliMUONHitForRec *extrapHitForRec, *hit;
+ AliMUONHitForRec *extrapHitForRec= NULL;
+ AliMUONHitForRec *hit;
AliMUONTrack *recTrack;
Double_t mcsFactor;
if (fPrintLevel >= 1)
nbCan1Seg1Hit = 0;
// Loop over chambers of the end station
for (ch = ch2; ch >= ch1; ch--) {
- // linear extrapolation to chamber
- extrapHitForRec =
- BegSegment->CreateHitForRecFromLinearExtrapToChamber(ch, mcsFactor);
// limits for the hit index in the loop
iHitMin = fIndexOfFirstHitForRecPerChamber[ch];
iHitMax = iHitMin + fNHitsForRecPerChamber[ch];
hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[iHit]);
// test compatibility between current HitForRec and "extrapHitForRec"
// 2 because 2 quantities in chi2
+ // linear extrapolation to chamber
+ extrapHitForRec =
+ BegSegment->CreateHitForRecFromLinearExtrapToChamber( hit->GetZ(), mcsFactor);
if ((hit->
NormalizedChi2WithHitForRec(extrapHitForRec,
fMaxSigma2Distance)) <= 2.0) {
}
} // for (iHit = iHitMin;...
delete extrapHitForRec;
+ extrapHitForRec = NULL;
} // for (ch = ch2;...
return nbCan1Seg1Hit;
}
{
// Follow tracks in stations(1..) 3, 2 and 1
// too long: should be made more modular !!!!
- AliMUONHitForRec *bestHit, *extrapHit, *extrapCorrHit, *hit;
- AliMUONSegment *bestSegment, *extrapSegment, *extrapCorrSegment, *segment;
+ AliMUONHitForRec *bestHit, *extrapHit, *hit;
+ AliMUONSegment *bestSegment, *extrapSegment, *segment;
AliMUONTrack *track, *nextTrack;
AliMUONTrackParam *trackParam1, trackParam[2], trackParamVertex;
// -1 to avoid compilation warnings
// extrapolation to station
trackParam1->ExtrapToStation(station, trackParam);
extrapSegment = new AliMUONSegment(); // empty segment
- extrapCorrSegment = new AliMUONSegment(); // empty corrected segment
// multiple scattering factor corresponding to one chamber
// and momentum in bending plane (not total)
mcsFactor = 0.0136 * trackParam1->GetInverseBendingMomentum();
extrapSegment->UpdateFromStationTrackParam
(trackParam, mcsFactor, dZ1, dZ2, dZ3, station,
trackParam1->GetInverseBendingMomentum());
- // same thing for corrected segment
- // better to use copy constructor, after checking that it works properly !!!!
- extrapCorrSegment->SetBendingCoorReso2(fBendingResolution * fBendingResolution);
- extrapCorrSegment->
- SetNonBendingCoorReso2(fNonBendingResolution * fNonBendingResolution);
- extrapCorrSegment->UpdateFromStationTrackParam
- (trackParam, mcsFactor, dZ1, dZ2, dZ3, station,
- trackParam1->GetInverseBendingMomentum());
bestChi2 = 5.0;
bestSegment = NULL;
if (fPrintLevel >= 10) {
segment = (AliMUONSegment*) ((*fSegmentsPtr[station])[iSegment]);
// correction of corrected segment (fBendingCoor and fNonBendingCoor)
// according to real Z value of "segment" and slopes of "extrapSegment"
- extrapCorrSegment->
- SetBendingCoor(extrapSegment->GetBendingCoor() +
- extrapSegment->GetBendingSlope() *
- (segment->GetHitForRec1()->GetZ() -
- (&(pMUON->Chamber(2 * station)))->Z()));
- extrapCorrSegment->
- SetNonBendingCoor(extrapSegment->GetNonBendingCoor() +
- extrapSegment->GetNonBendingSlope() *
- (segment->GetHitForRec1()->GetZ() -
- (&(pMUON->Chamber(2 * station)))->Z()));
+ (&(trackParam[0]))->ExtrapToZ(segment->GetZ());
+ (&(trackParam[1]))->ExtrapToZ(segment->GetZ());
+ extrapSegment->SetBendingCoor((&(trackParam[0]))->GetBendingCoor());
+ extrapSegment->SetNonBendingCoor((&(trackParam[0]))->GetNonBendingCoor());
+ extrapSegment->SetBendingSlope((&(trackParam[0]))->GetBendingSlope());
+ extrapSegment->SetNonBendingSlope((&(trackParam[0]))->GetNonBendingSlope());
chi2 = segment->
- NormalizedChi2WithSegment(extrapCorrSegment, maxSigma2Distance);
+ NormalizedChi2WithSegment(extrapSegment, maxSigma2Distance);
if (chi2 < bestChi2) {
// update best Chi2 and Segment if better found
bestSegment = segment;
}
if (bestSegment) {
// best segment found: add it to track candidate
+ (&(trackParam[0]))->ExtrapToZ(bestSegment->GetZ());
+ (&(trackParam[1]))->ExtrapToZ(bestSegment->GetZ());
track->AddSegment(bestSegment);
// set track parameters at these two TrakHit's
track->SetTrackParamAtHit(track->GetNTrackHits() - 2, &(trackParam[0]));
// should consider all possibilities ????
// multiple scattering ???? do about like for extrapSegment !!!!
extrapHit = new AliMUONHitForRec(); // empty hit
- extrapCorrHit = new AliMUONHitForRec(); // empty corrected hit
bestChi2 = 3.0;
bestHit = NULL;
if (fPrintLevel >= 10) {
}
// Loop over chambers of the station
for (chInStation = 0; chInStation < 2; chInStation++) {
- // coordinates of extrapolated hit
- extrapHit->
- SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor());
- extrapHit->
- SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor());
- // resolutions from "extrapSegment"
- extrapHit->SetBendingReso2(extrapSegment->GetBendingCoorReso2());
- extrapHit->SetNonBendingReso2(extrapSegment->GetNonBendingCoorReso2());
- // same things for corrected hit
- // better to use copy constructor, after checking that it works properly !!!!
- extrapCorrHit->
- SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor());
- extrapCorrHit->
- SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor());
- extrapHit->SetBendingReso2(extrapSegment->GetBendingCoorReso2());
- extrapHit->SetNonBendingReso2(extrapSegment->GetNonBendingCoorReso2());
- // Loop over hits in the chamber
ch = 2 * station + chInStation;
for (iHit = fIndexOfFirstHitForRecPerChamber[ch];
iHit < fIndexOfFirstHitForRecPerChamber[ch] +
fNHitsForRecPerChamber[ch];
iHit++) {
hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[iHit]);
- // correction of corrected hit (fBendingCoor and fNonBendingCoor)
- // according to real Z value of "hit" and slopes of right "trackParam"
- extrapCorrHit->
- SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor() +
- (&(trackParam[chInStation]))->GetBendingSlope() *
- (hit->GetZ() -
- (&(trackParam[chInStation]))->GetZ()));
- extrapCorrHit->
- SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor() +
- (&(trackParam[chInStation]))->GetNonBendingSlope() *
- (hit->GetZ() -
- (&(trackParam[chInStation]))->GetZ()));
+ // coordinates of extrapolated hit
+ (&(trackParam[chInStation]))->ExtrapToZ(hit->GetZ());
+ extrapHit->
+ SetBendingCoor((&(trackParam[chInStation]))->GetBendingCoor());
+ extrapHit->
+ SetNonBendingCoor((&(trackParam[chInStation]))->GetNonBendingCoor());
+ // resolutions from "extrapSegment"
+ extrapHit->SetBendingReso2(extrapSegment->GetBendingCoorReso2());
+ extrapHit->SetNonBendingReso2(extrapSegment->GetNonBendingCoorReso2());
+ // Loop over hits in the chamber
// condition for hit not already in segment ????
chi2 = hit->NormalizedChi2WithHitForRec(extrapHit, maxSigma2Distance);
if (chi2 < bestChi2) {
}
if (bestHit) {
// best hit found: add it to track candidate
+ (&(trackParam[chBestHit]))->ExtrapToZ(bestHit->GetZ());
track->AddHitForRec(bestHit);
// set track parameters at this TrackHit
track->SetTrackParamAtHit(track->GetNTrackHits() - 1,
// and corresponding TrackHit's, ...
track->Remove();
delete extrapSegment;
- delete extrapCorrSegment;
delete extrapHit;
- delete extrapCorrHit;
break; // stop the search for this candidate:
// exit from the loop over station
}
delete extrapHit;
- delete extrapCorrHit;
}
delete extrapSegment;
- delete extrapCorrSegment;
// Sort track hits according to increasing Z
track->GetTrackHitsPtr()->Sort();
// Update track parameters at first track hit (smallest Z)
// after going through the first station
if (station == 0) {
trackParamVertex = *trackParam1;
- (&trackParamVertex)->ExtrapToVertex();
+ (&trackParamVertex)->ExtrapToVertex(0.,0.,0.);
track->SetTrackParamAtVertex(&trackParamVertex);
if (fPrintLevel >= 1) {
cout << "FollowTracks: track candidate(0..): " << trackIndex
return;
}
+ //__________________________________________________________________________
+void AliMUONEventReconstructor::UpdateHitForRecAtHit()
+{
+ // Set cluster parameterss after track fitting. Fill fHitForRecAtHit of AliMUONTrack's
+ AliMUONTrack *track;
+ AliMUONTrackHit *trackHit;
+ AliMUONHitForRec *hitForRec;
+ track = (AliMUONTrack*) fRecTracksPtr->First();
+ while (track) {
+ trackHit = (AliMUONTrackHit*) (track->GetTrackHitsPtr())->First();
+ while (trackHit) {
+ hitForRec = trackHit->GetHitForRecPtr();
+ track->AddHitForRecAtHit(hitForRec);
+ trackHit = (AliMUONTrackHit*) (track->GetTrackHitsPtr())->After(trackHit);
+ } // trackHit
+ track = (AliMUONTrack*) fRecTracksPtr->After(track);
+ } // track
+ return;
+}
+
+ //__________________________________________________________________________
+void AliMUONEventReconstructor::FillMUONTrack()
+{
+ // Set track parameters at hits for Kalman track. Fill fTrackParamAtHit of AliMUONTrack's
+ AliMUONTrackK *track;
+ track = (AliMUONTrackK*) fRecTracksPtr->First();
+ while (track) {
+ track->FillMUONTrack();
+ track = (AliMUONTrackK*) fRecTracksPtr->After(track);
+ }
+ return;
+}
+
//__________________________________________________________________________
void AliMUONEventReconstructor::EventDump(void)
{
{
// Follow tracks using Kalman filter
Bool_t ok;
- Int_t icand, ichamBeg, ichamEnd, chamBits;
+ Int_t icand, ichamBeg = 0, ichamEnd, chamBits;
Double_t zDipole1, zDipole2;
AliMUONTrackK *trackK;
AliMUONHitForRec *hit;
AliMUONRawCluster *clus;
TClonesArray *rawclusters;
- AliMUON *pMUON;
clus = 0; rawclusters = 0;
- zDipole1 = GetSimpleBPosition() - GetSimpleBLength()/2;
- zDipole2 = zDipole1 + GetSimpleBLength();
+ //AZ(z->-z) zDipole1 = GetSimpleBPosition() - GetSimpleBLength()/2;
+ //AZ(z->-z) zDipole2 = zDipole1 + GetSimpleBLength();
+ zDipole1 = GetSimpleBPosition() + GetSimpleBLength()/2;
+ zDipole2 = zDipole1 - GetSimpleBLength();
// Print hits
- pMUON = (AliMUON*) gAlice->GetModule("MUON");
- for (Int_t i1=0; i1<fNHitsForRec; i1++) {
- hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[i1]);
- //if (hit->GetTHTrack() > 1 || hit->GetGeantSignal() == 0) continue;
- /*
- cout << " Hit #" << hit->GetChamberNumber() << " ";
- cout << hit->GetBendingCoor() << " ";
- cout << hit->GetNonBendingCoor() << " ";
- cout << hit->GetZ() << " ";
- cout << hit->GetGeantSignal() << " ";
- cout << hit->GetTHTrack() << endl;
- */
- /*
- printf(" Hit # %d %10.4f %10.4f %10.4f",
- hit->GetChamberNumber(), hit->GetBendingCoor(),
- hit->GetNonBendingCoor(), hit->GetZ());
- if (fRecGeantHits) {
- // from GEANT hits
- printf(" %3d %3d \n", hit->GetGeantSignal(), hit->GetTHTrack());
- } else {
- // from raw clusters
- rawclusters = pMUON->RawClustAddress(hit->GetChamberNumber());
- clus = (AliMUONRawCluster*) rawclusters->UncheckedAt(hit->
- GetHitNumber());
- printf("%3d", clus->fTracks[1]-1);
- if (clus->fTracks[2] != 0) printf("%3d \n", clus->fTracks[2]-1);
- else printf("\n");
+ trackK = (AliMUONTrackK*) ((*fRecTracksPtr)[0]);
+ if (trackK->DebugLevel() > 0) {
+ for (Int_t i1=0; i1<fNHitsForRec; i1++) {
+ hit = (AliMUONHitForRec*) ((*fHitsForRecPtr)[i1]);
+ //if (hit->GetTTRTrack() > 1 || hit->GetTrackRefSignal() == 0) continue;
+ printf(" Hit # %d %10.4f %10.4f %10.4f",
+ hit->GetChamberNumber(), hit->GetBendingCoor(),
+ hit->GetNonBendingCoor(), hit->GetZ());
+ if (fRecTrackRefHits) {
+ // from track ref hits
+ printf(" %3d %3d \n", hit->GetTrackRefSignal(), hit->GetTTRTrack());
+ } else {
+ // from raw clusters
+ rawclusters = fMUONData->RawClusters(hit->GetChamberNumber());
+ clus = (AliMUONRawCluster*) rawclusters->UncheckedAt(hit->
+ GetHitNumber());
+ printf("%3d", clus->GetTrack(1)-1);
+ if (clus->GetTrack(2) != 0) printf("%3d \n", clus->GetTrack(2)-1);
+ else printf("\n");
+ } // if (fRecTrackRefHits)
}
- */
- }
+ } // if (trackK->DebugLevel() > 0)
icand = -1;
- Int_t nSeeds = fNRecTracks; // starting number of seeds
+ Int_t nSeeds;
+ nSeeds = fNRecTracks; // starting number of seeds
// Loop over track candidates
while (icand < fNRecTracks-1) {
icand ++;
+ if (trackK->DebugLevel()>0) cout << " *** Kalman track candidate No. " << icand << endl;
trackK = (AliMUONTrackK*) ((*fRecTracksPtr)[icand]);
+ if (trackK->GetRecover() < 0) continue; // failed track
// Discard candidate which will produce the double track
+ /*
if (icand > 0) {
ok = CheckCandidateK(icand,nSeeds);
if (!ok) {
- //trackK->SetRecover(-1); // mark candidate to be removed
- //continue;
+ trackK->SetRecover(-1); // mark candidate to be removed
+ continue;
}
}
+ */
ok = kTRUE;
if (trackK->GetRecover() == 0) hit = (AliMUONHitForRec*)
trackK->GetHitOnTrack()->Last(); // last hit
- else hit = (AliMUONHitForRec*) (*trackK->GetHitOnTrack())[1]; // 2'nd hit
- ichamBeg = hit->GetChamberNumber();
+ //else hit = (AliMUONHitForRec*) (*trackK->GetHitOnTrack())[1]; // 2'nd hit
+ else hit = trackK->GetHitLastOk(); // hit where track stopped
+ if (hit) ichamBeg = hit->GetChamberNumber();
ichamEnd = 0;
// Check propagation direction
- if (trackK->GetTrackDir() > 0) {
+ if (hit == NULL) ichamBeg = ichamEnd;
+ //AZ(z->-z) else if (trackK->GetTrackDir() > 0) {
+ else if (trackK->GetTrackDir() < 0) {
ichamEnd = 9; // forward propagation
ok = trackK->KalmanFilter(ichamBeg,ichamEnd,kFALSE,zDipole1,zDipole2);
if (ok) {
ichamEnd = 6; // backward propagation
// Change weight matrix and zero fChi2 for backpropagation
trackK->StartBack();
+ //AZ trackK->SetTrackDir(-1);
+ trackK->SetTrackDir(1);
ok = trackK->KalmanFilter(ichamBeg,ichamEnd,kTRUE,zDipole1,zDipole2);
ichamBeg = ichamEnd;
ichamEnd = 0;
}
if (ok) {
- trackK->SetTrackDir(-1);
+ //AZ trackK->SetTrackDir(-1);
+ trackK->SetTrackDir(1);
trackK->SetBPFlag(kFALSE);
ok = trackK->KalmanFilter(ichamBeg,ichamEnd,kFALSE,zDipole1,zDipole2);
}
- if (ok) trackK->SetTrackQuality(0); // compute "track quality"
- else trackK->SetRecover(-1); // mark candidate to be removed
+ if (!ok) { trackK->SetRecover(-1); continue; } // mark candidate to be removed
+
+ // Apply smoother
+ if (trackK->GetRecover() >= 0) {
+ ok = trackK->Smooth();
+ if (!ok) trackK->SetRecover(-1); // mark candidate to be removed
+ }
// Majority 3 of 4 in first 2 stations
+ if (!ok) continue;
chamBits = 0;
+ Double_t chi2_max = 0;
for (Int_t i=0; i<trackK->GetNTrackHits(); i++) {
hit = (AliMUONHitForRec*) (*trackK->GetHitOnTrack())[i];
- chamBits |= BIT(hit->GetChamberNumber()-1);
+ chamBits |= BIT(hit->GetChamberNumber());
+ if (trackK->GetChi2PerPoint(i) > chi2_max) chi2_max = trackK->GetChi2PerPoint(i);
}
- //if (!((chamBits&3)==3 || (chamBits>>2&3)==3)) trackK->SetRecover(-1);
- //mark candidate to be removed
+ if (!((chamBits&3)==3 || (chamBits>>2&3)==3) && chi2_max > 25) {
+ //trackK->Recover();
+ trackK->SetRecover(-1); //mark candidate to be removed
+ continue;
+ }
+ if (ok) trackK->SetTrackQuality(0); // compute "track quality"
} // while
for (Int_t i=0; i<fNRecTracks; i++) {
// Loop over first track of the pair
track1 = (AliMUONTrackK*) fRecTracksPtr->First();
+ Int_t debug = track1->DebugLevel();
while (track1) {
// Loop over second track of the pair
track2 = (AliMUONTrackK*) fRecTracksPtr->After(track1);
while (track2) {
// Check whether or not to keep track2
if (!track2->KeepTrack(track1)) {
- cout << " Killed track: " << 1/(*track2->GetTrackParameters())(4,0) <<
+ if (debug >= 0) cout << " Killed track: " << 1/(*track2->GetTrackParameters())(4,0) <<
" " << track2->GetTrackQuality() << endl;
trackToKill = track2;
track2 = (AliMUONTrackK*) fRecTracksPtr->After(track2);
} // track1
fNRecTracks = fRecTracksPtr->GetEntriesFast();
- cout << " Number of Kalman tracks: " << fNRecTracks << endl;
+ if (debug >= 0) cout << " Number of Kalman tracks: " << fNRecTracks << endl;
}
//__________________________________________________________________________
zVertex = 0;
for (Int_t i=0; i<fNRecTracks; i++) {
//((AliMUONTrackK*)(*fRecTracksPtr)[i])->Branson();
- //((AliMUONTrackK*)(*fRecTracksPtr)[i])->GoToZ(zVertex); // w/out absorber
((AliMUONTrackK*)(*fRecTracksPtr)[i])->SetTrackQuality(1); // compute Chi2
- ((AliMUONTrackK*)(*fRecTracksPtr)[i])->GoToVertex(); // with absorber
+ //((AliMUONTrackK*)(*fRecTracksPtr)[i])->GoToZ(zVertex); // w/out absorber
+ ((AliMUONTrackK*)(*fRecTracksPtr)[i])->GoToVertex(1); // with absorber
}
}
+
+//__________________________________________________________________________
+void AliMUONEventReconstructor::SetTrackMethod(Int_t iTrackMethod)
+{
+ // Set track method and recreate track container if necessary
+
+ fTrackMethod = iTrackMethod == 2 ? 2 : 1;
+ if (fTrackMethod == 2) {
+ if (fRecTracksPtr) delete fRecTracksPtr;
+ fRecTracksPtr = new TClonesArray("AliMUONTrackK", 10);
+ cout << " *** Tracking with the Kalman filter *** " << endl;
+ } else cout << " *** Traditional tracking *** " << endl;
+
+}