+
+
+//==============================================================================
+// Reading of GRP and MagneticField.
+// This is a reap-off from reconstruction ... should really be a common
+// code to do this somewhere in STEER.
+//==============================================================================
+
+Bool_t AliEveEventManager::InitGRP()
+{
+ //------------------------------------
+ // Initialization of the GRP entry
+ //------------------------------------
+
+ static const TEveException kEH("AliEveEventManager::InitGRP ");
+
+ AliGRPManager grpMgr;
+ if (!grpMgr.ReadGRPEntry()) {
+ return kFALSE;
+ }
+ fgGRPLoaded = kTRUE;
+ if (!grpMgr.SetMagField()) {
+ throw kEH + "Setting of field failed!";
+ }
+
+ //*** Get the diamond profiles from OCDB
+ // Eventually useful.
+
+ /*
+ entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexSPD");
+ if (entry) {
+ fDiamondProfileSPD = dynamic_cast<AliESDVertex*> (entry->GetObject());
+ } else {
+ ::Error(kEH, "No SPD diamond profile found in OCDB!");
+ }
+
+ entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertex");
+ if (entry) {
+ fDiamondProfile = dynamic_cast<AliESDVertex*> (entry->GetObject());
+ } else {
+ ::Error(kEH, "No diamond profile found in OCDB!");
+ }
+
+ entry = AliCDBManager::Instance()->Get("GRP/Calib/MeanVertexTPC");
+ if (entry) {
+ fDiamondProfileTPC = dynamic_cast<AliESDVertex*> (entry->GetObject());
+ } else {
+ ::Error(kEH, "No TPC diamond profile found in OCDB!");
+ }
+ */
+
+ return kTRUE;
+}
+
+//------------------------------------
+// Global variables management
+//------------------------------------
+
+Bool_t AliEveEventManager::InsertGlobal(const TString& tag, TEveElement* model)
+{
+ // Insert a new visualization-parameter database entry with the default
+ return InsertGlobal(tag, model, fGlobalReplace, fGlobalUpdate);
+}
+
+Bool_t AliEveEventManager::InsertGlobal(const TString& tag, TEveElement* model,
+ Bool_t replace, Bool_t update)
+{
+ TPair* pair = (TPair*) fGlobal->FindObject(tag);
+ if (pair)
+ {
+ if (replace)
+ {
+ model->IncDenyDestroy();
+ model->SetRnrChildren(kFALSE);
+
+ TEveElement* old_model = dynamic_cast<TEveElement*>(pair->Value());
+ while (old_model->HasChildren())
+ {
+ TEveElement *el = old_model->FirstChild();
+ el->SetVizModel(model);
+ if (update)
+ {
+ el->CopyVizParams(model);
+ el->PropagateVizParamsToProjecteds();
+ }
+ }
+ old_model->DecDenyDestroy();
+
+ pair->SetValue(dynamic_cast<TObject*>(model));
+ return kTRUE;
+ }
+ else
+ {
+ return kFALSE;
+ }
+ }
+ else
+ {
+ model->IncDenyDestroy();
+ model->SetRnrChildren(kFALSE);
+ fGlobal->Add(new TObjString(tag), dynamic_cast<TObject*>(model));
+ return kTRUE;
+ }
+}
+
+TEveElement* AliEveEventManager::FindGlobal(const TString& tag)
+{
+ return dynamic_cast<TEveElement*>(fGlobal->GetValue(tag));
+}