MadHandScan Class Reference

#include <MadHandScan.h>

Inheritance diagram for MadHandScan:
MadEvDisplay MadBase

List of all members.

Public Member Functions

 MadHandScan (TChain *chainSR=0, TChain *chainMC=0, TChain *chainTH=0, TChain *chainem=0)
 MadHandScan (JobC *, std::string, int)
 ~MadHandScan ()
void RunQuiz (std::string st="")
void WriteQuizTree (string tag)
void HandScanDisplay (int)
void Cheat ()
void Pid ()
void Zoom ()
void UnZoom ()
void Vote (int)

Public Attributes

int fCurEnt
char exit [5]

Protected Attributes

TTree * quizTree
string quizTag
Bool_t writeTree
int fTotEnt
std::map< int, int > entryMap
int fChainEnt
std::map< int, int > failedMap
int fCurFailed
int isNue
float tru_En
float shw_En
float lep_En
float tru_y
int tru_inu
int tru_iac
int r_num
int s_num
int maxpln
int minpln
int maxstp_u
int minstp_u
int maxstp_v
int minstp_v
TH2F * uHist
TH2F * vHist
TH2F * uEMHist
TH2F * vEMHist
TH2F * uPredHist
TH2F * vPredHist

Detailed Description

Definition at line 8 of file MadHandScan.h.


Constructor & Destructor Documentation

MadHandScan::MadHandScan ( TChain *  chainSR = 0,
TChain *  chainMC = 0,
TChain *  chainTH = 0,
TChain *  chainem = 0 
)

Definition at line 29 of file MadHandScan.cxx.

References MadBase::Clear(), MadBase::emrecord, entryMap, exit, failedMap, fCurEnt, fTotEnt, MadBase::InitChain(), MadBase::isEM, MadBase::isMC, isNue, MadBase::isTH, lep_En, maxpln, maxstp_u, maxstp_v, MadBase::mcrecord, minpln, minstp_u, minstp_v, MadBase::Nentries, quizTag, quizTree, r_num, MadBase::record, s_num, shw_En, MadBase::strecord, MadBase::threcord, tru_En, tru_iac, tru_inu, tru_y, uEMHist, uHist, uPredHist, vEMHist, vHist, vPredHist, MadBase::whichSource, and writeTree.

00031 {
00032 
00033   if(!chainSR) {
00034     record = 0;
00035     strecord = 0;
00036     emrecord = 0;
00037     mcrecord = 0;
00038     threcord = 0;
00039     Clear();
00040     whichSource = -1;
00041     isMC = true;
00042     isTH = true;
00043     isEM = true;
00044     Nentries = -1;
00045     return;
00046   }
00047 
00048   writeTree = false;
00049   quizTag = "noTag";
00050   quizTree = NULL;
00051   fTotEnt = 0;
00052   fCurEnt = 0;
00053   isNue = 0;
00054   tru_inu = 0;
00055   tru_iac = 0;
00056   tru_y = 0;
00057   shw_En = 0;
00058   lep_En = 0;
00059   tru_En = 0;
00060   r_num = 0;
00061   s_num = 0;
00062   maxpln = 0;
00063   minpln = 999;
00064   maxstp_u = 0;
00065   minstp_u = 999;
00066   maxstp_v = 0;
00067   minstp_v = 999;
00068 
00069   entryMap.clear();
00070   failedMap.clear();
00071 
00072   uHist = NULL;
00073   vHist = NULL;
00074   uEMHist = NULL;
00075   vEMHist = NULL;
00076   uPredHist = NULL;
00077   vPredHist = NULL;
00078 
00079   sprintf(exit,".q");
00080 
00081   InitChain(chainSR,chainMC,chainTH,chainEM);
00082   whichSource = 0;
00083 
00084 }

MadHandScan::MadHandScan ( JobC ,
std::string  ,
int   
)
MadHandScan::~MadHandScan (  ) 

Definition at line 140 of file MadHandScan.cxx.

References quizTag, quizTree, and writeTree.

00141 {
00142 
00143   if(writeTree&&quizTree) {
00144     char savename[256];
00145     sprintf(savename,"QuizFile_%s.root",quizTag.data());
00146     ifstream Test(savename);
00147     if(!Test) {
00148       TFile save(savename,"NEW");
00149       quizTree->Write();
00150       save.Close();
00151     }
00152     else {
00153       //move old file to temp location
00154       char pline[256];
00155       sprintf(pline,".! mv %s .QuizFile_tmp1.root",savename);
00156       gROOT->ProcessLine(pline);
00157       //make new temp file to hold current tree
00158       TFile save_tmp(".QuizFile_tmp2.root","NEW");
00159       save_tmp.cd();
00160       quizTree->Write();
00161       save_tmp.Close();
00162       //make a chain add both temp files and merge to specified save file
00163       TChain chain("QuizTree");
00164       chain.Add(".QuizFile_tmp1.root");
00165       chain.Add(".QuizFile_tmp2.root");
00166       chain.Merge(savename);
00167       gROOT->ProcessLine(".! rm .QuizFile_tmp1.root .QuizFile_tmp2.root");
00168     }
00169   }
00170 }


Member Function Documentation

void MadHandScan::Cheat (  ) 

Definition at line 706 of file MadHandScan.cxx.

References MadEvDisplay::DrawInteractionDiagram(), MadBase::ntpTruth, NtpMCTruth::p4el1, NtpMCTruth::p4mu1, NtpMCTruth::p4tau, Pid(), shw_En, tru_En, tru_iac, tru_inu, and tru_y.

00706                        {
00707 
00708   Pid();
00709 
00710   DrawInteractionDiagram(0);
00711   TCanvas *can = (TCanvas*) gROOT->FindObject("HandScanControlCan");
00712   can->cd();
00713   char sometext[256];
00714   sprintf(sometext,"Truth  - Nu: %i, NC/CC: %i, y: %.2f",
00715           tru_inu,tru_iac,tru_y);
00716   TLatex *tex = new TLatex(0.02,0.06,sometext);
00717   tex->SetTextColor(8);
00718   tex->Draw();
00719   sprintf(sometext,"Energy - Nu: %.2f",tru_En);
00720   if(tru_iac==0){
00721     sprintf(sometext,"%s, Shw: %.2f",sometext,shw_En); 
00722   }
00723   else if(tru_iac==1){
00724     if(tru_inu==12) sprintf(sometext,"%s, e: %.2f",
00725                             sometext,ntpTruth->p4el1[3]);
00726     if(tru_inu==14) sprintf(sometext,"%s, #mu: %.2f",
00727                             sometext,ntpTruth->p4mu1[3]);
00728     if(tru_inu==16) sprintf(sometext,"%s, #tau: %.2f",
00729                             sometext,ntpTruth->p4tau[3]);
00730   }
00731   sprintf(sometext,"%s GeV",sometext);
00732   tex = new TLatex(0.02,0.01,sometext);
00733   tex->SetTextColor(8);
00734   tex->Draw();
00735 
00736 }

void MadHandScan::HandScanDisplay ( int  entry  ) 

Definition at line 215 of file MadHandScan.cxx.

References NtpEMVertex::dcosu, NtpEMVertex::dcosv, NtpEMVertex::dcosz, entryMap, MadBase::eventSummary, failedMap, fChainEnt, fCurFailed, fTotEnt, MadBase::GetEntry(), RecDataHeader::GetRun(), RecPhysicsHeader::GetSnarl(), NtpSRStripPulseHeight::gev, NtpMCTruth::iaction, NtpMCTruth::inu, MadBase::isEM, MadBase::isST, lep_En, MadBase::LoadEMShower(), MadBase::LoadTruth(), Munits::m, maxpln, maxstp_u, maxstp_v, minpln, minstp_u, minstp_v, NtpEMSummary::nshower, NtpSREventSummary::nstrip, NtpEMShower::nstrip, MadBase::ntpEMShower, MadBase::ntpEMSummary, MadBase::ntpHeader, MadBase::ntpStrip, MadBase::ntpTruth, NtpMCTruth::p4el1, NtpMCTruth::p4mu1, NtpMCTruth::p4neu, NtpMCTruth::p4shw, NtpMCTruth::p4tau, NtpSRPulseHeight::pe, NtpEMShower::ph, NtpSRStrip::ph0, NtpSRStrip::ph1, NtpSRStrip::plane, NtpSRStrip::planeview, FitterEM::PredictEMLoss(), FitterEM::QuickInput(), r_num, MadBase::record, s_num, shw_En, NtpEMShower::status, NtpEMShower::stp, NtpStRecord::stp, NtpSRRecord::stp, MadBase::strecord, NtpSRStrip::strip, NtpSRStrip::tpos, tru_En, tru_iac, tru_inu, tru_y, NtpEMVertex::u, uEMHist, uHist, uPredHist, NtpEMVertex::v, vEMHist, vHist, vPredHist, NtpEMShower::vtx, NtpMCTruth::y, NtpSRStrip::z, and NtpEMVertex::z.

Referenced by Vote().

00215                                           {
00216 
00217   if(entry>=fTotEnt) entry = 0;
00218   if(entry<0) entry = fTotEnt-1;
00219   if(!this->GetEntry(entryMap[entry])) return;
00220   fChainEnt = entryMap[entry];
00221   fCurFailed = failedMap[entry];
00222   r_num = ntpHeader->GetRun();
00223   s_num = ntpHeader->GetSnarl();
00224 
00225   //get canvases etc.
00226   TCanvas *handScanCan;
00227   TCanvas *handScanControlCan;
00228   if(!gROOT->FindObject("HandScanCan")){
00229 
00230     gStyle->SetOptStat(0);
00231     
00232     handScanCan = new TCanvas("HandScanCan","HandScanCan",
00233                               0,0,900,700);
00234     handScanCan->Divide(2,3);
00235 
00236     handScanControlCan = new TCanvas("HandScanControlCan",
00237                                      "HandScanControlCan",
00238                                      950,0,300,500);    
00239     handScanControlCan->cd();
00240     TButton *but1 = new TButton("Next","HS->fCurEnt+=1;HS->HandScanDisplay(HS->fCurEnt);",0.5,0.9,1.0,1.0);
00241     but1->SetTextSize(0.5);
00242     but1->SetFillColor(4);
00243 
00244     TButton *but2 = new TButton("Previous","HS->fCurEnt-=1;HS->HandScanDisplay(HS->fCurEnt);",0.0,0.9,0.5,1.0);
00245     but2->SetTextSize(0.5);
00246     but2->SetFillColor(5);
00247 
00248     TButton *but3a = new TButton("CHEAT","HS->Cheat();",0.0,0.6,0.5,0.7);
00249     but3a->SetTextSize(0.5);
00250     but3a->SetFillColor(3);
00251 
00252     TButton *but3b = new TButton("PID","HS->Pid();",0.5,0.6,1.0,0.7);
00253     but3b->SetTextSize(0.5);
00254     but3b->SetFillColor(6);
00255 
00256     TButton *but4 = new TButton("Vote nue","HS->Vote(1);",0.0,0.7,0.5,0.8);
00257     but4->SetTextSize(0.5);
00258     but4->SetFillColor(5);
00259 
00260     TButton *but5 = new TButton("Vote !nue","HS->Vote(0);",0.5,0.7,1.0,0.8);
00261     but5->SetTextSize(0.5);
00262     but5->SetFillColor(4);
00263 
00264     TButton *but6 = new TButton("Zoom","HS->Zoom();",0.0,0.8,0.5,0.9);
00265     but6->SetTextSize(0.5);
00266     but6->SetFillColor(5);
00267 
00268     TButton *but7 = new TButton("Unzoom","HS->UnZoom();",0.5,0.8,1.0,0.9);
00269     but7->SetTextSize(0.5);
00270     but7->SetFillColor(4);
00271 
00272     TButton *but8 = new TButton("Quit","char exit[5] = HS->exit; delete HS; gROOT->ProcessLine(exit);",0.0,0.5,1.0,0.6);
00273     but8->SetTextSize(0.5);
00274     but8->SetFillColor(45);
00275 
00276     but1->Draw();
00277     but2->Draw();
00278     but3a->Draw();
00279     but3b->Draw();
00280     but4->Draw();
00281     but5->Draw();
00282     but6->Draw();
00283     but7->Draw();
00284     but8->Draw();
00285 
00286   }
00287   else {
00288     handScanCan = (TCanvas*) gROOT->FindObject("HandScanCan");
00289     handScanCan->cd(1);
00290     uHist = (TH2F*) gPad->FindObject("uHist");
00291     delete uHist;
00292     handScanCan->cd(2);
00293     vHist = (TH2F*) gPad->FindObject("vHist");
00294     delete vHist;
00295     handScanCan->cd(3);
00296     uEMHist = (TH2F*) gPad->FindObject("uEMHist");
00297     delete uEMHist;
00298     handScanCan->cd(4);
00299     vEMHist = (TH2F*) gPad->FindObject("vEMHist");
00300     delete vEMHist;
00301     handScanCan->cd(5);
00302     uPredHist = (TH2F*) gPad->FindObject("uPredHist");
00303     delete uPredHist;
00304     handScanCan->cd(6);
00305     vPredHist = (TH2F*) gPad->FindObject("vPredHist");
00306     delete vPredHist;
00307 
00308     for(int i=1;i<=6;i++){
00309       gPad->Modified();
00310       gPad->Update();
00311     }
00312 
00313     handScanControlCan = (TCanvas*) gROOT->FindObject("HandScanControlCan");
00314     handScanControlCan->cd();
00315     TList *theList = handScanControlCan->GetListOfPrimitives();
00316     TIterator *iter = theList->MakeIterator();
00317     TObject *ob;      
00318     while((ob = iter->Next())){
00319       if(ob->InheritsFrom("TLatex")) {
00320         TLatex *tex = (TLatex*) ob;
00321         delete tex;
00322       }
00323     }
00324     TLatex *tex = new TLatex(0.1,0.4,"Calculating...");
00325     tex->SetTextColor(2);
00326     tex->SetName("calcTex");
00327     tex->Draw();
00328     gPad->Modified();
00329     gPad->Update();
00330   }
00331 
00332   //if we cheated last time, get rid of stdhepcanvas
00333   if(gROOT->FindObject("StdHepDiagramCanvas")) {
00334     TCanvas *can = (TCanvas*) gROOT->FindObject("StdHepDiagramCanvas");
00335     can->cd();    
00336     TList *theList = can->GetListOfPrimitives();
00337     TIterator *iter = theList->MakeIterator();
00338     TObject *ob;      
00339     while((ob = iter->Next())){
00340       if(ob->InheritsFrom("TLatex")) {
00341         TLatex *tex = (TLatex*) ob;
00342         delete tex;
00343       }
00344       else if(ob->InheritsFrom("TArrow")) {
00345         TArrow *ar = (TArrow*) ob;
00346         delete ar;
00347       }
00348       else if(ob->InheritsFrom("TMarker")) {
00349         TMarker *m = (TMarker*) ob;
00350         delete m;
00351       }
00352     }
00353     delete can;    
00354   }
00355 
00356   if(LoadTruth(0)){
00357     tru_inu = ntpTruth->inu;
00358     tru_iac = ntpTruth->iaction;
00359     tru_y = ntpTruth->y;
00360     shw_En = ntpTruth->p4shw[3];
00361     tru_En = ntpTruth->p4neu[3];
00362     if(tru_iac==1){
00363       if(tru_inu==12) lep_En = ntpTruth->p4el1[3];
00364       else if(tru_inu==14) lep_En = ntpTruth->p4mu1[3];
00365       else if(tru_inu==16) lep_En = ntpTruth->p4tau[3];
00366     }
00367     else lep_En = 0;
00368   }
00369 
00370   //get strip lists:
00371   TClonesArray* pointStripArray = NULL;
00372   if(isST) pointStripArray = (strecord->stp);
00373   else pointStripArray = (record->stp);
00374   TClonesArray& stripArray = *pointStripArray;
00375   maxstp_u = 0;
00376   minstp_u = 999;
00377   maxstp_v = 0;
00378   minstp_v = 999;
00379   maxpln = 0;
00380   minpln = 999;
00381   float totPE = 0;
00382 
00383   for(int i=0;i<int(eventSummary->nstrip);i++){
00384     ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[i]);
00385     int pln = ntpStrip->plane;
00386     int stp = ntpStrip->strip;
00387     int view = ntpStrip->planeview;
00388     totPE += ntpStrip->ph0.pe + ntpStrip->ph1.pe;
00389     if(pln>maxpln) maxpln = pln;
00390     if(pln<minpln) minpln = pln;
00391     if(view==2){
00392       if(stp>maxstp_u) maxstp_u = stp;
00393       if(stp<minstp_u) minstp_u = stp;
00394     }
00395     else {
00396       if(stp>maxstp_v) maxstp_v = stp;
00397       if(stp<minstp_v) minstp_v = stp;
00398     }
00399   }
00400 
00401   handScanControlCan->cd();
00402   if(TObject *ob = handScanControlCan->FindObject("calcTex")){
00403     delete ob;
00404   }
00405   char somewords[256];
00406   sprintf(somewords,"Entry: %i(/%i)",entry+1,fTotEnt);
00407   TLatex *tex = new TLatex(0.02,0.45,somewords);
00408   tex->Draw();
00409   sprintf(somewords,"Total PE: %.2f",totPE);
00410   tex = new TLatex(0.02,0.4,somewords);
00411   tex->Draw();
00412   
00413 
00414   uHist = new TH2F("uHist","All Strips - U View",
00415                    maxpln-minpln+1,minpln-0.5,maxpln+0.5,
00416                    192,-0.5,191.5);
00417   uHist->SetXTitle("Plane");
00418   uHist->SetYTitle("Strip");
00419   uHist->SetZTitle("Frac PH");
00420   vHist = new TH2F("vHist","All Strips - V View",
00421                    maxpln-minpln+1,minpln-0.5,maxpln+0.5,
00422                    192,-0.5,191.5);
00423   vHist->SetXTitle("Plane");
00424   vHist->SetYTitle("Strip");
00425   vHist->SetZTitle("Frac PH");
00426 
00427   uEMHist = new TH2F("uEMHist","CandShowerEM Strips - U View",
00428                      maxpln-minpln+1,minpln-0.5,maxpln+0.5,
00429                      192,-0.5,191.5);
00430   uEMHist->SetXTitle("Plane");
00431   uEMHist->SetYTitle("Strip");
00432   uEMHist->SetZTitle("Frac PH");
00433   vEMHist = new TH2F("vEMHist","CandShowerEM Strips - V View",
00434                      maxpln-minpln+1,minpln-0.5,maxpln+0.5,
00435                      192,-0.5,191.5);
00436   vEMHist->SetXTitle("Plane");
00437   vEMHist->SetYTitle("Strip");
00438   vEMHist->SetZTitle("Frac PH");
00439 
00440   uPredHist = new TH2F("uPredHist","Predicted Strips - U View",
00441                        maxpln-minpln+1,minpln-0.5,maxpln+0.5,
00442                        192,-0.5,191.5);
00443   uPredHist->SetXTitle("Plane");
00444   uPredHist->SetYTitle("Strip");
00445   uPredHist->SetZTitle("Frac PH");
00446   vPredHist = new TH2F("vPredHist","Predicted Strips - V View",
00447                        maxpln-minpln+1,minpln-0.5,maxpln+0.5,
00448                        192,-0.5,191.5);
00449   vPredHist->SetXTitle("Plane");
00450   vPredHist->SetYTitle("Strip");
00451   vPredHist->SetZTitle("Frac PH");
00452 
00453   for(int i=0;i<int(eventSummary->nstrip);i++){
00454     ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[i]);
00455     int pln = ntpStrip->plane;
00456     int stp = ntpStrip->strip;
00457     int view = ntpStrip->planeview;
00458     float pes = ntpStrip->ph0.pe+ntpStrip->ph1.pe;
00459     if(view==2) uHist->Fill(pln,stp,pes);
00460     else vHist->Fill(pln,stp,pes);      
00461   }
00462 
00463   if(uHist->Integral()>0) uHist->Scale(1./uHist->Integral());
00464   if(vHist->Integral()>0)vHist->Scale(1./vHist->Integral());
00465 
00466   if(isEM){
00467     int nemshw = ntpEMSummary->nshower;
00468     if(nemshw==1) {
00469       
00470       LoadEMShower(0);
00471       maxpln = 0;
00472       minpln = 999;
00473       maxstp_u = 0;
00474       minstp_u = 999;
00475       maxstp_v = 0;
00476       minstp_v = 999;
00477 
00478       float energy = ntpEMShower->ph.gev;
00479       float vtx_u = ntpEMShower->vtx.u;
00480       float vtx_v = ntpEMShower->vtx.v;
00481       float vtx_z = ntpEMShower->vtx.z;
00482       float dudz = ntpEMShower->vtx.dcosu/ntpEMShower->vtx.dcosz;
00483       float dvdz = ntpEMShower->vtx.dcosv/ntpEMShower->vtx.dcosz;
00484       int vtxview = 2;
00485       
00486       float predVtx_u = 0;
00487       float predVtx_v = 0;
00488       float predVtx_z = 0;
00489       float minZDist = 999;
00490       float minUDist = 999;
00491       float minVDist = 999;
00492       int vtxPln = 0;
00493       int vtxUStp = 0;
00494       int vtxVStp = 0;
00495       
00496       int *strips = ntpEMShower->stp;    
00497       for(int i=0;i<ntpEMShower->nstrip;i++){
00498         int index = strips[i];
00499         ntpStrip = dynamic_cast<NtpSRStrip *>(stripArray[index]);
00500         int pln = ntpStrip->plane;
00501         int stp = ntpStrip->strip;
00502         int view = ntpStrip->planeview;
00503 
00504         if(pln>maxpln) maxpln = pln;
00505         if(pln<minpln) minpln = pln;
00506         if(view==2){
00507           if(stp>maxstp_u) maxstp_u = stp;
00508           if(stp<minstp_u) minstp_u = stp;
00509         }
00510         else {
00511           if(stp>maxstp_v) maxstp_v = stp;
00512           if(stp<minstp_v) minstp_v = stp;
00513         }
00514 
00515         if(fabs(ntpStrip->z - vtx_z)<minZDist) {
00516           minZDist = fabs(ntpStrip->z - vtx_z);
00517           vtxview = view;
00518           predVtx_z = ntpStrip->z - vtx_z;
00519           vtxPln = pln;
00520         }
00521         if(view==2){
00522           if(fabs(ntpStrip->tpos - vtx_u)<minUDist) {
00523             minUDist = fabs(ntpStrip->tpos - vtx_u);
00524             predVtx_u = ntpStrip->tpos - vtx_u;
00525             vtxUStp = stp;
00526           }
00527         }
00528         else {
00529           if(fabs(ntpStrip->tpos - vtx_v)<minVDist) {
00530             minVDist = fabs(ntpStrip->tpos - vtx_v);
00531             predVtx_v = ntpStrip->tpos - vtx_v;
00532             vtxVStp = stp;
00533           }
00534         }
00535         
00536         float pes = ntpStrip->ph0.pe+ntpStrip->ph1.pe;
00537         if(view==2) uEMHist->Fill(pln,stp,pes);
00538         else vEMHist->Fill(pln,stp,pes);   
00539       }
00540       
00541       minpln -= 1;
00542       maxpln += 1;
00543       minstp_u -= 2;
00544       minstp_v -= 2;
00545       maxstp_u += 2;
00546       maxstp_v += 2;
00547 
00548       if(maxstp_u-minstp_u<10) {
00549         int diff_u = 10 - (maxstp_u-minstp_u);
00550         maxstp_u += diff_u/2;
00551         minstp_u -= diff_u/2;
00552       }
00553       if(maxstp_v-minstp_v<10) {
00554         int diff_v = 10 - (maxstp_v-minstp_v);
00555         maxstp_v += diff_v/2;
00556         minstp_v -= diff_v/2;
00557       }
00558       if(maxpln-minpln<8){
00559         int diff_p = 8 - (maxpln-minpln);
00560         maxpln += diff_p/2;
00561         minpln -= diff_p/2;
00562       }
00563 
00564       handScanControlCan->cd();
00565       sprintf(somewords,"ShwEM - Status: %i",ntpEMShower->status);
00566       tex = new TLatex(0.02,0.35,somewords);
00567       tex->SetTextColor(4);
00568       tex->Draw();
00569       sprintf(somewords,"Total EM PE: %.2f",ntpEMShower->ph.pe);
00570       tex = new TLatex(0.02,0.3,somewords);
00571       tex->SetTextColor(4);
00572       tex->Draw();
00573       sprintf(somewords,"Energy: %.2f",energy);
00574       tex = new TLatex(0.02,0.25,somewords);
00575       tex->SetTextColor(4);
00576       tex->Draw();
00577       sprintf(somewords,"Vtx (u,v,z): %.3f, %.3f, %.3f",
00578               vtx_u,vtx_v,vtx_z);
00579       tex = new TLatex(0.02,0.2,somewords);
00580       tex->SetTextColor(4);
00581       tex->Draw();
00582       sprintf(somewords,"Angles (dudz,dvdz): %.3f, %.3f",
00583               dudz,dvdz);
00584       tex = new TLatex(0.02,0.15,somewords);
00585       tex->SetTextColor(4);
00586       tex->Draw();
00587            
00588       float chi2 = 0;        
00589       int ndf = 0;
00590       
00591       FitterEM *fit = new FitterEM();
00592       fit->QuickInput(energy,predVtx_u,predVtx_v,predVtx_z,dudz,dvdz,vtxview);
00593       double binFluc = 1;
00594       for(int i=minpln;i<=maxpln;i++) {
00595         if(i%2==0&&i<250||i%2==1&&i>250){
00596           for(int j=minstp_u;j<=maxstp_u;j++) {   
00597             uPredHist->Fill(i,j,fit->PredictEMLoss(i-vtxPln,
00598                                                    j-vtxUStp,binFluc));
00599           }
00600         }
00601         else{
00602           for(int j=minstp_v;j<=maxstp_v;j++) {   
00603             vPredHist->Fill(i,j,fit->PredictEMLoss(i-vtxPln,
00604                                                    j-vtxVStp,binFluc));
00605           }
00606         }
00607       }
00608 
00609       if(uEMHist->Integral()>0)uEMHist->Scale(1./uEMHist->Integral());
00610       if(vEMHist->Integral()>0)vEMHist->Scale(1./vEMHist->Integral());
00611       if(uPredHist->Integral()>0)uPredHist->Scale(1./uPredHist->Integral());
00612       if(vPredHist->Integral()>0)vPredHist->Scale(1./vPredHist->Integral());
00613 
00614       for(int i=minpln;i<=maxpln;i++) {
00615         if(i%2==0&&i<250||i%2==1&&i>250){
00616           for(int j=minstp_u;j<=maxstp_u;j++) {   
00617             fit->PredictEMLoss(i-vtxPln,j-vtxUStp,binFluc);
00618             if(binFluc>0){
00619               int binx = uEMHist->GetXaxis()->FindBin(i);
00620               int biny = uEMHist->GetYaxis()->FindBin(j);
00621               float p = uPredHist->GetBinContent(binx,biny);
00622               float em = uEMHist->GetBinContent(binx,biny);
00623               chi2 += ((p-em)*(p-em))/(binFluc*binFluc);
00624               ndf+=1;
00625             }
00626           }
00627         }
00628         else{
00629           for(int j=minstp_v;j<=maxstp_v;j++) {
00630             fit->PredictEMLoss(i-vtxPln,j-vtxVStp,binFluc);
00631             if(binFluc>0){
00632               int binx = vEMHist->GetXaxis()->FindBin(i);
00633               int biny = vEMHist->GetYaxis()->FindBin(j);
00634               float p = vPredHist->GetBinContent(binx,biny);
00635               float em = vEMHist->GetBinContent(binx,biny);
00636               chi2 += ((p-em)*(p-em))/(binFluc*binFluc);
00637               ndf+=1;
00638             }
00639           }
00640         }
00641       }
00642       delete fit;      
00643       sprintf(somewords,"Chi2/NDF: %.3f / %i",chi2,ndf);
00644       tex = new TLatex(0.02,0.1,somewords);
00645       tex->SetTextColor(2);
00646       tex->Draw();
00647     }
00648   }
00649 
00650   for(int i=1;i<=6;i++) {
00651     handScanCan->cd(i);
00652     gPad->SetTheta(30.0);
00653     gPad->SetPhi(30.0);
00654   }
00655   
00656   handScanCan->cd(1);
00657   uHist->Draw("LEGO2");
00658   gPad->Modified();
00659   gPad->Update();
00660   
00661   handScanCan->cd(2);
00662   vHist->Draw("LEGO2");
00663   gPad->Modified();
00664   gPad->Update();
00665 
00666   handScanCan->cd(3);
00667   uEMHist->Draw("LEGO2");
00668   gPad->Modified();
00669   gPad->Update();
00670 
00671   handScanCan->cd(4);  
00672   vEMHist->Draw("LEGO2");
00673   gPad->Modified();
00674   gPad->Update();
00675   
00676   handScanCan->cd(5);
00677   uPredHist->Draw("LEGO2");
00678   gPad->Modified();
00679   gPad->Update();
00680 
00681   handScanCan->cd(6);
00682   vPredHist->Draw("LEGO2");
00683   gPad->Modified();
00684   gPad->Update();
00685 
00686   handScanControlCan->cd();
00687   
00688 }

void MadHandScan::Pid (  ) 

Definition at line 738 of file MadHandScan.cxx.

References fCurFailed, tru_iac, and tru_inu.

Referenced by Cheat().

00738                      {
00739   
00740   if(fCurFailed!=0&&fCurFailed!=1) return; //no PID for this set of events
00741   TCanvas *can = (TCanvas*) gROOT->FindObject("HandScanControlCan");
00742   can->cd();
00743   char sometext[256];
00744   if(abs(tru_inu)==12 && tru_iac==1) {
00745     if(fCurFailed) sprintf(sometext,"PID = NOT #nu_{e}");
00746     else sprintf(sometext,"PID = #nu_{e}");
00747   }
00748   else {
00749     if(fCurFailed) sprintf(sometext,"PID = #nu_{e}");
00750     else sprintf(sometext,"PID = NOT #nu_{e}");
00751   }
00752   TLatex *tex = new TLatex(0.6,0.45,sometext);
00753   tex->SetTextColor(6);
00754   tex->Draw();
00755   
00756 }

void MadHandScan::RunQuiz ( std::string  st = ""  ) 
void MadHandScan::UnZoom (  ) 

Definition at line 783 of file MadHandScan.cxx.

References cd(), uEMHist, uHist, uPredHist, vEMHist, vHist, and vPredHist.

00783                         {
00784 
00785   uHist->GetXaxis()->UnZoom();
00786   vHist->GetXaxis()->UnZoom();
00787   uEMHist->GetXaxis()->UnZoom();
00788   vEMHist->GetXaxis()->UnZoom();
00789   uPredHist->GetXaxis()->UnZoom();
00790   vPredHist->GetXaxis()->UnZoom();
00791 
00792   uHist->SetAxisRange(0.,191.,"Y");
00793   vHist->SetAxisRange(0.,191.,"Y");
00794   uEMHist->SetAxisRange(0.,191.,"Y");
00795   vEMHist->SetAxisRange(0.,191.,"Y");
00796   uPredHist->SetAxisRange(0.,191.,"Y");
00797   vPredHist->SetAxisRange(0.,191.,"Y");
00798   
00799   TCanvas *can = (TCanvas*) gROOT->FindObject("HandScanCan");  
00800   for(int i=1;i<=6;i++) {
00801     can->cd(i);
00802     gPad->Modified();
00803     gPad->Update();
00804   }
00805   ((TCanvas*)gROOT->FindObject("HandScanControlCan"))->cd();
00806 }

void MadHandScan::Vote ( int  val  ) 

Definition at line 690 of file MadHandScan.cxx.

References fCurEnt, HandScanDisplay(), isNue, quizTree, tru_iac, and tru_inu.

00690                              {
00691 
00692   if(abs(tru_inu)==12&&tru_iac==1) { //if it really is a nue
00693     if(val==1) isNue = 1;  //and the vote was for nue, then fill tree with 1
00694     else isNue = 0;  //otherwise with 0
00695   }
00696   else {  //if it wasn't really a nue
00697     if(val==1) isNue = 0; //and the vote was for nue, then fill tree with 0
00698     else isNue = 1; //otherwise with 1
00699   }
00700   quizTree->Fill();
00701   fCurEnt+=1;
00702   HandScanDisplay(fCurEnt);
00703 
00704 }

void MadHandScan::WriteQuizTree ( string  tag  )  [inline]

Definition at line 58 of file MadHandScan.h.

References quizTag, and writeTree.

00058 {writeTree = true;quizTag = tag;}

void MadHandScan::Zoom (  ) 

Definition at line 758 of file MadHandScan.cxx.

References cd(), maxpln, maxstp_u, maxstp_v, minpln, minstp_u, minstp_v, uEMHist, uHist, uPredHist, vEMHist, vHist, and vPredHist.

00758                       {
00759 
00760   uHist->SetAxisRange(minpln,maxpln,"X");
00761   vHist->SetAxisRange(minpln,maxpln,"X");
00762   uEMHist->SetAxisRange(minpln,maxpln,"X");
00763   vEMHist->SetAxisRange(minpln,maxpln,"X");
00764   uPredHist->SetAxisRange(minpln,maxpln,"X");
00765   vPredHist->SetAxisRange(minpln,maxpln,"X");
00766 
00767   uHist->SetAxisRange(minstp_u,maxstp_u,"Y");
00768   vHist->SetAxisRange(minstp_v,maxstp_v,"Y");
00769   uEMHist->SetAxisRange(minstp_u,maxstp_u,"Y");
00770   vEMHist->SetAxisRange(minstp_v,maxstp_v,"Y");
00771   uPredHist->SetAxisRange(minstp_u,maxstp_u,"Y");
00772   vPredHist->SetAxisRange(minstp_v,maxstp_v,"Y");
00773 
00774   TCanvas *can = (TCanvas*) gROOT->FindObject("HandScanCan");  
00775   for(int i=1;i<=6;i++) {
00776     can->cd(i);
00777     gPad->Modified();
00778     gPad->Update();
00779   }
00780   ((TCanvas*)gROOT->FindObject("HandScanControlCan"))->cd();
00781 }


Member Data Documentation

std::map<int,int> MadHandScan::entryMap [protected]

Definition at line 18 of file MadHandScan.h.

Referenced by HandScanDisplay(), and MadHandScan().

Definition at line 54 of file MadHandScan.h.

Referenced by MadHandScan().

std::map<int,int> MadHandScan::failedMap [protected]

Definition at line 20 of file MadHandScan.h.

Referenced by HandScanDisplay(), and MadHandScan().

int MadHandScan::fChainEnt [protected]

Definition at line 19 of file MadHandScan.h.

Referenced by HandScanDisplay().

Definition at line 53 of file MadHandScan.h.

Referenced by MadHandScan(), and Vote().

int MadHandScan::fCurFailed [protected]

Definition at line 21 of file MadHandScan.h.

Referenced by HandScanDisplay(), and Pid().

int MadHandScan::fTotEnt [protected]

Definition at line 16 of file MadHandScan.h.

Referenced by HandScanDisplay(), and MadHandScan().

int MadHandScan::isNue [protected]

Definition at line 23 of file MadHandScan.h.

Referenced by MadHandScan(), and Vote().

float MadHandScan::lep_En [protected]

Definition at line 26 of file MadHandScan.h.

Referenced by HandScanDisplay(), and MadHandScan().

int MadHandScan::maxpln [protected]

Definition at line 32 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), and Zoom().

int MadHandScan::maxstp_u [protected]

Definition at line 34 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), and Zoom().

int MadHandScan::maxstp_v [protected]

Definition at line 36 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), and Zoom().

int MadHandScan::minpln [protected]

Definition at line 33 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), and Zoom().

int MadHandScan::minstp_u [protected]

Definition at line 35 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), and Zoom().

int MadHandScan::minstp_v [protected]

Definition at line 37 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), and Zoom().

string MadHandScan::quizTag [protected]

Definition at line 14 of file MadHandScan.h.

Referenced by MadHandScan(), WriteQuizTree(), and ~MadHandScan().

TTree* MadHandScan::quizTree [protected]

Definition at line 13 of file MadHandScan.h.

Referenced by MadHandScan(), Vote(), and ~MadHandScan().

int MadHandScan::r_num [protected]

Definition at line 30 of file MadHandScan.h.

Referenced by HandScanDisplay(), and MadHandScan().

int MadHandScan::s_num [protected]

Definition at line 31 of file MadHandScan.h.

Referenced by HandScanDisplay(), and MadHandScan().

float MadHandScan::shw_En [protected]

Definition at line 25 of file MadHandScan.h.

Referenced by Cheat(), HandScanDisplay(), and MadHandScan().

float MadHandScan::tru_En [protected]

Definition at line 24 of file MadHandScan.h.

Referenced by Cheat(), HandScanDisplay(), and MadHandScan().

int MadHandScan::tru_iac [protected]

Definition at line 29 of file MadHandScan.h.

Referenced by Cheat(), HandScanDisplay(), MadHandScan(), Pid(), and Vote().

int MadHandScan::tru_inu [protected]

Definition at line 28 of file MadHandScan.h.

Referenced by Cheat(), HandScanDisplay(), MadHandScan(), Pid(), and Vote().

float MadHandScan::tru_y [protected]

Definition at line 27 of file MadHandScan.h.

Referenced by Cheat(), HandScanDisplay(), and MadHandScan().

TH2F* MadHandScan::uEMHist [protected]

Definition at line 41 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), UnZoom(), and Zoom().

TH2F* MadHandScan::uHist [protected]

Definition at line 39 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), UnZoom(), and Zoom().

TH2F* MadHandScan::uPredHist [protected]

Definition at line 43 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), UnZoom(), and Zoom().

TH2F* MadHandScan::vEMHist [protected]

Definition at line 42 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), UnZoom(), and Zoom().

TH2F* MadHandScan::vHist [protected]

Definition at line 40 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), UnZoom(), and Zoom().

TH2F* MadHandScan::vPredHist [protected]

Definition at line 44 of file MadHandScan.h.

Referenced by HandScanDisplay(), MadHandScan(), UnZoom(), and Zoom().

Bool_t MadHandScan::writeTree [protected]

Definition at line 15 of file MadHandScan.h.

Referenced by MadHandScan(), WriteQuizTree(), and ~MadHandScan().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1