#include <TROOT.h>
// STEER includes
-#include "AliMagFMaps.h"
+#include "AliMagF.h"
#include "AliTracker.h"
#include "AliESDEvent.h"
#include "AliESDMuonTrack.h"
#include "AliRecoParam.h"
#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliCDBPath.h"
#include "AliGeomManager.h"
// MUON includes
#include "AliMUONESDInterface.h"
#include "AliMUONRefitter.h"
#include "AliMUONVDigit.h"
-#include "AliMUONVCluster.h"
-#include "AliMUONVClusterStore.h"
#include "AliMUONTrack.h"
#include "AliMUONVTrackStore.h"
#include "AliMUONTrackParam.h"
// prepare the refitting
gRandom->SetSeed(1);
Prepare();
+
+ // reconstruction parameters for the refitting
+ AliMUONRecoParam* recoParam = AliMUONRecoParam::GetLowFluxParam();
+ Info("MUONRefit", "\n Reconstruction parameters for refitting:");
+ recoParam->Print("FULL");
+
AliMUONESDInterface esdInterface;
- AliMUONRefitter refitter;
+ AliMUONRefitter refitter(recoParam);
refitter.Connect(&esdInterface);
// open the ESD file and tree
TFile* esdFile = TFile::Open(esdFileNameIn);
TTree* esdTree = GetESDTree(esdFile);
- // create the ESD output tree
- gROOT->cd();
+ // create the ESD output file and tree
+ TFile* newESDFile = TFile::Open(esdFileNameOut, "RECREATE");
+ newESDFile->SetCompressionLevel(2);
TTree* newESDTree = esdTree->CloneTree(0);
// connect ESD event to the ESD tree
// get the ESD of current event
esdTree->GetEvent(iEvent);
if (!esd) {
- Error("CheckESD", "no ESD object found for event %d", iEvent);
+ Error("MUONRefit", "no ESD object found for event %d", iEvent);
return;
}
Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks();
// loop over digit to modify their charge
AliMUONVDigit *digit;
TIter next(esdInterface.CreateDigitIterator());
- while ((digit = static_cast<AliMUONVDigit*>(next()))) digit->SetCharge(digit->ADC());
+ while ((digit = static_cast<AliMUONVDigit*>(next()))) {
+ digit->SetCharge(digit->ADC());
+ digit->Calibrated(kFALSE);
+ }
// refit the tracks from digits
AliMUONVTrackStore* newTrackStore = refitter.ReconstructFromDigits();
// get the ESD track
AliESDMuonTrack* esdTrack = (AliESDMuonTrack*) esdTracks->UncheckedAt(iTrack);
+
+ // skip ghost tracks (leave them unchanged in the new ESD file)
+ if (!esdTrack->ContainTrackerData()) continue;
+
// get the corresponding MUON track
AliMUONTrack* track = esdInterface.FindTrack(esdTrack->GetUniqueID());
+
// Find the corresponding re-fitted MUON track
AliMUONTrack* newTrack = (AliMUONTrack*) newTrackStore->FindObject(esdTrack->GetUniqueID());
timer.Stop();
// write output ESD tree
- TFile* newESDFile = TFile::Open(esdFileNameOut, "RECREATE");
- newESDFile->SetCompressionLevel(2);
+ newESDFile->cd();
newESDTree->Write();
+ delete newESDTree;
newESDFile->Close();
// free memory
esdFile->Close();
- delete newESDTree;
delete esd;
cout<<endl<<"time to refit: R:"<<timer.RealTime()<<" C:"<<timer.CpuTime()<<endl<<endl;
}
}
- // set mag field
- printf("Loading field map...\n");
- AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 1, 1., 10., AliMagFMaps::k5kG);
- AliTracker::SetFieldMap(field, kFALSE);
- AliMUONTrackExtrap::SetField(AliTracker::GetFieldMap());
+ // set mag field
+ // waiting for mag field in CDB
+ if (!TGeoGlobalMagField::Instance()->GetField()) {
+ printf("Loading field map...\n");
+ AliMagF* field = new AliMagF("Maps","Maps",2,1.,1., 10.,AliMagF::k5kG);
+ TGeoGlobalMagField::Instance()->SetField(field);
+ }
+ // set the magnetic field for track extrapolations
+ AliMUONTrackExtrap::SetField();
// Load mapping
AliCDBManager* man = AliCDBManager::Instance();
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
man->SetRun(0);
if ( ! AliMpCDB::LoadDDLStore() ) {
Error("MUONRefit","Could not access mapping from OCDB !");
exit(-1);
}
- // set reconstruction parameters
- AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLowFluxParam();
- muonRecoParam->CombineClusterTrackReco(kFALSE);
- muonRecoParam->Print("FULL");
- AliRecoParam::Instance()->RegisterRecoParam(muonRecoParam);
+ // Load initial reconstruction parameters from OCDB
+ AliMUONRecoParam* recoParam = 0x0;
+ AliCDBPath path("MUON","Calib","RecoParam");
+ AliCDBEntry *entry=man->Get(path.GetPath());
+ if(entry) {
+ recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject());
+ entry->SetOwner(0);
+ AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
+ }
+ if (!recoParam) {
+ printf("Couldn't find RecoParam object in OCDB: create default one");
+ recoParam = AliMUONRecoParam::GetLowFluxParam();
+ }
+ Info("MUONRefit", "\n initial recontruction parameters:");
+ recoParam->Print("FULL");
+ AliMUONESDInterface::ResetTracker(recoParam);
}