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

In This Package:

Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PreElecSimSvc Class Reference

for preparing SimHits for digitalization More...

#include <PreElecSimSvc.h>

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

List of all members.

Classes

class  Configure

Public Member Functions

 PreElecSimSvc (const string &name, ISvcLocator *pSvcLocator)
virtual ~PreElecSimSvc ()
virtual StatusCode initialize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppint)
SimHitHeadergetSimHitHeader (vector< const DayaBay::SimHeader * > &shs, TimeStamp &hite, TimeStamp &hitl)
virtual SimHitHeadergetSimHitHeader (vector< const SimHeader * > &shs, TimeStamp &hite, TimeStamp &hitl)=0

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Member Functions

StatusCode fillHitsBuffer (DayaBay::SimHeader *sh)
StatusCode findGap ()
StatusCode createHitHeaders ()

Private Attributes

MsgStream m_log
IMixInputSvcm_mixInputSvc
deque< TimeStampm_hitsGap
deque< MixSimHitm_tranSimHits
deque< MixSimHitm_SimHits
map< DayaBay::SimHitHeader
*, vector< const
DayaBay::SimHeader * > > 
m_HitHeaderToHeaders
deque< DayaBay::SimHitHeader * > m_propSimHitHeaders
deque< TimeStampm_hitEarliests
deque< TimeStampm_hitLatests
TimeStamp m_minTimeGap
TimeStamp m_absTime
bool m_ifDeal
deque< TimeStamp >::size_type m_dealInd
list __all__ = ['PreElecSimSvcConf', 'Configure']

Detailed Description

for preparing SimHits for digitalization

Zhang YiChun Dec 13 2010 yczhang@ihep.ac.cn

Definition at line 33 of file PreElecSimSvc.h.


Constructor & Destructor Documentation

PreElecSimSvc::PreElecSimSvc ( const string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 9 of file PreElecSimSvc.cc.

              :Service(name, pSvcLocator), m_log(msgSvc(), "PreElecSimSvc")
{
  //MixInputSvc
  m_mixInputSvc = 0;

  //MiniTimeGap 
  //pre(post)TimeTolerance "ns"
  double mintimeGap = preTimeTolerance/CLHEP::nanosecond + postTimeTolerance/CLHEP::nanosecond;
  /*declareProperty("MinGapTime", m_mintimeGap = preTimeTolerance + postTimeTolerance,
    "Minimum width for a gap that defines a chunk of SimHits");*/

  /*m_log<< MSG::INFO<< "PreElecSimSvc::PreElecSimSvc(): "
    << " m_mintimeGap: "<< m_mintimeGap<< endreq;*/

  TimeStamp initime(mintimeGap/1.0e9);
  m_minTimeGap = initime;
}
PreElecSimSvc::~PreElecSimSvc ( ) [virtual]

Definition at line 28 of file PreElecSimSvc.cc.

{
  m_log<< MSG::INFO<< "PreElecSimSvc::~PreElecSimSvc()..."<< endreq;
}

Member Function Documentation

StatusCode PreElecSimSvc::initialize ( ) [virtual]

Definition at line 33 of file PreElecSimSvc.cc.

{
  //PreElecSim initialization
  m_log<< MSG::INFO<< "PreElecSimSvc ininalize @"<< (void*)this<< endreq;
  StatusCode sc = Service::initialize();
  if(sc.isFailure()) 
  {
    m_log<< MSG::ERROR<< "Parent class(Service) failed to initialize!"<< endreq;
    return sc;
  }
  
  //Check the mini time gap
  m_log<< MSG::INFO<< "MinTimeGap: "<< m_minTimeGap.GetSec()<< "s--"
       << m_minTimeGap.GetNanoSec()<< "ns"<< endreq;

  //Initialize the MixInputSvc   
  IService* isvc = 0;
  sc = serviceLocator()->service("RootIOCnvSvc", isvc, true);
  if(sc.isFailure()) 
  {
    m_log<< MSG::ERROR<< "Conversion service RootIOCnvSvc could not be retrieved"<< endreq;
    return sc;
  }
  isvc->addRef();
  sc = isvc->queryInterface(IMixInputSvc::interfaceID(), (void**)&m_mixInputSvc);
  if(sc.isFailure()) 
  {
    m_log<< MSG::ERROR<< "Service MixInputSvc does not implement IMixInputSvc"<< endreq;
    return sc;
  }

  return StatusCode::SUCCESS;
}
StatusCode PreElecSimSvc::queryInterface ( const InterfaceID &  riid,
void **  ppint 
) [virtual]

Definition at line 67 of file PreElecSimSvc.cc.

{
  if(IID_IPreElecSimSvc.versionMatch(riid)) 
  {
    m_log<< MSG::DEBUG<< "queryInterface("<< riid
         << ")-->(IPreElecSimSvc*)"<< (void*)this<< endreq;
    *ppint = (IPreElecSimSvc*)this;
  }
  else 
  {
    return Service::queryInterface(riid, ppint);
  }
  addRef();
  return StatusCode::SUCCESS;
}
SimHitHeader * PreElecSimSvc::getSimHitHeader ( vector< const DayaBay::SimHeader * > &  shs,
TimeStamp hite,
TimeStamp hitl 
)

Definition at line 84 of file PreElecSimSvc.cc.

{
  m_log<< MSG::INFO<< "Now in the getSimHeaders()...."<< endreq;

  TimeStamp initime(0.0);
  hite = initime;
  hitl = initime;

  for( ; ; )
  {
    m_log<< MSG::DEBUG<< "SimHitHeaders' buffer size = "<< m_propSimHitHeaders.size()<< endreq;

    //The SimHitHeader buffer is not empty
    if(0 != m_propSimHitHeaders.size())
    {
      m_log<< MSG::DEBUG<< "So, get one SimHitHeader and its SimHeaders directly!"<< endreq;
      //Output one SimHitHeader
      SimHitHeader* shh = m_propSimHitHeaders[0];
      if(!shh)
      {
        m_log<< MSG::ERROR<< "Got one wrong SimHitHeader!"<< endreq;
        return shh; 
      }

      hite = m_hitEarliests[0];
      hitl = m_hitLatests[0];
      
      shs = m_HitHeaderToHeaders[shh];

      //pop_front the SimHitHeader buffer(take care of memory)
      m_log<< MSG::DEBUG<< "Before clearing: SimHitHeader buffer size: "<< m_propSimHitHeaders.size()
           << " SimHitToSimHeader buffer size: "<< m_HitHeaderToHeaders.size()<< endreq;

      m_HitHeaderToHeaders.erase(m_propSimHitHeaders[0]);
      m_propSimHitHeaders.pop_front();
      m_hitEarliests.pop_front();
      m_hitLatests.pop_front();

      m_log<< MSG::DEBUG<< "After clearing: SimHitHeader buffer size: "<< m_propSimHitHeaders.size()
           << " SimHitToSimHeader buffer size: "<< m_HitHeaderToHeaders.size()<< endreq;

      return shh;
    }
    else //The SimHitHeader buffer is empty
    {
      m_log<< MSG::DEBUG<< "So, need to create a SimHitHeader(SimHeaders) firstly!"<< endreq;

      m_ifDeal = false;

      //Multi-events input
      for(; ;)
      {
        //Input one SimHeader and its GenHeader
        SimHeader* sh = new SimHeader();
        //SimHeader* sh = 0;
        GenHeader* gh = new GenHeader();

        //GenHeader* gh = 0;
        StatusCode sc = m_mixInputSvc->prepareStream();
        if(sc.isFailure())
        {
          m_log<< MSG::ERROR<< "Error when preparing input-streams from files!"<< endreq;
          return 0;
        }

        sc = m_mixInputSvc->getSimHeader(gh, sh);
        if(sc.isFailure())
        {
          m_log<< MSG::ERROR<< "Error when getting a SimHeader from file!"<< endreq;
          return 0;
        }

        //Delete GenHeader(temp)
        delete gh;

        //Judge if need to fill the SimHits buffer
        if(0 == m_hitsGap.size()) //At the very beginning
        {
          m_log<< MSG::DEBUG<< "The Hits Gap vectors: GapV(TimeStamp) size = "
               << m_hitsGap.size()<< endreq;

          sc = this->fillHitsBuffer(sh);
          if(sc.isFailure())
          {
            m_log<< MSG::ERROR<< "Error when filling the SimHits!"<< endreq;
            return 0;
          }
          continue;
        }
        else
        {
          m_log<< MSG::DEBUG<< "The Hits Gap vectors: GapV(TimeStamp) size = "
               << m_hitsGap.size()<< endreq;

          //Judge if new SimHitHeaders can be created
          deque<TimeStamp>::size_type ind = m_hitsGap.size();
          ind--;
          for(; ; ind--)
          {
            m_log<< MSG::DEBUG<< "Now the Gap vector's index is: "<< ind<< endreq;
            m_log<< MSG::DEBUG<< "Time interval: "<< (sh->earliest() - m_hitsGap[ind]).GetSec()
                 << "--"<< (sh->earliest() - m_hitsGap[ind]).GetNanoSec()<< endreq;
            
            if((sh->earliest() - m_hitsGap[ind]) < m_minTimeGap) 
            {
              if(0 == ind)
              {
                m_log<< MSG::DEBUG<< "Now, there is no Gap with next SimHeader!"<< endreq;
                m_ifDeal = false;
                break;
              }
              else continue;
            }
            else 
            {
              m_ifDeal = true;
              m_dealInd = ind;
              m_log<< MSG::DEBUG<< "The gap is between m_hitsGap["<< ind<< "]: "
                   << "SimHeader's earliest()"<< endreq;
              break;
            }
          }//over

          if(false == m_ifDeal) //can not create new SimHitHeaders, just fill
          {
            m_log<< MSG::DEBUG<< "So, just fill the SimHits buffer!"<< endreq;

            //Fill SimHits buffer with the current SimHeader
            sc = this->fillHitsBuffer(sh);
            if(sc.isFailure())
            {
              m_log<< MSG::ERROR<< "Error when filling the SimHits!"<< endreq;
              return 0;
            }
            
            continue;
          }
          else //can create new SimHitHeaders
          {
            m_log<< MSG::DEBUG<< "So, create a new SimHitHeader firstly!"<< endreq;

            //Create one or more new SimHitHeaders in SimHitHeader buffer
            sc = this->createHitHeaders();
            if(sc.isFailure())
            {
              m_log<< MSG::ERROR<< "Error when creating the new SimHitHeaders!"<< endreq;
              return 0;
            }
            
            m_log<< MSG::DEBUG<< "OK, then fill the SimHits buffer!"<< endreq;
            //then fill SimHits buffer with the current SimHeader
            sc = this->fillHitsBuffer(sh);
            if(sc.isFailure())
            {
              m_log<< MSG::ERROR<< "Error when filling the SimHits!"<< endreq;
              return 0; 
            }
            
            break; //Quit the Multi-events input cycle
          }
        }
      }            //Multi-events input cycle
    }
  }                //Top for cycle
}
StatusCode PreElecSimSvc::fillHitsBuffer ( DayaBay::SimHeader sh) [private]

Definition at line 251 of file PreElecSimSvc.cc.

{
  m_log<< MSG::INFO<< "Fill SimHits buffer..."<< endreq;

  //Get the SimHitHeader
  const SimHitHeader* shh = sh->hits();
  map<short int, SimHitCollection*> mshc = shh->hitCollection();

  m_absTime = sh->timeStamp();
  m_log<< MSG::DEBUG<< "The current SimHeader time: "<< m_absTime.GetSec()
       << "--"<< m_absTime.GetNanoSec()<< endreq;
 
  //fill the SimHits buffer
  if(0 == m_hitsGap.size())
  {
    m_log<< MSG::DEBUG<< "m_SimHits' size is: "<< m_SimHits.size()<< "!"<< endreq;

    map<short int, SimHitCollection*>::iterator mit;
    for(mit = mshc.begin(); mit != mshc.end(); mit++)
    {
      //Get the SimHitCollection
      m_log<< MSG::INFO<< "In Det: "<< mit->first<< endreq;

      SimHitCollection* shc = mit->second;
      vector<SimHit*> hits = shc->collection();
      if(0 == hits.size()) return StatusCode::FAILURE;

      //Fill the Hits buffer
      for(vector<SimHit*>::iterator vit = hits.begin(); vit != hits.end(); vit++) 
      {
        MixSimHit mixhit;
        //m_log<< MSG::DEBUG<< "SimHit time: "<< (*vit)->hitTime()<< endreq;
        TimeStamp temTime = m_absTime;
        temTime.Add(((*vit)->hitTime())/1.0e9); //hitTime() to TimeStamp, relative to absolute
        mixhit.hitTime     = temTime;
        //m_log<< MSG::DEBUG<< "SimHit time: "<< (*vit)->hitTime()<< endreq;
        mixhit.trivialtime = (*vit)->hitTime() - (int)((*vit)->hitTime());
        m_log<< MSG::DEBUG<< "SimHit Time: "<< mixhit.hitTime.GetSec()
           << "--"<< mixhit.hitTime.GetNanoSec()<< endreq;
        mixhit.setHit(*vit);
        m_SimHits.push_back(mixhit); //deep copy need?
      }
    }

    sort(m_SimHits.begin(), m_SimHits.end());

    m_log<< MSG::DEBUG<< "After sorting....."<< endreq;
    for(deque<MixSimHit>::iterator vit = m_SimHits.begin(); vit != m_SimHits.end(); vit++)
    {
      //m_log<< MSG::DEBUG<< "SimHit time: "<< vit->sht->hitTime()<< endreq;
      m_log<< MSG::DEBUG<< "SimHit time in m_SimHits: "<< vit->hitTime.GetSec()
           << "--"<< vit->hitTime.GetNanoSec()<< endreq;
    }
  }
  else
  {
    deque<TimeStamp>::size_type curind = m_hitsGap.size();
    curind--;

    if(sh->earliest() > m_hitsGap[curind])
    {
      //Loop over all detectors' SimHitCollections
      deque<MixSimHit> mixhits;
      map<short int, SimHitCollection*>::iterator mit;
      for(mit = mshc.begin(); mit != mshc.end(); mit++)
      {
        //Get the SimHitCollection
        m_log<< MSG::INFO<< "In Det: "<< mit->first<< endreq;

        SimHitCollection* shc = mit->second;
        vector<SimHit*> hits = shc->collection();
        if(0 == hits.size()) return StatusCode::FAILURE;

        //Fill the Hits buffer
        for(vector<SimHit*>::iterator vit = hits.begin(); vit != hits.end(); vit++) 
        {
          MixSimHit mixhit;
          //m_log<< MSG::DEBUG<< "SimHit time: "<< (*vit)->hitTime()<< endreq;
          TimeStamp temTime = m_absTime;
          temTime.Add(((*vit)->hitTime())/1.0e9); //hitTime() to TimeStamp, relative to absolute
          mixhit.hitTime     = temTime;
          mixhit.trivialtime = (*vit)->hitTime() - (int)((*vit)->hitTime());
          m_log<< MSG::DEBUG<< "SimHit Time: "<< mixhit.hitTime.GetSec()
               << "--"<< mixhit.hitTime.GetNanoSec()<< endreq;
          mixhit.setHit(*vit);
          mixhits.push_back(mixhit); //deep copy need?
        }
      }

      //sort the mixhits
      sort(mixhits.begin(), mixhits.end());

      m_log<< MSG::DEBUG<< "After sorting....."<< endreq;
      for(deque<MixSimHit>::iterator dit = mixhits.begin(); dit != mixhits.end(); dit++)
      {
        //m_log<< MSG::DEBUG<< "SimHit time in mixhits: "<< dit->sht->hitTime()<< endreq;
        m_log<< MSG::DEBUG<< "SimHit time in mixhits: "<< dit->hitTime.GetSec()
             << "--"<< dit->hitTime.GetNanoSec()<< endreq;
        m_SimHits.push_back(*dit);
      }

      m_log<< MSG::DEBUG<< "After merging: "<< endreq;
      for(deque<MixSimHit>::iterator vit = m_SimHits.begin(); vit != m_SimHits.end(); vit++)
      {
        //m_log<< MSG::DEBUG<< "SimHit time in m_SimHits: "<< vit->sht->hitTime()<< endreq;
        m_log<< MSG::DEBUG<< "SimHit time in m_SimHits: "<< vit->hitTime.GetSec()
             << "--"<< vit->hitTime.GetNanoSec()<< endreq;
      }

      mixhits.clear();
    }
    else
    {
      //Loop over all detectors' SimHitCollections
      deque<MixSimHit> mixhits;
      map<short int, SimHitCollection*>::iterator mit;
      for(mit = mshc.begin(); mit != mshc.end(); mit++)
      {
        //Get the SimHitCollection
        m_log<< MSG::INFO<< "In Det: "<< mit->first<< endreq;

        SimHitCollection* shc = mit->second;
        vector<SimHit*> hits = shc->collection();
        if(0 == hits.size()) return StatusCode::FAILURE;

        //Fill the Hits buffer
        for(vector<SimHit*>::iterator vit = hits.begin(); vit != hits.end(); vit++) 
        {
          MixSimHit mixhit;
          //m_log<< MSG::DEBUG<< "SimHit time: "<< (*vit)->hitTime()<< endreq;
          TimeStamp temTime = m_absTime;
          temTime.Add(((*vit)->hitTime())/1.0e9); //hitTime() to TimeStamp, relative to absolute
          mixhit.hitTime     = temTime;
          mixhit.trivialtime = (*vit)->hitTime() - (int)((*vit)->hitTime());
          m_log<< MSG::DEBUG<< "SimHit Time: "<< mixhit.hitTime.GetSec()
               << "--"<< mixhit.hitTime.GetNanoSec()<< endreq;
          mixhit.setHit(*vit);
          mixhits.push_back(mixhit); //deep copy need?
        }
      }

      //sort the mixhits
      sort(mixhits.begin(), mixhits.end());
      merge(m_SimHits.begin(), m_SimHits.end(), mixhits.begin(), mixhits.end(), back_inserter(m_tranSimHits));
      m_SimHits = m_tranSimHits;
  
      m_log<< MSG::DEBUG<< "After merging: "<< endreq;
      for(deque<MixSimHit>::iterator vit = m_SimHits.begin(); vit != m_SimHits.end(); vit++)
      {
        //m_log<< MSG::DEBUG<< "SimHit time in m_SimHits: "<< vit->sht->hitTime()<< endreq;
        m_log<< MSG::DEBUG<< "SimHit time in m_SimHits: "<< vit->hitTime.GetSec()
             << "--"<< vit->hitTime.GetNanoSec()<< endreq;
      }

      m_tranSimHits.clear(); //Clear the buffer
      mixhits.clear();
    }
  }

  //Update the gap vector
  StatusCode sc = this->findGap();
  if(sc.isFailure())
  {
    m_log<< MSG::ERROR<< "Error in findGap()!"<< endreq;
    return StatusCode::FAILURE;
  }

  return StatusCode::SUCCESS;
}
StatusCode PreElecSimSvc::findGap ( ) [private]

Definition at line 421 of file PreElecSimSvc.cc.

{
  m_log<< MSG::DEBUG<< "Find gap here(update the Gap Vector)..."<< endreq;

  //Prepare the Gap vector
  //m_hitsgap.clear();
  m_hitsGap.clear();

  if(m_SimHits.size() < 2) //at least two hits. Actually, now there is just one.
  {
    m_log<< MSG::WARNING<< "No enough SimHits in m_SimHits! Be carefull!"<< endreq;

    //m_hitsgap.push_back(m_SimHits[0].sht->hitTime());
    //TimeStamp gapBeginTime(m_SimHits[0].sht->hitTime());
    //gapBeginTime.Add(m_absTime);
    m_hitsGap.push_back(m_SimHits[0].hitTime);

    for(vector<TimeStamp>::size_type ind = 0; ind != m_hitsGap.size(); ind++)
    {
      m_log<< MSG::DEBUG<< "TimeStamp Gap: "<< m_hitsGap[ind].GetSec()<< "--"
           << m_hitsGap[ind].GetNanoSec()<< endreq;
    }

    return StatusCode::SUCCESS;
  }

  //The first two lines from Fifteen, the third one is mine
  //________hhhhhh__hh______hhhhh_h______________hhhh_h_hhh_hhhhhhh___
  //                  gap          gap                             Gap
  //The three gap should be in Gap vector( g_g_G ) 
  //The last G is a potential begin of a gap

  //Standalone test
  deque<MixSimHit>::iterator dit, ddit, dend;
  dend = m_SimHits.end();
  dend--;
  for(dit = m_SimHits.begin(); dit != dend; dit++)
  {
    ddit = dit + 1;
    TimeStamp timeinter = ddit->hitTime - dit->hitTime;
    
    //There is one gap. Update the gap vector
    if(timeinter > m_minTimeGap)
    {
      m_log<< MSG::DEBUG<< "There is one gap!"<< endreq;

      m_hitsGap.push_back(dit->hitTime);
    }
  }

  //Last "Gap"
  m_log<< MSG::DEBUG<< "There is the last gap!"<< endreq;
  m_hitsGap.push_back(dend->hitTime);

  for(vector<TimeStamp>::size_type ind = 0; ind != m_hitsGap.size(); ind++)
  {
    m_log<< MSG::DEBUG<< "TimeStamp Gap: "<< m_hitsGap[ind].GetSec()<< "--"
         << m_hitsGap[ind].GetNanoSec()<< endreq;
  }

  return StatusCode::SUCCESS;
}
StatusCode PreElecSimSvc::createHitHeaders ( ) [private]

Definition at line 484 of file PreElecSimSvc.cc.

{
  //Create SimHitHeader
  //Bookkeeping the SimHitHeader and SimHeaders
  m_log<< MSG::INFO<< "Create new SimHitHeaders........"<< endreq;

  //Loop over the Gap vector
  deque<TimeStamp>::size_type iind;
  for(iind = 0; iind <= m_dealInd; iind++)
  {
    //One SimHitHeader each Gap
    m_log<< MSG::DEBUG<< "Create one SimHitHeader before SimHit("
         << m_hitsGap[0].GetSec()<< "--"<< m_hitsGap[0].GetNanoSec()<< ")"<< endreq;

    //Bookkeeping the SimHitHeader's time range
    m_hitEarliests.push_back(m_SimHits[0].hitTime);
    m_hitLatests.push_back(m_hitsGap[0]);

    SimHitHeader* shh = new SimHitHeader();

    if(0 == shh)
    {
      m_log<< MSG::ERROR<< "Can not create a new SimHitHeader!"<< endreq;
      return StatusCode::FAILURE;
    }
    m_log<< MSG::INFO<< "Create a new SimHitHeader: "<< shh<< endreq;

    //InputHeaders
    vector<const SimHeader*> inputHeaders;

    //mshc(reference)
    map<short int, SimHitCollection*>& mshc = shh->hitCollection();
    
    //Loop over the SimHits buffer
    for( ; ; )
    {
      m_log<< MSG::DEBUG<< "The SimHit buffer size is: "<< m_SimHits.size()<< endreq;

      deque<MixSimHit>::iterator dit = m_SimHits.begin();
      if(dit == m_SimHits.end())
      {
        m_log<< MSG::INFO<< "The SimHits Buffer is empty!"<< endreq;
        break;
      }
        
      if(dit->hitTime <= m_hitsGap[0])
      {
        Detector Det                   = dit->sht->hc()->detector();
        short int det                  = Det.siteDetPackedData();
        const SimHeader* currentHeader = dit->sht->hc()->header()->header();
        
        m_log<< MSG::DEBUG<< "This hit is from detector: "<< AsString(Det.detectorId())<< endreq;

        //There is a new detector!
        if(0 == mshc.size() || mshc.find(det) == mshc.end())
        {
          m_log<< MSG::DEBUG<< "map<short int, SimHitCollection*> size: "
               << mshc.size()<< " new detectorId: "<< AsString(Det.detectorId())<< endreq;

          //Create a new SimHitCollection
          SimHitCollection* shc = new SimHitCollection();
          shc->setHeader(shh);
          shc->setDetector(Det);
          //shts(reference)
          vector<SimHit*>& shts = shc->collection();
          shts.push_back(dit->sht);
          mshc[det] = shc;
          
          m_log<< MSG::DEBUG<< "Now the map size is: "<< mshc.size()<< endreq;

          //Deal with the InputHeaders
          vector<const SimHeader*>::iterator vit = inputHeaders.begin();
          if(0 == inputHeaders.size()) 
          {
            m_log<< MSG::DEBUG<< "New SimHeader: "<< currentHeader<< endreq;
            inputHeaders.push_back(currentHeader);
          }
          else
          {
            bool found = false;
            for( ; vit != inputHeaders.end(); vit++)
            {
              if(currentHeader == (*vit))
              {
                found = true;
                m_log<< MSG::DEBUG<< "SimHeader: "<< currentHeader<< " already in InputHeaders!"<< endreq;
                break;
              }
            }
            if(false == found) 
            {
              m_log<< MSG::DEBUG<< "SimHeader: "<< currentHeader<< " should be added into InputHeaders!"<< endreq;
              inputHeaders.push_back(currentHeader);
            }       
          }
          
          m_SimHits.pop_front();
          continue;
        }
        else
        {
          m_log<< MSG::DEBUG<< "map<short int, SimHitCollection*> size: "
               << mshc.size()<< "  detectorId: "<< AsString(Det.detectorId())<< endreq;
          //shts(reference)
          vector<SimHit*>& shts = mshc[det]->collection();
          shts.push_back(dit->sht);
          
          //Deal with the InputHeaders
          vector<const SimHeader*>::iterator vit = inputHeaders.begin();
          if(0 == inputHeaders.size())
          {
            m_log<< MSG::DEBUG<< "New SimHeader: "<< currentHeader<< endreq;
            inputHeaders.push_back(currentHeader);
          }
          else
          {
            bool found = false;
            for( ; vit != inputHeaders.end(); vit++)
            {
              if(currentHeader == (*vit))
              {
                found = true;
                m_log<< MSG::DEBUG<< "SimHeader: "<< currentHeader<< " already in InputHeaders!"<< endreq;
                break;
              }
            }
            if(false == found)
            {
              m_log<< MSG::DEBUG<< "SimHeader: "<< currentHeader<< " should be added into InputHeaders!"<< endreq;
              inputHeaders.push_back(currentHeader);
            }       
          }

          m_SimHits.pop_front();
          continue;
        }
      }
      else 
      {
        m_log<< MSG::DEBUG<< "Now create next SimHitHeader!"<< endreq;
        break;
      }
    }
    
    m_log<< MSG::INFO<< "Get one SimHitHeader: "<< shh<< " with "<< shh->hitCollection().size()<< endreq;
    m_propSimHitHeaders.push_back(shh);
    m_HitHeaderToHeaders[shh] = inputHeaders;
    m_log<< MSG::DEBUG<< "Now prepare the SimHitHeader: "<< shh<< " and "
         << m_HitHeaderToHeaders.size()<< " SimHeaders!"<< endreq;
    m_hitsGap.pop_front();
  } //Top for cycle

  return StatusCode::SUCCESS;
}
static const InterfaceID& IPreElecSimSvc::interfaceID ( ) [inline, static, inherited]

Definition at line 36 of file IPreElecSimSvc.h.

                             { return  IID_IPreElecSimSvc; }
virtual SimHitHeader* IPreElecSimSvc::getSimHitHeader ( vector< const SimHeader * > &  shs,
TimeStamp hite,
TimeStamp hitl 
) [pure virtual, inherited]

Member Data Documentation

MsgStream PreElecSimSvc::m_log [mutable, private]

Definition at line 47 of file PreElecSimSvc.h.

Definition at line 50 of file PreElecSimSvc.h.

Definition at line 54 of file PreElecSimSvc.h.

Definition at line 55 of file PreElecSimSvc.h.

Definition at line 56 of file PreElecSimSvc.h.

Definition at line 71 of file PreElecSimSvc.h.

Definition at line 72 of file PreElecSimSvc.h.

Definition at line 75 of file PreElecSimSvc.h.

Definition at line 76 of file PreElecSimSvc.h.

Definition at line 80 of file PreElecSimSvc.h.

Definition at line 81 of file PreElecSimSvc.h.

bool PreElecSimSvc::m_ifDeal [private]

Definition at line 84 of file PreElecSimSvc.h.

deque<TimeStamp>::size_type PreElecSimSvc::m_dealInd [private]

Definition at line 85 of file PreElecSimSvc.h.

list PreElecSimSvc::__all__ = ['PreElecSimSvcConf', 'Configure'] [private]

Definition at line 3 of file __init__.py.


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 10:15:00 for PreElecSimSvc by doxygen 1.7.4