#include <CaloOnlineTools/HcalOnlineDb/interface/XMLHTRPatterns.h>
Public Types | |
typedef struct XMLHTRPatterns::_HTRPatternConfig | HTRPatternConfig |
typedef XMLHTRPatterns::_loaderBaseConfig | loaderBaseConfig |
Public Member Functions | |
int | addPattern (HTRPatternConfig *config, string templateFileName="HCAL_HTR_DATA_PATTERNS.brickset.template") |
int | createByCrate (void) |
XMLHTRPatterns (string templateBase) | |
XMLHTRPatterns () | |
virtual | ~XMLHTRPatterns () |
Private Member Functions | |
int | fillPatternInfo (const HTRPatternConfig &) |
const XMLHTRPatterns & | operator= (const XMLHTRPatterns &) |
XMLHTRPatterns (const XMLHTRPatterns &) | |
Private Attributes | |
map< HTRPatternID, int > | configByCrate |
string | data_elements |
Classes | |
struct | _HTRPatternConfig |
struct | _loaderBaseConfig |
Usage: <usage>
Definition at line 54 of file XMLHTRPatterns.h.
XMLHTRPatterns::XMLHTRPatterns | ( | ) |
Definition at line 82 of file XMLHTRPatterns.cc.
00082 : XMLDOMBlock( "HCAL_HTR_DATA_PATTERNS.crate.template" ) 00083 { 00084 }
XMLHTRPatterns::XMLHTRPatterns | ( | string | templateBase | ) |
Definition at line 86 of file XMLHTRPatterns.cc.
00086 : XMLDOMBlock( templateBase ) 00087 { 00088 }
XMLHTRPatterns::~XMLHTRPatterns | ( | ) | [virtual] |
XMLHTRPatterns::XMLHTRPatterns | ( | const XMLHTRPatterns & | ) | [private] |
int XMLHTRPatterns::addPattern | ( | HTRPatternConfig * | config, | |
string | templateFileName = "HCAL_HTR_DATA_PATTERNS.brickset.template" | |||
) |
Definition at line 114 of file XMLHTRPatterns.cc.
References XMLProcessor::_toXMLCh(), lut2db_cfg::creationtag, data_elements, XMLDOMBlock::document, XMLDOMBlock::getDocument(), i, pydbsAccessor::root, XMLDOMBlock::setTagValue(), and transcode().
Referenced by createByCrate().
00115 { 00116 DOMElement * root = document -> getDocumentElement(); 00117 00118 XMLDOMBlock dataSetDoc( templateFileName ); 00119 DOMDocument * dataSet = dataSetDoc . getDocument(); 00120 00121 DOMNodeList * _list = dataSet -> getElementsByTagName( XMLProcessor::_toXMLCh( "Parameter" ) ); 00122 for ( int i = 0; i < _list -> getLength(); i++ ) 00123 { 00124 DOMElement * _tag = (DOMElement *)( _list -> item( i )); 00125 string parameterName = XMLString::transcode( _tag -> getAttribute( XMLProcessor::_toXMLCh( "name" ) ) ); 00126 //cout << XMLString::transcode( _tag -> getAttribute( XMLProcessor::_toXMLCh( "name" ) ) ) << endl; 00127 if ( parameterName == "CRATE" ) setTagValue( "Parameter", config -> crate, i, dataSet ); 00128 if ( parameterName == "SLOT" ) setTagValue( "Parameter", config -> slot, i, dataSet ); 00129 if ( parameterName == "TOPBOTTOM" ) setTagValue( "Parameter", config -> topbottom, i, dataSet ); 00130 if ( parameterName == "FIBER" ) setTagValue( "Parameter", config -> fiber, i, dataSet ); 00131 if ( parameterName == "GENERALIZEDINDEX" ) setTagValue( "Parameter", config -> generalizedindex, i, dataSet ); 00132 if ( parameterName == "CREATIONTAG" ) setTagValue( "Parameter", config -> creationtag, i, dataSet ); 00133 if ( parameterName == "CREATIONSTAMP" ) setTagValue( "Parameter", config -> creationstamp, i, dataSet ); 00134 if ( parameterName == "PATTERN_SPEC_NAME" ) setTagValue( "Parameter", config -> pattern_spec_name, i, dataSet ); 00135 } 00136 00137 setTagValue( "Data", data_elements, 0, dataSet ); 00138 00139 // changes to the pattern 00140 //setTagValue( "CRATE", config -> crate, 0, dataSet ); 00141 00142 // copy the <data_set> node into the final XML 00143 DOMNode * cloneDataSet = document -> importNode( dataSet -> getDocumentElement(), true ); 00144 root -> appendChild( cloneDataSet ); 00145 00146 return 0; 00147 }
Definition at line 162 of file XMLHTRPatterns.cc.
References addPattern(), bitset_utilities::append(), begin, configByCrate, GenMuonPlsPt100GeV_cfg::cout, data_elements, end, lat::endl(), fillPatternInfo(), first, XMLDOMBlock::getNewDocument(), XMLDOMBlock::getTimestamp(), i, j, NFBR, NFCH, NHBHECR, NHFCR, NHOCR, NHOETA, NHOPHI, NHSETS, NHSETSHO, NHTRS, NHTRSHO, NRMFIBR, NRMSLOT, NTOPBOT, NULL, phi, printHBHEHF(), printHO(), edm::second(), size, XMLDOMBlock::theFileName, and XMLDOMBlock::write().
00163 { 00164 00165 for ( int i = 0; i < 1024; i++ ) data_elements . append( " 10803" ); 00166 00167 //Global iterator variables 00168 int i, j; 00169 00170 //Stream variable 00171 00172 stringstream mystream; 00173 00174 //Declare the auxiliary functions (maybe put them in a library later?) 00175 void printHBHEHF(); 00176 void printHO(); 00177 00178 void writeXMLFooter (std::ostream& fOutput); 00179 void writeXMLHeader (std::ostream& fOutput, int swi); 00180 void writeXML (std::ostream& fOutput); 00181 void writeXMLHO (std::ostream& fOutput); 00182 00183 00184 //Variables that need to be printed 00185 int irm, irm_fi, iwedge, ipixel, iqie, iadc, isector; 00186 int islb, irctcra, irctcar, irctcon, irctnam, idphi; 00187 int iside, ieta, iphi, idepth, icrate, ihtr; 00188 int ihtr_fi, ifi_ch, ispigot, idcc, idcc_sl, ifed; 00189 00190 string rbx, slbin, slbin2, slnam; 00191 string det, fpga, rctnam, letter; 00192 char tempbuff[30]; 00193 00194 //These are used in the printing functions. 00195 int titlecounter = 0; 00196 00197 FILE* HOmap; 00198 FILE* HBEFmap; 00199 00200 //Note: If you have no "Maps" directory, modify this or you might get a segmentation fault 00201 HOmap = fopen ("../Maps/HCALmapHO_9.14.2007.txt","w"); 00202 HBEFmap = fopen ("../Maps/HCALmapHBEF_9.14.2007.txt","w"); 00203 00204 /* HBHE crate numbering */ 00205 int hbhecrate[NHBHECR]={0,1,4,5,10,11,14,15,17}; 00206 /* HF crate numbering */ 00207 int hfcrate[NHFCR]={2,9,12}; 00208 /* HO crate numbering */ 00209 int hocrate[NHOCR]={3,7,6,13}; 00210 /* HBHE FED numbering of DCCs */ 00211 int fedhbhenum[NHBHECR][2]={{702,703},{704,705},{700,701}, 00212 {706,707},{716,717},{708,709}, 00213 {714,715},{710,711},{712,713}}; 00214 /* HF FED numbering of DCCs */ 00215 int fedhfnum[NHFCR][2]={{718,719},{720,721},{722,723}}; 00216 /* HO FED numbering of DCCs */ 00217 int fedhonum[NHOCR][2]={{724,725},{726,727},{728,729},{730,731}}; 00218 /* HBHE/HF htr slot offsets for set of three htrs */ 00219 int ihslot[NHSETS]={2,5,13,16}; 00220 /* HO htr slot offsets for three sets of four htrs */ 00221 int ihslotho[NHSETSHO][NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}}; 00222 /* iphi (lower) starting index for each HBHE crate */ 00223 int ihbhephis[NHBHECR]={11,19,3,27,67,35,59,43,51}; 00224 /* iphi (lower) starting index for each HF crate */ 00225 int ihfphis[NHFCR]={3,27,51}; 00226 /* iphi (lower) starting index for each HO crate */ 00227 int ihophis[NHOCR]={71,17,35,53}; 00228 /* ihbheetadepth - unique HBHE {eta,depth} assignments per fiber and fiber channel */ 00229 int ihbheetadepth[NHTRS][NTOPBOT][NFBR][NFCH][2]={ 00230 {{{{11,1},{ 7,1},{ 3,1}}, /* htr 0 (HB) -bot(+top) */ 00231 {{ 5,1},{ 1,1},{ 9,1}}, 00232 {{11,1},{ 7,1},{ 3,1}}, 00233 {{ 5,1},{ 1,1},{ 9,1}}, 00234 {{10,1},{ 6,1},{ 2,1}}, 00235 {{ 8,1},{ 4,1},{12,1}}, 00236 {{10,1},{ 6,1},{ 2,1}}, 00237 {{ 8,1},{ 4,1},{12,1}}}, 00238 {{{11,1},{ 7,1},{ 3,1}}, /* htr 0 (HB) +bot(-top) */ 00239 {{ 5,1},{ 1,1},{ 9,1}}, 00240 {{11,1},{ 7,1},{ 3,1}}, 00241 {{ 5,1},{ 1,1},{ 9,1}}, 00242 {{10,1},{ 6,1},{ 2,1}}, 00243 {{ 8,1},{ 4,1},{12,1}}, 00244 {{10,1},{ 6,1},{ 2,1}}, 00245 {{ 8,1},{ 4,1},{12,1}}}}, 00246 {{{{16,2},{15,2},{14,1}}, /* htr 1 (HBHE) -bot(+top) */ 00247 {{15,1},{13,1},{16,1}}, 00248 {{16,2},{15,2},{14,1}}, 00249 {{15,1},{13,1},{16,1}}, 00250 {{17,1},{16,3},{26,1}}, 00251 {{18,1},{18,2},{26,2}}, 00252 {{17,1},{16,3},{25,1}}, 00253 {{18,1},{18,2},{25,2}}}, 00254 {{{16,2},{15,2},{14,1}}, /* htr 1 (HBHE) +bot(-top) */ 00255 {{15,1},{13,1},{16,1}}, 00256 {{16,2},{15,2},{14,1}}, 00257 {{15,1},{13,1},{16,1}}, 00258 {{17,1},{16,3},{25,1}}, 00259 {{18,1},{18,2},{25,2}}, 00260 {{17,1},{16,3},{26,1}}, 00261 {{18,1},{18,2},{26,2}}}}, 00262 {{{{28,1},{28,2},{29,1}}, /* htr 2 (HE) -bot(+top) */ 00263 {{28,3},{24,2},{24,1}}, 00264 {{27,1},{27,2},{29,2}}, 00265 {{27,3},{23,2},{23,1}}, 00266 {{19,2},{20,1},{22,2}}, 00267 {{19,1},{20,2},{22,1}}, 00268 {{19,2},{20,1},{21,2}}, 00269 {{19,1},{20,2},{21,1}}}, 00270 {{{27,1},{27,2},{29,2}}, /* htr 2 (HE) +bot(-top) */ 00271 {{27,3},{23,2},{23,1}}, 00272 {{28,1},{28,2},{29,1}}, 00273 {{28,3},{24,2},{24,1}}, 00274 {{19,2},{20,1},{21,2}}, 00275 {{19,1},{20,2},{21,1}}, 00276 {{19,2},{20,1},{22,2}}, 00277 {{19,1},{20,2},{22,1}}}} 00278 }; 00279 /* ihfetadepth - unique HF {eta,depth} assignments per fiber and fiber channel */ 00280 int ihfetadepth[NTOPBOT][NFBR][NFCH][2]={ 00281 {{{33,1},{31,1},{29,1}}, /* top */ 00282 {{32,1},{30,1},{34,1}}, 00283 {{33,2},{31,2},{29,2}}, 00284 {{32,2},{30,2},{34,2}}, 00285 {{34,2},{32,2},{30,2}}, 00286 {{31,2},{29,2},{33,2}}, 00287 {{34,1},{32,1},{30,1}}, 00288 {{31,1},{29,1},{33,1}}}, 00289 {{{41,1},{37,1},{35,1}}, /* bot */ 00290 {{38,1},{36,1},{39,1}}, 00291 {{41,2},{37,2},{35,2}}, 00292 {{38,2},{36,2},{39,2}}, 00293 {{40,2},{38,2},{36,2}}, 00294 {{37,2},{35,2},{39,2}}, 00295 {{40,1},{38,1},{36,1}}, 00296 {{37,1},{35,1},{39,1}}} 00297 }; 00298 00299 //Aram's insert: I shall now define an array which contains the RM and the RM fiber for HB HE 00300 //and variables associated with this table 00301 int irm_rmfiHBHE[NHTRS][NTOPBOT][NFBR][2]={ 00302 {{{6,1},{7,1},{6,2},{7,2},{4,1},{5,1},{4,2},{5,2}}, // HTR 0 top 00303 {{6,3},{7,3},{6,4},{7,4},{4,3},{5,3},{4,4},{5,4}}}, // HTR 0 bot 00304 {{{2,1},{3,1},{2,2},{3,2},{2,1},{3,1},{2,2},{3,2}}, // HTR 1 top 00305 {{2,3},{3,3},{2,4},{3,4},{2,3},{3,3},{2,4},{3,4}}}, // HTR 1 bot 00306 {{{4,1},{5,1},{4,2},{5,2},{6,1},{7,1},{6,2},{7,2}}, // HTR 2 top 00307 {{4,3},{5,3},{4,4},{5,4},{6,3},{7,3},{6,4},{7,4}}} // HTR 2 bot 00308 }; 00309 00310 int irm_rmfiHF[NHTRS][NTOPBOT][NFBR][2]={ 00311 {{{1,2},{2,2},{3,2},{4,2},{1,3},{2,3},{3,3},{4,3}}, // HTR 0 top 00312 {{5,2},{6,2},{7,2},{8,2},{5,3},{6,3},{7,3},{8,3}}}, // HTR 0 bot 00313 {{{1,1},{2,1},{3,1},{4,1},{1,2},{2,2},{3,2},{4,2}}, // HTR 1 top 00314 {{5,1},{6,1},{7,1},{8,1},{5,2},{6,2},{7,2},{8,2}}}, // HTR 1 bot 00315 {{{1,3},{2,3},{3,3},{4,3},{1,1},{2,1},{3,1},{4,1}}, // HTR 2 top 00316 {{5,3},{6,3},{7,3},{8,3},{5,1},{6,1},{7,1},{8,1}}} // HTR 2 bot 00317 }; 00318 00319 //Pixel tables as a function of rm, rm fiber and fiber channel 00320 00321 int ipixelHB[NRMFIBR][NFCH][NRMSLOT] = { // fch = 0 fch = 1 fch = 2 00322 {{18, 17, 3, 2 }, {13, 3, 17, 7 }, {14, 1, 19, 6 }}, //rmfiber = 2 00323 {{19, 2, 18, 1 }, {15, 7, 13, 5 }, {17, 19, 1, 3 }}, //rmfiber = 3 00324 {{9, 4, 16, 11}, {5, 8, 12, 15}, {2, 13, 7, 18}}, //rmfiber = 4 00325 {{12, 11, 9, 8 }, {7, 15, 5, 13}, {16, 6, 14, 4 }}, //rmfiber = 5 00326 {{8, 5, 15, 12}, {4, 9, 11, 16}, {1, 14, 6, 19}}, //rmfiber = 6 00327 {{6, 16, 4, 14}, {3, 18, 2, 17}, {11, 12, 8, 9 }} //rmfiber = 7 00328 }; 00329 00330 int ipixelHE[NRMFIBR][NFCH][NRMSLOT] = { // fch = 0 fch = 1 fch = 2 00331 {{12, 12, 12, 12}, {16, 7, 16, 7 }, {7, 16, 7, 16}}, //rmfiber = 2 00332 {{11, 11, 11, 11}, {19, 3, 19, 3 }, {3, 19, 3, 19}}, //rmfiber = 3 00333 {{15, 15, 6, 6 }, {2, 18, 2, 18}, {6, 6, 15, 15}}, //rmfiber = 4 00334 {{5, 14, 5, 14}, {14, 5, 14, 5 }, {18, 2, 18, 2 }}, //rmfiber = 5 00335 {{17, 1, 17, 1 }, {9, 9, 9, 9 }, {1, 17, 1, 17}}, //rmfiber = 6 00336 {{13, 4, 13, 4 }, {8, 8, 8, 8 }, {4, 13, 4, 13}} //rmfiber = 7 00337 }; 00338 00339 //adc and qie table; qie is entry 0, adc is entry 1. Constant across HB, HE, HO 00340 int iadcquiHBHE[NRMFIBR][NFCH][2]; 00341 00342 for (i = 0; i < NRMFIBR; i++){ 00343 for (j = 0; j < NFCH; j++){ 00344 //Intentionally relying on integer truncation here 00345 iadcquiHBHE[i][j][0] = i / 2 + 1; 00346 00347 if (i % 2 == 0) iadcquiHBHE[i][j][1] = j; 00348 else iadcquiHBHE[i][j][1] = NFCH + (j + 1) % 3; 00349 } 00350 } 00351 00352 //slb and rct tables 00353 00354 //HB and HE 00355 00356 const char* S_slbin_odd[] ={"A1","B0","B1","A0","A1","B0","B1","A0"}; 00357 const char* S_slbin_even[]={"C1","D0","D1","C0","C1","D0","D1","C0"}; 00358 const char* rct_rackHBHE[]={"S2E01-RH","S2E03-RH","S2E05-RH","S2E07-RH","S2E09-RH","S2E08-RL","S2E06-RL","S2E04-RL","S2E02-RL", 00359 "S2E02-RH","S2E04-RH","S2E06-RH","S2E08-RH","S2E09-RL","S2E07-RL","S2E05-RL","S2E03-RL","S2E01-RL"}; 00360 00361 //HF 00362 const char* S_slbin_7[] ={"A0","A1","B0","B1"}; 00363 const char* S_slbin_3[] ={"C0","C1","D0","D1"}; 00364 const char* rct_rackHF[]={"S2E01-FH","S2E03-FH","S2E05-FH","S2E07-FH","S2E09-FH","S2E08-FL","S2E06-FL","S2E04-FL","S2E02-FL", 00365 "S2E02-FH","S2E04-FH","S2E06-FH","S2E08-FH","S2E09-FL","S2E07-FL","S2E05-FL","S2E03-FL","S2E01-FL"}; 00366 00367 00368 int slb_table[29] = {1,1,2,2,3,3,4,4,5,5,6,6, // 1<=eta<=12 00369 1,1,2,2,3,3,1,1, // 13<=eta<=20 00370 2,2,3,3,4,4,4,4,4}; // 21<=eta<=29 00371 00372 //RM for the HO as a function of eta, phi and side as implemented in complete_ho_map.txt 00373 //There are only 24 phi columns because after that it begins to repeat. The relevant variable is phi mod 24. 00374 int HO_RM_table[24][15][2] = 00375 { 00376 {{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2}}, 00377 {{2,2},{2,2},{2,2},{2,2},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4}}, 00378 {{3,3},{3,3},{3,3},{3,3},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4}}, 00379 {{3,3},{3,3},{3,3},{3,3},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4}}, 00380 {{4,4},{4,4},{4,4},{4,4},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3}}, 00381 {{4,4},{4,4},{4,4},{4,4},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3}}, 00382 {{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3}}, 00383 {{3,3},{3,3},{3,3},{3,3},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1}}, 00384 {{2,2},{2,2},{2,2},{2,2},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1}}, 00385 {{2,2},{2,2},{2,2},{2,2},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1}}, 00386 {{4,4},{4,4},{4,4},{4,4},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2}}, 00387 {{4,4},{4,4},{4,4},{4,4},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2}}, 00388 {{3,3},{3,3},{3,3},{3,3},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2}}, 00389 {{3,3},{3,3},{3,3},{3,3},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4}}, 00390 {{2,2},{2,2},{2,2},{2,2},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4}}, 00391 {{2,2},{2,2},{2,2},{2,2},{4,4},{4,4},{4,4},{4,4},{4,4},{4,4},{2,4},{2,4},{2,4},{2,4},{2,4}}, 00392 {{1,1},{1,1},{1,1},{1,1},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3}}, 00393 {{1,1},{1,1},{1,1},{1,1},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3}}, 00394 {{2,2},{2,2},{2,2},{2,2},{3,3},{3,3},{3,3},{3,3},{3,3},{3,3},{1,3},{1,3},{1,3},{1,3},{1,3}}, 00395 {{2,2},{2,2},{2,2},{2,2},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1}}, 00396 {{3,3},{3,3},{3,3},{3,3},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1}}, 00397 {{3,3},{3,3},{3,3},{3,3},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{3,1},{3,1},{3,1},{3,1},{3,1}}, 00398 {{1,1},{1,1},{1,1},{1,1},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2}}, 00399 {{1,1},{1,1},{1,1},{1,1},{2,2},{2,2},{2,2},{2,2},{2,2},{2,2},{4,2},{4,2},{4,2},{4,2},{4,2}} 00400 }; 00401 00402 //For |eta| 5 to 15, rm_fi is a function of |eta| only while htr_fi is a function of side and |eta| 00403 int HO_RM_fi_eta5to15[11] = {3, 2, 5, 4, 7, 6, 3, 2, 5, 4, 7}; 00404 00405 int HO_htr_fi_eta5to15[2][11] = {{5, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7}, //iside = -1 00406 {1, 8, 7, 6, 5, 4, 3, 2, 1, 2, 1}}; //iside = +1 00407 00408 //For |eta| 1 to 4, it is a function of phi, eta and side. eta 1-3 always have the same value given a side, eta 4 is separate 00409 //and thus gets its own box 00410 int HO_RM_fi_eta1to4[72][2][2] = 00411 { //side = -1 side = 1 00412 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}}, //Phi 1 to 8 00413 {{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}}, //Phi 9 to 16 00414 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}}, //Phi 17 to 24 00415 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}}, //Phi 25 to 32 00416 {{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}}, //Phi 33 to 40 00417 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}}, //Phi 41 to 48 00418 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}}, //Phi 49 to 56 00419 {{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}},{{2,6},{5,4}},{{3,7},{5,4}}, //Phi 57 to 64 00420 {{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}},{{7,3},{4,5}},{{6,2},{4,5}} //Phi 65 to 72 00421 }; 00422 00423 //Pixel and letter code for the HO. Ring 0 is separate and goes into entry 0, Rings +/- 1,2 are all the same and go to entry 1. 00424 // Fiber Channel 0 1 2 0 1 2 0 1 2 00425 int ipixelHO[NRMFIBR][NFCH][2] = { {{12,12}, {7,7}, {6,3}}, {{4,4}, {8,8}, {5,1} }, {{19,11},{-1000,6},{17,2 }}, //RM fibers 2,3,4 00426 {{-1000,9},{1,13},{3,5}}, {{11,19},{16,18},{15,17}}, {{13,15},{9,14}, {14,16}} }; //RM fibers 5,6,7 00427 // Fiber Channel 0 1 2 0 1 2 0 1 2 00428 string letterHO[NRMFIBR][NFCH][2] = {{{"E","E"},{"G","L"},{"F","S"}}, {{"Q","M"},{"N","T"},{"P","F"}}, {{"A","C"},{"Z","J"},{"J","Q"}}, 00429 {{"Z","K"},{"R","R"},{"H","D"}}, {{"D","A"},{"C","G"},{"B","N"}}, {{"L","H"},{"M","P"},{"K","B"}}}; 00430 00431 00432 //Associated variables 00433 int hfphi; 00434 char sidesign, S_side; 00435 00436 //For slb and rct 00437 int phi, phideg, etaslb, oddcard, eta2, eta3, phimod8, ietamod; 00438 int crazy = 0; 00439 00440 //For HO 00441 int phmod24, phimod6, sidear, iph, iet, isid, ring, sector; 00442 bool phi1458, phi271011, phir0v1, phir0v2, phir0v3, phir0v4; 00443 00444 00445 //Chris's original variables (I got rid of iphi_loc; it's not longer necessary) 00446 int ic,is,ih,itb,ifb,ifc,ifwtb; 00447 00448 //Write the header for the HBEF XML 00449 00450 //writeXMLHeader(OutXML, 0); 00451 00452 // Kukartsev 00453 HTRPatternConfig _config; 00454 00455 /* all HBHE crates */ 00456 for(ic=0; ic<NHBHECR; ic++){ 00457 00458 char _buf[50]; 00459 sprintf( _buf, "testHTRPatterns_%d.xml", hbhecrate[ic] ); 00460 string _fileNameByCrate = _buf; 00461 00462 bool firstBlockWritten = false; 00463 00464 getNewDocument( theFileName ); 00465 00466 /* four sets of three htrs per crate */ 00467 for(is=0; is<NHSETS; is++){ 00468 /* three htrs per set */ 00469 for(ih=0; ih<NHTRS; ih++){ 00470 /* top and bottom */ 00471 for(itb=0; itb<NTOPBOT; itb++){ 00472 /* eight fibers per HTR FPGA */ 00473 for(ifb=0; ifb<NFBR; ifb++){ 00474 /* three channels per fiber */ 00475 for(ifc=0; ifc<NFCH; ifc++){ 00476 icrate=hbhecrate[ic]; 00477 iside=is<NHSETS/2?-1:1; 00478 ifwtb=(is/2+itb+1)%2; 00479 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0]; 00480 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1]; 00481 ihtr=ihslot[is]+ih; 00482 (ieta>16||idepth>2) ? det = "HE": det = "HB"; 00483 (itb%2)==1 ? fpga = "bot" : fpga = "top"; 00484 ihtr_fi=ifb+1; 00485 ifi_ch=ifc; 00486 iphi=(ieta>20)?(ihbhephis[ic]+(is%2)*4+itb*2-1)%72+1:(ihbhephis[ic]+(is%2)*4+itb*2+(ifb/2+is/2+1)%2-1)%72+1; 00487 ispigot=(is%2)*6+ih*2+itb; 00488 idcc=is<NHSETS/2?1:2; 00489 idcc_sl=idcc==1?9:19; 00490 ifed=fedhbhenum[ic][idcc-1]; 00491 //Aram's insert: rm variables, rbx, wedge 00492 //Careful here: per Pawel's map, the rm fiber is the first entry an the rm itself is the second. 00493 00494 //If iside == -1, switch top and bottom. Why? 00495 if (iside == -1){ 00496 S_side = '-'; 00497 sidesign = 'M'; 00498 irm = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][1]; 00499 irm_fi = irm_rmfiHBHE[ih][(itb + 1) % 2][ifb][0]; 00500 00501 //For eta >=21, the phi's cover 10 degrees rather than 5 (see HCAL TDR) 00502 if (ieta >= 21 && (irm == 1 || irm == 3)) iwedge = (iphi + 1 + irm + 1) / 4; 00503 else iwedge = (iphi + irm + 1) / 4; 00504 00505 //Roll over the wedge 00506 if (iwedge > 18) iwedge -= 18; 00507 } 00508 else{ 00509 S_side = '+'; 00510 sidesign = 'P'; 00511 irm = irm_rmfiHBHE[ih][itb][ifb][1]; 00512 irm_fi = irm_rmfiHBHE[ih][itb][ifb][0]; 00513 00514 //For eta >=21, the phi's cover 10 degrees rather than 5 (see HCAL TDR) 00515 if (ieta >= 21 && (irm == 4 || irm == 2)) iwedge = (iphi + 1 - irm + 6) / 4; 00516 else iwedge = (iphi - irm + 6) / 4; 00517 00518 //Roll over the wedge 00519 if (iwedge > 18) iwedge -= 18; 00520 } 00521 00522 sprintf (tempbuff, "%s%c%i%c", det.c_str(), sidesign, iwedge,'\0'); 00523 mystream<<tempbuff; 00524 rbx = mystream.str(); 00525 mystream.str(""); 00526 00527 //Note that irm_fi ranges from 2 to 7 whereas arrays start at 0 so 00528 //I use irm_fi - 2. Likewise, irm goes from 1 to 4 so use irm - 1 00529 00530 //Pixel is split by HB and HE 00531 if (ieta > 16 || idepth > 2) ipixel = ipixelHE[irm_fi - 2][ifc][irm - 1]; //HE 00532 else ipixel = ipixelHB[irm_fi - 2][ifc][irm - 1]; //HB 00533 00534 iqie = iadcquiHBHE[irm_fi - 2][ifc][0]; 00535 iadc = iadcquiHBHE[irm_fi - 2][ifc][1]; 00536 00537 //Calculate rctcrate 00538 00539 // int phi72 = (phi-1)/72; 00540 // phi = phi - 72*phi72; 00541 // if (phi < 1 ) phi = phi + 72; 00542 00543 //The code commented out above appears to do absolutely nothing. 00544 00545 phideg = iphi - 3; 00546 if (phideg < 0) phideg = phideg + 72; 00547 phideg = (phideg / 4) * 20 + 10; 00548 irctcra = (( 89 - phideg + 720)%360)/20; 00549 oddcard = irctcra % 2; 00550 irctcra /= 2; 00551 if (iside > 0) irctcra = irctcra + 9; 00552 00553 etaslb = ((ieta - 1) / 2) * 2 + 1; 00554 if (etaslb > 27) etaslb = 27; 00555 00556 00557 sprintf(tempbuff,"SLB_H_%3.3d%c%2.2d%c",phideg,S_side,etaslb,'\0'); 00558 mystream<<tempbuff; 00559 slnam = mystream.str(); 00560 mystream.str(""); 00561 00562 islb = slb_table[ieta - 1]; 00563 00564 // calculate RCT destination (that is, rctcon, rctcar and rctnam 00565 if (ieta <= 24) { // these are the normal cards 0-5 00566 irctcar = 2 * ((ieta - 1)/8) + oddcard; 00567 irctcon = 2 * (((ieta - 1)/2)%4); 00568 } 00569 else { // these are on the special card 6 which folds back eta on the odd card half 00570 irctcar = 6; 00571 eta2 = ieta; 00572 if (eta2 > 28) eta2 = 28; 00573 if (oddcard == 0) eta3 = eta2; 00574 else eta3 = 57 - eta2; 00575 irctcon = 2 * (((eta3 - 1) / 2) % 4); 00576 } 00577 irctcon = 11 * irctcon + 1; 00578 00579 sprintf(tempbuff,"%s-%1d-HD%2.2d",rct_rackHBHE[irctcra],irctcar,irctcon); 00580 mystream<<tempbuff; 00581 rctnam = mystream.str(); 00582 mystream.str(""); 00583 00584 //Finally, the slbin 00585 00586 phimod8 = iphi % 8; 00587 00588 for (i = 0; i < 18; i++){ 00589 if (iphi < i * 4 + 3){ 00590 crazy = i % 2; 00591 break; 00592 } 00593 } 00594 00595 int ietamod; // determine if eta is "odd" or "even". 00596 if (ieta == 29) ietamod = 0; 00597 else ietamod = ieta % 2; 00598 if (ieta < 25) { // use the regular table 00599 if (ietamod == 1) mystream<<S_slbin_odd[phimod8]; 00600 else mystream<<S_slbin_even[phimod8]; 00601 } 00602 else if (crazy == 0) { // use the regular table 00603 if (ietamod == 1) mystream<<S_slbin_odd[phimod8]; 00604 else mystream<<S_slbin_even[phimod8]; 00605 } 00606 else { // swap odd/even!!! 00607 if (ietamod == 1) mystream<<S_slbin_even[phimod8]; 00608 else mystream<<S_slbin_odd[phimod8]; 00609 } 00610 00611 slbin = mystream.str(); 00612 mystream.str(""); 00613 00614 if (ieta > 20){ 00615 idphi = 2; 00616 slbin2 = slbin; 00617 slbin2[1] = '1'; 00618 } 00619 else{ 00620 idphi = 1; 00621 slbin2 = "NA"; 00622 } 00623 00624 //printHBHEHF(); 00625 //writeXML(OutXML); 00626 00627 int _crate = icrate; 00628 int _slot = ihtr; 00629 int _topbottom = itb; // string _topbottom = fpga; 00630 int _fiber = ihtr_fi; 00631 //===> Kukartsev: 00632 if ( !firstBlockWritten || _crate != _config . crate || _slot != _config . slot || _topbottom != _config . topbottom || _fiber != _config . fiber ) 00633 { 00634 firstBlockWritten = true; 00635 _config . crate = _crate; 00636 _config . slot = _slot; 00637 _config . topbottom = _topbottom; 00638 _config . fiber = _fiber; 00639 _config . generalizedindex = 100*_slot + 10*_topbottom + _fiber; 00640 _config . creationstamp = getTimestamp( time( NULL ) ); 00641 addPattern( &_config ); 00642 firstBlockWritten = true; 00643 } 00644 } 00645 } 00646 } 00647 } 00648 } 00649 write( _fileNameByCrate ); 00650 } 00651 00652 /* all HF crates */ 00653 for(ic=0; ic<NHFCR; ic++){ 00654 00655 char _buf[50]; 00656 sprintf( _buf, "testHTRPatterns_%d.xml", hfcrate[ic] ); 00657 string _fileNameByCrate = _buf; 00658 00659 bool firstBlockWritten = false; 00660 00661 getNewDocument( theFileName ); 00662 00663 /* four sets of three htrs per crate */ 00664 for(is=0; is<NHSETS; is++){ 00665 /* three htrs per set */ 00666 for(ih=0; ih<NHTRS; ih++){ 00667 /* top and bottom */ 00668 for(itb=0; itb<NTOPBOT; itb++){ 00669 /* eight fibers per HTR FPGA */ 00670 for(ifb=0; ifb<NFBR; ifb++){ 00671 /* three channels per fiber */ 00672 for(ifc=0; ifc<NFCH; ifc++){ 00673 icrate=hfcrate[ic]; 00674 iside=is<NHSETS/2?-1:1; 00675 ieta=ihfetadepth[itb][ifb][ifc][0]; 00676 idepth=ihfetadepth[itb][ifb][ifc][1]; 00677 ihtr=ihslot[is]+ih; 00678 det = "HF"; 00679 (itb%2)== 1 ? fpga = "bot" : fpga = "top"; 00680 ihtr_fi=ifb+1; 00681 ifi_ch=ifc; 00682 iphi=(ieta>39)?(ihfphis[ic]+(is%2)*12+ih*4-1)%72+1:(ihfphis[ic]+(is%2)*12+ih*4+(ifb/4)*2-1)%72+1; 00683 ispigot=(is%2)*6+ih*2+itb; 00684 idcc=is<NHSETS/2?1:2; 00685 idcc_sl=idcc==1?9:19; 00686 ifed=fedhfnum[ic][idcc-1]; 00687 00688 irm = irm_rmfiHF[ih][itb][ifb][1]; 00689 irm_fi = irm_rmfiHF[ih][itb][ifb][0]; 00690 00691 //Don't switch in the HF. Why? 00692 if (iside == -1){ 00693 S_side = '-'; 00694 sidesign = 'M'; 00695 } 00696 else{ 00697 S_side = '+'; 00698 sidesign = 'P'; 00699 } 00700 00701 if (iphi >= 71) iwedge = 1; 00702 else iwedge = (iphi + 1) / 4 + 1; 00703 00704 00705 //eta == 40 is special. The cell is twice as wide 00706 if (ieta == 40) hfphi = (iphi + 3) / 2; 00707 else hfphi = (iphi + 1) / 2; 00708 00709 //In case it rolls over 00710 if (hfphi > 36) hfphi -= 36; 00711 00712 sprintf (tempbuff, "%s%c%i%c", det.c_str(), sidesign, (hfphi-1)/3 + 1,'\0'); 00713 mystream<<tempbuff; 00714 rbx = mystream.str(); 00715 mystream.str(""); 00716 00717 //No pixel in HF, follow Fedor's convention 00718 ipixel = 0; 00719 00720 //Integer truncation again consistent with Fedor's map. 00721 iqie = (irm_fi - 1) / 2 + 1; 00722 00723 if (irm_fi % 2 != 0) iadc = ifi_ch; 00724 else iadc = NFCH + (ifi_ch + 1) % 3; 00725 00726 //slb and rct variables 00727 //rctcrate 00728 phideg = iphi - 3; 00729 if (phideg < 0) phideg = phideg + 72; 00730 phideg = (phideg / 4) * 20 + 10; 00731 irctcra = (( 89 - phideg + 720)%360)/40; 00732 if (iside > 0) irctcra = irctcra + 9; 00733 00734 //rct card and rct connector appear to be dummy here -- again, I follow Fedor's convention 00735 irctcar = 99; 00736 irctcon = 0; 00737 00738 etaslb = 29; 00739 00740 sprintf(tempbuff,"SLB_H_%3.3d%c%2.2d",phideg,S_side,etaslb); 00741 mystream<<tempbuff; 00742 slnam = mystream.str(); 00743 mystream.str(""); 00744 00745 sprintf(tempbuff,"%s-JSC-HF_IN",rct_rackHF[irctcra]); 00746 mystream<<tempbuff; 00747 rctnam = mystream.str(); 00748 mystream.str(""); 00749 00750 islb = 6; 00751 00752 int phibin = (iphi + 1) % 8 ; 00753 int etabin = (ieta - 29) / 3; 00754 if (etabin < 0) etabin = 0; 00755 if (etabin > 3) etabin = 3; 00756 if (phibin < 4) mystream<<S_slbin_7[etabin]; 00757 else mystream<<S_slbin_3[etabin]; 00758 00759 slbin = mystream.str(); 00760 mystream.str(""); 00761 00762 //It has been decided that we not do this 00763 // slbin2 = slbin; 00764 // if (slbin[0] == 'A') slbin2[0] = 'C'; 00765 // else if (slbin[0] == 'B') slbin2[0] = 'D'; 00766 // else if (slbin[0] == 'C') slbin2[0] = 'A'; 00767 // else if (slbin[0] == 'D') slbin2[0] = 'B'; 00768 00769 slbin2 = "NA"; 00770 00771 if (ieta < 40) idphi = 2; 00772 else idphi = 4; 00773 00774 //printHBHEHF(); 00775 00776 00777 int _crate = icrate; 00778 int _slot = ihtr; 00779 int _topbottom = itb; // string _topbottom = fpga; 00780 int _fiber = ihtr_fi; 00781 //===> Kukartsev: 00782 if ( !firstBlockWritten || _crate != _config . crate || _slot != _config . slot || _topbottom != _config . topbottom || _fiber != _config . fiber ) 00783 { 00784 firstBlockWritten = true; 00785 _config . crate = _crate; 00786 _config . slot = _slot; 00787 _config . topbottom = _topbottom; 00788 _config . fiber = _fiber; 00789 _config . generalizedindex = 100*_slot + 10*_topbottom + _fiber; 00790 _config . creationstamp = getTimestamp( time( NULL ) ); 00791 addPattern( &_config ); 00792 firstBlockWritten = true; 00793 } 00794 } 00795 } 00796 } 00797 } 00798 } 00799 write( _fileNameByCrate ); 00800 } 00801 00802 //writeXMLFooter(OutXML); //End HBEF XML 00803 00804 //writeXMLHeader(OutXMLHO, 1); //Begin HO XML 00805 00806 titlecounter = 0; 00807 00808 configByCrate . clear(); 00809 00810 //Radical change: HO iterates over eta and phi rather than crate, HTR, etc. 00811 00812 for(isid = -1; isid < 2; isid+=2){ 00813 for (iph = 0; iph < NHOPHI; iph++){ 00814 for (iet = 0; iet < NHOETA; iet++){ 00815 00816 iphi = iph + 1; 00817 ieta = iet + 1; 00818 iside = isid; 00819 00820 if (iphi >= 71 || iphi < 17) ic = 0; 00821 else if (iphi >= 17 && iphi < 35) ic = 1; 00822 else if (iphi >= 35 && iphi < 53) ic = 2; 00823 else ic = 3; 00824 00825 icrate=hocrate[ic]; 00826 idepth=4; 00827 det = "HO"; 00828 00829 ihtr_fi=ifb+1; 00830 ifi_ch=ifc; 00831 00832 //fpga = top/bottom depends on a pattern that repeats every 30 degrees (6 phi) 00833 //Hence, phimod6 00834 00835 phimod6 = iphi % 6; 00836 00837 if (ieta >= 5){ 00838 if (phimod6 <= 4 && phimod6 >= 2) fpga = "top"; 00839 else fpga = "bot"; 00840 } 00841 else if (ieta == 4){ 00842 if (iside == 1){ 00843 if (phimod6 == 1 || phimod6 == 2) fpga = "bot"; 00844 else fpga = "top"; 00845 } 00846 else{ 00847 if (phimod6 == 3 || phimod6 == 4) fpga = "top"; 00848 else fpga = "bot"; 00849 } 00850 } 00851 else{ 00852 if (phimod6 % 2 == 0) fpga = "top"; 00853 else fpga = "bot"; 00854 } 00855 00856 //dphi 00857 if (ieta <= 20) idphi = 1; 00858 else idphi = -1000; 00859 00860 //create values usable in arrays from side and fpga 00861 if (iside == 1) sidear = 1; 00862 else sidear = 0; 00863 00864 if (fpga == "bot") itb = 1; 00865 else itb = 0; 00866 00867 phmod24 = iph % 24; 00868 00869 //Again, x - 1 because the array starts at 0 while the variables start at 1 00870 irm = HO_RM_table[phmod24][iet][sidear]; 00871 00872 //x - 5 for the eta array for the same reason 00873 if (ieta >= 5) irm_fi = HO_RM_fi_eta5to15[ieta - 5]; 00874 else if (ieta <= 3) irm_fi = HO_RM_fi_eta1to4[iph][0][sidear]; 00875 else if (ieta == 4) irm_fi = HO_RM_fi_eta1to4[iph][1][sidear]; 00876 else irm_fi = -1000; 00877 00878 //Determine which of HTR in the set belongs here. It depends only on eta and side. 00879 if (ieta <= 3 || (ieta >= 14 && iside == 1)) ih = 0; 00880 else if (ieta <= 13 && ieta >= 6 && iside == 1) ih = 1; 00881 else if (ieta <= 13 && ieta >= 6 && iside == -1) ih = 3; 00882 else ih = 2; 00883 00884 //Each value of "is" covers 30 degrees (that is, 6 values of phi). To calculate which ones, 00885 //I define phimod18. Crates start at phi = 71, 17, 35, 53 00886 00887 if (iphi % 18 == 17 || iphi % 18 <= 4) is = 0; 00888 else if (iphi % 18 >= 5 && iphi % 18 <= 10) is = 1; 00889 else is = 2; 00890 00891 ihtr=ihslotho[is][ih]; 00892 00893 ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb; 00894 idcc=ihtr<9?1:2; 00895 idcc_sl = idcc == 1 ? 9:19; 00896 00897 ifed=fedhonum[ic][idcc-1]; 00898 00899 //HTR fiber 00900 00901 if (ieta >= 5) ihtr_fi = HO_htr_fi_eta5to15[sidear][ieta - 5]; 00902 else if (ieta == 4){ 00903 if (phimod6 == 0 || phimod6 == 5) ihtr_fi = 3; 00904 else if (iside == 1) ihtr_fi = 2; 00905 else ihtr_fi = 4; 00906 } 00907 else{ 00908 if (iside == 1){ 00909 if (phimod6 == 4 || phimod6 == 3) ihtr_fi = 3; 00910 else if (phimod6 == 1 || phimod6 == 2) ihtr_fi = 4; 00911 else if (phimod6 == 0 || phimod6 == 5) ihtr_fi = 5; 00912 } 00913 else{ 00914 if (phimod6 == 4 || phimod6 == 3) ihtr_fi = 6; 00915 else if (phimod6 == 1 || phimod6 == 2) ihtr_fi = 7; 00916 else if (phimod6 == 0 || phimod6 == 5) ihtr_fi = 8; 00917 } 00918 } 00919 00920 //Fiber Channel 00921 //Eta >= 5 bools 00922 phi1458 = (iphi % 12 == 1 || iphi % 12 == 4 || iphi % 12 == 5 || iphi % 12 == 8); 00923 phi271011 = (iphi % 12 == 2 || iphi % 12 == 7 || iphi % 12 == 10 || iphi % 12 == 11); 00924 00925 //Ring 0 bools 00926 phir0v1 = (iphi % 24 == 0 || iphi % 24 == 2 || iphi % 24 == 4 || iphi % 24 == 18 || iphi % 24 == 20 || iphi % 24 == 22); 00927 phir0v2 = (iphi % 24 == 1 || iphi % 24 == 3 || iphi % 24 == 17 || iphi % 24 == 19 || iphi % 24 == 21 || iphi % 24 == 23); 00928 //v3: phi 5 to 15 odd; v4: phi 6 to 16 even 00929 phir0v3 = (iphi % 24 == 5 || iphi % 24 == 7 || iphi % 24 == 9 || iphi % 24 == 11 || iphi % 24 == 13 || iphi % 24 == 15); 00930 phir0v4 = (iphi % 24 == 6 || iphi % 24 == 8 || iphi % 24 == 10 || iphi % 24 == 12 || iphi % 24 == 14 || iphi % 24 == 16); 00931 00932 if (ieta >= 5){ 00933 if (ieta % 2 == 0 && phi1458) ifi_ch = 0; 00934 else if (ieta % 2 == 0 && iphi % 3 == 0) ifi_ch = 1; 00935 else if (ieta % 2 == 0 && phi271011) ifi_ch = 2; 00936 else if (ieta % 2 == 1 && iphi % 3 == 0) ifi_ch = 0; 00937 else if (ieta % 2 == 1 && phi271011) ifi_ch = 1; 00938 else if (ieta % 2 == 1 && phi1458) ifi_ch = 2; 00939 } 00940 else if (ieta == 4){ 00941 if (iside == -1){ 00942 if (phir0v1) ifi_ch = 0; 00943 else if (phir0v4) ifi_ch = 1; 00944 else if (iphi % 2 == 1) ifi_ch = 2; 00945 } 00946 else{ 00947 if (phir0v3) ifi_ch = 0; 00948 else if (phir0v2) ifi_ch = 1; 00949 else if (iphi % 2 == 0) ifi_ch = 2; 00950 } 00951 } 00952 //eta = -3 and eta = +2 00953 else if ((ieta == 3 && iside == -1) || (ieta == 2 && iside == 1)){ 00954 if (phir0v4) ifi_ch = 0; 00955 else if (phir0v3) ifi_ch = 1; 00956 else if (phir0v1 || phir0v2) ifi_ch = 2; 00957 } 00958 //eta = -2 and eta = +3 00959 else if ((ieta == 3 && iside == 1) || (ieta == 2 && iside == -1)){ 00960 if (phir0v2) ifi_ch = 0; 00961 else if (phir0v1) ifi_ch = 1; 00962 else if (phir0v3 || phir0v4) ifi_ch = 2; 00963 } 00964 //ieta = 1 00965 else if (ieta == 1){ 00966 if (phir0v1 || phir0v3) ifi_ch = 0; 00967 else if (phir0v2 || phir0v4) ifi_ch = 1; 00968 } 00969 00970 //Intentional integer truncation; iqie and iadc are the same across all subdetectors 00971 //(Although irm_fi for HF starts at 1 and for HO it starts at 2, so one can't just copy and paste) 00972 iqie = (irm_fi - 2) / 2 + 1; 00973 00974 if (irm_fi % 2 == 0) iadc = ifi_ch; 00975 else iadc = NFCH + (ifi_ch + 1) % 3; 00976 00977 //Pixel and Letter Code (Ring 0 is separate) 00978 if (ieta <= 4){ 00979 ipixel = ipixelHO[irm_fi - 2][ifi_ch][0]; 00980 letter = letterHO[irm_fi - 2][ifi_ch][0]; 00981 } 00982 else{ 00983 ipixel = ipixelHO[irm_fi - 2][ifi_ch][1]; 00984 letter = letterHO[irm_fi - 2][ifi_ch][1]; 00985 } 00986 00987 //RBX and sector 00988 00989 if (iside == -1) sidesign = 'M'; 00990 else sidesign = 'P'; 00991 00992 if (ieta <= 4) ring = 0; 00993 else if (ieta >= 5 && ieta <= 10) ring = 1; 00994 else ring = 2; 00995 00996 //Sector ranges from 1 to 12 depending on phi. Sector 1 goes 71,72,1,2,3,4 so I start at -2 00997 sector = 0; 00998 for (i = -2; i < iphi; i+=6){ 00999 sector++; 01000 } 01001 if (sector > 12) sector = 1; //It rolls over for phi = 71,72 01002 01003 isector = sector; 01004 01005 //For rings 1 and 2, we only want even sectors for the rbx 01006 if (ring != 0 && sector % 2 != 0) sector++; 01007 01008 if (ring == 0) sprintf (tempbuff, "%s%i%2.2d", det.c_str(), ring, sector); 01009 else sprintf (tempbuff, "%s%i%c%2.2d", det.c_str(), ring, sidesign, sector); 01010 mystream<<tempbuff; 01011 rbx = mystream.str(); 01012 mystream.str(""); 01013 01014 iwedge = -1000; 01015 irctcra = -1000; 01016 irctcar = -1000; 01017 irctcon = -1000; 01018 rctnam = "RCTNAM"; 01019 01020 islb = -1000; 01021 slbin = "SLBIN"; 01022 slnam = "SLNAM"; 01023 slbin2 = "NA"; 01024 01025 //printHO(); 01026 //writeXMLHO(OutXMLHO); 01027 01028 // Kukartsev 01029 int _crate = icrate; 01030 int _slot = ihtr; 01031 int _topbottom = itb; // string _topbottom = fpga; 01032 int _fiber = ihtr_fi; 01033 HTRPatternConfig _config; 01034 _config . crate = _crate; 01035 _config . slot = _slot; 01036 _config . topbottom = _topbottom; 01037 _config . fiber = _fiber; 01038 fillPatternInfo( _config ); 01039 } 01040 } 01041 } 01042 //writeXMLFooter(OutXMLHO); //End HO XML 01043 01044 01045 cout << configByCrate . size() << endl << endl; 01046 01047 int currentCrate = -1; 01048 string _fileNameByHOCrate; 01049 for( map< HTRPatternID, int >::const_iterator i = configByCrate . begin(); i != configByCrate . end(); i++ ) 01050 { 01051 //cout << i -> second << endl; 01052 if ( currentCrate != i -> second ) 01053 { 01054 if ( currentCrate != -1 ) write( _fileNameByHOCrate ); 01055 char _buf[50]; 01056 sprintf( _buf, "testHTRPatterns_%d.xml", i -> second ); 01057 _fileNameByHOCrate = _buf; 01058 getNewDocument( theFileName ); 01059 } 01060 01061 int _crate = i -> first . crate; 01062 int _slot = i -> first . slot; 01063 int _topbottom = i -> first . topbottom; 01064 int _fiber = i -> first . fiber; 01065 01066 _config . crate = _crate; 01067 _config . slot = _slot; 01068 _config . topbottom = _topbottom; 01069 _config . fiber = _fiber; 01070 _config . generalizedindex = 100*_slot + 10*_topbottom + _fiber; 01071 _config . creationstamp = getTimestamp( time( NULL ) ); 01072 addPattern( &_config ); 01073 01074 currentCrate = i -> second; 01075 } 01076 01077 //write the last file 01078 write( _fileNameByHOCrate ); 01079 01080 }
int XMLHTRPatterns::fillPatternInfo | ( | const HTRPatternConfig & | _conf | ) | [private] |
Definition at line 149 of file XMLHTRPatterns.cc.
References configByCrate.
Referenced by createByCrate().
00150 { 00151 HTRPatternID id_; 00152 id_ . crate = _conf . crate; 00153 id_ . slot = _conf . slot; 00154 id_ . topbottom = _conf . topbottom; 00155 id_ . fiber = _conf . fiber; 00156 00157 configByCrate[ id_ ] = _conf . crate; 00158 00159 return 0; 00160 }
const XMLHTRPatterns& XMLHTRPatterns::operator= | ( | const XMLHTRPatterns & | ) | [private] |
map< HTRPatternID, int > XMLHTRPatterns::configByCrate [private] |
Definition at line 99 of file XMLHTRPatterns.h.
Referenced by createByCrate(), and fillPatternInfo().
string XMLHTRPatterns::data_elements [private] |