#include <TArrayS.h>
#include <TArrayD.h>
#include <TObjArray.h>
+#include <TMap.h>
#include "AliReconstruction.h"
#include "AliCodeTimer.h"
#include "AliSysInfo.h" // memory snapshots
#include "AliRawHLTManager.h"
+#include "AliMagWrapCheb.h"
ClassImp(AliReconstruction)
const char* name, const char* title) :
TNamed(name, title),
- fUniformField(kTRUE),
+ fUniformField(kFALSE),
fRunVertexFinder(kTRUE),
fRunVertexFinderTracks(kTRUE),
fRunHLTTracking(kFALSE),
ftreeOld(NULL),
fhlttreeOld(NULL),
ftVertexer(NULL),
- fIsNewRunLoader(kFALSE)
+ fIsNewRunLoader(kFALSE),
+ fRunAliEVE(kFALSE)
{
// create reconstruction object with default parameters
ftreeOld(NULL),
fhlttreeOld(NULL),
ftVertexer(NULL),
- fIsNewRunLoader(rec.fIsNewRunLoader)
+ fIsNewRunLoader(rec.fIsNewRunLoader),
+ fRunAliEVE(kFALSE)
{
// copy constructor
AliCodeTimerAuto("");
if (!InitRun(input)) return kFALSE;
-
+
//******* The loop over events
Int_t iEvent = 0;
while ((iEvent < fRunLoader->GetNumberOfEvents()) ||
TString geom(gSystem->DirName(fGAliceFileName));
geom += "/geometry.root";
AliGeomManager::LoadGeometry(geom.Data());
+ if(!AliGeomManager::CheckSymNamesLUT())
+ AliFatalClass("Current loaded geometry differs in the definition of symbolic names!");
if (!gGeoManager) if (fStopOnError) return kFALSE;
}
if (!MisalignGeometry(fLoadAlignData)) if (fStopOnError) return kFALSE;
AliSysInfo::AddStamp("LoadGeom");
- //QA
- AliQADataMakerSteer qas ;
- if (fRunQA && fRawReader) {
- qas.Run(fRunLocalReconstruction, fRawReader) ;
- fSameQACycle = kTRUE ;
+
+ // Get the GRP CDB entry
+ AliCDBEntry* entryGRP = AliCDBManager::Instance()->Get("GRP/GRP/Data");
+
+ if (entryGRP)
+ fGRPData = dynamic_cast<TMap*>(entryGRP->GetObject());
+
+ if (!fGRPData) {
+ AliError("No GRP entry found in OCDB!");
+ return kFALSE;
}
- // checking the QA of previous steps
- //CheckQA() ;
-
- /*
- // local reconstruction
- if (!fRunLocalReconstruction.IsNull()) {
- if (!RunLocalReconstruction(fRunLocalReconstruction)) {
- if (fStopOnError) {CleanUp(); return kFALSE;}
+
+
+ // Magnetic field map
+ if (!AliTracker::GetFieldMap()) {
+ // Construct the field map out of the information retrieved from GRP.
+ //
+ // For the moment, this is a dummy piece of code.
+ // The actual map is expected to be already created in rec.C !
+ //
+
+ Float_t factor=1.;
+ Int_t map=AliMagWrapCheb::k5kG;
+ Bool_t dipoleON=kTRUE;
+
+ // L3
+ TObjString *l3Current=
+ dynamic_cast<TObjString*>(fGRPData->GetValue("fL3Current"));
+ if (!l3Current) {
+ AliError("GRP/GRP/Data entry: missing value for the L3 current !");
+ return kFALSE;
+ }
+ TObjString *l3Polarity=
+ dynamic_cast<TObjString*>(fGRPData->GetValue("fL3Polarity"));
+ if (!l3Polarity) {
+ AliError("GRP/GRP/Data entry: missing value for the L3 polarity !");
+ return kFALSE;
+ }
+
+ // Dipole
+ TObjString *diCurrent=
+ dynamic_cast<TObjString*>(fGRPData->GetValue("fDipoleCurrent"));
+ if (!diCurrent) {
+ AliError("GRP/GRP/Data entry: missing value for the dipole current !");
+ return kFALSE;
+ }
+ TObjString *diPolarity=
+ dynamic_cast<TObjString*>(fGRPData->GetValue("fDipolePolarity"));
+ if (!diPolarity) {
+ AliError("GRP/GRP/Data entry: missing value for the dipole polarity !");
+ return kFALSE;
}
+
+
+ AliMagF *field=
+ new AliMagWrapCheb("Maps","Maps",2,factor,10.,map,dipoleON);
+ AliTracker::SetFieldMap(field,fUniformField);
+
+ //Temporary measure
+ AliFatal("Please, provide the field map ! Crashing deliberately...");
+
+ }
+
+
+ // Get the diamond profile from OCDB
+ AliCDBEntry* entry = AliCDBManager::Instance()
+ ->Get("GRP/Calib/MeanVertex");
+
+ if(entry) {
+ fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject());
+ } else {
+ AliError("No diamond profile found in OCDB!");
}
- */
+
+ entry = 0;
+ entry = AliCDBManager::Instance()
+ ->Get("GRP/Calib/MeanVertexTPC");
+
+ if(entry) {
+ fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject());
+ } else {
+ AliError("No diamond profile found in OCDB!");
+ }
+
+ ftVertexer = new AliVertexerTracks(AliTracker::GetBz());
+ if(fDiamondProfile && fMeanVertexConstraint) ftVertexer->SetVtxStart(fDiamondProfile);
// get vertexer
if (fRunVertexFinder && !CreateVertexer()) {
fhltesd->CreateStdContent();
fhltesd->WriteToTree(fhlttree);
- /* CKB Why?
- delete esd; delete hltesd;
- esd = NULL; hltesd = NULL;
- */
- // create the branch with ESD additions
-
-
if (fWriteESDfriend) {
fesdf = new AliESDfriend();
fesd->AddObject(fesdf);
}
- // Get the GRP CDB entry
- AliCDBEntry* entryGRP = AliCDBManager::Instance()->Get("GRP/GRP/Data");
-
- if (entryGRP)
- fGRPData = dynamic_cast<TMap*> (entryGRP->GetObject());
-
- if (!fGRPData)
- AliError("No GRP entry found in OCDB!");
- // Get the diamond profile from OCDB
- AliCDBEntry* entry = AliCDBManager::Instance()
- ->Get("GRP/Calib/MeanVertex");
-
- if(entry) {
- fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject());
- } else {
- AliError("No diamond profile found in OCDB!");
- }
-
- entry = 0;
- entry = AliCDBManager::Instance()
- ->Get("GRP/Calib/MeanVertexTPC");
-
- if(entry) {
- fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject());
- } else {
- AliError("No diamond profile found in OCDB!");
- }
-
- ftVertexer = new AliVertexerTracks(AliTracker::GetBz());
- if(fDiamondProfile && fMeanVertexConstraint) ftVertexer->SetVtxStart(fDiamondProfile);
if (fRawReader) fRawReader->RewindEvents();
AliInfo(Form("Current memory usage %d %d", ProcInfo.fMemResident, ProcInfo.fMemVirtual));
+ //QA
+ AliQADataMakerSteer qas ;
+ if (fRunQA && fRawReader) {
+ qas.Run(fRunLocalReconstruction, fRawReader) ;
+ fSameQACycle = kTRUE ;
+ }
//Initialize the QA and start of cycle for out-of-cycle QA
if (fRunQA) {
- TString detStr(fFillESD);
- for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
- if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
- AliQADataMakerRec *qadm = GetQADataMaker(iDet);
- if (!qadm) continue;
- AliInfo(Form("Initializing the QA data maker for %s",
- fgkDetectorName[iDet]));
- qadm->Init(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun());
- qadm->Init(AliQA::kESDS, AliCDBManager::Instance()->GetRun());
- if (!fInLoopQA) {
- qadm->StartOfCycle(AliQA::kRECPOINTS, fSameQACycle);
- qadm->StartOfCycle(AliQA::kESDS,"same");
- }
- }
+// TString detStr(fFillESD);
+// for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
+// if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
+// AliQADataMakerRec *qadm = GetQADataMaker(iDet);
+// if (!qadm) continue;
+// AliInfo(Form("Initializing the QA data maker for %s",
+// fgkDetectorName[iDet]));
+// qadm->Init(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun());
+// qadm->Init(AliQA::kESDS, AliCDBManager::Instance()->GetRun());
+// if (!fInLoopQA) {
+// qadm->StartOfCycle(AliQA::kRECPOINTS, fSameQACycle);
+// qadm->StartOfCycle(AliQA::kESDS,"same");
+// }
+// }
if (fRunGlobalQA) {
AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL);
AliInfo(Form("Initializing the global QA data maker"));
if(fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;}
}
+ if (strcmp(gProgName,"alieve") == 0)
+ fRunAliEVE = InitAliEVE();
+
return kTRUE;
}
if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;}
}
detectors=fFillESD;
+ // Temporary fix to avoid problems with HLT that overwrites the offline ESDs
+ if (detectors.Contains("ALL")) {
+ detectors="";
+ for (Int_t idet=0; idet<fgkNDetectors; ++idet){
+ detectors += fgkDetectorName[idet];
+ detectors += " ";
+ }
+ }
detectors.ReplaceAll("HLT", "");
if (!FillESD(fesd, detectors)) {
if (fStopOnError) {CleanUp(ffile, ffileOld); return kFALSE;}
// write HLT ESD
fhlttree->Fill();
+ // call AliEVE
+ if (fRunAliEVE) RunAliEVE();
+
if (fCheckPointLevel > 0) WriteESD(fesd, "final");
fesd->Reset();
fhltesd->Reset();
AliQADataMakerSteer qas;
qas.Run(fRunLocalReconstruction.Data(), AliQA::kRECPOINTS, fSameQACycle);
//qas.Reset() ;
- qas.Run(fRunTracking.Data(), AliQA::kESDS, fSameQACycle);
+ qas.Run(fRunLocalReconstruction.Data(), AliQA::kESDS, fSameQACycle);
if (fRunGlobalQA) {
AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL);
if (qadm) {
CleanUp();
return kFALSE;
}
+
fRunLoader->CdGAFile();
- if (gFile->GetKey(AliRunLoader::GetGAliceName())) {
- if (fRunLoader->LoadgAlice() == 0) {
- gAlice = fRunLoader->GetAliRun();
- AliTracker::SetFieldMap(gAlice->Field(),fUniformField);
- }
- }
- if (!gAlice && !fRawReader) {
- AliError(Form("no gAlice object found in file %s",
- fGAliceFileName.Data()));
- CleanUp();
- return kFALSE;
- }
+ fRunLoader->LoadgAlice();
//PH This is a temporary fix to give access to the kinematics
//PH that is needed for the labels of ITS clusters
}
-TNamed* AliReconstruction::CopyFileToTNamed(TString fPath,TString fName){
+TNamed* AliReconstruction::CopyFileToTNamed(TString fPath,TString pName){
// Dump a file content into a char in TNamed
ifstream in;
in.open(fPath.Data(),ios::in | ios::binary|ios::ate);
in.read (memblock, kBytes);
in.close();
TString fData(memblock,kBytes);
- fn = new TNamed(fName,fData);
+ fn = new TNamed(pName,fData);
printf("fData Size: %d \n",fData.Sizeof());
- printf("fName Size: %d \n",fName.Sizeof());
+ printf("pName Size: %d \n",pName.Sizeof());
printf("fn Size: %d \n",fn->Sizeof());
delete[] memblock;
}
return fn;
}
-void AliReconstruction::TNamedToFile(TTree* fTree, TString fName){
+void AliReconstruction::TNamedToFile(TTree* fTree, TString pName){
// This is not really needed in AliReconstruction at the moment
// but can serve as a template
TList *fList = fTree->GetUserInfo();
- TNamed *fn = (TNamed*)fList->FindObject(fName.Data());
+ TNamed *fn = (TNamed*)fList->FindObject(pName.Data());
printf("fn Size: %d \n",fn->Sizeof());
- TString fTmp(fn->GetName()); // to be 100% sure in principle fName also works
+ TString fTmp(fn->GetName()); // to be 100% sure in principle pName also works
const char* cdata = fn->GetTitle();
printf("fTmp Size %d\n",fTmp.Sizeof());
int size = fn->Sizeof()-fTmp.Sizeof()-sizeof(UChar_t)-sizeof(Int_t); // see dfinition of TString::SizeOf()...
printf("calculated size %d\n",size);
- ofstream out(fName.Data(),ios::out | ios::binary);
+ ofstream out(pName.Data(),ios::out | ios::binary);
out.write(cdata,size);
out.close();
AliWarning(Form("Implementation of this method not yet done !! Method return kTRUE"));
return kTRUE;
}
+
+//_____________________________________________________________________________
+Bool_t AliReconstruction::InitAliEVE()
+{
+ // This method should be called only in case
+ // AliReconstruction is run
+ // within the alieve environment.
+ // It will initialize AliEVE in a way
+ // so that it can visualize event processed
+ // by AliReconstruction.
+ // The return flag shows whenever the
+ // AliEVE initialization was successful or not.
+
+ TString macroStr;
+ macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT"));
+ AliInfo(Form("Loading AliEVE macro: %s",macroStr.Data()));
+ if (gROOT->LoadMacro(macroStr.Data()) != 0) return kFALSE;
+
+ gROOT->ProcessLine("if (!gAliEveEvent) {gAliEveEvent = new AliEveEventManager();gAliEveEvent->SetAutoLoad(kTRUE);gAliEveEvent->AddNewEventCommand(\"alieve_online_on_new_event()\");gEve->AddEvent(gAliEveEvent);};");
+ gROOT->ProcessLine("alieve_online_init()");
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliReconstruction::RunAliEVE()
+{
+ // Runs AliEVE visualisation of
+ // the current event.
+ // Should be executed only after
+ // successful initialization of AliEVE.
+
+ AliInfo("Running AliEVE...");
+ gROOT->ProcessLine(Form("gAliEveEvent->SetEvent((AliRunLoader*)%p,(AliRawReader*)%p,(AliESDEvent*)%p);",fRunLoader,fRawReader,fesd));
+ gROOT->ProcessLine("gAliEveEvent->StartStopAutoLoadTimer();");
+ gSystem->Run();
+}