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