#include <fstream>
#include <TString.h>
+#include <TError.h>
#include <TGraphErrors.h>
#include <TTree.h>
#include <TChain.h>
#include "AliCDBMetaData.h"
#include "AliCDBId.h"
#include "AliGeomManager.h"
-#include "AliLog.h"
#include "AliMpCDB.h"
#include "AliMUONAlignment.h"
fTransform(0x0),
fTrackTot(0),
fTrackOk(0),
+ fLastRunNumber(-1),
fMSDEx(0x0),
fMSDEy(0x0),
fMSDEz(0x0),
fTransform(0x0),
fTrackTot(0),
fTrackOk(0),
+ fLastRunNumber(-1),
fMSDEx(0x0),
fMSDEy(0x0),
fMSDEz(0x0),
fTransform = obj.fTransform;
fTrackTot = obj.fTrackTot;
fTrackOk = obj.fTrackOk;
+ fLastRunNumber = obj.fLastRunNumber;
fMSDEx = obj.fMSDEx;
fMSDEy = obj.fMSDEy;
fMSDEz = obj.fMSDEz;
fTransform = other.fTransform;
fTrackTot = other.fTrackTot;
fTrackOk = other.fTrackOk;
+ fLastRunNumber = other.fLastRunNumber;
fMSDEx = other.fMSDEx;
fMSDEy = other.fMSDEy;
fMSDEz = other.fMSDEz;
{
/// Local initialization, called once per task on the client machine
/// where the analysis train is assembled
-
- Prepare(fGeoFilename.Data(),fDefaultOCDB.Data(),fMisAlignOCDB.Data());
+ fLastRunNumber = 0;
+ // Prepare(fGeoFilename.Data(),fDefaultOCDB.Data(),fMisAlignOCDB.Data());
+ Prepare(fGeoFilename.Data(),"local://$ALICE_ROOT/OCDB",fMisAlignOCDB.Data());
+ fLastRunNumber = -1;
// Set initial values here, good guess may help convergence
// St 1
}
Double_t trackParams[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
-
-
+ if (fESD->GetRunNumber()!=fLastRunNumber){
+ fLastRunNumber = fESD->GetRunNumber();
+ Prepare(fGeoFilename.Data(),fDefaultOCDB.Data(),fMisAlignOCDB.Data());
+ }
Int_t nTracks = Int_t(fESD->GetNumberOfMuonTracks());
// if (!event%100) cout << " there are " << nTracks << " tracks in event " << event << endl;
fAlign->LocalFit(fTrackOk++,trackParams,0);
}
fTrackTot++;
+ cout << "Processed " << fTrackTot << " Tracks." << endl;
}
// Post final data. Write histo list to a file with option "RECREATE"
}
//________________________________________________________________________
-void AliMUONAlignmentTask::Terminate(const Option_t*)
+void AliMUONAlignmentTask::FinishTaskOutput()
{
/// Called once per task on the client machine at the end of the analysis.
cout << "Done with GlobalFit " << endl;
- // Update pointers reading them from the output slot
- fList = (TList*)GetOutputData(0);
- fMSDEx = (TGraphErrors*)fList->At(0);
- fMSDEy = (TGraphErrors*)fList->At(1);
- fMSDEz = (TGraphErrors*)fList->At(2);
- fMSDEp = (TGraphErrors*)fList->At(3);
+// // Update pointers reading them from the output slot
+// fList = (TList*)GetOutputData(0);
+// fMSDEx = (TGraphErrors*)fList->At(0);
+// fMSDEy = (TGraphErrors*)fList->At(1);
+// fMSDEz = (TGraphErrors*)fList->At(2);
+// fMSDEp = (TGraphErrors*)fList->At(3);
// Store results
Double_t DEid[156] = {0};
// Post final data. Write histo list to a file with option "RECREATE"
PostData(0,fList);
-
// Re Align
AliMUONGeometryTransformer *newTransform = fAlign->ReAlign(fTransform,fParameters,true);
newTransform->WriteTransformations("transform2ReAlign.dat");
}
+//________________________________________________________________________
+void AliMUONAlignmentTask::Terminate(const Option_t*)
+{
+ /// Called once per task on the client machine at the end of the analysis.
+
+}
+
//-----------------------------------------------------------------------
void AliMUONAlignmentTask::Prepare(const char* geoFilename, const char* defaultOCDB, const char* misAlignOCDB)
{
/// Set the geometry, the magnetic field, the mapping and the reconstruction parameters
-
- // Import TGeo geometry (needed by AliMUONTrackExtrap::ExtrapToVertex)
- if (!gGeoManager) {
- AliGeomManager::LoadGeometry(geoFilename);
- if (!gGeoManager) {
- AliError(Form("Getting geometry from file %s failed", "generated/galice.root"));
- return;
- }
- }
-
+
// Load mapping
AliCDBManager* man = AliCDBManager::Instance();
man->SetDefaultStorage(defaultOCDB);
man->SetSpecificStorage("MUON/Align/Data",misAlignOCDB);
man->Print();
- man->SetRun(0);
+ man->SetRun(fLastRunNumber);
if ( ! AliMpCDB::LoadDDLStore() ) {
- AliError("Could not access mapping from OCDB !");
+ Error("MUONRefit","Could not access mapping from OCDB !");
exit(-1);
}
+ // Import TGeo geometry (needed by AliMUONTrackExtrap::ExtrapToVertex)
+ if (!gGeoManager) {
+ AliGeomManager::LoadGeometry(geoFilename);
+ if (!gGeoManager) {
+ Error("AliMUONReAlignTask", "getting geometry from file %s failed", "generated/galice.root");
+ return;
+ }
+ }
+
// set mag field
if (!TGeoGlobalMagField::Instance()->GetField()) {
printf("Loading field map...\n");