Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

ChipTrackingTrgEngine3 - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: ChipTrackingTrgEngine3.cc,v 1.11 2005/10/24 09:06:42 pesce Exp $
// R. Pesce created

//_____________________________________________________________________________
//  
//  Chip Tracking Trigger Engine 3
//  ==============================
//
//  Tracking trigger built in front end chip.
//  The algorithm searches for sequences of pixels (over the threshold)
//  consequtive and adjacent. If the track length is over a threshold,
//  trigger occurs.
//  The algorithm searches also between track segments of two nearby chips:
//  if two track segments are consequtive in time and the total length is
//  over a threshold (different from the previous one), trigger occurs
//
//  Parameters:
//
//  fThresholdType: specify if the threshold on pixel hits in a gtu is absolute
//                  or relative
//  Valid options:
//    - absolute: the value specified in fThreshold is the minimum number of hits
//                in a gtu to consider
//    - relative: trigger threshold depends by the mean value of the background
//                hits (B) in each pixel:
//           threshold = (B) + fThreshold*sqrt(B)
//  fThreshold: threshold on pixel hits in a gtu; if fThresholdType=relative the
//              true threshold used by trigger algorithm depends by the mean hits
//              of background in each pixel (see above)
//  fMinTrackLenght: min length of the valid tracks
//  fMaxTrackLength: max length of the valid tracks
//  fMinTriggerTrackLength: min track length to have a trigger (single chip)
//  fMinTriggerTwoLength: min total track length in 2 nearby chips
//  fMaxTwoLength: max track length allowed in 2 nearby chips
//
//  fAcceptHole [bool] : an hole in a single track segment is or not accepted
//  fOnlyWithSignal [bool] : processes or not only chips ith at least a signal
//
//  Special multiple configuration:
//  The alorithm counts the numebr of tracks of the various trigger lengths,
//  fill a specific trigger word and dump the numbers of the recognized tracks
//


#include "ChipTrackingTrgEngine3.hh"
#include "MacroCellData.hh"
#include "MacroCell.hh"
#include "ElementaryCell.hh"
#include "FrontEndChip.hh"
#include "BoolAlgebra.hh"
#include "ChipTrackSegment.hh"
#include "EusoElectronics.hh"
#include "Photomultiplier.hh"
#include "EusoDetector.hh"
#include "TMath.h"
#include "EChipTrackTriggerDataAdder.hh"
#include "Config.hh"

ClassImp(ChipTrackingTrgEngine3)

//______________________________________________________________________________
 ChipTrackingTrgEngine3::ChipTrackingTrgEngine3() : 
ChipTrackingTrgEngine1(string("ChipTrackingTrgEngine3"), kChipTrackingTrigger3 ) {
    //
    // Constructor
    //

    fMinTrackLength = (Int_t)Conf()->GetNum("ChipTrackingTrgEngine3.fMinTrackLength");
    fMaxTrackLength = (Int_t)Conf()->GetNum("ChipTrackingTrgEngine3.fMaxTrackLength");
    fMinTriggerTrackLength = (Int_t)Conf()->GetNum("ChipTrackingTrgEngine3.fMinTriggerTrackLength");
    fMinTriggerTwoLength = (Int_t)Conf()->GetNum("ChipTrackingTrgEngine3.fMinTriggerTwoLength");
    fMaxTwoLength = (Int_t)Conf()->GetNum("ChipTrackingTrgEngine3.fMaxTwoLength");
 
    if ( Conf()->GetStr("ChipTrackingTrgEngine3.fThresholdType")=="absolute" ) fRelativeThreshold = kFALSE;
    else if ( Conf()->GetStr("ChipTrackingTrgEngine3.fThresholdType")=="relative" ) fRelativeThreshold = kTRUE;
    else Msg(EsafMsg::Panic) << "Wrong cfg value fThresholdType" << MsgDispatch;
    fAcceptHole = Conf()->GetBool("ChipTrackingTrgEngine3.fAcceptHole");
    fOnlyWithSignal = Conf()->GetBool("ChipTrackingTrgEngine3.fOnlyWithSignal");
    fThreshold = (Int_t)Conf()->GetNum("ChipTrackingTrgEngine3.fThreshold");

    // panic if we want to simulate >32 trigger patterns
    if ( ((fMaxTrackLength-fMinTriggerTrackLength+1)+(fMaxTwoLength-fMinTriggerTwoLength+1)) > 32  )
        Msg(EsafMsg::Panic) << "Request for > 32 patterns of trigger." << MsgDispatch;

    ConfigFileParser *pConfig = Config::Get()->GetCF("Electronics","MacroCell");
    if ( !pConfig->GetBool("MacroCell.fSaveAllChipGtuData") )
        Msg(EsafMsg::Warning) << "MacroCell.fSaveAllChipGtuData is not enabled. Some infos are missing" << MsgDispatch;

    FillRunPars();
    Clear();
}


//______________________________________________________________________________
 ChipTrackingTrgEngine3::~ChipTrackingTrgEngine3() {
    //
    // Destructor
    //
}

About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update Wed Nov 16 16:57:39 2005 Wed Nov 16 16:29:22 2005