00001 //$Id: FillMRCC.cxx,v 1.7 2010/01/08 23:02:13 jyuko Exp $ 00002 // C++ 00003 #include <vector> 00004 00005 // ROOT 00006 #include "TClonesArray.h" 00007 00008 // MINOS 00009 #include "Conventions/BeamType.h" 00010 #include "DataUtil/infid.h" 00011 #include "MCNtuple/NtpMCStdHep.h" 00012 #include "MCNtuple/NtpMCTruth.h" 00013 #include "MuonRemoval/NtpMRRecord.h" 00014 #include "MuonRemoval/NtpMREvent.h" 00015 #include "MCReweight/NeugenWeightCalculator.h" 00016 #include "MCReweight/ReweightHelpers.h" 00017 #include "MessageService/MsgService.h" 00018 #include "MinosObjectMap/MomNavigator.h" 00019 #include "StandardNtuple/NtpStRecord.h" 00020 00021 // Local 00022 #include "PhysicsNtuple/Default.h" 00023 #include "PhysicsNtuple/Factory.h" 00024 #include "PhysicsNtuple/Store/FillMRCC.h" 00025 00026 CVSID("$Id: FillMRCC.cxx,v 1.7 2010/01/08 23:02:13 jyuko Exp $"); 00027 REGISTER_ANP_OBJECT(AlgStore,FillMRCC) 00028 00029 using namespace std; 00030 00031 //----------------------------------------------------------------------------------------- 00032 Anp::FillMRCC::FillMRCC() 00033 :fDebug(true) 00034 { 00035 } 00036 00037 //----------------------------------------------------------------------------------------- 00038 Anp::FillMRCC::~FillMRCC() 00039 { 00040 } 00041 00042 //----------------------------------------------------------------------------------------- 00043 bool Anp::FillMRCC::Run(Record &record, TObject *ptr) 00044 { 00045 // 00046 // Get and fill Monte-Carlo truth and StdHep information 00047 // 00048 const NtpMRRecord* ntmrcc= dynamic_cast<NtpMRRecord *>(ptr); 00049 if(!ntmrcc){ 00050 const MomNavigator *mom = dynamic_cast<const MomNavigator *> (ptr); 00051 if(mom) 00052 { 00053 ntmrcc = dynamic_cast<NtpMRRecord *>(mom -> GetFragment("NtpMRRecord")); 00054 if(!ntmrcc) 00055 { 00056 MSG("FillAlg", Msg::kError) << "Failed to find NtpMRRecord pointer 1" << endl; 00057 return false; 00058 } 00059 } 00060 else 00061 { 00062 MSG("FillAlg", Msg::kError) << "Failed to find MomNavigator pointer" << endl; 00063 return false; 00064 } 00065 } 00066 if(!ntmrcc) 00067 { 00068 MSG("FillAlg", Msg::kError) << "Failed to get NtpMRRecord pointer 2" << endl; 00069 return false; 00070 } 00071 00072 TClonesArray& evtTca=*(ntmrcc->mrevt); 00073 // TClonesArray& truTca=*(ntmrcc->mrtru); 00074 00075 const Int_t numEvts=evtTca.GetEntriesFast(); 00076 for(int jj=0;jj<numEvts;jj++){ 00077 const NtpMREvent& mrccevt= *dynamic_cast<NtpMREvent*>(evtTca[jj]); 00078 MRCCInfo minfo = Fill(mrccevt); 00079 minfo.infoindex = jj; 00080 record.Add(minfo); 00081 } 00082 if(fDebug) cout<<"FillMRCC::Run - End "<<endl; 00083 return true; 00084 } 00085 00086 //---------------------------------------------------------------------- 00087 void Anp::FillMRCC::Config(const Registry ®) 00088 { 00089 00090 Anp::Read(reg,"FillMRCCDebug",fDebug); 00091 if(reg.KeyExists("PrintConfig")) 00092 { 00093 cout << "FillMRCC::Config" << endl; 00094 cout << "Debug "<<fDebug<< endl; 00095 } 00096 } 00097 00098 //----------------------------------------------------------------------------------------- 00099 const Anp::MRCCInfo Anp::FillMRCC::Fill(const NtpMREvent &mrevent) const 00100 { 00101 00102 MRCCInfo mrccinfo; 00103 00104 mrccinfo.mrcc_index = mrevent.best_event; 00105 mrccinfo.orig_index = mrevent.orig_event; 00106 mrccinfo.index = mrevent.index; 00107 mrccinfo.ndigit = mrevent.ndigit; 00108 mrccinfo.nstrip = mrevent.nstrip; 00109 // mrccinfo.stp = mrevent.stp; 00110 // mrccinfo.mrstp = mrevent.mrstp; 00111 mrccinfo.best_purity = mrevent.best_purity; 00112 mrccinfo.best_complete = mrevent.best_complete; 00113 mrccinfo.best_purity_phw = mrevent.best_purity_phw; 00114 mrccinfo.best_complete_phw= mrevent.best_complete_phw; 00115 mrccinfo.elec_complete = mrevent.elec_complete; 00116 mrccinfo.elec_complete_phw= mrevent.elec_complete_phw; 00117 mrccinfo.vtxx = mrevent.vtxx; 00118 mrccinfo.vtxy = mrevent.vtxy; 00119 mrccinfo.vtxz = mrevent.vtxz; 00120 mrccinfo.vtxp = mrevent.vtxp; 00121 mrccinfo.npln = mrevent.npln; 00122 mrccinfo.prng = mrevent.prng; 00123 mrccinfo.pcrv = mrevent.pcrv; 00124 mrccinfo.pvdx = mrevent.pvdx; 00125 mrccinfo.pvdy = mrevent.pvdy; 00126 mrccinfo.pvdz = mrevent.pvdz; 00127 mrccinfo.fitp = mrevent.fitp; 00128 mrccinfo.endc = mrevent.endc; 00129 mrccinfo.pass = mrevent.pass; 00130 mrccinfo.pmux = mrevent.pmux; 00131 mrccinfo.pmuy = mrevent.pmuy; 00132 mrccinfo.pmuz = mrevent.pmuz; 00133 mrccinfo.mxpl = mrevent.mxpl; 00134 00135 return mrccinfo; 00136 }
1.3.9.1