HitView Class Reference

#include <HitView.h>

Inheritance diagram for HitView:
Page

List of all members.

Public Member Functions

 HitView ()
 ~HitView ()
virtual void BuildDisplay (TCanvas *c)
virtual void DrawEvent (ParticleObjectHolder *poh=0, NtpStRecord *ntp=0, int ntpEvt=-1)
void DrawChains (int view)
void DrawTrueVertex (int view)
void DrawVertex (int view)
void DrawClusters (int view, TH2 *h)
void DrawInteractionDiagram (NtpStRecord *str, int index)
void DrawBasicInfo (NtpStRecord *str, int index)
void DrawTruthVectors (NtpStRecord *str, int index, int view)

Private Attributes

TPad * padU
TPad * padV
TPad * padMC
TPad * padInfo
TH2D * viewU
TH2D * viewV
ParticleObjectHoldermypoh
TLatex * info6
TLatex * info7
TLatex * info8
TLatex * info9
TLatex * info10
TLatex * info11
TLatex * info12
TLatex * info13

Detailed Description

Definition at line 13 of file HitView.h.


Constructor & Destructor Documentation

HitView::HitView (  ) 

Definition at line 17 of file HitView.cxx.

References info10, info11, info12, info13, info6, info7, info8, info9, padU, padV, viewU, and viewV.

00017                 :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 }

HitView::~HitView (  ) 

Definition at line 36 of file HitView.cxx.

00037 {}


Member Function Documentation

void HitView::BuildDisplay ( TCanvas *  c  )  [virtual]

Reimplemented from Page.

Definition at line 40 of file HitView.cxx.

References Page::myCanvas, padInfo, padMC, padU, and padV.

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 }

void HitView::DrawBasicInfo ( NtpStRecord str,
int  index 
)

Definition at line 837 of file HitView.cxx.

References NtpMCTruth::emfrac, RecRecordImp< T >::GetHeader(), NtpStRecord::GetMCStdHeps(), NtpStRecord::GetMCTruths(), RecDataHeader::GetRun(), RecPhysicsHeader::GetSnarl(), NtpStRecord::GetTHEvents(), NtpMCTruth::iaction, info10, info11, info12, info13, info6, info7, info8, info9, NtpMCTruth::inu, NtpMCTruth::inunoosc, NtpMCTruth::iresonance, NtpMCTruth::p4el1, NtpMCTruth::p4mu1, NtpMCTruth::p4neu, NtpMCTruth::p4shw, and NtpMCTruth::y.

Referenced by DrawEvent().

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   //char text1[100];
00851   //char text2[100];
00852   //char text3[100];
00853   //char text31[100];
00854   //char text4[100];
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   //char text11[100];
00862   //char text12[100];
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;//sprintf(tmptxt,"");
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     if (foundST) {
00968       sprintf(text11,"E_{#pi^{0}}_tot: %.2fGeV, E_{#pi^{0}}_neugen: %.2fGeV",stdhepinfo.epi0_total,stdhepinfo.epi0_neugen);
00969       sprintf(text12,"E_{#pi^{0}}_abs: %.2fGeV, E_{#pi^{0}}_intranuke: %.2fGeV",stdhepinfo.epi0_abs,stdhepinfo.epi0_intranuke);
00970     }
00971 */
00972 
00973 //      int mcinfoc=1;
00974         
00975 //      double textsize=0.12;
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     info12->SetText(0.05,0.14,text11);
01004     info12->SetTextSize(textsize);
01005     info12->SetTextColor(mcinfoc);
01006 
01007     info13->SetText(0.05,0.08,text12);
01008     info13->SetTextSize(textsize);
01009     info13->SetTextColor(mcinfoc);
01010   */  
01011     
01012   //  padr->cd(1);
01013 
01014         info6->Draw();
01015     info7->Draw();
01016     info8->Draw();
01017     info9->Draw();
01018     info10->Draw();
01019     info11->Draw();
01020    // info12->Draw();
01021    // info13->Draw();
01022     
01023 }

void HitView::DrawChains ( int  view  ) 

Definition at line 261 of file HitView.cxx.

References ParticleObjectHolder::chu, ParticleObjectHolder::chv, copy(), Chain::end_t, Chain::end_z, ChainHelper::FindMaxPath(), ChainHelper::finished, ChainHelper::GetAllChildren(), ChainHelper::GetChain(), Chain::myId, mypoh, Chain::parentChain, Chain::t, and Chain::z.

Referenced by DrawEvent().

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                 //draw the parent
00281             int dsize = todraw->t.size();
00282         int needconnect=0;
00283 
00284             if (dsize==1)  //chain with only 1 cluster needs to draw line to parent explicitly... if not a head chain
00285                                                 //other wise, make the single cluster, head chain, no children noticeable
00286          {
00287          //      if(todraw->parentChain<0)continue;
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          //int linecol =2+todraw->level;
00322 
00323         //      pl->SetLineColor(linecol);
00324         //      pl->SetLineColor(parentcount);
00325                  pl->SetLineColor(2);
00326 
00327          int width=1;
00328          //should make this better if it is to be really used
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          //    pl->Draw();
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)  //chain with only 1 cluster needs to draw line to parent explicitly... if not a head chain
00359                                                 //other wise, make the single cluster, head chain, no children noticeable 
00360                 {
00361                 //      if(todraw->parentChain<0)continue;
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                 //int linecol =2+todraw->level;
00403 
00404         //      pl->SetLineColor(linecol);
00405                 pl->SetLineColor(parentcount);
00406 
00407 
00408                 int width=1;
00409                 //should make this better if it is to be really used
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         //      pl->Draw();
00418                 pl->Draw("same");
00419  
00420                 }printf("\n");
00421         }}      
00422                 
00423 }       

void HitView::DrawClusters ( int  view,
TH2 *  h 
)

Definition at line 429 of file HitView.cxx.

References StripHolder::hits, mypoh, and ParticleObjectHolder::strips.

Referenced by DrawEvent().

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 }

void HitView::DrawEvent ( ParticleObjectHolder poh = 0,
NtpStRecord ntp = 0,
int  ntpEvt = -1 
) [virtual]

Reimplemented from Page.

Definition at line 56 of file HitView.cxx.

References DrawBasicInfo(), DrawChains(), DrawClusters(), DrawInteractionDiagram(), DrawTrueVertex(), DrawTruthVectors(), DrawVertex(), RecRecordImp< T >::GetHeader(), VldContext::GetSimFlag(), RecHeader::GetVldContext(), isMC, SimFlag::kMC, StripHolder::maxu, StripHolder::maxv, StripHolder::maxz, ParticleObjectHolder::mctrue, StripHolder::minu, StripHolder::minv, StripHolder::minz, Page::myCanvas, mypoh, padInfo, padMC, padU, padV, ParticleObjectHolder::strips, viewU, viewV, MCTrue::vtx_u, MCTrue::vtx_v, and MCTrue::vtx_z.

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 }

void HitView::DrawInteractionDiagram ( NtpStRecord str,
int  index 
)

Definition at line 486 of file HitView.cxx.

References NtpStRecord::GetMCStdHeps(), NtpStRecord::GetMCTruths(), and NtpStRecord::GetTHEvents().

Referenced by DrawEvent().

00487 {
00488         cout <<"int "<<&str<<" "<<index<<endl;
00489 
00490         if(!str || index<0)return;
00491         
00492         cout <<"interaction\n";
00493 
00494   //modified by steve cavanaugh aug 9, 2006 to take into account double particles in mc with IstHEP=2 
00495   //with modifications for readability
00496   
00497 
00498 /*
00499         TPad *tp1=new TPad("tp1","tp1",0.0,0.0,1,0.75);
00500                 
00501         tp1->Draw();
00502 
00503 
00504 
00505         tp1->cd();
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  // if (foundST) hep = SntpHelpers::GetStdHepArray(index, st);
00520  // else hep = SntpHelpers::GetStdHepArray(index, mc);
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       //parent[i] = hep[i]->parent[0];
00543 
00544       //in the case where we have more than 1 event per snarl we might 
00545       //have indices which refer to the actual index, not the one for the particular event.... 
00546       //so make sure we match this up properly
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; //don't draw arrows to initial state particles
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   //make arrows and markers
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   //now loop through valid stdhep entries and fill variables  
00604   Double_t Available[5] = {0.9,0.7,0.7,0.1};  
00605   
00606   //double max_a_3=0.7;
00607   
00608   //cout<<"nStdHep: "<<nStdHep<<"\n";
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     //    cout<<toUse<<"  "<<hep[toUse]->IstHEP<<"   "<<nStdHep<<endl;
00621     //cout<<parent[toUse]<<"   "<<parent1[toUse]<<endl;
00622 
00623 
00624 
00625     
00626     
00627     //sc - avoid any double taus' charms' etc, but set the proper parent/child 
00628     //(remove the particle between true parent and child)
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       //we've lost arrow tail info, so fix it
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     //sc - avoid any "later decays" not comming from IstHEP=1 decays .. .these are children of double taus, etc
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       //cout <<"breaking out of loop for particle "<<i<<"\n";
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     //set x,y    
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) {   //sc - allow for both IstHEP=3 and 14 intermediate decays
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; //seems to be opposite ordered....
00695     }
00696  
00697     //set colour and label (and override y in special cases)
00698     if(abs(hep[toUse]->IdHEP)==12) { //nue
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) { //numu
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) { //nutau
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) { //e
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) { //mu
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) { //tau
00724       //tau will decay so it is easier to read if it is not on the top line...
00725       // if(parent[toUse]==incomingNeutrino) y = 0.9;                  
00726       sprintf(text,"#tau^{-}"); col = 105;
00727       if(hep[toUse]->IdHEP<0) sprintf(text,"#tau^{+}"); 
00728     }
00729     else if(hep[toUse]->IdHEP==22) { //photon
00730       sprintf(text,"#gamma"); col = 9;      
00731     }
00732     else if(hep[toUse]->IdHEP>1000000000) { //nucleus
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         //cout<<"writing arrows from "<<j << " to "<<parent[j]<<"\n";
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     //  if(arrow[i]->GetX2()== 0.78 )
00806    //   {
00807    //           arrow[i]->SetY2(arrow[i]->GetY2()+0.5);//max_a_3-Available[3]);
00808     //          marker[i]->SetY(marker[i]->GetY()+0.5);//max_a_3-Available[3]);
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 }

void HitView::DrawTrueVertex ( int  view  ) 

Definition at line 466 of file HitView.cxx.

References Munits::m, ParticleObjectHolder::mctrue, mypoh, MCTrue::vtx_u, MCTrue::vtx_v, and MCTrue::vtx_z.

Referenced by DrawEvent().

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 }

void HitView::DrawTruthVectors ( NtpStRecord str,
int  index,
int  view 
)

Definition at line 156 of file HitView.cxx.

References NtpStRecord::GetMCStdHeps(), NtpStRecord::GetMCTruths(), NtpStRecord::GetTHEvents(), ParticleObjectHolder::mctrue, mypoh, MCTrue::vtx_u, MCTrue::vtx_v, and MCTrue::vtx_z.

Referenced by DrawEvent().

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; //don't draw arrows to initial state particles
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                 //scale for length of line
00223                 double scale=0.1;
00224                 
00225         /*      double ptot = sqrt(hep[toUse]->p4[0]*hep[toUse]->p4[0]+hep[toUse]->p4[1]*hep[toUse]->p4[1]+hep[toUse]->p4[2]*hep[toUse]->p4[2]);
00226                 
00227                 double angu = atan(hep[toUse]->p4[0]/hep[toUse]->p4[2]);
00228                 double angv = atan(hep[toUse]->p4[1]/hep[toUse]->p4[2]);
00229                 
00230                 double nx = ptot*scale*sin(angu);
00231                 double ny = ptot*scale*sin(angv);
00232                 double nz = ptot*scale;
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 }

void HitView::DrawVertex ( int  view  ) 

Definition at line 451 of file HitView.cxx.

References ParticleObjectHolder::event, Munits::m, mypoh, ParticleEvent::vtx_u, ParticleEvent::vtx_v, and ParticleEvent::vtx_z.

Referenced by DrawEvent().

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 }


Member Data Documentation

TLatex* HitView::info10 [private]

Definition at line 49 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TLatex* HitView::info11 [private]

Definition at line 50 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TLatex* HitView::info12 [private]

Definition at line 51 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TLatex* HitView::info13 [private]

Definition at line 52 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TLatex* HitView::info6 [private]

Definition at line 45 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TLatex* HitView::info7 [private]

Definition at line 46 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TLatex* HitView::info8 [private]

Definition at line 47 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TLatex* HitView::info9 [private]

Definition at line 48 of file HitView.h.

Referenced by DrawBasicInfo(), and HitView().

TPad* HitView::padInfo [private]

Definition at line 35 of file HitView.h.

Referenced by BuildDisplay(), and DrawEvent().

TPad* HitView::padMC [private]

Definition at line 34 of file HitView.h.

Referenced by BuildDisplay(), and DrawEvent().

TPad* HitView::padU [private]

Definition at line 32 of file HitView.h.

Referenced by BuildDisplay(), DrawEvent(), and HitView().

TPad* HitView::padV [private]

Definition at line 33 of file HitView.h.

Referenced by BuildDisplay(), DrawEvent(), and HitView().

TH2D* HitView::viewU [private]

Definition at line 37 of file HitView.h.

Referenced by DrawEvent(), and HitView().

TH2D* HitView::viewV [private]

Definition at line 38 of file HitView.h.

Referenced by DrawEvent(), and HitView().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1