本文整理汇总了C++中TObjString类的典型用法代码示例。如果您正苦于以下问题:C++ TObjString类的具体用法?C++ TObjString怎么用?C++ TObjString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TObjString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SetAliEnSettings
void SetAliEnSettings()
{
// Routine to load settings from an AliEn environment file.
ifstream fileIn;
fileIn.open(Form("/tmp/gclient_env_%d", gSystem->GetUid()));
if (gDebug>0) {printf("P010_TAlien.C: parsing /tmp/gclient_env_$UID\n");}
TString lineS,tmp;
char line[4096];
while (fileIn.good()){
fileIn.getline(line,4096,'\n');
lineS = line;
if (lineS.IsNull()) continue;
if (lineS.Contains("export ")) {
lineS.ReplaceAll("export ","");
TObjArray* array = lineS.Tokenize("=");
if (array->GetEntries() == 2) {
TObjString *strVar = (TObjString *) array->At(0);
TObjString *strVal = (TObjString *) array->At(1);
if ((strVar)&&(strVal)) {
tmp = strVal->GetString();
tmp.ReplaceAll("\"","");
tmp.ReplaceAll("$LD_LIBRARY_PATH",gSystem->Getenv("LD_LIBRARY_PATH"));
tmp.ReplaceAll("$DYLD_LIBRARY_PATH",gSystem->Getenv("DYLD_LIBRARY_PATH"));
tmp.ReplaceAll(" ","");
gSystem->Unsetenv(strVar->GetString());
gSystem->Setenv(strVar->GetString(), tmp);
if (gDebug>0) {
Info("P010_TAlien", "setting environment %s=\"%s\"", strVar->GetString().Data(), tmp.Data());
}
if (!strVar->GetString().CompareTo("GCLIENT_SERVER_LIST")) {
gSystem->Unsetenv("alien_API_SERVER_LIST");
gSystem->Setenv("alien_API_SERVER_LIST", tmp);
}
}
if (array) {
delete array;
array = 0 ;
}
} else {
// parse the MONA_ stuff
TObjArray* array = lineS.Tokenize("\" ");
TString key="";
TString val="";
for (int i=0; i< array->GetEntries(); i++) {
if ( ((TObjString*) array->At(i))->GetString().Contains("=")) {
if (key.Length() && val.Length()) {
val.Resize(val.Length()-1);
if (gDebug>0) {
Info("P010_TAlien", "setting environment %s=\"%s\"", key.Data(), val.Data());
}
gSystem->Unsetenv(key);
gSystem->Setenv(key, val);
key="";
val="";
}
key = ((TObjString*) array->At(i))->GetString();
key.ReplaceAll("=","");
} else {
val+=((TObjString*) array->At(i))->GetString();
val+=" ";
}
}
if (key.Length() && val.Length()) {
if (gDebug>0) {
Info("P010_TAlien", "setting environment %s=\"%s\"", key.Data(), val.Data());
}
gSystem->Unsetenv(key);
gSystem->Setenv(key, val);
}
}
}
}
}
开发者ID:0x0all,项目名称:ROOT,代码行数:78,代码来源:P010_TAlien.C
示例2: TMVAGui
// main GUI
void TMVAGui( const char* fName = "~/cern/ntuples/TMVA.root" )
{
// Use this script in order to run the various individual macros
// that plot the output of TMVA (e.g. running TMVAClassification.C),
// stored in the file "TMVA.root"
TString curMacroPath(gROOT->GetMacroPath());
//std::cout << curMacroPath << std::endl;
// uncomment next line for macros submitted to next root version
gROOT->SetMacroPath(curMacroPath+".:/:$ROOTSYS/tmva/test/:");
// for the sourceforge version, including $ROOTSYS/tmva/test in the
// macro path is a mistake, especially if "./" was not part of path
// add ../macros to the path (comment out next line for the ROOT version of TMVA)
// gROOT->SetMacroPath(curMacroPath+":../macros:");
TString curIncludePath=gSystem->GetIncludePath();
TString newIncludePath=TString("-I../ ")+curIncludePath;
gSystem->SetIncludePath(newIncludePath);
cout << "--- Launch TMVA GUI to view input file: " << fName << endl;
// init
TMVAGui_inactiveButtons.clear();
// check if file exist
TFile* file = TFile::Open( fName );
if (!file) {
cout << "==> Abort TMVAGui, please verify filename" << endl;
return;
}
// find all references
TMVAGui_keyContent = (TList*)file->GetListOfKeys()->Clone();
// close file
file->Close();
TString defaultRequiredClassifier = "";
// gROOT->Reset();
// gStyle->SetScreenFactor(2); // if you have a large screen, select 1,2 or 1.4
// create the control bar
TControlBar* cbar = new TControlBar( "vertical", "TMVA Plotting Macros for Classification", 0, 0 );
const TString buttonType( "button" );
// configure buttons
Int_t ic = 1;
// find all input variables types
TList* keylist = GetKeyList( "InputVariables" );
TListIter it( keylist );
TObjString* str = 0;
char ch = 'a';
while ((str = (TObjString*)it())) {
TString tmp = str->GetString();
TString title = Form( "Input variables '%s'-transformed (training sample)",
tmp.ReplaceAll("InputVariables_","").Data() );
if (tmp.Contains( "Id" )) title = "Input variables (training sample)";
ActionButton( cbar,
Form( "(%i%c) %s", ic, ch++, title.Data() ),
Form( ".x variables.C+(\"%s\",\"%s\",\"%s\")", fName, str->GetString().Data(), title.Data() ),
Form( "Plots all '%s'-transformed input variables (macro variables.C(...))", str->GetString().Data() ),
buttonType, str->GetString() );
}
ic++;
// correlation scatter plots
it.Reset(); ch = 'a';
while ((str = (TObjString*)it())) {
TString tmp = str->GetString();
TString title = Form( "Input variable correlations '%s'-transformed (scatter profiles)",
tmp.ReplaceAll("InputVariables_","").Data() );
if (tmp.Contains( "Id" )) title = "Input variable correlations (scatter profiles)";
ActionButton( cbar,
Form( "(%i%c) %s", ic, ch++, title.Data() ),
Form( ".x CorrGui.C+(\"%s\",\"%s\",\"%s\")", fName, str->GetString().Data(), title.Data() ),
Form( "Plots all correlation profiles between '%s'-transformed input variables (macro CorrGui.C(...))",
str->GetString().Data() ),
buttonType, str->GetString() );
}
TString title;
// coefficients
title =Form( "(%i) Input Variable Linear Correlation Coefficients", ++ic );
ActionButton( cbar,
title,
Form( ".x correlations.C+(\"%s\")", fName ),
"Plots signal and background correlation summaries for all input variables (macro correlations.C)",
buttonType );
title =Form( "(%ia) Classifier Output Distributions (test sample)", ++ic );
ActionButton( cbar,
title,
Form( ".x mvas.C+(\"%s\",0)", fName ),
"Plots the output of each classifier for the test data (macro mvas.C(...,0))",
buttonType, defaultRequiredClassifier );
//.........这里部分代码省略.........
开发者ID:apmorris,项目名称:scripts,代码行数:101,代码来源:TMVAGui.C
示例3: draw_syst_hists
void draw_syst_hists( const char* inwsfile, const char* syst_name, int sig_mass = 0, float max_msig_evts = 8., float max_msb_evts = 16. ) {
gStyle -> SetOptStat(0) ;
gStyle -> SetPadLeftMargin(0.15) ;
gStyle -> SetTitleW( 0.9 ) ;
gDirectory -> Delete( "h*" ) ;
loadHist( inwsfile ) ;
TLine* line = new TLine() ;
line -> SetLineStyle(2) ;
//----
gSystem -> Exec( "mkdir -p outputfiles/syst-plots" ) ;
TString infile_ts( inwsfile ) ;
TObjArray* tokens = infile_ts.Tokenize("/") ;
TObjString* tos = (TObjString*) (tokens -> At( tokens->GetEntries() - 1 ) ) ;
TString fname( tos->GetString() ) ;
printf( "ws file name : %s\n", fname.Data() ) ;
TString pdfbasename = fname.ReplaceAll(".root","") ;
printf(" pdf base name : %s\n", pdfbasename.Data() ) ;
char sigsb_str[2][10] = { "msig", "msb" } ;
for ( int ssbi=0; ssbi<2; ssbi++ ) {
char cname[100] ;
sprintf( cname, "can_evts_%s", sigsb_str[ssbi] ) ;
TCanvas* can_evts = (TCanvas*) gDirectory -> FindObject( cname ) ;
if ( can_evts == 0x0 ) {
if ( ssbi == 0 ) {
can_evts = new TCanvas( cname, "SIG observables", 1100, 300 ) ;
} else {
can_evts = new TCanvas( cname, "SB observables", 1100, 300 ) ;
}
}
sprintf( cname, "can_frac_%s", sigsb_str[ssbi] ) ;
TCanvas* can_frac = (TCanvas*) gDirectory -> FindObject( cname ) ;
if ( can_frac == 0x0 ) {
if ( ssbi == 0 ) {
can_frac = new TCanvas( cname, "SIG observables, syst (%)", 1100, 300 ) ;
} else {
can_frac = new TCanvas( cname, "SB observables, syst (%)", 1100, 300 ) ;
}
}
can_evts -> Clear() ;
can_evts -> Divide(4,1) ;
can_frac -> Clear() ;
can_frac -> Divide(4,1) ;
for ( int ci=1; ci<=4; ci++ ) {
char hname[1000] ;
char hnamev[1000] ;
char hnamenf[1000] ;
sprintf( hname, "h_syst_%s_%s_met%d_nom", syst_name, sigsb_str[ssbi], ci ) ;
TH1F* hist_nom = (TH1F*) gDirectory -> FindObject( hname ) ;
if ( hist_nom == 0x0 ) { printf("\n\n *** Can't find %s\n\n", hname ) ; return ; }
sprintf( hnamenf, "%s_nf", hname ) ;
TH1F* hist_nom_nf = (TH1F*) hist_nom -> Clone( hnamenf ) ;
sprintf( hname, "h_syst_%s_%s_met%d_m1s", syst_name, sigsb_str[ssbi], ci ) ;
TH1F* hist_m1s = (TH1F*) gDirectory -> FindObject( hname ) ;
if ( hist_m1s == 0x0 ) { printf("\n\n *** Can't find %s\n\n", hname ) ; return ; }
sprintf( hnamev, "%s_var", hname ) ;
TH1F* hist_m1s_var = (TH1F*) hist_m1s -> Clone( hnamev ) ;
sprintf( hname, "h_syst_%s_%s_met%d_p1s", syst_name, sigsb_str[ssbi], ci ) ;
TH1F* hist_p1s = (TH1F*) gDirectory -> FindObject( hname ) ;
if ( hist_p1s == 0x0 ) { printf("\n\n *** Can't find %s\n\n", hname ) ; return ; }
sprintf( hnamev, "%s_var", hname ) ;
TH1F* hist_p1s_var = (TH1F*) hist_p1s -> Clone( hnamev ) ;
TString htitle ;
htitle = hist_nom -> GetTitle() ;
if ( sig_mass > 0 ) {
char sigmassstr[1000] ;
sprintf( sigmassstr, ", higgsino mass = %d", sig_mass ) ;
htitle.ReplaceAll( ", nominal", sigmassstr ) ;
} else {
htitle.ReplaceAll( ", nominal", "" ) ;
}
hist_nom -> SetTitle( htitle ) ;
htitle = hist_m1s_var -> GetTitle() ;
//.........这里部分代码省略.........
开发者ID:owen234,项目名称:hbb-stats,代码行数:101,代码来源:draw_syst_hists.c
示例4: run_reco
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
void run_reco( TString mcEngine="TGeant3", Bool_t AlignDone=true )
{
// ---- Load libraries -------------------------------------------------
FairLogger *logger = FairLogger::GetLogger();
// logger->SetLogFileName("MyLog.log");
logger->SetLogToScreen(kTRUE);
// logger->SetLogToFile(kTRUE);
// logger->SetLogVerbosityLevel("HIGH");
// logger->SetLogFileLevel("DEBUG4");
logger->SetLogScreenLevel("INFO");
// Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug)
Int_t iVerbose = 0; // just forget about it, for the moment
TString Align= "";
if (AlignDone) {
Align= "align_";
}
TString InDir = "./data/";
// Input file (MC Events)
TString inFile ="testrun_";
inFile = InDir +inFile + Align + mcEngine + ".root";
// Output file name
TString outFile ="testreco_";
outFile = InDir + outFile + Align + mcEngine + ".root";
// Parameter file
TString parFile ="testparams_";
parFile = InDir + parFile + Align + mcEngine + ".root";
// Millepede file name
TString milleFile ="testmille_";
milleFile = InDir + milleFile + Align + mcEngine;
TList *parFileList = new TList();
TString workDir = gSystem->Getenv("VMCWORKDIR");
TString paramDir = workDir + "/simulation/Tutorial4/parameters/";
TString paramFile = paramDir + "example.par";
TObjString tutDetDigiFile;
tutDetDigiFile.SetString(paramFile);
parFileList->Add(&tutDetDigiFile);
// ----- Timer --------------------------------------------------------
TStopwatch timer;
// ----- Reconstruction run -------------------------------------------
FairRunAna *fRun= new FairRunAna();
FairFileSource *fFileSource = new FairFileSource(inFile);
fRun->SetSource(fFileSource);
fRun->SetSink(new FairRootFileSink(outFile));
FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
FairParRootFileIo* parInput1 = new FairParRootFileIo();
FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
parIo2->open(parFileList, "in");
parInput1->open(parFile.Data());
parIo2->open(parFileList, "in");
rtdb->setFirstInput(parInput1);
rtdb->setSecondInput(parIo2);
rtdb->setOutput(parInput1);
rtdb->saveOutput();
// ----- TorinoDetector hit producers ---------------------------------
FairTutorialDet4HitProducerIdealMisalign* hitProducer = new FairTutorialDet4HitProducerIdealMisalign();
hitProducer->DoMisalignment(kFALSE);
fRun->AddTask(hitProducer);
FairTutorialDet4StraightLineFitter* fitter = new FairTutorialDet4StraightLineFitter();
fitter->SetVersion(2);
fRun->AddTask(fitter);
FairTutorialDet4MilleWriter* writer = new FairTutorialDet4MilleWriter();
// writer->SetWriteAscii(kTRUE);
writer->SetVersion(2);
writer->SetFileName(milleFile);
fRun->AddTask(writer);
fRun->Init();
timer.Start();
fRun->Run();
// ----- Finish -------------------------------------------------------
cout << endl << endl;
// Extract the maximal used memory an add is as Dart measurement
// This line is filtered by CTest and the value send to CDash
FairSystemInfo sysInfo;
//.........这里部分代码省略.........
开发者ID:FairRootGroup,项目名称:FairRoot,代码行数:101,代码来源:run_reco.C
示例5: FnormMacro
//_____________________________________________________________________________
void FnormMacro(
const char* filename="../LHC15g.MuMu.1.root",
const char* associatedSimFileName="",
const char* associatedSimFileName2="",
const char* beamYear="PbPb2011",const int DebugLevel =0)
{
// //_____ FNorm
// analysis.ComputeIntFnormFromCounters("",kFALSE);
// //_____
AliAnalysisMuMu ana(filename,associatedSimFileName,associatedSimFileName2,beamYear);
AliLog::SetGlobalDebugLevel(DebugLevel);
if (!ana.OC() || !ana.CC())
{
AliError("No mergeable/counter collection. Consider Upgrade()");
return ;
}
else
{
cout << " ================================================================ " << endl;
cout << " Compute Mean Fnorm From Counters " << endl;
cout << " ================================================================ " << endl;
}
// Get configuration settings
TObjArray* eventTypeArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kEventSelectionList,IsSimulation());
TObjArray* triggerMuonArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kDimuonTriggerList,IsSimulation());
TObjArray* triggerMBArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kMinbiasTriggerList,IsSimulation());
TObjArray* centralityArray = ana.Config()->GetListElements(AliAnalysisMuMuConfig::kCentralitySelectionList, IsSimulation());
// Iterator for loops
TIter nextTriggerMuon(triggerMuonArray);
TIter nextTriggerMB(triggerMBArray);
TIter nextEventType(eventTypeArray);
TIter nextCentrality(centralityArray);
// Strings
TObjString* striggerMuon;
TObjString* striggerMB;
TObjString* seventType;
TObjString* scentrality;
//Pointers on histo
TH1*h(0x0);
TH1*h1(0x0);
TH1*h2(0x0);
Double_t FNormOverStat(0.);
Double_t FNormTotError(0.);
Double_t FNormTotErrorInverse(0.);
Double_t FNormTotErrorSys(0.);
Double_t Norm(1.);
Int_t n =0; //counter
nextEventType.Reset();
// Loop on each envenType (see MuMuConfig)
//==============================================================================
while ( ( seventType = static_cast<TObjString*>(nextEventType())) )
{
AliDebug(1,Form("EVENTTYPE %s",seventType->String().Data()));
nextTriggerMuon.Reset();
// Loop on each Muon trigger (see MuMuConfig)
//==============================================================================
while ( ( striggerMuon = static_cast<TObjString*>(nextTriggerMuon())) )
{
AliDebug(1,Form("-MUON TRIGGER %s",striggerMuon->String().Data()));
nextTriggerMB.Reset();
// Loop on each MB trigger (not the ones in MuMuConfig but the ones set)
//==============================================================================
while ( ( striggerMB = static_cast<TObjString*>(nextTriggerMB())) )
{
AliDebug(1,Form("-- MB PAIRCUT %s",striggerMB->String().Data()));
nextCentrality.Reset();
// Loop on each centrality
//==============================================================================
while ( ( scentrality = static_cast<TObjString*>(nextCentrality()) ) )
{
TString id(Form("/FNORM-%s/%s/%s/PbPb",striggerMuon->String().Data(),seventType->String().Data(),scentrality->String().Data())); // Path where are saved histos in the mergeable collection
h = OC()->Histo(id.Data(),Form("hFNormIntVSrun_%s",striggerMB->String().Data()));
if (!h)
{
AliDebug(1,Form("Can't get histo %s/hFNormIntVSrun_%s",id.Data(),striggerMB->String().Data()));
continue;
}
h1 = OC()->Histo(id.Data(),Form("hFNormInt_%s",striggerMB->String().Data()));
if (!h1)
{
AliDebug(1,Form("Can't get histo %s/hFNormInt_%s",id.Data(),striggerMB->String().Data()));
continue;
}
//.........这里部分代码省略.........
开发者ID:benjaminaudurier,项目名称:Macro,代码行数:101,代码来源:MeanFnorm.C
示例6: TGMainFrame
//______________________________________________________________________________
ButtonWindow::ButtonWindow()
: TGMainFrame(gClient->GetRoot(), 600, 500)
{
// Main test window.
SetWindowName("CaLib Control Panel");
// ---------------------------------------------------------------------------------
TGGroupFrame* config_frame = new TGGroupFrame(this, "Calibration and set configuration", kHorizontalFrame);
config_frame->SetTitlePos(TGGroupFrame::kLeft);
TGVerticalFrame* ver_frame_1 = new TGVerticalFrame(config_frame);
// calibration selection
fCBox_Calibration = new TGComboBox(ver_frame_1, "Choose calibration");
fCBox_Calibration->Resize(260, 25);
ver_frame_1->AddFrame(fCBox_Calibration, new TGLayoutHints(kLHintsLeft, 0, 5, 10, 0));
// fill calibrations
gCalibrations = TCMySQLManager::GetManager()->GetAllCalibrations();
for (Int_t i = 0; i < gCalibrations->GetSize(); i++)
{
TObjString* s = (TObjString*) gCalibrations->At(i);
fCBox_Calibration->AddEntry(s->GetString().Data(), i);
}
fCBox_Calibration->Connect("Selected(Int_t)", "ButtonWindow", this, "EnableModuleSelection(Int_t)");
// calibration module selection
fCBox_Module = new TGComboBox(ver_frame_1, "Choose calibration module");
fCBox_Module->Resize(260, 25);
ver_frame_1->AddFrame(fCBox_Module, new TGLayoutHints(kLHintsLeft, 0, 5, 10, 0));
// fill modules
for (Int_t i = 0; i < gCaLibModules->GetSize(); i++)
{
TCCalib* cmod = (TCCalib*) gCaLibModules->At(i);
fCBox_Module->AddEntry(cmod->GetTitle(), i);
}
fCBox_Module->Connect("Selected(Int_t)", "ButtonWindow", this, "ReadRunsets(Int_t)");
config_frame->AddFrame(ver_frame_1, new TGLayoutHints(kLHintsFillX));
TGVerticalFrame* ver_frame_2 = new TGVerticalFrame(config_frame);
// runset selection
fLB_RunSet = new TGListBox(ver_frame_2);
fLB_RunSet->SetMultipleSelections(kTRUE);
fLB_RunSet->Resize(120, 60);
ver_frame_2->AddFrame(fLB_RunSet, new TGLayoutHints(kLHintsLeft | kLHintsExpandY | kLHintsExpandX, 5, 0, 10, 0));
config_frame->AddFrame(ver_frame_2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
AddFrame(config_frame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5));
// ---------------------------------------------------------------------------------
// control buttons
TGGroupFrame* control_frame = new TGGroupFrame(this, "Calibration control", kHorizontalFrame);
control_frame->SetTitlePos(TGGroupFrame::kLeft);
fTB_Init = new TGTextButton(control_frame, "Start module");
ResizeFrame(fTB_Init);
fTB_Init->Connect("Clicked()", "ButtonWindow", this, "StartModule()");
control_frame->AddFrame(fTB_Init, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
fTB_Write = new TGTextButton(control_frame, "Write to DB");
ResizeFrame(fTB_Write);
fTB_Write->Connect("Clicked()", "ButtonWindow", this, "DoWrite()");
control_frame->AddFrame(fTB_Write, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
fTB_Print = new TGTextButton(control_frame, "Print values");
ResizeFrame(fTB_Print);
fTB_Print->Connect("Clicked()", "ButtonWindow", this, "Print()");
control_frame->AddFrame(fTB_Print, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
fTB_PrintChanges = new TGTextButton(control_frame, "Print changes");
ResizeFrame(fTB_PrintChanges);
fTB_PrintChanges->Connect("Clicked()", "ButtonWindow", this, "PrintChanges()");
control_frame->AddFrame(fTB_PrintChanges, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
fTB_Quit = new TGTextButton(control_frame, "Quit");
ResizeFrame(fTB_Quit);
fTB_Quit->Connect("Clicked()", "ButtonWindow", this, "Quit()");
control_frame->AddFrame(fTB_Quit, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
AddFrame(control_frame, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 5));
// ---------------------------------------------------------------------------------
TGHorizontalFrame* nav_main_frame = new TGHorizontalFrame(this);
// manual navigation
TGGroupFrame* nav_man_frame = new TGGroupFrame(nav_main_frame, "Manual navigation", kHorizontalFrame);
nav_man_frame->SetTitlePos(TGGroupFrame::kLeft);
fTB_Prev = new TGTextButton(nav_man_frame, "Previous");
ResizeFrame(fTB_Prev);
fTB_Prev->SetToolTipText("Go to previous element", 200);
fTB_Prev->Connect("Clicked()", "ButtonWindow", this, "DoPrev()");
//.........这里部分代码省略.........
开发者ID:Physott,项目名称:acqu,代码行数:101,代码来源:CalibrateGUI.C
示例7: html_a_directory
///
/// Process a directory recursively.
///
void html_a_directory(TDirectory *f, TString path, TEnv *params)
{
TCanvas *c_h1 = 0;
if (c_h1 == 0) {
int x = params->GetValue("H1.XSize", 150);
int y = params->GetValue("H1.YSize", 100);
c_h1 = new TCanvas ("c_h1", "1d plots", x, y);
}
///
/// Check how to make gif plots
///
char command[512];
sprintf(command, "which pstoimg &> /dev/null");
bool UsePstoimg = ! system(command);
///
/// Generate the output directory
///
gSystem->MakeDirectory (path);
///
/// Get the html started
///
ofstream html (path + "/index.html");
html << "<html><head><title>" << f->GetName() << "</title></head>" << endl;
html << "<body>" << endl;
html << "<h1>" << f->GetName() << "</h1>" << endl;
cout << "Processing directory " << f->GetName() << endl;
///
/// Now loop over all the keys in the directory
///
f->cd();
TList *objlist = f->GetListOfKeys();
objlist->Sort(); // order alphabetically, instead of order in which they were written
TIterator *itr = objlist->MakeIterator();
TKey *key;
while ((key = static_cast<TKey*>(itr->Next())) != 0) {
TObject *obj = key->ReadObj();
if (obj->IsA()->InheritsFrom("TDirectory")) {
TDirectory *d = static_cast<TDirectory*>(obj);
html << "<br><a href=\"" << d->GetName() << "/\">" << d->GetName() << "</a>" << endl;
html_a_directory(d, path + "/" + d->GetName(), params);
}
else if (obj->IsA()->InheritsFrom("TObjString")) {
TObjString *s = static_cast<TObjString*>(obj);
html << "<p><h2>" << key->GetName() << "</h2>" << endl;
//html << "<blockquote><pre>" << static_cast<char*>(s->GetString())
// << "</pre></blockquote></p>"
// << endl;
html << "<blockquote><pre>" << (s->GetString()).Data() << "</pre></blockquote></p>"<< endl;
}
// else if (obj->IsA()->InheritsFrom("CutFlowTable")) {
// CutFlowTable *c = static_cast<CutFlowTable*> (obj);
//
// html << "<p><h2>" << key->GetName() << "</h2>" << endl;
//
// CFTPrinterHTML txt (html);
// f->cd();
// c->PrintGlobal (txt, "All Events", "");
// html << "</p>" << endl;
// }
else if (obj->IsA()->InheritsFrom("TCanvas")) {
TCanvas *cnv = static_cast<TCanvas*>(obj);
cnv->Draw();
cnv->SaveAs(path + "/" + key->GetName() + ".eps");
if (UsePstoimg) {
sprintf(command, "pstoimg -type=gif %s &> /dev/null",(path + "/" + key->GetName() + ".eps").Data());
if (system(command) != 0) {
cout<<"Could not convert to gif: "<<path + "/" + key->GetName() + ".eps"<<endl;
abort();
}
} else cnv->SaveAs(path + "/" + key->GetName() + ".gif");
cnv->Close();
html << "<p><a href=\"" << key->GetName() << ".eps\">";
html << "<img src=\"" << key->GetName() << ".gif\">";
html << "</a> <br> " << key->GetName() << ".gif </p>" << endl;
}
else if (obj->IsA()->InheritsFrom("TH1") && !(obj->IsA()->InheritsFrom("TH2"))) {
TH1 *h = static_cast<TH1*> (obj);
c_h1->cd();
//.........这里部分代码省略.........
开发者ID:arangb,项目名称:usercode,代码行数:101,代码来源:make_all_plot_html.C
示例8: Draweff
void Draweff(){
int sth=0, Gth=0;
TFile *f = TFile::Open(outG);
if(sth==0){TString dirname = "std";}
else if(sth==1){TString dirname ="Gri055";}
else {TString dirname ="Gri101";}
gStyle->SetErrorX(0);
TString name;
TObjString* dataname = (TObjString*)f->Get(Form("dataname"));
TObjString* histoname = (TObjString*)f->Get(Form("histoname"));
if(Gth==0)
name = "G0";
else if(Gth<nGlau)
name = Form("Glau_%d",Gth);
else
name = Form("bin_%d",Gth-nGlau+1);
TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data()));
TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data()));
TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data()));
TVectorD* mubest = (TVectorD*)f->Get(Form("%s/%s/mubest",dirname.Data(),name.Data()));
TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data()));
TVectorD* Ndf = (TVectorD*)f->Get(Form("%s/%s/Ndf",dirname.Data(),name.Data()));
TVectorD* chis = (TVectorD*)f->Get(Form("%s/%s/chis",dirname.Data(),name.Data()));
TVectorD *kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data()));
TFile *fdata = TFile::Open(dataname->GetString());
TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetString());
histo_obs->Sumw2();
TFile *fGlauber = TFile::Open(Glaubername->GetString());
int binnum = histo_obs->GetNbinsX();
double Minx = histo_obs->GetXaxis()->GetXmin();
double Maxx = histo_obs->GetXaxis()->GetXmax();
double binsize = (Double_t)(Maxx-Minx)/binnum;
int xbinmin=(int)(((*xmin)[0]-Minx)/binsize);
int xbinmax=(int)(((*xmax)[0]-Minx)/binsize);
TH1D *histo_exp = new TH1D("histo_exp","Simulated distribution;Multiplicity;Event Fraction",binnum,Minx,Maxx);
histo_exp->Sumw2();
Int_t ibin;
TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone();
histo_obs_norm->Scale(1/histo_obs->Integral(xbinmin,xbinmax));
TF1 *NBD_fun = new
TF1("NBD_fun","[0]*TMath::Gamma(x+[1])/(TMath::Gamma(x+1)*TMath::Gamma([1]))*TMath::Power([2]/[1],x)/TMath::Power([2]/[1]+1,x+[1])",0,100);
NBD_fun->SetParameter(0,1); //[0]: Normalized constant
NBD_fun->SetParameter(1,(*kbest)[0]); //[1]: k value
NBD_fun->SetParameter(2,(*mubest)[0]); //[2]: mu value
TTree *t = (TTree*) fGlauber->Get("nt_Pb_Pb");
Long_t Nevent;
Nevent = (Long_t) t->GetEntries();
Long_t Ev; Int_t Bino; Double_t Para, Bi_Para, Mult;
Float_t Ncoll;
t->SetBranchAddress("Ncoll",&Ncoll);
for(Ev=0; Ev<Nevent; Ev++){
if(Ev%100000==0) cout<<"Have run "<<Ev<<" events"<<endl;
t->GetEntry(Ev);
Para = 0; //make sure that Para doesn't accumulate through loops
for(Bino=0; Bino<Ncoll; Bino++){
Bi_Para = NBD_fun->GetRandom();
Para += Bi_Para;
}
histo_exp->Fill(Para);
}
Double_t SumEvent, scale;
SumEvent = histo_exp->Integral(xbinmin,xbinmax);
scale = 1/SumEvent;
TH1D *histo_exp_norm = (TH1D*) histo_exp->Clone();
histo_exp_norm->Scale(scale);
TCanvas *c1 = new TCanvas();
gStyle->SetOptStat(kFALSE);
double hfbin[]={0,1,2,3,4,6,8,10,13,16,20,25,30,40,55,70,90};
int nhfbin = 16;
rehisto_obs_norm = (TH1D*)histo_obs_norm->Rebin(nhfbin,"rehisto_obs_norm",hfbin);
normalizeByBinWidth(rehisto_obs_norm);
rehisto_exp_norm = (TH1D*)histo_exp_norm->Rebin(nhfbin,"rehisto_exp_norm",hfbin);
normalizeByBinWidth(rehisto_exp_norm);
TH1D* ratio = (TH1D*)rehisto_obs_norm->Clone("ratio");
ratio->Divide(rehisto_exp_norm);
ratio->SetMaximum(1.2);
ratio->SetMinimum(0);
ratio->GetXaxis()->SetTitle("HF #Sigma E_{T}");
ratio->GetYaxis()->SetTitle("ratio");
/*
开发者ID:XuQiao,项目名称:HI,代码行数:88,代码来源:Draweff.C
示例9: scanDirectory
void scanDirectory(const char *dirname)
{
TDirectoryIter iter(dirname);
const char *filename = 0;
TString ent;
TString file;
TString html;
html.Form(gPreamble,dirname,dirname);
TList dirList;
TList fileList;
while( (filename=iter.Next()) )
{
if (filename[0]!='.') {
ent.Form("%s/%s", dirname, filename);
FileStat_t st;
gSystem->GetPathInfo(ent.Data(), st);
if (R_ISDIR(st.fMode)) {
//fprintf(stderr,"Seeing directory %s\n",ent.Data());
scanDirectory(ent.Data());
dirList.Add(new TObjString(filename));
} else {
size_t len = strlen(filename);
if (len > 8 && strncmp(filename,"pt_",3)==0 && strncmp(filename+len-5,".root",5)==0) {
//fprintf(stderr,"Seeing file %s\n",ent.Data());
file = filename;
file[len-5]='\0';
fileList.Add(new TObjString(file));
}
}
}
}
dirList.Sort();
fileList.Sort();
TIter next(&dirList);
TObjString *obj;
html += "<table width=\"500\">\n";
html += gLine;
html += gParentDir;
while ( (obj = (TObjString*)next()) ) {
html += TString::Format(gDirFmt,obj->GetName(),obj->GetName());
}
html += gLine;
if (!fileList.IsEmpty()) {
next = &fileList;
while ( (obj = (TObjString*)next()) ) {
html += "<tr>";
html += TString::Format(gFiles,obj->GetName(),obj->GetName(),obj->GetName(),obj->GetName());
obj = (TObjString*)next();
if (obj) {
html += TString::Format(gFiles,obj->GetName(),obj->GetName(),obj->GetName(),obj->GetName());
} else {
html += "<td></td></tr>";
break;
}
}
html += gLine;
}
html += "</table>\n";
dirList.Delete();
fileList.Delete();
html += "</body>\n";
html += "</html>\n";
ent.Form("%s/pt_index.html",dirname);
FILE *output = fopen(ent.Data(),"w");
fprintf(output,"%s",html.Data());
fclose(output);
}
开发者ID:asmagina1995,项目名称:roottest,代码行数:71,代码来源:pt_createIndex.C
示例10: TriggerInputsForMuonEventCuts
void TriggerInputsForMuonEventCuts ( TString runListFilename, TString selectedInputs="", TString defaultStorage = "raw://" )
{
AliCDBManager::Instance()->SetDefaultStorage(defaultStorage.Data());
TObjArray inputsList;
inputsList.SetOwner();
TObjArray* selectedInputsList = selectedInputs.Tokenize(",");
// Read input run list
ifstream inFile(runListFilename.Data());
TString srun = "";
if ( inFile.is_open() ) {
while ( ! inFile.eof() ) {
srun.ReadLine(inFile,kFALSE);
if ( ! srun.IsDigit() ) continue;
// For each run, read trigger inputs from OCDB
Int_t runNumber = srun.Atoi();
AliCDBManager::Instance()->SetRun(runNumber);
// Get trigger class configuration
AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/Config");
if ( ! entry ) continue;
THashList* runInputs = new THashList();
runInputs->SetOwner();
runInputs->SetUniqueID((UInt_t)runNumber);
AliTriggerConfiguration* trigConf = (AliTriggerConfiguration*)entry->GetObject();
const TObjArray& trigInputsArray = trigConf->GetInputs();
AliTriggerInput* trigInput = 0x0;
TIter next(&trigInputsArray);
while ( ( trigInput = static_cast<AliTriggerInput*>(next()) ) ) {
if ( selectedInputsList->GetEntriesFast() > 0 && ! selectedInputsList->FindObject(trigInput->GetName()) ) continue;
Int_t inputId = (Int_t)TMath::Log2(trigInput->GetMask());
TObjString* currInput = new TObjString(trigInput->GetName());
currInput->SetUniqueID(inputId);
runInputs->Add(currInput);
}
inputsList.Add(runInputs);
}
inFile.close();
}
delete selectedInputsList;
// Loop on the trigger inputs
// and group runs with an equal list of inputs
Int_t nentries = inputsList.GetEntries();
TArrayI checkMask(nentries);
checkMask.Reset(1);
for ( Int_t irun=0; irun<nentries; irun++ ) {
if ( checkMask[irun] == 0 ) continue;
THashList* currList = static_cast<THashList*>(inputsList.At(irun));
TString runRange = Form("Run range: %u", currList->GetUniqueID());
for ( Int_t jrun=irun+1; jrun<nentries; jrun++ ) {
if ( checkMask[jrun] == 0 ) continue;
THashList* checkList = static_cast<THashList*>(inputsList.At(jrun));
Bool_t isDifferent = kFALSE;
for ( Int_t itrig=0; itrig<currList->GetEntries(); itrig++ ) {
TObjString* currInput = static_cast<TObjString*>(currList->At(itrig));
TObject* checkInput = checkList->FindObject(currInput->GetName());
if ( ! checkInput || checkInput->GetUniqueID() != currInput->GetUniqueID() ) {
isDifferent = kTRUE;
break;
}
} // loop on trigger inputs
if ( isDifferent ) continue;
checkMask[jrun] = 0;
runRange += Form(",%u", checkList->GetUniqueID());
} // loop on runs
TString outString = "\nSetTrigInputsMap(\"";
for ( Int_t itrig=0; itrig<currList->GetEntries(); itrig++ ) {
TObjString* currInput = static_cast<TObjString*>(currList->At(itrig));
outString += Form("%s:%u,",currInput->GetString().Data(), currInput->GetUniqueID());
}
outString.Append("\");\n");
outString.ReplaceAll(",\"","\"");
outString += runRange;
printf("%s\n", outString.Data());
} // loop on runs
}
开发者ID:benjaminaudurier,项目名称:Macro,代码行数:81,代码来源:TriggerInputsForMuonEventCuts.C
示例11: MakeSnapshot
void MakeSnapshot(Int_t run, const char* defStorage, TMap* specStorages, const char* snapshotFileName)
{
AliCDBManager *cdb = AliCDBManager::Instance();
cdb->SetDefaultStorage(defStorage);
cdb->SetRun(run);
TIter iter(specStorages->GetTable());
TPair *pair = 0;
while((pair = dynamic_cast<TPair*> (iter.Next()))){
TObjString* caltype = dynamic_cast<TObjString*> (pair->Key());
TObjString* specstor= dynamic_cast<TObjString*> (pair->Value());
if (caltype && specstor)
//TString calType = caltype->GetString();
//TString specStor = specstor->GetString();
//cdb->SetSpecificStorage(calType.Data(),specStor.Data());
cdb->SetSpecificStorage(caltype->GetString().Data(),specstor->GetString().Data());
else
//AliFatal("Error reading info for specific storage")
Printf("Error reading info for specific storage");
}
// ********************************** GRP ******************************************
cdb->Get("GRP/CTP/Config");
cdb->Get("GRP/Calib/LHCClockPhase");
cdb->Get("GRP/GRP/Data");
cdb->Get("GRP/Align/Data");
cdb->Get("GRP/Calib/MeanVertexSPD");
cdb->Get("GRP/Calib/MeanVertex");
cdb->Get("GRP/Calib/MeanVertexTPC");
cdb->Get("GRP/Calib/CosmicTriggers");
cdb->Get("GRP/CTP/Scalers");
cdb->Get("GRP/CTP/CTPtiming");
cdb->Get("GRP/CTP/TimeAlign");
cdb->Get("GRP/GRP/LHCData");
cdb->Get("GRP/Calib/RecoParam");
// ********************************** ALL ******************************************
TString detStr = ("ITS TPC TRD TOF PHOS HMPID EMCAL MUON ZDC PMD T0 VZERO");
//TString detStr = ("ITS MUON TPC");
TObjArray *arr = detStr.Tokenize(' ');
for (Int_t iDet=0; iDet<arr->GetEntries(); iDet++) {
TObjString *detOStr = dynamic_cast<TObjString*>(arr->At(iDet));
AliCDBManager::Instance()->GetAll(Form("%s/Calib/*",detOStr->GetString().Data()));
AliCDBManager::Instance()->Get(Form("%s/Align/Data",detOStr->GetString().Data()));
}
// ******************************** TRIGGER ****************************************
// Temporary fix - one has to define the correct policy in order
// to load the trigger OCDB entries only for the detectors that
// in the trigger or that are needed in order to put correct
// information in ESD
AliCDBManager::Instance()->GetAll("TRIGGER/*/*");
// ********************************** HLT ******************************************
// cdb->Get("HLT/ConfigHLT/esdLayout");
// cdb->Get("HLT/Calib/StreamerInfo");
TMap* entriesMap = const_cast<TMap*>(cdb->GetEntryCache());
Printf("\nentriesMap has %d entries!\n", entriesMap->GetEntries());
TList* entriesList = const_cast<TList*>(cdb->GetRetrievedIds());
Printf("\nentriesList has %d entries!\n", entriesList->GetEntries());
//TString filename(TString::Format("CDBsnapshot_Run%d.root",run));
TString filename(snapshotFileName);
TFile *f = new TFile(filename.Data(),"recreate");
f->cd();
f->WriteObject(entriesMap,"entriesMap");
f->WriteObject(entriesList,"entriesList");
f->Close();
entriesMap->SetOwnerKeyValue(kFALSE,kFALSE);
entriesList->SetOwner(kFALSE);
}
开发者ID:alisw,项目名称:AliRoot,代码行数:73,代码来源:MakeCDBSnapshot.C
示例12: build
void build(const char *filename,const char *lib = 0, const char *obj = 0)
{
if (obj!=0 && strlen(obj) ) {
TString s = gSystem->GetMakeSharedLib();
TString r(" $ObjectFiles ");
r.Append(obj);
s.ReplaceAll(" $ObjectFiles",r);
//gDebug = 5;
gSystem->SetMakeSharedLib(s);
}
if (lib && strlen(lib)) {
TString liblist(lib);
TObjArray *libs = liblist.Tokenize(" ");
TIter iter(libs);
TObjString *objstr;
TString s = gSystem->GetMakeSharedLib();
TString what("..nothing..");
if (s.Contains("$DepLibs")) {
what = " $DepLibs";
} else {
what = " $LinkedLibs";
}
TString libstolink(" ");
while ( (objstr=(TObjString*)iter.Next()) ) {
gSystem->Load(objstr->String());
TString libfile( gSystem->GetLibraries(objstr->String(),"DSL",kFALSE));
libstolink.Append(libfile);
libstolink.Append(" ");
}
libstolink.Append(what);
s.ReplaceAll(what,libstolink);
gSystem->SetMakeSharedLib(s);
}
#ifdef __CLING__
TString r;
#ifdef ClingWorkAroundCallfuncAndInline
r.Append(" -DClingWorkAroundCallfuncAndInline ");
#endif
#ifdef ClingWorkAroundCallfuncAndVirtual
r.Append(" -DClingWorkAroundCallfuncAndVirtual ");
#endif
#ifdef ClingWorkAroundJITandInline
r.Append(" -DClingWorkAroundJITandInline ");
#endif
#ifdef ClingWorkAroundCallfuncAndReturnByValue
r.Append(" -DClingWorkAroundCallfuncAndReturnByValue ");
#endif
#ifdef ClingWorkAroundNoPrivateClassIO
r.Append(" -DClingWorkAroundNoPrivateClassIO ");
#endif
if (r.Length()) {
r.Append(" $IncludePath");
TString s = gSystem->GetMakeSharedLib();
s.ReplaceAll(" $IncludePath",r);
gSystem->SetMakeSharedLib(s);
}
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
TString fname(filename);
if (filename[0]=='/') {
// full path name we need to turn it into a windows path
fname = gSystem->GetFromPipe(TString::Format("cygpath -w %s",filename));
}
fprintf(stderr,"from %s to %s\n",filename,fname.Data());
int result = gSystem->CompileMacro(fname,"kc");
#else
int result = gSystem->CompileMacro(filename,"kc");
#endif
if (!result) gApplication->Terminate(1);
}
开发者ID:jlsalmon,项目名称:roottest,代码行数:72,代码来源:build.C
-
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18210|2023-10-27
-
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9656|2022-11-06
-
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8168|2022-11-06
-
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8543|2022-11-06
-
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8449|2022-11-06
-
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9375|2022-11-06
-
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8418|2022-11-06
-
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7855|2022-11-06
-
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8403|2022-11-06
-
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7391|2022-11-06
|
请发表评论