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

Public Member Functions | |
| StdHepTab () | |
| virtual | ~StdHepTab () |
| void | Init (TCanvas *canvas) |
| void | Expose () |
| void | Set (const Event &event, const Record &record) |
| void | ZoomIn () |
| void | ZoomOut () |
| void | Config (const Registry ®) |
Private Member Functions | |
| bool | Init (const Record &record) |
| void | CreateArrows (const Truth &truth, const Draw::HepVec &hvec) |
| void | Reset () |
Private Attributes | |
| Registry | fConfig |
| std::vector< TObject * > | fObjVec |
| bool | fInit |
| bool | fDraw |
| bool | fLoud |
| DrawSpan | fSpan |
| TCanvas * | fCanvas |
| TPad * | fPadU |
| TPad * | fPadV |
| TH2 * | f2hU |
| TH2 * | f2hV |
| std::vector< TArrow * > | fArrowU |
| std::vector< TArrow * > | fArrowV |
|
|
Definition at line 25 of file StdHepTab.cxx. 00026 :fInit(false), 00027 fDraw(true), 00028 fLoud(false), 00029 fCanvas(0), 00030 fPadU(0), 00031 fPadV(0), 00032 f2hU(0), 00033 f2hV(0) 00034 { 00035 }
|
|
|
Definition at line 38 of file StdHepTab.cxx. References fObjVec, and Reset(). 00039 {
00040 Reset();
00041
00042 for(std::vector<TObject *>::iterator it = fObjVec.begin(); it != fObjVec.begin(); ++it)
00043 {
00044 TObject *obj = *it;
00045 delete obj;
00046 }
00047 }
|
|
|
Implements Anp::EventTab. Definition at line 187 of file StdHepTab.cxx. References fConfig, fLoud, Registry::Get(), Registry::LockValues(), Registry::Merge(), reg, and Registry::UnLockValues(). 00188 {
00189 fConfig.UnLockValues();
00190 fConfig.Merge(reg);
00191 fConfig.LockValues();
00192
00193 const char *value_char = 0;
00194 if(reg.Get("StdHepLoud", value_char) && value_char)
00195 {
00196 if(std::strcmp(value_char, "yes") == 0)
00197 {
00198 fLoud = true;
00199 }
00200 }
00201 }
|
|
||||||||||||
|
Definition at line 315 of file StdHepTab.cxx. References abs(), Anp::StdHep::Energy(), Anp::Truth::Energy(), fArrowU, fArrowV, fConfig, fSpan, Anp::StdHep::GetIdHEP(), Anp::DrawSpan::GetMaxZ(), Anp::DrawSpan::GetMinZ(), Anp::StdHep::P(), Anp::StdHep::Px(), Anp::StdHep::Py(), Anp::StdHep::Pz(), Anp::Draw::Read(), Anp::StdHep::VtxX(), Anp::StdHep::VtxY(), and Anp::StdHep::VtxZ(). Referenced by Set(). 00316 {
00317 static const double r_sqrt2 = 0.707106781;
00318
00319 const double maxlength = fSpan.GetMaxZ(1.0, 0.0) - fSpan.GetMinZ(1.0, 0.0);
00320 const double penergy = truth.Energy();
00321
00322 static double StdHepArrowSize = 0.01;
00323
00324 if(fLoud)
00325 {
00326 cout << "Maximum arrow length = " << maxlength << endl;
00327 }
00328
00329 static bool init = false;
00330 if(!init)
00331 {
00332 init = true;
00333 StdHepArrowSize = Draw::Read("StdHepArrowSize", StdHepArrowSize, fConfig);
00334
00335 if(StdHepArrowSize < 0.0) StdHepArrowSize = 0.01;
00336 }
00337
00338 for(Draw::HepIter hit = hvec.begin(); hit != hvec.end(); ++hit)
00339 {
00340 const StdHep &stdhep = *(*hit);
00341
00342 const double p = stdhep.P();
00343 if(!(p > 0.0))
00344 {
00345 if(fLoud)
00346 {
00347 cerr << "StdHepTab::CreateArrows - ignoring StdHep record with 0 momentum" << endl;
00348 }
00349 continue;
00350 }
00351
00352 const double cos_x = stdhep.Px()/p;
00353 const double cos_y = stdhep.Py()/p;
00354 const double cos_z = stdhep.Pz()/p;
00355
00356 const double cos_u = (cos_y + cos_x)*r_sqrt2;
00357 const double cos_v = (cos_y - cos_x)*r_sqrt2;
00358
00359 const double vtx_x = stdhep.VtxX();
00360 const double vtx_y = stdhep.VtxY();
00361 const double vtx_z = stdhep.VtxZ();
00362
00363 const double vtx_u = (vtx_y + vtx_x) * r_sqrt2;
00364 const double vtx_v = (vtx_y - vtx_x) * r_sqrt2;
00365
00366 const double length = maxlength * stdhep.Energy()/penergy;
00367
00368 const double end_x = vtx_x + cos_x * length;
00369 const double end_y = vtx_y + cos_y * length;
00370 const double end_u = vtx_u + cos_u * length;
00371 const double end_v = vtx_v + cos_v * length;
00372 const double end_z = vtx_z + cos_z * length;
00373
00374 TArrow *uarrow = new TArrow(vtx_z, vtx_u, end_z, end_u, StdHepArrowSize);
00375 TArrow *varrow = new TArrow(vtx_z, vtx_v, end_z, end_v, StdHepArrowSize);
00376
00377 uarrow -> SetAngle(45);
00378 varrow -> SetAngle(45);
00379 //color edits by jasmine
00380 int ptype = abs(stdhep.GetIdHEP());
00381 int color =-1;
00382 if(ptype==13) color=4 ; //muon - blue
00383 else if(ptype==11 || ptype==15) color=7; // electron or tau
00384 else if(ptype==221) color =2; //proton -red
00385 else if(ptype==211 || ptype==111) color = 6; // pion
00386 else if(ptype==12 ||ptype==14||ptype==16) color=3;// neutrino
00387 else if(ptype==2112) color=8;
00388 else{
00389 color=1 ; //hopefuly black
00390 }
00391 uarrow ->SetLineColor(color);
00392 varrow ->SetLineColor(color);
00393
00394 fArrowU.push_back(uarrow);
00395 fArrowV.push_back(varrow);
00396
00397 if(fLoud)
00398 {
00399 cout << "New StdHep record: " << endl;
00400 cout << "vertex (X, Y, Z) = (" << vtx_x << ", " << vtx_y << ", " << vtx_z << ")" << endl;
00401 cout << "vertex (U, V, Z) = (" << vtx_u << ", " << vtx_v << ", " << vtx_z << ")" << endl;
00402
00403 cout << "end (X, Y, Z) = (" << end_x << ", " << end_y << ", " << end_z << ")" << endl;
00404 cout << "end (U, V, Z) = (" << end_u << ", " << end_v << ", " << end_z << ")" << endl;
00405 }
00406 }
00407 }
|
|
|
Implements Anp::EventTab. Definition at line 146 of file StdHepTab.cxx. References Draw(), f2hU, f2hV, fArrowU, fArrowV, fCanvas, fDraw, fPadU, and fPadV. 00147 {
00148 if(!fInit)
00149 {
00150 return;
00151 }
00152
00153 if(!fPadU || !fPadV)
00154 {
00155 return;
00156 }
00157
00158 if(fDraw)
00159 {
00160 fPadU -> cd();
00161 f2hU -> Draw("colz");
00162
00163 for(std::vector<TArrow *>::iterator it = fArrowU.begin(); it != fArrowU.end(); ++it)
00164 {
00165 TArrow *arrow = *it;
00166 // arrow -> Draw();
00167 }
00168
00169 fPadV -> cd();
00170 f2hV -> Draw("colz");
00171
00172 for(std::vector<TArrow *>::iterator it = fArrowV.begin(); it != fArrowV.end(); ++it)
00173 {
00174 TArrow *arrow = *it;
00175 arrow -> Draw();
00176 }
00177
00178 fDraw = false;
00179 }
00180
00181 fCanvas -> cd();
00182 fCanvas -> Modified();
00183 fCanvas -> Update();
00184 }
|
|
|
Definition at line 204 of file StdHepTab.cxx. References Anp::Draw::CreateTH2(), f2hU, f2hV, fConfig, fInit, fObjVec, and Anp::Record::GetHeader(). 00205 {
00206 if(fInit)
00207 {
00208 cerr << "StdHepTab is already initialized" << endl;
00209 return false;
00210 }
00211
00212 fInit = true;
00213
00214 f2hU = Draw::CreateTH2("Uview", fConfig, record.GetHeader());
00215 f2hV = Draw::CreateTH2("Vview", fConfig, record.GetHeader());
00216
00217 fObjVec.push_back(f2hU);
00218 fObjVec.push_back(f2hV);
00219
00220 return true;
00221 }
|
|
|
Implements Anp::EventTab. Definition at line 112 of file StdHepTab.cxx. References Anp::Draw::Config(), fCanvas, fConfig, fPadU, and fPadV. Referenced by Set(). 00113 {
00114 if(!canvas)
00115 {
00116 cerr << "StdHepTab::Expose(): null TCanvas pointer" << endl;
00117 return;
00118 }
00119 if(fPadU || fPadV || fCanvas)
00120 {
00121 cerr << "StdHepTab::Expose(): pads have been already initialized" << endl;
00122 return;
00123 }
00124
00125 fCanvas = canvas;
00126
00127 fCanvas -> Divide(0, 2);
00128
00129 fPadU = dynamic_cast<TPad *> (canvas -> cd(1));
00130 fPadV = dynamic_cast<TPad *> (canvas -> cd(2));
00131
00132 if(!fPadU || !fPadV)
00133 {
00134 cerr << "StdHepTab::Expose(): failed to create new pads" << endl;
00135 fCanvas = 0;
00136 fPadU = 0;
00137 fPadV = 0;
00138 return;
00139 }
00140
00141 Draw::Config(fPadU, "", fConfig);
00142 Draw::Config(fPadV, "", fConfig);
00143 }
|
|
|
Definition at line 224 of file StdHepTab.cxx. References f2hU, f2hV, fArrowU, fArrowV, fDraw, fSpan, and Anp::DrawSpan::Reset(). Referenced by Set(), and ~StdHepTab(). 00225 {
00226 fDraw = true;
00227
00228 fSpan.Reset();
00229
00230 if(f2hU)
00231 {
00232 f2hU -> Reset();
00233 }
00234 if(f2hV)
00235 {
00236 f2hV -> Reset();
00237 }
00238
00239 for(std::vector<TArrow *>::iterator it = fArrowU.begin(); it != fArrowU.end(); ++it)
00240 {
00241 TArrow *arrow = *it;
00242 delete arrow;
00243 }
00244
00245 for(std::vector<TArrow *>::iterator it = fArrowV.begin(); it != fArrowV.end(); ++it)
00246 {
00247 TArrow *arrow = *it;
00248 delete arrow;
00249 }
00250
00251 fArrowU.clear();
00252 fArrowV.clear();
00253 }
|
|
||||||||||||
|
Implements Anp::EventTab. Definition at line 50 of file StdHepTab.cxx. References CreateArrows(), f2hU, f2hV, Anp::DrawSpan::FindSpan(), Anp::Record::FindTruth(), fSpan, Anp::Record::GetHeader(), Anp::GetStrip(), Init(), Anp::Header::IsData(), Anp::Draw::Read(), Reset(), StripVec, Anp::Record::TruthEnd(), and Anp::TruthIter. 00051 {
00052 if(record.GetHeader().IsData())
00053 {
00054 return;
00055 }
00056
00057 if(!fInit)
00058 {
00059 Init(record);
00060 }
00061 else
00062 {
00063 Reset();
00064 }
00065
00066 if(!f2hU || !f2hV)
00067 {
00068 return;
00069 }
00070
00071 fSpan.FindSpan(event, record);
00072
00073 TruthIter truth = record.FindTruth(event);
00074 if(truth == record.TruthEnd())
00075 {
00076 cerr << "StdHepTab::Set - failed to find Truth record for this event" << endl;
00077 return;
00078 }
00079
00080 Draw::HepVec hvec;
00081
00082 const int nstdhep = Draw::Read(record, hvec, truth -> ChildBeg(), truth -> ChildEnd());
00083
00084 if(fLoud)
00085 {
00086 cout << "StdHepTab::Set - read " << nstdhep << " StdHep entries" << endl;
00087 }
00088
00089 CreateArrows(*truth, hvec);
00090
00091 const StripVec uvec = GetStrip(event, record, "U");
00092 const StripVec vvec = GetStrip(event, record, "V");
00093
00094 if(uvec.empty() || vvec.empty())
00095 {
00096 cerr << "StdHepTab::SetEvent() - no strips matching a track" << endl;
00097 return;
00098 }
00099
00100 for(Draw::SIter sit = uvec.begin(); sit != uvec.end(); ++sit)
00101 {
00102 f2hU -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> SigCor());
00103 }
00104
00105 for(Draw::SIter sit = vvec.begin(); sit != vvec.end(); ++sit)
00106 {
00107 f2hV -> Fill((*sit) -> ZPos(), (*sit) -> TPos(), (*sit) -> SigCor());
00108 }
00109 }
|
|
|
Reimplemented from Anp::EventTab. Definition at line 256 of file StdHepTab.cxx. References f2hU, f2hV, fConfig, fDraw, fSpan, Anp::DrawSpan::InitU(), Anp::DrawSpan::InitV(), Anp::DrawSpan::InitZ(), Anp::Draw::Read(), Anp::DrawSpan::SetRangeU(), Anp::DrawSpan::SetRangeV(), and Anp::DrawSpan::SetRangeZ(). 00257 {
00258 if(!fInit)
00259 {
00260 return;
00261 }
00262
00263 fDraw = true;
00264
00265 static double ZoomBorderScale = 1.2;
00266 static double ZoomBorderWidth = 0.1;
00267
00268 static bool init = false;
00269 if(!init)
00270 {
00271 init = true;
00272 ZoomBorderScale = Draw::Read("ZoomBorderScale", ZoomBorderScale, fConfig);
00273 ZoomBorderWidth = Draw::Read("ZoomBorderWidth", ZoomBorderWidth, fConfig);
00274
00275 if(ZoomBorderScale < 1.0) ZoomBorderScale = 1.2;
00276 if(ZoomBorderWidth < 0.0) ZoomBorderWidth = 0.1;
00277 }
00278
00279 if(fSpan.InitU())
00280 {
00281 fSpan.SetRangeU(f2hU -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00282 }
00283 if(fSpan.InitZ())
00284 {
00285 fSpan.SetRangeZ(f2hU -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00286 }
00287 if(fSpan.InitV())
00288 {
00289 fSpan.SetRangeV(f2hV -> GetYaxis(), ZoomBorderScale, ZoomBorderWidth);
00290 }
00291 if(fSpan.InitZ())
00292 {
00293 fSpan.SetRangeZ(f2hV -> GetXaxis(), ZoomBorderScale, ZoomBorderWidth);
00294 }
00295 }
|
|
|
Reimplemented from Anp::EventTab. Definition at line 298 of file StdHepTab.cxx. References f2hU, f2hV, and fDraw. 00299 {
00300 if(!fInit)
00301 {
00302 return;
00303 }
00304
00305 fDraw = true;
00306
00307 f2hU -> GetXaxis() -> UnZoom();
00308 f2hU -> GetYaxis() -> UnZoom();
00309
00310 f2hV -> GetXaxis() -> UnZoom();
00311 f2hV -> GetYaxis() -> UnZoom();
00312 }
|
|
|
Definition at line 64 of file StdHepTab.h. Referenced by Expose(), Init(), Reset(), Set(), ZoomIn(), and ZoomOut(). |
|
|
Definition at line 65 of file StdHepTab.h. Referenced by Expose(), Init(), Reset(), Set(), ZoomIn(), and ZoomOut(). |
|
|
Definition at line 67 of file StdHepTab.h. Referenced by CreateArrows(), Expose(), and Reset(). |
|
|
Definition at line 68 of file StdHepTab.h. Referenced by CreateArrows(), Expose(), and Reset(). |
|
|
Definition at line 59 of file StdHepTab.h. |
|
|
Definition at line 49 of file StdHepTab.h. Referenced by Config(), CreateArrows(), Init(), and ZoomIn(). |
|
|
Definition at line 54 of file StdHepTab.h. |
|
|
Definition at line 53 of file StdHepTab.h. Referenced by Init(). |
|
|
Definition at line 55 of file StdHepTab.h. Referenced by Config(). |
|
|
Definition at line 51 of file StdHepTab.h. Referenced by Init(), and ~StdHepTab(). |
|
|
Definition at line 61 of file StdHepTab.h. |
|
|
Definition at line 62 of file StdHepTab.h. |
|
|
Definition at line 57 of file StdHepTab.h. Referenced by CreateArrows(), Reset(), Set(), and ZoomIn(). |
1.3.9.1