X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FMUONRefit.C;h=69d299d5c7169e5e4123d6771cce7ce273c1a566;hb=e2ee57278e1744c6573551d83090f758ec4f1ee4;hp=3278c52f3324e284deccd758c6afea5d49fa0e86;hpb=ad3c6edafb517bc2779348c3b590deae74fc6e25;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/MUONRefit.C b/MUON/MUONRefit.C index 3278c52f332..69d299d5c71 100644 --- a/MUON/MUONRefit.C +++ b/MUON/MUONRefit.C @@ -32,53 +32,36 @@ #include // STEER includes -#include "AliMagFMaps.h" -#include "AliTracker.h" #include "AliESDEvent.h" #include "AliESDMuonTrack.h" -#include "AliRecoParam.h" #include "AliCDBManager.h" #include "AliGeomManager.h" // MUON includes -#include "AliMpCDB.h" +#include "AliMUONCDB.h" #include "AliMUONRecoParam.h" #include "AliMUONESDInterface.h" #include "AliMUONRefitter.h" #include "AliMUONVDigit.h" -#include "AliMUONVCluster.h" -#include "AliMUONVClusterStore.h" #include "AliMUONTrack.h" #include "AliMUONVTrackStore.h" #include "AliMUONTrackParam.h" -#include "AliMUONTrackExtrap.h" #endif const Int_t printLevel = 1; -void Prepare(); TTree* GetESDTree(TFile *esdFile); //----------------------------------------------------------------------- -void MUONRefit(Int_t nevents = -1, const char* esdFileNameIn = "AliESDs.root", const char* esdFileNameOut = "AliESDs_New.root") +void MUONRefit(Int_t nevents = -1, const char* esdFileNameIn = "AliESDs.root", const char* esdFileNameOut = "AliESDs_New.root", + const char* geoFilename = "geometry.root", const char* ocdbPath = "local://$ALICE_ROOT/OCDB") { + /// Example of muon refitting: /// refit ESD tracks from ESD pads (i.e. re-clusterized the attached ESD clusters); /// reset the charge of the digit using their raw charge before refitting; /// compare results with original ESD tracks; /// write results in a new ESD file - // prepare the refitting - gRandom->SetSeed(1); - Prepare(); - - // set reconstruction parameters used for refitting - AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLowFluxParam(); - muonRecoParam->Print("FULL"); - - AliMUONESDInterface esdInterface; - AliMUONRefitter refitter(muonRecoParam); - refitter.Connect(&esdInterface); - // open the ESD file and tree TFile* esdFile = TFile::Open(esdFileNameIn); TTree* esdTree = GetESDTree(esdFile); @@ -91,7 +74,39 @@ void MUONRefit(Int_t nevents = -1, const char* esdFileNameIn = "AliESDs.root", c // connect ESD event to the ESD tree AliESDEvent* esd = new AliESDEvent(); esd->ReadFromTree(esdTree); - + + // get run number + if (esdTree->GetEvent(0) <= 0) { + Error("MUONRefit", "no ESD object found for event 0"); + return; + } + Int_t runNumber = esd->GetRunNumber(); + + // Import TGeo geometry + if (!gGeoManager) { + AliGeomManager::LoadGeometry(geoFilename); + if (!gGeoManager) { + Error("MUONRefit", "getting geometry from file %s failed", "generated/galice.root"); + exit(-1); + } + } + + // load necessary data from OCDB + AliCDBManager::Instance()->SetDefaultStorage(ocdbPath); + AliCDBManager::Instance()->SetRun(runNumber); + if (!AliMUONCDB::LoadField()) return; + if (!AliMUONCDB::LoadMapping(kTRUE)) return; + + // reconstruction parameters for the refitting + AliMUONRecoParam* recoParam = AliMUONRecoParam::GetLowFluxParam(); + Info("MUONRefit", "\n Reconstruction parameters for refitting:"); + recoParam->Print("FULL"); + + AliMUONESDInterface esdInterface; + AliMUONRefitter refitter(recoParam); + refitter.Connect(&esdInterface); + gRandom->SetSeed(1); + // timer start... TStopwatch timer; @@ -107,14 +122,14 @@ void MUONRefit(Int_t nevents = -1, const char* esdFileNameIn = "AliESDs.root", c // 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(); if (nTracks < 1) continue; // load the current event - esdInterface.LoadEvent(*esd); + esdInterface.LoadEvent(*esd, kFALSE); // loop over digit to modify their charge AliMUONVDigit *digit; @@ -193,41 +208,11 @@ void MUONRefit(Int_t nevents = -1, const char* esdFileNameIn = "AliESDs.root", c // free memory esdFile->Close(); delete esd; + delete recoParam; cout<SetDefaultStorage("local://$ALICE_ROOT"); - man->SetRun(0); - if ( ! AliMpCDB::LoadDDLStore() ) { - Error("MUONRefit","Could not access mapping from OCDB !"); - exit(-1); - } - -} - //----------------------------------------------------------------------- TTree* GetESDTree(TFile *esdFile) {