RerootToTruthModule Class Reference

#include <RerootToTruthModule.h>

Inheritance diagram for RerootToTruthModule:
JobCModule

List of all members.

Public Member Functions

 RerootToTruthModule ()
 ~RerootToTruthModule ()
JobCResult Get (MomNavigator *mom)
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)

Static Public Member Functions

static std::string GetGlobalNewVtxFunction ()
static void SetGlobalNewVtxFunction (std::string funcname)
static int GetGlobalMakeDigiScintList ()
static void SetGlobalMakeDigiScintList (int flag=0)

Private Member Functions

void ModifyStdHep (TClonesArray *stdhep)
 adjust status codes, squeeze out unwanted lines
void RelocateStdHep (const VldContext &vldc, TClonesArray *stdhep)
 pick new vtx

Private Attributes

Detector::Detector_t detector
Bool_t fGetApplyRollback
Bool_t fAnaPrintStdHep
Bool_t fAnaPrintStdHepHead
Bool_t fAnaPrintNeuKin
Bool_t fAnaPrintNuEvtKin
Bool_t fAnaPrintFluxInfo
Bool_t fAnaPrintFluxWgt
Bool_t fAnaPrintScintHit
Int_t fIonScheme
Bool_t fFixCharmDKStatus
Bool_t fDropGeantEntries
Bool_t fDropTauDecayProducts
Bool_t fDropCharmDecayProducts
Bool_t fDropStatus999
std::string fStdHepEditString
Bool_t fMakeDigiScintHitList
std::string fNewVtxFunction

Detailed Description

Definition at line 27 of file RerootToTruthModule.h.


Constructor & Destructor Documentation

RerootToTruthModule::RerootToTruthModule (  ) 

Definition at line 78 of file RerootToTruthModule.cxx.

References LoadMinosPDG().

00079     : detector(Detector::kUnknown)
00080     , fGetApplyRollback(true)
00081     , fAnaPrintStdHep(true)
00082     , fAnaPrintStdHepHead(false)
00083     , fAnaPrintNeuKin(true)
00084     , fAnaPrintNuEvtKin(true)
00085     , fAnaPrintFluxInfo(true)
00086     , fAnaPrintFluxWgt(true)
00087     , fAnaPrintScintHit(false)
00088     , fIonScheme(UtilPDG::kIonUnchanged)
00089     , fFixCharmDKStatus(true)
00090     , fDropGeantEntries(false)
00091     , fDropTauDecayProducts(false)
00092     , fDropCharmDecayProducts(false)
00093     , fDropStatus999(false)
00094     , fStdHepEditString("")
00095     , fMakeDigiScintHitList(fgGlobalMakeDigiScintList)
00096     , fNewVtxFunction(fgGlobalNewVtxFunction)
00097 {
00098    // construct a new "RerootToTruthModule" JobControl module
00099 
00100    // initialize detector to non-legal value
00101 
00102    LoadMinosPDG();
00103 
00104 }

RerootToTruthModule::~RerootToTruthModule (  ) 

Definition at line 108 of file RerootToTruthModule.cxx.

References Msg::kVerbose, and MSG.

00109 {
00110   MSG("Exodus", Msg::kVerbose) << "RerootToTruthModule::Destructor\n";
00111 
00112 }


Member Function Documentation

JobCResult RerootToTruthModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 817 of file RerootToTruthModule.cxx.

References fAnaPrintFluxInfo, fAnaPrintFluxWgt, fAnaPrintNeuKin, fAnaPrintNuEvtKin, fAnaPrintScintHit, fAnaPrintStdHep, fAnaPrintStdHepHead, RecDataRecord< T >::FindComponent(), NuEvtKin::FormatToOStream(), MomNavigator::GetFragment(), SimSnarlRecord::GetSimSnarlHeader(), Msg::kInfo, JobCResult::kPassed, JobCResult::kWarning, Msg::kWarning, MSG, SimSnarlHeader::Print(), DigiScintHit::Print(), SimSnarlRecord::Print(), print_tclones_stdhep(), print_tclones_stdhephead(), REROOT_FluxWgt::printEvent(), REROOT_NeuKin::printEvent(), and REROOT_FluxInfo::printEvent().

00818 {
00819    // Check out current RecSimSnarl Record from the current REROOT event
00820 
00821    const TObject* obj = 0;
00822 
00823    SimSnarlRecord* simrec = 
00824       dynamic_cast<SimSnarlRecord*>(mom->GetFragment("SimSnarlRecord"));
00825    if (!simrec) {
00826       MSG("Exodus", Msg::kWarning) << 
00827         "RerootToTruthModule::Ana no SimSnarlRecord" << endl;
00828       return JobCResult::kWarning;
00829    }
00830 
00831    // leading space
00832    cout << endl;
00833    // print the header
00834    simrec->GetSimSnarlHeader()->Print();
00835    cout << endl; // finish off header
00836 
00837    if (fAnaPrintStdHep) {
00838        obj = simrec->FindComponent("TClonesArray","StdHep");
00839        const TClonesArray* newstdhep = dynamic_cast<const TClonesArray*>(obj);
00840        if (!newstdhep) {
00841            MSG("Exodus", Msg::kWarning) << 
00842                "RerootToTruthModule::Ana no StdHep " << obj << endl;
00843            simrec->Print();
00844            return JobCResult::kWarning;
00845        }
00846        else print_tclones_stdhep(newstdhep);
00847    }
00848 
00849 
00850    // this only works out of the Reroot record (not the SimSnarlRecord)!
00851    if (fAnaPrintStdHepHead) print_tclones_stdhephead();
00852 
00853    if (fAnaPrintNeuKin) {
00854        obj = simrec->FindComponent("TClonesArray","NeuKinList");
00855        const TClonesArray* neukinlist = dynamic_cast<const TClonesArray*>(obj);
00856        if (neukinlist) {
00857            MSG("Exodus", Msg::kInfo) 
00858                << "RerootToTruthModule::Ana NeuKinList has "
00859                << neukinlist->GetEntries() << " entries " << endl;
00860            for (int ikin=0; ikin <= neukinlist->GetLast(); ikin++) {
00861                const REROOT_NeuKin* neukin = 
00862                    dynamic_cast<const REROOT_NeuKin*>(neukinlist->At(ikin));
00863                if ( neukin ) neukin->printEvent(cout);
00864                else cout << "NeuKinList entry " << ikin << " was empty!" << endl;
00865            }
00866        }
00867        else {
00868            MSG("Exodus", Msg::kWarning) << 
00869                "RerootToTruthModule::Ana no NeuKinList " << obj << endl;
00870            const REROOT_NeuKin* neukin = 
00871                dynamic_cast<const REROOT_NeuKin*>(simrec->FindComponent("REROOT_NeuKin"));
00872            if ( neukin ) neukin->printEvent(cout);
00873            else {
00874                simrec->Print();
00875                return JobCResult::kWarning;
00876            }
00877        }
00878    }
00879 
00880 #ifdef EVENT_KINEMATICS_PKGS
00881    if (fAnaPrintNuEvtKin) {
00882        obj = simrec->FindComponent("TClonesArray","NuEvtKinList");
00883        const TClonesArray* nuevtkinlist = dynamic_cast<const TClonesArray*>(obj);
00884        if (nuevtkinlist) {
00885            MSG("Exodus", Msg::kInfo) 
00886                << "RerootToTruthModule::Ana NuEvtKinList has "
00887                << nuevtkinlist->GetEntries() << " entries " << endl;
00888            for (int ik=0; ik <= nuevtkinlist->GetLast(); ik++) {
00889                const NuEvtKin* nuevtkin = 
00890                    dynamic_cast<const NuEvtKin*>(nuevtkinlist->At(ik));
00891                if ( nuevtkin ) nuevtkin->FormatToOStream(cout,"");  // "v" or ""
00892                else cout << "NuEvtKinList entry " << ik << " was empty!" << endl;
00893            }
00894        }
00895        else {
00896            MSG("Exodus", Msg::kWarning) << 
00897                "RerootToTruthModule::Ana no NuEvtKinList " << obj << endl;
00898            //simrec->Print();
00899            return JobCResult::kWarning;
00900        }
00901    }
00902 #endif
00903 
00904    if (fAnaPrintFluxInfo) {
00905        obj = simrec->FindComponent("TClonesArray","FluxInfoList");
00906        const TClonesArray* fluxinfolist = dynamic_cast<const TClonesArray*>(obj);
00907        if (fluxinfolist) {
00908            MSG("Exodus", Msg::kInfo) 
00909                << "RerootToTruthModule::Ana FluxInfoList has "
00910                << fluxinfolist->GetEntries() << " entries " << endl;
00911            for (int ikin=0; ikin <= fluxinfolist->GetLast(); ikin++) {
00912                const REROOT_FluxInfo* fluxinfo = 
00913                    dynamic_cast<const REROOT_FluxInfo*>(fluxinfolist->At(ikin));
00914                if ( fluxinfo ) fluxinfo->printEvent(cout);
00915                else cout << "FluxInfoList entry " << ikin << " was empty!" << endl;
00916            }
00917        }
00918        else {
00919            MSG("Exodus", Msg::kWarning) << 
00920                "RerootToTruthModule::Ana no FluxInfoList " << obj << endl;
00921        }
00922    }
00923 
00924    if (fAnaPrintFluxWgt) {
00925        obj = simrec->FindComponent("TClonesArray","FluxWgtList");
00926        const TClonesArray* fluxwgtlist = dynamic_cast<const TClonesArray*>(obj);
00927        if (fluxwgtlist) {
00928            MSG("Exodus", Msg::kInfo) 
00929                << "RerootToTruthModule::Ana FluxWgtList has "
00930                << fluxwgtlist->GetEntries() << " entries " << endl;
00931            for (int ikin=0; ikin <= fluxwgtlist->GetLast(); ikin++) {
00932                const REROOT_FluxWgt* fluxwgt = 
00933                    dynamic_cast<const REROOT_FluxWgt*>(fluxwgtlist->At(ikin));
00934                if ( fluxwgt ) fluxwgt->printEvent(cout);
00935                else cout << "FluxWgtList entry " << ikin << " was empty!" << endl;
00936            }
00937        }
00938        else {
00939            MSG("Exodus", Msg::kWarning) << 
00940                "RerootToTruthModule::Ana no FluxWgtList " << obj << endl;
00941        }
00942    }
00943 
00944    if (fAnaPrintScintHit) {
00945        obj = simrec->FindComponent("TClonesArray","DigiScintHits");
00946        const TClonesArray* scinthitlist = dynamic_cast<const TClonesArray*>(obj);
00947        if (scinthitlist) {
00948            MSG("Exodus", Msg::kInfo) 
00949                << "RerootToTruthModule::Ana ScintHitList has "
00950                << scinthitlist->GetEntries() << " entries " << endl;
00951            for (int ihit=0; ihit <= scinthitlist->GetLast(); ihit++) {
00952                const DigiScintHit* scinthit = 
00953                    dynamic_cast<const DigiScintHit*>(scinthitlist->At(ihit));
00954                if ( scinthit ) scinthit->Print();
00955                else cout << "ScintHitList entry " << ihit << " was empty!" << endl;
00956            }
00957        }
00958        else {
00959            MSG("Exodus", Msg::kWarning) << 
00960                "RerootToTruthModule::Ana no ScintHitList " << obj << endl;
00961        }
00962    }
00963 
00964 
00965    return JobCResult::kPassed; // All Ok
00966 }

void RerootToTruthModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 1011 of file RerootToTruthModule.cxx.

References bfld::AsString(), fAnaPrintFluxInfo, fAnaPrintFluxWgt, fAnaPrintNeuKin, fAnaPrintNuEvtKin, fAnaPrintScintHit, fAnaPrintStdHep, fAnaPrintStdHepHead, fDropCharmDecayProducts, fDropGeantEntries, fDropStatus999, fDropTauDecayProducts, fFixCharmDKStatus, fGetApplyRollback, fIonScheme, fMakeDigiScintHitList, fStdHepEditString, Registry::Get(), Registry::GetCharString(), JobCModule::GetName(), RerootExodus::GetVldSimFlag(), UtilPDG::ionSchemeName(), Msg::kInfo, SimFlag::kUnknown, MSG, RerootExodus::SetVldSimFlag(), and Detector::StringToEnum().

01012 {
01013 //======================================================================
01014 // Configure the module given the registry r
01015 //======================================================================
01016 //  char   tmpb;
01017 //  double tmpd;
01018   int    tmpi;
01019 
01020 
01021   if (r.Get("GetApplyRollback",    tmpi)) { fGetApplyRollback   = tmpi; }
01022   if (r.Get("AnaPrintStdHep",      tmpi)) { fAnaPrintStdHep     = tmpi; }
01023   if (r.Get("AnaPrintStdHepHead",  tmpi)) { fAnaPrintStdHepHead = tmpi; }
01024   if (r.Get("AnaPrintNeuKin",      tmpi)) { fAnaPrintNeuKin     = tmpi; }
01025   if (r.Get("AnaPrintNuEvtKin",    tmpi)) { fAnaPrintNuEvtKin   = tmpi; }
01026   if (r.Get("AnaPrintFluxInfo",    tmpi)) { fAnaPrintFluxInfo   = tmpi; }
01027   if (r.Get("AnaPrintFluxWgt",     tmpi)) { fAnaPrintFluxWgt    = tmpi; }
01028   if (r.Get("AnaPrintScintHit",    tmpi)) { fAnaPrintScintHit   = tmpi; }
01029 
01030   if (r.Get("ConvertIonPDG",tmpi)) {
01031     if (fIonScheme != tmpi) {
01032       MSG("Exodus",Msg::kInfo) 
01033         << GetName() << " will convert ions using the "
01034         << UtilPDG::ionSchemeName((UtilPDG::ionscheme_t)tmpi)
01035         << " scheme." << endl;
01036     }
01037     fIonScheme = tmpi;
01038   }
01039 
01040   if (r.Get("FixCharmDKStatus",      tmpi)) { fFixCharmDKStatus       = tmpi; }
01041   if (r.Get("DropGeantEntries",      tmpi)) { fDropGeantEntries       = tmpi; }
01042   if (r.Get("DropTauDecayProducts",  tmpi)) { fDropTauDecayProducts   = tmpi; }
01043   if (r.Get("DropCharmDecayProducts",tmpi)) { fDropCharmDecayProducts = tmpi; }
01044   if (r.Get("DropStatus999",         tmpi)) { fDropStatus999          = tmpi; }
01045   fStdHepEditString = r.GetCharString("StdHepEditString");
01046 
01047   if (r.Get("MakeDigiScintHitList",  tmpi)) { fMakeDigiScintHitList   = tmpi; }
01048 
01049   MSG("Exodus",Msg::kInfo)
01050     << GetName() << " StdHep list editing,"
01051     << " FixCharmDKStatus " << (fFixCharmDKStatus?"yes":"no")
01052     <<", Drop " << endl
01053     << " GeantEntries="       << (fDropGeantEntries?"yes":"no")
01054     << " TauDecayProducts="   << (fDropTauDecayProducts?"yes":"no")
01055     << " CharmDecayProducts=" << (fDropCharmDecayProducts?"yes":"no")
01056     << " Status999="          << (fDropStatus999?"yes":"no")
01057     << endl;
01058   if (fStdHepEditString != "") {
01059     MSG("Exodus",Msg::kInfo)
01060       << " StdHepEditString: \"" << fStdHepEditString << "\""
01061       << endl;
01062   }
01063   MSG("Exodus",Msg::kInfo)
01064     << GetName() << " MakeDigiScintHitList = " 
01065     << (fMakeDigiScintHitList?"yes":"no") << endl;
01066 
01067   const char* simflg_string = r.GetCharString("VldSimFlag");
01068   SimFlag::SimFlag_t simflg = SimFlag::StringToEnum(simflg_string);
01069   if ( simflg == SimFlag::kUnknown ) simflg = RerootExodus::GetVldSimFlag();
01070   if ( simflg != RerootExodus::GetVldSimFlag() ) {
01071     MSG("Exodus",Msg::kInfo)
01072       << GetName() << " Changing SimFlag from "
01073       << SimFlag::AsString(RerootExodus::GetVldSimFlag()) << " to "
01074       << SimFlag::AsString(simflg) << " in SimSnarlHeader creation."
01075       << endl;
01076     RerootExodus::SetVldSimFlag(simflg);
01077   } else {
01078     MSG("Exodus",Msg::kInfo)
01079       << GetName() << " Using SimFlag "
01080       << SimFlag::AsString(simflg) << " in SimSnarlHeader creation."
01081       << endl;
01082   }
01083 
01084 }

const Registry & RerootToTruthModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 969 of file RerootToTruthModule.cxx.

References fgGlobalMakeDigiScintList, JobCModule::GetName(), UtilPDG::kIonUnchanged, Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00970 {
00971 //======================================================================
00972 // Create a registry which holds the default configuration and return it
00973 //======================================================================
00974   static Registry r;
00975  
00976   // Set name of config
00977   std::string name = this->GetName();
00978   name += ".config.default";
00979   r.SetName(name.c_str());
00980 
00981   // Set values of config
00982   r.UnLockValues();
00983   r.Set("GetApplyRollback",    1);
00984   r.Set("AnaPrintStdHep",      1);
00985   r.Set("AnaPrintStdHepHead",  0);
00986   r.Set("AnaPrintNeuKin",      1);
00987   r.Set("AnaPrintNuEvtKin",    1);
00988   r.Set("AnaPrintFluxInfo",    1);
00989   r.Set("AnaPrintFluxWgt",     1);
00990   r.Set("AnaPrintScintHit",    0);
00991 
00992   r.Set("VldSimFlag","kUnknown");
00993 
00994   r.Set("ConvertIonPDG",(int)UtilPDG::kIonUnchanged);
00995   r.Set("FixCharmDKStatus",       1);  // do *this* by default
00996   r.Set("DropGeantEntries",       0);
00997   r.Set("DropTauDecayProducts",   0);
00998   r.Set("DropCharmDecayProducts", 0);
00999   r.Set("DropStatus999",          0);
01000   r.Set("StdHepEditString",      "");
01001 
01002   r.Set("MakeDigiScintHitList",   fgGlobalMakeDigiScintList);
01003 
01004   r.LockValues();
01005 
01006   return r;
01007 }

JobCResult RerootToTruthModule::Get ( MomNavigator mom  )  [virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCModule.

Definition at line 544 of file RerootToTruthModule.cxx.

References RecDataRecord< T >::AdoptComponent(), MomNavigator::AdoptFragment(), VldTimeStamp::AsString(), RerootExodus::BuildVldContext(), RecJobHistory::CreateJobRecord(), detector, fGetApplyRollback, fIonScheme, fMakeDigiScintHitList, fNewVtxFunction, Form(), MomNavigator::FragmentIter(), CfgConfigurable::GetConfig(), DataUtil::GetDetector(), UtilPDG::getDfltStdIonScheme(), RerootExodus::GetEventNo(), RerootExodus::GetEventRecord(), RerootExodus::GetGminosCodeName(), RerootExodus::GetGminosHostName(), RecRecordImp< T >::GetJobHistory(), RerootExodus::GetLastEventHistoryTimeStamp(), RerootExodus::GetNeuKinList(), RerootExodus::GetRerootFileName(), RerootExodus::GetRunNo(), RerootExodus::GetSnarlNum(), RerootExodus::GetSubRunNum(), RecRecordImp< T >::GetTempTags(), RerootExodus::GetTimeFrame(), DbiTableProxyRegistry::Instance(), MsgService::Instance(), MsgService::IsActive(), JobCResult::kAOK, Msg::kDebug, RecJobHistory::kGMinos, Msg::kInfo, make_digi_scint_hit_list(), make_fluxinfo_list(), make_fluxwgt_list(), make_neukin_list(), make_std_hep_list(), ModifyStdHep(), MSG, Registry::Print(), RelocateStdHep(), run(), CfgConfigurable::Set(), Registry::Set(), MsgService::SetCurrentRunSnarl(), UtilPDG::setDfltStdIonScheme(), and CfgConfigurable::Update().

00545 {
00546    // Create SimSnarlRecord from the current REROOT event
00547    // available via gMINFast.
00548 
00549    detector = RerootExodus::GetDetector();
00550 
00551    // For a PlexHandle we need a context
00552    VldContext vldc = RerootExodus::BuildVldContext();
00553 
00554    Int_t run      = RerootExodus::GetRunNo();
00555    Short_t subrun = RerootExodus::GetSubRunNum();
00556    Int_t snarl    = RerootExodus::GetSnarlNum(); //tie to tree entry
00557 
00558    MsgService::Instance()->SetCurrentRunSnarl(run,snarl);
00559 
00560    // produce a SimSnarlRecord
00561    // have it adopt (secure) what we've produed
00562   
00563    Short_t runtype = 0;
00564    UInt_t  trigsrc = 0;
00565    UInt_t  errcode = 0;
00566    Int_t   timeframe = RerootExodus::GetTimeFrame(vldc);
00567    Int_t   spilltype = -1;
00568 
00570    // Find or make the SimSnarl
00571    
00572    SimSnarlRecord* record = 0;
00573    
00574    // See if a SimSnarl already exists. 
00575    TObject* tobj;
00576    TIter    fragiter = mom->FragmentIter();
00577    while( ( tobj = fragiter.Next() ) ) {
00578      record = dynamic_cast<SimSnarlRecord*>(tobj);
00579      if(record) break;
00580    }
00581    
00582   // If not, make one.
00583   if(record == 0) {
00584     VldTimeStamp mcGenTime(RerootExodus::GetLastEventHistoryTimeStamp());
00585     std::string  mcCodename(RerootExodus::GetGminosCodeName().Data());
00586     std::string  mcHostname(RerootExodus::GetGminosHostName().Data());
00587     SimSnarlHeader simheader(vldc,run,subrun,runtype,errcode,
00588                              snarl,trigsrc,timeframe,spilltype,
00589                              mcGenTime,mcCodename,mcHostname);
00590     record = new SimSnarlRecord(simheader);
00591     // Add the GMINOS information to the record
00592     RecJobHistory& jobhist 
00593                     = const_cast<RecJobHistory&>(record->GetJobHistory());
00594     jobhist.CreateJobRecord(RecJobHistory::kGMinos,mcCodename.c_str(),"",
00595                             mcHostname.c_str(),mcGenTime);
00596     
00597     MSG("Exodus",Msg::kDebug)
00598       << "New SimSnarlRecord " << simheader << endl;
00599     
00600     static VldTimeStamp rollbackTS;
00601     if ( fGetApplyRollback && mcGenTime < rollbackTS ) {
00602       rollbackTS = mcGenTime;
00603       // rollback the database for Ugli* and Bfld*
00604       DbiTableProxyRegistry& dbiCfg = DbiTableProxyRegistry::Instance();
00605       // something like: 
00606       //   dbiCfg.Set("Rollback:Ugli*         =  '2002-08-01'");
00607       dbiCfg.Set(Form("Rollback:UGLIDBI* = '%s'",rollbackTS.AsString("sql")));
00608       dbiCfg.Set(Form("Rollback:BFLDDBIPLANEMAP* = '%s'",rollbackTS.AsString("sql")));
00609       dbiCfg.Set("RollbackType:UGLIDBI* = 'CREATIONDATE'");
00610       dbiCfg.Set("RollbackType:BFLDDBIPLANEMAP* = 'CREATIONDATE'");
00611 
00612       MSG("Exodus",Msg::kInfo)
00613         << "RerootToTruthModule is setting dbiCfg to: " << endl;
00614       MsgService* msgserv = MsgService::Instance();
00615       if (msgserv->IsActive("Exodus",Msg::kInfo))
00616           dbiCfg.GetConfig().Print();
00617 
00618       dbiCfg.Update();
00619     }
00620 
00621     // give the RecSimSnarl to MOM to hold as a "fragment"
00622     record->GetTempTags().Set("stream","SimSnarl");  
00623     record->GetTempTags().Set("tree","SimSnarl");  
00624     record->GetTempTags().Set("file",RerootExodus::GetRerootFileName());
00625     record->GetTempTags().Set("index",RerootExodus::GetEventRecord());  
00626     mom->AdoptFragment(record);
00627   }
00628 
00629    // create/copy over other truth object
00630 
00631    // 2003-03-17 rwh: No longer copy REROOT_NeuVtx into record; doing
00632    // so is seriously flawed because there is a zoffset that depends
00633    // on the existence of gMINFast.  Thus one gets different values
00634    // for the REROOT_NeuVtx::Z() depending on whether one is running
00635    // from the original reroot file or a simsnarl'ed file.
00636 
00637    // Note: this next step is only legitimate if there is only ever 
00638    // *one* event in the snarl -- i.e. no overlay/pileup!
00639    REROOT_NeuKin *neukin_old = 
00640       (REROOT_NeuKin*)RerootExodus::GetNeuKinList()->At(0);
00641    if (neukin_old) record->AdoptComponent(new REROOT_NeuKin(*neukin_old));
00642 
00643    // Make a list of NeuKin objects
00644    // Keep the single object (done above) for backward compatibility
00645    record->AdoptComponent(make_neukin_list());
00646    record->AdoptComponent(make_fluxinfo_list());
00647    record->AdoptComponent(make_fluxwgt_list());
00648 
00649    // Add the StdHep list last for backward compatibility for those
00650    // that called SimSnarlRecord::FindComponent("TClonesArray") w/out
00651    // specifying the object name.  Set/Reset the PDG scheme used
00652    // for ions before/after conversion.
00653    UtilPDG::ionscheme_t old_ionscheme = UtilPDG::getDfltStdIonScheme();
00654    UtilPDG::setDfltStdIonScheme((UtilPDG::ionscheme_t)fIonScheme);
00655    // Make the list from what we have
00656    TClonesArray* stdhep_list = make_std_hep_list();
00657    ModifyStdHep(stdhep_list);
00658    if (fNewVtxFunction != "") RelocateStdHep(vldc,stdhep_list);
00659    record->AdoptComponent(stdhep_list);
00660    UtilPDG::setDfltStdIonScheme(old_ionscheme);
00661 
00662 #ifdef EVENT_KINEMATICS_PKGS
00663    // Add a list of NuEvtKin objects that link to StdHep
00664    record->AdoptComponent(make_NuEvtKin_list(stdhep_list));
00665 #endif
00666 
00667    // Add DigiScintHit's (if not disabled)
00668    if (fMakeDigiScintHitList)
00669      record->AdoptComponent(make_digi_scint_hit_list());
00670 
00671    // Create a DigiRerootInfo to hold miscellaneous information about
00672    // the event generation.
00673    DigiRerootInfo* drInfo = new DigiRerootInfo( RerootExodus::GetRunNo(),
00674                                                 RerootExodus::GetEventNo(),
00675                                                 RerootExodus::GetEventRecord(),
00676                                                 RerootExodus::BuildVldContext());
00677    record->AdoptComponent(drInfo);
00678 
00679    return JobCResult::kAOK; // All Ok
00680 }

int RerootToTruthModule::GetGlobalMakeDigiScintList (  )  [static]

Definition at line 70 of file RerootToTruthModule.cxx.

References fgGlobalMakeDigiScintList.

00071 { return fgGlobalMakeDigiScintList; }

std::string RerootToTruthModule::GetGlobalNewVtxFunction (  )  [static]

Definition at line 63 of file RerootToTruthModule.cxx.

00064 { return fgGlobalNewVtxFunction; }

void RerootToTruthModule::ModifyStdHep ( TClonesArray *  stdhep  )  [private]

adjust status codes, squeeze out unwanted lines

Definition at line 683 of file RerootToTruthModule.cxx.

References fDropCharmDecayProducts, fDropGeantEntries, fDropStatus999, fDropTauDecayProducts, fFixCharmDKStatus, fStdHepEditString, UtilHepevt::modStatusStdHep(), and UtilHepevt::squeezeStdHep().

Referenced by Get().

00684 {
00685   // Fix up decay chain of StdHep list 
00686   // Trim it appropriately
00687 
00688   if (fFixCharmDKStatus) {
00689     // Fix cases where charm hadron generated particles (e.g. delta-rays)
00690     // before it decayed.  In this case the original was tagged ist=2,
00691     // the decay point was ist=1205 but the daughters had ist=205
00692     // rather than 1.  Be a bit careful in case we have charm->charm->stuff
00693     // (perhaps a D* -> D + gamma/pi0, but I haven't seen any of those
00694     // come out of NEUGEN in my study of a few files...)
00695 
00696     // decay products of charm that are ist=205 should be 1
00697     string charmDKDaughters1("fromcharm && ( ! ischarm ) && ist==205 ");
00698     UtilHepevt::modStatusStdHep(stdhep_list,charmDKDaughters1,1);
00699     // in case of charm(2)->charm(1205)->charm(205)->stuff, tag last charm 2
00700     string charmDKDaughters2("fromcharm && ischarm && ist==205 && da0 > -1  ");
00701     UtilHepevt::modStatusStdHep(stdhep_list,charmDKDaughters2,2);
00702   }
00703 
00704   if (fDropGeantEntries) {
00705     // drop entries added in GEANT propagation that aren't charm/tau related
00706     string dropGeant("(  (ist> 200 && ist< 231) || "
00707                      "   (ist> 300 && ist< 310) || "
00708                      "   (ist>1200 && ist<1231) || "
00709                      "   (ist>1300 && ist<1310) )  "
00710                      " && !ischarm && !istau ");
00711     UtilHepevt::modStatusStdHep(stdhep_list,dropGeant);
00712     UtilHepevt::squeezeStdHep(stdhep_list);
00713   }
00714   if (fDropTauDecayProducts) {
00715     // flag and remove tau decay point entry and decay daughters
00716     string dropTauDK("(istau && ist==1205) || (fromtau && ist==1)");
00717     UtilHepevt::modStatusStdHep(stdhep_list,dropTauDK);
00718     UtilHepevt::squeezeStdHep(stdhep_list);
00719     // reactivate tau as an active particle subject to decay IST=1
00720     UtilHepevt::modStatusStdHep(stdhep_list,"istau && ist==2 && da0==-1",1);
00721   }
00722   if (fDropCharmDecayProducts) {
00723      // flag and remove charm decay point entry and decay daughters
00724     string dropCharmDK("(ischarm && ist==1205) || (fromcharm && ist==1)");
00725     UtilHepevt::modStatusStdHep(stdhep_list,dropCharmDK);
00726     UtilHepevt::squeezeStdHep(stdhep_list);
00727     // reactivate tau as an active particle subject to decay IST=1
00728     UtilHepevt::modStatusStdHep(stdhep_list,"ischarm && ist==2 && da0==-1",1);
00729   }
00730   if (fDropStatus999) {
00731     UtilHepevt::modStatusStdHep(stdhep_list,"ist==999");
00732     UtilHepevt::squeezeStdHep(stdhep_list);
00733   }
00734   if (fStdHepEditString != "") {
00735     UtilHepevt::modStatusStdHep(stdhep_list,fStdHepEditString);
00736     UtilHepevt::squeezeStdHep(stdhep_list);
00737   }
00738 
00739 }

void RerootToTruthModule::RelocateStdHep ( const VldContext vldc,
TClonesArray *  stdhep 
) [private]

pick new vtx

Definition at line 742 of file RerootToTruthModule.cxx.

References VldContext::AsString(), fNewVtxFunction, Form(), Msg::kDebug, Munits::mm, and MSG.

Referenced by Get().

00744 {
00745   // Readjust the vertex, using fNewVtxFunction to do so
00746 
00747   MSG("Exodus",Msg::kDebug)
00748     << "RerootToTruthModule::RelocateStdHep() " << endl
00749     << "   vldc = " << vldc.AsString("c") << endl
00750     << "   fNewVtxFunction = \"" << fNewVtxFunction << "\"" << endl;
00751 
00752   int nhep = stdhep_list->GetLast()+1;
00753   if (nhep<1) return;  // nothing to do
00754 
00755   // Get the lead particle's vertex
00756   TParticle* leadpart = dynamic_cast<TParticle*>(stdhep_list->At(0));
00757   TLorentzVector vtx0;
00758   leadpart->ProductionVertex(vtx0);
00759 
00760   // Use user defined function to get new vertex
00761   // the signature needs to be of the form:
00762   //     void myfunction(VldContext*, TLorentzVector*)
00763   // where the function name is specified in fNewVtxFunction 
00764   // initialize the location of the new vertex with lead vtx
00765   // in case user has some use for that info ...
00766   TLorentzVector newvtx = vtx0;  
00767   TApplication* app = gROOT->GetApplication();
00768   std::string fmt = "";
00769   fmt += "VldContext* vldcp = (VldContext*)0x%lx; ";
00770   fmt += "TLorentzVector* newvtxp  = (TLorentzVector*)0x%lx; ";
00771   fmt += "%s(vldcp,newvtxp);";
00772   std::string cintline = 
00773     Form(fmt.c_str(),
00774          reinterpret_cast<unsigned long>(&vldc),
00775          reinterpret_cast<unsigned long>(&newvtx),
00776          fNewVtxFunction.c_str());
00777   MSG("Exodus",Msg::kDebug) << "ProcessLine \"" << cintline << "\"" << endl;
00778   app->ProcessLine(cintline.c_str());
00779   MSG("Exodus",Msg::kDebug) 
00780     << "got vertex " << endl
00781     << " vtx0   {" << vtx0[0] << "," << vtx0[1] 
00782     << ","<< vtx0[2] << "," << vtx0[3] << "}" << endl
00783     << " newvtx {" << newvtx[0] << "," << newvtx[1] 
00784     << ","<< newvtx[2] << "," << newvtx[3] << "}" << endl;
00785 
00786   // Apply new vertex to existing entries, by adding as a shift
00787   // to preserve relative offsets (e.g. charm/tau translation)
00788   // Avoid adding offsets to special cases such as non-particle lines, 
00789   // and positions relative to vtx for intranuke.
00790   TLorentzVector offset = newvtx - vtx0;
00791   for (int i = 0; i < nhep; ++i) {
00792     TParticle* apart = dynamic_cast<TParticle*>(stdhep_list->At(i));
00793     TLorentzVector partvtx;
00794     apart->ProductionVertex(partvtx);
00795     int istatus = apart->GetStatusCode();
00796 
00797     const Double_t r_mx = 0.001 * Munits::mm;
00798 
00799     bool status01 = istatus==0 || istatus==1 || istatus > 200;
00800     bool awayfrom0 = ( partvtx.Rho() > r_mx );
00801     if ( istatus!=999 && ( status01 || awayfrom0 ) ) {
00802       partvtx += offset;
00803       apart->SetProductionVertex(partvtx);
00804     } else {
00805       MSG("Exodus",Msg::kDebug) 
00806         << "no offset applied to ihep=" << i << endl
00807         << " status " << istatus 
00808         << " (test=" << (status01?"change":"x") << ") "
00809         << " nonzero vtx " << partvtx.Rho() << " vs. " << r_mx 
00810         << " (test=" << (awayfrom0?"change":"x") << ")" << endl;
00811     }
00812   }
00813 
00814 }

void RerootToTruthModule::SetGlobalMakeDigiScintList ( int  flag = 0  )  [static]

Definition at line 72 of file RerootToTruthModule.cxx.

References fgGlobalMakeDigiScintList.

00073 { fgGlobalMakeDigiScintList = flag; }

void RerootToTruthModule::SetGlobalNewVtxFunction ( std::string  funcname  )  [static]

Definition at line 65 of file RerootToTruthModule.cxx.

References fgGlobalNewVtxFunction.

00066 { fgGlobalNewVtxFunction = funcname; }


Member Data Documentation

Definition at line 69 of file RerootToTruthModule.h.

Referenced by Get().

Definition at line 75 of file RerootToTruthModule.h.

Referenced by Ana(), and Config().

Definition at line 76 of file RerootToTruthModule.h.

Referenced by Ana(), and Config().

Definition at line 73 of file RerootToTruthModule.h.

Referenced by Ana(), and Config().

Definition at line 74 of file RerootToTruthModule.h.

Referenced by Ana(), and Config().

Definition at line 77 of file RerootToTruthModule.h.

Referenced by Ana(), and Config().

Definition at line 71 of file RerootToTruthModule.h.

Referenced by Ana(), and Config().

Definition at line 72 of file RerootToTruthModule.h.

Referenced by Ana(), and Config().

Definition at line 83 of file RerootToTruthModule.h.

Referenced by Config(), and ModifyStdHep().

Definition at line 81 of file RerootToTruthModule.h.

Referenced by Config(), and ModifyStdHep().

Definition at line 84 of file RerootToTruthModule.h.

Referenced by Config(), and ModifyStdHep().

Definition at line 82 of file RerootToTruthModule.h.

Referenced by Config(), and ModifyStdHep().

Definition at line 80 of file RerootToTruthModule.h.

Referenced by Config(), and ModifyStdHep().

Definition at line 70 of file RerootToTruthModule.h.

Referenced by Config(), and Get().

Definition at line 79 of file RerootToTruthModule.h.

Referenced by Config(), and Get().

Definition at line 87 of file RerootToTruthModule.h.

Referenced by Config(), and Get().

std::string RerootToTruthModule::fNewVtxFunction [private]

Definition at line 89 of file RerootToTruthModule.h.

Referenced by Get(), and RelocateStdHep().

Definition at line 85 of file RerootToTruthModule.h.

Referenced by Config(), and ModifyStdHep().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1