multi-thread safe porting with miniAOD-DQMsequence

This pull request supersedes the #4849 and #4843 since it is a merge of them.