#include <FillEvent.h>
Inheritance diagram for Anp::FillEvent:

Public Member Functions | |
| FillEvent () | |
| virtual | ~FillEvent () |
| bool | Run (Record &record, TObject *ptr=0) |
| void | Config (const Registry ®) |
Private Member Functions | |
| const RecoNu | Fill (const Event &event, const Record &record) const |
| void | FillNearestT (Event &event, const Record &record) const |
| void | FillNearestR (Event &event, const Record &record) const |
Private Attributes | |
| FillBasic | fBasic |
| int | fEndPlaneFD |
| int | fEndPlaneND |
| int | fAddKey |
|
|
Definition at line 26 of file FillEvent.cxx. 00027 :fEndPlaneFD(483), 00028 fEndPlaneND(274), 00029 fAddKey(40) 00030 { 00031 }
|
|
|
Definition at line 34 of file FillEvent.cxx. 00035 {
00036 }
|
|
|
Reimplemented from Anp::AlgStore. Definition at line 176 of file FillEvent.cxx. References Anp::FillBasic::Config(), fAddKey, fBasic, fEndPlaneFD, fEndPlaneND, Registry::Get(), Registry::KeyExists(), and reg. 00177 {
00178 //
00179 // Configure self
00180 //
00181 fBasic.Config(reg);
00182
00183 reg.Get("FillEventEndPlaneND", fEndPlaneND);
00184 reg.Get("FillEventEndPlaneFD", fEndPlaneFD);
00185 reg.Get("FillEventAddKey", fAddKey);
00186
00187 if(reg.KeyExists("PrintConfig"))
00188 {
00189 cout << "FillEvent::Config" << endl
00190 << " EndPlaneFD = " << fEndPlaneFD << endl
00191 << " EndPlaneND = " << fEndPlaneND << endl
00192 << " AddKey = " << fAddKey << endl;
00193 }
00194 }
|
|
||||||||||||
|
Definition at line 197 of file FillEvent.cxx. References Anp::RecoNu::cosn, Anp::Vertex::CosY(), Anp::Vertex::CosZ(), Anp::RecoNu::ehad, Anp::Event::EventIndex(), Anp::RecoNu::exit_back, Anp::RecoNu::exit_side, Anp::Record::GetHeader(), Anp::RecoNu::index, Anp::Header::IsFar(), Anp::Header::IsNear(), Anp::LongestTrack(), Anp::RecoNu::pass, Anp::RecoNu::pcur, Anp::RecoNu::plep, Anp::RecoNu::pran, Anp::PrimaryShower(), Anp::Record::ShowerEnd(), Anp::ShowerIter, Anp::RecoNu::sign, Anp::RecoNu::stop, Anp::Record::TrackEnd(), Anp::TrackIter, and Anp::RecoNu::weight. Referenced by Run(). 00198 {
00199 //
00200 // Fill and return RecoNu object that contains the reconstructed
00201 // event data used for the physics analysis.
00202 //
00203
00204 RecoNu rnu;
00205
00206 rnu.index = event.EventIndex();
00207 rnu.sign = 0;
00208 rnu.ehad = 0.0;
00209 rnu.plep = 0.0;
00210 rnu.pcur = 0.0;
00211 rnu.pran = 0.0;
00212 rnu.weight = 1.0;
00213 rnu.cosn = -1.0;
00214
00215 rnu.exit_back = false;
00216 rnu.exit_side = false;
00217 rnu.pass = false;
00218 rnu.stop = false;
00219
00220 const TrackIter itrack = Anp::LongestTrack(event, record);
00221 if(itrack != record.TrackEnd())
00222 {
00223 rnu.pran = itrack -> PRan();
00224
00225 if(itrack -> Stop())
00226 {
00227 rnu.stop = true;
00228 rnu.plep = itrack -> PRan();
00229 }
00230 else if(itrack -> Pass())
00231 {
00232 rnu.plep = itrack -> PCur();
00233 }
00234 if(rnu.plep > 1e20) {
00235 cerr<<" Rather high value for lepton momentum "<<rnu.plep<<" "<<itrack->GetBasic().NPlaneScint()<<endl;
00236 rnu.plep= 1e20;
00237 }
00238 if(itrack -> Pass())
00239 {
00240 rnu.pass = true;
00241 rnu.pcur = itrack -> PCur();
00242
00243 if (itrack -> QP() > 0.0) rnu.sign = +1;
00244 else if(itrack -> QP() < 0.0) rnu.sign = -1;
00245 }
00246
00247 const Vertex &vtx = itrack -> GetBegVtx();
00248
00249 if(record.GetHeader().IsNear())
00250 {
00251 //
00252 // In near detector neutrino is traveling down
00253 //
00254 rnu.cosn = -vtx.CosY()*0.057967487 + vtx.CosZ()*0.998318471;
00255
00256 if(!itrack -> Stop())
00257 {
00258 if(itrack -> GetBasic().EndPlane() > fEndPlaneND)
00259 {
00260 rnu.exit_back = true;
00261 rnu.exit_side = false;
00262 }
00263 else
00264 {
00265 rnu.exit_back = false;
00266 rnu.exit_side = true;
00267 }
00268 }
00269 }
00270 else if(record.GetHeader().IsFar())
00271 {
00272 //
00273 // In far detector neutrino is traveling up
00274 //
00275 rnu.cosn = +vtx.CosY()*0.057967487 + vtx.CosZ()*0.998318471;
00276
00277 if(!itrack -> Stop())
00278 {
00279 if(itrack -> GetBasic().EndPlane() > fEndPlaneFD)
00280 {
00281 rnu.exit_back = true;
00282 rnu.exit_side = false;
00283 }
00284 else
00285 {
00286 rnu.exit_back = false;
00287 rnu.exit_side = true;
00288 }
00289 }
00290 }
00291 }
00292
00293 //
00294 // Use primary (first) shower that passes separation OR energy cuts
00295 //
00296 const ShowerIter ishower = Anp::PrimaryShower(event, record);
00297 if(ishower != record.ShowerEnd())
00298 {
00299 rnu.ehad = ishower -> EnergyCC();
00300 }
00301
00302 return rnu;
00303 }
|
|
||||||||||||
|
Definition at line 354 of file FillEvent.cxx. References Anp::Event::Add(), Anp::Record::EventBeg(), Anp::Record::EventEnd(), Anp::Event::EventIndex(), Anp::EventIter, fAddKey, Anp::Event::GetBasic(), Anp::Event::GetVtx(), Anp::Basic::SigCor(), Anp::Vertex::X(), Anp::Vertex::Y(), and Anp::Vertex::Z(). 00355 {
00356 //
00357 // Return distance to nearest event vertex in meters
00358 //
00359
00360 double rmin = -1.0, zmin = -1.0, asig = -1.0;
00361
00362 for(EventIter ievent = record.EventBeg(); ievent != record.EventEnd(); ++ievent)
00363 {
00364 if(ievent -> EventIndex() == event.EventIndex())
00365 {
00366 continue;
00367 }
00368
00369 const double x = ievent -> GetVtx().X() - event.GetVtx().X();
00370 const double y = ievent -> GetVtx().Y() - event.GetVtx().Y();
00371 const double z = ievent -> GetVtx().Z() - event.GetVtx().Z();
00372 const double r = std::sqrt(x*x + y*y + z*z);
00373
00374 if(rmin < 0.0)
00375 {
00376 rmin = r;
00377 zmin = z;
00378 asig = ievent -> GetBasic().SigCor();
00379 }
00380 else if(std::fabs(z) < std::fabs(zmin))
00381 {
00382 rmin = r;
00383 zmin = z;
00384 asig = ievent -> GetBasic().SigCor();
00385 }
00386 }
00387
00388 event.Add(fAddKey + 4, zmin);
00389 event.Add(fAddKey + 5, rmin);
00390
00391 if(event.GetBasic().SigCor() > 0.0)
00392 {
00393 event.Add(fAddKey + 6, asig/event.GetBasic().SigCor());
00394 }
00395 }
|
|
||||||||||||
|
Definition at line 306 of file FillEvent.cxx. References Anp::Event::Add(), Anp::Record::EventBeg(), Anp::Record::EventEnd(), Anp::Event::EventIndex(), Anp::EventIter, fAddKey, Anp::Event::GetBasic(), Anp::Event::GetVtx(), MaxTime, Anp::Basic::MaxTime(), Anp::Basic::MinTime(), MinTime, Anp::Basic::SigCor(), and Anp::Vertex::Z(). 00307 {
00308 //
00309 // Return time in nanoseconds
00310 //
00311
00312 double tmin = -1.0, zmin = -1.0, asig = -1.0;
00313
00314 for(EventIter ievent = record.EventBeg(); ievent != record.EventEnd(); ++ievent)
00315 {
00316 if(ievent -> EventIndex() == event.EventIndex())
00317 {
00318 continue;
00319 }
00320
00321 vector<double> mvec;
00322 mvec.push_back(std::fabs(ievent -> GetBasic().MinTime() - event.GetBasic().MinTime()));
00323 mvec.push_back(std::fabs(ievent -> GetBasic().MinTime() - event.GetBasic().MaxTime()));
00324 mvec.push_back(std::fabs(ievent -> GetBasic().MaxTime() - event.GetBasic().MinTime()));
00325 mvec.push_back(std::fabs(ievent -> GetBasic().MaxTime() - event.GetBasic().MaxTime()));
00326
00327 const double deltat = *std::min_element(mvec.begin(), mvec.end());
00328 const double deltaz = ievent -> GetVtx().Z() - event.GetVtx().Z();
00329
00330 if(tmin < 0.0)
00331 {
00332 zmin = deltaz;
00333 tmin = deltat;
00334 asig = ievent -> GetBasic().SigCor();
00335 }
00336 else if(deltat < tmin)
00337 {
00338 zmin = deltaz;
00339 tmin = deltat;
00340 asig = ievent -> GetBasic().SigCor();
00341 }
00342 }
00343
00344 event.Add(fAddKey + 1, 1.0e9*tmin);
00345 event.Add(fAddKey + 2, zmin);
00346
00347 if(event.GetBasic().SigCor() > 0.0)
00348 {
00349 event.Add(fAddKey + 3, asig/event.GetBasic().SigCor());
00350 }
00351 }
|
|
||||||||||||
|
Implements Anp::AlgStore. Definition at line 39 of file FillEvent.cxx. References Anp::Record::Add(), Anp::Record::EventBegIterator(), Anp::Record::EventEndIterator(), Anp::EventIterator, Anp::Event::fBasic, fBasic, Fill(), Anp::FillBasic::Fill(), find(), Anp::Event::fNu, Anp::Event::fShower, Anp::Event::fTrack, Anp::Event::fVtx, Anp::FillBasic::GetBasic(), Anp::FillBasic::GetBegVtx(), Anp::Record::GetHeader(), Anp::GetShower(), Anp::GetTrack(), Anp::Event::gev, Anp::Event::index, Anp::Header::IsValid(), MSG, and Anp::Event::pid. 00040 {
00041 //
00042 // Fill reconstructed event information
00043 //
00044
00045 NtpStRecord *ntprec = dynamic_cast<NtpStRecord *>(ptr);
00046 if(!ntprec)
00047 {
00048 const MomNavigator *mom = dynamic_cast<const MomNavigator *> (ptr);
00049 if(mom)
00050 {
00051 ntprec = dynamic_cast<NtpStRecord *>(mom -> GetFragment("NtpStRecord"));
00052 }
00053 else
00054 {
00055 MSG("FillAlg", Msg::kError) << "Failed to find MomNavigator pointer" << endl;
00056 return false;
00057 }
00058 }
00059
00060 if(!ntprec)
00061 {
00062 MSG("FillAlg", Msg::kError) << "Failed to get NtpStRecord pointer" << endl;
00063 return false;
00064 }
00065
00066 TClonesArray *event_array = ntprec -> evt;
00067 if(!event_array)
00068 {
00069 MSG("FillAlg", Msg::kWarning) << "TClonesArray of events is invalid" << endl;
00070 return false;
00071 }
00072
00073 if(!record.GetHeader().IsValid())
00074 {
00075 MSG("FillAlg", Msg::kError) << "Invalid header information" << endl;
00076 return false;
00077 }
00078
00079 const int nevent = event_array -> GetEntries();
00080
00081 for(int ievent = 0; ievent < nevent; ++ievent)
00082 {
00083 NtpSREvent* ntpevt = dynamic_cast<NtpSREvent *>(event_array -> At(ievent));
00084 if(!ntpevt)
00085 {
00086 MSG("FillAlg", Msg::kWarning) << "Failed to find NtpSREvent at "<< ievent << endl;
00087 continue;
00088 }
00089
00090 if(ntpevt -> index != ievent)
00091 {
00092 MSG("FillAlg", Msg::kError) << "Mismatched event index" << endl;
00093 continue;
00094 }
00095
00096 if(!fBasic.Fill(*ntprec, *ntpevt))
00097 {
00098 MSG("FillAlg", Msg::kWarning) << "Failed to fill basic event information" << endl;
00099 }
00100
00101 Event event;
00102
00103 event.index = ievent;
00104 event.gev = ntpevt -> ph.gev;
00105 event.pid = -1.0e6;
00106 event.fBasic = fBasic.GetBasic();
00107 event.fVtx = fBasic.GetBegVtx();
00108
00109 if(ntpevt -> trk)
00110 {
00111 for(int itrack = 0; itrack < ntpevt -> ntrack; ++itrack)
00112 {
00113 const short tindex = ntpevt -> trk[itrack];
00114
00115 if(find(event.fTrack.begin(), event.fTrack.end(), tindex) != event.fTrack.end())
00116 {
00117 MSG("FillAlg", Msg::kError) << "Duplicate track index " << tindex << endl;
00118 }
00119 else
00120 {
00121 event.fTrack.push_back(tindex);
00122 }
00123 }
00124
00125 if(static_cast<unsigned int>(ntpevt -> ntrack) != event.fTrack.size())
00126 {
00127 MSG("FillAlg", Msg::kError) << "Wrong number of tracks" << endl;
00128 }
00129 if(event.fTrack.size() != GetTrack(event, record).size())
00130 {
00131 MSG("FillAlg", Msg::kError) << "Missing track record(s)" << endl;
00132 }
00133 }
00134
00135 if(ntpevt -> shw)
00136 {
00137 for(int ishower = 0; ishower < ntpevt -> nshower; ++ishower)
00138 {
00139 const short sindex = ntpevt -> shw[ishower];
00140
00141 if(find(event.fShower.begin(), event.fShower.end(), sindex) != event.fShower.end())
00142 {
00143 MSG("FillAlg", Msg::kError) << "Duplicate shower index " << sindex << endl;
00144 }
00145 else
00146 {
00147 event.fShower.push_back(sindex);
00148 }
00149 }
00150
00151 if(static_cast<unsigned int>(ntpevt -> nshower) != event.fShower.size())
00152 {
00153 MSG("FillAlg", Msg::kError) << "Wrong number of showers" << endl;
00154 }
00155 if(event.fShower.size() != GetShower(event, record).size())
00156 {
00157 MSG("FillAlg", Msg::kError) << "Missing shower record(s)" << endl;
00158 }
00159 }
00160
00161 event.fNu = Fill(event, record);
00162
00163 record.Add(event);
00164 }
00165
00166 for(EventIterator ievent = record.EventBegIterator(); ievent != record.EventEndIterator(); ++ievent)
00167 {
00168 FillEvent::FillNearestT(*ievent, record);
00169 FillEvent::FillNearestR(*ievent, record);
00170 }
00171
00172 return true;
00173 }
|
|
|
Definition at line 51 of file FillEvent.h. Referenced by Config(), FillNearestR(), and FillNearestT(). |
|
|
Definition at line 46 of file FillEvent.h. |
|
|
Definition at line 48 of file FillEvent.h. Referenced by Config(). |
|
|
Definition at line 49 of file FillEvent.h. Referenced by Config(). |
1.3.9.1