Atlfast::TrackNtupleMaker Class Reference

#include <TrackNtupleMaker.h>

Collaboration diagram for Atlfast::TrackNtupleMaker:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TrackNtupleMaker (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor: A constructor of this form must be provided.
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Protected Attributes

NTuple::Item< long > m_ntra
NTuple::Array< long > m_kpTruth
NTuple::Array< long > m_kfTruth
NTuple::Array< long > m_kpm1tra
NTuple::Array< long > m_kfm1tra
NTuple::Array< long > m_kpm2tra
NTuple::Array< long > m_kfm2tra
NTuple::Array< long > m_kpm3tra
NTuple::Array< long > m_kfm3tra
NTuple::Array< long > m_kpm4tra
NTuple::Array< long > m_kfm4tra
NTuple::Array< long > m_kpm5tra
NTuple::Array< long > m_kfm5tra
NTuple::Array< long > m_kpm6tra
NTuple::Array< long > m_kfm6tra
NTuple::Array< float > m_d0Track
NTuple::Array< float > m_z0Track
NTuple::Array< float > m_phiTrack
NTuple::Array< float > m_thetaTrack
NTuple::Array< float > m_pInvTrack
NTuple::Array< float > m_radiusTrack
NTuple::Array< float > m_curvTrack
NTuple::Array< float > m_d0Truth
NTuple::Array< float > m_z0Truth
NTuple::Array< float > m_phiTruth
NTuple::Array< float > m_thetaTruth
NTuple::Array< float > m_pInvTruth
NTuple::Array< float > m_radiusTruth
NTuple::Array< float > m_curvTruth
NTuple::Array< float > m_corr11tra
NTuple::Array< float > m_corr12tra
NTuple::Array< float > m_corr13tra
NTuple::Array< float > m_corr14tra
NTuple::Array< float > m_corr15tra
NTuple::Array< float > m_corr22tra
NTuple::Array< float > m_corr23tra
NTuple::Array< float > m_corr24tra
NTuple::Array< float > m_corr25tra
NTuple::Array< float > m_corr33tra
NTuple::Array< float > m_corr34tra
NTuple::Array< float > m_corr35tra
NTuple::Array< float > m_corr44tra
NTuple::Array< float > m_corr45tra
NTuple::Array< float > m_corr55tra
NTuple::Tuple * p_nt1

Private Attributes

long m_nEvents
TesIOm_tesIO
std::string m_mcLocation
std::string m_trackLocation

Static Private Attributes

static const std::string DEFAULT_trackLocation

Detailed Description

Definition at line 29 of file TrackNtupleMaker.h.


Constructor & Destructor Documentation

Atlfast::TrackNtupleMaker::TrackNtupleMaker ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Constructor: A constructor of this form must be provided.

Definition at line 43 of file TrackNtupleMaker.cxx.

00045     :Algorithm(name, pSvcLocator){
00046     
00047     m_trackLocation            = "/Event/AtlfastTracks";
00048     declareProperty( "TrackLocation", m_trackLocation );
00049   }


Member Function Documentation

StatusCode Atlfast::TrackNtupleMaker::initialize (  ) 

Definition at line 53 of file TrackNtupleMaker.cxx.

00053                                           {
00054     MsgStream log(msgSvc(), name());
00055     log << MSG::DEBUG << "Initialising SNM" << endreq;
00056     StatusCode status;
00057     
00058     m_nEvents = 0;   
00059     
00060     //
00061     log << MSG::DEBUG << "Ntuple call 52" << endreq;
00062     NTuple::Directory* col = 0;
00063     log << MSG::DEBUG << "About to open ntuple file" << endreq;
00064     NTupleFilePtr file2(ntupleSvc(), "/NTUPLES/FILE1");
00065     if ( file2 )    {
00066       log << MSG::DEBUG << "Opened ntuple file" << endreq;
00067       if ( !(col=ntupleSvc()->createDirectory("/NTUPLES/FILE1/Atlfast")) )   {
00068         log << MSG::ERROR << "Cannot create directory /NTUPLES/FILE1/Atlfast" 
00069             << endreq;  
00070         return StatusCode::FAILURE;
00071       }else{
00072         log << MSG::DEBUG << "Created ntuple directory" << endreq;
00073       }
00074     }
00075     else    {
00076       log << MSG::ERROR << "Cannot access file /NTUPLES/FILE1" << endreq;  
00077       return StatusCode::FAILURE;
00078     }
00079     // First: A column wise N tuple
00080     NTuplePtr nt1(ntupleSvc(), "/NTUPLES/FILE1/Atlfast/52");
00081     if ( !nt1 )    {    // Check if already booked
00082       nt1 = ntupleSvc()->book (col, 52, CLID_ColumnWiseTuple, "Tracks52");
00083       if ( nt1 )    {
00084         log << MSG::DEBUG << "booked ntuple " << endreq;
00085         // Add an index column
00086         //tracks
00087         status = nt1->addItem ("PTRACKS/NTRA"      , m_ntra, 0, 500 );
00088         status = nt1->addItem ("PTRACKS/KPTRA"     , m_ntra, m_kpTruth);
00089         status = nt1->addItem ("PTRACKS/KFTRA"     , m_ntra, m_kfTruth);
00090         /*        
00091         status = nt1->addItem ("PTRACKS/KPM1TRA"   , m_ntra, m_kpm1tra);
00092         status = nt1->addItem ("PTRACKS/KFM1TRA"   , m_ntra, m_kfm1tra);
00093         status = nt1->addItem ("PTRACKS/KPM2TRA"   , m_ntra, m_kpm2tra);
00094         status = nt1->addItem ("PTRACKS/KFM2TRA"   , m_ntra, m_kfm2tra);
00095         status = nt1->addItem ("PTRACKS/KPM3TRA"   , m_ntra, m_kpm3tra);
00096         status = nt1->addItem ("PTRACKS/KFM3TRA"   , m_ntra, m_kfm3tra);
00097         status = nt1->addItem ("PTRACKS/KPM4TRA"   , m_ntra, m_kpm4tra);
00098         status = nt1->addItem ("PTRACKS/KFM4TRA"   , m_ntra, m_kfm4tra);
00099         status = nt1->addItem ("PTRACKS/KPM5TRA"   , m_ntra, m_kpm5tra);
00100         status = nt1->addItem ("PTRACKS/KFM5TRA"   , m_ntra, m_kfm5tra);
00101         status = nt1->addItem ("PTRACKS/KPM6TRA"   , m_ntra, m_kpm6tra);
00102         status = nt1->addItem ("PTRACKS/KFM6TRA"   , m_ntra, m_kfm6tra);
00103         */
00104         status = nt1->addItem ("PTRACKS/D0TRACRU",     m_ntra, m_d0Truth);
00105         status = nt1->addItem ("PTRACKS/Z0TRACRU",     m_ntra, m_z0Truth);
00106         status = nt1->addItem ("PTRACKS/PHITRACRU",    m_ntra, m_phiTruth);
00107         status = nt1->addItem ("PTRACKS/THETATRACRU",  m_ntra, m_thetaTruth);
00108         status = nt1->addItem ("PTRACKS/PINVTRACRU",   m_ntra, m_pInvTruth);
00109         status = nt1->addItem ("PTRACKS/RADTRACRU",    m_ntra, m_radiusTruth);
00110         status = nt1->addItem ("PTRACKS/CURVTRACRU",   m_ntra, m_curvTruth);
00111         
00112         status = nt1->addItem ("PTRACKS/D0TRA",        m_ntra, m_d0Track);
00113         status = nt1->addItem ("PTRACKS/Z0TRA",        m_ntra, m_z0Track);
00114         status = nt1->addItem ("PTRACKS/PHITRA",       m_ntra, m_phiTrack);
00115         status = nt1->addItem ("PTRACKS/THETATRA",     m_ntra, m_thetaTrack);
00116         status = nt1->addItem ("PTRACKS/PINVTRA",      m_ntra, m_pInvTrack);
00117         status = nt1->addItem ("PTRACKS/RADTRA",       m_ntra, m_radiusTrack);
00118         status = nt1->addItem ("PTRACKS/CURVTRA",      m_ntra, m_curvTrack);
00119         
00120         status = nt1->addItem ("PTRACKS/CORR11TRA"   , m_ntra, m_corr11tra);
00121         status = nt1->addItem ("PTRACKS/CORR21TRA"   , m_ntra, m_corr12tra);
00122         status = nt1->addItem ("PTRACKS/CORR31TRA"   , m_ntra, m_corr13tra);
00123         status = nt1->addItem ("PTRACKS/CORR41TRA"   , m_ntra, m_corr14tra);
00124         status = nt1->addItem ("PTRACKS/CORR51TRA"   , m_ntra, m_corr15tra);
00125         status = nt1->addItem ("PTRACKS/CORR22TRA"   , m_ntra, m_corr22tra);
00126         status = nt1->addItem ("PTRACKS/CORR23TRA"   , m_ntra, m_corr23tra);
00127         status = nt1->addItem ("PTRACKS/CORR24TRA"   , m_ntra, m_corr24tra);
00128         status = nt1->addItem ("PTRACKS/CORR25TRA"   , m_ntra, m_corr25tra);
00129         status = nt1->addItem ("PTRACKS/CORR33TRA"   , m_ntra, m_corr33tra);
00130         status = nt1->addItem ("PTRACKS/CORR34TRA"   , m_ntra, m_corr34tra);
00131         status = nt1->addItem ("PTRACKS/CORR35TRA"   , m_ntra, m_corr35tra);
00132         status = nt1->addItem ("PTRACKS/CORR44TRA"   , m_ntra, m_corr44tra);
00133         status = nt1->addItem ("PTRACKS/CORR45TRA"   , m_ntra, m_corr45tra);
00134         status = nt1->addItem ("PTRACKS/CORR55TRA"   , m_ntra, m_corr55tra);
00135       }
00136       else    {   // did not manage to book the N tuple....
00137         return StatusCode::FAILURE;
00138       }
00139     }
00140 
00141     log<<MSG::DEBUG<<"returning with status"<< status<<endreq;
00142 
00143     GlobalEventData* ged = GlobalEventData::Instance();
00144     //int randSeed = ged->randSeed() ;
00145     // load the location of the MC in StoreGate
00146     m_mcLocation       = ged -> mcLocation();
00147 
00148     m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter());
00149 
00150     HeaderPrinter hp("Atlfast TrackNtupleMaker:", log);
00151     hp.add("Track Location           ", m_trackLocation);
00152     hp.print();
00153 
00154     return StatusCode::SUCCESS;
00155   }

StatusCode Atlfast::TrackNtupleMaker::execute (  ) 

Definition at line 158 of file TrackNtupleMaker.cxx.

00158                                        {
00159     // This just makes the code below a bit easier to read (and type)
00160     MsgStream log(msgSvc(), name());
00161     
00162     // Counter of events processed
00163     if( m_nEvents % 50 == 0) {
00164       log << MSG::INFO << "    processing event number " 
00165           << m_nEvents << endreq;
00166     }     
00167     
00168     m_nEvents++;  
00169     
00170     StatusCode status;
00171 
00172     //-------------------
00173     // Retrieve Tracks 
00174     //-------------------
00175 
00176     std::vector<Track*> tr;
00177     if( !m_tesIO->copy<TrackCollection> (tr, m_trackLocation) ){
00178       log <<MSG::DEBUG << "Could not find Tracks"<<endreq;
00179     }
00180     log << MSG::DEBUG << "Processing tracks" <<tr.size()<< endreq;
00181 
00182     std::vector<Track*>::const_iterator itr  = tr.begin();
00183     
00184     m_ntra = 0;
00185     for (;itr != tr.end(); ++itr )   {
00186       log<<MSG::DEBUG<< " dumping track: "<<m_ntra<<endreq;
00187       log<<MSG::DEBUG<<(*itr)<<endreq<<endreq;
00188       //get track info for four vector:
00189       const HepMC::GenParticle* particle = (*itr)->truth();
00190       
00191       m_kpTruth[m_ntra]= 0;
00192       m_kfTruth[m_ntra]= particle->pdg_id();
00193       /*
00194       m_kpm1tra[m_ntra]= 0;
00195       m_kfm1tra[m_ntra]= 0;
00196       m_kpm2tra[m_ntra]= 0;
00197       m_kfm2tra[m_ntra]= 0;
00198       m_kpm3tra[m_ntra]= 0;
00199       m_kfm3tra[m_ntra]= 0;
00200       m_kpm4tra[m_ntra]= 0;
00201       m_kfm4tra[m_ntra]= 0;
00202       m_kpm5tra[m_ntra]= 0;
00203       m_kfm5tra[m_ntra]= 0;
00204       m_kpm6tra[m_ntra]= 0;
00205       m_kfm6tra[m_ntra]= 0;
00206       */
00207       //
00208       TrackTrajectory truthTraj = (*itr)->truthTrajectory();
00209       TrackTrajectory traj = (*itr)->trajectory();
00210       TrackParameters truthParam = truthTraj.parameters();
00211       TrackParameters smearParam = traj.parameters();
00212       
00213       m_d0Truth[m_ntra]     = truthParam.impactParameter();
00214       m_z0Truth[m_ntra]     = truthParam.zPerigee();
00215       m_phiTruth[m_ntra]    = truthParam.phi();
00216       m_thetaTruth[m_ntra]  = truthParam.theta();
00217       m_pInvTruth[m_ntra]   = truthParam.invPCharge();
00218       m_radiusTruth[m_ntra] = truthTraj.radius();
00219       m_curvTruth[m_ntra]   = truthTraj.curvature();
00220       //
00221       m_d0Track[m_ntra]     = smearParam.impactParameter();
00222       m_z0Track[m_ntra]     = smearParam.zPerigee();
00223       m_phiTrack[m_ntra]    = smearParam.phi();
00224       m_thetaTrack[m_ntra]  = smearParam.theta();
00225       m_pInvTrack[m_ntra]   = smearParam.invPCharge();
00226       m_radiusTrack[m_ntra] = traj.radius();
00227       m_curvTrack[m_ntra]   = traj.curvature();
00228       //
00229       m_corr11tra[m_ntra]= ( (*itr)->smearMatrix() )(1,1);
00230       m_corr12tra[m_ntra]= ( (*itr)->smearMatrix() )(1,2);
00231       m_corr13tra[m_ntra]= ( (*itr)->smearMatrix() )(1,3);
00232       m_corr14tra[m_ntra]= ( (*itr)->smearMatrix() )(1,4);
00233       m_corr15tra[m_ntra]= ( (*itr)->smearMatrix() )(1,5);
00234       m_corr22tra[m_ntra]= ( (*itr)->smearMatrix() )(2,2);
00235       m_corr23tra[m_ntra]= ( (*itr)->smearMatrix() )(2,3);
00236       m_corr24tra[m_ntra]= ( (*itr)->smearMatrix() )(2,4);
00237       m_corr25tra[m_ntra]= ( (*itr)->smearMatrix() )(2,5);
00238       m_corr33tra[m_ntra]= ( (*itr)->smearMatrix() )(3,3);
00239       m_corr34tra[m_ntra]= ( (*itr)->smearMatrix() )(3,4);
00240       m_corr35tra[m_ntra]= ( (*itr)->smearMatrix() )(3,5);
00241       m_corr44tra[m_ntra]= ( (*itr)->smearMatrix() )(4,4);
00242       m_corr45tra[m_ntra]= ( (*itr)->smearMatrix() )(4,5);
00243       m_corr55tra[m_ntra]= ( (*itr)->smearMatrix() )(5,5);
00244 
00245       if ( ++m_ntra == m_ntra->range().distance() ) break;
00246     }
00247 
00248     // Write out ntuple
00249     
00250     log << MSG::DEBUG << "Writing ntuple part 52" << endreq;
00251     status = ntupleSvc()->writeRecord("/NTUPLES/FILE1/Atlfast/52");
00252     if ( !status.isSuccess() ) log <<MSG::ERROR 
00253                                    <<"Cannot fill id 52"
00254                                    <<endreq;
00255     log << MSG::DEBUG << "Done all the ntuple writing" << endreq;
00256     return StatusCode::SUCCESS;
00257   }

StatusCode Atlfast::TrackNtupleMaker::finalize (  ) 

Definition at line 260 of file TrackNtupleMaker.cxx.

00260                                         {
00261     
00262     MsgStream log(msgSvc(), name());
00263     log << MSG::DEBUG 
00264         << "    Number of events processed      = " 
00265         << m_nEvents << endreq;
00266     
00267     return StatusCode::SUCCESS;
00268   }


Member Data Documentation

NTuple::Item<long> Atlfast::TrackNtupleMaker::m_ntra [protected]

Definition at line 33 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kpTruth [protected]

Definition at line 34 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kfTruth [protected]

Definition at line 34 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kpm1tra [protected]

Definition at line 35 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kfm1tra [protected]

Definition at line 35 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kpm2tra [protected]

Definition at line 36 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kfm2tra [protected]

Definition at line 36 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kpm3tra [protected]

Definition at line 37 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kfm3tra [protected]

Definition at line 37 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kpm4tra [protected]

Definition at line 38 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kfm4tra [protected]

Definition at line 38 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kpm5tra [protected]

Definition at line 39 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kfm5tra [protected]

Definition at line 39 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kpm6tra [protected]

Definition at line 40 of file TrackNtupleMaker.h.

NTuple::Array<long> Atlfast::TrackNtupleMaker::m_kfm6tra [protected]

Definition at line 40 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_d0Track [protected]

Definition at line 41 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_z0Track [protected]

Definition at line 41 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_phiTrack [protected]

Definition at line 41 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_thetaTrack [protected]

Definition at line 41 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_pInvTrack [protected]

Definition at line 41 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_radiusTrack [protected]

Definition at line 41 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_curvTrack [protected]

Definition at line 41 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_d0Truth [protected]

Definition at line 44 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_z0Truth [protected]

Definition at line 44 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_phiTruth [protected]

Definition at line 44 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_thetaTruth [protected]

Definition at line 44 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_pInvTruth [protected]

Definition at line 44 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_radiusTruth [protected]

Definition at line 44 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_curvTruth [protected]

Definition at line 44 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr11tra [protected]

Definition at line 47 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr12tra [protected]

Definition at line 47 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr13tra [protected]

Definition at line 47 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr14tra [protected]

Definition at line 47 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr15tra [protected]

Definition at line 47 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr22tra [protected]

Definition at line 48 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr23tra [protected]

Definition at line 48 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr24tra [protected]

Definition at line 48 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr25tra [protected]

Definition at line 48 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr33tra [protected]

Definition at line 49 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr34tra [protected]

Definition at line 49 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr35tra [protected]

Definition at line 49 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr44tra [protected]

Definition at line 50 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr45tra [protected]

Definition at line 50 of file TrackNtupleMaker.h.

NTuple::Array<float> Atlfast::TrackNtupleMaker::m_corr55tra [protected]

Definition at line 50 of file TrackNtupleMaker.h.

NTuple::Tuple* Atlfast::TrackNtupleMaker::p_nt1 [protected]

Definition at line 53 of file TrackNtupleMaker.h.

long Atlfast::TrackNtupleMaker::m_nEvents [private]

Definition at line 64 of file TrackNtupleMaker.h.

TesIO* Atlfast::TrackNtupleMaker::m_tesIO [private]

Definition at line 65 of file TrackNtupleMaker.h.

std::string Atlfast::TrackNtupleMaker::m_mcLocation [private]

Definition at line 67 of file TrackNtupleMaker.h.

std::string Atlfast::TrackNtupleMaker::m_trackLocation [private]

Definition at line 70 of file TrackNtupleMaker.h.

const std::string Atlfast::TrackNtupleMaker::DEFAULT_trackLocation [static, private]

Definition at line 73 of file TrackNtupleMaker.h.


The documentation for this class was generated from the following files:
Generated on Mon Sep 24 14:19:42 2007 for AtlfastAlgs by  doxygen 1.5.1