Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PulserFromRawModule.cxx

Go to the documentation of this file.
00001 
00002 
00004 #include <cstdio>
00005 #include <fstream>
00006 // ROOT includes
00007 #include "TFile.h"
00008 // MINOS includes
00009 #include "MessageService/MsgService.h"     // MSG text output
00010 #include "MinosObjectMap/MomNavigator.h"   // Data access
00011 #include "CandData/CandRecord.h"           // DigitList handling
00012 #include "JobControl/JobCommand.h"         // JobCommand handling
00013 #include "JobControl/JobCModuleRegistry.h" // JOBMODULE registration macro
00014 #include "RawData/RawDaqSnarlHeader.h"
00015 #include "RawData/RawSnarlHeaderBlock.h"
00016 #include "RawData/RawRecord.h"
00017 #include "RawData/RawDigitDataBlock.h"
00018 #include "RawData/RawLIAdcSummaryBlock.h"
00019 #include "PulserCalibration/PulserSummaryList.h"
00020 #include "PulserCalibration/PulserSummary.h"
00021 #include "PulserCalibration/PulserFromRawModule.h"
00022 #include "Plex/PlexStripEndId.h"
00023 #include "Plex/PlexHandle.h"
00024 #include "RawData/RawChannelId.h"
00025 #include "RawData/RawDigit.h"
00026 #include "Validity/VldContext.h"
00027 #include "Validity/VldRange.h"
00028 #include "Conventions/StripEnd.h"
00029 #include "DatabaseInterface/DbiWriter.h"
00030 #include "Plex/PlexStripEndToLed.h"
00031 #include "Plex/PlexPinDiodeToLed.h"
00032 //include "PEGain/PEGainFitter.h"
00033 ClassImp(PulserFromRawModule)
00034 
00035 CVSID("$Id: PulserFromRawModule.cxx,v 1.5 2006/04/19 20:00:55 rhatcher Exp $");
00036 JOBMODULE(PulserFromRawModule,"PulserFromRawModule",
00037           "Make Pulser Summaries From Raw Data\n");
00038 
00039 //......................................................................
00040 
00041 //......................................................................
00042 
00043 PulserFromRawModule::PulserFromRawModule()
00044    //:fDoingThisSum(0)
00045 {
00046 //======================================================================
00047 // Set the initial state of your module. The code above initializes the
00048 // variables listed to the values in parentheses. In this case that's
00049 // all I need to do so the method itself is empty...
00050 //======================================================================
00051     fDoingThisSum=0;
00052     fSummaryList=0;
00053 
00054 }
00055 
00056 //......................................................................
00057 
00058 JobCResult PulserFromRawModule::Reco(MomNavigator *mom) 
00059 {
00060    JobCResult result(JobCResult::kPassed);
00061    
00062    RawRecord *rawrec = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord"));
00063    if (rawrec == 0) {
00064       MSG("Pulser", Msg::kWarning) << "No RawRecord in MOM." << endl;
00065       return result;
00066    }
00067 
00068    MSG("Pulser",Msg::kVerbose) << "Reco() got vld: " 
00069                              << (rawrec->GetRawHeader())->GetVldContext() 
00070                              << endl;
00071    int sec = rawrec->GetHeader()->GetVldContext().GetTimeStamp().GetSec();
00072    UInt_t trigword = 0;
00073    UInt_t frun = 0;
00074    UInt_t fsnarl = 0;
00075    
00076 
00077    const RawDaqSnarlHeader* snarlHdr =
00078       dynamic_cast<const RawDaqSnarlHeader*>(rawrec->GetRawHeader());
00079    if (snarlHdr) {
00080       frun = snarlHdr->GetRun();
00081       fsnarl = snarlHdr->GetSnarl();
00082       trigword = snarlHdr->GetTrigSrc();
00083    }
00084    const RawLIAdcSummaryBlock *rawsum = 
00085       dynamic_cast<const RawLIAdcSummaryBlock *>
00086       (rawrec->FindRawBlock("RawLIAdcSummaryBlock"));   
00087    if (rawsum) {
00088       MSG("Pulser",Msg::kDebug) 
00089          << "Got LI Summary for Led :" 
00090          << rawsum->GetLed()
00091          << " H " << rawsum->GetPulseHeight() << endl;
00092       if(!fDoingThisSum) {
00093          fDoingThisSum=new PulserFromRawLiBlock(*rawsum);
00094       }
00095       else fDoingThisSum->New(*rawsum);
00096 //      cerr << "Hello: " << fDoingThisSum << " "
00097 //                 << fDoingThisSum->GetPulses() << endl;
00098    }
00099   //  cerr << "Here " << fDoingThisSum << " "
00100 //      << fDoingThisSum->GetPulses() << endl;
00101    const RawDigitDataBlock *rawddb =
00102       dynamic_cast<const RawDigitDataBlock *>
00103       (rawrec->FindRawBlock("RawDigitDataBlock"));
00104    
00105    if (rawddb && fDoingThisSum) {
00106 //       cerr << "Here also " << fDoingThisSum << endl;
00107 //       cerr <<  fDoingThisSum->GetPulses() << endl;
00108       if (fSummaryList) {
00109          if (fDoingThisSum->GetLed()==fSummaryList->GetLed() && 
00110              fDoingThisSum->GetCalibPoint()==fSummaryList->GetPointIndex()) {
00111 //           cerr << "Here !!!" << endl;
00112             fSummaryList->Add(*rawddb,*fDoingThisSum);
00113          }
00114          else {
00115             // We're on a new point now!
00116 //           cerr << "Here !!!!" << endl;
00117             MSG("Pulser",Msg::kDebug)<< "New point at " << sec <<endl;
00118             FinishList(mom);
00119             fSummaryList = new PulserFromRawSummaryList(*rawddb,*fDoingThisSum);
00120          }
00121       } 
00122       else { 
00123 //        cerr << "Here !!!!! " << fDoingThisSum->GetPulses() << endl;
00124          
00125          fSummaryList = new PulserFromRawSummaryList(*rawddb,*fDoingThisSum);
00126       }
00127    }
00128    
00129    return result;
00130    
00131 }
00132 
00133 //......................................................................
00134 
00135 void PulserFromRawModule::EndJob() 
00136 {
00137 
00138 
00139 }
00140 
00141 void PulserFromRawModule::FinishList(MomNavigator* mom)
00142 {
00143     MSG("Pulser",Msg::kInfo) <<"Summary Complete! Box " << fSummaryList->GetPulserBox() << " Led "<< fSummaryList->GetLed()<<", point "<<fSummaryList->GetPointIndex()<<" of "<<fSummaryList->GetExpectedPoints()<<endl;
00144    fSummaryList->Finish();
00145    mom->AdoptFragment(fSummaryList);
00146    fSummaryList=0;
00147 }

Generated on Fri Mar 28 15:38:13 2008 for loon by  doxygen 1.3.9.1