00001 #include "EventFilter/GctRawToDigi/src/GctFormatTranslateV38.h"
00002
00003
00004 #include <iostream>
00005 #include <cassert>
00006
00007
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009
00010
00011 using std::cout;
00012 using std::endl;
00013 using std::pair;
00014 using std::make_pair;
00015
00016
00017 GctFormatTranslateV38::BlockLengthMap GctFormatTranslateV38::m_blockLength = GctFormatTranslateV38::BlockLengthMap();
00018 GctFormatTranslateV38::BlockNameMap GctFormatTranslateV38::m_blockName = GctFormatTranslateV38::BlockNameMap();
00019 GctFormatTranslateV38::BlockIdToUnpackFnMap GctFormatTranslateV38::m_blockUnpackFn = GctFormatTranslateV38::BlockIdToUnpackFnMap();
00020 GctFormatTranslateV38::BlkToRctCrateMap GctFormatTranslateV38::m_rctEmCrate = GctFormatTranslateV38::BlkToRctCrateMap();
00021 GctFormatTranslateV38::BlkToRctCrateMap GctFormatTranslateV38::m_rctJetCrate = GctFormatTranslateV38::BlkToRctCrateMap();
00022 GctFormatTranslateV38::BlockIdToEmCandIsoBoundMap GctFormatTranslateV38::m_internEmIsoBounds = GctFormatTranslateV38::BlockIdToEmCandIsoBoundMap();
00023
00024
00025
00026
00027 GctFormatTranslateV38::GctFormatTranslateV38(bool hltMode, bool unpackSharedRegions):
00028 GctFormatTranslateBase(hltMode, unpackSharedRegions)
00029 {
00030 static bool initClass = true;
00031
00032 if(initClass)
00033 {
00034 initClass = false;
00035
00036
00037
00038 m_blockLength.insert(make_pair(0x000,0));
00039
00040 m_blockLength.insert(make_pair(0x580,12));
00041 m_blockLength.insert(make_pair(0x581,2));
00042 m_blockLength.insert(make_pair(0x582,4));
00043 m_blockLength.insert(make_pair(0x583,8));
00044 m_blockLength.insert(make_pair(0x587,4));
00045
00046 m_blockLength.insert(make_pair(0x680,16));
00047 m_blockLength.insert(make_pair(0x681,6));
00048 m_blockLength.insert(make_pair(0x682,2));
00049 m_blockLength.insert(make_pair(0x683,6));
00050 m_blockLength.insert(make_pair(0x686,2));
00051 m_blockLength.insert(make_pair(0x687,4));
00052
00053 m_blockLength.insert(make_pair(0x800,20));
00054 m_blockLength.insert(make_pair(0x803,4));
00055 m_blockLength.insert(make_pair(0x804,15));
00056 m_blockLength.insert(make_pair(0x880,16));
00057 m_blockLength.insert(make_pair(0x883,4));
00058 m_blockLength.insert(make_pair(0x884,12));
00059 m_blockLength.insert(make_pair(0xc00,20));
00060 m_blockLength.insert(make_pair(0xc03,4));
00061 m_blockLength.insert(make_pair(0xc04,15));
00062 m_blockLength.insert(make_pair(0xc80,16));
00063 m_blockLength.insert(make_pair(0xc83,4));
00064 m_blockLength.insert(make_pair(0xc84,12));
00065
00066 m_blockLength.insert(make_pair(0x300,27));
00067 m_blockLength.insert(make_pair(0x301,3));
00068 m_blockLength.insert(make_pair(0x303,6));
00069 m_blockLength.insert(make_pair(0x305,2));
00070 m_blockLength.insert(make_pair(0x306,32));
00071 m_blockLength.insert(make_pair(0x307,4));
00072
00073 m_blockLength.insert(make_pair(0x380,21));
00074 m_blockLength.insert(make_pair(0x381,6));
00075 m_blockLength.insert(make_pair(0x383,7));
00076 m_blockLength.insert(make_pair(0x385,2));
00077 m_blockLength.insert(make_pair(0x386,32));
00078 m_blockLength.insert(make_pair(0x387,6));
00079
00080 m_blockLength.insert(make_pair(0x700,27));
00081 m_blockLength.insert(make_pair(0x701,3));
00082 m_blockLength.insert(make_pair(0x703,6));
00083 m_blockLength.insert(make_pair(0x705,2));
00084 m_blockLength.insert(make_pair(0x706,32));
00085 m_blockLength.insert(make_pair(0x707,4));
00086
00087 m_blockLength.insert(make_pair(0x780,21));
00088 m_blockLength.insert(make_pair(0x781,6));
00089 m_blockLength.insert(make_pair(0x783,7));
00090 m_blockLength.insert(make_pair(0x785,2));
00091 m_blockLength.insert(make_pair(0x786,32));
00092 m_blockLength.insert(make_pair(0x787,6));
00093
00094 m_blockLength.insert(make_pair(0x900,13));
00095 m_blockLength.insert(make_pair(0x901,3));
00096 m_blockLength.insert(make_pair(0x902,3));
00097 m_blockLength.insert(make_pair(0x903,10));
00098 m_blockLength.insert(make_pair(0x904,8));
00099 m_blockLength.insert(make_pair(0x908,13));
00100 m_blockLength.insert(make_pair(0x909,3));
00101 m_blockLength.insert(make_pair(0x90a,3));
00102 m_blockLength.insert(make_pair(0x90b,10));
00103 m_blockLength.insert(make_pair(0x90c,8));
00104 m_blockLength.insert(make_pair(0x980,6));
00105 m_blockLength.insert(make_pair(0x984,6));
00106 m_blockLength.insert(make_pair(0x988,13));
00107 m_blockLength.insert(make_pair(0x989,3));
00108 m_blockLength.insert(make_pair(0x98a,3));
00109 m_blockLength.insert(make_pair(0x98b,10));
00110 m_blockLength.insert(make_pair(0x98c,8));
00111 m_blockLength.insert(make_pair(0xa00,13));
00112 m_blockLength.insert(make_pair(0xa01,3));
00113 m_blockLength.insert(make_pair(0xa02,3));
00114 m_blockLength.insert(make_pair(0xa03,10));
00115 m_blockLength.insert(make_pair(0xa04,8));
00116 m_blockLength.insert(make_pair(0xa08,13));
00117 m_blockLength.insert(make_pair(0xa09,3));
00118 m_blockLength.insert(make_pair(0xa0a,3));
00119 m_blockLength.insert(make_pair(0xa0b,10));
00120 m_blockLength.insert(make_pair(0xa0c,8));
00121 m_blockLength.insert(make_pair(0xa80,6));
00122 m_blockLength.insert(make_pair(0xa84,6));
00123 m_blockLength.insert(make_pair(0xa88,13));
00124 m_blockLength.insert(make_pair(0xa89,3));
00125 m_blockLength.insert(make_pair(0xa8a,3));
00126 m_blockLength.insert(make_pair(0xa8b,10));
00127 m_blockLength.insert(make_pair(0xa8c,8));
00128 m_blockLength.insert(make_pair(0xb00,13));
00129 m_blockLength.insert(make_pair(0xb01,3));
00130 m_blockLength.insert(make_pair(0xb02,3));
00131 m_blockLength.insert(make_pair(0xb03,10));
00132 m_blockLength.insert(make_pair(0xb04,8));
00133 m_blockLength.insert(make_pair(0xb08,13));
00134 m_blockLength.insert(make_pair(0xb09,3));
00135 m_blockLength.insert(make_pair(0xb0a,3));
00136 m_blockLength.insert(make_pair(0xb0b,10));
00137 m_blockLength.insert(make_pair(0xb0c,8));
00138 m_blockLength.insert(make_pair(0xb80,6));
00139 m_blockLength.insert(make_pair(0xb84,6));
00140 m_blockLength.insert(make_pair(0xb88,13));
00141 m_blockLength.insert(make_pair(0xb89,3));
00142 m_blockLength.insert(make_pair(0xb8a,3));
00143 m_blockLength.insert(make_pair(0xb8b,10));
00144 m_blockLength.insert(make_pair(0xb8c,8));
00145
00146 m_blockLength.insert(make_pair(0xd00,13));
00147 m_blockLength.insert(make_pair(0xd01,3));
00148 m_blockLength.insert(make_pair(0xd02,3));
00149 m_blockLength.insert(make_pair(0xd03,10));
00150 m_blockLength.insert(make_pair(0xd04,8));
00151 m_blockLength.insert(make_pair(0xd08,13));
00152 m_blockLength.insert(make_pair(0xd09,3));
00153 m_blockLength.insert(make_pair(0xd0a,3));
00154 m_blockLength.insert(make_pair(0xd0b,10));
00155 m_blockLength.insert(make_pair(0xd0c,8));
00156 m_blockLength.insert(make_pair(0xd80,6));
00157 m_blockLength.insert(make_pair(0xd84,6));
00158 m_blockLength.insert(make_pair(0xd88,13));
00159 m_blockLength.insert(make_pair(0xd89,3));
00160 m_blockLength.insert(make_pair(0xd8a,3));
00161 m_blockLength.insert(make_pair(0xd8b,10));
00162 m_blockLength.insert(make_pair(0xd8c,8));
00163 m_blockLength.insert(make_pair(0xe00,13));
00164 m_blockLength.insert(make_pair(0xe01,3));
00165 m_blockLength.insert(make_pair(0xe02,3));
00166 m_blockLength.insert(make_pair(0xe03,10));
00167 m_blockLength.insert(make_pair(0xe04,8));
00168 m_blockLength.insert(make_pair(0xe08,13));
00169 m_blockLength.insert(make_pair(0xe09,3));
00170 m_blockLength.insert(make_pair(0xe0a,3));
00171 m_blockLength.insert(make_pair(0xe0b,10));
00172 m_blockLength.insert(make_pair(0xe0c,8));
00173 m_blockLength.insert(make_pair(0xe80,6));
00174 m_blockLength.insert(make_pair(0xe84,6));
00175 m_blockLength.insert(make_pair(0xe88,13));
00176 m_blockLength.insert(make_pair(0xe89,3));
00177 m_blockLength.insert(make_pair(0xe8a,3));
00178 m_blockLength.insert(make_pair(0xe8b,10));
00179 m_blockLength.insert(make_pair(0xe8c,8));
00180 m_blockLength.insert(make_pair(0xf00,13));
00181 m_blockLength.insert(make_pair(0xf01,3));
00182 m_blockLength.insert(make_pair(0xf02,3));
00183 m_blockLength.insert(make_pair(0xf03,10));
00184 m_blockLength.insert(make_pair(0xf04,8));
00185 m_blockLength.insert(make_pair(0xf08,13));
00186 m_blockLength.insert(make_pair(0xf09,3));
00187 m_blockLength.insert(make_pair(0xf0a,3));
00188 m_blockLength.insert(make_pair(0xf0b,10));
00189 m_blockLength.insert(make_pair(0xf0c,8));
00190 m_blockLength.insert(make_pair(0xf80,6));
00191 m_blockLength.insert(make_pair(0xf84,6));
00192 m_blockLength.insert(make_pair(0xf88,13));
00193 m_blockLength.insert(make_pair(0xf89,3));
00194 m_blockLength.insert(make_pair(0xf8a,3));
00195 m_blockLength.insert(make_pair(0xf8b,10));
00196 m_blockLength.insert(make_pair(0xf8c,8));
00197
00198
00199
00200
00201 m_blockName.insert(make_pair(0x000,"NULL"));
00202
00203 m_blockName.insert(make_pair(0x580,"ConcJet: Input TrigPathA (Jet Cands)"));
00204 m_blockName.insert(make_pair(0x581,"ConcJet: Input TrigPathB (HF Rings)"));
00205 m_blockName.insert(make_pair(0x582,"ConcJet: Input TrigPathC (MissHt)"));
00206 m_blockName.insert(make_pair(0x583,"ConcJet: Jet Cands and Counts Output to GT"));
00207 m_blockName.insert(make_pair(0x587,"ConcJet: BX & Orbit Info"));
00208
00209 m_blockName.insert(make_pair(0x680,"ConcElec: Input TrigPathA (EM Cands)"));
00210 m_blockName.insert(make_pair(0x681,"ConcElec: Input TrigPathB (Et Sums)"));
00211 m_blockName.insert(make_pair(0x682,"ConcElec: Input TrigPathC (Ht Sums)"));
00212 m_blockName.insert(make_pair(0x683,"ConcElec: EM Cands and Energy Sums Output to GT"));
00213 m_blockName.insert(make_pair(0x686,"ConcElec: Test (GT Serdes Loopback)"));
00214 m_blockName.insert(make_pair(0x687,"ConcElec: BX & Orbit Info"));
00215
00216 m_blockName.insert(make_pair(0x800,"Leaf0ElecPosEtaU1: Sort Input"));
00217 m_blockName.insert(make_pair(0x803,"Leaf0ElecPosEtaU1: Sort Output"));
00218 m_blockName.insert(make_pair(0x804,"Leaf0ElecPosEtaU1: Raw Input"));
00219 m_blockName.insert(make_pair(0x880,"Leaf0ElecPosEtaU2: Sort Input"));
00220 m_blockName.insert(make_pair(0x883,"Leaf0ElecPosEtaU2: Sort Output"));
00221 m_blockName.insert(make_pair(0x884,"Leaf0ElecPosEtaU2: Raw Input"));
00222 m_blockName.insert(make_pair(0xc00,"Leaf0ElecNegEtaU1: Sort Input"));
00223 m_blockName.insert(make_pair(0xc03,"Leaf0ElecNegEtaU1: Sort Output"));
00224 m_blockName.insert(make_pair(0xc04,"Leaf0ElecNegEtaU1: Raw Input"));
00225 m_blockName.insert(make_pair(0xc80,"Leaf0ElecNegEtaU2: Sort Input"));
00226 m_blockName.insert(make_pair(0xc83,"Leaf0ElecNegEtaU2: Sort Output"));
00227 m_blockName.insert(make_pair(0xc84,"Leaf0ElecNegEtaU2: Raw Input"));
00228
00229 m_blockName.insert(make_pair(0x300,"WheelPosEtaJet: Input TrigPathA (Jet Sort)"));
00230 m_blockName.insert(make_pair(0x301,"WheelPosEtaJet: Input TrigPathB (MissHt)"));
00231 m_blockName.insert(make_pair(0x303,"WheelPosEtaJet: Output TrigPathA (Jet Sort)"));
00232 m_blockName.insert(make_pair(0x305,"WheelPosEtaJet: Output TrigPathB (MissHt)"));
00233 m_blockName.insert(make_pair(0x306,"WheelPosEtaJet: Test (deprecated)"));
00234 m_blockName.insert(make_pair(0x307,"WheelPosEtaJet: Info (deprecated)"));
00235
00236 m_blockName.insert(make_pair(0x380,"WheelPosEtaEnergy: Input TrigPathA (Et)"));
00237 m_blockName.insert(make_pair(0x381,"WheelPosEtaEnergy: Input TrigPathB (Ht)"));
00238 m_blockName.insert(make_pair(0x383,"WheelPosEtaEnergy: Output TrigPathA (Et)"));
00239 m_blockName.insert(make_pair(0x385,"WheelPosEtaEnergy: Output TrigPathB (Ht)"));
00240 m_blockName.insert(make_pair(0x386,"WheelPosEtaEnergy: Test"));
00241 m_blockName.insert(make_pair(0x387,"WheelPosEtaEnergy: BX & Orbit Info"));
00242
00243 m_blockName.insert(make_pair(0x700,"WheelNegEtaJet: Input TrigPathA (Jet Sort)"));
00244 m_blockName.insert(make_pair(0x701,"WheelNegEtaJet: Input TrigPathB (MissHt)"));
00245 m_blockName.insert(make_pair(0x703,"WheelNegEtaJet: Output TrigPathA (Jet Sort)"));
00246 m_blockName.insert(make_pair(0x705,"WheelNegEtaJet: Output TrigPathB (MissHt)"));
00247 m_blockName.insert(make_pair(0x706,"WheelNegEtaJet: Test (deprecated)"));
00248 m_blockName.insert(make_pair(0x707,"WheelNegEtaJet: Info (deprecated)"));
00249
00250 m_blockName.insert(make_pair(0x780,"WheelNegEtaEnergy: Input TrigPathA (Et)"));
00251 m_blockName.insert(make_pair(0x781,"WheelNegEtaEnergy: Input TrigPathB (Ht)"));
00252 m_blockName.insert(make_pair(0x783,"WheelNegEtaEnergy: Output TrigPathA (Et)"));
00253 m_blockName.insert(make_pair(0x785,"WheelNegEtaEnergy: Output TrigPathB (Ht)"));
00254 m_blockName.insert(make_pair(0x786,"WheelNegEtaEnergy: Test"));
00255 m_blockName.insert(make_pair(0x787,"WheelNegEtaEnergy: BX & Orbit Info"));
00256
00257 m_blockName.insert(make_pair(0x900,"Leaf1JetPosEtaU1: JF2 Input"));
00258 m_blockName.insert(make_pair(0x901,"Leaf1JetPosEtaU1: JF2 Shared Received"));
00259 m_blockName.insert(make_pair(0x902,"Leaf1JetPosEtaU1: JF2 Shared Sent"));
00260 m_blockName.insert(make_pair(0x903,"Leaf1JetPosEtaU1: JF2 Output"));
00261 m_blockName.insert(make_pair(0x904,"Leaf1JetPosEtaU1: JF2 Raw Input"));
00262 m_blockName.insert(make_pair(0x908,"Leaf1JetPosEtaU1: JF3 Input"));
00263 m_blockName.insert(make_pair(0x909,"Leaf1JetPosEtaU1: JF3 Shared Received"));
00264 m_blockName.insert(make_pair(0x90a,"Leaf1JetPosEtaU1: JF3 Shared Sent"));
00265 m_blockName.insert(make_pair(0x90b,"Leaf1JetPosEtaU1: JF3 Output"));
00266 m_blockName.insert(make_pair(0x90c,"Leaf1JetPosEtaU1: JF3 Raw Input"));
00267 m_blockName.insert(make_pair(0x980,"Leaf1JetPosEtaU2: Eta0 Input"));
00268 m_blockName.insert(make_pair(0x984,"Leaf1JetPosEtaU2: Eta0 Raw Input"));
00269 m_blockName.insert(make_pair(0x988,"Leaf1JetPosEtaU2: JF1 Input"));
00270 m_blockName.insert(make_pair(0x989,"Leaf1JetPosEtaU2: JF1 Shared Received"));
00271 m_blockName.insert(make_pair(0x98a,"Leaf1JetPosEtaU2: JF1 Shared Sent"));
00272 m_blockName.insert(make_pair(0x98b,"Leaf1JetPosEtaU2: JF1 Output"));
00273 m_blockName.insert(make_pair(0x98c,"Leaf1JetPosEtaU2: JF1 Raw Input"));
00274 m_blockName.insert(make_pair(0xa00,"Leaf2JetPosEtaU1: JF2 Input"));
00275 m_blockName.insert(make_pair(0xa01,"Leaf2JetPosEtaU1: JF2 Shared Received"));
00276 m_blockName.insert(make_pair(0xa02,"Leaf2JetPosEtaU1: JF2 Shared Sent"));
00277 m_blockName.insert(make_pair(0xa03,"Leaf2JetPosEtaU1: JF2 Output"));
00278 m_blockName.insert(make_pair(0xa04,"Leaf2JetPosEtaU1: JF2 Raw Input"));
00279 m_blockName.insert(make_pair(0xa08,"Leaf2JetPosEtaU1: JF3 Input"));
00280 m_blockName.insert(make_pair(0xa09,"Leaf2JetPosEtaU1: JF3 Shared Received"));
00281 m_blockName.insert(make_pair(0xa0a,"Leaf2JetPosEtaU1: JF3 Shared Sent"));
00282 m_blockName.insert(make_pair(0xa0b,"Leaf2JetPosEtaU1: JF3 Output"));
00283 m_blockName.insert(make_pair(0xa0c,"Leaf2JetPosEtaU1: JF3 Raw Input"));
00284 m_blockName.insert(make_pair(0xa80,"Leaf2JetPosEtaU2: Eta0 Input"));
00285 m_blockName.insert(make_pair(0xa84,"Leaf2JetPosEtaU2: Eta0 Raw Input"));
00286 m_blockName.insert(make_pair(0xa88,"Leaf2JetPosEtaU2: JF1 Input"));
00287 m_blockName.insert(make_pair(0xa89,"Leaf2JetPosEtaU2: JF1 Shared Received"));
00288 m_blockName.insert(make_pair(0xa8a,"Leaf2JetPosEtaU2: JF1 Shared Sent"));
00289 m_blockName.insert(make_pair(0xa8b,"Leaf2JetPosEtaU2: JF1 Output"));
00290 m_blockName.insert(make_pair(0xa8c,"Leaf2JetPosEtaU2: JF1 Raw Input"));
00291 m_blockName.insert(make_pair(0xb00,"Leaf3JetPosEtaU1: JF2 Input"));
00292 m_blockName.insert(make_pair(0xb01,"Leaf3JetPosEtaU1: JF2 Shared Received"));
00293 m_blockName.insert(make_pair(0xb02,"Leaf3JetPosEtaU1: JF2 Shared Sent"));
00294 m_blockName.insert(make_pair(0xb03,"Leaf3JetPosEtaU1: JF2 Output"));
00295 m_blockName.insert(make_pair(0xb04,"Leaf3JetPosEtaU1: JF2 Raw Input"));
00296 m_blockName.insert(make_pair(0xb08,"Leaf3JetPosEtaU1: JF3 Input"));
00297 m_blockName.insert(make_pair(0xb09,"Leaf3JetPosEtaU1: JF3 Shared Received"));
00298 m_blockName.insert(make_pair(0xb0a,"Leaf3JetPosEtaU1: JF3 Shared Sent"));
00299 m_blockName.insert(make_pair(0xb0b,"Leaf3JetPosEtaU1: JF3 Output"));
00300 m_blockName.insert(make_pair(0xb0c,"Leaf3JetPosEtaU1: JF3 Raw Input"));
00301 m_blockName.insert(make_pair(0xb80,"Leaf3JetPosEtaU2: Eta0 Input"));
00302 m_blockName.insert(make_pair(0xb84,"Leaf3JetPosEtaU2: Eta0 Raw Input"));
00303 m_blockName.insert(make_pair(0xb88,"Leaf3JetPosEtaU2: JF1 Input"));
00304 m_blockName.insert(make_pair(0xb89,"Leaf3JetPosEtaU2: JF1 Shared Received"));
00305 m_blockName.insert(make_pair(0xb8a,"Leaf3JetPosEtaU2: JF1 Shared Sent"));
00306 m_blockName.insert(make_pair(0xb8b,"Leaf3JetPosEtaU2: JF1 Output"));
00307 m_blockName.insert(make_pair(0xb8c,"Leaf3JetPosEtaU2: JF1 Raw Input"));
00308
00309 m_blockName.insert(make_pair(0xd00,"Leaf1JetNegEtaU1: JF2 Input"));
00310 m_blockName.insert(make_pair(0xd01,"Leaf1JetNegEtaU1: JF2 Shared Received"));
00311 m_blockName.insert(make_pair(0xd02,"Leaf1JetNegEtaU1: JF2 Shared Sent"));
00312 m_blockName.insert(make_pair(0xd03,"Leaf1JetNegEtaU1: JF2 Output"));
00313 m_blockName.insert(make_pair(0xd04,"Leaf1JetNegEtaU1: JF2 Raw Input"));
00314 m_blockName.insert(make_pair(0xd08,"Leaf1JetNegEtaU1: JF3 Input"));
00315 m_blockName.insert(make_pair(0xd09,"Leaf1JetNegEtaU1: JF3 Shared Received"));
00316 m_blockName.insert(make_pair(0xd0a,"Leaf1JetNegEtaU1: JF3 Shared Sent"));
00317 m_blockName.insert(make_pair(0xd0b,"Leaf1JetNegEtaU1: JF3 Output"));
00318 m_blockName.insert(make_pair(0xd0c,"Leaf1JetNegEtaU1: JF3 Raw Input"));
00319 m_blockName.insert(make_pair(0xd80,"Leaf1JetNegEtaU2: Eta0 Input"));
00320 m_blockName.insert(make_pair(0xd84,"Leaf1JetNegEtaU2: Eta0 Raw Input"));
00321 m_blockName.insert(make_pair(0xd88,"Leaf1JetNegEtaU2: JF1 Input"));
00322 m_blockName.insert(make_pair(0xd89,"Leaf1JetNegEtaU2: JF1 Shared Received"));
00323 m_blockName.insert(make_pair(0xd8a,"Leaf1JetNegEtaU2: JF1 Shared Sent"));
00324 m_blockName.insert(make_pair(0xd8b,"Leaf1JetNegEtaU2: JF1 Output"));
00325 m_blockName.insert(make_pair(0xd8c,"Leaf1JetNegEtaU2: JF1 Raw Input"));
00326 m_blockName.insert(make_pair(0xe00,"Leaf2JetNegEtaU1: JF2 Input"));
00327 m_blockName.insert(make_pair(0xe01,"Leaf2JetNegEtaU1: JF2 Shared Received"));
00328 m_blockName.insert(make_pair(0xe02,"Leaf2JetNegEtaU1: JF2 Shared Sent"));
00329 m_blockName.insert(make_pair(0xe03,"Leaf2JetNegEtaU1: JF2 Output"));
00330 m_blockName.insert(make_pair(0xe04,"Leaf2JetNegEtaU1: JF2 Raw Input"));
00331 m_blockName.insert(make_pair(0xe08,"Leaf2JetNegEtaU1: JF3 Input"));
00332 m_blockName.insert(make_pair(0xe09,"Leaf2JetNegEtaU1: JF3 Shared Received"));
00333 m_blockName.insert(make_pair(0xe0a,"Leaf2JetNegEtaU1: JF3 Shared Sent"));
00334 m_blockName.insert(make_pair(0xe0b,"Leaf2JetNegEtaU1: JF3 Output"));
00335 m_blockName.insert(make_pair(0xe0c,"Leaf2JetNegEtaU1: JF3 Raw Input"));
00336 m_blockName.insert(make_pair(0xe80,"Leaf2JetNegEtaU2: Eta0 Input"));
00337 m_blockName.insert(make_pair(0xe84,"Leaf2JetNegEtaU2: Eta0 Raw Input"));
00338 m_blockName.insert(make_pair(0xe88,"Leaf2JetNegEtaU2: JF1 Input"));
00339 m_blockName.insert(make_pair(0xe89,"Leaf2JetNegEtaU2: JF1 Shared Received"));
00340 m_blockName.insert(make_pair(0xe8a,"Leaf2JetNegEtaU2: JF1 Shared Sent"));
00341 m_blockName.insert(make_pair(0xe8b,"Leaf2JetNegEtaU2: JF1 Output"));
00342 m_blockName.insert(make_pair(0xe8c,"Leaf2JetNegEtaU2: JF1 Raw Input"));
00343 m_blockName.insert(make_pair(0xf00,"Leaf3JetNegEtaU1: JF2 Input"));
00344 m_blockName.insert(make_pair(0xf01,"Leaf3JetNegEtaU1: JF2 Shared Received"));
00345 m_blockName.insert(make_pair(0xf02,"Leaf3JetNegEtaU1: JF2 Shared Sent"));
00346 m_blockName.insert(make_pair(0xf03,"Leaf3JetNegEtaU1: JF2 Output"));
00347 m_blockName.insert(make_pair(0xf04,"Leaf3JetNegEtaU1: JF2 Raw Input"));
00348 m_blockName.insert(make_pair(0xf08,"Leaf3JetNegEtaU1: JF3 Input"));
00349 m_blockName.insert(make_pair(0xf09,"Leaf3JetNegEtaU1: JF3 Shared Received"));
00350 m_blockName.insert(make_pair(0xf0a,"Leaf3JetNegEtaU1: JF3 Shared Sent"));
00351 m_blockName.insert(make_pair(0xf0b,"Leaf3JetNegEtaU1: JF3 Output"));
00352 m_blockName.insert(make_pair(0xf0c,"Leaf3JetNegEtaU1: JF3 Raw Input"));
00353 m_blockName.insert(make_pair(0xf80,"Leaf3JetNegEtaU2: Eta0 Input"));
00354 m_blockName.insert(make_pair(0xf84,"Leaf3JetNegEtaU2: Eta0 Raw Input"));
00355 m_blockName.insert(make_pair(0xf88,"Leaf3JetNegEtaU2: JF1 Input"));
00356 m_blockName.insert(make_pair(0xf89,"Leaf3JetNegEtaU2: JF1 Shared Received"));
00357 m_blockName.insert(make_pair(0xf8a,"Leaf3JetNegEtaU2: JF1 Shared Sent"));
00358 m_blockName.insert(make_pair(0xf8b,"Leaf3JetNegEtaU2: JF1 Output"));
00359 m_blockName.insert(make_pair(0xf8c,"Leaf3JetNegEtaU2: JF1 Raw Input"));
00360
00361
00362
00363
00364 m_blockUnpackFn[0x000] = &GctFormatTranslateV38::blockDoNothing;
00365
00366 m_blockUnpackFn[0x580] = &GctFormatTranslateV38::blockToGctTrigObjects;
00367 m_blockUnpackFn[0x581] = &GctFormatTranslateV38::blockDoNothing;
00368 m_blockUnpackFn[0x582] = &GctFormatTranslateV38::blockDoNothing;
00369 m_blockUnpackFn[0x583] = &GctFormatTranslateV38::blockToGctJetCandsAndCounts;
00370 m_blockUnpackFn[0x587] = &GctFormatTranslateV38::blockDoNothing;
00371
00372 m_blockUnpackFn[0x680] = &GctFormatTranslateV38::blockToGctInternEmCand;
00373 m_blockUnpackFn[0x681] = &GctFormatTranslateV38::blockDoNothing;
00374 m_blockUnpackFn[0x682] = &GctFormatTranslateV38::blockDoNothing;
00375 m_blockUnpackFn[0x683] = &GctFormatTranslateV38::blockToGctEmCandsAndEnergySums;
00376 m_blockUnpackFn[0x686] = &GctFormatTranslateV38::blockDoNothing;
00377 m_blockUnpackFn[0x687] = &GctFormatTranslateV38::blockDoNothing;
00378
00379 m_blockUnpackFn[0x800] = &GctFormatTranslateV38::blockToGctInternEmCand;
00380 m_blockUnpackFn[0x803] = &GctFormatTranslateV38::blockToGctInternEmCand;
00381 m_blockUnpackFn[0x804] = &GctFormatTranslateV38::blockToFibresAndToRctEmCand;
00382 m_blockUnpackFn[0x880] = &GctFormatTranslateV38::blockToGctInternEmCand;
00383 m_blockUnpackFn[0x883] = &GctFormatTranslateV38::blockToGctInternEmCand;
00384 m_blockUnpackFn[0x884] = &GctFormatTranslateV38::blockToFibresAndToRctEmCand;
00385 m_blockUnpackFn[0xc00] = &GctFormatTranslateV38::blockToGctInternEmCand;
00386 m_blockUnpackFn[0xc03] = &GctFormatTranslateV38::blockToGctInternEmCand;
00387 m_blockUnpackFn[0xc04] = &GctFormatTranslateV38::blockToFibresAndToRctEmCand;
00388 m_blockUnpackFn[0xc80] = &GctFormatTranslateV38::blockToGctInternEmCand;
00389 m_blockUnpackFn[0xc83] = &GctFormatTranslateV38::blockToGctInternEmCand;
00390 m_blockUnpackFn[0xc84] = &GctFormatTranslateV38::blockToFibresAndToRctEmCand;
00391
00392 m_blockUnpackFn[0x300] = &GctFormatTranslateV38::blockToGctJetClusterMinimal;
00393 m_blockUnpackFn[0x301] = &GctFormatTranslateV38::blockDoNothing;
00394 m_blockUnpackFn[0x303] = &GctFormatTranslateV38::blockToGctTrigObjects;
00395 m_blockUnpackFn[0x305] = &GctFormatTranslateV38::blockDoNothing;
00396 m_blockUnpackFn[0x306] = &GctFormatTranslateV38::blockDoNothing;
00397 m_blockUnpackFn[0x307] = &GctFormatTranslateV38::blockDoNothing;
00398
00399 m_blockUnpackFn[0x380] = &GctFormatTranslateV38::blockDoNothing;
00400 m_blockUnpackFn[0x381] = &GctFormatTranslateV38::blockDoNothing;
00401 m_blockUnpackFn[0x383] = &GctFormatTranslateV38::blockDoNothing;
00402 m_blockUnpackFn[0x385] = &GctFormatTranslateV38::blockDoNothing;
00403 m_blockUnpackFn[0x386] = &GctFormatTranslateV38::blockDoNothing;
00404 m_blockUnpackFn[0x387] = &GctFormatTranslateV38::blockDoNothing;
00405
00406 m_blockUnpackFn[0x700] = &GctFormatTranslateV38::blockToGctJetClusterMinimal;
00407 m_blockUnpackFn[0x701] = &GctFormatTranslateV38::blockDoNothing;
00408 m_blockUnpackFn[0x703] = &GctFormatTranslateV38::blockToGctTrigObjects;
00409 m_blockUnpackFn[0x705] = &GctFormatTranslateV38::blockDoNothing;
00410 m_blockUnpackFn[0x706] = &GctFormatTranslateV38::blockDoNothing;
00411 m_blockUnpackFn[0x707] = &GctFormatTranslateV38::blockDoNothing;
00412
00413 m_blockUnpackFn[0x780] = &GctFormatTranslateV38::blockDoNothing;
00414 m_blockUnpackFn[0x781] = &GctFormatTranslateV38::blockDoNothing;
00415 m_blockUnpackFn[0x783] = &GctFormatTranslateV38::blockDoNothing;
00416 m_blockUnpackFn[0x785] = &GctFormatTranslateV38::blockDoNothing;
00417 m_blockUnpackFn[0x786] = &GctFormatTranslateV38::blockDoNothing;
00418 m_blockUnpackFn[0x787] = &GctFormatTranslateV38::blockDoNothing;
00419
00420 m_blockUnpackFn[0x900] = &GctFormatTranslateV38::blockToRctCaloRegions;
00421 m_blockUnpackFn[0x901] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00422 m_blockUnpackFn[0x902] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00423 m_blockUnpackFn[0x903] = &GctFormatTranslateV38::blockDoNothing;
00424 m_blockUnpackFn[0x904] = &GctFormatTranslateV38::blockToFibres;
00425 m_blockUnpackFn[0x908] = &GctFormatTranslateV38::blockToRctCaloRegions;
00426 m_blockUnpackFn[0x909] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00427 m_blockUnpackFn[0x90a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00428 m_blockUnpackFn[0x90b] = &GctFormatTranslateV38::blockDoNothing;
00429 m_blockUnpackFn[0x90c] = &GctFormatTranslateV38::blockToFibres;
00430 m_blockUnpackFn[0x980] = &GctFormatTranslateV38::blockDoNothing;
00431 m_blockUnpackFn[0x984] = &GctFormatTranslateV38::blockToFibres;
00432 m_blockUnpackFn[0x988] = &GctFormatTranslateV38::blockToRctCaloRegions;
00433 m_blockUnpackFn[0x989] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00434 m_blockUnpackFn[0x98a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00435 m_blockUnpackFn[0x98b] = &GctFormatTranslateV38::blockDoNothing;
00436 m_blockUnpackFn[0x98c] = &GctFormatTranslateV38::blockToFibres;
00437 m_blockUnpackFn[0xa00] = &GctFormatTranslateV38::blockToRctCaloRegions;
00438 m_blockUnpackFn[0xa01] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00439 m_blockUnpackFn[0xa02] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00440 m_blockUnpackFn[0xa03] = &GctFormatTranslateV38::blockDoNothing;
00441 m_blockUnpackFn[0xa04] = &GctFormatTranslateV38::blockToFibres;
00442 m_blockUnpackFn[0xa08] = &GctFormatTranslateV38::blockToRctCaloRegions;
00443 m_blockUnpackFn[0xa09] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00444 m_blockUnpackFn[0xa0a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00445 m_blockUnpackFn[0xa0b] = &GctFormatTranslateV38::blockDoNothing;
00446 m_blockUnpackFn[0xa0c] = &GctFormatTranslateV38::blockToFibres;
00447 m_blockUnpackFn[0xa80] = &GctFormatTranslateV38::blockDoNothing;
00448 m_blockUnpackFn[0xa84] = &GctFormatTranslateV38::blockToFibres;
00449 m_blockUnpackFn[0xa88] = &GctFormatTranslateV38::blockToRctCaloRegions;
00450 m_blockUnpackFn[0xa89] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00451 m_blockUnpackFn[0xa8a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00452 m_blockUnpackFn[0xa8b] = &GctFormatTranslateV38::blockDoNothing;
00453 m_blockUnpackFn[0xa8c] = &GctFormatTranslateV38::blockToFibres;
00454 m_blockUnpackFn[0xb00] = &GctFormatTranslateV38::blockToRctCaloRegions;
00455 m_blockUnpackFn[0xb01] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00456 m_blockUnpackFn[0xb02] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00457 m_blockUnpackFn[0xb03] = &GctFormatTranslateV38::blockDoNothing;
00458 m_blockUnpackFn[0xb04] = &GctFormatTranslateV38::blockToFibres;
00459 m_blockUnpackFn[0xb08] = &GctFormatTranslateV38::blockToRctCaloRegions;
00460 m_blockUnpackFn[0xb09] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00461 m_blockUnpackFn[0xb0a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00462 m_blockUnpackFn[0xb0b] = &GctFormatTranslateV38::blockDoNothing;
00463 m_blockUnpackFn[0xb0c] = &GctFormatTranslateV38::blockToFibres;
00464 m_blockUnpackFn[0xb80] = &GctFormatTranslateV38::blockDoNothing;
00465 m_blockUnpackFn[0xb84] = &GctFormatTranslateV38::blockToFibres;
00466 m_blockUnpackFn[0xb88] = &GctFormatTranslateV38::blockToRctCaloRegions;
00467 m_blockUnpackFn[0xb89] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00468 m_blockUnpackFn[0xb8a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00469 m_blockUnpackFn[0xb8b] = &GctFormatTranslateV38::blockDoNothing;
00470 m_blockUnpackFn[0xb8c] = &GctFormatTranslateV38::blockToFibres;
00471
00472 m_blockUnpackFn[0xd00] = &GctFormatTranslateV38::blockToRctCaloRegions;
00473 m_blockUnpackFn[0xd01] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00474 m_blockUnpackFn[0xd02] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00475 m_blockUnpackFn[0xd03] = &GctFormatTranslateV38::blockDoNothing;
00476 m_blockUnpackFn[0xd04] = &GctFormatTranslateV38::blockToFibres;
00477 m_blockUnpackFn[0xd08] = &GctFormatTranslateV38::blockToRctCaloRegions;
00478 m_blockUnpackFn[0xd09] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00479 m_blockUnpackFn[0xd0a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00480 m_blockUnpackFn[0xd0b] = &GctFormatTranslateV38::blockDoNothing;
00481 m_blockUnpackFn[0xd0c] = &GctFormatTranslateV38::blockToFibres;
00482 m_blockUnpackFn[0xd80] = &GctFormatTranslateV38::blockDoNothing;
00483 m_blockUnpackFn[0xd84] = &GctFormatTranslateV38::blockToFibres;
00484 m_blockUnpackFn[0xd88] = &GctFormatTranslateV38::blockToRctCaloRegions;
00485 m_blockUnpackFn[0xd89] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00486 m_blockUnpackFn[0xd8a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00487 m_blockUnpackFn[0xd8b] = &GctFormatTranslateV38::blockDoNothing;
00488 m_blockUnpackFn[0xd8c] = &GctFormatTranslateV38::blockToFibres;
00489 m_blockUnpackFn[0xe00] = &GctFormatTranslateV38::blockToRctCaloRegions;
00490 m_blockUnpackFn[0xe01] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00491 m_blockUnpackFn[0xe02] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00492 m_blockUnpackFn[0xe03] = &GctFormatTranslateV38::blockDoNothing;
00493 m_blockUnpackFn[0xe04] = &GctFormatTranslateV38::blockToFibres;
00494 m_blockUnpackFn[0xe08] = &GctFormatTranslateV38::blockToRctCaloRegions;
00495 m_blockUnpackFn[0xe09] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00496 m_blockUnpackFn[0xe0a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00497 m_blockUnpackFn[0xe0b] = &GctFormatTranslateV38::blockDoNothing;
00498 m_blockUnpackFn[0xe0c] = &GctFormatTranslateV38::blockToFibres;
00499 m_blockUnpackFn[0xe80] = &GctFormatTranslateV38::blockDoNothing;
00500 m_blockUnpackFn[0xe84] = &GctFormatTranslateV38::blockToFibres;
00501 m_blockUnpackFn[0xe88] = &GctFormatTranslateV38::blockToRctCaloRegions;
00502 m_blockUnpackFn[0xe89] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00503 m_blockUnpackFn[0xe8a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00504 m_blockUnpackFn[0xe8b] = &GctFormatTranslateV38::blockDoNothing;
00505 m_blockUnpackFn[0xe8c] = &GctFormatTranslateV38::blockToFibres;
00506 m_blockUnpackFn[0xf00] = &GctFormatTranslateV38::blockToRctCaloRegions;
00507 m_blockUnpackFn[0xf01] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00508 m_blockUnpackFn[0xf02] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00509 m_blockUnpackFn[0xf03] = &GctFormatTranslateV38::blockDoNothing;
00510 m_blockUnpackFn[0xf04] = &GctFormatTranslateV38::blockToFibres;
00511 m_blockUnpackFn[0xf08] = &GctFormatTranslateV38::blockToRctCaloRegions;
00512 m_blockUnpackFn[0xf09] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00513 m_blockUnpackFn[0xf0a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00514 m_blockUnpackFn[0xf0b] = &GctFormatTranslateV38::blockDoNothing;
00515 m_blockUnpackFn[0xf0c] = &GctFormatTranslateV38::blockToFibres;
00516 m_blockUnpackFn[0xf80] = &GctFormatTranslateV38::blockDoNothing;
00517 m_blockUnpackFn[0xf84] = &GctFormatTranslateV38::blockToFibres;
00518 m_blockUnpackFn[0xf88] = &GctFormatTranslateV38::blockToRctCaloRegions;
00519 m_blockUnpackFn[0xf89] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00520 m_blockUnpackFn[0xf8a] = &GctFormatTranslateV38::blockToGctJetPreCluster;
00521 m_blockUnpackFn[0xf8b] = &GctFormatTranslateV38::blockDoNothing;
00522 m_blockUnpackFn[0xf8c] = &GctFormatTranslateV38::blockToFibres;
00523
00524
00525
00526 m_rctEmCrate[0x804] = 13;
00527 m_rctEmCrate[0x884] = 9;
00528 m_rctEmCrate[0xc04] = 4;
00529 m_rctEmCrate[0xc84] = 0;
00530
00531
00532
00533 m_rctJetCrate[0x900] = 9;
00534 m_rctJetCrate[0x908] = 10;
00535 m_rctJetCrate[0x988] = 17;
00536 m_rctJetCrate[0xa00] = 12;
00537 m_rctJetCrate[0xa08] = 13;
00538 m_rctJetCrate[0xa88] = 11;
00539 m_rctJetCrate[0xb00] = 15;
00540 m_rctJetCrate[0xb08] = 16;
00541 m_rctJetCrate[0xb88] = 14;
00542 m_rctJetCrate[0xd00] = 0;
00543 m_rctJetCrate[0xd08] = 1;
00544 m_rctJetCrate[0xd88] = 8;
00545 m_rctJetCrate[0xe00] = 3;
00546 m_rctJetCrate[0xe08] = 4;
00547 m_rctJetCrate[0xe88] = 2;
00548 m_rctJetCrate[0xf00] = 6;
00549 m_rctJetCrate[0xf08] = 7;
00550 m_rctJetCrate[0xf88] = 5;
00551
00552
00553
00554 m_internEmIsoBounds[0x680] = IsoBoundaryPair(8,15);
00555 m_internEmIsoBounds[0x800] = IsoBoundaryPair(0, 9);
00556 m_internEmIsoBounds[0x803] = IsoBoundaryPair(0, 1);
00557 m_internEmIsoBounds[0x880] = IsoBoundaryPair(0, 7);
00558 m_internEmIsoBounds[0x883] = IsoBoundaryPair(0, 1);
00559 m_internEmIsoBounds[0xc00] = IsoBoundaryPair(0, 9);
00560 m_internEmIsoBounds[0xc03] = IsoBoundaryPair(0, 1);
00561 m_internEmIsoBounds[0xc80] = IsoBoundaryPair(0, 7);
00562 m_internEmIsoBounds[0xc83] = IsoBoundaryPair(0, 1);
00563 }
00564 }
00565
00566 GctFormatTranslateV38::~GctFormatTranslateV38()
00567 {
00568 }
00569
00570 GctBlockHeader GctFormatTranslateV38::generateBlockHeader(const unsigned char * data) const
00571 {
00572
00573 uint32_t hdr = data[0] + (data[1]<<8) + (data[2]<<16) + (data[3]<<24);
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585 unsigned blockId = hdr & 0xfff;
00586 unsigned blockLength = 0;
00587 unsigned nSamples = (hdr>>16) & 0xf;
00588 unsigned bxId = (hdr>>20) & 0xfff;
00589 unsigned eventId = (hdr>>12) & 0xf;
00590 bool valid = (blockLengthMap().find(blockId) != blockLengthMap().end());
00591
00592 if(valid) { blockLength = blockLengthMap().find(blockId)->second; }
00593
00594 return GctBlockHeader(blockId, blockLength, nSamples, bxId, eventId, valid);
00595 }
00596
00597
00598 bool GctFormatTranslateV38::convertBlock(const unsigned char * data, const GctBlockHeader& hdr)
00599 {
00600
00601 if ( hdr.nSamples() < 1 ) { return true; }
00602
00603 if(!checkBlock(hdr)) { return false; }
00604
00605
00606
00607
00608 (this->*m_blockUnpackFn.find(hdr.blockId())->second)(data, hdr);
00609
00610 return true;
00611 }
00612
00613
00614
00615
00616 uint32_t GctFormatTranslateV38::generateRawHeader(const uint32_t blockId,
00617 const uint32_t nSamples,
00618 const uint32_t bxId,
00619 const uint32_t eventId) const
00620 {
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631 return ((bxId & 0xfff) << 20) | ((nSamples & 0xf) << 16) | ((eventId & 0xf) << 12) | (blockId & 0xfff);
00632 }
00633
00634
00635
00636
00637
00638 void GctFormatTranslateV38::blockToGctEmCandsAndEnergySums(const unsigned char * d, const GctBlockHeader& hdr)
00639 {
00640 const unsigned int id = hdr.blockId();
00641 const unsigned int nSamples = hdr.nSamples();
00642
00643
00644
00645 const uint16_t * p16 = reinterpret_cast<const uint16_t *>(d);
00646
00647
00648
00649 const unsigned int emCandCategoryOffset = nSamples * 4;
00650 const unsigned int timeSampleOffset = nSamples * 2;
00651
00652 unsigned int samplesToUnpack = 1;
00653 if(!hltMode()) { samplesToUnpack = nSamples; }
00654
00655 for (unsigned int iso=0; iso<2; ++iso)
00656 {
00657 bool isoFlag = (iso==1);
00658
00659
00660 L1GctEmCandCollection* em;
00661 if (isoFlag) { em = colls()->gctIsoEm(); }
00662 else { em = colls()->gctNonIsoEm(); }
00663
00664 for (unsigned int bx=0; bx<samplesToUnpack; ++bx)
00665 {
00666
00667
00668 const unsigned int cand0Offset = iso*emCandCategoryOffset + bx*2;
00669
00670 em->push_back(L1GctEmCand(p16[cand0Offset], isoFlag, id, 0, bx));
00671 em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset], isoFlag, id, 1, bx));
00672 em->push_back(L1GctEmCand(p16[cand0Offset + 1], isoFlag, id, 2, bx));
00673 em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset + 1], isoFlag, id, 3, bx));
00674 }
00675 }
00676
00677 p16 += emCandCategoryOffset * 2;
00678
00679
00680
00681
00682 colls()->gctEtTot()->push_back(L1GctEtTotal(p16[0]));
00683 colls()->gctEtHad()->push_back(L1GctEtHad(p16[1]));
00684
00685
00686 const uint32_t * p32 = reinterpret_cast<const uint32_t *>(p16);
00687
00688 colls()->gctEtMiss()->push_back(L1GctEtMiss(p32[nSamples]));
00689 }
00690
00691 void GctFormatTranslateV38::blockToGctJetCandsAndCounts(const unsigned char * d, const GctBlockHeader& hdr)
00692 {
00693 const unsigned int id = hdr.blockId();
00694 const unsigned int nSamples = hdr.nSamples();
00695
00696
00697
00698 const uint16_t * p16 = reinterpret_cast<const uint16_t *>(d);
00699
00700
00701
00702 const unsigned int jetCandCategoryOffset = nSamples * 4;
00703 const unsigned int timeSampleOffset = nSamples * 2;
00704
00705 unsigned int samplesToUnpack = 1;
00706 if(!hltMode()) { samplesToUnpack = nSamples; }
00707
00708
00709 for(unsigned int iCat = 0 ; iCat < NUM_JET_CATEGORIES ; ++iCat)
00710 {
00711 L1GctJetCandCollection * const jets = gctJets(iCat);
00712 assert(jets->empty());
00713
00714 bool tauflag = (iCat == TAU_JETS);
00715 bool forwardFlag = (iCat == FORWARD_JETS);
00716
00717
00718 for(unsigned int bx = 0 ; bx < samplesToUnpack ; ++bx)
00719 {
00720
00721 const unsigned int cand0Offset = iCat*jetCandCategoryOffset + bx*2;
00722
00723
00724 jets->push_back(L1GctJetCand(p16[cand0Offset], tauflag, forwardFlag, id, 0, bx));
00725
00726 jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag, id, 1, bx));
00727
00728 jets->push_back(L1GctJetCand(p16[cand0Offset + 1], tauflag, forwardFlag, id, 2, bx));
00729
00730 jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag, id, 3, bx));
00731 }
00732 }
00733
00734 p16 += NUM_JET_CATEGORIES * jetCandCategoryOffset;
00735
00736
00737
00738
00739
00740 const uint32_t * p32 = reinterpret_cast<const uint32_t *>(p16);
00741
00742
00743 colls()->gctHfBitCounts()->push_back(L1GctHFBitCounts::fromConcHFBitCounts(id,6,0,p32[0]));
00744 colls()->gctHfRingEtSums()->push_back(L1GctHFRingEtSums::fromConcRingSums(id,6,0,p32[0]));
00745
00746
00747 }
00748
00749
00750 void GctFormatTranslateV38::blockToGctInternEmCand(const unsigned char * d, const GctBlockHeader& hdr)
00751 {
00752
00753 if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal EM Cands"; return; }
00754
00755 unsigned int id = hdr.blockId();
00756 unsigned int nSamples = hdr.nSamples();
00757 unsigned int numCandPairs = hdr.blockLength();
00758
00759
00760 assert(internEmIsoBounds().find(id) != internEmIsoBounds().end());
00761
00762 unsigned int lowerIsoPairBound = internEmIsoBounds()[id].first;
00763 unsigned int upperIsoPairBound = internEmIsoBounds()[id].second;
00764
00765
00766 uint16_t * p = reinterpret_cast<uint16_t *>(const_cast<unsigned char *>(d));
00767
00768
00769 for(unsigned int bx=0; bx < nSamples; ++bx)
00770 {
00771
00772 for(unsigned int candPair = 0 ; candPair < numCandPairs ; ++candPair)
00773 {
00774
00775 bool iso = ((candPair>=lowerIsoPairBound) && (candPair<=upperIsoPairBound));
00776
00777
00778 for(unsigned int i = 0 ; i < 2 ; ++i)
00779 {
00780 unsigned offset = 2*(bx + candPair*nSamples) + i;
00781 uint16_t candRaw = p[offset];
00782 colls()->gctInternEm()->push_back( L1GctInternEmCand(candRaw, iso, id, candPair*2 + i, bx) );
00783 }
00784 }
00785 }
00786 }
00787
00788
00789
00790
00791 void GctFormatTranslateV38::blockToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr)
00792 {
00793
00794 if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of RCT EM Cands"; return; }
00795
00796 unsigned int id = hdr.blockId();
00797 unsigned int nSamples = hdr.nSamples();
00798 unsigned int length = hdr.blockLength();
00799
00800
00801 uint16_t * p = reinterpret_cast<uint16_t *>(const_cast<unsigned char *>(d));
00802
00803
00804 uint16_t sfp[2][4];
00805 uint16_t eIsoRank[4];
00806 uint16_t eIsoCard[4];
00807 uint16_t eIsoRgn[4];
00808 uint16_t eNonIsoRank[4];
00809 uint16_t eNonIsoCard[4];
00810 uint16_t eNonIsoRgn[4];
00811 uint16_t MIPbits[7][2];
00812 uint16_t QBits[7][2];
00813
00814 unsigned int bx = 0;
00815
00816
00817 for (unsigned int crate=rctEmCrateMap()[id]; crate<rctEmCrateMap()[id]+length/3; ++crate) {
00818
00819
00820 for (unsigned short iSfp=0 ; iSfp<4 ; ++iSfp) {
00821 for (unsigned short cyc=0 ; cyc<2 ; ++cyc) {
00822 if (iSfp==0) { sfp[cyc][iSfp] = 0; }
00823 else {
00824 sfp[cyc][iSfp] = *p;
00825 ++p;
00826 }
00827 }
00828 p = p + 2*(nSamples-1);
00829 }
00830
00831
00832 srcCardRouting().SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
00833
00834
00835 for (unsigned short int i=0; i<4; ++i) {
00836 colls()->rctEm()->push_back( L1CaloEmCand( eIsoRank[i], eIsoRgn[i], eIsoCard[i], crate, true, i, bx) );
00837 }
00838 for (unsigned short int i=0; i<4; ++i) {
00839 colls()->rctEm()->push_back( L1CaloEmCand( eNonIsoRank[i], eNonIsoRgn[i], eNonIsoCard[i], crate, false, i, bx) );
00840 }
00841 }
00842 }
00843
00844
00845 void GctFormatTranslateV38::blockToRctCaloRegions(const unsigned char * d, const GctBlockHeader& hdr)
00846 {
00847
00848 if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of RCT Regions"; return; }
00849
00850 unsigned int id = hdr.blockId();
00851 unsigned int nSamples = hdr.nSamples();
00852 unsigned int length = hdr.blockLength();
00853
00854
00855 assert(rctJetCrateMap().find(id) != rctJetCrateMap().end());
00856
00857
00858 unsigned int crate=rctJetCrateMap()[id];
00859
00860
00861 uint16_t * p = reinterpret_cast<uint16_t *>(const_cast<unsigned char *>(d));
00862
00863
00864 unsigned int ieta;
00865 unsigned int iphi;
00866
00867 for (unsigned int i=0; i<length; ++i)
00868 {
00869 for (uint16_t bx=0; bx<nSamples; ++bx)
00870 {
00871
00872 if (crate<9) {
00873 ieta = 12-i;
00874 iphi = 2*((11-crate)%9);
00875 }
00876 else {
00877 ieta = 9+i;
00878 iphi = 2*((20-crate)%9);
00879 }
00880
00881
00882 if (i>1) {
00883
00884 colls()->rctCalo()->push_back( makeL1CaloRegionBackPortHack(*p, ieta, iphi, bx) );
00885 ++p;
00886
00887 if (iphi>0) { iphi-=1; }
00888 else { iphi = 17; }
00889 colls()->rctCalo()->push_back( makeL1CaloRegionBackPortHack(*p, ieta, iphi, bx) );
00890 ++p;
00891 }
00892
00893 else if (unpackSharedRegions()){
00894
00895 colls()->rctCalo()->push_back( makeL1CaloRegionBackPortHack(*p, ieta, iphi, bx) );
00896 ++p;
00897
00898 if (iphi>0) { iphi-=1; }
00899 else { iphi = 17; }
00900 colls()->rctCalo()->push_back( makeL1CaloRegionBackPortHack(*p, ieta, iphi, bx) );
00901 ++p;
00902
00903 } else {
00904 ++p;
00905 ++p;
00906 }
00907 }
00908 }
00909 }
00910
00911
00912 void GctFormatTranslateV38::blockToFibres(const unsigned char * d, const GctBlockHeader& hdr)
00913 {
00914
00915 if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of GCT Fibres"; return; }
00916
00917 unsigned int id = hdr.blockId();
00918 unsigned int nSamples = hdr.nSamples();
00919 unsigned int length = hdr.blockLength();
00920
00921
00922 uint32_t * p = reinterpret_cast<uint32_t *>(const_cast<unsigned char *>(d));
00923
00924 for (unsigned int i=0; i<length; ++i) {
00925 for (unsigned int bx=0; bx<nSamples; ++bx) {
00926 colls()->gctFibres()->push_back( L1GctFibreWord(*p, id, i, bx) );
00927 ++p;
00928 }
00929 }
00930 }
00931
00932 void GctFormatTranslateV38::blockToFibresAndToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr)
00933 {
00934 this->blockToRctEmCand(d, hdr);
00935 this->blockToFibres(d, hdr);
00936 }
00937
00938 void GctFormatTranslateV38::blockToGctTrigObjects(const unsigned char * d, const GctBlockHeader& hdr)
00939 {
00940
00941 if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
00942
00943 unsigned int id = hdr.blockId();
00944 unsigned int nSamples = hdr.nSamples();
00945 unsigned int length = hdr.blockLength();
00946
00947
00948 uint16_t * p = reinterpret_cast<uint16_t *>(const_cast<unsigned char *>(d));
00949
00950 for (unsigned int i=0; i<length; ++i) {
00951
00952 for (unsigned int bx=0; bx<nSamples; ++bx) {
00953 colls()->gctInternJets()->push_back( L1GctInternJetData::fromGctTrigObject(L1CaloRegionDetId(0,0),id,i,bx,*p));
00954 ++p;
00955 colls()->gctInternJets()->push_back( L1GctInternJetData::fromGctTrigObject(L1CaloRegionDetId(0,0),id,i,bx,*p));
00956 ++p;
00957 }
00958 }
00959 }
00960
00961 void GctFormatTranslateV38::blockToGctJetClusterMinimal(const unsigned char * d, const GctBlockHeader& hdr)
00962 {
00963
00964 if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
00965
00966 unsigned int id = hdr.blockId();
00967 unsigned int nSamples = hdr.nSamples();
00968 unsigned int length = hdr.blockLength();
00969
00970
00971 uint16_t * p = reinterpret_cast<uint16_t *>(const_cast<unsigned char *>(d));
00972
00973 for (unsigned int i=0; i<length; ++i) {
00974
00975 for (unsigned int bx=0; bx<nSamples; ++bx) {
00976 colls()->gctInternJets()->push_back( L1GctInternJetData::fromJetClusterMinimal(L1CaloRegionDetId(0,0),id,i,bx,*p));
00977 ++p;
00978 colls()->gctInternJets()->push_back( L1GctInternJetData::fromJetClusterMinimal(L1CaloRegionDetId(0,0),id,i,bx,*p));
00979 ++p;
00980 }
00981 }
00982 }
00983
00984 void GctFormatTranslateV38::blockToGctJetPreCluster(const unsigned char * d, const GctBlockHeader& hdr)
00985 {
00986
00987 if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
00988
00989 unsigned int id = hdr.blockId();
00990 unsigned int nSamples = hdr.nSamples();
00991 unsigned int length = hdr.blockLength();
00992
00993
00994 uint16_t * p = reinterpret_cast<uint16_t *>(const_cast<unsigned char *>(d));
00995
00996 for (unsigned int i=0; i<length; ++i) {
00997
00998 for (unsigned int bx=0; bx<nSamples; ++bx) {
00999 colls()->gctInternJets()->push_back( L1GctInternJetData::fromJetPreCluster(L1CaloRegionDetId(0,0),id,i,bx,*p));
01000 ++p;
01001 colls()->gctInternJets()->push_back( L1GctInternJetData::fromJetPreCluster(L1CaloRegionDetId(0,0),id,i,bx,*p));
01002 ++p;
01003 }
01004 }
01005 }