RateSummary Class Reference

#include <RateSummary.h>

Inheritance diagram for RateSummary:
JobCModule

List of all members.

Public Member Functions

 RateSummary ()
 ~RateSummary ()
JobCResult Ana (const MomNavigator *mom)
void BeginJob ()
void EndJob ()
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Member Functions

void OpenFile ()
void CloseFile ()

Private Attributes

TFile * fFile
TTree * fTPtree
TPSinglesEventfTPevt
TTree * fDStree
DaqSnarlEventfDSevt
TTree * fCMtree
CrateMonitorEventfCMevt
Int_t fRun
Int_t fSubRun
Int_t fSMHitBlock
Int_t * fSMPlaneHits [2]
Int_t * fSHPlaneHits [2]
Int_t fTime
Int_t fYear
Int_t fMonth
std::string fRateFileName
std::string fRateFileDir
Bool_t fMonthlyDir

Detailed Description

Definition at line 24 of file RateSummary.h.


Constructor & Destructor Documentation

RateSummary::RateSummary (  ) 

Definition at line 59 of file RateSummary.cxx.

References RSMSyn.

00059                          :
00060 fFile(0), fTPtree(0), fDStree(0), fCMtree(0) {
00061   RSMSyn << "RateSummary::RateSummary" << endl;
00062   gROOT->SetBatch(kTRUE);
00063   fRun = 0;
00064   fSubRun = 0;
00065 }

RateSummary::~RateSummary (  ) 

Definition at line 67 of file RateSummary.cxx.

References fFile, and RSMSyn.

00067                           {
00068   RSMSyn << "RateSummary::~RateSummary" << endl;
00069   if(fFile) delete fFile;
00070 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 72 of file RateSummary.cxx.

References DSChipEvent::ADC, VldTimeStamp::Add(), RawCrateMonitorBlock::RawVfbMonitor::asdSupplyV, CMChipEvent::ASDSupplyV, BlockEvent::CheckChips(), DaqSnarlEvent::ChipGen(), TPSinglesEvent::ChipGen(), CrateMonitorEvent::ChipGen(), CloseFile(), DaqSnarlEvent::CrateADC, TPSinglesEvent::CratePulsed, TPSinglesEvent::CrateRate, digit(), fCMevt, fCMtree, fDSevt, fDStree, DbuSubRunSummary::fEndTime, RawRecord::FindRawBlock(), fMonth, fRun, DbuSubRunSummary::fRun, fSHPlaneHits, fSMPlaneHits, fSubRun, DbuSubRunSummary::fSubRun, fTPevt, fTPtree, fYear, Registry::Get(), RawDigit::GetADC(), RawDigit::GetChannel(), RawLITimingSummary::GetChannel(), RawCrateMonitorBlock::GetCrate(), RawChannelId::GetCrate(), RawDigit::GetCrateT0(), PlexSEIdAltL::GetCurrentItem(), VldTimeStamp::GetDate(), RawDigitDataBlock::GetDatumIter(), RawLITimingSummaryBlock::GetDatumIter(), PlexSEIdAltL::GetEnd(), RawTpSinglesSummaryBlock::GetHitsPerSecByCrate(), DbiResultPtr< T >::GetNumRows(), RawCrateMonitorBlock::GetNumVfbMonitors(), PlexPlaneId::GetPlane(), RawTpSinglesSummaryBlock::GetRates(), RawRecord::GetRawBlockIter(), RawRecord::GetRawHeader(), PlexHandle::GetReadoutType(), RawCrateMonitorBlock::GetRopTempCpuC(), RawCrateMonitorBlock::GetRopTempMemC(), RawCrateMonitorBlock::GetRopTempPmcC(), DbiResultPtr< T >::GetRow(), RawDaqHeader::GetRun(), VldTimeStamp::GetSec(), PlexSEIdAltLItem::GetSEId(), PlexHandle::GetSEIdAltL(), RawDaqHeader::GetSubRun(), RawDigit::GetTDC(), RecMinos::GetTempTags(), VldContext::GetTimeStamp(), RawSnarlHeaderBlock::GetTriggerTime(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawCrateMonitorBlock::GetVfbMonitor(), RecMinosHdr::GetVldContext(), RawChannelId::GetVmm(), BlockEvent::IsFilled(), TPChipEvent::IsPulsed, TPChipEvent::IsShield, DSChipEvent::IsShield, PlexSEIdAltL::IsValid(), PlexSEIdAltL::IsVetoShield(), JobCResult::kPassed, ReadoutType::kScintStrip, DaqSnarlEvent::MFADC, TPSinglesEvent::MFRate, NCRATE, RawCrateMonitorBlock::RawVfbMonitor::negativeVaRail0V, RawCrateMonitorBlock::RawVfbMonitor::negativeVaRail1V, RawCrateMonitorBlock::RawVfbMonitor::negativeVaRail2V, CMChipEvent::NegRail0V, CMChipEvent::NegRail1V, CMChipEvent::NegRail2V, PlexSEIdAltL::Next(), OpenFile(), RawCrateMonitorBlock::RawVfbMonitor::positiveVaRailV, CMChipEvent::PosRailV, DaqSnarlEvent::PostTrigADC, DaqSnarlEvent::PreTrigADC, TPChipEvent::Rate, BlockEvent::Reset(), CrateMonitorEvent::ROPTempCPU, CrateMonitorEvent::ROPTempMem, CrateMonitorEvent::ROPTempPmc, RSMDeb, RSMInf, RSMVer, RSMWar, BlockEvent::RunNum, PlexSEIdAltL::SetFirst(), RawChannelId::SetVaChannel(), SHOFFSET, SHPLANES, SM1PLANES, DaqSnarlEvent::SMHitBlock, SMPLANES, DaqSnarlEvent::SMPlanesHit, BlockEvent::SubRunNum, SuperModule, CMChipEvent::Temp, BlockEvent::Time, DaqSnarlEvent::TotalADC, RawCrateMonitorBlock::RawVfbMonitor::varcId, RawCrateMonitorBlock::RawVfbMonitor::vfbId, and RawCrateMonitorBlock::RawVfbMonitor::vfbTempC.

00072                                                    {
00073   RSMVer << "RateSummary::Ana" << endl;
00074 
00075   JobCResult result(JobCResult::kPassed);//Default passing result
00076 
00077   Bool_t HasDaqMonitor = false;
00078   Bool_t HasDaqSnarl = false;
00079   Bool_t HasLightInjection = false;
00080 
00081   RawLITimingSummary *rlits = 0;
00082 
00083   Int_t Plane, ShieldSection, SuperModule;//FEE Variables
00084   Int_t Crate, Vmm, Varc, Vadc, Vachip;//VME Variables
00085   const char* rcInStr = 0;
00086 
00087   for (int i=0;i<2;i++) {
00088     for(int j=0;j<SMPLANES;j++) fSMPlaneHits[i][j] = 0;
00089     for(int j=0;j<SHPLANES;j++) fSHPlaneHits[i][j] = 0;
00090   }
00091   fDSevt->Clear(); fDSevt->Reset();
00092   fTPevt->Clear(); fTPevt->Reset();
00093   fCMevt->Clear(); fCMevt->Reset();
00094 
00095   TIter momitr = const_cast<MomNavigator*>(mom)->FragmentIter();
00096   TObject* momobj = 0;
00097   while ((momobj=momitr())) {
00098     RawRecord* rawrec = 0;
00099     if ((rawrec=dynamic_cast<RawRecord*>(momobj))) {
00100       const RawDaqHeader* dhdr =
00101         dynamic_cast<const RawDaqHeader*>(rawrec->GetRawHeader());
00102 
00103       VldContext vldc = dhdr->GetVldContext();
00104       if (fRun!=dhdr->GetRun() || fSubRun!=dhdr->GetSubRun()) {
00105         RSMDeb << "Run change: " <<
00106           fRun << "-" << fSubRun << " -> " <<
00107           dhdr->GetRun() << "-" << dhdr->GetSubRun() << endl;
00108         CloseFile();
00109         fYear = vldc.GetTimeStamp().GetDate()/10000;
00110         fMonth = vldc.GetTimeStamp().GetDate()/100 - 100*fYear;
00111         fRun = dhdr->GetRun();
00112         fSubRun = dhdr->GetSubRun();
00113         DbiResultPtr<DbuSubRunSummary> dbptr(vldc);
00114         for (unsigned int i=0;i<dbptr.GetNumRows();i++) {
00115           const DbuSubRunSummary* dbsrs = dbptr.GetRow(i);
00116           Int_t tRun = dbsrs->fRun;
00117           Int_t tSubRun = dbsrs->fSubRun;
00118           if (tRun != fRun || tSubRun!=fSubRun) {
00119             RSMWar << "Not using DbuSubRunSummary for this VldContext"
00120                    << vldc << ", displaced Run from the DaqHeader"
00121                    << tRun << "-" << tSubRun << " != "
00122                    << fRun << "-" << fSubRun << endl;
00123             continue;
00124           }
00125           Int_t tYear = dbsrs->fEndTime.GetDate()/10000;
00126           Int_t tMonth = dbsrs->fEndTime.GetDate()/100 - 100*tYear;
00127           if (tYear != fYear || tMonth!=fMonth) {
00128             RSMInf << "Using Year-Mo " << tYear << "-" << tMonth
00129                    << " Instead of " << fYear << "-" << fMonth
00130                    << " as dictated by Dbu" << endl;
00131 
00132             fYear = tYear;
00133             fMonth = tMonth;
00134           }
00135         }
00136 
00137         OpenFile();
00138       }
00139       PlexHandle ph(vldc);
00140 
00141       //If we can't determine the stream of the RawRecord, skip it.
00142       if(!rawrec->GetTempTags().Get("stream",rcInStr)) continue;
00143 
00144       //Do What needs to be done just for DaqSnarl Stream
00145       if (!strcmp("DaqSnarl",rcInStr)) {
00146         HasDaqSnarl=true;
00147         /*
00148         for (int i=0;i<2;i++) {
00149           for(int j=0;j<SMPLANES;j++) fSMPlaneHits[i][j] = 0;
00150           for(int j=0;j<SHPLANES;j++) fSHPlaneHits[i][j] = 0;
00151         }
00152         fDSevt->Clear(); fDSevt->Reset();
00153         */
00154       }
00155 
00156       //Do What needs to be done just for DaqMonitor Stream
00157       if (!strcmp("DaqMonitor",rcInStr)) {
00158         HasDaqMonitor=true;
00159         //fTPevt->Clear(); fTPevt->Reset();
00160         //fCMevt->Clear(); fCMevt->Reset();
00161       }
00162 
00163       //Do What needs to be done just for LightInjection stream
00164       if (!strcmp("LightInjection",rcInStr)) {
00165         HasLightInjection=true;
00166       }
00167 
00168       TIter rawitr = rawrec->GetRawBlockIter(); rawitr.Reset();
00169       TObject *rawobj = 0;
00170       while ((rawobj=rawitr())) {
00171         RawDigitDataBlock* dblock = 0;
00172         if ((dblock=dynamic_cast<RawDigitDataBlock*>(rawobj))) {
00173           const RawSnarlHeaderBlock* hdrblk =
00174            dynamic_cast<const RawSnarlHeaderBlock*>
00175            (rawrec->FindRawBlock("RawSnarlHeaderBlock"));
00176           VldTimeStamp trigger_time = hdrblk->GetTriggerTime();
00177 
00178           fDSevt->Time = vldc.GetTimeStamp().GetSec();
00179 
00180           fDSevt->RunNum = fRun;
00181           fDSevt->SubRunNum = fSubRun;
00182 
00183           TIter digitr = dblock->GetDatumIter();
00184           TObject *digobj = 0;
00185           while ((digobj=digitr())) {
00186             RawDigit *digit=dynamic_cast<RawDigit*>(digobj);
00187             if(!digit) continue; //Only Deal with RawDigit objects
00188             RawChannelId rawid = digit->GetChannel();
00189             Crate = rawid.GetCrate();
00190             SuperModule = (Crate*2)/NCRATE;
00191             Varc = rawid.GetVarcId();
00192             Vmm = rawid.GetVmm();
00193             Vadc = rawid.GetVaAdcSel();
00194             Vachip = rawid.GetVaChip();
00195 
00196             VldTimeStamp vt_T0 = digit->GetCrateT0();
00197             vt_T0.Add(VldTimeStamp(0,(Int_t)(1.5625*digit->GetTDC())));
00198             //if(vt_T0<trigger_time) continue;
00199             //if(digit->GetADC()<70) continue;
00200 
00201             DSChipEvent* chip =
00202               fDSevt->ChipGen(Crate,Varc,Vmm,Vadc,Vachip);
00203             chip->ADC += digit->GetADC();
00204             fDSevt->CrateADC[Crate] += digit->GetADC();
00205             Int_t MF = 4*(int)(rawid.GetCrate()/8);
00206             MF += 1 + 2*(rawid.GetCrate()%2);
00207             MF += rawid.GetVaAdcSel();
00208             fDSevt->MFADC[MF-1] += digit->GetADC();
00209             fDSevt->TotalADC += digit->GetADC();
00210             if(vt_T0<trigger_time) fDSevt->PreTrigADC+=digit->GetADC();
00211             else fDSevt->PostTrigADC += digit->GetADC();
00212 
00213             PlexSEIdAltL seidl = ph.GetSEIdAltL(rawid);
00214             if (ph.GetReadoutType(rawid)==ReadoutType::kScintStrip &&
00215                 seidl.IsValid()) {
00216               seidl.SetFirst();
00217 
00218               if (seidl.IsVetoShield()) {
00219                 chip->IsShield=true;
00220                 int view_index = (Int_t)seidl.GetEnd() - 1;
00221                 if (view_index<0 || view_index>1) {
00222                   RSMWar
00223                    << "Bad View Index " << view_index << endl;
00224                   continue;
00225                 }
00226                 while (seidl.IsValid()) {
00227                   Plane = seidl.GetCurrentItem().GetSEId().GetPlane();
00228                   Plane = Plane - SHOFFSET;
00229                   ShieldSection = (Plane*4)/SHPLANES;
00230                   if(Plane>=0 && Plane<SHPLANES)
00231                     fSHPlaneHits[view_index][Plane]++;
00232                   else
00233                     RSMWar
00234                      << "Bad Plane in SH " << Plane << endl;
00235                   seidl.Next();
00236                 }
00237               }
00238               else {
00239                 //view_index = 0(East), 1(West)
00240                 Int_t view_index = (Int_t)seidl.GetEnd() - 1;
00241                 if (view_index<0 || view_index>1) {
00242                   RSMWar
00243                    << "Bad View Index " << view_index << endl;
00244                   continue;
00245                 }
00246                 while (seidl.IsValid()) {
00247                   Plane = seidl.GetCurrentItem().GetSEId().GetPlane();
00248                   if (Plane>=0 && Plane<SMPLANES)
00249                     fSMPlaneHits[view_index][Plane]++;
00250                   else
00251                     RSMWar
00252                      << "Bad Plane in SM " << Plane << endl;
00253                   seidl.Next();
00254                 }
00255               }
00256             }
00257           }//digititr()
00258         }//RawDigitDataBlock
00259 
00260         RawTpSinglesSummaryBlock* rtpssb = 0;
00261         if ((rtpssb=dynamic_cast<RawTpSinglesSummaryBlock*>(rawobj))) {
00262           fTPevt->RunNum = fRun;
00263           fTPevt->SubRunNum = fSubRun;
00264           fTPevt->Time = vldc.GetTimeStamp().GetSec();
00265 
00266           for(int i=0;i<NCRATE;i++)
00267             fTPevt->CrateRate[i] = rtpssb->GetHitsPerSecByCrate(i);
00268 
00269           const map<RawChannelId,UInt_t> RateMap = rtpssb->GetRates();
00270           map<RawChannelId,UInt_t>::const_iterator ritr;
00271 
00272           for (ritr=RateMap.begin();ritr!=RateMap.end();ritr++) {
00273             RawChannelId rawid = ritr->first;
00274             rawid.SetVaChannel(5);
00275             Int_t MF = 4*(int)(rawid.GetCrate()/8);
00276             MF += 1 + 2*(rawid.GetCrate()%2);
00277             MF += rawid.GetVaAdcSel();
00278             fTPevt->MFRate[MF-1] += ritr->second;
00279 
00280             if(ritr->second==0) continue;
00281 
00282             TPChipEvent* chip = fTPevt->ChipGen(rawid.GetCrate(),
00283                                                 rawid.GetVarcId(),
00284                                                 rawid.GetVmm(),
00285                                                 rawid.GetVaAdcSel(),
00286                                                 rawid.GetVaChip());
00287             chip->Rate = ritr->second;
00288 
00289             PlexSEIdAltL pseidatl = ph.GetSEIdAltL(rawid);
00290             if (pseidatl.IsVetoShield()) {
00291               chip->IsShield = true;
00292             }
00293           }
00294         }//RawTpSinglesSummaryBlock
00295 
00296         RawCrateMonitorBlock* rcmb = 0;
00297         if ((rcmb=dynamic_cast<RawCrateMonitorBlock*>(rawobj))) {
00298           fCMevt->RunNum = fRun;
00299           fCMevt->SubRunNum = fSubRun;
00300           fCMevt->Time = vldc.GetTimeStamp().GetSec();
00301 
00302           int ThisCrate = rcmb->GetCrate();
00303 
00304           fCMevt->ROPTempCPU[ThisCrate] = rcmb->GetRopTempCpuC();
00305           fCMevt->ROPTempMem[ThisCrate] = rcmb->GetRopTempMemC();
00306           fCMevt->ROPTempPmc[ThisCrate] = rcmb->GetRopTempPmcC();
00307 
00308           int nummon=rcmb->GetNumVfbMonitors();
00309           for (int i=0;i<nummon;i++) {
00310             const RawCrateMonitorBlock::RawVfbMonitor& vfbmon =
00311              rcmb->GetVfbMonitor(i);
00312             CMChipEvent* chip = fCMevt->ChipGen(ThisCrate,
00313                                                 vfbmon.varcId,
00314                                                 vfbmon.vfbId >> 1,
00315                                                 vfbmon.vfbId & 1,
00316                                                 0);
00317             chip->Temp = vfbmon.vfbTempC;
00318             chip->ASDSupplyV = vfbmon.asdSupplyV;
00319             chip->PosRailV = vfbmon.positiveVaRailV;
00320             chip->NegRail0V = vfbmon.negativeVaRail0V;
00321             chip->NegRail1V = vfbmon.negativeVaRail1V;
00322             chip->NegRail2V = vfbmon.negativeVaRail2V;
00323           }
00324         }//RawCrateMonitorBlock
00325 
00326         RawLiTpmtDigitsBlock* rlitdb = 0;
00327         if ((rlitdb=dynamic_cast<RawLiTpmtDigitsBlock*>(rawobj))) {
00328           /*
00329           TIter digitr = rlitdb->GetDatumIter();
00330           UChar_t ThisBit = 0x08;
00331           TObject *digobj=0;
00332           while ((digobj=digitr())) {
00333             RawDigit *digit=dynamic_cast<RawDigit*>(digobj);
00334             if(!digit) continue; //Only Deal with RawDigit objects
00335             const RawChannelId rawid = digit->GetChannel();
00336             fTPevt->CratePulsed[rawid.GetCrate()] |= ThisBit;
00337             TPChipEvent* chip = 0;
00338             chip = fTPevt->ChipGen(rawid.GetCrate(),
00339                                    rawid.GetVarcId(),
00340                                    rawid.GetVmm(),
00341                                    rawid.GetVaAdcSel(),
00342                                    rawid.GetVaChip());
00343             chip->ChipStatus |= ThisBit;
00344           }//digitr()
00345           */
00346         }//RawLiTpmtDigitsBlock
00347 
00348         RawLIAdcSummaryBlock *rliasb = 0;
00349         if ((rliasb = dynamic_cast<RawLIAdcSummaryBlock*>(rawobj))) {
00350           /*
00351           PlexLedId plid(vldc.GetDetector(),rliasb->GetPulserBox(),
00352                          rliasb->GetLed());
00353           std::vector<PlexStripEndId> pseidvec =
00354             ph.GetStripEndIdVector(plid);
00355 
00356           UChar_t ThisBit = 0x04;
00357           for(UInt_t i=0;i<pseidvec.size();i++) {
00358             const RawChannelId rawid = ph.GetRawChannelId(pseidvec[i]);
00359             fTPevt->CrateStatus[rawid.GetCrate()] |= ThisBit;
00360             TPChipEvent* chip = fTPevt->ChipGen(rawid.GetCrate(),
00361                                                 rawid.GetVarcId(),
00362                                                 rawid.GetVmm(),
00363                                                 rawid.GetVaAdcSel(),
00364                                                 rawid.GetVaChip());
00365             chip->ChipStatus |= ThisBit;
00366           }
00367           */
00368         }//RawLIAdcSummaryBlock
00369 
00370         RawLITimingSummaryBlock *rlitsb = 0;
00371         if ((rlitsb = dynamic_cast<RawLITimingSummaryBlock*>(rawobj))) {
00372           //UChar_t ThisBit = 0x02;
00373 
00374           TIter lititr = rlitsb->GetDatumIter();
00375           TObject *litobj = 0;
00376           while((litobj=lititr()))
00377           if( (rlits=dynamic_cast<RawLITimingSummary*>(litobj))) {
00378             const RawChannelId rawid = rlits->GetChannel();
00379             fTPevt->CratePulsed[rawid.GetCrate()] = true;
00380             TPChipEvent* chip = fTPevt->ChipGen(rawid.GetCrate(),
00381                                                 rawid.GetVarcId(),
00382                                                 rawid.GetVmm(),
00383                                                 rawid.GetVaAdcSel(),
00384                                                 rawid.GetVaChip());
00385             chip->IsPulsed = true;
00386           }
00387         }//RawLITimingSummaryBlock
00388       }//rawitr()
00389 
00390       if(fDSevt->IsFilled()) {
00391         fDSevt->SMPlanesHit[0] = 0;
00392         fDSevt->SMPlanesHit[1] = 0;
00393         fDSevt->SMHitBlock = 0;
00394 
00395         Int_t PlanesHit = 0;
00396         for (int i=0;i<SMPLANES;i++) {
00397           if (fSMPlaneHits[0][i]>0 && fSMPlaneHits[1][i]>0) {
00398             PlanesHit++;
00399             if(i<SM1PLANES) fDSevt->SMPlanesHit[0]++;
00400             else fDSevt->SMPlanesHit[1]++;
00401           }
00402           else {
00403             if(PlanesHit>fDSevt->SMHitBlock) {
00404               fDSevt->SMHitBlock = PlanesHit;
00405             }
00406             PlanesHit = 0;
00407           }
00408         }
00409 
00410         /*
00411         for (int i=0;i<SHPLANES;i++) {
00412           ShieldSection = Plane * 4 / SHPLANES;
00413           if(fSHPlaneHits[0][i]>0 && fSHPlaneHits[1][i]>0)
00414             fDSevt->SHPlanesHit[ShieldSection]++;
00415         }
00416         */
00417       }
00418     }//RawRecord
00419   }//momitr()
00420   if(fDSevt->IsFilled() && HasDaqSnarl) {
00421     fDSevt->CheckChips();
00422     fDStree->Fill();
00423   }
00424   if(fTPevt->IsFilled() && HasDaqMonitor) {
00425     fTPevt->CheckChips();
00426     fTPtree->Fill();
00427   }
00428   if(fCMevt->IsFilled() && HasDaqMonitor) {
00429     fCMevt->CheckChips();
00430     fCMtree->Fill();
00431   }
00432   return result;
00433 }

void RateSummary::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 435 of file RateSummary.cxx.

References fCMevt, fDSevt, fRun, fSHPlaneHits, fSMPlaneHits, fSubRun, fTPevt, RSMDeb, RSMSyn, SHPLANES, and SMPLANES.

00435                            {
00436   RSMSyn << "RateSummary::BeginJob" << endl;
00437 
00438   fRun = 0;
00439   fSubRun = 0;
00440 
00441   fTPevt = new TPSinglesEvent();
00442   fDSevt = new DaqSnarlEvent();
00443   fCMevt = new CrateMonitorEvent();
00444 
00445   for (int i=0;i<5;i++) {
00446     fSMPlaneHits[i] = new Int_t[SMPLANES];
00447     fSHPlaneHits[i] = new Int_t[SHPLANES];
00448   }
00449 
00450   RSMDeb << "Finished RateSummary::BeginJob" << endl;
00451 }

void RateSummary::CloseFile ( void   )  [private]

Definition at line 493 of file RateSummary.cxx.

References fCMevt, fCMtree, fDSevt, fDStree, fFile, fRun, fTPevt, fTPtree, BlockEvent::Reset(), and RSMSyn.

Referenced by Ana(), and EndJob().

00493                             {
00494   if(fRun==0) return;
00495   RSMSyn << "RateSummary::CloseFile" << endl;
00496 
00497   fFile->cd();
00498   fTPtree->Write();
00499   fDStree->Write();
00500   fCMtree->Write();
00501 
00502   fFile->cd();
00503   fFile->Write(NULL,TObject::kOverwrite);
00504   fFile->Purge();
00505   fTPtree->Delete();
00506   fDStree->Delete();
00507   fCMtree->Delete();
00508   fFile->Purge();
00509   fFile->Close();
00510   fTPevt->Reset();
00511   fDSevt->Reset();
00512   fCMevt->Reset();
00513 }

void RateSummary::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 532 of file RateSummary.cxx.

References fMonthlyDir, fRateFileDir, fRateFileName, Registry::Get(), and RSMSyn.

00532                                           {
00533   RSMSyn << "RateSummary::Config" << endl;
00534   int tmpi = 0;
00535   const char* tmps = 0;
00536 
00537   if(r.Get("RateFileName",tmps)) fRateFileName=tmps;
00538   if(r.Get("RateFileDir",tmps)) fRateFileDir=tmps;
00539   if(r.Get("MonthlyDir",tmpi)) fMonthlyDir=static_cast<bool>(tmpi);
00540 }

const Registry & RateSummary::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 515 of file RateSummary.cxx.

References JobCModule::GetName(), Registry::LockValues(), RSMSyn, Registry::Set(), and Registry::UnLockValues().

00515                                                  {
00516   RSMSyn << "RateSummary::DefaultConfig" << endl;
00517 
00518   static Registry r;
00519 
00520   string name = this->JobCModule::GetName();
00521   r.SetName((name+".config.default").c_str());
00522   r.UnLockValues();
00523 
00524   r.Set("RateFileName","F%08d_%04d.rate.root");
00525   r.Set("RateFileDir","./");
00526   r.Set("MonthlyDir",0);
00527 
00528   r.LockValues();
00529   return r;
00530 }

void RateSummary::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 453 of file RateSummary.cxx.

References CloseFile(), and RSMSyn.

00453                          {
00454   RSMSyn << "RateSummary::EndJob" << endl;
00455 
00456   CloseFile();
00457 }

void RateSummary::OpenFile (  )  [private]

Definition at line 459 of file RateSummary.cxx.

References UtilRSM::CheckDir(), exit(), fCMevt, fCMtree, fDSevt, fDStree, fFile, fMonth, fMonthlyDir, fRateFileDir, fRateFileName, fRun, fSubRun, fTPevt, fTPtree, fYear, RSMInf, and RSMSyn.

Referenced by Ana().

00459                            {
00460   RSMSyn << "RateSummary::OpenFile" << endl;
00461 
00462   char date_dir[10];
00463   char RateFileName[28];
00464 
00465   sprintf(RateFileName,fRateFileName.c_str(),fRun,fSubRun);
00466 
00467   string rdir = fRateFileDir + "/";
00468   if (fMonthlyDir) {
00469     sprintf(date_dir,"%4d_%02d",fYear,fMonth);
00470     rdir += date_dir; rdir += "/";
00471   }
00472   if(!UtilRSM::CheckDir(rdir.c_str())) exit(0);
00473 
00474   string full_file = rdir+RateFileName;
00475 
00476   RSMInf << "Writing to " << full_file << endl;
00477 
00478   fFile = new TFile(full_file.c_str(),"RECREATE");
00479   fFile->cd();
00480 
00481   fTPtree = new TTree("tprates","Trigger Processor Rates");
00482   fTPtree->Branch("tpevt","TPSinglesEvent",&fTPevt);
00483 
00484   fDStree = new TTree("dsrates","DaqSnarl Rates");
00485   fDStree->Branch("dsevt","DaqSnarlEvent",&fDSevt);
00486 
00487   fCMtree = new TTree("cmrates","Crate Monitor Rates");
00488   fCMtree->Branch("cmevt","CrateMonitorEvent",&fCMevt);
00489 
00490   fFile->cd();
00491 }


Member Data Documentation

Definition at line 49 of file RateSummary.h.

Referenced by Ana(), BeginJob(), CloseFile(), and OpenFile().

TTree* RateSummary::fCMtree [private]

Definition at line 48 of file RateSummary.h.

Referenced by Ana(), CloseFile(), and OpenFile().

Definition at line 46 of file RateSummary.h.

Referenced by Ana(), BeginJob(), CloseFile(), and OpenFile().

TTree* RateSummary::fDStree [private]

Definition at line 45 of file RateSummary.h.

Referenced by Ana(), CloseFile(), and OpenFile().

TFile* RateSummary::fFile [private]

Definition at line 40 of file RateSummary.h.

Referenced by CloseFile(), OpenFile(), and ~RateSummary().

Int_t RateSummary::fMonth [private]

Definition at line 62 of file RateSummary.h.

Referenced by Ana(), and OpenFile().

Bool_t RateSummary::fMonthlyDir [private]

Definition at line 67 of file RateSummary.h.

Referenced by Config(), and OpenFile().

std::string RateSummary::fRateFileDir [private]

Definition at line 66 of file RateSummary.h.

Referenced by Config(), and OpenFile().

std::string RateSummary::fRateFileName [private]

Definition at line 65 of file RateSummary.h.

Referenced by Config(), and OpenFile().

Int_t RateSummary::fRun [private]

Definition at line 51 of file RateSummary.h.

Referenced by Ana(), BeginJob(), CloseFile(), and OpenFile().

Int_t* RateSummary::fSHPlaneHits[2] [private]

Definition at line 57 of file RateSummary.h.

Referenced by Ana(), and BeginJob().

Int_t RateSummary::fSMHitBlock [private]

Definition at line 54 of file RateSummary.h.

Int_t* RateSummary::fSMPlaneHits[2] [private]

Definition at line 56 of file RateSummary.h.

Referenced by Ana(), and BeginJob().

Int_t RateSummary::fSubRun [private]

Definition at line 52 of file RateSummary.h.

Referenced by Ana(), BeginJob(), and OpenFile().

Int_t RateSummary::fTime [private]

Definition at line 59 of file RateSummary.h.

Definition at line 43 of file RateSummary.h.

Referenced by Ana(), BeginJob(), CloseFile(), and OpenFile().

TTree* RateSummary::fTPtree [private]

Definition at line 42 of file RateSummary.h.

Referenced by Ana(), CloseFile(), and OpenFile().

Int_t RateSummary::fYear [private]

Definition at line 61 of file RateSummary.h.

Referenced by Ana(), and OpenFile().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1