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

Public Member Functions | |
| LIRawNt () | |
| JobCResult | Ana (const MomNavigator *mom) |
| void | EndJob () |
| void | HandleCommand (JobCommand *cmd) |
Private Attributes | |
| TTree * | fLIRawNt |
| TFile * | outFile |
| PlexHandle * | fPlex |
| Int_t | nt_run |
| Int_t | nt_snarl |
| Int_t | nt_timesec |
| Int_t | nt_timenanosec |
| Int_t | nt_errcode |
| Int_t | nt_crate |
| Int_t | nt_varc |
| Int_t | nt_vmm |
| Int_t | nt_vaadc |
| Int_t | nt_vachip |
| Int_t | nt_vachannel |
| Int_t | nt_pixel |
| Int_t | nt_adc |
| Int_t | nt_tdc |
| Int_t | nt_readouttype |
| Short_t | nt_pbox |
| Short_t | nt_pboxopp |
| Short_t | nt_led [nStripPerPixel] |
| Short_t | nt_ledopp [nStripPerPixel] |
| Float_t | record |
Static Private Attributes | |
| static const int | nStripPerPixel = 8 |
Definition at line 11 of file LIRawNt.h.
| LIRawNt::LIRawNt | ( | ) |
Definition at line 28 of file LIRawNt.cxx.
References count, fLIRawNt, Form(), nt_adc, nt_crate, nt_errcode, nt_led, nt_ledopp, nt_pbox, nt_pboxopp, nt_pixel, nt_readouttype, nt_run, nt_snarl, nt_tdc, nt_timenanosec, nt_timesec, nt_vaadc, nt_vachannel, nt_vachip, nt_varc, nt_vmm, and outFile.
00029 : fPlex(0) 00030 { 00031 outFile=0; 00032 string sBase = "liraw"; 00033 string sFileName=sBase+".root"; 00034 ifstream test(sFileName.c_str()); 00035 if(!test){ 00036 outFile = new TFile(sFileName.c_str(),"RECREATE"); 00037 } 00038 else{ 00039 Int_t count=1; 00040 while(test){ 00041 test.close(); 00042 string sAppen=Form("%d",count); 00043 sFileName=sBase+"_"+sAppen+".root"; 00044 test.open(sFileName.c_str()); 00045 ++count; 00046 } 00047 outFile=new TFile(sFileName.c_str(),"NEW"); 00048 } 00049 00050 fLIRawNt = new TTree("liraw", "liraw"); 00051 fLIRawNt -> Branch("run", &nt_run, "run/I"); 00052 fLIRawNt -> Branch("snarl", &nt_snarl, "snarl/I"); 00053 fLIRawNt -> Branch("timesec", &nt_timesec, "timesec/I"); 00054 fLIRawNt -> Branch("timenanosec", &nt_timenanosec, "timenanosec/I"); 00055 fLIRawNt -> Branch("errcode", &nt_errcode, "errcode/I"); 00056 fLIRawNt -> Branch("crate", &nt_crate, "crate/I1"); 00057 fLIRawNt -> Branch("varc", &nt_varc, "varc/I1"); 00058 fLIRawNt -> Branch("vmm", &nt_vmm, "vmm/I1"); 00059 fLIRawNt -> Branch("vaadc", &nt_vaadc, "vaadc/I1"); 00060 fLIRawNt -> Branch("vachip", &nt_vachip, "vachip/I1"); 00061 fLIRawNt -> Branch("vachannel", &nt_vachannel, "vachannel/I1"); 00062 fLIRawNt -> Branch("pixel", &nt_pixel, "pixel/I1"); 00063 fLIRawNt -> Branch("adc", &nt_adc, "adc/I2"); 00064 fLIRawNt -> Branch("tdc", &nt_tdc, "tdc/I"); 00065 fLIRawNt -> Branch("readouttype", &nt_readouttype, "readouttype/I"); 00066 fLIRawNt -> Branch("pbox", &nt_pbox, "pbox/S"); 00067 fLIRawNt -> Branch("pboxopp", &nt_pboxopp, "pboxopp/S"); 00068 fLIRawNt -> Branch("led", nt_led, "led[8]/S"); 00069 fLIRawNt -> Branch("ledopp", nt_ledopp, "led[8]/S"); 00070 00071 }
| JobCResult LIRawNt::Ana | ( | const MomNavigator * | mom | ) | [virtual] |
Implement this for read only access to the MomNavigator
Reimplemented from JobCModule.
Definition at line 73 of file LIRawNt.cxx.
References count, fLIRawNt, fPlex, Detector::GetChannel(), RawChannelId::GetCrate(), DataUtil::GetDetector(), RawChannelId::GetElecType(), PlexLedId::GetLedInBox(), PlexSEIdAltL::GetPlane(), PlexLedId::GetPulserBox(), DataUtil::GetRawHeader(), DataUtil::GetRun(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), DataUtil::GetVldContext(), RawChannelId::GetVmm(), Detector::kCalDet, JobCResult::kFailed, JobCResult::kPassed, ReadoutType::kScintStrip, ElecType::kVA, Msg::kVerbose, Msg::kWarning, MSG, nStripPerPixel, nt_adc, nt_crate, nt_errcode, nt_led, nt_ledopp, nt_pbox, nt_pboxopp, nt_pixel, nt_readouttype, nt_run, nt_snarl, nt_tdc, nt_timenanosec, nt_timesec, nt_vaadc, nt_vachannel, nt_vachip, nt_varc, and nt_vmm.
00073 { 00074 00075 const RawRecord *rawrec = 00076 dynamic_cast<const RawRecord *>(mom -> GetFragment("RawRecord")); 00077 if (!rawrec) { 00078 MSG("LIRawNt", Msg::kWarning) << "No RawRecord in MOM." << endl; 00079 return JobCResult::kFailed; 00080 } 00082 static Int_t count =0; 00084 const VldContext *vldC = rawrec -> GetVldContext(); 00085 if (!(vldC -> IsValid())) { 00086 MSG("LIRawNt", Msg::kWarning) << "Invalid context for RawRecord." << endl; 00087 return JobCResult::kFailed; 00088 } 00089 // if(count<10000){ 00090 ++count; 00091 const Detector::Detector_t detector = vldC -> GetDetector(); 00092 if (fPlex && !(fPlex -> GetVldRange().IsCompatible(vldC))) { 00093 delete fPlex; 00094 } 00095 if (!fPlex) { 00096 fPlex = new PlexHandle(*vldC); 00097 MSG("LIRawNt", Msg::kVerbose) 00098 << "New plex handle; validity" 00099 << " from " << fPlex -> GetVldRange().GetTimeStart().AsString() 00100 << " to " << fPlex -> GetVldRange().GetTimeEnd().AsString() 00101 << endl; 00102 } 00103 00104 const RawDaqSnarlHeader *snarlHdr = 00105 dynamic_cast<const RawDaqSnarlHeader*>(rawrec -> GetRawHeader()); 00106 if (!snarlHdr) { 00107 return JobCResult::kFailed; 00108 } 00109 00110 nt_run = snarlHdr -> GetRun(); 00111 nt_snarl = snarlHdr -> GetSnarl(); 00112 00113 const RawSnarlHeaderBlock *rawsnarlHdrBlock = 00114 dynamic_cast<const RawSnarlHeaderBlock *> 00115 (rawrec -> FindRawBlock("RawSnarlHeaderBlock")); 00116 00117 nt_timesec = -1; 00118 nt_timenanosec = -1; 00119 if (rawsnarlHdrBlock) { 00120 nt_timesec = rawsnarlHdrBlock -> GetTriggerTime().GetSec(); 00121 nt_timenanosec = rawsnarlHdrBlock -> GetTriggerTime().GetNanoSec(); 00122 } 00123 00124 // Remove this? 00125 const RawRecord *rr = 00126 dynamic_cast<RawRecord *>(mom -> GetFragment("RawRecord")); 00127 if (!rr) { 00128 MSG("LIRawNt", Msg::kWarning) << "No RawRecord in MOM." << endl; 00129 return JobCResult::kFailed; 00130 } 00131 00132 // Can this be pulled out from the plex? 00133 const Int_t vach2pixel[18] = 00134 {0, 0, 15, 1, 16, 2, 11, 5, 12, 6, 7, 9, 8, 10, 3, 14, 4, 13}; 00135 00136 TIter rdbit = rr -> GetRawBlockIter(); 00137 TObject *tob; 00138 while ((tob = rdbit())) { 00139 // ++count;// 00140 // cout<<count<<endl; 00141 if(count>10)break;// 00142 if (tob -> InheritsFrom("RawDigitDataBlock")) { 00143 const RawDigitDataBlock *rdb = 00144 dynamic_cast<const RawDigitDataBlock *>(tob); 00145 TIter rdit = rdb -> GetDatumIter(); 00146 const RawDigit *rd = dynamic_cast<const RawDigit *>(rdit()); 00147 while (rd) { 00148 nt_pbox = -1; 00149 nt_pboxopp = -1; 00150 for (Int_t i = 0; i < nStripPerPixel; ++i) { 00151 nt_led[i] = -1; nt_ledopp[i] = -1; 00152 } 00153 const RawChannelId rawid = rd -> GetChannel(); 00154 if (rawid.GetElecType() == ElecType::kVA/*&&count%10==0*/) { 00155 nt_crate = rawid.GetCrate(); 00156 nt_varc = rawid.GetVarcId(); 00157 nt_vmm = rawid.GetVmm(); 00158 nt_vaadc = rawid.GetVaAdcSel(); 00159 nt_vachip = rawid.GetVaChip(); 00160 nt_vachannel = rawid.GetVaChannel(); 00161 nt_pixel = -1; 00162 if ((nt_vachannel >= 2) && (nt_vachannel <= 17)) { 00163 nt_pixel = vach2pixel[nt_vachannel]; 00164 } 00165 nt_errcode = rd -> GetErrorCode(); 00166 nt_adc = rd -> GetADC(); 00167 nt_tdc = rd -> GetTDC(); 00168 nt_readouttype = static_cast<Int_t>(fPlex -> GetReadoutType(rawid)); 00169 if (nt_readouttype == ReadoutType::kScintStrip) { 00170 PlexSEIdAltL stripEndList = fPlex -> GetSEIdAltL(rawid); 00171 Int_t plane = stripEndList.GetPlane(); 00172 if (plane > 485) {} // Ignore shield "planes" 00173 else if (detector == Detector::kCalDet && 00174 plane > 59) {} // Ignore CalDet muon counter 00175 else { 00176 Int_t i = 0; 00177 for (PlexSEIdAltL::iterator it = stripEndList.begin(); 00178 it != stripEndList.end(); 00179 it++) { 00180 PlexStripEndId stripEndId = (*it).GetSEId(); 00181 PlexStripEndId stripEndIdOpp = stripEndId.GetOppositeSEId(); 00182 PlexLedId ledId = fPlex -> GetLedId(stripEndId); 00183 PlexLedId ledIdOpp = fPlex -> GetLedId(stripEndIdOpp); 00184 if (it == stripEndList.begin()) { 00185 nt_pbox = ledId.GetPulserBox(); 00186 nt_pboxopp = ledIdOpp.GetPulserBox(); 00187 } 00188 if (i < nStripPerPixel) { 00189 nt_led[i] = ledId.GetLedInBox(); 00190 nt_ledopp[i] = ledIdOpp.GetLedInBox(); 00191 } 00192 i++; 00193 } 00194 } 00195 } 00196 else {} 00197 // if(count<100000){ 00198 // ++count; 00199 fLIRawNt -> Fill(); 00200 // } 00201 // else{return false;} 00202 } 00203 rd = dynamic_cast<const RawDigit *>(rdit()); 00204 // }// 00205 } 00206 } 00207 } 00208 00209 return JobCResult::kPassed; 00210 }
| void LIRawNt::EndJob | ( | ) | [virtual] |
Implement for notification of end of job
Reimplemented from JobCModule.
Definition at line 229 of file LIRawNt.cxx.
References outFile.
00230 { 00231 //====================================================================== 00232 // At the end of the job print some stuff out and save the histogram 00233 // to a file 00234 //====================================================================== 00235 // fFile->Write(); 00236 outFile->Close(); 00237 }
| void LIRawNt::HandleCommand | ( | JobCommand * | cmd | ) | [virtual] |
Implement to handle a JobCommand
Reimplemented from JobCModule.
Definition at line 215 of file LIRawNt.cxx.
References JobCommand::HaveCmd(), Msg::kWarning, MSG, and JobCommand::PopCmd().
00216 { 00217 //====================================================================== 00218 // Handle a command send from the job controller 00219 // 00220 // Inputs: cmd - The parsed job command 00221 //====================================================================== 00222 if (cmd->HaveCmd()) { // If we have a command... 00223 string sc = cmd->PopCmd(); // Get the command 00224 MSG("LIRawNt",Msg::kWarning) << "Don't understand '" << sc.c_str() << "'\n"; 00225 } 00226 }
TTree* LIRawNt::fLIRawNt [private] |
PlexHandle* LIRawNt::fPlex [private] |
const int LIRawNt::nStripPerPixel = 8 [static, private] |
Int_t LIRawNt::nt_adc [private] |
Int_t LIRawNt::nt_crate [private] |
Int_t LIRawNt::nt_errcode [private] |
Short_t LIRawNt::nt_led[nStripPerPixel] [private] |
Short_t LIRawNt::nt_ledopp[nStripPerPixel] [private] |
Short_t LIRawNt::nt_pbox [private] |
Short_t LIRawNt::nt_pboxopp [private] |
Int_t LIRawNt::nt_pixel [private] |
Int_t LIRawNt::nt_readouttype [private] |
Int_t LIRawNt::nt_run [private] |
Int_t LIRawNt::nt_snarl [private] |
Int_t LIRawNt::nt_tdc [private] |
Int_t LIRawNt::nt_timenanosec [private] |
Int_t LIRawNt::nt_timesec [private] |
Int_t LIRawNt::nt_vaadc [private] |
Int_t LIRawNt::nt_vachannel [private] |
Int_t LIRawNt::nt_vachip [private] |
Int_t LIRawNt::nt_varc [private] |
Int_t LIRawNt::nt_vmm [private] |
TFile* LIRawNt::outFile [private] |
Float_t LIRawNt::record [private] |
1.4.7