AtNuDigitNtuple Class Reference

#include <AtNuDigitNtuple.h>

List of all members.

Public Member Functions

 AtNuDigitNtuple ()
 ~AtNuDigitNtuple ()
void Reset ()
void AddFile (const char *file)
void SetFileName (const char *file)
void OpenFile ()
void WriteToFile ()
void CloseFile ()
void Run ()

Private Attributes

TChain * fChain
TFile * fAtNuDigitFile
TTree * fAtNuDigitTree
TString fFileName
Int_t index
Int_t last
Int_t idnu
Int_t idact
Int_t idres
Double_t enu
Double_t emu
Double_t ehad
Int_t run
Int_t subrun
Int_t snarl
Int_t goodevent
Int_t fcpc
Int_t veto
Int_t spill
Int_t atmosnue
Int_t atmosnumu
Int_t atmosnumucv
Int_t atmosnumuup
Double_t trueemu
Double_t trueeshw
Double_t trueevis
Int_t plane
Int_t strip
Int_t end
Int_t view
Double_t T
Double_t L
Double_t Z
Int_t trk
Int_t shw
Int_t ndigits
Double_t traw
Double_t tcal
Double_t qadc
Double_t qpe
Double_t qpecorr
Double_t sigcorr
Double_t sigmap
Double_t sigmip
AtNuEventSelectionFactoryfSelectionFactory
AtNuEventSelectionfSelection
AtmosEventfEvent

Detailed Description

Definition at line 16 of file AtNuDigitNtuple.h.


Constructor & Destructor Documentation

AtNuDigitNtuple::AtNuDigitNtuple (  ) 

Definition at line 14 of file AtNuDigitNtuple.cxx.

00014                                  :
00015   fChain(0),
00016   fSelectionFactory(0),
00017   fSelection(0),
00018   fEvent(0)
00019 {
00020   this->Reset();
00021 }

AtNuDigitNtuple::~AtNuDigitNtuple (  ) 

Definition at line 23 of file AtNuDigitNtuple.cxx.

00024 {
00025 
00026 }


Member Function Documentation

void AtNuDigitNtuple::AddFile ( const char *  file  ) 

Definition at line 51 of file AtNuDigitNtuple.cxx.

References fChain.

00052 {
00053   std::cout << " adding files from: " << file << std::endl;
00054 
00055   fChain->Add(file);
00056 
00057   std::cout << "   ... total entries=" << fChain->GetEntries() << std::endl;
00058 
00059   return;
00060 }

void AtNuDigitNtuple::CloseFile (  ) 

Definition at line 128 of file AtNuDigitNtuple.cxx.

References fAtNuDigitFile, and fAtNuDigitTree.

Referenced by Run().

00129 {
00130   if( fAtNuDigitFile ){
00131     std::cout << " closing file: " << fAtNuDigitFile->GetName() << std::endl;
00132     TDirectory* tmpd = gDirectory;
00133     fAtNuDigitFile->cd();
00134     fAtNuDigitTree->Write();
00135     fAtNuDigitFile->Close();
00136     gDirectory = tmpd;
00137   }
00138 }

void AtNuDigitNtuple::OpenFile (  ) 

Definition at line 71 of file AtNuDigitNtuple.cxx.

References atmosnue, atmosnumu, atmosnumucv, atmosnumuup, ehad, emu, end, enu, fAtNuDigitFile, fAtNuDigitTree, fcpc, fFileName, goodevent, idact, idnu, idres, index, L, last, ndigits, plane, qadc, qpe, qpecorr, run, shw, sigcorr, sigmap, sigmip, snarl, spill, strip, subrun, T, tcal, traw, trk, trueemu, trueeshw, trueevis, veto, view, and Z.

Referenced by Run().

00072 {
00073   if( !fAtNuDigitFile ){
00074     std::cout << " opening file: " << fFileName.Data() << std::endl;
00075     TDirectory* tmpd = gDirectory;
00076     fAtNuDigitFile = new TFile(fFileName.Data(),"recreate");
00077     fAtNuDigitTree = new TTree("ntuple","minos monitor ntuple");
00078     fAtNuDigitTree->SetDirectory(fAtNuDigitFile);
00079 
00080     fAtNuDigitTree->Branch("index",&index,"index/I");
00081     fAtNuDigitTree->Branch("last",&last,"last/I");
00082     fAtNuDigitTree->Branch("run",&run,"run/I");
00083     fAtNuDigitTree->Branch("subrun",&subrun,"subrun/I");
00084     fAtNuDigitTree->Branch("snarl",&snarl,"snarl/I");
00085 
00086     fAtNuDigitTree->Branch("mc.inu",&idnu,"idnu/I");
00087     fAtNuDigitTree->Branch("mc.iact",&idact,"idact/I");
00088     fAtNuDigitTree->Branch("mc.ires",&idres,"idres/I");
00089     fAtNuDigitTree->Branch("mc.enu",&enu,"enu/D");
00090     fAtNuDigitTree->Branch("mc.emu",&emu,"emu/D");
00091     fAtNuDigitTree->Branch("mc.ehad",&ehad,"ehad/D");
00092     fAtNuDigitTree->Branch("evt.goodevent",&goodevent,"goodevent/I");
00093     fAtNuDigitTree->Branch("evt.fcpc",&fcpc,"fcpc/I");
00094     fAtNuDigitTree->Branch("evt.veto",&veto,"veto/I");
00095     fAtNuDigitTree->Branch("evt.spill",&spill,"spill/I");
00096     fAtNuDigitTree->Branch("evt.atmosnue",&atmosnue,"atmosnue/I");
00097     fAtNuDigitTree->Branch("evt.atmosnumu",&atmosnumu,"atmosnumu/I");
00098     fAtNuDigitTree->Branch("evt.atmosnumucv",&atmosnumucv,"atmosnumucv/I");
00099     fAtNuDigitTree->Branch("evt.atmosnumuup",&atmosnumuup,"atmosnumuup/I");
00100     fAtNuDigitTree->Branch("evt.trueemu",&trueemu,"trueemu/D");
00101     fAtNuDigitTree->Branch("evt.trueeshw",&trueeshw,"trueeshw/D");
00102     fAtNuDigitTree->Branch("evt.trueevis",&trueevis,"trueevis/D");
00103 
00104     fAtNuDigitTree->Branch("stp.plane",&plane,"plane/I");
00105     fAtNuDigitTree->Branch("stp.strip",&strip,"strip/I");
00106     fAtNuDigitTree->Branch("stp.end",&end,"end/I");
00107     fAtNuDigitTree->Branch("stp.view",&view,"view/I");
00108     fAtNuDigitTree->Branch("stp.T",&T,"T/D");
00109     fAtNuDigitTree->Branch("stp.L",&L,"L/D");
00110     fAtNuDigitTree->Branch("stp.Z",&Z,"Z/D");
00111     fAtNuDigitTree->Branch("stp.trk",&trk,"trk/I");
00112     fAtNuDigitTree->Branch("stp.shw",&shw,"shw/I");
00113     fAtNuDigitTree->Branch("stp.ndigits",&ndigits,"ndigits/I");
00114     fAtNuDigitTree->Branch("stp.traw",&traw,"traw/D");
00115     fAtNuDigitTree->Branch("stp.tcal",&tcal,"tcal/D");
00116     fAtNuDigitTree->Branch("stp.qadc",&qadc,"qadc/D");
00117     fAtNuDigitTree->Branch("stp.qpe",&qpe,"qpe/D");
00118     fAtNuDigitTree->Branch("stp.qpecorr",&qpecorr,"qpecorr/D");
00119     fAtNuDigitTree->Branch("stp.sigcorr",&sigcorr,"sigcorr/D");
00120     fAtNuDigitTree->Branch("stp.sigmap",&sigmap,"sigmap/D");
00121     fAtNuDigitTree->Branch("stp.sigmip",&sigmip,"sigmip/D");
00122 
00123     fAtNuDigitTree->SetAutoSave(100);
00124     gDirectory = tmpd;
00125   }
00126 }

void AtNuDigitNtuple::Reset (  ) 

Definition at line 28 of file AtNuDigitNtuple.cxx.

References fAtNuDigitFile, fAtNuDigitTree, fChain, fEvent, fFileName, fSelection, fSelectionFactory, and AtNuEventSelectionFactory::MakeEventSelection().

00029 {
00030   if( !fChain ){
00031     fChain = new TChain("ntp","chain");
00032   }
00033 
00034   if( !fSelectionFactory ){
00035     fSelectionFactory = new AtNuEventSelectionFactory();
00036     fSelection = fSelectionFactory->MakeEventSelection();
00037   }
00038 
00039 
00040   fChain->Reset();
00041   fChain->SetBranchAddress("evt",&fEvent);
00042  
00043   fAtNuDigitFile = 0;
00044   fAtNuDigitTree = 0;
00045 
00046   fFileName = "ntpdigits.root";
00047 
00048   return;
00049 }

void AtNuDigitNtuple::Run (  ) 

Definition at line 150 of file AtNuDigitNtuple.cxx.

References atmosnue, atmosnumu, atmosnumucv, atmosnumuup, CloseFile(), AtmosMC::Ehad, ehad, AtmosMC::Emu, emu, end, AtmosMC::Enu, enu, fChain, fcpc, fEvent, fSelection, AtNuEventSelection::GetEventType(), goodevent, AtmosMC::IDact, idact, AtmosMC::IDnu, idnu, idres, AtmosMC::IDres, index, AtNuEventType::kAtmosNue, AtNuEventType::kAtmosNumu, AtNuEventType::kAtmosNumuCV, AtNuEventType::kAtmosNumuUP, AtNuEventType::kFC, AtNuEventType::kGoodEvent, AtNuEventType::kPC, AtNuEventType::kSpill, AtNuEventType::kVeto, AtmosStrip::L, L, last, AtmosEvent::MCInfo, AtmosStrip::MIP, ndigits, AtmosStrip::Ndigits, OpenFile(), AtmosStrip::Plane, plane, qadc, AtmosStrip::Qadc, AtmosStrip::QPE, qpe, qpecorr, AtmosStrip::QPEcorr, run, AtmosEvent::Run, shw, AtmosStrip::Shw, AtmosStrip::Sigcorr, sigcorr, sigmap, AtmosStrip::Sigmap, sigmip, snarl, AtmosEvent::Snarl, spill, AtmosStrip::Strip, strip, AtmosEvent::StripList, subrun, AtmosEvent::SubRun, AtmosStrip::T, T, tcal, AtmosStrip::Tcal, traw, AtmosStrip::Traw, AtmosStrip::Trk, trk, trueemu, trueeshw, trueevis, veto, AtmosStrip::View, view, WriteToFile(), AtmosStrip::Z, and Z.

00151 {
00152   std::cout << " *** AtNuDigitNtuple::Run() *** " << std::endl;
00153 
00154   // open file
00155   this->OpenFile();
00156 
00157   // loop over events
00158   run = -1;
00159   subrun = -1;
00160 
00161   for( Int_t i=0; i<fChain->GetEntries(); i++ ){
00162     fChain->GetEntry(i);
00163 
00164     if( !(fEvent->Run==run 
00165        && fEvent->SubRun==subrun) ){
00166       run = fEvent->Run; 
00167       subrun = fEvent->SubRun;
00168       std::cout << "  Run: " << run << "/" << subrun << std::endl;
00169     }
00170 
00171     // Data
00172     // ====
00173     snarl = fEvent->Snarl;
00174 
00175     // Monte Carlo
00176     // ===========
00177     idnu  = fEvent->MCInfo.IDnu;
00178     idact = fEvent->MCInfo.IDact;
00179     idres = fEvent->MCInfo.IDres;
00180 
00181     enu   = fEvent->MCInfo.Enu;
00182     emu   = fEvent->MCInfo.Emu;
00183     ehad  = fEvent->MCInfo.Ehad;
00184 
00185     trueemu  = 0.0;
00186     trueeshw = 0.0;
00187     trueevis = 0.0;
00188 
00189     // true kinematics
00190     // ===============
00191     if( idnu!=0 ){
00192       if( idact==1 ){
00193         if( fabs(idnu)==14 ){  // numu CC
00194           trueemu = fabs(emu);
00195           trueeshw = enu - fabs(emu);
00196           trueevis = enu;
00197         }
00198         else{  // nue CC or nutau CC
00199           trueemu = 0.0;
00200           trueeshw = enu;
00201           trueevis = enu;
00202         }
00203       }
00204       else{  // NC
00205         trueemu = 0.0;
00206         trueeshw = ehad;
00207         trueevis = ehad;
00208       }
00209     }
00210 
00211     // event selection
00212     // ===============
00213     Int_t eventtype = fSelection->GetEventType(fEvent);
00214     
00215     goodevent = 0;
00216     veto = 0;
00217     spill = 0;
00218     fcpc = 0;
00219     atmosnue = 0;
00220     atmosnumu = 0;
00221     atmosnumucv = 0;
00222     atmosnumuup = 0;
00223 
00224     if(eventtype&AtNuEventType::kGoodEvent) goodevent = 1; 
00225     if(eventtype&AtNuEventType::kVeto) veto = 1;
00226     if(eventtype&AtNuEventType::kSpill) spill = 1;
00227 
00228     if( (eventtype&AtNuEventType::kFC)
00229      || (eventtype&AtNuEventType::kPC) ) fcpc = 1; 
00230     if(eventtype&AtNuEventType::kAtmosNue) atmosnue = 1;   
00231     if(eventtype&AtNuEventType::kAtmosNumu) atmosnumu = 1;
00232     if(eventtype&AtNuEventType::kAtmosNumuCV) atmosnumucv = 1;
00233     if(eventtype&AtNuEventType::kAtmosNumuUP) atmosnumuup = 1;
00234 
00235     // analyse strips
00236     // ===============
00237     TClonesArray* myStripList = (TClonesArray*)(fEvent->StripList);
00238 
00239     for( Int_t j=0; j<1+myStripList->GetLast(); j++ ){
00240       AtmosStrip* myStrip = (AtmosStrip*)(myStripList->At(j));
00241 
00242       index   = j;
00243       last    = myStripList->GetLast();
00244 
00245       plane   = myStrip->Plane;
00246       strip   = myStrip->Strip;
00247       
00248       view    = myStrip->View;
00249       T       = myStrip->T;
00250       L       = myStrip->L;
00251       Z       = myStrip->Z;
00252       trk     = myStrip->Trk;
00253       shw     = myStrip->Shw;
00254       ndigits = myStrip->Ndigits;
00255 
00256       end     = 0;
00257       traw    = myStrip->Traw[0];
00258       tcal    = myStrip->Tcal[0];
00259       qadc    = myStrip->Qadc[0];
00260       qpe     = myStrip->QPE[0];
00261       qpecorr = myStrip->QPEcorr[0];
00262       sigcorr = myStrip->Sigcorr[0];
00263       sigmap  = myStrip->Sigmap[0];
00264       sigmip  = myStrip->MIP[0];
00265 
00266       this->WriteToFile();
00267 
00268       end     = 1;
00269       traw    = myStrip->Traw[1];
00270       tcal    = myStrip->Tcal[1];
00271       qadc    = myStrip->Qadc[1];
00272       qpe     = myStrip->QPE[1];
00273       qpecorr = myStrip->QPEcorr[1];
00274       sigcorr = myStrip->Sigcorr[1];
00275       sigmap  = myStrip->Sigmap[1];
00276       sigmip  = myStrip->MIP[1];
00277 
00278       this->WriteToFile();
00279     }
00280   }
00281 
00282   // close file
00283   this->CloseFile();
00284 
00285   return;
00286 }

void AtNuDigitNtuple::SetFileName ( const char *  file  ) 

Definition at line 62 of file AtNuDigitNtuple.cxx.

References fFileName.

00063 {
00064   std::cout << " *** AtNuDigitNtuple::SetFileName(...) *** " << std::endl;
00065 
00066   fFileName = file;
00067 
00068   std::cout << "   output file = " << fFileName.Data() << std::endl;
00069 }

void AtNuDigitNtuple::WriteToFile (  ) 

Definition at line 140 of file AtNuDigitNtuple.cxx.

References fAtNuDigitFile, and fAtNuDigitTree.

Referenced by Run().

00141 {
00142   if( fAtNuDigitFile ){
00143     TDirectory* tmpd = gDirectory;
00144     fAtNuDigitFile->cd();
00145     fAtNuDigitTree->Fill();
00146     gDirectory = tmpd;
00147   }
00148 }


Member Data Documentation

Int_t AtNuDigitNtuple::atmosnue [private]

Definition at line 59 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::atmosnumu [private]

Definition at line 60 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Definition at line 61 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Definition at line 62 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::ehad [private]

Definition at line 49 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::emu [private]

Definition at line 48 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::end [private]

Definition at line 70 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::enu [private]

Definition at line 47 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Definition at line 36 of file AtNuDigitNtuple.h.

Referenced by CloseFile(), OpenFile(), Reset(), and WriteToFile().

Definition at line 37 of file AtNuDigitNtuple.h.

Referenced by CloseFile(), OpenFile(), Reset(), and WriteToFile().

TChain* AtNuDigitNtuple::fChain [private]

Definition at line 34 of file AtNuDigitNtuple.h.

Referenced by AddFile(), Reset(), and Run().

Int_t AtNuDigitNtuple::fcpc [private]

Definition at line 56 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Definition at line 91 of file AtNuDigitNtuple.h.

Referenced by Reset(), and Run().

TString AtNuDigitNtuple::fFileName [private]

Definition at line 38 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), Reset(), and SetFileName().

Definition at line 89 of file AtNuDigitNtuple.h.

Referenced by Reset(), and Run().

Definition at line 88 of file AtNuDigitNtuple.h.

Referenced by Reset().

Int_t AtNuDigitNtuple::goodevent [private]

Definition at line 55 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::idact [private]

Definition at line 44 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::idnu [private]

Definition at line 43 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::idres [private]

Definition at line 45 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::index [private]

Definition at line 40 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::L [private]

Definition at line 73 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::last [private]

Definition at line 41 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::ndigits [private]

Definition at line 77 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::plane [private]

Definition at line 68 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::qadc [private]

Definition at line 81 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::qpe [private]

Definition at line 82 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::qpecorr [private]

Definition at line 83 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::run [private]

Definition at line 51 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::shw [private]

Definition at line 76 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::sigcorr [private]

Definition at line 84 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::sigmap [private]

Definition at line 85 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::sigmip [private]

Definition at line 86 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::snarl [private]

Definition at line 53 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::spill [private]

Definition at line 58 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::strip [private]

Definition at line 69 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::subrun [private]

Definition at line 52 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::T [private]

Definition at line 72 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::tcal [private]

Definition at line 80 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::traw [private]

Definition at line 79 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::trk [private]

Definition at line 75 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::trueemu [private]

Definition at line 64 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::trueeshw [private]

Definition at line 65 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::trueevis [private]

Definition at line 66 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::veto [private]

Definition at line 57 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Int_t AtNuDigitNtuple::view [private]

Definition at line 71 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().

Double_t AtNuDigitNtuple::Z [private]

Definition at line 74 of file AtNuDigitNtuple.h.

Referenced by OpenFile(), and Run().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1