本文整理汇总了C++中TList::SetOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ TList::SetOwner方法的具体用法?C++ TList::SetOwner怎么用?C++ TList::SetOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TList
的用法示例。
在下文中一共展示了TList::SetOwner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GroupByChamber
//_________________________________________________________________________________________________
void GroupByChamber(AliMergeableCollection& hc, int timeResolution)
{
for ( Int_t ich = 1; ich <= 10; ++ich )
{
AliMpDEIterator it;
it.First(ich-1);
TH1* hchamberLeft(0x0);
TH1* hchamberRight(0x0);
TList listLeft;
TList listRight;
listLeft.SetOwner(kFALSE);
listRight.SetOwner(kFALSE);
AliMpDCSNamer dcs("TRACKER");
while (!it.IsDone())
{
Int_t detElemId = it.CurrentDEId();
AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
TH1* h = hc.Histo(Form("/DE/HITS/%ds/DE%04d",timeResolution,detElemId));
if (dcs.DCSAliasName(detElemId).Contains("Left"))
{
if (!hchamberLeft)
{
hchamberLeft = static_cast<TH1*>(h->Clone(Form("CHAMBER%dLEFT",ich)));
}
else
{
listLeft.Add(h);
}
}
else
{
if (!hchamberRight)
{
hchamberRight = static_cast<TH1*>(h->Clone(Form("CHAMBER%dRIGHT",ich)));
}
else
{
listRight.Add(h);
}
}
it.Next();
}
hchamberLeft->Merge(&listLeft);
hchamberRight->Merge(&listRight);
hc.Adopt(Form("/CHAMBER/HITS/%ds",timeResolution),hchamberLeft);
hc.Adopt(Form("/CHAMBER/HITS/%ds",timeResolution),hchamberRight);
TH1* hchamber = static_cast<TH1*>(hchamberLeft->Clone(Form("CHAMBER%d",ich)));
hchamber->Add(hchamberRight);
hc.Adopt(Form("/CHAMBER/HITS/%ds",timeResolution),hchamber);
}
}
示例2: Terminate
/**
* End of job processing
*/
void Terminate(Option_t*)
{
fList = dynamic_cast<TList*>(GetOutputData(1));
if (!fList) {
AliError(Form("No output list defined (%p)", GetOutputData(1)));
if (GetOutputData(1)) GetOutputData(1)->Print();
return;
}
TList* output = new TList;
output->SetName("triggerResults");
output->SetOwner();
fVertexMC = static_cast<TH1D*>(fList->FindObject("vertexMC"));
fVertexESD = static_cast<TH1D*>(fList->FindObject("vertexESD"));
fM = static_cast<TH1D*>(fList->FindObject("m"));
if (fVertexMC) {
TH1D* vtxMC = static_cast<TH1D*>(fVertexMC->Clone("vertexMC"));
vtxMC->SetDirectory(0);
if (vtxMC->GetEntries() > 0)
vtxMC->Scale(1. / vtxMC->GetEntries());
else
vtxMC->Scale(0);
output->Add(vtxMC);
}
if (fVertexESD) {
TH1D* vtxESD = static_cast<TH1D*>(fVertexESD->Clone("vertexESD"));
vtxESD->SetDirectory(0);
if (vtxESD->GetEntries() > 0)
vtxESD->Scale(1. / vtxESD->GetEntries());
else
vtxESD->Scale(0);
output->Add(vtxESD);
}
if (fM) {
TH1D* m = static_cast<TH1D*>(fM->Clone("m"));
m->SetDirectory(0);
m->SetYTitle("P(N_{ch}|_{|#eta|<1} < X)");
if (m->GetBinContent(1) > 0)
m->Scale(1. / m->GetBinContent(1));
else
m->Scale(0);
output->Add(m);
}
TString vtxReq;
if (fVertexRequirement & kMC) vtxReq.Append("MC ");
if (fVertexRequirement & kESD) vtxReq.Append("ESD ");
output->Add(new TNamed("vtxReq", vtxReq.Data()));
output->Add(new TNamed("trkReq",
fTrackletRequirement == kMC ? "MC" : "ESD"));
fInel.Finish(fList, output);
fInelGt0.Finish(fList, output);
fNSD.Finish(fList, output);
fNClusterGt0.Finish(fList, output);
PostData(2, output);
}
示例3: GroupByDDL
//_________________________________________________________________________________________________
void GroupByDDL(AliMergeableCollection& hc, int timeResolution)
{
Int_t nddls = AliDAQ::NumberOfDdls("MUONTRK");
Int_t offset = AliDAQ::DdlIDOffset("MUONTRK");
for ( Int_t i = 0; i < nddls; ++i )
{
Int_t ddlId = offset + i;
AliMpDDL* ddl = AliMpDDLStore::Instance()->GetDDL(i);
TH1* hddl(0x0);
TList list;
list.SetOwner(kFALSE);
for ( Int_t ide = 0; ide < ddl->GetNofDEs(); ++ide )
{
Int_t detElemId = ddl->GetDEId(ide);
TH1* h = hc.Histo(Form("/DE/HITS/%ds/DE%04d",timeResolution,detElemId));
if (!hddl)
{
hddl = static_cast<TH1*>(h->Clone(Form("DDL%d",ddlId)));
}
else
{
list.Add(h);
}
}
hddl->Merge(&list);
hc.Adopt(Form("/DDL/HITS/%ds",timeResolution),hddl);
}
}
示例4: monsim
void monsim(Int_t nev=20){
// Geant3 and Pythia
gSystem->Load("liblhapdf");
gSystem->Load("libEGPythia6");
gSystem->Load("libpythia6");
gSystem->Load("libAliPythia6");
gSystem->Load("libgeant321");
// MonaLisa monitoring
gSystem->Load("libNet.so");
gSystem->Load("libMonaLisa.so");
new TMonaLisaWriter("aliendb3.cern.ch", "Simulation pp", gSystem->Getenv("TEST_PLATFORMID"), gSystem->Getenv("TEST_PLATFORMID"), "global");
gROOT->LoadMacro("sim.C");
sim(nev);
if (gMonitoringWriter) gMonitoringWriter->SendProcessingProgress(1,1,kTRUE);
// Send the size of the raw.root file
FileStat_t buf;
gSystem->GetPathInfo("./raw.root",buf);
TList *valuelist = new TList();
valuelist->SetOwner(kTRUE);
TMonaLisaValue* valdouble = new TMonaLisaValue("raw.root size",buf.fSize);
valuelist->Add(valdouble);
if (gMonitoringWriter) gMonitoringWriter->SendParameters(valuelist);
delete valuelist;
printf("#Test finished successfully#\n");
}
示例5: Streamer
void KVList::Streamer(TBuffer &R__b)
{
// Backwards-compatible streamer
UInt_t R__s, R__c;
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v < 3) {
// read in old KVList object which inherited from TList
TList list;
list.Streamer(R__b);
TQObjSender fQObj;
fQObj.Streamer(R__b);
SetOwner(list.IsOwner()); // was list owner of objects ?
list.SetOwner(kFALSE); // make sure old list doesn't delete objects when it goes out of scope
TIter next(&list);
TObject* obj;
while ( (obj = next()) ) Add(obj);
list.Clear();
}
else
R__b.ReadClassBuffer(KVList::Class(),this,R__v,R__s,R__c);
} else {
R__b.WriteClassBuffer(KVList::Class(),this);
}
}
示例6: GetListOfTitles
UInt_t GetListOfTitles( TDirectory *rfdir, TList & titles )
{
// get a list of titles (i.e TDirectory) given a method dir
UInt_t ni=0;
if (rfdir==0) return 0;
TList *keys = rfdir->GetListOfKeys();
if (keys==0) {
cout << "+++ Directory '" << rfdir->GetName() << "' contains no keys" << endl;
return 0;
}
//
TIter rfnext(rfdir->GetListOfKeys());
TKey *rfkey;
titles.Clear();
titles.SetOwner(kFALSE);
while ((rfkey = (TKey*)rfnext())) {
// make sure, that we only look at histograms
TClass *cl = gROOT->GetClass(rfkey->GetClassName());
if (cl->InheritsFrom("TDirectory")) {
titles.Add(rfkey);
ni++;
}
}
cout << "--- Found " << ni << " instance(s) of the method " << rfdir->GetName() << endl;
return ni;
}
示例7: next
template <class HolderClass> bool read(const char *testname, int nEntry = 0, bool readother = false) {
// for each dirname
TString dirname = gROOT->GetVersion();
dirname.ReplaceAll(".","-");
dirname.ReplaceAll("/","-");
bool result = true;
result &= read<HolderClass>(dirname,testname, nEntry, /*current=*/true);
if (readother) {
TList listOfDirs;
listOfDirs.SetOwner(kTRUE);
fillListOfDir(listOfDirs);
TIter next(&listOfDirs);
while (TObjString *dir = (TObjString*)next()) {
if (dirname != dir->GetName()) {
std::cout << "Testing older file format from: " << dir->GetName() << std::endl;
result &= read<HolderClass>(dir->GetName(),testname, nEntry, /*current=*/ false);
}
}
}
return result;
}
示例8: GetListing
TList* KVDMS::GetListing(const Char_t* directory)
{
// Create and fill TList with just the names of files & containers in current directory
// (default) or in given directory.
// TList is filled with DMSFile_t objects which belong to the list, list must be deleted after use.
list(directory);
if (fout == "") {
Error("GetListing", "Unknown directory %s", directory);
return 0;
}
TObjArray* toks = fout.Tokenize("\n");
TList* list = new TList;
list->SetOwner(kTRUE);
list->SetName(((TObjString*)(*toks)[0])->String().Remove(TString::kBoth, ' ').Data());
for (int i = 1; i < toks->GetEntries(); i++) {
TString tmp = ((TObjString*)(*toks)[i])->String().Remove(TString::kBoth, ' ');
DMSFile_t* f = new DMSFile_t;
if (IsContainer(tmp)) { // container
f->SetName(gSystem->BaseName(tmp.Data()));
f->SetIsContainer();
} else {
f->SetName(tmp.Data());
}
list->Add(f);
}
delete toks;
return list;
}
示例9: runMuMuLoop
//______________________________________________________________________________
AliAnalysisTask* runMuMuLoop(TString smode = "local", TString inputFileName = "Find;BasePath=/alice/data/2015/LHC15o/000244918/muon_calo_pass1/AOD/*;FileName=AliAOD.Muons.root;Mode=cache;" )
{
// path for macro usefull for saf3
gROOT->LoadMacro(gSystem->ExpandPathName("$HOME/Documents/Analysis/Macro/Philippe/runTaskFacilities.C"));
// --- analysis setup ---
TString rootVersion = "";
TString alirootVersion = "";
TString aliphysicsVersion = "vAN-20151215-1";
TString dataDir = "/alice/cern.ch/user/p/ppillot/Data/LHC15n/reco/PbPbParam_AlignV6";
TString dataPattern = "*AliESDs.root";
TString runFormat = "%09d";
TString outDir = "Data/LHC15n/reco/PbPbParam_AlignV6/Phys/all";
TString analysisMacroName = "Physics";
Int_t ttl = 30000;
Int_t maxFilesPerJob = 100;
Int_t maxMergeFiles = 10;
Int_t maxMergeStages = 2;
TString extraLibs="PWGmuon";
TString extraIncs="include";
TString extraTasks="";
TString extraPkgs="";
// Copy file to run on the saf
TList pathList=0x0;
pathList.SetOwner();
// pathList.Add(new TObjString("$HOME/alicesw/aliphysics/mumu/src/PWG/muon"));
TList fileList; fileList.SetOwner();
// --- prepare the analysis environment ---
Int_t mode = PrepareAnalysis(smode, inputFileName, extraLibs, extraIncs, extraTasks, extraPkgs, pathList, fileList);
fileList.Add(new TObjString("runMuMuLoop.C"));
fileList.Add(new TObjString("AddTaskMuMu.C"));
// --- run the analysis (saf3 is a special case as the analysis is launched on the server) ---
// --- run the analysis (saf3 is a special case as the analysis is launched on the server) ---
if (mode == kSAF3Connect) {
RunAnalysisOnSAF3(fileList, aliphysicsVersion, inputFileName);
} else {
CreateAnalysisTrain();
RunAnalysis(smode, inputFileName, rootVersion, alirootVersion, aliphysicsVersion, extraLibs, extraIncs, extraTasks, extraPkgs, dataDir, dataPattern, outDir, analysisMacroName, runFormat, ttl, maxFilesPerJob, maxMergeFiles, maxMergeStages);
}
}
示例10: GroupByDE
//_________________________________________________________________________________________________
void GroupByDE(AliMergeableCollection& hc, int timeResolution)
{
AliMpDEIterator it;
it.First();
while (!it.IsDone())
{
Int_t detElemId = it.CurrentDEId();
AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
TList list;
list.SetOwner(kFALSE);
TH1* hde(0x0);
if ( de->GetStationType() != AliMp::kStationTrigger)
{
for ( Int_t i = 0; i < de->GetNofBusPatches(); ++i )
{
Int_t busPatchId = de->GetBusPatchId(i);
TH1* h = hc.Histo(Form("/BUSPATCH/HITS/%ds/BP%04d",timeResolution,busPatchId));
if (!hde)
{
hde = static_cast<TH1*>(h->Clone());
hde->SetName(Form("DE%04d",detElemId));
}
else
{
list.Add(h);
}
}
hde->Merge(&list);
hc.Adopt(Form("/DE/HITS/%ds",timeResolution),hde);
}
it.Next();
}
}
示例11: CreateAnalysisTrain
//______________________________________________________________________________
void CreateAnalysisTrain()
{
/// create the analysis train and configure it
// analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("MuonPhysicsAnalysis");
// Debug mode
//mgr->SetDebugLevel(3);
// AOD handler
AliInputEventHandler* aodH = new AliAODInputHandler;
mgr->SetInputEventHandler(aodH);
// Fill the trigger list with desired trigger combinations (See on ALICE log book for denomination)
//==============================================================================
TList* triggers = new TList; // Create pointer for trigger list
triggers->SetOwner(kTRUE); // Give rights to trigger liser
if (!isMC)
{
// PbPb trigger
triggers->Add(new TObjString("CINT7-B-NOPF-MUFAST"));//MB &0MUL
triggers->Add(new TObjString("CINT7-B-NOPF-MUFAST&0MSL"));//MB &0MUL
triggers->Add(new TObjString("CINT7-B-NOPF-MUFAST&0MUL"));//MB &0MUL
triggers->Add(new TObjString("CMUL7-B-NOPF-MUFAST"));// MUL
triggers->Add(new TObjString("CMSL7-B-NOPF-MUFAST"));// MSL
triggers->Add(new TObjString("CMSL7-B-NOPF-MUFAST&0MUL"));// MSL &0MUL
}
// Load centrality task
//==============================================================================
gROOT->LoadMacro("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros/AddTaskMultSelection.C");
AddTaskMultSelection(kFALSE); // user
// Load task
//==============================================================================
TString outputname = AliAnalysisManager::GetAnalysisManager()->GetCommonFileName(); // Create output name in case of no dataset selected
gROOT->LoadMacro("AddTaskMuMu.C");
AddTaskMuMu(outputname.Data(),triggers,"PbPb2015",isMC);
cout <<"add task mumu done"<< endl;
}
示例12: GetListOfKeys
UInt_t GetListOfKeys( TList& keys, TString inherits, TDirectory *dir=0 )
{
// get a list of keys with a given inheritance
// the list contains TKey objects
if (dir==0) dir = gDirectory;
TIter mnext(dir->GetListOfKeys());
TKey *mkey;
keys.Clear();
keys.SetOwner(kFALSE);
UInt_t ni=0;
while ((mkey = (TKey*)mnext())) {
// make sure, that we only look at TDirectory with name Method_<xxx>
TClass *cl = gROOT->GetClass(mkey->GetClassName());
if (cl->InheritsFrom(inherits)) {
keys.Add(mkey);
ni++;
}
}
return ni;
}
示例13: AdaptFileStructure
void AdaptFileStructure(TString fileName)
{
TFile* f = TFile::Open(fileName.Data(), "READ");
TList* cList = new TList();
cList->SetName("cList");
cList->SetOwner(kTRUE);
for (Int_t i = 0; i < gFile->GetNkeys(); i++) {
TObject* obj = f->GetListOfKeys()->At(i);
TString name = obj->GetName();
TObject* obj2 = f->Get(name.Data());
cList->Add(obj2);
}
TString fileNameOutput = fileName;
fileNameOutput.ReplaceAll(".root", "_commonStructure.root");
TFile* fOut = TFile::Open(fileNameOutput.Data(), "RECREATE");
fOut->mkdir("PWGLF_PPVsMultXCheck_MC");
fOut->cd("PWGLF_PPVsMultXCheck_MC");
cList->Write("cList", TObject::kSingleKey);
fOut->Close();
f->Close();
}
示例14: GetListOfMethods
UInt_t GetListOfMethods( TList & methods, TDirectory *dir=0 )
{
// get a list of methods
// the list contains TKey objects
if (dir==0) dir = gDirectory;
TIter mnext(dir->GetListOfKeys());
TKey *mkey;
methods.Clear();
methods.SetOwner(kFALSE);
UInt_t ni=0;
while ((mkey = (TKey*)mnext())) {
// make sure, that we only look at TDirectory with name Method_<xxx>
TString name = mkey->GetClassName();
TClass *cl = gROOT->GetClass(name);
if (cl->InheritsFrom("TDirectory")) {
if (TString(mkey->GetName()).BeginsWith("Method_")) {
methods.Add(mkey);
ni++;
}
}
}
cout << "--- Found " << ni << " classifier types" << endl;
return ni;
}
示例15: AddTask_GammaConvDalitzV1_pp
//.........这里部分代码省略.........
} else if (trainConfig == 202) {
cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253202221710");
cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "10475400253202221710");
cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "30475400253202221710");
cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253201221710");
cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253203221710");
cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253202121710");
cuts.AddCut("00074113", "00200009360300007800004000", "0263103100900000", "20475400253202321710");
} else {
Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
return;
}
if(!cuts.AreValid()){
cout << "\n\n****************************************************" << endl;
cout << "ERROR: No valid cuts stored in CutHandlerConvDalitz! Returning..." << endl;
cout << "****************************************************\n\n" << endl;
return;
}
Int_t numberOfCuts = cuts.GetNCuts();
TList *EventCutList = new TList();
TList *ConvCutList = new TList();
TList *MesonCutList = new TList();
TList *ElecCutList = new TList();
TList *HeaderList = new TList();
TObjString *Header2 = new TObjString("BOX");
HeaderList->Add(Header2);
EventCutList->SetOwner(kTRUE);
AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
ConvCutList->SetOwner(kTRUE);
AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
MesonCutList->SetOwner(kTRUE);
AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
ElecCutList->SetOwner(kTRUE);
AliDalitzElectronCuts **analysisElecCuts = new AliDalitzElectronCuts*[numberOfCuts];
Bool_t initializedMatBudWeigths_existing = kFALSE;
for(Int_t i = 0; i<numberOfCuts; i++){
TString cutName( Form("%s_%s_%s_%s",(cuts.GetEventCut(i)).Data(),(cuts.GetPhotonCut(i)).Data(),(cuts.GetElecCut(i)).Data(),(cuts.GetMesonCut(i)).Data() ) );
analysisEventCuts[i] = new AliConvEventCuts();
analysisEventCuts[i]->SetV0ReaderName(V0ReaderName);
analysisEventCuts[i]->InitializeCutsFromCutString((cuts.GetEventCut(i)).Data());
EventCutList->Add(analysisEventCuts[i]);
analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
analysisCuts[i] = new AliConversionPhotonCuts();
if (enableMatBudWeightsPi0 > 0){
if (isMC > 0){
if (analysisCuts[i]->InitializeMaterialBudgetWeights(enableMatBudWeightsPi0,filenameMatBudWeights)){
initializedMatBudWeigths_existing = kTRUE;}
else {cout << "ERROR The initialization of the materialBudgetWeights did not work out." << endl;}
}
else {cout << "ERROR 'enableMatBudWeightsPi0'-flag was set > 0 even though this is not a MC task. It was automatically reset to 0." << endl;}
}
analysisCuts[i]->SetV0ReaderName(V0ReaderName);
analysisCuts[i]->InitializeCutsFromCutString((cuts.GetPhotonCut(i)).Data());
ConvCutList->Add(analysisCuts[i]);
analysisCuts[i]->SetFillCutHistograms("",kFALSE);