#include "AliLoader.h"
#include "AliMUONTrackK.h" //AZ
#include "AliMC.h"
-#include "AliLog.h"
//************* Defaults parameters for reconstruction
const Double_t AliMUONEventReconstructor::fgkDefaultMinBendingMomentum = 3.0;
{
// Protected copy constructor
- AliFatal("Not implemented.");
+ Fatal("AliMUONEventReconstructor", "Not implemented.");
}
AliMUONEventReconstructor &
if (this == &rhs) return *this;
- AliFatal("Not implemented.");
+ Fatal("operator=", "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;
sprintf(treeName, "TreeK%d", fBkgGeantEventNumber);
fBkgGeantTK = (TTree*)gDirectory->Get(treeName);
if (!fBkgGeantTK) {
- AliError(Form("cannot find Kine Tree for background event: %d",fBkgGeantEventNumber));
- exit(0);
+ cout << "ERROR: cannot find Kine Tree for background event: " <<
+ fBkgGeantEventNumber << endl;
+ exit(0);
}
}
if (fBkgGeantTK)
sprintf(treeName, "TreeH%d", fBkgGeantEventNumber);
fBkgGeantTH = (TTree*)gDirectory->Get(treeName);
if (!fBkgGeantTH) {
- AliError(Form("cannot find Hits Tree for background event: %d",fBkgGeantEventNumber));
+ cout << "ERROR: cannot find Hits Tree for background event: " <<
+ fBkgGeantEventNumber << endl;
exit(0);
}
if (fBkgGeantTH && fBkgGeantHits) {
Int_t retval = fLoader->LoadHits();
if ( retval)
{
- AliError("Error occured while loading hits.");
+ Error("MakeEventToBeReconstructed","Error occured while loading hits.");
return;
}
treeH = fLoader->TreeH();
if (treeH == 0x0)
{
- AliError("Can not get TreeH");
+ Error("MakeEventToBeReconstructed","Can not get TreeH");
return;
}
}
nTRentries = Int_t(TR->GetEntries());
if (nTRentries != 1) {
- AliError(Form("nTRentries = %d not equal to 1 ",nTRentries));
+ cout << "Error in AliMUONEventReconstructor::AddHitsForRecFromRawClusters"
+ << endl;
+ cout << "nTRentries = " << nTRentries << " not equal to 1" << endl;
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) {
treeR->GetEvent(0); // only one entry
if (!(fMUONData->IsTriggerBranchesInTree())) {
- AliWarning(Form("Trigger information is not avalaible, nTRentries = %d not equal to 1",nTRentries));
+ cout << "Warning in AliMUONEventReconstructor::MakeTriggerTracks"
+ << endl;
+ cout << "Trigger information is not avalaible, nTRentries = " << nTRentries << " not equal to 1" << endl;
return kFALSE;
}
// 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) {
{
// 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)