本文整理汇总了C++中TNamed::GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ TNamed::GetTitle方法的具体用法?C++ TNamed::GetTitle怎么用?C++ TNamed::GetTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TNamed
的用法示例。
在下文中一共展示了TNamed::GetTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SlaveBegin
void ProofNtuple::SlaveBegin(TTree * /*tree*/)
{
// The SlaveBegin() function is called after the Begin() function.
// When running with PROOF SlaveBegin() is called on each slave server.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
// We may be creating a dataset or a merge file: check it
TNamed *nm = dynamic_cast<TNamed *>(fInput->FindObject("SimpleNtuple.root"));
if (nm) {
// Just create the object
UInt_t opt = TProofOutputFile::kRegister | TProofOutputFile::kOverwrite | TProofOutputFile::kVerify;
fProofFile = new TProofOutputFile("SimpleNtuple.root",
TProofOutputFile::kDataset, opt, nm->GetTitle());
} else {
// For the ntuple, we use the automatic file merging facility
// Check if an output URL has been given
TNamed *out = (TNamed *) fInput->FindObject("PROOF_OUTPUTFILE_LOCATION");
Info("SlaveBegin", "PROOF_OUTPUTFILE_LOCATION: %s", (out ? out->GetTitle() : "undef"));
fProofFile = new TProofOutputFile("SimpleNtuple.root", (out ? out->GetTitle() : "M"));
out = (TNamed *) fInput->FindObject("PROOF_OUTPUTFILE");
if (out) fProofFile->SetOutputFileName(out->GetTitle());
}
// Open the file
fFile = fProofFile->OpenFile("RECREATE");
if (fFile && fFile->IsZombie()) SafeDelete(fFile);
// Cannot continue
if (!fFile) {
Info("SlaveBegin", "could not create '%s': instance is invalid!", fProofFile->GetName());
return;
}
// Now we create the ntuple
fNtp = new TNtuple("ntuple","Demo ntuple","px:py:pz:random:i");
// File resident
fNtp->SetDirectory(fFile);
fNtp->AutoSave();
// Should we generate the random numbers or take them from the ntuple ?
TNamed *unr = (TNamed *) fInput->FindObject("PROOF_USE_NTP_RNDM");
if (unr) {
// Get the ntuple from the input list
if (!(fNtpRndm = dynamic_cast<TNtuple *>(fInput->FindObject("NtpRndm")))) {
Warning("SlaveBegin",
"asked to use rndm ntuple but 'NtpRndm' not found in the"
" input list! Using the random generator");
fInput->Print();
} else {
Info("SlaveBegin", "taking randoms from input ntuple 'NtpRndm'");
}
}
// Init the random generator, if required
if (!fNtpRndm) fRandom = new TRandom3(0);
}
示例2: SlaveBegin
//_____________________________________________________________________________
void ProofJob::SlaveBegin(TTree * /*tree*/)
{
cout << " Starting babyTupler job " << endl;
// ############################
// # Get input from PROOF #
// ############################
// Dataset name
TNamed *dsname = (TNamed *) fInput->FindObject("PROOF_DATASETNAME");
datasetName = dsname->GetTitle();
cout << " > Dataset : " << datasetName << endl;
// XML config
TNamed *xfname = (TNamed *) fInput->FindObject("PROOF_XMLFILENAME");
string xmlFileName = xfname->GetTitle();
// Output file
TNamed *out = (TNamed *) fInput->FindObject("PROOF_OUTPUTFILE");
fProofFile = new TProofOutputFile(out->GetTitle());
TDirectory *savedir = gDirectory;
fFile = fProofFile->OpenFile("UPDATE");
if (fFile && fFile->IsZombie()) SafeDelete(fFile);
savedir->cd();
// #######################
// # Load the config #
// #######################
sel = Void;
anaEL = new AnalysisEnvironmentLoader(xmlFileName.c_str());
anaEL->LoadSamples(datasets, datasetName);
anaEL->LoadSelection(sel);
anaEL->LoadGeneralInfo(DataType, Luminosity, LumiError, verbosity);
LoadCorrectionFiles();
// Retrieve the current dataset according to its name
for(unsigned int d=0;d<datasets.size();d++)
if (datasets[d].Name() == datasetName) dataset = &datasets[d];
// #############################
// # Initialise the TTree #
// #############################
theTree=new TTree("babyTuple","babyTuple");
theTree->SetDirectory(fFile);
InitializeBranches(theTree,&myEvent);
}
示例3: Begin
//_____________________________________________________________________________
void ProofSimple::Begin(TTree * /*tree*/)
{
// The Begin() function is called at the start of the query.
// When running with PROOF Begin() is only called on the client.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
Ssiz_t iopt = kNPOS;
// Histos array
if (fInput->FindObject("ProofSimple_NHist")) {
TParameter<Long_t> *p =
dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist"));
fNhist = (p) ? (Int_t) p->GetVal() : fNhist;
} else if ((iopt = option.Index("nhist=")) != kNPOS) {
TString s;
Ssiz_t from = iopt + strlen("nhist=");
if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist = s.Atoi();
}
if (fNhist < 1) {
Abort("fNhist must be > 0! Hint: proof->SetParameter(\"ProofSimple_NHist\","
" (Long_t) <nhist>)", kAbortProcess);
return;
}
if (fInput->FindObject("ProofSimple_NHist3")) {
TParameter<Long_t> *p =
dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist3"));
fNhist3 = (p) ? (Int_t) p->GetVal() : fNhist3;
} else if ((iopt = option.Index("nhist3=")) != kNPOS) {
TString s;
Ssiz_t from = iopt + strlen("nhist3=");
if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist3 = s.Atoi();
}
// Ntuple
TNamed *nm = dynamic_cast<TNamed *>(fInput->FindObject("ProofSimple_Ntuple"));
if (nm) {
// Title is in the form
// merge merge via file
// |<fout> location of the output file if merge
// |retrieve retrieve to client machine
// dataset create a dataset
// |<dsname> dataset name (default: dataset_ntuple)
// |plot for a final plot
// <empty> or other keep in memory
fHasNtuple = 1;
TString ontp(nm->GetTitle());
if (ontp.Contains("|plot") || ontp == "plot") {
fPlotNtuple = kTRUE;
ontp.ReplaceAll("|plot", "");
if (ontp == "plot") ontp = "";
}
if (ontp.BeginsWith("dataset")) fHasNtuple = 2;
}
}
示例4: SlaveBegin
//_____________________________________________________________________________
void ProofEventProc::SlaveBegin(TTree * /*tree*/)
{
// The SlaveBegin() function is called after the Begin() function.
// When running with PROOF SlaveBegin() is called on each slave server.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
// How much to read
fFullRead = kFALSE;
TNamed *nm = 0;
if (fInput) {
if ((nm = dynamic_cast<TNamed *>(fInput->FindObject("ProofEventProc_Read")))) {
if (!strcmp(nm->GetTitle(), "readall")) fFullRead = kTRUE;
}
}
if (!nm) {
// Check option
if (option == "readall") fFullRead = kTRUE;
}
Info("SlaveBegin", "'%s' reading", (fFullRead ? "full" : "optimized"));
fPtHist = new TH1F("pt_dist","p_{T} Distribution",100,0,5);
fPtHist->SetDirectory(0);
fPtHist->GetXaxis()->SetTitle("p_{T}");
fPtHist->GetYaxis()->SetTitle("dN/p_{T}dp_{T}");
fOutput->Add(fPtHist);
fPzHist = new TH1F("pz_dist","p_{Z} Distribution",100,0,5.);
fPzHist->SetDirectory(0);
fPzHist->GetXaxis()->SetTitle("p_{Z}");
fPzHist->GetYaxis()->SetTitle("dN/dp_{Z}");
fOutput->Add(fPzHist);
fPxPyHist = new TH2F("px_py","p_{X} vs p_{Y} Distribution",100,-5.,5.,100,-5.,5.);
fPxPyHist->SetDirectory(0);
fPxPyHist->GetXaxis()->SetTitle("p_{X}");
fPxPyHist->GetYaxis()->SetTitle("p_{Y}");
fOutput->Add(fPxPyHist);
// Abort test, if any
TParameter<Int_t> *pi = 0;
if (fInput)
pi = dynamic_cast<TParameter<Int_t> *>(fInput->FindObject("ProofEventProc_TestAbort"));
if (pi) fTestAbort = pi->GetVal();
if (fTestAbort < -1 || fTestAbort > 1) {
Info("SlaveBegin", "unsupported value for the abort test: %d not in [-1,1] - ignore", fTestAbort);
fTestAbort = -1;
} else if (fTestAbort > -1) {
Info("SlaveBegin", "running abort test: %d", fTestAbort);
}
if (fTestAbort == 0)
Abort("Test abortion during init", kAbortProcess);
}
示例5: ShowShortcutsInfos
void KVCanvas::ShowShortcutsInfos()
{
std::cout << std::endl << std::endl;
TNamed* info = 0;
TIter it(&fShortCuts);
while ((info = (TNamed*)it())) {
std::cout << Form("%20s", info->GetName()) << " " << info->GetTitle() << std::endl;
}
std::cout << std::endl;
}
示例6: GetAction
//_____________________________________________________________________________
Int_t ProofAux::GetAction(TList *input)
{
// Get the required action.
// Returns -1 if unknown.
Int_t action = -1;
// Determine the test type
TNamed *ntype = dynamic_cast<TNamed*>(input->FindObject("ProofAux_Action"));
if (ntype) {
if (!strcmp(ntype->GetTitle(), "GenerateTrees")) {
action = 0;
} else if (!strcmp(ntype->GetTitle(), "GenerateTreesSameFile")) {
action = 1;
} else {
Warning("GetAction", "unknown action: '%s'", ntype->GetTitle());
}
}
// Done
return action;
}
示例7: ParseInput
//_____________________________________________________________________________
void ProofTests::ParseInput()
{
// This function sets some control member variables based on the input list
// content. Called by Begin and SlaveBegin.
// Determine the test type
TNamed *ntype = dynamic_cast<TNamed*>(fInput->FindObject("ProofTests_Type"));
if (ntype) {
if (!strcmp(ntype->GetTitle(), "InputData")) {
fTestType = 0;
} else if (!strcmp(ntype->GetTitle(), "PackTest1")) {
fTestType = 1;
} else if (!strcmp(ntype->GetTitle(), "PackTest2")) {
fTestType = 2;
} else {
Warning("ParseInput", "unknown type: '%s'", ntype->GetTitle());
}
}
Info("ParseInput", "test type: %d (from '%s')", fTestType, ntype ? ntype->GetTitle() : "undef");
}
示例8: AddAllManagers
Bool_t AddAllManagers(TList *listManagers,TString anSrc, TString anMode,TString input,TString inputMC) {
TIter next(listManagers);
Int_t counter=0;
TNamed *name;
while ((name = (TNamed *)next.Next())) {
if (!AddAnalysisManager(name->GetName(), anSrc, anMode,input,inputMC,name->GetTitle(),Form("%d",counter++))) {
Printf("Error: Problem adding %s",name->GetName());
return kFALSE;
}
}
return kTRUE;
}
示例9: EventInfo
//______________________________________________________________________
void EventInfo(Int_t event, Int_t px, Int_t , TObject *selected)
{
//draw the tooltip showing the backtrace for the bin at px
if (!gTip) return;
gTip->Hide();
if (event == kMouseLeave)
return;
Double_t xpx = gPad->AbsPixeltoX(px);
Int_t bin = hleaks->GetXaxis()->FindBin(xpx);
if (bin <=0 || bin > hleaks->GetXaxis()->GetNbins()) return;
Int_t nbytes = (Int_t)hleaks->GetBinContent(bin);
Int_t entry = (Int_t)hentry->GetBinContent(bin);
Int_t btid = (Int_t)V4[entry];
Double_t time = 0.0001*V3[entry];
TH1I *hbtids = (TH1I*)T->GetUserInfo()->FindObject("btids");
if (!hbtids) return;
if (!btidlist) btidlist = (TObjArray*)T->GetUserInfo()->FindObject("FAddrsList");
if (!btidlist) btidlist = (TObjArray*)f->Get("FAddrsList"); //old memstat files
if (!btidlist) return;
Int_t nbt = (Int_t)hbtids->GetBinContent(btid-1);
TString ttip;
for (Int_t i=0;i<nbt;i++) {
Int_t j = (Int_t)hbtids->GetBinContent(btid+i);
TNamed *nm = (TNamed*)btidlist->At(j);
if (nm==0) break;
char *title = (char*)nm->GetTitle();
Int_t nch = strlen(title);
if (nch < 20) continue;
if (nch > 100) title[100] =0;
const char *bar = strstr(title,"| ");
if (!bar) continue;
if (strstr(bar,"operator new")) continue;
if (strstr(bar,"libMemStat")) continue;
if (strstr(bar,"G__Exception")) continue;
ttip += TString::Format("%2d %s\n",i,bar+1);
}
if (selected) {
TString form1 = TString::Format(" Leak number=%d, leaking %d bytes at entry=%d time=%gseconds\n\n",bin,nbytes,entry,time);
gTip->SetText(TString::Format("%s%s",form1.Data(),ttip.Data() ));
gTip->SetPosition(px+15, 100);
gTip->Reset();
}
}
示例10: Copy
void KVTrieur::Copy(TObject & a) const
{
#else
void KVTrieur::Copy(TObject & a)
{
#endif
//
// Methode de Copy
//
Char_t nom[80];
#ifdef DEBUG_KVTrieur
cout << "Copy de " << a.GetName() << "..." << endl;
#endif
#ifdef DEBUG_KVTrieur
sprintf(nom, "Copy de %s", a.GetName());
#else
sprintf(nom, "Copy_%s", a.GetName());
#endif
((KVTrieur &) a).SetName(nom);
((KVTrieur &) a).SetTitle(nom);
((KVTrieur &) a).nb_cases = this->nb_cases;
if (this->noms_cases) {
((KVTrieur &) a).noms_cases =
new TClonesArray("TNamed", this->nb_cases);
TClonesArray *tca = ((KVTrieur &) a).noms_cases;
Char_t nomc[80];
for (Int_t i = 0; i < this->nb_cases; i++) {
TNamed *c = (TNamed *) this->noms_cases->At(i);
sprintf(nomc, "%s_C%d", this->GetName(), i + 1);
new((*tca)[i]) TNamed(nomc, c->GetTitle());
}
} else {
((KVTrieur &) a).noms_cases = 0;
}
#ifdef DEBUG_KVTrieur
cout << "Nom de la Copy (arguement): " << nom << endl;
cout << "Nom de la Copy (resultat) : " << GetName() << endl;
#endif
}
示例11: SlaveBegin
//_____________________________________________________________________________
void ProofSimpleFile::SlaveBegin(TTree * /*tree*/)
{
// The SlaveBegin() function is called after the Begin() function.
// When running with PROOF SlaveBegin() is called on each slave server.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
// Number of histograms (needed in terminate)
Ssiz_t iopt = kNPOS;
if (fInput->FindObject("ProofSimpleFile_NHist")) {
TParameter<Long_t> *p =
dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimpleFile_NHist"));
fNhist = (p) ? (Int_t) p->GetVal() : fNhist;
} else if ((iopt = option.Index("nhist=")) != kNPOS) {
TString s;
Ssiz_t from = iopt + strlen("nhist=");
if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist = s.Atoi();
}
// The file for merging
fProofFile = new TProofOutputFile("SimpleFile.root", "M");
TNamed *out = (TNamed *) fInput->FindObject("PROOF_OUTPUTFILE");
if (out) fProofFile->SetOutputFileName(out->GetTitle());
TDirectory *savedir = gDirectory;
fFile = fProofFile->OpenFile("RECREATE");
if (fFile && fFile->IsZombie()) SafeDelete(fFile);
savedir->cd();
// Cannot continue
if (!fFile) {
TString amsg = TString::Format("ProofSimpleFile::SlaveBegin: could not create '%s':"
" instance is invalid!", fProofFile->GetName());
Abort(amsg, kAbortProcess);
return;
}
// Histos arrays
if (CreateHistoArrays() != 0) {
Abort("ProofSimpleFile::SlaveBegin: could not create histograms", kAbortProcess);
return;
}
// Create directory
if (!(fFileDir = fFile->mkdir("blue"))) {
Abort("ProofSimpleFile::SlaveBegin: could not create directory 'blue' in file!",
kAbortProcess);
return;
}
// Create the histograms
for (Int_t i=0; i < fNhist; i++) {
fHistTop[i] = new TH1F(Form("ht%d",i), Form("ht%d",i), 100, -3., 3.);
fHistTop[i]->SetFillColor(kRed);
fHistTop[i]->SetDirectory(fFile);
fHistDir[i] = new TH1F(Form("hd%d",i), Form("hd%d",i), 100, -3., 3.);
fHistDir[i]->SetFillColor(kBlue);
fHistDir[i]->SetDirectory(fFileDir);
}
// Set random seed
fRandom = new TRandom3(0);
}
示例12: SETUP
//.........这里部分代码省略.........
Form("%s/lib:%s", aliPhysicsDir.Data(), gSystem->GetDynamicPath()) );
}
}
else {
// AliRoot enabled from a single metaparfile. Assume that ALICE_ROOT and
// ALICE_PHYSICS are already defined on master and each worker.
// Note: this is the VAF case.
aliRootDir = gSystem->Getenv("ALICE_ROOT"); // NULL --> ""
aliPhysicsDir = gSystem->Getenv("ALICE_PHYSICS"); // NULL --> ""
if (aliRootDir.IsNull()) {
::Error(gMessTag.Data(),
"ALICE_ROOT environment variable not defined on PROOF node, and not"
"loading from a PARfile containing AliRoot version in its name");
return -1;
}
if (aliPhysicsDir.EqualTo(aliRootDir)) {
// AliPhysics does not exist if it points to the same directory of AliRoot
aliPhysicsDir = "";
}
::Info(gMessTag.Data(),
"Enabling ALICE software located on PROOF node (VAF mode)");
}
}
//
// Where are AliRoot and AliPhysics? Inform user
//
::Info(gMessTag.Data(), ">> ALICE_ROOT=%s", aliRootDir.Data());
::Info(gMessTag.Data(), ">> ALICE_PHYSICS=%s", aliPhysicsDir.Data());
//
// Common operations on Client and PROOF Master/Workers
//
// Add standard AliRoot Core include and macro path
gSystem->AddIncludePath( Form("-I\"%s/include\"", aliRootDir.Data()) );
gROOT->SetMacroPath( Form("%s:%s/macros", gROOT->GetMacroPath(), aliRootDir.Data()) );
// Same for AliPhysics
if (!aliPhysicsDir.IsNull()) {
gSystem->AddIncludePath( Form("-I\"%s/include\"", aliPhysicsDir.Data()) );
gROOT->SetMacroPath( Form("%s:%s/macros", gROOT->GetMacroPath(), aliPhysicsDir.Data()) );
}
//
// Process input parameters
//
TString extraLibs, mode;
Bool_t enableAliEn = kFALSE;
if (inputList) {
TIter it(inputList);
TNamed *pair;
while ((pair = dynamic_cast<TNamed *>(it.Next()))) {
if ( strcmp(pair->GetName(), "ALIROOT_EXTRA_LIBS") == 0 )
extraLibs = pair->GetTitle();
else if ( strcmp(pair->GetName(), "ALIROOT_ENABLE_ALIEN") == 0 )
enableAliEn = ( *(pair->GetTitle()) != '\0' );
else if ( strcmp(pair->GetName(), "ALIROOT_MODE") == 0 )
mode = pair->GetTitle();
}
}
//
// Load extra libraries and set AliRoot Core mode
//
if (!SETUP_SetAliRootCoreMode(mode, extraLibs)) {
::Error(gMessTag.Data(), "Error loading libraries while setting AliRoot mode.");
::Error(gMessTag.Data(), "Did you enable the right version of ROOT?");
return -1;
}
//
// Enable AliEn
//
if (enableAliEn) {
::Info(gMessTag.Data(), "Connecting to AliEn...");
TGrid::Connect("alien:");
if (!gGrid) {
::Error(gMessTag.Data(), "Cannot connect to AliEn");
return -1;
}
else {
::Info(gMessTag.Data(), "Successfully connected to AliEn");
}
}
return 0;
}
示例13: SlaveBegin
//_____________________________________________________________________________
void ProofTests::SlaveBegin(TTree * /*tree*/)
{
// The SlaveBegin() function is called after the Begin() function.
// When running with PROOF SlaveBegin() is called on each slave server.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
// Fill relevant members
ParseInput();
// Output histo
fStat = new TH1I("TestStat", "Test results", 20, .5, 20.5);
fOutput->Add(fStat);
// We were started
fStat->Fill(1.);
// Depends on the test
if (fTestType == 0) {
// Retrieve objects from the input list and copy them to the output
// H1
TList *h1list = dynamic_cast<TList*>(fInput->FindObject("h1list"));
if (h1list) {
// Retrieve objects from the input list and copy them to the output
TH1F *h1 = dynamic_cast<TH1F*>(h1list->FindObject("h1data"));
if (h1) {
TParameter<Double_t> *h1avg = dynamic_cast<TParameter<Double_t>*>(h1list->FindObject("h1avg"));
TParameter<Double_t> *h1rms = dynamic_cast<TParameter<Double_t>*>(h1list->FindObject("h1rms"));
if (h1avg && h1rms) {
if (TMath::Abs(h1avg->GetVal() - h1->GetMean()) < 0.0001) {
if (TMath::Abs(h1rms->GetVal() - h1->GetRMS()) < 0.0001) {
fStat->Fill(2.);
}
}
} else {
Info("SlaveBegin", "%d: info 'h1avg' or 'h1rms' not found!", fTestType);
}
} else {
Info("SlaveBegin", "%d: input histo 'h1data' not found!", fTestType);
}
} else {
Info("SlaveBegin", "%d: input list 'h1list' not found!", fTestType);
}
// H2
TList *h2list = dynamic_cast<TList*>(fInput->FindObject("h2list"));
if (h2list) {
// Retrieve objects from the input list and copy them to the output
TH1F *h2 = dynamic_cast<TH1F*>(h2list->FindObject("h2data"));
if (h2) {
TParameter<Double_t> *h2avg = dynamic_cast<TParameter<Double_t>*>(h2list->FindObject("h2avg"));
TParameter<Double_t> *h2rms = dynamic_cast<TParameter<Double_t>*>(h2list->FindObject("h2rms"));
if (h2avg && h2rms) {
if (TMath::Abs(h2avg->GetVal() - h2->GetMean()) < 0.0001) {
if (TMath::Abs(h2rms->GetVal() - h2->GetRMS()) < 0.0001) {
fStat->Fill(3.);
}
}
} else {
Info("SlaveBegin", "%d: info 'h2avg' or 'h2rms' not found!", fTestType);
}
} else {
Info("SlaveBegin", "%d: input histo 'h2data' not found!", fTestType);
}
} else {
Info("SlaveBegin", "%d: input list 'h2list' not found!", fTestType);
}
TNamed *iob = dynamic_cast<TNamed*>(fInput->FindObject("InputObject"));
if (iob) {
fStat->Fill(4.);
} else {
Info("SlaveBegin", "%d: input histo 'InputObject' not found!", fTestType);
}
} else if (fTestType == 1) {
// We should find in the input list the name of a test variable which should exist
// at this point in the gEnv table
TNamed *nm = dynamic_cast<TNamed*>(fInput->FindObject("testenv"));
if (nm) {
if (gEnv->Lookup(nm->GetTitle())) fStat->Fill(2.);
} else {
Info("SlaveBegin", "%d: TNamed with the test env info not found!", fTestType);
}
} else if (fTestType == 2) {
// We should find in the input list the list of names of test variables which should exist
// at this point in the gEnv table
TNamed *nm = dynamic_cast<TNamed*>(fInput->FindObject("testenv"));
if (nm) {
TString nms(nm->GetTitle()), nam;
Int_t from = 0;
while (nms.Tokenize(nam, from, ",")) {
if (gEnv->Lookup(nam)) {
Double_t xx = gEnv->GetValue(nam, -1.);
if (xx > 1.) fStat->Fill(xx);
}
}
} else {
Info("SlaveBegin", "%d: TNamed with the test env info not found!", fTestType);
}
//.........这里部分代码省略.........
示例14: SlaveBegin
//_____________________________________________________________________________
void ProofSimple::SlaveBegin(TTree * /*tree*/)
{
// The SlaveBegin() function is called after the Begin() function.
// When running with PROOF SlaveBegin() is called on each slave server.
// The tree argument is deprecated (on PROOF 0 is passed).
TString option = GetOption();
Ssiz_t iopt = kNPOS;
// Histos array
if (fInput->FindObject("ProofSimple_NHist")) {
TParameter<Long_t> *p =
dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist"));
fNhist = (p) ? (Int_t) p->GetVal() : fNhist;
} else if ((iopt = option.Index("nhist=")) != kNPOS) {
TString s;
Ssiz_t from = iopt + strlen("nhist=");
if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist = s.Atoi();
}
if (fNhist < 1) {
Abort("fNhist must be > 0! Hint: proof->SetParameter(\"ProofSimple_NHist\","
" (Long_t) <nhist>)", kAbortProcess);
return;
}
fHist = new TH1F*[fNhist];
TString hn;
// Create the histogram
for (Int_t i=0; i < fNhist; i++) {
hn.Form("h%d",i);
fHist[i] = new TH1F(hn.Data(), hn.Data(), 100, -3., 3.);
fHist[i]->SetFillColor(kRed);
fOutput->Add(fHist[i]);
}
// 3D Histos array
if (fInput->FindObject("ProofSimple_NHist3")) {
TParameter<Long_t> *p =
dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist3"));
fNhist3 = (p) ? (Int_t) p->GetVal() : fNhist3;
} else if ((iopt = option.Index("nhist3=")) != kNPOS) {
TString s;
Ssiz_t from = iopt + strlen("nhist3=");
if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist3 = s.Atoi();
}
if (fNhist3 > 0) {
fHist3 = new TH3F*[fNhist3];
Info("Begin", "%d 3D histograms requested", fNhist3);
// Create the 3D histogram
for (Int_t i=0; i < fNhist3; i++) {
hn.Form("h%d_3d",i);
fHist3[i] = new TH3F(hn.Data(), hn.Data(),
100, -3., 3., 100, -3., 3., 100, -3., 3.);
fOutput->Add(fHist3[i]);
}
}
// Histo with labels
if (fInput->FindObject("ProofSimple_TestLabelMerging")) {
fHLab = new TH1F("hlab", "Test merging of histograms with automatic labels", 10, 0., 10.);
fOutput->Add(fHLab);
}
// Ntuple
TNamed *nm = dynamic_cast<TNamed *>(fInput->FindObject("ProofSimple_Ntuple"));
if (nm) {
// Title is in the form
// merge merge via file
// |<fout> location of the output file if merge
// |retrieve retrieve to client machine
// dataset create a dataset
// |<dsname> dataset name (default: dataset_ntuple)
// |plot for a final plot
// <empty> or other keep in memory
fHasNtuple = 1;
TString ontp(nm->GetTitle());
if (ontp.Contains("|plot") || ontp == "plot") {
fPlotNtuple = kTRUE;
ontp.ReplaceAll("|plot", "");
if (ontp == "plot") ontp = "";
}
TString locfn("SimpleNtuple.root");
if (ontp.BeginsWith("merge")) {
ontp.Replace(0,5,"");
fProofFile = new TProofOutputFile(locfn, "M");
TString fn;
Ssiz_t iret = ontp.Index("|retrieve");
if (iret != kNPOS) {
fProofFile->SetRetrieve(kTRUE);
TString rettag("|retrieve");
if ((iret = ontp.Index("|retrieve=")) != kNPOS) {
rettag += "=";
fn = ontp(iret + rettag.Length(), ontp.Length() - iret - rettag.Length());
if ((iret = fn.Index('|')) != kNPOS) fn.Remove(iret);
rettag += fn;
}
//.........这里部分代码省略.........
示例15: AnalyseFile
void KVSimDir::AnalyseFile(const Char_t* filename)
{
// Analyse ROOT file given as argument.
// If there is a TTree in the file, then we look at all of its branches until we find one
// containing objects which derive from KVEvent:
//
// -- if they inherit from KVSimEvent, we add the file to the list of simulated data:
// * a KVSimFile is created. The title of the TTree where data were found will
// be used as 'Information' on the nature of the simulation.
// -- if they inherit from KVReconstructedEvent, we add the file to the list of filtered data.
// * a KVSimFile is created. Informations on the filtered data are extracted from
// TNamed objects in the file with names 'Dataset', 'System', 'Run', 'Geometry'
// (type of geometry used, 'ROOT' or 'KV'), 'Origin' (i.e. the name of the simulation
// file which was filtered), 'Filter' (type of filter: Geo, GeoThresh or Full).
// These objects are automatically created when data is filtered using KVEventFiltering.
//
// Analysis of the file stops after the first TTree with a branch satisfying one of the
// two criteria is found (it is assumed that in each file there is only one TTree containing
// either simulated or filtered data).
Info("AnalyseFile", "Analysing file %s...", filename);
TString fullpath;
AssignAndDelete(fullpath, gSystem->ConcatFileName(GetDirectory(), filename));
TFile* file = TFile::Open(fullpath);
if (!file || file->IsZombie()) return;
// look for TTrees in file
TIter next(file->GetListOfKeys());
TKey* key;
while ((key = (TKey*)next())) {
TString cn = key->GetClassName();
if (cn == "TTree") {
// look for branch with KVEvent objects
TTree* tree = (TTree*)file->Get(key->GetName());
TSeqCollection* branches = tree->GetListOfBranches();
TIter nextB(branches);
TBranchElement* branch;
while ((branch = (TBranchElement*)nextB())) {
TString branch_classname = branch->GetClassName();
TClass* branch_class = TClass::GetClass(branch_classname, kFALSE, kTRUE);
if (branch_class && branch_class->InheritsFrom("KVEvent")) {
if (branch_class->InheritsFrom("KVSimEvent")) {
fSimData.Add(new KVSimFile(this, filename, tree->GetTitle(), tree->GetEntries(), tree->GetName(), branch->GetName()));
delete file;
return;
} else if (branch_class->InheritsFrom("KVReconstructedEvent")) {
// filtered data. there must be TNamed called 'Dataset', 'System', & 'Run' in the file.
TNamed* ds = (TNamed*)file->Get("Dataset");
TNamed* orig = (TNamed*)file->Get("Origin");
TNamed* sys = (TNamed*)file->Get("System");
TNamed* r = (TNamed*)file->Get("Run");
TNamed* g = (TNamed*)file->Get("Geometry");
TNamed* f = (TNamed*)file->Get("Filter");
TString dataset;
if (ds) dataset = ds->GetTitle();
TString system;
if (sys) system = sys->GetTitle();
TString run;
if (r) run = r->GetTitle();
TString origin;
if (orig) origin = orig->GetTitle();
TString geometry;
if (g) geometry = g->GetTitle();
TString filter;
if (f) filter = f->GetTitle();
Int_t run_number = run.Atoi();
fFiltData.Add(new KVSimFile(this, filename, tree->GetTitle(), tree->GetEntries(), tree->GetName(), branch->GetName(),
dataset, system, run_number, geometry, origin, filter));
delete file;
delete ds;
delete sys;
delete r;
delete f;
return;
}
}
}
}
}
}