#include <FiltSGateModule.h>
Inheritance diagram for FiltSGateModule:

Public Member Functions | |
| FiltSGateModule () | |
| JobCResult | Ana (const MomNavigator *mom) |
| const Registry & | DefaultConfig () const |
| void | Config (const Registry &r) |
| void | Report () |
| void | EndJob () |
| void | ProcessVtmTimeInfoBlks (std::vector< const RawVtmTimeInfoBlock * > &vtmBlks) |
| bool | ProcessDigitDataBlks (std::vector< const RawDigitDataBlock * > &digitBlks, Int_t tfnum) |
| Double_t | near_tdc_sec (Int_t tdc) |
| void | DrawHistgrams () |
Private Attributes | |
| Int_t | fTicksPerSec |
| Int_t | fQieErrorMask |
| Int_t | fPedSubAdcMin |
| Int_t | fCheckTimeFrame |
| Double_t | fTminWindow |
| Double_t | fTmaxWindow |
| Int_t | fTriggerMaskAllow |
| Int_t | fDrawHists |
| bool | fWriteHists |
| bool | fKeepCanvas |
| TCanvas * | fCanvas |
| TH1I | fLastRFClockHist |
| TH1I | fSpillTimeRFHist |
| TH1D | fAdcVsTimeRFHist1 |
| Double_t | fHist1TScale |
| TH1D | fSnarlVsTimeRFHist |
| TH1D | fAdcVsTimeRFHist2 |
| Double_t | fHist2TScale |
| TNtuple | fNtuple |
| Int_t | fLatestRun |
| Int_t | fLatestSubRun |
| Int_t | fLatestSpillTimeTF |
| Int_t | fLatestSpillTimeRF |
| Int_t | fLastRFClock |
| Int_t | fLastRFClockPrevTF |
| Int_t | fLatchedSpillTimeTF |
Definition at line 24 of file FiltSGateModule.h.
| FiltSGateModule::FiltSGateModule | ( | ) |
Definition at line 80 of file FiltSGateModule.cxx.
References fAdcVsTimeRFHist1, fAdcVsTimeRFHist2, fLastRFClockHist, fSnarlVsTimeRFHist, and fSpillTimeRFHist.
00080 : 00081 // Configuration data 00082 fTicksPerSec(kDefaultTicksPerSec), 00083 fQieErrorMask(0), 00084 fPedSubAdcMin(0), 00085 fCheckTimeFrame(0), 00086 fTminWindow(-20.0), // SGate window (usec) based on digitTDC - VtmSpillRF 00087 fTmaxWindow( 20.0), 00088 fTriggerMaskAllow(0), 00089 fDrawHists(1), 00090 fWriteHists(true), 00091 fKeepCanvas(true), 00092 // Classes for drawing 00093 fCanvas(new TCanvas(std::tmpnam(0),"SGate Filter",800,800)), 00094 // Histograms 00095 // Name of object Histogram title bins Low High 00096 // ============== ========================== ==== ==== ==== 00097 fLastRFClockHist("fLastRFClock", 00098 Form("Last RF Clock - %d",kDefaultTicksPerSec), 00099 150,-25,125), 00100 fSpillTimeRFHist("fSpillTimeRF", "Spill Time RF", 50, 0,53104000), 00101 fAdcVsTimeRFHist1("fAdcVsTimeRFHist1", "Adc vs. Time rel RF", 500,-20.0,20.0), 00102 fSnarlVsTimeRFHist("fSnarlVsTimeRFHist1", "Snarl vs. Time rel RF", 500,-20.0,20.0), 00103 fAdcVsTimeRFHist2("fAdcVsTimeRFHist2", "Adc vs. Time rel RF", 500,-100.0,100.0), 00104 // Ntuple 00105 fNtuple("fNtuple","Event Summary",gsChTags), 00106 // Module data 00107 fLatestRun(-1), 00108 fLatestSubRun(-1), 00109 fLatestSpillTimeTF(-1), 00110 fLatestSpillTimeRF(-1), 00111 fLastRFClock(-1), 00112 fLastRFClockPrevTF(-1), 00113 fLatchedSpillTimeTF(-1) 00114 00115 { 00116 //====================================================================== 00117 // Set the initial state of your module. The code above initializes the 00118 // variables listed to the values in parentheses. In this case that's 00119 // all I need to do so the method itself is empty... 00120 //====================================================================== 00121 00122 fLastRFClockHist.SetXTitle("Ticks"); 00123 fLastRFClockHist.SetYTitle("VtmTimeInfo blocks"); 00124 00125 fSpillTimeRFHist.SetXTitle("Ticks"); 00126 fSpillTimeRFHist.SetYTitle("VtmTimeInfo blocks"); 00127 00128 fAdcVsTimeRFHist1.SetXTitle("TDC-SpillTimeRF (sec)"); 00129 fAdcVsTimeRFHist1.SetYTitle("#Sigma Adc"); 00130 00131 fSnarlVsTimeRFHist.SetXTitle("TDC-SpillTimeRF (sec)"); 00132 fSnarlVsTimeRFHist.SetYTitle("#Snarls"); 00133 00134 fAdcVsTimeRFHist2.SetXTitle("TDC-SpillTimeRF (sec)"); 00135 fAdcVsTimeRFHist2.SetYTitle("#Sigma Adc"); 00136 00137 }
| JobCResult FiltSGateModule::Ana | ( | const MomNavigator * | mom | ) | [virtual] |
Implement this for read only access to the MomNavigator
Reimplemented from JobCModule.
Definition at line 326 of file FiltSGateModule.cxx.
References DrawHistgrams(), fDrawHists, fLatestRun, fLatestSpillTimeTF, fLatestSubRun, MomNavigator::FragmentIter(), fTriggerMaskAllow, RecMinos::GetHeader(), RawRecord::GetRawBlockIter(), RawDaqHeader::GetRun(), RawDaqSnarlHeader::GetSnarl(), RawDaqHeader::GetSubRun(), RawDaqHeader::GetTimeFrameNum(), RawDaqSnarlHeader::GetTrigSrc(), JobCResult::kAOK, Msg::kDebug, JobCResult::kFailed, JobCResult::kPassed, Msg::kSynopsis, MSG, ProcessDigitDataBlks(), and ProcessVtmTimeInfoBlks().
00327 { 00328 //====================================================================== 00329 // Given the object to which the data is attached perform some 00330 // analysis of the data 00331 //====================================================================== 00332 00333 vector<const RawVtmTimeInfoBlock*> vtmBlks; 00334 vector<const RawDigitDataBlock*> digitBlks; 00335 Int_t snarlTfNum = -1; 00336 00337 int nrawrec=0; 00338 int nrawblk=0; 00339 bool acceptBecauseTrigMask = false; 00340 UInt_t trigSrc = 0; 00341 Int_t snarlNum = -1; 00342 bool sawMonitorRecord = false; 00343 00344 TObject* recObj = 0; 00345 TIter recItr = mom->FragmentIter(); 00346 while ( ( recObj = recItr.Next() ) ) { 00347 RawRecord* rawrec = dynamic_cast<RawRecord*>(recObj); 00348 if (!rawrec) continue; // skip things in mom that aren't RawRecords 00349 nrawrec++; 00350 00351 // look for the DaqSnarl records with TrigSrc having SGate bit set 00352 const RawDaqSnarlHeader* snarlHdr = 00353 dynamic_cast<const RawDaqSnarlHeader*>(rawrec->GetHeader()); 00354 if ( snarlHdr ) { 00355 fLatestRun = snarlHdr->GetRun(); 00356 fLatestSubRun = snarlHdr->GetSubRun(); 00357 snarlTfNum = snarlHdr->GetTimeFrameNum(); 00358 snarlNum = snarlHdr->GetSnarl(); 00359 if ( snarlHdr->GetTrigSrc() & fTriggerMaskAllow ) { 00360 // rawrec->Print(); 00361 acceptBecauseTrigMask = true; 00362 trigSrc = snarlHdr->GetTrigSrc(); 00363 } 00364 } // snarl header 00365 else 00366 sawMonitorRecord = true; 00367 00368 TObject* blkObj = 0; 00369 TIter blkItr = rawrec->GetRawBlockIter(); 00370 while ( ( blkObj = blkItr.Next() ) ) { 00371 const RawDataBlock* rawBlk = dynamic_cast<const RawDataBlock*>(blkObj); 00372 if (!rawBlk) continue; // odd! 00373 nrawblk++; 00374 00375 const RawVtmTimeInfoBlock* vtmblk = 00376 dynamic_cast<const RawVtmTimeInfoBlock*>(rawBlk); 00377 if (vtmblk) vtmBlks.push_back(vtmblk); 00378 00379 const RawDigitDataBlock* digitblk = 00380 dynamic_cast<const RawDigitDataBlock*>(rawBlk); 00381 if (digitblk) digitBlks.push_back(digitblk); 00382 00383 } // loop over blocks 00384 } // loop over records 00385 00386 MSG("Filt",Msg::kDebug) 00387 << "Saw " << (vtmBlks.size()) << " RawVtmTimeInfoBlocks " 00388 << "and " << (digitBlks.size()) << " RawDigitDataBlocks " 00389 << " from " << nrawblk << " blocks in " << nrawrec << " records" 00390 << endl; 00391 00392 // first process all available VtmTimeInfo blocks 00393 ProcessVtmTimeInfoBlks(vtmBlks); 00394 00395 // then process digits 00396 bool digitsInWindow = ProcessDigitDataBlks(digitBlks,snarlTfNum); 00397 00398 // If graphics are enabled (fDrawHist!=0), draw the histograms if: 00399 // * there were digits seen in the time window 00400 // * fDrawHist is < 0 (e.g. ever snarl record --> very slow!) 00401 // * fDrawHist is > 0 and that many TimeFrames have passed 00402 // since the histograms were last drawn 00403 if (fDrawHists!=0) { 00404 static Int_t lastTF_drawn = -9999; // when we see N-th new time frame ... 00405 if ( ( digitsInWindow ) || 00406 ( fDrawHists < 0 ) || 00407 ( fLatestSpillTimeTF >= lastTF_drawn+fDrawHists ) ) 00408 { 00409 this->DrawHistgrams(); 00410 lastTF_drawn = fLatestSpillTimeTF; 00411 } 00412 } 00413 00414 if ( acceptBecauseTrigMask || digitsInWindow ) { 00415 MSG("Filt",Msg::kSynopsis ) 00416 << std::right 00417 << "FiltSGate Snarl=" << setw(6) << snarlNum 00418 << " in TF=" << setw(5) << snarlTfNum 00419 << " TrigMask=" 00420 << (acceptBecauseTrigMask?"yes":"no ") 00421 << " (0x" << std::hex << std::setfill('0') << std::right << setw(8) 00422 << trigSrc 00423 << std::setfill(' ') << std::left << std::dec 00424 << ") digitsInWindow=" 00425 << (digitsInWindow?"yes":"no ") 00426 << endl; 00427 return JobCResult::kPassed; // Passed cut 00428 } 00429 if ( sawMonitorRecord ) { 00430 MSG("Filt",Msg::kDebug ) 00431 << "FiltSGateModule AOK because DaqMonitor record in recset." 00432 << endl; 00433 return JobCResult::kAOK; // Passed 00434 } 00435 00436 return JobCResult::kFailed; // no reason to keep any of these records 00437 }
| void FiltSGateModule::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 204 of file FiltSGateModule.cxx.
References chooseTimeScale(), fAdcVsTimeRFHist1, fAdcVsTimeRFHist2, fCheckTimeFrame, fDrawHists, fHist1TScale, fHist2TScale, fKeepCanvas, fLastRFClockHist, Form(), fPedSubAdcMin, fQieErrorMask, fSnarlVsTimeRFHist, fTicksPerSec, fTmaxWindow, fTminWindow, fTriggerMaskAllow, fWriteHists, Registry::Get(), Msg::kSynopsis, and MSG.
00205 { 00206 //====================================================================== 00207 // Configure the module given the registry r 00208 //====================================================================== 00209 // char tmpb; 00210 double tmpd; 00211 int tmpi; 00212 00213 if (r.Get("TicksPerSec", tmpi)) { fTicksPerSec = tmpi; } 00214 if (r.Get("QieErrorMask", tmpi)) { fQieErrorMask = tmpi; } 00215 if (r.Get("PedSubAdcMin", tmpi)) { fPedSubAdcMin = tmpi; } 00216 if (r.Get("CheckTimeFrame", tmpi)) { fCheckTimeFrame = tmpi; } 00217 00218 if (r.Get("TminWindow", tmpd)) { fTminWindow = tmpd; } 00219 if (r.Get("TmaxWindow", tmpd)) { fTmaxWindow = tmpd; } 00220 00221 if (r.Get("TriggerMaskAllow",tmpi)) { fTriggerMaskAllow = tmpi; } 00222 00223 if (r.Get("DrawHists", tmpi)) { fDrawHists = tmpi; } 00224 if (r.Get("WriteHists", tmpi)) { fWriteHists = tmpi; } 00225 if (r.Get("KeepCanvas", tmpi)) { fKeepCanvas = tmpi; } 00226 00227 // histogram parameters 00228 bool reBin; 00229 int nbin; 00230 double xmin, xmax; 00231 const char* timeUnitsTag; 00232 00233 reBin = false; 00234 nbin = fAdcVsTimeRFHist1.GetNbinsX(); 00235 xmin = fAdcVsTimeRFHist1.GetXaxis()->GetXmin(); 00236 xmax = fAdcVsTimeRFHist1.GetXaxis()->GetXmax(); 00237 if (r.Get("Nbin1",tmpi)) { reBin = true; nbin = tmpi; } 00238 if (r.Get("Tmin1",tmpd)) { reBin = true; xmin = tmpd; } 00239 if (r.Get("Tmax1",tmpd)) { reBin = true; xmax = tmpd; } 00240 if (reBin) { 00241 MSG("Filt",Msg::kSynopsis) 00242 << "Rebin Hist1 nbins=" << nbin 00243 << " [ " << xmin << " : " << xmax << " ]" 00244 << endl; 00245 chooseTimeScale(xmax-xmin,fHist1TScale,timeUnitsTag); 00246 fAdcVsTimeRFHist1.SetBins(nbin,xmin*fHist1TScale,xmax*fHist1TScale); 00247 fAdcVsTimeRFHist1.SetXTitle(Form("TDC-SpillTimeRF (%s)",timeUnitsTag)); 00248 fSnarlVsTimeRFHist.SetBins(nbin,xmin*fHist1TScale,xmax*fHist1TScale); 00249 fSnarlVsTimeRFHist.SetXTitle(Form("TDC-SpillTimeRF (%s)",timeUnitsTag)); 00250 } 00251 00252 reBin = false; 00253 nbin = fAdcVsTimeRFHist2.GetNbinsX(); 00254 xmin = fAdcVsTimeRFHist2.GetXaxis()->GetXmin(); 00255 xmax = fAdcVsTimeRFHist2.GetXaxis()->GetXmax(); 00256 if (r.Get("Nbin2",tmpi)) { reBin = true; nbin = tmpi; } 00257 if (r.Get("Tmin2",tmpd)) { reBin = true; xmin = tmpd; } 00258 if (r.Get("Tmax2",tmpd)) { reBin = true; xmax = tmpd; } 00259 if (reBin) { 00260 MSG("Filt",Msg::kSynopsis) 00261 << "Rebin Hist2 nbins=" << nbin 00262 << " [ " << xmin << " : " << xmax << " ]" 00263 << endl; 00264 chooseTimeScale(xmax-xmin,fHist2TScale,timeUnitsTag); 00265 fAdcVsTimeRFHist2.SetBins(nbin,xmin*fHist2TScale,xmax*fHist2TScale); 00266 fAdcVsTimeRFHist2.SetXTitle(Form("TDC-SpillTimeRF (%s)",timeUnitsTag)); 00267 } 00268 00269 reBin = false; 00270 nbin = fLastRFClockHist.GetNbinsX(); 00271 xmin = fLastRFClockHist.GetXaxis()->GetXmin(); 00272 xmax = fLastRFClockHist.GetXaxis()->GetXmax(); 00273 if (r.Get("NbinLastRF",tmpi)) { reBin = true; nbin = tmpi; } 00274 if (r.Get("TminLastRF",tmpd)) { reBin = true; xmin = tmpd; } 00275 if (r.Get("TmaxLastRF",tmpd)) { reBin = true; xmax = tmpd; } 00276 if (reBin) { 00277 MSG("Filt",Msg::kSynopsis) 00278 << "Rebin RFClock nbins=" << nbin 00279 << " [ " << xmin << " : " << xmax << " ]" 00280 << endl; 00281 fLastRFClockHist.SetBins(nbin,xmin,xmax); 00282 } 00283 }
| const Registry & FiltSGateModule::DefaultConfig | ( | ) | 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 141 of file FiltSGateModule.cxx.
References MuELoss::e, JobCModule::GetName(), RawQieDigit::kCapIdError, RawQieDigit::kCapIdSameMenuError, RawQieDigit::kCapIdSharedMinderError, kDefaultTicksPerSec, RawQieDigit::kMisCountError, RawQieDigit::kParityError, RawQieDigit::kPriorityTruncate, Registry::LockValues(), Registry::Set(), TRIGGER_BIT_SPILL, TRIGGER_BIT_SPILL_IP, and Registry::UnLockValues().
00142 { 00143 //====================================================================== 00144 // Create a registry which holds the default configuration and return it 00145 //====================================================================== 00146 static Registry r; 00147 00148 // Set name of config 00149 std::string name = this->GetName(); 00150 name += ".config.default"; 00151 r.SetName(name.c_str()); 00152 00153 Int_t qieErrorMask = 0; 00154 qieErrorMask |= RawQieDigit::kParityError; // 0x0001 00155 qieErrorMask |= RawQieDigit::kCapIdError; // 0x0002 00156 qieErrorMask |= RawQieDigit::kMisCountError; // 0x0004 00157 qieErrorMask |= RawQieDigit::kPriorityTruncate; // 0x0008 00158 qieErrorMask |= RawQieDigit::kCapIdSameMenuError; // 0x0010 00159 qieErrorMask |= RawQieDigit::kCapIdSharedMinderError; // 0x0020 00160 00161 Int_t trigMaskAllow = 0; 00162 //trigMaskAllow |= TRIGGER_BIT_NULL; // 0x1 00163 //trigMaskAllow |= TRIGGER_BIT_RAWLI; // 0x2 00164 //trigMaskAllow |= TRIGGER_BIT_PLANE; // 0x4 00165 //trigMaskAllow |= TRIGGER_BIT_TOF; // 0x8 00166 //trigMaskAllow |= TRIGGER_BIT_ACTIVITY; // 0x10 00167 //trigMaskAllow |= TRIGGER_BIT_E4; // 0x20 00168 //trigMaskAllow |= TRIGGER_BIT_MINBIAS; // 0x8000 00169 trigMaskAllow |= TRIGGER_BIT_SPILL; // 0x10000 00170 trigMaskAllow |= TRIGGER_BIT_SPILL_IP; // 0x20000 00171 00172 // Set values of config 00173 r.UnLockValues(); 00174 r.Set("TicksPerSec", kDefaultTicksPerSec); 00175 r.Set("QieErrorMask", qieErrorMask); 00176 r.Set("PedSubAdcMin", 0); 00177 r.Set("CheckTimeFrame", 0); 00178 // Tmin & Tmax values are in seconds!! 00179 r.Set("TminWindow", -100.0e-6); 00180 r.Set("TmaxWindow", 100.0e-6); 00181 r.Set("TriggerMaskAllow", trigMaskAllow); 00182 00183 r.Set("DrawHists", 1); 00184 r.Set("WriteHists", true); 00185 00186 r.Set("Nbin1", 200); 00187 r.Set("Tmin1", -20.0e-6); 00188 r.Set("Tmax1", 20.0e-6); 00189 r.Set("Nbin2", 200); 00190 r.Set("Tmin2", -100.0e-6); 00191 r.Set("Tmax2", 100.0e-6); 00192 00193 r.Set("NbinLastRF", 600); 00194 r.Set("TminLastRF", -25); 00195 r.Set("TmaxLastRF", 575); 00196 00197 r.LockValues(); 00198 00199 return r; 00200 }
| void FiltSGateModule::DrawHistgrams | ( | ) |
Definition at line 661 of file FiltSGateModule.cxx.
References fAdcVsTimeRFHist1, fCanvas, fLastRFClockHist, fSnarlVsTimeRFHist, and fSpillTimeRFHist.
Referenced by Ana(), and Report().
00662 { 00663 //====================================================================== 00664 // Draw the histograms 00665 //====================================================================== 00666 00667 static bool first = true; 00668 if (first) { 00669 first = false; 00670 fCanvas->Divide(1,4); // Like PAW's zone command 00671 fCanvas->cd(4); 00672 gPad->Divide(2,1); 00673 gStyle->SetOptStat(111111); 00674 } 00675 00676 fCanvas->cd(1); 00677 gPad->SetLogy(0); 00678 fAdcVsTimeRFHist1.DrawCopy(); 00679 00680 fCanvas->cd(2); 00681 gPad->SetLogy(0); 00682 fSnarlVsTimeRFHist.DrawCopy(); 00683 00684 fCanvas->cd(3); 00685 gPad->SetLogy(0); 00686 fAdcVsTimeRFHist1.DrawCopy(); 00687 00688 fCanvas->cd(4); 00689 gPad->cd(1); 00690 //gPad->SetLogy(1); 00691 fLastRFClockHist.DrawCopy(); 00692 00693 fCanvas->cd(4); 00694 gPad->cd(2); 00695 //gPad->SetLogy(1); 00696 fSpillTimeRFHist.DrawCopy(); 00697 00698 fCanvas->cd(1); 00699 fCanvas->Update(); 00700 }
| void FiltSGateModule::EndJob | ( | ) | [virtual] |
Implement for notification of end of job
Reimplemented from JobCModule.
Definition at line 302 of file FiltSGateModule.cxx.
References fAdcVsTimeRFHist1, fAdcVsTimeRFHist2, fCanvas, fKeepCanvas, fLastRFClockHist, fNtuple, fSnarlVsTimeRFHist, fSpillTimeRFHist, and fWriteHists.
00303 { 00304 //====================================================================== 00305 // At the end of the job print some stuff out and save the histogram 00306 // to a file 00307 //====================================================================== 00308 00309 // Create a file to write the histogram to. By default it becomes 00310 // the current directory. Write uses current directory by default 00311 if (fWriteHists) { 00312 TFile userFile("sgate_filter.root","RECREATE"); 00313 fLastRFClockHist.Write(); 00314 fSpillTimeRFHist.Write(); 00315 fAdcVsTimeRFHist1.Write(); 00316 fSnarlVsTimeRFHist.Write(); 00317 fAdcVsTimeRFHist2.Write(); 00318 fNtuple.Write(); 00319 } 00320 00321 if ( ! fKeepCanvas ) delete fCanvas; 00322 }
| Double_t FiltSGateModule::near_tdc_sec | ( | Int_t | tdc | ) |
Definition at line 651 of file FiltSGateModule.cxx.
References fTicksPerSec.
Referenced by ProcessDigitDataBlks().
00652 { 00653 return tdc/((double)fTicksPerSec); 00654 00655 // Peter's version 00656 // return tdc*1.5625*16.0*58.0/77.0; 00657 }
| bool FiltSGateModule::ProcessDigitDataBlks | ( | std::vector< const RawDigitDataBlock * > & | digitBlks, | |
| Int_t | tfnum | |||
| ) |
Definition at line 523 of file FiltSGateModule.cxx.
References RawQieDigit::AsString(), RawChannelId::ClearModeBits(), digit(), fAdcVsTimeRFHist1, fAdcVsTimeRFHist2, fCheckTimeFrame, fHist1TScale, fHist2TScale, fLastRFClockPrevTF, fLatchedSpillTimeTF, fLatestRun, fLatestSpillTimeRF, fLatestSubRun, fPedSubAdcMin, fQieErrorMask, fSnarlVsTimeRFHist, fTmaxWindow, fTminWindow, Msg::kDebug, Detector::kNear, kPedAdc, ElecType::kQIE, RawQieDigit::kSGate, Msg::kSynopsis, Msg::kWarning, MSG, and near_tdc_sec().
Referenced by Ana().
00524 { 00525 //====================================================================== 00526 // Process the DigitDataBlocks 00527 // Determine whether any digit TDC's were in the user specified 00528 // time window. Histogram TDC distribution. 00529 // 00530 // Inputs: cdlh - Pointer to a candidate digit list handle 00531 // 00532 // Outputs: true is any TDC's were in the time window 00533 //====================================================================== 00534 00535 size_t n = digitBlks.size(); 00536 if ( ! n ) return false; // nothing to process 00537 00538 bool sawWindowDigits = false; 00539 00540 // real bad hack !!!!! 00541 #ifdef RAWCHANNELID_NEW_CTOR 00542 RawChannelId rcid_bad(Detector::kNear,ElecType::kQIE,5,18,0,12); 00543 #else 00544 RawChannelId rcid_bad(Detector::kNear,ElecType::kQIE,5,18,0,12,false,false); 00545 #endif 00546 00547 for (size_t i = 0; i < n; ++i) { 00548 const RawDigitDataBlock* rddb = digitBlks[i]; 00549 00550 TIter rditr = rddb->GetDatumIter(); 00551 const RawDigit* digit = 0; 00552 Int_t nd = 0; 00553 //Long64_t sumtdc = 0; 00554 Int_t mintdc = 0x7FFFFFF; 00555 Int_t maxtdc = -(mintdc-1); 00556 Char_t dtlast = -1; 00557 Msg::LogLevel_t dumpLevel = Msg::kDebug; 00558 00559 Double_t sumAdcTime = 0; 00560 Double_t sumAdc = 0; 00561 00562 // What we're doing here for calculating times isn't really 00563 // right for events that span the TF boundary ... we should 00564 // be making use of the crate T0 and not the TF #. 00565 Double_t tfOffset = 00566 (snarlTfNum-fLatchedSpillTimeTF) * near_tdc_sec(fLastRFClockPrevTF); 00567 if ( fCheckTimeFrame == 0 ) tfOffset = 0; 00568 00569 while ( ( digit = dynamic_cast<RawDigit*>(rditr.Next()) ) ) { 00570 00571 // skip digits that have error codes on that we don't want 00572 if ( digit->GetErrorCode() & fQieErrorMask ) continue; 00573 00574 // real bad hack !!!!! 00575 RawChannelId rcid = digit->GetChannel(); 00576 rcid.ClearModeBits(); 00577 if ( rcid == rcid_bad ) continue; 00578 00579 Int_t tdc = digit->GetTDC(); 00580 Double_t subTime_sec = 00581 near_tdc_sec(tdc-fLatestSpillTimeRF) + tfOffset; 00582 00583 // don't forget to subtract off the base ADC value of 50 00584 Int_t pedSubAdc = digit->GetADC()-kPedAdc; 00585 // skip digits that are less than the minimum ADC 00586 if ( pedSubAdc < fPedSubAdcMin ) continue; 00587 00588 fAdcVsTimeRFHist1.Fill(subTime_sec*fHist1TScale,pedSubAdc); 00589 fAdcVsTimeRFHist2.Fill(subTime_sec*fHist2TScale,pedSubAdc); 00590 00591 sumAdcTime += pedSubAdc * subTime_sec*fHist1TScale; 00592 sumAdc += pedSubAdc; 00593 00594 if ( subTime_sec >= fTminWindow && 00595 subTime_sec <= fTmaxWindow ) { 00596 sawWindowDigits = true; 00597 dumpLevel = Msg::kSynopsis; 00598 } 00599 00600 nd++; 00601 //sumtdc += tdc; 00602 if ( tdc < mintdc ) mintdc = tdc; 00603 if ( tdc > maxtdc ) maxtdc = tdc; 00604 Char_t dt = digit->GetDataType(); 00605 if ( dtlast != dt && dtlast != -1 ) { 00606 MSG("Filt",Msg::kWarning) 00607 << " RawDigitDataBlock has mixed DataTypes!" 00608 << (Int_t)dtlast << " -> " << (Int_t)dt 00609 << endl; 00610 } 00611 dtlast = dt; 00612 } // loop over digits 00613 00614 if ( sumAdc > 0.0 ) fSnarlVsTimeRFHist.Fill(sumAdcTime/sumAdc,1.0); 00615 00616 //Int_t avgtdc = sumtdc/nd; 00617 const char* tagrf = " "; 00618 if ( mintdc <= fLatestSpillTimeRF && 00619 fLatestSpillTimeRF <= maxtdc ) tagrf = "<== "; 00620 00621 MSG("Filt",dumpLevel) 00622 << std::right 00623 << " Run " << setw(5) << fLatestRun 00624 << "/" << setw(2) << fLatestSubRun 00625 << " TF " << setw(5) << snarlTfNum 00626 << " TDC" 00627 << " min " << setw(9) << mintdc 00628 << " max " << setw(9) << maxtdc 00629 //<< " avg " << setw(9) << avgtdc 00630 //<< " usec " << setw(10) << setprecision(7) 00631 //<< near_tdc_sec(avgtdc)/Munits::microsecond 00632 << " nd " << setw(5) << nd << " " 00633 << RawQieDigit::AsString((RawQieDigit::EQieDataTypes)dtlast) 00634 << (dtlast==RawQieDigit::kSGate?" ##":" ") 00635 << tagrf 00636 //<< endl 00637 //<< " " << mintdc 00638 //<< ((mintdc<=fLatestSpillTimeRF)?" < ":" !< ") 00639 //<< fLatestSpillTimeRF 00640 //<< ((fLatestSpillTimeRF<=maxtdc)?" < ":" !< ") 00641 //<< maxtdc 00642 << endl; 00643 00644 } // loop over blocks 00645 00646 return sawWindowDigits; 00647 }
| void FiltSGateModule::ProcessVtmTimeInfoBlks | ( | std::vector< const RawVtmTimeInfoBlock * > & | vtmBlks | ) |
Definition at line 441 of file FiltSGateModule.cxx.
References fLastRFClock, fLastRFClockHist, fLastRFClockPrevTF, fLatchedSpillTimeTF, fLatestRun, fLatestSpillTimeRF, fLatestSpillTimeTF, fLatestSubRun, fSpillTimeRFHist, Msg::kDebug, kDefaultTicksPerSec, Msg::kSynopsis, and MSG.
Referenced by Ana().
00442 { 00443 //====================================================================== 00444 // Calculate the total charge and number of hit strips in an event 00445 // 00446 // Inputs: cdlh - Pointer to a candidate digit list handle 00447 // 00448 // Outputs: nHit - total number of digits in the list 00449 //====================================================================== 00450 00451 size_t n = vtmBlks.size(); 00452 if ( ! n ) return; // nothing to process 00453 00454 const size_t maxCrates = 16; 00455 int crate[maxCrates]; 00456 int tfnum[maxCrates]; 00457 int spillTimeRF[maxCrates]; 00458 int lastRFClock[maxCrates]; 00459 Msg::LogLevel_t dumpLevel = Msg::kDebug; 00460 00461 Int_t sum = 0; 00462 00463 for (size_t i = 0; i < n; ++i) { 00464 const RawVtmTimeInfoBlock* vti = vtmBlks[i]; 00465 00466 crate[i] = vti->GetCrate(); 00467 tfnum[i] = vti->GetTimeFrameNum(); 00468 spillTimeRF[i] = vti->GetSpillTimeRF(); 00469 lastRFClock[i] = vti->GetLastTimeStamp(); 00470 // Run & SubRun should be the same in all the blocks 00471 if ( 0 == i ) { 00472 fLatestRun = vti->GetRun(); 00473 fLatestSubRun = vti->GetSubRun(); 00474 } 00475 00476 sum += spillTimeRF[i]; 00477 00478 fLastRFClockHist.Fill(lastRFClock[i]-kDefaultTicksPerSec); 00479 00480 MSG("Filt",Msg::kDebug) 00481 << " TF " << setw(5) << tfnum[i] 00482 << " VtmTimeInfo crate " << setw(2) << crate[i] 00483 << " RF " << setw(9) << spillTimeRF[i] 00484 << " GPS " << setw(9) << vti->GetSpillTimeGPS() 00485 << endl; 00486 } 00487 00488 Int_t fSpillTimeRFAvg = sum/n; 00489 fLatestSpillTimeTF = (Int_t)TMath::Median(n,tfnum); 00490 Int_t medianSpillTimeRF = (Int_t)TMath::Median(n,spillTimeRF); 00491 // We recognize a new latching of a spill time by it having 00492 // a different value -- and thus we know in which TimeFrame 00493 // the latch occurred. Or so we assume -- and yes it is broken 00494 // if the new spill time happens *exactly* at the same time. 00495 if ( medianSpillTimeRF != fLatestSpillTimeRF ) { 00496 fLatchedSpillTimeTF = fLatestSpillTimeTF; 00497 // fill only for new latched value (and not initial junk value) 00498 if (fLatestSpillTimeRF>=0) fSpillTimeRFHist.Fill(fLatestSpillTimeRF); 00499 dumpLevel = Msg::kSynopsis; 00500 } 00501 fLatestSpillTimeRF = medianSpillTimeRF; 00502 fLastRFClockPrevTF = fLastRFClock; 00503 fLastRFClock = (Int_t)TMath::Median(n,lastRFClock); 00504 00505 MSG("Filt",dumpLevel) 00506 << std::right 00507 << " Run " << setw(5) << fLatestRun 00508 << "/" << setw(2) << fLatestSubRun 00509 << " TF " << setw(5) << fLatestSpillTimeTF 00510 << " (" << setw(5) << fLatchedSpillTimeTF << ")" 00511 << " SpillTimeRF" 00512 << " median " << setw(9) << fLatestSpillTimeRF 00513 << ( (fLatestSpillTimeRF == fSpillTimeRFAvg) ? " consistent":" median!=avg") 00514 //<< " avg " << setw(9) << fSpillTimeRFAvg 00515 //<< " usec " << setw(10) << setprecision(7) 00516 //<< near_tdc_sec(fSpillTimeRFAvg)/Munits::microsecond 00517 //<< " *******" 00518 << endl; 00519 }
| void FiltSGateModule::Report | ( | ) | [virtual] |
Implement to spew end of running report
Reimplemented from JobCModule.
Definition at line 287 of file FiltSGateModule.cxx.
References DrawHistgrams(), fDrawHists, Msg::kInfo, and MSG.
00288 { 00289 //====================================================================== 00290 // ** No longer needed. Use Module::Report() to see list of parameters 00291 // ** which can be set using Set("name=value"). 00292 // 00293 // Print help for this module 00294 //====================================================================== 00295 MSG("Demo",Msg::kInfo) 00296 << "Report For FiltSGateModule Module:\n" << endl; 00297 if (fDrawHists!=0) this->DrawHistgrams(); 00298 }
TH1D FiltSGateModule::fAdcVsTimeRFHist1 [private] |
Definition at line 59 of file FiltSGateModule.h.
Referenced by Config(), DrawHistgrams(), EndJob(), FiltSGateModule(), and ProcessDigitDataBlks().
TH1D FiltSGateModule::fAdcVsTimeRFHist2 [private] |
Definition at line 62 of file FiltSGateModule.h.
Referenced by Config(), EndJob(), FiltSGateModule(), and ProcessDigitDataBlks().
TCanvas* FiltSGateModule::fCanvas [private] |
Int_t FiltSGateModule::fCheckTimeFrame [private] |
Definition at line 47 of file FiltSGateModule.h.
Referenced by Config(), and ProcessDigitDataBlks().
Int_t FiltSGateModule::fDrawHists [private] |
Double_t FiltSGateModule::fHist1TScale [private] |
Definition at line 60 of file FiltSGateModule.h.
Referenced by Config(), and ProcessDigitDataBlks().
Double_t FiltSGateModule::fHist2TScale [private] |
Definition at line 63 of file FiltSGateModule.h.
Referenced by Config(), and ProcessDigitDataBlks().
bool FiltSGateModule::fKeepCanvas [private] |
Int_t FiltSGateModule::fLastRFClock [private] |
TH1I FiltSGateModule::fLastRFClockHist [private] |
Definition at line 57 of file FiltSGateModule.h.
Referenced by Config(), DrawHistgrams(), EndJob(), FiltSGateModule(), and ProcessVtmTimeInfoBlks().
Int_t FiltSGateModule::fLastRFClockPrevTF [private] |
Definition at line 71 of file FiltSGateModule.h.
Referenced by ProcessDigitDataBlks(), and ProcessVtmTimeInfoBlks().
Int_t FiltSGateModule::fLatchedSpillTimeTF [private] |
Definition at line 72 of file FiltSGateModule.h.
Referenced by ProcessDigitDataBlks(), and ProcessVtmTimeInfoBlks().
Int_t FiltSGateModule::fLatestRun [private] |
Definition at line 66 of file FiltSGateModule.h.
Referenced by Ana(), ProcessDigitDataBlks(), and ProcessVtmTimeInfoBlks().
Int_t FiltSGateModule::fLatestSpillTimeRF [private] |
Definition at line 69 of file FiltSGateModule.h.
Referenced by ProcessDigitDataBlks(), and ProcessVtmTimeInfoBlks().
Int_t FiltSGateModule::fLatestSpillTimeTF [private] |
Int_t FiltSGateModule::fLatestSubRun [private] |
Definition at line 67 of file FiltSGateModule.h.
Referenced by Ana(), ProcessDigitDataBlks(), and ProcessVtmTimeInfoBlks().
TNtuple FiltSGateModule::fNtuple [private] |
Int_t FiltSGateModule::fPedSubAdcMin [private] |
Definition at line 46 of file FiltSGateModule.h.
Referenced by Config(), and ProcessDigitDataBlks().
Int_t FiltSGateModule::fQieErrorMask [private] |
Definition at line 45 of file FiltSGateModule.h.
Referenced by Config(), and ProcessDigitDataBlks().
TH1D FiltSGateModule::fSnarlVsTimeRFHist [private] |
Definition at line 61 of file FiltSGateModule.h.
Referenced by Config(), DrawHistgrams(), EndJob(), FiltSGateModule(), and ProcessDigitDataBlks().
TH1I FiltSGateModule::fSpillTimeRFHist [private] |
Definition at line 58 of file FiltSGateModule.h.
Referenced by DrawHistgrams(), EndJob(), FiltSGateModule(), and ProcessVtmTimeInfoBlks().
Int_t FiltSGateModule::fTicksPerSec [private] |
Double_t FiltSGateModule::fTmaxWindow [private] |
Definition at line 49 of file FiltSGateModule.h.
Referenced by Config(), and ProcessDigitDataBlks().
Double_t FiltSGateModule::fTminWindow [private] |
Definition at line 48 of file FiltSGateModule.h.
Referenced by Config(), and ProcessDigitDataBlks().
Int_t FiltSGateModule::fTriggerMaskAllow [private] |
bool FiltSGateModule::fWriteHists [private] |
1.4.7