CheezyDisplayModule Class Reference

#include <CheezyDisplayModule.h>

Inheritance diagram for CheezyDisplayModule:
JobCModule

List of all members.

Public Member Functions

 CheezyDisplayModule ()
 ~CheezyDisplayModule ()
JobCResult Ana (const MomNavigator *mom)
void HandleCommand (JobCommand *command)

Private Attributes

TString fListPlex
TString fListTruth
Bool_t fDrawEmpty
CheezyDisplayfDisplay

Detailed Description

Definition at line 23 of file CheezyDisplayModule.h.


Constructor & Destructor Documentation

CheezyDisplayModule::CheezyDisplayModule (  ) 

Definition at line 40 of file CheezyDisplayModule.cxx.

References Msg::kDebug, and MSG.

00041    : fListPlex("canddigitlist"), fListTruth("candmcdigitlist"), 
00042      fDrawEmpty(false), fDisplay(0)
00043 {
00044    // construct a new "CheezyDisplayModule" JobControl module
00045    // by default:
00046    //    no specific choice of CandDigitList to use
00047    //    draw all possibilities in PlexSEIdAltL (w/ no miminum wgt)
00048 
00049    // Create a display
00050    // do it here in the ctor so that configuration state info can be
00051    // passed to it before any events are drawn
00052    // (eg. settings of DrawTruth, DrawOnlyBest, WgtThresh)
00053 
00054   if ( ! fDisplay ) {
00055      fDisplay = new CheezyDisplay("CheezyDisplayModule",
00056                                   "CheezyDisplayModule display");
00057      MSG("Cheezy",Msg::kDebug)
00058         << "create new CheezyDisplay within ctor" << endl;
00059   }
00060 
00061 }

CheezyDisplayModule::~CheezyDisplayModule (  ) 

Definition at line 65 of file CheezyDisplayModule.cxx.

References fDisplay, Msg::kVerbose, and MSG.

00066 {
00067   MSG("Exodus", Msg::kVerbose) << "CheezyDisplayModule::Destructor\n";
00068 
00069   SafeDelete(fDisplay);
00070 }


Member Function Documentation

JobCResult CheezyDisplayModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 74 of file CheezyDisplayModule.cxx.

References CheezyDisplay::AddSEIdAltL(), CheezyDisplay::ClearLists(), CheezyDisplay::Draw(), fDisplay, fDrawEmpty, CandRecord::FindCandHandle(), fListPlex, fListTruth, CandHandle::GetDaughterIterator(), MomNavigator::GetFragment(), RecMinos::GetHeader(), RecMinosHdr::GetVldContext(), JobCResult::kAOK, JobCResult::kError, Msg::kFatal, Msg::kWarning, MSG, and CheezyDisplay::SetVldContext().

00075 {
00076   // Find the RawRecord for Header info (detector) and TRUTH (if available)
00077   // Find the CandDigitList
00078   // draw digits on CheezyDisplay
00079 
00080   // Get either RawRecord or CandRecord from Mom 
00081   RecMinos *rec = dynamic_cast<RecMinos *>(mom->GetFragment("RecMinos"));
00082                                         
00083   if ( ! rec ) {
00084      MSG("Exodus",Msg::kFatal) << "CheezyDisplayModule::Ana" <<
00085         " failed to fin a \"RecMinos\"" << endl;
00086      return JobCResult::kError;
00087   }
00088 
00089   VldContext vldc = rec->GetHeader()->GetVldContext();
00090 
00091   // Create (if necessary) a display
00092   if ( ! fDisplay ) {
00093      fDisplay = new CheezyDisplay("CheezyDisplayModule",
00094                                   "CheezyDisplayModule display");
00095      MSG("Cheezy",Msg::kWarning)
00096         << "create new CheezyDisplay within Ana" << endl;
00097   }
00098 
00099   fDisplay->ClearLists();
00100   fDisplay->SetVldContext(vldc);
00101 
00102   // Draw TRUTH first so other digits won't be obscured
00103   // Find MC version of CandDigitList fragment in MOM.
00104 
00105 // Find (Primary)CandidateRecord fragment in MOM.
00106   CandRecord *candrec = dynamic_cast<CandRecord *>
00107     (mom->GetFragment("CandRecord")); //, "PrimaryCandidateRecord"));
00108   if (candrec == 0) {
00109     MSG("Cheezy", Msg::kWarning) 
00110       << "No " // << "Primary"
00111       << "CandRecord in MOM." 
00112       << endl;
00113     return JobCResult::kError;
00114   }
00115 
00116   int ndigits = 0;
00117 
00118   CandDigitListHandle *cmcdlh = dynamic_cast<CandDigitListHandle *>
00119      (candrec->FindCandHandle("CandDigitListHandle",fListTruth.Data()));
00120 
00121   if (cmcdlh) {
00122      // do iteration only if there is a Truth list!
00123      CandDigitHandleItr cmcdhItr(cmcdlh->GetDaughterIterator());
00124 
00125      // loop over digits
00126      while ( CandDigitHandle *cmcdh = cmcdhItr() ) {
00127         // for each digit
00128         PlexSEIdAltL altlist = cmcdh->GetPlexSEIdAltL();
00129         fDisplay->AddSEIdAltL(altlist,kTRUE);
00130         ndigits++;
00131      }
00132   }  
00133 
00134   // Find requested CandDigitList fragment in MOM.
00135   CandDigitListHandle *cdlh = dynamic_cast<CandDigitListHandle *>
00136       (candrec->FindCandHandle("CandDigitListHandle",fListPlex.Data()));
00137 
00138   CandDigitHandleItr cdhItr(cdlh->GetDaughterIterator());
00139   
00140   while ( CandDigitHandle *cdh = cdhItr() ) {
00141      // for each digit
00142      PlexSEIdAltL altlist = cdh->GetPlexSEIdAltL();
00143      fDisplay->AddSEIdAltL(altlist,kFALSE);
00144      ndigits++;
00145   }
00146 
00147   // Now actually draw these things
00148   if (!fDisplay) MSG("Cheezy",Msg::kFatal) << " no display?? " << endl;
00149   if (ndigits || fDrawEmpty) fDisplay->Draw();
00150 
00151   return JobCResult::kAOK;
00152 
00153 }

void CheezyDisplayModule::HandleCommand ( JobCommand command  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 157 of file CheezyDisplayModule.cxx.

References CheezyDisplay::Draw(), fDisplay, fDrawEmpty, fListPlex, fListTruth, Msg::kWarning, MSG, JobCommand::PopCmd(), JobCommand::PopFloatOpt(), JobCommand::PopIntOpt(), JobCommand::PopOpt(), CheezyDisplay::SetDrawOnlyBest(), CheezyDisplay::SetDrawTruth(), and CheezyDisplay::SetWgtThresh().

00158 {
00159 //
00160 // Process configuration commands
00161 //
00162 
00163 //  MSG("Exodus", Msg::kInfo) << "CheezyDisplayModule::HandleCommand\n";
00164 
00165   TString cmd = command->PopCmd();
00166   if (cmd == "Set") {
00167      TString opt = command->PopOpt();
00168      if      (opt == "ListPlex")  fListPlex  = command->PopOpt();
00169      else if (opt == "ListTruth") fListTruth = command->PopOpt();
00170      else if (opt == "DrawEmpty") fDrawEmpty = command->PopIntOpt();
00171      else if (opt == "DrawTruth")
00172      { // damn braces needed to get scoping of "if" statement right
00173         if (fDisplay) fDisplay->SetDrawTruth(command->PopIntOpt() != 0);
00174      }
00175      else if (opt == "OnlyBest")
00176      { // damn braces needed to get scoping of "if" statement right
00177         if (fDisplay) fDisplay->SetDrawOnlyBest(command->PopIntOpt() != 0);
00178      }
00179      else if (opt == "WgtThresh")
00180      { // damn braces needed to get scoping of "if" statement right
00181         if (fDisplay) fDisplay->SetWgtThresh(command->PopFloatOpt());
00182      }
00183      else {
00184         MSG("Exodus", Msg::kWarning)
00185            << "CheezyDisplayModule: Unrecognized option " << opt << endl;
00186      }
00187   } else if (cmd == "Redraw") {
00188      if (fDisplay) fDisplay->Draw();
00189   } else {
00190      MSG("Exodus", Msg::kWarning)
00191         << "CheezyDisplayModule: Unrecognized command " << cmd << endl;
00192   }
00193 }


Member Data Documentation

Definition at line 58 of file CheezyDisplayModule.h.

Referenced by Ana(), HandleCommand(), and ~CheezyDisplayModule().

Definition at line 57 of file CheezyDisplayModule.h.

Referenced by Ana(), and HandleCommand().

TString CheezyDisplayModule::fListPlex [private]

Definition at line 55 of file CheezyDisplayModule.h.

Referenced by Ana(), and HandleCommand().

Definition at line 56 of file CheezyDisplayModule.h.

Referenced by Ana(), and HandleCommand().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1