001 #include "AtlfastAlgs/ReconstructorFactory.h"
002 #include "AtlfastAlgs/CompoundReconstructor.h"
003 #include "AtlfastAlgs/ParticleSubsystemPartitionTool.h"
004 #include "AtlfastAlgs/DefaultReconstructor.h"
005 #include "AtlfastAlgs/ElectronReconstructor.h"
006 #include "AtlfastAlgs/MuonReconstructor.h"
007 #include "AtlfastAlgs/MuonMisalignmentReconstructor.h"
008 #include "AtlfastAlgs/PhotonReconstructor.h"
009
010 namespace Atlfast{
011 ReconstructorFactory::ReconstructorFactory(std::string fileName,MsgStream &log):m_log(log),m_fl(fileName){
012
013
014
015
016
017
018
019
020
021
022 m_reconstructorTypeMap[DetectorParameters::Misalignment] = &reconstructorForge<MuonMisalignmentReconstructor>;
023
024
025
026
027
028 m_particleSubsystemMap.insert(std::pair<int,DetectorParameters::SUBSYSTEM>(11,DetectorParameters::Calorimeter));
029 m_particleSubsystemMap.insert(std::pair<int,DetectorParameters::SUBSYSTEM>(13,DetectorParameters::Calorimeter));
030 m_particleSubsystemMap.insert(std::pair<int,DetectorParameters::SUBSYSTEM>(13,DetectorParameters::MuonSystem));
031
032 }
033
034 IReconstructor* ReconstructorFactory::makeReconstructor( int particleType,
035 const int randSeed,
036 const int lumi,
037 const int muSmearKey,
038 std::string& muonResFile,
039 std::vector<double> smearParamArray,
040 int smearParamSchema )const{
041
042
043 IDefaultReconstructor *defaultReconstructor;
044
045 if (particleType == 11)
046 {
047 m_log << MSG::DEBUG << "Creating new ElectronReconstructor randSeed: "<<randSeed<<" lumi: "<<lumi<<endreq;
048 defaultReconstructor = new ElectronReconstructor(randSeed, lumi, m_log);
049 }
050 else if (particleType == 13)
051 {
052 m_log << MSG::DEBUG << "Creating new MuonReconstructor randSeed: "<<randSeed<<" lumi: "<<lumi<<endreq;
053 m_log << MSG::DEBUG << " smearKey: "<<muSmearKey<<" resFile: "<<muonResFile<<endreq;
054 defaultReconstructor = new MuonReconstructor(randSeed, lumi, muSmearKey, muonResFile, m_log);
055 }
056 else if (particleType == 22)
057 {
058 m_log << MSG::DEBUG << "Creating new PhotonReconstructor randSeed: "<<randSeed<<" lumi: "<<lumi<<endreq;
059 defaultReconstructor = new PhotonReconstructor(randSeed, lumi, m_log);
060 }
061 else
062 {
063 m_log << MSG::DEBUG << "Creating new DefaultReconstructor randSeed: "<<randSeed<<endreq;
064 defaultReconstructor = new DefaultReconstructor(randSeed);
065 }
066 defaultReconstructor->setSmearParameters(smearParamArray);
067 defaultReconstructor->setSmearParamSchema(smearParamSchema);
068 CompoundReconstructor *compoundReconstructor = new CompoundReconstructor(defaultReconstructor);
069
070
071 m_log << MSG::DEBUG << "Partitioning problematic regions."<<endreq;
072 std::vector<const ProblematicRegion*> pbr(m_fl.GetRegions());
073 std::vector<const ProblematicRegion*>::iterator itr, start, end, bound;
074 start = pbr.begin();
075 end = pbr.end();
076 ParticleSubsystemPartitionTool ptp(particleType,m_particleSubsystemMap);
077 bound = std::partition(start, end, ptp);
078
079
080 m_log << MSG::DEBUG << "Adding defined replacement/marginal reconstructor to compound reconstructor."<<endreq;
081 std::map<DetectorParameters::PROBLEM,reconstructorForgePointer>::const_iterator mItr;
082 for(itr=pbr.begin();itr!=bound;++itr){
083 mItr = m_reconstructorTypeMap.find((*itr)->problem());
084 if(mItr!=m_reconstructorTypeMap.end()){
085 IAcceptingReconstructor *ias = mItr->second(**itr);
086 if(ias->is_replacement()){ compoundReconstructor->addReplacement(ias); }
087 else{ compoundReconstructor->addMarginal(ias); }
088 }
089 else{
090 m_log<<MSG::ERROR<<"ReconstructorFactory: You shouldn't be seeing this message. If you are then no mapping has been"<<endreq;
091 m_log<<MSG::ERROR<<" established between your chosen PROBLEM type and a concrete reconstructor implementation!"<<endreq;
092 assert(false);
093 }
094 }
095
096 m_log << MSG::DEBUG << "Returning CompoundReconstructor."<<endreq;
097 return compoundReconstructor;
098 }
099
100
101 }
102
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|