00001 #include "NueAna/ParticlePID/ParticleFinder/Display/HitView.h"
00002 #include "TPolyLine.h"
00003 #include "TMarker.h"
00004 #include "TArrow.h"
00005 #include "TMath.h"
00006
00007 #include "Conventions/SimFlag.h"
00008 #include <vector>
00009 #include "MCNtuple/NtpMCStdHep.h"
00010 #include "MCNtuple/NtpMCRecord.h"
00011 #include "MCNtuple/NtpMCTruth.h"
00012
00013 #include "TruthHelperNtuple/NtpTHEvent.h"
00014
00015 using namespace std;
00016
00017 HitView::HitView():Page()
00018 {
00019 viewU=0;
00020 viewV=0;
00021 padU=0;
00022 padV=0;
00023
00024
00025 info6=new TLatex();
00026 info7=new TLatex();
00027 info8=new TLatex();
00028 info9=new TLatex();
00029 info10=new TLatex();
00030 info11=new TLatex();
00031 info12=new TLatex();
00032 info13=new TLatex();
00033 }
00034
00035
00036 HitView::~HitView()
00037 {}
00038
00039
00040 void HitView::BuildDisplay(TCanvas *c)
00041 {
00042 myCanvas=c;
00043 padV=new TPad("chainview_padv","chainview_padu",0,0,0.7,0.5);
00044 padU=new TPad("chainview_padu","chainview_padv",0,0.5,0.7,1.0);
00045 padMC=new TPad("chainview_padmc","chainview_padmc",0.71,0.0,1.0,0.8);
00046 padInfo=new TPad("chainview_padinfo","chainview_padinfo",0.71,0.8,1.0,1.0);
00047 myCanvas->cd();
00048 padU->Draw();
00049 padV->Draw();
00050 padMC->Draw();
00051 padInfo->Draw();
00052
00053 }
00054
00055
00056 void HitView::DrawEvent(ParticleObjectHolder * poh, NtpStRecord *ntp,int ntpEvt)
00057 {
00058 padU->Clear();
00059 padV->Clear();
00060 padMC->Clear();
00061 padInfo->Clear();
00062
00063 mypoh=poh;
00064
00065 int isMC=0;
00066 if(poh->GetHeader().GetVldContext().GetSimFlag() == SimFlag::kMC)isMC=1;
00067
00068 double minz= mypoh->strips.minz;
00069 double minu= mypoh->strips.minu;
00070 double minv= mypoh->strips.minv;
00071 double maxz= mypoh->strips.maxz;
00072 double maxu= mypoh->strips.maxu;
00073 double maxv= mypoh->strips.maxv;
00074
00075
00076
00077 if(isMC)
00078 {
00079 if(mypoh->mctrue.vtx_z>=0)minz=minz<mypoh->mctrue.vtx_z ? minz : mypoh->mctrue.vtx_z;
00080 maxz=maxz>mypoh->mctrue.vtx_z ? maxz : mypoh->mctrue.vtx_z;
00081 minu=minu<mypoh->mctrue.vtx_u ? minu : mypoh->mctrue.vtx_u;
00082 maxu=maxu>mypoh->mctrue.vtx_u ? maxu : mypoh->mctrue.vtx_u;
00083 minv=minv<mypoh->mctrue.vtx_v ? minv : mypoh->mctrue.vtx_v;
00084 maxv=maxv>mypoh->mctrue.vtx_v ? maxv : mypoh->mctrue.vtx_v;
00085 }
00086
00087
00088
00089
00090 minz -= 0.1;
00091 minu -= 0.1;
00092 minv -= 0.1;
00093 maxz += 0.1;
00094 maxu += 0.1;
00095 maxv += 0.1;
00096
00097 int nu=(int)((maxu-minu)/0.0412);
00098 int nv=(int)((maxv-minv)/0.0412);
00099 int nz=(int)((maxz-minz)/0.0354);
00100
00101
00102 if(viewU)delete viewU;
00103 if(viewV)delete viewV;
00104
00105 viewU = new TH2D("hu","Hits U", nz, minz,maxz,nu,minu, maxu);
00106 viewV = new TH2D("hv","Hits V", nz, minz,maxz,nv,minv, maxv);
00107 viewU->SetStats(0);
00108 viewV->SetStats(0);
00109 viewU->SetDirectory(0);
00110 viewV->SetDirectory(0);
00111
00112 if(mypoh)
00113 {
00114 padU->cd();
00115 viewU->Draw();
00116 DrawClusters(2,viewU);
00117 DrawVertex(2);
00118 if(isMC)DrawTrueVertex(2);
00119 DrawChains(2);
00120 if(isMC)DrawTruthVectors(ntp,ntpEvt,2);
00121
00122
00123 padV->cd();
00124 viewV->Draw();
00125 DrawClusters(3,viewV);
00126 DrawVertex(3);
00127 if(isMC)DrawTrueVertex(3);
00128 DrawChains(3);
00129 if(isMC)DrawTruthVectors(ntp,ntpEvt,3);
00130
00131 }
00132
00133 if(ntp)
00134 {
00135 padMC->cd();
00136 if(isMC)DrawInteractionDiagram(ntp,ntpEvt);
00137 padInfo->cd();
00138 if(isMC)DrawBasicInfo(ntp,ntpEvt);
00139 }
00140
00141 double maxz_u = viewU->GetMaximum();
00142 double maxz_v = viewV->GetMaximum();
00143 double maxz_both = maxz_u>maxz_v?maxz_u:maxz_v;
00144 viewU->GetZaxis()->SetRangeUser(0, maxz_both);
00145 viewV->GetZaxis()->SetRangeUser(0, maxz_both);
00146
00147 padU->Update();
00148 padV->Update();
00149 padMC->Update();
00150 padInfo->Update();
00151 myCanvas->Update();
00152
00153 }
00154
00155
00156 void HitView::DrawTruthVectors(NtpStRecord *str, int index, int view)
00157 {
00158
00159 std::vector<const NtpMCTruth* > thmc = str->GetMCTruths();
00160 if(thmc.size()<1)return;
00161 std::vector<const NtpTHEvent* > thevt = str->GetTHEvents();
00162 index = thevt[index]->neumc;
00163
00164
00165 vector<const NtpMCStdHep *> hep = str->GetMCStdHeps(index);
00166
00167 Int_t nStdHep = int(hep.size());
00168 Int_t *indicesToUse = new Int_t[nStdHep];
00169 Int_t *parent = new Int_t[nStdHep];
00170 Int_t *parent1 = new Int_t[nStdHep];
00171 Int_t incomingNeutrino = -1;
00172 Int_t cnt = 0;
00173
00174 for(int i=0;i<nStdHep;i++){
00175 if(hep[i]->mc==index) {
00176 indicesToUse[cnt] = i;
00177
00178 for(int j=0;j<nStdHep;j++){
00179 if ((Int_t)hep[j]->index==hep[i]->parent[0]){
00180 parent[i]=j;
00181 break;
00182 }
00183 }
00184
00185 for(int j=0;j<nStdHep;j++){
00186 if ((Int_t)hep[j]->index==hep[i]->parent[1]){
00187 parent1[i]=j;
00188 break;
00189 }
00190 }
00191
00192 if(hep[i]->IstHEP==0){
00193 if(abs(hep[i]->IdHEP)==12||abs(hep[i]->IdHEP)==14
00194 ||abs(hep[i]->IdHEP)==16) {
00195 incomingNeutrino=i;
00196 }
00197 parent[i] = -1;
00198 parent1[i] = -1;
00199 }
00200 cnt++;
00201 }else{
00202 parent[i] = -1;
00203 parent1[i] = -1;
00204 }
00205 }
00206
00207
00208
00209 for(int i=0;i<cnt;i++){
00210
00211 int toUse = indicesToUse[i];
00212 if(hep[toUse]->IstHEP==999){
00213 parent[i]=-1;
00214 continue;
00215 }
00216
00217 if(hep[toUse]->IstHEP!=1)continue;
00218
00219 double vt=view==2?mypoh->mctrue.vtx_u:mypoh->mctrue.vtx_v;
00220 double vz = mypoh->mctrue.vtx_z;
00221
00222
00223 double scale=0.1;
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 double nx = scale*hep[toUse]->p4[0];
00236 double ny = scale*hep[toUse]->p4[1];
00237 double nz = scale*hep[toUse]->p4[2];
00238
00239 double eu=1/sqrt(2.0)*(nx+ny);
00240 double ev=1/sqrt(2.0)*(-nx+ny);
00241
00242
00243 double et=view==2?eu:ev;
00244 et+=vt;
00245 double ez=vz + nz;
00246
00247
00248
00249 TLine *l = new TLine(vz,vt,ez,et);
00250
00251
00252 l->SetLineColor(2);
00253 l->Draw("same");
00254
00255 }
00256
00257
00258 }
00259
00260
00261 void HitView::DrawChains(int view)
00262 {
00263
00264 ChainHelper * ch = 0;
00265 if(view==2)
00266 ch=&mypoh->chu;
00267 else if(view==3)
00268 ch=&mypoh->chv;
00269 else return;
00270
00271
00272 std::vector<int> path =ch->FindMaxPath();
00273
00274 for(unsigned int i=0;i<ch->finished.size();i++)
00275 {
00276 if(ch->finished[i].parentChain>-1 || ch->finished[i].entries < 1)continue;
00277 int parentcount=2;
00278 Chain *todraw=ch->GetChain(ch->finished[i].myId);
00279
00280
00281 int dsize = todraw->t.size();
00282 int needconnect=0;
00283
00284 if (dsize==1)
00285
00286 {
00287
00288 if(todraw->parentChain>-1)
00289 {
00290 dsize=2;
00291 needconnect=1;
00292 }
00293 }
00294
00295 double * tt = new double[todraw->t.size()];
00296 double * tz = new double[todraw->t.size()];
00297 if(needconnect)
00298 {
00299 tt[0]=ch->GetChain(todraw->parentChain)->end_t;
00300 tz[0]=ch->GetChain(todraw->parentChain)->end_z;
00301 tz[1]=todraw->z[0];
00302 tt[1]=todraw->t[0];
00303 }
00304 else
00305 {
00306 std::copy(todraw->t.begin(),todraw->t.end(),tt);
00307 std::copy(todraw->z.begin(),todraw->z.end(),tz);
00308
00309 if(dsize==1)
00310 {
00311 tt[1]=tt[0];
00312 tz[1]=tz[0]-0.03;
00313 dsize=2;
00314
00315 }
00316
00317 }
00318
00319 TPolyLine *pl = new TPolyLine(dsize,tz,tt );
00320
00321
00322
00323
00324
00325 pl->SetLineColor(2);
00326
00327 int width=1;
00328
00329
00330 for(unsigned int j=0;j<path.size();j++)
00331 {
00332 if(path[j]==todraw->myId)width+=1;
00333 }
00334
00335 pl->SetLineWidth(width);
00336
00337 pl->Draw("same");
00338
00339 for (unsigned int k=0;k<ch->finished[i].children.size();k++)
00340 {
00341 parentcount++;
00342
00343 std::vector<int> c = ch->GetAllChildren(ch->GetChain(ch->finished[i].children[k]));
00344
00345 printf("parent %d children ", ch->finished[i].myId);
00346
00347 for(unsigned int j=0;j<c.size();j++)
00348 {
00349
00350 Chain *todraw=ch->GetChain(c[j]);
00351
00352 printf("%d ",todraw->myId);
00353
00354
00355 int dsize = todraw->t.size();
00356 int needconnect=0;
00357
00358 if (dsize==1)
00359
00360 {
00361
00362
00363 if(todraw->parentChain>-1)
00364 {
00365 dsize=2;
00366 needconnect=1;
00367 }
00368 }
00369
00370 double * tt = new double[todraw->t.size()];
00371 double * tz = new double[todraw->t.size()];
00372 if(needconnect)
00373 {
00374 if(!ch->GetChain(todraw->parentChain))
00375 {
00376 cout<<"ERROR!!!!!! bad chain in hitview.cxx line 272\n";
00377 return;
00378
00379 }
00380 tt[0]=ch->GetChain(todraw->parentChain)->end_t;
00381 tz[0]=ch->GetChain(todraw->parentChain)->end_z;
00382 tz[1]=todraw->z[0];
00383 tt[1]=todraw->t[0];
00384 }
00385 else
00386 {
00387 std::copy(todraw->t.begin(),todraw->t.end(),tt);
00388 std::copy(todraw->z.begin(),todraw->z.end(),tz);
00389
00390 if(dsize==1)
00391 {
00392 tt[1]=tt[0];
00393 tz[1]=tz[0]-0.03;
00394 dsize=2;
00395
00396 }
00397
00398 }
00399
00400 TPolyLine *pl = new TPolyLine(dsize,tz,tt );
00401
00402
00403
00404
00405 pl->SetLineColor(parentcount);
00406
00407
00408 int width=1;
00409
00410
00411 for(unsigned int j=0;j<path.size();j++)
00412 {
00413 if(path[j]==todraw->myId)width+=1;
00414 }
00415
00416 pl->SetLineWidth(width);
00417
00418 pl->Draw("same");
00419
00420 }printf("\n");
00421 }}
00422
00423 }
00424
00425
00426
00427
00428
00429 void HitView::DrawClusters(int view, TH2 * h)
00430 {
00431
00432 std::map<double, std::map<double, int> >::iterator p_iterr;
00433 std::map<double, int>::iterator s_iterr;
00434
00435
00436
00437 for(unsigned int i=0;i<mypoh->strips.hits.size();i++)
00438 {
00439 if(mypoh->strips.hits[i].view!=view)continue;
00440 if(mypoh->strips.hits[i].e<0.3)continue;
00441 h->Fill(mypoh->strips.hits[i].z,mypoh->strips.hits[i].t,mypoh->strips.hits[i].e);
00442
00443
00444 }
00445 h->SetStats(0);
00446 h->Draw("colz");
00447
00448 }
00449
00450
00451 void HitView::DrawVertex(int view)
00452 {
00453
00454 double t=0;
00455 if(view==2)
00456 t=mypoh->event.vtx_u;
00457 else if(view==3)
00458 t=mypoh->event.vtx_v;
00459 else return;
00460
00461 TMarker *m = new TMarker(mypoh->event.vtx_z, t, 3);
00462 m->Draw("same");
00463
00464 }
00465
00466 void HitView::DrawTrueVertex(int view)
00467 {
00468
00469 double t=0;
00470 if(view==2)
00471 t=mypoh->mctrue.vtx_u;
00472 else if(view==3)
00473 t=mypoh->mctrue.vtx_v;
00474 else return;
00475
00476 TMarker *m = new TMarker(mypoh->mctrue.vtx_z, t, 2);
00477 m->Draw("same");
00478
00479 }
00480
00481
00482
00483
00484
00485
00486 void HitView::DrawInteractionDiagram(NtpStRecord *str,int index)
00487 {
00488 cout <<"int "<<&str<<" "<<index<<endl;
00489
00490 if(!str || index<0)return;
00491
00492 cout <<"interaction\n";
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509 std::vector<const NtpMCTruth* > thmc = str->GetMCTruths();
00510 if(thmc.size()<1)return;
00511 std::vector<const NtpTHEvent* > thevt = str->GetTHEvents();
00512 index = thevt[index]->neumc;
00513
00514
00515
00516
00517
00518 vector<const NtpMCStdHep *> hep;
00519
00520
00521
00522 hep = str->GetMCStdHeps(index);
00523
00524
00525
00526
00527 Int_t nStdHep = int(hep.size());
00528 Int_t *indicesToUse = new Int_t[nStdHep];
00529 Int_t *parent = new Int_t[nStdHep];
00530 Int_t *parent1 = new Int_t[nStdHep];
00531 Int_t incomingNeutrino = -1;
00532 Int_t cnt = 0;
00533
00534
00535
00536 for(int i=0;i<nStdHep;i++){
00537 if(hep[i]->mc==index) {
00538 indicesToUse[cnt] = i;
00539
00540
00541
00542
00543
00544
00545
00546
00547 for(int j=0;j<nStdHep;j++){
00548 if ((Int_t)hep[j]->index==hep[i]->parent[0]){
00549 parent[i]=j;
00550 break;
00551 }
00552 }
00553
00554
00555 for(int j=0;j<nStdHep;j++){
00556 if ((Int_t)hep[j]->index==hep[i]->parent[1]){
00557 parent1[i]=j;
00558 break;
00559 }
00560 }
00561
00562
00563
00564
00565 if(hep[i]->IstHEP==0){
00566 if(abs(hep[i]->IdHEP)==12||abs(hep[i]->IdHEP)==14
00567 ||abs(hep[i]->IdHEP)==16) {
00568 incomingNeutrino=i;
00569
00570
00571 }
00572 parent[i] = -1;
00573 parent1[i] = -1;
00574 }
00575 cnt++;
00576 }
00577 else{
00578 parent[i] = -1;
00579 parent1[i] = -1;
00580 }
00581 }
00582
00583
00584
00585
00586
00587
00588
00589
00590 TArrow *arrow[1000];
00591 TMarker *marker[1000];
00592 for(int i=0;i<nStdHep;i++) {
00593 arrow[i] = new TArrow(0,0,0,0,.01,"|>");
00594 arrow[i]->SetLineWidth(1);
00595 arrow[i]->SetLineStyle(3);
00596 arrow[i]->SetFillColor(39);
00597 arrow[i]->SetLineColor(39);
00598 marker[i] = new TMarker(0,0,24);
00599 marker[i]->SetMarkerSize(.2);
00600 marker[i]->SetMarkerColor(38);
00601 }
00602
00603
00604 Double_t Available[5] = {0.9,0.7,0.7,0.1};
00605
00606
00607
00608
00609
00610 for(int i=0;i<cnt;i++){
00611
00612 int toUse = indicesToUse[i];
00613 if(hep[toUse]->IstHEP==999){
00614 parent[i]=-1;
00615 continue;
00616 }
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630 if((hep[toUse]->child[0]==hep[toUse]->child[1]) &&
00631 (hep[toUse]->IstHEP==2 || hep[toUse]->IstHEP==3 || hep[toUse]->IstHEP==14) &&
00632 hep[toUse]->child[0]!=-1){
00633 int j;
00634 int child = hep[toUse]->child[0];
00635 for(j=0;j<cnt;j++){
00636 if ((Int_t)hep[j]->index==child)break;
00637 }
00638
00639
00640 if (j<nStdHep){
00641 arrow[j]->SetX1(arrow[i]->GetX1());
00642 arrow[j]->SetY1(arrow[i]->GetY1());
00643
00644 parent[i]=-1;
00645
00646 continue;
00647 }else{
00648 cout<<"Error! - linking failed, index out of range! \n";
00649 }
00650 }
00651
00652
00653
00654 if((hep[toUse]->IstHEP==205||hep[toUse]->IstHEP==1205)&&
00655 (hep[parent[toUse]]->IstHEP!=1 || hep[parent1[toUse]]->IstHEP!=1)){
00656 parent[i]=-1;
00657
00658 continue;
00659 }
00660
00661
00662
00663
00664 Double_t mom = sqrt(hep[toUse]->p4[0]*hep[toUse]->p4[0] +
00665 hep[toUse]->p4[1]*hep[toUse]->p4[1] +
00666 hep[toUse]->p4[2]*hep[toUse]->p4[2]);
00667 double x=0.,y=0.;
00668 int col=0;
00669 char text[256];
00670
00671
00672 if(hep[toUse]->IstHEP==0) {
00673 x = 0.05;
00674 y=Available[0]; Available[0] -= 0.05;
00675 }
00676 else if(hep[toUse]->IstHEP==2) {
00677 x = 0.15;
00678 y=Available[1]; Available[1] -= 0.05;
00679 }
00680 else if(hep[toUse]->IstHEP==11) {
00681 x = 0.05;
00682 y=Available[0]; Available[0] -= 0.05;
00683 }
00684 else if(hep[toUse]->IstHEP==3||hep[toUse]->IstHEP==14) {
00685 x = 0.3;
00686 y=Available[1]; Available[1] -= 0.05;
00687 }
00688 else if(hep[toUse]->IstHEP==1){
00689 x = 0.55;
00690 y=Available[2]; Available[2] -= 0.05;
00691 }
00692 else if((hep[toUse]->IstHEP==205||hep[toUse]->IstHEP==1205)){
00693 x = 0.8;
00694 y=Available[3]; Available[3] += 0.05;
00695 }
00696
00697
00698 if(abs(hep[toUse]->IdHEP)==12) {
00699 if(parent[toUse]==incomingNeutrino) y = 0.9;
00700 sprintf(text,"#nu_{e}"); col = 3;
00701 if(hep[toUse]->IdHEP<0) sprintf(text,"#bar{#nu}_{e}");
00702 }
00703 else if(abs(hep[toUse]->IdHEP)==14) {
00704 if(parent[toUse]==incomingNeutrino) y = 0.9;
00705 sprintf(text,"#nu_{#mu}"); col = 4;
00706 if(hep[toUse]->IdHEP<0) sprintf(text,"#bar{#nu}_{#mu}");
00707 }
00708 else if(abs(hep[toUse]->IdHEP)==16) {
00709 if(parent[toUse]==incomingNeutrino) y = 0.9;
00710 sprintf(text,"#nu_{#tau}"); col = 105;
00711 if(hep[toUse]->IdHEP<0) sprintf(text,"#bar{#nu}_{#tau}");
00712 }
00713 else if(abs(hep[toUse]->IdHEP)==11) {
00714 if(parent[toUse]==incomingNeutrino) y = 0.9;
00715 sprintf(text,"e^{-}"); col = 3;
00716 if(hep[toUse]->IdHEP<0) sprintf(text,"e^{+}");
00717 }
00718 else if(abs(hep[toUse]->IdHEP)==13) {
00719 if(parent[toUse]==incomingNeutrino) y = 0.9;
00720 sprintf(text,"#mu^{-}"); col = 4;
00721 if(hep[toUse]->IdHEP<0) sprintf(text,"#mu^{+}");
00722 }
00723 else if(abs(hep[toUse]->IdHEP)==15) {
00724
00725
00726 sprintf(text,"#tau^{-}"); col = 105;
00727 if(hep[toUse]->IdHEP<0) sprintf(text,"#tau^{+}");
00728 }
00729 else if(hep[toUse]->IdHEP==22) {
00730 sprintf(text,"#gamma"); col = 9;
00731 }
00732 else if(hep[toUse]->IdHEP>1000000000) {
00733 y = 0.8;
00734 sprintf(text,"nucleus(%i,%i)",int((hep[toUse]->IdHEP-1e9)/1e6),
00735 int((hep[toUse]->IdHEP-1e9 - 1e6*int((hep[toUse]->IdHEP-1e9)
00736 /1e6))/1e3));
00737 col = 15;
00738 }
00739 else if(hep[toUse]->IdHEP==2112){
00740 sprintf(text,"neutron"); col = 28;
00741 }
00742 else if(hep[toUse]->IdHEP==2212){
00743 sprintf(text,"proton"); col = 2;
00744 }
00745 else if(abs(hep[toUse]->IdHEP)==211) {
00746 sprintf(text,"#pi^{+}"); col = 6;
00747 if(hep[toUse]->IdHEP<0) sprintf(text,"#pi^{-}");
00748 }
00749 else if(hep[toUse]->IdHEP==111) {
00750 sprintf(text,"#pi^{0}"); col = 7;
00751 }
00752 else if(hep[toUse]->IdHEP==130) {
00753 sprintf(text,"K^{0}_{L}"); col = 31;
00754 }
00755 else if(hep[toUse]->IdHEP==310) {
00756 sprintf(text,"K^{0}_{S}"); col = 31;
00757 }
00758 else if(hep[toUse]->IdHEP==311) {
00759 sprintf(text,"K^{0}"); col = 31;
00760 }
00761 else if(abs(hep[toUse]->IdHEP)==321) {
00762 sprintf(text,"K^{+}"); col = 31;
00763 if(hep[toUse]->IdHEP<0) sprintf(text,"K^{-}"); col = 31;
00764 }
00765 else if(hep[toUse]->IdHEP==28) {
00766 sprintf(text,"Geantino"); col = 46;
00767 if(hep[toUse]->IdHEP<0) sprintf(text,"K^{-}"); col = 31;
00768 }
00769 else {
00770 sprintf(text,"ID: %i",hep[toUse]->IdHEP); col=43;
00771 }
00772
00773 sprintf(text,"%s [%.1f GeV/c]",text,mom);
00774
00775 arrow[toUse]->SetX2(x-0.02);
00776 arrow[toUse]->SetY2(y-0.02);
00777 marker[toUse]->SetX(x-0.02);
00778 marker[toUse]->SetY(y-0.02);
00779
00780 for(int j=0;j<nStdHep;j++){
00781
00782 if(parent[j]==toUse){
00783 arrow[j]->SetX1(x-0.02);
00784 arrow[j]->SetY1(y-0.02);
00785
00786 }
00787 }
00788
00789 TLatex *tex = new TLatex(x,y,text);
00790 char texname[256];
00791 sprintf(texname,"tex%i",i);
00792 tex->SetName(texname);
00793 tex->SetTextSize(0.03);
00794 tex->SetTextColor(col);
00795 tex->Draw();
00796 }
00797
00798 for(int i=0;i<nStdHep;i++){
00799 if(parent[i]==-1){
00800 delete arrow[i];
00801 delete marker[i];
00802 }
00803 else {
00804
00805
00806
00807
00808
00809
00810
00811
00812 arrow[i]->Draw();
00813 marker[i]->Draw();
00814
00815 }
00816 }
00817
00818
00819
00820
00821
00822 Double_t minAvail = 0;
00823 for(int i=0;i<4;i++){
00824 if(Available[i]<minAvail) minAvail = Available[i];
00825 }
00826
00827 delete [] indicesToUse;
00828 delete [] parent;
00829
00830
00831
00832 }
00833
00834
00835
00836
00837 void HitView::DrawBasicInfo(NtpStRecord *str,int index)
00838 {
00839
00840
00841 info6->Clear();
00842 info7->Clear();
00843 info8->Clear();
00844 info9->Clear();
00845 info10->Clear();
00846 info11->Clear();
00847 info12->Clear();
00848 info13->Clear();
00849
00850
00851
00852
00853
00854
00855 char text5[100];
00856 char text6[100];
00857 char text7[100];
00858 char text8[100];
00859 char text9[100];
00860 char text10[100];
00861
00862
00863
00864 if(!str || index <0)return;
00865
00866 sprintf(text5,"Run: %d, Snarl: %d, Event: %d",str->GetHeader().GetRun(),str->GetHeader().GetSnarl(),index);
00867
00868
00869
00870 std::vector<const NtpMCStdHep* > stdhep = str->GetMCStdHeps();
00871
00872
00873 double energy =0;
00874
00875 if(stdhep.size()>0)
00876 {
00877 printf("STDHEPS %d %f %f %f %f\n",(int)stdhep.size(),stdhep[0]->p4[0],stdhep[0]->p4[1],stdhep[0]->p4[2],stdhep[0]->p4[3]);
00878 energy = stdhep[0]->p4[3];
00879 }
00880
00881 sprintf(text6,"Single Particle Energy %f",energy);
00882
00883 int mcinfoc=1;
00884
00885 double textsize=0.12;
00886
00887 if(stdhep.size()==1)
00888 {
00889
00890 info6->SetText(0.05,1-1*(textsize*1.1),text5);
00891 info6->SetTextSize(textsize);
00892 info6->SetTextColor(mcinfoc);
00893 info6->Draw();
00894
00895 info7->SetText(0.05,1-2*(textsize*1.1),text6);
00896 info7->SetTextSize(textsize);
00897 info7->SetTextColor(mcinfoc);
00898 info7->Draw();
00899
00900 return;
00901 }
00902 std::vector<const NtpMCTruth* > thmc = str->GetMCTruths();
00903 std::vector<const NtpTHEvent* > thevt = str->GetTHEvents();
00904
00905
00906
00907
00908 if(thmc.size()<1)return;
00909
00910 const NtpMCTruth * mctruth = thmc[thevt[index]->neumc];
00911
00912
00913 char tmptxt[100];
00914 tmptxt[0]=0;
00915 if (mctruth->iaction==0){
00916 sprintf(text6,"NC event %s",tmptxt);
00917 }
00918 else{
00919 if (abs(mctruth->inunoosc)==12&&abs(mctruth->inu)==12){
00920 sprintf(text6,"beam #nu_{e} CC %s",tmptxt);
00921 }
00922 if (abs(mctruth->inunoosc)==12&&abs(mctruth->inu)==14){
00923 sprintf(text6,"beam #nu_{e}#rightarrow#nu_{#mu} CC %s",tmptxt);
00924 }
00925 if (abs(mctruth->inunoosc)==12&&abs(mctruth->inu)==16){
00926 sprintf(text6,"beam #nu_{e}#rightarrow#nu_{#tau} CC %s",tmptxt);
00927 }
00928 if (abs(mctruth->inunoosc)==14&&abs(mctruth->inu)==14){
00929 sprintf(text6,"#nu_{#mu}#rightarrow#nu_{#mu} CC %s",tmptxt);
00930 }
00931 if (abs(mctruth->inunoosc)==14&&abs(mctruth->inu)==12){
00932 sprintf(text6,"#nu_{#mu}#rightarrow#nu_{e} CC %s",tmptxt);
00933 }
00934 if (abs(mctruth->inunoosc)==14&&abs(mctruth->inu)==16){
00935 sprintf(text6,"#nu_{#mu}#rightarrow#nu_{#tau} CC %s",tmptxt);
00936 }
00937 if (abs(mctruth->inunoosc)==16&&abs(mctruth->inu)==14){
00938 sprintf(text6,"#nu_{#tau}#rightarrow#nu_{#mu} CC %s",tmptxt);
00939 }
00940 if (abs(mctruth->inunoosc)==16&&abs(mctruth->inu)==12){
00941 sprintf(text6,"#nu_{#tau}#rightarrow#nu_{e} CC %s",tmptxt);
00942 }
00943 if (abs(mctruth->inunoosc)==16&&abs(mctruth->inu)==16){
00944 sprintf(text6,"#nu_{#tau}#rightarrow#nu_{#tau} CC %s",tmptxt);
00945 }
00946 }
00947 if (mctruth->iresonance==1001 && mctruth->iaction==1){
00948 sprintf(text7,"quasi-elastic");
00949 }
00950 if (mctruth->iresonance==1001 && mctruth->iaction==0){
00951 sprintf(text7,"elastic");
00952 }
00953 if (mctruth->iresonance==1002){
00954 sprintf(text7,"resonance production");
00955 }
00956 if (mctruth->iresonance==1003){
00957 sprintf(text7,"DIS");
00958 }
00959 if (mctruth->iresonance==1004){
00960 sprintf(text7,"coherent production");
00961 }
00962 sprintf(text8,"E_{#nu}: %.1fGeV, E_{shw}: %.1fGeV",TMath::Abs(mctruth->p4neu[3]),TMath::Abs(mctruth->p4shw[3]));
00963 sprintf(text9,"Y: %.2f, emfrac: %.2f",mctruth->y,mctruth->emfrac);
00964 sprintf(text10,"E_{#mu}: %.1fGeV, E_{el}: %.1fGeV",TMath::Abs(mctruth->p4mu1[3]),TMath::Abs(mctruth->p4el1[3]));
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977 info6->SetText(0.05,1-1*(textsize*1.1),text5);
00978 info6->SetTextSize(textsize);
00979 info6->SetTextColor(mcinfoc);
00980
00981
00982 info7->SetText(0.05,1-2*(textsize*1.1),text6);
00983 info7->SetTextSize(textsize);
00984 info7->SetTextColor(mcinfoc);
00985
00986 info8->SetText(0.05,1-3*(textsize*1.1),text7);
00987 info8->SetTextSize(textsize);
00988 info8->SetTextColor(mcinfoc);
00989
00990 info9->SetText(0.05,1-4*(textsize*1.1),text8);
00991 info9->SetTextSize(textsize);
00992 info9->SetTextColor(mcinfoc);
00993
00994 info10->SetText(0.05,1-5*(textsize*1.1),text9);
00995 info10->SetTextSize(textsize);
00996 info10->SetTextColor(mcinfoc);
00997
00998 info11->SetText(0.05,1-6*(textsize*1.1),text10);
00999 info11->SetTextSize(textsize);
01000 info11->SetTextColor(mcinfoc);
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014 info6->Draw();
01015 info7->Draw();
01016 info8->Draw();
01017 info9->Draw();
01018 info10->Draw();
01019 info11->Draw();
01020
01021
01022
01023 }
01024
01025
01026