ChainView Class Reference

#include <ChainView.h>

Inheritance diagram for ChainView:
Page

List of all members.

Public Member Functions

 ChainView ()
 ~ChainView ()
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)

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 ChainView.h.


Constructor & Destructor Documentation

ChainView::ChainView (  ) 

Definition at line 21 of file ChainView.cxx.

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

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

ChainView::~ChainView (  ) 

Definition at line 40 of file ChainView.cxx.

00041 {}


Member Function Documentation

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

Reimplemented from Page.

Definition at line 44 of file ChainView.cxx.

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

Referenced by ParticleDisplay::BuildDisplay().

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 }

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

Definition at line 903 of file ChainView.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().

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   //char text1[100];
00917   //char text2[100];
00918   //char text3[100];
00919   //char text31[100];
00920   //char text4[100];
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   //char text11[100];
00928   //char text12[100];
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;//sprintf(tmptxt,"");
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     if (foundST) {
01038       sprintf(text11,"E_{#pi^{0}}_tot: %.2fGeV, E_{#pi^{0}}_neugen: %.2fGeV",stdhepinfo.epi0_total,stdhepinfo.epi0_neugen);
01039       sprintf(text12,"E_{#pi^{0}}_abs: %.2fGeV, E_{#pi^{0}}_intranuke: %.2fGeV",stdhepinfo.epi0_abs,stdhepinfo.epi0_intranuke);
01040     }
01041 */
01042 
01043 //      int mcinfoc=1;
01044         
01045 //      double textsize=0.12;
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     info12->SetText(0.05,0.14,text11);
01074     info12->SetTextSize(textsize);
01075     info12->SetTextColor(mcinfoc);
01076 
01077     info13->SetText(0.05,0.08,text12);
01078     info13->SetTextSize(textsize);
01079     info13->SetTextColor(mcinfoc);
01080   */  
01081     
01082   //  padr->cd(1);
01083 
01084         info6->Draw();
01085     info7->Draw();
01086     info8->Draw();
01087     info9->Draw();
01088     info10->Draw();
01089     info11->Draw();
01090    // info12->Draw();
01091    // info13->Draw();
01092     
01093 }

void ChainView::DrawChains ( int  view  ) 

Definition at line 159 of file ChainView.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().

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                 //draw the parent
00179             int dsize = todraw->t.size();
00180         int needconnect=0;
00181 
00182             if (dsize==1)  //chain with only 1 cluster needs to draw line to parent explicitly... if not a head chain
00183                                                 //other wise, make the single cluster, head chain, no children noticeable
00184          {
00185          //      if(todraw->parentChain<0)continue;
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          //int linecol =2+todraw->level;
00220 
00221         //      pl->SetLineColor(linecol);
00222         //      pl->SetLineColor(parentcount);
00223                  pl->SetLineColor(2);
00224 
00225          int width=1;
00226          //should make this better if it is to be really used
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          //    pl->Draw();
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            // printf("parent %d children ", ch->finished[i].myId);
00244                        
00245             for(unsigned int j=0;j<c.size();j++)
00246             {               
00247                                 
00248                 Chain *todraw=ch->GetChain(c[j]);
00249 
00250                 //printf("%d ",todraw->myId);
00251 
00252                 
00253                 int dsize = todraw->t.size();
00254                 int needconnect=0;
00255 
00256                 if (dsize==1)  //chain with only 1 cluster needs to draw line to parent explicitly... if not a head chain
00257                                                 //other wise, make the single cluster, head chain, no children noticeable 
00258                 {
00259                 //      if(todraw->parentChain<0)continue;
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                 //int linecol =2+todraw->level;
00301 
00302         //      pl->SetLineColor(linecol);
00303                 pl->SetLineColor(parentcount);
00304 
00305 
00306                 int width=1;
00307                 //should make this better if it is to be really used
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         //      pl->Draw();
00316                 pl->Draw("same");
00317  
00318                 }//printf("\n");
00319         }}      
00320                 
00321 }       

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

Definition at line 327 of file ChainView.cxx.

References ParticleObjectHolder::cluster_saver, ParticleObjectHolder::clusterer, Managed::ClusterSaver::clusters, Managed::ManagedCluster::e, Managed::ClusterSaver::GetCluster(), Managed::ClusterManager::GetCluster(), Managed::ClusterSaver::GetClusterMap(), Managed::ClusterManager::GetClusterMap(), Managed::ManagedCluster::GetStatus(), Munits::m, and mypoh.

Referenced by DrawEvent().

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         //maxe should hold the minimum e cutoff to restrict one hit per plane
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;  //printf("maxe %f\n",maxe);
00346                 }
00347 
00348          if(TMath::Abs(p_iterr->first-lastplane)>0.02){
00349                 maxpe=0;
00350                 secmaxpe=0;
00351                 //printf("newplane\n");
00352          }
00353    
00354         //printf("plane %f\n",p_iterr->first);
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; //need to be slightly larger than second largest peak to make sure we cut it out
00364                                 maxpe=ce;
00365                         }else secmaxpe=ce+0.001;
00366                         
00367                         
00368                 }
00369                 
00370                 //printf("t %f  e %f\n",s_iterr->first,ce);
00371                 //printf("updating maxe %f secmaxpe %f\n",maxpe,secmaxpe);
00372                         
00373          }
00374 
00375          lastplane=p_iterr->first;
00376    }
00377    maxe = maxe<secmaxpe?secmaxpe:maxe;
00378         //printf("maxe %f\n",maxe);
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                         //Managed::ManagedCluster * clus = cluhs->GetCluster(s_iterr->second);
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         /*      if( cluh->GetCluster(s_iterr->second)->e>maxe)
00420                 {
00421                     TMarker *m=new TMarker(p_iterr->first,s_iterr->first, 25);
00422                         m->Draw("same");
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                 //draw the size of the cluster....
00436                 
00437 
00438                 
00439                 
00440          }
00441          }
00442 
00443 /*
00444     for(p_iterr=cluhs->GetClusterMap(view)->begin();p_iterr!=cluhs->GetClusterMap(view)->end(); p_iterr++)
00445     {   
00446 
00447         for(s_iterr=p_iterr->second.begin();s_iterr!=p_iterr->second.end(); s_iterr++)
00448         {
00449 
00450                         Managed::ManagedCluster * c = cluh->GetCluster(s_iterr->second);
00451                         TBox *b = new TBox(c->zmin,c->tmin,c->zmax,c->tmax);
00452                         b->Draw("same");
00453                 }
00454         }
00455         
00456 
00457     for(p_iterr=cluh->GetClusterMap(view)->begin();p_iterr!=cluh->GetClusterMap(view)->end(); p_iterr++)
00458     {   
00459 
00460         for(s_iterr=p_iterr->second.begin();s_iterr!=p_iterr->second.end(); s_iterr++)
00461         {
00462 
00463                         Managed::ManagedCluster * c = cluh->GetCluster(s_iterr->second);
00464                         
00465                         TBox *b = new TBox(c->zmin-0.01,c->tmin,c->zmax+0.01,c->tmax);
00466                         
00467                         char txt[200];
00468                         sprintf(txt,"(%f,%f) (%f %f) e %f\n",c->zmin,c->tmin,c->zmax,c->tmax,c->e);
00469                         b->SetToolTipText(txt);
00470                         b->Draw("1same");
00471                 }
00472         }       
00473         */
00474 /*
00475     for(p_iterr=cluhs->GetClusterMap(view)->begin();p_iterr!=cluhs->GetClusterMap(view)->end(); p_iterr++)
00476     {   
00477         for(s_iterr=p_iterr->second.begin();s_iterr!=p_iterr->second.end(); s_iterr++)
00478         {
00479                         Managed::ManagedCluster * clus = cluhs->GetCluster(s_iterr->second);
00480 
00481 
00482                 TMarker *m=new TMarker(clus->z,clus->t, 27);
00483                 m->Draw("same");
00484                         
00485 
00486                 }
00487         }
00488 */      
00489         
00490 
00491 
00492         //show cluster saver hits
00493 /*
00494         Managed::ClusterSaver *cs = &mypoh->cluster_saver;
00495 
00496         for(p_iterr=cs->cluster_map.begin();p_iterr!=cs->cluster_map.end(); p_iterr++)
00497     {
00498 
00499          for(s_iterr=p_iterr->second.begin();s_iterr!=p_iterr->second.end(); s_iterr++)
00500          {
00501          
00502                 if(cs->GetCluster(s_iterr->second)->view!=view)continue;
00503                 double ce = cs->GetCluster(s_iterr->second)->e;
00504                 h->Fill( p_iterr->first,s_iterr->first, ce);  
00505                         TMarker *m=new TMarker(p_iterr->first,s_iterr->first, 27);
00506                 m->Draw("same");
00507          }
00508 
00509         }
00510 */
00511 
00512 
00513 
00514 }

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

Reimplemented from Page.

Definition at line 60 of file ChainView.cxx.

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

Referenced by ParticleDisplay::UpdateDisplay().

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 }

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

Definition at line 552 of file ChainView.cxx.

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

Referenced by DrawEvent().

00553 {
00554         cout <<"int "<<&str<<" "<<index<<endl;
00555 
00556         if(!str || index<0)return;
00557         
00558         cout <<"interaction\n";
00559 
00560   //modified by steve cavanaugh aug 9, 2006 to take into account double particles in mc with IstHEP=2 
00561   //with modifications for readability
00562   
00563 
00564 /*
00565         TPad *tp1=new TPad("tp1","tp1",0.0,0.0,1,0.75);
00566                 
00567         tp1->Draw();
00568 
00569 
00570 
00571         tp1->cd();
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  // if (foundST) hep = SntpHelpers::GetStdHepArray(index, st);
00586  // else hep = SntpHelpers::GetStdHepArray(index, mc);
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       //parent[i] = hep[i]->parent[0];
00609 
00610       //in the case where we have more than 1 event per snarl we might 
00611       //have indices which refer to the actual index, not the one for the particular event.... 
00612       //so make sure we match this up properly
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; //don't draw arrows to initial state particles
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   //make arrows and markers
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   //now loop through valid stdhep entries and fill variables  
00670   Double_t Available[5] = {0.9,0.7,0.7,0.1};  
00671   
00672   //double max_a_3=0.7;
00673   
00674   //cout<<"nStdHep: "<<nStdHep<<"\n";
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     //    cout<<toUse<<"  "<<hep[toUse]->IstHEP<<"   "<<nStdHep<<endl;
00687     //cout<<parent[toUse]<<"   "<<parent1[toUse]<<endl;
00688 
00689 
00690 
00691     
00692     
00693     //sc - avoid any double taus' charms' etc, but set the proper parent/child 
00694     //(remove the particle between true parent and child)
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       //we've lost arrow tail info, so fix it
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     //sc - avoid any "later decays" not comming from IstHEP=1 decays .. .these are children of double taus, etc
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       //cout <<"breaking out of loop for particle "<<i<<"\n";
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     //set x,y    
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) {   //sc - allow for both IstHEP=3 and 14 intermediate decays
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; //seems to be opposite ordered....
00761     }
00762  
00763     //set colour and label (and override y in special cases)
00764     if(abs(hep[toUse]->IdHEP)==12) { //nue
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) { //numu
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) { //nutau
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) { //e
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) { //mu
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) { //tau
00790       //tau will decay so it is easier to read if it is not on the top line...
00791       // if(parent[toUse]==incomingNeutrino) y = 0.9;                  
00792       sprintf(text,"#tau^{-}"); col = 105;
00793       if(hep[toUse]->IdHEP<0) sprintf(text,"#tau^{+}"); 
00794     }
00795     else if(hep[toUse]->IdHEP==22) { //photon
00796       sprintf(text,"#gamma"); col = 9;      
00797     }
00798     else if(hep[toUse]->IdHEP>1000000000) { //nucleus
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         //cout<<"writing arrows from "<<j << " to "<<parent[j]<<"\n";
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     //  if(arrow[i]->GetX2()== 0.78 )
00872    //   {
00873    //           arrow[i]->SetY2(arrow[i]->GetY2()+0.5);//max_a_3-Available[3]);
00874     //          marker[i]->SetY(marker[i]->GetY()+0.5);//max_a_3-Available[3]);
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 }

void ChainView::DrawTrueVertex ( int  view  ) 

Definition at line 532 of file ChainView.cxx.

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

Referenced by DrawEvent().

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 }

void ChainView::DrawVertex ( int  view  ) 

Definition at line 517 of file ChainView.cxx.

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

Referenced by DrawEvent().

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 }


Member Data Documentation

TLatex* ChainView::info10 [private]

Definition at line 48 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

TLatex* ChainView::info11 [private]

Definition at line 49 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

TLatex* ChainView::info12 [private]

Definition at line 50 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

TLatex* ChainView::info13 [private]

Definition at line 51 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

TLatex* ChainView::info6 [private]

Definition at line 44 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

TLatex* ChainView::info7 [private]

Definition at line 45 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

TLatex* ChainView::info8 [private]

Definition at line 46 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

TLatex* ChainView::info9 [private]

Definition at line 47 of file ChainView.h.

Referenced by ChainView(), and DrawBasicInfo().

Definition at line 39 of file ChainView.h.

Referenced by DrawChains(), DrawClusters(), DrawEvent(), DrawTrueVertex(), and DrawVertex().

TPad* ChainView::padInfo [private]

Definition at line 34 of file ChainView.h.

Referenced by BuildDisplay(), and DrawEvent().

TPad* ChainView::padMC [private]

Definition at line 33 of file ChainView.h.

Referenced by BuildDisplay(), and DrawEvent().

TPad* ChainView::padU [private]

Definition at line 31 of file ChainView.h.

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

TPad* ChainView::padV [private]

Definition at line 32 of file ChainView.h.

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

TH2D* ChainView::viewU [private]

Definition at line 36 of file ChainView.h.

Referenced by ChainView(), and DrawEvent().

TH2D* ChainView::viewV [private]

Definition at line 37 of file ChainView.h.

Referenced by ChainView(), and DrawEvent().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1