PulserCollectorModule Class Reference

#include <PulserCollectorModule.h>

Inheritance diagram for PulserCollectorModule:
JobCModule

List of all members.

Public Member Functions

 PulserCollectorModule ()
 ~PulserCollectorModule ()
JobCResult Reco (MomNavigator *mom)
void HandleCommand (JobCommand *command)

Private Member Functions

JobCResult ReferencePointReco (MomNavigator *mom)
void WriteRawCurveData (PulserSummaryList *psl)
void WriteRawDriftData (PulserSummaryList *psl)
void WriteReferenceDriftData (PulserSummaryList *psl)

Private Attributes

Int_t fIdent
std::map< Int_t, PulserRawGainfNearMapCurve
std::map< Int_t, PulserRawGainFfFarMapCurve
PulserRawGainPin fHighPinCurve
PulserRawGainPin fLowPinCurve
std::map< Int_t, PulserRawDriftfNearMapDrift
std::map< Int_t, PulserRawDriftFfFarMapDrift
PulserRawDriftPin fHighPinDrift
PulserRawDriftPin fLowPinDrift
std::map< Int_t, PulserRefDriftfNearMapRef
std::map< Int_t, PulserRefDriftFfFarMapRef
PulserRefDriftPin fHighPinRef
PulserRefDriftPin fLowPinRef
int fGCValid
int fDPValid
int fLongTime
int fDoReferencePoint

Static Private Attributes

static const int fCodeVersion = 2

Detailed Description

Definition at line 43 of file PulserCollectorModule.h.


Constructor & Destructor Documentation

PulserCollectorModule::PulserCollectorModule (  ) 

Definition at line 52 of file PulserCollectorModule.cxx.

00053 {
00054   fDoReferencePoint=0;
00055   fIdent = 0; 
00056   fGCValid = 3600*24*62; // 2 months validity for Gaincurve
00057   fDPValid = 3600*24*1;  // Driftpoint valid up to a day?
00058   fLongTime = 3600*24*365*20; // 20 yrs
00059 }

PulserCollectorModule::~PulserCollectorModule (  ) 

Definition at line 61 of file PulserCollectorModule.cxx.

00062 {
00063 
00064 }


Member Function Documentation

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

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 309 of file PulserCollectorModule.cxx.

References fDoReferencePoint, Msg::kDebug, Msg::kWarning, MSG, and JobCommand::PopCmd().

00310 {
00311 
00312 // Process configuration commands
00313   TString cmd = command->PopCmd();
00314 
00315   MSG("Pulser", Msg::kDebug)
00316                    << "PulserCollectorModule:HandleCommand: " << cmd << endl;
00317   if (cmd == "Reference") {
00318      fDoReferencePoint=1;
00319   }
00320   else {
00321      MSG("Pulser", Msg::kWarning)
00322                           << "Unrecognized Command: " << cmd << endl;
00323   }
00324 
00325 }

JobCResult PulserCollectorModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 115 of file PulserCollectorModule.cxx.

References PulserRawGainPin::AddPoint(), fDoReferencePoint, fFarMapCurve, fFarMapDrift, fHighPinCurve, fHighPinDrift, fIdent, fLowPinCurve, fLowPinDrift, fNearMapCurve, fNearMapDrift, PulserSummaryList::GetAggregateNo(), PulserSummaryList::GetExpectedPoints(), PulserSummaryList::GetFarBegin(), PulserSummaryList::GetFarEnd(), MomNavigator::GetFragment(), PulserSummaryList::GetHighPin(), PulserSummaryList::GetIdent(), PulserSummaryList::GetLowPin(), PulserSummaryList::GetNearBegin(), PulserSummaryList::GetNearEnd(), PulserSummary::GetPinDiodeId(), PulserSummaryList::GetPointIndex(), it, Msg::kDebug, JobCResult::kFailed, Msg::kVerbose, Msg::kWarning, MSG, PulserRawDriftPin::New(), PulserRawGainPin::New(), ReferencePointReco(), WriteRawCurveData(), and WriteRawDriftData().

00116 {
00117    if(fDoReferencePoint) {
00118       return ReferencePointReco(mom);
00119    }
00120    //Get PulserSummary...
00121    PulserSummaryList *psl = dynamic_cast<PulserSummaryList *>
00122       (mom->GetFragment("PulserSummaryList"));
00123    if (psl==0) {
00124       MSG("Pulser",Msg::kVerbose) <<"No pulser summary list here\n";
00125       return JobCResult::kFailed;
00126    }
00127    MSG("Pulser",Msg::kDebug) <<"Got pulser summary "<<psl->GetPointIndex()
00128                              <<" of "<<psl->GetExpectedPoints()<<endl;
00129    int point = psl->GetPointIndex();
00130    switch(psl->GetExpectedPoints()) {
00131    case 0:
00132       // Noise - no pulsing
00133       break;
00134    case 1:
00135       // Doug Point
00136       MSG("Pulser",Msg::kDebug) <<"Doug Point"<<endl;
00137       fHighPinDrift.New(psl->GetAggregateNo(),
00138                         psl->GetHighPin().GetPinDiodeId(),
00139                         psl->GetHighPin());
00140       fLowPinDrift.New(psl->GetAggregateNo(),
00141                        psl->GetLowPin().GetPinDiodeId(),
00142                        psl->GetLowPin());
00143       // Loop over near end data
00144       for (std::map<Int_t,PulserSummary>::const_iterator it=psl->GetNearBegin();
00145            it!=psl->GetNearEnd(); it++) {
00146          fNearMapDrift[(*it).first].New(psl->GetAggregateNo(),
00147                                         (*it).second.GetStripEndId().BuildPlnStripEndKey(),
00148                                         (*it).second);
00149       }
00150       for (std::map<Int_t,PulserSummary>::const_iterator it=psl->GetFarBegin();
00151            it!=psl->GetFarEnd(); it++) {
00152          fFarMapDrift[(*it).first].New(psl->GetAggregateNo(),
00153                                        (*it).second.GetStripEndId().BuildPlnStripEndKey(),
00154                                        (*it).second);
00155       }
00156       WriteRawDriftData(psl);
00157       break;
00158    default:
00159       // Gain Curve
00160       // Check we're on the right curve...
00161       if (fIdent!=0 && fIdent!=psl->GetIdent()) {
00162          MSG("Pulser",Msg::kWarning)<< "Conflicting gaincurves in same place!\n";
00163       }
00164       if (fIdent==0) {
00165          fHighPinCurve.New(psl->GetAggregateNo(),psl->GetExpectedPoints(),
00166                            psl->GetHighPin().GetPinDiodeId());
00167          fLowPinCurve.New(psl->GetAggregateNo(),psl->GetExpectedPoints(),
00168                           psl->GetLowPin().GetPinDiodeId());
00169          fIdent = psl->GetIdent();
00170       }
00171       MSG("Pulser",Msg::kDebug) <<"Gain Curve"<<endl;
00172       // Loop over near end data
00173       for (std::map<Int_t,PulserSummary>::const_iterator it=psl->GetNearBegin();
00174            it!=psl->GetNearEnd(); it++) {
00175          if (!fNearMapCurve.count((*it).first)) {
00176             fNearMapCurve[(*it).first].New(psl->GetAggregateNo(),
00177                                            psl->GetExpectedPoints(),
00178                                            (*it).first);
00179          }
00180          fNearMapCurve[(*it).first].AddPoint(point,(*it).second);
00181     }
00182       for (std::map<Int_t,PulserSummary>::const_iterator it=psl->GetFarBegin();
00183            it!=psl->GetFarEnd(); it++) {
00184          if (!fFarMapCurve.count((*it).first))    {
00185             fFarMapCurve[(*it).first].New(psl->GetAggregateNo(),
00186                                           psl->GetExpectedPoints(),
00187                                           (*it).first);
00188          }
00189          fFarMapCurve[(*it).first].AddPoint(point,(*it).second);
00190       }
00191       fHighPinCurve.AddPoint(point,psl->GetHighPin());
00192       fLowPinCurve.AddPoint(point,psl->GetLowPin());
00193       if (point == psl->GetExpectedPoints()){
00194          // Got curve - now write DB
00195          WriteRawCurveData(psl);
00196       }
00197       
00198    }
00199    
00200    return JobCResult::kFailed;
00201 }

JobCResult PulserCollectorModule::ReferencePointReco ( MomNavigator mom  )  [private]

Definition at line 66 of file PulserCollectorModule.cxx.

References fFarMapRef, fHighPinRef, fLowPinRef, fNearMapRef, PulserSummaryList::GetAggregateNo(), PulserSummaryList::GetExpectedPoints(), PulserSummaryList::GetFarBegin(), PulserSummaryList::GetFarEnd(), MomNavigator::GetFragment(), PulserSummaryList::GetHighPin(), PulserSummaryList::GetLowPin(), PulserSummaryList::GetNearBegin(), PulserSummaryList::GetNearEnd(), PulserSummary::GetPinDiodeId(), PulserSummaryList::GetPointIndex(), it, Msg::kDebug, JobCResult::kFailed, JobCResult::kPassed, Msg::kVerbose, MSG, PulserRefDriftPin::New(), and WriteReferenceDriftData().

Referenced by Reco().

00067 {
00068    //Get PulserSummary...
00069    PulserSummaryList *psl = dynamic_cast<PulserSummaryList *>
00070       (mom->GetFragment("PulserSummaryList"));
00071    if (psl==0) {
00072       MSG("Pulser",Msg::kVerbose) <<"No pulser summary list here\n";
00073       return JobCResult::kFailed;
00074    }
00075    MSG("Pulser",Msg::kDebug) <<"Got pulser summary "<<psl->GetPointIndex()
00076                              <<" of "<<psl->GetExpectedPoints()<<endl;
00077    //unused: int point = psl->GetPointIndex();
00078    switch(psl->GetExpectedPoints()) {
00079    case 0:
00080       // Noise - no pulsing
00081       break;
00082   case 1:
00083      // Doug Point
00084      MSG("Pulser",Msg::kDebug) <<"Doug Point"<<endl;
00085      ;
00086      fHighPinRef.New(psl->GetAggregateNo(),
00087                      psl->GetHighPin().GetPinDiodeId(),
00088                      psl->GetHighPin());
00089      fLowPinRef.New(psl->GetAggregateNo(),
00090                     psl->GetLowPin().GetPinDiodeId(),
00091                     psl->GetLowPin());
00092      // Loop over near end data
00093      for (std::map<Int_t,PulserSummary>::const_iterator it=psl->GetNearBegin();
00094           it!=psl->GetNearEnd(); it++) {
00095         fNearMapRef[(*it).first].New(psl->GetAggregateNo(),
00096                                      (*it).second.GetStripEndId().BuildPlnStripEndKey(),
00097                                      (*it).second);
00098      }
00099      for (std::map<Int_t,PulserSummary>::const_iterator it=psl->GetFarBegin();
00100           it!=psl->GetFarEnd(); it++) {
00101         fFarMapRef[(*it).first].New(psl->GetAggregateNo(),
00102                                     (*it).second.GetStripEndId().BuildPlnStripEndKey(),
00103                                     (*it).second);
00104      }
00105      WriteReferenceDriftData(psl);
00106      break;
00107    default:
00108       return JobCResult::kFailed;
00109    }
00110    return JobCResult::kPassed;
00111 }

void PulserCollectorModule::WriteRawCurveData ( PulserSummaryList psl  )  [private]

Definition at line 205 of file PulserCollectorModule.cxx.

References VldTimeStamp::Add(), DbiWriter< T >::Close(), fCodeVersion, fFarMapCurve, fGCValid, fHighPinCurve, fIdent, fLowPinCurve, fNearMapCurve, PulserSummaryList::GetAggregateNo(), VldContext::GetDetector(), VldContext::GetSimFlag(), VldContext::GetTimeStamp(), PulserSummaryList::GetVldContext(), it, Msg::kDebug, and MSG.

Referenced by Reco().

00206 {
00207    VldContext vld = psl->GetVldContext();
00208    VldTimeStamp start = vld.GetTimeStamp();
00209    VldTimeStamp end = start;
00210    end.Add(VldTimeStamp(fGCValid,0));
00211    VldRange vr(vld.GetDetector(),vld.GetSimFlag(),start,
00212                end, "PulserCollectorModule");
00213    VldTimeStamp create = start; // now!
00214    create.Add(VldTimeStamp(fCodeVersion,0));
00215    int aggNo = psl->GetAggregateNo();
00216    DbiWriter<PulserRawGain> writer(vr,aggNo,0,create);
00217    MSG("Pulser",Msg::kDebug)<<"Writing database "<<psl->GetVldContext()<<endl;
00218    for (std::map <Int_t,PulserRawGain>::const_iterator 
00219            it = fNearMapCurve.begin(); it!=fNearMapCurve.end(); it++) {
00220       writer << (*it).second;
00221    }
00222    writer.Close();
00223    DbiWriter<PulserRawGainF> fwriter(vr,aggNo,0,create);
00224    for (std::map <Int_t,PulserRawGainF>::const_iterator 
00225            it = fFarMapCurve.begin(); it!=fFarMapCurve.end(); it++) {
00226       fwriter << (*it).second;
00227    }
00228    fwriter.Close();
00229    DbiWriter<PulserRawGainPin> w(vr,aggNo,0,create);
00230    w << fHighPinCurve;
00231    w << fLowPinCurve;
00232    w.Close();
00233    fNearMapCurve.clear();
00234    fFarMapCurve.clear();
00235    fIdent=0;
00236 }

void PulserCollectorModule::WriteRawDriftData ( PulserSummaryList psl  )  [private]

Definition at line 276 of file PulserCollectorModule.cxx.

References VldTimeStamp::Add(), DbiWriter< T >::Close(), fCodeVersion, fDPValid, fFarMapDrift, fHighPinDrift, fLowPinDrift, fNearMapDrift, PulserSummaryList::GetAggregateNo(), VldContext::GetDetector(), VldContext::GetSimFlag(), VldContext::GetTimeStamp(), PulserSummaryList::GetVldContext(), it, Msg::kDebug, and MSG.

Referenced by Reco().

00277 {
00278    VldContext vld = psl->GetVldContext();
00279    VldTimeStamp start = vld.GetTimeStamp();
00280    VldTimeStamp end = start;
00281    end.Add(VldTimeStamp(fDPValid,0));
00282    VldRange vr(vld.GetDetector(),vld.GetSimFlag(),start,
00283                end, "PulserCollectorModule");
00284    VldTimeStamp create = start; 
00285    create.Add(VldTimeStamp(fCodeVersion,0));
00286    int aggNo = psl->GetAggregateNo();
00287    DbiWriter<PulserRawDrift> writer(vr,aggNo,0,create);
00288    MSG("Pulser",Msg::kDebug)<<"Writing database "<<psl->GetVldContext()<<endl;
00289    for (std::map <Int_t,PulserRawDrift>::const_iterator 
00290            it = fNearMapDrift.begin(); it!=fNearMapDrift.end(); it++) {
00291       writer << (*it).second;
00292    }
00293    writer.Close();
00294    DbiWriter<PulserRawDriftF> fwriter(vr,aggNo,0,create);
00295    for (std::map <Int_t,PulserRawDriftF>::const_iterator 
00296            it = fFarMapDrift.begin(); it!=fFarMapDrift.end(); it++) {
00297       fwriter << (*it).second;
00298    }
00299    fwriter.Close();
00300    DbiWriter<PulserRawDriftPin> w(vr,aggNo,0,create);
00301    w << fHighPinDrift;
00302    w << fLowPinDrift;
00303    w.Close();
00304    fNearMapDrift.clear();
00305    fFarMapDrift.clear();
00306 }

void PulserCollectorModule::WriteReferenceDriftData ( PulserSummaryList psl  )  [private]

Definition at line 238 of file PulserCollectorModule.cxx.

References VldTimeStamp::Add(), DbiWriter< T >::Close(), fCodeVersion, fFarMapRef, fHighPinRef, fLowPinRef, fNearMapRef, PulserSummaryList::GetAggregateNo(), VldContext::GetDetector(), VldContext::GetSimFlag(), PulserSummaryList::GetVldContext(), it, Msg::kDebug, and MSG.

Referenced by ReferencePointReco().

00239 {
00240    VldContext vld = psl->GetVldContext();
00241    //   VldTimeStamp start = vld.GetTimeStamp();
00242    //VldTimeStamp start = vld.GetTimeStamp();
00243    //VldTimeStamp end = start;
00244    //end.Add(VldTimeStamp(fDPValid,0));
00245    VldTimeStamp start = VldTimeStamp(2002,9,4,15,0,1); //Valid For all time
00246    VldTimeStamp end = VldTimeStamp(2002,10,2,0,0,0);
00247    //end.Add(VldTimeStamp(fLongTime,0));
00248    VldRange vr(vld.GetDetector(),vld.GetSimFlag(),start,
00249                end, "PulserCollectorModule");
00250    VldTimeStamp create = start; 
00251    create.Add(VldTimeStamp(fCodeVersion,0));
00252    int aggNo = psl->GetAggregateNo();
00253    DbiWriter<PulserRefDrift> writer(vr,aggNo,0,create);
00254    MSG("Pulser",Msg::kDebug)<<"Writing database "<<psl->GetVldContext()<<endl;
00255    for (std::map <Int_t,PulserRefDrift>::const_iterator 
00256            it = fNearMapRef.begin(); it!=fNearMapRef.end(); it++) {
00257       //MSG("Pulser",Msg::kWarning)<<"RefDrift: " << (*it).first << endl;
00258       writer << (*it).second;
00259    }
00260    writer.Close();
00261    DbiWriter<PulserRefDriftF> fwriter(vr,aggNo,0,create);
00262    for (std::map <Int_t,PulserRefDriftF>::const_iterator 
00263            it = fFarMapRef.begin(); it!=fFarMapRef.end(); it++) {
00264       fwriter << (*it).second;
00265    }
00266    fwriter.Close();
00267    DbiWriter<PulserRefDriftPin> w(vr,aggNo,0,create);
00268    w << fHighPinRef;
00269    w << fLowPinRef;
00270    w.Close();
00271    fNearMapRef.clear();
00272    fFarMapRef.clear();
00273 }


Member Data Documentation

const int PulserCollectorModule::fCodeVersion = 2 [static, private]

Definition at line 80 of file PulserCollectorModule.h.

Referenced by HandleCommand(), and Reco().

Definition at line 78 of file PulserCollectorModule.h.

Referenced by WriteRawDriftData().

Definition at line 61 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawCurveData().

Definition at line 67 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawDriftData().

Definition at line 73 of file PulserCollectorModule.h.

Referenced by ReferencePointReco(), and WriteReferenceDriftData().

Definition at line 77 of file PulserCollectorModule.h.

Referenced by WriteRawCurveData().

Definition at line 62 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawCurveData().

Definition at line 68 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawDriftData().

Definition at line 74 of file PulserCollectorModule.h.

Referenced by ReferencePointReco(), and WriteReferenceDriftData().

Definition at line 59 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawCurveData().

Definition at line 79 of file PulserCollectorModule.h.

Definition at line 63 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawCurveData().

Definition at line 69 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawDriftData().

Definition at line 75 of file PulserCollectorModule.h.

Referenced by ReferencePointReco(), and WriteReferenceDriftData().

Definition at line 60 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawCurveData().

Definition at line 66 of file PulserCollectorModule.h.

Referenced by Reco(), and WriteRawDriftData().

Definition at line 72 of file PulserCollectorModule.h.

Referenced by ReferencePointReco(), and WriteReferenceDriftData().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1