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

Public Member Functions | |
| AlgFilterDigitList () | |
| virtual | ~AlgFilterDigitList () |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
| virtual void | Trace (const char *c) const |
Private Member Functions | |
| void | MakeBadChannelMap (DetectorType::Detector_t det) |
Private Attributes | |
| std::string | fBadChannelFile |
| TFolder * | fTFolder |
| path and file holding bad channel info | |
|
|
Definition at line 53 of file AlgFilterDigitList.cxx. 00053 : 00054 fTFolder(0) 00055 { 00056 }
|
|
|
Definition at line 59 of file AlgFilterDigitList.cxx. References fTFolder. 00060 {
00061 FilterBadChannelMap *badChannelMap;
00062 if (fTFolder && (badChannelMap = dynamic_cast<FilterBadChannelMap*>
00063 (fTFolder->FindObject("FilterBadChannelMap")))) {
00064 fTFolder->Remove(badChannelMap);
00065 delete badChannelMap;
00066 }
00067 }
|
|
|
Definition at line 209 of file AlgFilterDigitList.cxx. References RawChannelId::AsString(), RawChannelId::ClearModeBits(), fBadChannelFile, FilterBadChannelMap::fBadChannelMap, fTFolder, RawChannelId::GetEncoded(), and MSG. Referenced by RunAlg(). 00210 {
00211 UInt_t prevEncoded = 0;
00212
00213 // make the bad channel map object
00214 FilterBadChannelMap *badChMap = new FilterBadChannelMap();
00215
00216 // open the bad channel file
00217 ifstream badChannels(fBadChannelFile.c_str());
00218
00219 if (!badChannels.is_open()) {
00220 MSG("AlgFilterDigitList", Msg::kError)
00221 << "cannot open list of bad channels,"
00222 << fBadChannelFile
00223 << " assume there are none" << endl;
00224
00225 // Add the map to the white board. AlgFilterDigitList retains ownership!
00226 fTFolder->Add(badChMap);
00227 return;
00228 }
00229
00230 // fill the map
00231 if (det==DetectorType::kNear) {
00232 UInt_t crate = 0;
00233 UInt_t geo = 0;
00234 UInt_t masterChannel = 0;
00235 UInt_t minderChannel = 0;
00236
00237 // read in the list of bad channels
00238 while (!badChannels.eof()) {
00239 badChannels >> crate >> geo >> masterChannel >> minderChannel;
00240
00241 // make a RawChannelId to get the encoded value
00242 #ifdef RAWCHANNELID_NEW_CTOR
00243 RawChannelId rawId(det,ElecType::kQIE, crate, geo,
00244 masterChannel, minderChannel);
00245 #else
00246 RawChannelId rawId(det,ElecType::kQIE, crate, geo,
00247 masterChannel, minderChannel, false, false);
00248 #endif
00249 rawId.ClearModeBits();
00250 MSG("AlgFilterDigitList", Msg::kDebug)
00251 << "*******filter channel********"
00252 << crate << " " << geo << " " << masterChannel << " "
00253 << minderChannel << " "
00254 << rawId.AsString("ec") << endl;
00255
00256 // if the channel is in the list it is a bad channel so the flag is true
00257 if (rawId.GetEncoded() != prevEncoded)
00258 badChMap->fBadChannelMap[rawId] = true;
00259
00260 } // end loop over input file
00261 } // end if near detector
00262
00263 // Add the map to the white board. AlgFilterDigitList retains ownership!
00264 fTFolder->Add(badChMap);
00265 return;
00266 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 70 of file AlgFilterDigitList.cxx. References CandHandle::AddDaughterLink(), RawChannelId::AsString(), RawChannelId::ClearModeBits(), fBadChannelFile, FilterBadChannelMap::fBadChannelMap, fTFolder, Registry::Get(), CandDigitListHandle::GetAbsTime(), CandHandle::GetCandRecord(), CandDigitHandle::GetChannelId(), CandDigitHandle::GetCharge(), RawChannelId::GetCrate(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), VldContext::GetDetector(), RawChannelId::GetGeographicAddress(), CandDigitListHandle::GetIsSparse(), RawChannelId::GetMasterChannel(), RawChannelId::GetMinderChannel(), CandDigitHandle::GetQieErrorBits(), CandDigitHandle::GetSubtractedTime(), CandDigitHandle::GetVaErrorBits(), CandHandle::GetVldContext(), MakeBadChannelMap(), MSG, CandDigitListHandle::SetAbsTime(), CandHandle::SetCandRecord(), and CandDigitListHandle::SetIsSparse(). 00072 {
00073 MSG("AlgFilterDigitList", Msg::kDebug)
00074 << "Starting AlgFilterDigitList::RunAlg()" << endl;
00075
00076 // Check for input CandDigitListHandle in CandContext
00077 assert(cx.GetDataIn());
00078
00079 // Obtain CandContext's CandDigitList as input
00080 const CandDigitListHandle *cdlh =
00081 dynamic_cast<const CandDigitListHandle *> (cx.GetDataIn());
00082 assert(cdlh); // Check for input CandDigitListHandle in CandContext
00083
00084 // Obtain filtering parameters from AlgConfig
00085 Int_t filterstrategy = 0;
00086 Float_t chargeMin = -FLT_MAX;
00087 Double_t timeMin = -FLT_MAX;
00088 Int_t errorBitsMaskVA = 0;
00089 Int_t errorBitsMaskQIE = 0;
00090
00091 Int_t tmpi = 0;
00092 Double_t tmpd = 0;
00093 const char* tmps;
00094 if (ac.Get("FilterStrategy", tmpi)) filterstrategy = tmpi;
00095 if (ac.Get("ChargeMin",tmpd)) chargeMin = tmpd;
00096 if (ac.Get("SubtractedTimeMin",tmpd)) timeMin = tmpd;
00097 if (ac.Get("ErrorBitsMaskVA",tmpi)) errorBitsMaskVA = tmpi;
00098 if (ac.Get("ErrorBitsMaskQIE",tmpi)) errorBitsMaskQIE = tmpi;
00099 if (ac.Get("BadChannelFile", tmps)) fBadChannelFile = tmps;
00100
00101 MSG("AlgFilterDigitList", Msg::kDebug) << "file = "
00102 << fBadChannelFile << " strategy = "
00103 << filterstrategy << endl;
00104
00105 // Set CandRecord pointer in new CandDigitList to that of CandDigitList
00106 ch.SetCandRecord((cdlh->GetCandRecord())); //Sub-algorithms need this
00107
00108 // Copy member variables from orig CandDigitList to new CandDigitList
00109 CandDigitListHandle &cddlh = dynamic_cast<CandDigitListHandle &>(ch);
00110 cddlh.SetAbsTime(cdlh->GetAbsTime());
00111 cddlh.SetIsSparse(cdlh->GetIsSparse());
00112
00113 // Iterate over CandContext's CandDigitList to find CandDigitHandles.
00114 TIter cdhiter = cdlh->GetDaughterIterator();
00115 TObject *tob;
00116 while ((tob = cdhiter())) {
00117 CandDigitHandle *cdh = dynamic_cast<CandDigitHandle *>(tob);
00118 if (cdh == 0) continue; // Skip daughter if not a CandDigitHandle
00119
00120 // Filter unwanted digits here
00121 // if (DontWantThisDigit(filterstrategy)) continue;
00122
00123 // Strategy 1: filter away digits that have error codes
00124 // or are below the sparsification threshold
00125 if (1==filterstrategy) {
00126 if ( cdh->GetCharge() < chargeMin ) continue;
00127 if ( cdh->GetSubtractedTime() < timeMin ) continue;
00128 if ( cdh->GetVaErrorBits() & errorBitsMaskVA ) continue;
00129 if ( cdh->GetQieErrorBits() & errorBitsMaskQIE ) continue;
00130 } // End Filter Strategy 1
00131
00132 // Strategy 2: Strategy 1 + filter away digits from known bad channels
00133 if(filterstrategy==2){
00134 MSG("AlgFilterDigitList", Msg::kDebug)
00135 << "using strategy 2" << endl;
00136
00137 // Look for the FilterBadChannelMap object on the TFolder white board.
00138 if (fTFolder==0) {
00139 TFolder *lf = dynamic_cast<TFolder*>
00140 (gROOT->GetRootFolder()->FindObject("Loon"));
00141 if (lf==0) {
00142 MSG("AlgFilterDigitList", Msg::kDebug)
00143 << "Creating Loon TFolder" << endl;
00144 lf = gROOT->GetRootFolder()->AddFolder("Loon",
00145 "Loon analysis");
00146 gROOT->GetListOfBrowsables()->Add(lf, "Loon");
00147 }
00148 fTFolder = dynamic_cast<TFolder*>(lf->FindObject("CandDigit"));
00149 if (fTFolder==0) {
00150 MSG("AlgFilterDigitList", Msg::kDebug)
00151 << "Creating Loon/CandDigit TFolder" << endl;
00152 fTFolder =
00153 lf->AddFolder("CandDigit", "CandDigit diagnostics");
00154 }
00155 }
00156
00157 FilterBadChannelMap *badChannelMap =
00158 dynamic_cast<FilterBadChannelMap*>
00159 (fTFolder->FindObject("FilterBadChannelMap"));
00160 if (badChannelMap==0) {
00161 MSG("AlgFilterDigitList", Msg::kDebug)
00162 << "Creating Loon/CandDigit/FilterBadChannelMap" << endl;
00163 MakeBadChannelMap(cdh->GetVldContext()->GetDetector());
00164 badChannelMap = dynamic_cast<FilterBadChannelMap*>
00165 (fTFolder->FindObject("FilterBadChannelMap"));
00166
00167 if ( !badChannelMap ) MSG("AlgFilterDigitList", Msg::kFatal)
00168 << "still no Loon/CandDigit/FilterBadChannelMap" << endl;
00169 }
00170
00171 // grab the RawChannelId and copy it to a local thing
00172 RawChannelId theChannel = cdh->GetChannelId();
00173 theChannel.ClearModeBits();
00174
00175 MSG("AlgFilterDigitList", Msg::kDebug) << "encoded value = "
00176 << theChannel.AsString("ec") << endl;
00177
00178 // check to see if the channel for this digit is in the bad channel map
00179 map<RawChannelId, bool>& theMap = badChannelMap->fBadChannelMap;
00180 if (theMap.find(theChannel) != theMap.end()) {
00181 MSG("AlgFilterDigitList", Msg::kDebug)
00182 << "filtering " << cdh->GetChannelId().GetCrate() << "-"
00183 << cdh->GetChannelId().GetGeographicAddress() << "-"
00184 << cdh->GetChannelId().GetMasterChannel() << "-"
00185 << cdh->GetChannelId().GetMinderChannel() << endl;
00186 continue;
00187 }
00188
00189 if ( cdh->GetCharge() < chargeMin ) continue;
00190 if ( cdh->GetSubtractedTime() < timeMin ) continue;
00191 if ( cdh->GetVaErrorBits() & errorBitsMaskVA ) continue;
00192 if ( cdh->GetQieErrorBits() & errorBitsMaskQIE ) continue;
00193
00194 } // end strategy 2
00195
00196 // Effect copy of wanted digits from orig CandDigitList to daughter list
00197 CandDigitHandle cddh(*cdh);
00198 ch.AddDaughterLink(cddh, kFALSE); // Don't check for dups
00199 }
00200 }
|
|
|
Reimplemented from AlgBase. Definition at line 203 of file AlgFilterDigitList.cxx. 00204 {
00205 }
|
|
|
Definition at line 33 of file AlgFilterDigitList.h. Referenced by MakeBadChannelMap(), and RunAlg(). |
|
|
path and file holding bad channel info
Definition at line 34 of file AlgFilterDigitList.h. Referenced by MakeBadChannelMap(), RunAlg(), and ~AlgFilterDigitList(). |
1.3.9.1