00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #include <iostream>
00016
00017 #include "TFile.h"
00018 #include "TH1.h"
00019 #include "TH2.h"
00020
00021 #include "JobControl/JobCModuleRegistry.h"
00022 #include "JobControl/JobCommand.h"
00023 #include "MessageService/MsgService.h"
00024 #include "MinosObjectMap/MomNavigator.h"
00025 #include "RawData/RawLIAdcSummary.h"
00026 #include "RawData/RawDaqHeader.h"
00027 #include "RawData/RawLIAdcSummaryBlock.h"
00028 #include "RawData/RawRecord.h"
00029 #include "RawData/RawLIHeader.h"
00030
00031 #include "LISummary/LISummaryAnalyser.h"
00032
00033 #include <cassert>
00034
00035 ClassImp(LISummaryAnalyser)
00036
00037 JOBMODULE(LISummaryAnalyser,"LISummaryAnalyser","A module to analyse raw LI data");
00038
00039 CVSID("$Id: LISummaryAnalyser.cxx,v 1.1 2003/07/28 11:05:17 hartnell Exp $");
00040
00041
00042
00043 LISummaryAnalyser::LISummaryAnalyser()
00044 {
00045 MSG("LISummaryAnalyser", Msg::kDebug)
00046 << "Running constructor..." << endl;
00047
00048
00049 calibPoint=-1;
00050 calibType=-1;
00051 led=-1;
00052 mean=-1;
00053 numEntries=-1;
00054 period=-1;
00055 pulseHeight=-1;
00056 pulserBox=-1;
00057 pulses=-1;
00058 pulseWidth=-1;
00059 rms=-1;
00060 timeNanoSec=-1;
00061 timeSec=-1;
00062
00064 plottedOnce=0;
00065 numSummariesProcessed=0;
00066 msgLevel=0;
00067
00068 hMeanPb=new TH1F*[NUMPULSERBOXES];
00069 hMeanCorrelatedPb=new TH1F*[NUMPULSERBOXES];
00070 for (Int_t i=0;i<NUMPULSERBOXES;i++){
00071 string s="Trigger PMT Mean ADC (Pb ";
00072 string pB=Form("%d",i);
00073 s=s+pB+")";
00074 hMeanPb[i]=new TH1F(s.c_str(),s.c_str(),20000,-5,17005);
00075 hMeanPb[i]->GetXaxis()->SetTitle("Mean");
00076 hMeanPb[i]->GetXaxis()->CenterTitle();
00077 hMeanPb[i]->GetYaxis()->SetTitle("Num Entries");
00078 hMeanPb[i]->GetYaxis()->CenterTitle();
00079 hMeanPb[i]->SetFillColor(0);
00080 hMeanPb[i]->SetBit(TH1::kCanRebin);
00081
00082 s="Trigger PMT Mean ADC (Correlated, Pb ";
00083 s=s+pB+")";
00084 hMeanCorrelatedPb[i]=new TH1F(s.c_str(),s.c_str(),150,-5,17005);
00085 hMeanCorrelatedPb[i]->GetXaxis()->SetTitle("Mean");
00086 hMeanCorrelatedPb[i]->GetXaxis()->CenterTitle();
00087 hMeanCorrelatedPb[i]->GetYaxis()->SetTitle("Num Entries");
00088 hMeanCorrelatedPb[i]->GetYaxis()->CenterTitle();
00089 hMeanCorrelatedPb[i]->SetFillColor(0);
00090 hMeanCorrelatedPb[i]->SetLineColor(2);
00091 hMeanCorrelatedPb[i]->SetBit(TH1::kCanRebin);
00092 }
00093
00094 hTimestamp=new TH1F("hTimestamp","Timestamp",
00095 6000000,1.0365e9,1.0370e9);
00096 hTimestamp->GetXaxis()->SetTitle("Timestamp");
00097 hTimestamp->GetXaxis()->CenterTitle();
00098 hTimestamp->GetYaxis()->SetTitle("Number of entries");
00099 hTimestamp->GetYaxis()->CenterTitle();
00100 hTimestamp->SetFillColor(0);
00101 hTimestamp->SetBit(TH1::kCanRebin);
00102
00103 hTimestampCorrelated=new TH1F("hTimestampCorrelated",
00104 "TimestampCorrelated",
00105 3000000,1.035e9,1.038e9);
00106 hTimestampCorrelated->GetXaxis()->SetTitle("TimestampCorrelated");
00107 hTimestampCorrelated->GetXaxis()->CenterTitle();
00108 hTimestampCorrelated->GetYaxis()->SetTitle("Number of entries");
00109 hTimestampCorrelated->GetYaxis()->CenterTitle();
00110 hTimestampCorrelated->SetFillColor(0);
00111 hTimestampCorrelated->SetLineColor(2);
00112 hTimestampCorrelated->SetBit(TH1::kCanRebin);
00113
00114 cTimestamp=new TCanvas("cTimestamp","Timestamp",
00115 0,0,1200,600);
00116 cTimestamp->SetFillColor(0);
00117 cTimestamp->cd();
00118 hTimestamp->Draw();
00119
00120
00121 MSG("LISummaryAnalyser", Msg::kDebug)
00122 << "Finished constructor" << endl;
00123 }
00124
00125
00126
00127 LISummaryAnalyser::~LISummaryAnalyser()
00128 {
00129 MSG("LISummaryAnalyser", Msg::kDebug)
00130 << "Running destructor..." << endl;
00131
00132 MSG("LISummaryAnalyser", Msg::kDebug)
00133 << "Finished destructor" << endl;
00134 }
00135
00136
00137
00138 JobCResult LISummaryAnalyser::Ana(const MomNavigator *mom)
00139 {
00140 JobCResult result(JobCResult::kPassed);
00141
00142
00143 assert(mom);
00144
00145
00146 RawRecord *rawrec = dynamic_cast<RawRecord *>
00147 (mom->GetFragment("RawRecord"));
00148
00149 if (!rawrec) {
00150 result.SetError().SetFailed();
00151 return result;
00152 }
00153
00154
00155 const RawLIAdcSummaryBlock *rawliadcsummaryblock =
00156 dynamic_cast<const RawLIAdcSummaryBlock*>
00157 (rawrec->FindRawBlock("RawLIAdcSummaryBlock"));
00158
00159
00160 if(!rawliadcsummaryblock){
00161 result.SetError().SetFailed();
00162 return result;
00163 }
00164
00165
00166 timeStamp=rawliadcsummaryblock->GetTimeStamp();
00167 timeSec=static_cast<Int_t>(timeStamp.GetSec());
00168 timeNanoSec=static_cast<Int_t>(timeStamp.GetNanoSec());
00169 pulserBox=rawliadcsummaryblock->GetPulserBox();
00170 led=rawliadcsummaryblock->GetLed();
00171 pulseHeight=rawliadcsummaryblock->GetPulseHeight();
00172 pulses=rawliadcsummaryblock->GetPulses();
00173
00174 if (numSummariesProcessed>msgLevel){
00175 MSG("LIAnalysis",Msg::kInfo)
00176 <<"Number of summaries processed = "<<numSummariesProcessed
00177 <<endl;
00178 msgLevel+=500000;
00179 }
00180 numSummariesProcessed+=rawliadcsummaryblock->GetNumberOfSummaries();
00181
00182
00183 for(Int_t n=0;n<rawliadcsummaryblock->GetNumberOfSummaries();n++){
00184 const RawLIAdcSummary *rawliadcsummary=
00185 rawliadcsummaryblock->At(n);
00186
00187 mean=rawliadcsummary->GetMean();
00188 rms=rawliadcsummary->GetRms();
00189 numEntries=rawliadcsummary->GetEntries();
00190
00191 Int_t crate=rawliadcsummary->GetChannel().GetCrate();
00192 Int_t varc=rawliadcsummary->GetChannel().GetVarcId();
00193 Int_t vfb=rawliadcsummary->GetChannel().GetVaAdcSel();
00194 Int_t vmm=rawliadcsummary->GetChannel().GetVmm();
00195 Int_t chip=rawliadcsummary->GetChannel().GetVaChip();
00196
00197
00198
00199
00200 if (crate==1 && varc==2 && vmm==5 && vfb==0 && chip==1){
00201 hTimestamp->Fill(timeSec+(1e-9)*timeNanoSec);
00202 cout<<"seconds="<<timeSec<<", nano="<<timeNanoSec
00203 <<", sum="<<timeSec+(1e-9)*timeNanoSec
00204 <<endl;
00205 }
00206 }
00207
00208
00209
00210
00211
00212 cTimestamp->Update();
00213
00214 return result;
00215 }
00216
00217
00218
00219 void LISummaryAnalyser::EndJob()
00220 {
00221
00222 }
00223
00224