AtNuShieldEventNtuple Class Reference

#include <AtNuShieldEventNtuple.h>

List of all members.

Public Member Functions

 AtNuShieldEventNtuple ()
 ~AtNuShieldEventNtuple ()
void AddFile (const char *file)
void SetFileName (const char *filename)
void Run (Int_t entries=-1)

Private Member Functions

void OpenFile ()
void FillData ()
void ResetData ()
void CloseFile ()
void LoadShieldGeometry ()

Private Attributes

TChain * fChain
AtNuShieldEventfShieldEvent
AtNuEventSelectionFactoryfSelectionFactory
AtNuEventSelectionfSelection
AtmosEventfEvent
TFile * fShieldFile
TTree * fShieldTree
Int_t fRun
Int_t fDate
Int_t fWeek
Int_t fSection
Int_t fSubSection
Int_t fPlane
Int_t fPlank
Int_t fEnd
Double_t fX
Double_t fY
Double_t fExpected
Double_t fObserved
Double_t fAnyObserved
Double_t fExactMatched
Double_t fDoubleMatched
Int_t fExpectedHits [300][5][2]
Int_t fObservedHits [300][5][2]
Int_t fAnyObservedHits [300][5][2]
Int_t fMatchedHits [300][5][2]
Int_t fDoubleMatchedHits [300][5][2]
Double_t fShieldX [300][5]
Double_t fShieldY [300][5]
Int_t fShieldIndex [300][5]
TString fFileName

Detailed Description

Definition at line 15 of file AtNuShieldEventNtuple.h.


Constructor & Destructor Documentation

AtNuShieldEventNtuple::AtNuShieldEventNtuple (  ) 

Definition at line 13 of file AtNuShieldEventNtuple.cxx.

00013                                              :
00014   fChain(0),
00015   fShieldEvent(0),
00016   fSelectionFactory(0),
00017   fSelection(0),
00018   fEvent(0),
00019   fShieldFile(0),
00020   fShieldTree(0),
00021   fFileName("shieldntuple.root")
00022 {
00023   // creating shield analysis
00024   fShieldEvent = new AtNuShieldEvent();  
00025 
00026   // creating event selection
00027   std::cout << "  creating selection factory... " << std::endl;
00028   if( !fSelectionFactory ){
00029     fSelectionFactory = new AtNuEventSelectionFactory();
00030     if( fSelectionFactory ){
00031       fSelection = fSelectionFactory->MakeEventSelection();
00032       if( fSelection ) std::cout << "   ...done " << std::endl;
00033     }
00034   }  
00035 
00036   // create chain of ntuples
00037   std::cout << "  creating ntuple chain..." << std::endl;
00038   if( !fChain ){
00039     fChain = new TChain("ntp","chain");
00040     fChain->SetBranchAddress("evt",&fEvent);
00041     if( fChain ) std::cout << "   ...done" << std::endl;
00042   }
00043 
00044   // initialize arrays
00045   this->ResetData();
00046 
00047   // load shield geometry
00048   this->LoadShieldGeometry();
00049 
00050 }

AtNuShieldEventNtuple::~AtNuShieldEventNtuple (  ) 

Definition at line 52 of file AtNuShieldEventNtuple.cxx.

References fShieldEvent.

00053 {
00054   delete fShieldEvent;
00055 }


Member Function Documentation

void AtNuShieldEventNtuple::AddFile ( const char *  file  ) 

Definition at line 57 of file AtNuShieldEventNtuple.cxx.

References fChain.

00058 {
00059   std::cout << " *** AtNuShieldEventNtuple::AddFile(...) *** " << std::endl;
00060   std::cout << "  adding files from: " << file << std::endl;
00061 
00062   fChain->Add(file);
00063 
00064   std::cout << "      ...total entries=" << fChain->GetEntries() << std::endl;
00065 
00066   return;
00067 }

void AtNuShieldEventNtuple::CloseFile (  )  [private]

Definition at line 401 of file AtNuShieldEventNtuple.cxx.

References fShieldFile, and fShieldTree.

Referenced by Run().

00402 {
00403   std::cout << " *** AtNuShieldEventNtuple::CloseFile() *** " << std::endl;
00404 
00405   if( fShieldFile ){
00406     std::cout << " closing file: " << fShieldFile->GetName() << std::endl;
00407     TDirectory* tmpd = gDirectory;
00408     fShieldFile->cd();
00409     fShieldTree->Write();
00410     fShieldFile->Close();
00411     gDirectory = tmpd;
00412   }
00413 }

void AtNuShieldEventNtuple::FillData (  )  [private]

Definition at line 297 of file AtNuShieldEventNtuple.cxx.

References fAnyObserved, fAnyObservedHits, fDoubleMatched, fDoubleMatchedHits, fEnd, fExactMatched, fExpected, fExpectedHits, fMatchedHits, fObserved, fObservedHits, fPlane, fPlank, fSection, fShieldFile, fShieldIndex, fShieldTree, fShieldX, fShieldY, fSubSection, fX, and fY.

Referenced by Run().

00298 {
00299   if( fShieldFile ){
00300     for( Int_t iplane=0; iplane<300; iplane++ ){
00301       for( Int_t iplank=0; iplank<5; iplank++ ){
00302         for( Int_t iend=0; iend<2; iend++ ){
00303     
00304           fSection = fShieldIndex[iplane][iplank];
00305 
00306           if( fSection>0 ){
00307 
00308             // plane/plank/end
00309             fPlane = iplane+500;
00310             fPlank = 4*iplank;
00311             fEnd = iend;
00312 
00313             // subsection (see diagram)
00314             //
00315             //  -2: east side (x<0)
00316             //  -1: east wall (x<0)          __0__     
00317             //   0: top              -1|  __|     |__  |+1                  
00318             //  +1: west wall (x>0)      
00319             //  +2: west side (x>0)      -2|       |+2
00320             //
00321 
00322             if(fPlane>=528 && fPlane<=575){ // section 1
00323               if(fPlane>=543 && fPlane<=557) fSubSection = 0; 
00324               if(fPlane>=528 && fPlane<=542) fSubSection = 0;
00325               if(fPlane>=572 && fPlane<=575) fSubSection = 1;
00326               if(fPlane>=563 && fPlane<=566) fSubSection =-1;
00327               if(fPlane>=567 && fPlane<=568) fSubSection = 2;
00328               if(fPlane>=558 && fPlane<=559) fSubSection =-2;
00329             }
00330             if(fPlane>=592 && fPlane<=639){ // section 2
00331               if(fPlane>=607 && fPlane<=621) fSubSection = 0;
00332               if(fPlane>=592 && fPlane<=606) fSubSection = 0;
00333               if(fPlane>=636 && fPlane<=639) fSubSection = 1;
00334               if(fPlane>=627 && fPlane<=630) fSubSection =-1;
00335               if(fPlane>=631 && fPlane<=632) fSubSection = 2;
00336               if(fPlane>=622 && fPlane<=623) fSubSection =-2;
00337             }
00338             if(fPlane>=656 && fPlane<=703){ // section 3
00339               if(fPlane>=671 && fPlane<=685) fSubSection = 0;
00340               if(fPlane>=656 && fPlane<=670) fSubSection = 0;
00341               if(fPlane>=700 && fPlane<=703) fSubSection = 1;
00342               if(fPlane>=691 && fPlane<=694) fSubSection =-1;
00343               if(fPlane>=695 && fPlane<=696) fSubSection = 2;
00344               if(fPlane>=686 && fPlane<=687) fSubSection =-2;
00345             }
00346             if(fPlane>=720 && fPlane<=767){ // section 4
00347               if(fPlane>=735 && fPlane<=749) fSubSection = 0;
00348               if(fPlane>=720 && fPlane<=734) fSubSection = 0;
00349               if(fPlane>=764 && fPlane<=767) fSubSection = 1;
00350               if(fPlane>=755 && fPlane<=758) fSubSection =-1;
00351               if(fPlane>=759 && fPlane<=760) fSubSection = 2;
00352               if(fPlane>=750 && fPlane<=751) fSubSection =-2;
00353             }
00354 
00355             fExpected = fExpectedHits[iplane][iplank][iend];
00356             fObserved = fObservedHits[iplane][iplank][iend];
00357             fAnyObserved = fAnyObservedHits[iplane][iplank][iend];
00358             fExactMatched = fMatchedHits[iplane][iplank][iend];
00359             fDoubleMatched = fDoubleMatchedHits[iplane][iplank][iend];
00360 
00361             fX = -999.9;
00362             fY = -999.9;
00363 
00364             if( fExpected>0.0 ){
00365               fX = fShieldX[iplane][iplank];
00366               fY = fShieldY[iplane][iplank];
00367             }
00368 
00369             fShieldFile->cd();
00370             fShieldTree->Fill();
00371           }
00372         }
00373       }
00374 
00375     }
00376   }
00377 }

void AtNuShieldEventNtuple::LoadShieldGeometry (  )  [private]

Definition at line 415 of file AtNuShieldEventNtuple.cxx.

References fShieldIndex.

00416 {
00417   std::cout << " *** AtNuShieldEventNtuple::LoadShieldGeometry() *** " << std::endl;
00418 
00419   // LOAD SHIELD GEOMETRY FROM LOOKUP TABLE
00420   // ====================================== 
00421   // stores the shield planks to be monitored 
00422 
00423   // fShieldIndex[300][5]
00424   //  elements: [plane-500][plank/4]
00425   //  contents: [section]
00426 
00427   Int_t tempShieldIndex[300][5] = {
00428     {0, 0, 0, 0, 0},
00429     {0, 0, 0, 0, 0},
00430     {0, 0, 0, 0, 0},
00431     {0, 0, 0, 0, 0},
00432     {0, 0, 0, 0, 0},
00433     {0, 0, 0, 0, 0},
00434     {0, 0, 0, 0, 0},
00435     {0, 0, 0, 0, 0},
00436     {0, 0, 0, 0, 0},
00437     {0, 0, 0, 0, 0},
00438     {0, 0, 0, 0, 0},
00439     {0, 0, 0, 0, 0},
00440     {0, 0, 0, 0, 0},
00441     {0, 0, 0, 0, 0},
00442     {0, 0, 0, 0, 0},
00443     {0, 0, 0, 0, 0},
00444     {0, 0, 0, 0, 0},
00445     {0, 0, 0, 0, 0},
00446     {0, 0, 0, 0, 0},
00447     {0, 0, 0, 0, 0},
00448     {0, 0, 0, 0, 0},
00449     {0, 0, 0, 0, 0},
00450     {0, 0, 0, 0, 0},
00451     {0, 0, 0, 0, 0},
00452     {0, 0, 0, 0, 0},
00453     {0, 0, 0, 0, 0},
00454     {0, 0, 0, 0, 0},
00455     {0, 0, 0, 0, 0},
00456     {1, 1, 0, 1, 0}, // 528
00457     {1, 0, 1, 0, 1}, // 529
00458     {0, 1, 0, 1, 0}, // 530
00459     {1, 0, 1, 0, 1}, // 531
00460     {0, 1, 0, 1, 0}, // 532
00461     {1, 1, 0, 1, 0}, // 533
00462     {1, 0, 1, 0, 1}, // 534
00463     {0, 1, 0, 1, 0}, // 535
00464     {1, 1, 0, 1, 0}, // 536
00465     {1, 0, 1, 0, 0}, // 537
00466     {1, 0, 1, 0, 1}, // 538
00467     {0, 1, 0, 1, 0}, // 539
00468     {1, 0, 1, 0, 1}, // 540
00469     {0, 1, 0, 1, 0}, // 541
00470     {1, 0, 1, 0, 1}, // 542
00471     {1, 1, 0, 1, 0}, // 543
00472     {1, 0, 1, 0, 1}, // 544
00473     {0, 1, 0, 1, 0}, // 545
00474     {1, 0, 1, 0, 1}, // 546
00475     {0, 1, 0, 1, 0}, // 547
00476     {1, 0, 1, 0, 1}, // 548
00477     {0, 1, 0, 1, 0}, // 549
00478     {1, 0, 1, 0, 1}, // 550
00479     {0, 1, 0, 1, 0}, // 551
00480     {1, 0, 1, 0, 1}, // 552
00481     {1, 0, 1, 0, 1}, // 553
00482     {0, 1, 0, 1, 0}, // 554
00483     {1, 0, 1, 0, 1}, // 555
00484     {0, 1, 0, 1, 0}, // 556
00485     {1, 0, 1, 0, 1}, // 557
00486     {1, 0, 1, 0, 1}, // 558: subsection -2
00487     {0, 1, 0, 1, 0}, // 559: subsection -2
00488     {0, 0, 0, 0, 0},
00489     {0, 0, 0, 0, 0},
00490     {0, 0, 0, 0, 0},
00491     {1, 0, 1, 0, 1}, // 563: subsection -1
00492     {0, 1, 0, 1, 0}, // 564: subsection -1
00493     {1, 0, 1, 0, 1}, // 565: subsection -1
00494     {0, 1, 0, 1, 0}, // 566: subsection -1
00495     {1, 0, 1, 0, 1}, // 567: subsection +2
00496     {0, 1, 0, 1, 0}, // 568: subsection +2
00497     {0, 0, 0, 0, 0},
00498     {0, 0, 0, 0, 0},
00499     {0, 0, 0, 0, 0},
00500     {1, 0, 1, 0, 1}, // 572: subsection +1
00501     {0, 1, 0, 1, 0}, // 573: subsection +1
00502     {1, 0, 1, 0, 1}, // 574: subsection +1
00503     {0, 1, 0, 1, 0}, // 575: subsection +1
00504     {0, 0, 0, 0, 0},
00505     {0, 0, 0, 0, 0},
00506     {0, 0, 0, 0, 0},
00507     {0, 0, 0, 0, 0},
00508     {0, 0, 0, 0, 0},
00509     {0, 0, 0, 0, 0},
00510     {0, 0, 0, 0, 0},
00511     {0, 0, 0, 0, 0},
00512     {0, 0, 0, 0, 0},
00513     {0, 0, 0, 0, 0},
00514     {0, 0, 0, 0, 0},
00515     {0, 0, 0, 0, 0},
00516     {0, 0, 0, 0, 0},
00517     {0, 0, 0, 0, 0},
00518     {0, 0, 0, 0, 0},
00519     {0, 0, 0, 0, 0},
00520     {2, 2, 0, 2, 0}, // 592
00521     {2, 0, 2, 0, 2}, // 593
00522     {0, 2, 0, 2, 0}, // 594
00523     {2, 0, 2, 0, 2}, // 595
00524     {0, 2, 0, 2, 0}, // 596
00525     {2, 2, 0, 2, 0}, // 597
00526     {2, 0, 2, 0, 2}, // 598
00527     {0, 2, 0, 2, 0}, // 599
00528     {2, 2, 0, 2, 0}, // 600
00529     {2, 0, 2, 0, 0}, // 601
00530     {2, 0, 2, 0, 2}, // 602
00531     {0, 2, 0, 2, 0}, // 603
00532     {2, 0, 2, 0, 2}, // 604
00533     {0, 2, 0, 2, 0}, // 605
00534     {2, 0, 2, 0, 2}, // 606
00535     {2, 2, 0, 2, 0}, // 607
00536     {2, 0, 2, 0, 2}, // 608
00537     {0, 2, 0, 2, 0}, // 609
00538     {2, 0, 2, 0, 2}, // 610
00539     {0, 2, 0, 2, 0}, // 611
00540     {2, 0, 2, 0, 2}, // 612
00541     {0, 2, 0, 2, 0}, // 613
00542     {2, 0, 2, 0, 2}, // 614
00543     {0, 2, 0, 2, 0}, // 615
00544     {2, 0, 2, 0, 2}, // 616
00545     {2, 0, 2, 0, 2}, // 617
00546     {0, 2, 0, 2, 0}, // 618
00547     {2, 0, 2, 0, 2}, // 619
00548     {0, 2, 0, 2, 0}, // 620
00549     {2, 0, 2, 0, 2}, // 621
00550     {2, 0, 2, 0, 2}, // 622: subsection -2
00551     {0, 2, 0, 2, 0}, // 623: subsection -2
00552     {0, 0, 0, 0, 0},
00553     {0, 0, 0, 0, 0},
00554     {0, 0, 0, 0, 0},
00555     {2, 0, 2, 0, 2}, // 627: subsection -1
00556     {0, 2, 0, 2, 0}, // 628: subsection -1
00557     {2, 0, 2, 0, 2}, // 629: subsection -1
00558     {0, 2, 0, 2, 0}, // 630: subsection -1
00559     {2, 0, 2, 0, 2}, // 631: subsection +2
00560     {0, 2, 0, 2, 0}, // 632: subsection +2
00561     {0, 0, 0, 0, 0},
00562     {0, 0, 0, 0, 0},
00563     {0, 0, 0, 0, 0},
00564     {2, 0, 2, 0, 2}, // 636: subsection +1
00565     {0, 2, 0, 2, 0}, // 637: subsection +1
00566     {2, 0, 2, 0, 2}, // 638: subsection +1
00567     {0, 2, 0, 2, 0}, // 639: subsection +1
00568     {0, 0, 0, 0, 0},
00569     {0, 0, 0, 0, 0},
00570     {0, 0, 0, 0, 0},
00571     {0, 0, 0, 0, 0},
00572     {0, 0, 0, 0, 0},
00573     {0, 0, 0, 0, 0},
00574     {0, 0, 0, 0, 0},
00575     {0, 0, 0, 0, 0},
00576     {0, 0, 0, 0, 0},
00577     {0, 0, 0, 0, 0},
00578     {0, 0, 0, 0, 0},
00579     {0, 0, 0, 0, 0},
00580     {0, 0, 0, 0, 0},
00581     {0, 0, 0, 0, 0},
00582     {0, 0, 0, 0, 0},
00583     {0, 0, 0, 0, 0},
00584     {3, 3, 0, 3, 0}, // 656
00585     {3, 0, 3, 0, 3}, // 657
00586     {0, 3, 0, 3, 0}, // 658
00587     {3, 0, 3, 0, 3}, // 659
00588     {0, 3, 0, 3, 0}, // 660
00589     {3, 3, 0, 3, 0}, // 661
00590     {3, 0, 3, 0, 3}, // 662
00591     {0, 3, 0, 3, 0}, // 663
00592     {3, 3, 0, 3, 0}, // 664
00593     {3, 0, 3, 0, 0}, // 665
00594     {3, 0, 3, 0, 3}, // 666
00595     {0, 3, 0, 3, 0}, // 667
00596     {3, 0, 3, 0, 3}, // 668
00597     {0, 3, 0, 3, 0}, // 669
00598     {3, 0, 3, 0, 3}, // 670
00599     {3, 3, 0, 3, 0}, // 671
00600     {3, 0, 3, 0, 3}, // 672
00601     {0, 3, 0, 3, 0}, // 673
00602     {3, 0, 3, 0, 3}, // 674
00603     {0, 3, 0, 3, 0}, // 675
00604     {3, 0, 3, 0, 3}, // 676
00605     {0, 3, 0, 3, 0}, // 677
00606     {3, 0, 3, 0, 3}, // 678
00607     {0, 3, 0, 3, 0}, // 679
00608     {3, 0, 3, 0, 3}, // 680
00609     {3, 0, 3, 0, 3}, // 681
00610     {0, 3, 0, 3, 0}, // 682
00611     {3, 0, 3, 0, 3}, // 683
00612     {0, 3, 0, 3, 0}, // 684
00613     {3, 0, 3, 0, 3}, // 685
00614     {3, 0, 3, 0, 3}, // 686: subsection -2
00615     {0, 3, 0, 3, 0}, // 687: subsection -2
00616     {0, 0, 0, 0, 0},
00617     {0, 0, 0, 0, 0},
00618     {0, 0, 0, 0, 0},
00619     {3, 0, 3, 0, 3}, // 691: subsection -1
00620     {0, 3, 0, 3, 0}, // 692: subsection -1
00621     {3, 0, 3, 0, 3}, // 693: subsection -1
00622     {0, 3, 0, 3, 0}, // 694: subsection -1
00623     {3, 0, 3, 0, 3}, // 695: subsection +2
00624     {0, 3, 0, 3, 0}, // 696: subsection +2
00625     {0, 0, 0, 0, 0},
00626     {0, 0, 0, 0, 0},
00627     {0, 0, 0, 0, 0},
00628     {3, 0, 3, 0, 3}, // 700: subsection +1
00629     {0, 3, 0, 3, 0}, // 701: subsection +1
00630     {3, 0, 3, 0, 3}, // 702: subsection +1
00631     {0, 3, 0, 3, 0}, // 703: subsection +1
00632     {0, 0, 0, 0, 0},
00633     {0, 0, 0, 0, 0},
00634     {0, 0, 0, 0, 0},
00635     {0, 0, 0, 0, 0},
00636     {0, 0, 0, 0, 0},
00637     {0, 0, 0, 0, 0},
00638     {0, 0, 0, 0, 0},
00639     {0, 0, 0, 0, 0},
00640     {0, 0, 0, 0, 0},
00641     {0, 0, 0, 0, 0},
00642     {0, 0, 0, 0, 0},
00643     {0, 0, 0, 0, 0},
00644     {0, 0, 0, 0, 0},
00645     {0, 0, 0, 0, 0},
00646     {0, 0, 0, 0, 0},
00647     {0, 0, 0, 0, 0},
00648     {4, 4, 0, 4, 0}, // 720
00649     {4, 0, 4, 0, 4}, // 721
00650     {0, 4, 0, 4, 0}, // 722
00651     {4, 0, 4, 0, 4}, // 723
00652     {0, 4, 0, 4, 0}, // 724
00653     {4, 4, 0, 4, 0}, // 725
00654     {4, 0, 4, 0, 4}, // 726
00655     {0, 4, 0, 4, 0}, // 727
00656     {4, 4, 0, 4, 0}, // 728
00657     {4, 0, 4, 0, 0}, // 729
00658     {4, 0, 4, 0, 4}, // 730
00659     {0, 4, 0, 4, 0}, // 731
00660     {4, 0, 4, 0, 4}, // 732
00661     {0, 4, 0, 4, 0}, // 733
00662     {4, 0, 4, 0, 4}, // 734
00663     {4, 4, 0, 4, 0}, // 735
00664     {4, 0, 4, 0, 4}, // 736
00665     {0, 4, 0, 4, 0}, // 737
00666     {4, 0, 4, 0, 4}, // 738
00667     {0, 4, 0, 4, 0}, // 739
00668     {4, 0, 4, 0, 4}, // 740
00669     {0, 4, 0, 4, 0}, // 741
00670     {4, 0, 4, 0, 4}, // 742
00671     {0, 4, 0, 4, 0}, // 743
00672     {4, 0, 4, 0, 4}, // 744
00673     {4, 0, 4, 0, 4}, // 745
00674     {0, 4, 0, 4, 0}, // 746
00675     {4, 0, 4, 0, 4}, // 747
00676     {0, 4, 0, 4, 0}, // 748
00677     {4, 0, 4, 0, 4}, // 749
00678     {4, 0, 4, 0, 4}, // 750: subsection -2
00679     {0, 4, 0, 4, 0}, // 751: subsection -2
00680     {0, 0, 0, 0, 0},
00681     {0, 0, 0, 0, 0},
00682     {0, 0, 0, 0, 0},
00683     {4, 0, 4, 0, 4}, // 755: subsection -1
00684     {0, 4, 0, 4, 0}, // 756: subsection -1
00685     {4, 0, 4, 0, 4}, // 757: subsection +2
00686     {0, 4, 0, 4, 0}, // 758: subsection +2
00687     {4, 0, 4, 0, 4}, // 759: subsection +2
00688     {0, 4, 0, 4, 0}, // 760: subsection +2
00689     {0, 0, 0, 0, 0},
00690     {0, 0, 0, 0, 0},
00691     {0, 0, 0, 0, 0},
00692     {4, 0, 4, 0, 4}, // 764: subsection +1
00693     {0, 4, 0, 4, 0}, // 765: subsection +1
00694     {4, 0, 4, 0, 4}, // 766: subsection +1
00695     {0, 4, 0, 4, 0}, // 767: subsection +1
00696     {0, 0, 0, 0, 0},
00697     {0, 0, 0, 0, 0},
00698     {0, 0, 0, 0, 0},
00699     {0, 0, 0, 0, 0},
00700     {0, 0, 0, 0, 0},
00701     {0, 0, 0, 0, 0},
00702     {0, 0, 0, 0, 0},
00703     {0, 0, 0, 0, 0},
00704     {0, 0, 0, 0, 0},
00705     {0, 0, 0, 0, 0},
00706     {0, 0, 0, 0, 0},
00707     {0, 0, 0, 0, 0},
00708     {0, 0, 0, 0, 0},
00709     {0, 0, 0, 0, 0},
00710     {0, 0, 0, 0, 0},
00711     {0, 0, 0, 0, 0},
00712     {0, 0, 0, 0, 0},
00713     {0, 0, 0, 0, 0},
00714     {0, 0, 0, 0, 0},
00715     {0, 0, 0, 0, 0},
00716     {0, 0, 0, 0, 0},
00717     {0, 0, 0, 0, 0},
00718     {0, 0, 0, 0, 0},
00719     {0, 0, 0, 0, 0},
00720     {0, 0, 0, 0, 0},
00721     {0, 0, 0, 0, 0},
00722     {0, 0, 0, 0, 0},
00723     {0, 0, 0, 0, 0},
00724     {0, 0, 0, 0, 0},
00725     {0, 0, 0, 0, 0},
00726     {0, 0, 0, 0, 0},
00727     {0, 0, 0, 0, 0},
00728   };
00729 
00730   for( Int_t i=0; i<300; i++ ){
00731     for( Int_t j=0; j<5; j++ ){
00732       fShieldIndex[i][j] = tempShieldIndex[i][j];
00733     }
00734   }
00735 
00736   return;
00737 }

void AtNuShieldEventNtuple::OpenFile (  )  [private]

Definition at line 265 of file AtNuShieldEventNtuple.cxx.

References fAnyObserved, fDate, fDoubleMatched, fEnd, fExactMatched, fExpected, fFileName, fObserved, fPlane, fPlank, fRun, fSection, fShieldFile, fShieldTree, fSubSection, fWeek, fX, and fY.

Referenced by Run().

00266 {
00267   std::cout << " *** AtNuShieldEventNtuple::OpenFile() *** " << std::endl;
00268 
00269   if( !fShieldFile ){
00270     std::cout << " opening file: " << fFileName.Data() << std::endl;
00271     TDirectory* tmpd = gDirectory;
00272     fShieldFile = new TFile(fFileName.Data(),"recreate");
00273     fShieldTree = new TTree("shieldntuple","shield analysis ntuple");
00274     fShieldTree->SetDirectory(fShieldFile);
00275     fShieldTree->Branch("run",&fRun,"run/I");
00276     fShieldTree->Branch("date",&fDate,"date/I");
00277     fShieldTree->Branch("week",&fWeek,"week/I");
00278     fShieldTree->Branch("section",&fSection,"section/I");
00279     fShieldTree->Branch("subsection",&fSubSection,"subsection/I");
00280     fShieldTree->Branch("plane",&fPlane,"plane/I");
00281     fShieldTree->Branch("plank",&fPlank,"plank/I");
00282     fShieldTree->Branch("end",&fEnd,"end/I");
00283     fShieldTree->Branch("X",&fX,"X/D");
00284     fShieldTree->Branch("Y",&fY,"Y/D");
00285 
00286     fShieldTree->Branch("expected",&fExpected,"expected/D");
00287     fShieldTree->Branch("observed",&fObserved,"observed/D");
00288     fShieldTree->Branch("matched",&fAnyObserved,"matched/D");
00289     fShieldTree->Branch("exactmatched",&fExactMatched,"exactmatched/D");
00290     fShieldTree->Branch("doubleexactmatched",&fDoubleMatched,"doubleexactmatched/D");
00291 
00292     fShieldTree->SetAutoSave(100);
00293     gDirectory = tmpd;
00294   }
00295 }

void AtNuShieldEventNtuple::ResetData (  )  [private]

Definition at line 379 of file AtNuShieldEventNtuple.cxx.

References fAnyObservedHits, fDoubleMatchedHits, fExpectedHits, fMatchedHits, fObservedHits, fShieldX, and fShieldY.

Referenced by Run().

00380 {
00381   for( Int_t iplane=0; iplane<300; iplane++ ){
00382     for( Int_t iplank=0; iplank<5; iplank++ ){
00383       for( Int_t iend=0; iend<2; iend++ ){
00384         fExpectedHits[iplane][iplank][iend] = 0;
00385         fObservedHits[iplane][iplank][iend] = 0;
00386         fAnyObservedHits[iplane][iplank][iend] = 0;
00387         fMatchedHits[iplane][iplank][iend] = 0;
00388         fDoubleMatchedHits[iplane][iplank][iend] = 0; 
00389       }
00390     }
00391   }  
00392   
00393   for( Int_t iplane=0; iplane<300; iplane++ ){
00394     for( Int_t iplank=0; iplank<5; iplank++ ){
00395       fShieldX[iplane][iplank] = -999.9;
00396       fShieldY[iplane][iplank] = -999.9;
00397     }
00398   }
00399 }

void AtNuShieldEventNtuple::Run ( Int_t  entries = -1  ) 

Definition at line 69 of file AtNuShieldEventNtuple.cxx.

References CloseFile(), AtmosEvent::Date, fAnyObservedHits, fChain, fDate, fDoubleMatchedHits, fEvent, fExpectedHits, FillData(), AtNuShieldEvent::FillEvent(), fMatchedHits, fObservedHits, fRun, fSelection, fShieldEvent, fShieldX, fShieldY, fWeek, AtNuEventSelection::GetAtmosEventType(), AtNuEventSelection::GetEventType(), AtNuShieldEvent::GetExpectedPlank(), AtNuShieldEvent::GetExpectedPlankEntries(), AtNuShieldEvent::GetMatchedPlank(), AtNuShieldEvent::GetMatchedPlankEntries(), AtNuEventType::kGoodCosmic, AtNuEventType::kGoodEvent, AtNuEventType::kNothing, AtNuAtmosEventType::kNothing, OpenFile(), AtmosShieldPlank::Plane, AtmosShieldPlank::Plank, ResetData(), AtmosEvent::Run, AtmosShieldPlank::Section, AtmosShieldPlank::X, and AtmosShieldPlank::Y.

00070 {  
00071   std::cout << " *** AtNuShieldEventNtuple::Run(...) *** " << std::endl; 
00072 
00073   // sort data
00074   // =========
00075   Int_t run_entries = entries;
00076   if( run_entries<0 || run_entries>fChain->GetEntries() ){
00077     run_entries = fChain->GetEntries();
00078   }
00079 
00080   if( run_entries<=0 ){
00081     std::cout << " *** WARNING: NO DATA TO ANALYSE *** " << std::endl;
00082     return;
00083   }
00084 
00085   // open output file
00086   // ================
00087   this->OpenFile();
00088 
00089   // run over data
00090   // =============
00091   std::cout << "  running over " << run_entries << " events " << std::endl;
00092     
00093   fRun = -1;
00094   fDate = -1;
00095   fWeek = -1;
00096 
00097   for(Int_t i=0; i<run_entries; i++){
00098 
00099     fChain->GetEntry(i);
00100 
00101     Int_t thisRun = fEvent->Run;
00102     Int_t thisDate = fEvent->Date;
00103     Int_t thisWeek = thisDate/7;
00104 
00105     //
00106     // if( i%10000==0 ) std::cout << " " << i << "/" << run_entries << std::endl;
00107     //
00108 
00109     // check for new run/day/week
00110     // ==========================
00111     if( thisRun != fRun ){
00112       std::cout << "   Run " << thisRun << std::endl;
00113 
00114       if( fRun>=0 ){
00115         this->FillData();
00116         this->ResetData();
00117       }
00118 
00119       fRun = thisRun;
00120       fDate = thisDate;
00121       fWeek = thisWeek;
00122     }        
00123 
00124     // event classification
00125     // ====================
00126     Int_t eventtype = AtNuEventType::kNothing;
00127     Int_t atmoseventtype = AtNuAtmosEventType::kNothing;
00128    
00129     if( fSelection ){
00130       eventtype = fSelection->GetEventType(fEvent);
00131       atmoseventtype = fSelection->GetAtmosEventType(fEvent);
00132     }
00133 
00134     // select 'good' cosmic muons
00135     // ==========================
00136     if( (eventtype&AtNuEventType::kGoodEvent)==(AtNuEventType::kGoodEvent)
00137      && (eventtype&AtNuEventType::kGoodCosmic)==(AtNuEventType::kGoodCosmic) ){
00138 
00139 
00140       // analyse shield hits
00141       // ===================
00142       fShieldEvent->FillEvent(fEvent);
00143 
00144       Bool_t vetoN,vetoS;
00145       Int_t nObservedPlanks = fShieldEvent->GetMatchedPlankEntries();
00146       Int_t nExpectedPlanks = fShieldEvent->GetExpectedPlankEntries();
00147 
00148 
00149       // observed planks
00150       // ===============
00151       Int_t anyobserved = 0;
00152 
00153       for( Int_t nObs=0; nObs<nObservedPlanks; nObs++ ){
00154         AtmosShieldPlank* plankObs = fShieldEvent->GetMatchedPlank(nObs,vetoN,vetoS);
00155 
00156         if( plankObs->Plane>=500 && plankObs->Plane<800
00157          && plankObs->Plank>=0 && plankObs->Plank<=16 ){
00158 
00159           Int_t iplaneObs = plankObs->Plane-500;
00160           Int_t iplankObs = plankObs->Plank/4;
00161 
00162           if( vetoN ){
00163             fObservedHits[iplaneObs][iplankObs][0]++;
00164             anyobserved++;
00165           }
00166 
00167           if( vetoS ){
00168             fObservedHits[iplaneObs][iplankObs][1]++;
00169             anyobserved++;
00170           }
00171 
00172         }
00173       }
00174 
00175 
00176       // expected planks
00177       // ===============
00178       for( Int_t nExp=0; nExp<nExpectedPlanks; nExp++ ){
00179         AtmosShieldPlank* plankExp = fShieldEvent->GetExpectedPlank(nExp);
00180     
00181         if( plankExp->Plane>=500 && plankExp->Plane<800
00182          && plankExp->Plank>=0 && plankExp->Plank<=16 ){
00183 
00184           Int_t iplaneExp = plankExp->Plane-500;
00185           Int_t iplankExp = plankExp->Plank/4;
00186 
00187           fExpectedHits[iplaneExp][iplankExp][0]++;
00188           fExpectedHits[iplaneExp][iplankExp][1]++;
00189 
00190           if( anyobserved>0 ){
00191             fAnyObservedHits[iplaneExp][iplankExp][0]++;
00192             fAnyObservedHits[iplaneExp][iplankExp][1]++; 
00193           }
00194 
00195           fShieldX[iplaneExp][iplankExp] = plankExp->X;
00196           fShieldY[iplaneExp][iplankExp] = plankExp->Y;
00197         }
00198       }
00199 
00200 
00201       // matched planks
00202       // ==============
00203       for( Int_t nObs=0; nObs<nObservedPlanks; nObs++ ){
00204         AtmosShieldPlank* plankObs = fShieldEvent->GetMatchedPlank(nObs,vetoN,vetoS);
00205 
00206         if( plankObs->Plane>=500 && plankObs->Plane<800
00207          && plankObs->Plank>=0 && plankObs->Plank<=16 ){
00208 
00209           Int_t iplaneObs = plankObs->Plane-500;
00210           Int_t iplankObs = plankObs->Plank/4;
00211 
00212           Bool_t nearmatch = 0;
00213           Bool_t exactmatch = 0;
00214 
00215           for( Int_t nExp=0; nExp<nExpectedPlanks; nExp++ ){
00216             AtmosShieldPlank* plankExp = fShieldEvent->GetExpectedPlank(nExp);
00217         
00218             if( plankExp->Plane>=500 && plankExp->Plane<800
00219              && plankExp->Plank>=0 && plankExp->Plank<=16 ){
00220 
00221               Double_t dX = plankObs->X - plankExp->X;
00222               Double_t dY = plankObs->Y - plankExp->Y;
00223               Double_t dR2 = dX*dX + dY*dY;              
00224 
00225               if( plankObs->Section==plankExp->Section && dR2<0.14 ){
00226                 nearmatch = 1;
00227 
00228                 if( plankObs->Plane == plankExp->Plane
00229                  && plankObs->Plank == plankExp->Plank ){
00230                   exactmatch = 1;
00231                 }
00232 
00233               }
00234             }
00235           }
00236 
00237           if( exactmatch ){          
00238             if( vetoN ){
00239               fMatchedHits[iplaneObs][iplankObs][0]++;
00240               if( vetoS ) fDoubleMatchedHits[iplaneObs][iplankObs][0]++;
00241             }
00242             if( vetoS ){
00243               fMatchedHits[iplaneObs][iplankObs][1]++;
00244               if( vetoN ) fDoubleMatchedHits[iplaneObs][iplankObs][1]++;
00245             }
00246           }
00247      
00248         }
00249       }
00250 
00251     }
00252   }
00253 
00254   // write data to file
00255   // ==================
00256   this->FillData();
00257 
00258   // close output file
00259   // =================
00260   this->CloseFile();
00261 
00262   return;
00263 }

void AtNuShieldEventNtuple::SetFileName ( const char *  filename  )  [inline]

Definition at line 23 of file AtNuShieldEventNtuple.h.

References fFileName.

00023                                           {
00024       fFileName = filename;
00025     }


Member Data Documentation

Definition at line 55 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Int_t AtNuShieldEventNtuple::fAnyObservedHits[300][5][2] [private]

Definition at line 61 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), ResetData(), and Run().

TChain* AtNuShieldEventNtuple::fChain [private]

Definition at line 31 of file AtNuShieldEventNtuple.h.

Referenced by AddFile(), and Run().

Definition at line 42 of file AtNuShieldEventNtuple.h.

Referenced by OpenFile(), and Run().

Definition at line 57 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Int_t AtNuShieldEventNtuple::fDoubleMatchedHits[300][5][2] [private]

Definition at line 63 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), ResetData(), and Run().

Int_t AtNuShieldEventNtuple::fEnd [private]

Definition at line 48 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Definition at line 36 of file AtNuShieldEventNtuple.h.

Referenced by Run().

Definition at line 56 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Definition at line 53 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Int_t AtNuShieldEventNtuple::fExpectedHits[300][5][2] [private]

Definition at line 59 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), ResetData(), and Run().

Definition at line 70 of file AtNuShieldEventNtuple.h.

Referenced by OpenFile(), and SetFileName().

Int_t AtNuShieldEventNtuple::fMatchedHits[300][5][2] [private]

Definition at line 62 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), ResetData(), and Run().

Definition at line 54 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Int_t AtNuShieldEventNtuple::fObservedHits[300][5][2] [private]

Definition at line 60 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), ResetData(), and Run().

Definition at line 46 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Definition at line 47 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Int_t AtNuShieldEventNtuple::fRun [private]

Definition at line 41 of file AtNuShieldEventNtuple.h.

Referenced by OpenFile(), and Run().

Definition at line 44 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Definition at line 35 of file AtNuShieldEventNtuple.h.

Referenced by Run().

Definition at line 34 of file AtNuShieldEventNtuple.h.

Definition at line 33 of file AtNuShieldEventNtuple.h.

Referenced by Run(), and ~AtNuShieldEventNtuple().

Definition at line 38 of file AtNuShieldEventNtuple.h.

Referenced by CloseFile(), FillData(), and OpenFile().

Int_t AtNuShieldEventNtuple::fShieldIndex[300][5] [private]

Definition at line 68 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and LoadShieldGeometry().

Definition at line 39 of file AtNuShieldEventNtuple.h.

Referenced by CloseFile(), FillData(), and OpenFile().

Double_t AtNuShieldEventNtuple::fShieldX[300][5] [private]

Definition at line 65 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), ResetData(), and Run().

Double_t AtNuShieldEventNtuple::fShieldY[300][5] [private]

Definition at line 66 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), ResetData(), and Run().

Definition at line 45 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Definition at line 43 of file AtNuShieldEventNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuShieldEventNtuple::fX [private]

Definition at line 50 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().

Double_t AtNuShieldEventNtuple::fY [private]

Definition at line 51 of file AtNuShieldEventNtuple.h.

Referenced by FillData(), and OpenFile().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1