SpillInfo Class Reference

#include <SpillInfo.h>

List of all members.

Public Member Functions

 SpillInfo ()
 ~SpillInfo ()
void GetSpillInfo (int month, int year, double snarltime, SpillInfoBlock &spinfo)

Private Attributes

TFile * beamfile
TTree * beamt
Int_t beamsav
Bool_t first_beam
Double_t fTime
Double_t fPot
Double_t fHorn
Double_t fTgtpos
Double_t fHpos
Double_t fVpos
Double_t fMagnet

Detailed Description

Definition at line 10 of file SpillInfo.h.


Constructor & Destructor Documentation

SpillInfo::SpillInfo (  ) 

Definition at line 15 of file SpillInfo.cxx.

References beamsav, and first_beam.

00016 {
00017  beamsav=0;
00018  first_beam=true;
00019 }

SpillInfo::~SpillInfo (  ) 

Definition at line 22 of file SpillInfo.cxx.

00023 {
00024 //beamfile->Close();
00025 }


Member Function Documentation

void SpillInfo::GetSpillInfo ( int  month,
int  year,
double  snarltime,
SpillInfoBlock spinfo 
)

Definition at line 27 of file SpillInfo.cxx.

References beamfile, beamsav, beamt, fHorn, fHpos, first_beam, fMagnet, fPot, fTgtpos, fTime, fVpos, SpillInfoBlock::SetHorn(), SpillInfoBlock::SetHpos(), SpillInfoBlock::SetMagnet(), SpillInfoBlock::SetPot(), SpillInfoBlock::SetTgtpos(), SpillInfoBlock::SetTime(), SpillInfoBlock::SetVpos(), and SpillInfoBlock::Zero().

Referenced by MadDpAnalysis::CreatePAN(), MadTestAnalysis::CreatePAN(), and MadCluAnalysis::DataDistributions().

00028 {
00029   Bool_t found=false; 
00030   Int_t bentry=-1;
00031   Double_t diffmin=9999999.;
00032   spinfo.Zero();
00033   char myfile[256];
00034   char dir[265];
00035  
00036    char mon[256];
00037     if(month==1)  sprintf(mon,"january");  if(month==2)  sprintf(mon,"february"); if(month==3)   sprintf(mon,"march");
00038     if(month==4)  sprintf(mon,"april");    if(month==5)  sprintf(mon,"may");       if(month==6)   sprintf(mon,"june");
00039     if(month==7)  sprintf(mon,"july");     if(month==8)  sprintf(mon,"august");    if(month==9)   sprintf(mon,"september");
00040     if(month==10) sprintf(mon,"october");  if(month==11) sprintf(mon,"november");  if(month==12)  sprintf(mon,"december");
00041   
00042   Int_t myyear=year-2000;
00043   
00044   sprintf(dir,"/afs/fnal.gov/files/data/minos/d80/niki/BeamFiles");  
00045   sprintf(myfile,"%s/beam_ntuple_%s_0%d.root",dir,mon,myyear);
00046   
00047   if(first_beam) {
00048     beamfile = new TFile(myfile,"READ");
00049     beamt    = (TTree*)beamfile->Get("beamtree");
00050     beamt->SetBranchAddress("time",  &fTime);
00051     beamt->SetBranchAddress("pot",   &fPot);
00052     beamt->SetBranchAddress("horn",  &fHorn);
00053     beamt->SetBranchAddress("tgtpos",&fTgtpos);
00054     beamt->SetBranchAddress("hpos",  &fHpos);
00055     beamt->SetBranchAddress("vpos",  &fVpos);
00056     beamt->SetBranchAddress("magnet",&fMagnet);    
00057     first_beam      = false; 
00058   }
00059   Int_t ibeamlow  = beamsav-10;            
00060      
00061   if(ibeamlow<0)    ibeamlow  = 0;       
00062              
00063   Int_t endbeam = beamt->GetEntries();    
00064   
00065   for (int ibeam =ibeamlow; ibeam < endbeam; ibeam++ ) {
00066     beamt->GetEntry(ibeam);
00067     if(fTime>(snarltime+10.)) break;
00068     Double_t diff=fTime-snarltime;          
00069     if(fabs(diff)<diffmin){
00070       diffmin=fabs(diff);
00071       bentry=ibeam;
00072     }
00073    }    
00074     
00075     if(fabs(diffmin)<1.5){
00076       beamt->GetEntry(bentry);
00077       found=true;
00078       beamsav  = bentry; 
00079       spinfo.SetTime(fTime);
00080       spinfo.SetPot(fPot);
00081       spinfo.SetHorn(fHorn);
00082       spinfo.SetTgtpos(fTgtpos);
00083       spinfo.SetHpos(fHpos);
00084       spinfo.SetVpos(fVpos);
00085       spinfo.SetMagnet(fMagnet);        
00086      }  
00087  
00088    if(!found){
00089       Double_t fd=-999.;
00090       spinfo.SetTime(fd);
00091       spinfo.SetPot(fd); 
00092       spinfo.SetHorn(fd);
00093       spinfo.SetTgtpos(fd); 
00094       spinfo.SetHpos(fd);
00095       spinfo.SetVpos(fd);
00096       spinfo.SetMagnet(fd);       
00097    }
00098   return;
00099 }


Member Data Documentation

TFile* SpillInfo::beamfile [private]

Definition at line 14 of file SpillInfo.h.

Referenced by GetSpillInfo().

Int_t SpillInfo::beamsav [private]

Definition at line 16 of file SpillInfo.h.

Referenced by GetSpillInfo(), and SpillInfo().

TTree* SpillInfo::beamt [private]

Definition at line 15 of file SpillInfo.h.

Referenced by GetSpillInfo().

Double_t SpillInfo::fHorn [private]

Definition at line 21 of file SpillInfo.h.

Referenced by GetSpillInfo().

Double_t SpillInfo::fHpos [private]

Definition at line 23 of file SpillInfo.h.

Referenced by GetSpillInfo().

Bool_t SpillInfo::first_beam [private]

Definition at line 17 of file SpillInfo.h.

Referenced by GetSpillInfo(), and SpillInfo().

Double_t SpillInfo::fMagnet [private]

Definition at line 25 of file SpillInfo.h.

Referenced by GetSpillInfo().

Double_t SpillInfo::fPot [private]

Definition at line 20 of file SpillInfo.h.

Referenced by GetSpillInfo().

Double_t SpillInfo::fTgtpos [private]

Definition at line 22 of file SpillInfo.h.

Referenced by GetSpillInfo().

Double_t SpillInfo::fTime [private]

Definition at line 19 of file SpillInfo.h.

Referenced by GetSpillInfo().

Double_t SpillInfo::fVpos [private]

Definition at line 24 of file SpillInfo.h.

Referenced by GetSpillInfo().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1