diff --git a/QFramework/Root/TQXSecParser.cxx b/QFramework/Root/TQXSecParser.cxx index a0636f05afb064feac63c01ca9019735c4f7612d..5d16921f17cdb61c67785fcf3a4fbec829d7df19 100644 --- a/QFramework/Root/TQXSecParser.cxx +++ b/QFramework/Root/TQXSecParser.cxx @@ -17,13 +17,13 @@ ClassImp(TQXSecParser) // // The first row of the text file is interpreted as column labels. // The first column will be taken as sample name. -// +// // The other colum labels are expected to match the following patterns unless // specified differently by setting the corresponding tags: -// +// // column content | default pattern | tag name // -------------------------------------------------------- -// cross section | *xsec* | xSecColName +// cross section | *xsec* | xSecColName // filter efficiency | *filt*eff* | xFilterEffColName // kFactor | *k*fac* | kFactorColName // process info | *proc* | processInfoColName @@ -450,8 +450,8 @@ int TQXSecParser::applyWhitelist(std::vector<TString>* lines){ this->setProperty(i,0,"bold",true); // will prevent from name matching with same entry in line above if (count==0) { WARNclass("No samples passed the whitelist selection!"); - } - + } + return count; } @@ -540,14 +540,14 @@ void TQXSecParser::clearTagKeysToExport() { } int TQXSecParser::addAllEnabledSamples(){ - // add all mapped samples to the folder + // add all mapped samples to the folder // an enabled sample is a mapped sample // that has the 'enabled' flag set return this->addAllSamples(true,true); } int TQXSecParser::addAllMappedSamples(){ - // add all mapped samples to the folder + // add all mapped samples to the folder // a mapped sample is one that has a path assigned to it return this->addAllSamples(false,true); } @@ -618,7 +618,11 @@ int TQXSecParser::addAllSamples(bool requireEnabled, bool requirePath){ TQTaggableIterator itr(this->fPathVariants); while(itr.hasNext()){ TQNamedTaggable* pathVariant = itr.readNext(); - TString path = pathVariant ? pathVariant->replaceInText(pathpattern) : pathpattern; + int nReplaced = 0; + int nFailed = 0; + TString path = pathVariant ? + pathVariant->replaceInText(pathpattern, nReplaced, nFailed, (TString) "") : + pathpattern; DEBUGclass("path is '%s'",path.Data()); TQSampleFolder* sf = this->fSampleFolder->getSampleFolder(path+"+"); if(!sf){ @@ -628,7 +632,7 @@ int TQXSecParser::addAllSamples(bool requireEnabled, bool requirePath){ if(sf->hasObject(samplename)){ WARNclass("cowardly refusing to overwrite sample '%s' in folder '%s' - please check your cross section file for path conflicts!",samplename.Data(),path.Data()); continue; - } + } TQSample* s = new TQSample(samplename); if(!s){ ERRORclass("unable to allocate sample with name '%s' - this should never have happened!",samplename.Data()); @@ -700,8 +704,8 @@ int TQXSecParser::addAllSamples(bool requireEnabled, bool requirePath){ DEBUGclass("setting tag sumOfWeights=%f",sumOfWeightsPerEvent); s->setTagDouble(".xsp.sumOfWeights",sumOfWeightsPerEvent); } - } - + } + DEBUGclass("treeName = %s", s->getTagStringDefault(".xsp.treename", "").Data()); TString filepath; if(this->getTagString("fileNamePattern",filepath)){ @@ -715,6 +719,11 @@ int TQXSecParser::addAllSamples(bool requireEnabled, bool requirePath){ } retval++; DEBUGclass("done adding sample '%s' at path '%s'",samplename.Data(),sf->getPath().Data()); + if (nReplaced == 0){ + DEBUGclass("Skipping other path variants, because path doesn't depend on path variants."); + break; + } + DEBUGclass("nReplaced = %d", nReplaced); } } return retval; @@ -812,14 +821,14 @@ int TQXSecParser::addAllSamplesFromFolder(TQFolder* f, const TString& folderpath s->setTagBool(TString::Format(".%s.visited", traceID.Data()), true); s->setTagInteger(TString::Format(".%s.timestamp.machine",traceID.Data()),TQUtils::getCurrentTime()); s->setTagString(TString::Format(".%s.timestamp.human",traceID.Data()),TQUtils::getTimeStamp()); - + s->importTags(tagstring); sf->addObject(s); retval++; } return retval; } - + bool TQXSecParser::isGood(){ // return true if this reader was properly initialized and is good to go if(this->getNcols() < 2) return false;