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