#include "AliEveEventManager.h"
#include "AliEveEventSelector.h"
#include "AliEveMacroExecutor.h"
+
+#include <THashList.h>
#include <TEveElement.h>
#include <TEveManager.h>
#include <TEveViewer.h>
+#include <AliLog.h>
#include <AliRunLoader.h>
#include <AliRun.h>
#include <AliESDRun.h>
#include <AliESDfriend.h>
#include <AliAODEvent.h>
+#include <AliRecoParam.h>
+#include <AliCentralTrigger.h>
+#include <AliCDBEntry.h>
+#include <AliTriggerClass.h>
+#include <AliTriggerConfiguration.h>
+#include <AliTriggerCluster.h>
+#include <AliDetectorRecoParam.h>
+
#include <AliDAQ.h>
#include <AliRawEventHeaderBase.h>
#include <AliRawReaderRoot.h>
Bool_t AliEveEventManager::fgGRPLoaded = kFALSE;
AliMagF* AliEveEventManager::fgMagField = 0;
+AliRecoParam* AliEveEventManager::fgRecoParam = 0;
Bool_t AliEveEventManager::fgUniformField = kFALSE;
AliEveEventManager* AliEveEventManager::fgMaster = 0;
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),
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),
throw (kEH + "Event-files not opened.");
}
+ fEventInfo.Reset();
+
fHasEvent = kFALSE;
Int_t maxEvent = 0;
// !!! This should really go somewhere else. It is done in GotoEvent(),
// so here we should do it in SetEvent().
DestroyElements();
- gSystem->ExitLoop();
+
}
else if (fESDTree)
{
GotoEvent(nextevent);
}
- }
+ }
else if (fEventId < GetMaxEventId(kTRUE))
{
GotoEvent(fEventId + 1);
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<TObjArray*>(recoParamObj)) {
+ // GRP has a normal TobjArray of AliDetectorRecoParam objects
+ // Registering them in AliRecoParam
+ fgRecoParam->AddDetRecoParamArray(kNDetectors,dynamic_cast<TObjArray*>(recoParamObj));
+ }
+ else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) {
+ // GRP has only onse set of reco parameters
+ // Registering it in AliRecoParam
+ ::Info(kEH, "Single set of GRP reconstruction parameters found");
+ dynamic_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault();
+ fgRecoParam->AddDetRecoParam(kNDetectors,dynamic_cast<AliDetectorRecoParam*>(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<TObjArray*>(recoParamObj)) {
+ // The detector has a normal TobjArray of AliDetectorRecoParam objects
+ // Registering them in AliRecoParam
+ fgRecoParam->AddDetRecoParamArray(iDet,dynamic_cast<TObjArray*>(recoParamObj));
+ }
+ else if (dynamic_cast<AliDetectorRecoParam*>(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<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault();
+ fgRecoParam->AddDetRecoParam(iDet,dynamic_cast<AliDetectorRecoParam*>(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)
// 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<THashList*>(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<TNamed*>(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.
#include <TQObject.h>
#include <TObjArray.h>
+#include <AliEventInfo.h>
+
class AliEveMacroExecutor;
class AliEveEventSelector;
class AliRawReader;
class AliGRPObject;
+class AliRecoParam;
class AliMagF;
class TEveElement;
AliEveEventSelector* GetEventSelector() const { return fPEventSelector; }
TString GetEventInfoHorizontal() const;
TString GetEventInfoVertical() const;
+ const AliEventInfo* GetEventInfo();
static Int_t CurrentEventId();
static AliMagF* AssertMagField();
static TGeoManager* AssertGeometry();
+ static AliRecoParam* AssertRecoParams();
static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
static AliEveEventManager* GetDependentManager(const TString& name);
AliAODEvent *fAOD; // AODEvent object.
AliRawReader *fRawReader; // Raw-data reader.
-
+ AliEventInfo fEventInfo; // Current Event Info
+
Bool_t fAutoLoad; // Automatic loading of events (online)
Float_t fAutoLoadTime; // Auto-load time in seconds
TTimer *fAutoLoadTimer; // Timer for automatic event loading
static Bool_t fgGRPLoaded; // Global run parameters loaded?
static AliMagF *fgMagField; // Global pointer to magnetic field.
+ static AliRecoParam* fgRecoParam;
static Bool_t fgUniformField; // Track with uniform field.
private:
void StopAutoLoadTimer();
static Bool_t InitGRP();
+ static Bool_t InitRecoParam();
Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
#if !defined(__CINT__) || defined(__MAKECINT__)
#include <TEveElement.h>
-#include <TROOT.h>
-#include <TFile.h>
-#include <TCanvas.h>
-#include <TH2F.h>
#include <AliEveEventManager.h>
#include <AliEveLego.h>
**************************************************************************/
#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <iostream>
+
+#include <TGeoGlobalMagField.h>
+#include <TGeoManager.h>
+#include <TMap.h>
+#include <TString.h>
+#include <TSystem.h>
#include <TStyle.h>
#include <TTree.h>
+#include <TRegexp.h>
#include <TEveManager.h>
#include <TEveElement.h>
#include <TEvePointSet.h>
#include <TEveTreeTools.h>
-#include <AliRawReader.h>
#include <AliAltroRawStreamV3.h>
-#include <AliTPCRawStreamV3.h>
#include <AliEveEventManager.h>
#include <AliEveTPCData.h>
#include <AliEveTPCSector2D.h>
#include <AliEveTPCSector3D.h>
+#include <AliGeomManager.h>
+#include <AliMagF.h>
+#include <AliRawReader.h>
+
+#include <AliGRPObject.h>
+#include <AliCDBManager.h>
+#include <AliCDBPath.h>
+#include <AliCDBEntry.h>
+
+#include <STEER/STEER/AliGRPManager.h>
+
+#include <TPC/AliTPCcalibDB.h>
+#include <TPC/AliTPCTransform.h>
+#include <TPC/AliTPCclusterMI.h>
+#include <TPC/AliTPCClustersRow.h>
+
+#include <TPC/AliTPCParam.h>
+#include <TPC/AliTPCRawStreamV3.h>
+#include <TPC/AliTPCRecoParam.h>
+#include <TPC/AliTPCReconstructor.h>
+
+#include <HLT/BASE/AliHLTOUT.h>
+#include <HLT/BASE/AliHLTSystem.h>
+#include <HLT/BASE/AliHLTPluginBase.h>
+
+#include <RAW/AliRawHLTManager.h>
#endif
+// read TPC clusters compressed by HLT from RawReader and return output in OutputTree
+TTree* readHLTClusters(AliRawReader *RawReader);
+
+// add the HLT clusters from clustersTree to visualization
+void renderHLTClusters(TTree* clustersTree);
+
+
// Macro to visualise rootified raw-data from TPC.
//
// Use tpc_raw(Int_t mode) in order to run it
// mode = 1 - show only 2D sectors
// mode = 2 - show only 3D sectors
// mode = 3 - show both 2D and 3D sectors
-
void tpc_raw(Int_t mode = 3)
{
gStyle->SetPalette(1, 0);
+ AliEveEventManager::AssertGeometry();
+ AliEveEventManager::AssertMagField();
+
AliRawReader *reader = AliEveEventManager::AssertRawReader();
reader->Reset();
+
AliTPCRawStreamV3 input(reader);
reader->Select("TPC"); // ("TPC", firstRCU, lastRCU);
t->IncRTS();
}
}
-
+
+ // Display TPC clusters compressed by HLT
+ TTree* hltClustersTree = readHLTClusters(reader); // read HLT compressed clusters from TPC from raw reader and output them in hltClustersTree
+ if(hltClustersTree) renderHLTClusters(hltClustersTree);
+
gEve->EnableRedraw();
+ gEve->Redraw3D();
+
+}
+
+// read TPC Clusters compressed by HLT from a raw filename
+TTree* readHLTClusters(AliRawReader *fRawReader)
+{
+/*************************
+* Raw IO Stuff
+**************************/
+ AliRawReader* rawReader = AliRawHLTManager::CreateRawReaderHLT(fRawReader, "TPC");
+ rawReader->Select("TPC");
+
+/*************************
+* HLT IO Stuff
+**************************/
+ AliHLTSystem* hltSystem=AliHLTPluginBase::GetInstance();
+
+ AliHLTOUT* hltOut = AliHLTOUT::New(rawReader);
+ hltOut->Init();
+ hltSystem->InitHLTOUT(hltOut);
+
+/*************************
+* GRP Stuff
+**************************/
+ AliGRPManager manGRP;
+ AliRecoParam* recoParam = AliEveEventManager::AssertRecoParams();
+
+ AliEveEventManager* curEventMan = (AliEveEventManager*)gEve->GetCurrentEvent();
+
+ const AliRunInfo* runInfo = manGRP.GetRunInfo();
+ const THashTable* cosmicTriggers = manGRP.GetCosmicTriggers();
+ const AliEventInfo* eventinfo = curEventMan->GetEventInfo();
+
+ recoParam->SetEventSpecie(runInfo,*eventinfo,cosmicTriggers);
+
+ AliTPCRecoParam *tpcRecoParam = (AliTPCRecoParam*)recoParam->GetDetRecoParam(1); // TPC has index 1
+ tpcRecoParam->SetUseHLTClusters(3); // reconstruct only HLT clusters
+
+/**************************
+* Reconstruction of Clusters
+**************************/
+ TTree* outputClustersTree = new TTree;
+
+ AliTPCReconstructor *reconstructor = new AliTPCReconstructor();
+ reconstructor->SetOption("useHLT");
+ reconstructor->CreateTracker(); // this will set the option to reconstruct for only HLT clusters
+
+ reconstructor->SetRecoParam(tpcRecoParam);
+ reconstructor->SetRunInfo((AliRunInfo*)runInfo);
+ reconstructor->SetEventInfo((AliEventInfo*)eventinfo);
+
+ reconstructor->Reconstruct(rawReader, outputClustersTree);
+
+ delete reconstructor;
+
+ hltSystem->ReleaseHLTOUT(hltOut);
+
+ return outputClustersTree;
+}
+
+void renderHLTClusters(TTree* clustersTree)
+{
+
+/**************************
+* Visualization of Clusters
+**************************/
+ const Int_t kMaxCl=100*160;
+ Int_t fNColorBins = 5;
+
+ TEvePointSet* clusters = new TEvePointSet(kMaxCl);
+ clusters->SetOwnIds(kTRUE);
+
+ TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized");
+ cc->SetMainColor(kRed);
+ cc->SetMarkerStyle(4);
+ cc->SetMarkerSize(0.4);
+ cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*60.);
+
+ cc->GetBin(0)->SetMainColor(kGray);
+ cc->GetBin(0)->SetMarkerSize(0.4);
+ cc->GetBin(1)->SetMainColor(kBlue);
+ cc->GetBin(1)->SetMarkerSize(0.42);
+ cc->GetBin(2)->SetMainColor(kCyan);
+ cc->GetBin(2)->SetMarkerSize(0.44);
+ cc->GetBin(3)->SetMainColor(kGreen);
+ cc->GetBin(3)->SetMarkerSize(0.46);
+ cc->GetBin(4)->SetMainColor(kYellow);
+ cc->GetBin(4)->SetMarkerSize(0.48);
+ cc->GetBin(5)->SetMainColor(kRed);
+ cc->GetBin(5)->SetMarkerSize(0.50);
+ cc->GetBin(6)->SetMainColor(kMagenta);
+ cc->GetBin(6)->SetMarkerSize(0.52);
+
+
+// Loop over clusters
+ Int_t nentries = clustersTree->GetEntriesFast();
+
+ AliTPCClustersRow *clrow = new AliTPCClustersRow();
+ clrow->SetClass("AliTPCclusterMI");
+ //clrow->SetArray(kMaxCl);
+ clustersTree->SetBranchAddress("Segment", &clrow);
+
+ for (Int_t i=0; i<nentries; i++) {
+ if (!clustersTree->GetEvent(i)) continue;
+
+ TClonesArray *cl = clrow->GetArray();
+ Int_t ncl = cl->GetEntriesFast();
+
+ while (ncl--)
+ {
+ AliTPCclusterMI* clusterMI = (AliTPCclusterMI*) cl->At(ncl);
+
+ AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
+ Float_t g[3]; //global coordinates
+ c->GetGlobalXYZ(g);
+
+ cc->Fill(g[0], g[1], g[2], clusterMI->GetQ());
+ clusters->SetNextPoint(g[0], g[1], g[2]);
+ AliCluster *atp = new AliCluster(*clusterMI);
+ clusters->SetPointId(atp);
+
+ }
+ cl->Clear();
+ }
+
+ delete clrow;
+
+ clusters->SetName("TPC Clusters");
+ clusters->SetTitle(Form("N=%d", clusters->Size()));
+
+ const TString viz_tag("REC Clusters TPC"); // to be changed
+ clusters->ApplyVizTag(viz_tag, "Clusters");
+
+ cc->SetRnrSelf(kTRUE);
+
+ gEve->AddElement(cc);
+
+ return;
}
// Note: CDB manager should be initialized beforehand //
////////////////////////////////////////////////////////////////////////////
+#include <THashTable.h>
#include <TGeoGlobalMagField.h>
#include "AliGRPManager.h"
// Constructs and returns an object
// containing the run information
// The user code is the owner of the object
+ if(!fGRPData) ReadGRPEntry();
TString lhcState = fGRPData->GetLHCState();
if (lhcState==AliGRPObject::GetInvalidString()) {
return new AliRunInfo(lhcState, beamType, beamEnergy, runType, activeDetectors);
}
+THashTable* AliGRPManager::GetCosmicTriggers()
+{
+ THashTable* listOfCosmicTriggers = 0;
+ AliCDBEntry* entry = 0;
+
+ entry = AliCDBManager::Instance()->Get("GRP/Calib/CosmicTriggers");
+ if (entry) {
+ listOfCosmicTriggers = dynamic_cast<THashTable*>(entry->GetObject());
+ entry->SetOwner(0);
+ }
+
+ if (!listOfCosmicTriggers) {
+ AliWarning("Can not get list of cosmic triggers from OCDB! Cosmic event specie will be effectively disabled!");
+ }
+
+ return listOfCosmicTriggers;
+}
+
+
//_____________________________________________________________________________
void AliGRPManager::SetGRPEntry(const AliGRPObject* source)
{
class AliRunInfo;
class AliGRPObject;
+class THashTable;
class AliGRPManager: public TObject {
public:
Bool_t SetMagField();
AliRunInfo* GetRunInfo();
+ THashTable* GetCosmicTriggers(); // return the list of cosmic triggers as defined by trigger coordination
private: