MadScanDisplay Class Reference

#include <MadScanDisplay.h>

Inheritance diagram for MadScanDisplay:
MadBase

List of all members.

Public Member Functions

 MadScanDisplay (TChain *chainSR=0, TChain *chainMC=0, TChain *chainTH=0, TChain *chainem=0, const char *scan_sheet_name=0)
 MadScanDisplay (JobC *, string, int, const char *scan_sheet_name=0)
virtual ~MadScanDisplay ()
Int_t NextEvt ()
Int_t PrevEvt ()
Int_t NextPass ()
Int_t PrevPass ()
Int_t NextFidNoTrk ()
Int_t PrevFidNoTrk ()
Bool_t InFidNoTrk (int e)
Int_t NextFidTrk ()
Int_t PrevFidTrk ()
Bool_t InFidTrk (int e)
Int_t SkipTo ()
Int_t JumpTo ()
Bool_t Display (Int_t entry=0, Int_t theSlice=0, Int_t theEvent=0, Int_t theMCevent=0, Bool_t automat=true)
void SetDVals (Float_t, Float_t)
void PrintDisplay ()
void SetPrintOpt (char *opt)
void SetMessages (Bool_t yesno=true)
virtual Bool_t PassCuts ()
void DrawButtons (TCanvas *)
void DrawTextBox (TCanvas *, Bool_t)
void DrawInteractionDiagram (Int_t itr=0)
void EventDump ()
Float_t RecoMKMuEnergy (Int_t &opt, Int_t itrk, bool isdata=true)
Float_t RecoMuDCosNeuND (Int_t itr=0, Float_t *vtx=0)
Float_t RecoMuDCosNeuFD (Int_t itr=0, Float_t *vtx=0)
void ROICalc ()
void ShwROICalc ()
void HandleZoomEvent ()
void MakeGraphNonEditable (TObject *)
void MakeGraphListNonEditable (TList *)
void StartLogger ()
void Log ()
void EnableHandScan (char *)
void ChangeLogButColor ()
void PrintHSHelp ()
void SetDefaultShowerMarkerColor (Int_t col)
void SetDefaultShowerMarkerStyle (Int_t style)
void FindUnSliced ()
bool ReadEventsFile (const char *filename)
Int_t NextInterestingEvent (bool backward=false)

Public Attributes

Int_t LeNu
Int_t LeAction
Bool_t LeLego
Bool_t LeClus
Int_t LeEvent
Int_t LeSlice
Int_t LeMCevent
Int_t LeEntry
Bool_t UseNuInfo
Bool_t LeAutoMat
Bool_t drawSAME
ScanFrameSFrame
Bool_t handScan
Int_t ScanID
Int_t ScanTop
char logFileName [256]
bool fAltDisplay

Protected Member Functions

Int_t * Dec2Bin (Int_t)
void DrawKey (TVirtualPad *)
void DrawKey2 (TVirtualPad *)

Protected Attributes

char printName [100]
char printOpt [10]
Float_t Dspe_val
Float_t Dmid_val
Bool_t ptt_msg

Private Attributes

std::vector< std::vector< Int_t > > fNeatoEvents
bool fHaveNeatoEvents
Int_t fNeatoEventIdx
Int_t fDefaultShowerMarkerColor
Int_t fDefaultShowerMarkerStyle
bool fSetFidSet

Detailed Description

Definition at line 10 of file MadScanDisplay.h.


Constructor & Destructor Documentation

MadScanDisplay::MadScanDisplay ( TChain *  chainSR = 0,
TChain *  chainMC = 0,
TChain *  chainTH = 0,
TChain *  chainem = 0,
const char *  scan_sheet_name = 0 
)

Definition at line 44 of file MadScanDisplay.cxx.

References MadBase::Clear(), ScanFrame::CreateScanSheet(), Dmid_val, drawSAME, Dspe_val, MadBase::emrecord, fAltDisplay, fSetFidSet, handScan, MadBase::InitChain(), MadBase::isEM, MadBase::isMC, MadBase::isTH, LeAction, LeAutoMat, LeClus, LeEntry, LeEvent, LeLego, LeMCevent, LeNu, LeSlice, logFileName, MadBase::mcrecord, MadBase::Nentries, printOpt, ptt_msg, MadBase::record, ScanID, ScanTop, SFrame, MadBase::threcord, UseNuInfo, and MadBase::whichSource.

00046                                                             : 
00047 fHaveNeatoEvents(false), fNeatoEventIdx(-1), fDefaultShowerMarkerColor(5), fDefaultShowerMarkerStyle(4)
00048 {
00049 
00050   fSetFidSet=false;
00051   Dspe_val = 2.0;
00052   Dmid_val = 20.0;
00053   ptt_msg = false;
00054   UseNuInfo = false;
00055   fAltDisplay= false;
00056   LeNu = 14;
00057   LeAction = 1;
00058   LeLego = false;
00059   LeClus = false;
00060   LeEvent = 0;
00061   LeSlice = 0;
00062   LeMCevent = 0;
00063   LeEntry = 0;
00064   LeAutoMat = true;
00065   drawSAME = false;
00066 
00067   handScan = false;
00068   ScanID = 0;
00069   ScanTop = 0;
00070   sprintf(logFileName,"handScan.dat");
00071 
00072   sprintf(printOpt,"gif");
00073   //  sprintf(printOpt,"png");
00074   //  sprintf(printOpt,"eps");
00075 
00076   if(!chainSR) {
00077     record = 0;
00078     emrecord = 0;
00079     mcrecord = 0;
00080     threcord = 0;
00081     Clear();
00082     whichSource = -1;
00083     isMC = true;
00084     isTH = true;
00085     isEM = true;
00086     Nentries = -1;
00087     return;
00088   }
00089  
00090  
00091   InitChain(chainSR,chainMC,chainTH,chainEM, true);
00092   whichSource = 0;
00093   SFrame = ScanFrame::CreateScanSheet(gClient->GetRoot(),scan_sheet_name); // JM add
00094 
00095 }

MadScanDisplay::MadScanDisplay ( JobC j,
string  path,
int  entries,
const char *  scan_sheet_name = 0 
)

Definition at line 97 of file MadScanDisplay.cxx.

References MadBase::Clear(), ScanFrame::CreateScanSheet(), Dmid_val, drawSAME, Dspe_val, MadBase::emrecord, MadBase::fChain, MadBase::fCurRun, MadBase::fJC, fSetFidSet, handScan, MadBase::isEM, MadBase::isMC, MadBase::isTH, MadBase::jcPath, LeAction, LeAutoMat, LeClus, LeEntry, LeEvent, LeLego, LeMCevent, LeNu, LeSlice, logFileName, MadBase::mcrecord, MadBase::Nentries, printOpt, ptt_msg, MadBase::record, ScanID, ScanTop, SFrame, MadBase::threcord, UseNuInfo, and MadBase::whichSource.

00099                                                             : 
00100 fHaveNeatoEvents(false), fNeatoEventIdx(-1), fDefaultShowerMarkerColor(5), fDefaultShowerMarkerStyle(4)
00101 {
00102   fSetFidSet=false;
00103   Dspe_val = 2.0;
00104   Dmid_val = 20.0;
00105   ptt_msg = false;
00106   UseNuInfo = false;
00107 
00108   LeNu = 14;
00109   LeAction = 1;
00110   LeLego = false;
00111   LeClus = false;
00112   LeEvent = 0;
00113   LeSlice = 0;
00114   LeMCevent = 0;
00115   LeEntry = 0;
00116   LeAutoMat = true;
00117   drawSAME = false;
00118 
00119   handScan = false;
00120   ScanID = 0;
00121   ScanTop = 0;
00122   sprintf(logFileName,"handScan.dat");
00123 
00124   sprintf(printOpt,"gif");
00125   //  sprintf(printOpt,"png");
00126   //  sprintf(printOpt,"eps");
00127 
00128   record = 0;
00129   emrecord = 0;
00130   mcrecord = 0;
00131   threcord = 0;
00132   Clear();
00133   isMC = true;
00134   isTH = true;
00135   isEM = true;
00136   Nentries = entries;
00137   jcPath = path;
00138   whichSource = 1;
00139   fCurRun = -1;
00140   fJC = j;
00141   fChain = NULL;
00142   SFrame = ScanFrame::CreateScanSheet(gClient->GetRoot(),scan_sheet_name); // JM add
00143 
00144 }

MadScanDisplay::~MadScanDisplay (  )  [virtual]

Definition at line 146 of file MadScanDisplay.cxx.

00147 {
00148 }


Member Function Documentation

void MadScanDisplay::ChangeLogButColor (  ) 

Definition at line 4661 of file MadScanDisplay.cxx.

References ScanID, and ScanTop.

Referenced by Display().

04662 {
04663   if(gROOT->FindObject("MainCanvas")) {
04664     TCanvas *MainCanvas = (TCanvas*) gROOT->FindObject("MainCanvas");
04665     TVirtualPad *MainCanvas_2 = MainCanvas->GetPad(2);
04666     char butName[256];
04667     int butNums[10] = {1,2,3,4,5,6,8,9,10,11};
04668     for(int i=0;i<10;i++){
04669       sprintf(butName,"logBut%i",butNums[i]);
04670       TButton *but = (TButton*) MainCanvas_2->FindObject(butName);
04671       if(butNums[i]==ScanID || butNums[i]==ScanTop+7) {
04672         but->SetFillColor(3);
04673         but->Modified();
04674       }
04675       else if(but->GetFillColor()!=2) {
04676         but->SetFillColor(2);
04677         but->Modified();
04678       }
04679     }
04680   }
04681 }

Int_t * MadScanDisplay::Dec2Bin ( Int_t  dec  )  [protected]

Definition at line 4091 of file MadScanDisplay.cxx.

04091                                        {
04092 
04093   Int_t *bin = new Int_t[32];
04094   for(Int_t i=0;i<32;i++) bin[i]=0;
04095 
04096   Int_t index=1;
04097   
04098   while(true){
04099     if(dec<TMath::Power(2,index) && dec>1) {
04100       bin[index-1]=1;
04101       dec-=Int_t(TMath::Power(2,index-1));
04102       index=1;
04103     }
04104 
04105     else index+=1;
04106 
04107     if(dec==0) break;
04108     if(dec==1){
04109       bin[0]=1;
04110       dec-=1;
04111       break;
04112     }
04113   }
04114   return bin;
04115 }

Bool_t MadScanDisplay::Display ( Int_t  entry = 0,
Int_t  theSlice = 0,
Int_t  theEvent = 0,
Int_t  theMCevent = 0,
Bool_t  automat = true 
)

Delete truth,track,shower,strip objects

Delete arrows

Recover shapes

recover histo placeholders and reset

EM Showers

Definition at line 777 of file MadScanDisplay.cxx.

References ClusterType::AsString(), ChangeLogButColor(), NtpSRShower::clu, Munits::cm, NtpSRTrack::contained, EnergyCorrections::CorrectShowerEnergy(), count, NtpSRVertex::dcosu, NtpSRVertex::dcosv, NtpSRVertex::dcosz, det, Dmid_val, DrawButtons(), drawSAME, DrawTextBox(), Dspe_val, MadBase::eventSummary, fAltDisplay, fDefaultShowerMarkerColor, fDefaultShowerMarkerStyle, VldContext::GetDetector(), MadBase::GetEntry(), PlaneOutline::GetNDPlanesHist(), PlaneOutline::GetOutline(), MadAbID::GetPass(), RecDataHeader::GetRun(), RecPhysicsHeader::GetSnarl(), RecHeader::GetVldContext(), FidVol::gTrkVtxZOffset, handScan, NtpSRCluster::id, NtpMCStdHep::IdHEP, Munits::inch, MadBase::isEM, NtpSRShieldSummary::ishit, MadBase::isMC, MadBase::isST, MadBase::isTH, NtpMCStdHep::IstHEP, Detector::kCalDet, CandShowerHandle::kCC, Detector::kFar, Detector::kNear, PlaneCoverage::kNearFull, PlaneCoverage::kNearPartial, PlaneView::kU, PlaneView::kV, LeClus, LeEvent, LeLego, LeMCevent, LeSlice, NtpSRShowerPulseHeight::linCCgev, MadBase::LoadCluster(), MadBase::LoadEMShower(), MadBase::LoadEvent(), MadBase::LoadLargestShowerFromEvent(), MadBase::LoadLargestTrackFromEvent(), MadBase::LoadShower(), MadBase::LoadShower_Jim(), MadBase::LoadSlice(), MadBase::LoadSliceForRecoTH(), MadBase::LoadStrip(), MadBase::LoadTHEvent(), MadBase::LoadTrack(), MadBase::LoadTruth(), MadBase::LoadTruthForReco(), MadBase::LoadTruthForRecoTH(), MakeGraphListNonEditable(), NtpMCStdHep::mc, MadBase::mcrecord, NtpSRTrack::momentum, NtpSRShower::ncluster, NtpSRSlice::ndigit, NtpTHEvent::neustdhep, NtpSREventSummary::nevent, NtpSREvent::nshower, NtpEMSummary::nshower, NtpSREventSummary::nslice, NtpSREventSummary::nstrip, NtpSRCluster::nstrip, NtpSRTrack::nstrip, NtpEMShower::nstrip, NtpSRShower::nstrip, NtpSRSlice::nstrip, MadBase::ntpCluster, MadBase::ntpEMShower, MadBase::ntpEMSummary, MadBase::ntpEvent, MadBase::ntpHeader, MadBase::ntpShieldStrip, MadBase::ntpShower, MadBase::ntpSlice, MadBase::ntpStrip, MadBase::ntpTHEvent, MadBase::ntpTrack, MadBase::ntpTruth, NtpSREvent::ntrack, OK, NtpMCStdHep::p4, NtpMCTruth::p4el1, NtpMCTruth::p4mu1, NtpMCTruth::p4neu, NtpMCTruth::p4neunoosc, NtpMCStdHep::parent, ScanFrame::PassFloat(), ScanFrame::PassInt(), NtpSRPulseHeight::pe, NtpSREventSummary::ph, NtpSRSlice::ph, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRStrip::planeview, NtpSRCluster::planeview, NtpMCStdHep::Print(), printName, printOpt, NtpSRCluster::probem, ptt_msg, NtpSRMomentum::qp, NtpSRMomentum::range, NtpSRPulseHeight::raw, MadBase::record, ScanFrame::ResetDisplay(), ScanID, ScanTop, ScanFrame::SetEvent(), ScanFrame::SetRun(), ScanFrame::SetSlice(), ScanFrame::SetSnarl(), SFrame, MadBase::shieldSummary, NtpSREvent::shw, NtpSRShower::shwph, NtpSREvent::slc, NtpStRecord::stdhep, NtpMCRecord::stdhep, NtpSRShower::stp, NtpEMShower::stp, NtpSRSlice::stp, NtpStRecord::stp, NtpSRCluster::stp, NtpSRRecord::stp, NtpSRTrack::stp, NtpSRTrack::stpt0, NtpSRTrack::stpt1, NtpSRTrack::stpx, NtpSRTrack::stpy, NtpSRTrack::stpz, MadBase::strecord, NtpSRStrip::strip, NtpSRShieldStrip::time, NtpSRStrip::time0, NtpSRStrip::time1, NtpSRStrip::tpos, NtpSREventSummary::trigtime, NtpSREvent::trk, NtpSRVertex::u, NtpSRVertex::v, NtpSRRecord::vetostp, NtpStRecord::vetostp, NtpMCStdHep::vtx, NtpSRShower::vtx, NtpSRTrack::vtx, NtpMCTruth::vtxx, NtpMCTruth::vtxy, NtpMCTruth::vtxz, NtpSRShieldStrip::x, NtpSRShieldStrip::y, NtpSRStrip::z, and NtpSRVertex::z.

Referenced by JumpTo(), NextEvt(), NextFidNoTrk(), NextFidTrk(), NextInterestingEvent(), NextPass(), PrevEvt(), PrevFidNoTrk(), PrevFidTrk(), PrevPass(), and SkipTo().

00779 {
00780 
00781   gStyle->SetTextFont(132);
00782   if(this->GetEntry(entry)==0) return false;
00783   
00784   Bool_t isReco = true;  //checks for reconstructed event
00785   Bool_t NoSlice = false;
00786 
00787   //no point using LoadStrip since it will called many times, just get arrays
00788   TClonesArray* pointShieldStripArray = NULL;
00789   if(isST) pointShieldStripArray = (strecord->vetostp);
00790   else pointShieldStripArray = (record->vetostp);
00791   TClonesArray& shieldstripArray = *pointShieldStripArray;
00792   TClonesArray* pointStripArray = NULL;
00793   if(isST) pointStripArray = (strecord->stp);
00794   else pointStripArray = (record->stp);
00795   TClonesArray& stripArray = *pointStripArray;
00796 
00797   // find all strips not in a slice
00798 
00799   int nmissU=0;
00800   int nmissV=0;
00801 
00802   int nmissUOneEnd=0;
00803   int nmissVOneEnd=0;
00804 
00805   int nmissULowPE=0;
00806   int nmissVLowPE=0;
00807 
00808   float *missstripz_0 = new float[eventSummary->nstrip];
00809   float *missstripz_1 = new float[eventSummary->nstrip];
00810   float *missstript_0 = new float[eventSummary->nstrip];
00811   float *missstript_1 = new float[eventSummary->nstrip];
00812 
00813   float *missstripzOneEnd_0 = new float[eventSummary->nstrip];
00814   float *missstripzOneEnd_1 = new float[eventSummary->nstrip];
00815   float *missstriptOneEnd_0 = new float[eventSummary->nstrip];
00816   float *missstriptOneEnd_1 = new float[eventSummary->nstrip];
00817 
00818   float *missstripzLowPE_0 = new float[eventSummary->nstrip];
00819   float *missstripzLowPE_1 = new float[eventSummary->nstrip];
00820   float *missstriptLowPE_0 = new float[eventSummary->nstrip];
00821   float *missstriptLowPE_1 = new float[eventSummary->nstrip];
00822 
00823   float lowest_missz=100;
00824   float highest_missz=0;
00825   float lowest_misst0=100;
00826   float highest_misst0=-100;
00827   
00828 
00829   for(unsigned int i=0;i<eventSummary->nstrip;i++){
00830     bool found=false;
00831     for(int j=0;j<eventSummary->nslice;j++){
00832       LoadSlice(j);
00833       for(int k=0;k<ntpSlice->nstrip;k++){
00834         unsigned int index = ntpSlice->stp[k];
00835         if(index==i){found=true; continue;}
00836       }
00837       if(found)continue;
00838     }
00839         
00840     if(!found){
00841       LoadStrip(i);
00842       if(ntpHeader->GetVldContext().GetDetector()==Detector::kFar || 
00843          ntpStrip->plane<121){
00844         if(ntpStrip->z<lowest_missz)lowest_missz=ntpStrip->z-0.2;
00845         if(ntpStrip->z>highest_missz)highest_missz=ntpStrip->z+0.2;
00846         if(ntpStrip->tpos<lowest_misst0)lowest_misst0=ntpStrip->tpos-0.2;
00847         if(ntpStrip->tpos>highest_misst0)highest_misst0=ntpStrip->tpos+0.2;
00848 
00849         //Added by AS 11/30/10
00850         //Only show unassociated strips that have more than 2 PE
00851         //Skip bit of code trying to subcategorize unassociated strips
00852         //as it does not work and it isn't necessary anyway.
00853         if(ntpStrip->ph0.pe+ntpStrip->ph1.pe>2){        
00854           if(ntpStrip->planeview==PlaneView::kU){
00855             missstript_0[nmissU]=ntpStrip->tpos;
00856             missstripz_0[nmissU]=ntpStrip->z;
00857             nmissU++;
00858           }
00859           else{
00860             missstript_1[nmissV]=ntpStrip->tpos;
00861             missstripz_1[nmissV]=ntpStrip->z;
00862             nmissV++;
00863           }
00864         }
00865 
00866 
00867 //      if(ntpStrip->ph0.pe>0 && ntpStrip->ph1.pe>0 && ntpStrip->ph0.pe+ntpStrip->ph1.pe>2){    
00868 //        if(ntpStrip->planeview==PlaneView::kU){
00869             
00870 //          missstript_0[nmissU]=ntpStrip->tpos;
00871 //          missstripz_0[nmissU]=ntpStrip->z;
00872 //          nmissU++;
00873 //        }
00874 //        else{
00875 //          missstript_1[nmissV]=ntpStrip->tpos;
00876 //          missstripz_1[nmissV]=ntpStrip->z;
00877 //          nmissV++;
00878 //        }
00879 //      }
00880 //      else if(ntpStrip->ph0.pe==0 || ntpStrip->ph1.pe==0){    
00881 //        if(ntpStrip->planeview==PlaneView::kU){
00882 //          missstriptOneEnd_0[nmissUOneEnd]=ntpStrip->tpos;
00883 //          missstripzOneEnd_0[nmissUOneEnd]=ntpStrip->z;
00884 //          // nmissUOneEnd++;
00885 //          nmissU++;
00886 //        }
00887 //        else{
00888 //          missstriptOneEnd_1[nmissVOneEnd]=ntpStrip->tpos;
00889 //          missstripzOneEnd_1[nmissVOneEnd]=ntpStrip->z;
00890 //          //      nmissVOneEnd++;
00891 //          nmissV++;
00892 //        }
00893 //      }
00894 //      else if((ntpStrip->ph0.pe>0 && ntpStrip->ph1.pe>0) && ntpStrip->ph0.pe+ntpStrip->ph1.pe<2){     
00895 //        if(ntpStrip->planeview==PlaneView::kU){
00896 //          missstriptLowPE_0[nmissULowPE]=ntpStrip->tpos;
00897 //          missstripzLowPE_0[nmissULowPE]=ntpStrip->z;
00898 //          //nmissULowPE++;
00899 //          nmissU++;
00900 //        }
00901 //        else{
00902 //          missstriptLowPE_1[nmissVLowPE]=ntpStrip->tpos;
00903 //          missstripzLowPE_1[nmissVLowPE]=ntpStrip->z;
00904 //          //nmissVLowPE++;
00905 //          nmissV++;
00906 //        }
00907 //      }
00908       }
00909     }
00910   }
00911  
00912   //Load the event:  
00913   if(!LoadEvent(theEvent)) { //if can't load event asked for
00914     LeEvent = theEvent = 0; //try loading event 0
00915     if(!LoadEvent(theEvent)) isReco=false; //if not present then don't 
00916                                            //try to draw reco graphs
00917   }
00918   else LeEvent = theEvent;
00919 
00920   //if we have MC and TH, load slices and truth events based on reco'd event
00921   if(isMC) {
00922     if(isTH&&automat) {
00923       if(!LoadSliceForRecoTH(theEvent,theSlice)){ //load slice from reco evt
00924         LeSlice = theSlice = 0; //if not present load slice 0
00925         if(!LoadSlice(theSlice)) {
00926           std::cerr << "No slice present in Run: " << ntpHeader->GetRun() 
00927                     << " Snarl: " << ntpHeader->GetSnarl() << std::endl; 
00928           NoSlice=true; //if not there exit with a message after delete stuff
00929         }
00930       }
00931       else LeSlice = theSlice;
00932       if(!LoadTruthForRecoTH(theEvent,theMCevent)){ //load truth from reco
00933         LeMCevent = theMCevent = 0; //if not present load truth 0
00934         LoadTruth(theMCevent);
00935       }
00936       else LeMCevent = theMCevent;
00937     }
00938     else if(automat){ //if there's no TH but we are in automatic mode
00939       if(!LoadTruthForReco(theEvent,theMCevent)){ //load truth using reco vtx
00940         LeMCevent = theMCevent = 0; //if not present load truth 0
00941         LoadTruth(theMCevent);
00942         //load slice from event->slc:
00943         theSlice = ntpEvent->slc;
00944         if(!LoadSlice(theSlice)) {
00945           LeSlice = theSlice = 0;         
00946           if(!LoadSlice(theSlice)) {
00947            std::cerr << "No slice present in Run: " << ntpHeader->GetRun() 
00948                     << " Snarl: " << ntpHeader->GetSnarl() << std::endl; 
00949           NoSlice=true; //if not there exit with a message after delete stuff 
00950           }
00951         }
00952         else LeSlice = theSlice;
00953       }
00954       else LeMCevent = theMCevent;
00955     }
00956     else { //not in automatic mode
00957       if(!LoadTruth(theMCevent)) { //load truth asked for
00958         LeMCevent = theMCevent = 0; //if not present load truth 0
00959         LoadTruth(theMCevent);  
00960       }
00961       else LeMCevent = theMCevent;
00962       if(!LoadSlice(theSlice)){
00963         LeSlice = theSlice = 0; //if not present load slice 0
00964         if(!LoadSlice(theSlice)){
00965           std::cerr << "No slice present in Run: " << ntpHeader->GetRun() 
00966                     << " Snarl: " << ntpHeader->GetSnarl() << std::endl; 
00967           NoSlice=true; //if not there exit with a message after delete stuff
00968         }
00969       }
00970       else LeSlice = theSlice;
00971     }
00972     //    DrawInteractionDiagram(theMCevent);
00973   }
00974 
00975   else { //if no MC present
00976     if(!automat) { //if not in automatic mode, load slice asked for if possible
00977       if(!LoadSlice(theSlice)) { //if the one asked for not present
00978         theSlice = 0;
00979         LeSlice = theSlice;
00980         if(!LoadSlice(theSlice)){ //trying loading slice 0
00981           std::cerr << "No slice present in Run: " << ntpHeader->GetRun() 
00982                     << " Snarl: " << ntpHeader->GetSnarl() << std::endl; 
00983           return false; //if not there exit with a message
00984         }
00985       }
00986       else LeSlice = theSlice;
00987     }
00988     else { //in automatic mode
00989       if(isReco) { //if there is a reco'd event
00990         theSlice = ntpEvent->slc; //load slice from event
00991         if(!LoadSlice(theSlice)) {
00992           LeSlice = theSlice = 0;         
00993           if(!LoadSlice(theSlice)) {
00994             std::cerr << "No slice present in Run: " << ntpHeader->GetRun() 
00995                       << " Snarl: " << ntpHeader->GetSnarl() << std::endl; 
00996             NoSlice=true; //if not there exit with a message after delete stuff 
00997           }
00998         }
00999         else LeSlice = theSlice;
01000       }
01001       else {  //no reco'd event
01002         if(!LoadSlice(theSlice)) {  //try to load the slice asked for
01003           LeSlice = theSlice = 0;   //otherwise try to load slice 0
01004           if(!LoadSlice(theSlice)) {
01005             std::cerr << "No slice present in Run: " << ntpHeader->GetRun() 
01006                       << " Snarl: " << ntpHeader->GetSnarl() << std::endl; 
01007             NoSlice=true; //if not there exit with a message after delete stuff
01008           }
01009         }
01010         else LeSlice = theSlice;
01011       }
01012     }
01013   }
01014 
01015   sprintf(printName,"_Run%i_Snl%i_Slc%i_Evt%i.%s",ntpHeader->GetRun(),
01016           ntpHeader->GetSnarl(),theSlice,theEvent,printOpt);
01017 
01019   //Set Up Display Canvas
01020   //Delete Old Graphs
01021 
01022   TCanvas *RecoCanvas = 0;
01023   TCanvas *MainCanvas = 0;
01024   TCanvas *LegoCanvas = 0;
01025   TCanvas *ClusterCanvas = 0;
01026 
01027   static TPolyLine *line = 0;
01028   static TPolyLine *pu1_outline = 0; static TPolyLine *fu1_outline = 0; 
01029   static TPolyLine *pv1_outline = 0; static TPolyLine *fv1_outline = 0;
01030   static TPolyLine *pu2_outline = 0; static TPolyLine *fu2_outline = 0; 
01031   static TPolyLine *pv2_outline = 0; static TPolyLine *fv2_outline = 0;
01032   static TEllipse  *nd_xy_fid = 0;
01033   static TPolyLine *nd_uz_fid = 0;
01034   static TPolyLine *nd_vz_fid = 0;
01035 
01036   static TEllipse  *fd_xy_fid1 = 0;
01037   static TEllipse  *fd_xy_fid2 = 0;
01038   static TPolyLine *fd_uz_fid1 = 0;
01039   static TPolyLine *fd_vz_fid1 = 0;
01040   static TPolyLine *fd_uz_fid2 = 0;
01041   static TPolyLine *fd_vz_fid2 = 0;
01042   TEllipse *ellie = 0;
01043 
01044   TH2F *xz_place = 0;
01045   TH2F *yz_place = 0;
01046   TH2F *yx_place = 0;
01047   TH2 *tz_place_0 = 0;
01048   TH2 *tz_place_1 = 0;
01049   TH2 *tz_missplace_0 = 0;
01050   TH2 *tz_missplace_1 = 0;
01051 
01052   static std::string tz_place_dopt="";
01053 
01054   TH2F *tz_0_lego = 0;
01055   TH2F *tz_1_lego = 0;  
01056     
01057   TMultiGraph *xz_trk = 0;
01058   TMultiGraph *yz_trk = 0;
01059   TMultiGraph *yx_trk = 0;
01060   TMultiGraph *xz_shw = 0;
01061   TMultiGraph *yz_shw = 0;
01062   TMultiGraph *yx_shw = 0;
01063   TMultiGraph *yx_veto = 0;
01064   
01065   TMultiGraph * tz_missstp_0 = 0;  
01066   TMultiGraph * tz_missstp_1 = 0;
01067   
01068   TMultiGraph *tz_stp_0 = 0;
01069   TMultiGraph *tz_stp_mid_0 = 0;
01070   TMultiGraph *tz_stp_spe_0 = 0;
01071   TMultiGraph *tz_stp_1 = 0;
01072   TMultiGraph *tz_stp_mid_1 = 0;
01073   TMultiGraph *tz_stp_spe_1 = 0;
01074 
01075   TMultiGraph *tz_trk0 = 0;
01076   TMultiGraph *tz_shw0 = 0;
01077   TMultiGraph *tz_emshw0 = 0;
01078   TMultiGraph *tz_clu0 = 0;
01079   TMultiGraph *tz_trk1 = 0;
01080   TMultiGraph *tz_shw1 = 0;
01081   TMultiGraph *tz_emshw1 = 0;
01082   TMultiGraph *tz_clu1 = 0;
01083   
01084   TLegend *cluLeg0 = 0;
01085   TLegend *cluLeg1 = 0;
01086   
01087   TMultiGraph *ytime = 0;
01088   TMultiGraph *ztime = 0;
01089   TMultiGraph *ytime_veto = 0;
01090     
01091   if(!gROOT->FindObject("RecoCanvas")){ 
01092 
01093     //set up canvases and placeholders
01094     gStyle->SetOptStat(0);
01095 
01096     RecoCanvas = new TCanvas("RecoCanvas","Reconstructed Tracks",0,0,900,700);
01097     RecoCanvas->Divide(3,2);
01098     TVirtualPad *RecoCanvas_5 = RecoCanvas->GetPad(5);
01099     RecoCanvas_5->Divide(1,2);
01100     
01101     if(LeLego) {
01102       LegoCanvas = new TCanvas("LegoCanvas","Lego View of Hit Strips",
01103                                0,0,900,700);
01104       LegoCanvas->Divide(1,2);
01105       
01106       /*
01107       int nzpos = 1000;
01108       double z_pos[1001];
01109       z_pos[0] = 0.5;
01110       z_pos[1] = 0.5+0.167;
01111       for(int i=2;i<1001;i++) z_pos[i] = z_pos[i-2]+1;
01112       */
01113       
01114       int nzpos = 500;
01115       double z_pos[501];
01116       z_pos[0] = 0.5;
01117       for(int i=1;i<501;i++) z_pos[i] = z_pos[i-1]+1;      
01118       
01119       tz_0_lego = new TH2F("tz_0_lego","TPos vs Plane view - U Planes",
01120                            nzpos,z_pos,192,-3.936,3.936);
01121       tz_0_lego->SetXTitle("Plane");
01122       tz_0_lego->SetYTitle("TPos (m)");
01123       tz_0_lego->SetZTitle("Pulse Height (PEs)");
01124       tz_1_lego = new TH2F("tz_1_lego","TPos vs Plane view - V Planes",
01125                            nzpos,z_pos,192,-3.936,3.936);
01126       tz_1_lego->SetXTitle("Plane");
01127       tz_1_lego->SetYTitle("TPos (m)");
01128       tz_1_lego->SetZTitle("Pulse Height (PEs)");
01129     }
01130 
01131     if(LeClus) {
01132       ClusterCanvas = new TCanvas("ClusterCanvas","Reconstructed Cluster View",
01133                                   910,0,400,700);
01134       ClusterCanvas->Divide(1,2);
01135     }
01136 
01137     MainCanvas = new TCanvas("MainCanvas","Main Display and Controls",
01138                              0,0,900,700);
01139     MainCanvas->Divide(2,2);
01140     // add zoom execs to these two pads:
01141     MainCanvas->GetPad(3)->AddExec("zoom","EVD->HandleZoomEvent()");
01142     MainCanvas->GetPad(4)->AddExec("zoom","EVD->HandleZoomEvent()");
01143 
01144     xz_place = new TH2F("xz_place","X vs Z view",70,0,35,50,-5,5);
01145     xz_place->SetXTitle("z position (m)");
01146     xz_place->SetYTitle("x position (m)");
01147 
01148     yz_place = new TH2F("yz_place","Y vs Z view",70,0,35,50,-5,5);
01149     yz_place->SetXTitle("z position (m)");
01150     yz_place->SetYTitle("y position (m)");
01151 
01152     yx_place = new TH2F("yx_place","Y vs X view",50,-5,5,50,-5,5);
01153     yx_place->SetXTitle("x position (m)");
01154     yx_place->SetYTitle("y position (m)");
01155     // mike, fill us
01156     Detector::Detector_t det=ntpHeader->GetVldContext().GetDetector();
01157     if(det==Detector::kFar){
01158       tz_place_0 = new TH2F("tz_place_0","Transverse vs Z view - U Planes",
01159                             70,0,35,50,-5,5);
01160       tz_place_1 = new TH2F("tz_place_1","Transverse vs Z view - V Planes",
01161                             70,0,35,50,-5,5);      
01162       tz_missplace_0 = new TH2F("tz_missplace_0","Transverse vs Z view - U Planes",
01163                             70,0,35,50,-5,5);
01164       tz_missplace_1 = new TH2F("tz_missplace_1","Transverse vs Z view - V Planes",
01165                             70,0,35,50,-5,5);      
01166     }
01167     else{
01168       PlaneOutline po;
01169       tz_place_0 = po.GetNDPlanesHist(PlaneView::kV);//strips measure U
01170       tz_place_0->SetName("tz_place_0");
01171       tz_place_0->SetTitle("Transverse vs Z view - U Planes");
01172       // attempt to defeat ROOT's behaviour whereby it unzooms z axis
01173       // when user unzooms y axis ... didn't work, causes whacky behaviour
01174       //tz_place_0->GetYaxis()->SetName("xaxis");
01175       tz_place_0->SetDirectory(gROOT);
01176 
01177       tz_missplace_0 = po.GetNDPlanesHist(PlaneView::kV);//strips measure U
01178       tz_missplace_0->SetName("tz_missplace_0");
01179       tz_missplace_0->SetTitle("Transverse vs Z view - U Planes");
01180       // attempt to defeat ROOT's behaviour whereby it unzooms z axis
01181       // when user unzooms y axis ... didn't work, causes whacky behaviour
01182       //tz_place_0->GetYaxis()->SetName("xaxis");
01183       tz_missplace_0->SetDirectory(gROOT);
01184       //      tz_place_0->SetDrawOption("col");
01185       tz_place_1 = po.GetNDPlanesHist(PlaneView::kU);//strips measure V
01186       tz_place_1->SetName("tz_place_1");
01187       tz_place_1->SetTitle("Transverse vs Z view - V Planes");
01188       //tz_place_1->GetYaxis()->SetName("xaxis");
01189       tz_place_1->SetDirectory(gROOT);
01190 
01191       tz_missplace_1 = po.GetNDPlanesHist(PlaneView::kU);//strips measure V
01192       tz_missplace_1->SetName("tz_missplace_1");
01193       tz_missplace_1->SetTitle("Transverse vs Z view - V Planes");
01194       //tz_place_1->GetYaxis()->SetName("xaxis");
01195       tz_missplace_1->SetDirectory(gROOT);
01196       //      tz_place_1->SetDrawOption("col");
01197 
01198       tz_place_dopt ="col";
01199     
01200     }
01201     tz_place_0->SetXTitle("z position (m)");
01202     tz_place_0->SetYTitle("transverse position (m)");
01203     tz_place_1->SetXTitle("z position (m)");
01204     tz_place_1->SetYTitle("transverse position (m)");
01205     
01206     tz_missplace_0->SetXTitle("z position (m)");
01207     tz_missplace_0->SetYTitle("transverse position (m)");
01208     tz_missplace_1->SetXTitle("z position (m)");
01209     tz_missplace_1->SetYTitle("transverse position (m)");
01210     
01211     this->DrawButtons(MainCanvas);
01212   }
01213   else {
01214     RecoCanvas = (TCanvas*) gROOT->FindObject("RecoCanvas");
01215     MainCanvas = (TCanvas*) gROOT->FindObject("MainCanvas");
01216 
01217     //Lego:
01218     if(gROOT->FindObject("LegoCanvas")) {
01219       LegoCanvas = (TCanvas*) gROOT->FindObject("LegoCanvas");
01220       LegoCanvas->cd(1);
01221       TVirtualPad *LegoCanvas_1 = LegoCanvas->GetPad(1);
01222       tz_0_lego = (TH2F*) LegoCanvas_1->FindObject("tz_0_lego");
01223       LegoCanvas->cd(2);
01224       TVirtualPad *LegoCanvas_2 = LegoCanvas->GetPad(2);
01225       tz_1_lego = (TH2F*) LegoCanvas_2->FindObject("tz_1_lego");
01226     }
01227     else if(LeLego) {
01228       LegoCanvas = new TCanvas("LegoCanvas","Lego View of Hit Strips",
01229                                0,0,900,700);
01230       LegoCanvas->Divide(1,2);
01231       
01232       /*
01233       int nzpos = 1000;
01234       double z_pos[1001];
01235       z_pos[0] = 0.5;
01236       z_pos[1] = 0.5+0.167;
01237       for(int i=2;i<1001;i++) z_pos[i] = z_pos[i-2]+1;
01238       */
01239       
01240       int nzpos = 500;
01241       double z_pos[501];
01242       z_pos[0] = 0.5;
01243       for(int i=1;i<501;i++) z_pos[i] = z_pos[i-1]+1;
01244 
01245       tz_0_lego = new TH2F("tz_0_lego","TPos vs Plane view - U Planes",
01246                            nzpos,z_pos,192,-3.936,3.936);
01247       tz_0_lego->SetXTitle("Plane");
01248       tz_0_lego->SetYTitle("TPos (m)");
01249       tz_0_lego->SetZTitle("Pulse Height (PEs)");
01250       tz_1_lego = new TH2F("tz_1_lego","TPos vs Plane view - V Planes",
01251                            nzpos,z_pos,192,-3.936,3.936);
01252       tz_1_lego->SetXTitle("Plane");
01253       tz_1_lego->SetYTitle("TPos (m)");
01254       tz_1_lego->SetZTitle("Pulse Height (PEs)");
01255 
01256       LegoCanvas->cd(1);
01257       tz_0_lego->Draw("lego");
01258       LegoCanvas->cd(2);
01259       tz_1_lego->Draw("lego");
01260     }
01261 
01262     if(!LeLego&&gROOT->FindObject("LegoCanvas")) {
01263       delete LegoCanvas;
01264       delete tz_0_lego;
01265       delete tz_1_lego;
01266     }
01267 
01269     RecoCanvas->cd(1);
01270     TVirtualPad *RecoCanvas_1 = RecoCanvas->GetPad(1);
01271     TVirtualPad *RecoCanvas_4 = RecoCanvas->GetPad(4);
01272     TVirtualPad *RecoCanvas_2 = RecoCanvas->GetPad(2);
01273     xz_trk = (TMultiGraph*) RecoCanvas_1->FindObject("xz_trk");
01274     yz_trk = (TMultiGraph*) RecoCanvas_4->FindObject("yz_trk");
01275     yx_trk = (TMultiGraph*) RecoCanvas_2->FindObject("yx_trk");
01276     xz_shw = (TMultiGraph*) RecoCanvas_1->FindObject("xz_shw");
01277     yz_shw = (TMultiGraph*) RecoCanvas_4->FindObject("yz_shw");
01278     yx_shw = (TMultiGraph*) RecoCanvas_2->FindObject("yx_shw");
01279     yx_veto = (TMultiGraph*) RecoCanvas_2->FindObject("yx_veto");
01280     
01281     if(!drawSAME) {
01282       delete xz_trk; xz_trk = 0;
01283       delete yz_trk; yz_trk = 0;
01284       delete yx_trk; yx_trk = 0;
01285       delete xz_shw; xz_shw = 0;
01286       delete yz_shw; yz_shw = 0;
01287       delete yx_shw; yx_shw = 0;
01288       delete yx_veto; yx_veto = 0;
01289     }
01290 
01291     RecoCanvas->cd(5);
01292     TVirtualPad *RecoCanvas_5 = RecoCanvas->GetPad(5);
01293     TVirtualPad *RecoCanvas_5_1 = RecoCanvas_5->GetPad(1);
01294     TVirtualPad *RecoCanvas_5_2 = RecoCanvas_5->GetPad(2);
01295     ytime = (TMultiGraph*) RecoCanvas_5_1->FindObject("ytime");
01296     ztime = (TMultiGraph*) RecoCanvas_5_2->FindObject("ztime");
01297     ytime_veto = (TMultiGraph*) RecoCanvas_5_1->FindObject("ytime_veto");
01298     
01299     if(!drawSAME) {
01300       delete ytime; ytime = 0;
01301       delete ztime; ztime = 0;
01302       delete ytime_veto; ytime_veto = 0;
01303     }
01304 
01305     MainCanvas->cd(1);
01306     TVirtualPad *MainCanvas_1 = MainCanvas->GetPad(1);
01307     TLatex *info1 = (TLatex*) MainCanvas_1->FindObject("info1");
01308     TLatex *info2 = (TLatex*) MainCanvas_1->FindObject("info2");
01309     TLatex *info3 = (TLatex*) MainCanvas_1->FindObject("info3");
01310     TLatex *info4 = (TLatex*) MainCanvas_1->FindObject("info4");
01311     TLatex *info5 = (TLatex*) MainCanvas_1->FindObject("info5");
01312     TLatex *info6 = (TLatex*) MainCanvas_1->FindObject("info6");
01313     TLatex *info7 = (TLatex*) MainCanvas_1->FindObject("info7");
01314     TLatex *info8 = (TLatex*) MainCanvas_1->FindObject("info8");
01315     TLatex *info9 = (TLatex*) MainCanvas_1->FindObject("info9");
01316     TLatex *info10 = (TLatex*) MainCanvas_1->FindObject("info10");
01317     TLatex *info11 = (TLatex*) MainCanvas_1->FindObject("info11");
01318     TLatex *info12 = (TLatex*) MainCanvas_1->FindObject("info12");
01319     TLatex *info13 = (TLatex*) MainCanvas_1->FindObject("info13");
01320     TLatex *info14 = (TLatex*) MainCanvas_1->FindObject("info14");
01321 
01322     delete info1;
01323     delete info2;
01324     delete info3;
01325     delete info4;
01326     delete info5;
01327     delete info6;
01328     delete info7;
01329     delete info8;
01330     delete info9;
01331     delete info10;
01332     delete info11;
01333     delete info12;
01334     delete info13;
01335     delete info14;
01336 
01338 
01340     MainCanvas->cd(3);
01341     TPad *MainCanvas_3 = (TPad*)MainCanvas->GetPad(3);
01342 
01343     tz_stp_0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_stp_0");
01344     tz_stp_mid_0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_stp_mid_0");
01345     tz_stp_spe_0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_stp_spe_0");    
01346     if(!drawSAME){
01347       delete tz_stp_0; tz_stp_0 = 0;
01348       delete tz_stp_mid_0; tz_stp_mid_0 = 0;
01349       delete tz_stp_spe_0; tz_stp_spe_0 = 0;
01350     }
01351 
01352     tz_trk0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_trk0");
01353     tz_shw0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_shw0");
01354     tz_emshw0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_emshw0");
01355     if(!drawSAME){
01356       delete tz_trk0; tz_trk0 = 0;
01357       delete tz_shw0; tz_shw0 = 0;
01358       delete tz_emshw0; tz_emshw0 = 0;
01359     }
01360     
01361     TArrow *ttz_arrow1 = (TArrow*) MainCanvas_3->FindObject("TArrow");
01362     delete ttz_arrow1;
01363     
01364     //delete stdhep lines:
01365     TLine *stdhepLine = 0;
01366     while((stdhepLine = (TLine*) MainCanvas_3->FindObject("TLine"))) {
01367       delete stdhepLine;
01368     }
01369   
01370     MainCanvas->cd(4);
01371     TPad *MainCanvas_4 = (TPad*)MainCanvas->GetPad(4);
01372 
01373     tz_stp_1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_stp_1");
01374     tz_stp_mid_1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_stp_mid_1");
01375     tz_stp_spe_1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_stp_spe_1");
01376     if(!drawSAME){
01377       delete tz_stp_1; tz_stp_1 = 0;
01378       delete tz_stp_mid_1; tz_stp_mid_1 = 0;
01379       delete tz_stp_spe_1; tz_stp_spe_1 = 0;
01380     }
01381 
01382     tz_trk1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_trk1");
01383     tz_shw1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_shw1");
01384     tz_emshw1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_emshw1");
01385     if(!drawSAME){
01386       delete tz_trk1; tz_trk1 = 0;
01387       delete tz_shw1; tz_shw1 = 0;
01388       delete tz_emshw1; tz_emshw1 = 0;
01389     }
01390 
01391 
01392     TArrow *ttz_arrow2 = (TArrow*) MainCanvas_4->FindObject("TArrow");
01393     delete ttz_arrow2;
01394 
01395     stdhepLine = 0;  
01396     while((stdhepLine = (TLine*) MainCanvas_4->FindObject("TLine"))) {
01397       delete stdhepLine;
01398     }
01399 
01400     //Cluster:
01401     if(gROOT->FindObject("ClusterCanvas")) {
01402       ClusterCanvas = (TCanvas*) gROOT->FindObject("ClusterCanvas");
01403       ClusterCanvas->cd(1);
01404       TVirtualPad *ClusterCanvas_1 = ClusterCanvas->GetPad(1);
01405       tz_clu0 = (TMultiGraph*) ClusterCanvas_1->FindObject("tz_clu0");
01406       cluLeg0 = (TLegend*) ClusterCanvas_1->FindObject("TPave");
01407       if(!drawSAME) {
01408         delete tz_clu0; tz_clu0 = 0;
01409         delete cluLeg0; cluLeg0 = 0;
01410       }
01411       gPad->Update();
01412       gPad->Modified();
01413       ClusterCanvas->cd(2);
01414       TVirtualPad *ClusterCanvas_2 = ClusterCanvas->GetPad(2);
01415       tz_clu1 = (TMultiGraph*) ClusterCanvas_2->FindObject("tz_clu1");
01416       cluLeg1 = (TLegend*) ClusterCanvas_2->FindObject("TPave");
01417       if(!drawSAME) {
01418         delete tz_clu1; tz_clu1 = 0;
01419         delete cluLeg1; cluLeg1 = 0;
01420       }
01421       gPad->Update();
01422       gPad->Modified();
01423     }
01424     else if(LeClus) {
01425       ClusterCanvas = new TCanvas("ClusterCanvas","Reconstructed Cluster View",
01426                                   910,0,400,700);
01427       ClusterCanvas->Divide(1,2);
01428     }
01429 
01430     if(!LeClus&&gROOT->FindObject("ClusterCanvas")) {
01431       delete ClusterCanvas;
01432     }
01433 
01435         
01437     RecoCanvas->cd(2);
01438     //    line = (TPolyLine*) RecoCanvas_2->FindObject("TPolyLine");
01439     ellie = (TEllipse*) RecoCanvas_2->FindObject("TEllipse");
01440     RecoCanvas->Clear();
01441     RecoCanvas->Divide(3,2);
01442     RecoCanvas_5 = RecoCanvas->GetPad(5);
01443     RecoCanvas_5->Divide(1,2);
01444     
01446     xz_place = (TH2F*) gROOT->FindObject("xz_place");
01447     yz_place = (TH2F*) gROOT->FindObject("yz_place");
01448     yx_place = (TH2F*) gROOT->FindObject("yx_place");
01449     tz_place_0 = (TH2*) gROOT->FindObject("tz_place_0");
01450     tz_place_1 = (TH2*) gROOT->FindObject("tz_place_1");
01451     tz_missplace_0 = (TH2*) gROOT->FindObject("tz_missplace_0");
01452     tz_missplace_1 = (TH2*) gROOT->FindObject("tz_missplace_1");
01453 
01454     xz_place->GetXaxis()->UnZoom();
01455     yz_place->GetXaxis()->UnZoom();
01456     tz_place_0->GetXaxis()->UnZoom();
01457     tz_place_1->GetXaxis()->UnZoom();
01458     tz_missplace_0->GetXaxis()->UnZoom();
01459     tz_missplace_1->GetXaxis()->UnZoom();
01460     xz_place->GetYaxis()->UnZoom();
01461     yz_place->GetYaxis()->UnZoom();
01462     tz_place_0->GetYaxis()->UnZoom();
01463     tz_place_1->GetYaxis()->UnZoom();
01464     tz_missplace_0->GetYaxis()->UnZoom();
01465     tz_missplace_1->GetYaxis()->UnZoom();
01466 
01467     if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
01468       yx_place->GetXaxis()->SetRangeUser(-2.6,3.8);
01469       yx_place->GetYaxis()->SetRangeUser(-3.2,3.2);
01470 
01471     }
01472     else {
01473       yx_place->GetXaxis()->UnZoom();
01474       yx_place->GetYaxis()->UnZoom();
01475     }
01476     
01477     if(LeLego){
01478       tz_0_lego->GetXaxis()->UnZoom();
01479       tz_0_lego->GetYaxis()->UnZoom();
01480       tz_1_lego->GetXaxis()->UnZoom();
01481       tz_1_lego->GetYaxis()->UnZoom();
01482       if(!drawSAME) {
01483         tz_0_lego->Reset();
01484         tz_1_lego->Reset();
01485       }
01486     }
01487     if(handScan) {
01488       ScanID = 0;
01489       ScanTop = 0;
01490       ChangeLogButColor();
01491     }
01492   }
01493 
01494   //if no detector outlines, make them here:
01495   if(!line){
01496     float linex_caldet[5] = {-0.5,0.5,0.5,-0.5,-0.5};
01497     float liney_caldet[5] = {-0.5,-0.5,0.5,0.5,-0.5};
01498     if(ntpHeader->GetVldContext().GetDetector()==Detector::kFar) {
01499       line = new TPolyLine(33,"");
01500       line->SetPoint( 0, 421.8893*Munits::cm,-142.8867*Munits::cm);
01501       line->SetPoint( 1, 421.8893*Munits::cm,-138.3342*Munits::cm);
01502       line->SetPoint( 2, 400.1614*Munits::cm,-115.9855*Munits::cm);
01503       line->SetPoint( 3, 400.1614*Munits::cm,  87.6358*Munits::cm);
01504       line->SetPoint( 4, 406.9902*Munits::cm,  94.0507*Munits::cm);
01505       line->SetPoint( 5, 429.1319*Munits::cm, 101.5003*Munits::cm);
01506       line->SetPoint( 6, 447.1350*Munits::cm, 101.5003*Munits::cm);
01507       line->SetPoint( 7, 454.7915*Munits::cm,  94.2577*Munits::cm);
01508       line->SetPoint( 8, 457.6886*Munits::cm,  94.2577*Munits::cm);
01509       line->SetPoint( 9, 457.6886*Munits::cm, 109.3637*Munits::cm);
01510       line->SetPoint(10, 143.7724*Munits::cm, 423.2799*Munits::cm);
01511       line->SetPoint(11, 139.4268*Munits::cm, 423.2799*Munits::cm);
01512       line->SetPoint(12, 117.2850*Munits::cm, 401.1382*Munits::cm);
01513       line->SetPoint(13,-116.9622*Munits::cm, 401.1382*Munits::cm);
01514       line->SetPoint(14,-139.1040*Munits::cm, 423.2799*Munits::cm);
01515       line->SetPoint(15,-143.4496*Munits::cm, 423.2799*Munits::cm);
01516       line->SetPoint(16,-457.3658*Munits::cm, 109.3637*Munits::cm);
01517       line->SetPoint(17,-457.3658*Munits::cm,  94.2577*Munits::cm);
01518       line->SetPoint(18,-454.4687*Munits::cm,  94.2577*Munits::cm);
01519       line->SetPoint(19,-439.9834*Munits::cm, 101.9141*Munits::cm);
01520       line->SetPoint(20,-429.8438*Munits::cm, 101.9141*Munits::cm);
01521       line->SetPoint(21,-406.6674*Munits::cm,  94.2577*Munits::cm);
01522       line->SetPoint(22,-399.8386*Munits::cm,  84.7388*Munits::cm);
01523       line->SetPoint(23,-399.8386*Munits::cm,-115.9855*Munits::cm);
01524       line->SetPoint(24,-421.5665*Munits::cm,-137.7134*Munits::cm);
01525       line->SetPoint(25,-421.5665*Munits::cm,-142.8867*Munits::cm);
01526       line->SetPoint(26,-143.4496*Munits::cm,-421.0036*Munits::cm);
01527       line->SetPoint(27,-139.1040*Munits::cm,-421.0036*Munits::cm);
01528       line->SetPoint(28,-116.9622*Munits::cm,-398.8619*Munits::cm);
01529       line->SetPoint(29, 116.8712*Munits::cm,-398.8619*Munits::cm);
01530       line->SetPoint(30, 139.4268*Munits::cm,-421.0036*Munits::cm);
01531       line->SetPoint(31, 143.7724*Munits::cm,-421.0036*Munits::cm);
01532       line->SetPoint(32, 421.8893*Munits::cm,-142.8867*Munits::cm);
01533       
01534       fd_xy_fid1 = new TEllipse(0.0, 0.0, 3.74, 3.74); // 0.8 m radius
01535       fd_xy_fid1->SetLineWidth(2);
01536       fd_xy_fid1->SetLineColor(kBlack);
01537       fd_xy_fid1->SetLineStyle(kDashed);
01538       fd_xy_fid1->SetFillStyle(0);
01539       fd_xy_fid1->SetBit(kCannotPick); // hey, don't move!
01540 
01541       fd_xy_fid2 = new TEllipse(0.0, 0.0, 0.4, 0.4); // 0.4 m radius
01542       fd_xy_fid2->SetLineWidth(2);
01543       fd_xy_fid2->SetLineColor(kBlack);
01544       fd_xy_fid2->SetLineStyle(kDashed);
01545       fd_xy_fid2->SetFillStyle(0);
01546       fd_xy_fid2->SetBit(kCannotPick); // hey, don't move!
01547       
01548       fd_uz_fid1 = new TPolyLine(5);
01549       fd_vz_fid1 = new TPolyLine(5);
01550       fd_uz_fid2 = new TPolyLine(5);
01551       fd_vz_fid2 = new TPolyLine(5);
01552       const double u_cen=0.4; 
01553       const double v_cen=0.4;
01554       fd_uz_fid1->SetPoint(0,0.23,u_cen+3.74);
01555       fd_uz_fid1->SetPoint(1,14.27,u_cen+3.74);
01556       fd_uz_fid1->SetPoint(2,14.27,u_cen-3.74);
01557       fd_uz_fid1->SetPoint(3,0.23,u_cen-3.74);
01558       fd_uz_fid1->SetPoint(4,0.23,u_cen+3.74);
01559       fd_uz_fid1->SetLineColor(kBlack);
01560       fd_uz_fid1->SetLineStyle(kDashed);
01561       fd_uz_fid1->SetLineWidth(2);
01562       fd_uz_fid1->SetBit(kCannotPick);
01563 
01564       fd_uz_fid2->SetPoint(0,16.13,u_cen+3.74);
01565       fd_uz_fid2->SetPoint(1,28.73,u_cen+3.74);
01566       fd_uz_fid2->SetPoint(2,28.73,u_cen-3.74);
01567       fd_uz_fid2->SetPoint(3,16.13,u_cen-3.74);
01568       fd_uz_fid2->SetPoint(4,16.13,u_cen+3.74);
01569       fd_uz_fid2->SetLineColor(kBlack);
01570       fd_uz_fid2->SetLineStyle(kDashed);
01571       fd_uz_fid2->SetLineWidth(2);
01572       fd_uz_fid2->SetBit(kCannotPick);
01573 
01574       fd_vz_fid1->SetPoint(0,0.23,v_cen+3.74);
01575       fd_vz_fid1->SetPoint(1,14.27,v_cen+3.74);
01576       fd_vz_fid1->SetPoint(2,14.27,v_cen-3.74);
01577       fd_vz_fid1->SetPoint(3,0.23,v_cen-3.74);
01578       fd_vz_fid1->SetPoint(4,0.23,v_cen+3.74);
01579       fd_vz_fid1->SetLineColor(kBlack);
01580       fd_vz_fid1->SetLineStyle(kDashed);
01581       fd_vz_fid1->SetLineWidth(2);
01582       fd_vz_fid1->SetBit(kCannotPick);
01583 
01584       fd_vz_fid2->SetPoint(0,16.13,u_cen+3.74);
01585       fd_vz_fid2->SetPoint(1,28.73,u_cen+3.74);
01586       fd_vz_fid2->SetPoint(2,28.73,u_cen-3.74);
01587       fd_vz_fid2->SetPoint(3,16.13,u_cen-3.74);
01588       fd_vz_fid2->SetPoint(4,16.13,u_cen+3.74);
01589       fd_vz_fid2->SetLineColor(kBlack);
01590       fd_vz_fid2->SetLineStyle(kDashed);
01591       fd_vz_fid2->SetLineWidth(2);
01592       fd_vz_fid2->SetBit(kCannotPick);
01593 
01594 
01595     }     
01596     else if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear) {
01597       line = new TPolyLine(23,"");
01598       Double_t x0 = 55.78*Munits::cm;   
01599       line->SetPoint( 0,-121.43*Munits::inch+x0,  0.47*Munits::inch);
01600       line->SetPoint( 1,-120.25*Munits::inch+x0,  0.47*Munits::inch);
01601       line->SetPoint( 2,-115.14*Munits::inch+x0,  3.42*Munits::inch);
01602       line->SetPoint( 3,-110.24*Munits::inch+x0,  3.42*Munits::inch);
01603       line->SetPoint( 4, -95.24*Munits::inch+x0, -1.48*Munits::inch);
01604       line->SetPoint( 5, -95.24*Munits::inch+x0,-35.47*Munits::inch);
01605       line->SetPoint( 6, -69.80*Munits::inch+x0,-60.91*Munits::inch);
01606       line->SetPoint( 7, -69.80*Munits::inch+x0,-75.04*Munits::inch);
01607       line->SetPoint( 8,  69.80*Munits::inch+x0,-75.04*Munits::inch);
01608       line->SetPoint( 9,  69.80*Munits::inch+x0,-60.91*Munits::inch);
01609       line->SetPoint(10,  95.24*Munits::inch+x0,-35.47*Munits::inch);
01610       line->SetPoint(11,  95.24*Munits::inch+x0, -1.48*Munits::inch);
01611       line->SetPoint(12, 110.16*Munits::inch+x0,  3.42*Munits::inch);
01612       line->SetPoint(13, 117.30*Munits::inch+x0,  3.42*Munits::inch);
01613       line->SetPoint(14, 120.25*Munits::inch+x0,  0.47*Munits::inch);
01614       line->SetPoint(15, 121.43*Munits::inch+x0,  0.47*Munits::inch);
01615       line->SetPoint(16, 121.43*Munits::inch+x0,  9.28*Munits::inch);
01616       line->SetPoint(17,  69.80*Munits::inch+x0, 60.91*Munits::inch);
01617       line->SetPoint(18,  69.80*Munits::inch+x0, 75.04*Munits::inch);
01618       line->SetPoint(19, -69.80*Munits::inch+x0, 75.04*Munits::inch);
01619       line->SetPoint(20, -69.80*Munits::inch+x0, 60.91*Munits::inch);
01620       line->SetPoint(21,-121.43*Munits::inch+x0,  9.28*Munits::inch);
01621       line->SetPoint(22,-121.43*Munits::inch+x0,  0.47*Munits::inch);
01622       line->SetBit(kCannotPick);
01623       // near detector plane outlines
01624       PlaneOutline po;
01625       Color_t colu=38;
01626       Color_t colv=46;
01627       po.GetOutline(PlaneView::kV, PlaneCoverage::kNearPartial,
01628                     pv1_outline, pv2_outline);
01629       po.GetOutline(PlaneView::kV, PlaneCoverage::kNearFull,
01630                     fv1_outline, fv2_outline);
01631       po.GetOutline(PlaneView::kU, PlaneCoverage::kNearPartial,
01632                     pu1_outline, pu2_outline);
01633       po.GetOutline(PlaneView::kU, PlaneCoverage::kNearFull,
01634                     fu1_outline, fu2_outline);
01635       pv1_outline->SetLineColor(colv);
01636       pu1_outline->SetLineColor(colu);
01637 
01638       fv1_outline->SetLineColor(colv);
01639       fu1_outline->SetLineColor(colu);
01640       fv2_outline->SetFillColor(16);
01641       fu2_outline->SetFillColor(16);
01642       fv2_outline->SetFillStyle(4020);
01643       fu2_outline->SetFillStyle(4020);
01644       
01645       pv1_outline->SetLineWidth(2);
01646       pu1_outline->SetLineWidth(2);
01647       fv1_outline->SetLineWidth(2);
01648       fu1_outline->SetLineWidth(2);
01649       fv2_outline->SetLineWidth(2);
01650       fu2_outline->SetLineWidth(2);
01651 
01652       pv1_outline->SetBit(kCannotPick);
01653       pu1_outline->SetBit(kCannotPick);
01654       fv1_outline->SetBit(kCannotPick);
01655       fu1_outline->SetBit(kCannotPick);
01656       fv2_outline->SetBit(kCannotPick);
01657       fu2_outline->SetBit(kCannotPick);
01658 
01659 
01660       nd_xy_fid = new TEllipse(1.4828, 0.2384, 0.8, 0.8); // 0.8 m radius
01661       nd_xy_fid->SetLineWidth(2);
01662       nd_xy_fid->SetLineColor(kBlack);
01663       nd_xy_fid->SetLineStyle(kDashed);
01664       nd_xy_fid->SetFillStyle(0);
01665       nd_xy_fid->SetBit(kCannotPick); // hey, don't move!
01666 
01667       nd_uz_fid = new TPolyLine(5);
01668       nd_vz_fid = new TPolyLine(5);
01669       /*
01670       const double u_cen=(1.0/sqrt(2.0))*(1.4885+0.1397);
01671       const double v_cen=(1.0/sqrt(2.0))*(0.1397-1.4885);
01672       nd_uz_fid->SetPoint(0,0.8,u_cen+0.8);
01673       nd_uz_fid->SetPoint(1,4.0,u_cen+0.8);
01674       nd_uz_fid->SetPoint(2,4.0,u_cen-0.8);
01675       nd_uz_fid->SetPoint(3,0.8,u_cen-0.8);
01676       nd_uz_fid->SetPoint(4,0.8,u_cen+0.8);
01677       */
01678       //Alex: Adjustment according to DataUtil/infid_sets.C (cc2008)
01679       //Also need to adjust for trk vtx correction: See DataUtil/infid.cxx
01680       const double gTrkVtxZOffset=0.0392;
01681       const double u_cen=(1.0/sqrt(2.0))*(1.4828+0.2384);
01682       const double v_cen=(1.0/sqrt(2.0))*(0.2384-1.4828);
01683       nd_uz_fid->SetPoint(0,0.81009+gTrkVtxZOffset,
01684                           u_cen+(0.81009+gTrkVtxZOffset) );
01685       nd_uz_fid->SetPoint(1,4.07710+gTrkVtxZOffset,
01686                           u_cen+(0.81009+gTrkVtxZOffset) );
01687       nd_uz_fid->SetPoint(2,4.07710+gTrkVtxZOffset,
01688                           u_cen-(0.81009+gTrkVtxZOffset) );
01689       nd_uz_fid->SetPoint(3,0.81009+gTrkVtxZOffset,
01690                           u_cen-(0.81009+gTrkVtxZOffset) );
01691       nd_uz_fid->SetPoint(4,0.81009+gTrkVtxZOffset,
01692                           u_cen+(0.81009+gTrkVtxZOffset) );
01693 
01694       nd_uz_fid->SetLineColor(kBlack);
01695       nd_uz_fid->SetLineStyle(kDashed);
01696       nd_uz_fid->SetLineWidth(2);
01697       nd_uz_fid->SetBit(kCannotPick);
01698       
01699       /*
01700       nd_vz_fid->SetPoint(0,0.8,v_cen+0.8);
01701       nd_vz_fid->SetPoint(1,4.0,v_cen+0.8);
01702       nd_vz_fid->SetPoint(2,4.0,v_cen-0.8);
01703       nd_vz_fid->SetPoint(3,0.8,v_cen-0.8);
01704       nd_vz_fid->SetPoint(4,0.8,v_cen+0.8);
01705       */
01706       //Alex: Adjustment according to DataUtil/infid_sets.C (cc2008)
01707       nd_vz_fid->SetPoint(0,0.81009+gTrkVtxZOffset,
01708                           v_cen+(0.81009+gTrkVtxZOffset) );
01709       nd_vz_fid->SetPoint(1,4.07710+gTrkVtxZOffset,
01710                           v_cen+(0.81009+gTrkVtxZOffset) );
01711       nd_vz_fid->SetPoint(2,4.07710+gTrkVtxZOffset,
01712                           v_cen-(0.81009+gTrkVtxZOffset) );
01713       nd_vz_fid->SetPoint(3,0.81009+gTrkVtxZOffset,
01714                           v_cen-(0.81009+gTrkVtxZOffset) );
01715       nd_vz_fid->SetPoint(4,0.81009+gTrkVtxZOffset,
01716                           v_cen+(0.81009+gTrkVtxZOffset) );
01717 
01718       nd_vz_fid->SetLineColor(kBlack);
01719       nd_vz_fid->SetLineStyle(kDashed);
01720       nd_vz_fid->SetLineWidth(2);
01721       nd_vz_fid->SetBit(kCannotPick);
01722 
01723      }
01724     else if(ntpHeader->GetVldContext().GetDetector()==Detector::kCalDet) 
01725       line = new TPolyLine(5,linex_caldet,liney_caldet);
01726     line->SetLineWidth(3);
01727     line->SetLineColor(4);
01728   }
01729   
01730   if(!ellie&&ntpHeader->GetVldContext().GetDetector()==Detector::kFar){ 
01731     ellie = new TEllipse(0,0,3.5,3.5,0,360,0);   
01732     ellie->SetLineColor(6);
01733     ellie->SetLineWidth(3);
01734     ellie->SetLineStyle(2);
01735     ellie->SetFillStyle(0);
01736   }
01737 
01738   //  if(NoSlice) return false;
01739 
01740   // Missing Strips
01741 
01742   if(!tz_missstp_0 && nmissU>0) {
01743     tz_missstp_0 = new TMultiGraph();
01744     tz_missstp_0->SetName("tz_missstp_0");
01745     tz_missstp_0->SetTitle("Transverse Position vs Z View");
01746   }
01747   if(tz_missstp_0 && nmissU>0){
01748     TGraph *temp = new TGraph(nmissU,missstripz_0,missstript_0);
01749     temp->SetMarkerColor(2);
01750     temp->SetMarkerSize(1);
01751     temp->SetMarkerStyle(8);
01752     tz_missstp_0->Add(temp);
01753   }
01754   if(tz_missstp_0 && nmissU>0){
01755     TGraph *temp = new TGraph(nmissU,missstripz_0,missstript_0);
01756     temp->SetMarkerColor(2);
01757     temp->SetMarkerSize(1);
01758     temp->SetMarkerStyle(8);
01759     tz_missstp_0->Add(temp);
01760   }
01761   if(tz_missstp_0 && nmissUOneEnd>0){
01762     TGraph *temp = new TGraph(nmissUOneEnd,missstripzOneEnd_0,missstriptOneEnd_0);
01763     temp->SetMarkerColor(3);
01764     temp->SetMarkerSize(1);
01765     temp->SetMarkerStyle(8);
01766     tz_missstp_0->Add(temp);
01767   }
01768   if(tz_missstp_0 && nmissULowPE>0){
01769     TGraph *temp = new TGraph(nmissULowPE,missstripzLowPE_0,missstriptLowPE_0);
01770     temp->SetMarkerColor(4);
01771     temp->SetMarkerSize(1);
01772     temp->SetMarkerStyle(8);
01773     tz_missstp_0->Add(temp);
01774   }
01775   if(!tz_missstp_1 && nmissV>0) {
01776     tz_missstp_1 = new TMultiGraph();
01777     tz_missstp_1->SetName("tz_missstp_1");
01778     tz_missstp_1->SetTitle("Transverse Position vs Z View");
01779   }
01780   if(tz_missstp_1 && nmissV>0){
01781     TGraph *temp = new TGraph(nmissV,missstripz_1,missstript_1);
01782     temp->SetMarkerColor(2);
01783     temp->SetMarkerSize(1);
01784     temp->SetMarkerStyle(8);
01785     tz_missstp_1->Add(temp);
01786   }
01787   if(tz_missstp_1 && nmissVOneEnd>0){
01788     TGraph *temp = new TGraph(nmissVOneEnd,missstripzOneEnd_1,missstriptOneEnd_1);
01789     temp->SetMarkerColor(3);
01790     temp->SetMarkerSize(1);
01791     temp->SetMarkerStyle(8);
01792     tz_missstp_1->Add(temp);
01793   }
01794   if(tz_missstp_1 && nmissVLowPE>0){
01795     TGraph *temp = new TGraph(nmissVLowPE,missstripzLowPE_1,missstriptLowPE_1);
01796     temp->SetMarkerColor(4);
01797     temp->SetMarkerSize(1);
01798     temp->SetMarkerStyle(8);
01799     tz_missstp_1->Add(temp);
01800   }
01801   delete [] missstript_0;
01802   delete [] missstripz_0;
01803   delete [] missstript_1;
01804   delete [] missstripz_1;
01805 
01806   delete [] missstriptOneEnd_0;
01807   delete [] missstripzOneEnd_0;
01808   delete [] missstriptOneEnd_1;
01809   delete [] missstripzOneEnd_1;
01810 
01811   delete [] missstriptLowPE_0;
01812   delete [] missstripzLowPE_0;
01813   delete [] missstriptLowPE_1;
01814   delete [] missstripzLowPE_1;
01815 
01816 
01817 
01819   //Strips
01820   int slc_nstrip=0;
01821   if(ntpSlice){
01822     slc_nstrip = ntpSlice->nstrip;
01823   }
01824     float *stp_z_big_0 = new float[slc_nstrip];
01825     float *stp_z_mid_0 = new float[slc_nstrip];
01826     float *stp_z_spe_0 = new float[slc_nstrip];
01827     
01828     float *stp_tpos_big_0 = new float[slc_nstrip];
01829     float *stp_tpos_mid_0 = new float[slc_nstrip];
01830     float *stp_tpos_spe_0 = new float[slc_nstrip];
01831     
01832     int nstp_big_0 = 0;
01833     int nstp_mid_0 = 0;
01834     int nstp_spe_0 = 0;
01835     
01836     float *stp_z_big_1 = new float[slc_nstrip];
01837     float *stp_z_mid_1 = new float[slc_nstrip];
01838     float *stp_z_spe_1 = new float[slc_nstrip];
01839     
01840     float *stp_tpos_big_1 = new float[slc_nstrip];
01841     float *stp_tpos_mid_1 = new float[slc_nstrip];
01842     float *stp_tpos_spe_1 = new float[slc_nstrip];
01843     
01844     int nstp_big_1 = 0;
01845     int nstp_mid_1 = 0;
01846     int nstp_spe_1 = 0;
01847     
01848     float ATH_reco0[500][192] = {};
01849     float ATH_reco1[500][192] = {};
01850     float ATH_mcA[500][192] = {};
01851     float ATH_mcB[500][192] = {};
01852     
01853     for(int i=0;i<500;i++){
01854       for(int j=0;j<192;j++){
01855         ATH_reco0[i][j] = -1;
01856         ATH_reco1[i][j] = -1;
01857         ATH_mcA[i][j] = -1;
01858         ATH_mcB[i][j] = -1;
01859       }
01860     }
01861     
01862     float highest_plane = 0;
01863     float lowest_plane = 500;
01864     
01865     float highest_z = 0;
01866     float lowest_z = 30.;
01867     float highest_t0 = -4.0;
01868     float lowest_t0 = 4.0;
01869     float highest_t1 = -4.0;
01870     float lowest_t1 = 4.0;
01871     
01872     for(int i=0;i<slc_nstrip;i++){
01873       
01874       int index = ntpSlice->stp[i];
01875       ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
01876       
01877       int tempo_pln = ntpStrip->plane;
01878       int tempo_stp = ntpStrip->strip;
01879       
01880       if(tempo_pln<lowest_plane) {
01881         lowest_plane=tempo_pln;
01882         lowest_z=ntpStrip->z;
01883       }
01884       if(tempo_pln>highest_plane) {
01885         highest_plane=tempo_pln;
01886         highest_z=ntpStrip->z;
01887       }
01888       
01889       ATH_reco0[tempo_pln][tempo_stp] = ntpStrip->ph0.pe;
01890       ATH_reco1[tempo_pln][tempo_stp] = ntpStrip->ph1.pe;
01891       
01892       if(ntpStrip->planeview==2){
01893         
01894         if(LeLego) 
01895           tz_0_lego->Fill(tempo_pln-0.49,ntpStrip->tpos,
01896                           ntpStrip->ph0.pe+ntpStrip->ph1.pe);
01897         
01898         if(ntpStrip->tpos<lowest_t0) lowest_t0=ntpStrip->tpos;
01899         if(ntpStrip->tpos>highest_t0) highest_t0=ntpStrip->tpos;
01900         
01901         if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dspe_val){
01902           stp_z_spe_0[nstp_spe_0]=ntpStrip->z;
01903           stp_tpos_spe_0[nstp_spe_0]=ntpStrip->tpos;
01904           nstp_spe_0++;
01905         }
01906         else if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dmid_val){
01907           stp_z_mid_0[nstp_mid_0]=ntpStrip->z;
01908           stp_tpos_mid_0[nstp_mid_0]=ntpStrip->tpos;
01909           nstp_mid_0++;
01910         }
01911         else {
01912           stp_z_big_0[nstp_big_0]=ntpStrip->z;
01913           stp_tpos_big_0[nstp_big_0]=ntpStrip->tpos;
01914           nstp_big_0++;
01915         }
01916       }
01917       
01918       else {
01919         
01920         if(LeLego)
01921           tz_1_lego->Fill(tempo_pln-0.49,ntpStrip->tpos,
01922                           ntpStrip->ph0.pe+ntpStrip->ph1.pe);
01923         
01924         if(ntpStrip->tpos<lowest_t1) lowest_t1=ntpStrip->tpos;
01925         if(ntpStrip->tpos>highest_t1) highest_t1=ntpStrip->tpos;
01926         
01927         if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dspe_val){
01928           stp_z_spe_1[nstp_spe_1]=ntpStrip->z;
01929           stp_tpos_spe_1[nstp_spe_1]=ntpStrip->tpos;
01930           nstp_spe_1++;
01931         }
01932         else if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dmid_val){
01933           stp_z_mid_1[nstp_mid_1]=ntpStrip->z;
01934           stp_tpos_mid_1[nstp_mid_1]=ntpStrip->tpos;
01935           nstp_mid_1++;
01936         }
01937         else {
01938           stp_z_big_1[nstp_big_1]=ntpStrip->z;
01939           stp_tpos_big_1[nstp_big_1]=ntpStrip->tpos;
01940           nstp_big_1++;
01941         }
01942       }
01943     }
01944     
01945     if(!tz_stp_0 && nstp_big_0>0) {
01946       tz_stp_0 = new TMultiGraph();
01947       tz_stp_0->SetName("tz_stp_0");
01948       tz_stp_0->SetTitle("Transverse Position vs Z View");
01949     }
01950     if(nstp_big_0>0){
01951       TGraph *temp = new TGraph(nstp_big_0,stp_z_big_0,stp_tpos_big_0);
01952       temp->SetMarkerColor(1);
01953       temp->SetMarkerSize(1.1);
01954       temp->SetMarkerStyle(8);
01955       tz_stp_0->Add(temp);
01956     }
01957     if(!tz_stp_mid_0 && nstp_mid_0>0){
01958       tz_stp_mid_0 = new TMultiGraph();
01959       tz_stp_mid_0->SetName("tz_stp_mid_0");
01960       tz_stp_mid_0->SetTitle("Transverse Position vs Z View");
01961     }
01962     if(nstp_mid_0>0){
01963       TGraph *temp = new TGraph(nstp_mid_0,stp_z_mid_0,stp_tpos_mid_0);
01964       temp->SetMarkerColor(4);
01965       temp->SetMarkerSize(1.1);
01966       temp->SetMarkerStyle(8);
01967       tz_stp_mid_0->Add(temp);
01968     }
01969     if(!tz_stp_spe_0 && nstp_spe_0>0){
01970       tz_stp_spe_0 = new TMultiGraph();
01971       tz_stp_spe_0->SetName("tz_stp_spe_0");
01972     }
01973     if(nstp_spe_0>0){  
01974       TGraph *temp = new TGraph(nstp_spe_0,stp_z_spe_0,stp_tpos_spe_0);
01975       temp->SetMarkerColor(3);
01976       temp->SetMarkerSize(1.1);
01977       temp->SetMarkerStyle(8);
01978       tz_stp_spe_0->Add(temp);
01979     }
01980     if(!tz_stp_1 && nstp_big_1>0) {
01981       tz_stp_1 = new TMultiGraph();
01982       tz_stp_1->SetName("tz_stp_1");
01983       tz_stp_1->SetTitle("Transverse Position vs Z View");
01984     }
01985     if(nstp_big_1>0){
01986       TGraph *temp = new TGraph(nstp_big_1,stp_z_big_1,stp_tpos_big_1);
01987       temp->SetMarkerColor(1);
01988       temp->SetMarkerSize(1.1);
01989       temp->SetMarkerStyle(8);
01990       tz_stp_1->Add(temp);
01991     }
01992     
01993     if(!tz_stp_mid_1 && nstp_mid_1>0){
01994       tz_stp_mid_1 = new TMultiGraph();
01995       tz_stp_mid_1->SetName("tz_stp_mid_1");
01996       tz_stp_mid_1->SetTitle("Transverse Position vs Z View");
01997     }
01998     if(nstp_mid_1>0){
01999       TGraph *temp = new TGraph(nstp_mid_1,stp_z_mid_1,stp_tpos_mid_1);
02000       temp->SetMarkerColor(4);
02001       temp->SetMarkerSize(1.1);
02002       temp->SetMarkerStyle(8);
02003       tz_stp_mid_1->Add(temp);
02004     }
02005     
02006     if(!tz_stp_spe_1 && nstp_spe_1>0){
02007       tz_stp_spe_1 = new TMultiGraph();
02008       tz_stp_spe_1->SetName("tz_stp_spe_1");
02009     }
02010     if(nstp_spe_1>0){  
02011       TGraph *temp = new TGraph(nstp_spe_1,stp_z_spe_1,stp_tpos_spe_1);
02012       temp->SetMarkerColor(3);
02013       temp->SetMarkerSize(1.1);
02014       temp->SetMarkerStyle(8);
02015       tz_stp_spe_1->Add(temp);
02016     }
02017   
02018     delete [] stp_tpos_big_0;
02019     delete [] stp_tpos_mid_0;
02020     delete [] stp_tpos_spe_0;
02021     delete [] stp_z_big_0;
02022     delete [] stp_z_mid_0;
02023     delete [] stp_z_spe_0;
02024     
02025     delete [] stp_tpos_big_1;
02026     delete [] stp_tpos_mid_1;
02027     delete [] stp_tpos_spe_1;
02028     delete [] stp_z_big_1;
02029     delete [] stp_z_mid_1;
02030     delete [] stp_z_spe_1;
02031   
02032     if(lowest_plane-10>=0) {
02033       lowest_plane-=10;
02034       lowest_z-=10.*0.06;
02035     }
02036     else {
02037       lowest_plane=0;
02038       lowest_z=0.;
02039     }
02040     
02041     if(highest_plane+10<=485) {
02042       highest_plane+=10;
02043       highest_z+=10.*0.06;
02044     }
02045     else {
02046       highest_plane=485;
02047       highest_z=30.;
02048     }
02049     
02050     if(lowest_t0-5*0.041>=-4.0) lowest_t0-=5.*0.041;
02051     else lowest_t0=-4.0;
02052     
02053     if(lowest_t1-5*0.041>=-4.0) lowest_t1-=5.*0.041;
02054     else lowest_t1=-4.0;
02055     
02056     if(highest_t0+5*0.041<=4.0) highest_t0+=5.*0.041;
02057     else highest_t0=4.0;
02058     
02059     if(highest_t1+5*0.041<=4.0) highest_t1+=5.*0.041;
02060     else highest_t1=4.0;
02061  
02063   //Start making Reco plots for showers and tracks:
02064 
02065   //make sure there is a reconstructed event
02066   if(isReco&&eventSummary->nevent!=0){ //begin of reco code
02067 
02069     //Showers
02070     
02071     //make sure there is a shower
02072     if(ntpEvent->nshower>0){ //begin of shower code
02073       
02074       if(!tz_shw0) {
02075         tz_shw0 = new TMultiGraph();
02076         tz_shw0->SetName("tz_shw0");
02077       }
02078       if(!tz_shw1){
02079         tz_shw1 = new TMultiGraph();
02080         tz_shw1->SetName("tz_shw1");
02081       }
02082       if(!xz_shw){
02083         xz_shw = new TMultiGraph();
02084         xz_shw->SetName("xz_shw");
02085       }
02086       if(!yz_shw){
02087         yz_shw = new TMultiGraph();
02088         yz_shw->SetName("yz_shw");
02089       }
02090       if(!yx_shw){
02091         yx_shw = new TMultiGraph();
02092         yx_shw->SetName("yx_shw");
02093       }
02094       if(!ztime) {
02095         ztime = new TMultiGraph();
02096         ztime->SetName("ztime");
02097         ztime->SetTitle("Time vs Z view");      
02098       }
02099       if(!ytime){
02100         ytime = new TMultiGraph();
02101         ytime->SetName("ytime");
02102         ytime->SetTitle("Time vs Y view");
02103       }
02104 
02105       int *showers = ntpEvent->shw;
02106       
02107       int numshwstp=0;
02108       int numshwstp0=0;
02109       int numshwstp1=0;
02110 
02111       for(int i=0;i<ntpEvent->nshower;i++){
02112         int index = showers[i];
02113         LoadShower(index);
02114         numshwstp += ntpShower->nstrip;
02115       }
02116 
02117       float *shw_tpos = new float[numshwstp];      
02118       float *shw_tpos0 = new float[numshwstp];
02119       float *shw_z0 = new float[numshwstp];
02120       float *shw_tpos1 = new float[numshwstp];
02121       float *shw_z1 = new float[numshwstp];
02122       float *shwstpx = new float[numshwstp];
02123       float *shwstpy = new float[numshwstp];
02124       float *shwstpz = new float[numshwstp];
02125       double *shw_time = new double[numshwstp];
02126       double *shw_y = new double[numshwstp];
02127       double *shw_z = new double[numshwstp];
02128       int count = 0;
02129       int largest_shw_index=-1;
02130       int vtx_shw_index=-1;
02131       
02132       LoadShower_Jim(theEvent,vtx_shw_index,ntpHeader->GetVldContext().GetDetector());
02133       
02134       LoadLargestShowerFromEvent(theEvent,largest_shw_index);
02135       /*
02136       {
02137         int track_index=-1;
02138         LoadLargestTrackFromEvent(theEvent,track_index);
02139         if(track_index>-1) LoadShowerAtTrackVertex(theEvent,track_index,vtx_shw_index);
02140       }
02141       */
02142       for(int i=0;i<ntpEvent->nshower;i++){
02143         int index1 = showers[i];
02144         LoadShower(index1);
02145         Int_t *shwstrips = ntpShower->stp;
02146 
02147         count=0;
02148         numshwstp0=0;
02149         numshwstp1=0;
02150       
02151         for(int j=0;j<ntpShower->nstrip;j++){
02152           Int_t index = shwstrips[j];
02153           if(index==-1) {numshwstp=0; break;} //bug in old ntuple code
02154           ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
02155           
02156           shw_tpos[count] = ntpStrip->tpos;
02157           shw_z[count] = ntpStrip->z;
02158 
02159           if(ntpStrip->time0>0 && 
02160              ntpStrip->time1>0) shw_time[count] = (ntpStrip->time0 + 
02161                                                    ntpStrip->time1)/2.;
02162           else if(ntpStrip->time0>0) shw_time[count] = ntpStrip->time0;
02163           else if(ntpStrip->time1>0) shw_time[count] = ntpStrip->time1;
02164           else shw_time[count] = 0;
02165           /*
02166             if(ntpStrip->time0>0 && 
02167             ntpStrip->time1>0) shw_time[count] = (ntpShower->stpt0[j] + 
02168             ntpShower->stpt1[j])/2.;
02169             else if(ntpStrip->time0>0) shw_time[count] = ntpShower->stpt0[j];
02170             else if(ntpStrip->time1>0) shw_time[count] = ntpShower->stpt1[j];
02171             else shw_time[count] = 0;
02172             }
02173           */
02174           shw_time[count] -= eventSummary->trigtime;
02175           shw_time[count] *= 1e9;
02176 
02177           float shwstpu = 0;
02178           float shwstpv = 0;
02179 
02180           if(ntpStrip->planeview==2){
02181             shw_tpos0[numshwstp0] = shw_tpos[count];
02182             shw_z0[numshwstp0] = shw_z[count];
02183             numshwstp0+=1;
02184             shwstpu = shw_tpos[count];
02185             float grad = 0;
02186             if(ntpShower->vtx.dcosv!=0&&false) {
02187               grad = ntpShower->vtx.dcosz/ntpShower->vtx.dcosv;
02188             }
02189             shwstpv = ntpShower->vtx.v+(shw_z[count]-ntpShower->vtx.z)*grad;
02190             //shwstpv = ntpShower->stpv[j];
02191           }
02192           else {
02193             shw_tpos1[numshwstp1] = shw_tpos[count];
02194             shw_z1[numshwstp1] = shw_z[count];
02195             numshwstp1+=1;
02196             shwstpv = shw_tpos[count];
02197             float grad = 0;
02198             if(ntpShower->vtx.dcosu!=0&&false) {
02199               grad = ntpShower->vtx.dcosz/ntpShower->vtx.dcosu;
02200             }
02201             shwstpu = ntpShower->vtx.u+(shw_z[count]-ntpShower->vtx.z)*grad;
02202             //shwstpu = ntpShower->stpu[j];
02203           }
02204           shwstpx[count] = (shwstpu-shwstpv)/sqrt(2.);
02205           shwstpy[count] = (shwstpu+shwstpv)/sqrt(2.);
02206           shwstpz[count] = shw_z[count];
02207           shw_y[count]   = shwstpy[count];
02208           count++;
02209         }
02210         // largest ph shower will have color 5 by default
02211         // users can change this default via SetDefaultShowerMarkerColor()
02212         // others, a purplish-brown
02213         fDefaultShowerMarkerStyle=28;
02214         fDefaultShowerMarkerColor=6;
02215         int shw_marker_color=1;
02216         // vertex shower will have open circles, other open squares by default
02217         // users can change the default via SetDefaultShowerMarkerStyle()
02218         int shw_marker_style=25;
02219         if(largest_shw_index==index1) shw_marker_color = fDefaultShowerMarkerColor;
02220         if(vtx_shw_index==index1) shw_marker_style=fDefaultShowerMarkerStyle;
02221         if(numshwstp0>0){
02222           TGraph *temp = new TGraph(numshwstp0,shw_z0,shw_tpos0);
02223           temp->SetMarkerColor(shw_marker_color);
02224           temp->SetMarkerSize(1.15);
02225           temp->SetMarkerStyle(shw_marker_style);
02226           tz_shw0->Add(temp);
02227           temp = new TGraph(1,&ntpShower->vtx.z,&ntpShower->vtx.u);
02228           temp->SetMarkerColor(shw_marker_color);
02229           temp->SetMarkerSize(1);
02230           temp->SetMarkerStyle(3);
02231           tz_shw0->Add(temp);   
02232         }
02233         else {
02234           delete tz_shw0;
02235           tz_shw0 = NULL;
02236         }
02237         
02238         if(numshwstp1>0){
02239           TGraph *temp = new TGraph(numshwstp1,shw_z1,shw_tpos1);
02240           temp->SetMarkerColor(shw_marker_color);
02241           temp->SetMarkerSize(1.15);
02242           temp->SetMarkerStyle(shw_marker_style);
02243           tz_shw1->Add(temp);
02244           temp = new TGraph(1,&ntpShower->vtx.z,&ntpShower->vtx.v);
02245           temp->SetMarkerColor(shw_marker_color);
02246           temp->SetMarkerSize(1);
02247           temp->SetMarkerStyle(3);
02248           tz_shw1->Add(temp);
02249         }
02250         else {
02251           delete tz_shw1;
02252           tz_shw1 = NULL;
02253         }
02254 
02255         if(count>0){
02256           TGraph *temp = new TGraph(count,shwstpz,shwstpx);
02257           temp->SetMarkerColor(fDefaultShowerMarkerColor);
02258           temp->SetMarkerSize(0.6);
02259           temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
02260           xz_shw->Add(temp);
02261           
02262           temp = new TGraph(count,shwstpz,shwstpy);
02263           temp->SetMarkerColor(fDefaultShowerMarkerColor);
02264           temp->SetMarkerSize(0.6);
02265           temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
02266           yz_shw->Add(temp);
02267           
02268           temp = new TGraph(count,shwstpx,shwstpy);
02269           temp->SetMarkerColor(fDefaultShowerMarkerColor);
02270           temp->SetMarkerSize(0.6);
02271           temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
02272           yx_shw->Add(temp);
02273 
02274           temp = new TGraph(count,shw_z,shw_time);
02275           temp->SetMarkerColor(fDefaultShowerMarkerColor);
02276           temp->SetMarkerSize(0.6);
02277           temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
02278           ztime->Add(temp);
02279 
02280           temp = new TGraph(count,shw_y,shw_time);
02281           temp->SetMarkerColor(fDefaultShowerMarkerColor);
02282           temp->SetMarkerSize(0.6);
02283           temp->SetMarkerStyle(fDefaultShowerMarkerStyle);    
02284           ytime->Add(temp);
02285         }
02286       }
02287     
02288       delete [] shw_tpos;
02289       delete [] shw_tpos0;
02290       delete [] shw_z0;
02291       delete [] shw_tpos1;
02292       delete [] shw_z1;
02293       delete [] shwstpx;
02294       delete [] shwstpy;
02295       delete [] shwstpz;
02296       delete [] shw_time;
02297       delete [] shw_y;
02298       delete [] shw_z; 
02299       
02300     }
02301   
02303       //Clusters
02304 
02305     //make sure there is a cluster (by checking that there's a shower)
02306     if(LeClus&&ntpEvent->nshower>0){  //begin of cluster code
02307 
02308       if(!tz_clu0){
02309         tz_clu0 = new TMultiGraph();
02310         tz_clu0->SetName("tz_clu0");
02311       }
02312       if(!tz_clu1){
02313         tz_clu1 = new TMultiGraph();
02314         tz_clu1->SetName("tz_clu1");
02315       }
02316       if(!cluLeg0)
02317         cluLeg0 = new TLegend(0.85,0.7,0.98,0.98,"  Key: ID (P_{EM})");
02318       if(!cluLeg1)
02319         cluLeg1 = new TLegend(0.85,0.7,0.98,0.98,"  Key: ID (P_{EM})");
02320     
02321       int nUclus = 0;
02322       int col0 = 1;
02323       int nVclus = 0;
02324       int col1 = 1;
02325       
02326       int *showers = ntpEvent->shw;
02327       for(int i=0;i<ntpEvent->nshower;i++){
02328         int index2 = showers[i];
02329         LoadShower(index2);
02330                 
02331         int *clusters = ntpShower->clu;
02332         int numclustp=0;
02333         int numclustp0=0;
02334         int numclustp1=0;
02335         
02336         for(int j=0;j<ntpShower->ncluster;j++){
02337           int index1 = clusters[j];
02338           if(LoadCluster(index1)) {
02339             numclustp+=ntpCluster->nstrip;
02340             if(ntpCluster->planeview==2) nUclus+=1;
02341             else if(ntpCluster->planeview==3) nVclus+=1;
02342           }
02343         }
02344       
02345         float *clu_tpos = new float[numclustp];
02346         float *clu_tpos0 = new float[numclustp];
02347         float *clu_z0 = new float[numclustp];
02348         float *clu_tpos1 = new float[numclustp];
02349         float *clu_z1 = new float[numclustp];
02350         double *clu_z = new double[numclustp];
02351         int count = 0;
02352 
02353         for(int j=0;j<ntpShower->ncluster;j++){
02354           int index1 = clusters[j];
02355           if(!LoadCluster(index1)) continue;
02356           Int_t *clustrips = ntpCluster->stp;
02357 
02358           count=0;
02359           numclustp0=0;
02360           numclustp1=0;
02361 
02362           for(int k=0;k<ntpCluster->nstrip;k++){
02363             Int_t index = clustrips[k];
02364             ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
02365 
02366             clu_tpos[count] = ntpStrip->tpos;
02367             clu_z[count]    = ntpStrip->z;
02368 
02369             if(ntpStrip->planeview==2){
02370               clu_tpos0[numclustp0] = clu_tpos[count];
02371               clu_z0[numclustp0] = clu_z[count];
02372               numclustp0+=1;
02373             }
02374             else {
02375               clu_tpos1[numclustp1] = clu_tpos[count];
02376               clu_z1[numclustp1] = clu_z[count];
02377               numclustp1+=1;
02378             }
02379             count++;
02380           }
02381               
02382           if(numclustp0>0){
02383             TGraph *temp = new TGraph(numclustp0,clu_z0,clu_tpos0);
02384             if(col0==10) col0+=1;
02385             temp->SetMarkerColor(col0);
02386             temp->SetMarkerSize(0.6);
02387             temp->SetMarkerStyle(21);
02388             if(ntpCluster->id==2 || 
02389                ntpCluster->id==4) temp->SetMarkerStyle(25);
02390             tz_clu0->Add(temp);
02391             col0+=1;
02392             char ssnom[256];
02393             if(ntpCluster->id==0||ntpCluster->id==1){
02394               sprintf(ssnom,"%s (%.2f)",
02395                       ClusterType::AsString(ClusterType::
02396                                             EClusterType(ntpCluster->id)),
02397                       ntpCluster->probem);
02398             }
02399             else {
02400               sprintf(ssnom,"%s",
02401                       ClusterType::AsString(ClusterType::
02402                                             EClusterType(ntpCluster->id)));
02403             }
02404             cluLeg0->AddEntry(temp,ssnom,"p");
02405           }
02406         
02407           if(numclustp1>0){
02408             if(col1==10) col1+=1;
02409             TGraph *temp = new TGraph(numclustp1,clu_z1,clu_tpos1);
02410             temp->SetMarkerColor(col1);
02411             temp->SetMarkerSize(0.6);
02412             temp->SetMarkerStyle(21);
02413             if(ntpCluster->id==2 || 
02414                ntpCluster->id==4) temp->SetMarkerStyle(25);
02415             tz_clu1->Add(temp);
02416             col1+=1;
02417             char ssnom[256];
02418             if(ntpCluster->id==0||ntpCluster->id==1){
02419               sprintf(ssnom,"%s (%.2f)",
02420                       ClusterType::AsString(ClusterType::
02421                                             EClusterType(ntpCluster->id)),
02422                       ntpCluster->probem);
02423             }
02424             else {
02425               sprintf(ssnom,"%s",
02426                       ClusterType::AsString(ClusterType::
02427                                             EClusterType(ntpCluster->id)));
02428             }
02429             cluLeg1->AddEntry(temp,ssnom,"p");
02430           }
02431         }
02432         
02433         delete [] clu_tpos;
02434         delete [] clu_z;
02435         delete [] clu_tpos0;
02436         delete [] clu_z0;
02437         delete [] clu_tpos1;
02438         delete [] clu_z1;
02439         
02440       }
02441       if(nUclus==0) {
02442         delete tz_clu0;
02443         tz_clu0=NULL;
02444       }
02445       if(nVclus==0) {
02446         delete tz_clu1;
02447         tz_clu1=NULL;
02448       }
02449     }
02450       
02452     if(isEM){ //make sure there is an EM chain
02453     
02454       //make sure there is a shower
02455       if(ntpEMSummary->nshower!=0){ 
02456 
02457         if(!tz_emshw0){
02458           tz_emshw0 = new TMultiGraph();
02459           tz_emshw0->SetName("tz_emshw0");
02460         }
02461         if(!tz_emshw1){
02462           tz_emshw1 = new TMultiGraph();
02463           tz_emshw1->SetName("tz_emshw1");
02464         }
02465         int numemshwstp=0;
02466         int numemshwstp0=0;
02467         int numemshwstp1=0;
02468         
02469         for(int i=0;i<ntpEMSummary->nshower;i++){
02470           LoadEMShower(i);
02471           numemshwstp += ntpEMShower->nstrip;
02472         }
02473         
02474         float *emshw_tpos = new float[numemshwstp];
02475         float *emshw_z = new float[numemshwstp];
02476         float *emshw_tpos0 = new float[numemshwstp];
02477         float *emshw_z0 = new float[numemshwstp];
02478         float *emshw_tpos1 = new float[numemshwstp];
02479         float *emshw_z1 = new float[numemshwstp];
02480         int count = 0;
02481         
02482         for(int i=0;i<ntpEMSummary->nshower;i++){
02483           LoadEMShower(i);
02484           Int_t *emshwstrips = ntpEMShower->stp;
02485           count=0;
02486           numemshwstp0=0;
02487           numemshwstp1=0;
02488           for(int j=0;j<ntpEMShower->nstrip;j++){
02489             Int_t index = emshwstrips[j];
02490             ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
02491             emshw_tpos[count] = ntpStrip->tpos;
02492             emshw_z[count] = ntpStrip->z;
02493             if(ntpStrip->planeview==2){
02494               emshw_tpos0[numemshwstp0] = emshw_tpos[count];
02495               emshw_z0[numemshwstp0] = emshw_z[count];
02496               numemshwstp0+=1;
02497             }
02498             else {
02499               emshw_tpos1[numemshwstp1] = emshw_tpos[count];
02500               emshw_z1[numemshwstp1] = emshw_z[count];
02501               numemshwstp1+=1;
02502             }
02503             count++;
02504           }
02505 
02506           if(numemshwstp0>0){
02507             TGraph *temp = new TGraph(numemshwstp0,emshw_z0,emshw_tpos0);
02508             temp->SetMarkerColor(6);
02509             temp->SetMarkerSize(0.6);
02510             temp->SetMarkerStyle(28);
02511             tz_emshw0->Add(temp);
02512           }
02513           else {
02514             delete tz_emshw0;
02515             tz_emshw0 = NULL;
02516           }
02517 
02518           if(numemshwstp1>0){
02519             TGraph *temp = new TGraph(numemshwstp1,emshw_z1,emshw_tpos1);
02520             temp->SetMarkerColor(6);
02521             temp->SetMarkerSize(0.6);
02522             temp->SetMarkerStyle(28);
02523             tz_emshw1->Add(temp);
02524           }
02525           else {
02526             delete tz_emshw1;
02527             tz_emshw1 = NULL;
02528           }
02529         }
02530         delete [] emshw_tpos;
02531         delete [] emshw_z;
02532         delete [] emshw_tpos0;
02533         delete [] emshw_z0;
02534         delete [] emshw_tpos1;
02535         delete [] emshw_z1;
02536       }
02537     }
02538   
02540     //Tracks
02541   
02542     if(ntpEvent->ntrack>0){ //begin of track code
02543       if(!tz_trk0){
02544         tz_trk0 = new TMultiGraph();
02545         tz_trk0->SetName("tz_trk0");
02546       }
02547       if(!tz_trk1){
02548         tz_trk1 = new TMultiGraph();
02549         tz_trk1->SetName("tz_trk1");
02550       }
02551       if(!xz_trk){
02552         xz_trk = new TMultiGraph();
02553         xz_trk->SetName("xz_trk");
02554       }
02555       if(!yz_trk){
02556         yz_trk = new TMultiGraph();
02557         yz_trk->SetName("yz_trk");
02558       }
02559       if(!yx_trk){
02560         yx_trk = new TMultiGraph();
02561         yx_trk->SetName("yx_trk");
02562       }
02563       if(!ztime){
02564         ztime = new TMultiGraph();
02565         ztime->SetName("ztime");
02566         ztime->SetTitle("Time vs Z view");
02567       }
02568       if(!ytime){
02569         ytime = new TMultiGraph();
02570         ytime->SetName("ytime");
02571         ytime->SetTitle("Time vs Y view");
02572       }
02573     
02574       int *tracks = ntpEvent->trk;
02575       
02576       int totnumtrkstp = 0;
02577       int numtrkstpcnt = 0;
02578       int numtrkstp0 = 0;
02579       int numtrkstp1 = 0;
02580     
02581       for(int itrk=0;itrk<ntpEvent->ntrack;itrk++) {
02582         int index = tracks[itrk];
02583         LoadTrack(index);
02584         totnumtrkstp += ntpTrack->nstrip;
02585       }
02586     
02587       //just in case there are no strips in the track
02588       if(totnumtrkstp!=0) { 
02589         
02590         float *trk_tpos = new float[totnumtrkstp];
02591         float *trk_tpos0 = new float[totnumtrkstp];
02592         float *trk_tpos1 = new float[totnumtrkstp];
02593         float *trkstpz0 = new float[totnumtrkstp];
02594         float *trkstpz1 = new float[totnumtrkstp];
02595         
02596         float *trkstpx = new float[totnumtrkstp];
02597         float *trkstpy = new float[totnumtrkstp];
02598         float *trkstpz = new float[totnumtrkstp];
02599         
02600         int alpha = 0;
02601         double *trk_time = new double[totnumtrkstp*2];
02602         double *trk_y = new double[totnumtrkstp*2];
02603         double *trk_z = new double[totnumtrkstp*2];
02604       
02605         for(int itrk=0;itrk<ntpEvent->ntrack;itrk++){
02606           
02607           int index1 = tracks[itrk];
02608           LoadTrack(index1);
02609         
02610           int numtrkstp = ntpTrack->nstrip;
02611         
02612           float *trk_stp_x = ntpTrack->stpx;
02613           float *trk_stp_y = ntpTrack->stpy;
02614           float *trk_stp_z = ntpTrack->stpz;
02615         
02616           double *trkstpt0 = ntpTrack->stpt0;
02617           double *trkstpt1 = ntpTrack->stpt1;
02618           
02619           int *trkstrips = ntpTrack->stp;
02620           numtrkstpcnt=0;
02621           numtrkstp0=0;
02622           numtrkstp1=0;
02623           alpha=0;
02624         
02625           for(int i=0;i<numtrkstp;i++){
02626             int index = trkstrips[i];
02627             ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
02628             
02629             trkstpx[numtrkstpcnt] = trk_stp_x[i];
02630             trkstpy[numtrkstpcnt] = trk_stp_y[i];
02631             trkstpz[numtrkstpcnt] = trk_stp_z[i];
02632             trk_tpos[numtrkstpcnt] = ntpStrip->tpos;
02633             numtrkstpcnt++;
02634             
02635             if(ntpStrip->planeview==2){
02636               trk_tpos0[numtrkstp0] = ntpStrip->tpos;
02637               trkstpz0[numtrkstp0] = trk_stp_z[i];
02638               numtrkstp0+=1;
02639             }
02640             else {
02641               trk_tpos1[numtrkstp1] = ntpStrip->tpos;
02642               trkstpz1[numtrkstp1] = trk_stp_z[i];
02643               numtrkstp1+=1;
02644             }
02645           }
02646           
02647           for(int i=0;i<numtrkstp;i++){
02648             if(trkstpt0[i]!=-999999){
02649               trk_time[alpha] = 1e9*(trkstpt0[i]-eventSummary->trigtime);
02650               trk_z[alpha] = trk_stp_z[i];
02651               trk_y[alpha] = trk_stp_y[i];
02652               alpha+=1;
02653             }
02654             if(trkstpt1[i]!=-999999){
02655               trk_time[alpha] = 1e9*(trkstpt1[i]-eventSummary->trigtime);
02656               trk_z[alpha] = trk_stp_z[i];
02657               trk_y[alpha] = trk_stp_y[i];
02658               alpha+=1;
02659             }
02660           }
02661 
02662           TGraph *temp = 0;
02663           if(numtrkstp0>0){
02664             temp = new TGraph(numtrkstp0,trkstpz0,trk_tpos0);
02665             temp->SetMarkerColor(2);
02666             temp->SetMarkerSize(0.6);
02667             temp->SetMarkerStyle(8);
02668             tz_trk0->Add(temp);
02669             temp = new TGraph(1,&ntpTrack->vtx.z,&ntpTrack->vtx.u);
02670             std::cout<< "UZ Track Vertex: " 
02671                      << ntpTrack->vtx.u << ", "
02672                      << ntpTrack->vtx.z << std::endl;
02673             temp->SetMarkerColor(2);
02674             temp->SetMarkerSize(1);
02675             temp->SetMarkerStyle(29);
02676             tz_trk0->Add(temp); 
02677           }
02678           else {
02679             delete tz_trk0;
02680             tz_trk0 = NULL;
02681           }
02682           
02683           if(numtrkstp1>0){
02684             temp = new TGraph(numtrkstp1,trkstpz1,trk_tpos1);
02685             temp->SetMarkerColor(2);
02686             temp->SetMarkerSize(0.6);
02687             temp->SetMarkerStyle(8);
02688             tz_trk1->Add(temp);
02689             temp = new TGraph(1,&ntpTrack->vtx.z,&ntpTrack->vtx.v);
02690             std::cout<< "VZ Track Vertex: " 
02691                      << ntpTrack->vtx.v << ", "
02692                      << ntpTrack->vtx.z << std::endl;
02693             temp->SetMarkerColor(2);
02694             temp->SetMarkerSize(1);
02695             temp->SetMarkerStyle(29);
02696             tz_trk1->Add(temp); 
02697           }
02698           else {
02699             delete tz_trk1;
02700             tz_trk1 = NULL;
02701           }
02702         
02703           if(numtrkstpcnt>0){
02704             temp = new TGraph(numtrkstpcnt,trkstpz,trkstpx);
02705             temp->SetMarkerColor(2);
02706             temp->SetMarkerSize(0.6);
02707             temp->SetMarkerStyle(8);
02708             xz_trk->Add(temp);
02709             
02710             temp = new TGraph(numtrkstpcnt,trkstpz,trkstpy);
02711             temp->SetMarkerColor(2);
02712             temp->SetMarkerSize(0.6);
02713             temp->SetMarkerStyle(8);
02714             yz_trk->Add(temp);
02715             
02716             temp = new TGraph(numtrkstpcnt,trkstpx,trkstpy);
02717             temp->SetMarkerColor(2);
02718             temp->SetMarkerSize(0.6);
02719             temp->SetMarkerStyle(8);
02720             yx_trk->Add(temp);
02721           }
02722 
02723           if(alpha>0){
02724             temp = new TGraph(alpha,trk_z,trk_time);
02725             temp->SetMarkerColor(2);
02726             temp->SetMarkerSize(0.6);
02727             temp->SetMarkerStyle(8);
02728             ztime->Add(temp);   
02729             
02730             temp = new TGraph(alpha,trk_y,trk_time);
02731             temp->SetMarkerColor(2);
02732             temp->SetMarkerSize(0.6);
02733             temp->SetMarkerStyle(8);    
02734             ytime->Add(temp);
02735           }
02736         }
02737       
02738         delete [] trkstpx;
02739         delete [] trkstpy;
02740         delete [] trkstpz;
02741         delete [] trk_tpos;
02742         delete [] trk_tpos0;
02743         delete [] trk_tpos1;
02744         delete [] trkstpz0;
02745         delete [] trkstpz1;
02746         delete [] trk_time;
02747         delete [] trk_y;
02748         delete [] trk_z; 
02749         
02750       }
02751     }
02752   } //end of reco code
02753   
02754   //Veto Shield
02755   if(!yx_veto) {
02756     yx_veto = new TMultiGraph();
02757     yx_veto->SetName("yx_veto");
02758   }
02759   if(!ytime_veto) {
02760     ytime_veto = new TMultiGraph();
02761     ytime_veto->SetName("ytime_veto");
02762   }
02763 
02764   if(shieldstripArray.GetEntries()!=0&&shieldSummary->ishit){
02765     int nvetostp = shieldstripArray.GetEntries();    
02766     double *vetostp_x = new double[nvetostp];
02767     double *vetostp_y = new double[nvetostp];
02768     double *veto_y = new double[nvetostp*2];
02769     double *veto_time = new double[nvetostp*2];
02770     int beta = 0;
02771     
02772     for(int i=0;i<nvetostp;i++) {
02773       ntpShieldStrip = dynamic_cast<NtpSRShieldStrip *>(shieldstripArray[i]);
02774       vetostp_x[i] = ntpShieldStrip->x;
02775       vetostp_y[i] = ntpShieldStrip->y;
02776       
02777       veto_time[beta] = ntpShieldStrip->time[0];
02778       veto_y[beta] = vetostp_y[i];
02779       beta+=1;
02780       
02781       veto_time[beta] = ntpShieldStrip->time[1];
02782       veto_y[beta] = vetostp_y[i];
02783       beta+=1;      
02784     }
02785     
02786     TGraph *temp1 = new TGraph(nvetostp,vetostp_x,vetostp_y);
02787     temp1->SetMarkerColor(7);
02788     temp1->SetMarkerSize(0.6);
02789     temp1->SetMarkerStyle(8);
02790     yx_veto->Add(temp1);
02791 
02792     TGraph *temp2 = new TGraph(beta,veto_y,veto_time);
02793     temp2->SetMarkerColor(7);
02794     temp2->SetMarkerSize(0.6);
02795     temp2->SetMarkerStyle(8);
02796     ytime_veto->Add(temp2);
02797     
02798     delete [] vetostp_x;
02799     delete [] vetostp_y;
02800     delete [] veto_time;
02801     delete [] veto_y;
02802   }
02803   else {
02804     delete yx_veto; yx_veto = NULL;
02805     delete ytime_veto; ytime_veto = NULL;
02806   }
02807 
02809   //Truth Angles
02810   if(false){ 
02811     TArrow *tz_arrow1 = 0;     // arrows to show direction of
02812     TArrow *tz_arrow2 = 0;     // neutrino in tz view
02813     float nu_mu_angle = 0; // angle between nu and mu P3 vectors in rad
02814     float nu_el_angle = 0; // angle between nu and el P3 vectors in rad
02815     float zen_mu_angle = 0; // angle between mu and zenith P3 vectors in rad
02816     
02817     MainCanvas->cd(1);
02818     gPad->Clear();
02819     
02820     if(isMC){
02821       
02822       TVector3 *nuvec = new TVector3(ntpTruth->p4neunoosc[0],
02823                                      ntpTruth->p4neunoosc[1],
02824                                      ntpTruth->p4neunoosc[2]);
02825       TVector3 *muvec = new TVector3(ntpTruth->p4mu1[0],
02826                                      ntpTruth->p4mu1[1],
02827                                      ntpTruth->p4mu1[2]);
02828       TVector3 *elvec = new TVector3(ntpTruth->p4el1[0],
02829                                      ntpTruth->p4el1[1],
02830                                      ntpTruth->p4el1[2]);
02831       TVector3 *zenith = new TVector3(0,-1,0);
02832       
02833       nu_mu_angle = nuvec->Angle(*muvec);
02834       nu_el_angle = nuvec->Angle(*elvec);
02835       zen_mu_angle = muvec->Angle(*zenith);
02836       
02837       nuvec->RotateZ(-TMath::Pi()/4.);
02838       muvec->RotateZ(-TMath::Pi()/4.);
02839       TVector3 unitnu;
02840       if(ntpTruth->p4neu[3]<0.00001) unitnu = muvec->Unit();
02841       else unitnu = nuvec->Unit();
02842       
02843       float mc_vtxu = ntpTruth->vtxx/(sqrt(2.)) 
02844         + ntpTruth->vtxy/(sqrt(2.));
02845       float mc_vtxv = - ntpTruth->vtxx/(sqrt(2.)) 
02846         + ntpTruth->vtxy/(sqrt(2.));
02847       
02848       
02849       tz_arrow1 = new TArrow(ntpTruth->vtxz-unitnu.Z(),
02850                              mc_vtxu-unitnu.X(),
02851                              ntpTruth->vtxz,mc_vtxu,0.02,"|>");
02852       tz_arrow1->SetFillColor(5);
02853       tz_arrow1->SetLineColor(9);
02854       tz_arrow1->SetLineWidth(2);
02855       
02856       tz_arrow2 = new TArrow(ntpTruth->vtxz-unitnu.Z(),
02857                              mc_vtxv-unitnu.Y(),
02858                              ntpTruth->vtxz,mc_vtxv,0.02,"|>");
02859       tz_arrow2->SetFillColor(5);
02860       tz_arrow2->SetLineColor(9);
02861       tz_arrow2->SetLineWidth(2);
02862       
02863       delete nuvec;
02864       delete muvec;
02865       delete elvec;
02866     }
02867     
02868     //StdHep line drawing code from Tingjun:
02869     //stdhep vectors
02870     TLine** paru = 0;
02871     TLine** parv = 0;
02872     int nstdhep = 0;
02873     int *drawline = 0;
02874     if (isMC&&isTH){
02875       TClonesArray* pointHepArray = NULL;
02876       if(isST) pointHepArray = (strecord->stdhep);
02877       else pointHepArray = (mcrecord->stdhep);
02878       TClonesArray& heparray = *pointHepArray;
02879       nstdhep = heparray.GetLast()+1;
02880       double *vtx_u = new double[nstdhep];
02881       double *vtx_v = new double[nstdhep];
02882       double *vtx_z = new double[nstdhep];
02883       double *p_u = new double[nstdhep];
02884       double *p_v = new double[nstdhep];
02885       double *p_z = new double[nstdhep];
02886       double *p_tot = new double[nstdhep];
02887       double *k_u = new double[nstdhep];
02888       double *k_v = new double[nstdhep];
02889       double *epar = new double[nstdhep];
02890       int *idhep = new int[nstdhep];
02891       drawline = new int[nstdhep];
02892       
02893       if(LoadTHEvent(theEvent)) {
02894         NtpMCStdHep* hep0 = 
02895           dynamic_cast<NtpMCStdHep*>(heparray[ntpTHEvent->neustdhep]);
02896         int currentmc = hep0->mc;
02897         
02898         for (int istd = 0; istd < nstdhep; istd++){
02899           NtpMCStdHep* hep =  dynamic_cast<NtpMCStdHep*>(heparray[istd]);
02900           drawline[istd] = 0;
02901           vtx_u[istd] = (hep->vtx[0]+hep->vtx[1])*sqrt(2.)/2;
02902           vtx_v[istd] = (hep->vtx[1]-hep->vtx[0])*sqrt(2.)/2;
02903           vtx_z[istd] = hep->vtx[2];
02904           
02905           p_u[istd] = (hep->p4[0]+hep->p4[1])*sqrt(2.)/2;
02906           p_v[istd] = (hep->p4[1]-hep->p4[0])*sqrt(2.)/2;
02907           p_z[istd] = hep->p4[2];
02908           p_tot[istd] = sqrt(p_u[istd]*p_u[istd] + p_v[istd]*p_v[istd] + 
02909                              p_z[istd]*p_z[istd]);
02910           
02911           epar[istd] = hep->p4[3];
02912           idhep[istd] = abs(hep->IdHEP);
02913           if (fabs(p_z[istd])>0.) {
02914             k_u[istd] = p_u[istd]/p_z[istd];
02915             k_v[istd] = p_v[istd]/p_z[istd];
02916           }
02917           
02918           bool drawphoton = false;
02919           if (abs(hep->IdHEP)==22){//photon
02920             NtpMCStdHep*hep_parent = 
02921               dynamic_cast<NtpMCStdHep*>(heparray[hep->parent[0]]);
02922             if (abs(hep_parent->IdHEP)!=111) drawphoton = true;
02923           }
02924           //decide what to draw
02925           /*
02926             if((hep->mc==currentmc && hep->child[0]==-1 && hep->child[1]==-1 &&
02927             abs(hep->IdHEP)<10000 && 
02928             (abs(hep->IdHEP)==22 && drawphoton || abs(hep->IdHEP)!=22)) || 
02929             (hep->mc==currentmc && abs(hep->IdHEP)==111)) drawline[istd]=1;
02930             if(p_tot[istd]<=0) drawline[istd]=0;
02931           */
02932           if(hep->mc==currentmc){
02933             hep->Print();
02934             // draw all final state particles except photons from pi0 decay
02935             if(hep->IstHEP==1 && hep->IdHEP<10000){
02936               // do not draw geantinos (probably made by intranuke)
02937               if(hep->IdHEP!=28) drawline[istd]=1;
02938               //            if(hep->IdHEP!=22) drawline[istd]=1;
02939               //            else if(drawphoton) drawline[istd]=1;
02940             }
02941           }
02942         }
02943         paru = new TLine*[nstdhep];
02944         parv = new TLine*[nstdhep];
02945         for (int istd = 0; istd < nstdhep; istd++){
02946           if(p_tot[istd]==0)p_tot[istd]=0.001;
02947           if (drawline[istd] == 1){
02948             paru[istd] = new TLine(vtx_z[istd],vtx_u[istd],
02949                                    vtx_z[istd] + 
02950                                    (p_z[istd]/p_tot[istd])*epar[istd]/3,
02951                                    vtx_u[istd] + 
02952                                    p_u[istd]/p_tot[istd]*epar[istd]/3);
02953             parv[istd] = new TLine(vtx_z[istd],vtx_v[istd],
02954                                    vtx_z[istd] + 
02955                                    (p_z[istd]/p_tot[istd])*epar[istd]/3,
02956                                    vtx_v[istd] + 
02957                                    p_v[istd]/p_tot[istd]*epar[istd]/3);
02958             if(idhep[istd] == 11) {     //electron
02959               paru[istd]->SetLineColor(3);
02960               parv[istd]->SetLineColor(3);
02961             }
02962             else if(idhep[istd] == 13) {//muon
02963               paru[istd]->SetLineColor(4);
02964               parv[istd]->SetLineColor(4);
02965             }
02966             else if(idhep[istd] == 15) {//tau
02967               paru[istd]->SetLineColor(5);
02968               parv[istd]->SetLineColor(5);
02969             }
02970             else if(idhep[istd] == 211){//pion
02971               paru[istd]->SetLineColor(6);
02972               parv[istd]->SetLineColor(6);
02973             }
02974             else if(idhep[istd] == 2212){//proton
02975               paru[istd]->SetLineColor(2);
02976               parv[istd]->SetLineColor(2);
02977             }
02978             else if(idhep[istd] == 111) { //pi0
02979               paru[istd]->SetLineColor(7);
02980               parv[istd]->SetLineColor(7);
02981             }
02982             else if(idhep[istd] == 22){  //photon
02983               paru[istd]->SetLineColor(9);
02984               parv[istd]->SetLineColor(9);
02985             }
02986             else if(idhep[istd] == 2112){//neutron
02987               paru[istd]->SetLineColor(28);
02988               parv[istd]->SetLineColor(28);
02989             }
02990             else if(idhep[istd] == 321 || idhep[istd] == 311 || 
02991                     idhep[istd] == 310 || idhep[istd] == 130){//kaon
02992               paru[istd]->SetLineColor(31);
02993               parv[istd]->SetLineColor(31);
02994             }//anything else will be black
02995             else if(idhep[istd] == 12 || idhep[istd] == 14 ||
02996                     idhep[istd] == 16){  //outgoing neutrino
02997               paru[istd]->SetLineStyle(2); //black, dashed line
02998               parv[istd]->SetLineStyle(2);
02999             }
03000           }
03001         }
03002       }
03003       
03004       delete[] vtx_u;
03005       delete[] vtx_v;
03006       delete[] vtx_z;
03007       delete[] p_u;
03008       delete[] p_v;
03009       delete[] p_z;
03010       delete[] p_tot;
03011       delete[] k_u;
03012       delete[] k_v;
03013       delete[] epar;
03014       delete[] idhep;
03015     }
03016   }
03018   //Text Box
03019   this->DrawTextBox(MainCanvas,isReco);
03020 
03022   //Start Drawing
03023 
03024   RecoCanvas->cd(1);
03025   gPad->Clear();
03026   xz_place->Draw();
03027   if(xz_trk) xz_trk->Draw("P");
03028   if(xz_shw) xz_shw->Draw("P");
03029 
03030   RecoCanvas->cd(4);
03031   gPad->Clear();
03032   yz_place->Draw();
03033   if(yz_trk) yz_trk->Draw("P");
03034   if(yz_shw) yz_shw->Draw("P");
03035 
03036   RecoCanvas->cd(2);
03037   gPad->Clear();
03038 
03039   if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
03040     yx_place->GetXaxis()->SetRangeUser(-2.6,3.8);
03041     yx_place->GetYaxis()->SetRangeUser(-3.2,3.2);
03042     
03043   }
03044   else {
03045     yx_place->GetXaxis()->UnZoom();
03046     yx_place->GetYaxis()->UnZoom();
03047   }
03048   yx_place->Draw();  
03049 
03050   if(yx_trk) yx_trk->Draw("P");
03051   if(yx_shw) yx_shw->Draw("P");
03052   if(yx_veto) yx_veto->Draw("P");
03053   // mike: draw plane outlines here
03054   line->Draw();
03055   if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
03056     fu1_outline->Draw();
03057     fu2_outline->Draw();
03058     fv1_outline->Draw();
03059     fv2_outline->Draw();
03060     pu1_outline->Draw();
03061     //  pu2_outline->Draw();
03062     pv1_outline->Draw();
03063     //  pv2_outline->Draw();
03064   }
03065   if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){ 
03066     nd_xy_fid->Draw();
03067   }
03068   if (ntpHeader->GetVldContext().GetDetector()==Detector::kFar){
03069     fd_xy_fid1->Draw();
03070     fd_xy_fid2->Draw();
03071   }
03072 
03073   if(ntpHeader->GetVldContext().GetDetector()==Detector::kFar) 
03074     // ellie->Draw();
03075 
03076   RecoCanvas->cd(3);
03077   TVirtualPad *RecoCanvas_3 = RecoCanvas->GetPad(3);
03078   RecoCanvas_3->Clear();
03079 
03080   tz_place_0->SetAxisRange(lowest_z,highest_z,"X");
03081   tz_place_0->SetAxisRange(lowest_t0,highest_t0,"Y");
03082 
03083   if(fAltDisplay){
03084     tz_place_0->Draw(tz_place_dopt.c_str());    
03085     if(tz_stp_0) tz_stp_0->Draw("P");
03086     if(tz_stp_mid_0) tz_stp_mid_0->Draw("P");
03087      if(tz_stp_spe_0) tz_stp_spe_0->Draw("P");  //AS Do not plot PE<2.0 hits
03088     
03089     if(tz_trk0) tz_trk0->Draw("P");
03090     if(tz_shw0) tz_shw0->Draw("P");
03091     if(tz_emshw0) tz_emshw0->Draw("P");
03092   }
03093   else{
03094     tz_missplace_0->SetAxisRange(lowest_missz,highest_missz,"X");
03095     tz_missplace_0->SetAxisRange(lowest_misst0,highest_misst0,"Y");  
03096     tz_missplace_0->Draw(tz_place_dopt.c_str());
03097     if(tz_missstp_0) tz_missstp_0->Draw("P");
03098   }
03099   RecoCanvas_3->Update();
03100   RecoCanvas_3->Modified();
03101 
03102  
03103  RecoCanvas->cd(5);
03104   TVirtualPad *RecoCanvas_5 = RecoCanvas->GetPad(5);
03105   RecoCanvas_5->cd(1);
03106   gPad->Clear();
03107    
03108  if(ytime){
03109     ytime->Draw("AP");
03110     ytime->GetXaxis()->SetTitle("y position (m)");
03111     ytime->GetYaxis()->SetTitle("time (ns)");
03112     if(ytime_veto) ytime_veto->Draw("P");
03113   }
03114   
03115 
03116   gPad->Update();
03117   gPad->Modified();
03118 
03119   RecoCanvas_5->cd(2);
03120   gPad->Clear();
03121   
03122   if(ztime) {
03123     ztime->Draw("AP");
03124     ztime->GetXaxis()->SetTitle("z position (m)");
03125     ztime->GetYaxis()->SetTitle("time (ns)");
03126   }
03127   
03128   gPad->Update();
03129   gPad->Modified();
03130 
03131   RecoCanvas->cd(6);
03132   gPad->Clear(); 
03133   
03134   
03135   tz_place_1->SetAxisRange(lowest_z,highest_z,"X");
03136   tz_place_1->SetAxisRange(lowest_t1,highest_t1,"Y");
03137  
03138   if(fAltDisplay){
03139     tz_place_1->Draw(tz_place_dopt.c_str());   
03140     if(tz_stp_1) tz_stp_1->Draw("P");
03141     if(tz_stp_mid_1) tz_stp_mid_1->Draw("P");
03142     if(tz_stp_spe_1) tz_stp_spe_1->Draw("P");  //AS Do not plot PE<2.0 hits
03143     
03144     if(tz_trk1) tz_trk1->Draw("P");
03145     if(tz_shw1) tz_shw1->Draw("P");
03146     if(tz_emshw1) tz_emshw1->Draw("P");
03147   }
03148   else{
03149     tz_missplace_1->SetAxisRange(lowest_missz,highest_missz,"X");
03150     tz_missplace_1->SetAxisRange(lowest_misst0,highest_misst0,"Y");  
03151     tz_missplace_1->Draw(tz_place_dopt.c_str());
03152     if(tz_missstp_1) tz_missstp_1->Draw("P");
03153   }
03154   gPad->Update();
03155   gPad->Modified();
03156 
03158 
03159   MainCanvas->cd(3);
03160   gPad->Clear();
03161   if(fAltDisplay){
03162     tz_missplace_0->SetAxisRange(lowest_missz,highest_missz,"X");
03163     tz_missplace_0->SetAxisRange(lowest_misst0,highest_misst0,"Y");  
03164     tz_missplace_0->Draw(tz_place_dopt.c_str());
03165     if(tz_missstp_0) tz_missstp_0->Draw("P");
03166 
03167   }
03168   else{
03169     tz_place_0->Draw(tz_place_dopt.c_str());      
03170     if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){ 
03171       nd_uz_fid->Draw();
03172     }
03173     if (ntpHeader->GetVldContext().GetDetector()==Detector::kFar){
03174       fd_uz_fid1->Draw();
03175       fd_uz_fid2->Draw();
03176 
03177     }
03178     if(nstp_big_0>0) tz_stp_0->Draw("P");
03179     if(nstp_mid_0>0) tz_stp_mid_0->Draw("P");
03180     if(nstp_spe_0>0) tz_stp_spe_0->Draw("P"); //AS: Do not show pe<2.0 hits
03181     
03182     if(tz_trk0) tz_trk0->Draw("P");
03183     if(tz_shw0) tz_shw0->Draw("P");
03184     if(tz_emshw0) tz_emshw0->Draw("P");    
03185   }
03186   /*
03187   if(isMC) {
03188     tz_arrow1->Draw();
03189     if(isTH){
03190       for (int istd = 0; istd < nstdhep; istd++){
03191         if (drawline[istd] == 1 && paru[istd]!=0 ) paru[istd]->Draw("same");
03192       }
03193     }
03194   }
03195   */
03196   gPad->Modified();
03197   gPad->Update();
03198 
03199   MainCanvas->cd(4);
03200   gPad->Clear();
03201   if(fAltDisplay){
03202     tz_missplace_1->SetAxisRange(lowest_missz,highest_missz,"X");
03203     tz_missplace_1->SetAxisRange(lowest_misst0,highest_misst0,"Y");  
03204     tz_missplace_1->Draw(tz_place_dopt.c_str());
03205     if(tz_missstp_1) tz_missstp_1->Draw("P");
03206   }
03207   else{
03208     tz_place_1->Draw(tz_place_dopt.c_str());
03209     if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){ 
03210       nd_vz_fid->Draw();
03211     }
03212     if (ntpHeader->GetVldContext().GetDetector()==Detector::kFar){
03213       fd_vz_fid1->Draw();
03214       fd_vz_fid2->Draw();
03215 
03216     }
03217     
03218     if(nstp_big_1>0) tz_stp_1->Draw("P");
03219     if(nstp_mid_1>0) tz_stp_mid_1->Draw("P");
03220     if(nstp_spe_1>0) tz_stp_spe_1->Draw("P"); //AS Do not plot PE<2.0 hits
03221     
03222     if(tz_trk1) tz_trk1->Draw("P");
03223     if(tz_shw1) tz_shw1->Draw("P");
03224     if(tz_emshw1) tz_emshw1->Draw("P");
03225   }
03226   /*
03227   if(isMC) {
03228     tz_arrow2->Draw();
03229     if(isTH){
03230       for (int istd = 0; istd < nstdhep; istd++){
03231         if (drawline[istd] == 1 && parv[istd] ) parv[istd]->Draw("same");
03232       }
03233     }
03234   }
03235   */
03237 
03238   if(LeLego) {
03239     tz_0_lego->SetAxisRange(lowest_plane,highest_plane,"X");
03240     tz_1_lego->SetAxisRange(lowest_plane,highest_plane,"X");
03241     tz_0_lego->SetAxisRange(lowest_t0,highest_t0,"Y");
03242     tz_1_lego->SetAxisRange(lowest_t1,highest_t1,"Y");
03243 
03244     LegoCanvas->cd(1);
03245     tz_0_lego->Draw("LEGO2");
03246     gPad->Update();
03247     gPad->Modified();
03248 
03249     LegoCanvas->cd(2);
03250     tz_1_lego->Draw("LEGO2");
03251     gPad->Update();
03252     gPad->Modified();
03253   }
03254 
03256 
03257   if(LeClus){
03258     ClusterCanvas->cd(1);
03259     gPad->Clear();
03260     if(tz_clu0) {
03261       if(tz_clu0->Sizeof()>0){
03262         tz_place_0->Draw(tz_place_dopt.c_str());
03263         tz_clu0->Draw("P");
03264         if(cluLeg0) cluLeg0->Draw();
03265         if(isMC) {
03266           //tz_arrow1->Draw();
03267           if(isTH){
03268             //    for (int istd = 0; istd < nstdhep; istd++){
03269             //   if (drawline[istd] == 1 && paru[istd]) paru[istd]->Draw("same");
03270             //      }
03271           }
03272         }
03273       }
03274     }
03275     gPad->Update();
03276     gPad->Modified();    
03277     
03278 
03279     ClusterCanvas->cd(2);
03280     gPad->Clear();
03281     if(tz_clu1) {
03282       if(tz_clu1->Sizeof()>0){
03283         tz_place_1->Draw(tz_place_dopt.c_str());
03284         tz_clu1->Draw("P");
03285         if(cluLeg1) cluLeg1->Draw();
03286         if(isMC) {
03287           //tz_arrow2->Draw();
03288           if(isTH){
03289             //      for (int istd = 0; istd < nstdhep; istd++){
03290             //  if (drawline[istd] == 1 && parv[istd]) parv[istd]->Draw("same");
03291             //      }
03292           }
03293         }
03294       }
03295     }
03296     gPad->Update();
03297     gPad->Modified();
03298   }
03299 
03300   //delete stdhep 
03301 //  if (isMC&&isTH) delete[] drawline;
03302 
03304   //Print To Terminal
03305 
03306   if(ptt_msg) {
03307 
03308     //    float Sum_mcA = 0;
03309     //  float Sum_mcB = 0;
03310     //for(int i=0;i<500;i++){
03311     //  for(int j=0;j<192;j++){
03312     //    if(ATH_mcA[i][j]>0||ATH_mcB[i][j]>0) {
03313     //  Sum_mcA+=ATH_mcA[i][j];
03314     //  Sum_mcB+=ATH_mcB[i][j];      
03315     //   }
03316     // }
03317     //}
03318     
03319     std::cout << "Run: " << ntpHeader->GetRun() 
03320               << " Snarl: " << ntpHeader->GetSnarl() 
03321               << " (entry: " << entry << ")" << std::endl;
03322     std::cout << "-----------------------------------" << std::endl;
03323     //  std::cout << "Truth:" << std::endl;
03324         //    std::cout << "\tSummed PEs=" << Sum_mcA+Sum_mcB << "\tSummed PEs/0.6=" 
03325         //      << (Sum_mcA+Sum_mcB)/0.6 << std::endl;
03326     std::cout << "-----------------------------------" << std::endl;
03327     std::cout << "Reco:" << std::endl;
03328     std::cout << "\tNumber of slices\t"<< eventSummary->nslice << std::endl;
03329     std::cout << "\tSummed Raw Charge in Snarl (Current Slice) " 
03330               << eventSummary->ph.raw << " (" 
03331               << ntpSlice->ph.raw << ")" << std::endl; 
03332     std::cout << "\tSummed PEs in Snarl (Current Slice) " 
03333               << eventSummary->ph.pe << " (" 
03334               << ntpSlice->ph.pe << ")" << std::endl; 
03335     std::cout << "\tNumber of Reco Digits in Slice = " << ntpSlice->ndigit
03336               << " Strips = " 
03337               << (nstp_spe_0+nstp_spe_1+nstp_mid_0+nstp_mid_1+nstp_big_0
03338                   +nstp_big_1) << std::endl;
03339     std::cout << "===================================" << std::endl;
03340   }
03341 
03342   MainCanvas->cd(2); //change to pad with controls
03343 
03344  // JM add  update scan page
03345   SFrame->SetRun(ntpHeader->GetRun());
03346   SFrame->SetSnarl(ntpHeader->GetSnarl());
03347   SFrame->SetSlice(theSlice);
03348   SFrame->SetEvent(theEvent);
03349   
03350   int shower_index ; int track_index;
03351   if(ntpEvent){
03352     if(ntpEvent->ntrack>0){
03353       LoadLargestTrackFromEvent(theEvent,track_index);
03354       if(ntpTrack->momentum.qp!=0) SFrame->PassFloat("Curv",1./ntpTrack->momentum.qp);
03355       SFrame->PassFloat("Range",ntpTrack->momentum.range);
03356       SFrame->PassInt("TrackContained",ntpTrack->contained);
03357     }
03358     else{
03359       SFrame->PassFloat("Range",0);
03360       SFrame->PassFloat("Curv",0);
03361       SFrame->PassInt("TrackContained",0);
03362     }
03363     if(ntpEvent->nshower>0){
03364       const Detector::Detector_t det = ntpHeader->GetVldContext().GetDetector();
03365       bool OK =LoadShower_Jim(theEvent,shower_index,det);
03366       float cor_shw_energy = 0;
03367       if(OK) cor_shw_energy = CorrectShowerEnergy(ntpShower->shwph.linCCgev,
03368                                                   det,CandShowerHandle::kCC);
03369       
03370       SFrame->PassFloat("ShwE",cor_shw_energy);
03371     }
03372     else{
03373       SFrame->PassFloat("ShwE",0);
03374     }
03375     
03376     SFrame->ResetDisplay("noPH");
03377     //  ROICalc();
03378     MadAbID pid;
03379     bool pass = pid.GetPass(ntpEvent,strecord);
03380     SFrame->PassInt("Passed",pass);
03381   }
03382  //
03383 
03384   // RBP -- for zooming capabilites, we will want the TGraphs and TMultiGraphs
03385   // to be non-editable.  (No need to edit them anyway, I'd think.)
03386   MakeGraphListNonEditable(MainCanvas->GetPad(3)->GetListOfPrimitives());
03387   MakeGraphListNonEditable(MainCanvas->GetPad(4)->GetListOfPrimitives());
03388 
03389   return true;
03390 }

void MadScanDisplay::DrawButtons ( TCanvas *  MainCanvas  ) 

Definition at line 4389 of file MadScanDisplay.cxx.

References DrawKey2(), drawSAME, handScan, LeAction, LeAutoMat, LeClus, LeLego, LeNu, StartLogger(), and UseNuInfo.

Referenced by Display().

04389                                                     {
04390 
04391   MainCanvas->cd(2);
04392   TVirtualPad *MainCanvas_2 = MainCanvas->GetPad(2);
04393   MainCanvas_2->Range(0,0,1,1);
04394   
04395   if(!gROOT->IsBatch()){ //if we are not in batch mode, draw controls.
04396     //otherwise let the Key fill up MainCanvas_2
04397     
04398     //Next/Prev event with cuts
04399     TButton *but1 = new TButton("Next Fid Trk","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} ; EVD->fAltDisplay=false; EVD->LeEntry = EVD->NextFidTrk();",0.6,0.9,1,1);
04400     but1->SetTextSize(0.5);
04401     but1->SetFillColor(4);
04402     TButton *but2 = new TButton("Nxt Fid No Trk","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();}; EVD->fAltDisplay=false; EVD->LeEntry = EVD->NextFidNoTrk();",0.2,0.9,0.6,1);
04403     but2->SetTextSize(0.5);
04404     but2->SetFillColor(5);
04405     
04406     //Next/Prev event of any kind
04407     TButton *but14 = new TButton("Step Forward","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeSlice=0; EVD->LeEvent=0; EVD->LeMCevent=0;  EVD->LeEntry += 1; EVD->FindUnSliced(); EVD->fAltDisplay=true; EVD->Display(EVD->LeEntry,0,0,0,EVD->LeAutoMat);",0.6,0.8,1,0.9);
04408     but14->SetTextSize(0.5);
04409     but14->SetFillColor(4);
04410     TButton *but15 = new TButton("Step Back","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeSlice=0; EVD->LeEvent=0; EVD->LeMCevent=0; EVD->LeEntry -= 1; EVD->FindUnSliced(); EVD->fAltDisplay=true; EVD->Display(EVD->LeEntry,0,0,0,EVD->LeAutoMat);",0.2,0.8,0.6,0.9);
04411     but15->SetTextSize(0.5);
04412     but15->SetFillColor(5);
04413     
04414     TButton *but10 = new TButton("Next Slc","if(EVD->drawSAME) {EVD->drawSAME=false; } EVD->LeEntry = EVD->NextPass();",0.4,0.7,0.6,0.8);
04415     but10->SetName("but10");
04416     but10->SetTextSize(0.5);
04417     but10->SetFillColor(4);
04418     
04419     TButton *but12 = new TButton("Prev Slc","if(EVD->drawSAME) {EVD->drawSAME=false; } EVD->LeEntry = EVD->PrevPass();",0.2,0.7,0.4,0.8);
04420     but12->SetName("but12");
04421     but12->SetTextSize(0.5);
04422     but12->SetFillColor(5);
04423 
04424     //    TButton *but11 = new TButton("Next Evt","if (EVD->drawSAME) {EVD->drawSAME=false; } EVD->LeEntry = EVD->NextEvt();",0.8,0.7,1,0.8);
04425     TButton *but11 = new TButton("Next Evt","if (EVD->drawSAME) {EVD->drawSAME=false; } EVD->LeEvent+=1; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.8,0.7,1,0.8);
04426     but11->SetName("but11");
04427     but11->SetTextSize(0.5);
04428     but11->SetFillColor(4);
04429     
04430     //    TButton *but13 = new TButton("Prev Evt","if (EVD->drawSAME) {EVD->drawSAME=false; } EVD->LeEntry = EVD->PrevEvt();",0.6,0.7,0.8,0.8);
04431     TButton *but13 = new TButton("Prev Evt","EVD->LeEvent-=1; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.6,0.7,0.8,0.8);
04432     but13->SetName("but13");
04433     but13->SetTextSize(0.5);
04434     but13->SetFillColor(5);
04435     
04436     //Skip to, +/- MC
04437     TButton *but16 = new TButton("Prev MC","EVD->LeMCevent-=1; fAltDisplay-false; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.2,0.6,0.4,0.7);
04438     but16->SetName("but16");
04439     but16->SetTextSize(0.5);
04440     but16->SetFillColor(5);
04441     TButton *but17 = new TButton("Next MC","EVD->LeMCevent+=1; fAltDisplay=false; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.4,0.6,0.6,0.7);
04442     but17->SetName("but17");
04443     but17->SetTextSize(0.5);
04444     but17->SetFillColor(4);
04445     
04446     TButton *but3a = new TButton("Skip to...","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeSlice=0; EVD->LeEvent=0; fAltDisplay=false; EVD->LeMCevent=0; EVD->LeEntry = EVD->SkipTo();",0.6,0.65,0.8,0.7);
04447     but3a->SetTextSize(0.5);
04448     but3a->SetFillColor(9);
04449     
04450     TButton *but3e = new TButton("Run,Snarl...","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeSlice=0; EVD->LeEvent=0; fAltDisplay=false; EVD->LeMCevent=0; EVD->LeEntry = EVD->JumpTo();",0.6,0.6,0.8,0.65);
04451     but3e->SetTextSize(0.5);
04452     but3e->SetFillColor(9);
04453     
04454     TButton *but3c = new TButton("AutoMatch","if(EVD->LeAutoMat) { but3c->SetFillColor(2); but10->SetFillColor(4); but12->SetFillColor(5); but16->SetFillColor(5); but17->SetFillColor(4); EVD->LeAutoMat=false; } else { but3c->SetFillColor(3); but10->SetFillColor(15); but12->SetFillColor(15); but16->SetFillColor(15); but17->SetFillColor(15); EVD->LeAutoMat = true; }; but10->Modified(); but12->Modified(); but16->Modified(); but17->Modified();",0.8,0.6,1,0.7);
04455     but3c->SetName("but3c");
04456     but3c->SetTextSize(0.5);
04457     but3c->SetFillColor(3);
04458     
04459     if(LeAutoMat) {
04460       but10->SetFillColor(15);
04461       but12->SetFillColor(15);
04462       but16->SetFillColor(15);
04463       but17->SetFillColor(15);
04464     }
04465     //Refresh/Lego/Quit/Print
04466     
04467     TButton *but4 = new TButton("Refresh","EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.2,0.55,0.4,0.6);
04468     but4->SetTextSize(0.5);
04469     but4->SetFillColor(6);
04470 
04471     TButton *but4b = new TButton("Overlay","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2);} else {EVD->drawSAME=true; but4b->SetFillColor(3);}",0.2,0.5,0.4,0.55);
04472     but4b->SetName("but4b");
04473     but4b->SetTextSize(0.5);
04474     if(drawSAME) but4b->SetFillColor(3);
04475     else but4b->SetFillColor(2);
04476     
04477     TButton *but3b = new TButton("Lego?","if(EVD->LeLego) {EVD->LeLego=false; but3b->SetFillColor(2);} else {EVD->LeLego=true; but3b->SetFillColor(3);}",0.4,0.55,0.6,0.6);
04478     but3b->SetName("but3b");
04479     but3b->SetTextSize(0.5);
04480     if(LeLego) but3b->SetFillColor(3);
04481     else but3b->SetFillColor(2);    
04482     
04483     TButton *but3d = new TButton("Clusters?","if(EVD->LeClus) {EVD->LeClus=false; but3d->SetFillColor(2);} else {EVD->LeClus=true; but3d->SetFillColor(3);}",0.4,0.5,0.6,0.55);
04484     but3d->SetName("but3d");
04485     but3d->SetTextSize(0.5);
04486     if(LeClus) but3d->SetFillColor(3);
04487     else but3d->SetFillColor(2);    
04488     
04489     TButton *but18 = new TButton("Print","EVD->PrintDisplay();",
04490                                  0.6,0.5,0.8,0.6);
04491     but18->SetTextSize(0.5);
04492     but18->SetFillColor(8);
04493     
04494     TButton *but5 = new TButton("Quit",".q",0.8,0.5,1,0.6);
04495     but5->SetTextSize(0.5);
04496     but5->SetFillColor(45);
04497     
04498     but1->Draw();
04499     but2->Draw();
04500     but3a->Draw();
04501     but3b->Draw();
04502     but3c->Draw();
04503     but3d->Draw();
04504     but3e->Draw();
04505     but4->Draw();
04506     but4b->Draw();
04507     but5->Draw();
04508     but10->Draw();
04509     but11->Draw();
04510     but12->Draw();
04511     but13->Draw();
04512     but14->Draw();
04513     but15->Draw();
04514     but16->Draw();
04515     but17->Draw();
04516     but18->Draw();
04517     
04518     if(!handScan) {
04519       
04520       //Buttons to select out numu/nue/NC/CC
04521       TButton *but19 = new TButton(" Missed PH","EVD->ROICalc();",0,0.9,0.195,1);
04522       but19->SetTextSize(0.4);
04523       but19->SetName("but19");
04524       TButton *but6 = new TButton("Extra PH","EVD->ShwROICalc()",0,0.8,0.195,0.9);
04525       but6->SetTextSize(0.4);
04526       but6->SetName("but6");
04527       TButton *but7 = new TButton("NuE","EVD->LeNu=12; but6->SetFillColor(2); but7->SetFillColor(3); but6->Modified(); EVD->UseNuInfo=true; but19->SetFillColor(2); but19->Modified();",0,0.7,0.195,0.8);
04528       but7->SetTextSize(0.4);
04529       but7->SetName("but7");
04530       TButton *but8 = new TButton("NC","EVD->LeAction=0; but8->SetFillColor(3); but9->SetFillColor(2); but9->Modified(); EVD->UseNuInfo=true; but19->SetFillColor(2); but19->Modified();",0,0.6,0.195,0.7);
04531       but8->SetTextSize(0.4);
04532       but8->SetName("but8");
04533       TButton *but9 = new TButton("CC","EVD->LeAction=1; but8->SetFillColor(2); but9->SetFillColor(3); but8->Modified(); EVD->UseNuInfo=true; but19->SetFillColor(2); but19->Modified();",0,0.5,0.195,0.6);
04534       but9->SetTextSize(0.4);
04535       but9->SetName("but9");
04536         
04537       if(UseNuInfo){
04538         if(LeNu==14) {but6->SetFillColor(3); but7->SetFillColor(2);}
04539         else if(LeNu==12) {but7->SetFillColor(3); but6->SetFillColor(2);}
04540           else {but6->SetFillColor(10); but7->SetFillColor(10);}
04541         if(LeAction==0) {but8->SetFillColor(3); but9->SetFillColor(2);}
04542         else if(LeAction==1) {but9->SetFillColor(3); but8->SetFillColor(2);}
04543         else {but9->SetFillColor(10); but8->SetFillColor(10);}
04544         }
04545       else {
04546         but19->SetFillColor(3); but6->SetFillColor(15); 
04547         but7->SetFillColor(15);
04548         but8->SetFillColor(15); but9->SetFillColor(15);
04549       }
04550       
04551       but6->Draw();
04552       but7->Draw();
04553       but8->Draw();
04554       but9->Draw();
04555       but19->Draw();
04556     }
04557     else StartLogger();
04558   }
04559   //else MainCanvas_2->Range(0,0,0.5,0.5);
04560   this->DrawKey2(MainCanvas_2);
04561 }

void MadScanDisplay::DrawInteractionDiagram ( Int_t  itr = 0  ) 

Definition at line 4118 of file MadScanDisplay.cxx.

References NtpMCStdHep::IdHEP, MadBase::isST, NtpMCStdHep::IstHEP, MadBase::LoadStdHep(), MadBase::LoadTruth(), Munits::m, NtpMCStdHep::mc, MadBase::mcrecord, MadBase::ntpStdHep, NtpMCStdHep::p4, NtpMCStdHep::parent, NtpStRecord::stdhep, NtpMCRecord::stdhep, and MadBase::strecord.

04118                                                     {
04119 
04120   if(!LoadTruth(itr)) return;
04121 
04122   //make sure there is a canvas for my art
04123   TCanvas *can;  
04124   if(gROOT->FindObject("StdHepDiagramCanvas")) {
04125     can = (TCanvas*) gROOT->FindObject("StdHepDiagramCanvas");
04126     can->cd();    
04127     TList *theList = can->GetListOfPrimitives();
04128     TIterator *iter = theList->MakeIterator();
04129     TObject *ob;      
04130     while((ob = iter->Next())){
04131       if(ob->InheritsFrom("TLatex")) {
04132         TLatex *tex = (TLatex*) ob;
04133         delete tex;
04134       }
04135       else if(ob->InheritsFrom("TArrow")) {
04136         TArrow *ar = (TArrow*) ob;
04137         delete ar;
04138       }
04139       else if(ob->InheritsFrom("TMarker")) {
04140         TMarker *m = (TMarker*) ob;
04141         delete m;
04142       }
04143     }
04144     can->Range(0,0,1,1.1);
04145   }
04146   else {
04147     can = new TCanvas("StdHepDiagramCanvas","StdHep Diagram Canvas",0,0,900,400);
04148     can->cd();
04149     can->Range(0,0,1,1.1);
04150     TPaveText *infoTex1 = new TPaveText(0.05,1.,0.2,1.07);
04151     infoTex1->AddText("Initial State");
04152     infoTex1->SetBorderSize(1);
04153     TPaveText *infoTex2 = new TPaveText(0.3,1.,0.45,1.07);
04154     infoTex2->AddText("Intermediate");
04155     infoTex2->SetBorderSize(1);
04156     TPaveText *infoTex3 = new TPaveText(0.55,1.,0.7,1.07);
04157     infoTex3->AddText("Final State");
04158     infoTex3->SetBorderSize(1);
04159     TPaveText *infoTex4 = new TPaveText(0.8,1.,0.95,1.07);
04160     infoTex4->AddText("Later Decays");
04161     infoTex4->SetBorderSize(1);
04162     infoTex1->SetTextSize(0.05);
04163     infoTex1->SetTextFont(12);
04164     infoTex1->SetTextColor(1);
04165     infoTex2->SetTextSize(0.05);
04166     infoTex2->SetTextFont(12);
04167     infoTex2->SetTextColor(1);
04168     infoTex3->SetTextSize(0.05);
04169     infoTex3->SetTextFont(12);
04170     infoTex3->SetTextColor(1);
04171     infoTex4->SetTextSize(0.05);
04172     infoTex4->SetTextFont(12);
04173     infoTex4->SetTextColor(1);
04174     infoTex1->SetName("infoTex1");
04175     infoTex2->SetName("infoTex2");
04176     infoTex3->SetName("infoTex3");
04177     infoTex4->SetName("infoTex4");
04178     infoTex1->Draw();
04179     infoTex2->Draw();
04180     infoTex3->Draw();
04181     infoTex4->Draw();
04182   }
04183   
04184   //First get indices to use:
04185   TClonesArray* pointStdhepArray = NULL;
04186   if(isST) pointStdhepArray = (strecord->stdhep);
04187   else pointStdhepArray = (mcrecord->stdhep);
04188   TClonesArray& stdhepArray = *pointStdhepArray;
04189   Int_t nStdHep = stdhepArray.GetEntries();
04190   Int_t *indicesToUse = new Int_t[nStdHep];
04191   Int_t *parent = new Int_t[nStdHep];
04192   Int_t incomingNeutrino = -1;
04193   Int_t cnt = 0;
04194   for(int i=0;i<nStdHep;i++){
04195     LoadStdHep(i);
04196     if(ntpStdHep->mc==itr) {
04197       indicesToUse[cnt] = i;
04198       parent[i] = ntpStdHep->parent[0];
04199       if(ntpStdHep->IstHEP==0){
04200         if(abs(ntpStdHep->IdHEP)==12||abs(ntpStdHep->IdHEP)==14
04201            ||abs(ntpStdHep->IdHEP)==16) {
04202           incomingNeutrino=i;
04203         }
04204         parent[i] = -1; //don't draw arrows to initial state particles
04205       }
04206       cnt++;
04207     }
04208     else parent[i] = -1;
04209   }
04210   
04211   //make arrows and markers
04212   //  TArrow *arrow[1000];
04213   //  TMarker *marker[1000];
04214   // it is possible to have more than 1000 stdhep particles
04215   // yikes...
04216   // I think that these objects are deleted in the block at
04217   // the start of this routine.
04218   std::vector<TArrow*> arrow(nStdHep);
04219   std::vector<TMarker*> marker(nStdHep);
04220 
04221   for(int i=0;i<nStdHep;i++) {
04222     arrow[i] = new TArrow(0,0,0,0,0.03,"|>");
04223     arrow[i]->SetLineWidth(1);
04224     arrow[i]->SetLineStyle(3);
04225     arrow[i]->SetFillColor(39);
04226     arrow[i]->SetLineColor(39);
04227     marker[i] = new TMarker(0,0,24);
04228     marker[i]->SetMarkerSize(1);
04229     marker[i]->SetMarkerColor(38);
04230   }
04231 
04232   //now loop through valid stdhep entries and fill variables  
04233   Float_t Available[4] = {0.9,0.7,0.9,0.7};
04234   
04235   for(int i=0;i<cnt;i++){
04236     
04237     int toUse = indicesToUse[i];
04238     LoadStdHep(toUse);
04239     if(ntpStdHep->IstHEP==999) continue;
04240     Float_t mom = sqrt(ntpStdHep->p4[0]*ntpStdHep->p4[0] + 
04241                        ntpStdHep->p4[1]*ntpStdHep->p4[1] + 
04242                        ntpStdHep->p4[2]*ntpStdHep->p4[2]);
04243     float x=0.,y=0.;
04244     int col=0;
04245     char text[256];
04246 
04247     //set x,y    
04248     if(ntpStdHep->IstHEP==0) {
04249       x = 0.05;
04250       y=Available[0]; Available[0] -= 0.1;
04251     }
04252     else if(ntpStdHep->IstHEP==11) {
04253       x = 0.05;
04254       y=Available[0]; Available[0] -= 0.1; 
04255     }
04256     else if(ntpStdHep->IstHEP==3 || ntpStdHep->IstHEP==14) {
04257       x = 0.3;
04258       y=Available[1]; Available[1] -= 0.1;
04259     }
04260     else if(ntpStdHep->IstHEP==1){
04261       x = 0.55;
04262       y=Available[2]; Available[2] -= 0.1;
04263     }
04264     else if(ntpStdHep->IstHEP==205){
04265       x = 0.8;
04266       y=Available[3]; Available[3] -= 0.1;
04267     }
04268  
04269     //set colour and label (and override y in special cases)
04270     if(abs(ntpStdHep->IdHEP)==12) { //nue
04271       y = 0.9; sprintf(text,"#nu_{e}"); col = 3;
04272       if(ntpStdHep->IdHEP<0) sprintf(text,"#bar{#nu}_{e}");
04273     }
04274     else if(abs(ntpStdHep->IdHEP)==14) { //numu
04275       y = 0.9; sprintf(text,"#nu_{#mu}"); col = 4;
04276       if(ntpStdHep->IdHEP<0) sprintf(text,"#bar{#nu}_{#mu}");
04277     }
04278     else if(abs(ntpStdHep->IdHEP)==16) { //nutau
04279       y = 0.9; sprintf(text,"#nu_{#tau}"); col = 5;
04280       if(ntpStdHep->IdHEP<0) sprintf(text,"#bar{#nu}_{#tau}"); 
04281     }    
04282     else if(abs(ntpStdHep->IdHEP)==11) { //e
04283       if(parent[toUse]==incomingNeutrino) y = 0.9;
04284       sprintf(text,"e^{-}"); col = 3;
04285       if(ntpStdHep->IdHEP<0) sprintf(text,"e^{+}");
04286     }
04287     else if(abs(ntpStdHep->IdHEP)==13) { //mu
04288       if(parent[toUse]==incomingNeutrino) y = 0.9;
04289       sprintf(text,"#mu^{-}"); col = 4;
04290       if(ntpStdHep->IdHEP<0) sprintf(text,"#mu^{+}");
04291     }
04292     else if(abs(ntpStdHep->IdHEP)==15) { //tau
04293       if(parent[toUse]==incomingNeutrino) y = 0.9;      
04294       sprintf(text,"#tau^{-}"); col = 5;
04295       if(ntpStdHep->IdHEP<0) sprintf(text,"#tau^{+}"); 
04296     }
04297     else if(ntpStdHep->IdHEP==22) { //photon
04298       sprintf(text,"#gamma"); col = 9;      
04299     }
04300     else if(ntpStdHep->IdHEP>1000000000) { //nucleus
04301       y = 0.8;
04302       sprintf(text,"nucleus(%i,%i)",int((ntpStdHep->IdHEP-1e9)/1e6),
04303               int((ntpStdHep->IdHEP-1e9 - 1e6*int((ntpStdHep->IdHEP-1e9)
04304                                                   /1e6))/1e3)); 
04305       col = 15;
04306     }
04307     else if(ntpStdHep->IdHEP==2112){ 
04308       sprintf(text,"neutron"); col = 28;
04309     }
04310     else if(ntpStdHep->IdHEP==2212){
04311       sprintf(text,"proton"); col = 2;
04312     }
04313     else if(abs(ntpStdHep->IdHEP)==211) {
04314       sprintf(text,"#pi^{+}"); col = 6;
04315       if(ntpStdHep->IdHEP<0) sprintf(text,"#pi^{-}");
04316     }
04317     else if(ntpStdHep->IdHEP==111) {
04318       sprintf(text,"#pi^{0}"); col = 7;
04319     }
04320     else if(ntpStdHep->IdHEP==130) {
04321       sprintf(text,"K^{0}_{L}"); col = 31;
04322     }
04323     else if(ntpStdHep->IdHEP==310) {
04324       sprintf(text,"K^{0}_{S}"); col = 31;
04325     }
04326     else if(ntpStdHep->IdHEP==311) {
04327       sprintf(text,"K^{0}"); col = 31;
04328     }
04329     else if(abs(ntpStdHep->IdHEP)==321) {
04330       sprintf(text,"K^{+}"); col = 31;
04331       if(ntpStdHep->IdHEP<0) sprintf(text,"K^{-}"); col = 31;
04332     }
04333     else if(ntpStdHep->IdHEP==28) {
04334       sprintf(text,"Geantino"); col = 46;
04335       if(ntpStdHep->IdHEP<0) sprintf(text,"K^{-}"); col = 31;
04336     }
04337     else {
04338       sprintf(text,"ID: %i",ntpStdHep->IdHEP); col=43;
04339     }
04340 
04341     sprintf(text,"%s [%.1f GeV/c]",text,mom);
04342     
04343     arrow[toUse]->SetX2(x-0.02);   
04344     arrow[toUse]->SetY2(y-0.02);   
04345     marker[toUse]->SetX(x-0.02);
04346     marker[toUse]->SetY(y-0.02);
04347 
04348     for(int j=0;j<nStdHep;j++){
04349       if(parent[j]==toUse){
04350         arrow[j]->SetX1(x-0.02);
04351         arrow[j]->SetY1(y-0.02);
04352       }
04353     }
04354  
04355     TLatex *tex = new TLatex(x,y,text);
04356     char texname[256];
04357     sprintf(texname,"tex%i",i);
04358     tex->SetName(texname);
04359     tex->SetTextSize(0.05);
04360     tex->SetTextColor(col);    
04361     tex->Draw();
04362   }
04363 
04364   for(int i=0;i<nStdHep;i++){
04365     if(parent[i]==-1) {
04366       delete arrow[i];
04367       delete marker[i];
04368     }
04369     else {
04370       arrow[i]->Draw();
04371       marker[i]->Draw();
04372     }
04373   }
04374 
04375   Float_t minAvail = 0;
04376   for(int i=0;i<4;i++){
04377     if(Available[i]<minAvail) minAvail = Available[i];
04378   }
04379 
04380   if(minAvail<0) can->Range(0,minAvail,1,1.1);
04381 
04382   delete [] indicesToUse;
04383   delete [] parent;
04384 
04385   can->Modified();
04386   can->Update();
04387 }

void MadScanDisplay::DrawKey ( TVirtualPad *  KeyPad  )  [protected]

Definition at line 3949 of file MadScanDisplay.cxx.

References Dmid_val, and Dspe_val.

03949                                                {
03950 
03951    KeyPad->cd(2);
03952 
03953    TPave *pave = new TPave(0.02,0.02,0.98,0.48);
03954    pave->Draw();
03955 
03956    TMarker *marker = new TMarker(0.2,0.89/2.,8);
03957    marker->SetMarkerColor(3);
03958    marker->SetMarkerStyle(8);
03959    marker->SetMarkerSize(1.3);
03960    marker->Draw();
03961    marker = new TMarker(0.2,0.80/2.,8);
03962    marker->SetMarkerColor(4);
03963    marker->SetMarkerStyle(8);
03964    marker->SetMarkerSize(1.3);
03965    marker->Draw();
03966    marker = new TMarker(0.2,0.71/2.,8);
03967    marker->SetMarkerStyle(8);
03968    marker->SetMarkerSize(1.3);
03969    marker->Draw();
03970    marker = new TMarker(0.2,0.62/2.,8);
03971    marker->SetMarkerColor(2);
03972    marker->SetMarkerStyle(8);
03973    marker->SetMarkerSize(0.9);
03974    marker->Draw();
03975    marker = new TMarker(0.2,0.53/2.,4);
03976    marker->SetMarkerColor(5);
03977    marker->SetMarkerStyle(4);
03978    marker->SetMarkerSize(0.9);
03979    marker->Draw();
03980    marker = new TMarker(0.21,0.53/2.,4);
03981    marker->SetMarkerColor(7);
03982    marker->SetMarkerStyle(4);
03983    marker->SetMarkerSize(0.9);
03984    marker->Draw();
03985    marker = new TMarker(0.2,0.44/2.,25);
03986    marker->SetMarkerColor(7);
03987    marker->SetMarkerStyle(25);
03988    marker->SetMarkerSize(1.3);
03989    marker->Draw();
03990    marker = new TMarker(0.2,0.35/2.,26);
03991    marker->SetMarkerColor(3);
03992    marker->SetMarkerStyle(26);
03993    marker->SetMarkerSize(1.3);
03994    marker->Draw();
03995    marker = new TMarker(0.2,0.26/2.,27);
03996    marker->SetMarkerColor(6);
03997    marker->SetMarkerStyle(27);
03998    marker->SetMarkerSize(1.3);
03999    marker->Draw();
04000    marker = new TMarker(0.2,0.17/2.,30);
04001    marker->SetMarkerStyle(30);
04002    marker->SetMarkerSize(1.3);
04003    marker->Draw();
04004    marker = new TMarker(0.2,0.08/2.,28);
04005    marker->SetMarkerColor(5);
04006    marker->SetMarkerStyle(28);
04007    marker->SetMarkerSize(1.3);
04008    marker->Draw();
04009    TLatex *tex = new TLatex(0.04,0.86/2.,"Reco");
04010    tex->SetTextFont(132);
04011    tex->SetTextSize(0.05);
04012    tex->SetLineWidth(2);
04013    tex->Draw();
04014    tex = new TLatex(0.04,0.41/2.,"Truth");
04015    tex->SetTextFont(132);
04016    tex->SetTextSize(0.05);
04017    tex->SetLineWidth(2);
04018    tex->Draw();
04019    char temp[256];
04020    sprintf(temp,"Summed NPEs < %.1f",Dspe_val);
04021    tex = new TLatex(0.3,0.86/2.,temp);
04022    tex->SetTextFont(132);
04023    tex->SetTextSize(0.05);
04024    tex->SetLineWidth(2);
04025    tex->Draw();
04026    sprintf(temp,"%.1f < Summed NPEs < %.1f",Dspe_val,Dmid_val);
04027    tex = new TLatex(0.3,0.77/2.,temp);
04028    tex->SetTextFont(132);
04029    tex->SetTextSize(0.05);
04030    tex->SetLineWidth(2);
04031    tex->Draw();
04032    sprintf(temp,"Summed NPEs > %.1f",Dmid_val);
04033    tex = new TLatex(0.3,0.68/2.,temp);
04034    tex->SetTextFont(132);
04035    tex->SetTextSize(0.05);
04036    tex->SetLineWidth(2);
04037    tex->Draw();
04038    tex = new TLatex(0.3,0.59/2.,"Reconstructed Track Hit");
04039    tex->SetTextFont(132);
04040    tex->SetTextSize(0.05);
04041    tex->SetLineWidth(2);
04042    tex->Draw();
04043    tex = new TLatex(0.3,0.50/2.,"Reconstructed Primary Shower Hit (cyan=EM)");
04044    tex->SetTextFont(132);
04045    tex->SetTextSize(0.05);
04046    tex->SetLineWidth(2);
04047    tex->Draw();
04048   tex = new TLatex(0.3,0.50/2.,"Reconstructed Sec. Shower Hit (cyan=EM)");
04049    tex->SetTextFont(132);
04050    tex->SetTextSize(0.05);
04051    tex->SetLineWidth(2);
04052    tex->Draw();
04053    tex = new TLatex(0.3,0.41/2.,"Primary Muon (+ secondaries)");
04054    tex->SetTextFont(132);
04055    tex->SetTextSize(0.05);
04056    tex->SetLineWidth(2);
04057    tex->Draw();
04058    tex = new TLatex(0.3,0.32/2.,"Primary Electron (+ secondaries)");
04059    tex->SetTextFont(132);
04060    tex->SetTextSize(0.05);
04061    tex->SetLineWidth(2);
04062    tex->Draw();
04063    tex = new TLatex(0.3,0.23/2.,"Recoil Shower Products");
04064    tex->SetTextFont(132);
04065    tex->SetTextSize(0.05);
04066    tex->SetLineWidth(2);
04067    tex->Draw();
04068    tex = new TLatex(0.3,0.14/2.,"Noise");
04069    tex->SetTextFont(132);
04070    tex->SetTextSize(0.05);
04071    tex->SetLineWidth(2);
04072    tex->Draw();
04073    tex = new TLatex(0.3,0.05/2.,"Other");
04074    tex->SetTextFont(132);
04075    tex->SetTextSize(0.05);
04076    tex->SetLineWidth(2);
04077    tex->Draw();
04078    tex = new TLatex(0.65,0.05/2.,"Nu Unit P");
04079    tex->SetTextFont(132);
04080    tex->SetTextSize(0.05);
04081    tex->SetLineWidth(2);
04082    tex->Draw();
04083    TArrow *arrow = new TArrow(0.5,0.09/2.,0.6,0.09/2.,0.03,"|>");
04084    arrow->SetFillColor(5);
04085    arrow->SetLineColor(9);
04086    arrow->SetLineWidth(2);
04087    arrow->Draw();
04088 }

void MadScanDisplay::DrawKey2 ( TVirtualPad *  KeyPad  )  [protected]

Definition at line 3849 of file MadScanDisplay.cxx.

References Dmid_val, and Dspe_val.

Referenced by DrawButtons().

03849                                                 {
03850 
03851    KeyPad->cd(2);
03852 
03853    TPave *pave = new TPave(0.02,0.02,0.98,0.48);
03854    pave->Draw();
03855    //reco:
03856    TMarker *marker = new TMarker(0.2,0.89/2.,8);
03857    marker->SetMarkerColor(3);
03858    marker->SetMarkerStyle(8);
03859    marker->SetMarkerSize(1.3);
03860    marker->Draw();
03861    marker = new TMarker(0.2,0.80/2.,8);
03862    marker->SetMarkerColor(4);
03863    marker->SetMarkerStyle(8);
03864    marker->SetMarkerSize(1.3);
03865    marker->Draw();
03866    marker = new TMarker(0.2,0.71/2.,8);
03867    marker->SetMarkerStyle(8);
03868    marker->SetMarkerSize(1.3);
03869    marker->Draw();
03870    marker = new TMarker(0.2,0.62/2.,8);
03871    marker->SetMarkerColor(2);
03872    marker->SetMarkerStyle(8);
03873    marker->SetMarkerSize(0.9);
03874    marker->Draw();
03875    marker = new TMarker(0.2,0.53/2.,4);
03876    marker->SetMarkerColor(6);
03877    marker->SetMarkerStyle(28);
03878    marker->SetMarkerSize(0.9);
03879    marker->Draw();
03880    marker = new TMarker(0.2,0.44/2.,4);
03881    marker->SetMarkerColor(6);
03882    marker->SetMarkerStyle(25);
03883    marker->SetMarkerSize(0.9);
03884    marker->Draw();
03885    marker = new TMarker(0.2,0.35/2.,4);
03886    marker->SetMarkerColor(2);
03887    marker->SetMarkerStyle(29);
03888    marker->SetMarkerSize(1);
03889    marker->Draw();
03890    marker = new TMarker(0.2,0.26/2.,4);
03891    marker->SetMarkerColor(6);
03892    marker->SetMarkerStyle(3);
03893    marker->SetMarkerSize(1);
03894    marker->Draw();
03895    
03896    TLatex *tex = new TLatex(0.04,0.86/2.,"Reco");
03897    tex->SetTextFont(132);
03898    tex->SetTextSize(0.05);
03899    tex->SetLineWidth(2);
03900    tex->Draw();
03901    char temp[256];
03902    sprintf(temp,"Summed NPEs < %.1f",Dspe_val);
03903    tex = new TLatex(0.3,0.86/2.,temp);
03904    tex->SetTextFont(132);
03905    tex->SetTextSize(0.05);
03906    tex->SetLineWidth(2);
03907    tex->Draw();
03908    sprintf(temp,"%.1f < Summed NPEs < %.1f",Dspe_val,Dmid_val);
03909    tex = new TLatex(0.3,0.77/2.,temp);
03910    tex->SetTextFont(132);
03911    tex->SetTextSize(0.05);
03912    tex->SetLineWidth(2);
03913    tex->Draw();
03914    sprintf(temp,"Summed NPEs > %.1f",Dmid_val);
03915    tex = new TLatex(0.3,0.68/2.,temp);
03916    tex->SetTextFont(132);
03917    tex->SetTextSize(0.05);
03918    tex->SetLineWidth(2);
03919    tex->Draw();
03920    tex = new TLatex(0.3,0.59/2.,"Reconstructed Track Hit");
03921    tex->SetTextFont(132);
03922    tex->SetTextSize(0.05);
03923    tex->SetLineWidth(2);
03924    tex->Draw();
03925    tex = new TLatex(0.3,0.50/2.,"Reconstructed Primary Shower Hit");
03926    tex->SetTextFont(132);
03927    tex->SetTextSize(0.05);
03928    tex->SetLineWidth(2);
03929    tex->Draw();
03930    tex = new TLatex(0.3,0.41/2.,"Reconstructed Sec. Shower Hit");
03931    tex->SetTextFont(132);
03932    tex->SetTextSize(0.05);
03933    tex->SetLineWidth(2);
03934    tex->Draw();   
03935    tex = new TLatex(0.3,0.32/2.,"Track Vertex");
03936    tex->SetTextFont(132);
03937    tex->SetTextSize(0.05);
03938    tex->SetLineWidth(2);
03939    tex->Draw();   
03940 tex = new TLatex(0.3,0.23/2.,"Shower Vertex");
03941    tex->SetTextFont(132);
03942    tex->SetTextSize(0.05);
03943    tex->SetLineWidth(2);
03944    tex->Draw();
03945  
03946 }

void MadScanDisplay::DrawTextBox ( TCanvas *  MainCanvas,
Bool_t  isReco 
)

Definition at line 3393 of file MadScanDisplay.cxx.

References choose_infid_set(), NtpTHSlice::complete, NtpTHTrack::completeall, NtpTHShower::completeall, EnergyCorrections::CorrectShowerEnergy(), det, NtpSRTrack::end, NtpSRMomentum::eqp, MadBase::eventSummary, MadMKAnalysis::FarTrkContained(), VldContext::GetDetector(), RecDataHeader::GetRun(), VldContext::GetSimFlag(), RecPhysicsHeader::GetSnarl(), RecHeader::GetVldContext(), NtpSRStripPulseHeight::gev, NtpMCTruth::iaction, infid(), NtpMCTruth::inu, NtpMCTruth::iresonance, MadBase::isMC, MadBase::isST, MadBase::isTH, it, CandShowerHandle::kCC, Detector::kFar, SimFlag::kMC, Detector::kNear, LeEvent, LeMCevent, LeSlice, NtpSRShowerPulseHeight::linCCgev, MadBase::LoadShower(), MadBase::LoadTHShower(), MadBase::LoadTHSlice(), MadBase::LoadTHTrack(), MadBase::LoadTrack(), NtpStRecord::mc, NtpMCRecord::mc, MadBase::mcrecord, NtpSRTrack::momentum, NtpSREventSummary::nevent, NtpSREvent::nshower, NtpSREventSummary::nslice, MadBase::ntpEvent, MadBase::ntpHeader, MadBase::ntpShower, MadBase::ntpTHShower, MadBase::ntpTHSlice, MadBase::ntpTHTrack, MadBase::ntpTrack, MadBase::ntpTruth, NtpSREvent::ntrack, NtpMCTruth::p4el1, NtpMCTruth::p4mu1, NtpMCTruth::p4neu, NtpMCTruth::p4neunoosc, NtpMCTruth::p4shw, ScanFrame::PassChar(), ScanFrame::PassFloat(), ScanFrame::PassInt(), NtpSRShower::ph, MadMKAnalysis::PittTrkContained(), NtpTHSlice::purity, NtpTHTrack::purity, NtpTHShower::purity, NtpSRMomentum::qp, RecoMKMuEnergy(), RecoMuDCosNeuFD(), RecoMuDCosNeuND(), SFrame, NtpSREvent::shw, NtpSRShower::shwph, MadBase::strecord, NtpSREvent::trk, NtpSRVertex::u, NtpSRVertex::v, NtpSRShower::vtx, NtpSRTrack::vtx, NtpMCTruth::vtxx, NtpMCTruth::vtxy, NtpMCTruth::vtxz, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by Display().

03393                                                                  {
03394   
03395   //recalculate angles:
03396   float nu_mu_angle = 0;
03397   float nu_el_angle = 0;
03398   float zen_mu_angle = 0;
03399   if(isMC){
03400     TVector3 *nuvec = new TVector3(ntpTruth->p4neunoosc[0],
03401                                    ntpTruth->p4neunoosc[1],
03402                                    ntpTruth->p4neunoosc[2]);
03403     TVector3 *muvec = new TVector3(ntpTruth->p4mu1[0],
03404                                    ntpTruth->p4mu1[1],
03405                                    ntpTruth->p4mu1[2]);
03406     TVector3 *elvec = new TVector3(ntpTruth->p4el1[0],
03407                                    ntpTruth->p4el1[1],
03408                                    ntpTruth->p4el1[2]);
03409     TVector3 *zenith = new TVector3(0,-1,0); 
03410     nu_mu_angle = nuvec->Angle(*muvec);
03411     nu_el_angle = nuvec->Angle(*elvec);
03412     zen_mu_angle = muvec->Angle(*zenith);
03413   }
03414 
03415   //Summary
03416   char sometext1[100] = ".";
03417   if(isReco) sprintf(sometext1,
03418                      "Run: %i, Snarl: %i, Slice: %i(/%i), Event %i(/%i)",
03419                      ntpHeader->GetRun(),ntpHeader->GetSnarl(),LeSlice+1,
03420                      eventSummary->nslice,LeEvent+1,eventSummary->nevent);
03421   else sprintf(sometext1,
03422                "Run: %i, Snarl: %i, Slice: %i(/%i), Event %i(/%i)",
03423                ntpHeader->GetRun(),ntpHeader->GetSnarl(),LeSlice+1,
03424                eventSummary->nslice,0,eventSummary->nevent);
03425 
03426   //Truth
03427   char sometext2[100] = "Truth";
03428   char sometext3[100] = "N/A";
03429   char sometext4[100] = "N/A";
03430   char sometext5[100] = "N/A";
03431   char sometext6[100] = "N/A";
03432   char sometext7[100] = "N/A";
03433   char sometext8[100] = "N/A";
03434 
03435   //Reco
03436   char sometext9[100] = "N/A";
03437   char sometext10[100] = "N/A";
03438   char sometext14[100] = "N/A";
03439 
03440   if(isReco&&eventSummary->nevent!=0&&isTH) {
03441     //Slice summary:
03442     LoadTHSlice(LeSlice);
03443     if(ntpTHSlice) sprintf(sometext9,"Reco - Slice (%.3f, %.3f)",
03444                            ntpTHSlice->purity,ntpTHSlice->complete);
03445     else sprintf(sometext9,"Reco");
03446 
03447     //Shower summary:
03448     if(ntpEvent->nshower>0&&ntpTHShower){
03449       if(LoadTHShower(ntpEvent->shw[0])) {
03450           sprintf(sometext14,"     #Shws: %i (%.3f, %.3f)",
03451                 ntpEvent->nshower,ntpTHShower->purity,ntpTHShower->completeall);
03452           SFrame->PassInt("NumShw",ntpEvent->nshower);
03453       }
03454       for(int i=1;i<ntpEvent->nshower;i++){
03455         LoadTHShower(ntpEvent->shw[i]);
03456         if(ntpTHShower) 
03457           sprintf(sometext14,"%s (%.3f, %.3f)",sometext14,ntpTHShower->purity,
03458                   ntpTHShower->completeall);
03459       }
03460     }
03461     else if(ntpEvent->nshower>0) {
03462        sprintf(sometext14,"     #Shws: %i", ntpEvent->nshower);
03463        SFrame->PassInt("NumShw",ntpEvent->nshower);
03464     }
03465     else {
03466       sprintf(sometext14,"     #Shws: 0");
03467       SFrame->PassInt("NumShw",0);
03468     }
03469 
03470     //Track summary:
03471     if(ntpEvent->ntrack>0&&ntpTHTrack){
03472       sprintf(sometext10,"     #Trks: %i (%.3f, %.3f)",
03473               ntpEvent->ntrack,ntpTHTrack->purity,ntpTHTrack->completeall);
03474       SFrame->PassInt("NumTrk",ntpEvent->ntrack);
03475       for(int i=1;i<ntpEvent->ntrack;i++){
03476         LoadTHTrack(ntpEvent->trk[i]);
03477         if(ntpTHTrack) 
03478           sprintf(sometext10,"%s (%.3f, %.3f)",sometext10,ntpTHTrack->purity,
03479                   ntpTHTrack->completeall);
03480       }
03481     }
03482     else if (ntpEvent->ntrack>0) {
03483       sprintf(sometext10,"     #Trks: %i",ntpEvent->ntrack);
03484       SFrame->PassInt("NumTrk",ntpEvent->ntrack);
03485     }
03486     else {
03487       sprintf(sometext10,"     #Trks: 0");
03488       SFrame->PassInt("NumTrk",0);
03489     }
03490   }
03491   
03492   else if(isReco&&eventSummary->nevent!=0){
03493     sprintf(sometext9,"Reco");
03494     sprintf(sometext10,"     #Trks: %i",ntpEvent->ntrack);
03495     SFrame->PassInt("NumTrk",ntpEvent->ntrack);
03496     sprintf(sometext14,"     #Shws: %i",ntpEvent->nshower);
03497     SFrame->PassInt("NumShw",ntpEvent->nshower);
03498   }
03499   else {
03500     sprintf(sometext9,"Reco");
03501     sprintf(sometext10,"     No Reconstruced Event");
03502   }
03503 
03504   //Track values
03505   char sometext11[100] = "N/A";
03506   char sometext12[100] = "N/A";
03507   char sometext13[100] = "N/A";
03508   
03509   if(false){ //if MC
03510     TClonesArray* pointMcArray = NULL;
03511     if(isST) pointMcArray = (strecord->mc);
03512     else pointMcArray = (mcrecord->mc);
03513     TClonesArray& mcArray = *pointMcArray;
03514 
03515     sprintf(sometext2,"Truth - MC: %i(/%i)",LeMCevent+1,
03516             mcArray.GetEntries());
03517     
03518     sprintf(sometext3,"     Nu ID: %i;  NC/CC: %i;  Process: %i",ntpTruth->inu,
03519             ntpTruth->iaction,ntpTruth->iresonance);
03520     
03521     sprintf(sometext7,"     Shw Energy: %f",ntpTruth->p4shw[3]);
03522 
03523     sprintf(sometext8,"     Vtx: %.2f, %.2f, %.2f",ntpTruth->vtxx,
03524             ntpTruth->vtxy,ntpTruth->vtxz);    
03525     
03526     if(abs(ntpTruth->inu)==12){
03527       
03528       sprintf(sometext4,"     Nu E: %.3f;  Elec E*q: %.3f",ntpTruth->p4neu[3],
03529               ntpTruth->p4el1[3]);
03530       
03531       sprintf(sometext5,"     Elec p: %.3f;  Py: %.2f",
03532               sqrt(ntpTruth->p4el1[3]*ntpTruth->p4el1[3])
03533               -(0.000511*0.000511),ntpTruth->p4el1[1]);
03534       
03535       sprintf(sometext6,"     #theta: %.4f rad, %.2f deg",nu_el_angle,
03536               nu_el_angle*180./TMath::Pi());
03537       
03538     }
03539     
03540     else if(abs(ntpTruth->inu)==14){
03541       
03542       sprintf(sometext4,"     Nu E: %.3f;  Mu E*q: %.3f",ntpTruth->p4neu[3],
03543               ntpTruth->p4mu1[3]);
03544       
03545       sprintf(sometext5,"     Mu p: %.3f;  Py: %.2f",
03546               sqrt(ntpTruth->p4mu1[3]*ntpTruth->p4mu1[3])
03547               -(0.10555*0.10555),ntpTruth->p4mu1[1]);
03548       
03549       sprintf(sometext6,"     #theta: %.4f rad, %.2f deg",nu_mu_angle,
03550               nu_mu_angle*180./TMath::Pi());
03551       
03552     }
03553 
03554     else if(ntpTruth->p4neu[3]<0.00001){
03555       
03556       sprintf(sometext4,"     Nu E: %.3f;  Mu E*q: %.3f",ntpTruth->p4neu[3],
03557               ntpTruth->p4mu1[3]);
03558       
03559       sprintf(sometext5,"     Mu p: %.3f;  Py: %.2f",
03560               sqrt(ntpTruth->p4mu1[3]*ntpTruth->p4mu1[3])
03561               -(0.10555*0.10555),ntpTruth->p4mu1[1]);
03562       
03563       sprintf(sometext6,"     Zenith angle: %.4f rad, %.2f deg",zen_mu_angle,
03564               zen_mu_angle*180./TMath::Pi());
03565     }
03566 
03567   }
03568   
03569   if(isReco&&eventSummary->nevent!=0){ //reconstructed event present
03570     const Detector::Detector_t det 
03571       = ntpHeader->GetVldContext().GetDetector();
03572     Float_t cor_shw_energy =0; // corrected shower energy
03573     float best_trk_mom=0.0;// will be range or curvature
03574     int do_meth=0; // emu reco method we should use
03575     float reco_dircosneu=-1; // z cosine
03576     const bool is_mc
03577       =(ntpHeader->GetVldContext().GetSimFlag()==SimFlag::kMC);
03578     const double muM=0.10566; // muon mass
03579     if(ntpEvent->ntrack!=0){  //and at least one track
03580       
03581       float trk_mom_pq = 0;
03582       //for info, just show first track:
03583       int *tracks = ntpEvent->trk;
03584       int index = 0;
03585       float largestEn = 0;
03586       for(int it=0;it<ntpEvent->ntrack;it++){
03587         if(!LoadTrack(tracks[it])) continue;
03588         if(ntpTrack->momentum.qp==0) continue;
03589         if(fabs(1./ntpTrack->momentum.qp)>largestEn) {
03590           largestEn = fabs(1./ntpTrack->momentum.qp);
03591           index = tracks[it];
03592         }
03593       }
03594       LoadTrack(index);
03595       if(ntpTrack->momentum.qp!=0) trk_mom_pq = 1./ntpTrack->momentum.qp;
03596 
03597       // determine if event is contained, compute momentum      
03598       if(det==Detector::kNear){//if it's the near detector
03599         int pitt_evt_class = 
03600           MadMKAnalysis::PittTrkContained(ntpTrack->end.x,
03601                                           ntpTrack->end.y,
03602                                           ntpTrack->end.z,
03603                                           ntpTrack->end.u,
03604                                           ntpTrack->end.v);
03605         if(pitt_evt_class>0){ // if it was classified
03606           if( (pitt_evt_class == 1) || (pitt_evt_class == 3) ) 
03607             do_meth=2; // stoppers --> range
03608           else if( (pitt_evt_class == 2) || (pitt_evt_class == 4) ) 
03609             do_meth=1; // punch-through --> curvature
03610           if(do_meth==1 || do_meth==2){
03611             best_trk_mom = 
03612               RecoMKMuEnergy(do_meth,index,!is_mc);
03613           }
03614         }
03615       }
03616       else if(det==Detector::kFar){//if it's the far detector
03617         do_meth=MadMKAnalysis::FarTrkContained(ntpTrack->end.x,
03618                                                ntpTrack->end.y,
03619                                                ntpTrack->end.z);
03620         if(do_meth==1 || do_meth==2){
03621           best_trk_mom = 
03622             RecoMKMuEnergy(do_meth,index,!is_mc);
03623         }
03624       }                             
03625       best_trk_mom = sqrt(best_trk_mom*best_trk_mom - muM*muM);
03626       int range_meth=2;
03627       float mom_range = RecoMKMuEnergy(range_meth,index,!is_mc);
03628       mom_range = sqrt(mom_range*mom_range - muM*muM);
03629       if(det==Detector::kNear) 
03630         reco_dircosneu = RecoMuDCosNeuND(index);
03631       else reco_dircosneu = RecoMuDCosNeuFD(index);
03632 
03633       
03634       char range_used=' ';
03635       char curve_used='R';
03636       if(do_meth==1) curve_used='C';
03637       else range_used='*';
03638 
03639       choose_infid_set("cc2008");
03640       Bool_t fid = infid(*strecord,*ntpTrack);
03641         
03642       char track_fid = 'N';
03643       if(fid) track_fid = 'Y';
03644         
03645       sprintf(sometext11,"     q/p: %.3f +/- %.3f,  p/q: %.3f  Best: %c  Fiducial: %c ",
03646               ntpTrack->momentum.qp,
03647               ntpTrack->momentum.eqp,trk_mom_pq,curve_used, track_fid);
03648       SFrame->PassChar("BestRange",curve_used);
03649       SFrame->PassFloat("QoverP",ntpTrack->momentum.qp);
03650       
03651       sprintf(sometext12,"     TrkRangeEnergy: %.3f %c",mom_range,range_used);
03652       SFrame->PassFloat("TrkEne",mom_range);
03653       
03654       sprintf(sometext13,"     Vtx:  x: %.2f, y: %.2f, u: %.2f, v: %.2f, z: %.2f",ntpTrack->vtx.x,
03655               ntpTrack->vtx.y,ntpTrack->vtx.u, ntpTrack->vtx.v,ntpTrack->vtx.z);
03656 
03657      }
03658     else {//no track
03659       sprintf(sometext11,"     q/p: %.3f +/- %.3f,  p/q: %.3f",0.,0.,0.);
03660       SFrame->PassChar("BestRange",'?');
03661       SFrame->PassFloat("QoverP",0.);
03662       sprintf(sometext12,"     TrkRangeEnergy: %.3f",0.);
03663       SFrame->PassFloat("TrkEne",0.);
03664       sprintf(sometext13,"     Vtx: %.2f, %.2f, %.2f",0.,0.,0.);
03665     }
03666     if(ntpEvent->nshower!=0){  //at least one shower
03667       //for info, just show biggest shower:
03668       // and the sum of showers
03669       int *showers = ntpEvent->shw;      
03670       int index = 0;
03671       float largestEn = 0;
03672       float sumEn = 0;
03673       float thisEn = 0;
03674       for(int is=0;is<ntpEvent->nshower;is++){
03675         if(!LoadShower(showers[is])) continue;
03676         if(ntpShower->shwph.linCCgev>largestEn) {
03677           largestEn = ntpShower->shwph.linCCgev;
03678           index = showers[is];
03679         }
03680 
03681         thisEn=CorrectShowerEnergy(ntpShower->shwph.linCCgev,
03682                                    det,CandShowerHandle::kCC);
03683         sumEn+=thisEn;
03684         std::cout<<"shw (i,u,v,z,E,Ecor): ( "<<is<<" , "<<ntpShower->vtx.u
03685                  <<" , "<<ntpShower->vtx.v<<" , "<<ntpShower->vtx.z
03686                  <<" , "<<ntpShower->ph.gev<<" , "<<thisEn<<" ) "<<std::endl;
03687         
03688       }
03689       LoadShower(index);
03690       static int i_shw_message=1;
03691       if(i_shw_message<11){
03692         std::cout<<"Printing the corrected linCC energy ("<<i_shw_message<<"/10)";
03693         if(i_shw_message==10){
03694           std::cout<<" Last message...";
03695         }
03696         std::cout<<std::endl;
03697         i_shw_message++;
03698       }
03699 
03700       cor_shw_energy = CorrectShowerEnergy(ntpShower->shwph.linCCgev,
03701                               det,CandShowerHandle::kCC);
03702       sprintf(sometext12,"%s   RecoShwEnergy: %.3f [%.3f]",sometext12,
03703               cor_shw_energy, sumEn);
03704       SFrame->PassFloat("ShwEne",cor_shw_energy);
03705        
03706     }
03707     else {//no shower
03708       sprintf(sometext12,"%s   RecoShwEnergy: %.3f",sometext12,0.);
03709       SFrame->PassFloat("ShwEne",0.);
03710     }
03711 
03712     if(best_trk_mom>0){
03713       float reco_x=0.,reco_y=0.,reco_Q2=0.,reco_W2=0.,reco_QEQ2=0.;
03714       float reco_eshw=cor_shw_energy;
03715       float reco_emu=sqrt(best_trk_mom*best_trk_mom+muM*muM);
03716       
03717       float reco_enu=reco_emu+reco_eshw;
03718       const double M=(0.93827 + 0.93957)/2.0; // <nucleon mass>
03719       if(reco_emu>0) reco_Q2 = 
03720                        2*reco_enu*reco_emu*(1.0 - reco_dircosneu);
03721       reco_W2 = M*M - reco_Q2 + 2*M*reco_eshw;    
03722       if(reco_enu>0) reco_y = reco_eshw/reco_enu;
03723       if(reco_eshw>0 && reco_Q2>0) reco_x =  reco_Q2/(2*M*reco_eshw);
03724       
03725       float muP=(reco_emu*reco_emu -muM*muM);
03726       if(muP<0) muP=0;
03727       else muP=sqrt(muP);
03728       float reco_qe_enu = (M*reco_emu - muM*muM/2.0)
03729         /(M - reco_emu + muP*reco_dircosneu);
03730       reco_QEQ2 
03731         = abs(-2.0*reco_qe_enu*(reco_emu-muP*reco_dircosneu)+muM*muM);
03732     
03733       //      sprintf(sometext13,"%s,  x,y,Q2,W2  = %.2f, %.2f, %.2f, %.2f",
03734       //              sometext13, reco_x,reco_y,reco_Q2,reco_W2);
03735     }
03736   }
03737   else { //no event
03738     sprintf(sometext11,"     q/p: %.3f +/- %.3f,  p/q: %.3f",0.,0.,0.);
03739     sprintf(sometext12,
03740             "     TrkRangeEnergy: %.3f   RecoShwEnergy: %.3f",0.,0.);
03741     sprintf(sometext13,"     Vtx: %.2f, %.2f, %.2f",0.,0.,0.);
03742 
03743     SFrame->PassChar("BestRange",'?');
03744     SFrame->PassFloat("QoverP",0.);
03745     SFrame->PassFloat("TrkEne",0.);
03746     SFrame->PassFloat("ShwEne",0.);
03747 
03748   }
03749 
03750 
03751   //summary
03752   TLatex *Info1 = new TLatex(0.05,0.91,sometext1);
03753   Info1->SetName("info1");
03754   Info1->SetTextSize(0.06);
03755   Info1->SetTextColor(2);
03756 
03757   //Reco
03758   TLatex *Info9 = new TLatex(0.05,0.84,sometext9);
03759   Info9->SetName("info9");
03760   Info9->SetTextSize(0.06);
03761   Info9->SetTextColor(4);
03762 
03763   TLatex *Info10 = new TLatex(0.05,0.77,sometext10);
03764   Info10->SetName("info10");
03765   if(Info10->Sizeof()<70) Info10->SetTextSize(0.05);
03766   else Info10->SetTextSize(0.04);
03767   Info10->SetTextColor(9);
03768 
03769   TLatex *Info14 = new TLatex(0.05,0.70,sometext14);
03770   Info14->SetName("info14");
03771   if(Info14->Sizeof()<70) Info14->SetTextSize(0.05);
03772   else Info14->SetTextSize(0.04);
03773   Info14->SetTextColor(9);
03774 
03775   //track
03776 
03777   TLatex *Info11 = new TLatex(0.05,0.63,sometext11);
03778   Info11->SetName("info11");
03779   Info11->SetTextSize(0.05);
03780   Info11->SetTextColor(9);
03781 
03782   TLatex *Info12 = new TLatex(0.05,0.56,sometext12);
03783   Info12->SetName("info12");
03784   Info12->SetTextSize(0.05);
03785   Info12->SetTextColor(9);
03786 
03787   TLatex *Info13 = new TLatex(0.05,0.49,sometext13);
03788   Info13->SetName("info13");
03789   Info13->SetTextSize(0.05);
03790   Info13->SetTextColor(9);
03791   
03792   //truth
03793   /*
03794   TLatex *Info2 = new TLatex(0.05,0.42,sometext2);
03795   Info2->SetName("info2");
03796   Info2->SetTextSize(0.06);
03797   Info2->SetTextColor(3);
03798   
03799   TLatex *Info3 = new TLatex(0.05,0.35,sometext3);
03800   Info3->SetName("info3");
03801   Info3->SetTextSize(0.05);
03802   Info3->SetTextColor(8);
03803 
03804   TLatex *Info4 = new TLatex(0.05,0.28,sometext4);
03805   Info4->SetName("info4");
03806   Info4->SetTextSize(0.05);
03807   Info4->SetTextColor(8);
03808 
03809   TLatex *Info5 = new TLatex(0.05,0.21,sometext5);
03810   Info5->SetName("info5");
03811   Info5->SetTextSize(0.05);
03812   Info5->SetTextColor(8);
03813 
03814   TLatex *Info6 = new TLatex(0.05,0.14,sometext6);
03815   Info6->SetName("info6");
03816   Info6->SetTextSize(0.05);
03817   Info6->SetTextColor(8);
03818 
03819   TLatex *Info7 = new TLatex(0.05,0.07,sometext7);
03820   Info7->SetName("info7");
03821   Info7->SetTextSize(0.05);
03822   Info7->SetTextColor(8);
03823 
03824   TLatex *Info8 = new TLatex(0.05,0.00,sometext8);
03825   Info8->SetName("info8");
03826   Info8->SetTextSize(0.05);
03827   Info8->SetTextColor(8);
03828   */
03829   MainCanvas->cd(1);
03830   gPad->Range(0,0,1,1);
03831   Info1->Draw();
03832   //  Info2->Draw();
03833   //  Info3->Draw();
03834   // Info4->Draw();
03835   //  Info5->Draw();
03836   // Info6->Draw();
03837   // Info7->Draw();
03838   // Info8->Draw();
03839   Info9->Draw();
03840   Info10->Draw();
03841   Info11->Draw();
03842   Info12->Draw();
03843   Info13->Draw();
03844   Info14->Draw();
03845 
03846 }

void MadScanDisplay::EnableHandScan ( char *  fname  ) 

Definition at line 4698 of file MadScanDisplay.cxx.

References handScan, and logFileName.

04699 {
04700   handScan = true;
04701   if(std::strcmp(fname,"")) {
04702     sprintf(logFileName,"%s",fname);
04703   }
04704 }

void MadScanDisplay::EventDump (  ) 
void MadScanDisplay::FindUnSliced (  ) 

Definition at line 769 of file MadScanDisplay.cxx.

References ScanFrame::EntryProc(), ScanFrame::SetEvent(), ScanFrame::SetSlice(), and SFrame.

00769                                  {
00770   SFrame->SetEvent(-1);
00771   SFrame->SetSlice(-1);
00772   SFrame->EntryProc();
00773 }

void MadScanDisplay::HandleZoomEvent (  ) 

Definition at line 5069 of file MadScanDisplay.cxx.

05069                                      {
05070   // RBP: 2008-03-13
05071   // Added this routine to allow users to drag-draw a box for zooming.
05072   // Much less wrist strain for the hand scanning studies!
05073 
05074   static Int_t    firstX, firstY, lastX , lastY , lastEvent;
05075   static Double_t holdX0, holdX1, holdY0, holdY1;
05076   static Bool_t   inside;
05077   Int_t event = gPad->GetEvent();
05078   Int_t x     = gPad->GetEventX();
05079   Int_t y     = gPad->GetEventY();
05080 
05081   // get the drawn histogram... expecting it to be At(1):
05082   TH2 *h = (TH2*)gPad->GetListOfPrimitives()->At(1);
05083   if (!h->InheritsFrom(TH1::Class())) return;
05084 
05085   if (h) {
05086       TFrame* fr = 0;
05087     switch (event) {
05088 
05089     case kButton1Down:
05090       // hold start of zoom region if inside frame
05091       fr = (TFrame*)gPad->GetListOfPrimitives()->At(0);
05092       if (x > gPad->XtoAbsPixel(fr->GetX1())&&
05093           x < gPad->XtoAbsPixel(fr->GetX2())&&
05094           y > gPad->YtoAbsPixel(fr->GetY2())&&
05095           y < gPad->YtoAbsPixel(fr->GetY1())) {
05096         inside = kTRUE;
05097         firstX = x;
05098         firstY = y;
05099         gPad->SetCursor(kCross);
05100         gPad->GetRange(holdX0,holdY0,holdX1,holdY1);
05101         gVirtualX->DrawBox(x,y,x,y,TVirtualX::kHollow);
05102         gVirtualX->SetLineColor(-1);
05103       }
05104       else {
05105         inside = kFALSE;
05106       }
05107       break;
05108       
05109     case kButton1Motion:
05110       if (inside) {
05111         // draw zooming box
05112         gVirtualX->DrawBox(firstX,firstY,lastX,lastY,TVirtualX::kHollow);
05113         gVirtualX->DrawBox(firstX,firstY,    x,    y,TVirtualX::kHollow);
05114       }
05115       break;
05116       
05117     case kButton1Up:
05118       if (gROOT->IsEscaped()) {
05119         gROOT->SetEscape(kFALSE);
05120       }
05121       else if (inside) {
05122         // zoom the axes
05123         gPad->Range(holdX0,holdY0,holdX1,holdY1);
05124         Double_t newx0 = gPad->AbsPixeltoX((firstX<x)?firstX:x);
05125         Double_t newx1 = gPad->AbsPixeltoX((firstX<x)?x:firstX);
05126         Double_t newy0 = gPad->AbsPixeltoY((firstY>y)?firstY:y);
05127         Double_t newy1 = gPad->AbsPixeltoY((firstY>y)?y:firstY);
05128         Double_t oldx0 = gPad->GetUxmin();
05129         Double_t oldx1 = gPad->GetUxmax();
05130         Double_t oldy0 = gPad->GetUymin();
05131         Double_t oldy1 = gPad->GetUymax();
05132         if ((newx1-newx0)/(oldx1-oldx0)>0.05||
05133             (newy1-newy0)/(oldy1-oldy0)>0.05) {
05134           h->GetXaxis()->SetRangeUser(newx0,newx1);
05135           h->GetYaxis()->SetRangeUser(newy0,newy1);
05136           gPad->Modified(kTRUE);
05137         }
05138       }
05139       inside = kFALSE;
05140       gVirtualX->SetLineColor(-1);
05141       break;
05142     
05143     default:
05144       break;
05145     }
05146   }
05147 
05148   lastEvent = event;
05149   lastX     = x;
05150   lastY     = y;
05151 }

Bool_t MadScanDisplay::InFidNoTrk ( int  e  ) 

Definition at line 508 of file MadScanDisplay.cxx.

References choose_infid_set(), MadBase::eventSummary, VldContext::GetDetector(), RecHeader::GetVldContext(), infid(), NtpSRShowerPulseHeight::linCCgev, MadBase::LoadEvent(), MadBase::LoadLargestTrackFromEvent(), MadBase::LoadShower_Jim(), MadBase::LoadSlice(), NtpSREventSummary::nevent, MadBase::ntpEvent, MadBase::ntpHeader, MadBase::ntpShower, MadBase::ntpTrack, ScanFrame::Pass(), SFrame, NtpSRShower::shwph, NtpSREvent::slc, and MadBase::strecord.

Referenced by NextFidNoTrk(), and PrevFidNoTrk().

00508                                           {
00509 
00510   int shower_index;
00511   int ind;
00512   bool slice2=false;
00513   int slice = ntpEvent->slc;
00514   if(!LoadSlice(slice))return false;
00515   for(int i=0;i<eventSummary->nevent;i++){
00516     if(i!=event){
00517       LoadEvent(i);
00518       if(ntpEvent->slc==slice) slice2=true;;
00519     }
00520   }
00521   LoadLargestTrackFromEvent(event ,ind);
00522   if(ntpTrack)return false;
00523   LoadShower_Jim(event,shower_index,ntpHeader->GetVldContext().GetDetector());
00524   if(!ntpShower)return false;
00525   if(ntpShower->shwph.linCCgev<0.2) return false; //Get rid of tiny noise showers
00526 
00527   choose_infid_set("cc2008Exp");
00528   //choose_infid_set("cc2008");
00529   Bool_t fid = infid(*strecord,*ntpShower);
00530   
00531   if(fid && slice2) SFrame->Pass("Slice2Evt");
00532   
00533   return fid;
00534 }

Bool_t MadScanDisplay::InFidTrk ( int  e  ) 

Definition at line 485 of file MadScanDisplay.cxx.

References choose_infid_set(), MadBase::eventSummary, infid(), MadBase::LoadEvent(), MadBase::LoadLargestTrackFromEvent(), MadBase::LoadSlice(), NtpSREventSummary::nevent, MadBase::ntpEvent, MadBase::ntpTrack, ScanFrame::Pass(), SFrame, NtpSREvent::slc, and MadBase::strecord.

Referenced by NextFidTrk(), and PrevFidTrk().

00485                                         {
00486 
00487   int ind;
00488  int slice = ntpEvent->slc;
00489  if(!LoadSlice(slice))return false;
00490  bool slice2=false;
00491  for(int i=0;i<eventSummary->nevent;i++){
00492    if(i!=event){
00493      LoadEvent(i);
00494      if(ntpEvent->slc==slice) slice2=true;
00495    }
00496  }
00497  LoadEvent(event);
00498   LoadLargestTrackFromEvent(event,ind);
00499   if(!ntpTrack)return false;
00500   
00501   choose_infid_set("cc2008Exp");
00502   //choose_infid_set("cc2008");
00503   Bool_t fid = infid(*strecord,*ntpTrack);
00504   if(fid && slice2) SFrame->Pass("Slice2Evt");
00505   return fid;
00506 }

Int_t MadScanDisplay::JumpTo (  ) 

Definition at line 745 of file MadScanDisplay.cxx.

References Display(), MadBase::fChain, MadChain::GetEntryNumber(), MadBase::lastEntry, LeAutoMat, MadBase::Nentries, run(), and MadBase::whichSource.

00746 {
00747  
00748   if(whichSource==0){
00749     Int_t run = 0;
00750     Int_t snarl = 0;
00751     std::cout << "Enter run number of the snarl:" << std::endl;
00752     std::cin >> run;
00753     std::cout << "Enter snarl number:" << std::endl;
00754     std::cin >> snarl;
00755     Int_t entry = fChain->GetEntryNumber(run,snarl);
00756     cout << entry << endl;
00757     if(entry>=0 && entry<Nentries) {
00758       std::cout << "Displaying Run: " << run << " Snarl: " 
00759                 << snarl << std::endl;
00760       Display(entry,0,0,0,LeAutoMat);
00761       return entry;
00762     }
00763     std::cout << "Couldn't find Run: " << run << " Snarl: " 
00764               << snarl << std::endl;
00765   }
00766   return lastEntry;
00767 }

void MadScanDisplay::Log (  ) 

Definition at line 4683 of file MadScanDisplay.cxx.

References RecDataHeader::GetRun(), RecPhysicsHeader::GetSnarl(), RecDataHeader::GetSubRun(), NtpSRSlice::index, NtpSREvent::index, logFileName, MadBase::ntpEvent, MadBase::ntpHeader, MadBase::ntpSlice, ScanID, and ScanTop.

04684 {
04685   ofstream outFile;
04686   outFile.open(logFileName, ofstream::out | ofstream::app);
04687   outFile << ntpHeader->GetRun() << " " 
04688           << ntpHeader->GetSubRun() << " " 
04689           << ntpHeader->GetSnarl() << " "
04690           << ntpSlice->index << " "
04691           << ntpEvent->index << " "
04692           << ScanID << " "
04693           << ScanTop << " "
04694           << endl;
04695   outFile.close();
04696 }

void MadScanDisplay::MakeGraphListNonEditable ( TList *  list  ) 

Definition at line 5164 of file MadScanDisplay.cxx.

References MakeGraphNonEditable().

Referenced by Display(), and MakeGraphNonEditable().

05164                                                          {
05165   TIter next(list);
05166   while (TObject *obj = next()) {
05167     MakeGraphNonEditable(obj);
05168   }
05169 }

void MadScanDisplay::MakeGraphNonEditable ( TObject *  obj  ) 

Definition at line 5154 of file MadScanDisplay.cxx.

References MakeGraphListNonEditable().

Referenced by MakeGraphListNonEditable().

05154                                                       {
05155   if (obj->InheritsFrom(TGraph::Class())) {
05156     ((TGraph*)obj)->SetEditable(0);
05157   }
05158   else if (obj->InheritsFrom(TMultiGraph::Class())) {
05159     MakeGraphListNonEditable(((TMultiGraph*)obj)->GetListOfGraphs());
05160   }
05161 }

Int_t MadScanDisplay::NextEvt (  ) 

Definition at line 372 of file MadScanDisplay.cxx.

References Display(), ScanFrame::EntryProc(), MadBase::GetEntry(), LeAutoMat, LeEntry, LeEvent, LeMCevent, LeSlice, MadBase::LoadEvent(), MadBase::Nentries, and SFrame.

00373 {
00374   //  if (fHaveNeatoEvents) { return NextInterestingEvent(); }
00375 
00376   SFrame->EntryProc();
00377   int entry = LeEntry;
00378   int event = LeEvent+1;
00379  
00380   while(this->GetEntry(entry)){
00381     while(LoadEvent(event++)) {
00382       LeSlice = 0;
00383       LeEvent = event;
00384       LeMCevent = 0;
00385       Display(entry,0,event,0,LeAutoMat);
00386       return entry;
00387     }
00388     event = 0;
00389     entry+=1;
00390     if(entry>=Nentries) break;
00391   }
00392   entry = 0;
00393   Display(0,0,0,0,LeAutoMat);
00394   
00395   return entry;
00396 }

Int_t MadScanDisplay::NextFidNoTrk (  ) 

Definition at line 562 of file MadScanDisplay.cxx.

References Display(), ScanFrame::EntryProc(), MadBase::GetEntry(), InFidNoTrk(), LeAutoMat, LeEntry, LeEvent, LeMCevent, LeSlice, MadBase::LoadEvent(), MadBase::Nentries, and SFrame.

00562                                    {
00563   // override to read from list of events
00564   SFrame->EntryProc();
00565   int entry = LeEntry;
00566   int event = LeEvent+1;
00567 
00568  
00569   while(this->GetEntry(entry)){
00570     while(LoadEvent(event)) {
00571       if(InFidNoTrk(event)){
00572         LeSlice = 0;
00573         LeEvent = event;
00574         LeMCevent = 0;
00575         Display(entry,0,event,0,LeAutoMat);
00576         return entry;
00577       }     
00578       event+=1;
00579     }
00580     event = 0;
00581     entry+=1;
00582     if(entry>=Nentries) break;
00583   }
00584   entry = 0;
00585   Display(0,0,0,0,LeAutoMat);
00586   return entry;  
00587 }

Int_t MadScanDisplay::NextFidTrk (  ) 

Definition at line 536 of file MadScanDisplay.cxx.

References Display(), ScanFrame::EntryProc(), MadBase::GetEntry(), InFidTrk(), LeAutoMat, LeEntry, LeEvent, LeMCevent, LeSlice, MadBase::LoadEvent(), MadBase::Nentries, and SFrame.

00536                                  {
00537   // override to read from list of events
00538   SFrame->EntryProc();
00539   int entry = LeEntry;
00540   int event = LeEvent+1;
00541  
00542   while(this->GetEntry(entry)){
00543     while(LoadEvent(event)) {
00544       if(InFidTrk(event)){
00545         LeSlice = 0;
00546         LeEvent = event;
00547         LeMCevent = 0;
00548         Display(entry,0,event,0,LeAutoMat);
00549         return entry;
00550       }     
00551       event+=1;
00552     }
00553     event = 0;
00554     entry+=1;
00555     if(entry>=Nentries) break;
00556   }
00557   entry = 0;
00558   Display(0,0,0,0,LeAutoMat);
00559   return entry;  
00560 }

Int_t MadScanDisplay::NextInterestingEvent ( bool  backward = false  ) 

Definition at line 4788 of file MadScanDisplay.cxx.

References Display(), ScanFrame::EntryProc(), MadBase::fChain, fNeatoEventIdx, fNeatoEvents, MadBase::GetEntry(), MadChain::GetEntryNumber(), RecDataHeader::GetRun(), RecPhysicsHeader::GetSnarl(), LeAutoMat, LeEntry, MadBase::LoadEvent(), MadBase::ntpHeader, and SFrame.

Referenced by NextPass(), and PrevPass().

04788                                                        {
04789   if(fNeatoEvents.size()==0) return LeEntry;
04790   //  int ncontinue;
04791   Int_t event=-1;
04792   Int_t entry=-1;
04793   while(true){
04794     if(!backward){
04795       if(fNeatoEventIdx+1 >= static_cast<Int_t>(fNeatoEvents.size())){
04796         fNeatoEventIdx=0; 
04797       }
04798       else fNeatoEventIdx++;
04799     }
04800     else{
04801       if(fNeatoEventIdx-1 < 0){
04802         fNeatoEventIdx=fNeatoEvents.size()-1;
04803       }
04804       else fNeatoEventIdx--;
04805     }
04806     //  return fNeatoEventIdx;
04807     // search for event in MadChain's list
04808     std::vector<Int_t>& v = fNeatoEvents[fNeatoEventIdx]; 
04809     entry=fChain->GetEntryNumber(v[0],v[1]);
04810     if(entry != -1) {
04811       event = v[2];
04812       break;
04813     }
04814 
04815   }
04816   this->GetEntry(entry);
04817   this->LoadEvent(event);
04818   SFrame->EntryProc();
04819   Display(entry,0,event,0,LeAutoMat);
04820   char buf[256];
04821   sprintf(buf,"r%is%i",ntpHeader->GetRun(),ntpHeader->GetSnarl());
04822   
04823   TSeqCollection* list = gROOT->GetListOfCanvases();
04824   for(Int_t ican=0; ican<list->GetEntries(); ican++){
04825     TCanvas* c = dynamic_cast<TCanvas*>(list->At(ican));
04826     std::string f1=buf; f1+=c->GetName(); f1+=".eps";
04827     std::string f2=buf; f2+=c->GetName(); f2+=".pdf";
04828     std::string f3=buf; f3+=c->GetName(); f3+=".C";
04829     std::string f4=buf; f4+=c->GetName(); f4+=".png";
04830     c->Print(f1.c_str());
04831     c->Print(f2.c_str());
04832     c->Print(f3.c_str());
04833     c->Print(f4.c_str());
04834 
04835   }
04836   
04837   return entry;
04838 
04839 }

Int_t MadScanDisplay::NextPass (  ) 

Definition at line 428 of file MadScanDisplay.cxx.

References Display(), fHaveNeatoEvents, MadBase::GetEntry(), NtpMCTruth::iaction, NtpMCTruth::inu, MadBase::isMC, MadBase::isTH, LeAction, LeAutoMat, LeEntry, LeEvent, LeMCevent, LeNu, LeSlice, MadBase::LoadEvent(), MadBase::LoadSliceForRecoTH(), MadBase::LoadTruthForRecoTH(), MadBase::Nentries, NextInterestingEvent(), MadBase::ntpTruth, PassCuts(), and UseNuInfo.

00428                                {
00429   // override to read from list of events
00430  
00431   if(fHaveNeatoEvents) { return NextInterestingEvent(); }
00432 
00433   int entry = LeEntry;
00434   int event = LeEvent+1;
00435 
00436   if(isMC&&isTH){
00437     int mcevent = 0;
00438     while(this->GetEntry(entry)){
00439       while(LoadEvent(event)) { 
00440         if(LoadTruthForRecoTH(event,mcevent)){
00441           if(PassCuts()&&(!UseNuInfo||(abs(ntpTruth->inu)==LeNu
00442                                        &&ntpTruth->iaction==LeAction))){
00443             int slice = 0;
00444             LoadSliceForRecoTH(event,slice);
00445             LeSlice = slice;        
00446             LeEvent = event;
00447             LeMCevent = mcevent;
00448             Display(entry,slice,event,mcevent,LeAutoMat);
00449             return entry;
00450           }
00451         }
00452         event+=1;
00453       }
00454       event = 0;
00455       entry+=1;
00456       if(entry>=Nentries) break;
00457     }
00458     entry = 0;
00459     Display(0,0,0,0,LeAutoMat);
00460     return entry;
00461   }
00462 
00463   //if no MC or TH:
00464   while(this->GetEntry(entry)){
00465     while(LoadEvent(event)) {
00466       if(PassCuts()){
00467         LeSlice = 0;
00468         LeEvent = event;
00469         LeMCevent = 0;
00470         Display(entry,0,event,0,LeAutoMat);
00471         return entry;
00472       }     
00473       event+=1;
00474     }
00475     event = 0;
00476     entry+=1;
00477     if(entry>=Nentries) break;
00478   }
00479   entry = 0;
00480   Display(0,0,0,0,LeAutoMat);
00481   return entry;
00482   
00483 }

Bool_t MadScanDisplay::PassCuts (  )  [virtual]

Definition at line 200 of file MadScanDisplay.cxx.

References NtpSRCluster::avgdev, NtpSRShower::clu, NtpTHShower::completeslc, NtpTHEvent::completeslc, MadBase::eventSummary, VldContext::GetDetector(), RecHeader::GetVldContext(), NtpSRStripPulseHeight::gev, NtpMCTruth::iaction, NtpSRCluster::id, NtpSRTrack::index, NtpSREvent::index, Detector::kNear, MadBase::LoadCluster(), MadBase::LoadEvent(), MadBase::LoadLargestShowerFromEvent(), MadBase::LoadLargestTrackFromEvent(), MadBase::LoadShowerAtTrackVertex(), MadBase::LoadTHEvent(), MadBase::LoadTHShower(), NtpSRShower::ncluster, NtpSREventSummary::nevent, NtpSREventSummary::nshower, NtpSREvent::nshower, MadBase::ntpCluster, MadBase::ntpEvent, MadBase::ntpHeader, MadBase::ntpShower, MadBase::ntpTHEvent, MadBase::ntpTHShower, MadBase::ntpTrack, MadBase::ntpTruth, NtpSREvent::ntrack, NtpSREventSummary::ntrack, NtpSRPulseHeight::pe, NtpSRCluster::ph, NtpSRCluster::planeview, NtpSRCluster::probem, NtpSREvent::slc, NtpSREvent::vtx, NtpSRTrack::vtx, NtpSRVertex::x, NtpSRVertex::y, and NtpSRVertex::z.

Referenced by NextPass(), and PrevPass().

00200                                {
00201   if(!ntpEvent) return false;
00202  
00203   //ND fid cuts
00204   if(false){
00205     if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
00206       if((ntpEvent->vtx.z<1 || ntpEvent->vtx.z>5 ||
00207           sqrt(((ntpEvent->vtx.x-1.4885)*(ntpEvent->vtx.x-1.4885)) +
00208                ((ntpEvent->vtx.y-0.1397)*(ntpEvent->vtx.y-0.1397)))>1)) {
00209         return false;
00210       }
00211       Int_t track = -1;
00212       if(LoadLargestTrackFromEvent(ntpEvent->index,track)){
00213         if((ntpTrack->vtx.z<1 || ntpTrack->vtx.z>5 ||
00214             sqrt(((ntpTrack->vtx.x-1.4885)*(ntpTrack->vtx.x-1.4885)) +
00215                  ((ntpTrack->vtx.y-0.1397)*(ntpTrack->vtx.y-0.1397)))>1)) {
00216           return false;
00217         }
00218       }
00219     }
00220   }
00221 
00222   if(false){
00223     if(LoadTHEvent(ntpEvent->index)) {
00224       if(ntpTHEvent->completeslc<0.1) {
00225         cout << "low event completeness " << ntpTHEvent->completeslc << endl;
00226         return true;    
00227       }
00228       if(ntpEvent->nshower>0) {
00229         Int_t shw_ind = -1;
00230         if( ( ntpEvent->ntrack>0 && ntpTrack &&
00231               LoadShowerAtTrackVertex(ntpEvent->index,
00232                                       ntpTrack->index,shw_ind) ) ||
00233             (ntpEvent->ntrack==0 && 
00234              LoadLargestShowerFromEvent(ntpEvent->index,shw_ind) ) ){
00235           if(LoadTHShower(shw_ind)) {
00236             if(ntpTHShower->completeslc < 0.2) {
00237               cout << "low vertex shower completeness " 
00238                    << ntpTHShower->completeslc << endl;
00239               return true;    
00240             }
00241           }
00242         }
00243       }
00244     }
00245   }
00246 
00247   if(false){
00248     if(eventSummary->nshower==1 && eventSummary->ntrack==1 &&
00249        eventSummary->nevent==1 && ntpEvent->nshower==1 && 
00250        ntpEvent->ntrack==0) return true;
00251   }
00252 
00253   //>=2 showers
00254   if(false){
00255     if(ntpEvent->nshower>1 && 
00256        ntpEvent->ntrack==0) return true;
00257   }
00258 
00259   //Two or more events/slice
00260   if(false){
00261     Int_t slice = ntpEvent->slc;
00262     Int_t ev_index = ntpEvent->index;
00263     if(LoadEvent(ev_index+1)) {      
00264       if(ntpEvent->slc==slice) {
00265         //get total charge of shower in PEs for U and V:
00266         Double_t shwChargeU = 0;
00267         Double_t shwChargeV = 0;
00268         Double_t shwChargeAsym = 0;
00269         Int_t shower = -1;
00270         if(LoadLargestShowerFromEvent(ntpEvent->index,shower)){
00271           for(int i = 0; i<ntpShower->ncluster;i++){
00272             LoadCluster(ntpShower->clu[i]);
00273             if(ntpCluster->planeview==2) shwChargeU += ntpCluster->ph.pe;
00274             else shwChargeV += ntpCluster->ph.pe;
00275           }
00276           shwChargeAsym = ( TMath::Abs(shwChargeU - shwChargeV) / 
00277                             (shwChargeU+shwChargeV) );
00278           cout << "2nd: " << shwChargeU << " " << shwChargeV << " " 
00279                << shwChargeAsym << endl;
00280         }
00281         LoadEvent(ev_index);    
00282         // first event:
00283         shwChargeU = 0;
00284         shwChargeV = 0;
00285         if(LoadLargestShowerFromEvent(ntpEvent->index,shower)){
00286           for(int i = 0; i<ntpShower->ncluster;i++){
00287             LoadCluster(ntpShower->clu[i]);
00288             if(ntpCluster->planeview==2) shwChargeU += ntpCluster->ph.pe;
00289             else shwChargeV += ntpCluster->ph.pe;
00290           }
00291           shwChargeAsym = ( TMath::Abs(shwChargeU - shwChargeV) / 
00292                             (shwChargeU+shwChargeV) );
00293           
00294           cout << "1st: " << shwChargeU << " " << shwChargeV << " " 
00295                << shwChargeAsym << endl;
00296         }
00297         cout << ">1 event in slice" << endl;
00298         return true;
00299       }
00300     }
00301     LoadEvent(ev_index);
00302   }
00303 
00304   //SubShower Cuts:
00305   if(false){
00306     Int_t shower = -1;
00307     if(eventSummary->nevent==1&&ntpEvent->nshower==1&&
00308        LoadLargestShowerFromEvent(ntpEvent->index,shower)) {
00309       int goodU = 0;
00310       int goodV = 0;
00311       double maxU = 0;
00312       double maxV = 0;
00313       double avgdevU = 1.;
00314       double avgdevV = 1.;
00315       Int_t nemclu = 0;
00316       Int_t nhadclu = 0;
00317       Int_t nphysclu = 0;
00318       
00319       Int_t *clusters = ntpShower->clu;
00320       for(int k=0; k<ntpShower->ncluster; k++){
00321         Int_t index = clusters[k];
00322         if(!LoadCluster(index)) continue;
00323         if(ntpCluster->ph.gev>0.4){
00324           if(ntpCluster->id==0) nemclu++;
00325           else if(ntpCluster->id==1) nhadclu++;
00326           else if(ntpCluster->id!=2) nphysclu++;
00327         }
00328         if(ntpCluster->planeview==2){
00329           if(ntpCluster->ph.gev>maxU){
00330             if(ntpCluster->id==0){
00331               goodU = 1;
00332               if(ntpCluster->probem>0.2) goodU=3;
00333               avgdevU = ntpCluster->avgdev;
00334               maxU = ntpCluster->ph.gev;
00335             }
00336             else {
00337               goodU = 0;
00338               avgdevU = ntpCluster->avgdev;
00339             maxU = ntpCluster->ph.gev;
00340             }
00341           }
00342         }
00343         else if(ntpCluster->planeview==3){
00344           if(ntpCluster->ph.gev>maxV){
00345             if(ntpCluster->id==0){
00346               goodV = 1;
00347               if(ntpCluster->probem>0.2) goodV=3;
00348               avgdevV = ntpCluster->avgdev;
00349               maxV = ntpCluster->ph.gev;
00350             }
00351             else {
00352               goodV = 0;
00353               avgdevV = ntpCluster->avgdev;
00354               maxV = ntpCluster->ph.gev;
00355             }
00356           }
00357         }
00358       }
00359       if((goodU==1 && goodV==1) || goodU==3 || goodV==3){
00360         cout << ntpTruth->iaction << " " 
00361              << nemclu << " " << nhadclu << " " 
00362              << nemclu+nhadclu+nphysclu << endl;
00363         return true;
00364       }
00365     }
00366   }
00367   return false;
00368 }

Int_t MadScanDisplay::PrevEvt (  ) 

Definition at line 400 of file MadScanDisplay.cxx.

References Display(), ScanFrame::EntryProc(), MadBase::GetEntry(), LeAutoMat, LeEntry, LeEvent, LeMCevent, LeSlice, MadBase::LoadEvent(), and SFrame.

00401 {
00402   //if (fHaveNeatoEvents) { return NextInterestingEvent(true); }
00403 
00404   SFrame->EntryProc();
00405   int entry = LeEntry;
00406   int event = LeEvent-1;
00407  
00408   while(this->GetEntry(entry)){
00409     while(LoadEvent(event--)) {
00410       LeSlice = 0;
00411       LeEvent = event;
00412       LeMCevent = 0;
00413       Display(entry,0,event,0,LeAutoMat);
00414       return entry;
00415     }
00416     event = 0;
00417     entry-=1;
00418     if(entry<0) break;
00419   }
00420   entry = 0;
00421   Display(0,0,0,0,LeAutoMat);
00422   
00423   return entry;
00424 }

Int_t MadScanDisplay::PrevFidNoTrk (  ) 

Definition at line 698 of file MadScanDisplay.cxx.

References Display(), NtpStRecord::evt, NtpSRRecord::evt, MadBase::GetEntry(), InFidNoTrk(), MadBase::isST, LeAutoMat, LeEntry, LeEvent, LeMCevent, LeSlice, MadBase::LoadEvent(), MadBase::record, and MadBase::strecord.

00698                                    {
00699   // override to read from list of events
00700 
00701   int entry = LeEntry;
00702   int event = LeEvent-1;
00703   
00704   while(this->GetEntry(entry)){
00705     if(event==-100){
00706       TClonesArray* pointEventArray = NULL;
00707       if(isST) pointEventArray = (strecord->evt);
00708       else pointEventArray = (record->evt);
00709       TClonesArray& eventArray = *pointEventArray;
00710       event = eventArray.GetEntries() - 1;
00711     }
00712     while(LoadEvent(event)) {
00713       if(InFidNoTrk(event)){
00714         LeSlice = 0;
00715         LeEvent = event;
00716         LeMCevent = 0;
00717         Display(entry,0,event,0,LeAutoMat);
00718         return entry;
00719       }
00720       event-=1;
00721     }
00722     event = -100;
00723     entry-=1;
00724     if(entry<0) break;
00725   }
00726   entry = 0;
00727   Display(0,0,0,0,LeAutoMat);
00728   return entry;
00729 
00730 }

Int_t MadScanDisplay::PrevFidTrk (  ) 

Definition at line 663 of file MadScanDisplay.cxx.

References Display(), NtpStRecord::evt, NtpSRRecord::evt, MadBase::GetEntry(), InFidTrk(), MadBase::isST, LeAutoMat, LeEntry, LeEvent, LeMCevent, LeSlice, MadBase::LoadEvent(), MadBase::record, and MadBase::strecord.

00663                                  {
00664   // override to read from list of events
00665  
00666   int entry = LeEntry;
00667   int event = LeEvent-1;
00668   
00669 
00670 
00671   while(this->GetEntry(entry)){
00672     if(event==-100){
00673       TClonesArray* pointEventArray = NULL;
00674       if(isST) pointEventArray = (strecord->evt);
00675       else pointEventArray = (record->evt);
00676       TClonesArray& eventArray = *pointEventArray;
00677       event = eventArray.GetEntries() - 1;
00678     }
00679     while(LoadEvent(event)) {
00680       if(InFidTrk(event)){
00681         LeSlice = 0;
00682         LeEvent = event;
00683         LeMCevent = 0;
00684         Display(entry,0,event,0,LeAutoMat);
00685         return entry;
00686       }
00687       event-=1;
00688     }
00689     event = -100;
00690     entry-=1;
00691     if(entry<0) break;
00692   }
00693   entry = 0;
00694   Display(0,0,0,0,LeAutoMat);
00695   return entry;
00696 
00697 }

Int_t MadScanDisplay::PrevPass (  ) 

Definition at line 589 of file MadScanDisplay.cxx.

References Display(), ScanFrame::EntryProc(), NtpStRecord::evt, NtpSRRecord::evt, fHaveNeatoEvents, MadBase::GetEntry(), NtpMCTruth::iaction, NtpMCTruth::inu, MadBase::isMC, MadBase::isST, MadBase::isTH, LeAction, LeAutoMat, LeEntry, LeEvent, LeMCevent, LeNu, LeSlice, MadBase::LoadEvent(), MadBase::LoadSliceForRecoTH(), MadBase::LoadTruthForRecoTH(), NextInterestingEvent(), MadBase::ntpTruth, PassCuts(), MadBase::record, SFrame, MadBase::strecord, and UseNuInfo.

00589                                {
00590   // override to read from list of events
00591  
00592   if(fHaveNeatoEvents) { return NextInterestingEvent(true); }
00593 
00594   int entry = LeEntry;
00595   int event = LeEvent-1;
00596   
00597   if(isMC&&isTH){
00598     int mcevent = 0;
00599     while(this->GetEntry(entry)){
00600       if(event==-100){ 
00601         TClonesArray* pointEventArray = NULL;
00602         if(isST) pointEventArray = (strecord->evt);
00603         else pointEventArray = (record->evt);
00604         TClonesArray& eventArray = *pointEventArray;
00605         event = eventArray.GetEntries() - 1;
00606       }
00607       while(LoadEvent(event)) {
00608         if(LoadTruthForRecoTH(event,mcevent)){
00609           if(PassCuts()&&(!UseNuInfo||(abs(ntpTruth->inu)==LeNu
00610                                        &&ntpTruth->iaction==LeAction))){
00611             int slice = 0;
00612             LoadSliceForRecoTH(event,slice);
00613             LeSlice = slice;        
00614             LeEvent = event;
00615             LeMCevent = mcevent;
00616             Display(entry,slice,event,mcevent,LeAutoMat);
00617             SFrame->EntryProc();
00618             return entry;
00619           }
00620         }
00621         event-=1;
00622       }
00623       event = -100; //to catch when we've got to last event in snarl
00624       entry -= 1;      
00625       if(entry<0) break;
00626     }
00627     entry = 0;
00628     Display(0,0,0,0,LeAutoMat);
00629     SFrame->EntryProc();
00630     return entry;
00631   }
00632 
00633   //if no MC or TH:
00634   while(this->GetEntry(entry)){
00635     if(event==-100){
00636       TClonesArray* pointEventArray = NULL;
00637       if(isST) pointEventArray = (strecord->evt);
00638       else pointEventArray = (record->evt);
00639       TClonesArray& eventArray = *pointEventArray;
00640       event = eventArray.GetEntries() - 1;
00641     }
00642     while(LoadEvent(event)) {
00643       if(PassCuts()){
00644         LeSlice = 0;
00645         LeEvent = event;
00646         LeMCevent = 0;
00647         Display(entry,0,event,0,LeAutoMat);
00648         SFrame->EntryProc();
00649         return entry;
00650       }
00651       event-=1;
00652     }
00653     event = -100;
00654     entry-=1;
00655     if(entry<0) break;
00656   }
00657   entry = 0;
00658   Display(0,0,0,0,LeAutoMat);
00659   SFrame->EntryProc();
00660   return entry;
00661 
00662 }

void MadScanDisplay::PrintDisplay (  ) 

Definition at line 156 of file MadScanDisplay.cxx.

References Nav::GetName(), MadBase::isMC, and printName.

00157 {
00158   //Print canvases
00159   TCanvas *can[6];
00160   can[0] = (TCanvas*) gROOT->FindObject("RecoCanvas");
00161   can[1] = (TCanvas*) gROOT->FindObject("MainCanvas");
00162   can[2] = (TCanvas*) gROOT->FindObject("TruthCanvas");
00163   can[3] = (TCanvas*) gROOT->FindObject("LegoCanvas");
00164   can[4] = (TCanvas*) gROOT->FindObject("ClusterCanvas");
00165   can[5] = (TCanvas*) gROOT->FindObject("StdHepDiagramCanvas");
00166   
00167   for(int i=0;i<5;i++){
00168     if(can[i]) {
00169       TString temp(can[i]->GetName());
00170       if(isMC) {
00171         temp.Append("_MC");
00172       }
00173       temp.Append(printName);
00174       can[i]->Print(temp.Data());
00175 
00176       /*
00177       // try to use TImage (TASImage actually...) to print canvases
00178       // in the hope of solving the "canvas with bit of other window" output
00179       // this didn't work... got 
00180       // <RootX11ErrorHandler>: BadMatch and canvas was covered
00181       // or
00182       // ASImage2gif():944:<MainCanvas_MC_Run10001_Snl35_Slc1_Evt1.gif>
00183       // GIF-LIB undefined error 0.
00184       // Error in <TASImage::WriteImage>: error writing file MainCanvas_MC_Run10001_Snl35_Slc1_Evt1.gif
00185 
00186       TImage* img = TImage::Create();
00187       img->FromPad(can[i]);
00188       img->WriteImage(temp.Data());
00189       delete img;
00190       */
00191     }
00192   }  
00193 }

void MadScanDisplay::PrintHSHelp (  ) 

Definition at line 4706 of file MadScanDisplay.cxx.

04707 {
04708   cout << endl;
04709   cout << endl;
04710   cout << "================= Hand Scan Info =================" << endl;
04711   cout << "Left Hand Column shows possible event ID tags:" << endl;
04712   cout << "mu    = numu CC                  -   code = 1" << endl;
04713   cout << "e     = nue CC                   -   code = 2" << endl;
04714   cout << "NC    = NC                       -   code = 3" << endl;
04715   cout << "mu/NC = numu CC / NC Ambiguity   -   code = 4" << endl;
04716   cout << "e/NC  = nue CC / NC Ambiguity    -   code = 5" << endl;
04717   cout << "???   = Complete Ambiguity       -   code = 6" << endl;
04718   cout << "N/A (all buttons red)            -   code = 0" << endl;
04719   cout << "--------------------------------------------------" << endl;
04720   cout << "Right Hand Column shows possible event topology tags:" << endl;
04721   cout << "QE                               -   code = 1" << endl;
04722   cout << "RES                              -   code = 2" << endl;
04723   cout << "DIS                              -   code = 3" << endl;
04724   cout << "???                              -   code = 4" << endl;
04725   cout << "N/A (all buttons red)            -   code = 0" << endl;
04726   cout << "--------------------------------------------------" << endl;
04727   cout << "Click 'Log Details' to write choices to text file" << endl;
04728   cout << "=================== Good Luck! ===================" << endl;
04729   cout << endl;
04730 }

bool MadScanDisplay::ReadEventsFile ( const char *  filename  ) 

Definition at line 4740 of file MadScanDisplay.cxx.

References fHaveNeatoEvents, fNeatoEvents, gSystem(), and run().

04740                                                        {
04741   // read text file listing interesting events
04742   // file format: run snarl event
04743   // blank lines and lines beginning with # are ignored
04744 
04745   //check that file exists
04746   FileStat_t buf;  
04747   if(gSystem->GetPathInfo(filename,buf) == 1) {
04748     std::cout<<"MadScanDisplay::ReadEventsFile: couldn't open "<<filename<<std::endl;
04749     return false;
04750   }
04751   else{
04752     std::cout<<"MadScanDisplay::ReadEventsFile: reading from "<<filename<<std::endl;
04753   }
04754   std::ifstream in(filename);
04755   int nread=0;
04756   std::string s;
04757   while(std::getline(in,s,'\n')){
04758 
04759     if(s=="") continue;// a blank line
04760     else if(s[0]=='#') continue; // a comment
04761     else{ 
04762       std::istringstream iss(s,std::istringstream::in);
04763       Int_t run,snarl,event;
04764       iss>>run>>snarl>>event;
04765 
04766       /*
04767       std::cout<<run<<" "<<snarl<<" "<<event;
04768       if(iss.good()) std::cout<<" good ";
04769       else std::cout<<" !good ";
04770       if(iss.eof()) std::cout<<" eof ";
04771       else std::cout<<" !eof ";
04772       std::cout<<std::endl;
04773       */
04774 
04775       // check that the read was ok
04776       if(iss.good() || iss.eof()){ 
04777         std::vector<Int_t> v(3); v[0]=run; v[1]=snarl; v[2]=event;
04778         fNeatoEvents.push_back(v);
04779         nread++;
04780       }
04781     }
04782   }
04783   std::cout<<"MadScanDisplay::ReadEventsFile read "<<nread<<" events."<<std::endl;
04784   if(nread>0) fHaveNeatoEvents=true;
04785   return true;
04786 }

Float_t MadScanDisplay::RecoMKMuEnergy ( Int_t &  opt,
Int_t  itrk,
bool  isdata = true 
)

Definition at line 4841 of file MadScanDisplay.cxx.

References EnergyCorrections::CorrectMomentumFromRange(), NtpSRFiducial::dr, NtpSRFiducial::dz, NtpSRTrack::fidall, MadBase::LoadTrack(), NtpSRTrack::momentum, MadBase::ntpTrack, NtpSRMomentum::qp, and NtpSRMomentum::range.

Referenced by DrawTextBox().

04841                                                                         {
04842   
04843   if(LoadTrack(itrk)){
04844      float mr=ntpTrack->momentum.range;
04845      mr=CorrectMomentumFromRange(mr,isdata);
04846     if(opt==0){  
04847       //return the most appropriate measure of momentum
04848       // assign opt based on our choice
04849       if(ntpTrack->fidall.dr>0.5&&ntpTrack->fidall.dz>0.5) {
04850         opt=2;
04851         return sqrt(mr*mr+ 0.10555*0.10555);
04852       }
04853       else {
04854         opt=1;
04855         // in R1.9 the tracker will apparently return (q/p)=0.0
04856         // maybe it's when a track looks perfectly rigid?
04857         // if so, we have to do something
04858         // I don't want to use the range, that could be very wrong
04859         // but wrong in a more subtle way ...
04860         // so, we'll return an obviously ridiculous value of 10 TeV
04861         if(ntpTrack->momentum.qp == 0.0) return 10000.0; 
04862         else return sqrt(1./(ntpTrack->momentum.qp*ntpTrack->momentum.qp)
04863                          + 0.10555*0.10555);
04864       }
04865     }
04866     else if(opt==1) { //return curvature measurement
04867         if(ntpTrack->momentum.qp == 0.0) return 10000.0; 
04868         else return sqrt(1./(ntpTrack->momentum.qp*ntpTrack->momentum.qp)
04869                          + 0.10555*0.10555);
04870     }
04871     else if(opt==2) //return range measurement
04872       return sqrt(mr*mr + 0.10555*0.10555);
04873     else return 0;
04874   }
04875   return 0.;
04876 }

Float_t MadScanDisplay::RecoMuDCosNeuFD ( Int_t  itr = 0,
Float_t *  vtx = 0 
)

Definition at line 4879 of file MadScanDisplay.cxx.

References NtpSRVertex::dcosy, NtpSRVertex::dcosz, MadBase::LoadTrack(), MadBase::ntpTrack, and NtpSRTrack::vtx.

Referenced by DrawTextBox().

04879                                                                     {
04880   if(!LoadTrack(itr)) return 0.;
04881 
04882   Float_t bl_z = TMath::Cos(TMath::Pi()*3./180.); //3degree beam
04883   Float_t bl_y = sqrt(1. - bl_z*bl_z);
04884   Float_t costhbl = ntpTrack->vtx.dcosz*bl_z + ntpTrack->vtx.dcosy*bl_y;
04885   
04886   return  costhbl;
04887 }

Float_t MadScanDisplay::RecoMuDCosNeuND ( Int_t  itr = 0,
Float_t *  vtx = 0 
)

Definition at line 4889 of file MadScanDisplay.cxx.

References NtpSRVertex::dcosy, NtpSRVertex::dcosz, MadBase::LoadTrack(), MadBase::ntpTrack, and NtpSRTrack::vtx.

Referenced by DrawTextBox().

04889                                                                     {
04890   if(!LoadTrack(itr)) return 0.;
04891   /*
04892    // simple correction based on the vertical position
04893   float vtxy=0;
04894   if(vtx) vtxy=vtx[1]; // in meters
04895   // cosine of the typical neutrino angle in the yz plane
04896   // calculated as py / sqrt( py^2 + pz^2)
04897   float nu_cos = -5.799E-2;
04898   if(vtxy>-2.0 && vtxy<2.0){ //prevents further nuttyness if vtxy is silly
04899     nu_cos += vtxy*1.23304E-3 
04900       + vtxy*vtxy*1.08212E-5 
04901       + vtxy*vtxy*vtxy*(-4.634E-5);
04902   }
04903   */
04904   float nu_cos = -5.799E-2;
04905   float nu_sin = sqrt(1 -nu_cos*nu_cos);
04906   float cosz = ntpTrack->vtx.dcosz*nu_sin + ntpTrack->vtx.dcosy*nu_cos;
04907 
04908   return cosz;
04909 
04910 }

void MadScanDisplay::ROICalc (  ) 

Definition at line 4912 of file MadScanDisplay.cxx.

References PlaneView::kU, MadBase::LoadSlice(), MadBase::LoadStrip(), nbuf, NtpSREvent::nstrip, NtpSRSlice::nstrip, MadBase::ntpEvent, MadBase::ntpSlice, MadBase::ntpStrip, ScanFrame::PassFloat(), NtpSRPulseHeight::pe, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRStrip::planeview, SFrame, NtpSREvent::slc, NtpSREvent::stp, NtpSRSlice::stp, NtpSRStrip::strip, NtpSRStrip::tpos, and NtpSRStrip::z.

04912                             {
04913  
04914   TH2 * utz_place  = (TH2*) gROOT->FindObject("tz_place_0");
04915   TH2 * vtz_place =  (TH2*) gROOT->FindObject("tz_place_1");
04916  
04917   Double_t tmin_U=0; 
04918   Double_t tmax_U=0; 
04919   Double_t zmin_U=0; 
04920   Double_t zmax_U=0; 
04921   Double_t tmin_V=0; 
04922   Double_t tmax_V=0; 
04923   Double_t zmin_V=0; 
04924   Double_t zmax_V=0;  
04925 
04926   if(utz_place && vtz_place){
04927     int firstbin = utz_place->GetXaxis()->GetFirst();
04928     int lastbin = utz_place->GetXaxis()->GetLast();
04929     zmin_U = utz_place->GetXaxis()->GetXmin()+utz_place->GetXaxis()->GetBinWidth(0)*(firstbin-1);
04930     zmax_U = utz_place->GetXaxis()->GetXmin()+utz_place->GetXaxis()->GetBinWidth(0)*(lastbin-1);
04931 
04932     firstbin = utz_place->GetYaxis()->GetFirst();
04933     lastbin = utz_place->GetYaxis()->GetLast();
04934     tmin_U = utz_place->GetYaxis()->GetXmin()+utz_place->GetYaxis()->GetBinWidth(0)*(firstbin-1);
04935     tmax_U = utz_place->GetYaxis()->GetXmin()+utz_place->GetYaxis()->GetBinWidth(0)*(lastbin-1);
04936 
04937     firstbin = vtz_place->GetXaxis()->GetFirst();
04938     lastbin = vtz_place->GetXaxis()->GetLast();
04939     zmin_V = vtz_place->GetXaxis()->GetXmin()+vtz_place->GetXaxis()->GetBinWidth(0)*(firstbin-1);
04940     zmax_V = vtz_place->GetXaxis()->GetXmin()+vtz_place->GetXaxis()->GetBinWidth(0)*(lastbin-1);
04941 
04942     firstbin = vtz_place->GetYaxis()->GetFirst();
04943     lastbin = vtz_place->GetYaxis()->GetLast();
04944     tmin_V = vtz_place->GetYaxis()->GetXmin()+vtz_place->GetYaxis()->GetBinWidth(0)*(firstbin-1);
04945     tmax_V = vtz_place->GetYaxis()->GetXmin()+vtz_place->GetYaxis()->GetBinWidth(0)*(lastbin-1);
04946   }
04947   
04948   double slcPH=0;
04949   if(ntpEvent){
04950     LoadSlice(ntpEvent->slc);
04951     if(ntpSlice){
04952       for(int i=0;i<ntpSlice->nstrip;i++){
04953         if(!LoadStrip(ntpSlice->stp[i])) continue;
04954         Double_t zstp = ntpStrip->z;
04955         Double_t tstp = ntpStrip->tpos;
04956         Double_t ph = ntpStrip->ph1.pe + ntpStrip->ph0.pe;
04957         if(ntpStrip->planeview==PlaneView::kU){
04958           if(zstp>=zmin_U && zstp<=zmax_U && tstp>=tmin_U && tstp<=tmax_U){
04959             slcPH+=ph;
04960           }
04961         }
04962         else{
04963           if(zstp>=zmin_V && zstp<=zmax_V && tstp>=tmin_V && tstp<=tmax_V) {
04964             slcPH+=ph;
04965           }
04966           } 
04967       }
04968     }
04969     double evtPH=0;
04970     int stripbuf[10000] ; int planebuf[10000];
04971     int nbuf=0;
04972     for(int i=0;i<ntpEvent->nstrip;i++){
04973       if(!LoadStrip(ntpEvent->stp[i])) continue;
04974       bool used=false;
04975       for(int j=0;j<nbuf;j++){
04976         if(stripbuf[j]==ntpStrip->strip && planebuf[j]==ntpStrip->plane) used=true;
04977       }
04978       stripbuf[nbuf]=ntpStrip->strip; planebuf[nbuf]=ntpStrip->plane;
04979       nbuf++;
04980       if(!used){
04981         Double_t ztrk = ntpStrip->z;
04982         Double_t ttrk = ntpStrip->tpos;
04983         Double_t ph = ntpStrip->ph1.pe + ntpStrip->ph0.pe;
04984         if(ntpStrip->planeview==PlaneView::kU){
04985           if(ztrk>=zmin_U && ztrk<=zmax_U && ttrk>=tmin_U && ttrk<=tmax_U) {
04986             evtPH+=ph;
04987           }
04988 
04989         }
04990         else{
04991           if(ztrk>=zmin_V && ztrk<=zmax_V && ttrk>=tmin_V && ttrk<=tmax_V) {
04992             evtPH+=ph;
04993           }
04994         }
04995       }
04996     }
04997     double phlost = 0;
04998     if(slcPH-evtPH>0) phlost=slcPH-evtPH;
04999     SFrame->PassFloat("ShwLostPH",phlost);
05000     
05001   }
05002 }

void MadScanDisplay::SetDefaultShowerMarkerColor ( Int_t  col  )  [inline]

Definition at line 92 of file MadScanDisplay.h.

References fDefaultShowerMarkerColor.

void MadScanDisplay::SetDefaultShowerMarkerStyle ( Int_t  style  )  [inline]

Definition at line 93 of file MadScanDisplay.h.

References fDefaultShowerMarkerStyle.

void MadScanDisplay::SetDVals ( Float_t  spe_val,
Float_t  mid_val 
)

Definition at line 150 of file MadScanDisplay.cxx.

References Dmid_val, and Dspe_val.

00151 {
00152   Dspe_val = spe_val;
00153   Dmid_val = mid_val; 
00154 }

void MadScanDisplay::SetMessages ( Bool_t  yesno = true  )  [inline]

Definition at line 51 of file MadScanDisplay.h.

References ptt_msg.

00051 {ptt_msg=yesno;} //print extra info?

void MadScanDisplay::SetPrintOpt ( char *  opt  ) 

Definition at line 195 of file MadScanDisplay.cxx.

References printOpt.

00195                                          {
00196   sprintf(printOpt,"%s",opt);
00197   //  this->Display(LeEntry,LeSlice,LeEvent,LeMCevent,LeAutoMat);
00198 }

void MadScanDisplay::ShwROICalc (  ) 

Definition at line 5003 of file MadScanDisplay.cxx.

References PlaneView::kU, MadBase::LoadShower(), MadBase::LoadStrip(), NtpSREvent::nshower, NtpSRShower::nstrip, MadBase::ntpEvent, MadBase::ntpShower, MadBase::ntpStrip, ScanFrame::PassFloat(), NtpSRPulseHeight::pe, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::planeview, SFrame, NtpSREvent::shw, NtpSRShower::stp, NtpSRStrip::tpos, and NtpSRStrip::z.

05003                                {
05004  
05005   TH2 * utz_place  = (TH2*) gROOT->FindObject("tz_place_0");
05006   TH2 * vtz_place =  (TH2*) gROOT->FindObject("tz_place_1");
05007  
05008   Double_t tmin_U=0; 
05009   Double_t tmax_U=0; 
05010   Double_t zmin_U=0; 
05011   Double_t zmax_U=0; 
05012   Double_t tmin_V=0; 
05013   Double_t tmax_V=0; 
05014   Double_t zmin_V=0; 
05015   Double_t zmax_V=0;  
05016 
05017   if(utz_place && vtz_place){
05018     int firstbin = utz_place->GetXaxis()->GetFirst();
05019     int lastbin = utz_place->GetXaxis()->GetLast();
05020     zmin_U = utz_place->GetXaxis()->GetXmin()+utz_place->GetXaxis()->GetBinWidth(0)*(firstbin-1);
05021     zmax_U = utz_place->GetXaxis()->GetXmin()+utz_place->GetXaxis()->GetBinWidth(0)*(lastbin-1);
05022 
05023     firstbin = utz_place->GetYaxis()->GetFirst();
05024     lastbin = utz_place->GetYaxis()->GetLast();
05025     tmin_U = utz_place->GetYaxis()->GetXmin()+utz_place->GetYaxis()->GetBinWidth(0)*(firstbin-1);
05026     tmax_U = utz_place->GetYaxis()->GetXmin()+utz_place->GetYaxis()->GetBinWidth(0)*(lastbin-1);
05027 
05028     firstbin = vtz_place->GetXaxis()->GetFirst();
05029     lastbin = vtz_place->GetXaxis()->GetLast();
05030     zmin_V = vtz_place->GetXaxis()->GetXmin()+vtz_place->GetXaxis()->GetBinWidth(0)*(firstbin-1);
05031     zmax_V = vtz_place->GetXaxis()->GetXmin()+vtz_place->GetXaxis()->GetBinWidth(0)*(lastbin-1);
05032 
05033     firstbin = vtz_place->GetYaxis()->GetFirst();
05034     lastbin = vtz_place->GetYaxis()->GetLast();
05035     tmin_V = vtz_place->GetYaxis()->GetXmin()+vtz_place->GetYaxis()->GetBinWidth(0)*(firstbin-1);
05036     tmax_V = vtz_place->GetYaxis()->GetXmin()+vtz_place->GetYaxis()->GetBinWidth(0)*(lastbin-1);
05037   }
05038   
05039   double shwPH=0;
05040   if(ntpEvent){
05041     int *showers = ntpEvent->shw;
05042     for(int i=0;i<ntpEvent->nshower;i++){
05043       int index = showers[i];
05044       LoadShower(index);
05045     }
05046     for(int i=0;i<ntpShower->nstrip;i++){
05047       if(!LoadStrip(ntpShower->stp[i])) continue;
05048       Double_t zshw = ntpStrip->z;
05049       Double_t tshw = ntpStrip->tpos;
05050       Double_t ph = ntpStrip->ph1.pe + ntpStrip->ph0.pe;
05051       if(ntpStrip->planeview==PlaneView::kU){
05052         if(zshw>=zmin_U && zshw<=zmax_U && tshw>=tmin_U && tshw<=tmax_U) {
05053           shwPH+=ph;
05054         }
05055       }
05056       else{
05057         if(zshw>=zmin_V && zshw<=zmax_V && tshw>=tmin_V && tshw<=tmax_V) {
05058           shwPH+=ph;
05059         }
05060       }
05061     }
05062   }
05063   SFrame->PassFloat("ShwExtraPH",shwPH);
05064   
05065 }

Int_t MadScanDisplay::SkipTo (  ) 

Definition at line 732 of file MadScanDisplay.cxx.

References Display(), LeAutoMat, and MadBase::Nentries.

00733 {
00734  
00735   Int_t sp = 0;
00736   std::cout << "Enter tree entry number to jump to" << std::endl;
00737   std::cin >> sp;
00738   if(sp<0||sp>Nentries) sp=0;
00739   std::cout << sp << std::endl;
00740   Display(sp,0,0,0,LeAutoMat);
00741   return sp;
00742 
00743 }

void MadScanDisplay::StartLogger (  ) 

Definition at line 4563 of file MadScanDisplay.cxx.

Referenced by DrawButtons().

04564 {
04565 
04566   TButton *but1 = new TButton("mu",
04567                               "EVD->ScanID=1; EVD->ChangeLogButColor();",
04568                               0.,0.8875,0.1275,0.95);
04569   but1->SetTextSize(0.6);
04570   but1->SetFillColor(2);
04571   but1->SetName("logBut1");
04572   
04573   TButton *but2 = new TButton("e",
04574                               "EVD->ScanID=2; EVD->ChangeLogButColor();",
04575                               0.,0.825,0.1275,0.8875);
04576   but2->SetTextSize(0.6);
04577   but2->SetFillColor(2);
04578   but2->SetName("logBut2");
04579   
04580   TButton *but3 = new TButton("NC",
04581                               "EVD->ScanID=3; EVD->ChangeLogButColor();",
04582                               0.,0.7625,0.1275,0.825);
04583   but3->SetTextSize(0.6);
04584   but3->SetFillColor(2);
04585   but3->SetName("logBut3");
04586   
04587   TButton *but4 = new TButton("mu/NC?",
04588                               "EVD->ScanID=4; EVD->ChangeLogButColor();",
04589                               0.,0.70,0.1275,0.7625);
04590   but4->SetTextSize(0.6);
04591   but4->SetFillColor(2);
04592   but4->SetName("logBut4");
04593   
04594   TButton *but5 = new TButton("e/NC?",
04595                               "EVD->ScanID=5; EVD->ChangeLogButColor();",
04596                               0.,0.6375,0.1275,0.7);
04597   but5->SetTextSize(0.6);
04598   but5->SetFillColor(2);
04599   but5->SetName("logBut5");
04600   
04601   TButton *but6 = new TButton("???",
04602                               "EVD->ScanID=6; EVD->ChangeLogButColor();",
04603                               0.,0.575,0.1275,0.6375);
04604   but6->SetTextSize(0.6);
04605   but6->SetFillColor(2);
04606   but6->SetName("logBut6");
04607 
04608   TButton *but8 = new TButton("QE",
04609                               "EVD->ScanTop=1; EVD->ChangeLogButColor();",
04610                               0.1275,0.85625,0.195,0.95);
04611   but8->SetTextSize(0.4);
04612   but8->SetFillColor(2);
04613   but8->SetName("logBut8");
04614   
04615   TButton *but9 = new TButton("RES",
04616                               "EVD->ScanTop=2; EVD->ChangeLogButColor();",
04617                               0.1275,0.7625,0.195,0.85625);
04618   but9->SetTextSize(0.4);
04619   but9->SetFillColor(2);
04620   but9->SetName("logBut9");
04621   
04622   TButton *but10 = new TButton("DIS",
04623                                "EVD->ScanTop=3; EVD->ChangeLogButColor();",
04624                                0.1275,0.66875,0.195,0.7625);
04625   but10->SetTextSize(0.4);
04626   but10->SetFillColor(2);
04627   but10->SetName("logBut10");
04628 
04629   TButton *but11 = new TButton("???",
04630                               "EVD->ScanTop=4; EVD->ChangeLogButColor();",
04631                               0.1275,0.575,0.195,0.66875);
04632   but11->SetTextSize(0.4);
04633   but11->SetFillColor(2);
04634   but11->SetName("logBut11");
04635     
04636   TButton *but12 = new TButton("Log Details","EVD->Log();",
04637                                0.,0.5,0.195,0.575);
04638   but12->SetTextSize(0.6);
04639   but12->SetFillColor(4);
04640 
04641   TButton *but7 = new TButton("Click for Info",
04642                                "EVD->PrintHSHelp();",
04643                                0.,0.95,0.195,1.0);
04644   but7->SetTextSize(0.6);
04645   but7->SetFillColor(45);
04646     
04647   but1->Draw();
04648   but2->Draw();
04649   but3->Draw();
04650   but4->Draw();
04651   but5->Draw();
04652   but6->Draw();
04653   but7->Draw();
04654   but8->Draw();
04655   but9->Draw();
04656   but10->Draw();
04657   but11->Draw();
04658   but12->Draw();
04659 }


Member Data Documentation

Float_t MadScanDisplay::Dmid_val [protected]

Definition at line 19 of file MadScanDisplay.h.

Referenced by Display(), DrawKey(), DrawKey2(), MadScanDisplay(), and SetDVals().

Definition at line 74 of file MadScanDisplay.h.

Referenced by Display(), DrawButtons(), and MadScanDisplay().

Float_t MadScanDisplay::Dspe_val [protected]

Definition at line 18 of file MadScanDisplay.h.

Referenced by Display(), DrawKey(), DrawKey2(), MadScanDisplay(), and SetDVals().

Definition at line 81 of file MadScanDisplay.h.

Referenced by Display(), and MadScanDisplay().

Definition at line 103 of file MadScanDisplay.h.

Referenced by Display(), and SetDefaultShowerMarkerColor().

Definition at line 104 of file MadScanDisplay.h.

Referenced by Display(), and SetDefaultShowerMarkerStyle().

Definition at line 101 of file MadScanDisplay.h.

Referenced by NextPass(), PrevPass(), and ReadEventsFile().

Definition at line 102 of file MadScanDisplay.h.

Referenced by NextInterestingEvent().

std::vector< std::vector<Int_t> > MadScanDisplay::fNeatoEvents [private]

Definition at line 100 of file MadScanDisplay.h.

Referenced by NextInterestingEvent(), and ReadEventsFile().

Definition at line 105 of file MadScanDisplay.h.

Referenced by MadScanDisplay().

Definition at line 77 of file MadScanDisplay.h.

Referenced by Display(), DrawButtons(), EnableHandScan(), and MadScanDisplay().

Definition at line 65 of file MadScanDisplay.h.

Referenced by DrawButtons(), MadScanDisplay(), NextPass(), and PrevPass().

Definition at line 67 of file MadScanDisplay.h.

Referenced by Display(), DrawButtons(), and MadScanDisplay().

Definition at line 66 of file MadScanDisplay.h.

Referenced by Display(), DrawButtons(), and MadScanDisplay().

Definition at line 64 of file MadScanDisplay.h.

Referenced by DrawButtons(), MadScanDisplay(), NextPass(), and PrevPass().

Definition at line 80 of file MadScanDisplay.h.

Referenced by EnableHandScan(), Log(), and MadScanDisplay().

char MadScanDisplay::printName[100] [protected]

Definition at line 15 of file MadScanDisplay.h.

Referenced by Display(), and PrintDisplay().

char MadScanDisplay::printOpt[10] [protected]

Definition at line 16 of file MadScanDisplay.h.

Referenced by Display(), MadScanDisplay(), and SetPrintOpt().

Bool_t MadScanDisplay::ptt_msg [protected]

Definition at line 21 of file MadScanDisplay.h.

Referenced by Display(), MadScanDisplay(), and SetMessages().

Definition at line 78 of file MadScanDisplay.h.

Referenced by ChangeLogButColor(), Display(), Log(), and MadScanDisplay().

Definition at line 79 of file MadScanDisplay.h.

Referenced by ChangeLogButColor(), Display(), Log(), and MadScanDisplay().

Definition at line 72 of file MadScanDisplay.h.

Referenced by DrawButtons(), MadScanDisplay(), NextPass(), and PrevPass().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1