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

In This Package:

MichelAlg.cc
Go to the documentation of this file.
00001 #include "Algorithms/MichelAlg.h"
00002 #include "LafKernel/GlobalVar.h"
00003 #include <iostream>
00004 
00005 using namespace std;
00006 
00007 MichelAlg::MichelAlg(const std::string& name)
00008   : AlgBase(name)
00009 {
00010   setOption("MuEngLow",  m_muEngLow  = 80.);  //80MeV
00011   setOption("MuEngHigh", m_muEngHigh = 1000.);  //1GeV
00012   setOption("T2MuLow",   m_t2muLow   = 2.e-6);  //2us
00013   setOption("T2MuHigh",  m_t2muHigh  = 1.e-5);  //10us
00014 
00015   for(int i=0; i<GlobalVar::NumADs; i++) {
00016     m_muEng[i] = 0.;
00017     m_muTime[i] = 0;
00018   }
00019 }
00020 
00021 bool MichelAlg::initialize()
00022 {
00023   LogDebug << "MuEngLow = " << m_muEngLow << std::endl;
00024   m_buffer = dynamic_cast<PhyEventBuf*>(service("Cycler"));
00025   m_tuple = ntupleSvc()->bookNtuple("FILE1/Michel", "Michel", "det:energy:muenergy:t2mu");
00026 
00027   return true;
00028 }
00029 
00030 bool MichelAlg::finalize()
00031 {
00032   LogDebug << "---MichelAlg::finalize()---" << endl;
00033   return true;
00034 }
00035 
00036 bool MichelAlg::execute()
00037 {
00038 
00039   // If bad event, return
00040   PhyEvent *event = m_buffer->curEvt();
00041   if ( !event->m_good ) return true;
00042   if ( !event->isAD() ) return true;
00043 
00044   // tag muon
00045   if(event->m_energy>m_muEngLow && event->m_energy<m_muEngHigh) { // find a muon
00046     m_muEng[event->m_det-1] = event->m_energy;
00047     m_muTime[event->m_det-1] = event->m_trigTime;
00048     return true;
00049   }
00050 
00051   double t2mu = (event->m_trigTime - m_muTime[event->m_det-1]);
00052   if(t2mu>m_t2muLow && t2mu<m_t2muHigh) {
00053       LogDebug << event->m_det << " " << event->m_energy
00054                << " " << m_muEng[event->m_det-1] << " " << t2mu << endl;
00055       m_tuple->Fill(event->m_det,event->m_energy,m_muEng[event->m_det-1],t2mu);
00056   }
00057 
00058   return true;
00059 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:50:49 for Algorithms by doxygen 1.7.4