#include <StandardNtupleMaker.h>
Collaboration diagram for Atlfast::StandardNtupleMaker:
Public Member Functions | |
StandardNtupleMaker (const std::string &name, ISvcLocator *pSvcLocator) | |
Constructor: A constructor of this form must be provided. | |
~StandardNtupleMaker () | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Protected Attributes | |
NTuple::Item< long > | m_isub |
NTuple::Item< long > | m_njetb |
NTuple::Item< long > | m_njetc |
NTuple::Item< long > | m_njettau |
NTuple::Item< float > | m_pxmiss |
NTuple::Item< float > | m_pymiss |
NTuple::Item< float > | m_pxnue |
NTuple::Item< float > | m_pynue |
NTuple::Item< float > | m_mcWeight0 |
NTuple::Item< float > | m_mcWeight1 |
NTuple::Item< float > | m_mcWeight2 |
NTuple::Item< long > | m_njet |
Jets. | |
NTuple::Array< long > | m_jetlabel |
NTuple::Array< float > | m_bjetdR |
NTuple::Array< float > | m_cjetdR |
NTuple::Array< float > | m_taujetdR |
NTuple::Array< float > | m_pxjet |
NTuple::Array< float > | m_pyjet |
NTuple::Array< float > | m_pzjet |
NTuple::Array< float > | m_eejet |
NTuple::Array< float > | m_ptcalo |
NTuple::Array< float > | m_ucorr |
NTuple::Array< float > | m_btag |
NTuple::Array< float > | m_bcorr |
NTuple::Array< float > | m_tautag |
NTuple::Array< float > | m_taucorr |
NTuple::Array< float > | m_tau1ptag |
NTuple::Array< float > | m_tau3ptag |
NTuple::Array< float > | m_tau1p3pcorr |
NTuple::Item< long > | m_nele |
Electrons. | |
NTuple::Array< long > | m_codeele |
NTuple::Array< float > | m_pxele |
NTuple::Array< float > | m_pyele |
NTuple::Array< float > | m_pzele |
NTuple::Array< float > | m_eeele |
NTuple::Item< long > | m_nmuo |
Muons. | |
NTuple::Array< long > | m_codemuo |
NTuple::Array< float > | m_pxmuo |
NTuple::Array< float > | m_pymuo |
NTuple::Array< float > | m_pzmuo |
NTuple::Array< float > | m_eemuo |
NTuple::Item< long > | m_nmux |
NTuple::Array< long > | m_codemux |
NTuple::Array< float > | m_pxmux |
NTuple::Array< float > | m_pymux |
NTuple::Array< float > | m_pzmux |
NTuple::Array< float > | m_eemux |
NTuple::Item< long > | m_npho |
Photons. | |
NTuple::Array< long > | m_codepho |
NTuple::Array< float > | m_pxpho |
NTuple::Array< float > | m_pypho |
NTuple::Array< float > | m_pzpho |
NTuple::Array< float > | m_eepho |
NTuple::Item< long > | m_npart |
Particle. | |
NTuple::Array< long > | m_kppart |
NTuple::Array< long > | m_kspart |
NTuple::Array< long > | m_kfpart |
NTuple::Array< long > | m_kpmoth |
NTuple::Array< long > | m_kfmoth |
NTuple::Array< float > | m_pxpart |
NTuple::Array< float > | m_pypart |
NTuple::Array< float > | m_pzpart |
NTuple::Array< float > | m_eepart |
NTuple::Item< long > | m_nbphys |
Bphys. | |
NTuple::Array< long > | m_kbphys |
NTuple::Array< long > | m_kfbphys |
NTuple::Array< long > | m_pxphys |
NTuple::Array< long > | m_pybphys |
NTuple::Array< long > | m_pzbphys |
NTuple::Array< long > | m_eebphys |
NTuple::Array< long > | m_vxphys |
NTuple::Array< long > | m_vybphys |
NTuple::Array< long > | m_vzbphys |
NTuple::Tuple * | p_nt1 |
Private Types | |
typedef std::vector< HepMC::GenParticle * > | t_MC_particleCollection |
typedef std::vector< HepMC::GenParticle * >::iterator | t_MC_particleIterator |
Private Member Functions | |
std::pair< int, int > | getParentCodes (MCparticleCollection::const_iterator &) |
Private Attributes | |
long | m_nEvents |
Counters for event processing. | |
TesIO * | m_tesIO |
std::string | m_mcLocation |
std::string | m_atlfastEventLocation |
member variables pointing to locations in the TES | |
std::string | m_jetLocation |
std::string | m_electronLocation |
std::string | m_isolatedMuonLocation |
std::string | m_nonIsolatedMuonLocation |
std::string | m_photonLocation |
std::string | m_trackLocation |
std::string | m_mcTruthLocation |
std::string | m_bPhysicsLocation |
std::string | m_triggerLocation |
std::string | m_eventHeaderLocation |
Definition at line 25 of file StandardNtupleMaker.h.
typedef std::vector<HepMC::GenParticle*> Atlfast::StandardNtupleMaker::t_MC_particleCollection [private] |
Definition at line 119 of file StandardNtupleMaker.h.
typedef std::vector<HepMC::GenParticle*>::iterator Atlfast::StandardNtupleMaker::t_MC_particleIterator [private] |
Definition at line 120 of file StandardNtupleMaker.h.
Atlfast::StandardNtupleMaker::StandardNtupleMaker | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Constructor: A constructor of this form must be provided.
Definition at line 53 of file StandardNtupleMaker.cxx.
00054 : Algorithm(name, pSvcLocator), 00055 p_nt1(0), 00056 m_tesIO(0) 00057 { 00058 00059 m_atlfastEventLocation = "/Event/Atlfast"; 00060 m_jetLocation = "/Event/AtlfastJets"; 00061 m_electronLocation = "/Event/AtlfastIsolatedElectrons"; 00062 m_isolatedMuonLocation = "/Event/AtlfastIsolatedMuons"; 00063 m_nonIsolatedMuonLocation = "/Event/AtlfastNonIsolatedMuons"; 00064 m_photonLocation = "/Event/AtlfastIsolatedPhotons"; 00065 // m_trackLocation = DEFAULT_trackLocation; 00066 m_mcTruthLocation = "/Event/McEventCollection"; 00067 m_bPhysicsLocation = "/Event/AtlfastBPhysics"; 00068 // m_triggerLocation = DEFAULT_triggerLocation; 00069 m_eventHeaderLocation = "/Event/AtlfastEventHeader"; 00070 00071 declareProperty( "AtlfastEventLocation", m_atlfastEventLocation ); 00072 declareProperty( "JetLocation", m_jetLocation ); 00073 declareProperty( "ElectronLocation", m_electronLocation ); 00074 declareProperty( "IsolatedMuonLocation", m_isolatedMuonLocation ); 00075 declareProperty( "NonIsolatedMuonLocation", m_nonIsolatedMuonLocation ); 00076 declareProperty( "PhotonLocation", m_photonLocation ); 00077 // declareProperty( "TrackLocation", m_trackLocation ); 00078 declareProperty( "McTruthLocation", m_mcTruthLocation ); 00079 declareProperty( "BPhysicsLocation", m_bPhysicsLocation ); 00080 // declareProperty( "TriggerLocation",m_triggerLocation ); 00081 declareProperty( "EventHeaderLocation", m_eventHeaderLocation ); 00082 00083 00084 }
Atlfast::StandardNtupleMaker::~StandardNtupleMaker | ( | ) |
StatusCode Atlfast::StandardNtupleMaker::initialize | ( | ) |
Definition at line 92 of file StandardNtupleMaker.cxx.
00092 { 00093 MsgStream log(msgSvc(), name()); 00094 log << MSG::DEBUG << "Initialising SNM" << endreq; 00095 StatusCode status; 00096 00097 m_nEvents = 0; 00098 // 00099 log << MSG::DEBUG << "Ntuple call 51" << endreq; 00100 NTuple::Directory* col = 0; 00101 log << MSG::DEBUG << "About to open ntuple file" << endreq; 00102 NTupleFilePtr file1(ntupleSvc(), "/NTUPLES/FILE1"); 00103 if ( file1 ) { 00104 log << MSG::DEBUG << "Opened ntuple file" << endreq; 00105 if ( !(col=ntupleSvc()->createDirectory("/NTUPLES/FILE1/Atlfast")) ) { 00106 log << MSG::ERROR << "Cannot create directory /NTUPLES/FILE1/Atlfast" 00107 << endreq; 00108 return StatusCode::FAILURE; 00109 }else{ 00110 log << MSG::DEBUG << "Created ntuple directory" << endreq; 00111 } 00112 } 00113 else { 00114 log << MSG::ERROR << "Cannot access file /NTUPLES/FILE1" << endreq; 00115 return StatusCode::FAILURE; 00116 } 00117 // First: A column wise N tuple 00118 NTuplePtr nt1(ntupleSvc(), "/NTUPLES/FILE1/Atlfast/51"); 00119 if ( !nt1 ) { // Check if already booked 00120 nt1 = ntupleSvc()->book (col, 51, CLID_ColumnWiseTuple, "Atlfast51"); 00121 if ( nt1 ) { 00122 log << MSG::DEBUG << "booked ntuple " << endreq; 00123 // Add an index column 00124 // Electrons 00125 status = nt1->addItem ("PLEPTONS/NELE" , m_nele, 0, 12 ); 00126 status = nt1->addItem ("PLEPTONS/KFELE" , m_nele, m_codeele); 00127 status = nt1->addItem ("PLEPTONS/PXELE" , m_nele, m_pxele); 00128 status = nt1->addItem ("PLEPTONS/PYELE" , m_nele, m_pyele); 00129 status = nt1->addItem ("PLEPTONS/PZELE" , m_nele, m_pzele); 00130 status = nt1->addItem ("PLEPTONS/EEELE" , m_nele, m_eeele); 00131 // Photons 00132 status = nt1->addItem ("PPHOTONS/NPHO" , m_npho, 0, 12 ); 00133 status = nt1->addItem ("PPHOTONS/KFPHO" , m_npho, m_codepho); 00134 status = nt1->addItem ("PPHOTONS/PXPHO" , m_npho, m_pxpho); 00135 status = nt1->addItem ("PPHOTONS/PYPHO" , m_npho, m_pypho); 00136 status = nt1->addItem ("PPHOTONS/PZPHO" , m_npho, m_pzpho); 00137 status = nt1->addItem ("PPHOTONS/EEPHO" , m_npho, m_eepho); 00138 // Muons (isolated) 00139 status = nt1->addItem ("PLEPTONS/NMUO" , m_nmuo, 0, 12 ); 00140 status = nt1->addItem ("PLEPTONS/KFMUO" , m_nmuo, m_codemuo); 00141 status = nt1->addItem ("PLEPTONS/PXMUO" , m_nmuo, m_pxmuo); 00142 status = nt1->addItem ("PLEPTONS/PYMUO" , m_nmuo, m_pymuo); 00143 status = nt1->addItem ("PLEPTONS/PZMUO" , m_nmuo, m_pzmuo); 00144 status = nt1->addItem ("PLEPTONS/EEMUO" , m_nmuo, m_eemuo); 00145 // MuonsX (non-isolated) 00146 status = nt1->addItem ("PMUXS/NMUX" , m_nmux, 0, 12 ); 00147 status = nt1->addItem ("PMUXS/KFMUX" , m_nmux, m_codemux); 00148 status = nt1->addItem ("PMUXS/PXMUX" , m_nmux, m_pxmux); 00149 status = nt1->addItem ("PMUXS/PYMUX" , m_nmux, m_pymux); 00150 status = nt1->addItem ("PMUXS/PZMUX" , m_nmux, m_pzmux); 00151 status = nt1->addItem ("PMUXS/EEMUX" , m_nmux, m_eemux); 00152 // Jets 00153 status = nt1->addItem ("PPJETS/NJET" , m_njet, 0, 40 ); 00154 status = nt1->addItem ("PPJETS/KFJET" , m_njet, m_jetlabel); 00155 status = nt1->addItem ("PPJETS/PXJET" , m_njet, m_pxjet); 00156 status = nt1->addItem ("PPJETS/PYJET" , m_njet, m_pyjet); 00157 status = nt1->addItem ("PPJETS/PZJET" , m_njet, m_pzjet); 00158 status = nt1->addItem ("PPJETS/EEJET" , m_njet, m_eejet); 00159 status = nt1->addItem ("PPJETS/BJETDR" , m_njet, m_bjetdR); 00160 status = nt1->addItem ("PPJETS/CJETDR" , m_njet, m_cjetdR); 00161 status = nt1->addItem ("PPJETS/TAUJETDR" , m_njet, m_taujetdR); 00162 status = nt1->addItem ("PPJETS/PTCALO" , m_njet, m_ptcalo); 00163 status = nt1->addItem ("PPJETS/UCORR" , m_njet, m_ucorr); 00164 status = nt1->addItem ("PPJETS/BTAG" , m_njet, m_btag); 00165 status = nt1->addItem ("PPJETS/BCORR" , m_njet, m_bcorr); 00166 status = nt1->addItem ("PPJETS/TAUTAG" , m_njet, m_tautag); 00167 status = nt1->addItem ("PPJETS/TAUCORR" , m_njet, m_taucorr); 00168 status = nt1->addItem ("PPJETS/TAU1PTAG" , m_njet, m_tau1ptag); 00169 status = nt1->addItem ("PPJETS/TAU3PTAG" , m_njet, m_tau3ptag); 00170 status = nt1->addItem ("PPJETS/TAU1P3PCORR", m_njet, m_tau1p3pcorr); 00171 // History 00172 status = nt1->addItem ("PHISTORY/NPART" , m_npart, 0, 40 ); 00173 status = nt1->addItem ("PHISTORY/KPPART" , m_npart, m_kppart); 00174 status = nt1->addItem ("PHISTORY/KSPART" , m_npart, m_kspart); 00175 status = nt1->addItem ("PHISTORY/KFPART" , m_npart, m_kfpart); 00176 status = nt1->addItem ("PHISTORY/KPMOTH" , m_npart, m_kpmoth); 00177 status = nt1->addItem ("PHISTORY/KFMOTH" , m_npart, m_kfmoth); 00178 status = nt1->addItem ("PHISTORY/PXPART" , m_npart, m_pxpart); 00179 status = nt1->addItem ("PHISTORY/PYPART" , m_npart, m_pypart); 00180 status = nt1->addItem ("PHISTORY/PZPART" , m_npart, m_pzpart); 00181 status = nt1->addItem ("PHISTORY/EEPART" , m_npart, m_eepart); 00182 // Missing 00183 status = nt1->addItem ("INFO/ISUB" , m_isub); 00184 status = nt1->addItem ("INFO/JETB" , m_njetb); 00185 status = nt1->addItem ("INFO/JETC" , m_njetc); 00186 status = nt1->addItem ("INFO/JETTAU" , m_njettau); 00187 status = nt1->addItem ("PMISSING/PXMISS" , m_pxmiss); 00188 status = nt1->addItem ("PMISSING/PYMISS" , m_pymiss); 00189 status = nt1->addItem ("PMISSING/PXNUE" , m_pxnue); 00190 status = nt1->addItem ("PMISSING/PYNUE" , m_pynue); 00191 status = nt1->addItem ("MCWEIGHT/W0" , m_mcWeight0); 00192 status = nt1->addItem ("MCWEIGHT/W1" , m_mcWeight1); 00193 status = nt1->addItem ("MCWEIGHT/W2" , m_mcWeight2); 00194 //tracks 00195 //status = nt1->addItem ("PTRACKS/NTRA" , m_ntra, 0, 500 ); 00196 //status = nt1->addItem ("PTRACKS/KPTRA" , m_ntra, m_kpTruth); 00197 //status = nt1->addItem ("PTRACKS/KFTRA" , m_ntra, m_kfTruth); 00198 // 00199 //status = nt1->addItem ("PTRACKS/KPM1TRA" , m_ntra, m_kpm1tra); 00200 //status = nt1->addItem ("PTRACKS/KFM1TRA" , m_ntra, m_kfm1tra); 00201 //status = nt1->addItem ("PTRACKS/KPM2TRA" , m_ntra, m_kpm2tra); 00202 //status = nt1->addItem ("PTRACKS/KFM2TRA" , m_ntra, m_kfm2tra); 00203 //status = nt1->addItem ("PTRACKS/KPM3TRA" , m_ntra, m_kpm3tra); 00204 //status = nt1->addItem ("PTRACKS/KFM3TRA" , m_ntra, m_kfm3tra); 00205 //status = nt1->addItem ("PTRACKS/KPM4TRA" , m_ntra, m_kpm4tra); 00206 //status = nt1->addItem ("PTRACKS/KFM4TRA" , m_ntra, m_kfm4tra); 00207 //status = nt1->addItem ("PTRACKS/KPM5TRA" , m_ntra, m_kpm5tra); 00208 //status = nt1->addItem ("PTRACKS/KFM5TRA" , m_ntra, m_kfm5tra); 00209 //status = nt1->addItem ("PTRACKS/KPM6TRA" , m_ntra, m_kpm6tra); 00210 //status = nt1->addItem ("PTRACKS/KFM6TRA" , m_ntra, m_kfm6tra); 00211 // 00212 //status = nt1->addItem ("PTRACKS/D0TRA " , m_ntra, m_d0Truth); 00213 //status = nt1->addItem ("PTRACKS/Z0TRA " , m_ntra, m_z0Truth); 00214 //status = nt1->addItem ("PTRACKS/PHITRA " , m_ntra, m_phiTruth); 00215 //status = nt1->addItem ("PTRACKS/COTTRA " , m_ntra, m_cotTruth); 00216 //status = nt1->addItem ("PTRACKS/PTINVTRA " , m_ntra, m_ptInvTruth); 00217 // 00218 //status = nt1->addItem ("PTRACKS/D0TRACRU " , m_ntra, m_d0Track); 00219 //status = nt1->addItem ("PTRACKS/Z0TRACRU " , m_ntra, m_z0Track); 00220 //status = nt1->addItem ("PTRACKS/PHITRACRU " , m_ntra, m_phiTrack); 00221 //status = nt1->addItem ("PTRACKS/COTTRACRU " , m_ntra, m_cotTrack); 00222 //status = nt1->addItem ("PTRACKS/PTINVTRACRU " , m_ntra, m_ptInvTrack); 00223 // 00224 //status = nt1->addItem ("PTRACKS/CORR11TRA " , m_ntra, m_corr11tra); 00225 //status = nt1->addItem ("PTRACKS/CORR21TRA " , m_ntra, m_corr12tra); 00226 //status = nt1->addItem ("PTRACKS/CORR31TRA " , m_ntra, m_corr13tra); 00227 //status = nt1->addItem ("PTRACKS/CORR41TRA " , m_ntra, m_corr14tra); 00228 //status = nt1->addItem ("PTRACKS/CORR51TRA " , m_ntra, m_corr15tra); 00229 //status = nt1->addItem ("PTRACKS/CORR22TRA " , m_ntra, m_corr22tra); 00230 //status = nt1->addItem ("PTRACKS/CORR23TRA " , m_ntra, m_corr23tra); 00231 //status = nt1->addItem ("PTRACKS/CORR24TRA " , m_ntra, m_corr24tra); 00232 //status = nt1->addItem ("PTRACKS/CORR25TRA " , m_ntra, m_corr25tra); 00233 //status = nt1->addItem ("PTRACKS/CORR33TRA " , m_ntra, m_corr33tra); 00234 //status = nt1->addItem ("PTRACKS/CORR34TRA " , m_ntra, m_corr34tra); 00235 //status = nt1->addItem ("PTRACKS/CORR34TRA " , m_ntra, m_corr34tra); 00236 //status = nt1->addItem ("PTRACKS/CORR35TRA " , m_ntra, m_corr35tra); 00237 //status = nt1->addItem ("PTRACKS/CORR44TRA " , m_ntra, m_corr44tra); 00238 //status = nt1->addItem ("PTRACKS/CORR45TRA " , m_ntra, m_corr45tra); 00239 //status = nt1->addItem ("PTRACKS/CORR55TRA " , m_ntra, m_corr55tra); 00240 } 00241 else { // did not manage to book the N tuple.... 00242 return StatusCode::FAILURE; 00243 } 00244 } 00245 00246 log<<MSG::DEBUG<<"returning sith status"<< status<<endreq; 00247 00248 00249 GlobalEventData* ged = GlobalEventData::Instance(); 00250 // load the location of the MC in StoreGate 00251 m_mcLocation = ged -> mcLocation(); 00252 00253 // m_tesIO = new TesIO(eventDataService()); 00254 m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter()); 00255 00256 HeaderPrinter hp("Atlfast StandardNtuleMaker:", log); 00257 hp.add("MC location ", m_mcTruthLocation); 00258 hp.add("Electron Location ", m_electronLocation); 00259 hp.add("Photon Location ", m_photonLocation); 00260 hp.add("Isolated Muon Location ", m_isolatedMuonLocation); 00261 hp.add("Non-Isolated Muon Location ", m_nonIsolatedMuonLocation); 00262 hp.add("Jet Location ", m_jetLocation); 00263 hp.add("EventHeaderLocation ", m_eventHeaderLocation ); 00264 hp.print(); 00265 // declareProperty( "TriggerLocation",m_triggerLocation ); 00266 00267 00268 return StatusCode::SUCCESS; 00269 }
StatusCode Atlfast::StandardNtupleMaker::execute | ( | ) |
Definition at line 272 of file StandardNtupleMaker.cxx.
00272 { 00273 // This just makes the code below a bit easier to read (and type) 00274 MsgStream log(msgSvc(), name()); 00275 log << MSG::DEBUG << "****Start execute()****" << endreq; 00276 00277 // Counter of events processed 00278 if( m_nEvents % 50 == 0) { 00279 log << MSG::INFO << " processing event number " 00280 << m_nEvents << endreq; 00281 } 00282 00283 m_nEvents++; 00284 00285 StatusCode status; 00286 00287 //------------------- 00288 // Retrieve Electrons 00289 //------------------- 00290 std::vector<ReconstructedParticle*> rp; 00291 if(!m_tesIO->copy<ReconstructedParticleCollection>(rp,m_electronLocation)){ 00292 log <<MSG::DEBUG << "Could not find Electrons"<<endreq; 00293 } 00294 log << MSG::DEBUG << "processing Electrons: " <<rp.size()<< endreq; 00295 00296 std::vector<ReconstructedParticle*>::const_iterator irp = rp.begin(); 00297 00298 m_nele = 0; 00299 for (; irp != rp.end(); ++irp) { 00300 m_codeele[m_nele] = (*irp)->pdg_id(); 00301 m_pxele[m_nele] = (*irp)->momentum().px(); 00302 m_pyele[m_nele] = (*irp)->momentum().py(); 00303 m_pzele[m_nele] = (*irp)->momentum().pz(); 00304 m_eeele[m_nele] = (*irp)->momentum().e(); 00305 if (++m_nele == m_nele->range().distance() ) { 00306 log << MSG::WARNING << "Electron list truncated in Ntuple" << endreq; 00307 break; 00308 } 00309 } 00310 00311 //------------------- 00312 // Retrieve Photons 00313 //------------------- 00314 00315 rp.clear(); 00316 if(!m_tesIO->copy <ReconstructedParticleCollection>(rp, m_photonLocation)){ 00317 log <<MSG::DEBUG << "Could not find Photons"<<endreq; 00318 } 00319 log << MSG::DEBUG << "processing Photons: " <<rp.size()<< endreq; 00320 00321 irp = rp.begin(); 00322 00323 m_npho = 0; 00324 for (; irp != rp.end(); ++irp) { 00325 m_codepho[m_npho] = (*irp)->pdg_id(); 00326 m_pxpho[m_npho] = (*irp)->momentum().px(); 00327 m_pypho[m_npho] = (*irp)->momentum().py(); 00328 m_pzpho[m_npho] = (*irp)->momentum().pz(); 00329 m_eepho[m_npho] = (*irp)->momentum().e(); 00330 if (++m_npho == m_npho->range().distance() ) { 00331 log << MSG::WARNING << "Photon list truncated in Ntuple" << endreq; 00332 break; 00333 } 00334 } 00335 00336 //------------------- 00337 // Retrieve Isolated Muons 00338 //------------------- 00339 00340 rp.clear(); 00341 if(!m_tesIO->copy 00342 <ReconstructedParticleCollection>(rp, m_isolatedMuonLocation)){ 00343 log <<MSG::DEBUG << "Could not find Isolated Muons"<<endreq; 00344 } 00345 log << MSG::DEBUG << "Isolated Muons: " <<rp.size()<< endreq; 00346 00347 irp = rp.begin(); 00348 00349 m_nmuo = 0; 00350 00351 for (; irp != rp.end(); ++irp) { 00352 m_codemuo[m_nmuo] = (*irp)->pdg_id(); 00353 m_pxmuo[m_nmuo] = (*irp)->momentum().px(); 00354 m_pymuo[m_nmuo] = (*irp)->momentum().py(); 00355 m_pzmuo[m_nmuo] = (*irp)->momentum().pz(); 00356 m_eemuo[m_nmuo] = (*irp)->momentum().e(); 00357 if (++m_nmuo == m_nmuo->range().distance() ) { 00358 log << MSG::WARNING 00359 << "Isolated Muon list truncated in Ntuple" << endreq; 00360 break; 00361 } 00362 } 00363 00364 //------------------- 00365 // Retrieve NonIsolated Muons 00366 //------------------- 00367 00368 rp.clear(); 00369 if(!m_tesIO->copy 00370 <ReconstructedParticleCollection >(rp, m_nonIsolatedMuonLocation)){ 00371 log <<MSG::DEBUG << "Could not find non Isolated muons"<<endreq; 00372 } 00373 log << MSG::DEBUG << "NonIsolated Muons: " <<rp.size()<< endreq; 00374 irp = rp.begin(); 00375 00376 m_nmux = 0; 00377 00378 for (; irp != rp.end(); ++irp) { 00379 m_codemux[m_nmux] = (*irp)->pdg_id(); 00380 m_pxmux[m_nmux] = (*irp)->momentum().px(); 00381 m_pymux[m_nmux] = (*irp)->momentum().py(); 00382 m_pzmux[m_nmux] = (*irp)->momentum().pz(); 00383 m_eemux[m_nmux] = (*irp)->momentum().e(); 00384 if (++m_nmux == m_nmux->range().distance() ) { 00385 log << MSG::WARNING 00386 << "Non-isolated Muon list truncated in Ntuple" << endreq; 00387 break; 00388 } 00389 } 00390 00391 //------------------- 00392 // Retrieve Jets 00393 //------------------- 00394 00395 std::vector<Jet*> jv; 00396 if(!m_tesIO->copy<JetCollection >(jv, m_jetLocation)){ 00397 log <<MSG::DEBUG << "Could not find Jets"<<endreq; 00398 } 00399 log << MSG::DEBUG << "Processing Jets: " <<jv.size()<< endreq; 00400 00401 std::vector<Jet*>::const_iterator ijv = jv.begin(); 00402 00403 m_njet = 0; 00404 00405 for (; ijv != jv.end(); ++ijv) { 00406 m_jetlabel[m_njet] = (*ijv)->pdg_id(); 00407 m_pxjet[m_njet] = (*ijv)->px(); 00408 m_pyjet[m_njet] = (*ijv)->py(); 00409 m_pzjet[m_njet] = (*ijv)->pz(); 00410 m_eejet[m_njet] = (*ijv)->e(); 00411 m_bjetdR[m_njet] = (*ijv)->getdRbquark(); 00412 m_cjetdR[m_njet] = (*ijv)->getdRcquark(); 00413 m_taujetdR[m_njet] = (*ijv)->getdRhadtau(); 00414 m_ptcalo[m_njet] = (*ijv)->pT(); 00415 m_ucorr[m_njet] = (*ijv)->lTagCorrFactor(); 00416 m_btag[m_njet] = (*ijv)->isBTagged() ? 1. : 0.; 00417 m_bcorr[m_njet] = (*ijv)->bTagCorrFactor(); 00418 m_tautag[m_njet] = (*ijv)->isTauTagged("Standard") ? 1. : 0.; 00419 m_taucorr[m_njet] = (*ijv)->tauTagCorrFactor("Tau"); 00420 m_tau1ptag[m_njet] = (*ijv)->isTauTagged("Tau1P3P:1prong") ? 1. : 0.; 00421 m_tau3ptag[m_njet] = (*ijv)->isTauTagged("Tau1P3P:3prong") ? 1. : 0.; 00422 m_tau1p3pcorr[m_njet] = (*ijv)->tauTagCorrFactor("Tau1P3P"); 00423 if ( ++m_njet == m_njet->range().distance() ) break; 00424 } 00425 log << MSG::DEBUG << " Jets in ntuple" << endreq; 00426 00427 00428 //------------------- 00429 // Retrieve Status 21 quarks (fudged with final state collector FIXME) 00430 //------------------- 00431 //***PS std::vector<HepMC::GenParticle*> mc; 00432 //***PS m_tesIO->getMC( mc, m_mcTruthLocation, &isf) ; 00433 //***PS 00434 //***PS log << MSG::DEBUG << "Processing partons" <<mc.size()<< endreq; 00435 //***PS 00436 //***PS std::vector<HepMC::GenParticle*>::const_iterator imc = mc.begin(); 00437 00438 MCparticleCollection mc; 00439 // TesIoStat stat = m_tesIO->getMC(mc, &isf); 00440 00441 HepMC_helper::All* all= new HepMC_helper::All; 00442 TesIoStat stat = m_tesIO->getMC(mc, all); 00443 delete all; 00444 00445 if(stat){ 00446 log << MSG::DEBUG << " found MC truth" << endreq; 00447 }else{ 00448 log << MSG::ERROR << " MC truth not found in TES" << endreq; 00449 } 00450 00451 MCparticleCollection::const_iterator imc = mc.begin(); 00452 m_npart=0; 00453 00454 HepMC_helper::IsStatusxx isf(3); 00455 00456 for(;imc != mc.end(); ++imc){ 00457 if(isf(*imc)){ 00458 m_kppart[m_npart] = (*imc)->barcode(); 00459 m_kspart[m_npart] = (*imc)->status()%100; 00460 m_kfpart[m_npart] = (*imc)->pdg_id(); 00461 std::pair<int, int> parentCodes = getParentCodes(imc); 00462 m_kfmoth[m_npart] = parentCodes.first; 00463 m_kpmoth[m_npart] = parentCodes.second; 00464 //}else{ 00465 m_pxpart[m_npart] = (*imc)->momentum().x(); 00466 m_pypart[m_npart] = (*imc)->momentum().y(); 00467 m_pzpart[m_npart] = (*imc)->momentum().z(); 00468 m_eepart[m_npart] = (*imc)->momentum().e(); 00469 ++m_npart; 00470 } 00471 00472 if ( m_npart == m_npart->range().distance() ) break; 00473 00474 // m_kfpart[m_npart] = (*imc)->pdg_id(); 00475 // m_pxpart[m_npart] = (*imc)->momentum().x(); 00476 // m_pypart[m_npart] = (*imc)->momentum().y(); 00477 // m_pzpart[m_npart] = (*imc)->momentum().z(); 00478 // m_eepart[m_npart] = (*imc)->momentum().e(); 00479 } 00480 00481 log << MSG::DEBUG << " Particles in ntuple" << endreq; 00482 00483 const EventHeader* theEventHeader(0); 00484 00485 if(!(m_tesIO->getDH(theEventHeader))){ 00486 log << MSG::ERROR<<"Could not find the event header in the TES"<<endreq; 00487 } 00488 00489 if(theEventHeader){ 00490 m_isub = 0; 00491 m_njetb = theEventHeader->nBJets(); 00492 m_njetc = theEventHeader->nCJets(); 00493 m_njettau = theEventHeader->nTauJets(); 00494 m_pxmiss = theEventHeader->pMiss().x(); 00495 m_pymiss = theEventHeader->pMiss().y(); 00496 m_pxnue = theEventHeader->pEscaped().x(); 00497 m_pynue = theEventHeader->pEscaped().y(); 00498 00499 00500 MCweightContainer weights = theEventHeader->firstFewWeights(3); 00501 // MCweightContainer weights(3, 0.); 00502 m_mcWeight0 = weights[0]; 00503 m_mcWeight1 = weights[1]; 00504 m_mcWeight2 = weights[2]; 00505 } else { 00506 log << MSG::ERROR << " Invalid EventHeader data handle" << endreq; 00507 } 00508 00509 log << MSG::DEBUG << " EventHeader quantities are in ntuple" << endreq; 00510 00511 // Write out ntuples 00512 00513 log << MSG::DEBUG << "Writing ntuple part 51" << endreq; 00514 status = ntupleSvc()->writeRecord("/NTUPLES/FILE1/Atlfast/51"); 00515 if ( !status.isSuccess() ) log <<MSG::ERROR 00516 <<"Cannot fill id 51" 00517 <<endreq; 00518 log << MSG::DEBUG << "Done all the ntuple writing" << endreq; 00519 return StatusCode::SUCCESS; 00520 }
StatusCode Atlfast::StandardNtupleMaker::finalize | ( | ) |
Definition at line 540 of file StandardNtupleMaker.cxx.
00540 { 00541 00542 MsgStream log(msgSvc(), name()); 00543 log << MSG::INFO << " Number of events processed = " << m_nEvents << endreq; 00544 00545 return StatusCode::SUCCESS; 00546 }
std::pair< int, int > Atlfast::StandardNtupleMaker::getParentCodes | ( | MCparticleCollection::const_iterator & | ) | [private] |
method to get particle parents. return contains pdg id, barcode returns (0,0) if parent is unavailable.
Definition at line 522 of file StandardNtupleMaker.cxx.
00523 { 00524 00525 HepMC::GenVertex* gv = (*imc)->production_vertex(); 00526 if ( gv == 0 ){ return std::pair<int, int>(0,0);} 00527 00528 if ( gv->particles_in_size() == 0 ) { return std::pair<int, int>(0,0); } 00529 00530 HepMC::GenVertex::particle_iterator 00531 pi = gv->particles_begin(HepMC::parents); 00532 if( *pi == 0 ){ return std::pair<int, int>(0,0); } 00533 00534 00535 return std::pair<int, int>( (*pi)->pdg_id(), (*pi)->barcode() ); 00536 }
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_isub [protected] |
Items for the column wise n-tuple Miscs
Definition at line 29 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_njetb [protected] |
Definition at line 30 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_njetc [protected] |
Definition at line 30 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_njettau [protected] |
Definition at line 30 of file StandardNtupleMaker.h.
NTuple::Item<float> Atlfast::StandardNtupleMaker::m_pxmiss [protected] |
Definition at line 31 of file StandardNtupleMaker.h.
NTuple::Item<float> Atlfast::StandardNtupleMaker::m_pymiss [protected] |
Definition at line 31 of file StandardNtupleMaker.h.
NTuple::Item<float> Atlfast::StandardNtupleMaker::m_pxnue [protected] |
Definition at line 31 of file StandardNtupleMaker.h.
NTuple::Item<float> Atlfast::StandardNtupleMaker::m_pynue [protected] |
Definition at line 31 of file StandardNtupleMaker.h.
NTuple::Item<float> Atlfast::StandardNtupleMaker::m_mcWeight0 [protected] |
Definition at line 32 of file StandardNtupleMaker.h.
NTuple::Item<float> Atlfast::StandardNtupleMaker::m_mcWeight1 [protected] |
Definition at line 32 of file StandardNtupleMaker.h.
NTuple::Item<float> Atlfast::StandardNtupleMaker::m_mcWeight2 [protected] |
Definition at line 32 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_njet [protected] |
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_jetlabel [protected] |
Definition at line 35 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_bjetdR [protected] |
Definition at line 36 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_cjetdR [protected] |
Definition at line 36 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_taujetdR [protected] |
Definition at line 36 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pxjet [protected] |
Definition at line 37 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pyjet [protected] |
Definition at line 37 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pzjet [protected] |
Definition at line 37 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_eejet [protected] |
Definition at line 37 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_ptcalo [protected] |
Definition at line 38 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_ucorr [protected] |
Definition at line 38 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_btag [protected] |
Definition at line 39 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_bcorr [protected] |
Definition at line 39 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_tautag [protected] |
Definition at line 40 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_taucorr [protected] |
Definition at line 40 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_tau1ptag [protected] |
Definition at line 41 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_tau3ptag [protected] |
Definition at line 41 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_tau1p3pcorr [protected] |
Definition at line 41 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_nele [protected] |
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_codeele [protected] |
Definition at line 44 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pxele [protected] |
Definition at line 45 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pyele [protected] |
Definition at line 45 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pzele [protected] |
Definition at line 45 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_eeele [protected] |
Definition at line 45 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_nmuo [protected] |
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_codemuo [protected] |
Definition at line 48 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pxmuo [protected] |
Definition at line 49 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pymuo [protected] |
Definition at line 49 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pzmuo [protected] |
Definition at line 49 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_eemuo [protected] |
Definition at line 49 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_nmux [protected] |
Definition at line 50 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_codemux [protected] |
Definition at line 51 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pxmux [protected] |
Definition at line 52 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pymux [protected] |
Definition at line 52 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pzmux [protected] |
Definition at line 52 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_eemux [protected] |
Definition at line 52 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_npho [protected] |
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_codepho [protected] |
Definition at line 55 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pxpho [protected] |
Definition at line 56 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pypho [protected] |
Definition at line 56 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pzpho [protected] |
Definition at line 56 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_eepho [protected] |
Definition at line 56 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_npart [protected] |
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_kppart [protected] |
Definition at line 76 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_kspart [protected] |
Definition at line 76 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_kfpart [protected] |
Definition at line 76 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_kpmoth [protected] |
Definition at line 77 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_kfmoth [protected] |
Definition at line 77 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pxpart [protected] |
Definition at line 78 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pypart [protected] |
Definition at line 78 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_pzpart [protected] |
Definition at line 78 of file StandardNtupleMaker.h.
NTuple::Array<float> Atlfast::StandardNtupleMaker::m_eepart [protected] |
Definition at line 78 of file StandardNtupleMaker.h.
NTuple::Item<long> Atlfast::StandardNtupleMaker::m_nbphys [protected] |
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_kbphys [protected] |
Definition at line 81 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_kfbphys [protected] |
Definition at line 81 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_pxphys [protected] |
Definition at line 82 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_pybphys [protected] |
Definition at line 82 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_pzbphys [protected] |
Definition at line 82 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_eebphys [protected] |
Definition at line 82 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_vxphys [protected] |
Definition at line 83 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_vybphys [protected] |
Definition at line 83 of file StandardNtupleMaker.h.
NTuple::Array<long> Atlfast::StandardNtupleMaker::m_vzbphys [protected] |
Definition at line 83 of file StandardNtupleMaker.h.
NTuple::Tuple* Atlfast::StandardNtupleMaker::p_nt1 [protected] |
Definition at line 87 of file StandardNtupleMaker.h.
long Atlfast::StandardNtupleMaker::m_nEvents [private] |
TesIO* Atlfast::StandardNtupleMaker::m_tesIO [private] |
Definition at line 103 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_mcLocation [private] |
Definition at line 105 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_atlfastEventLocation [private] |
member variables pointing to locations in the TES
Definition at line 107 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_jetLocation [private] |
Definition at line 108 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_electronLocation [private] |
Definition at line 109 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_isolatedMuonLocation [private] |
Definition at line 110 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_nonIsolatedMuonLocation [private] |
Definition at line 111 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_photonLocation [private] |
Definition at line 112 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_trackLocation [private] |
Definition at line 113 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_mcTruthLocation [private] |
Definition at line 114 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_bPhysicsLocation [private] |
Definition at line 115 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_triggerLocation [private] |
Definition at line 116 of file StandardNtupleMaker.h.
std::string Atlfast::StandardNtupleMaker::m_eventHeaderLocation [private] |
Definition at line 117 of file StandardNtupleMaker.h.