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

AlgCaldetDigit.cxx

Go to the documentation of this file.
00001 
00002 // $Id: AlgCaldetDigit.cxx,v 1.5 2005/04/08 12:26:29 tagg Exp $
00003 //
00004 // AlgCaldetDigit.cxx
00005 //
00006 // AlgCaldetDigit is a concrete Digit Algorithm class.
00007 //
00008 // Author:  G. Irwin 4/2000
00010 
00011 #include <cassert>
00012 
00013 #include "Calibrator/Calibrator.h"
00014 #include "CandData/CandRecord.h"
00015 #include "CandDigit/AlgCaldetDigit.h"
00016 #include "CandDigit/CandDigitHandle.h"
00017 #include "Candidate/CandContext.h"
00018 #include "Conventions/Munits.h"
00019 #include "MessageService/MsgService.h"
00020 #include "Plex/PlexHandle.h"
00021 #include "Plex/PlexSEIdAltL.h"
00022 #include "RawData/RawChannelId.h"
00023 #include "RawData/RawDigit.h"
00024 #include "RawData/RawHeader.h"
00025 #include "RawData/RawRecord.h"
00026 #include "Validity/VldContext.h"
00027 #include "CaldetRawDigitWrapper.h"
00028 ClassImp(AlgCaldetDigit)
00029 
00030 //______________________________________________________________________
00031 //CVSID("$Id: AlgCaldetDigit.cxx,v 1.5 2005/04/08 12:26:29 tagg Exp $");
00032 
00033 //______________________________________________________________________
00034 AlgCaldetDigit::AlgCaldetDigit()
00035 {
00036 }
00037 
00038 //______________________________________________________________________
00039 AlgCaldetDigit::~AlgCaldetDigit()
00040 {
00041 }
00042 
00043 
00044 //______________________________________________________________________
00045 void AlgCaldetDigit::RunAlg(AlgConfig & /* ac */, CandHandle &ch, CandContext &cx)
00046 {
00047 
00048 #ifdef ENABLE_DEBUG_MSG
00049    MSG("Alg", Msg::kDebug) << "Starting AlgCaldetDigit::RunAlg()" << endl;
00050 #endif
00051 
00052    assert(ch.InheritsFrom("CandDigitHandle"));
00053    CandDigitHandle &cdh = (CandDigitHandle &) ch;
00054 
00055    assert(cx.GetDataIn());
00056    const CaldetRawDigitWrapper* wrapper = 
00057      dynamic_cast<const CaldetRawDigitWrapper *> (cx.GetDataIn());
00058 
00059    const RawDigit* digit = wrapper->fDigit;
00060    const RawDigit* fidDigit = wrapper->fFiducialDigit;
00061    
00062    const RawChannelId digitRCId = digit->GetChannel();
00063 
00064    assert(digit);
00065 
00066    // Get VldContext
00067    const VldContext &vldc = *(cx.GetCandRecord()->GetVldContext());
00068    
00069    // Use CandDigitHandle methods to set CandDigit member variables.
00070    cdh.SetChannelId(digitRCId);
00071    
00072    Calibrator& cal = Calibrator::Instance();
00073 
00074    double time =  cal.GetTimeFromTDC(digit->GetTDC(),
00075                                      digitRCId);
00076 
00077    double fidTime = 0;
00078    if(fidDigit)
00079      fidTime =cal.GetTimeFromTDC(fidDigit->GetTDC(),
00080                                  fidDigit->GetChannel());
00081 
00082    //   cout << digitRCId.AsString("e") << time << "\t" << fidTime << endl;
00083 
00084    // Add on the fiducial time if this is a ND digit.
00085    if(digitRCId.GetElecType() == ElecType::kQIE) 
00086      time = time + fidTime;
00087 
00088 
00089    Double_t adc_offset  = 0.;
00090    if (digitRCId.GetElecType() == ElecType::kQIE) {
00091      adc_offset = 50.;
00092      cdh.SetQieErrorBits(digit->GetErrorCode());
00093    }
00094    else
00095      cdh.SetVaErrorBits(digit->GetErrorCode());
00096    
00097    // Convert TDC counts to Double_t.  Don't subtract Trigger time offset.
00098    cdh.SetTime(time);
00099    
00100    // Set charge to offset-subtracted ADC value ( ~60. * p.e. )
00101    cdh.SetCharge(((Double_t) digit->GetADC()) - adc_offset);
00102    
00103    // Get a PlexHandle for PlexStripEndId to RawChannelId conversions
00104    PlexHandle ph(vldc);
00105    
00106    // Fill and calibrate PlexSEIdAltL
00107    PlexSEIdAltL altlist = ph.GetSEIdAltL(digitRCId,
00108                                          &cal,
00109                                          (int)(digit->GetADC()-adc_offset),
00110                                          cdh.GetTime());
00111    
00112    cdh.SetPlexSEIdAltL(altlist);
00113 }
00114 
00115 //______________________________________________________________________
00116 void AlgCaldetDigit::Trace(const char * /* c */) const
00117 {
00118 }

Generated on Mon Jun 16 14:56:13 2008 for loon by  doxygen 1.3.9.1