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 "CalibCalorimetry/HcalTPGAlgos/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
00056 extention_table_name = "HCAL_CHANNELS_OLD_V01";
00057 eta = 1;
00058 phi = 1;
00059 depth = 1;
00060 z = -1;
00061 hcal_channel_id = 1107312769;
00062 std::string detector_name = "HB";
00063 zero_suppression = 2;
00064 }
00065
00066 XMLHTRZeroSuppressionLoader::XMLHTRZeroSuppressionLoader( loaderBaseConfig * config, std::string templateBase ) : XMLDOMBlock( templateBase )
00067 {
00068 setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name );
00069 setTagValue( "NAME", config -> name );
00070 setTagValue( "RUN_TYPE", config -> run_type );
00071 setTagValue( "RUN_NUMBER", config -> run_number );
00072 char timebuf[50];
00073 strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> run_begin_timestamp) ) );
00074 setTagValue( "COMMENT_DESCRIPTION", config -> comment_description );
00075 setTagAttribute( "DATA_SET", "id", config -> data_set_id );
00076 setTagAttribute( "IOV", "id", config -> iov_id );
00077 setTagValue( "INTERVAL_OF_VALIDITY_BEGIN", config -> iov_begin );
00078 setTagValue( "INTERVAL_OF_VALIDITY_END", config -> iov_end );
00079 setTagAttribute( "TAG", "id", config -> tag_id );
00080 setTagAttribute( "TAG", "mode", config -> tag_mode );
00081 setTagValue( "TAG_NAME", config -> tag_name );
00082 setTagValue( "DETECTOR_NAME", config -> detector_name );
00083 setTagValue( "COMMENT_DESCRIPTION", config -> elements_comment_description, 1 );
00084
00085 setTagAttribute( "TAG", "idref", config -> tag_id, 1 );
00086 setTagAttribute( "IOV", "idref", config -> iov_id, 1 );
00087 setTagAttribute( "DATA_SET", "idref", config -> data_set_id, 1 );
00088 }
00089
00090
00091
00092
00093
00094
00095 XMLHTRZeroSuppressionLoader::~XMLHTRZeroSuppressionLoader()
00096 {
00097 }
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 int XMLHTRZeroSuppressionLoader::addZS( datasetDBConfig * config, std::string templateFileName )
00115 {
00116 DOMElement * root = document -> getDocumentElement();
00117
00118 XMLDOMBlock dataSetDoc( templateFileName );
00119 DOMDocument * dataSet = dataSetDoc . getDocument();
00120
00121
00122 setTagValue( "VERSION", config -> version, 0, dataSet );
00123 setTagValue( "SUBVERSION", config -> subversion, 0, dataSet );
00124 char timebuf[50];
00125
00126 strftime( timebuf, 50, "%Y-%m-%d %H:%M:%S.0", gmtime( &(config -> create_timestamp) ) );
00127 setTagValue( "CREATE_TIMESTAMP", timebuf , 0, dataSet );
00128
00129 setTagValue( "CREATED_BY_USER", config -> created_by_user, 0, dataSet );
00130 setTagValue( "COMMENT_DESCRIPTION", config -> comment_description, 0, dataSet );
00131 setTagValue( "EXTENSION_TABLE_NAME", config -> extention_table_name, 0, dataSet );
00132
00133 setTagValue( "ETA", config -> eta, 0, dataSet );
00134 setTagValue( "PHI", config -> phi, 0, dataSet );
00135 setTagValue( "DEPTH", config -> depth, 0, dataSet );
00136 setTagValue( "Z", config -> z, 0, dataSet );
00137 setTagValue( "HCAL_CHANNEL_ID", config -> hcal_channel_id, 0, dataSet );
00138 setTagValue( "DETECTOR_NAME", config -> detector_name, 0, dataSet );
00139 setTagValue( "ZERO_SUPPRESSION", config -> zero_suppression, 0, dataSet );
00140
00141
00142 DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true );
00143 root -> appendChild( cloneDataSet );
00144
00145 return 0;
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
00199