00001 #include "DataFormats/Provenance/interface/RunAuxiliary.h" 00002 #include <ostream> 00003 00004 /*---------------------------------------------------------------------- 00005 00006 $Id: RunAuxiliary.cc,v 1.3 2008/08/14 17:47:33 paterno Exp $ 00007 00008 ----------------------------------------------------------------------*/ 00009 00010 namespace edm { 00011 void 00012 RunAuxiliary::write(std::ostream& os) const { 00013 os << "Process History ID = " << processHistoryID_ << std::endl; 00014 os << id_ << std::endl; 00015 } 00016 00017 bool 00018 RunAuxiliary::mergeAuxiliary(RunAuxiliary const& newAux) { 00019 00020 mergeNewTimestampsIntoThis_(newAux); 00021 mergeNewProcessHistoryIntoThis_(newAux); 00022 00023 // Keep the process history ID that is in the preexisting principal 00024 // It may have been updated to include the current process. 00025 // There is one strange other case where the two ProcessHistoryIDs 00026 // could be different which should not be important and we just ignore. 00027 // There could have been previous processes which only dropped products. 00028 // These processes could have dropped the same branches but had different 00029 // process names ... Ignore this. 00030 00031 return id_ == newAux.id(); 00032 // if (id_ != newAux.id()) return false; 00033 // return true; 00034 } 00035 00036 void 00037 RunAuxiliary::mergeNewTimestampsIntoThis_(RunAuxiliary const& newAux) { 00038 if (beginTime_ == Timestamp::invalidTimestamp() || 00039 newAux.beginTime() == Timestamp::invalidTimestamp()) { 00040 beginTime_ = Timestamp::invalidTimestamp(); 00041 } 00042 else if (newAux.beginTime() < beginTime_) { 00043 beginTime_ = newAux.beginTime(); 00044 } 00045 00046 if (endTime_ == Timestamp::invalidTimestamp() || 00047 newAux.endTime() == Timestamp::invalidTimestamp()) { 00048 endTime_ = Timestamp::invalidTimestamp(); 00049 } 00050 else if (newAux.endTime() > endTime_) { 00051 endTime_ = newAux.endTime(); 00052 } 00053 } 00054 00055 void 00056 RunAuxiliary::mergeNewProcessHistoryIntoThis_(RunAuxiliary const& newAux) 00057 { 00058 allEventsProcessHistories_.insert(newAux.allEventsProcessHistories_.begin(), 00059 newAux.allEventsProcessHistories_.end()); 00060 00061 } 00062 }