AtlfastProtoJetMaker.cxx

Go to the documentation of this file.
00001 
00002 // ================================================
00003 // AtlfastProtoJetMaker 
00004 // ================================================
00005 //
00006 // THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT
00007 //
00008 //
00009 // Namespace Atlfast
00010 //
00011 
00012 #include "AtlfastAlgs/AtlfastProtoJetMaker.h"
00013 #include "AtlfastAlgs/ISmearer.h"
00014 #include "AtlfastAlgs/JetSmearer.h"
00015 #include "AtlfastAlgs/GlobalEventData.h"
00016 
00017 #include "AtlfastUtils/HeaderPrinter.h"
00018 #include "AtlfastUtils/HepMC_helper/IsFinalState.h"
00019 
00020 #include "AtlfastEvent/AtlfastProtoJet.h"
00021 #include "AtlfastEvent/ICell.h"
00022 #include "AtlfastEvent/Jet.h"
00023 #include "AtlfastEvent/ICluster.h"
00024 #include "AtlfastEvent/CollectionDefs.h"
00025 
00026 #include <cmath>
00027 //#include <iomanip.h>
00028 // CLHEP,HepMC
00029 #include "GeneratorObjects/McEventCollection.h"
00030 // Gaudi includes
00031 #include "GaudiKernel/DataSvc.h"
00032 #include "GaudiKernel/Chrono.h"
00033 #include "GaudiKernel/MsgStream.h"
00034 #include "GaudiKernel/ISvcLocator.h"
00035 //Generator includes
00036 #include "GeneratorObjects/McEventCollection.h"
00037 
00038 namespace Atlfast {
00039 
00040   AtlfastProtoJetMaker:: AtlfastProtoJetMaker(const std::string& name, ISvcLocator* pSvcLocator):
00041     Algorithm(name,pSvcLocator){
00042     
00043     //default paths for entities in the TES
00044     m_inputCellLocation     = "/Event/AtlfastCells";
00045     m_inputClusterLocation  = "/Event/AtlfastClusters";
00046 
00047     m_outputTowerPJKey      = "/Event/AtlfastTowerProtoJets";
00048     m_outputClusterPJKey    = "/Event/AtlfastClusterProtoJets";
00049     m_outputFinalStatePJKey = "/Event/AtlfastFinalStateProtoJets";
00050 
00051 
00052     m_towerPJConstruct      = true;
00053     m_clusterPJConstruct    = true;
00054     m_finalStatePJConstruct = true;
00055 
00056     m_towerPJSmearOn = false;
00057     m_clusterPJSmearOn = false;
00058 
00059     declareProperty("InputCellLocation",      m_inputCellLocation);
00060     declareProperty("InputClusterLocation",   m_inputClusterLocation);
00061 
00062     declareProperty("OutputTowerPJKey",       m_outputTowerPJKey);
00063     declareProperty("OutputClusterPJKey",     m_outputClusterPJKey);
00064     declareProperty("OutputFinalStatePJKey",  m_outputFinalStatePJKey);
00065 
00066     declareProperty("TowerPJConstruct",       m_towerPJConstruct);
00067     declareProperty("ClusterPJConstruct",     m_clusterPJConstruct);
00068     declareProperty("FinalStatePJConstruct",  m_finalStatePJConstruct);
00069 
00070     declareProperty("TowerPJSmearOn",         m_towerPJSmearOn);
00071     declareProperty("ClusterPJSmearOn",       m_clusterPJSmearOn);
00072   }
00073   
00074   //__________________________________________________________________________
00075   AtlfastProtoJetMaker::~AtlfastProtoJetMaker()
00076   {
00077     MsgStream log( messageService(), name() ) ;
00078     log << MSG::INFO << "AtlfastProtoJetMaker destructor called" << endreq;
00079   }
00080   //__________________________________________________________________________
00081   StatusCode AtlfastProtoJetMaker::initialize()
00082   {
00083     
00084     MsgStream log( messageService(), name() );
00085     log << MSG::DEBUG <<"AtlfastProtoJetllMaker initialize()" << endreq;
00086     //get the Global Event Data using singleton pattern
00087     GlobalEventData* ged = GlobalEventData::Instance();
00088 
00089     int lumi                  = ged->lumi();
00090     int randSeed              = ged->randSeed() ;
00091     double barrelForwardEta   = ged->barrelForwardEta();
00092     m_mcLocation              = ged->mcLocation();  
00093     m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter());
00094 
00095     m_smearer = new JetSmearer(randSeed, 
00096                                lumi,
00097                                0., 
00098                                0., 
00099                                barrelForwardEta); 
00100       
00101     HeaderPrinter hp("Atlfast-ProtoJet Maker:", log);
00102     hp.add("Input Cell Key                  ", m_inputCellLocation);    
00103     hp.add("Input Cluster Key               ", m_inputClusterLocation);    
00104     hp.add("Output  Tower PJ Key            ", m_outputTowerPJKey);    
00105     hp.add("Output Cluster PJ Key           ", m_outputClusterPJKey);    
00106     hp.add("Output FinalState PJ Key        ", m_outputFinalStatePJKey);
00107     hp.add("Construct Tower ProtoJets       ", m_towerPJConstruct);
00108     hp.add("Construct Cluster ProtoJets     ", m_clusterPJConstruct);
00109     hp.add("Construct Final State ProtoJets ", m_finalStatePJConstruct);
00110     hp.add("Smear Tower  ProtoJets          ", m_towerPJSmearOn);
00111     hp.add("Smear Cluster ProtoJets         ", m_clusterPJSmearOn);
00112     hp.print();
00113     
00114 
00115     return StatusCode::SUCCESS; 
00116   }
00117   
00118   StatusCode AtlfastProtoJetMaker::finalize()
00119   {
00120     MsgStream log( messageService(), name() );
00121     log << MSG::DEBUG <<"AtlfastProtoJetllMaker finalize()" << endreq;
00122     return StatusCode::SUCCESS; 
00123   }
00124   
00125   //_________________________________________________________________________
00126   StatusCode AtlfastProtoJetMaker::execute()
00127   {
00128     //.............................................
00129     
00130     MsgStream log( messageService(), name() );
00131     std::string message;
00132     log << MSG::DEBUG << "AtlfastProtoJetMaker execute()" << endreq;
00133 
00134     AtlfastProtoJet* proJ;
00135      //do protojet filling from now on---------------------
00136     if(m_towerPJConstruct){
00137     //Get the cells from storeGate
00138       std::vector<const ICell*> cells;
00139       TesIoStat stat = 
00140         m_tesIO->copy<ITwoCptCellCollection>(cells,m_inputCellLocation);
00141       message = stat?  "Found Cells in TES":"No Cells in TES";
00142       log<<MSG::DEBUG << message <<endreq;
00143       if(stat){
00144         if(!this->FillProtoJets(cells,proJ,m_outputTowerPJKey,m_towerPJSmearOn)){
00145           return StatusCode::FAILURE;
00146         }
00147       }
00148     }
00149 
00150     if(m_clusterPJConstruct){
00151     //Get the clusters from storeGate
00152       std::vector<ICluster*> clusters;
00153       TesIoStat stat = 
00154         m_tesIO->copy<IClusterCollection>(clusters,m_inputClusterLocation);
00155       message = stat?  "Found Clusters in TES":"No Clusters in TES";
00156       log<<MSG::DEBUG << message <<endreq;
00157       if(stat){
00158         if(!this->FillProtoJets(clusters,proJ,m_outputClusterPJKey,m_clusterPJSmearOn)){
00159           return StatusCode::FAILURE;
00160         }
00161       }
00162     }
00163     if(m_finalStatePJConstruct){
00164     //Get the FinalStateParticles from storeGate
00165       HepMC_helper::IsFinalState ifs;
00166       MCparticleCollection particles;
00167       TesIoStat stat = m_tesIO->getMC(particles, &ifs);
00168       message = stat?  "Found FS Particles in TES":"No FS Particles in TES";
00169       log<<MSG::DEBUG << message <<endreq;
00170       if(stat){
00171         if(!this->FillProtoJets(particles,proJ,m_outputFinalStatePJKey)){
00172           return StatusCode::FAILURE;
00173         }
00174       }
00175     }
00191   return StatusCode::SUCCESS;
00192   }
00193 
00194  
00195 } // end of namespace bracket
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 

Generated on Mon Sep 24 14:19:11 2007 for AtlfastAlgs by  doxygen 1.5.1