本文整理汇总了C++中Output::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Output::Reset方法的具体用法?C++ Output::Reset怎么用?C++ Output::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char * argv[])
{
if( argc < 3) {
std::cout << "usage : tupleMaker input-filenames output-filename <Unweight>" << std::endl;
return 1;
}
std::string lastarg = std::string( argv[argc-1] );
int lastargisfilename = 0;
if (lastarg.length() > 1 ){
lastargisfilename =1;
}
if (!lastargisfilename){
if( argc < 5) {
std::cout << "usage : tupleMaker input-filenames output-filename <Unweight> <PDF reweight>" << std::endl;
return 1;
}
}
//
// read in some control parameters
//
bool Unweight = 0;
bool PDF_reweight = 0;
if (!lastargisfilename){
Unweight = atoi( argv[argc-2] );
PDF_reweight = atoi( argv[argc-1] );
std::cout<<"Unweight = "<<Unweight<<" PDF reweight = "<<PDF_reweight<<std::endl;
if(PDF_reweight==1) {
std::cout<<"========================================================================================================"<<std::endl;
std::cout<<"Need to make sure you have right PDF text files resbos_P/resbos_weights_PDF_*.dat"<<std::endl;
std::cout<<"========================================================================================================"<<std::endl;
}
}
// get input and output file names
std::vector<std::string> in_files;
int nInputs = argc-(2-lastargisfilename);
if(PDF_reweight) nInputs = argc-(3-lastargisfilename);
for( int i = 1; i < nInputs;++i) {
in_files.push_back( std::string( argv[i] ) );
std::cout<<"Input file: "<<std::string(argv[i])<<std::endl;
}
int nOutput = argc-(2-lastargisfilename);
if(PDF_reweight) nOutput = argc-(3-lastargisfilename);
std::string out_filename = std::string( argv[nOutput] );
std::cout<<"Output file: "<<out_filename<<std::endl;
// setup outputfile
TFile * of = new TFile(out_filename.c_str(),"RECREATE");
if( of == 0) {
std::cout << "Couldn't open output file : " << out_filename << std::endl;
return 1;
}
Output * output = new Output();
output->Reset();
// initialise random number generator
TRandom2 random;
random.SetSeed(19742005);
// loop over files
Double_t StandardWeight =0;
int nfiles = in_files.size();
if (Unweight){
std::cout << "All events will have weight one" << std::endl;
std::cout << "Multiple files are merged using pass/fail based on the weight of events in the first file -- Standard Weight as shown below" << std::endl;
}
if (!Unweight)
std::cout << "Unweighted events, Weights from generator are maintained"<< std::endl;
//
// read event weights for different PDF files
//
std::ifstream f_weights[45];
vector<float> pdfwgts;
pdfwgts.resize(45);
if(PDF_reweight) {
char name[50];
for(int i=0; i<44; i++) {
sprintf(name, "%s%d%s", "resbos_P/resbos_weights_PDF_", i+1, ".dat");
f_weights[i].open(name, std::ios::in);
if( !f_weights[i] ) std::cout<<"Could not find the weight file "<<name<<std::endl;
}
}
#ifdef __USE_PDFS_RESBOS__
Unweight = true;
///
{
std::ifstream tmp_file;
tmp_file.open( "weights_00.hep" , std::ios::in );
if( tmp_file )
{
int num ; double wgt ;
while( tmp_file >> num >> wgt )
//.........这里部分代码省略.........