Skip to content

Commit b02b1a7

Browse files
authored
Added method to test if a given BC is in one of the BC ranges (#8938)
* Extend bcRanges with method to test if a given BC is in one of the BC ranges * Do not print columns of type o2::soa::Marker.
1 parent 7801832 commit b02b1a7

2 files changed

Lines changed: 47 additions & 28 deletions

File tree

DataFormats/Reconstruction/include/ReconstructionDataFormats/BCRange.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,20 @@ struct bcRanges {
185185
}
186186
}
187187

188+
// check if the value index is in a range
189+
// and return true if this is the case
190+
bool isInRange(uint64_t index)
191+
{
192+
// make sure that the list is merged
193+
merge(false);
194+
195+
// find the range in which the value index falls
196+
auto range = std::find_if(mbcRangesList.begin(), mbcRangesList.end(), [index](limits a) {
197+
return (index >= a.first) && (index <= a.second);
198+
});
199+
return (range != mbcRangesList.end());
200+
}
201+
188202
// get BC range
189203
auto operator[](int index)
190204
{

scripts/datamodel-doc/ALICEO2includeFile.py

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,21 @@ def print(self):
182182

183183
def printHTML(self):
184184
cn2u = fullDataModelName(self.nslevel, self.cname)
185-
cn2u = cn2u.replace(":collision",":&zwnj;collision")
186-
# replace < by &lt; and > by &gt;
187-
ty2u = self.type.replace("<","&lt;").replace(">","&gt;")
188-
print(" <tr>")
189-
print(" <td>"+cn2u+"</td>")
190-
print(" <td>"+columnTypes(1)[self.kind]+"</td>")
191-
print(" <td>"+self.gname+"</td>")
192-
print(" <td>"+ty2u+"</td>")
193-
print(" <td>"+self.comment+"</td>")
194-
print(" </tr>")
185+
186+
# some columns don't need to be printed
187+
cols2Skip = [ "o2::soa::Marker" ]
188+
if not any(cn2u.startswith(word) for word in cols2Skip):
189+
cn2u = cn2u.replace(":collision",":&zwnj;collision")
190+
# replace < by &lt; and > by &gt;
191+
ty2u = self.type.replace("<","&lt;").replace(">","&gt;")
192+
print(" <tr>")
193+
print(" <td>"+cn2u+"</td>")
194+
print(" <td>"+columnTypes(1)[self.kind]+"</td>")
195+
print(" <td>"+self.gname+"</td>")
196+
print(" <td>"+ty2u+"</td>")
197+
print(" <td>"+self.comment+"</td>")
198+
print(" </tr>")
199+
195200

196201
# .............................................................................
197202
# holds a table
@@ -335,9 +340,9 @@ def __init__(self, dmname, CErelation, hfile, initCard=None):
335340
self.defines = list()
336341
self.namespaces = list()
337342
self.categories = list()
338-
343+
339344
# set some variables
340-
self.O2path = ""
345+
self.O2path = ""
341346
self.O2Physicspath = ""
342347
self.O2href = ""
343348
self.O2Physicshref = ""
@@ -373,15 +378,15 @@ def __init__(self, dmname, CErelation, hfile, initCard=None):
373378
tmp = initCard.find("O2general/delimJoins")
374379
if tmp != None:
375380
self.delimJoins = tmp.text.strip()
376-
381+
377382
# read the file
378383
lines_in_file = file.readlines()
379384
content = O2DMT.pickContent(lines_in_file)
380385

381386
# parse datamodel
382387
self.parseContent(hfile, content, "", self)
383388
# self.synchronize()
384-
389+
385390
# extract the categories definition
386391
def setTableCategories(self, DMxml):
387392

@@ -580,7 +585,7 @@ def printSingleTable(self, tabs, uses, tab2u):
580585
else:
581586
href2u = self.O2href
582587
path2u = self.O2path
583-
588+
584589
hf2u = O2DMT.block(tab2u.hfile.split(path2u)[
585590
1:], False).strip().lstrip("/")
586591
print(" <div>")
@@ -631,20 +636,20 @@ def printSingleTable(self, tabs, uses, tab2u):
631636

632637
# print the table footer
633638
tab2u.printFooterHTML()
634-
639+
635640

636641
def printTables(self, DMtype, tabs, uses, CER, tabs2u):
637642
print("")
638643
print("#### ", CER[2])
639-
644+
640645
# add source code information if available
641646
if "O2Physics" in CER[0]:
642647
href2u = self.O2Physicshref
643648
path2u = self.O2Physicspath
644649
else:
645650
href2u = self.O2href
646651
path2u = self.O2path
647-
652+
648653
if DMtype == 1:
649654
if href2u != "":
650655
print("Code file: <a href=\""+href2u+"/"+CER[0].split(path2u)[1] +
@@ -654,14 +659,14 @@ def printTables(self, DMtype, tabs, uses, CER, tabs2u):
654659

655660
tabInCat = list()
656661
others = list()
657-
if DMtype == 0:
662+
if DMtype == 0:
658663
# pattern for table versions
659664
vPattern = self.initCard.find('O2general/TableVersionPattern')
660665
if vPattern == None:
661666
vPattern = "_\d\d\d$"
662667
else:
663668
vPattern = vPattern.text.strip()
664-
669+
665670
# Analyze the tables and categories
666671
tabInCat = [False]*len(tabs2u)
667672
for cat in self.categories:
@@ -681,14 +686,14 @@ def printTables(self, DMtype, tabs, uses, CER, tabs2u):
681686

682687
print("<div>")
683688
print("")
684-
689+
685690
# loop over all table categories
686691
if DMtype == 0:
687692
for cat in self.categories:
688693
txt2print = '<h4 id="cat_'+cat.name+'">'+cat.name+'</h4>'
689694
print(txt2print)
690695
print("<div>")
691-
696+
692697
# print tables of of given category
693698
for tname in cat.members:
694699
for tab in tabs2u:
@@ -697,7 +702,7 @@ def printTables(self, DMtype, tabs, uses, CER, tabs2u):
697702
self.printSingleTable(tabs, uses, tab)
698703
continue
699704
print("</div>")
700-
705+
701706
# print non-categorized tables
702707
if len(others) > 0:
703708
print('<h4 id="cat_Others">Others</h4>')
@@ -706,7 +711,7 @@ def printTables(self, DMtype, tabs, uses, CER, tabs2u):
706711
print()
707712
self.printSingleTable(tabs, uses, tabs2u[i])
708713
print("</div>")
709-
714+
710715
else:
711716
# print all tables of given producer
712717
for tab in tabs2u:
@@ -737,7 +742,7 @@ def printHTML(self):
737742
# only one Main CER should be available
738743
if len(CER2u) != 1:
739744
sys.exit('<datamodel.printHTML> Exacly 1 DataModel of type Main is expected. We found '+len(CER2u)+'! EXIT -->')
740-
745+
741746
for CER in CER2u:
742747
inds = [i for i, x in enumerate(tabs) if CER in x.CErelations]
743748
tabs2u = [tabs[i] for i in inds]
@@ -804,7 +809,7 @@ def printHTML(self):
804809
# remove the version id from the table name
805810

806811
def baseTableName(vtname, vPattern):
807-
812+
808813
vres = re.compile(vPattern).search(vtname)
809814
if vres:
810815
return vtname[0:vres.start()]
@@ -1154,11 +1159,11 @@ class tableCategory:
11541159
def __init__(self, catName, catMembers):
11551160
self.name = catName
11561161
self.members = catMembers
1157-
1162+
11581163
def blongsTo(self, tableName):
11591164
if tableName in catMembers:
11601165
return true
11611166
else:
11621167
return false
1163-
1168+
11641169
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)