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

Public Member Functions | |
| BDAnaModule () | |
| ~BDAnaModule () | |
| void | BeginJob () |
| void | EndJob () |
| JobCResult | Ana (const MomNavigator *mom) |
Private Attributes | |
| int | n_bd_rec |
| int | n_daq_req |
|
|
Definition at line 28 of file BDAnaModule.cxx. References n_bd_rec, and n_daq_req.
|
|
|
Definition at line 33 of file BDAnaModule.cxx. 00034 {
00035 }
|
|
|
Implement this for read only access to the MomNavigator Reimplemented from JobCModule. Definition at line 124 of file BDAnaModule.cxx. References HistMan::Fill1d(), HistMan::Get(), Registry::GetCharString(), RawBeamData::GetMsecs(), RawBeamData::GetSeconds(), RecMinos::GetTempTags(), RawBeamMonHeaderBlock::GetTimeStamp(), RawSnarlHeaderBlock::GetTriggerTime(), spew_record(), swics, RawBeamSwicData::VmeNanoseconds(), and RawBeamSwicData::VmeSeconds(). 00125 {
00126
00127 const RawRecord* daq_rec = 0;
00128 const RawRecord* bd_rec = 0;
00129
00130
00131 TIter mitr = mom -> FragmentIter();
00132 TObject* object;
00133 while ( (object = mitr.Next()) ) {
00134 const RawRecord* rr = dynamic_cast<const RawRecord*>(object);
00135 if ( !rr ) continue;
00136
00137 spew_record(*rr);
00138
00139 string stream_name = rr->GetTempTags().GetCharString("stream");
00140 if (stream_name == "BeamMon") bd_rec = rr;
00141 if (stream_name == "DaqSnarl") daq_rec = rr;
00142 }
00143
00144 if (bd_rec) ++ n_bd_rec;
00145 if (daq_rec) ++ n_daq_req;
00146
00147 if (!(bd_rec && daq_rec)) return JobCResult::kFailed;
00148
00149 const RawBeamMonHeaderBlock* bd_head = get_block<RawBeamMonHeaderBlock>(*bd_rec);
00150 const RawBeamMonBlock* bd_block = get_block<RawBeamMonBlock>(*bd_rec);
00151
00152 const RawSnarlHeaderBlock* daq_snarl = get_block<RawSnarlHeaderBlock>(*daq_rec);
00153 //const RawDigitDataBlock* daq_digit = get_block<RawDigitDataBlock>(*daq_rec);
00154
00155 HistMan hm("BDAna");
00156
00157 if (bd_block) {
00158 TH1I *swic_count = hm.Get<TH1I>("swic_count");
00159 TH2D *dae_vme_dt = hm.Get<TH2D>("dae_vme_dt");
00160
00161 for (int ind=0; swics[ind]; ++ind) {
00162 const RawBeamData* rbd = (*bd_block)[swics[ind]];
00163
00164 if (!rbd) continue;
00165 swic_count->Fill(ind);
00166
00167 double t_dae = rbd->GetSeconds() + rbd->GetMsecs()*0.001;
00168
00169 RawBeamSwicData swic(*rbd);
00170
00171 double t_vme = swic.VmeSeconds() + swic.VmeNanoseconds()*1.0e-9;
00172
00173 //cout << t_dae << " - " << t_vme << " = " << t_dae-t_vme << endl;
00174
00175 dae_vme_dt->Fill(ind,t_dae-t_vme);
00176 }
00177 }
00178
00179
00180 if (bd_block && daq_snarl) {
00181 const RawBeamData* rbd = 0;
00182
00183 rbd = (*bd_block)["E:MTGTDS"];
00184
00185 if (rbd) {
00186 TH1D *daq_vme_dt = hm.Get<TH1D>("daq_vme_dt");
00187
00188 RawBeamSwicData swic(*rbd);
00189
00190 VldTimeStamp vld_daq = daq_snarl->GetTriggerTime();
00191 VldTimeStamp vld_vme(swic.VmeSeconds(),swic.VmeNanoseconds());
00192
00193 daq_vme_dt->Fill(vld_daq-vld_vme);
00194 }
00195
00196 rbd = (*bd_block)["E:TORTGT"];
00197 if (rbd) {
00198 TH1D *daq_dae_dt = hm.Get<TH1D>("daq_dae_dt");
00199
00200 VldTimeStamp vld_daq = daq_snarl->GetTriggerTime();
00201 VldTimeStamp vld_dae(rbd->GetSeconds(),(int)(rbd->GetMsecs()*1e6));
00202 daq_dae_dt->Fill(vld_daq-vld_dae);
00203 }
00204
00205 }
00206
00207 if (bd_head && daq_snarl) {
00208
00209 VldTimeStamp trig_vts = daq_snarl->GetTriggerTime();
00210 VldTimeStamp bd_vts = bd_head->GetTimeStamp();
00211 double head_dt = trig_vts - bd_vts;
00212 hm.Fill1d("head_dt",head_dt);
00213 hm.Fill1d("head_dt_wide",head_dt);
00214 cout << "daq=" << trig_vts << endl
00215 << "bd= " << bd_vts << endl
00216 << "\tdt=" << head_dt << endl;
00217 }
00218
00219
00220
00221 return JobCResult::kAOK;
00222 }
|
|
|
Implement for notification of begin of job Reimplemented from JobCModule. Definition at line 55 of file BDAnaModule.cxx. References HistMan::Book(), and swics. 00056 {
00057 HistMan hm("BDAna");
00058
00059 hm.Book<TH1D>("head_dt","Time between DAQ and BeamData headers",
00060 4000,-2,2);
00061 hm.Book<TH1D>("head_dt_wide","Time between DAQ and BeamData headers",
00062 2400,-120,120);
00063
00064 hm.Book<TH1D>("daq_vme_dt","Time between DAQ trigger and E:MTGTDS VME timestamp",
00065 4000,-2,2);
00066 hm.Book<TH1D>("daq_dae_dt","Time between DAQ trigger and E:TORTGT DAE timestamp",
00067 4000,-2,2);
00068
00069 TH2D* h2d =
00070 hm.Book<TH2D>("dae_vme_dt","Time between DAE and VME ts for various devices",
00071 nswics,0,nswics,200,-10,10);
00072
00073 TH1I *h1i =
00074 hm.Book<TH1I>("swic_count","Count number of times a swic device shows up",
00075 nswics,0,nswics);
00076 for (int ind=0; swics[ind]; ++ind) {
00077 h2d->GetXaxis()->SetBinLabel(ind+1,swics[ind]);
00078 h1i->GetXaxis()->SetBinLabel(ind+1,swics[ind]);
00079 }
00080 }
|
|
|
Implement for notification of end of job Reimplemented from JobCModule. Definition at line 82 of file BDAnaModule.cxx. References HistMan::WriteOut(). 00083 {
00084 HistMan hm("BDAna");
00085
00086 TFile file("bdana.root","recreate");
00087 hm.WriteOut(file);
00088 }
|
|
|
Definition at line 8 of file BDAnaModule.h. Referenced by BDAnaModule(). |
|
|
Definition at line 8 of file BDAnaModule.h. Referenced by BDAnaModule(). |
1.3.9.1