-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding CONTRIBUTING.md and library validation
- Loading branch information
Showing
5 changed files
with
249 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Contributions to this library can be made directly to the `master` branch when the process, metadata, or any contributed code, is stable enough to be integrated at the next official release. This does not mean it is 100% bug free, but that the new process it is in a final state and its use would be accepted in an official data processing chain, or results will be published using that code and they need to be tagged for future reference. | ||
|
||
Experimental developments, or developments taking longer periods of time, are encouraged to create a dedicated branch to be merged to master in the future to avoid adding to an official tag/release any unfinished job. | ||
|
||
### Using GitHub issue tracker | ||
|
||
New contributions are encouraged to create a new issue entry at the GitHub issue tracker in order to explain the nature of the developments, allow tracking of those developments, and invite other developers to join the discussion, evaluation and testing of the new code. | ||
|
||
When we use the issue tracking system we must write at the commit message the issue number, so that it keeps registered at the issue tracker. | ||
|
||
For example: | ||
|
||
``` | ||
git commit -m "ClassName. Fixed initalization bug. Issue #1" | ||
``` | ||
|
||
As soon as any issues remain open (and commits connected to this issue have been already added to master) those issues should be closed before fixing a new library release. | ||
|
||
### Contribution requirements | ||
|
||
Authors pushing new processes or metadata classes to this library will be encouraged to prompty include at least: | ||
|
||
1. Doxygen in-code documentation describing the process pourpose and scope, including examples, and if possible, a figure ilustrating the effect of the process on event data. | ||
2. A validation test with a minimal running test to be included at the pipeline file `.gitlab-ci.yml`. Tests will be running at https://lfna.unizar.es/rest-for-physics/tracklib. | ||
|
||
### Fixing a new library release | ||
|
||
In a last commit we will update manually the version found at the `CMakeLists.txt` file. I.e. from `1.0` to `1.1`, | ||
|
||
``` | ||
set( LibraryVersion "1.1" ) | ||
``` | ||
|
||
Then we will commit and push the change, | ||
|
||
``` | ||
git commit -m "Updating library to version 1.1" | ||
git push | ||
``` | ||
|
||
and we will create the new tag | ||
|
||
``` | ||
git tag -a v1.1 -m "Fixing release 1.1" | ||
git push --tags | ||
``` | ||
|
||
As soon as the new release is ready, the most natural is to update the submodule at the main [framework](https://github.com/rest-for-physics/framework) in order to make official the changes in the next framework release. | ||
|
||
If we are the main framework directory this would be achieved by doing | ||
|
||
``` | ||
git add source/libraries/track | ||
git commit -m "Updating track library submodule to version 1.1" | ||
git push | ||
``` | ||
|
||
### Versioning | ||
|
||
Please, notice that the central versioning system, which guarantees code traceability, is only managed by the framework. The library version number is only used for users to identify major changes, access the release notes for the corresponding updates, and create a citable reference to be used in publications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This library defines a track event type allowing to define inheritance relations between tracks that contain groups of hits. A process connecting to the detector library allows for hit clustering to create a first set of tracks using a distance relation. Graph theory processes are included in this library in order to identify and reconstruct a physical track, and execute topological algorithms. | ||
|
||
Please have a look to this library [contribution guide](CONTRIBUTING.md) before pushing changes to this repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
#!/usr/bin/python | ||
# -*- coding: iso-8859-15 -*- | ||
|
||
# This script generates the version header to be used in REST installation | ||
# J. Galan - [email protected] | ||
# 23 - Dec - 2019 | ||
|
||
#from __future__ import print_function | ||
import os | ||
import sys | ||
import re | ||
import filecmp | ||
import subprocess | ||
|
||
|
||
def validateClass(className): | ||
print "" | ||
print "++++ Validating class : " + className | ||
with open(className, 'r') as file: | ||
data = file.read() | ||
|
||
data = data[data.find("::Initialize"):] | ||
data = getMethodDefinition(data) | ||
data = removeCppComment(data) | ||
|
||
#print (data) | ||
#print data.find("SETLIBRARYVERSION(LIBRARY_VERSION);") | ||
if data.find("SETLIBRARYVERSION(LIBRARY_VERSION);") >= 0: | ||
print "OK" | ||
return | ||
else: | ||
print( "Problem found at class : " + className ) | ||
print( "SetLibraryVersion was NOT found at Initialization!" ) | ||
sys.exit(1) | ||
return | ||
|
||
def getObservablePositions(data): | ||
obsposes = {} | ||
pos = 0 | ||
str = "SETOBSERVABLEVALUE(\"" | ||
while(pos < len(data)): | ||
pos1 = data.find(str,pos) | ||
if(pos1 == -1): | ||
break | ||
pos1 += len(str) | ||
pos2 = data.find("\"",pos1) | ||
if(pos2 == -1): | ||
break | ||
|
||
name = data[pos1:pos2] | ||
if(not obsposes.has_key(name)): | ||
obsposes[name] = pos1 | ||
|
||
pos = pos2 + 1 | ||
return obsposes | ||
|
||
|
||
def getMethodDefinition(text): | ||
initPos = text.find("{") | ||
|
||
counter = 1 | ||
start = initPos + 1 | ||
while(counter > 0): | ||
pos1 = text.find("{",start) | ||
pos2 = text.find("}",start) | ||
|
||
endPosition = pos2 + 1 | ||
|
||
if(pos1 != -1 and pos2 != -1): | ||
if(pos1 < pos2): | ||
counter = counter + 1 | ||
start = pos1 + 1 | ||
if(pos2 < pos1): | ||
counter = counter - 1 | ||
start = pos2 + 1 | ||
elif pos1 != -1: | ||
print "Big error!!" | ||
else: | ||
counter = counter - 1 | ||
start = pos2 + 1 | ||
|
||
return text[initPos:endPosition].upper() | ||
|
||
|
||
def removeCppComment(strInput) : | ||
state = 0; | ||
strOutput = '' | ||
strRemoved = '' | ||
|
||
for c in strInput : | ||
if state == 0 and c == '/' : # ex. [/] | ||
state = 1 | ||
elif state == 1 and c == '*' : # ex. [/*] | ||
state = 2 | ||
elif state == 1 and c == '/' : # ex. [#] | ||
state = 4 | ||
elif state == 1 : # ex. [<secure/_stdio.h> or 5/3] | ||
state = 0 | ||
|
||
elif state == 3 and c == '*': # ex. [/*he**] | ||
state = 3 | ||
elif state == 2 and c == '*': # ex. [/*he*] | ||
state = 3 | ||
elif state == 2: # ex. [/*heh] | ||
state = 2 | ||
|
||
elif state == 3 and c == '/': # ex. [/*heh*/] | ||
state = 0 | ||
elif state == 3: # ex. [/*heh*e] | ||
state = 2 | ||
|
||
elif state == 4 and c == '\\': # ex. [//hehe\] | ||
state = 9 | ||
elif state == 9 and c == '\\': # ex. [//hehe\\\\\] | ||
state = 9 | ||
elif state == 9: # ex. [//hehe\<enter> or //hehe\a] | ||
state = 4 | ||
elif state == 4 and c == '\n': # ex. [//hehe<enter>] | ||
state = 0 | ||
|
||
elif state == 0 and c == '\'': # ex. ['] | ||
state = 5 | ||
elif state == 5 and c == '\\': # ex. ['\] | ||
state = 6 | ||
elif state == 6: # ex. ['\n or '\' or '\t etc.] | ||
state = 5 | ||
elif state == 5 and c == '\'': # ex. ['\n' or '\'' or '\t' ect.] | ||
state = 0 | ||
|
||
elif state == 0 and c == '\"': # ex. ["] | ||
state = 7 | ||
elif state == 7 and c == '\\': # ex. ["\] | ||
state = 8 | ||
elif state == 8: # ex. ["\n or "\" or "\t ect.] | ||
state = 7 | ||
elif state == 7 and c == '\"': # ex. ["\n" or "\"" or "\t" ect.] | ||
state = 0 | ||
|
||
if (state == 0 and c != '/') or state == 5 or\ | ||
state == 6 or state == 7 or state == 8 : | ||
strOutput += c | ||
else: | ||
# removed chareters | ||
strRemoved += c | ||
|
||
return strOutput | ||
|
||
|
||
files = [] | ||
|
||
# r=root, d=directories, f = files | ||
for r, d, f in os.walk(sys.argv[1]): | ||
for file in f: | ||
validate = 0 | ||
if '.cxx' in file: | ||
# print ( file ) | ||
with open(os.path.join(r, file)) as fin: | ||
if '::InitFromConfigFile' in fin.read(): | ||
validate = 1 | ||
with open(os.path.join(r, file)) as fin: | ||
if '::LoadDefaultConfig' in fin.read(): | ||
validate = 1 | ||
with open(os.path.join(r, file)) as fin: | ||
if '::Initialize' in fin.read(): | ||
validate = validate + 1 | ||
if validate == 2: | ||
files.append(os.path.join(r, file)) | ||
validateClass(os.path.join(r, file)) | ||
|
||
#for f in files: | ||
# print(f) | ||
|
||
#validateProcess(sys.argv[1]); | ||
sys.exit(0) |