#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"
#include "AliRawReaderDate.h"
#include "AliRawReaderRoot.h"
#include "AliRawEventHeaderBase.h"
-#include "AliESD.h"
+#include "AliESDEvent.h"
#include "AliESDfriend.h"
#include "AliESDVertex.h"
#include "AliMultiplicity.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();
+ AliESDEvent* esd = new AliESDEvent(); AliESDEvent* hltesd = new AliESDEvent();
TFile* fileOld = NULL;
TTree* treeOld = NULL; TTree *hlttreeOld = NULL;
if (!gSystem->AccessPathName("AliESDs.root")){
}
TTree* tree = new TTree("esdTree", "Tree with ESD objects");
- esd = new AliESD();
+ esd = new AliESDEvent();
esd->CreateStdContent();
esd->WriteToTree(tree);
TTree* hlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects");
- hltesd = new AliESD();
+ hltesd = new AliESDEvent();
hltesd->CreateStdContent();
hltesd->WriteToTree(hlttree);
esd = NULL; hltesd = NULL;
*/
// create the branch with ESD additions
+
+
+
AliESDfriend *esdf = 0;
if (fWriteESDfriend) {
esdf = new AliESDfriend();
br->SetFile("AliESDfriends.root");
esd->AddObject(esdf);
}
+
// Get the diamond profile from OCDB
AliCDBEntry* entry = AliCDBManager::Instance()
// Muon tracking
if (!fRunTracking.IsNull()) {
if (fRunMuonTracking) {
- if (!RunMuonTracking()) {
+ if (!RunMuonTracking(esd)) {
if (fStopOnError) {CleanUp(file, fileOld); return kFALSE;}
}
}
if (fCheckPointLevel > 0) WriteESD(esd, "final");
esd->Reset();
hltesd->Reset();
+ if (fWriteESDfriend) {
+ new (esdf) AliESDfriend(); // Reset...
+ }
// esdf->Reset();
// delete esdf; esdf = 0;
}
+
+
tree->GetUserInfo()->Add(esd);
hlttree->GetUserInfo()->Add(hltesd);
}
- AliInfo(Form("Execution time for filling ESD : R:%.2fs C:%.2fs",
- stopwatch.RealTime(),stopwatch.CpuTime()));
-
file->cd();
if (fWriteESDfriend)
tree->SetBranchStatus("ESDfriend*",0);
}
gROOT->cd();
+ CleanUp(file, fileOld);
+
// Create tags for the events in the ESD tree (the ESD tree is always present)
// In case of empty events the tags will contain dummy values
- CreateTag(file);
+ CreateTag("AliESDs.root");
- CleanUp(file, fileOld);
return kTRUE;
}
{
// 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;
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::RunVertexFinder(AliESD*& esd)
+Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd)
{
// 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;
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::RunHLTTracking(AliESD*& esd)
+Bool_t AliReconstruction::RunHLTTracking(AliESDEvent*& esd)
{
// 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(AliESDEvent*& 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;
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::RunTracking(AliESD*& esd)
+Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd)
{
// 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;
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::FillESD(AliESD*& esd, const TString& detectors)
+Bool_t AliReconstruction::FillESD(AliESDEvent*& esd, const TString& detectors)
{
// 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;
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::FillTriggerESD(AliESD*& esd)
+Bool_t AliReconstruction::FillTriggerESD(AliESDEvent*& esd)
{
// Reads the trigger decision which is
// stored in Trigger.root file and fills
// the corresponding esd entries
+ AliCodeTimerAuto("")
+
AliInfo("Filling trigger information into the ESD");
if (fRawReader) {
//_____________________________________________________________________________
-Bool_t AliReconstruction::FillRawEventHeaderESD(AliESD*& esd)
+Bool_t AliReconstruction::FillRawEventHeaderESD(AliESDEvent*& esd)
{
//
// Filling information from RawReader Header
//_____________________________________________________________________________
-Bool_t AliReconstruction::ReadESD(AliESD*& esd, const char* recStep) const
+
+Bool_t AliReconstruction::ReadESD(AliESDEvent*& esd, const char* recStep) const
{
// read the ESD event from a file
gROOT->cd();
delete esd;
- esd = (AliESD*) file->Get("ESD");
+ esd = (AliESDEvent*) file->Get("ESD");
file->Close();
delete file;
return kTRUE;
+
}
+
+
//_____________________________________________________________________________
-void AliReconstruction::WriteESD(AliESD* esd, const char* recStep) const
+void AliReconstruction::WriteESD(AliESDEvent* esd, const char* recStep) const
{
// write the ESD event to a file
//_____________________________________________________________________________
-void AliReconstruction::CreateTag(TFile* file)
+void AliReconstruction::CreateTag(const char* fESDfilename)
{
//GRP
Float_t lhcLuminosity = 0.0;
btag->SetCompressionLevel(9);
AliInfo(Form("Creating the tags......."));
-
+
+ TFile *file = TFile::Open(fESDfilename);
if (!file || !file->IsOpen()) {
AliError(Form("opening failed"));
delete file;
}
Int_t lastEvent = 0;
TTree *b = (TTree*) file->Get("esdTree");
- AliESD *esd = new AliESD();
+ AliESDEvent *esd = new AliESDEvent();
esd->ReadFromTree(b);
b->GetEntry(fFirstEvent);
// connect to ESD
TTree *t = (TTree*) esdFile->Get("esdTree");
- TBranch *b = t->GetBranch("ESD");
- AliESD *esd = 0;
- b->SetAddress(&esd);
+ AliESDEvent *esd = new AliESDEvent();
+ 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;
return;
}
-void AliReconstruction::WriteAlignmentData(AliESD* esd)
+void AliReconstruction::WriteAlignmentData(AliESDEvent* esd)
{
// Write space-points which are then used in the alignment procedures
// For the moment only ITS, TRD and TPC
}
//_____________________________________________________________________________
-void AliReconstruction::FillRawDataErrorLog(Int_t iEvent, AliESD* esd)
+void AliReconstruction::FillRawDataErrorLog(Int_t iEvent, AliESDEvent* esd)
{
// The method reads the raw-data error log
// accumulated within the rawReader.
}
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