Changeset 7173 for trunk/MagicSoft/Mars/mhbase
- Timestamp:
- 06/28/05 10:22:44 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/mhbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhbase/MH.cc
r6978 r7173 1204 1204 // -------------------------------------------------------------------------- 1205 1205 // 1206 // M.Gaug added this withouz Documentation1206 // 1207 1207 // 1208 1208 TH1I* MH::ProjectArray(const TArrayF &array, Int_t nbins, … … 1251 1251 // -------------------------------------------------------------------------- 1252 1252 // 1253 // M.Gaug added this withouz Documentation1253 // 1254 1254 // 1255 1255 TH1I* MH::ProjectArray(const TArrayD &array, Int_t nbins, const char* name, const char* title) … … 1297 1297 // -------------------------------------------------------------------------- 1298 1298 // 1299 // M.Gaug added this withouz Documentation1299 // 1300 1300 // 1301 1301 TH1I* MH::ProjectArray(const MArrayF &array, Int_t nbins, … … 1307 1307 // -------------------------------------------------------------------------- 1308 1308 // 1309 // M.Gaug added this withouz Documentation1309 // 1310 1310 // 1311 1311 TH1I* MH::ProjectArray(const MArrayD &array, Int_t nbins, const char* name, const char* title) … … 1324 1324 *fLog << "%) Evts skipped: " << str << endl; 1325 1325 } 1326 1327 // -------------------------------------------------------------------------- 1328 // 1329 // Calls gStyle->SetPalette. Allowed palettes are: 1330 // pretty 1331 // deepblue: darkblue -> lightblue 1332 // lightblue: black -> blue -> white 1333 // greyscale: black -> white 1334 // glow1: black -> darkred -> orange -> yellow -> white 1335 // glow2: 1336 // glowsym: lightblue -> blue -> black -> darkred -> orange -> yellow -> white 1337 // redish: darkred -> lightred 1338 // bluish: darkblue -> lightblue 1339 // small1: 1340 // 1341 // If the palette name contains 'inv' the order of the colors is inverted. 1342 // 1343 // The second argument determines the number of colors for the palette. 1344 // The default is 50. 'pretty' always has 50 colors. 1345 // 1346 // (Remark: Drawing 3D object like TH2D with surf3 allows a maximum 1347 // of 99 colors) 1348 // 1349 void MH::SetPalette(TString paletteName, Int_t ncol) 1350 { 1351 Bool_t found=kFALSE; 1352 1353 paletteName.ToLower(); 1354 1355 const Bool_t inverse = paletteName.Contains("inv"); 1356 1357 if (paletteName.Contains("pretty")) 1358 { 1359 gStyle->SetPalette(1, 0); 1360 ncol=50; 1361 found=kTRUE; 1362 } 1363 1364 if (paletteName.Contains("deepblue")) 1365 { 1366 Double_t s[5] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; 1367 Double_t r[5] = { 0.00, 0.09, 0.18, 0.09, 0.00 }; 1368 Double_t g[5] = { 0.01, 0.02, 0.39, 0.68, 0.97 }; 1369 Double_t b[5] = { 0.17, 0.39, 0.62, 0.79, 0.97 }; 1370 gStyle->CreateGradientColorTable(5, s, r, g, b, ncol); 1371 found=kTRUE; 1372 } 1373 1374 if (paletteName.Contains("lightblue")) 1375 { 1376 Double_t s[5] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; 1377 Double_t r[5] = { 0.00, 0.09, 0.18, 0.09, 0.00 }; 1378 Double_t g[5] = { 0.00, 0.02, 0.40, 0.70, 1.00 }; 1379 Double_t b[5] = { 0.00, 0.27, 0.51, 0.81, 1.00 }; 1380 gStyle->CreateGradientColorTable(5, s, r, g, b, ncol); 1381 found=kTRUE; 1382 } 1383 1384 if (paletteName.Contains("greyscale")) 1385 { 1386 double s[2] = {0.00, 1.00}; 1387 double r[2] = {0.00, 1.00}; 1388 double g[2] = {0.00, 1.00}; 1389 double b[2] = {0.00, 1.00}; 1390 gStyle->CreateGradientColorTable(2, s, r, g, b, ncol); 1391 found=kTRUE; 1392 } 1393 1394 if (paletteName.Contains("glow1")) 1395 { 1396 double s[5] = {0., 0.10, 0.45, 0.75, 1.00}; 1397 double r[5] = {0., 0.35, 0.85, 1.00, 1.00}; 1398 double g[5] = {0., 0.10, 0.20, 0.73, 1.00}; 1399 double b[5] = {0., 0.03, 0.06, 0.00, 1.00}; 1400 gStyle->CreateGradientColorTable(5, s, r, g, b, ncol); 1401 found=kTRUE; 1402 } 1403 1404 if (paletteName.Contains("glow2")) 1405 { 1406 double s[4] = {0.00, 0.50, 0.75, 1.00}; 1407 double r[4] = {0.24, 0.67, 1.00, 1.00}; 1408 double g[4] = {0.03, 0.04, 0.80, 1.00}; 1409 double b[4] = {0.03, 0.04, 0.00, 1.00}; 1410 gStyle->CreateGradientColorTable(4, s, r, g, b, ncol); 1411 found=kTRUE; 1412 } 1413 1414 if (paletteName.Contains("glowsym")) 1415 { 1416 double s[8] = {0.00, 0.17, 0.39, 0.50, 0.55, 0.72, 0.88, 1.00}; 1417 double r[8] = {0.09, 0.18, 0.09, 0.00, 0.35, 0.85, 1.00, 1.00}; 1418 double g[8] = {0.70, 0.40, 0.02, 0.00, 0.10, 0.20, 0.73, 1.00}; 1419 double b[8] = {0.81, 0.51, 0.27, 0.00, 0.03, 0.06, 0.00, 1.00}; 1420 gStyle->CreateGradientColorTable(8, s, r, g, b, ncol); 1421 found=kTRUE; 1422 } 1423 1424 if (paletteName.Contains("redish")) 1425 { 1426 double s[3] = {0., 0.5, 1.}; 1427 double r[3] = {0., 1.0, 1.}; 1428 double g[3] = {0., 0.0, 1.}; 1429 double b[3] = {0., 0.0, 1.}; 1430 gStyle->CreateGradientColorTable(3, s, r, g, b, ncol); 1431 found=kTRUE; 1432 } 1433 1434 if (paletteName.Contains("bluish")) 1435 { 1436 double s[3] = {0., 0.5, 1.}; 1437 double r[3] = {0., 0.0, 1.}; 1438 double g[3] = {0., 0.0, 1.}; 1439 double b[3] = {0., 1.0, 1.}; 1440 gStyle->CreateGradientColorTable(3, s, r, g, b, ncol); 1441 found=kTRUE; 1442 } 1443 1444 if (paletteName.Contains("small1")) 1445 { 1446 double s[4] = {0.00, 0.50, 0.95, 1.}; 1447 double r[4] = {0.04, 0.28, 0.98, 1.}; 1448 double g[4] = {0.28, 0.93, 0.03, 1.}; 1449 double b[4] = {0.79, 0.11, 0.03, 1.}; 1450 gStyle->CreateGradientColorTable(4, s, r, g, b, ncol); 1451 found=kTRUE; 1452 } 1453 1454 if (inverse) 1455 { 1456 TArrayI c(ncol); 1457 for (int i=0; i<ncol; i++) 1458 c[ncol-i-1] = gStyle->GetColorPalette(i); 1459 gStyle->SetPalette(ncol, c.GetArray()); 1460 } 1461 1462 if (!found) 1463 gLog << warn << "MH::SetPalette: Palette " << paletteName << " unknown... ignored." << endl; 1464 } -
trunk/MagicSoft/Mars/mhbase/MH.h
r6978 r7173 117 117 static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL); 118 118 119 static void SetPalette(TString paletteName, Int_t ncol=50); 120 119 121 ClassDef(MH, 2) //A base class for Mars histograms 120 122 };
Note:
See TracChangeset
for help on using the changeset viewer.