BCkovReco Class Reference

#include <BCkovReco.h>

Inheritance diagram for BCkovReco:

JobCModule CfgObserver List of all members.

Public Member Functions

 BCkovReco (const char *version)
 ~BCkovReco ()
void NewRun (int run, int subrun)
void EndRun (int run, int subrun)
JobCResult Reco (EDMEventHandle &evt)
void Update (const CfgConfig &c)

Private Member Functions

void FillHitHistos ()
void FillPIDHistos (unsigned short trigword)
void InitAnglesAndCombos ()
 Initialize predicted Cherenkov angles for each particle in each counter, and based on that, make appropriate combinations for particle ID's.
void MakeHistos ()
void MakeHit ()
 Group all information (ADC & 2 groups of TDC) into BCkovHit object.
bool MakePID ()
bool MakeTDCPID ()
 Makes particle ID exclusively based on TDC hits.

Private Attributes

BCkovCalibTablefCalib
BCkovResTablefResponse
CMapTOFfMapTOF
TrigCalibfTrigCalib
float fNsPerTDC
double fCkovAngle [2][PIDDef::kNPID]
 Predicted cherenkov angle.
double fCkovAngleSig [2][PIDDef::kNPID]
 Sigma on fCkovAngle.
short fOffsetTDC [PIDDef::kNPID]
 TDC Offset for LRS2229 TDC's.
short fIdealCombo [PIDDef::kNPID]
 Ideal PMT combo with 100% efficiency.
const T0TimefT0Time
const TrigT0fTrigT0
const BCKOVDigitfDigit [BCkov::kNChan]
const TrigChanfTrigChan [BCkov::kNChan]
BCkovHitfHit
RBPIDfPID
TH2F * fHistoTDCVsTrig [BCkov::kNChan]
TH1F * fHistoRaw3377 [BCkov::kNChan]
TH1F * fHistoTime3377 [BCkov::kNChan]
TH1F * fHistoRaw2229 [BCkov::kNChan]
TH1F * fHistoTime2229 [BCkov::kNChan]
TH1F * fHistoPID
TH2F * fHistoTrigVsPID
TH2F * fHistoQVsAngle [BCkov::kNChan]
TH1F * fHistoQ [PIDDef::kNPID][BCkov::kNChan]
int fDebug
int fDoHistos
int fDoResCalib
int fFailIfNoPID
int fUseTDCOnly
float fPCPerADC
 Number of pC per ADC count.
std::string fFolder
 Folder where Hit and PID are written to.
float fThresholdAngle [2]
 Threshold radiation angles for 2 counters.
float fKaonThresholdAngleShift
 Upstream counter correction for Kaon.
float fBeamComposition [PIDDef::kNPID]
 Fraction of each particle species.
float fMinTime
float fMaxTime

Detailed Description

Definition at line 29 of file BCkovReco.h.


Constructor & Destructor Documentation

BCkovReco::BCkovReco ( const char *  version  ) 

Definition at line 36 of file BCkovReco.cxx.

References JobCModule::CheckInit(), fDoHistos, fOffsetTDC, MakeHistos(), and JobCModule::SetCfgVersion().

00036                                         :
00037   JobCModule("BCkovReco"),
00038   fCalib(BCkovCalibTable::Instance()),
00039   fResponse(BCkovResTable::Instance()),
00040   fMapTOF(CMapTOF::Instance()),
00041   fTrigCalib(TrigCalib::Instance()),
00042   fHit(0),
00043   fPID(0),
00044   fDebug(0),
00045   fPCPerADC(0)
00046 {
00047   SetCfgVersion(version);
00048   CheckInit();
00049 
00050   // Initialize default TDC offsets. TODO: extract them from DB table
00051   // or something of that order
00052   fOffsetTDC[0] = 1000;
00053   fOffsetTDC[1] = 1100;
00054   fOffsetTDC[2] =  920;
00055   fOffsetTDC[3] = 1030;
00056 
00057   if (fDoHistos) MakeHistos();
00058 }

BCkovReco::~BCkovReco (  ) 

Definition at line 62 of file BCkovReco.cxx.

00063 {
00064 }


Member Function Documentation

void BCkovReco::EndRun ( int  run,
int  subrun 
) [virtual]

Reimplemented from JobCModule.

Definition at line 513 of file BCkovReco.cxx.

References fCalib, fDoResCalib, fHistoQ, fIdealCombo, fResponse, BCkov::kNChan, PIDDef::kNPID, BCkovCalibTable::Ped(), BCkovResTable::Reset(), BCkovResTable::Set(), BCkovResTable::SetRunRange(), and BCkovResTable::WriteToDB().

00514 {
00515   if (!fDoResCalib) return;
00516 
00517   fResponse.Reset();
00518 
00519   TF1 fitFu("powExp", "pow(x / [2], [1]) * exp([0] - x / [2])", 0, 256);
00520 
00521   for (int i = 0; i < PIDDef::kNPID; ++i) {
00522     for (int j = 0; j < BCkov::kNChan; ++j) {
00523       if (fHistoQ[i][j]->GetEntries() < 100) continue;
00524 
00525       if (fIdealCombo[i] & (1 << j)) {
00526     // We should have signal, so try fitting a power*exponent
00527     while (fHistoQ[i][j]->GetMaximum() < 10) fHistoQ[i][j]->Rebin();
00528 
00529     fitFu.SetParameter(0, 0);
00530     fitFu.SetParameter(1, 2);
00531     fitFu.SetParameter(2, 2);
00532     fHistoQ[i][j]->Fit(&fitFu, "", "");
00533       }
00534       else { 
00535     // There should be pedestal only, so use 1/2 of ped RMS for sigma
00536     fResponse.Set(i, j, 0, 0, fCalib.Ped(j) * 0.5);
00537       }
00538     }
00539   }
00540 
00541   fResponse.SetRunRange(run, run);
00542   fResponse.WriteToDB();
00543 }

void BCkovReco::FillHitHistos (  )  [private]

Definition at line 136 of file BCkovReco.cxx.

References fDigit, fDoHistos, fHistoRaw2229, fHistoRaw3377, fHistoTDCVsTrig, fHistoTime2229, fHistoTime3377, fHit, Fill(), fMapTOF, fOffsetTDC, fTrigChan, fTrigT0, TrigChan::GetNHit(), TrigChan::GetTime(), TrigT0::GetTime(), CMapTOF::kBCkovOffset, BCkov::kNChan, CMapTOF::TDCBinSize(), and BCkovHit::Time().

Referenced by Reco().

00137 {
00138   if (!fDoHistos) return;
00139 
00140   for (int i = 0; i < BCkov::kNChan; ++i) {
00141     if (fDigit[i] && fTrigChan[i] && (fTrigChan[i]->GetNHit() > 0)) {
00142       int tdc2 = fDigit[i]->TDC() - fOffsetTDC[i];
00143       double t = tdc2;
00144       t *= fMapTOF.TDCBinSize(CMapTOF::kBCkovOffset + 1 + i) * 1e-3;
00145       fHistoRaw2229[i]->Fill(t);
00146       fHistoTime2229[i]->Fill(fHit->Time(i));
00147       for (int j = 0; j < fTrigChan[i]->GetNHit(); ++j) {
00148     fHistoTDCVsTrig[i]->Fill(fTrigT0->GetTime(), 
00149                  fTrigChan[i]->GetTime(j));
00150     fHistoRaw3377[i]->Fill(fTrigChan[i]->GetTime(j));
00151     fHistoTime3377[i]->Fill(fHit->Time(i, j));
00152       }
00153     }
00154   }
00155 }

void BCkovReco::FillPIDHistos ( unsigned short  trigword  )  [private]

Definition at line 159 of file BCkovReco.cxx.

References BCkovHit::Charge(), fCkovAngle, fDoHistos, fHistoPID, fHistoQ, fHistoQVsAngle, fHistoTrigVsPID, fHit, Fill(), fPID, BCkov::kNChan, PIDDef::kUndef, and RBPID::PID().

Referenced by Reco().

00159                                                      {
00160   if (!fDoHistos) return;
00161 
00162   // Fill in PID histograms
00163   fHistoPID->Fill(fPID->PID());
00164 
00165   for (int i = 0; i < 16; ++i) {
00166     if (trigword & (1 << i)) fHistoTrigVsPID->Fill(fPID->PID(), i);
00167   }
00168 
00169   for (int i = 0; i < BCkov::kNChan; ++i) {
00170     fHistoQ[fPID->PID()][i]->Fill(fHit->Charge(i));
00171     if (fPID->PID() != PIDDef::kUndef) {
00172       fHistoQVsAngle[i]->Fill(fCkovAngle[i / 2][fPID->PID()] * 1e3, 
00173                   fHit->Charge(i));
00174     }
00175   }
00176 }

void BCkovReco::InitAnglesAndCombos (  )  [private]

Initialize predicted Cherenkov angles for each particle in each counter, and based on that, make appropriate combinations for particle ID's.

E.g. under "normal" secondary beam conditions, e,mu,pi would be 1010 (binary) K would be 1001 p would be 0100 That is, combo bits from 0 to 3 are upstream inner, upstream outer, downstream inner, downstream outer.

Definition at line 203 of file BCkovReco.cxx.

References RIBCkov::ComputeAngle(), RIBCkov::Counter(), fCkovAngle, fCkovAngleSig, fDebug, fIdealCombo, fKaonThresholdAngleShift, fThresholdAngle, RIBCkov::kNCounter, PIDDef::kNPID, PIDDef::PartMass(), and PIDDef::PartName().

Referenced by NewRun().

00204 {
00205   memset(fIdealCombo, 0, sizeof(fIdealCombo));
00206   for (int co = 0; co < RIBCkov::kNCounter; ++co) {
00207     RIBCkov& counter = RIBCkov::Counter(co);
00208     for (int part = 0; part < PIDDef::kNPID; ++part) {
00209       counter.ComputeAngle(PIDDef::PartMass(part),
00210                fCkovAngle[co][part],
00211                fCkovAngleSig[co][part]);
00212 
00213       if (fDebug) {
00214     cout << counter.Name() << " " << PIDDef::PartName(part)
00215          << " angle: "
00216          << fCkovAngle[co][part] * 1e3 << " +/- "
00217          << fCkovAngleSig[co][part] * 1e3
00218          << " mrad" << endl;
00219       }
00220 
00221       // Check if the particle radiates
00222       if (fCkovAngle[co][part] < 1e-4) continue; 
00223 
00224       // Subtract fKaonThresholdAngleShift from the angle for
00225       // Kaons in the upstream counter
00226       if(co == 0 && part == 3) 
00227     fCkovAngle[co][part] -= fKaonThresholdAngleShift;
00228 
00229       if (fCkovAngle[co][part] > fThresholdAngle[co]) {
00230     // Set that the outer PMT should be hit
00231     fIdealCombo[part] |= (2 << (co*2));
00232       }
00233       else {
00234     // Set that the inner PMT should be hit
00235     fIdealCombo[part] |= (1 << (co*2));
00236       }
00237     }
00238   }
00239 
00240   if (fDebug) {
00241     for (int i = 0; i < PIDDef::kNPID; ++i) {
00242       cout << "Ideal " << PIDDef::PartName(i) << " combo: "
00243        << fIdealCombo[i] << endl;
00244     }
00245   }
00246 }

void BCkovReco::MakeHistos (  )  [private]

Definition at line 68 of file BCkovReco.cxx.

References BCkov::ChanName(), fHistoPID, fHistoQ, fHistoQVsAngle, fHistoRaw2229, fHistoRaw3377, fHistoTDCVsTrig, fHistoTime2229, fHistoTime3377, fHistoTrigVsPID, BCkov::kNChan, PIDDef::kNPID, name, PIDDef::PartName(), and BCkov::ShortName().

Referenced by BCkovReco().

00069 {
00070   char name[256], title[256];
00071   for (int i = 0; i < BCkov::kNChan; ++i) {
00072     sprintf(name, "%s_Time3377", BCkov::ShortName(i));
00073     sprintf(title, "Distribution of %s corrected hit times from LRS3377", 
00074         BCkov::ChanName(i));
00075     fHistoTime3377[i] = new TH1F(name, title, 201, -50.25, 50.25);
00076     fHistoTime3377[i]->SetXTitle("Corrected Time (ns)");
00077 
00078     sprintf(name, "%s_Raw3377", BCkov::ShortName(i));
00079     sprintf(title, "Distribution of %s raw hit times from LRS3377", 
00080         BCkov::ChanName(i));
00081     fHistoRaw3377[i] = new TH1F(name, title, 201, -50.25, 50.25);
00082     fHistoRaw3377[i]->SetXTitle("Raw Time (ns)");
00083 
00084     sprintf(name, "%s_Time2229", BCkov::ShortName(i));
00085     sprintf(title, "Distribution of %s corrected hit times from LRS2229", 
00086         BCkov::ChanName(i));
00087     fHistoTime2229[i] = new TH1F(name, title, 401, -12.03, 12.03);
00088     fHistoTime2229[i]->SetXTitle("Corrected Time (ns)");
00089 
00090     sprintf(name, "%s_Raw2229", BCkov::ShortName(i));
00091     sprintf(title, "Distribution of %s raw hit times from LRS2229", 
00092         BCkov::ChanName(i));
00093     fHistoRaw2229[i] = new TH1F(name, title, 401, -12.03, 12.03);
00094     fHistoRaw2229[i]->SetXTitle("Raw Time (ns)");
00095 
00096     sprintf(name, "%s_TDCVsTrig", BCkov::ShortName(i));
00097     sprintf(title, "Correlation of trigger time and %s raw time",
00098         BCkov::ChanName(i));
00099     fHistoTDCVsTrig[i] = new TH2F(name, title, 201, -50.25, 50.52,
00100                   201, -50.25, 50.25);
00101     fHistoTDCVsTrig[i]->SetXTitle("Trig time (ns)");
00102     fHistoTDCVsTrig[i]->SetYTitle("Hit time (ns)");
00103 
00104     sprintf(name, "%s_QVsAngle", BCkov::ShortName(i));
00105     sprintf(title, "%s integrated charge vs predicted Cherenkov angle", 
00106         BCkov::ChanName(i));
00107     fHistoQVsAngle[i] = new TH2F(name, title, 50, 0, 50, 100, 0, 200);
00108     fHistoQVsAngle[i]->SetXTitle("Angle (mrad)");
00109     fHistoQVsAngle[i]->SetYTitle("Charge (pc)");
00110 
00111     for (int j = 0; j < PIDDef::kNPID; ++j) {
00112       sprintf(name, "%s_Q%d", BCkov::ShortName(i), j);
00113       sprintf(title, "%s charge on %s ID", BCkov::ShortName(i),
00114           PIDDef::PartName(j));
00115       fHistoQ[j][i] = new TH1F(name, title, 256, -6, 250);
00116       fHistoQ[j][i]->SetXTitle("Charge (pc)");
00117     }
00118   }
00119 
00120   fHistoPID = new TH1F("BCkovPID", "Particle ID based on Beam Cherenkov",
00121                PIDDef::kNPID, 0, PIDDef::kNPID);
00122   for (int i = 0; i < PIDDef::kNPID; ++i) {
00123     fHistoPID->GetXaxis()->SetBinLabel(i + 1, PIDDef::PartName(i));
00124   }
00125 
00126   fHistoTrigVsPID = new TH2F("TrigVsPID", "Trigger bit vs particle ID",
00127                  PIDDef::kNPID, 0, PIDDef::kNPID, 16, 0, 16);
00128   fHistoTrigVsPID->SetYTitle("Trigger bit that fired event");
00129   for (int i = 0; i < PIDDef::kNPID; ++i) {
00130     fHistoTrigVsPID->GetXaxis()->SetBinLabel(i + 1, PIDDef::PartName(i));
00131   }
00132 }

void BCkovReco::MakeHit (  )  [private]

Group all information (ADC & 2 groups of TDC) into BCkovHit object.

Definition at line 365 of file BCkovReco.cxx.

References BCkovHit::Charge(), fCalib, fDebug, fHit, fNsPerTDC, fPCPerADC, fT0Time, T0Time::GetTime(), BCkovHit::InitChan(), BCkov::kNChan, BCkovHit::Mult(), BCkovCalibTable::Ped(), BCkov::ShortName(), BCkovHit::Time(), and BCkovCalibTable::TOffset().

Referenced by Reco().

00366 {
00367   if (!fHit) fHit = new BCkovHit;
00368 
00369   float charge;
00370   float t;
00371 
00372   for (int chan = 0; chan < BCkov::kNChan; ++chan) {
00373     // Extract information from the digit
00374 
00375     if (fDigit[chan]) {
00376       charge = fDigit[chan]->ADC() - fCalib.Ped(chan);
00377       charge *= fPCPerADC;
00378 
00379       t = fDigit[chan]->TDC();
00380       if (t > 0 && t < 2000) {
00381     // Get the hit time in ns
00382     t *= fNsPerTDC;
00383     t -= fCalib.TOffset(chan);
00384     t -= fT0Time->GetTime();
00385 
00386 
00387       }
00388       else t = 1e9;
00389     }
00390     else {
00391       charge = 0;
00392       t = 1e9;
00393     }
00394 
00395 
00396     fHit->InitChan(chan, charge, t, fTrigChan[chan]);
00397   }
00398 
00399   if (fDebug) {
00400     for (int chan = 0; chan < BCkov::kNChan; ++chan) {
00401       cout << BCkov::ShortName(chan) << ": t = " << fHit->Time(chan)
00402        << "; q = " << fHit->Charge(chan)
00403        << " t[" << fHit->Mult(chan) << "] = ";
00404       
00405       for (int i = 0; i < fHit->Mult(chan); ++i) {
00406     cout << fHit->Time(chan, i) << " ";
00407       }
00408       cout << endl;
00409     }
00410   }
00411 }

bool BCkovReco::MakePID (  )  [private]

Definition at line 415 of file BCkovReco.cxx.

References fPID, fUseTDCOnly, PIDDef::kBCkov, MakeTDCPID(), RBPID::SetDetId(), and RBPID::SetTrkId().

Referenced by Reco().

00416 {
00417   if (!fPID) fPID = new RBPID;
00418   fPID->SetDetId(PIDDef::kBCkov);
00419   fPID->SetTrkId(0);
00420   
00421   if (fUseTDCOnly) return MakeTDCPID();
00422 
00423   return false;
00424 }

bool BCkovReco::MakeTDCPID (  )  [private]

Makes particle ID exclusively based on TDC hits.

Definition at line 429 of file BCkovReco.cxx.

References fBeamComposition, fDebug, fHit, fIdealCombo, fMaxTime, fMinTime, fPID, BCkov::kNChan, PIDDef::kNPID, PIDDef::kUndef, BCkovHit::Mult(), RBPID::SetLL(), and BCkovHit::Time().

Referenced by MakePID().

00430 {
00431   short combo2229 = 0;
00432   short combo3377 = 0;
00433   for (int chan = 0; chan < BCkov::kNChan; ++chan) {
00434     // Make sure that LRS2229 TDC hit is either totally out of range
00435     // or within our accepted time window
00436     if (fabs(fHit->Time(chan)) < 100) {
00437       if (fHit->Time(chan) < fMinTime || fHit->Time(chan) > fMaxTime) {
00438     // This is a valid hit, but it's out of time
00439     if (fDebug) {
00440       cout << "BCkovReco: Invalid hit in LRS2229 channel " 
00441            << chan << ": time = " << fHit->Time(chan) << endl;
00442     }
00443     return false;
00444       }
00445       combo2229 |= (1 << chan);
00446     }
00447 
00448     // Now check for acceptable hits in LRS3377 data
00449     for (int i = 0; i < fHit->Mult(chan); ++i) {
00450       if (fHit->Time(chan, i) >= fMinTime && 
00451       fHit->Time(chan, i) < fMaxTime) {
00452     combo3377 |= (1 << chan);
00453     break;
00454       }
00455     }
00456   }
00457 
00458   // If the two combinations are different, then we are likely to have
00459   // pileup or otherwise "bad" event
00460   if (combo2229 != combo3377) {
00461     if (fDebug) {
00462       cout << "BCkovReco: combo3377 = " << combo3377 << ", combo2229 = "
00463        << combo2229 << endl;
00464       return false;
00465     }
00466   }
00467 
00468   // Now assign PID's based on beam composition and the combination
00469   // that we calculated
00470   bool setId = false;
00471   for (int i = 0; i < PIDDef::kNPID; ++i) {
00472     if (fIdealCombo[i] == combo2229) {
00473       fPID->SetLL(i, fBeamComposition[i]);
00474       setId = true;
00475     }
00476     else fPID->SetLL(i, 0);
00477   }
00478   if (!setId) fPID->SetLL(PIDDef::kUndef, 1);
00479 
00480   return true;
00481 }

void BCkovReco::NewRun ( int  run,
int  subrun 
) [virtual]

Reimplemented from JobCModule.

Definition at line 180 of file BCkovReco.cxx.

References fCalib, fMapTOF, fNsPerTDC, fTrigCalib, RIBCkov::Init(), TrigCalib::Init(), CMapTrig::Init(), CMapTOF::Init(), BCkovCalibTable::Init(), InitAnglesAndCombos(), CMapTOF::kBCkovOffset, RIMCConfig::kMCRunOffset, and CMapTOF::TDCBinSize().

00181 {
00182   fCalib.Init(run);
00183   fMapTOF.Init(run%RIMCConfig::kMCRunOffset, false);
00184   CMapTrig::Init(run);
00185   fTrigCalib.Init(run);
00186 
00187   RIBCkov::Init(run);
00188 
00189   InitAnglesAndCombos();
00190   fNsPerTDC = fMapTOF.TDCBinSize(CMapTOF::kBCkovOffset + 1) * 1e-3;
00191 }

JobCResult BCkovReco::Reco ( EDMEventHandle evt  )  [virtual]

Reimplemented from JobCModule.

Definition at line 250 of file BCkovReco.cxx.

References EDMEventHandle::Cal(), EDMTriggerId::CalibTrig(), EDMTriggerId::EoSTrig(), EDMEventHeader::Event(), fDebug, fDigit, fFolder, fHit, FillHitHistos(), FillPIDHistos(), fPID, fT0Time, fTrigChan, fTrigT0, EDMDataBucket::Get(), EDMDataBucket::GetFolder(), TrigT0::GetTime(), T0Time::GetTime(), EDMEventHandle::Header(), CMapTrig::kBCKVdo, CMapTrig::kBCKVui, JobCModule::kFailed, BCkov::kNChan, JobCModule::kPassed, LatchWord::kPrescaled, EDMDataBucket::MakeFolder(), MakeHit(), MakePID(), EDMDataBucket::Put(), EDMEventHandle::Raw(), EDMEventHandle::Reco(), and EDMEventHeader::TriggerId().

00251 {
00252   // Skip end of spill triggers
00253   if (evt.Header().TriggerId().EoSTrig() ||
00254       evt.Header().TriggerId().CalibTrig()) return kFailed;
00255   
00256   memset(fDigit, 0, sizeof(fDigit));
00257   memset(fTrigChan, 0, sizeof(fTrigChan));
00258 
00259   int nDigit = 0;
00260   int nInput = 0;
00261 
00262   // Find trigger T0 object
00263   try {
00264     vector<const TrigT0*> t0list(0);
00265     evt.Cal().Get("/trig", t0list);
00266     if (!t0list.empty()) fTrigT0 = t0list[0];
00267   }
00268   catch (...) { }
00269 
00270   // Find T0Time object
00271   try {
00272     vector<const T0Time*> t0time(0);
00273     evt.Reco().Get("/t0", t0time);
00274     if (!t0time.empty()) {
00275       fT0Time = t0time[0];
00276 
00277       if (fDebug) {
00278     cout << "********** Event " << evt.Header().Event()
00279          << " T0 = " << fT0Time->GetTime() << " / ";
00280     if (fTrigT0) cout << fTrigT0->GetTime();
00281     else cout << "NONE";
00282     cout << " **********" << endl;
00283       }
00284     }
00285     else if (fDebug) cout << "BCkovReco: no T0 time object found" << endl;
00286   }
00287   catch (...) { }
00288 
00289   // Find BCkov digits (ADC and fine TDC signals)
00290   try { 
00291     vector<const BCKOVDigit*> digList(0);
00292     evt.Raw().Get("/bckov", digList); 
00293 
00294     vector<const BCKOVDigit*>::iterator itr(digList.begin());
00295     vector<const BCKOVDigit*>::iterator itrEnd(digList.end());
00296     for ( ; itr != itrEnd; ++itr) {
00297       const BCKOVDigit* dig = *itr;
00298       int chan = dig->Channel() - 1;
00299 
00300       if (chan < 0 || chan >= BCkov::kNChan) {
00301     cout << "BCkovReco: skipping invalid digit from channel "
00302          << dig->Channel() << endl;
00303     continue;
00304       }
00305       nDigit++;
00306       fDigit[chan] = dig;
00307     }
00308   }
00309   catch (...) { 
00310     if (fDebug) cout << "No BCKOVDigit's found" << endl;
00311   }
00312 
00313   // Find BCkov trigger input TDC signals
00314   try {
00315     vector<const TrigChan*> trigList(0);
00316     evt.Cal().Get("/trig", trigList);
00317 
00318     if (trigList.size() >= CMapTrig::kBCKVdo) {
00319       for ( ; nInput < 4; ++nInput) {
00320     fTrigChan[nInput] = trigList[CMapTrig::kBCKVui + nInput];
00321       }
00322     }
00323   }
00324   catch (...) {}
00325 
00326   if (nDigit == 0 && nInput == 0) return kFailed;
00327 
00328   if (fDebug) {
00329     cout << "BCkovReco: have " << nDigit << " digits and " << nInput
00330      << " trigger inputs" << endl;
00331 //     cout << "T0Time: " << fT0Time->GetTime() << ", trig t0: " 
00332 //   << fTrigT0->GetTime() << endl;
00333   }
00334 
00335   MakeHit();
00336   FillHitHistos();
00337 
00338   if (!evt.Reco().GetFolder(fFolder.c_str())) {
00339     evt.Reco().MakeFolder(fFolder.c_str());
00340   }
00341   evt.Reco().Put(*fHit, fFolder.c_str());
00342 
00343   if (!MakePID()) {
00344     if (fDebug) cout << "BCkovReco: couldn't make PID" << endl;
00345     return kFailed;
00346   }
00347   evt.Reco().Put(*fPID, fFolder.c_str());
00348 
00349   vector<const LatchWord*> latch(0);
00350   try {
00351     evt.Raw().Get("/trig", latch);
00352     if (!latch.empty()) {
00353       FillPIDHistos(latch[LatchWord::kPrescaled]->GetWord());
00354     }
00355   }
00356   catch (...) {}
00357 
00358 
00359   return kPassed;
00360 }

void BCkovReco::Update ( const CfgConfig c  )  [virtual]

Implements CfgObserver.

Definition at line 485 of file BCkovReco.cxx.

References fBeamComposition, fDebug, fDoHistos, fDoResCalib, fFailIfNoPID, fFolder, JobCModule::fIsInit, fKaonThresholdAngleShift, fMaxTime, fMinTime, fPCPerADC, fThresholdAngle, fUseTDCOnly, and PIDDef::kNPID.

00486 {
00487   c("Debug").Get(fDebug);
00488   c("DoHistos").Get(fDoHistos);
00489   c("DoResCalib").Get(fDoResCalib);
00490   c("FailIfNoPID").Get(fFailIfNoPID);
00491   c("UseTDCOnly").Get(fUseTDCOnly);
00492   c("PCPerADC").Get(fPCPerADC);
00493   c("Folder").Get(fFolder);
00494   c("MinTime").Get(fMinTime);
00495   c("MaxTime").Get(fMaxTime);
00496   c("KaonThresholdAngleShift").Get(fKaonThresholdAngleShift);
00497 
00498   vector<float> vec;
00499   c("ThresholdAngle").Get(vec);
00500   assert(vec.size() == 2);
00501   for (int i = 0; i < 2; ++i) fThresholdAngle[i] = vec[i];
00502   
00503   vec.clear();
00504   c("BeamComposition").Get(vec);
00505   assert(vec.size() == PIDDef::kNPID);
00506   for (int i = 0; i < PIDDef::kNPID; ++i) fBeamComposition[i] = vec[i];
00507 
00508   fIsInit = true;
00509 }


Member Data Documentation

float BCkovReco::fBeamComposition[PIDDef::kNPID] [private]

Fraction of each particle species.

Definition at line 88 of file BCkovReco.h.

Referenced by MakeTDCPID(), and Update().

BCkovCalibTable& BCkovReco::fCalib [private]

Definition at line 50 of file BCkovReco.h.

Referenced by EndRun(), MakeHit(), and NewRun().

double BCkovReco::fCkovAngle[2][PIDDef::kNPID] [private]

Predicted cherenkov angle.

Definition at line 56 of file BCkovReco.h.

Referenced by FillPIDHistos(), and InitAnglesAndCombos().

double BCkovReco::fCkovAngleSig[2][PIDDef::kNPID] [private]

Sigma on fCkovAngle.

Definition at line 57 of file BCkovReco.h.

Referenced by InitAnglesAndCombos().

int BCkovReco::fDebug [private]

Definition at line 79 of file BCkovReco.h.

Referenced by InitAnglesAndCombos(), MakeHit(), MakeTDCPID(), Reco(), and Update().

const BCKOVDigit* BCkovReco::fDigit[BCkov::kNChan] [private]

Definition at line 63 of file BCkovReco.h.

Referenced by FillHitHistos(), and Reco().

int BCkovReco::fDoHistos [private]

Definition at line 80 of file BCkovReco.h.

Referenced by BCkovReco(), FillHitHistos(), FillPIDHistos(), and Update().

int BCkovReco::fDoResCalib [private]

Definition at line 81 of file BCkovReco.h.

Referenced by EndRun(), and Update().

int BCkovReco::fFailIfNoPID [private]

Definition at line 82 of file BCkovReco.h.

Referenced by Update().

std::string BCkovReco::fFolder [private]

Folder where Hit and PID are written to.

Definition at line 85 of file BCkovReco.h.

Referenced by Reco(), and Update().

TH1F* BCkovReco::fHistoPID [private]

Definition at line 74 of file BCkovReco.h.

Referenced by FillPIDHistos(), and MakeHistos().

TH1F* BCkovReco::fHistoQ[PIDDef::kNPID][BCkov::kNChan] [private]

Definition at line 77 of file BCkovReco.h.

Referenced by EndRun(), FillPIDHistos(), and MakeHistos().

TH2F* BCkovReco::fHistoQVsAngle[BCkov::kNChan] [private]

Definition at line 76 of file BCkovReco.h.

Referenced by FillPIDHistos(), and MakeHistos().

TH1F* BCkovReco::fHistoRaw2229[BCkov::kNChan] [private]

Definition at line 72 of file BCkovReco.h.

Referenced by FillHitHistos(), and MakeHistos().

TH1F* BCkovReco::fHistoRaw3377[BCkov::kNChan] [private]

Definition at line 70 of file BCkovReco.h.

Referenced by FillHitHistos(), and MakeHistos().

TH2F* BCkovReco::fHistoTDCVsTrig[BCkov::kNChan] [private]

Definition at line 69 of file BCkovReco.h.

Referenced by FillHitHistos(), and MakeHistos().

TH1F* BCkovReco::fHistoTime2229[BCkov::kNChan] [private]

Definition at line 73 of file BCkovReco.h.

Referenced by FillHitHistos(), and MakeHistos().

TH1F* BCkovReco::fHistoTime3377[BCkov::kNChan] [private]

Definition at line 71 of file BCkovReco.h.

Referenced by FillHitHistos(), and MakeHistos().

TH2F* BCkovReco::fHistoTrigVsPID [private]

Definition at line 75 of file BCkovReco.h.

Referenced by FillPIDHistos(), and MakeHistos().

BCkovHit* BCkovReco::fHit [private]

Definition at line 66 of file BCkovReco.h.

Referenced by FillHitHistos(), FillPIDHistos(), MakeHit(), MakeTDCPID(), and Reco().

short BCkovReco::fIdealCombo[PIDDef::kNPID] [private]

Ideal PMT combo with 100% efficiency.

Definition at line 59 of file BCkovReco.h.

Referenced by EndRun(), InitAnglesAndCombos(), and MakeTDCPID().

float BCkovReco::fKaonThresholdAngleShift [private]

Upstream counter correction for Kaon.

Definition at line 87 of file BCkovReco.h.

Referenced by InitAnglesAndCombos(), and Update().

CMapTOF& BCkovReco::fMapTOF [private]

Definition at line 52 of file BCkovReco.h.

Referenced by FillHitHistos(), and NewRun().

float BCkovReco::fMaxTime [private]

Definition at line 90 of file BCkovReco.h.

Referenced by MakeTDCPID(), and Update().

float BCkovReco::fMinTime [private]

Definition at line 89 of file BCkovReco.h.

Referenced by MakeTDCPID(), and Update().

float BCkovReco::fNsPerTDC [private]

Definition at line 54 of file BCkovReco.h.

Referenced by MakeHit(), and NewRun().

short BCkovReco::fOffsetTDC[PIDDef::kNPID] [private]

TDC Offset for LRS2229 TDC's.

Definition at line 58 of file BCkovReco.h.

Referenced by BCkovReco(), and FillHitHistos().

float BCkovReco::fPCPerADC [private]

Number of pC per ADC count.

Definition at line 84 of file BCkovReco.h.

Referenced by MakeHit(), and Update().

RBPID* BCkovReco::fPID [private]

Definition at line 67 of file BCkovReco.h.

Referenced by FillPIDHistos(), MakePID(), MakeTDCPID(), and Reco().

BCkovResTable& BCkovReco::fResponse [private]

Definition at line 51 of file BCkovReco.h.

Referenced by EndRun().

const T0Time* BCkovReco::fT0Time [private]

Definition at line 61 of file BCkovReco.h.

Referenced by MakeHit(), and Reco().

float BCkovReco::fThresholdAngle[2] [private]

Threshold radiation angles for 2 counters.

Definition at line 86 of file BCkovReco.h.

Referenced by InitAnglesAndCombos(), and Update().

TrigCalib& BCkovReco::fTrigCalib [private]

Definition at line 53 of file BCkovReco.h.

Referenced by NewRun().

const TrigChan* BCkovReco::fTrigChan[BCkov::kNChan] [private]

Definition at line 64 of file BCkovReco.h.

Referenced by FillHitHistos(), and Reco().

const TrigT0* BCkovReco::fTrigT0 [private]

Definition at line 62 of file BCkovReco.h.

Referenced by FillHitHistos(), and Reco().

int BCkovReco::fUseTDCOnly [private]

Definition at line 83 of file BCkovReco.h.

Referenced by MakePID(), and Update().


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 08:03:57 2009 for MIPP(E907) by  doxygen 1.4.7