// ----------------------------------------------------------------------------
// $Id: LCDTrackFullSmear.cxx,v 1.2 2001/06/23 16:15:46 toshi Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDTrackFullSmear.cxx,v $
// Revision 1.2  2001/06/23 16:15:46  toshi
// In method arg. , Char_t* -> const Char_t*
//
// Revision 1.1  2001/05/10 17:56:07  toshi
// Changes C++ name convention from *.C to *.cxx to allow Windows usage.
//
//
#include "LCDTrackFullSmear.h"

//______________________________________________________________________
//
// LCDTrackFullSmear
//
// oversees creation of tracks by applying acceptance cuts on McParts

ClassImp(LCDTrackFullSmear)

//----------------------------------------------------------------------
 LCDTrackFullSmear::LCDTrackFullSmear(LCDGetParameters* gp,
				     const Char_t* smearFileName) {
  // constructor: sets up track smearer
  m_parameters=0;
  m_recon=0;
  MakeLCDSmearTrack(gp,smearFileName);
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
 LCDTrackFullSmear::~LCDTrackFullSmear() {
  if (m_recon)
    delete m_recon;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
void
 LCDTrackFullSmear::MakeLCDSmearTrack(LCDGetParameters* gp, 
				     const Char_t* smearFileName) {
  if (m_recon) delete m_recon;
  m_recon = new LCDSmearTrack(gp, smearFileName);
  m_parameters = gp;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
void
 LCDTrackFullSmear::Cleanup(LCDEvent* event) {
  if (event) {
    event->Tracks()->Delete();
  }
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
//        execute: 'reconstruct' the tracks from McPart
void
 LCDTrackFullSmear::Doit(LCDEvent* event)
{
  // apply acceptance cuts on appropriate McParts and get SmearTrack t
  // make the tracks

  TClonesArray* McPList = event->MCparticles();
  TClonesArray* TkList  = event->Tracks();

 // create tracks for particles within the acceptance	
  Int_t          nParts = McPList ->GetEntries();
  LCDMcPart*     mcP;
  Int_t          statusCode;
  Bool_t         decayed;
  TLorentzVector p4;
  TVector3       p;
  Double_t       pTot;
  Double_t       abscos;
  Int_t          index;
  Int_t          index0;
  LCDTrack*      tk;

  Int_t          ntrk=0;
  for(Int_t i =0; i< nParts; i++) {

    mcP        = (LCDMcPart*) McPList->At(i);
    if (mcP == 0) continue;
    statusCode = mcP->GetStatus();
    decayed    = (statusCode != 1);

    if (decayed) continue;

    p4.SetPxPyPzE(mcP->Get4MomentumPtr()->Px(),
		  mcP->Get4MomentumPtr()->Py(),
		  mcP->Get4MomentumPtr()->Pz(),
		  mcP->Get4MomentumPtr()->E());

    p = p4.Vect();

    if (mcP->GetCharge() == 0) continue;

    pTot      = p.Mag();
    abscos    = TMath::Abs(p.CosTheta());
    index     = McPList->IndexOf(mcP);

    // Temp
    index0 = mcP->GetParentIdx();
    
    if ( (abscos < m_parameters->GetPolarOuter()) && 
	 ( pTot  > m_parameters->GetPTMin()     ) ){
      // TkList->Add(m_recon->makeTrack(mcP,index,m_parameters));
      //TkList->Add(m_recon->makeTrack(mcP,index,index0,m_parameters));
      tk=new((*TkList)[ntrk++]) LCDTrack();
      m_recon->SmearTrack(mcP,index,index0,m_parameters,tk);
    }
  }

}
//----------------------------------------------------------------------



ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.