00001 #ifndef madevdisplay_cxx
00002 #define madevdisplay_cxx
00003 #include <cstring>
00004 #include <iostream>
00005 #include <fstream>
00006 #include <sstream>
00007
00008 #include "TClonesArray.h"
00009 #include "TH2.h"
00010 #include "TGraph.h"
00011 #include "TMultiGraph.h"
00012 #include "TStyle.h"
00013 #include "TCanvas.h"
00014 #include "TVector3.h"
00015 #include "TArrow.h"
00016 #include "TPolyLine.h"
00017 #include "TEllipse.h"
00018 #include "TButton.h"
00019 #include "TLatex.h"
00020 #include "TMarker.h"
00021 #include "TMath.h"
00022 #include "TPave.h"
00023 #include "TPaveText.h"
00024 #include "TLegend.h"
00025 #include "TSystem.h"
00026 #include "TImage.h"
00027
00028 #include "Validity/VldContext.h"
00029 #include "Conventions/Detector.h"
00030 #include "Conventions/Munits.h"
00031 #include "CandSubShowerSR/ClusterType.h"
00032 #include "Conventions/PlaneView.h"
00033 #include "DataUtil/PlaneOutline.h"
00034
00035 #include "Mad/MadEvDisplay.h"
00036 #include "DataUtil/EnergyCorrections.h"
00037 #include "Mad/MadMKAnalysis.h"
00038
00039 using namespace EnergyCorrections;
00040
00041 MadEvDisplay::MadEvDisplay(TChain *chainSR,TChain *chainMC,
00042 TChain *chainTH,TChain *chainEM) : fHaveNeatoEvents(false), fNeatoEventIdx(-1), fDefaultShowerMarkerColor(6), fDefaultShowerMarkerStyle(4)
00043 {
00044
00045 Dspe_val = 2.0;
00046 Dmid_val = 20.0;
00047 ptt_msg = false;
00048 UseNuInfo = false;
00049
00050 LeNu = 14;
00051 LeAction = 1;
00052 LeLego = false;
00053 LeClus = false;
00054 LeEvent = 0;
00055 LeSlice = 0;
00056 LeMCevent = 0;
00057 LeEntry = 0;
00058 LeAutoMat = true;
00059 drawSAME = false;
00060
00061 handScan = false;
00062 ScanID = 0;
00063 ScanTop = 0;
00064 sprintf(logFileName,"handScan.dat");
00065
00066 sprintf(printOpt,"gif");
00067
00068
00069
00070 if(!chainSR) {
00071 record = 0;
00072 emrecord = 0;
00073 mcrecord = 0;
00074 threcord = 0;
00075 Clear();
00076 whichSource = -1;
00077 isMC = true;
00078 isTH = true;
00079 isEM = true;
00080 Nentries = -1;
00081 return;
00082 }
00083
00084 InitChain(chainSR,chainMC,chainTH,chainEM, true);
00085 whichSource = 0;
00086
00087 }
00088
00089 MadEvDisplay::MadEvDisplay(JobC *j,string path,int entries) : fHaveNeatoEvents(false), fNeatoEventIdx(-1), fDefaultShowerMarkerColor(6), fDefaultShowerMarkerStyle(4)
00090 {
00091
00092 Dspe_val = 2.0;
00093 Dmid_val = 20.0;
00094 ptt_msg = false;
00095 UseNuInfo = false;
00096
00097 LeNu = 14;
00098 LeAction = 1;
00099 LeLego = false;
00100 LeClus = false;
00101 LeEvent = 0;
00102 LeSlice = 0;
00103 LeMCevent = 0;
00104 LeEntry = 0;
00105 LeAutoMat = true;
00106 drawSAME = false;
00107
00108 handScan = false;
00109 ScanID = 0;
00110 ScanTop = 0;
00111 sprintf(logFileName,"handScan.dat");
00112
00113 sprintf(printOpt,"gif");
00114
00115
00116
00117 record = 0;
00118 emrecord = 0;
00119 mcrecord = 0;
00120 threcord = 0;
00121 Clear();
00122 isMC = true;
00123 isTH = true;
00124 isEM = true;
00125 Nentries = entries;
00126 jcPath = path;
00127 whichSource = 1;
00128 fCurRun = -1;
00129 fJC = j;
00130 fChain = NULL;
00131
00132 }
00133
00134 MadEvDisplay::~MadEvDisplay()
00135 {
00136 }
00137
00138 void MadEvDisplay::SetDVals(Float_t spe_val,Float_t mid_val)
00139 {
00140 Dspe_val = spe_val;
00141 Dmid_val = mid_val;
00142 }
00143
00144 void MadEvDisplay::PrintDisplay()
00145 {
00146
00147 TCanvas *can[6];
00148 can[0] = (TCanvas*) gROOT->FindObject("RecoCanvas");
00149 can[1] = (TCanvas*) gROOT->FindObject("MainCanvas");
00150 can[2] = (TCanvas*) gROOT->FindObject("TruthCanvas");
00151 can[3] = (TCanvas*) gROOT->FindObject("LegoCanvas");
00152 can[4] = (TCanvas*) gROOT->FindObject("ClusterCanvas");
00153 can[5] = (TCanvas*) gROOT->FindObject("StdHepDiagramCanvas");
00154
00155 for(int i=0;i<6;i++){
00156 if(can[i]) {
00157 TString temp(can[i]->GetName());
00158 if(isMC) {
00159 temp.Append("_MC");
00160 }
00161 temp.Append(printName);
00162 can[i]->Print(temp.Data());
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 }
00180 }
00181 }
00182
00183 void MadEvDisplay::SetPrintOpt(char *opt){
00184 sprintf(printOpt,"%s",opt);
00185
00186 }
00187
00188 Bool_t MadEvDisplay::PassCuts(){
00189 if(!ntpEvent) return false;
00190
00191
00192 if(false){
00193 if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
00194 if((ntpEvent->vtx.z<1 || ntpEvent->vtx.z>5 ||
00195 sqrt(((ntpEvent->vtx.x-1.4885)*(ntpEvent->vtx.x-1.4885)) +
00196 ((ntpEvent->vtx.y-0.1397)*(ntpEvent->vtx.y-0.1397)))>1)) {
00197 return false;
00198 }
00199 Int_t track = -1;
00200 if(LoadLargestTrackFromEvent(ntpEvent->index,track)){
00201 if((ntpTrack->vtx.z<1 || ntpTrack->vtx.z>5 ||
00202 sqrt(((ntpTrack->vtx.x-1.4885)*(ntpTrack->vtx.x-1.4885)) +
00203 ((ntpTrack->vtx.y-0.1397)*(ntpTrack->vtx.y-0.1397)))>1)) {
00204 return false;
00205 }
00206 }
00207 }
00208 }
00209
00210 if(false){
00211 if(LoadTHEvent(ntpEvent->index)) {
00212 if(ntpTHEvent->completeslc<0.1) {
00213 cout << "low event completeness " << ntpTHEvent->completeslc << endl;
00214 return true;
00215 }
00216 if(ntpEvent->nshower>0) {
00217 Int_t shw_ind = -1;
00218 if( ( ntpEvent->ntrack>0 && ntpTrack &&
00219 LoadShowerAtTrackVertex(ntpEvent->index,
00220 ntpTrack->index,shw_ind) ) ||
00221 (ntpEvent->ntrack==0 &&
00222 LoadLargestShowerFromEvent(ntpEvent->index,shw_ind) ) ){
00223 if(LoadTHShower(shw_ind)) {
00224 if(ntpTHShower->completeslc < 0.2) {
00225 cout << "low vertex shower completeness "
00226 << ntpTHShower->completeslc << endl;
00227 return true;
00228 }
00229 }
00230 }
00231 }
00232 }
00233 }
00234
00235 if(false){
00236 if(eventSummary->nshower==1 && eventSummary->ntrack==1 &&
00237 eventSummary->nevent==1 && ntpEvent->nshower==1 &&
00238 ntpEvent->ntrack==0) return true;
00239 }
00240
00241
00242 if(false){
00243 if(ntpEvent->nshower>1 &&
00244 ntpEvent->ntrack==0) return true;
00245 }
00246
00247
00248 if(false){
00249 Int_t slice = ntpEvent->slc;
00250 Int_t ev_index = ntpEvent->index;
00251 if(LoadEvent(ev_index+1)) {
00252 if(ntpEvent->slc==slice) {
00253
00254 Double_t shwChargeU = 0;
00255 Double_t shwChargeV = 0;
00256 Double_t shwChargeAsym = 0;
00257 Int_t shower = -1;
00258 if(LoadLargestShowerFromEvent(ntpEvent->index,shower)){
00259 for(int i = 0; i<ntpShower->ncluster;i++){
00260 LoadCluster(ntpShower->clu[i]);
00261 if(ntpCluster->planeview==2) shwChargeU += ntpCluster->ph.pe;
00262 else shwChargeV += ntpCluster->ph.pe;
00263 }
00264 shwChargeAsym = ( TMath::Abs(shwChargeU - shwChargeV) /
00265 (shwChargeU+shwChargeV) );
00266 cout << "2nd: " << shwChargeU << " " << shwChargeV << " "
00267 << shwChargeAsym << endl;
00268 }
00269 LoadEvent(ev_index);
00270
00271 shwChargeU = 0;
00272 shwChargeV = 0;
00273 if(LoadLargestShowerFromEvent(ntpEvent->index,shower)){
00274 for(int i = 0; i<ntpShower->ncluster;i++){
00275 LoadCluster(ntpShower->clu[i]);
00276 if(ntpCluster->planeview==2) shwChargeU += ntpCluster->ph.pe;
00277 else shwChargeV += ntpCluster->ph.pe;
00278 }
00279 shwChargeAsym = ( TMath::Abs(shwChargeU - shwChargeV) /
00280 (shwChargeU+shwChargeV) );
00281
00282 cout << "1st: " << shwChargeU << " " << shwChargeV << " "
00283 << shwChargeAsym << endl;
00284 }
00285 cout << ">1 event in slice" << endl;
00286 return true;
00287 }
00288 }
00289 LoadEvent(ev_index);
00290 }
00291
00292
00293 if(false){
00294 Int_t shower = -1;
00295 if(eventSummary->nevent==1&&ntpEvent->nshower==1&&
00296 LoadLargestShowerFromEvent(ntpEvent->index,shower)) {
00297 int goodU = 0;
00298 int goodV = 0;
00299 double maxU = 0;
00300 double maxV = 0;
00301 double avgdevU = 1.;
00302 double avgdevV = 1.;
00303 Int_t nemclu = 0;
00304 Int_t nhadclu = 0;
00305 Int_t nphysclu = 0;
00306
00307 Int_t *clusters = ntpShower->clu;
00308 for(int k=0; k<ntpShower->ncluster; k++){
00309 Int_t index = clusters[k];
00310 if(!LoadCluster(index)) continue;
00311 if(ntpCluster->ph.gev>0.4){
00312 if(ntpCluster->id==0) nemclu++;
00313 else if(ntpCluster->id==1) nhadclu++;
00314 else if(ntpCluster->id!=2) nphysclu++;
00315 }
00316 if(ntpCluster->planeview==2){
00317 if(ntpCluster->ph.gev>maxU){
00318 if(ntpCluster->id==0){
00319 goodU = 1;
00320 if(ntpCluster->probem>0.2) goodU=3;
00321 avgdevU = ntpCluster->avgdev;
00322 maxU = ntpCluster->ph.gev;
00323 }
00324 else {
00325 goodU = 0;
00326 avgdevU = ntpCluster->avgdev;
00327 maxU = ntpCluster->ph.gev;
00328 }
00329 }
00330 }
00331 else if(ntpCluster->planeview==3){
00332 if(ntpCluster->ph.gev>maxV){
00333 if(ntpCluster->id==0){
00334 goodV = 1;
00335 if(ntpCluster->probem>0.2) goodV=3;
00336 avgdevV = ntpCluster->avgdev;
00337 maxV = ntpCluster->ph.gev;
00338 }
00339 else {
00340 goodV = 0;
00341 avgdevV = ntpCluster->avgdev;
00342 maxV = ntpCluster->ph.gev;
00343 }
00344 }
00345 }
00346 }
00347 if((goodU==1 && goodV==1) || goodU==3 || goodV==3){
00348 cout << ntpTruth->iaction << " "
00349 << nemclu << " " << nhadclu << " "
00350 << nemclu+nhadclu+nphysclu << endl;
00351 return true;
00352 }
00353 }
00354 }
00355 return false;
00356 }
00357
00358 Int_t MadEvDisplay::NextPass() {
00359
00360 if(fHaveNeatoEvents) { return NextInterestingEvent(); }
00361
00362 int entry = LeEntry;
00363 int event = LeEvent+1;
00364
00365 if(isMC&&isTH){
00366 int mcevent = 0;
00367 while(this->GetEntry(entry)){
00368 while(LoadEvent(event)) {
00369 if(LoadTruthForRecoTH(event,mcevent)){
00370 if(PassCuts()&&(!UseNuInfo||(abs(ntpTruth->inu)==LeNu
00371 &&ntpTruth->iaction==LeAction))){
00372 int slice = 0;
00373 LoadSliceForRecoTH(event,slice);
00374 LeSlice = slice;
00375 LeEvent = event;
00376 LeMCevent = mcevent;
00377 Display(entry,slice,event,mcevent,LeAutoMat);
00378 return entry;
00379 }
00380 }
00381 event+=1;
00382 }
00383 event = 0;
00384 entry+=1;
00385 if(entry>=Nentries) break;
00386 }
00387 entry = 0;
00388 Display(0,0,0,0,LeAutoMat);
00389 return entry;
00390 }
00391
00392
00393 while(this->GetEntry(entry)){
00394 while(LoadEvent(event)) {
00395 if(PassCuts()){
00396 LeSlice = 0;
00397 LeEvent = event;
00398 LeMCevent = 0;
00399 Display(entry,0,event,0,LeAutoMat);
00400 return entry;
00401 }
00402 event+=1;
00403 }
00404 event = 0;
00405 entry+=1;
00406 if(entry>=Nentries) break;
00407 }
00408 entry = 0;
00409 Display(0,0,0,0,LeAutoMat);
00410 return entry;
00411
00412 }
00413
00414 Int_t MadEvDisplay::PrevPass() {
00415
00416 if(fHaveNeatoEvents) { return NextInterestingEvent(true); }
00417
00418 int entry = LeEntry;
00419 int event = LeEvent-1;
00420
00421 if(isMC&&isTH){
00422 int mcevent = 0;
00423 while(this->GetEntry(entry)){
00424 if(event==-100){
00425 TClonesArray* pointEventArray = NULL;
00426 if(isST) pointEventArray = (strecord->evt);
00427 else pointEventArray = (record->evt);
00428 TClonesArray& eventArray = *pointEventArray;
00429 event = eventArray.GetEntries() - 1;
00430 }
00431 while(LoadEvent(event)) {
00432 if(LoadTruthForRecoTH(event,mcevent)){
00433 if(PassCuts()&&(!UseNuInfo||(abs(ntpTruth->inu)==LeNu
00434 &&ntpTruth->iaction==LeAction))){
00435 int slice = 0;
00436 LoadSliceForRecoTH(event,slice);
00437 LeSlice = slice;
00438 LeEvent = event;
00439 LeMCevent = mcevent;
00440 Display(entry,slice,event,mcevent,LeAutoMat);
00441 return entry;
00442 }
00443 }
00444 event-=1;
00445 }
00446 event = -100;
00447 entry -= 1;
00448 if(entry<0) break;
00449 }
00450 entry = 0;
00451 Display(0,0,0,0,LeAutoMat);
00452 return entry;
00453 }
00454
00455
00456 while(this->GetEntry(entry)){
00457 if(event==-100){
00458 TClonesArray* pointEventArray = NULL;
00459 if(isST) pointEventArray = (strecord->evt);
00460 else pointEventArray = (record->evt);
00461 TClonesArray& eventArray = *pointEventArray;
00462 event = eventArray.GetEntries() - 1;
00463 }
00464 while(LoadEvent(event)) {
00465 if(PassCuts()){
00466 LeSlice = 0;
00467 LeEvent = event;
00468 LeMCevent = 0;
00469 Display(entry,0,event,0,LeAutoMat);
00470 return entry;
00471 }
00472 event-=1;
00473 }
00474 event = -100;
00475 entry-=1;
00476 if(entry<0) break;
00477 }
00478 entry = 0;
00479 Display(0,0,0,0,LeAutoMat);
00480 return entry;
00481
00482 }
00483
00484 Int_t MadEvDisplay::SkipTo()
00485 {
00486
00487 Int_t sp = 0;
00488 std::cout << "Enter tree entry number to jump to" << std::endl;
00489 std::cin >> sp;
00490 if(sp<0||sp>Nentries) sp=0;
00491 std::cout << sp << std::endl;
00492 Display(sp,0,0,0,LeAutoMat);
00493 return sp;
00494
00495 }
00496
00497 Int_t MadEvDisplay::JumpTo()
00498 {
00499 if(whichSource==0){
00500 Int_t run = 0;
00501 Int_t snarl = 0;
00502 std::cout << "Enter run number of the snarl:" << std::endl;
00503 std::cin >> run;
00504 std::cout << "Enter snarl number:" << std::endl;
00505 std::cin >> snarl;
00506 Int_t entry = fChain->GetEntryNumber(run,snarl);
00507 cout << entry << endl;
00508 if(entry>=0 && entry<Nentries) {
00509 std::cout << "Displaying Run: " << run << " Snarl: "
00510 << snarl << std::endl;
00511 Display(entry,0,0,0,LeAutoMat);
00512 return entry;
00513 }
00514 std::cout << "Couldn't find Run: " << run << " Snarl: "
00515 << snarl << std::endl;
00516 }
00517 return lastEntry;
00518 }
00519
00520 Bool_t MadEvDisplay::Display(Int_t entry,Int_t theSlice,Int_t theEvent,
00521 Int_t theMCevent,Bool_t automat)
00522 {
00523
00524 gStyle->SetTextFont(132);
00525 if(this->GetEntry(entry)==0) return false;
00526
00527 Bool_t isReco = true;
00528 Bool_t NoSlice = false;
00529
00530
00531 TClonesArray* pointShieldStripArray = NULL;
00532 if(isST) pointShieldStripArray = (strecord->vetostp);
00533 else pointShieldStripArray = (record->vetostp);
00534 TClonesArray& shieldstripArray = *pointShieldStripArray;
00535 TClonesArray* pointStripArray = NULL;
00536 if(isST) pointStripArray = (strecord->stp);
00537 else pointStripArray = (record->stp);
00538 TClonesArray& stripArray = *pointStripArray;
00539
00540
00541 if(!LoadEvent(theEvent)) {
00542 LeEvent = theEvent = 0;
00543 if(!LoadEvent(theEvent)) isReco=false;
00544
00545 }
00546 else LeEvent = theEvent;
00547
00548
00549 if(isMC) {
00550 if(isTH&&automat) {
00551 if(!LoadSliceForRecoTH(theEvent,theSlice)){
00552 LeSlice = theSlice = 0;
00553 if(!LoadSlice(theSlice)) {
00554 std::cerr << "No slice present in Run: " << ntpHeader->GetRun()
00555 << " Snarl: " << ntpHeader->GetSnarl() << std::endl;
00556 NoSlice=true;
00557 }
00558 }
00559 else LeSlice = theSlice;
00560 if(!LoadTruthForRecoTH(theEvent,theMCevent)){
00561 LeMCevent = theMCevent = 0;
00562 LoadTruth(theMCevent);
00563 }
00564 else LeMCevent = theMCevent;
00565 }
00566 else if(automat){
00567 if(!LoadTruthForReco(theEvent,theMCevent)){
00568 LeMCevent = theMCevent = 0;
00569 LoadTruth(theMCevent);
00570
00571 theSlice = ntpEvent->slc;
00572 if(!LoadSlice(theSlice)) {
00573 LeSlice = theSlice = 0;
00574 if(!LoadSlice(theSlice)) {
00575 std::cerr << "No slice present in Run: " << ntpHeader->GetRun()
00576 << " Snarl: " << ntpHeader->GetSnarl() << std::endl;
00577 NoSlice=true;
00578 }
00579 }
00580 else LeSlice = theSlice;
00581 }
00582 else LeMCevent = theMCevent;
00583 }
00584 else {
00585 if(!LoadTruth(theMCevent)) {
00586 LeMCevent = theMCevent = 0;
00587 LoadTruth(theMCevent);
00588 }
00589 else LeMCevent = theMCevent;
00590 if(!LoadSlice(theSlice)){
00591 LeSlice = theSlice = 0;
00592 if(!LoadSlice(theSlice)){
00593 std::cerr << "No slice present in Run: " << ntpHeader->GetRun()
00594 << " Snarl: " << ntpHeader->GetSnarl() << std::endl;
00595 NoSlice=true;
00596 }
00597 }
00598 else LeSlice = theSlice;
00599 }
00600 DrawInteractionDiagram(theMCevent);
00601 }
00602
00603 else {
00604 if(!automat) {
00605 if(!LoadSlice(theSlice)) {
00606 theSlice = 0;
00607 LeSlice = theSlice;
00608 if(!LoadSlice(theSlice)){
00609 std::cerr << "No slice present in Run: " << ntpHeader->GetRun()
00610 << " Snarl: " << ntpHeader->GetSnarl() << std::endl;
00611 return false;
00612 }
00613 }
00614 else LeSlice = theSlice;
00615 }
00616 else {
00617 if(isReco) {
00618 theSlice = ntpEvent->slc;
00619 if(!LoadSlice(theSlice)) {
00620 LeSlice = theSlice = 0;
00621 if(!LoadSlice(theSlice)) {
00622 std::cerr << "No slice present in Run: " << ntpHeader->GetRun()
00623 << " Snarl: " << ntpHeader->GetSnarl() << std::endl;
00624 NoSlice=true;
00625 }
00626 }
00627 else LeSlice = theSlice;
00628 }
00629 else {
00630 if(!LoadSlice(theSlice)) {
00631 LeSlice = theSlice = 0;
00632 if(!LoadSlice(theSlice)) {
00633 std::cerr << "No slice present in Run: " << ntpHeader->GetRun()
00634 << " Snarl: " << ntpHeader->GetSnarl() << std::endl;
00635 NoSlice=true;
00636 }
00637 }
00638 else LeSlice = theSlice;
00639 }
00640 }
00641 }
00642
00643 sprintf(printName,"_Run%i_Snl%i_Slc%i_Evt%i.%s",ntpHeader->GetRun(),
00644 ntpHeader->GetSnarl(),theSlice,theEvent,printOpt);
00645
00646
00648
00649
00650
00651 TCanvas *RecoCanvas = 0;
00652 TCanvas *MainCanvas = 0;
00653 TCanvas *LegoCanvas = 0;
00654 TCanvas *ClusterCanvas = 0;
00655
00656 static TPolyLine *line = 0;
00657 static TPolyLine *pu1_outline = 0; static TPolyLine *fu1_outline = 0;
00658 static TPolyLine *pv1_outline = 0; static TPolyLine *fv1_outline = 0;
00659 static TPolyLine *pu2_outline = 0; static TPolyLine *fu2_outline = 0;
00660 static TPolyLine *pv2_outline = 0; static TPolyLine *fv2_outline = 0;
00661
00662 TEllipse *ellie = 0;
00663
00664 TH2F *xz_place = 0;
00665 TH2F *yz_place = 0;
00666 TH2F *yx_place = 0;
00667 TH2 *tz_place_0 = 0;
00668 TH2 *tz_place_1 = 0;
00669
00670 static std::string tz_place_dopt="";
00671
00672
00673 TH2F *tz_0_lego = 0;
00674 TH2F *tz_1_lego = 0;
00675
00676 TMultiGraph *xz_trk = 0;
00677 TMultiGraph *yz_trk = 0;
00678 TMultiGraph *yx_trk = 0;
00679 TMultiGraph *xz_shw = 0;
00680 TMultiGraph *yz_shw = 0;
00681 TMultiGraph *yx_shw = 0;
00682 TMultiGraph *yx_veto = 0;
00683
00684 TMultiGraph *tz_stp_0 = 0;
00685 TMultiGraph *tz_stp_mid_0 = 0;
00686 TMultiGraph *tz_stp_spe_0 = 0;
00687 TMultiGraph *tz_stp_1 = 0;
00688 TMultiGraph *tz_stp_mid_1 = 0;
00689 TMultiGraph *tz_stp_spe_1 = 0;
00690
00691 TMultiGraph *tz_trk0 = 0;
00692 TMultiGraph *tz_shw0 = 0;
00693 TMultiGraph *tz_emshw0 = 0;
00694 TMultiGraph *tz_clu0 = 0;
00695 TMultiGraph *tz_trk1 = 0;
00696 TMultiGraph *tz_shw1 = 0;
00697 TMultiGraph *tz_emshw1 = 0;
00698 TMultiGraph *tz_clu1 = 0;
00699
00700 TLegend *cluLeg0 = 0;
00701 TLegend *cluLeg1 = 0;
00702
00703 TMultiGraph *ytime = 0;
00704 TMultiGraph *ztime = 0;
00705 TMultiGraph *ytime_veto = 0;
00706
00707 if(!gROOT->FindObject("RecoCanvas")){
00708
00709
00710 gStyle->SetOptStat(0);
00711
00712 RecoCanvas = new TCanvas("RecoCanvas","Reconstructed Tracks",0,0,900,700);
00713 RecoCanvas->Divide(3,2);
00714 TVirtualPad *RecoCanvas_5 = RecoCanvas->GetPad(5);
00715 RecoCanvas_5->Divide(1,2);
00716
00717 if(LeLego) {
00718 LegoCanvas = new TCanvas("LegoCanvas","Lego View of Hit Strips",
00719 0,0,900,700);
00720 LegoCanvas->Divide(1,2);
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730 int nzpos = 500;
00731 double z_pos[501];
00732 z_pos[0] = 0.5;
00733 for(int i=1;i<501;i++) z_pos[i] = z_pos[i-1]+1;
00734
00735 tz_0_lego = new TH2F("tz_0_lego","TPos vs Plane view - U Planes",
00736 nzpos,z_pos,192,-3.936,3.936);
00737 tz_0_lego->SetXTitle("Plane");
00738 tz_0_lego->SetYTitle("TPos (m)");
00739 tz_0_lego->SetZTitle("Pulse Height (PEs)");
00740 tz_1_lego = new TH2F("tz_1_lego","TPos vs Plane view - V Planes",
00741 nzpos,z_pos,192,-3.936,3.936);
00742 tz_1_lego->SetXTitle("Plane");
00743 tz_1_lego->SetYTitle("TPos (m)");
00744 tz_1_lego->SetZTitle("Pulse Height (PEs)");
00745 }
00746
00747 if(LeClus) {
00748 ClusterCanvas = new TCanvas("ClusterCanvas","Reconstructed Cluster View",
00749 910,0,400,700);
00750 ClusterCanvas->Divide(1,2);
00751 }
00752
00753 MainCanvas = new TCanvas("MainCanvas","Main Display and Controls",
00754 0,0,900,700);
00755 MainCanvas->Divide(2,2);
00756
00757 xz_place = new TH2F("xz_place","X vs Z view",70,0,35,50,-5,5);
00758 xz_place->SetXTitle("z position (m)");
00759 xz_place->SetYTitle("x position (m)");
00760
00761 yz_place = new TH2F("yz_place","Y vs Z view",70,0,35,50,-5,5);
00762 yz_place->SetXTitle("z position (m)");
00763 yz_place->SetYTitle("y position (m)");
00764
00765 yx_place = new TH2F("yx_place","Y vs X view",50,-5,5,50,-5,5);
00766 yx_place->SetXTitle("x position (m)");
00767 yx_place->SetYTitle("y position (m)");
00768
00769 Detector::Detector_t det=ntpHeader->GetVldContext().GetDetector();
00770 if(det==Detector::kFar){
00771 tz_place_0 = new TH2F("tz_place_0","Transverse vs Z view - U Planes",
00772 70,0,35,50,-5,5);
00773 tz_place_1 = new TH2F("tz_place_1","Transverse vs Z view - V Planes",
00774 70,0,35,50,-5,5);
00775 }
00776 else{
00777 PlaneOutline po;
00778 tz_place_0 = po.GetNDPlanesHist(PlaneView::kV);
00779 tz_place_0->SetName("tz_place_0");
00780 tz_place_0->SetTitle("Transverse vs Z view - U Planes");
00781
00782
00783
00784 tz_place_0->SetDirectory(gROOT);
00785
00786 tz_place_1 = po.GetNDPlanesHist(PlaneView::kU);
00787 tz_place_1->SetName("tz_place_1");
00788 tz_place_1->SetTitle("Transverse vs Z view - V Planes");
00789
00790 tz_place_1->SetDirectory(gROOT);
00791
00792 tz_place_dopt ="col";
00793
00794 }
00795 tz_place_0->SetXTitle("z position (m)");
00796 tz_place_0->SetYTitle("transverse position (m)");
00797 tz_place_1->SetXTitle("z position (m)");
00798 tz_place_1->SetYTitle("transverse position (m)");
00799
00800 this->DrawButtons(MainCanvas);
00801 }
00802 else {
00803 RecoCanvas = (TCanvas*) gROOT->FindObject("RecoCanvas");
00804 MainCanvas = (TCanvas*) gROOT->FindObject("MainCanvas");
00805
00806
00807 if(gROOT->FindObject("LegoCanvas")) {
00808 LegoCanvas = (TCanvas*) gROOT->FindObject("LegoCanvas");
00809 LegoCanvas->cd(1);
00810 TVirtualPad *LegoCanvas_1 = LegoCanvas->GetPad(1);
00811 tz_0_lego = (TH2F*) LegoCanvas_1->FindObject("tz_0_lego");
00812 LegoCanvas->cd(2);
00813 TVirtualPad *LegoCanvas_2 = LegoCanvas->GetPad(2);
00814 tz_1_lego = (TH2F*) LegoCanvas_2->FindObject("tz_1_lego");
00815 }
00816 else if(LeLego) {
00817 LegoCanvas = new TCanvas("LegoCanvas","Lego View of Hit Strips",
00818 0,0,900,700);
00819 LegoCanvas->Divide(1,2);
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829 int nzpos = 500;
00830 double z_pos[501];
00831 z_pos[0] = 0.5;
00832 for(int i=1;i<501;i++) z_pos[i] = z_pos[i-1]+1;
00833
00834 tz_0_lego = new TH2F("tz_0_lego","TPos vs Plane view - U Planes",
00835 nzpos,z_pos,192,-3.936,3.936);
00836 tz_0_lego->SetXTitle("Plane");
00837 tz_0_lego->SetYTitle("TPos (m)");
00838 tz_0_lego->SetZTitle("Pulse Height (PEs)");
00839 tz_1_lego = new TH2F("tz_1_lego","TPos vs Plane view - V Planes",
00840 nzpos,z_pos,192,-3.936,3.936);
00841 tz_1_lego->SetXTitle("Plane");
00842 tz_1_lego->SetYTitle("TPos (m)");
00843 tz_1_lego->SetZTitle("Pulse Height (PEs)");
00844
00845 LegoCanvas->cd(1);
00846 tz_0_lego->Draw("lego");
00847 LegoCanvas->cd(2);
00848 tz_1_lego->Draw("lego");
00849 }
00850
00851 if(!LeLego&&gROOT->FindObject("LegoCanvas")) {
00852 delete LegoCanvas;
00853 delete tz_0_lego;
00854 delete tz_1_lego;
00855 }
00856
00858 RecoCanvas->cd(1);
00859 TVirtualPad *RecoCanvas_1 = RecoCanvas->GetPad(1);
00860 TVirtualPad *RecoCanvas_4 = RecoCanvas->GetPad(4);
00861 TVirtualPad *RecoCanvas_2 = RecoCanvas->GetPad(2);
00862 xz_trk = (TMultiGraph*) RecoCanvas_1->FindObject("xz_trk");
00863 yz_trk = (TMultiGraph*) RecoCanvas_4->FindObject("yz_trk");
00864 yx_trk = (TMultiGraph*) RecoCanvas_2->FindObject("yx_trk");
00865 xz_shw = (TMultiGraph*) RecoCanvas_1->FindObject("xz_shw");
00866 yz_shw = (TMultiGraph*) RecoCanvas_4->FindObject("yz_shw");
00867 yx_shw = (TMultiGraph*) RecoCanvas_2->FindObject("yx_shw");
00868 yx_veto = (TMultiGraph*) RecoCanvas_2->FindObject("yx_veto");
00869
00870 if(!drawSAME) {
00871 delete xz_trk; xz_trk = 0;
00872 delete yz_trk; yz_trk = 0;
00873 delete yx_trk; yx_trk = 0;
00874 delete xz_shw; xz_shw = 0;
00875 delete yz_shw; yz_shw = 0;
00876 delete yx_shw; yx_shw = 0;
00877 delete yx_veto; yx_veto = 0;
00878 }
00879
00880 RecoCanvas->cd(5);
00881 TVirtualPad *RecoCanvas_5 = RecoCanvas->GetPad(5);
00882 TVirtualPad *RecoCanvas_5_1 = RecoCanvas_5->GetPad(1);
00883 TVirtualPad *RecoCanvas_5_2 = RecoCanvas_5->GetPad(2);
00884 ytime = (TMultiGraph*) RecoCanvas_5_1->FindObject("ytime");
00885 ztime = (TMultiGraph*) RecoCanvas_5_2->FindObject("ztime");
00886 ytime_veto = (TMultiGraph*) RecoCanvas_5_1->FindObject("ytime_veto");
00887
00888 if(!drawSAME) {
00889 delete ytime; ytime = 0;
00890 delete ztime; ztime = 0;
00891 delete ytime_veto; ytime_veto = 0;
00892 }
00893
00894 MainCanvas->cd(1);
00895 TVirtualPad *MainCanvas_1 = MainCanvas->GetPad(1);
00896 TLatex *info1 = (TLatex*) MainCanvas_1->FindObject("info1");
00897 TLatex *info2 = (TLatex*) MainCanvas_1->FindObject("info2");
00898 TLatex *info3 = (TLatex*) MainCanvas_1->FindObject("info3");
00899 TLatex *info4 = (TLatex*) MainCanvas_1->FindObject("info4");
00900 TLatex *info5 = (TLatex*) MainCanvas_1->FindObject("info5");
00901 TLatex *info6 = (TLatex*) MainCanvas_1->FindObject("info6");
00902 TLatex *info7 = (TLatex*) MainCanvas_1->FindObject("info7");
00903 TLatex *info8 = (TLatex*) MainCanvas_1->FindObject("info8");
00904 TLatex *info9 = (TLatex*) MainCanvas_1->FindObject("info9");
00905 TLatex *info10 = (TLatex*) MainCanvas_1->FindObject("info10");
00906 TLatex *info11 = (TLatex*) MainCanvas_1->FindObject("info11");
00907 TLatex *info12 = (TLatex*) MainCanvas_1->FindObject("info12");
00908 TLatex *info13 = (TLatex*) MainCanvas_1->FindObject("info13");
00909 TLatex *info14 = (TLatex*) MainCanvas_1->FindObject("info14");
00910
00911 delete info1;
00912 delete info2;
00913 delete info3;
00914 delete info4;
00915 delete info5;
00916 delete info6;
00917 delete info7;
00918 delete info8;
00919 delete info9;
00920 delete info10;
00921 delete info11;
00922 delete info12;
00923 delete info13;
00924 delete info14;
00925
00927
00929 MainCanvas->cd(3);
00930 TVirtualPad *MainCanvas_3 = MainCanvas->GetPad(3);
00931
00932 tz_stp_0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_stp_0");
00933 tz_stp_mid_0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_stp_mid_0");
00934 tz_stp_spe_0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_stp_spe_0");
00935 if(!drawSAME){
00936 delete tz_stp_0; tz_stp_0 = 0;
00937 delete tz_stp_mid_0; tz_stp_mid_0 = 0;
00938 delete tz_stp_spe_0; tz_stp_spe_0 = 0;
00939 }
00940
00941 tz_trk0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_trk0");
00942 tz_shw0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_shw0");
00943 tz_emshw0 = (TMultiGraph*) MainCanvas_3->FindObject("tz_emshw0");
00944 if(!drawSAME){
00945 delete tz_trk0; tz_trk0 = 0;
00946 delete tz_shw0; tz_shw0 = 0;
00947 delete tz_emshw0; tz_emshw0 = 0;
00948 }
00949
00950 TArrow *ttz_arrow1 = (TArrow*) MainCanvas_3->FindObject("TArrow");
00951 delete ttz_arrow1;
00952
00953
00954 TLine *stdhepLine = 0;
00955 while((stdhepLine = (TLine*) MainCanvas_3->FindObject("TLine"))) {
00956 delete stdhepLine;
00957 }
00958
00959 MainCanvas->cd(4);
00960 TVirtualPad *MainCanvas_4 = MainCanvas->GetPad(4);
00961
00962 tz_stp_1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_stp_1");
00963 tz_stp_mid_1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_stp_mid_1");
00964 tz_stp_spe_1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_stp_spe_1");
00965 if(!drawSAME){
00966 delete tz_stp_1; tz_stp_1 = 0;
00967 delete tz_stp_mid_1; tz_stp_mid_1 = 0;
00968 delete tz_stp_spe_1; tz_stp_spe_1 = 0;
00969 }
00970
00971 tz_trk1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_trk1");
00972 tz_shw1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_shw1");
00973 tz_emshw1 = (TMultiGraph*) MainCanvas_4->FindObject("tz_emshw1");
00974 if(!drawSAME){
00975 delete tz_trk1; tz_trk1 = 0;
00976 delete tz_shw1; tz_shw1 = 0;
00977 delete tz_emshw1; tz_emshw1 = 0;
00978 }
00979
00980
00981 TArrow *ttz_arrow2 = (TArrow*) MainCanvas_4->FindObject("TArrow");
00982 delete ttz_arrow2;
00983
00984 stdhepLine = 0;
00985 while((stdhepLine = (TLine*) MainCanvas_4->FindObject("TLine"))) {
00986 delete stdhepLine;
00987 }
00988
00989
00990 if(gROOT->FindObject("ClusterCanvas")) {
00991 ClusterCanvas = (TCanvas*) gROOT->FindObject("ClusterCanvas");
00992 ClusterCanvas->cd(1);
00993 TVirtualPad *ClusterCanvas_1 = ClusterCanvas->GetPad(1);
00994 tz_clu0 = (TMultiGraph*) ClusterCanvas_1->FindObject("tz_clu0");
00995 cluLeg0 = (TLegend*) ClusterCanvas_1->FindObject("TPave");
00996 if(!drawSAME) {
00997 delete tz_clu0; tz_clu0 = 0;
00998 delete cluLeg0; cluLeg0 = 0;
00999 }
01000 gPad->Update();
01001 gPad->Modified();
01002 ClusterCanvas->cd(2);
01003 TVirtualPad *ClusterCanvas_2 = ClusterCanvas->GetPad(2);
01004 tz_clu1 = (TMultiGraph*) ClusterCanvas_2->FindObject("tz_clu1");
01005 cluLeg1 = (TLegend*) ClusterCanvas_2->FindObject("TPave");
01006 if(!drawSAME) {
01007 delete tz_clu1; tz_clu1 = 0;
01008 delete cluLeg1; cluLeg1 = 0;
01009 }
01010 gPad->Update();
01011 gPad->Modified();
01012 }
01013 else if(LeClus) {
01014 ClusterCanvas = new TCanvas("ClusterCanvas","Reconstructed Cluster View",
01015 910,0,400,700);
01016 ClusterCanvas->Divide(1,2);
01017 }
01018
01019 if(!LeClus&&gROOT->FindObject("ClusterCanvas")) {
01020 delete ClusterCanvas;
01021 }
01022
01024
01026 RecoCanvas->cd(2);
01027
01028 ellie = (TEllipse*) RecoCanvas_2->FindObject("TEllipse");
01029 RecoCanvas->Clear();
01030 RecoCanvas->Divide(3,2);
01031 RecoCanvas_5 = RecoCanvas->GetPad(5);
01032 RecoCanvas_5->Divide(1,2);
01033
01035 xz_place = (TH2F*) gROOT->FindObject("xz_place");
01036 yz_place = (TH2F*) gROOT->FindObject("yz_place");
01037 yx_place = (TH2F*) gROOT->FindObject("yx_place");
01038 tz_place_0 = (TH2*) gROOT->FindObject("tz_place_0");
01039 tz_place_1 = (TH2*) gROOT->FindObject("tz_place_1");
01040
01041 xz_place->GetXaxis()->UnZoom();
01042 yz_place->GetXaxis()->UnZoom();
01043 tz_place_0->GetXaxis()->UnZoom();
01044 tz_place_1->GetXaxis()->UnZoom();
01045 xz_place->GetYaxis()->UnZoom();
01046 yz_place->GetYaxis()->UnZoom();
01047 tz_place_0->GetYaxis()->UnZoom();
01048 tz_place_1->GetYaxis()->UnZoom();
01049
01050 if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
01051 yx_place->GetXaxis()->SetRangeUser(-2.6,3.8);
01052 yx_place->GetYaxis()->SetRangeUser(-3.2,3.2);
01053
01054 }
01055 else {
01056 yx_place->GetXaxis()->UnZoom();
01057 yx_place->GetYaxis()->UnZoom();
01058 }
01059
01060 if(LeLego){
01061 tz_0_lego->GetXaxis()->UnZoom();
01062 tz_0_lego->GetYaxis()->UnZoom();
01063 tz_1_lego->GetXaxis()->UnZoom();
01064 tz_1_lego->GetYaxis()->UnZoom();
01065 if(!drawSAME) {
01066 tz_0_lego->Reset();
01067 tz_1_lego->Reset();
01068 }
01069 }
01070 if(handScan) {
01071 ScanID = 0;
01072 ScanTop = 0;
01073 ChangeLogButColor();
01074 }
01075 }
01076
01077
01078 if(!line){
01079 float linex_caldet[5] = {-0.5,0.5,0.5,-0.5,-0.5};
01080 float liney_caldet[5] = {-0.5,-0.5,0.5,0.5,-0.5};
01081 if(ntpHeader->GetVldContext().GetDetector()==Detector::kFar) {
01082 line = new TPolyLine(33,"");
01083 line->SetPoint( 0, 421.8893*Munits::cm,-142.8867*Munits::cm);
01084 line->SetPoint( 1, 421.8893*Munits::cm,-138.3342*Munits::cm);
01085 line->SetPoint( 2, 400.1614*Munits::cm,-115.9855*Munits::cm);
01086 line->SetPoint( 3, 400.1614*Munits::cm, 87.6358*Munits::cm);
01087 line->SetPoint( 4, 406.9902*Munits::cm, 94.0507*Munits::cm);
01088 line->SetPoint( 5, 429.1319*Munits::cm, 101.5003*Munits::cm);
01089 line->SetPoint( 6, 447.1350*Munits::cm, 101.5003*Munits::cm);
01090 line->SetPoint( 7, 454.7915*Munits::cm, 94.2577*Munits::cm);
01091 line->SetPoint( 8, 457.6886*Munits::cm, 94.2577*Munits::cm);
01092 line->SetPoint( 9, 457.6886*Munits::cm, 109.3637*Munits::cm);
01093 line->SetPoint(10, 143.7724*Munits::cm, 423.2799*Munits::cm);
01094 line->SetPoint(11, 139.4268*Munits::cm, 423.2799*Munits::cm);
01095 line->SetPoint(12, 117.2850*Munits::cm, 401.1382*Munits::cm);
01096 line->SetPoint(13,-116.9622*Munits::cm, 401.1382*Munits::cm);
01097 line->SetPoint(14,-139.1040*Munits::cm, 423.2799*Munits::cm);
01098 line->SetPoint(15,-143.4496*Munits::cm, 423.2799*Munits::cm);
01099 line->SetPoint(16,-457.3658*Munits::cm, 109.3637*Munits::cm);
01100 line->SetPoint(17,-457.3658*Munits::cm, 94.2577*Munits::cm);
01101 line->SetPoint(18,-454.4687*Munits::cm, 94.2577*Munits::cm);
01102 line->SetPoint(19,-439.9834*Munits::cm, 101.9141*Munits::cm);
01103 line->SetPoint(20,-429.8438*Munits::cm, 101.9141*Munits::cm);
01104 line->SetPoint(21,-406.6674*Munits::cm, 94.2577*Munits::cm);
01105 line->SetPoint(22,-399.8386*Munits::cm, 84.7388*Munits::cm);
01106 line->SetPoint(23,-399.8386*Munits::cm,-115.9855*Munits::cm);
01107 line->SetPoint(24,-421.5665*Munits::cm,-137.7134*Munits::cm);
01108 line->SetPoint(25,-421.5665*Munits::cm,-142.8867*Munits::cm);
01109 line->SetPoint(26,-143.4496*Munits::cm,-421.0036*Munits::cm);
01110 line->SetPoint(27,-139.1040*Munits::cm,-421.0036*Munits::cm);
01111 line->SetPoint(28,-116.9622*Munits::cm,-398.8619*Munits::cm);
01112 line->SetPoint(29, 116.8712*Munits::cm,-398.8619*Munits::cm);
01113 line->SetPoint(30, 139.4268*Munits::cm,-421.0036*Munits::cm);
01114 line->SetPoint(31, 143.7724*Munits::cm,-421.0036*Munits::cm);
01115 line->SetPoint(32, 421.8893*Munits::cm,-142.8867*Munits::cm);
01116 }
01117 else if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear) {
01118 line = new TPolyLine(23,"");
01119 Double_t x0 = 55.78*Munits::cm;
01120 line->SetPoint( 0,-121.43*Munits::inch+x0, 0.47*Munits::inch);
01121 line->SetPoint( 1,-120.25*Munits::inch+x0, 0.47*Munits::inch);
01122 line->SetPoint( 2,-115.14*Munits::inch+x0, 3.42*Munits::inch);
01123 line->SetPoint( 3,-110.24*Munits::inch+x0, 3.42*Munits::inch);
01124 line->SetPoint( 4, -95.24*Munits::inch+x0, -1.48*Munits::inch);
01125 line->SetPoint( 5, -95.24*Munits::inch+x0,-35.47*Munits::inch);
01126 line->SetPoint( 6, -69.80*Munits::inch+x0,-60.91*Munits::inch);
01127 line->SetPoint( 7, -69.80*Munits::inch+x0,-75.04*Munits::inch);
01128 line->SetPoint( 8, 69.80*Munits::inch+x0,-75.04*Munits::inch);
01129 line->SetPoint( 9, 69.80*Munits::inch+x0,-60.91*Munits::inch);
01130 line->SetPoint(10, 95.24*Munits::inch+x0,-35.47*Munits::inch);
01131 line->SetPoint(11, 95.24*Munits::inch+x0, -1.48*Munits::inch);
01132 line->SetPoint(12, 110.16*Munits::inch+x0, 3.42*Munits::inch);
01133 line->SetPoint(13, 117.30*Munits::inch+x0, 3.42*Munits::inch);
01134 line->SetPoint(14, 120.25*Munits::inch+x0, 0.47*Munits::inch);
01135 line->SetPoint(15, 121.43*Munits::inch+x0, 0.47*Munits::inch);
01136 line->SetPoint(16, 121.43*Munits::inch+x0, 9.28*Munits::inch);
01137 line->SetPoint(17, 69.80*Munits::inch+x0, 60.91*Munits::inch);
01138 line->SetPoint(18, 69.80*Munits::inch+x0, 75.04*Munits::inch);
01139 line->SetPoint(19, -69.80*Munits::inch+x0, 75.04*Munits::inch);
01140 line->SetPoint(20, -69.80*Munits::inch+x0, 60.91*Munits::inch);
01141 line->SetPoint(21,-121.43*Munits::inch+x0, 9.28*Munits::inch);
01142 line->SetPoint(22,-121.43*Munits::inch+x0, 0.47*Munits::inch);
01143
01144
01145 PlaneOutline po;
01146 Color_t colu=38;
01147 Color_t colv=46;
01148 po.GetOutline(PlaneView::kV, PlaneCoverage::kNearPartial,
01149 pv1_outline, pv2_outline);
01150 po.GetOutline(PlaneView::kV, PlaneCoverage::kNearFull,
01151 fv1_outline, fv2_outline);
01152 po.GetOutline(PlaneView::kU, PlaneCoverage::kNearPartial,
01153 pu1_outline, pu2_outline);
01154 po.GetOutline(PlaneView::kU, PlaneCoverage::kNearFull,
01155 fu1_outline, fu2_outline);
01156 pv1_outline->SetLineColor(colv);
01157 pu1_outline->SetLineColor(colu);
01158
01159 fv1_outline->SetLineColor(colv);
01160 fu1_outline->SetLineColor(colu);
01161 fv2_outline->SetFillColor(16);
01162 fu2_outline->SetFillColor(16);
01163 fv2_outline->SetFillStyle(4020);
01164 fu2_outline->SetFillStyle(4020);
01165
01166 pv1_outline->SetLineWidth(2);
01167 pu1_outline->SetLineWidth(2);
01168 fv1_outline->SetLineWidth(2);
01169 fu1_outline->SetLineWidth(2);
01170 fv2_outline->SetLineWidth(2);
01171 fu2_outline->SetLineWidth(2);
01172
01173 }
01174 else if(ntpHeader->GetVldContext().GetDetector()==Detector::kCalDet)
01175 line = new TPolyLine(5,linex_caldet,liney_caldet);
01176 line->SetLineWidth(3);
01177 line->SetLineColor(4);
01178 }
01179
01180 if(!ellie&&ntpHeader->GetVldContext().GetDetector()==Detector::kFar){
01181
01182 ellie = new TEllipse(0,0,TMath::Sqrt(14),TMath::Sqrt(14),0,360,0);
01183 ellie->SetLineColor(5);
01184 ellie->SetLineWidth(1);
01185 ellie->SetFillStyle(0);
01186 ellie->SetLineStyle(2);
01187 }
01188
01189 if(NoSlice) return false;
01190
01192
01193
01194 int slc_nstrip = ntpSlice->nstrip;
01195
01196 float *stp_z_big_0 = new float[slc_nstrip];
01197 float *stp_z_mid_0 = new float[slc_nstrip];
01198 float *stp_z_spe_0 = new float[slc_nstrip];
01199
01200 float *stp_tpos_big_0 = new float[slc_nstrip];
01201 float *stp_tpos_mid_0 = new float[slc_nstrip];
01202 float *stp_tpos_spe_0 = new float[slc_nstrip];
01203
01204 int nstp_big_0 = 0;
01205 int nstp_mid_0 = 0;
01206 int nstp_spe_0 = 0;
01207
01208 float *stp_z_big_1 = new float[slc_nstrip];
01209 float *stp_z_mid_1 = new float[slc_nstrip];
01210 float *stp_z_spe_1 = new float[slc_nstrip];
01211
01212 float *stp_tpos_big_1 = new float[slc_nstrip];
01213 float *stp_tpos_mid_1 = new float[slc_nstrip];
01214 float *stp_tpos_spe_1 = new float[slc_nstrip];
01215
01216 int nstp_big_1 = 0;
01217 int nstp_mid_1 = 0;
01218 int nstp_spe_1 = 0;
01219
01220 float ATH_reco0[500][192] = {};
01221 float ATH_reco1[500][192] = {};
01222 float ATH_mcA[500][192] = {};
01223 float ATH_mcB[500][192] = {};
01224
01225 for(int i=0;i<500;i++){
01226 for(int j=0;j<192;j++){
01227 ATH_reco0[i][j] = -1;
01228 ATH_reco1[i][j] = -1;
01229 ATH_mcA[i][j] = -1;
01230 ATH_mcB[i][j] = -1;
01231 }
01232 }
01233
01234 float highest_plane = 0;
01235 float lowest_plane = 500;
01236
01237 float highest_z = 0;
01238 float lowest_z = 30.;
01239 float highest_t0 = -4.0;
01240 float lowest_t0 = 4.0;
01241 float highest_t1 = -4.0;
01242 float lowest_t1 = 4.0;
01243
01244 for(int i=0;i<slc_nstrip;i++){
01245
01246 int index = ntpSlice->stp[i];
01247 ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
01248
01249 int tempo_pln = ntpStrip->plane;
01250 int tempo_stp = ntpStrip->strip;
01251
01252 if(tempo_pln<lowest_plane) {
01253 lowest_plane=tempo_pln;
01254 lowest_z=ntpStrip->z;
01255 }
01256 if(tempo_pln>highest_plane) {
01257 highest_plane=tempo_pln;
01258 highest_z=ntpStrip->z;
01259 }
01260
01261 ATH_reco0[tempo_pln][tempo_stp] = ntpStrip->ph0.pe;
01262 ATH_reco1[tempo_pln][tempo_stp] = ntpStrip->ph1.pe;
01263
01264 if(ntpStrip->planeview==2){
01265
01266 if(LeLego)
01267 tz_0_lego->Fill(tempo_pln-0.49,ntpStrip->tpos,
01268 ntpStrip->ph0.pe+ntpStrip->ph1.pe);
01269
01270 if(ntpStrip->tpos<lowest_t0) lowest_t0=ntpStrip->tpos;
01271 if(ntpStrip->tpos>highest_t0) highest_t0=ntpStrip->tpos;
01272
01273 if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dspe_val){
01274 stp_z_spe_0[nstp_spe_0]=ntpStrip->z;
01275 stp_tpos_spe_0[nstp_spe_0]=ntpStrip->tpos;
01276 nstp_spe_0++;
01277 }
01278 else if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dmid_val){
01279 stp_z_mid_0[nstp_mid_0]=ntpStrip->z;
01280 stp_tpos_mid_0[nstp_mid_0]=ntpStrip->tpos;
01281 nstp_mid_0++;
01282 }
01283 else {
01284 stp_z_big_0[nstp_big_0]=ntpStrip->z;
01285 stp_tpos_big_0[nstp_big_0]=ntpStrip->tpos;
01286 nstp_big_0++;
01287 }
01288 }
01289
01290 else {
01291
01292 if(LeLego)
01293 tz_1_lego->Fill(tempo_pln-0.49,ntpStrip->tpos,
01294 ntpStrip->ph0.pe+ntpStrip->ph1.pe);
01295
01296 if(ntpStrip->tpos<lowest_t1) lowest_t1=ntpStrip->tpos;
01297 if(ntpStrip->tpos>highest_t1) highest_t1=ntpStrip->tpos;
01298
01299 if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dspe_val){
01300 stp_z_spe_1[nstp_spe_1]=ntpStrip->z;
01301 stp_tpos_spe_1[nstp_spe_1]=ntpStrip->tpos;
01302 nstp_spe_1++;
01303 }
01304 else if(ntpStrip->ph0.pe+ntpStrip->ph1.pe<Dmid_val){
01305 stp_z_mid_1[nstp_mid_1]=ntpStrip->z;
01306 stp_tpos_mid_1[nstp_mid_1]=ntpStrip->tpos;
01307 nstp_mid_1++;
01308 }
01309 else {
01310 stp_z_big_1[nstp_big_1]=ntpStrip->z;
01311 stp_tpos_big_1[nstp_big_1]=ntpStrip->tpos;
01312 nstp_big_1++;
01313 }
01314 }
01315 }
01316
01317 if(!tz_stp_0 && nstp_big_0>0) {
01318 tz_stp_0 = new TMultiGraph();
01319 tz_stp_0->SetName("tz_stp_0");
01320 tz_stp_0->SetTitle("Transverse Position vs Z View");
01321 }
01322 if(nstp_big_0>0){
01323 TGraph *temp = new TGraph(nstp_big_0,stp_z_big_0,stp_tpos_big_0);
01324 temp->SetMarkerColor(1);
01325 temp->SetMarkerSize(1.1);
01326 temp->SetMarkerStyle(8);
01327 tz_stp_0->Add(temp);
01328 }
01329
01330 if(!tz_stp_mid_0 && nstp_mid_0>0){
01331 tz_stp_mid_0 = new TMultiGraph();
01332 tz_stp_mid_0->SetName("tz_stp_mid_0");
01333 tz_stp_mid_0->SetTitle("Transverse Position vs Z View");
01334 }
01335 if(nstp_mid_0>0){
01336 TGraph *temp = new TGraph(nstp_mid_0,stp_z_mid_0,stp_tpos_mid_0);
01337 temp->SetMarkerColor(4);
01338 temp->SetMarkerSize(1.1);
01339 temp->SetMarkerStyle(8);
01340 tz_stp_mid_0->Add(temp);
01341 }
01342
01343 if(!tz_stp_spe_0 && nstp_spe_0>0){
01344 tz_stp_spe_0 = new TMultiGraph();
01345 tz_stp_spe_0->SetName("tz_stp_spe_0");
01346 }
01347 if(nstp_spe_0>0){
01348 TGraph *temp = new TGraph(nstp_spe_0,stp_z_spe_0,stp_tpos_spe_0);
01349 temp->SetMarkerColor(3);
01350 temp->SetMarkerSize(1.1);
01351 temp->SetMarkerStyle(8);
01352 tz_stp_spe_0->Add(temp);
01353 }
01354
01355 if(!tz_stp_1 && nstp_big_1>0) {
01356 tz_stp_1 = new TMultiGraph();
01357 tz_stp_1->SetName("tz_stp_1");
01358 tz_stp_1->SetTitle("Transverse Position vs Z View");
01359 }
01360 if(nstp_big_1>0){
01361 TGraph *temp = new TGraph(nstp_big_1,stp_z_big_1,stp_tpos_big_1);
01362 temp->SetMarkerColor(1);
01363 temp->SetMarkerSize(1.1);
01364 temp->SetMarkerStyle(8);
01365 tz_stp_1->Add(temp);
01366 }
01367
01368 if(!tz_stp_mid_1 && nstp_mid_1>0){
01369 tz_stp_mid_1 = new TMultiGraph();
01370 tz_stp_mid_1->SetName("tz_stp_mid_1");
01371 tz_stp_mid_1->SetTitle("Transverse Position vs Z View");
01372 }
01373 if(nstp_mid_1>0){
01374 TGraph *temp = new TGraph(nstp_mid_1,stp_z_mid_1,stp_tpos_mid_1);
01375 temp->SetMarkerColor(4);
01376 temp->SetMarkerSize(1.1);
01377 temp->SetMarkerStyle(8);
01378 tz_stp_mid_1->Add(temp);
01379 }
01380
01381 if(!tz_stp_spe_1 && nstp_spe_1>0){
01382 tz_stp_spe_1 = new TMultiGraph();
01383 tz_stp_spe_1->SetName("tz_stp_spe_1");
01384 }
01385 if(nstp_spe_1>0){
01386 TGraph *temp = new TGraph(nstp_spe_1,stp_z_spe_1,stp_tpos_spe_1);
01387 temp->SetMarkerColor(3);
01388 temp->SetMarkerSize(1.1);
01389 temp->SetMarkerStyle(8);
01390 tz_stp_spe_1->Add(temp);
01391 }
01392
01393 delete [] stp_tpos_big_0;
01394 delete [] stp_tpos_mid_0;
01395 delete [] stp_tpos_spe_0;
01396 delete [] stp_z_big_0;
01397 delete [] stp_z_mid_0;
01398 delete [] stp_z_spe_0;
01399
01400 delete [] stp_tpos_big_1;
01401 delete [] stp_tpos_mid_1;
01402 delete [] stp_tpos_spe_1;
01403 delete [] stp_z_big_1;
01404 delete [] stp_z_mid_1;
01405 delete [] stp_z_spe_1;
01406
01407 if(lowest_plane-10>=0) {
01408 lowest_plane-=10;
01409 lowest_z-=10.*0.06;
01410 }
01411 else {
01412 lowest_plane=0;
01413 lowest_z=0.;
01414 }
01415
01416 if(highest_plane+10<=485) {
01417 highest_plane+=10;
01418 highest_z+=10.*0.06;
01419 }
01420 else {
01421 highest_plane=485;
01422 highest_z=30.;
01423 }
01424
01425 if(lowest_t0-5*0.041>=-4.0) lowest_t0-=5.*0.041;
01426 else lowest_t0=-4.0;
01427
01428 if(lowest_t1-5*0.041>=-4.0) lowest_t1-=5.*0.041;
01429 else lowest_t1=-4.0;
01430
01431 if(highest_t0+5*0.041<=4.0) highest_t0+=5.*0.041;
01432 else highest_t0=4.0;
01433
01434 if(highest_t1+5*0.041<=4.0) highest_t1+=5.*0.041;
01435 else highest_t1=4.0;
01436
01438
01439
01440
01441 if(isReco&&eventSummary->nevent!=0){
01442
01444
01445
01446
01447 if(ntpEvent->nshower>0){
01448
01449 if(!tz_shw0) {
01450 tz_shw0 = new TMultiGraph();
01451 tz_shw0->SetName("tz_shw0");
01452 }
01453 if(!tz_shw1){
01454 tz_shw1 = new TMultiGraph();
01455 tz_shw1->SetName("tz_shw1");
01456 }
01457 if(!xz_shw){
01458 xz_shw = new TMultiGraph();
01459 xz_shw->SetName("xz_shw");
01460 }
01461 if(!yz_shw){
01462 yz_shw = new TMultiGraph();
01463 yz_shw->SetName("yz_shw");
01464 }
01465 if(!yx_shw){
01466 yx_shw = new TMultiGraph();
01467 yx_shw->SetName("yx_shw");
01468 }
01469 if(!ztime) {
01470 ztime = new TMultiGraph();
01471 ztime->SetName("ztime");
01472 ztime->SetTitle("Time vs Z view");
01473 }
01474 if(!ytime){
01475 ytime = new TMultiGraph();
01476 ytime->SetName("ytime");
01477 ytime->SetTitle("Time vs Y view");
01478 }
01479
01480 int *showers = ntpEvent->shw;
01481
01482 int numshwstp=0;
01483 int numshwstp0=0;
01484 int numshwstp1=0;
01485
01486 for(int i=0;i<ntpEvent->nshower;i++){
01487 int index = showers[i];
01488 LoadShower(index);
01489 numshwstp += ntpShower->nstrip;
01490 }
01491
01492 float *shw_tpos = new float[numshwstp];
01493 float *shw_tpos0 = new float[numshwstp];
01494 float *shw_z0 = new float[numshwstp];
01495 float *shw_tpos1 = new float[numshwstp];
01496 float *shw_z1 = new float[numshwstp];
01497 float *shwstpx = new float[numshwstp];
01498 float *shwstpy = new float[numshwstp];
01499 float *shwstpz = new float[numshwstp];
01500 double *shw_time = new double[numshwstp];
01501 double *shw_y = new double[numshwstp];
01502 double *shw_z = new double[numshwstp];
01503 int count = 0;
01504 int largest_shw_index=-1;
01505 int vtx_shw_index=-1;
01506 LoadLargestShowerFromEvent(theEvent,largest_shw_index);
01507 {
01508 int track_index=-1;
01509 LoadLargestTrackFromEvent(theEvent,track_index);
01510 if(track_index>-1) LoadShowerAtTrackVertex(theEvent,track_index,vtx_shw_index);
01511 }
01512 for(int i=0;i<ntpEvent->nshower;i++){
01513 int index1 = showers[i];
01514 LoadShower(index1);
01515 Int_t *shwstrips = ntpShower->stp;
01516
01517 count=0;
01518 numshwstp0=0;
01519 numshwstp1=0;
01520
01521 for(int j=0;j<ntpShower->nstrip;j++){
01522 Int_t index = shwstrips[j];
01523 if(index==-1) {numshwstp=0; break;}
01524 ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
01525
01526 shw_tpos[count] = ntpStrip->tpos;
01527 shw_z[count] = ntpStrip->z;
01528
01529 if(ntpStrip->time0>0 &&
01530 ntpStrip->time1>0) shw_time[count] = (ntpStrip->time0 +
01531 ntpStrip->time1)/2.;
01532 else if(ntpStrip->time0>0) shw_time[count] = ntpStrip->time0;
01533 else if(ntpStrip->time1>0) shw_time[count] = ntpStrip->time1;
01534 else shw_time[count] = 0;
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544 shw_time[count] -= eventSummary->trigtime;
01545 shw_time[count] *= 1e9;
01546
01547 float shwstpu = 0;
01548 float shwstpv = 0;
01549
01550 if(ntpStrip->planeview==2){
01551 shw_tpos0[numshwstp0] = shw_tpos[count];
01552 shw_z0[numshwstp0] = shw_z[count];
01553 numshwstp0+=1;
01554 shwstpu = shw_tpos[count];
01555 float grad = 0;
01556 if(ntpShower->vtx.dcosv!=0&&false) {
01557 grad = ntpShower->vtx.dcosz/ntpShower->vtx.dcosv;
01558 }
01559 shwstpv = ntpShower->vtx.v+(shw_z[count]-ntpShower->vtx.z)*grad;
01560
01561 }
01562 else {
01563 shw_tpos1[numshwstp1] = shw_tpos[count];
01564 shw_z1[numshwstp1] = shw_z[count];
01565 numshwstp1+=1;
01566 shwstpv = shw_tpos[count];
01567 float grad = 0;
01568 if(ntpShower->vtx.dcosu!=0&&false) {
01569 grad = ntpShower->vtx.dcosz/ntpShower->vtx.dcosu;
01570 }
01571 shwstpu = ntpShower->vtx.u+(shw_z[count]-ntpShower->vtx.z)*grad;
01572
01573 }
01574 shwstpx[count] = (shwstpu-shwstpv)/sqrt(2.);
01575 shwstpy[count] = (shwstpu+shwstpv)/sqrt(2.);
01576 shwstpz[count] = shw_z[count];
01577 shw_y[count] = shwstpy[count];
01578 count++;
01579 }
01580
01581
01582
01583 int shw_marker_color=48;
01584 if(largest_shw_index==index1) shw_marker_color = fDefaultShowerMarkerColor;
01585
01586
01587 int shw_marker_style=25;
01588 if(vtx_shw_index==index1) shw_marker_style=fDefaultShowerMarkerStyle;
01589 if(numshwstp0>0){
01590 TGraph *temp = new TGraph(numshwstp0,shw_z0,shw_tpos0);
01591 temp->SetMarkerColor(shw_marker_color);
01592 temp->SetMarkerSize(0.6);
01593 temp->SetMarkerStyle(shw_marker_style);
01594 tz_shw0->Add(temp);
01595 }
01596 else {
01597 delete tz_shw0;
01598 tz_shw0 = NULL;
01599 }
01600
01601 if(numshwstp1>0){
01602 TGraph *temp = new TGraph(numshwstp1,shw_z1,shw_tpos1);
01603 temp->SetMarkerColor(shw_marker_color);
01604 temp->SetMarkerSize(0.6);
01605 temp->SetMarkerStyle(shw_marker_style);
01606 tz_shw1->Add(temp);
01607 }
01608 else {
01609 delete tz_shw1;
01610 tz_shw1 = NULL;
01611 }
01612
01613 if(count>0){
01614 TGraph *temp = new TGraph(count,shwstpz,shwstpx);
01615 temp->SetMarkerColor(fDefaultShowerMarkerColor);
01616 temp->SetMarkerSize(0.6);
01617 temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
01618 xz_shw->Add(temp);
01619
01620 temp = new TGraph(count,shwstpz,shwstpy);
01621 temp->SetMarkerColor(fDefaultShowerMarkerColor);
01622 temp->SetMarkerSize(0.6);
01623 temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
01624 yz_shw->Add(temp);
01625
01626 temp = new TGraph(count,shwstpx,shwstpy);
01627 temp->SetMarkerColor(fDefaultShowerMarkerColor);
01628 temp->SetMarkerSize(0.6);
01629 temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
01630 yx_shw->Add(temp);
01631
01632 temp = new TGraph(count,shw_z,shw_time);
01633 temp->SetMarkerColor(fDefaultShowerMarkerColor);
01634 temp->SetMarkerSize(0.6);
01635 temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
01636 ztime->Add(temp);
01637
01638 temp = new TGraph(count,shw_y,shw_time);
01639 temp->SetMarkerColor(fDefaultShowerMarkerColor);
01640 temp->SetMarkerSize(0.6);
01641 temp->SetMarkerStyle(fDefaultShowerMarkerStyle);
01642 ytime->Add(temp);
01643 }
01644 }
01645
01646 delete [] shw_tpos;
01647 delete [] shw_tpos0;
01648 delete [] shw_z0;
01649 delete [] shw_tpos1;
01650 delete [] shw_z1;
01651 delete [] shwstpx;
01652 delete [] shwstpy;
01653 delete [] shwstpz;
01654 delete [] shw_time;
01655 delete [] shw_y;
01656 delete [] shw_z;
01657
01658 }
01659
01661
01662
01663
01664 if(LeClus&&ntpEvent->nshower>0){
01665
01666 if(!tz_clu0){
01667 tz_clu0 = new TMultiGraph();
01668 tz_clu0->SetName("tz_clu0");
01669 }
01670 if(!tz_clu1){
01671 tz_clu1 = new TMultiGraph();
01672 tz_clu1->SetName("tz_clu1");
01673 }
01674 if(!cluLeg0)
01675 cluLeg0 = new TLegend(0.85,0.7,0.98,0.98," Key: ID (P_{EM})");
01676 if(!cluLeg1)
01677 cluLeg1 = new TLegend(0.85,0.7,0.98,0.98," Key: ID (P_{EM})");
01678
01679 int nUclus = 0;
01680 int col0 = 1;
01681 int nVclus = 0;
01682 int col1 = 1;
01683
01684 int *showers = ntpEvent->shw;
01685 for(int i=0;i<ntpEvent->nshower;i++){
01686 int index2 = showers[i];
01687 LoadShower(index2);
01688
01689 int *clusters = ntpShower->clu;
01690 int numclustp=0;
01691 int numclustp0=0;
01692 int numclustp1=0;
01693
01694 for(int j=0;j<ntpShower->ncluster;j++){
01695 int index1 = clusters[j];
01696 if(LoadCluster(index1)) {
01697 numclustp+=ntpCluster->nstrip;
01698 if(ntpCluster->planeview==2) nUclus+=1;
01699 else if(ntpCluster->planeview==3) nVclus+=1;
01700 }
01701 }
01702
01703 float *clu_tpos = new float[numclustp];
01704 float *clu_tpos0 = new float[numclustp];
01705 float *clu_z0 = new float[numclustp];
01706 float *clu_tpos1 = new float[numclustp];
01707 float *clu_z1 = new float[numclustp];
01708 double *clu_z = new double[numclustp];
01709 int count = 0;
01710
01711 for(int j=0;j<ntpShower->ncluster;j++){
01712 int index1 = clusters[j];
01713 if(!LoadCluster(index1)) continue;
01714 Int_t *clustrips = ntpCluster->stp;
01715
01716 count=0;
01717 numclustp0=0;
01718 numclustp1=0;
01719
01720 for(int k=0;k<ntpCluster->nstrip;k++){
01721 Int_t index = clustrips[k];
01722 ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
01723
01724 clu_tpos[count] = ntpStrip->tpos;
01725 clu_z[count] = ntpStrip->z;
01726
01727 if(ntpStrip->planeview==2){
01728 clu_tpos0[numclustp0] = clu_tpos[count];
01729 clu_z0[numclustp0] = clu_z[count];
01730 numclustp0+=1;
01731 }
01732 else {
01733 clu_tpos1[numclustp1] = clu_tpos[count];
01734 clu_z1[numclustp1] = clu_z[count];
01735 numclustp1+=1;
01736 }
01737 count++;
01738 }
01739
01740 if(numclustp0>0){
01741 TGraph *temp = new TGraph(numclustp0,clu_z0,clu_tpos0);
01742 if(col0==10) col0+=1;
01743 temp->SetMarkerColor(col0);
01744 temp->SetMarkerSize(0.6);
01745 temp->SetMarkerStyle(21);
01746 if(ntpCluster->id==2 ||
01747 ntpCluster->id==4) temp->SetMarkerStyle(25);
01748 tz_clu0->Add(temp);
01749 col0+=1;
01750 char ssnom[256];
01751 if(ntpCluster->id==0||ntpCluster->id==1){
01752 sprintf(ssnom,"%s (%.2f)",
01753 ClusterType::AsString(ClusterType::
01754 EClusterType(ntpCluster->id)),
01755 ntpCluster->probem);
01756 }
01757 else {
01758 sprintf(ssnom,"%s",
01759 ClusterType::AsString(ClusterType::
01760 EClusterType(ntpCluster->id)));
01761 }
01762 cluLeg0->AddEntry(temp,ssnom,"p");
01763 }
01764
01765 if(numclustp1>0){
01766 if(col1==10) col1+=1;
01767 TGraph *temp = new TGraph(numclustp1,clu_z1,clu_tpos1);
01768 temp->SetMarkerColor(col1);
01769 temp->SetMarkerSize(0.6);
01770 temp->SetMarkerStyle(21);
01771 if(ntpCluster->id==2 ||
01772 ntpCluster->id==4) temp->SetMarkerStyle(25);
01773 tz_clu1->Add(temp);
01774 col1+=1;
01775 char ssnom[256];
01776 if(ntpCluster->id==0||ntpCluster->id==1){
01777 sprintf(ssnom,"%s (%.2f)",
01778 ClusterType::AsString(ClusterType::
01779 EClusterType(ntpCluster->id)),
01780 ntpCluster->probem);
01781 }
01782 else {
01783 sprintf(ssnom,"%s",
01784 ClusterType::AsString(ClusterType::
01785 EClusterType(ntpCluster->id)));
01786 }
01787 cluLeg1->AddEntry(temp,ssnom,"p");
01788 }
01789 }
01790
01791 delete [] clu_tpos;
01792 delete [] clu_z;
01793 delete [] clu_tpos0;
01794 delete [] clu_z0;
01795 delete [] clu_tpos1;
01796 delete [] clu_z1;
01797
01798 }
01799 if(nUclus==0) {
01800 delete tz_clu0;
01801 tz_clu0=NULL;
01802 }
01803 if(nVclus==0) {
01804 delete tz_clu1;
01805 tz_clu1=NULL;
01806 }
01807 }
01808
01810 if(isEM){
01811
01812
01813 if(ntpEMSummary->nshower!=0){
01814
01815 if(!tz_emshw0){
01816 tz_emshw0 = new TMultiGraph();
01817 tz_emshw0->SetName("tz_emshw0");
01818 }
01819 if(!tz_emshw1){
01820 tz_emshw1 = new TMultiGraph();
01821 tz_emshw1->SetName("tz_emshw1");
01822 }
01823 int numemshwstp=0;
01824 int numemshwstp0=0;
01825 int numemshwstp1=0;
01826
01827 for(int i=0;i<ntpEMSummary->nshower;i++){
01828 LoadEMShower(i);
01829 numemshwstp += ntpEMShower->nstrip;
01830 }
01831
01832 float *emshw_tpos = new float[numemshwstp];
01833 float *emshw_z = new float[numemshwstp];
01834 float *emshw_tpos0 = new float[numemshwstp];
01835 float *emshw_z0 = new float[numemshwstp];
01836 float *emshw_tpos1 = new float[numemshwstp];
01837 float *emshw_z1 = new float[numemshwstp];
01838 int count = 0;
01839
01840 for(int i=0;i<ntpEMSummary->nshower;i++){
01841 LoadEMShower(i);
01842 Int_t *emshwstrips = ntpEMShower->stp;
01843 count=0;
01844 numemshwstp0=0;
01845 numemshwstp1=0;
01846 for(int j=0;j<ntpEMShower->nstrip;j++){
01847 Int_t index = emshwstrips[j];
01848 ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
01849 emshw_tpos[count] = ntpStrip->tpos;
01850 emshw_z[count] = ntpStrip->z;
01851 if(ntpStrip->planeview==2){
01852 emshw_tpos0[numemshwstp0] = emshw_tpos[count];
01853 emshw_z0[numemshwstp0] = emshw_z[count];
01854 numemshwstp0+=1;
01855 }
01856 else {
01857 emshw_tpos1[numemshwstp1] = emshw_tpos[count];
01858 emshw_z1[numemshwstp1] = emshw_z[count];
01859 numemshwstp1+=1;
01860 }
01861 count++;
01862 }
01863
01864 if(numemshwstp0>0){
01865 TGraph *temp = new TGraph(numemshwstp0,emshw_z0,emshw_tpos0);
01866 temp->SetMarkerColor(7);
01867 temp->SetMarkerSize(0.6);
01868 temp->SetMarkerStyle(4);
01869 tz_emshw0->Add(temp);
01870 }
01871 else {
01872 delete tz_emshw0;
01873 tz_emshw0 = NULL;
01874 }
01875
01876 if(numemshwstp1>0){
01877 TGraph *temp = new TGraph(numemshwstp1,emshw_z1,emshw_tpos1);
01878 temp->SetMarkerColor(7);
01879 temp->SetMarkerSize(0.6);
01880 temp->SetMarkerStyle(4);
01881 tz_emshw1->Add(temp);
01882 }
01883 else {
01884 delete tz_emshw1;
01885 tz_emshw1 = NULL;
01886 }
01887 }
01888 delete [] emshw_tpos;
01889 delete [] emshw_z;
01890 delete [] emshw_tpos0;
01891 delete [] emshw_z0;
01892 delete [] emshw_tpos1;
01893 delete [] emshw_z1;
01894 }
01895 }
01896
01898
01899
01900 if(ntpEvent->ntrack>0){
01901 if(!tz_trk0){
01902 tz_trk0 = new TMultiGraph();
01903 tz_trk0->SetName("tz_trk0");
01904 }
01905 if(!tz_trk1){
01906 tz_trk1 = new TMultiGraph();
01907 tz_trk1->SetName("tz_trk1");
01908 }
01909 if(!xz_trk){
01910 xz_trk = new TMultiGraph();
01911 xz_trk->SetName("xz_trk");
01912 }
01913 if(!yz_trk){
01914 yz_trk = new TMultiGraph();
01915 yz_trk->SetName("yz_trk");
01916 }
01917 if(!yx_trk){
01918 yx_trk = new TMultiGraph();
01919 yx_trk->SetName("yx_trk");
01920 }
01921 if(!ztime){
01922 ztime = new TMultiGraph();
01923 ztime->SetName("ztime");
01924 ztime->SetTitle("Time vs Z view");
01925 }
01926 if(!ytime){
01927 ytime = new TMultiGraph();
01928 ytime->SetName("ytime");
01929 ytime->SetTitle("Time vs Y view");
01930 }
01931
01932 int *tracks = ntpEvent->trk;
01933
01934 int totnumtrkstp = 0;
01935 int numtrkstpcnt = 0;
01936 int numtrkstp0 = 0;
01937 int numtrkstp1 = 0;
01938
01939 for(int itrk=0;itrk<ntpEvent->ntrack;itrk++) {
01940 int index = tracks[itrk];
01941 LoadTrack(index);
01942 totnumtrkstp += ntpTrack->nstrip;
01943 }
01944
01945
01946 if(totnumtrkstp!=0) {
01947
01948 float *trk_tpos = new float[totnumtrkstp];
01949 float *trk_tpos0 = new float[totnumtrkstp];
01950 float *trk_tpos1 = new float[totnumtrkstp];
01951 float *trkstpz0 = new float[totnumtrkstp];
01952 float *trkstpz1 = new float[totnumtrkstp];
01953
01954 float *trkstpx = new float[totnumtrkstp];
01955 float *trkstpy = new float[totnumtrkstp];
01956 float *trkstpz = new float[totnumtrkstp];
01957
01958 int alpha = 0;
01959 double *trk_time = new double[totnumtrkstp*2];
01960 double *trk_y = new double[totnumtrkstp*2];
01961 double *trk_z = new double[totnumtrkstp*2];
01962
01963 for(int itrk=0;itrk<ntpEvent->ntrack;itrk++){
01964
01965 int index1 = tracks[itrk];
01966 LoadTrack(index1);
01967
01968 int numtrkstp = ntpTrack->nstrip;
01969
01970 float *trk_stp_x = ntpTrack->stpx;
01971 float *trk_stp_y = ntpTrack->stpy;
01972 float *trk_stp_z = ntpTrack->stpz;
01973
01974 double *trkstpt0 = ntpTrack->stpt0;
01975 double *trkstpt1 = ntpTrack->stpt1;
01976
01977 int *trkstrips = ntpTrack->stp;
01978 numtrkstpcnt=0;
01979 numtrkstp0=0;
01980 numtrkstp1=0;
01981 alpha=0;
01982
01983 for(int i=0;i<numtrkstp;i++){
01984 int index = trkstrips[i];
01985 ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
01986
01987 trkstpx[numtrkstpcnt] = trk_stp_x[i];
01988 trkstpy[numtrkstpcnt] = trk_stp_y[i];
01989 trkstpz[numtrkstpcnt] = trk_stp_z[i];
01990 trk_tpos[numtrkstpcnt] = ntpStrip->tpos;
01991 numtrkstpcnt++;
01992
01993 if(ntpStrip->planeview==2){
01994 trk_tpos0[numtrkstp0] = ntpStrip->tpos;
01995 trkstpz0[numtrkstp0] = trk_stp_z[i];
01996 numtrkstp0+=1;
01997 }
01998 else {
01999 trk_tpos1[numtrkstp1] = ntpStrip->tpos;
02000 trkstpz1[numtrkstp1] = trk_stp_z[i];
02001 numtrkstp1+=1;
02002 }
02003 }
02004
02005 for(int i=0;i<numtrkstp;i++){
02006 if(trkstpt0[i]!=-999999){
02007 trk_time[alpha] = 1e9*(trkstpt0[i]-eventSummary->trigtime);
02008 trk_z[alpha] = trk_stp_z[i];
02009 trk_y[alpha] = trk_stp_y[i];
02010 alpha+=1;
02011 }
02012 if(trkstpt1[i]!=-999999){
02013 trk_time[alpha] = 1e9*(trkstpt1[i]-eventSummary->trigtime);
02014 trk_z[alpha] = trk_stp_z[i];
02015 trk_y[alpha] = trk_stp_y[i];
02016 alpha+=1;
02017 }
02018 }
02019
02020 TGraph *temp = 0;
02021 if(numtrkstp0>0){
02022 temp = new TGraph(numtrkstp0,trkstpz0,trk_tpos0);
02023 temp->SetMarkerColor(2);
02024 temp->SetMarkerSize(0.6);
02025 temp->SetMarkerStyle(8);
02026 tz_trk0->Add(temp);
02027 }
02028 else {
02029 delete tz_trk0;
02030 tz_trk0 = NULL;
02031 }
02032
02033 if(numtrkstp1>0){
02034 temp = new TGraph(numtrkstp1,trkstpz1,trk_tpos1);
02035 temp->SetMarkerColor(2);
02036 temp->SetMarkerSize(0.6);
02037 temp->SetMarkerStyle(8);
02038 tz_trk1->Add(temp);
02039 }
02040 else {
02041 delete tz_trk1;
02042 tz_trk1 = NULL;
02043 }
02044
02045 if(numtrkstpcnt>0){
02046 temp = new TGraph(numtrkstpcnt,trkstpz,trkstpx);
02047 temp->SetMarkerColor(2);
02048 temp->SetMarkerSize(0.6);
02049 temp->SetMarkerStyle(8);
02050 xz_trk->Add(temp);
02051
02052 temp = new TGraph(numtrkstpcnt,trkstpz,trkstpy);
02053 temp->SetMarkerColor(2);
02054 temp->SetMarkerSize(0.6);
02055 temp->SetMarkerStyle(8);
02056 yz_trk->Add(temp);
02057
02058 temp = new TGraph(numtrkstpcnt,trkstpx,trkstpy);
02059 temp->SetMarkerColor(2);
02060 temp->SetMarkerSize(0.6);
02061 temp->SetMarkerStyle(8);
02062 yx_trk->Add(temp);
02063 }
02064
02065 if(alpha>0){
02066 temp = new TGraph(alpha,trk_z,trk_time);
02067 temp->SetMarkerColor(2);
02068 temp->SetMarkerSize(0.6);
02069 temp->SetMarkerStyle(8);
02070 ztime->Add(temp);
02071
02072 temp = new TGraph(alpha,trk_y,trk_time);
02073 temp->SetMarkerColor(2);
02074 temp->SetMarkerSize(0.6);
02075 temp->SetMarkerStyle(8);
02076 ytime->Add(temp);
02077 }
02078 }
02079
02080 delete [] trkstpx;
02081 delete [] trkstpy;
02082 delete [] trkstpz;
02083 delete [] trk_tpos;
02084 delete [] trk_tpos0;
02085 delete [] trk_tpos1;
02086 delete [] trkstpz0;
02087 delete [] trkstpz1;
02088 delete [] trk_time;
02089 delete [] trk_y;
02090 delete [] trk_z;
02091
02092 }
02093 }
02094 }
02095
02096
02097 if(!yx_veto) {
02098 yx_veto = new TMultiGraph();
02099 yx_veto->SetName("yx_veto");
02100 }
02101 if(!ytime_veto) {
02102 ytime_veto = new TMultiGraph();
02103 ytime_veto->SetName("ytime_veto");
02104 }
02105
02106 if(shieldstripArray.GetEntries()!=0&&shieldSummary->ishit){
02107 int nvetostp = shieldstripArray.GetEntries();
02108 double *vetostp_x = new double[nvetostp];
02109 double *vetostp_y = new double[nvetostp];
02110 double *veto_y = new double[nvetostp*2];
02111 double *veto_time = new double[nvetostp*2];
02112 int beta = 0;
02113
02114 for(int i=0;i<nvetostp;i++) {
02115 ntpShieldStrip = dynamic_cast<NtpSRShieldStrip *>(shieldstripArray[i]);
02116 vetostp_x[i] = ntpShieldStrip->x;
02117 vetostp_y[i] = ntpShieldStrip->y;
02118
02119 veto_time[beta] = ntpShieldStrip->time[0];
02120 veto_y[beta] = vetostp_y[i];
02121 beta+=1;
02122
02123 veto_time[beta] = ntpShieldStrip->time[1];
02124 veto_y[beta] = vetostp_y[i];
02125 beta+=1;
02126 }
02127
02128 TGraph *temp1 = new TGraph(nvetostp,vetostp_x,vetostp_y);
02129 temp1->SetMarkerColor(7);
02130 temp1->SetMarkerSize(0.6);
02131 temp1->SetMarkerStyle(8);
02132 yx_veto->Add(temp1);
02133
02134 TGraph *temp2 = new TGraph(beta,veto_y,veto_time);
02135 temp2->SetMarkerColor(7);
02136 temp2->SetMarkerSize(0.6);
02137 temp2->SetMarkerStyle(8);
02138 ytime_veto->Add(temp2);
02139
02140 delete [] vetostp_x;
02141 delete [] vetostp_y;
02142 delete [] veto_time;
02143 delete [] veto_y;
02144 }
02145 else {
02146 delete yx_veto; yx_veto = NULL;
02147 delete ytime_veto; ytime_veto = NULL;
02148 }
02149
02151
02152
02153 TArrow *tz_arrow1 = 0;
02154 TArrow *tz_arrow2 = 0;
02155 float nu_mu_angle = 0;
02156 float nu_el_angle = 0;
02157 float zen_mu_angle = 0;
02158
02159 MainCanvas->cd(1);
02160 gPad->Clear();
02161
02162 if(isMC){
02163
02164 TVector3 *nuvec = new TVector3(ntpTruth->p4neunoosc[0],
02165 ntpTruth->p4neunoosc[1],
02166 ntpTruth->p4neunoosc[2]);
02167 TVector3 *muvec = new TVector3(ntpTruth->p4mu1[0],
02168 ntpTruth->p4mu1[1],
02169 ntpTruth->p4mu1[2]);
02170 TVector3 *elvec = new TVector3(ntpTruth->p4el1[0],
02171 ntpTruth->p4el1[1],
02172 ntpTruth->p4el1[2]);
02173 TVector3 *zenith = new TVector3(0,-1,0);
02174
02175 nu_mu_angle = nuvec->Angle(*muvec);
02176 nu_el_angle = nuvec->Angle(*elvec);
02177 zen_mu_angle = muvec->Angle(*zenith);
02178
02179 nuvec->RotateZ(-TMath::Pi()/4.);
02180 muvec->RotateZ(-TMath::Pi()/4.);
02181 TVector3 unitnu;
02182 if(ntpTruth->p4neu[3]<0.00001) unitnu = muvec->Unit();
02183 else unitnu = nuvec->Unit();
02184
02185 float mc_vtxu = ntpTruth->vtxx/(sqrt(2.))
02186 + ntpTruth->vtxy/(sqrt(2.));
02187 float mc_vtxv = - ntpTruth->vtxx/(sqrt(2.))
02188 + ntpTruth->vtxy/(sqrt(2.));
02189
02190
02191 tz_arrow1 = new TArrow(ntpTruth->vtxz-unitnu.Z(),
02192 mc_vtxu-unitnu.X(),
02193 ntpTruth->vtxz,mc_vtxu,0.02,"|>");
02194 tz_arrow1->SetFillColor(5);
02195 tz_arrow1->SetLineColor(9);
02196 tz_arrow1->SetLineWidth(2);
02197
02198 tz_arrow2 = new TArrow(ntpTruth->vtxz-unitnu.Z(),
02199 mc_vtxv-unitnu.Y(),
02200 ntpTruth->vtxz,mc_vtxv,0.02,"|>");
02201 tz_arrow2->SetFillColor(5);
02202 tz_arrow2->SetLineColor(9);
02203 tz_arrow2->SetLineWidth(2);
02204
02205 delete nuvec;
02206 delete muvec;
02207 delete elvec;
02208 }
02209
02210
02211
02212 TLine** paru = 0;
02213 TLine** parv = 0;
02214 bool usingparuv = false;
02215 int nstdhep = 0;
02216 int *drawline = 0;
02217 if (isMC&&isTH){
02218 TClonesArray* pointHepArray = NULL;
02219 if(isST) pointHepArray = (strecord->stdhep);
02220 else pointHepArray = (mcrecord->stdhep);
02221 TClonesArray& heparray = *pointHepArray;
02222 nstdhep = heparray.GetLast()+1;
02223 double *vtx_u = new double[nstdhep];
02224 double *vtx_v = new double[nstdhep];
02225 double *vtx_z = new double[nstdhep];
02226 double *p_u = new double[nstdhep];
02227 double *p_v = new double[nstdhep];
02228 double *p_z = new double[nstdhep];
02229 double *p_tot = new double[nstdhep];
02230 double *k_u = new double[nstdhep];
02231 double *k_v = new double[nstdhep];
02232 double *epar = new double[nstdhep];
02233 int *idhep = new int[nstdhep];
02234 drawline = new int[nstdhep];
02235
02236 if(LoadTHEvent(theEvent)) {
02237 NtpMCStdHep* hep0 =
02238 dynamic_cast<NtpMCStdHep*>(heparray[ntpTHEvent->neustdhep]);
02239 int currentmc = hep0->mc;
02240
02241 for (int istd = 0; istd < nstdhep; istd++){
02242 NtpMCStdHep* hep = dynamic_cast<NtpMCStdHep*>(heparray[istd]);
02243 drawline[istd] = 0;
02244 vtx_u[istd] = (hep->vtx[0]+hep->vtx[1])*sqrt(2.)/2;
02245 vtx_v[istd] = (hep->vtx[1]-hep->vtx[0])*sqrt(2.)/2;
02246 vtx_z[istd] = hep->vtx[2];
02247
02248 p_u[istd] = (hep->p4[0]+hep->p4[1])*sqrt(2.)/2;
02249 p_v[istd] = (hep->p4[1]-hep->p4[0])*sqrt(2.)/2;
02250 p_z[istd] = hep->p4[2];
02251 p_tot[istd] = sqrt(p_u[istd]*p_u[istd] + p_v[istd]*p_v[istd] +
02252 p_z[istd]*p_z[istd]);
02253
02254 epar[istd] = hep->p4[3];
02255 idhep[istd] = abs(hep->IdHEP);
02256 if (fabs(p_z[istd])>0.) {
02257 k_u[istd] = p_u[istd]/p_z[istd];
02258 k_v[istd] = p_v[istd]/p_z[istd];
02259 }
02260
02261 bool drawphoton = false;
02262 if (abs(hep->IdHEP)==22){
02263 NtpMCStdHep*hep_parent =
02264 dynamic_cast<NtpMCStdHep*>(heparray[hep->parent[0]]);
02265 if (abs(hep_parent->IdHEP)!=111) drawphoton = true;
02266 }
02267
02268
02269
02270
02271
02272
02273
02274 if(hep->mc==currentmc){
02275 hep->Print();
02276
02277 if(hep->IstHEP==1 && hep->IdHEP<10000){
02278
02279 if(hep->IdHEP!=28) drawline[istd]=1;
02280
02281
02282 }
02283 }
02284 }
02285 paru = new TLine*[nstdhep];
02286 parv = new TLine*[nstdhep];
02287 usingparuv = true;
02288 for (int istd = 0; istd < nstdhep; istd++){
02289 if (drawline[istd] == 1){
02290 if(p_tot[istd]<=0.001) {
02291 drawline[istd]=0;
02292 continue;
02293 }
02294 float pztot = p_z[istd]/p_tot[istd];
02295 float putot = p_u[istd]/p_tot[istd];
02296 float pvtot = p_v[istd]/p_tot[istd];
02297 paru[istd] = new TLine(vtx_z[istd], vtx_u[istd],
02298 vtx_z[istd] + pztot*epar[istd]/3,
02299 vtx_u[istd] + putot*epar[istd]/3);
02300 parv[istd] = new TLine(vtx_z[istd], vtx_v[istd],
02301 vtx_z[istd] + pztot*epar[istd]/3,
02302 vtx_v[istd] + pvtot*epar[istd]/3);
02303 if(idhep[istd] == 11) {
02304 paru[istd]->SetLineColor(3);
02305 parv[istd]->SetLineColor(3);
02306 }
02307 else if(idhep[istd] == 13) {
02308 paru[istd]->SetLineColor(4);
02309 parv[istd]->SetLineColor(4);
02310 }
02311 else if(idhep[istd] == 15) {
02312 paru[istd]->SetLineColor(1);
02313 parv[istd]->SetLineColor(1);
02314 }
02315 else if(idhep[istd] == 211){
02316 paru[istd]->SetLineColor(6);
02317 parv[istd]->SetLineColor(6);
02318 }
02319 else if(idhep[istd] == 2212){
02320 paru[istd]->SetLineColor(2);
02321 parv[istd]->SetLineColor(2);
02322 }
02323 else if(idhep[istd] == 111) {
02324 paru[istd]->SetLineColor(7);
02325 parv[istd]->SetLineColor(7);
02326 }
02327 else if(idhep[istd] == 22){
02328 paru[istd]->SetLineColor(9);
02329 parv[istd]->SetLineColor(9);
02330 }
02331 else if(idhep[istd] == 2112){
02332 paru[istd]->SetLineColor(28);
02333 parv[istd]->SetLineColor(28);
02334 }
02335 else if(idhep[istd] == 321 || idhep[istd] == 311 ||
02336 idhep[istd] == 310 || idhep[istd] == 130){
02337 paru[istd]->SetLineColor(31);
02338 parv[istd]->SetLineColor(31);
02339 }
02340 else if(idhep[istd] == 12 || idhep[istd] == 14 ||
02341 idhep[istd] == 16){
02342 paru[istd]->SetLineStyle(2);
02343 parv[istd]->SetLineStyle(2);
02344 }
02345 }
02346 }
02347 }
02348
02349 delete[] vtx_u;
02350 delete[] vtx_v;
02351 delete[] vtx_z;
02352 delete[] p_u;
02353 delete[] p_v;
02354 delete[] p_z;
02355 delete[] p_tot;
02356 delete[] k_u;
02357 delete[] k_v;
02358 delete[] epar;
02359 delete[] idhep;
02360 }
02361
02363
02364 this->DrawTextBox(MainCanvas,isReco);
02365
02367
02368
02369 RecoCanvas->cd(1);
02370 gPad->Clear();
02371 xz_place->Draw();
02372 if(xz_trk) xz_trk->Draw("P");
02373 if(xz_shw) xz_shw->Draw("P");
02374
02375 RecoCanvas->cd(4);
02376 gPad->Clear();
02377 yz_place->Draw();
02378 if(yz_trk) yz_trk->Draw("P");
02379 if(yz_shw) yz_shw->Draw("P");
02380
02381 RecoCanvas->cd(2);
02382 gPad->Clear();
02383
02384 if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
02385 yx_place->GetXaxis()->SetRangeUser(-2.6,3.8);
02386 yx_place->GetYaxis()->SetRangeUser(-3.2,3.2);
02387
02388 }
02389 else {
02390 yx_place->GetXaxis()->UnZoom();
02391 yx_place->GetYaxis()->UnZoom();
02392 }
02393 yx_place->Draw();
02394
02395
02396
02397 if(ntpHeader->GetVldContext().GetDetector()==Detector::kFar)
02398 ellie->Draw();
02399
02400
02401 if(yx_trk) yx_trk->Draw("P");
02402 if(yx_shw) yx_shw->Draw("P");
02403 if(yx_veto) yx_veto->Draw("P");
02404
02405 line->Draw();
02406 if(ntpHeader->GetVldContext().GetDetector()==Detector::kNear){
02407 fu1_outline->Draw();
02408 fu2_outline->Draw();
02409 fv1_outline->Draw();
02410 fv2_outline->Draw();
02411 pu1_outline->Draw();
02412
02413 pv1_outline->Draw();
02414
02415 }
02416
02417
02418
02419 RecoCanvas->cd(3);
02420 TVirtualPad *RecoCanvas_3 = RecoCanvas->GetPad(3);
02421 RecoCanvas_3->Clear();
02422
02423 tz_place_0->Draw(tz_place_dopt.c_str());
02424 tz_place_0->SetAxisRange(lowest_z,highest_z,"X");
02425 tz_place_0->SetAxisRange(lowest_t0,highest_t0,"Y");
02426
02427 if(tz_stp_0) tz_stp_0->Draw("P");
02428 if(tz_stp_mid_0) tz_stp_mid_0->Draw("P");
02429 if(tz_stp_spe_0) tz_stp_spe_0->Draw("P");
02430
02431 if(tz_trk0) tz_trk0->Draw("P");
02432 if(tz_shw0) tz_shw0->Draw("P");
02433 if(tz_emshw0) tz_emshw0->Draw("P");
02434
02435 RecoCanvas_3->Update();
02436 RecoCanvas_3->Modified();
02437
02438 RecoCanvas->cd(5);
02439 TVirtualPad *RecoCanvas_5 = RecoCanvas->GetPad(5);
02440 RecoCanvas_5->cd(1);
02441 gPad->Clear();
02442 if(ytime){
02443 ytime->Draw("AP");
02444 ytime->GetXaxis()->SetTitle("y position (m)");
02445 ytime->GetYaxis()->SetTitle("time (ns)");
02446 if(ytime_veto) ytime_veto->Draw("P");
02447 }
02448 gPad->Update();
02449 gPad->Modified();
02450
02451 RecoCanvas_5->cd(2);
02452 gPad->Clear();
02453 if(ztime) {
02454 ztime->Draw("AP");
02455 ztime->GetXaxis()->SetTitle("z position (m)");
02456 ztime->GetYaxis()->SetTitle("time (ns)");
02457 }
02458 gPad->Update();
02459 gPad->Modified();
02460
02461 RecoCanvas->cd(6);
02462 gPad->Clear();
02463 tz_place_1->Draw(tz_place_dopt.c_str());
02464 tz_place_1->SetAxisRange(lowest_z,highest_z,"X");
02465 tz_place_1->SetAxisRange(lowest_t1,highest_t1,"Y");
02466
02467 if(tz_stp_1) tz_stp_1->Draw("P");
02468 if(tz_stp_mid_1) tz_stp_mid_1->Draw("P");
02469 if(tz_stp_spe_1) tz_stp_spe_1->Draw("P");
02470
02471 if(tz_trk1) tz_trk1->Draw("P");
02472 if(tz_shw1) tz_shw1->Draw("P");
02473 if(tz_emshw1) tz_emshw1->Draw("P");
02474
02475 gPad->Update();
02476 gPad->Modified();
02477
02479
02480 MainCanvas->cd(3);
02481 gPad->Clear();
02482
02483 tz_place_0->Draw(tz_place_dopt.c_str());
02484
02485 if(nstp_big_0>0) tz_stp_0->Draw("P");
02486 if(nstp_mid_0>0) tz_stp_mid_0->Draw("P");
02487 if(nstp_spe_0>0) tz_stp_spe_0->Draw("P");
02488
02489 if(tz_trk0) tz_trk0->Draw("P");
02490 if(tz_shw0) tz_shw0->Draw("P");
02491 if(tz_emshw0) tz_emshw0->Draw("P");
02492 if(isMC) {
02493 tz_arrow1->Draw();
02494 if(isTH && usingparuv){
02495 for (int istd = 0; istd < nstdhep; istd++){
02496 if (drawline[istd] == 1) paru[istd]->Draw("same");
02497 }
02498 }
02499 }
02500 gPad->Modified();
02501 gPad->Update();
02502
02503 MainCanvas->cd(4);
02504 gPad->Clear();
02505
02506 tz_place_1->Draw(tz_place_dopt.c_str());
02507
02508 if(nstp_big_1>0) tz_stp_1->Draw("P");
02509 if(nstp_mid_1>0) tz_stp_mid_1->Draw("P");
02510 if(nstp_spe_1>0) tz_stp_spe_1->Draw("P");
02511
02512 if(tz_trk1) tz_trk1->Draw("P");
02513 if(tz_shw1) tz_shw1->Draw("P");
02514 if(tz_emshw1) tz_emshw1->Draw("P");
02515 if(isMC) {
02516 tz_arrow2->Draw();
02517 if(isTH && usingparuv){
02518 for (int istd = 0; istd < nstdhep; istd++){
02519 if (drawline[istd] == 1) parv[istd]->Draw("same");
02520 }
02521 }
02522 }
02523
02525
02526 if(LeLego) {
02527 tz_0_lego->SetAxisRange(lowest_plane,highest_plane,"X");
02528 tz_1_lego->SetAxisRange(lowest_plane,highest_plane,"X");
02529 tz_0_lego->SetAxisRange(lowest_t0,highest_t0,"Y");
02530 tz_1_lego->SetAxisRange(lowest_t1,highest_t1,"Y");
02531
02532 LegoCanvas->cd(1);
02533 tz_0_lego->Draw("LEGO2");
02534 gPad->Update();
02535 gPad->Modified();
02536
02537 LegoCanvas->cd(2);
02538 tz_1_lego->Draw("LEGO2");
02539 gPad->Update();
02540 gPad->Modified();
02541 }
02542
02544
02545 if(LeClus){
02546 ClusterCanvas->cd(1);
02547 gPad->Clear();
02548 if(tz_clu0) {
02549 if(tz_clu0->Sizeof()>0){
02550 tz_place_0->Draw(tz_place_dopt.c_str());
02551 tz_clu0->Draw("P");
02552 if(cluLeg0) cluLeg0->Draw();
02553 if(isMC) {
02554
02555 if(isTH){
02556 for (int istd = 0; istd < nstdhep; istd++){
02557 if (drawline[istd] == 1) paru[istd]->Draw("same");
02558 }
02559 }
02560 }
02561 }
02562 }
02563 gPad->Update();
02564 gPad->Modified();
02565
02566 ClusterCanvas->cd(2);
02567 gPad->Clear();
02568 if(tz_clu1) {
02569 if(tz_clu1->Sizeof()>0){
02570 tz_place_1->Draw(tz_place_dopt.c_str());
02571 tz_clu1->Draw("P");
02572 if(cluLeg1) cluLeg1->Draw();
02573 if(isMC) {
02574
02575 if(isTH){
02576 for (int istd = 0; istd < nstdhep; istd++){
02577 if (drawline[istd] == 1) parv[istd]->Draw("same");
02578 }
02579 }
02580 }
02581 }
02582 }
02583 gPad->Update();
02584 gPad->Modified();
02585 }
02586
02587
02588 if (isMC&&isTH) delete[] drawline;
02589
02591
02592
02593 if(ptt_msg) {
02594
02595 float Sum_mcA = 0;
02596 float Sum_mcB = 0;
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606 std::cout << "Run: " << ntpHeader->GetRun()
02607 << " Snarl: " << ntpHeader->GetSnarl()
02608 << " (entry: " << entry << ")" << std::endl;
02609 std::cout << "-----------------------------------" << std::endl;
02610 std::cout << "Truth:" << std::endl;
02611 std::cout << "\tSummed PEs=" << Sum_mcA+Sum_mcB << "\tSummed PEs/0.6="
02612 << (Sum_mcA+Sum_mcB)/0.6 << std::endl;
02613 std::cout << "-----------------------------------" << std::endl;
02614 std::cout << "Reco:" << std::endl;
02615 std::cout << "\tNumber of slices\t"<< eventSummary->nslice << std::endl;
02616 std::cout << "\tSummed Raw Charge in Snarl (Current Slice) "
02617 << eventSummary->ph.raw << " ("
02618 << ntpSlice->ph.raw << ")" << std::endl;
02619 std::cout << "\tSummed PEs in Snarl (Current Slice) "
02620 << eventSummary->ph.pe << " ("
02621 << ntpSlice->ph.pe << ")" << std::endl;
02622 std::cout << "\tNumber of Reco Digits in Slice = " << ntpSlice->ndigit
02623 << " Strips = "
02624 << (nstp_spe_0+nstp_spe_1+nstp_mid_0+nstp_mid_1+nstp_big_0
02625 +nstp_big_1) << std::endl;
02626 std::cout << "===================================" << std::endl;
02627 }
02628
02629 MainCanvas->cd(2);
02630
02631 return true;
02632 }
02633
02634
02635 void MadEvDisplay::DrawTextBox(TCanvas *MainCanvas,Bool_t isReco){
02636
02637
02638 float nu_mu_angle = 0;
02639 float nu_el_angle = 0;
02640 float zen_mu_angle = 0;
02641 if(isMC){
02642 TVector3 *nuvec = new TVector3(ntpTruth->p4neunoosc[0],
02643 ntpTruth->p4neunoosc[1],
02644 ntpTruth->p4neunoosc[2]);
02645 TVector3 *muvec = new TVector3(ntpTruth->p4mu1[0],
02646 ntpTruth->p4mu1[1],
02647 ntpTruth->p4mu1[2]);
02648 TVector3 *elvec = new TVector3(ntpTruth->p4el1[0],
02649 ntpTruth->p4el1[1],
02650 ntpTruth->p4el1[2]);
02651 TVector3 *zenith = new TVector3(0,-1,0);
02652 nu_mu_angle = nuvec->Angle(*muvec);
02653 nu_el_angle = nuvec->Angle(*elvec);
02654 zen_mu_angle = muvec->Angle(*zenith);
02655 }
02656
02657
02658 char sometext1[100] = ".";
02659 if(isReco) sprintf(sometext1,
02660 "Run: %i, Snarl: %i, Slice: %i(/%i), Event %i(/%i)",
02661 ntpHeader->GetRun(),ntpHeader->GetSnarl(),LeSlice+1,
02662 eventSummary->nslice,LeEvent+1,eventSummary->nevent);
02663 else sprintf(sometext1,
02664 "Run: %i, Snarl: %i, Slice: %i(/%i), Event %i(/%i)",
02665 ntpHeader->GetRun(),ntpHeader->GetSnarl(),LeSlice+1,
02666 eventSummary->nslice,0,eventSummary->nevent);
02667
02668
02669 char sometext2[100] = "Truth";
02670 char sometext3[100] = "N/A";
02671 char sometext4[100] = "N/A";
02672 char sometext5[100] = "N/A";
02673 char sometext6[100] = "N/A";
02674 char sometext7[100] = "N/A";
02675 char sometext8[100] = "N/A";
02676
02677
02678 char sometext9[100] = "N/A";
02679 char sometext10[100] = "N/A";
02680 char sometext14[100] = "N/A";
02681
02682 if(isReco&&eventSummary->nevent!=0&&isTH) {
02683
02684 LoadTHSlice(LeSlice);
02685 if(ntpTHSlice) sprintf(sometext9,"Reco - Slice (%.3f, %.3f)",
02686 ntpTHSlice->purity,ntpTHSlice->complete);
02687 else sprintf(sometext9,"Reco");
02688
02689
02690 if(ntpEvent->nshower>0&&ntpTHShower){
02691 if(LoadTHShower(ntpEvent->shw[0]))
02692 sprintf(sometext14," #Shws: %i (%.3f, %.3f)",
02693 ntpEvent->nshower,ntpTHShower->purity,ntpTHShower->completeall);
02694 for(int i=1;i<ntpEvent->nshower;i++){
02695 LoadTHShower(ntpEvent->shw[i]);
02696 if(ntpTHShower)
02697 sprintf(sometext14,"%s (%.3f, %.3f)",sometext14,ntpTHShower->purity,
02698 ntpTHShower->completeall);
02699 }
02700 }
02701 else if(ntpEvent->nshower>0) sprintf(sometext14," #Shws: %i",
02702 ntpEvent->nshower);
02703 else sprintf(sometext14," #Shws: 0");
02704
02705
02706 if(ntpEvent->ntrack>0&&ntpTHTrack){
02707 sprintf(sometext10," #Trks: %i (%.3f, %.3f)",
02708 ntpEvent->ntrack,ntpTHTrack->purity,ntpTHTrack->completeall);
02709 for(int i=1;i<ntpEvent->ntrack;i++){
02710 LoadTHTrack(ntpEvent->trk[i]);
02711 if(ntpTHTrack)
02712 sprintf(sometext10,"%s (%.3f, %.3f)",sometext10,ntpTHTrack->purity,
02713 ntpTHTrack->completeall);
02714 }
02715 }
02716 else if(ntpEvent->ntrack>0) sprintf(sometext10," #Trks: %i",
02717 ntpEvent->ntrack);
02718 else sprintf(sometext10," #Trks: 0");
02719
02720 }
02721
02722 else if(isReco&&eventSummary->nevent!=0){
02723 sprintf(sometext9,"Reco");
02724 sprintf(sometext10," #Trks: %i",ntpEvent->ntrack);
02725 sprintf(sometext14," #Shws: %i",ntpEvent->nshower);
02726 }
02727 else {
02728 sprintf(sometext9,"Reco");
02729 sprintf(sometext10," No Reconstruced Event");
02730 }
02731
02732
02733 char sometext11[100] = "N/A";
02734 char sometext12[100] = "N/A";
02735 char sometext13[100] = "N/A";
02736
02737 if(isMC){
02738 TClonesArray* pointMcArray = NULL;
02739 if(isST) pointMcArray = (strecord->mc);
02740 else pointMcArray = (mcrecord->mc);
02741 TClonesArray& mcArray = *pointMcArray;
02742
02743 sprintf(sometext2,"Truth - MC: %i(/%i)",LeMCevent+1,
02744 mcArray.GetEntries());
02745
02746 sprintf(sometext3," Nu ID: %i; NC/CC: %i; Process: %i",ntpTruth->inu,
02747 ntpTruth->iaction,ntpTruth->iresonance);
02748
02749 sprintf(sometext7," Shw Energy: %f",ntpTruth->p4shw[3]);
02750
02751 sprintf(sometext8," Vtx: %.2f, %.2f, %.2f",ntpTruth->vtxx,
02752 ntpTruth->vtxy,ntpTruth->vtxz);
02753
02754 if(abs(ntpTruth->inu)==12){
02755
02756 sprintf(sometext4," Nu E: %.3f; Elec E*q: %.3f",ntpTruth->p4neu[3],
02757 ntpTruth->p4el1[3]);
02758
02759 sprintf(sometext5," Elec p: %.3f; Py: %.2f",
02760 sqrt(ntpTruth->p4el1[3]*ntpTruth->p4el1[3])
02761 -(0.000511*0.000511),ntpTruth->p4el1[1]);
02762
02763 sprintf(sometext6," #theta: %.4f rad, %.2f deg",nu_el_angle,
02764 nu_el_angle*180./TMath::Pi());
02765
02766 }
02767
02768 else if(abs(ntpTruth->inu)==14){
02769
02770 sprintf(sometext4," Nu E: %.3f; Mu E*q: %.3f",ntpTruth->p4neu[3],
02771 ntpTruth->p4mu1[3]);
02772
02773 sprintf(sometext5," Mu p: %.3f; Py: %.2f",
02774 sqrt(ntpTruth->p4mu1[3]*ntpTruth->p4mu1[3])
02775 -(0.10555*0.10555),ntpTruth->p4mu1[1]);
02776
02777 sprintf(sometext6," #theta: %.4f rad, %.2f deg",nu_mu_angle,
02778 nu_mu_angle*180./TMath::Pi());
02779
02780 }
02781
02782 else if(ntpTruth->p4neu[3]<0.00001){
02783
02784 sprintf(sometext4," Nu E: %.3f; Mu E*q: %.3f",ntpTruth->p4neu[3],
02785 ntpTruth->p4mu1[3]);
02786
02787 sprintf(sometext5," Mu p: %.3f; Py: %.2f",
02788 sqrt(ntpTruth->p4mu1[3]*ntpTruth->p4mu1[3])
02789 -(0.10555*0.10555),ntpTruth->p4mu1[1]);
02790
02791 sprintf(sometext6," Zenith angle: %.4f rad, %.2f deg",zen_mu_angle,
02792 zen_mu_angle*180./TMath::Pi());
02793 }
02794
02795 }
02796
02797 if(isReco&&eventSummary->nevent!=0){
02798 const Detector::Detector_t det
02799 = ntpHeader->GetVldContext().GetDetector();
02800 Float_t cor_shw_energy =0;
02801 float best_trk_mom=0.0;
02802 int do_meth=0;
02803 float reco_dircosneu=-1;
02804 const bool is_mc
02805 =(ntpHeader->GetVldContext().GetSimFlag()==SimFlag::kMC);
02806 const double muM=0.10566;
02807 if(ntpEvent->ntrack!=0){
02808
02809 float trk_mom_pq = 0;
02810
02811 int *tracks = ntpEvent->trk;
02812 int index = 0;
02813 float largestEn = 0;
02814 for(int it=0;it<ntpEvent->ntrack;it++){
02815 if(!LoadTrack(tracks[it])) continue;
02816 if(ntpTrack->momentum.qp==0) continue;
02817 if(fabs(1./ntpTrack->momentum.qp)>largestEn) {
02818 largestEn = fabs(1./ntpTrack->momentum.qp);
02819 index = tracks[it];
02820 }
02821 }
02822 LoadTrack(index);
02823 if(ntpTrack->momentum.qp!=0) trk_mom_pq = 1./ntpTrack->momentum.qp;
02824
02825
02826 if(det==Detector::kNear){
02827 int pitt_evt_class =
02828 MadMKAnalysis::PittTrkContained(ntpTrack->end.x,
02829 ntpTrack->end.y,
02830 ntpTrack->end.z,
02831 ntpTrack->end.u,
02832 ntpTrack->end.v);
02833 if(pitt_evt_class>0){
02834 if( (pitt_evt_class == 1) || (pitt_evt_class == 3) )
02835 do_meth=2;
02836 else if( (pitt_evt_class == 2) || (pitt_evt_class == 4) )
02837 do_meth=1;
02838 if(do_meth==1 || do_meth==2){
02839 best_trk_mom =
02840 RecoMKMuEnergy(do_meth,index,!is_mc);
02841 }
02842 }
02843 }
02844 else if(det==Detector::kFar){
02845 do_meth=MadMKAnalysis::FarTrkContained(ntpTrack->end.x,
02846 ntpTrack->end.y,
02847 ntpTrack->end.z);
02848 if(do_meth==1 || do_meth==2){
02849 best_trk_mom =
02850 RecoMKMuEnergy(do_meth,index,!is_mc);
02851 }
02852 }
02853 best_trk_mom = sqrt(best_trk_mom*best_trk_mom - muM*muM);
02854 int range_meth=2;
02855 float mom_range = RecoMKMuEnergy(range_meth,index,!is_mc);
02856 mom_range = sqrt(mom_range*mom_range - muM*muM);
02857 if(det==Detector::kNear)
02858 reco_dircosneu = RecoMuDCosNeuND(index);
02859 else reco_dircosneu = RecoMuDCosNeuFD(index);
02860
02861
02862 char range_used=' ';
02863 char curve_used=' ';
02864 if(do_meth==1) curve_used='*';
02865 else range_used='*';
02866 sprintf(sometext11," q/p: %.3f +/- %.3f, p/q: %.3f %c",
02867 ntpTrack->momentum.qp,
02868 ntpTrack->momentum.eqp,trk_mom_pq,curve_used);
02869
02870 sprintf(sometext12," TrkRangeEnergy: %.3f %c",mom_range,range_used);
02871
02872
02873 sprintf(sometext13," Vtx: %.2f, %.2f, %.2f",ntpTrack->vtx.x,
02874 ntpTrack->vtx.y,ntpTrack->vtx.z);
02875
02876
02877 }
02878 else {
02879 sprintf(sometext11," q/p: %.3f +/- %.3f, p/q: %.3f",0.,0.,0.);
02880 sprintf(sometext12," TrkRangeEnergy: %.3f",0.);
02881 sprintf(sometext13," Vtx: %.2f, %.2f, %.2f",0.,0.,0.);
02882 }
02883 if(ntpEvent->nshower!=0){
02884
02885
02886 int *showers = ntpEvent->shw;
02887 int index = 0;
02888 float largestEn = 0;
02889 float sumEn = 0;
02890 float thisEn = 0;
02891 for(int is=0;is<ntpEvent->nshower;is++){
02892 if(!LoadShower(showers[is])) continue;
02893 if(ntpShower->shwph.linCCgev>largestEn) {
02894 largestEn = ntpShower->shwph.linCCgev;
02895 index = showers[is];
02896 }
02897
02898 thisEn=CorrectShowerEnergy(ntpShower->shwph.linCCgev,
02899 det,CandShowerHandle::kCC);
02900 sumEn+=thisEn;
02901 std::cout<<"shw (i,u,v,z,E,Ecor): ( "<<is<<" , "<<ntpShower->vtx.u
02902 <<" , "<<ntpShower->vtx.v<<" , "<<ntpShower->vtx.z
02903 <<" , "<<ntpShower->ph.gev<<" , "<<thisEn<<" ) "<<std::endl;
02904
02905 }
02906 LoadShower(index);
02907 static int i_shw_message=1;
02908 if(i_shw_message<11){
02909 std::cout<<"Printing the corrected linCC energy ("<<i_shw_message<<"/10)";
02910 if(i_shw_message==10){
02911 std::cout<<" Last message...";
02912 }
02913 std::cout<<std::endl;
02914 i_shw_message++;
02915 }
02916
02917 cor_shw_energy = CorrectShowerEnergy(ntpShower->shwph.linCCgev,
02918 det,CandShowerHandle::kCC);
02919 sprintf(sometext12,"%s RecoShwEnergy: %.3f [%.3f]",sometext12,
02920 cor_shw_energy, sumEn);
02921
02922 }
02923 else {
02924 sprintf(sometext12,"%s RecoShwEnergy: %.3f",sometext12,0.);
02925 }
02926
02927 if(best_trk_mom>0){
02928 float reco_x=0.,reco_y=0.,reco_Q2=0.,reco_W2=0.,reco_QEQ2=0.;
02929 float reco_eshw=cor_shw_energy;
02930 float reco_emu=sqrt(best_trk_mom*best_trk_mom+muM*muM);
02931
02932 float reco_enu=reco_emu+reco_eshw;
02933 const double M=(0.93827 + 0.93957)/2.0;
02934 if(reco_emu>0) reco_Q2 =
02935 2*reco_enu*reco_emu*(1.0 - reco_dircosneu);
02936 reco_W2 = M*M - reco_Q2 + 2*M*reco_eshw;
02937 if(reco_enu>0) reco_y = reco_eshw/reco_enu;
02938 if(reco_eshw>0 && reco_Q2>0) reco_x = reco_Q2/(2*M*reco_eshw);
02939
02940 float muP=(reco_emu*reco_emu -muM*muM);
02941 if(muP<0) muP=0;
02942 else muP=sqrt(muP);
02943 float reco_qe_enu = (M*reco_emu - muM*muM/2.0)
02944 /(M - reco_emu + muP*reco_dircosneu);
02945 reco_QEQ2
02946 = abs(-2.0*reco_qe_enu*(reco_emu-muP*reco_dircosneu)+muM*muM);
02947
02948 sprintf(sometext13,"%s, x,y,Q2,W2 = %.2f, %.2f, %.2f, %.2f",
02949 sometext13, reco_x,reco_y,reco_Q2,reco_W2);
02950 }
02951 }
02952 else {
02953 sprintf(sometext11," q/p: %.3f +/- %.3f, p/q: %.3f",0.,0.,0.);
02954 sprintf(sometext12,
02955 " TrkRangeEnergy: %.3f RecoShwEnergy: %.3f",0.,0.);
02956 sprintf(sometext13," Vtx: %.2f, %.2f, %.2f",0.,0.,0.);
02957 }
02958
02959 const double horzoff = 0.01, vertoff = 0.02;
02960
02961
02962 TLatex *Info1 = new TLatex(horzoff,0.91+vertoff,sometext1);
02963 Info1->SetName("info1");
02964 Info1->SetTextSize(0.06);
02965 Info1->SetTextColor(2);
02966
02967
02968 TLatex *Info9 = new TLatex(horzoff,0.84+vertoff,sometext9);
02969 Info9->SetName("info9");
02970 Info9->SetTextSize(0.06);
02971 Info9->SetTextColor(4);
02972
02973 TLatex *Info10 = new TLatex(horzoff,0.77+vertoff,sometext10);
02974 Info10->SetName("info10");
02975 if(Info10->Sizeof()<70) Info10->SetTextSize(0.05);
02976 else Info10->SetTextSize(0.04);
02977 Info10->SetTextColor(9);
02978
02979 TLatex *Info14 = new TLatex(horzoff,0.70+vertoff,sometext14);
02980 Info14->SetName("info14");
02981 if(Info14->Sizeof()<70) Info14->SetTextSize(0.05);
02982 else Info14->SetTextSize(0.04);
02983 Info14->SetTextColor(9);
02984
02985
02986
02987 TLatex *Info11 = new TLatex(horzoff,0.63+vertoff,sometext11);
02988 Info11->SetName("info11");
02989 Info11->SetTextSize(0.05);
02990 Info11->SetTextColor(9);
02991
02992 TLatex *Info12 = new TLatex(horzoff,0.56+vertoff,sometext12);
02993 Info12->SetName("info12");
02994 Info12->SetTextSize(0.05);
02995 Info12->SetTextColor(9);
02996
02997 TLatex *Info13 = new TLatex(horzoff,0.49+vertoff,sometext13);
02998 Info13->SetName("info13");
02999 Info13->SetTextSize(0.05);
03000 Info13->SetTextColor(9);
03001
03002
03003 TLatex *Info2 = new TLatex(horzoff,0.42+vertoff,sometext2);
03004 Info2->SetName("info2");
03005 Info2->SetTextSize(0.06);
03006 Info2->SetTextColor(3);
03007
03008 TLatex *Info3 = new TLatex(horzoff,0.35+vertoff,sometext3);
03009 Info3->SetName("info3");
03010 Info3->SetTextSize(0.05);
03011 Info3->SetTextColor(8);
03012
03013 TLatex *Info4 = new TLatex(horzoff,0.28+vertoff,sometext4);
03014 Info4->SetName("info4");
03015 Info4->SetTextSize(0.05);
03016 Info4->SetTextColor(8);
03017
03018 TLatex *Info5 = new TLatex(horzoff,0.21+vertoff,sometext5);
03019 Info5->SetName("info5");
03020 Info5->SetTextSize(0.05);
03021 Info5->SetTextColor(8);
03022
03023 TLatex *Info6 = new TLatex(horzoff,0.14+vertoff,sometext6);
03024 Info6->SetName("info6");
03025 Info6->SetTextSize(0.05);
03026 Info6->SetTextColor(8);
03027
03028 TLatex *Info7 = new TLatex(horzoff,0.07+vertoff,sometext7);
03029 Info7->SetName("info7");
03030 Info7->SetTextSize(0.05);
03031 Info7->SetTextColor(8);
03032
03033 TLatex *Info8 = new TLatex(horzoff,0.00+vertoff,sometext8);
03034 Info8->SetName("info8");
03035 Info8->SetTextSize(0.05);
03036 Info8->SetTextColor(8);
03037
03038 MainCanvas->cd(1);
03039 gPad->Range(0,0,1,1);
03040 Info1->Draw();
03041 Info2->Draw();
03042 Info3->Draw();
03043 Info4->Draw();
03044 Info5->Draw();
03045 Info6->Draw();
03046 Info7->Draw();
03047 Info8->Draw();
03048 Info9->Draw();
03049 Info10->Draw();
03050 Info11->Draw();
03051 Info12->Draw();
03052 Info13->Draw();
03053 Info14->Draw();
03054 }
03055
03056
03057 void MadEvDisplay::DrawKey2(TVirtualPad *KeyPad){
03058
03059 KeyPad->cd(2);
03060
03061 TPave *pave = new TPave(0.02,0.02,0.98,0.48);
03062 pave->Draw();
03063
03064 TMarker *marker = new TMarker(0.2,0.89/2.,8);
03065 marker->SetMarkerColor(3);
03066 marker->SetMarkerStyle(8);
03067 marker->SetMarkerSize(1.3);
03068 marker->Draw();
03069 marker = new TMarker(0.2,0.80/2.,8);
03070 marker->SetMarkerColor(4);
03071 marker->SetMarkerStyle(8);
03072 marker->SetMarkerSize(1.3);
03073 marker->Draw();
03074 marker = new TMarker(0.2,0.71/2.,8);
03075 marker->SetMarkerStyle(8);
03076 marker->SetMarkerSize(1.3);
03077 marker->Draw();
03078 marker = new TMarker(0.2,0.62/2.,8);
03079 marker->SetMarkerColor(2);
03080 marker->SetMarkerStyle(8);
03081 marker->SetMarkerSize(0.9);
03082 marker->Draw();
03083 marker = new TMarker(0.2,0.53/2.,4);
03084 marker->SetMarkerColor(fDefaultShowerMarkerColor);
03085 marker->SetMarkerStyle(fDefaultShowerMarkerStyle);
03086 marker->SetMarkerSize(0.9);
03087 marker->Draw();
03088 marker = new TMarker(0.21,0.53/2.,4);
03089 marker->SetMarkerColor(7);
03090 marker->SetMarkerStyle(4);
03091 marker->SetMarkerSize(0.9);
03092 marker->Draw();
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103 TLine *line = new TLine(0.19,0.44/2.,0.25,0.44/2.);
03104 line->SetLineColor(3);
03105 line->SetLineWidth(3);
03106 line->Draw();
03107 line = new TLine(0.49,0.44/2.,0.55,0.44/2.);
03108 line->SetLineColor(4);
03109 line->SetLineWidth(3);
03110 line->Draw();
03111 line = new TLine(0.19,0.35/2.,0.25,0.35/2.);
03112 line->SetLineColor(2);
03113 line->SetLineWidth(3);
03114 line->Draw();
03115 line = new TLine(0.49,0.35/2.,0.55,0.35/2.);
03116 line->SetLineColor(28);
03117 line->SetLineWidth(3);
03118 line->Draw();
03119 line = new TLine(0.19,0.26/2.,0.25,0.26/2.);
03120 line->SetLineColor(6);
03121 line->SetLineWidth(3);
03122 line->Draw();
03123 line = new TLine(0.49,0.26/2.,0.55,0.26/2.);
03124 line->SetLineColor(7);
03125 line->SetLineWidth(3);
03126 line->Draw();
03127 line = new TLine(0.19,0.17/2.,0.25,0.17/2.);
03128 line->SetLineColor(31);
03129 line->SetLineWidth(3);
03130 line->Draw();
03131 line = new TLine(0.49,0.17/2.,0.55,0.17/2.);
03132 line->SetLineColor(9);
03133 line->SetLineWidth(3);
03134 line->Draw();
03135 line = new TLine(0.19,0.08/2.,0.25,0.08/2.);
03136 line->SetLineColor(1);
03137 line->SetLineWidth(3);
03138 line->Draw();
03139 line = new TLine(0.49,0.08/2.,0.55,0.08/2.);
03140 line->SetLineColor(1);
03141 line->SetLineStyle(2);
03142 line->SetLineWidth(3);
03143 line->Draw();
03144
03145 TLatex *tex = new TLatex(0.04,0.86/2.,"Reco");
03146 tex->SetTextFont(132);
03147 tex->SetTextSize(0.05);
03148 tex->SetLineWidth(2);
03149 tex->Draw();
03150 tex = new TLatex(0.04,0.41/2.,"Truth");
03151 tex->SetTextFont(132);
03152 tex->SetTextSize(0.05);
03153 tex->SetLineWidth(2);
03154 tex->Draw();
03155 char temp[256];
03156 sprintf(temp,"Summed NPEs < %.1f",Dspe_val);
03157 tex = new TLatex(0.3,0.86/2.,temp);
03158 tex->SetTextFont(132);
03159 tex->SetTextSize(0.05);
03160 tex->SetLineWidth(2);
03161 tex->Draw();
03162 sprintf(temp,"%.1f < Summed NPEs < %.1f",Dspe_val,Dmid_val);
03163 tex = new TLatex(0.3,0.77/2.,temp);
03164 tex->SetTextFont(132);
03165 tex->SetTextSize(0.05);
03166 tex->SetLineWidth(2);
03167 tex->Draw();
03168 sprintf(temp,"Summed NPEs > %.1f",Dmid_val);
03169 tex = new TLatex(0.3,0.68/2.,temp);
03170 tex->SetTextFont(132);
03171 tex->SetTextSize(0.05);
03172 tex->SetLineWidth(2);
03173 tex->Draw();
03174 tex = new TLatex(0.3,0.59/2.,"Reconstructed Track Hit");
03175 tex->SetTextFont(132);
03176 tex->SetTextSize(0.05);
03177 tex->SetLineWidth(2);
03178 tex->Draw();
03179 tex = new TLatex(0.3,0.50/2.,"Reconstructed Shower Hit (cyan=EM)");
03180 tex->SetTextFont(132);
03181 tex->SetTextSize(0.05);
03182 tex->SetLineWidth(2);
03183 tex->Draw();
03184 tex = new TLatex(0.3,0.41/2.,"e");
03185 tex->SetTextFont(132);
03186 tex->SetTextSize(0.05);
03187 tex->SetLineWidth(2);
03188 tex->Draw();
03189 tex = new TLatex(0.65,0.41/2.,"#mu");
03190 tex->SetTextFont(132);
03191 tex->SetTextSize(0.05);
03192 tex->SetLineWidth(2);
03193 tex->Draw();
03194 tex = new TLatex(0.3,0.32/2.,"p");
03195 tex->SetTextFont(132);
03196 tex->SetTextSize(0.05);
03197 tex->SetLineWidth(2);
03198 tex->Draw();
03199 tex = new TLatex(0.65,0.32/2.,"n");
03200 tex->SetTextFont(132);
03201 tex->SetTextSize(0.05);
03202 tex->SetLineWidth(2);
03203 tex->Draw();
03204 tex = new TLatex(0.3,0.23/2.,"#pi^{+/-}");
03205 tex->SetTextFont(132);
03206 tex->SetTextSize(0.05);
03207 tex->SetLineWidth(2);
03208 tex->Draw();
03209 tex = new TLatex(0.65,0.23/2.,"#pi^{0}");
03210 tex->SetTextFont(132);
03211 tex->SetTextSize(0.05);
03212 tex->SetLineWidth(2);
03213 tex->Draw();
03214 tex = new TLatex(0.3,0.14/2.,"K^{+/-/0}");
03215 tex->SetTextFont(132);
03216 tex->SetTextSize(0.05);
03217 tex->SetLineWidth(2);
03218 tex->Draw();
03219 tex = new TLatex(0.65,0.14/2.,"#gamma");
03220 tex->SetTextFont(132);
03221 tex->SetTextSize(0.05);
03222 tex->SetLineWidth(2);
03223 tex->Draw();
03224 tex = new TLatex(0.3,0.05/2.,"#tau");
03225 tex->SetTextFont(132);
03226 tex->SetTextSize(0.05);
03227 tex->SetLineWidth(2);
03228 tex->Draw();
03229 tex = new TLatex(0.65,0.05/2.,"final #nu");
03230 tex->SetTextFont(132);
03231 tex->SetTextSize(0.05);
03232 tex->SetLineWidth(2);
03233 tex->Draw();
03234
03235 TArrow *arrow = new TArrow(0.79,0.44/2.,0.89,0.44/2.,0.025,"|>");
03236 arrow->SetFillColor(5);
03237 arrow->SetLineColor(9);
03238 arrow->SetLineWidth(2);
03239 arrow->Draw();
03240 tex = new TLatex(0.79,0.32/2.,"initial #nu");
03241 tex->SetTextFont(132);
03242 tex->SetTextSize(0.05);
03243 tex->SetLineWidth(2);
03244 tex->Draw();
03245
03246 }
03247
03248
03249 void MadEvDisplay::DrawKey(TVirtualPad *KeyPad){
03250
03251 KeyPad->cd(2);
03252
03253 TPave *pave = new TPave(0.02,0.02,0.98,0.48);
03254 pave->Draw();
03255
03256 TMarker *marker = new TMarker(0.2,0.89/2.,8);
03257 marker->SetMarkerColor(3);
03258 marker->SetMarkerStyle(8);
03259 marker->SetMarkerSize(1.3);
03260 marker->Draw();
03261 marker = new TMarker(0.2,0.80/2.,8);
03262 marker->SetMarkerColor(4);
03263 marker->SetMarkerStyle(8);
03264 marker->SetMarkerSize(1.3);
03265 marker->Draw();
03266 marker = new TMarker(0.2,0.71/2.,8);
03267 marker->SetMarkerStyle(8);
03268 marker->SetMarkerSize(1.3);
03269 marker->Draw();
03270 marker = new TMarker(0.2,0.62/2.,8);
03271 marker->SetMarkerColor(2);
03272 marker->SetMarkerStyle(8);
03273 marker->SetMarkerSize(0.9);
03274 marker->Draw();
03275 marker = new TMarker(0.2,0.53/2.,4);
03276 marker->SetMarkerColor(6);
03277 marker->SetMarkerStyle(4);
03278 marker->SetMarkerSize(0.9);
03279 marker->Draw();
03280 marker = new TMarker(0.21,0.53/2.,4);
03281 marker->SetMarkerColor(7);
03282 marker->SetMarkerStyle(4);
03283 marker->SetMarkerSize(0.9);
03284 marker->Draw();
03285 marker = new TMarker(0.2,0.44/2.,25);
03286 marker->SetMarkerColor(7);
03287 marker->SetMarkerStyle(25);
03288 marker->SetMarkerSize(1.3);
03289 marker->Draw();
03290 marker = new TMarker(0.2,0.35/2.,26);
03291 marker->SetMarkerColor(3);
03292 marker->SetMarkerStyle(26);
03293 marker->SetMarkerSize(1.3);
03294 marker->Draw();
03295 marker = new TMarker(0.2,0.26/2.,27);
03296 marker->SetMarkerColor(6);
03297 marker->SetMarkerStyle(27);
03298 marker->SetMarkerSize(1.3);
03299 marker->Draw();
03300 marker = new TMarker(0.2,0.17/2.,30);
03301 marker->SetMarkerStyle(30);
03302 marker->SetMarkerSize(1.3);
03303 marker->Draw();
03304 marker = new TMarker(0.2,0.08/2.,28);
03305 marker->SetMarkerColor(6);
03306 marker->SetMarkerStyle(28);
03307 marker->SetMarkerSize(1.3);
03308 marker->Draw();
03309 TLatex *tex = new TLatex(0.04,0.86/2.,"Reco");
03310 tex->SetTextFont(132);
03311 tex->SetTextSize(0.05);
03312 tex->SetLineWidth(2);
03313 tex->Draw();
03314 tex = new TLatex(0.04,0.41/2.,"Truth");
03315 tex->SetTextFont(132);
03316 tex->SetTextSize(0.05);
03317 tex->SetLineWidth(2);
03318 tex->Draw();
03319 char temp[256];
03320 sprintf(temp,"Summed NPEs < %.1f",Dspe_val);
03321 tex = new TLatex(0.3,0.86/2.,temp);
03322 tex->SetTextFont(132);
03323 tex->SetTextSize(0.05);
03324 tex->SetLineWidth(2);
03325 tex->Draw();
03326 sprintf(temp,"%.1f < Summed NPEs < %.1f",Dspe_val,Dmid_val);
03327 tex = new TLatex(0.3,0.77/2.,temp);
03328 tex->SetTextFont(132);
03329 tex->SetTextSize(0.05);
03330 tex->SetLineWidth(2);
03331 tex->Draw();
03332 sprintf(temp,"Summed NPEs > %.1f",Dmid_val);
03333 tex = new TLatex(0.3,0.68/2.,temp);
03334 tex->SetTextFont(132);
03335 tex->SetTextSize(0.05);
03336 tex->SetLineWidth(2);
03337 tex->Draw();
03338 tex = new TLatex(0.3,0.59/2.,"Reconstructed Track Hit");
03339 tex->SetTextFont(132);
03340 tex->SetTextSize(0.05);
03341 tex->SetLineWidth(2);
03342 tex->Draw();
03343 tex = new TLatex(0.3,0.50/2.,"Reconstructed Shower Hit (cyan=EM)");
03344 tex->SetTextFont(132);
03345 tex->SetTextSize(0.05);
03346 tex->SetLineWidth(2);
03347 tex->Draw();
03348 tex = new TLatex(0.3,0.41/2.,"Primary Muon (+ secondaries)");
03349 tex->SetTextFont(132);
03350 tex->SetTextSize(0.05);
03351 tex->SetLineWidth(2);
03352 tex->Draw();
03353 tex = new TLatex(0.3,0.32/2.,"Primary Electron (+ secondaries)");
03354 tex->SetTextFont(132);
03355 tex->SetTextSize(0.05);
03356 tex->SetLineWidth(2);
03357 tex->Draw();
03358 tex = new TLatex(0.3,0.23/2.,"Recoil Shower Products");
03359 tex->SetTextFont(132);
03360 tex->SetTextSize(0.05);
03361 tex->SetLineWidth(2);
03362 tex->Draw();
03363 tex = new TLatex(0.3,0.14/2.,"Noise");
03364 tex->SetTextFont(132);
03365 tex->SetTextSize(0.05);
03366 tex->SetLineWidth(2);
03367 tex->Draw();
03368 tex = new TLatex(0.3,0.05/2.,"Other");
03369 tex->SetTextFont(132);
03370 tex->SetTextSize(0.05);
03371 tex->SetLineWidth(2);
03372 tex->Draw();
03373 tex = new TLatex(0.65,0.05/2.,"Nu Unit P");
03374 tex->SetTextFont(132);
03375 tex->SetTextSize(0.05);
03376 tex->SetLineWidth(2);
03377 tex->Draw();
03378 TArrow *arrow = new TArrow(0.5,0.09/2.,0.6,0.09/2.,0.03,"|>");
03379 arrow->SetFillColor(5);
03380 arrow->SetLineColor(9);
03381 arrow->SetLineWidth(2);
03382 arrow->Draw();
03383 }
03384
03385
03386 Int_t *MadEvDisplay::Dec2Bin(Int_t dec){
03387
03388 Int_t *bin = new Int_t[32];
03389 for(Int_t i=0;i<32;i++) bin[i]=0;
03390
03391 Int_t index=1;
03392
03393 while(true){
03394 if(dec<TMath::Power(2,index) && dec>1) {
03395 bin[index-1]=1;
03396 dec-=Int_t(TMath::Power(2,index-1));
03397 index=1;
03398 }
03399
03400 else index+=1;
03401
03402 if(dec==0) break;
03403 if(dec==1){
03404 bin[0]=1;
03405 dec-=1;
03406 break;
03407 }
03408 }
03409 return bin;
03410 }
03411
03412
03413 void MadEvDisplay::DrawInteractionDiagram(Int_t itr){
03414
03415 if(!LoadTruth(itr)) return;
03416
03417
03418 TCanvas *can;
03419 if(gROOT->FindObject("StdHepDiagramCanvas")) {
03420 can = (TCanvas*) gROOT->FindObject("StdHepDiagramCanvas");
03421 can->cd();
03422 TList *theList = can->GetListOfPrimitives();
03423 TIterator *iter = theList->MakeIterator();
03424 TObject *ob;
03425 while((ob = iter->Next())){
03426 if(ob->InheritsFrom("TLatex")) {
03427 TLatex *tex = (TLatex*) ob;
03428 delete tex;
03429 }
03430 else if(ob->InheritsFrom("TArrow")) {
03431 TArrow *ar = (TArrow*) ob;
03432 delete ar;
03433 }
03434 else if(ob->InheritsFrom("TMarker")) {
03435 TMarker *m = (TMarker*) ob;
03436 delete m;
03437 }
03438 }
03439 can->Range(0,0,1,1.1);
03440 }
03441 else {
03442 can = new TCanvas("StdHepDiagramCanvas","StdHep Diagram Canvas",0,0,900,400);
03443 can->cd();
03444 can->Range(0,0,1,1.1);
03445 TPaveText *infoTex1 = new TPaveText(0.05,1.,0.2,1.07);
03446 infoTex1->AddText("Initial State");
03447 infoTex1->SetBorderSize(1);
03448 TPaveText *infoTex2 = new TPaveText(0.3,1.,0.45,1.07);
03449 infoTex2->AddText("Intermediate");
03450 infoTex2->SetBorderSize(1);
03451 TPaveText *infoTex3 = new TPaveText(0.55,1.,0.7,1.07);
03452 infoTex3->AddText("Final State");
03453 infoTex3->SetBorderSize(1);
03454 TPaveText *infoTex4 = new TPaveText(0.8,1.,0.95,1.07);
03455 infoTex4->AddText("Later Decays");
03456 infoTex4->SetBorderSize(1);
03457 infoTex1->SetTextSize(0.05);
03458 infoTex1->SetTextFont(12);
03459 infoTex1->SetTextColor(1);
03460 infoTex2->SetTextSize(0.05);
03461 infoTex2->SetTextFont(12);
03462 infoTex2->SetTextColor(1);
03463 infoTex3->SetTextSize(0.05);
03464 infoTex3->SetTextFont(12);
03465 infoTex3->SetTextColor(1);
03466 infoTex4->SetTextSize(0.05);
03467 infoTex4->SetTextFont(12);
03468 infoTex4->SetTextColor(1);
03469 infoTex1->SetName("infoTex1");
03470 infoTex2->SetName("infoTex2");
03471 infoTex3->SetName("infoTex3");
03472 infoTex4->SetName("infoTex4");
03473 infoTex1->Draw();
03474 infoTex2->Draw();
03475 infoTex3->Draw();
03476 infoTex4->Draw();
03477 }
03478
03479
03480 TClonesArray* pointStdhepArray = NULL;
03481 if(isST) pointStdhepArray = (strecord->stdhep);
03482 else pointStdhepArray = (mcrecord->stdhep);
03483 TClonesArray& stdhepArray = *pointStdhepArray;
03484 Int_t nStdHep = stdhepArray.GetEntries();
03485 Int_t *indicesToUse = new Int_t[nStdHep];
03486 Int_t *parent = new Int_t[nStdHep];
03487 Int_t incomingNeutrino = -1;
03488 Int_t cnt = 0;
03489 for(int i=0;i<nStdHep;i++){
03490 LoadStdHep(i);
03491 if(ntpStdHep->mc==itr) {
03492 indicesToUse[cnt] = i;
03493 parent[i] = ntpStdHep->parent[0];
03494 if(ntpStdHep->IstHEP==0){
03495 if(abs(ntpStdHep->IdHEP)==12||abs(ntpStdHep->IdHEP)==14
03496 ||abs(ntpStdHep->IdHEP)==16) {
03497 incomingNeutrino=i;
03498 }
03499 parent[i] = -1;
03500 }
03501 cnt++;
03502 }
03503 else parent[i] = -1;
03504 }
03505
03506
03507
03508
03509
03510
03511
03512
03513 std::vector<TArrow*> arrow(nStdHep);
03514 std::vector<TMarker*> marker(nStdHep);
03515
03516 for(int i=0;i<nStdHep;i++) {
03517 arrow[i] = new TArrow(0,0,0,0,0.03,"|>");
03518 arrow[i]->SetLineWidth(1);
03519 arrow[i]->SetLineStyle(3);
03520 arrow[i]->SetFillColor(39);
03521 arrow[i]->SetLineColor(39);
03522 marker[i] = new TMarker(0,0,24);
03523 marker[i]->SetMarkerSize(1);
03524 marker[i]->SetMarkerColor(38);
03525 }
03526
03527
03528 Float_t Available[4] = {0.9,0.7,0.8,0.7};
03529 std::vector<int> rootino;
03530 for(int i=0;i<cnt;i++){
03531
03532 int toUse = indicesToUse[i];
03533 LoadStdHep(toUse);
03534 if(ntpStdHep->IstHEP==999){
03535 rootino.push_back(i);
03536 continue;
03537 }
03538 Float_t mom = sqrt(ntpStdHep->p4[0]*ntpStdHep->p4[0] +
03539 ntpStdHep->p4[1]*ntpStdHep->p4[1] +
03540 ntpStdHep->p4[2]*ntpStdHep->p4[2]);
03541 float x=0.05,y=0.05;
03542 int col=0;
03543 char text[256];
03544
03545
03546 if(ntpStdHep->IstHEP==0 ||
03547 ntpStdHep->IstHEP==11 ) {
03548 x = 0.05;
03549 y=Available[0]; Available[0] -= 0.1;
03550 }
03551 else if(ntpStdHep->IstHEP==2 ||
03552 ntpStdHep->IstHEP==3 ||
03553 ntpStdHep->IstHEP==14 ) {
03554 x = 0.3;
03555 y=Available[1]; Available[1] -= 0.1;
03556 }
03557 else if(ntpStdHep->IstHEP==1){
03558 x = 0.55;
03559 y=Available[2]; Available[2] -= 0.1;
03560 }
03561 else if(ntpStdHep->IstHEP==205 ||
03562 ntpStdHep->IstHEP==1205 ) {
03563 x = 0.8;
03564 y=Available[3]; Available[3] -= 0.1;
03565 }
03566
03567
03568 if(abs(ntpStdHep->IdHEP)==12) {
03569 if(parent[toUse]==incomingNeutrino) y = 0.9;
03570 sprintf(text,"#nu_{e}"); col = 3;
03571 if(ntpStdHep->IdHEP<0) sprintf(text,"#bar{#nu}_{e}");
03572 }
03573 else if(abs(ntpStdHep->IdHEP)==14) {
03574 if(parent[toUse]==incomingNeutrino) y = 0.9;
03575 sprintf(text,"#nu_{#mu}"); col = 4;
03576 if(ntpStdHep->IdHEP<0) sprintf(text,"#bar{#nu}_{#mu}");
03577 }
03578 else if(abs(ntpStdHep->IdHEP)==16) {
03579 if(parent[toUse]==incomingNeutrino) y = 0.9;
03580 sprintf(text,"#nu_{#tau}"); col = 1;
03581 if(ntpStdHep->IdHEP<0) sprintf(text,"#bar{#nu}_{#tau}");
03582 }
03583 else if(abs(ntpStdHep->IdHEP)==11) {
03584 if(parent[toUse]==incomingNeutrino) y = 0.9;
03585 sprintf(text,"e^{-}"); col = 3;
03586 if(ntpStdHep->IdHEP<0) sprintf(text,"e^{+}");
03587 }
03588 else if(abs(ntpStdHep->IdHEP)==13) {
03589 if(parent[toUse]==incomingNeutrino) y = 0.9;
03590 sprintf(text,"#mu^{-}"); col = 4;
03591 if(ntpStdHep->IdHEP<0) sprintf(text,"#mu^{+}");
03592 }
03593 else if(abs(ntpStdHep->IdHEP)==15) {
03594 y = 0.9;
03595 sprintf(text,"#tau^{-}"); col = 1;
03596 if(ntpStdHep->IdHEP<0) sprintf(text,"#tau^{+}");
03597 }
03598 else if(ntpStdHep->IdHEP==22) {
03599 sprintf(text,"#gamma"); col = 9;
03600 }
03601 else if(ntpStdHep->IdHEP>1000000000) {
03602 y = 0.8;
03603 sprintf(text,"nucleus(%i,%i)",int((ntpStdHep->IdHEP-1e9)/1e6),
03604 int((ntpStdHep->IdHEP-1e9 - 1e6*int((ntpStdHep->IdHEP-1e9)
03605 /1e6))/1e3));
03606 col = 15;
03607 }
03608 else if(ntpStdHep->IdHEP==2112){
03609 sprintf(text,"neutron"); col = 28;
03610 }
03611 else if(ntpStdHep->IdHEP==2212){
03612 sprintf(text,"proton"); col = 2;
03613 }
03614 else if(abs(ntpStdHep->IdHEP)==211) {
03615 sprintf(text,"#pi^{+}"); col = 6;
03616 if(ntpStdHep->IdHEP<0) sprintf(text,"#pi^{-}");
03617 }
03618 else if(ntpStdHep->IdHEP==111) {
03619 sprintf(text,"#pi^{0}"); col = 7;
03620 }
03621 else if(ntpStdHep->IdHEP==130) {
03622 sprintf(text,"K^{0}_{L}"); col = 31;
03623 }
03624 else if(ntpStdHep->IdHEP==310) {
03625 sprintf(text,"K^{0}_{S}"); col = 31;
03626 }
03627 else if(ntpStdHep->IdHEP==311) {
03628 sprintf(text,"K^{0}"); col = 31;
03629 }
03630 else if(abs(ntpStdHep->IdHEP)==321) {
03631 sprintf(text,"K^{+}"); col = 31;
03632 if(ntpStdHep->IdHEP<0) sprintf(text,"K^{-}"); col = 31;
03633 }
03634 else if(ntpStdHep->IdHEP==28) {
03635 sprintf(text,"Geantino"); col = 46;
03636 if(ntpStdHep->IdHEP<0) sprintf(text,"K^{-}"); col = 31;
03637 }
03638 else {
03639 sprintf(text,"ID: %i",ntpStdHep->IdHEP); col=43;
03640 }
03641
03642 sprintf(text,"%s [%.2f GeV/c]",text,mom);
03643
03644 arrow[toUse]->SetX2(x-0.02);
03645 arrow[toUse]->SetY2(y-0.02);
03646 marker[toUse]->SetX(x-0.02);
03647 marker[toUse]->SetY(y-0.02);
03648
03649 for(int j=0;j<nStdHep;j++){
03650 if(parent[j]==toUse){
03651 arrow[j]->SetX1(x-0.02);
03652 arrow[j]->SetY1(y-0.02);
03653 }
03654 }
03655
03656 TLatex *tex = new TLatex(x,y,text);
03657 char texname[256];
03658 sprintf(texname,"tex%i",i);
03659 tex->SetName(texname);
03660 tex->SetTextSize(0.05);
03661 tex->SetTextColor(col);
03662 tex->Draw();
03663 }
03664
03665 for(int i=0;i<nStdHep;i++){
03666 if(parent[i]==-1) {
03667 delete arrow[i]; arrow[i]=0;
03668 }
03669 else arrow[i]->Draw();
03670 marker[i]->Draw();
03671 }
03672
03673 for (unsigned int j=0;j<rootino.size();j++){
03674 if (arrow[rootino[j]]){
03675 delete arrow[rootino[j]]; arrow[rootino[j]] = 0;
03676 }
03677 delete marker[rootino[j]];
03678 }
03679
03680 Float_t minAvail = 0;
03681 for(int i=0;i<4;i++){
03682 if(Available[i]<minAvail) minAvail = Available[i];
03683 }
03684
03685 if(minAvail<0) can->Range(0,minAvail,1,1.1);
03686
03687 delete [] indicesToUse;
03688 delete [] parent;
03689
03690 can->Modified();
03691 can->Update();
03692
03693 }
03694
03695 void MadEvDisplay::DrawButtons(TCanvas *MainCanvas) {
03696 MainCanvas->cd(2);
03697 TVirtualPad *MainCanvas_2 = MainCanvas->GetPad(2);
03698 MainCanvas_2->Range(0,0,1,1);
03699
03700 if(!gROOT->IsBatch()){
03701
03702
03703
03704 TButton *but1 = new TButton("Next Pass","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeEntry = EVD->NextPass();",0.6,0.9,1,1);
03705 but1->SetTextSize(0.5);
03706 but1->SetFillColor(4);
03707 TButton *but2 = new TButton("Previous Pass","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeEntry = EVD->PrevPass();",0.2,0.9,0.6,1);
03708 but2->SetTextSize(0.5);
03709 but2->SetFillColor(5);
03710
03711
03712 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->Display(EVD->LeEntry,0,0,0,EVD->LeAutoMat);",0.6,0.8,1,0.9);
03713 but14->SetTextSize(0.5);
03714 but14->SetFillColor(4);
03715 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->Display(EVD->LeEntry,0,0,0,EVD->LeAutoMat);",0.2,0.8,0.6,0.9);
03716 but15->SetTextSize(0.5);
03717 but15->SetFillColor(5);
03718
03719
03720 TButton *but10 = new TButton("Next Slc","EVD->LeSlice+=1; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.4,0.7,0.6,0.8);
03721 but10->SetName("but10");
03722 but10->SetTextSize(0.5);
03723 but10->SetFillColor(4);
03724
03725 TButton *but11 = new TButton("Next Evt","EVD->LeEvent+=1; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.8,0.7,1,0.8);
03726 but11->SetName("but11");
03727 but11->SetTextSize(0.5);
03728 but11->SetFillColor(4);
03729
03730 TButton *but12 = new TButton("Prev Slc","EVD->LeSlice-=1; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.2,0.7,0.4,0.8);
03731 but12->SetName("but12");
03732 but12->SetTextSize(0.5);
03733 but12->SetFillColor(5);
03734 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);
03735 but12->SetName("but12");
03736 but13->SetTextSize(0.5);
03737 but13->SetFillColor(5);
03738
03739
03740 TButton *but16 = new TButton("Prev MC","EVD->LeMCevent-=1; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.2,0.6,0.4,0.7);
03741 but16->SetName("but16");
03742 but16->SetTextSize(0.5);
03743 but16->SetFillColor(5);
03744 TButton *but17 = new TButton("Next MC","EVD->LeMCevent+=1; EVD->Display(EVD->LeEntry,EVD->LeSlice,EVD->LeEvent,EVD->LeMCevent,EVD->LeAutoMat);",0.4,0.6,0.6,0.7);
03745 but17->SetName("but17");
03746 but17->SetTextSize(0.5);
03747 but17->SetFillColor(4);
03748
03749 TButton *but3a = new TButton("Skip to...","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeSlice=0; EVD->LeEvent=0; EVD->LeMCevent=0; EVD->LeEntry = EVD->SkipTo();",0.6,0.65,0.8,0.7);
03750 but3a->SetTextSize(0.5);
03751 but3a->SetFillColor(9);
03752
03753 TButton *but3e = new TButton("Run,Snarl...","if(EVD->drawSAME) {EVD->drawSAME=false; but4b->SetFillColor(2); but4b->Modified();} EVD->LeSlice=0; EVD->LeEvent=0; EVD->LeMCevent=0; EVD->LeEntry = EVD->JumpTo();",0.6,0.6,0.8,0.65);
03754 but3e->SetTextSize(0.5);
03755 but3e->SetFillColor(9);
03756
03757 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);
03758 but3c->SetName("but3c");
03759 but3c->SetTextSize(0.5);
03760 but3c->SetFillColor(3);
03761
03762 if(LeAutoMat) {
03763 but10->SetFillColor(15);
03764 but12->SetFillColor(15);
03765 but16->SetFillColor(15);
03766 but17->SetFillColor(15);
03767 }
03768
03769
03770 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);
03771 but4->SetTextSize(0.5);
03772 but4->SetFillColor(5);
03773
03774 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);
03775 but4b->SetName("but4b");
03776 but4b->SetTextSize(0.5);
03777 if(drawSAME) but4b->SetFillColor(3);
03778 else but4b->SetFillColor(2);
03779
03780 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);
03781 but3b->SetName("but3b");
03782 but3b->SetTextSize(0.5);
03783 if(LeLego) but3b->SetFillColor(3);
03784 else but3b->SetFillColor(2);
03785
03786 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);
03787 but3d->SetName("but3d");
03788 but3d->SetTextSize(0.5);
03789 if(LeClus) but3d->SetFillColor(3);
03790 else but3d->SetFillColor(2);
03791
03792 TButton *but18 = new TButton("Print","EVD->PrintDisplay();",
03793 0.6,0.5,0.8,0.6);
03794 but18->SetTextSize(0.5);
03795 but18->SetFillColor(8);
03796
03797 TButton *but5 = new TButton("Quit",".q",0.8,0.5,1,0.6);
03798 but5->SetTextSize(0.5);
03799 but5->SetFillColor(45);
03800
03801 but1->Draw();
03802 but2->Draw();
03803 but3a->Draw();
03804 but3b->Draw();
03805 but3c->Draw();
03806 but3d->Draw();
03807 but3e->Draw();
03808 but4->Draw();
03809 but4b->Draw();
03810 but5->Draw();
03811 but10->Draw();
03812 but11->Draw();
03813 but12->Draw();
03814 but13->Draw();
03815 but14->Draw();
03816 but15->Draw();
03817 but16->Draw();
03818 but17->Draw();
03819 but18->Draw();
03820
03821 if(!handScan) {
03822
03823
03824 TButton *but19 = new TButton("Ignore","EVD->UseNuInfo=false; but19->SetFillColor(3); but6->SetFillColor(15); but6->Modified(); but7->SetFillColor(15); but7->Modified(); but8->SetFillColor(15); but8->Modified(); but9->SetFillColor(15); but9->Modified();",0,0.9,0.195,1);
03825 but19->SetTextSize(0.4);
03826 but19->SetName("but19");
03827 TButton *but6 = new TButton("NuMu","EVD->LeNu=14; but6->SetFillColor(3); but7->SetFillColor(2); but7->Modified(); EVD->UseNuInfo=true; but19->SetFillColor(2); but19->Modified();",0,0.8,0.195,0.9);
03828 but6->SetTextSize(0.4);
03829 but6->SetName("but6");
03830 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);
03831 but7->SetTextSize(0.4);
03832 but7->SetName("but7");
03833 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);
03834 but8->SetTextSize(0.4);
03835 but8->SetName("but8");
03836 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);
03837 but9->SetTextSize(0.4);
03838 but9->SetName("but9");
03839
03840 if(UseNuInfo){
03841 if(LeNu==14) {but6->SetFillColor(3); but7->SetFillColor(2);}
03842 else if(LeNu==12) {but7->SetFillColor(3); but6->SetFillColor(2);}
03843 else {but6->SetFillColor(10); but7->SetFillColor(10);}
03844 if(LeAction==0) {but8->SetFillColor(3); but9->SetFillColor(2);}
03845 else if(LeAction==1) {but9->SetFillColor(3); but8->SetFillColor(2);}
03846 else {but9->SetFillColor(10); but8->SetFillColor(10);}
03847 }
03848 else {
03849 but19->SetFillColor(3); but6->SetFillColor(15);
03850 but7->SetFillColor(15);
03851 but8->SetFillColor(15); but9->SetFillColor(15);
03852 }
03853
03854 but6->Draw();
03855 but7->Draw();
03856 but8->Draw();
03857 but9->Draw();
03858 but19->Draw();
03859 }
03860 else StartLogger();
03861 }
03862
03863 this->DrawKey2(MainCanvas_2);
03864 }
03865
03866 void MadEvDisplay::StartLogger()
03867 {
03868
03869 TButton *but1 = new TButton("mu",
03870 "EVD->ScanID=1; EVD->ChangeLogButColor();",
03871 0.,0.8875,0.1275,0.95);
03872 but1->SetTextSize(0.6);
03873 but1->SetFillColor(2);
03874 but1->SetName("logBut1");
03875
03876 TButton *but2 = new TButton("e",
03877 "EVD->ScanID=2; EVD->ChangeLogButColor();",
03878 0.,0.825,0.1275,0.8875);
03879 but2->SetTextSize(0.6);
03880 but2->SetFillColor(2);
03881 but2->SetName("logBut2");
03882
03883 TButton *but3 = new TButton("NC",
03884 "EVD->ScanID=3; EVD->ChangeLogButColor();",
03885 0.,0.7625,0.1275,0.825);
03886 but3->SetTextSize(0.6);
03887 but3->SetFillColor(2);
03888 but3->SetName("logBut3");
03889
03890 TButton *but4 = new TButton("mu/NC?",
03891 "EVD->ScanID=4; EVD->ChangeLogButColor();",
03892 0.,0.70,0.1275,0.7625);
03893 but4->SetTextSize(0.6);
03894 but4->SetFillColor(2);
03895 but4->SetName("logBut4");
03896
03897 TButton *but5 = new TButton("e/NC?",
03898 "EVD->ScanID=5; EVD->ChangeLogButColor();",
03899 0.,0.6375,0.1275,0.7);
03900 but5->SetTextSize(0.6);
03901 but5->SetFillColor(2);
03902 but5->SetName("logBut5");
03903
03904 TButton *but6 = new TButton("???",
03905 "EVD->ScanID=6; EVD->ChangeLogButColor();",
03906 0.,0.575,0.1275,0.6375);
03907 but6->SetTextSize(0.6);
03908 but6->SetFillColor(2);
03909 but6->SetName("logBut6");
03910
03911 TButton *but8 = new TButton("QE",
03912 "EVD->ScanTop=1; EVD->ChangeLogButColor();",
03913 0.1275,0.85625,0.195,0.95);
03914 but8->SetTextSize(0.4);
03915 but8->SetFillColor(2);
03916 but8->SetName("logBut8");
03917
03918 TButton *but9 = new TButton("RES",
03919 "EVD->ScanTop=2; EVD->ChangeLogButColor();",
03920 0.1275,0.7625,0.195,0.85625);
03921 but9->SetTextSize(0.4);
03922 but9->SetFillColor(2);
03923 but9->SetName("logBut9");
03924
03925 TButton *but10 = new TButton("DIS",
03926 "EVD->ScanTop=3; EVD->ChangeLogButColor();",
03927 0.1275,0.66875,0.195,0.7625);
03928 but10->SetTextSize(0.4);
03929 but10->SetFillColor(2);
03930 but10->SetName("logBut10");
03931
03932 TButton *but11 = new TButton("???",
03933 "EVD->ScanTop=4; EVD->ChangeLogButColor();",
03934 0.1275,0.575,0.195,0.66875);
03935 but11->SetTextSize(0.4);
03936 but11->SetFillColor(2);
03937 but11->SetName("logBut11");
03938
03939 TButton *but12 = new TButton("Log Details","EVD->Log();",
03940 0.,0.5,0.195,0.575);
03941 but12->SetTextSize(0.6);
03942 but12->SetFillColor(4);
03943
03944 TButton *but7 = new TButton("Click for Info",
03945 "EVD->PrintHSHelp();",
03946 0.,0.95,0.195,1.0);
03947 but7->SetTextSize(0.6);
03948 but7->SetFillColor(45);
03949
03950 but1->Draw();
03951 but2->Draw();
03952 but3->Draw();
03953 but4->Draw();
03954 but5->Draw();
03955 but6->Draw();
03956 but7->Draw();
03957 but8->Draw();
03958 but9->Draw();
03959 but10->Draw();
03960 but11->Draw();
03961 but12->Draw();
03962 }
03963
03964 void MadEvDisplay::ChangeLogButColor()
03965 {
03966 if(gROOT->FindObject("MainCanvas")) {
03967 TCanvas *MainCanvas = (TCanvas*) gROOT->FindObject("MainCanvas");
03968 TVirtualPad *MainCanvas_2 = MainCanvas->GetPad(2);
03969 char butName[256];
03970 int butNums[10] = {1,2,3,4,5,6,8,9,10,11};
03971 for(int i=0;i<10;i++){
03972 sprintf(butName,"logBut%i",butNums[i]);
03973 TButton *but = (TButton*) MainCanvas_2->FindObject(butName);
03974 if(butNums[i]==ScanID || butNums[i]==ScanTop+7) {
03975 but->SetFillColor(3);
03976 but->Modified();
03977 }
03978 else if(but->GetFillColor()!=2) {
03979 but->SetFillColor(2);
03980 but->Modified();
03981 }
03982 }
03983 }
03984 }
03985
03986 void MadEvDisplay::Log()
03987 {
03988 ofstream outFile;
03989 outFile.open(logFileName, ofstream::out | ofstream::app);
03990 outFile << ntpHeader->GetRun() << " "
03991 << ntpHeader->GetSubRun() << " "
03992 << ntpHeader->GetSnarl() << " "
03993 << ntpSlice->index << " "
03994 << ntpEvent->index << " "
03995 << ScanID << " "
03996 << ScanTop << " "
03997 << endl;
03998 outFile.close();
03999 }
04000
04001 void MadEvDisplay::EnableHandScan(char *fname)
04002 {
04003 handScan = true;
04004 if(std::strcmp(fname,"")) {
04005 sprintf(logFileName,"%s",fname);
04006 }
04007 }
04008
04009 void MadEvDisplay::PrintHSHelp()
04010 {
04011 cout << endl;
04012 cout << endl;
04013 cout << "================= Hand Scan Info =================" << endl;
04014 cout << "Left Hand Column shows possible event ID tags:" << endl;
04015 cout << "mu = numu CC - code = 1" << endl;
04016 cout << "e = nue CC - code = 2" << endl;
04017 cout << "NC = NC - code = 3" << endl;
04018 cout << "mu/NC = numu CC / NC Ambiguity - code = 4" << endl;
04019 cout << "e/NC = nue CC / NC Ambiguity - code = 5" << endl;
04020 cout << "??? = Complete Ambiguity - code = 6" << endl;
04021 cout << "N/A (all buttons red) - code = 0" << endl;
04022 cout << "--------------------------------------------------" << endl;
04023 cout << "Right Hand Column shows possible event topology tags:" << endl;
04024 cout << "QE - code = 1" << endl;
04025 cout << "RES - code = 2" << endl;
04026 cout << "DIS - code = 3" << endl;
04027 cout << "??? - code = 4" << endl;
04028 cout << "N/A (all buttons red) - code = 0" << endl;
04029 cout << "--------------------------------------------------" << endl;
04030 cout << "Click 'Log Details' to write choices to text file" << endl;
04031 cout << "=================== Good Luck! ===================" << endl;
04032 cout << endl;
04033 }
04034
04035 void MadEvDisplay::EventDump()
04036 {
04037 if(ntpEvent) ntpEvent->Print();
04038 if(LoadTrack(ntpEvent->trk[0])) ntpTrack->Print();
04039 if(LoadShower(ntpEvent->shw[0])) ntpShower->Print();
04040 if(ntpTruth) ntpTruth->Print();
04041 }
04042
04043 bool MadEvDisplay::ReadEventsFile(const char* filename){
04044
04045
04046
04047
04048
04049 FileStat_t buf;
04050 if(gSystem->GetPathInfo(filename,buf) == 1) {
04051 std::cout<<"MadEvDisplay::ReadEventsFile: couldn't open "<<filename<<std::endl;
04052 return false;
04053 }
04054 else{
04055 std::cout<<"MadEvDisplay::ReadEventsFile: reading from "<<filename<<std::endl;
04056 }
04057 std::ifstream in(filename);
04058 int nread=0;
04059 std::string s;
04060 while(std::getline(in,s,'\n')){
04061
04062 if(s=="") continue;
04063 else if(s[0]=='#') continue;
04064 else{
04065 std::istringstream iss(s,std::istringstream::in);
04066 Int_t run,snarl,event;
04067 iss>>run>>snarl>>event;
04068
04069
04070
04071
04072
04073
04074
04075
04076
04077
04078
04079 if(iss.good() || iss.eof()){
04080 std::vector<Int_t> v(3); v[0]=run; v[1]=snarl; v[2]=event;
04081 fNeatoEvents.push_back(v);
04082 nread++;
04083 }
04084 }
04085 }
04086 std::cout<<"MadEvDisplay::ReadEventsFile read "<<nread<<" events."<<std::endl;
04087 if(nread>0) fHaveNeatoEvents=true;
04088 return true;
04089 }
04090
04091 Int_t MadEvDisplay::NextInterestingEvent(bool backward){
04092 if(fNeatoEvents.size()==0) return LeEntry;
04093
04094 Int_t event=-1;
04095 Int_t entry=-1;
04096 int startingindex = fNeatoEventIdx;
04097 if(startingindex == -1) startingindex = 0;
04098 bool firsttry = true;
04099 while(true){
04100 if(!backward){
04101 if(fNeatoEventIdx+1 >= static_cast<Int_t>(fNeatoEvents.size())){
04102 fNeatoEventIdx=0;
04103 }
04104 else fNeatoEventIdx++;
04105
04106 if(fNeatoEventIdx == startingindex && !firsttry){
04107 cerr << "Looped all the way around without finding any neato events!\n";
04108 return -1;
04109 }
04110
04111 firsttry = false;
04112 }
04113 else{
04114 if(fNeatoEventIdx-1 < 0){
04115 fNeatoEventIdx=fNeatoEvents.size()-1;
04116 }
04117 else fNeatoEventIdx--;
04118 }
04119
04120
04121 std::vector<Int_t>& v = fNeatoEvents[fNeatoEventIdx];
04122 entry = fChain->GetEntryNumber(v[0],v[1]);
04123 if(entry != -1) {
04124 event = v[2];
04125 break;
04126 }
04127 }
04128 this->GetEntry(entry);
04129 this->LoadEvent(event);
04130 Display(entry,0,event,0,LeAutoMat);
04131
04132 return entry;
04133
04134 }
04135
04136 Float_t MadEvDisplay::RecoMKMuEnergy(Int_t& opt,Int_t itrk, bool isdata){
04137
04138 if(LoadTrack(itrk)){
04139 float mr=ntpTrack->momentum.range;
04140 mr=CorrectMomentumFromRange(mr,isdata);
04141 if(opt==0){
04142
04143
04144 if(ntpTrack->fidall.dr>0.5&&ntpTrack->fidall.dz>0.5) {
04145 opt=2;
04146 return sqrt(mr*mr+ 0.10555*0.10555);
04147 }
04148 else {
04149 opt=1;
04150
04151
04152
04153
04154
04155
04156 if(ntpTrack->momentum.qp == 0.0) return 10000.0;
04157 else return sqrt(1./(ntpTrack->momentum.qp*ntpTrack->momentum.qp)
04158 + 0.10555*0.10555);
04159 }
04160 }
04161 else if(opt==1) {
04162 if(ntpTrack->momentum.qp == 0.0) return 10000.0;
04163 else return sqrt(1./(ntpTrack->momentum.qp*ntpTrack->momentum.qp)
04164 + 0.10555*0.10555);
04165 }
04166 else if(opt==2)
04167 return sqrt(mr*mr + 0.10555*0.10555);
04168 else return 0;
04169 }
04170 return 0.;
04171 }
04172
04173
04174 Float_t MadEvDisplay::RecoMuDCosNeuFD(Int_t itr, Float_t* ){
04175 if(!LoadTrack(itr)) return 0.;
04176
04177 Float_t bl_z = TMath::Cos(TMath::Pi()*3./180.);
04178 Float_t bl_y = sqrt(1. - bl_z*bl_z);
04179 Float_t costhbl = ntpTrack->vtx.dcosz*bl_z + ntpTrack->vtx.dcosy*bl_y;
04180
04181 return costhbl;
04182 }
04183
04184 Float_t MadEvDisplay::RecoMuDCosNeuND(Int_t itr, Float_t* ){
04185 if(!LoadTrack(itr)) return 0.;
04186
04187
04188
04189
04190
04191
04192
04193
04194
04195
04196
04197
04198
04199 float nu_cos = -5.799E-2;
04200 float nu_sin = sqrt(1 -nu_cos*nu_cos);
04201 float cosz = ntpTrack->vtx.dcosz*nu_sin + ntpTrack->vtx.dcosy*nu_cos;
04202
04203 return cosz;
04204
04205 }
04206
04207 #endif // #ifdef madevdisplay_cxx