本文整理汇总了C++中TObjArray::MakeIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ TObjArray::MakeIterator方法的具体用法?C++ TObjArray::MakeIterator怎么用?C++ TObjArray::MakeIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TObjArray
的用法示例。
在下文中一共展示了TObjArray::MakeIterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChainToTextFile
void ChainToTextFile(TChain* chain, const char* target)
{
// write a text list of the files in the chain
TObjArray* list = chain->GetListOfFiles();
TIterator* iter = list->MakeIterator();
TObject* obj = 0;
ofstream outfile;
outfile.open(target);
while ((obj = iter->Next())) {
TString fileName(obj->GetTitle());
outfile << fileName.Data() << endl;
}
outfile.close();
delete iter;
}
示例2: main
int main(int argc, char *argv[])
{
// Declaration of variables
ExRootConfReader *confReader = 0;
Delphes *modularDelphes = 0;
DelphesFactory *factory = 0;
TObjArray *allParticleOutputArray = 0;
TObjArray *stableParticleOutputArray = 0;
TObjArray *partonOutputArray = 0;
Int_t event;
TObjArray *inputArray = 0;
TIterator *inputIterator = 0;
Candidate *candidate = 0;
TLorentzVector momentum;
JetDefinition *definition = 0;
vector<PseudoJet> inputList, outputList;
PseudoJet jet;
gROOT->SetBatch();
int appargc = 1;
char appName[] = "ExternalFastJetBasic";
char *appargv[] = {appName};
TApplication app(appName, &appargc, appargv);
if(argc != 2)
{
cout << " Usage: " << appName << " config_file" << endl;
cout << " config_file - configuration file in Tcl format." << endl;
return 1;
}
try
{
// Initialization
confReader = new ExRootConfReader;
confReader->ReadFile(argv[1]);
modularDelphes = new Delphes("Delphes");
modularDelphes->SetConfReader(confReader);
factory = modularDelphes->GetFactory();
allParticleOutputArray = modularDelphes->ExportArray("allParticles");
stableParticleOutputArray = modularDelphes->ExportArray("stableParticles");
partonOutputArray = modularDelphes->ExportArray("partons");
modularDelphes->InitTask();
// fastjet definition
ClusterSequence::print_banner();
definition = new JetDefinition(antikt_algorithm, 0.5);
// Define your input candidates to fastjet (by default particle-flow objects).
// If you want pure calorimeter towers change "EFlowMerger/eflow" into "Calorimeter/towers":
inputArray = modularDelphes->ImportArray("EFlowMerger/eflow");
inputIterator = inputArray->MakeIterator();
// Event loop
for(event = 0; event < NEVENTS; ++event)
{
modularDelphes->Clear();
// convert EVENT input array into Delphes internal format
ConvertInput(event, factory, allParticleOutputArray, stableParticleOutputArray, partonOutputArray);
// run Delphes reconstruction
modularDelphes->ProcessTask();
inputList.clear();
inputIterator->Reset();
// pass delphes candidates to fastjet clustering
while((candidate = static_cast<Candidate*>(inputIterator->Next())))
{
momentum = candidate->Momentum;
jet = PseudoJet(momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E());
inputList.push_back(jet);
}
// run clustering
ClusterSequence sequence(inputList, *definition);
outputList.clear();
outputList = sorted_by_pt(sequence.inclusive_jets(0.0));
// tell the user what was done
// - the description of the algorithm used
// - show the inclusive jets as
// {index, rapidity, phi, pt}
//----------------------------------------------------------
cout << "Ran " << definition->description() << endl;
// label the columns
//.........这里部分代码省略.........
示例3: main
int main(int argc, char *argv[])
{
char appName[] = "hepmc2pileup";
stringstream message;
FILE *inputFile = 0;
DelphesFactory *factory = 0;
TObjArray *stableParticleOutputArray = 0, *allParticleOutputArray = 0, *partonOutputArray = 0;
TIterator *itParticle = 0;
Candidate *candidate = 0;
DelphesPileUpWriter *writer = 0;
DelphesHepMCReader *reader = 0;
Int_t i;
Long64_t length, eventCounter;
if(argc < 2)
{
cout << " Usage: " << appName << " output_file" << " [input_file(s)]" << endl;
cout << " output_file - output binary pile-up file," << endl;
cout << " input_file(s) - input file(s) in HepMC format," << endl;
cout << " with no input_file, or when input_file is -, read standard input." << endl;
return 1;
}
signal(SIGINT, SignalHandler);
gROOT->SetBatch();
int appargc = 1;
char *appargv[] = {appName};
TApplication app(appName, &appargc, appargv);
try
{
writer = new DelphesPileUpWriter(argv[1]);
factory = new DelphesFactory("ObjectFactory");
allParticleOutputArray = factory->NewPermanentArray();
stableParticleOutputArray = factory->NewPermanentArray();
partonOutputArray = factory->NewPermanentArray();
itParticle = stableParticleOutputArray->MakeIterator();
reader = new DelphesHepMCReader;
i = 2;
do
{
if(interrupted) break;
if(i == argc || strncmp(argv[i], "-", 2) == 0)
{
cout << "** Reading standard input" << endl;
inputFile = stdin;
length = -1;
}
else
{
cout << "** Reading " << argv[i] << endl;
inputFile = fopen(argv[i], "r");
if(inputFile == NULL)
{
message << "can't open " << argv[i];
throw runtime_error(message.str());
}
fseek(inputFile, 0L, SEEK_END);
length = ftello(inputFile);
fseek(inputFile, 0L, SEEK_SET);
if(length <= 0)
{
fclose(inputFile);
++i;
continue;
}
}
reader->SetInputFile(inputFile);
ExRootProgressBar progressBar(length);
// Loop over all objects
eventCounter = 0;
factory->Clear();
reader->Clear();
while(reader->ReadBlock(factory, allParticleOutputArray,
stableParticleOutputArray, partonOutputArray) && !interrupted)
{
if(reader->EventReady())
{
++eventCounter;
itParticle->Reset();
while((candidate = static_cast<Candidate*>(itParticle->Next())))
{
const TLorentzVector &position = candidate->Position;
const TLorentzVector &momentum = candidate->Momentum;
writer->WriteParticle(candidate->PID,
position.X(), position.Y(), position.Z(), position.T(),
//.........这里部分代码省略.........
示例4: cafZFlatNtupleMaker
//.........这里部分代码省略.........
c->InitDataset(dsp[1]);
c->InitDataset(dsp[2]);
c->InitDataset(dsp[3]);
c->InitDataset(dsp[4]);
c->InitDataset(dsp[5]);
c->InitDataset(dsp[6]);
c->InitDataset(dsp[7]);
ap->AddDataset(dsp[0]);
ap->AddDataset(dsp[1]);
ap->AddDataset(dsp[2]);
ap->AddDataset(dsp[3]);
ap->AddDataset(dsp[4]);
ap->AddDataset(dsp[5]);
ap->AddDataset(dsp[6]);
ap->AddDataset(dsp[7]);
}
if (partype == 2) {
dsp[0] = new TStnDataset("cdfpstn","ze0s8t");
dsp[1] = new TStnDataset("cdfpstn","ze0sat");
c->InitDataset(dsp[0]);
c->InitDataset(dsp[1]);
ap->AddDataset(dsp[0]);
ap->AddDataset(dsp[1]);
}
double sum=0;
for (int i=0; i < datasets; i++) {
std::cout << "Nfile="<< dsp[i]->GetNFiles() << std::endl;
std::cout << "NEvts="<< dsp[i]->GetNEvents() << std::endl;
sum+= dsp[i]->GetNEvents();
TObjArray* myarr = dsp[i]->GetListOfFiles();
TIterator *it = myarr->MakeIterator();
TObject *obj;
while (obj = (TObject*) it->Next()) {
obj->Print();
}
}
std::cout << "Total Evts="<< sum << std::endl;
int split = 0;
if (partype == 0 || partype == 1) split = 200;
if (partype == 2) split = 10;
std::cout << "split, IND=" << ind << ", " << split <<std::endl;
ap->SetSplit(ind, split);
std::cout << "syscode, MomPdg, parType=" << syscode << ", " << 23 << ", " << partype <<std::endl;
TH1::AddDirectory(kFALSE); //do not add these histos to memory
/******************************************************/
// define all module here
/******************************************************/
//PassFailTree *passFailFile = new PassFailTree;
//BadPointerChecker *ptChecker = new BadPointerChecker;
TriggerModule* trigMod;