Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Level1.cxx

Go to the documentation of this file.
00001 // Level1.cxx: implementation of the Level1 class.
00002 //
00003 // Author: T. Burnett, tburnett@u.washington.edu
00004 // $Id: Level1.cxx,v 1.2 2001/10/19 20:48:59 ritz Exp $
00006 
00007 #include "Level1.h"
00008 
00009 #include <iostream>
00010 #include <iomanip>
00011 
00012 using namespace std;
00013 
00014 Level1::Level1(const Tuple&t , bool useACD)
00015 : Analyze(t, "Trig_Bits", useACD? "L1T w ACD": " Level 1")
00016 , m_useACD(useACD)
00017 {
00018     clear();
00019 }
00020 
00021 
00022 bool Level1::apply () 
00023 {
00024     int bits = static_cast<unsigned>(item());
00025     m_counts[bits] = m_counts[bits]+1;
00026 
00027 // modified 18 Oct S. Ritz to use updated Trig_Bits definition
00028     int trigger =  bits & (4|8|16);
00029     if( trigger & 4) m_track++;
00030     if( trigger & 8) m_cal++;
00031     if( trigger & 16) m_hi_cal++;
00032     if( (trigger &(4|8))==(4|8)) m_both++;
00033     if( !m_useACD) return (trigger!=0);
00034 
00035     // basic ACD
00036      return ((bits & 16)!=0 )  // always if HICAL
00037        || (bits &(4+8))!=0  // track or low cal
00038           && (bits&(2+16))==0;   // but not if nACD>2 or ACD track veto
00039 } 
00040 
00041 void Level1::report(ostream& out)
00042 {
00043     out << endl << name();
00044     out << endl << "\t track: " << setw(8) << m_track;
00045     out << endl << "\t   cal: " << setw(8) << m_cal;
00046     out << endl << "\thi cal: " << setw(8) << m_hi_cal;
00047     out << endl << "\t  both: " << setw(8) << m_both;
00048     out << endl << " bit frequency table";
00049     out << endl << setw(6) << "value"<< setw(6) << "count" ;
00050     int j, grand_total=0;
00051     for(j=0; j<7; ++j) out << setw(6) << (1<<j);
00052     out << endl << setw(6) <<" "<< setw(6) << "------"; 
00053     for( j=0; j<7; ++j) out << setw(6) << "-----";
00054     vector<int>total(7);
00055     for( map<int,int>::const_iterator it = m_counts.begin(); it != m_counts.end(); ++it){
00056         int i = (*it).first, n = (*it).second;
00057         grand_total += n;
00058         out << endl << setw(6)<< i << setw(6)<< n ;
00059         for(j=0; j<7; ++j){
00060             int m = ((i&(1<<j))!=0)? n :0;
00061             total[j] += m;
00062             out << setw(6) << m ;
00063         }
00064     }
00065     out << endl << setw(6) <<" "<< setw(6) << "------"; 
00066     for( j=0; j<7; ++j) out << setw(6) << "-----";
00067     out << endl << setw(6) << "tot:" << setw(6)<< grand_total;
00068     for( j=0; j<7; ++j) out << setw(6) << total[j];
00069 
00070     Analyze::report(out);
00071     separator(out);
00072     
00073 }

Generated at Wed Nov 21 12:20:39 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000