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

Public Member Functions | |
| AlgChopListFar () | |
| virtual | ~AlgChopListFar () |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
| virtual void | Trace (const char *c) const |
|
|
Definition at line 44 of file AlgChopListFar.cxx. 00045 {
00046 }
|
|
|
Definition at line 49 of file AlgChopListFar.cxx. 00050 {
00051 }
|
|
||||||||||||||||
|
Set functions are called to load the CandStrip member variables based on the CandDigit members, and the daughter list is filled. Implements AlgBase. Definition at line 58 of file AlgChopListFar.cxx. References CandHandle::AddDaughterLink(), digits(), RawRecord::FindRawBlock(), Form(), CandDigitListHandle::GetAbsTime(), AlgFactory::GetAlgHandle(), CandContext::GetDataIn(), Registry::GetDouble(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), Registry::GetInt(), CandContext::GetMom(), CandDigitList::MakeCandidate(), MSG, CandHandle::SetName(), and NR::sort(). 00061 {
00062 assert(candHandle.InheritsFrom("CandChopListHandle"));
00063 CandChopListHandle &sliceList = dynamic_cast<CandChopListHandle &>(candHandle);
00064
00065 assert(candContext.GetDataIn());
00066 // Check for CandDigitListHandle input
00067 if (!(candContext.GetDataIn()->InheritsFrom("CandDigitListHandle"))) {
00068 MSG("Chop",Msg::kWarning ) << "Data into AlgChopListFar is not a digit list." << std::endl;
00069 }
00070
00071 const CandDigitListHandle *cdlh_ptr =
00072 dynamic_cast<const CandDigitListHandle*>(candContext.GetDataIn());
00073
00074 const MomNavigator *mom = candContext.GetMom();
00075 RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord"));
00076 if (!rr) {
00077 MSG("Chop", Msg::kWarning) << "No RawRecord in MOM." << endl;
00078 return;
00079 }
00080 const RawDigitDataBlock *rddb = dynamic_cast<const RawDigitDataBlock *>
00081 (rr->FindRawBlock("RawDigitDataBlock"));
00082 if (!rddb) {
00083 MSG("Chop", Msg::kWarning) << "No RawDigitDataBlock in RawRecord." << endl;
00084 return;
00085 }
00086
00087 // Get setup for the DigitList maker algorithm
00088 AlgFactory &af = AlgFactory::GetInstance();
00089 AlgHandle ah = af.GetAlgHandle("AlgChop","default");
00090 CandContext cxx(this,candContext.GetMom());
00091
00092 // Configuration:
00093 double cTimeGap = algConfig.GetDouble("TimeGap");
00094 double cExtraShieldWindow = algConfig.GetDouble("ExtraShieldWindow");
00095 bool cIgnorePreTrigger = algConfig.GetInt("IgnorePreTrigger");
00096
00097
00098 // First, make a nice stl vector of the digits.
00099 DigitVector digits(cdlh_ptr);
00100
00101 UInt_t ndigits = digits.size();
00102 if(ndigits==0) return; // No data.
00103
00104 // Sort the list by time.
00105 std::sort(digits.begin(), digits.end(), compareDigitTimes());
00106
00107 // Trigger time.
00108 double trigTime = cdlh_ptr->GetAbsTime();
00109 if(!cIgnorePreTrigger) trigTime = -100.0; // Set trigger time infinately early.
00110
00111 // Find the first digit after the pre-trigger window.
00112 int first_digit = 0;
00113 for(UInt_t i=0;i<ndigits;i++) {
00114 if( (digits[i].GetTime()-trigTime) >0) {
00115 first_digit = i;
00116 break;
00117 }
00118 }
00119
00120
00121 // Go through, look for gaps. When you find a gap, make a new slice.
00122
00123 int nslice = 0;
00124 double slice_start = digits[first_digit].GetTime(); // start time (inclusive)
00125 double slice_end = slice_start; // stop time (inclusive)
00126 double t_last = 99e9;
00127 bool have_slice = false;
00128
00129 for(UInt_t i=first_digit; i<ndigits; i++) {
00130 double t = digits[i].GetTime();
00131 bool create_slice = false;
00132
00133 // Only look at non-veto digits.
00134 if(!(digits[i].GetPlexSEIdAltL().IsVetoShield()) ) {
00135 // This digit isn't in veto.. use it.
00136 double delta_t = t-t_last;
00137 t_last = t;
00138 if(!have_slice) {
00139 slice_start = t;
00140 have_slice = true;
00141 } else {
00142 if( (delta_t >= cTimeGap) ) create_slice = true;
00143 }
00144 }
00145
00146 // Hack for last digit: close off the slice:
00147 if(i == ndigits-1) {
00148 if(have_slice) {
00149 create_slice = true;
00150 slice_end = 99e9;
00151 }
00152 }
00153
00154 if(create_slice) {
00155
00156 // Set start and end times. Note that the extra window
00157 // will only catch shield hits, assuming the extra window
00158 // is smaller than the gap window.
00159 double tstart = slice_start - cExtraShieldWindow;
00160 double tend = slice_end + cExtraShieldWindow;
00161
00162 // Make a new slice.
00163 MSG("Chop",Msg::kDebug) << "Forming new slice, digit " << slice_start
00164 << " to " << slice_end << endl;
00165 DigitVector slice_data;
00166 for(UInt_t j=0; j<ndigits; j++) {
00167 double tt = digits[j].GetTime();
00168 if((tt>=tstart)&&(tt<=tend)) slice_data.push_back(digits[j]);
00169 }
00170
00171 cxx.SetDataIn(&(slice_data));
00172 CandDigitListHandle sliceHandle = CandDigitList::MakeCandidate(ah,cxx);
00173 sliceHandle.SetName(Form("Chop %d",nslice++));
00174 sliceList.AddDaughterLink(sliceHandle);
00175
00176 // Prep next slice.
00177 slice_start = t;
00178 }
00179
00180 slice_end = t;
00181
00182
00183 }
00184
00185 }
|
|
|
Reimplemented from AlgBase. Definition at line 189 of file AlgChopListFar.cxx. 00190 {
00191 }
|
1.3.9.1