+// $Id$
/**************************************************************************
* This file is property of and copyright by the ALICE HLT Project *
* ALICE Experiment at CERN, All rights reserved. *
for (Int_t i = 0; i < domain.fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( domain.fEntries[i] );
+ const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( domain.fEntries.UncheckedAt(i) );
new (fEntries[fEntries.GetEntriesFast()]) AliHLTDomainEntry(*entry);
}
}
AliHLTReadoutList::kEMCAL, AliHLTReadoutList::kDAQTEST, AliHLTReadoutList::kHLT
};
- for (Int_t deti = 0; deti < AliHLTDAQ::NumberOfDetectors() && deti<(sizeof(detId)/sizeof(Int_t)); deti++)
+ for (Int_t deti = 0; deti < (Int_t)AliHLTDAQ::NumberOfDetectors() && deti < (Int_t)(sizeof(detId)/sizeof(Int_t)); deti++)
{
if (list.DetectorEnabled(detId[deti]))
{
- Add("DAQRDOUT", AliHLTDAQ::OnlineName(deti));
+ Add(kAliHLTDAQRDOUTDataTypeID, AliHLTDAQ::OnlineName(deti));
}
else
{
for (Int_t i = 0; i < AliHLTDAQ::NumberOfDdls(deti); i++)
{
Int_t ddlId = AliHLTDAQ::DdlID(deti, i);
- if (list.IsDDLEnabled(ddlId)) Add("DAQRDOUT", AliHLTDAQ::OnlineName(deti), ddlId);
+ if (list.IsDDLEnabled(ddlId)) Add(kAliHLTDAQRDOUTDataTypeID, AliHLTDAQ::OnlineName(deti), ddlId);
}
}
}
// because it is already part of the trigger domain.
for (Int_t i = 0; i < count; i++)
{
- AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>(fEntries[i]);
+ AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>(fEntries.UncheckedAt(i));
if (ientry->Inclusive())
{
if (entry.SubsetOf(*ientry))
}
else if (ientry->SubsetOf(entry))
{
- ientry->SetBit(14, true); // mark for removal.
+ ientry->SetBit(BIT(14), true); // mark for removal.
}
}
else
{
if (ientry->SubsetOf(entry))
{
- ientry->SetBit(14, true); // mark for removal.
+ ientry->SetBit(BIT(14), true); // mark for removal.
}
else if (entry.SubsetOf(*ientry))
{
AliHLTReadoutList::kEMCAL, AliHLTReadoutList::kDAQTEST, AliHLTReadoutList::kHLT
};
- for (Int_t deti = 0; deti < AliHLTDAQ::NumberOfDetectors() && deti<(sizeof(detId)/sizeof(Int_t)); deti++)
+ for (Int_t deti = 0; deti < (Int_t)AliHLTDAQ::NumberOfDetectors() && deti < (Int_t)(sizeof(detId)/sizeof(Int_t)); deti++)
{
if (list.DetectorEnabled(detId[deti]))
{
- Remove("DAQRDOUT", AliHLTDAQ::OnlineName(deti));
+ Remove(kAliHLTDAQRDOUTDataTypeID, AliHLTDAQ::OnlineName(deti));
}
else
{
for (Int_t i = 0; i < AliHLTDAQ::NumberOfDdls(deti); i++)
{
Int_t ddlId = AliHLTDAQ::DdlID(deti, i);
- if (list.IsDDLEnabled(ddlId)) Remove("DAQRDOUT", AliHLTDAQ::OnlineName(deti), ddlId);
+ if (list.IsDDLEnabled(ddlId)) Remove(kAliHLTDAQRDOUTDataTypeID, AliHLTDAQ::OnlineName(deti), ddlId);
}
}
}
// inclusive trigger domain entries (rules / patterns).
for (Int_t i = 0; i < count; i++)
{
- AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>(fEntries[i]);
+ AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>(fEntries.UncheckedAt(i));
if (ientry->Inclusive())
{
if (ientry->SubsetOf(entry))
{
- ientry->SetBit(14, true); // mark for removal.
+ ientry->SetBit(BIT(14), true); // mark for removal.
}
else if (entry.SubsetOf(*ientry))
{
}
else if (ientry->SubsetOf(entry))
{
- ientry->SetBit(14, true); // mark for removal.
+ ientry->SetBit(BIT(14), true); // mark for removal.
}
}
}
bool result = false;
for (Int_t i = 0; i < fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* ientry = static_cast<const AliHLTDomainEntry*>(fEntries[i]);
+ const AliHLTDomainEntry* ientry = static_cast<const AliHLTDomainEntry*>(fEntries.UncheckedAt(i));
if (ientry->Inclusive())
{
if (*ientry == entry) result = true;
bool result = false;
for (Int_t i = 0; i < fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>(fEntries[i]);
+ const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>(fEntries.UncheckedAt(i));
if (entry->Inclusive())
{
if (*entry == block) result = true;
cout << "Trigger domain rules (applied in order of first to last):" << endl;
for (Int_t i = 0; i < fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( fEntries[i] );
+ const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( fEntries.UncheckedAt(i) );
if (entry->Inclusive())
{
cout << "Include ";
fEntries.Clear();
for (Int_t i = 0; i < domain.fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( domain.fEntries[i] );
+ const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( domain.fEntries.UncheckedAt(i) );
new (fEntries[fEntries.GetEntriesFast()]) AliHLTDomainEntry(*entry);
}
return *this;
// intersections to the end of fEntries.
for (Int_t i = 0; i < domain.fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* newEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries[i] );
+ const AliHLTDomainEntry* newEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries.UncheckedAt(i) );
for (Int_t j = 0; j < count; j++)
{
- const AliHLTDomainEntry* currentEntry = static_cast<const AliHLTDomainEntry*>( fEntries[j] );
+ const AliHLTDomainEntry* currentEntry = static_cast<const AliHLTDomainEntry*>( fEntries.UncheckedAt(j) );
if (currentEntry->Inclusive() and newEntry->Inclusive())
{
// If either entry is a subset of the other then we do not need to add
// IncludeInReadout() or Contains().
for (Int_t i = 0; i < domain.fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* newEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries[i] );
+ const AliHLTDomainEntry* newEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries.UncheckedAt(i) );
for (Int_t j = 0; j < count; j++)
{
- const AliHLTDomainEntry* currentEntry = static_cast<const AliHLTDomainEntry*>( fEntries[j] );
+ const AliHLTDomainEntry* currentEntry = static_cast<const AliHLTDomainEntry*>( fEntries.UncheckedAt(j) );
if (newEntry->IntersectWith(*currentEntry, intersect))
{
// We can remove all intersections that were already added that will
// parts of the two trigger domains.
for (Int_t i = 0; i < domain.fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* checkEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries[i] );
+ const AliHLTDomainEntry* checkEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries.UncheckedAt(i) );
if (checkEntry->Inclusive())
{
// For inclusive entries we need to find the overlaps with the inclusive
// part of the trigger domain set.
for (Int_t j = 0; j < startOfIntersects; j++)
{
- AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries[j] );
+ AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries.UncheckedAt(j) );
// We only need to consider the case where both entries are inclusive,
// since an exclusion in fEntries already eliminates those data blocks
new (fEntries[newIndex++]) AliHLTDomainEntry(kTRUE, intersect);
if (currentEntry->IdenticalTo(intersect))
{
- currentEntry->SetBit(14, true);
+ currentEntry->SetBit(BIT(14), true);
}
}
}
// all of fEntries and re-apply these with the same exclude flags.
for (Int_t j = 0; j < startOfIntersects; j++)
{
- AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries[j] );
+ AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries.UncheckedAt(j) );
if (checkEntry->IntersectWith(*currentEntry, intersect))
{
// We can remove all intersections that were already added that will
result.Add(kAliHLTAnyDataType);
for (Int_t i = 0; i < fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( fEntries[i] );
+ const AliHLTDomainEntry* entry = static_cast<const AliHLTDomainEntry*>( fEntries.UncheckedAt(i) );
if (entry->Inclusive())
{
result.Remove(*entry);
// makes sure that all exclusion entries are always subsets of inclusion entries.
for (Int_t i = 0; i < domain.fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* checkEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries[i] );
+ const AliHLTDomainEntry* checkEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries.UncheckedAt(i) );
if (checkEntry->Inclusive())
{
for (Int_t j = 0; j < fEntries.GetEntriesFast(); j++)
{
- AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries[j] );
+ AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries.UncheckedAt(j) );
if (checkEntry->IntersectWith(*currentEntry, intersect))
{
// We can remove all entries that were already added to the result that
{
for (Int_t j = 0; j < fEntries.GetEntriesFast(); j++)
{
- AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries[j] );
+ AliHLTDomainEntry* currentEntry = static_cast<AliHLTDomainEntry*>( fEntries.UncheckedAt(j) );
if (checkEntry->IntersectWith(*currentEntry, intersect))
{
// We can remove all entries that were already added to the result that
}
+bool AliHLTTriggerDomain::operator == (const AliHLTTriggerDomain& domain) const
+{
+ // Checks if two domains are the same.
+
+ if (fEntries.GetEntriesFast() != domain.fEntries.GetEntriesFast()) return false;
+
+ // We need to find for each entry in this domain an identical entry in the domain
+ // that we are comparing to. Both entries cannot have subset entries further down
+ // in the entries lists. i.e. for fEntries[n], there cannot be any entry fEntries[m]
+ // that is a subset of fEntries[n] where m > n. Similarly for domain.fEntries.
+ // If two such entries are matched and they respect the subset rule mentioned,
+ // then they are marked. We keep finding matching pairs until no more pairs are
+ // found and check if there are any unmarked entries in either list. If there are
+ // any unmatched pairs then the two domains do not match.
+ //
+ // Note: We use bit 14 in fBits to mark the entries.
+ // 2) We traverse fEntries from back to front (i.e. from N-1 down to 0) so that
+ // we are guaranteed that fEntries[n] has no subset entries above it that are
+ // not marked.
+ for (Int_t i = fEntries.GetEntriesFast() - 1; i >= 0; --i)
+ {
+ AliHLTDomainEntry* entry1 = static_cast<AliHLTDomainEntry*>(const_cast<TObject*>( fEntries.UncheckedAt(i) ));
+ // Find identical domain entry in domain.fEntries.
+ AliHLTDomainEntry* entry2 = NULL;
+ Int_t entry2index = -1;
+ for (Int_t j = fEntries.GetEntriesFast() - 1; j >= 0; --j)
+ {
+ AliHLTDomainEntry* current = static_cast<AliHLTDomainEntry*>(const_cast<TObject*>( domain.fEntries.UncheckedAt(j) ));
+ if (current->TestBit(BIT(14))) continue; // skip marked entries.
+ if (entry1->IdenticalTo(*current) and entry1->Exclusive() == current->Exclusive())
+ {
+ entry2 = current;
+ entry2index = j;
+ break;
+ }
+ }
+ if (entry2 == NULL)
+ {
+ // Could not find identical entry in domain.fEntries for fEntries[i] so we
+ // will have at least one unmatched entry and thus the domains do not match.
+ return false;
+ }
+ // Now check if entry2 has any subset entries below it. If it does then
+ // it fails our ordering requirements and the domains cannot match.
+ for (Int_t j = entry2index + 1; j < fEntries.GetEntriesFast(); ++j)
+ {
+ const AliHLTDomainEntry* current = static_cast<const AliHLTDomainEntry*>(const_cast<TObject*>( domain.fEntries.UncheckedAt(j) ));
+ if (current->TestBit(BIT(14))) continue; // skip marked entries.
+ if (entry1->SubsetOf(*current)) return false;
+ }
+ // If we got to this point then entry1 and entry2 are a match and obey the
+ // ordering rules, so mark them.
+ entry1->SetBit(BIT(14), true);
+ entry2->SetBit(BIT(14), true);
+ }
+ // At this point we could find all pairs so the domains match.
+ // We now just need to clear the bits that we set.
+ for (Int_t i = 0; i < fEntries.GetEntriesFast() - 1; ++i)
+ {
+ fEntries[i]->SetBit(BIT(14), false);
+ domain.fEntries[i]->SetBit(BIT(14), false);
+ }
+ return true;
+}
+
+
AliHLTTriggerDomain::operator AliHLTReadoutList () const
{
// Typecast operator which constructs a readout list from the trigger domain.
for (Int_t i = 0; i < AliHLTDAQ::NumberOfDdls(deti); i++)
{
Int_t ddlId = AliHLTDAQ::DdlID(deti, i);
- if (Contains(AliHLTDomainEntry("DAQRDOUT", AliHLTDAQ::OnlineName(deti), ddlId)))
+ AliHLTComponentDataType type = AliHLTComponentDataTypeInitializer(kAliHLTDAQRDOUTDataTypeID, AliHLTDAQ::OnlineName(deti));
+ if (Contains(AliHLTDomainEntry(type, ddlId)))
{
result.EnableDDLBit(ddlId);
}
}
else
{
- const AliHLTDomainEntry* newEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries[i] );
+ const AliHLTDomainEntry* newEntry = static_cast<const AliHLTDomainEntry*>( domain.fEntries.UncheckedAt(i) );
new (fEntries[entriesCount+i]) AliHLTDomainEntry(*newEntry);
}
}
// the MarkForDeletionSubsetsOf method.
for (Int_t i = startOfIntersects; i < fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* ientry = static_cast<const AliHLTDomainEntry*>( fEntries[i] );
- if (ientry->TestBit(14))
+ const AliHLTDomainEntry* ientry = static_cast<const AliHLTDomainEntry*>( fEntries.UncheckedAt(i) );
+ if (ientry->TestBit(BIT(14)))
{
fEntries.RemoveAt(i);
anythingRemoved = true;
AliHLTDomainEntry intersect;
for (Int_t i = min; i < fEntries.GetEntriesFast(); i++)
{
- AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>( fEntries[i] );
- if (ientry->TestBit(14)) continue;
+ AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>( fEntries.UncheckedAt(i) );
+ if (ientry->TestBit(BIT(14))) continue;
if (ientry->SubsetOf(entry))
{
- ientry->SetBit(14, true);
+ ientry->SetBit(BIT(14), true);
}
}
}
bool anythingRemoved = false;
for (Int_t i = 0; i < fEntries.GetEntriesFast(); i++)
{
- const AliHLTDomainEntry* ientry = static_cast<const AliHLTDomainEntry*>( fEntries[i] );
- if (ientry->TestBit(14))
+ const AliHLTDomainEntry* ientry = static_cast<const AliHLTDomainEntry*>( fEntries.UncheckedAt(i) );
+ if (ientry->TestBit(BIT(14)))
{
fEntries.RemoveAt(i);
anythingRemoved = true;
// Check that the first entry is not and exclusion which would be redundent.
if (fEntries.GetEntriesFast() == 0) return;
AliHLTDomainEntry* firstEntry = static_cast<AliHLTDomainEntry*>( fEntries[0] );
- if (firstEntry->Exclusive()) firstEntry->SetBit(14, true);
+ if (firstEntry->Exclusive()) firstEntry->SetBit(BIT(14), true);
for (Int_t i = 1; i < fEntries.GetEntriesFast(); i++)
{
- AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>( fEntries[i] );
+ AliHLTDomainEntry* ientry = static_cast<AliHLTDomainEntry*>( fEntries.UncheckedAt(i) );
// For the i'th entry in fEntries, compare it in reverse order with all other
// entries that are before it and look for redundant ones, i.e. that are subsets
// of the i'th entry.
for (Int_t j = i-1; j >= 0; j--)
{
- AliHLTDomainEntry* jentry = static_cast<AliHLTDomainEntry*>( fEntries[j] );
- if (jentry->TestBit(14)) continue;
+ AliHLTDomainEntry* jentry = static_cast<AliHLTDomainEntry*>( fEntries.UncheckedAt(j) );
+ if (jentry->TestBit(BIT(14))) continue;
// Find entries that intersect
if (jentry->SubsetOf(*ientry))
{
// jentry is a subset of ientry so it is redundant because for all values
// ientry will override jentry when calling IncludeInReadout.
- jentry->SetBit(14, true);
+ jentry->SetBit(BIT(14), true);
}
else if (*ientry == *jentry)
{
if (ientry->SubsetOf(*jentry))
{
- ientry->SetBit(14, true);
+ ientry->SetBit(BIT(14), true);
goto processNextEntry;
}
}
// (pattern matching) list without hitting any and overlapping entries.
// So now we need to check if ientry is an exclusion. If it is, then it is
// redundant and we can mark it for removal.
- if (ientry->Exclusive()) ientry->SetBit(14, true);
+ if (ientry->Exclusive()) ientry->SetBit(BIT(14), true);
processNextEntry: ;
}
RemoveMarkedEntries();
}
+const AliHLTDomainEntry& AliHLTTriggerDomain::operator[](int index) const
+{
+ // Access individual entry of the domain
+ return static_cast<AliHLTDomainEntry&>(*fEntries[index]);
+}