/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
DMCIBDSelectAlg Class Reference

#include <DMCIBDSelectAlg.h>

Inheritance diagram for DMCIBDSelectAlg:
Inheritance graph
[legend]
Collaboration diagram for DMCIBDSelectAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DMCIBDSelectAlg (const std::string &name)
virtual ~DMCIBDSelectAlg ()
virtual bool initialize ()
virtual bool execute ()
virtual bool finalize ()
const std::string & name ()
SvcBaseservice (const std::string &name)
TOutputSvcntupleSvc ()
bool setOption (const std::string &option, Type &var)

Protected Attributes

std::string m_name

Private Member Functions

bool fillIbd (const std::vector< PhyEvent * > &evtGroup)

Private Attributes

PhyEventBufm_buffer
TTree * m_tree
double m_tep
double m_txp
double m_typ
double m_tzp
double m_ten
double m_txn
double m_tyn
double m_tzn
double m_tdt
int m_tdet
int m_tpfile
int m_tpentry
int m_tnfile
int m_tnentry
int m_tptrignum
int m_tntrignum
int m_tn
std::vector< PhyEvent * > m_adBuf [4]
double m_eplow
double m_ephigh
double m_edlow
double m_edhigh
double m_dtlow
double m_dthigh

Detailed Description

Definition at line 11 of file DMCIBDSelectAlg.h.


Constructor & Destructor Documentation

DMCIBDSelectAlg::DMCIBDSelectAlg ( const std::string &  name)

Definition at line 14 of file DMCIBDSelectAlg.cc.

: AlgBase(name)
{
  setOption("PromptEngLow",m_eplow);  
  setOption("PromptEngHigh",m_ephigh);  
  setOption("DelayedEngLow",m_edlow);  
  setOption("DelayedEngHigh",m_edhigh);  
  setOption("DtLow",m_dtlow);  
  setOption("DtHigh",m_dthigh);  

  for(int det=1;det<=GlobalVar::NumADs;det++) {
    m_adBuf[det-1].clear();    
  }
}
virtual DMCIBDSelectAlg::~DMCIBDSelectAlg ( ) [inline, virtual]

Definition at line 15 of file DMCIBDSelectAlg.h.

{}

Member Function Documentation

bool DMCIBDSelectAlg::initialize ( ) [virtual]

Implements AlgBase.

Definition at line 29 of file DMCIBDSelectAlg.cc.

{
  m_buffer = dynamic_cast<PhyEventBuf*>(service("Cycler"));

  m_tree = new TTree("dmc","dmc");
  m_tree->Branch("ep",&m_tep,"ep/D");
  m_tree->Branch("xp",&m_txp,"xp/D");
  m_tree->Branch("yp",&m_typ,"yp/D");
  m_tree->Branch("zp",&m_tzp,"zp/D");
  m_tree->Branch("en",&m_ten,"en/D");
  m_tree->Branch("xn",&m_txn,"xn/D");
  m_tree->Branch("yn",&m_tyn,"yn/D");
  m_tree->Branch("zn",&m_tzn,"zn/D");
  m_tree->Branch("dt",&m_tdt,"dt/D");
  m_tree->Branch("det",&m_tdet,"det/I");
  m_tree->Branch("pfile",&m_tpfile,"pfile/I");
  m_tree->Branch("pentry",&m_tpentry,"pentry/I");
  m_tree->Branch("nfile",&m_tnfile,"nfile/I");
  m_tree->Branch("nentry",&m_tnentry,"nentry/I");
  m_tree->Branch("ptrignum",&m_tptrignum,"ptrignum/I");
  m_tree->Branch("ntrignum",&m_tntrignum,"ntrignum/I");
  m_tree->Branch("tn",&m_tn,"tn/I");
  ntupleSvc()->attach("FILE1/hem/tree/",m_tree);

  return true;
}
bool DMCIBDSelectAlg::execute ( ) [virtual]

Implements AlgBase.

Definition at line 61 of file DMCIBDSelectAlg.cc.

{

  // Get current event
  PhyEvent *event = m_buffer->curEvt();
  //event->print();

  LogDebug << "------entry=" << event->m_entry
    << ", fileNum=" << event->m_fileNum
    << ", local entry=" << event->m_localEntry
    << ", trigNum=" << event->m_trigNum
    << ", trigtime=" << event->m_trigTime
    << ", det=" << event->m_det 
    << ", energy=" << event->energy()
    << ", flasherTag=" << event->m_flasherTag 
    << ", 2inchFlasherTag=" << event->m_2inchFlasherTag
    << ", forceTrigTag=" << event->m_forceTrigTag
    << ", crossTrigTag=" << event->m_crossTrigTag
    << ", rpcNoiseTag=" << event->m_rpcNoiseTag
    << ", adLowEnergyTag=" << event->m_adLowEnergyTag
    << ", goodevent=" << event->m_good
    << ", muontag=" << event->m_muonTag
    << endl;

  LogDebug << "Print event in buffer." << endl;
  for(int det=1;det<=GlobalVar::NumADs;det++) {
    LogDebug << "Det: " << det << endl;
    for(unsigned int j=0;j<m_adBuf[det-1].size();j++) {
      LogDebug << j << "," << m_adBuf[det-1][j] << "," 
        << m_adBuf[det-1][j]->m_det << "," << m_adBuf[det-1][j]->m_entry << endl;
    }
  }

  if(!event->isAD()) {
    LogDebug << "Skip none AD event." << endl;
    return true;
  }

  if(event->m_flasherTag || event->m_2inchFlasherTag 
      || event->m_forceTrigTag || event->m_crossTrigTag) {
    LogDebug << "Skip bad event." << endl;
    return true;
  }

  if(event->isMuon()) {
    LogDebug << "Skip muon event." << endl;
    return true;
  }

  // energy cut
  if(!(event->energy()>m_eplow && event->energy()<m_ephigh)) {
    LogDebug << "Out of energy range (0.7MeV,12MeV)." << endl;
    return true;
  }

  // Make a user tag if this event is in muon veto window
  event->m_userTag["MuonVeto"] = 0.;
  MuonVeto *muonVeto = MuonVeto::instance();
  if(muonVeto->veto(event) && event->energy()>m_edlow && event->energy()<m_edhigh) {
    LogDebug << "This neutron like signal is in muon veto window." << endl;
    event->m_userTag["MuonVeto"] = 1.;
  }

  // Multi-coincidence selection
  PhyEvent *lastEvt = 0;
  if(!m_adBuf[event->m_det-1].empty()) {
    lastEvt = m_adBuf[event->m_det-1][m_adBuf[event->m_det-1].size()-1];
  } else {
    LogDebug << "push_back: " << event->m_entry << endl;
    LogDebug << "Empty buffer. Either this is the first event or something wrong." << endl;
    // GrabInstance() is used as a smart pointer, 
    // to make sure event in local buffer will not be deleted,
    // even if it's out of the buffer time window
    m_adBuf[event->m_det-1].push_back(event->GrabInstance());
    return true;
  }

  if(lastEvt) {
    double t2last = event->m_trigTime - lastEvt->m_trigTime;
    if(t2last > 2*m_dthigh) { // find a >400us time gap, deal with events in buffer
      fillIbd(m_adBuf[event->m_det-1]);
      // Release the smart pointer when this event is removed from local buffer,
      // to make sure no memory leak
      for(unsigned int i=0;i<m_adBuf[event->m_det-1].size();i++) {
        m_adBuf[event->m_det-1][i]->ReleaseInstance();
      }
      m_adBuf[event->m_det-1].clear();
    } 
    LogDebug << "push_back: " << event->m_entry << endl;
    m_adBuf[event->m_det-1].push_back(event->GrabInstance());
  } else {
    LogError << "Can't find last event. Check your code." << endl;
  }

  return true;
}
bool DMCIBDSelectAlg::finalize ( ) [virtual]

Implements AlgBase.

Definition at line 56 of file DMCIBDSelectAlg.cc.

{
  return true;
}
bool DMCIBDSelectAlg::fillIbd ( const std::vector< PhyEvent * > &  evtGroup) [private]

Member Data Documentation

Definition at line 25 of file DMCIBDSelectAlg.h.

TTree* DMCIBDSelectAlg::m_tree [private]

Definition at line 26 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_tep [private]

Definition at line 29 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_txp [private]

Definition at line 30 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_typ [private]

Definition at line 31 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_tzp [private]

Definition at line 32 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_ten [private]

Definition at line 33 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_txn [private]

Definition at line 34 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_tyn [private]

Definition at line 35 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_tzn [private]

Definition at line 36 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_tdt [private]

Definition at line 37 of file DMCIBDSelectAlg.h.

int DMCIBDSelectAlg::m_tdet [private]

Definition at line 38 of file DMCIBDSelectAlg.h.

Definition at line 39 of file DMCIBDSelectAlg.h.

Definition at line 40 of file DMCIBDSelectAlg.h.

Definition at line 41 of file DMCIBDSelectAlg.h.

Definition at line 42 of file DMCIBDSelectAlg.h.

Definition at line 43 of file DMCIBDSelectAlg.h.

Definition at line 44 of file DMCIBDSelectAlg.h.

int DMCIBDSelectAlg::m_tn [private]

Definition at line 45 of file DMCIBDSelectAlg.h.

std::vector<PhyEvent*> DMCIBDSelectAlg::m_adBuf[4] [private]

Definition at line 47 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_eplow [private]

Definition at line 50 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_ephigh [private]

Definition at line 51 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_edlow [private]

Definition at line 52 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_edhigh [private]

Definition at line 53 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_dtlow [private]

Definition at line 54 of file DMCIBDSelectAlg.h.

double DMCIBDSelectAlg::m_dthigh [private]

Definition at line 55 of file DMCIBDSelectAlg.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:50:43 for IBDSelectAlg by doxygen 1.7.4