X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVE%2FEveBase%2FAliEveEventManager.cxx;h=d93f104524df296d40037bbac7a7e69d41e5a919;hb=97d1753003409fa2952f9a89a10f3e2a3c32f311;hp=4d38ed381df0613f0747874c224596b3769e7ace;hpb=ea8fceefe5a73a1a1fe3836b6edbd3ff8e9f0574;p=u%2Fmrichter%2FAliRoot.git diff --git a/EVE/EveBase/AliEveEventManager.cxx b/EVE/EveBase/AliEveEventManager.cxx index 4d38ed381df..d93f104524d 100644 --- a/EVE/EveBase/AliEveEventManager.cxx +++ b/EVE/EveBase/AliEveEventManager.cxx @@ -10,10 +10,13 @@ #include "AliEveEventManager.h" #include "AliEveEventSelector.h" #include "AliEveMacroExecutor.h" + +#include #include #include #include +#include #include #include #include @@ -21,6 +24,14 @@ #include #include +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -95,6 +106,7 @@ Bool_t AliEveEventManager::fgRawFromStandardLoc = kFALSE; Bool_t AliEveEventManager::fgGRPLoaded = kFALSE; AliMagF* AliEveEventManager::fgMagField = 0; +AliRecoParam* AliEveEventManager::fgRecoParam = 0; Bool_t AliEveEventManager::fgUniformField = kFALSE; AliEveEventManager* AliEveEventManager::fgMaster = 0; @@ -120,6 +132,7 @@ void AliEveEventManager::InitInternals() fAutoLoadTimer = new TTimer; fAutoLoadTimer->Connect("Timeout()", "AliEveEventManager", this, "AutoLoadNextEvent()"); + fAutoLoadTimer->Connect("Timeout()", "AliEveEventManager", this, "Timeout()"); fExecutor = new AliEveMacroExecutor; @@ -144,7 +157,7 @@ AliEveEventManager::AliEveEventManager(const TString& name) : fESDFile (0), fESDTree (0), fESD (0), fESDfriend (0), fESDfriendExists(kFALSE), fAODFile (0), fAODTree (0), fAOD (0), - fRawReader (0), + fRawReader (0), fEventInfo(), fAutoLoad (kFALSE), fAutoLoadTime (5.), fAutoLoadTimer(0), fIsOpen (kFALSE), fHasEvent (kFALSE), fExternalCtrl (kFALSE), fGlobal (0), fGlobalReplace (kTRUE), fGlobalUpdate (kTRUE), @@ -166,7 +179,7 @@ AliEveEventManager::AliEveEventManager(const TString& name, const TString& path, fESDFile (0), fESDTree (0), fESD (0), fESDfriend (0), fESDfriendExists(kFALSE), fAODFile (0), fAODTree (0), fAOD (0), - fRawReader (0), + fRawReader (0), fEventInfo(), fAutoLoad (kFALSE), fAutoLoadTime (5), fAutoLoadTimer(0), fIsOpen (kFALSE), fHasEvent (kFALSE), fExternalCtrl (kFALSE), fGlobal (0), fGlobalReplace (kTRUE), fGlobalUpdate (kTRUE), @@ -189,6 +202,8 @@ AliEveEventManager::AliEveEventManager(const TString& name, const TString& path, AliEveEventManager::~AliEveEventManager() { // Destructor. + fAutoLoadTimer->Stop(); + fAutoLoadTimer->Disconnect("Timeout"); delete fSubManagers; @@ -202,6 +217,8 @@ AliEveEventManager::~AliEveEventManager() fTransientLists->DecDenyDestroy(); fTransientLists->Destroy(); + + //delete fExecutor; } /******************************************************************************/ @@ -738,6 +755,8 @@ void AliEveEventManager::GotoEvent(Int_t event) throw (kEH + "Event-files not opened."); } + fEventInfo.Reset(); + fHasEvent = kFALSE; Int_t maxEvent = 0; @@ -870,6 +889,11 @@ void AliEveEventManager::GotoEvent(Int_t event) AliSysInfo::AddStamp(sysInfoHeader + "PostUserActions"); } +void AliEveEventManager::Timeout() +{ + Emit("Timeout()"); +} + void AliEveEventManager::NextEvent() { // Loads next event. @@ -887,8 +911,8 @@ void AliEveEventManager::NextEvent() // !!! This should really go somewhere else. It is done in GotoEvent(), // so here we should do it in SetEvent(). DestroyElements(); + gSystem->ExitLoop(); - gSystem->ExitLoop(); } else if (fESDTree) { @@ -897,7 +921,7 @@ void AliEveEventManager::NextEvent() { GotoEvent(nextevent); } - } + } else if (fEventId < GetMaxEventId(kTRUE)) { GotoEvent(fEventId + 1); @@ -907,7 +931,7 @@ void AliEveEventManager::NextEvent() void AliEveEventManager::PrevEvent() { // Loads previous event. - + static const TEveException kEH("AliEveEventManager::PrevEvent "); if (fAutoLoadTimerRunning) @@ -1177,6 +1201,111 @@ TGeoManager* AliEveEventManager::AssertGeometry() return gGeoManager; } +AliRecoParam* AliEveEventManager::AssertRecoParams() +{ + if(!fgRecoParam) + InitRecoParam(); + + return fgRecoParam; +} + +Bool_t AliEveEventManager::InitRecoParam() +{ +// This is mostly a reap-off from reconstruction +// The method accesses OCDB and retrieves all +// the available reco-param objects from there. + + fgRecoParam = new AliRecoParam; + const Int_t kNDetectors = 14; + + static const TEveException kEH("AliEveEventManager::InitRecoParam "); + + Bool_t isOK = kTRUE; + + if (fgRecoParam->GetDetRecoParamArray(kNDetectors)) { + ::Info(kEH, "Using custom GRP reconstruction parameters"); + } + else { + ::Info(kEH, "Loading GRP reconstruction parameter objects"); + + AliCDBPath path("GRP","Calib","RecoParam"); + AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); + if(!entry){ + ::Warning(kEH, "Couldn't find GRP RecoParam entry in OCDB"); + isOK = kFALSE; + } + else { + TObject *recoParamObj = entry->GetObject(); + if (dynamic_cast(recoParamObj)) { + // GRP has a normal TobjArray of AliDetectorRecoParam objects + // Registering them in AliRecoParam + fgRecoParam->AddDetRecoParamArray(kNDetectors,dynamic_cast(recoParamObj)); + } + else if (dynamic_cast(recoParamObj)) { + // GRP has only onse set of reco parameters + // Registering it in AliRecoParam + ::Info(kEH, "Single set of GRP reconstruction parameters found"); + dynamic_cast(recoParamObj)->SetAsDefault(); + fgRecoParam->AddDetRecoParam(kNDetectors,dynamic_cast(recoParamObj)); + } + else { + ::Error(kEH, "No valid GRP RecoParam object found in the OCDB"); + isOK = kFALSE; + } + entry->SetOwner(0); + } + } + + const char* fgkDetectorName[kNDetectors] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE" }; + + + for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { + + if (fgRecoParam->GetDetRecoParamArray(iDet)) { + ::Info(kEH, Form("Using custom reconstruction parameters for detector %s",fgkDetectorName[iDet])); + continue; + } + + ::Info(kEH, Form("Loading reconstruction parameter objects for detector %s",fgkDetectorName[iDet])); + + AliCDBPath path(fgkDetectorName[iDet],"Calib","RecoParam"); + AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); + if(!entry){ + ::Warning(kEH, Form("Couldn't find RecoParam entry in OCDB for detector %s",fgkDetectorName[iDet])); + isOK = kFALSE; + } + else { + TObject *recoParamObj = entry->GetObject(); + if (dynamic_cast(recoParamObj)) { + // The detector has a normal TobjArray of AliDetectorRecoParam objects + // Registering them in AliRecoParam + fgRecoParam->AddDetRecoParamArray(iDet,dynamic_cast(recoParamObj)); + } + else if (dynamic_cast(recoParamObj)) { + // The detector has only onse set of reco parameters + // Registering it in AliRecoParam + ::Info(kEH, Form("Single set of reconstruction parameters found for detector %s",fgkDetectorName[iDet])); + dynamic_cast(recoParamObj)->SetAsDefault(); + fgRecoParam->AddDetRecoParam(iDet,dynamic_cast(recoParamObj)); + } + else { + ::Error(kEH, Form("No valid RecoParam object found in the OCDB for detector %s",fgkDetectorName[iDet])); + isOK = kFALSE; + } + entry->SetOwner(0); + + } + } + + if(!isOK) { + delete fgRecoParam; + fgRecoParam = 0; + } + + return isOK; +} + + //------------------------------------------------------------------------------ AliEveEventManager* AliEveEventManager::AddDependentManager(const TString& name, const TString& path) @@ -1404,6 +1533,122 @@ void AliEveEventManager::NewEventLoaded() // Event info dumpers //------------------------------------------------------------------------------ +const AliEventInfo* AliEveEventManager::GetEventInfo() +{ + // Fill the event info object + + AliCentralTrigger *aCTP = NULL; + if (fRawReader) { + fEventInfo.SetEventType(fRawReader->GetType()); + + ULong64_t mask = fRawReader->GetClassMask(); + fEventInfo.SetTriggerMask(mask); + UInt_t clmask = fRawReader->GetDetectorPattern()[0]; + fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(clmask)); + + aCTP = new AliCentralTrigger(); + TString configstr(""); + if (!aCTP->LoadConfiguration(configstr)) { // Load CTP config from OCDB + AliError("No trigger configuration found in OCDB! The trigger configuration information will not be used!"); + delete aCTP; + return 0; + } + aCTP->SetClassMask(mask); + aCTP->SetClusterMask(clmask); + + if (fRunLoader) { + AliCentralTrigger* rlCTP = fRunLoader->GetTrigger(); + if (rlCTP) { + rlCTP->SetClassMask(mask); + rlCTP->SetClusterMask(clmask); + } + } + } + else { + fEventInfo.SetEventType(AliRawEventHeaderBase::kPhysicsEvent); + + if (fRunLoader && (!fRunLoader->LoadTrigger())) { + aCTP = fRunLoader->GetTrigger(); + fEventInfo.SetTriggerMask(aCTP->GetClassMask()); + // get inputs from actp - just get + AliESDHeader* esdheader = fESD->GetHeader(); + esdheader->SetL0TriggerInputs(aCTP->GetL0TriggerInputs()); + esdheader->SetL1TriggerInputs(aCTP->GetL1TriggerInputs()); + esdheader->SetL2TriggerInputs(aCTP->GetL2TriggerInputs()); + fEventInfo.SetTriggerCluster(AliDAQ::ListOfTriggeredDetectors(aCTP->GetClusterMask())); + } + else { + AliWarning("No trigger can be loaded! The trigger information will not be used!"); + return 0; + } + } + + AliTriggerConfiguration *config = aCTP->GetConfiguration(); + if (!config) { + AliError("No trigger configuration has been found! The trigger configuration information will not be used!"); + if (fRawReader) delete aCTP; + return 0; + } + + TString declTriggerClasses; + + // Load trigger aliases and declare the trigger classes included in aliases + AliCDBEntry * entry = AliCDBManager::Instance()->Get("GRP/CTP/Aliases"); + if (entry) { + THashList * lst = dynamic_cast(entry->GetObject()); + if (lst) { + lst->Sort(kSortDescending); // to avoid problems with substrings + if (fRawReader) fRawReader->LoadTriggerAlias(lst); + // Now declare all the triggers present in the aliases + TIter iter(lst); + TNamed *nmd = 0; + while((nmd = dynamic_cast(iter.Next()))){ + declTriggerClasses += " "; + declTriggerClasses += nmd->GetName(); + } + } + else { + AliError("Cannot cast the object with trigger aliases to THashList!"); + } + } + else { + AliError("No OCDB entry for the trigger aliases!"); + } + + // Load trigger classes for this run + UChar_t clustmask = 0; + TString trclasses; + ULong64_t trmask = fEventInfo.GetTriggerMask(); + const TObjArray& classesArray = config->GetClasses(); + Int_t nclasses = classesArray.GetEntriesFast(); + for( Int_t iclass=0; iclass < nclasses; iclass++ ) { + AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass); + if (trclass && trclass->GetMask()>0) { + Int_t trindex = TMath::Nint(TMath::Log2(trclass->GetMask())); + if (fESD) fESD->SetTriggerClass(trclass->GetName(),trindex); + if (fRawReader) fRawReader->LoadTriggerClass(trclass->GetName(),trindex); + if (trmask & (1ull << trindex)) { + trclasses += " "; + trclasses += trclass->GetName(); + trclasses += " "; + clustmask |= trclass->GetCluster()->GetClusterMask(); + } + } + } + fEventInfo.SetTriggerClasses(trclasses); + + if (!aCTP->CheckTriggeredDetectors()) { + if (fRawReader) delete aCTP; + return 0; + } + + if (fRawReader) delete aCTP; + +// everything went ok, return pointer + return (&fEventInfo); +} + + TString AliEveEventManager::GetEventInfoHorizontal() const { // Dumps the event-header contents in vertical formatting. @@ -1567,6 +1812,7 @@ Bool_t AliEveEventManager::InsertGlobal(const TString& tag, TEveElement* model, model->SetRnrChildren(kFALSE); TEveElement* old_model = dynamic_cast(pair->Value()); + if(!old_model) AliFatal("old_model == 0, dynamic cast failed\n"); while (old_model->HasChildren()) { TEveElement *el = old_model->FirstChild();