Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

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/Cell.h"
00022 #include "AtlfastEvent/Jet.h"
00023 #include "AtlfastEvent/Cluster.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     m_tesIO = new TesIO();
00087     //get the Global Event Data using singleton pattern
00088     GlobalEventData* ged = GlobalEventData::Instance();
00089 
00090     int lumi                  = ged->lumi();
00091     int randSeed              = ged->randSeed() ;
00092     double barrelForwardEta   = ged->barrelForwardEta();
00093       
00094     m_smearer = new JetSmearer(randSeed, 
00095                                lumi,
00096                                0., 
00097                                0., 
00098                                barrelForwardEta); 
00099       
00100     HeaderPrinter hp("Atlfast-ProtoJet Maker:", log);
00101     hp.add("Input Cell Key                  ", m_inputCellLocation);    
00102     hp.add("Input Cluster Key               ", m_inputClusterLocation);    
00103     hp.add("Output  Tower PJ Key            ", m_outputTowerPJKey);    
00104     hp.add("Output Cluster PJ Key           ", m_outputClusterPJKey);    
00105     hp.add("Output FinalState PJ Key        ", m_outputFinalStatePJKey);
00106     hp.add("Construct Tower ProtoJets       ", m_towerPJConstruct);
00107     hp.add("Construct Cluster ProtoJets     ", m_clusterPJConstruct);
00108     hp.add("Construct Final State ProtoJets ", m_finalStatePJConstruct);
00109     hp.add("Smear Tower  ProtoJets          ", m_towerPJSmearOn);
00110     hp.add("Smear Cluster ProtoJets         ", m_clusterPJSmearOn);
00111     hp.print();
00112     
00113 
00114     return StatusCode::SUCCESS; 
00115   }
00116   
00117   StatusCode AtlfastProtoJetMaker::finalize()
00118   {
00119     MsgStream log( messageService(), name() );
00120     log << MSG::DEBUG <<"AtlfastProtoJetllMaker finalize()" << endreq;
00121     return StatusCode::SUCCESS; 
00122   }
00123   
00124   //_________________________________________________________________________
00125   StatusCode AtlfastProtoJetMaker::execute()
00126   {
00127     //.............................................
00128     
00129     MsgStream log( messageService(), name() );
00130     std::string message;
00131     log << MSG::DEBUG << "AtlfastProtoJetMaker execute()" << endreq;
00132 
00133     AtlfastProtoJet* proJ;
00134      //do protojet filling from now on---------------------
00135     if(m_towerPJConstruct){
00136     //Get the cells from storeGate
00137       std::vector<Cell*> cells;
00138       TesIoStat stat = m_tesIO->copy<CellCollection>(cells,m_inputCellLocation);
00139       message = stat?  "Found Cells in TES":"No Cells in TES";
00140       log<<MSG::DEBUG << message <<endreq;
00141       if(stat){
00142         if(!this->FillProtoJets(cells,proJ,m_outputTowerPJKey,m_towerPJSmearOn)){
00143           return StatusCode::FAILURE;
00144         }
00145       }
00146     }
00147 
00148     if(m_clusterPJConstruct){
00149     //Get the clusters from storeGate
00150       std::vector<Cluster*> clusters;
00151       TesIoStat stat = 
00152         m_tesIO->copy<ClusterCollection>(clusters,m_inputClusterLocation);
00153       message = stat?  "Found Clusters in TES":"No Clusters in TES";
00154       log<<MSG::DEBUG << message <<endreq;
00155       if(stat){
00156         if(!this->FillProtoJets(clusters,proJ,m_outputClusterPJKey,m_clusterPJSmearOn)){
00157           return StatusCode::FAILURE;
00158         }
00159       }
00160     }
00161     if(m_finalStatePJConstruct){
00162     //Get the FinalStateParticles from storeGate
00163       HepMC_helper::IsFinalState ifs;
00164       MCparticleCollection particles;
00165       TesIoStat stat = m_tesIO->getMC(particles, &ifs);
00166       message = stat?  "Found FS Particles in TES":"No FS Particles in TES";
00167       log<<MSG::DEBUG << message <<endreq;
00168       if(stat){
00169         if(!this->FillProtoJets(particles,proJ,m_outputFinalStatePJKey)){
00170           return StatusCode::FAILURE;
00171         }
00172       }
00173     }
00189   return StatusCode::SUCCESS;
00190   }
00191 
00192  
00193 } // end of namespace bracket
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 

Generated on Tue Jan 28 09:57:12 2003 for AtlfastAlgs by doxygen1.3-rc1