MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000455JANABugpublic2015-02-28 19:332015-06-05 16:23
Reportersdobbs 
Assigned Todavidl 
PriorityhighSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Summary0000455: Wrong ordering when loading CCDB tables with multiple columns
DescriptionWhen loading tables with multiple columns in JANA, the columns are loaded ordered by their column labels alphabetically, instead of the order they are stored in the CCDB.

This problem came up when loading the CCDB table /BCAL/attenuation_parameters, which has three columns, named "L1", "L2", and "L0", respectively. When loading the table in DBCALPoint_factory, the values were loaded in the order "L0", "L1", "L2".
Steps To ReproduceThis problem is illustrated in the plugin in the following location:

  /w/halld-scifs1a/home/sdobbs/plugins/CCDBTest

compared to the output of

  ccdb cat /BCAL/attenuation_parameters

Sample outputs are attached.
Additional InformationDmitry pointed out that the problem lies in this function:

//-------------
template<class T> bool JCalibration::Get(string namepath, vector< vector<T> > &vals, int event_number)
{
    vector< map<string, string> >svals;
    bool res = GetCalib(namepath, svals, event_number);
  
    // copying them into the vals map.
    vals.clear();
    for(unsigned int i=0; i<svals.size(); i++){
        map<string,string>::const_iterator iter;
  ...
    }
    
    return res;
}

Since this function gets the calibration values as a map instead of a vector<vector<>>, and maps in C++ are ordered by key name, this is where this mis-ordering comes from.
TagsNo tags attached.
Attached Filestxt file icon bug_output.txt [^] (32,538 bytes) 2015-02-28 19:33 [Show Content]

- Relationships

-  Notes
(0000629)
davidl (administrator)
2015-03-02 10:17

This is a feature designed into the API for JANA. The intent is to minimize the number of virtual methods that must be implemented in a class inheriting from JCalibration. The design was to allow one to access a table that had columns defined by name using:

   Get(string name path, vector< map<string, T> > &vals, int event_number)

And columns defined by position using:

   Get(string name path, vector< vector<T> > &vals, int event_number)


The idea was that if you had a table where the columns did not have names and were only defined by position, then the underlying DB was responsible for maintaining the ordering and one would request the table using the "vector" form of Get(). If had a table with named columns, then you should be using the "map" form of Get() which gives you the values indexed by column name. The only way to fix this so that one may use the "vector" form with named columns and still preserve order is to add another pair of GetCalib virtual methods to JCalibration and have CCDB implement those.
(0000640)
davidl (administrator)
2015-06-05 16:23

This was implemented in revision 2334 and will appear in JANA 0.7.3. It also required changes to DCalibrationCCDB that exists in the DANA library in sim-recon. Those changes have already been checked in and checked that they still compile with JANA 0.7.2 this shouldn't require a synchronous upgrade between JANA and sim-recon.

- Issue History
Date Modified Username Field Change
2015-02-28 19:33 sdobbs New Issue
2015-02-28 19:33 sdobbs File Added: bug_output.txt
2015-03-02 10:17 davidl Note Added: 0000629
2015-06-05 16:23 davidl Note Added: 0000640
2015-06-05 16:23 davidl Status new => resolved
2015-06-05 16:23 davidl Resolution open => fixed
2015-06-05 16:23 davidl Assigned To => davidl


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker