#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, and CandHandle::SetName(). 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
00103 // Sort the list by time.
00104 std::sort(digits.begin(), digits.end(), compareDigitTimes());
00105
00106 // Trigger time.
00107 double trigTime = cdlh_ptr->GetAbsTime();
00108 if(!cIgnorePreTrigger) trigTime = -100.0; // Set trigger time infinately early.
00109
00110 // Find the first digit after the pre-trigger window.
00111 int first_digit = 0;
00112 for(UInt_t i=0;i<ndigits;i++) {
00113 if( (digits[i].GetTime()-trigTime) >0) {
00114 first_digit = i;
00115 break;
00116 }
00117 }
00118
00119
00120 // Go through, look for gaps. When you find a gap, make a new slice.
00121
00122 int nslice = 0;
00123 double slice_start = digits[first_digit].GetTime(); // start time (inclusive)
00124 double slice_end = slice_start; // stop time (inclusive)
00125 double t_last = 99e9;
00126 bool have_slice = false;
00127
00128 for(UInt_t i=first_digit; i<ndigits; i++) {
00129 double t = digits[i].GetTime();
00130 bool create_slice = false;
00131
00132 // Only look at non-veto digits.
00133 if(!(digits[i].GetPlexSEIdAltL().IsVetoShield()) ) {
00134 // This digit isn't in veto.. use it.
00135 double delta_t = t-t_last;
00136 t_last = t;
00137 if(!have_slice) {
00138 slice_start = t;
00139 have_slice = true;
00140 } else {
00141 if( (delta_t >= cTimeGap) ) create_slice = true;
00142 }
00143 }
00144
00145 // Hack for last digit: close off the slice:
00146 if(i == ndigits-1) {
00147 if(have_slice) {
00148 create_slice = true;
00149 slice_end = 99e9;
00150 }
00151 }
00152
00153 if(create_slice) {
00154
00155 // Set start and end times. Note that the extra window
00156 // will only catch shield hits, assuming the extra window
00157 // is smaller than the gap window.
00158 double tstart = slice_start - cExtraShieldWindow;
00159 double tend = slice_end + cExtraShieldWindow;
00160
00161 // Make a new slice.
00162 MSG("Chop",Msg::kDebug) << "Forming new slice, digit " << slice_start
00163 << " to " << slice_end << endl;
00164 DigitVector slice_data;
00165 for(UInt_t j=0; j<ndigits; j++) {
00166 double tt = digits[j].GetTime();
00167 if((tt>=tstart)&&(tt<=tend)) slice_data.push_back(digits[j]);
00168 }
00169
00170 cxx.SetDataIn(&(slice_data));
00171 CandDigitListHandle sliceHandle = CandDigitList::MakeCandidate(ah,cxx);
00172 sliceHandle.SetName(Form("Chop %d",nslice++));
00173 sliceList.AddDaughterLink(sliceHandle);
00174
00175 // Prep next slice.
00176 slice_start = t;
00177 }
00178
00179 slice_end = t;
00180
00181
00182 }
00183
00184 }
|
|
|
Reimplemented from AlgBase. Definition at line 188 of file AlgChopListFar.cxx. 00189 {
00190 }
|
1.3.9.1