CMS 3D CMS Logo

Public Member Functions

Py8toJetInputHEPEVT Class Reference

#include <Py8toJetInput.h>

Inheritance diagram for Py8toJetInputHEPEVT:
Py8toJetInput

List of all members.

Public Member Functions

const std::vector
< fastjet::PseudoJet > 
fillJetAlgoInput (const Event &, const Event &, const lhef::LHEEvent *, const std::vector< int > *partonList=0)
 Py8toJetInputHEPEVT ()
 ~Py8toJetInputHEPEVT ()

Detailed Description

Definition at line 42 of file Py8toJetInput.h.


Constructor & Destructor Documentation

Py8toJetInputHEPEVT::Py8toJetInputHEPEVT ( ) [inline]

Definition at line 47 of file Py8toJetInput.h.

{}
Py8toJetInputHEPEVT::~Py8toJetInputHEPEVT ( ) [inline]

Definition at line 48 of file Py8toJetInput.h.

{}

Member Function Documentation

const std::vector< fastjet::PseudoJet > Py8toJetInputHEPEVT::fillJetAlgoInput ( const Event event,
const Event workEvent,
const lhef::LHEEvent lhee,
const std::vector< int > *  partonList = 0 
) [virtual]

Reimplemented from Py8toJetInput.

Definition at line 253 of file Py8toJetInput.cc.

References abs, event(), Py8toJetInput::fJetInput, Py8toJetInput::getAncestor(), lhef::LHEEvent::getHEPEUP(), lhef::HEPEUP::IDUP, customizeTrackingMonitorSeedNumber::idx, getHLTprescales::index, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, and lhef::HEPEUP::PUP.

{

   fJetInput.clear();

   HepMC::HEPEVT_Wrapper::zero_everything();   
      
   // service container for further mother-daughters links
   //
   std::vector<int> Py8PartonIdx; // position of original (LHE) partons in Py8::Event
   Py8PartonIdx.clear(); 
   std::vector<int> HEPEVTPartonIdx; // position of LHE partons in HEPEVT (incl. ME-generated decays)
   HEPEVTPartonIdx.clear(); 

   // general counter
   //
   int index = 0;

   int Py8PartonCounter = 0;
   int HEPEVTPartonCounter = 0;
   
   // find the fisrt parton that comes from LHE (ME-generated)
   // skip the incoming particles/partons
   for ( int iprt=1; iprt<event.size(); iprt++ )
   {
      const Particle& part = event[iprt];
      if ( abs(part.status()) < 22 ) continue; // below 10 is "service"
                                               // 11-19 are beam particles; below 10 is "service"
                                               // 21 is incoming partons      
      Py8PartonCounter = iprt;
      break;
   }

   const lhef::HEPEUP& hepeup = *lhee->getHEPEUP();
   // start the counter from 2, because we don't want the incoming particles/oartons !
   for ( int iprt=2; iprt<hepeup.NUP; iprt++ )
   {
      index++;
      HepMC::HEPEVT_Wrapper::set_id( index, hepeup.IDUP[iprt] );
      HepMC::HEPEVT_Wrapper::set_status( index, 2 );
      HepMC::HEPEVT_Wrapper::set_momentum( index, hepeup.PUP[iprt][0], hepeup.PUP[iprt][1], hepeup.PUP[iprt][2], hepeup.PUP[iprt][4] );
      HepMC::HEPEVT_Wrapper::set_mass( index, hepeup.PUP[iprt][4] );
      // --> FIXME HepMC::HEPEVT_Wrapper::set_position( index, part.xProd(), part.yProd(), part.zProd(), part.tProd() );
      HepMC::HEPEVT_Wrapper::set_parents( index, 0, 0 ); // NO, not anymore to the "system particle"
      HepMC::HEPEVT_Wrapper::set_children( index, 0, 0 ); 
      if (  hepeup.MOTHUP[iprt].first > 2 && hepeup.MOTHUP[iprt].second > 2 ) // decay from LHE, will NOT show at the start of Py8 event !!!
      {
         HEPEVTPartonCounter++;
         continue;
      }
      Py8PartonIdx.push_back( Py8PartonCounter );
      Py8PartonCounter++;
      HEPEVTPartonIdx.push_back( HEPEVTPartonCounter);
      HEPEVTPartonCounter++;   
   }
      
   HepMC::HEPEVT_Wrapper::set_number_entries( index );   
         
   // now that the initial partons are in, attach parton-level from Pythia8
   // do NOT reset index as we need to *add* more particles sequentially
   //
   for ( int iprt=1; iprt<workEvent.size(); iprt++ ) // from 0-entry (system) or from 1st entry ???
   {
   
      const Particle& part = workEvent[iprt];
      

//      if ( part.status() != 62 ) continue;
      if ( part.status() < 51 ) continue;
      index++;
      HepMC::HEPEVT_Wrapper::set_id( index, part.id() );
      
      // HepMC::HEPEVT_Wrapper::set_status( index, event.statusHepMC(iprt) ); 
      HepMC::HEPEVT_Wrapper::set_status( index, 1 );      
      HepMC::HEPEVT_Wrapper::set_momentum( index, part.px(), part.py(), part.pz(), part.e() );
      HepMC::HEPEVT_Wrapper::set_mass( index, part.m() );
      HepMC::HEPEVT_Wrapper::set_position( index, part.xProd(), part.yProd(), part.zProd(), part.tProd() );
      HepMC::HEPEVT_Wrapper::set_parents( index, 0, 0 ); // just set to 0 like in Py6...
                                                         // although for some, mother will need to be re-set properly !
      HepMC::HEPEVT_Wrapper::set_children( index, 0, 0 );

      // now refine mother-daughters links, where applicable
      
      int parentId = getAncestor( part.daughter1(), event, workEvent );
      
      if ( parentId <= 0 ) continue;

      for ( int idx=0; idx<(int)Py8PartonIdx.size(); idx++ )
      {
         if ( parentId == Py8PartonIdx[idx] )
         {
            int idx1 = HEPEVTPartonIdx[idx]; 
            HepMC::HEPEVT_Wrapper::set_parents( index, idx1+1, idx1+1 ); 
            break;
         }
      }

   } 
        
   HepMC::HEPEVT_Wrapper::set_number_entries( index );

// --> FIXME   HepMC::HEPEVT_Wrapper::set_event_number( fEventNumber ); // well, if you know it... well, it's one of the counters...
      
//   HepMC::HEPEVT_Wrapper::print_hepevt();
   
   return fJetInput;

}