#include <ReconstructedParticleHistogramMaker.h>
Collaboration diagram for Atlfast::ReconstructedParticleHistogramMaker:
Public Methods | |
ReconstructedParticleHistogramMaker (const std::string &name, ISvcLocator *pSvcLocator) | |
~ReconstructedParticleHistogramMaker () | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Methods | |
void | book (std::vector< IHistogram1D * > &start, const std::string title, const int nbins, const double xmin, const double xmax, const double xminDiff, const double xmaxDiff) |
void | fill (std::vector< IHistogram1D * > &start, const double rec, const double tru) |
Private Attributes | |
TesIO * | m_tesIO |
std::string | m_inputLocation |
std::string | m_mcTruthLocation |
std::vector< IHistogram1D * > | m_h_multiplicity |
std::vector< IHistogram1D * > | m_h_energy |
std::vector< IHistogram1D * > | m_h_pt |
std::vector< IHistogram1D * > | m_h_eta |
std::vector< IHistogram1D * > | m_h_phi |
std::vector< IHistogram1D * > | m_h_theta |
int | m_histStart |
int | m_nHist |
int | m_particleType |
std::string | m_histTitle |
HepMC_helper::IMCselector * | m_ncutter |
Definition at line 55 of file ReconstructedParticleHistogramMaker.h.
|
Definition at line 48 of file ReconstructedParticleHistogramMaker.cxx.
00049 : Algorithm( name, pSvcLocator ){ 00050 00051 00052 00053 00054 // Default paths for entities in the TES 00055 m_inputLocation = "/Event/Electrons"; 00056 m_mcTruthLocation = "/Event/McEventCollection"; 00057 00058 00059 m_histStart = 0; // ID of first histogram 00060 m_particleType = 11; // Default particle type to examine 00061 m_histTitle = "Electron "; // Default prefixfor histogram titles 00062 00063 declareProperty( "InputLocation", m_inputLocation ) ; 00064 declareProperty( "McTruthLocation", m_mcTruthLocation ); 00065 declareProperty( "HistogramStart", m_histStart ); 00066 declareProperty( "ParticleType", m_particleType ); 00067 declareProperty( "HistogramTitle", m_histTitle ); 00068 00069 } |
|
Definition at line 72 of file ReconstructedParticleHistogramMaker.cxx.
00072 {
00073 MsgStream log(messageService(), name());
00074 log << MSG::INFO << "destructor" << endreq;
00075
00076 }
|
|
Definition at line 83 of file ReconstructedParticleHistogramMaker.cxx. References book(), m_h_energy, m_h_eta, m_h_multiplicity, m_h_phi, m_h_pt, m_h_theta, m_histStart, m_ncutter, m_nHist, m_particleType, and m_tesIO.
00084 { 00085 // .. put any initialisation in here... 00086 MsgStream log(messageService(), name()); 00087 log << MSG::DEBUG << "in initialize()" << endreq; 00088 00089 m_nHist = m_histStart; 00090 00091 book(m_h_multiplicity, string("Multiplicity"),20,0.0,20.0,-5.0, 5.0); 00092 log << MSG::DEBUG << "Made multiplicity histos" << endreq; 00093 00094 book(m_h_energy, string("Energy"),100,0.0,500.0,-10.0, 10.0); 00095 log << MSG::DEBUG << "Made energy histos" << endreq; 00096 00097 book(m_h_pt, string("Pt"), 100,0.0,500.0,-10.0,10.0); 00098 log << MSG::DEBUG << "Made pt histos" << endreq; 00099 00100 book(m_h_eta, string("Eta"), 100,-3.0,3.0,-0.2,0.2); 00101 log << MSG::DEBUG << "Made eta histos" << endreq; 00102 00103 book(m_h_phi, string("Phi"),20,-M_PI,M_PI,-0.1,0.1); 00104 log << MSG::DEBUG << "Made phi histos" << endreq; 00105 00106 book(m_h_theta, string("Theta"),20,0.0,M_PI,-0.1,0.1); 00107 log << MSG::DEBUG << "Made thetahistos" << endreq; 00108 00109 00110 log << MSG::DEBUG << "Booked histograms OK" << endreq; 00111 // m_tesIO = new TesIO(eventDataService()); 00112 m_tesIO = new TesIO(); 00113 00114 // Set up NCutter to select the required HepMC::GenParticles 00115 typedef HepMC_helper::IMCselector Selector; 00116 00117 Selector* typeSelector = new HepMC_helper::SelectType( m_particleType); 00118 Selector* kineSelector = new HepMC_helper::MCCuts(m_mcPtMin, m_mcEtaMax); 00119 Selector* fstaSelector = new HepMC_helper::IsFinalState(); 00120 00121 vector<HepMC_helper::IMCselector*> selectors; 00122 selectors.push_back(fstaSelector); 00123 selectors.push_back(typeSelector); 00124 selectors.push_back(kineSelector); 00125 00126 m_ncutter = new HepMC_helper::NCutter(selectors); 00127 00128 delete typeSelector; 00129 delete fstaSelector; 00130 delete kineSelector; 00131 //======================================================= 00132 00133 return StatusCode::SUCCESS ; 00134 } |
|
Definition at line 158 of file ReconstructedParticleHistogramMaker.cxx. References fill(), m_h_energy, m_h_eta, m_h_multiplicity, m_h_phi, m_h_pt, m_h_theta, m_inputLocation, m_ncutter, and m_tesIO.
00159 { 00160 00161 //................................ 00162 // make a message logging stream 00163 00164 MsgStream log( messageService(), name() ) ; 00165 log << MSG::DEBUG << "Executing " << endreq; 00166 00167 // Access the reconstructed particles in the TES 00168 std::vector<ReconstructedParticle*> myParticles; 00169 // Access the collection of "McEvent" records in the TES 00170 std::vector<McEvent*> mcEvents; 00171 00172 00173 //Get the MC truth list 00174 MCparticleCollection myMC_particles ; 00175 MCparticleCollectionCIter src ; 00176 00177 TesIoStat stat = m_tesIO->getMC( myMC_particles, m_ncutter ) ; 00178 mess = stat? "Retrieved MC from TES ":"Failed MC retrieve from TES"; 00179 log << MSG::DEBUG << mess << endreq; 00180 00181 00182 //check to see whether any reconstructed particles are found at the requested location 00183 if(!m_tesIO->copy(myParticles, m_inputLocation)){ 00184 log << MSG::DEBUG << "no particles found in the TES. This is probably normal" << endreq; 00185 // fill any histograms that have meaning in the absence of rec particles 00186 fill(m_h_multiplicity,0.0,float(myMC_particles.size()) ); 00187 //log << MSG::DEBUG 00188 //<< "filled multiplicity 0.0 and " 00189 //<< float(myMC_particles.size()) 00190 //<< endreq; 00191 } else { 00192 // fill all histograms 00193 //log << MSG::DEBUG << "Fill multiplicity" << endreq; 00194 fill(m_h_multiplicity, 00195 double(myParticles.size()), 00196 double(myMC_particles.size()) ); 00197 00198 //iterate over the electrons 00199 00200 std::vector<ReconstructedParticle*>::const_iterator iter = myParticles.begin(); 00201 for (; iter != myParticles.end(); ++iter) { 00202 const HepMC::GenParticle* truth = (*iter)->truth(); 00203 HepLorentzVector momentum = (*iter)->momentum(); 00204 HepLorentzVector trueMomentum = truth->momentum(); 00205 00206 //log << MSG::DEBUG << "Fill per-electron histos" << endreq; 00207 fill(m_h_pt, (*iter)->pT(), trueMomentum.perp()); 00208 fill(m_h_eta, (*iter)->eta(), trueMomentum.pseudoRapidity()); 00209 fill(m_h_energy,((*iter)->momentum()).e(), trueMomentum.e()); 00210 fill(m_h_phi, (*iter)->phi(), trueMomentum.phi()); 00211 fill(m_h_theta, ((*iter)->momentum()).theta(),trueMomentum.theta()); 00212 } 00213 } 00214 log << MSG::DEBUG << "Done the filling OK" << endreq; 00215 return StatusCode::SUCCESS ; 00216 } |
|
Definition at line 142 of file ReconstructedParticleHistogramMaker.cxx.
00143 { 00144 // .. put any finalisation in here... 00145 MsgStream log(messageService(), name()); 00146 log << MSG::INFO << "finalizing" << endreq; 00147 00148 return StatusCode::SUCCESS ; 00149 } |
|
Definition at line 223 of file ReconstructedParticleHistogramMaker.cxx. Referenced by initialize().
00232 { 00233 00234 // book the histograms in turn, incrementing the counter before using it 00235 start.push_back(histoSvc()->book( 00236 "/stat/simple1d/", 00237 ++m_nHist, 00238 m_histTitle+" Rec "+title, 00239 nbins, 00240 xmin, 00241 xmax 00242 ) 00243 ); 00244 00245 start.push_back(histoSvc()->book( 00246 "/stat/simple1d/", 00247 ++m_nHist, 00248 m_histTitle+" Tru "+title, 00249 nbins, 00250 xmin, 00251 xmax 00252 ) 00253 ); 00254 00255 start.push_back(histoSvc()->book( 00256 "/stat/simple1d/", 00257 ++m_nHist, 00258 m_histTitle+" Dif "+title, 00259 nbins*2, 00260 xminDiff, 00261 xmaxDiff 00262 ) 00263 ); 00264 start.push_back(histoSvc()->book( 00265 "/stat/simple1d/", 00266 ++m_nHist, 00267 m_histTitle+" Res "+title, 00268 nbins*2, 00269 -2.0, 00270 2.0 00271 ) 00272 ); 00273 00274 return; 00275 } |
|
Definition at line 280 of file ReconstructedParticleHistogramMaker.cxx. Referenced by execute().
00280 { 00281 00282 MsgStream log( messageService(), name() ) ; 00283 00284 if (!start[0] || !start[1] || !start[2] || !start[3]) { 00285 log << MSG::WARNING << "trying to fill to a null histogram pointer" << endreq; 00286 return; 00287 } 00288 start[0]->fill(rec,1.0); 00289 start[1]->fill(tru,1.0); 00290 start[2]->fill(tru-rec,1.0); 00291 if (tru != 0.0) { 00292 start[3]->fill((tru-rec)/tru,1.0); 00293 } 00294 return; 00295 } |
|
Definition at line 81 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |
|
Definition at line 106 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(). |
|
Definition at line 107 of file ReconstructedParticleHistogramMaker.h. |
|
Definition at line 123 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |
|
Definition at line 125 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |
|
Definition at line 127 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |
|
Definition at line 129 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |
|
Definition at line 131 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |
|
Definition at line 133 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |
|
Definition at line 138 of file ReconstructedParticleHistogramMaker.h. Referenced by initialize(). |
|
Definition at line 140 of file ReconstructedParticleHistogramMaker.h. Referenced by initialize(). |
|
Definition at line 143 of file ReconstructedParticleHistogramMaker.h. Referenced by initialize(). |
|
Definition at line 146 of file ReconstructedParticleHistogramMaker.h. |
|
Definition at line 152 of file ReconstructedParticleHistogramMaker.h. Referenced by execute(), and initialize(). |