Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 28 additions & 21 deletions scripts/datamodel-doc/ALICEO2dataModelTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,32 @@ def expandLine(self, line):
# no substitution of variables needed
expandedLine = line.replace(self.name, self.cont)
else:
# substitute variables vars
vars = "".join(line.split("(")[1:]).split(")")[0].split(",")
if len(vars) != len(self.vars):
print("ATTENTION")
print("Substitution error!")
print("")
self.print()
print("")
print(" ", line)

else:
words = split(self.cont)
for ind1 in range(len(self.vars)):
for ind2 in range(len(words)):
if self.vars[ind1].strip() in words[ind2]:
words[ind2] = re.sub(self.vars[ind1].strip(), vars[ind1].strip(), words[ind2])
expandedLine = block(words)
inds = [i for i in range(len(line)) if line.startswith(self.name, i)]
expandedLine = line[:inds[0]]
for i, ind in enumerate(inds):

# make sure that the name of the define == self.name and not only starts with self.name
words = line[ind:].split('(')
if words[0].strip() != self.name:
if i < len(inds)-1:
expandedLine += line[ind:inds[i+1]]
else:
expandedLine += line[ind:]
continue

# substitute variables vars
vars = "".join(line[ind:].split("(")[1:]).split(")")[0].split(",")
if len(vars) != len(self.vars):
print("ATTENTION")
print("Substitution error!")
print('>> ', line)
else:
words = split(self.cont)
for ind1 in range(len(self.vars)):
for ind2 in range(len(words)):
if self.vars[ind1].strip() in words[ind2]:
words[ind2] = re.sub(self.vars[ind1].strip(), vars[ind1].strip(), words[ind2])
expandedLine += block(words)

# remove ##, which connects two strings
expandedLine = block(split(expandedLine.replace(" # # ", "")))
Expand Down Expand Up @@ -324,8 +333,7 @@ def pickContent(lines_in_file):
linesWithoutComments[ind] = res[1]

# select all lines starting with #define
idfs = [l for l, s in enumerate(
linesWithoutComments) if s.lstrip().startswith("#define")][::-1]
idfs = [l for l, s in enumerate(linesWithoutComments) if s.lstrip().startswith("#define")]
for idf in idfs:
ws = split(linesWithoutComments[idf])
defstring = linesWithoutComments[idf].split(ws[2], 1)[1]
Expand All @@ -334,8 +342,7 @@ def pickContent(lines_in_file):
# find the corresponding #undef
# if no #undef then apply to the end of the file
iend = len(linesWithoutComments)
iudfs = [l for l, s in enumerate(
linesWithoutComments) if s.lstrip().startswith("#undef")][::-1]
iudfs = [l for l, s in enumerate(linesWithoutComments) if s.lstrip().startswith("#undef")]
for iudf in iudfs:
ws = split(linesWithoutComments[iudf])
if ws[2] == df.name:
Expand Down
10 changes: 8 additions & 2 deletions scripts/datamodel-doc/ALICEO2includeFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,15 @@ def condition(s):
for icol in inds:
iend = [i for i, x in enumerate(
O2DMT.list_in([")", ";"], words[icol:])) if x == True]
iend1 = [i for i, x in enumerate(
O2DMT.list_in([")"], words[icol:])) if x == True]
if len(iend) == 0:
print(nslevel)
sys.exit('Ending ); not found in table declaration! EXIT -->')
if len(iend1) == 0:
print(iend1)
print(lines)
sys.exit('Ending ); not found in table declaration! EXIT -->')
else:
iend = iend1
cont = words[icol:iend[0]+icol+2]

kind = [i for i, x in enumerate(types) if x == words[icol].txt][0]
Expand Down
6 changes: 3 additions & 3 deletions scripts/datamodel-doc/inputCard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@
o2::aod::BCs, o2::aod::Timestamps, o2::aod::Collisions
</category>
<category name="Tracks">
o2::aod::Tracks, o2::aod::TracksIU, o2::aod::TracksCov, o2::aod::TracksCovIU, o2::aod::TracksExtra, o2::aod::StoredTracks, o2::aod::StoredTracksIU, o2::aod::StoredTracksCov, o2::aod::StoredTracksCovIU, o2::aod::StoredTracksExtra, o2::aod::MFTTracks, o2::aod::StoredMFTTracks, o2::aod::FwdTracks, o2::aod::FwdTracksCov, o2::aod::StoredFwdTracks, o2::aod::StoredFwdTracksCov, o2::aod::AmbiguousTracks, o2::aod::AmbiguousMFTTracks, o2::aod::AmbiguousFwdTracks
o2::aod::Tracks, o2::aod::TracksIU, o2::aod::TracksCov, o2::aod::TracksCovIU, o2::aod::TracksExtra, o2::aod::StoredTracks, o2::aod::StoredTracksIU, o2::aod::StoredTracksCov, o2::aod::StoredTracksCovIU, o2::aod::StoredTracksExtra, o2::aod::MFTTracks, o2::aod::StoredMFTTracks, o2::aod::FwdTracks, o2::aod::FwdTracksCov, o2::aod::StoredFwdTracks, o2::aod::StoredFwdTracksCov, o2::aod::FwdTrkCls, o2::aod::AmbiguousTracks, o2::aod::AmbiguousMFTTracks, o2::aod::AmbiguousFwdTracks
</category>
<category name="Detectors">
o2::aod::FV0As, o2::aod::FT0s, o2::aod::FDDs, so2::aod::HMPIDs, o2::aod::Calos, o2::aod::CaloTriggers, o2::aod::Zdcs, o2::aod::FV0Cs, o2::aod::HMPIDs, o2::aod::CPVClusters, o2::aod::FwdTrkCls
o2::aod::FV0As, o2::aod::FT0s, o2::aod::FDDs, so2::aod::HMPIDs, o2::aod::Calos, o2::aod::CaloTriggers, o2::aod::Zdcs, o2::aod::FV0Cs, o2::aod::HMPIDs, o2::aod::CPVClusters, o2::aod::HMPID
</category>
<category name="Strangeness">
o2::aod::V0s, o2::aod::TransientV0s, o2::aod::StoredV0s, o2::aod::Cascades, o2::aod::TransientCascades, o2::aod::StoredCascades, o2::aod::Decays3Body
o2::aod::V0s, o2::aod::TransientV0s, o2::aod::StoredV0s, o2::aod::TrackedV0s, o2::aod::Cascades, o2::aod::TransientCascades, o2::aod::StoredCascades, o2::aod::TrackedCascades, o2::aod::Decay3Bodys, o2::aod::Tracked3Bodys
</category>
<category name="Indices">
o2::aod::Run3MatchedExclusive, o2::aod::Run3MatchedSparse, o2::aod::MatchedBCCollisionsExclusive, o2::aod::MatchedBCCollisionsSparse, o2::aod::Run3MatchedToBCExclusive, o2::aod::Run3MatchedToBCSparse, o2::aod::MatchedBCCollisionsExclusiveMulti, o2::aod::MatchedBCCollisionsSparseMulti
Expand Down