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

Public Member Functions | |
| AlgFarDetEventList () | |
| virtual | ~AlgFarDetEventList () |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
| virtual void | Trace (const char *c) const |
Private Member Functions | |
| void | CompareShowersWithTrack (CandTrackHandle *besttrack, CandShowerListHandle *shwlist, CandShowerHandle *&vtxshower, TObjArray *HadronicShowers, TObjArray *BremsAndDeltas, Double_t &separation) |
|
|
Definition at line 29 of file AlgFarDetEventList.cxx. 00030 {
00031
00032 }
|
|
|
Definition at line 34 of file AlgFarDetEventList.cxx. 00035 {
00036
00037 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 235 of file AlgFarDetEventList.cxx. References abs(), CandHandle::GetDaughterIterator(), CandHandle::GetNDaughters(), CandRecoHandle::GetVtxPlane(), CandRecoHandle::GetVtxU(), CandRecoHandle::GetVtxV(), CandRecoHandle::GetVtxZ(), and MSG. Referenced by RunAlg(). 00236 {
00237 MSG("FarDetEvent",Msg::kVerbose) << " CompareShowersWithTrack(...) " << endl;
00238
00239 if(!bestTrack)
00240 {
00241 MSG("FarDetEvent",Msg::kError) << " AlgFarDetEventList::CompareShowersWithTrack * Not Given A Track To Compare With Showers!" << endl;
00242 return;
00243 }
00244 if(!shwlist)
00245 {
00246 MSG("FarDetEvent",Msg::kError) << " AlgFarDetEventList::CompareShowersWithTrack * Not Given A List of Showers To Compare With Track!" << endl;
00247 return;
00248 }
00249 if(shwlist->GetNDaughters()<=0)
00250 {
00251 MSG("FarDetEvent",Msg::kWarning) << " AlgFarDetEventList::CompareShowersWithTrack * Given An Empty Showerlist To Compare With Track!" << endl;
00252 return;
00253 }
00254
00255 HadronicShowers->Clear(); BremsAndDeltas->Clear();
00256
00257 int vtxpln = bestTrack->GetVtxPlane();
00258 double trku = bestTrack->GetVtxU();
00259 double trkv = bestTrack->GetVtxV();
00260 double trkz = bestTrack->GetVtxZ();
00261
00262 TIter shwitr(shwlist->GetDaughterIterator());
00263 while(CandShowerHandle* shw = (CandShowerHandle*)(shwitr()))
00264 {
00265 if( shw )
00266 {
00267 // Look for possible hadronic showers
00268 // (offset by less than 10 planes from track vertex)
00269 if( abs(shw->GetVtxPlane()-vtxpln)<20 )
00270 {
00271 HadronicShowers->Add(shw);
00272 double temp = (shw->GetVtxU()-trku)*(shw->GetVtxU()-trku)
00273 + (shw->GetVtxV()-trkv)*(shw->GetVtxV()-trkv)
00274 + (shw->GetVtxZ()-trkz)*(shw->GetVtxZ()-trkz);
00275 if(temp<separation)
00276 {
00277 vtxshower=shw;
00278 separation=temp;
00279 }
00280 }
00281 // Look for possible brems and deltas
00282 // ( loop over the planes in the shower and see if
00283 // it is associated with the track in that plane)
00284 else
00285 {
00286
00287 }
00288 }
00289 }
00290 return;
00291 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 39 of file AlgFarDetEventList.cxx. References CandHandle::AddDaughterLink(), CompareShowersWithTrack(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), CandShowerHandle::GetEnergy(), AlgFactory::GetInstance(), CandContext::GetMom(), CandTrackHandle::GetRange(), FarDetEvent::MakeCandidate(), MSG, CandHandle::SetName(), and CandHandle::SetTitle(). 00040 {
00041 MSG("FarDetEvent",Msg::kDebug) << " AlgFarDetEventList::RunAlg(...) " << endl;
00042
00043 FarDetEventListHandle& fdeventlist = dynamic_cast<FarDetEventListHandle&>(ch);
00044
00045 const TObjArray* arr = dynamic_cast<const TObjArray*>(cx.GetDataIn());
00046
00047 AlgFactory &af = AlgFactory::GetInstance();
00048 AlgHandle ah = af.GetAlgHandle("AlgFarDetEvent","default");
00049 CandRecord* candrec = (CandRecord*)(cx.GetCandRecord());
00050 CandContext cxnew(this, cx.GetMom());
00051 cxnew.SetCandRecord(candrec);
00052
00053 // Create TObjArray to store the event information
00054 TObjArray* eventinfo = new TObjArray();
00055
00056 // Start to find a new event...
00057 // N.B: Assume there is only one event for now!
00058 eventinfo->Clear();
00059
00060 // Get the track information
00061 MSG("FarDetEvent",Msg::kVerbose) << " GET TRACK INFORMATION " << endl;
00062 CandFitTrackListHandle* fitlist = (CandFitTrackListHandle*)(arr->At(0));
00063 CandFitTrackHandle* bestFitTrack=0;
00064
00065 CandTrackListHandle* trklist = (CandTrackListHandle*)(arr->At(1));
00066 CandTrackHandle* bestTrack=0;
00067
00068 // Look in the fitted tracks first
00069 if( fitlist )
00070 {
00071 Double_t bestFitTracklength=-1.0;
00072 TIter fititr(fitlist->GetDaughterIterator());
00073 while(CandFitTrackHandle* fit = (CandFitTrackHandle*)(fititr()))
00074 {
00075 if(fit)
00076 {
00077 if(fit->GetRange()>bestFitTracklength)
00078 {
00079 bestFitTrack = fit;
00080 bestFitTracklength = bestFitTrack->GetRange();
00081 }
00082 }
00083 }
00084
00085 }
00086
00087 // Otherwise fall back to the found tracks.
00088 else if( trklist )
00089 {
00090 Double_t bestTracklength=-1.0;
00091 TIter trkitr(trklist->GetDaughterIterator());
00092 while(CandTrackHandle* trk = (CandTrackHandle*)(trkitr()))
00093 {
00094 if(trk)
00095 {
00096 if(trk->GetRange()>bestTracklength)
00097 {
00098 bestTrack = trk;
00099 bestTracklength = bestTrack->GetRange();
00100 }
00101 }
00102 }
00103 }
00104
00105 eventinfo->Add(bestFitTrack);
00106 eventinfo->Add(bestTrack); // Add bestTrack even if it is null.
00107
00108 CandTrackHandle* primaryTrack = 0;
00109 if( bestFitTrack ) primaryTrack=(CandTrackHandle*)bestFitTrack;
00110 else if( bestTrack ) primaryTrack=(CandTrackHandle*)bestTrack;
00111
00112 if( primaryTrack ){
00113 MSG("FarDetEvent",Msg::kVerbose) << " ...found a primary track " << endl;
00114 }
00115 else{
00116 MSG("FarDetEvent",Msg::kVerbose) << " ...there is no primary track " << endl;
00117 }
00118
00119 // Now we've stored the track we want to use in our event,
00120 // we should try and find a shower to go with it.
00121 MSG("FarDetEvent",Msg::kVerbose) << " GET SHOWER INFORMATION " << endl;
00122 CandShowerListHandle* shwlist = (CandShowerListHandle*)(arr->At(2));
00123
00124 CandShowerHandle* vtxshower = 0;
00125 TObjArray* HadronicShowers = new TObjArray();
00126 TObjArray* BremsAndDeltas = new TObjArray();
00127
00128 if( shwlist )
00129 { // Loop over the shower list and look for a vertex shower.
00130
00131 Double_t separation(999.),temp(999.),shwenergy(0.0);
00132 if( primaryTrack )
00133 { // We have a track so find the shower closest to it
00134 this->CompareShowersWithTrack(primaryTrack,
00135 shwlist,
00136 vtxshower,
00137 HadronicShowers,
00138 BremsAndDeltas,
00139 separation);
00140 }
00141
00142 else
00143 { // We have no track so find the largest shower
00144 TIter shwitr(shwlist->GetDaughterIterator());
00145 while(CandShowerHandle* shw = (CandShowerHandle*)(shwitr()))
00146 {
00147 if( shw )
00148 {
00149 temp=shw->GetEnergy();
00150 if(temp>shwenergy)
00151 {
00152 vtxshower=shw;
00153 shwenergy=temp;
00154 }
00155 }
00156 }
00157 }
00158 }
00159
00160 if( vtxshower ){
00161 MSG("FarDetEvent",Msg::kVerbose) << " ...found a primary shower " << endl;
00162 }
00163 else{
00164 MSG("FarDetEvent",Msg::kVerbose) << " ...there is no primary shower " << endl;
00165 }
00166
00167 eventinfo->Add(vtxshower);
00168 eventinfo->Add(HadronicShowers);
00169 eventinfo->Add(BremsAndDeltas);
00170
00171 // Add the strip list
00172 MSG("FarDetEvent",Msg::kVerbose) << " GET STRIP INFORMATION " << endl;
00173 CandStripListHandle* strplist = (CandStripListHandle*)(arr->At(3));
00174
00175 TObjArray* AssociatedStrips = new TObjArray();
00176 TObjArray* AllStrips = new TObjArray();
00177
00178 if( strplist )
00179 {
00180 TIter strpitr(strplist->GetDaughterIterator());
00181 while(CandStripHandle* strp = (CandStripHandle*)(strpitr()))
00182 {
00183 if( strp )
00184 {
00185
00186 // record all strips
00187 AllStrips->Add(strp);
00188
00189 // some association could go here...
00190 AssociatedStrips->Add(strp);
00191
00192 }
00193 }
00194 }
00195
00196 eventinfo->Add(AssociatedStrips);
00197 eventinfo->Add(AllStrips);
00198
00199 // Add event info to CandContext
00200 cxnew.SetDataIn(eventinfo);
00201
00202 // Make new FarDetEventHandle
00203 MSG("FarDetEvent",Msg::kVerbose) << " MAKING FARDETEVENT " << endl;
00204 FarDetEventHandle fdevent = FarDetEvent::MakeCandidate(ah,cxnew);
00205 fdevent.SetName("FarDetEvent");
00206 fdevent.SetTitle(TString("Created by AlgFarDetEventList"));
00207 fdeventlist.AddDaughterLink(fdevent);
00208
00209 // Delete temporary objects
00210 HadronicShowers->Clear();
00211 delete HadronicShowers;
00212
00213 BremsAndDeltas->Clear();
00214 delete BremsAndDeltas;
00215
00216 AssociatedStrips->Clear();
00217 delete AssociatedStrips;
00218
00219 AllStrips->Clear();
00220 delete AllStrips;
00221
00222 //
00223 // Could turn this into a loop and make another event now...
00224 //
00225
00226 eventinfo->Clear();
00227 delete eventinfo;
00228 }
|
|
|
Reimplemented from AlgBase. Definition at line 230 of file AlgFarDetEventList.cxx. 00231 {
00232
00233 }
|
1.3.9.1