Skip to content
Snippets Groups Projects
Commit 6df41298 authored by Carsten Burgard's avatar Carsten Burgard :speech_balloon:
Browse files

added histosys transfers

parent 09bb9890
No related branches found
No related tags found
1 merge request!664analysis developments
Pipeline #2369707 failed
......@@ -78,8 +78,8 @@ namespace TSBaseActions {
TString cleanup(TString input) const {
TQStringUtils::removeLeadingText(input,"Sample.");
TQStringUtils::removeLeadingText(input,"Channel.");
TQStringUtils::removeLeadingText(input,"OverallSys.");
TQStringUtils::removeLeadingText(input,"HistoSys.");
// TQStringUtils::removeLeadingText(input,"OverallSys.");
// TQStringUtils::removeLeadingText(input,"HistoSys.");
return input;
}
......@@ -151,7 +151,7 @@ namespace TSBaseActions {
TString mode = config->getTagStringDefault("mode","sample");
std::vector<TString> exceptRegions = config->getTagVString("except.Channels");
std::vector<TString> exceptSamples = config->getTagVString("except.Samples");
std::vector<TString> exceptSystematics = config->getTagVString("except.OverallSys");
std::vector<TString> exceptSystematics = config->getTagVString("except");
manager->info(TString::Format("performing transfer '%s'",config->GetName()));
......@@ -169,10 +169,17 @@ namespace TSBaseActions {
}
TString mark;
bool marked = config->getTagString("selectTag.OverallSys",mark);
bool marked = config->getTagString("selectTag",mark);
std::vector<TString> sysTypes = config->getTagVString("types");
if(sysTypes.size() == 0){
sysTypes.push_back("OverallSys");
if(mode.Contains("sample")){
sysTypes.push_back("HistoSys");
}
}
if (mode.Contains("sample",TString::kIgnoreCase)) {
TString sourceSample;
if(!config->getTagString("source",sourceSample)){
manager->error(TString::Format("missing required 'source' information on transfer '%s'",config->GetName()));
......@@ -204,14 +211,14 @@ namespace TSBaseActions {
if(TQStringUtils::matches(sample->GetName(),"Sample."+sourceSample)) continue;
if(verbose) manager->info(TString::Format("\tfor sample '%s'",sample->GetName()));
sample->deleteObject(".Dropped!");
for (const auto& systType : {TString("OverallSys."),TString("ShapeSys.")}) {
for (const auto& systType : sysTypes){
std::vector<TQFolder*> remove;
{
TQFolderIterator oldsystematics(sample->getListOfFolders(systType+"*"),true);
TQFolderIterator oldsystematics(sample->getListOfFolders(systType+".*"),true);
while(oldsystematics.hasNext()){
TQFolder* systematic = oldsystematics.readNext();
if(!systematic) continue;
if(matchesAny(systematic,exceptSystematics,systType) || !matchesAny(systematic,targetSystematics,systType)) continue;
if(matchesAny(systematic,exceptSystematics,systType+".") || !matchesAny(systematic,targetSystematics,systType+".")) continue;
if(marked && !systematic->getTagBoolDefault(mark,false)) continue;
if(verbose) manager->info(TString::Format("\t\tremoving '%s'",systematic->GetName()));
remove.push_back(systematic);
......@@ -277,37 +284,39 @@ namespace TSBaseActions {
if(matchesAny(sample,exceptSamples,"Sample.")) continue;
if(verbose) manager->info(TString::Format("\tfor sample '%s'",sample->GetName()));
sample->deleteObject(".Dropped!");
std::vector<TQFolder*> remove;
{
TQFolderIterator oldsystematics(sample->getListOfFolders("OverallSys.*"),true);
while(oldsystematics.hasNext()){
TQFolder* systematic = oldsystematics.readNext();
if(!systematic) continue;
if(matchesAny(region,exceptSystematics,"OverallSys.")) continue;
if(marked && !systematic->getTagBoolDefault(mark,false)) continue;
if(!matchesAny(systematic,targetSystematics,"OverallSys.")) continue;
if(verbose) manager->info(TString::Format("\t\tremoving '%s'",systematic->GetName()));
remove.push_back(systematic);
for (const auto& systType : sysTypes){
std::vector<TQFolder*> remove;
{
TQFolderIterator oldsystematics(sample->getListOfFolders(systType+".*"),true);
while(oldsystematics.hasNext()){
TQFolder* systematic = oldsystematics.readNext();
if(!systematic) continue;
if(matchesAny(region,exceptSystematics,systType+".")) continue;
if(marked && !systematic->getTagBoolDefault(mark,false)) continue;
if(!matchesAny(systematic,targetSystematics,systType+".")) continue;
if(verbose) manager->info(TString::Format("\t\tremoving '%s'",systematic->GetName()));
remove.push_back(systematic);
}
}
}
for(auto systematic:remove){
systematic->detachFromBase();
delete systematic;
}
{
TQFolderIterator newsystematics(source->getListOfFolders(TQFolder::concatPaths(sample->getName(),"OverallSys.*")),true);
while(newsystematics.hasNext()){
TQFolder* systematic = newsystematics.readNext();
if(!systematic) continue;
if(matchesAny(region,exceptSystematics,"OverallSys.")) continue;
if(marked && !systematic->getTagBoolDefault(mark,false)) continue;
if(!matchesAny(systematic,targetSystematics,"OverallSys.")) continue;
if(verbose) manager->info(TString::Format("\t\tcopying '%s'",systematic->GetName()));
TQFolder* copy = systematic->copy();
i++;
sample->addFolder(copy);
copy->setTagString("transferred",source->GetName());
addToLog(log,cleanup(systematic->GetName()),sourceChannel,cleanup(region->GetName()));
for(auto systematic:remove){
systematic->detachFromBase();
delete systematic;
}
{
TQFolderIterator newsystematics(source->getListOfFolders(TQFolder::concatPaths(sample->getName(),systType+".*")),true);
while(newsystematics.hasNext()){
TQFolder* systematic = newsystematics.readNext();
if(!systematic) continue;
if(matchesAny(region,exceptSystematics,systType+".")) continue;
if(marked && !systematic->getTagBoolDefault(mark,false)) continue;
if(!matchesAny(systematic,targetSystematics,systType+".")) continue;
if(verbose) manager->info(TString::Format("\t\tcopying '%s'",systematic->GetName()));
TQFolder* copy = systematic->copy();
i++;
sample->addFolder(copy);
copy->setTagString("transferred",source->GetName());
addToLog(log,cleanup(systematic->GetName()),sourceChannel,cleanup(region->GetName()));
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment