ScanList Class Reference

#include <ScanList.h>

List of all members.

Public Member Functions

 ScanList ()
 ~ScanList ()
Int_t GetDecision (Int_t run, Int_t snarl)
Bool_t GetStatus ()

Private Attributes

Int_t frun
Int_t fsnarl
Int_t fscandecision
TFile * ffile
TTree * ftree
Bool_t fstatus

Detailed Description

Definition at line 6 of file ScanList.h.


Constructor & Destructor Documentation

ScanList::ScanList (  ) 

Definition at line 22 of file ScanList.cxx.

References ffile, frun, fscandecision, fsnarl, fstatus, and ftree.

00022                    {
00023 
00024   fstatus=true;
00025 
00026   const char* file=getenv("SCAN_LIST");
00027 
00028   FILE *fin;
00029 
00030   if (file==NULL) {
00031     fstatus=false;
00032     cout << "No SCAN_LIST symlink defined - won't fill scan decisions\n";
00033   }
00034   
00035   if (fstatus) {
00036     
00037     if ((fin = fopen(file, "r")) == NULL) {
00038       fstatus=false;
00039       cout << "Scan list file not found - won't fill scan decisions\n";
00040     }
00041   }
00042 
00043   if (fstatus) {
00044     ffile=new TFile(file,"READ");
00045     if (!ffile) {
00046       fstatus=false;
00047       cout << "Can't read scan list file - won't fill scan decisions\n";
00048     }
00049   }
00050 
00051   if (fstatus) {
00052     ftree=(TTree*)ffile->Get("scan");
00053     if (!ftree) {
00054       fstatus=false;
00055       cout << "Can't find scan list tree - won't fill scan decisions\n";
00056     }    
00057     else {
00058       ftree->SetBranchAddress("run",&frun);
00059       ftree->SetBranchAddress("snarl",&fsnarl);
00060       ftree->SetBranchAddress("scandecision",&fscandecision);
00061       fstatus=true;
00062     }
00063   }
00064 
00065 }

ScanList::~ScanList (  ) 

Definition at line 67 of file ScanList.cxx.

References ffile, and fstatus.

00067                     {
00068   if (ffile && fstatus) {ffile->Close();}
00069 }


Member Function Documentation

Int_t ScanList::GetDecision ( Int_t  run,
Int_t  snarl 
)

Definition at line 71 of file ScanList.cxx.

References frun, fscandecision, fsnarl, fstatus, and ftree.

Referenced by MadDpAnalysis::CreatePAN(), MadTestAnalysis::CreatePAN(), and MadPIDAnalysis::CreatePAN().

00071                                                   {
00072 
00073 
00074   if (!fstatus) {return -1;}
00075 
00076   Int_t numentries=ftree->GetEntries();
00077 
00078   Bool_t isfound=false;
00079 
00080   Int_t counter=0;
00081 
00082   Int_t decision=-1;
00083 
00084   while (!isfound && counter<numentries) {
00085     
00086     ftree->GetEntry(counter);
00087  
00088     if (run==frun && snarl==fsnarl) {
00089       decision=fscandecision;
00090       isfound=true;
00091     }
00092 
00093     counter++;
00094 
00095   }
00096 
00097   return decision;
00098 
00099 }

Bool_t ScanList::GetStatus (  )  [inline]

Definition at line 14 of file ScanList.h.

References fstatus.

00014 {return fstatus;}


Member Data Documentation

TFile* ScanList::ffile [private]

Definition at line 21 of file ScanList.h.

Referenced by ScanList(), and ~ScanList().

Int_t ScanList::frun [private]

Definition at line 18 of file ScanList.h.

Referenced by GetDecision(), and ScanList().

Int_t ScanList::fscandecision [private]

Definition at line 20 of file ScanList.h.

Referenced by GetDecision(), and ScanList().

Int_t ScanList::fsnarl [private]

Definition at line 19 of file ScanList.h.

Referenced by GetDecision(), and ScanList().

Bool_t ScanList::fstatus [private]

Definition at line 24 of file ScanList.h.

Referenced by GetDecision(), GetStatus(), ScanList(), and ~ScanList().

TTree* ScanList::ftree [private]

Definition at line 22 of file ScanList.h.

Referenced by GetDecision(), and ScanList().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1