00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "CaloOnlineTools/HcalOnlineDb/interface/XMLHTRZeroSuppressionLoader.h"
00018 #include "CaloOnlineTools/HcalOnlineDb/interface/XMLProcessor.h"
00019 #include "CaloOnlineTools/HcalOnlineDb/interface/LMap.h"
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 XMLHTRZeroSuppressionLoader::loaderBaseConfig::_loaderBaseConfig()
00034 {
00035 extention_table_name = "HCAL_ZERO_SUPPRESSION_TYPE01";
00036 name = "HCAL zero suppression [type 1]";
00037 run_type = "hcal-test";
00038 run_number = 1;
00039 run_begin_timestamp = 1194394284;
00040 comment_description = "Fake set of ZS by kukartsev";
00041 data_set_id = "-1";
00042 iov_id = "1";
00043 iov_begin = 1;
00044 iov_end = -1;
00045 tag_id = "2";
00046 tag_mode = "auto";
00047 tag_name = "test ZS kukartsev";
00048 detector_name = "HCAL";
00049 elements_comment_description = "Fake ZS for testing (kukartsev)";
00050 }
00051
00052 XMLHTRZeroSuppressionLoader::datasetDBConfig::_datasetDBConfig() : XMLProcessor::DBConfig()
00053 {
00054 comment_description = "Default ZS comment description";
00055 extention_table_name = "HCAL_CHANNELS";
00056 eta = 1;
00057 phi = 1;
00058 depth = 1;
00059 z = -1;
00060 hcal_channel_id = 1107312769;
00061 string detector_name = "HB";
00062 zero_suppression = 2;
00063 }
00064
00065 XMLHTRZeroSuppressionLoader::XMLHTRZeroSuppressionLoader( loaderBaseConfig * config, string templateBase ) : XMLDOMBlock( templateBase )
00066 {
00067 setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name );
00068 setTagValue( "NAME", config -> name );
00069 setTagValue( "RUN_TYPE", config -> run_type );
00070 setTagValue( "RUN_NUMBER", config -> run_number );
00071 char timebuf[50];
00072 strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> run_begin_timestamp) ) );
00073 setTagValue( "COMMENT_DESCRIPTION", config -> comment_description );
00074 setTagAttribute( "DATA_SET", "id", config -> data_set_id );
00075 setTagAttribute( "IOV", "id", config -> iov_id );
00076 setTagValue( "INTERVAL_OF_VALIDITY_BEGIN", config -> iov_begin );
00077 setTagValue( "INTERVAL_OF_VALIDITY_END", config -> iov_end );
00078 setTagAttribute( "TAG", "id", config -> tag_id );
00079 setTagAttribute( "TAG", "mode", config -> tag_mode );
00080 setTagValue( "TAG_NAME", config -> tag_name );
00081 setTagValue( "DETECTOR_NAME", config -> detector_name );
00082 setTagValue( "COMMENT_DESCRIPTION", config -> elements_comment_description, 1 );
00083
00084 setTagAttribute( "TAG", "idref", config -> tag_id, 1 );
00085 setTagAttribute( "IOV", "idref", config -> iov_id, 1 );
00086 setTagAttribute( "DATA_SET", "idref", config -> data_set_id, 1 );
00087 }
00088
00089
00090
00091
00092
00093
00094 XMLHTRZeroSuppressionLoader::~XMLHTRZeroSuppressionLoader()
00095 {
00096 }
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 int XMLHTRZeroSuppressionLoader::addZS( datasetDBConfig * config, string templateFileName )
00114 {
00115 DOMElement * root = document -> getDocumentElement();
00116
00117 XMLDOMBlock dataSetDoc( templateFileName );
00118 DOMDocument * dataSet = dataSetDoc . getDocument();
00119
00120
00121 setTagValue( "VERSION", config -> version, 0, dataSet );
00122 setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
00123 char timebuf[50];
00124
00125 strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
00126 setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
00127
00128 setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
00129 setTagValue( "COMMENT_DESCRIPTION", config -> comment_description, 0, dataSet );
00130 setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name, 0, dataSet );
00131
00132 setTagValue( "ETA", config -> eta, 0, dataSet );
00133 setTagValue( "PHI", config -> phi, 0, dataSet );
00134 setTagValue( "DEPTH", config -> depth, 0, dataSet );
00135 setTagValue( "Z", config -> z, 0, dataSet );
00136 setTagValue( "HCAL_CHANNEL_ID", config -> hcal_channel_id, 0, dataSet );
00137 setTagValue( "DETECTOR_NAME", config -> detector_name, 0, dataSet );
00138 setTagValue( "ZERO_SUPPRESSION", config -> zero_suppression, 0, dataSet );
00139
00140
00141 DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
00142 root -> appendChild( cloneDataSet );
00143
00144 return 0;
00145 }
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198