#include <TSystem.h>
#include <TROOT.h>
#include <TPluginManager.h>
-#include <TStopwatch.h>
#include <TGeoManager.h>
#include <TLorentzVector.h>
#include "AliReconstruction.h"
+#include "AliCodeTimer.h"
#include "AliReconstructor.h"
#include "AliLog.h"
#include "AliRunLoader.h"
CleanUp();
fOptions.Delete();
fSpecCDBUri.Delete();
+
+ AliCodeTimer::Instance()->Print();
}
//_____________________________________________________________________________
loadAlObjsListOfDets += fgkDetectorName[iDet];
loadAlObjsListOfDets += " ";
} // end loop over detectors
- (AliGeomManager::Instance())->ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data());
+ AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data());
}else{
// Check if the array with alignment objects was
// provided by the user. If yes, apply the objects
// to the present TGeo geometry
if (fAlignObjArray) {
if (gGeoManager && gGeoManager->IsClosed()) {
- if ((AliGeomManager::Instance())->ApplyAlignObjsToGeom(fAlignObjArray) == kFALSE) {
+ if (AliGeomManager::ApplyAlignObjsToGeom(*fAlignObjArray) == kFALSE) {
AliError("The misalignment of one or more volumes failed!"
"Compare the list of simulated detectors and the list of detector alignment data!");
return kFALSE;
delete fAlignObjArray; fAlignObjArray=0;
- // Update the TGeoPhysicalNodes
- gGeoManager->RefreshPhysicalNodes();
-
return kTRUE;
}
{
// run the reconstruction
+ AliCodeTimerAuto("")
+
// set the input
if (!input) input = fInput.Data();
TString fileName(input);
if (!gGeoManager) {
TString geom(gSystem->DirName(fGAliceFileName));
geom += "/geometry.root";
- TGeoManager::Import(geom.Data());
+ AliGeomManager::LoadGeometry(geom.Data());
if (!gGeoManager) if (fStopOnError) return kFALSE;
}
}
}
-
- TStopwatch stopwatch;
- stopwatch.Start();
-
// get the possibly already existing ESD file and tree
AliESD* esd = new AliESD(); AliESD* hltesd = new AliESD();
TFile* fileOld = NULL;
// Muon tracking
if (!fRunTracking.IsNull()) {
if (fRunMuonTracking) {
- if (!RunMuonTracking()) {
+ if (!RunMuonTracking(esd)) {
if (fStopOnError) {CleanUp(file, fileOld); return kFALSE;}
}
}
}
- AliInfo(Form("Execution time for filling ESD : R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
file->cd();
if (fWriteESDfriend)
tree->SetBranchStatus("ESDfriend*",0);
{
// run the local reconstruction
- TStopwatch stopwatch;
- stopwatch.Start();
+ AliCodeTimerAuto("")
AliCDBManager* man = AliCDBManager::Instance();
Bool_t origCache = man->GetCacheFlag();
if (!reconstructor) continue;
if (reconstructor->HasLocalReconstruction()) continue;
+ AliCodeTimerStart(Form("running reconstruction for %s", fgkDetectorName[iDet]));
AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet]));
- TStopwatch stopwatchDet;
- stopwatchDet.Start();
-
+
+ AliCodeTimerStart(Form("Loading calibration data from OCDB for %s", fgkDetectorName[iDet]));
AliInfo(Form("Loading calibration data from OCDB for %s", fgkDetectorName[iDet]));
man->SetCacheFlag(kTRUE);
TString calibPath = Form("%s/Calib/*", fgkDetectorName[iDet]);
man->GetAll(calibPath); // entries are cached!
+ AliCodeTimerStop(Form("Loading calibration data from OCDB for %s", fgkDetectorName[iDet]));
+
if (fRawReader) {
fRawReader->RewindEvents();
reconstructor->Reconstruct(fRunLoader, fRawReader);
} else {
reconstructor->Reconstruct(fRunLoader);
}
- AliInfo(Form("Execution time for %s: R:%.2fs C:%.2fs",
- fgkDetectorName[iDet],
- stopwatchDet.RealTime(),stopwatchDet.CpuTime()));
+
+ AliCodeTimerStop(Form("running reconstruction for %s", fgkDetectorName[iDet]));
// unload calibration data
- man->ClearCache();
+ man->UnloadFromCache(calibPath);
+ //man->ClearCache();
}
man->SetCacheFlag(origCache);
if (fStopOnError) return kFALSE;
}
- AliInfo(Form("Execution time: R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
return kTRUE;
}
{
// run the local reconstruction
- TStopwatch stopwatch;
- stopwatch.Start();
+ AliCodeTimerAuto("")
TString detStr = detectors;
for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (fRawReader && reconstructor->HasDigitConversion()) {
AliInfo(Form("converting raw data digits into root objects for %s",
fgkDetectorName[iDet]));
- TStopwatch stopwatchDet;
- stopwatchDet.Start();
+ AliCodeTimerAuto(Form("converting raw data digits into root objects for %s",
+ fgkDetectorName[iDet]));
loader->LoadDigits("update");
loader->CleanDigits();
loader->MakeDigitsContainer();
reconstructor->ConvertDigits(fRawReader, digitsTree);
loader->WriteDigits("OVERWRITE");
loader->UnloadDigits();
- AliInfo(Form("Execution time for %s: R:%.2fs C:%.2fs",
- fgkDetectorName[iDet],
- stopwatchDet.RealTime(),stopwatchDet.CpuTime()));
}
// local reconstruction
if (!reconstructor->HasLocalReconstruction()) continue;
AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet]));
- TStopwatch stopwatchDet;
- stopwatchDet.Start();
+ AliCodeTimerAuto(Form("running reconstruction for %s", fgkDetectorName[iDet]));
loader->LoadRecPoints("update");
loader->CleanRecPoints();
loader->MakeRecPointsContainer();
}
loader->WriteRecPoints("OVERWRITE");
loader->UnloadRecPoints();
- AliInfo(Form("Execution time for %s: R:%.2fs C:%.2fs",
- fgkDetectorName[iDet],
- stopwatchDet.RealTime(),stopwatchDet.CpuTime()));
}
if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) {
if (fStopOnError) return kFALSE;
}
- AliInfo(Form("Execution time: R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
return kTRUE;
}
{
// run the barrel tracking
- TStopwatch stopwatch;
- stopwatch.Start();
+ AliCodeTimerAuto("")
AliESDVertex* vertex = NULL;
Double_t vtxPos[3] = {0, 0, 0};
}
delete vertex;
- AliInfo(Form("Execution time: R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
return kTRUE;
}
{
// run the HLT barrel tracking
- TStopwatch stopwatch;
- stopwatch.Start();
+ AliCodeTimerAuto("")
if (!fRunLoader) {
AliError("Missing runLoader!");
delete tracker;
}
- AliInfo(Form("Execution time: R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
return kTRUE;
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::RunMuonTracking()
+Bool_t AliReconstruction::RunMuonTracking(AliESD*& esd)
{
// run the muon spectrometer tracking
- TStopwatch stopwatch;
- stopwatch.Start();
+ AliCodeTimerAuto("")
if (!fRunLoader) {
AliError("Missing runLoader!");
fLoader[iDet]->MakeTracksContainer();
// read RecPoints
- fLoader[iDet]->LoadRecPoints("read");
-
- if (!tracker->Clusters2Tracks(0x0)) {
+ fLoader[iDet]->LoadRecPoints("read");
+ tracker->LoadClusters(fLoader[iDet]->TreeR());
+
+ Int_t rv = tracker->Clusters2Tracks(esd);
+
+ fLoader[iDet]->UnloadRecPoints();
+
+ if ( rv )
+ {
AliError(Form("%s Clusters2Tracks failed", fgkDetectorName[iDet]));
return kFALSE;
}
+
+ tracker->UnloadClusters();
+
fLoader[iDet]->UnloadRecPoints();
fLoader[iDet]->WriteTracks("OVERWRITE");
delete tracker;
-
- AliInfo(Form("Execution time: R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
return kTRUE;
}
{
// run the barrel tracking
- TStopwatch stopwatch;
- stopwatch.Start();
+ AliCodeTimerAuto("")
AliInfo("running tracking");
track->RelateToVertex(esd->GetVertex(),fieldZ, kMaxD);
}
- AliInfo(Form("Execution time: R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
return kTRUE;
}
{
// fill the event summary data
- TStopwatch stopwatch;
- stopwatch.Start();
- AliInfo("filling ESD");
+ AliCodeTimerAuto("")
TString detStr = detectors;
for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (fStopOnError) return kFALSE;
}
- AliInfo(Form("Execution time: R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
return kTRUE;
}
// stored in Trigger.root file and fills
// the corresponding esd entries
+ AliCodeTimerAuto("")
+
AliInfo("Filling trigger information into the ESD");
if (fRawReader) {
// connect to ESD
TTree *t = (TTree*) esdFile->Get("esdTree");
- TBranch *b = t->GetBranch("ESD");
- AliESD *esd = 0;
- b->SetAddress(&esd);
+ AliESD *esd = new AliESD();
+ esd->ReadFromTree(t);
- Int_t nEvents = b->GetEntries();
+ Int_t nEvents = t->GetEntries();
// set arrays and pointers
Float_t posF[3];
// loop over events and fill them
for (Int_t iEvent = 0; iEvent < nEvents; ++iEvent) {
- b->GetEntry(iEvent);
+ t->GetEntry(iEvent);
// Multiplicity information needed by the header (to be revised!)
Int_t nTracks = esd->GetNumberOfTracks();
// Update the header
AliAODHeader* header = aod->GetHeader();
- header->SetRunNumber (fESD->GetRunNumber() );
- header->SetBunchCrossNumber(fESD->GetBunchCrossNumber());
- header->SetOrbitNumber (fESD->GetOrbitNumber() );
- header->SetPeriodNumber (fESD->GetPeriodNumber() );
- header->SetTriggerMask (fESD->GetTriggerMask() );
- header->SetTriggerCluster (fESD->GetTriggerCluster() );
- header->SetEventType (fESD->GetEventType() );
- header->SetMagneticField (fESD->GetMagneticField() );
- header->SetZDCN1Energy (fESD->GetZDCN1Energy() );
- header->SetZDCP1Energy (fESD->GetZDCP1Energy() );
- header->SetZDCN2Energy (fESD->GetZDCN2Energy() );
- header->SetZDCP2Energy (fESD->GetZDCP2Energy() );
- header->SetZDCEMEnergy (fESD->GetZDCEMEnergy() );
+ header->SetRunNumber (esd->GetRunNumber() );
+ header->SetBunchCrossNumber(esd->GetBunchCrossNumber());
+ header->SetOrbitNumber (esd->GetOrbitNumber() );
+ header->SetPeriodNumber (esd->GetPeriodNumber() );
+ header->SetTriggerMask (esd->GetTriggerMask() );
+ header->SetTriggerCluster (esd->GetTriggerCluster() );
+ header->SetEventType (esd->GetEventType() );
+ header->SetMagneticField (esd->GetMagneticField() );
+ header->SetZDCN1Energy (esd->GetZDCN1Energy() );
+ header->SetZDCP1Energy (esd->GetZDCP1Energy() );
+ header->SetZDCN2Energy (esd->GetZDCN2Energy() );
+ header->SetZDCP2Energy (esd->GetZDCP2Energy() );
+ header->SetZDCEMEnergy (esd->GetZDCEMEnergy() );
header->SetRefMultiplicity (nTracks);
header->SetRefMultiplicityPos(nPosTracks);
header->SetRefMultiplicityNeg(nTracks - nPosTracks);
Int_t id = cluster->GetID();
Int_t label = -1;
- Float_t energy = cluster->GetClusterEnergy();
- cluster->GetGlobalPosition(posF);
+ Float_t energy = cluster->E();
+ cluster->GetPosition(posF);
AliAODVertex *prodVertex = primary;
AliAODTrack *primTrack = NULL;
Char_t ttype=AliAODCluster::kUndef;
}
TNamed* AliReconstruction::CopyFileToTNamed(TString fPath,TString fName){
+ // Dump a file content into a char in TNamed
ifstream in;
in.open(fPath.Data(),ios::in | ios::binary|ios::ate);
Int_t kBytes = (Int_t)in.tellg();
}
void AliReconstruction::TNamedToFile(TTree* fTree, TString fName){
-
// This is not really needed in AliReconstruction at the moment
// but can serve as a template