RecJobHistory Class Reference

#include <RecJobHistory.h>

List of all members.

Classes

class  compareJobRecord

Public Types

enum  EJobType {
  kUnknownJobType = 0x0000, kRaw = 0x0001, kGMinos = 0x0002, kPTSim = 0x0004,
  kPhotonTransport = 0x0008, kCand = 0x0010, kNtpMC = 0x0020, kNtpTH = 0x0040,
  kNtpSR = 0x0080, kNtpSt = 0x0100
}
typedef enum
RecJobHistory::EJobType 
JobType_t
typedef std::map< std::string,
RecJobRecord * > 
JobRecordMap
typedef JobRecordMap::iterator JobRecordMapItr
typedef
JobRecordMap::const_iterator 
JobRecordMapConstItr

Public Member Functions

 RecJobHistory ()
 RecJobHistory (const RecJobHistory &)
virtual ~RecJobHistory ()
const char * JobTypeAsString (JobType_t jobtype) const
const RecJobRecordGetJobRecord (JobType_t jobtype) const
const RecJobRecordGetJobRecord (const char *jobtypestr) const
const JobRecordMapGetJobRecordMap () const
virtual std::ostream & Print (std::ostream &os) const
virtual void Print (Option_t *option="") const
virtual bool Append (const RecJobHistory &that)
virtual bool CreateJobRecord (JobType_t jobtype)
virtual bool CreateJobRecord (const char *jobtypestr)
virtual bool CreateJobRecord (JobType_t jobtype, const char *prodname, const char *codename, const char *hostname, const VldTimeStamp &timestamp)
virtual bool CreateJobRecord (const char *jobtypestr, const char *prodname, const char *codename, const char *hostname, const VldTimeStamp &timestamp)
virtual bool CreateJobRecord (JobType_t jobtype, const RecJobRecord &jobrec_tocopy)
virtual bool CreateJobRecord (const char *jobtypestr, const RecJobRecord &jobrec_tocopy)
virtual ReleaseType::Release_t GetProdReleaseType (UInt_t jobtypemask=(kGMinos|kCand)) const

Static Public Attributes

static const UInt_t kNJobType = 10

Private Member Functions

virtual bool AdoptJobRecord (const char *, RecJobRecord *jobrec)

Private Attributes

JobRecordMap fJobRecordMap

Detailed Description

Definition at line 22 of file RecJobHistory.h.


Member Typedef Documentation

typedef std::map<std::string,RecJobRecord*> RecJobHistory::JobRecordMap

Definition at line 42 of file RecJobHistory.h.

typedef JobRecordMap::const_iterator RecJobHistory::JobRecordMapConstItr

Definition at line 44 of file RecJobHistory.h.

typedef JobRecordMap::iterator RecJobHistory::JobRecordMapItr

Definition at line 43 of file RecJobHistory.h.


Member Enumeration Documentation

Enumerator:
kUnknownJobType 
kRaw 
kGMinos 
kPTSim 
kPhotonTransport 
kCand 
kNtpMC 
kNtpTH 
kNtpSR 
kNtpSt 

Definition at line 27 of file RecJobHistory.h.

00027                          {
00028      // Enumerated list of job types.
00029      kUnknownJobType  = 0x0000,
00030      kRaw             = 0x0001,  
00031      kGMinos          = 0x0002, 
00032      kPTSim           = 0x0004,
00033      kPhotonTransport = 0x0008,
00034      kCand            = 0x0010,
00035      kNtpMC           = 0x0020,
00036      kNtpTH           = 0x0040,
00037      kNtpSR           = 0x0080,
00038      kNtpSt           = 0x0100
00039    } JobType_t;  


Constructor & Destructor Documentation

RecJobHistory::RecJobHistory (  ) 

Definition at line 31 of file RecJobHistory.cxx.

References Msg::kDebug, and MSG.

00031                              {
00032   // Default constructor
00033 
00034   MSG("Rec",Msg::kDebug) << "RecJobHistory default ctor @ " << this << endl;
00035   
00036 }

RecJobHistory::RecJobHistory ( const RecJobHistory that  ) 

Definition at line 39 of file RecJobHistory.cxx.

References Append(), Msg::kDebug, and MSG.

00039                                                       : TObject(that) {
00040   // Copy constructor
00041 
00042   MSG("Rec",Msg::kDebug) << "RecJobHistory copy ctor @ " << this << endl;
00043   Append(that);
00044   
00045 }

RecJobHistory::~RecJobHistory (  )  [virtual]

Definition at line 48 of file RecJobHistory.cxx.

References fJobRecordMap, Msg::kDebug, and MSG.

00048                               {
00049   // Destructor
00050   
00051   MSG("Rec",Msg::kDebug) << "RecJobHistory dtor @ " << this << endl;
00052 
00053   JobRecordMapItr itr; 
00054   for ( itr = fJobRecordMap.begin(); itr != fJobRecordMap.end(); itr++ ) {
00055     RecJobRecord* jobrecord = itr->second;
00056     delete jobrecord;
00057   }
00058   fJobRecordMap.clear();
00059   
00060 }


Member Function Documentation

bool RecJobHistory::AdoptJobRecord ( const char *  jobtypestr,
RecJobRecord jobrec 
) [private, virtual]

Definition at line 249 of file RecJobHistory.cxx.

References fJobRecordMap, Msg::kWarning, and MSG.

Referenced by CreateJobRecord().

00250                                                          {
00251   // Insert job ptr to map with the specified jobtypestr as key.
00252   // If entry already exists, user will be warned and then entry
00253   // will be overrriden with new record.
00254   // Return true if success.  Return false if jobtypestr is "UnknownJobType"
00255   // and no insertion will be made in this case.
00256 
00257   if ( std::string(jobtypestr) == "UnknownJobType" ) {
00258     MSG("Rec",Msg::kWarning) << "RecJobHistory::CreateJobRecord "
00259                              << "received Unknown jobtypestr " << jobtypestr 
00260                              << ". Ignored." << endl;
00261     return false;
00262   }
00263 
00264   JobRecordMapItr itr = fJobRecordMap.find(jobtypestr);
00265   
00266   if ( itr != fJobRecordMap.end() ) {
00267     // Found record map entry of same job type.  Check to see if
00268     // it is an equivalent record, otherwise Print warning.
00269     if ( *(itr->second) != *jobrec ) {
00270       MSG("Rec",Msg::kWarning) << "RecJobHistory::CreateJobRecord "
00271                                << "Found existing entry of requested type "
00272                                << jobtypestr << ". Replaced." 
00273                                << endl;
00274     }
00275     delete (itr->second); // delete old record
00276     itr->second = jobrec; // insert new
00277   }
00278   else {
00279     fJobRecordMap.insert(make_pair(jobtypestr,jobrec));
00280   }
00281   
00282   return true;
00283   
00284 }

bool RecJobHistory::Append ( const RecJobHistory that  )  [virtual]

Definition at line 155 of file RecJobHistory.cxx.

References CreateJobRecord(), and GetJobRecordMap().

Referenced by RecordSetupModule::Get(), DetSim::Get(), RecJobHistory(), NtpTHModule::Reco(), and DataQualityReader::Reco().

00155                                                     {
00156   // Append the contents of that's history to this.
00157   
00158   JobRecordMapConstItr citr; 
00159   const JobRecordMap& thatJobRecordMap = that.GetJobRecordMap();
00160   bool allpass = true;
00161   for ( citr = thatJobRecordMap.begin(); citr != thatJobRecordMap.end(); 
00162                                                                 citr++ ) {
00163     allpass &= CreateJobRecord((citr->first).c_str(),*(citr->second));
00164   }
00165 
00166   return allpass;
00167 
00168 }

bool RecJobHistory::CreateJobRecord ( const char *  jobtypestr,
const RecJobRecord jobrec_tocopy 
) [virtual]

Definition at line 235 of file RecJobHistory.cxx.

References AdoptJobRecord().

00236                                                                        {
00237   // Create job record from the input jobrec_tocopy and insert it in 
00238   // the fJobRecordMap with the specified jobtypestr as key.  Return true
00239   // if successful, or false if jobtypestr is "UnknownJobType".
00240 
00241   RecJobRecord* jobrec = new RecJobRecord(jobrec_tocopy);
00242   bool isOk = AdoptJobRecord(jobtypestr,jobrec);
00243   if ( !isOk ) delete jobrec;
00244   return isOk;
00245   
00246 }

bool RecJobHistory::CreateJobRecord ( JobType_t  jobtype,
const RecJobRecord jobrec_tocopy 
) [virtual]

Definition at line 224 of file RecJobHistory.cxx.

References CreateJobRecord(), and JobTypeAsString().

00225                                                                        {
00226   // Create job record as copy from the input jobrec_tocopy and insert it 
00227   // in the fJobRecordMap with the associated jobtype string as key.  
00228   // Return true if successful, or false if jobtype is unknown.
00229 
00230   return CreateJobRecord(JobTypeAsString(jobtype),jobrec_tocopy);
00231 
00232 }

bool RecJobHistory::CreateJobRecord ( const char *  jobtypestr,
const char *  prodname,
const char *  codename,
const char *  hostname,
const VldTimeStamp timestamp 
) [virtual]

Definition at line 207 of file RecJobHistory.cxx.

References AdoptJobRecord().

00210                                                                    {
00211   // Create job record from arguments and insert it in 
00212   // the fJobRecordMap with the specified jobtypestr as key.  Return true
00213   // if successful or false if jobtypestr is "UnknownJobType".
00214 
00215   RecJobRecord* jobrec = new RecJobRecord(prodname,codename,hostname,
00216                                           timestamp);
00217   bool isOk = AdoptJobRecord(jobtypestr,jobrec);
00218   if ( !isOk ) delete jobrec;
00219   return isOk;
00220   
00221 }

bool RecJobHistory::CreateJobRecord ( JobType_t  jobtype,
const char *  prodname,
const char *  codename,
const char *  hostname,
const VldTimeStamp timestamp 
) [virtual]

Definition at line 194 of file RecJobHistory.cxx.

References CreateJobRecord(), and JobTypeAsString().

00196                                                                    {
00197   // Create job record from arguments and insert it in the 
00198   // fJobRecordMap with the associated jobtype string as key.  
00199   // Return true if successful, or false if jobtype is unknown.
00200 
00201   return CreateJobRecord(JobTypeAsString(jobtype),prodname,codename,
00202                          hostname,timestamp);
00203   
00204 }

bool RecJobHistory::CreateJobRecord ( const char *  jobtypestr  )  [virtual]

Definition at line 181 of file RecJobHistory.cxx.

References AdoptJobRecord().

00181                                                           {
00182   // Create job record from current job environment and insert it in 
00183   // the fJobRecordMap with the specified jobtypestr as key.  Return true
00184   // if successful, or false if jobtypestr is "UnknownJobType".
00185 
00186   RecJobRecord* jobrec = new RecJobRecord();
00187   bool isOk = AdoptJobRecord(jobtypestr,jobrec);
00188   if ( !isOk ) delete jobrec;
00189   return isOk;
00190   
00191 }

bool RecJobHistory::CreateJobRecord ( JobType_t  jobtype  )  [virtual]

Definition at line 171 of file RecJobHistory.cxx.

References JobTypeAsString().

Referenced by Append(), RotoObjectifier::BuildRecord(), CreateJobRecord(), HepevtModule::FindOrCreateSimSnarlRecord(), RerootToTruthModule::Get(), RecordSetupModule::Get(), DetSim::Get(), PhotonTransport::Get(), PTSimModule::Reco(), NtpTHModule::Reco(), and DataQualityReader::Reco().

00171                                                      {
00172   // Create job record from current job environment and insert it in the 
00173   // fJobRecordMap with the associated jobtype string as key.  
00174   // Return true if successful, or false if jobtype is unknown.
00175 
00176   return CreateJobRecord(JobTypeAsString(jobtype));
00177 
00178 }

const RecJobRecord * RecJobHistory::GetJobRecord ( const char *  jobtypestr  )  const

Definition at line 109 of file RecJobHistory.cxx.

References fJobRecordMap.

00109                                                                             {
00110   // Get job record by character string job type.
00111   // Return null if not found.
00112 
00113   JobRecordMapConstItr citr = fJobRecordMap.find(jobtypestr);
00114   if ( citr != fJobRecordMap.end() ) return citr->second;
00115   else return 0;
00116   
00117 }

const RecJobRecord * RecJobHistory::GetJobRecord ( JobType_t  jobtype  )  const

Definition at line 98 of file RecJobHistory.cxx.

References JobTypeAsString().

Referenced by GetProdReleaseType().

00098                                                                        {
00099   // Get ptr to job record by enumerated job type.
00100   // Return null if not found.
00101 
00102   std::string jobtypestr = JobTypeAsString(jobtype);
00103   if ( jobtypestr == "UnknownJobType" ) return 0;
00104 
00105   return GetJobRecord(jobtypestr.c_str());
00106 }

const JobRecordMap& RecJobHistory::GetJobRecordMap (  )  const [inline]

Definition at line 55 of file RecJobHistory.h.

References fJobRecordMap.

Referenced by Append().

00055 { return fJobRecordMap; }

ReleaseType::Release_t RecJobHistory::GetProdReleaseType ( UInt_t  jobtypemask = (kGMinos | kCand)  )  const [virtual]

Definition at line 287 of file RecJobHistory.cxx.

References fJobRecordMap, GetJobRecord(), RecJobRecord::GetProdReleaseType(), it, kNJobType, ReleaseType::kUnknown, and kUnknownJobType.

Referenced by NueDisplayModule::Ana(), and NtpStRecord::GetRelease().

00288                                                                             {
00289   // Get OR of production release types associated with job records selected
00290   // as specified in the input jobtypemask.  jobtypemask corresponds
00291   // to a bit mask of OR'ed EJobTypes. 
00292   // The default is to return the OR of production release types corresponding 
00293   // to records of type kCand or kGMinos.
00294   // Specifying jobtypemask = EJobType::kUnknownJobType requests the OR of all 
00295   // record release types in the job history.
00296   // Returns ReleaseType::kUnknown if unknown. 
00297 
00298   ReleaseType::Release_t release = ReleaseType::kUnknown;
00299   
00300   if ( kUnknownJobType == jobtypemask ) {
00301     // Loop over all records in the history and construct OR of release types
00302     JobRecordMapConstItr citr;
00303     for ( citr = fJobRecordMap.begin(); citr != fJobRecordMap.end(); citr++ ) {
00304       ReleaseType::Release_t recrelease = citr->second->GetProdReleaseType();
00305       if ( recrelease != ReleaseType::kUnknown ) {
00306         if ( release != ReleaseType::kUnknown ) release |= recrelease;
00307         else release = recrelease;
00308       }
00309     }
00310     return release;
00311   }
00312   
00313   // Otherwise, seek records of jobtype matching those specified in jobtypemask
00314   for ( UInt_t it = 0; it < kNJobType-1; it++ ) {
00315     UInt_t jobbit = 1 << it;
00316     if ( jobbit & jobtypemask ) {
00317       EJobType jobtype = static_cast<EJobType>(jobbit);
00318       const RecJobRecord* jobrecord = GetJobRecord(jobtype);
00319       if ( jobrecord ) {
00320         ReleaseType::Release_t recrelease = jobrecord->GetProdReleaseType();
00321         if ( recrelease != ReleaseType::kUnknown ) {
00322           if ( release != ReleaseType::kUnknown ) release |= recrelease;
00323           else release = recrelease;
00324         }
00325       }
00326     }
00327   }
00328 
00329   return release;
00330   
00331 }

const char * RecJobHistory::JobTypeAsString ( JobType_t  jobtype  )  const

Definition at line 63 of file RecJobHistory.cxx.

References kCand, kGMinos, kNtpMC, kNtpSR, kNtpSt, kNtpTH, kPhotonTransport, kPTSim, kRaw, kUnknownJobType, Msg::kWarning, and MSG.

Referenced by CreateJobRecord(), and GetJobRecord().

00063                                                                   {
00064   // Purpose: Convert enumerated jobtype to a string.
00065 
00066   switch (jobtype) {
00067 
00068   case kRaw:
00069     return "Raw";
00070   case kGMinos:
00071     return "GMinos";
00072   case kPTSim:
00073     return "PTSim";
00074   case kPhotonTransport:
00075     return "PhotonTransport";
00076   case kCand:
00077     return "Cand";
00078   case kNtpMC:
00079     return "NtpMC";
00080   case kNtpTH:
00081     return "NtpTH";
00082   case kNtpSR:
00083     return "NtpSR";
00084   case kNtpSt:
00085     return "NtpSt";
00086   case kUnknownJobType:
00087     return "UnknownJobType";
00088   default:
00089     MSG("Rec",Msg::kWarning)
00090       << "RecJobHistory::JobTypeAsString called with unknown JobType_t "
00091       << (int)jobtype << ". Fix method. Abort." << endl;
00092     abort();
00093   } // end of switch
00094 
00095 }

void RecJobHistory::Print ( Option_t *  option = ""  )  const [virtual]

Definition at line 145 of file RecJobHistory.cxx.

References Print().

00145                                                        {
00146   //  Purpose:  Print header in form supported by TObject::Print.
00147 
00148   Print(std::cout);
00149 
00150   return;
00151 
00152 }

std::ostream & RecJobHistory::Print ( std::ostream &  os  )  const [virtual]

Definition at line 120 of file RecJobHistory.cxx.

References fJobRecordMap.

Referenced by RawRecord::Print(), Print(), RecMinos::Print(), RecRecordImp< T >::Print(), and CandRecord::Print().

00120                                                      {
00121   //  Purpose:  Print history on ostream.  Job records are printed in
00122   //            sequential order by timestamp.
00123 
00124   std::map<const RecJobRecord*,std::string,compareJobRecord> recmapbytime;
00125   JobRecordMapConstItr citr;
00126   for ( citr = fJobRecordMap.begin(); citr != fJobRecordMap.end(); citr++ ) {
00127     recmapbytime.insert(make_pair(citr->second,citr->first));
00128   }
00129   
00130   os << "RecJobHistory:";
00131   if ( recmapbytime.empty() ) os << " <<empty>>" << endl;
00132   else  os << endl;
00133 
00134   std::map<const RecJobRecord*,std::string,compareJobRecord>::const_iterator 
00135                                                                        tcitr; 
00136   for ( tcitr = recmapbytime.begin(); tcitr != recmapbytime.end(); tcitr++ ) {
00137     os << tcitr->second << "\t" << *(tcitr->first) << endl;
00138   }
00139 
00140   return os;
00141 
00142 }


Member Data Documentation

const UInt_t RecJobHistory::kNJobType = 10 [static]

Definition at line 40 of file RecJobHistory.h.

Referenced by GetProdReleaseType().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1