Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

NtpMCModule.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // NtpMCModule.cxx
00004 //
00005 // A JobControl Module for filling an NtpMCRecord from data stored
00006 // in the SimSnarlRecord.
00007 //
00009 #include <iostream>
00010 #include <cassert>
00011 
00012 using namespace std;
00013 
00014 #include "TParticle.h"
00015 #include "DataUtil/TruthHelper.h"
00016 
00017 #include "MessageService/MsgService.h"
00018 #include "JobControl/JobCModuleRegistry.h"
00019 #include "JobControl/JobCommand.h"
00020 #include "MinosObjectMap/MomNavigator.h"
00021 #include "TClonesArray.h"
00022 #include "MCNtuple/Module/NtpMCModule.h"
00023 #include "MCNtuple/NtpMCRecord.h"
00024 #include "MCNtuple/NtpMCTruth.h"
00025 #include "MCNtuple/NtpMCStdHep.h"
00026 #include "MCNtuple/NtpMCDigiScintHit.h"
00027 #include "MCNtuple/NtpMCDetSimResult.h"
00028 #include "MCNtuple/NtpMCPhotonResult.h"
00029 #include "MCNtuple/NtpMCFluxInfo.h"
00030 #include "MCNtuple/NtpMCFluxWgt.h"
00031 #include "MCNtuple/NtpMCStdHepHit.h"
00032 #include "StandardNtuple/NtpStRecord.h"
00033 #include "Record/SimSnarlRecord.h"
00034 #include "Record/SimSnarlHeader.h"
00035 #include "Plex/PlexPlaneId.h"
00036 #include "Plex/PlexStripEndId.h"
00037 #include "REROOT_Classes/REROOT_NeuKin.h"
00038 #include "REROOT_Classes/REROOT_FluxInfo.h"
00039 #include "REROOT_Classes/REROOT_FluxWgt.h"
00040 #include "Conventions/Munits.h"
00041 #include "Conventions/Mphysical.h"
00042 #include "Util/UtilMath.h"
00043 #include "UgliGeometry/UgliGeomHandle.h"
00044 #include "UgliGeometry/UgliStripHandle.h"
00045 #include "Digitization/DigiScintHit.h"
00046 #include "RawData/RawRecord.h"
00047 #include "RawData/RawDigitDataBlock.h"
00048 #include "RawData/RawDataBlock.h"
00049 #include "RawData/RawDigit.h"
00050 #include "DataUtil/Truthifier.h"
00051 #include "PhotonTransport/PhotonEventResult.h"
00052 #include "DetSim/SimEventResult.h"
00053 
00054 ClassImp(NtpMCModule)
00055 
00056 //   Definition of static data members
00057 //   *********************************
00058 
00059 CVSID("$Id: NtpMCModule.cxx,v 1.41 2009/05/21 18:29:36 rhatcher Exp $");
00060 JOBMODULE(NtpMCModule, "NtpMCModule",
00061          "A module for filling MC ntuple records.");
00062 
00063 
00064 // Definition of methods (alphabetical order)
00065 // ***************************************************
00066 
00067 bool compareP4(Float_t* p4neu, TParticle* part)
00068 {
00069   bool result = true;
00070   Float_t part_p4[4] = { part->Px(), part->Py(), part->Pz(), part->Energy() };
00071   for (int k=0; k<4; ++k) {
00072     // use float strictness scaled by 100 (vs default 10)
00073     // because for fava values are exchanged as ASCII messages
00074     // and more precision gets lost
00075     result &= UtilMath::sameValue(p4neu[k],part_p4[k],false,100.);
00076   }
00077   return result;
00078 }
00079 
00080 //......................................................................
00081 
00082 const Registry& NtpMCModule::DefaultConfig() const {
00083   //
00084   // Purpose: Method to return default configuration.
00085   // 
00086   // Arguments: none.
00087   //
00088   // Return: Registry containing default configuration
00089   //
00090 
00091   MSG("NtpMC",Msg::kDebug) << 
00092     "NtpMCModule::DefaultConfig" << endl;
00093 
00094   static Registry r; 
00095   std::string name = this->JobCModule::GetName();
00096   name += ".config.default";
00097   r.SetName(name.c_str());
00098 
00099   r.UnLockValues();
00100   r.Set("WriteDigiHit",0);
00101   r.Set("UseStandard",0);
00102   r.Set("SimSnarlRecordName", "");
00103   r.Set("RecordName", "Primary");
00104   r.Set("RecordTitle", "Created by NtpMCModule");
00105   r.LockValues();
00106 
00107   return r;
00108 }
00109 
00110 //......................................................................
00111 
00112 void NtpMCModule::Config(const Registry& r) {
00113   //
00114   // Purpose: Configure the module given a registry.
00115   //
00116   // Arguments: Registry to use to configure the module.
00117   //
00118   // Return: none.
00119   //
00120 
00121   MSG("NtpMC",Msg::kDebug) << "NtpMCModule::Config" << endl;
00122   
00123   Int_t tmpi;
00124   //  Double_t tmpd;
00125   const Char_t* tmps;
00126   if ( r.Get("WriteDigiHit",tmpi) ) fWriteDigiHit = tmpi;
00127   if ( r.Get("UseStandard",tmpi) ) fUseStandard = tmpi;
00128   if ( r.Get("SimSnarlRecordName",tmps) ) fSimSnarlRecordName = tmps;
00129   if ( r.Get("RecordName", tmps) )  fRecordName = tmps;
00130   if ( r.Get("RecordTitle", tmps) ) fRecordTitle = tmps;
00131 
00132 }
00133 
00134 //......................................................................
00135 
00136 JobCResult NtpMCModule::Reco(MomNavigator *mom) {
00137   //
00138   //  Purpose:  Create and fill ntuple record.
00139   //
00140   //  Arguments: mom.
00141   //  
00142   //  Return: status.
00143   // 
00144 
00145   JobCResult result(JobCResult::kPassed);  
00146   MSG("NtpMC",Msg::kDebug) << "NtpMCModule::Reco" << endl;
00147 
00148   // Check that mom exists.
00149   assert(mom);
00150   
00151   SimSnarlRecord* simrec = dynamic_cast<SimSnarlRecord*>
00152             (mom->GetFragment("SimSnarlRecord",fSimSnarlRecordName.c_str()));
00153   if ( !simrec ) {
00154     MSG("NtpMC",Msg::kWarning) << "No SimSnarlRecord of name "
00155                  << fSimSnarlRecordName.c_str() << " in Mom." << endl;
00156     result.SetWarning().SetFailed();
00157     return result;
00158   }
00159 
00160   const SimSnarlHeader* simhdr = simrec->GetSimSnarlHeader();
00161 
00162   if ( fStdHepRange ) delete [] fStdHepRange; fStdHepRange=0;
00163   
00164   TClonesArray* ntpmcarrptr = 0;
00165   TClonesArray* ntpstdheparrptr = 0;
00166   TClonesArray* ntpdigihitarrptr = 0;
00167   
00168   NtpStRecord* ntpstrec = 0;
00169   NtpMCRecord* ntpmcrec = 0;
00170   NtpMCSummary* ntpmcsummaryptr = 0;
00171   NtpMCPhotonResult* ntpmcphotonptr = 0;
00172   NtpMCDetSimResult* ntpmcdetsimptr = 0;
00173   
00174   if ( fUseStandard ) {
00175     ntpstrec = dynamic_cast<NtpStRecord*>(mom->GetFragment("NtpStRecord",
00176                                                 fRecordName.c_str()));
00177     if ( !ntpstrec) {
00178       MSG("NtpMC",Msg::kWarning) << "No NtpStRecord in Mom of name "
00179                         << fRecordName.c_str() << " and UseStandard."
00180                         << "\nMust call NtpStModule::Get() first." << endl;
00181       result.SetWarning().SetFailed();
00182       return result;
00183     }
00184     ntpmcarrptr = ntpstrec->mc;
00185     ntpstdheparrptr = ntpstrec->stdhep;
00186     ntpdigihitarrptr = ntpstrec->digihit;
00187     ntpmcsummaryptr = &(ntpstrec->mchdr);
00188     ntpmcphotonptr = &(ntpstrec->photon);
00189     ntpmcdetsimptr = &(ntpstrec->detsim);
00190   }
00191   else {
00192     // Create a NtpMCRecord
00193     RecCandHeader ntphdr(simhdr->GetVldContext(),simhdr->GetRun(),
00194            simhdr->GetSubRun(),simhdr->GetRunType(),simhdr->GetErrorCode(),
00195            simhdr->GetSnarl(),simhdr->GetTrigSrc(),simhdr->GetTimeFrame(),
00196            simhdr->GetRemoteSpillType(),-1);
00197     ntpmcrec = new NtpMCRecord(ntphdr);
00198     ntpmcrec -> SetName(fRecordName.c_str());
00199     ntpmcrec -> SetTitle(fRecordTitle.c_str());
00200 
00201     RecJobHistory& jobhist 
00202           = const_cast<RecJobHistory&>(ntpmcrec->GetJobHistory());
00203     jobhist.Append(simrec->GetJobHistory());
00204     jobhist.CreateJobRecord(RecJobHistory::kNtpMC);
00205     
00206     ntpmcarrptr = ntpmcrec->mc;
00207     ntpstdheparrptr = ntpmcrec->stdhep;
00208     ntpdigihitarrptr = ntpmcrec->digihit;
00209     ntpmcsummaryptr = &(ntpmcrec->mchdr);
00210     ntpmcphotonptr = &(ntpmcrec->photon);
00211     ntpmcdetsimptr = &(ntpmcrec->detsim);
00212   }
00213   
00214   TClonesArray& ntpmctrutharray = *(ntpmcarrptr);
00215   TClonesArray& ntpstdheparray  = *(ntpstdheparrptr);
00216   NtpMCSummary& ntpmcsummary = *(ntpmcsummaryptr);
00217   NtpMCPhotonResult& ntpmcphoton = *(ntpmcphotonptr);
00218   NtpMCDetSimResult& ntpmcdetsim = *(ntpmcdetsimptr);
00219   
00220   ntpmcsummary.geninfo.time  = simhdr->GetMcGenTime();
00221   ntpmcsummary.geninfo.codename = simhdr->GetMcGenCodename();
00222   ntpmcsummary.geninfo.hostname = simhdr->GetMcGenHostname();
00223 
00224   this -> FillNtpMCTruth(ntpmctrutharray,ntpmcsummary,simrec,mom);
00225 
00226   this -> FillNtpMCStdHep(ntpstdheparray,ntpmcsummary,simrec);
00227   if ( fWriteDigiHit ) {
00228     TClonesArray& ntpdigihitarray = *(ntpdigihitarrptr);
00229     this -> FillNtpMCDigiScintHit(ntpdigihitarray,ntpmcsummary,simrec);
00230   }
00231 
00232   this -> FillNtpMCPhotonResult(ntpmcphoton,simrec);
00233   this -> FillNtpMCDetSimResult(ntpmcdetsim,simrec);
00234 
00235   // pass record to mom to own
00236   MSG("NtpMC",Msg::kDebug) << ntpmcsummary << endl;
00237   
00238   if ( !fUseStandard)  mom -> AdoptFragment(ntpmcrec);
00239   
00240   return result;
00241 
00242 }
00243 
00244 void NtpMCModule::FillNtpMCTruth(TClonesArray& ntpmctrutharray,
00245                                  NtpMCSummary& ntpmcsummary,
00246                                  const SimSnarlRecord* simrec,
00247                                  const MomNavigator* mom) {
00248   //
00249   //  Purpose:  Private method used to fill mc truth portion of ntuple record.
00250   //
00251   //  Arguments: NtpMCTruth, SimSnarlRecord and Mom for Truthifier (for filling
00252   //             ndigu(v)/tphu(v) per true event
00253   //  
00254   //  Return: status.
00255   // 
00256 
00257   MSG("NtpMC",Msg::kDebug) << "NtpMCModule::FillNtpMCTruth" << endl;
00258 
00259   if ( !simrec ) {
00260     MSG("NtpMC",Msg::kWarning) 
00261     << "NtpMCModule::FillNtpMCTruth called with null argument pointer." 
00262     << endl;
00263     return;
00264   }
00265 
00266   // SimSnarlRecord does *NOT* have REROOT_NeuVtx objects
00267   // (these rely on gMINFast to give correct z offset)
00268   // so we must retrieve the vertex info from the StdHep array
00269 
00270   const TClonesArray* neukinarray = dynamic_cast<const TClonesArray*>
00271                           (simrec->FindComponent("TClonesArray","NeuKinList"));
00272   const TClonesArray* stdheparray = dynamic_cast<const TClonesArray*>
00273                           (simrec->FindComponent("TClonesArray","StdHep"));
00274   const TClonesArray* finfoarray = dynamic_cast<const TClonesArray *>
00275     (simrec->FindComponent("TClonesArray","FluxInfoList"));
00276   const TClonesArray* fwgtarray = dynamic_cast<const TClonesArray *>
00277     (simrec->FindComponent("TClonesArray","FluxWgtList"));
00278   
00279   if ( neukinarray && neukinarray->GetEntriesFast() != 0 ) {
00280     REROOT_NeuKin* rneukin 
00281         = dynamic_cast<REROOT_NeuKin*>(neukinarray->At(0));
00282     if ( rneukin -> INu() != 0 ) {
00283       // Only complain if not a dummy NeuKin entry, such is generated
00284       // when user uses KINE card to set particle initial state
00285       if ( !finfoarray || finfoarray->GetEntriesFast() == 0 ) {
00286         MAXMSG("NtpMC",Msg::kWarning,1) << "FluxInfoList is empty.\n"
00287           << "mc.flux will not be properly filled!" << endl;
00288       }
00289       if ( !fwgtarray || fwgtarray->GetEntriesFast() == 0 ) {
00290         MAXMSG("NtpMC",Msg::kWarning,1) << "FluxWgtList is empty.\n"
00291           << "mc.fluxwgt will not be properly filled!" << endl;
00292       }
00293     }
00294   }
00295 
00296 
00297   if ( neukinarray && stdheparray ) {
00298     Int_t nneukin = neukinarray->GetLast()+1;
00299     ntpmcsummary.nmc = nneukin;
00300     // Set error bit if build failed
00301     if ( !BuildMCToStdHep(neukinarray,stdheparray) ) ntpmcsummary.error = 1;
00302     
00303     for ( Int_t ineu = 0; ineu < nneukin; ineu++ ) {
00304       NtpMCTruth* ntpmctruth = new(ntpmctrutharray[ineu])NtpMCTruth();
00305       ntpmctruth->index = ineu;
00306       if ( fStdHepRange ) {
00307         ntpmctruth->stdhep[0] = fStdHepRange[ineu*2+0];
00308         ntpmctruth->stdhep[1] = fStdHepRange[ineu*2+1];
00309       }
00310       
00311       REROOT_NeuKin* rneukin 
00312         = dynamic_cast<REROOT_NeuKin*>(neukinarray->At(ineu));
00313       if ( rneukin ) {
00314         ntpmctruth->inu        = rneukin->INu();
00315         ntpmctruth->inunoosc   = rneukin->INuNoOsc();
00316         ntpmctruth->itg        = rneukin->ITg();
00317         ntpmctruth->iboson     = rneukin->IBoson();
00318         ntpmctruth->iresonance = rneukin->IResonance();
00319         ntpmctruth->iaction    = rneukin->IAction();
00320         ntpmctruth->istruckq   = rneukin->IStruckQ();
00321         ntpmctruth->iflags     = rneukin->IFlags();
00322         ntpmctruth->a          = rneukin->A();
00323         ntpmctruth->z          = rneukin->Z();
00324         ntpmctruth->sigma      = rneukin->Sigma();
00325         ntpmctruth->sigmadiff  = rneukin->SigmaDiff();
00326         for (int i = 0; i < 4; i++) {
00327           ntpmctruth->p4neu[i] = rneukin->P4Neu()[i];
00328           ntpmctruth->p4neunoosc[i] = rneukin->P4NeuNoOsc()[i];
00329           ntpmctruth->p4tgt[i] = rneukin->P4Tgt()[i];
00330           ntpmctruth->p4shw[i] = rneukin->P4Shw()[i];
00331           ntpmctruth->p4mu1[i] = rneukin->P4Mu1()[i];
00332           ntpmctruth->p4mu2[i] = rneukin->P4Mu2()[i];
00333           ntpmctruth->p4el1[i] = rneukin->P4El1()[i];
00334           ntpmctruth->p4el2[i] = rneukin->P4El2()[i];
00335           ntpmctruth->p4tau[i] = rneukin->P4Tau()[i];
00336         }
00337         ntpmctruth->x  = rneukin->X();
00338         ntpmctruth->y  = rneukin->Y();
00339         ntpmctruth->q2 = rneukin->Q2();
00340         ntpmctruth->w2 = rneukin->W2();
00341         ntpmctruth->emfrac = rneukin->EMFrac();
00342       }
00343     
00344       RawRecord* rawrec = dynamic_cast<RawRecord*>
00345        (mom->GetFragment("RawRecord","","DaqSnarl"));
00346 
00347       if ( rawrec && ntpmctruth->stdhep[0] >= 0 ) {
00348         const Truthifier& truth = Truthifier::Instance(mom);
00349         TIter itr = rawrec -> GetRawBlockIter();
00350         while (RawDataBlock* rawblk=dynamic_cast<RawDataBlock*>(itr.Next())){
00351           RawDigitDataBlock* rddb = dynamic_cast<RawDigitDataBlock*>(rawblk);
00352           if ( rddb ) {
00353             TIter diter = rddb -> GetDatumIter();
00354             while (RawDigit* rawdigit=dynamic_cast<RawDigit*>(diter.Next())) {
00355               RawChannelId digitRCId = rawdigit->GetChannel();
00356               Double_t adc_offset = 0;
00357               if ( digitRCId.GetElecType() == ElecType::kQIE ) adc_offset=50;
00358               Bool_t digfound = false;
00359               Bool_t inu = false;
00360               Bool_t inv = false;
00361               if ( const DigiSignal* signal = truth.GetSignal(rawdigit) ) {
00362                 if ( signal ) {
00363                   for(UInt_t ihit=0; ihit<signal->GetNumberOfHits(); ihit++) {
00364                     const DigiScintHit* hit = signal->GetHit(ihit);
00365                     if ( hit ) {
00366                       Int_t trkid = abs(hit->TrackId());
00367                       if ( trkid >= ntpmctruth->stdhep[0] && 
00368                            trkid <= ntpmctruth->stdhep[1] ) {
00369                         digfound = true;
00370                         PlexStripEndId seid = hit->StripEndId();
00371                         if ( seid.GetPlaneView()==PlaneView::kU )inu = true;
00372                         if ( seid.GetPlaneView()==PlaneView::kV )inv = true;
00373                       }
00374                     }
00375                   }
00376                 }
00377               }
00378               if ( digfound ) {
00379                 if ( inu ) {
00380                   ntpmctruth->ndigu += 1;
00381                   ntpmctruth->tphu += (rawdigit->GetADC()-adc_offset);
00382                 }
00383                 else if ( inv ) {
00384                   ntpmctruth->ndigv += 1;
00385                   ntpmctruth->tphv += (rawdigit->GetADC()-adc_offset);
00386                 }
00387               }
00388             }
00389           }
00390         }         
00391       }
00392 
00393       TruthHelper th;  // used to access methos IsNeutrino & IsDocStatus
00394       // look for the neutrino vector in StdHep that matches NeuKin
00395       for (int ihep=0; ihep<= stdheparray->GetLast(); ++ihep) {
00396         TParticle* part = 
00397           dynamic_cast<TParticle*>(stdheparray->At(ihep));
00398         if ( !part || !th.IsNeutrino(part) || !th.IsDocStatus(part) ) continue;
00399         if ( !compareP4(ntpmctruth->p4neu,part) ) continue;
00400         // this should be the matching entry for neutrino
00401         
00402         // take the vertex from the primary lepton origin 
00403         // should be first daughter of neutrino
00404         int ihep_lepton_out = part->GetFirstDaughter();
00405         TParticle* outlep = 
00406           dynamic_cast<TParticle*>(stdheparray->At(ihep_lepton_out));
00407         ntpmctruth->vtxx = outlep->Vx();
00408         ntpmctruth->vtxy = outlep->Vy();
00409         ntpmctruth->vtxz = outlep->Vz();
00410       }
00411 
00412       //Fill gnumi flux info.  Added by TV, 10-31-2005
00413       if(finfoarray && finfoarray->GetEntriesFast() != 0){
00414         if(finfoarray->GetEntriesFast()<=ineu) {
00415           MAXMSG("NtpMC",Msg::kWarning,5)
00416             <<"Can not get "<<ineu<<" entry from FluxInfo Array "
00417             <<" which only has "<<finfoarray->GetEntriesFast()<<endl;
00418         }
00419         else {
00420           const REROOT_FluxInfo *rrfi = dynamic_cast<const REROOT_FluxInfo*>
00421             (finfoarray->At(ineu));
00422           FillNtpFluxInfo(ntpmctruth->flux,rrfi);
00423         }
00424       }
00425       if(fwgtarray && fwgtarray->GetEntriesFast() != 0){
00426         if(fwgtarray->GetEntriesFast()<=ineu){
00427           MAXMSG("NtpMC",Msg::kWarning,5)
00428             <<"Can not get "<<ineu<<" entry from FluxWgt Array "
00429             <<" which only has "<<fwgtarray->GetEntriesFast()<<endl;
00430         }
00431         else{
00432           const REROOT_FluxWgt *rrfw = dynamic_cast<const REROOT_FluxWgt*>
00433             (fwgtarray->At(ineu));
00434           FillNtpFluxWgt(ntpmctruth->fluxwgt,rrfw);
00435         }
00436       }
00437       
00438       MSG("NtpMC",Msg::kDebug) << *ntpmctruth << endl;
00439     }
00440     
00441 
00442   }
00443   else {
00444     MSG("NtpMC",Msg::kWarning) 
00445      << "Either NeuKin list " << neukinarray 
00446      << " or StdHep list " << stdheparray
00447      << " is missing in SimSnarlRecord.\nNtpMCTruth array will not be filled."
00448      << endl;
00449     return;
00450   }
00451 
00452   return;
00453 
00454 }
00455 
00456 void NtpMCModule::FillNtpMCStdHep(TClonesArray& ntpstdheparray,
00457                                   NtpMCSummary& ntpmcsummary,
00458                                   const SimSnarlRecord* simrec) {
00459   //
00460   //  Purpose:  Private method used to fill shield strip portion of ntuple 
00461   //            record.
00462   //
00463   //  Arguments: TClonesArray of NtpMCStdHep and SimSnarlRecord
00464   //  
00465   //  Return: status.
00466   // 
00467 
00468   MSG("NtpMC",Msg::kDebug) << "NtpMCModule::FillNtpMCStdHep" << endl;
00469 
00470   if ( !simrec ) {
00471     MSG("NtpMC",Msg::kWarning) 
00472     << "NtpMCModule::FillNtpMCStdHep called with null argument pointer." 
00473     << endl;
00474     return;
00475   }
00476 
00477   const TClonesArray* simstdheparray = dynamic_cast<const TClonesArray*>
00478                            (simrec -> FindComponent("TClonesArray","StdHep"));
00479   if ( !simstdheparray ) {
00480     MSG("NtpMC",Msg::kWarning) << "No StdHep array in SimSnarlRecord." << endl;
00481     return;
00482   }
00483   const TClonesArray* simdigihitarray = dynamic_cast<const TClonesArray*>
00484                     (simrec -> FindComponent("TClonesArray","DigiScintHits"));
00485   if ( !simdigihitarray ) {
00486     MSG("NtpMC",Msg::kWarning) << "No DigiScintHits array in SimSnarlRecord." 
00487                                << endl;
00488     return;
00489   }
00490 
00491   // Extract vldcontext and create an UgliGeomHandle
00492   const VldContext& vldc = *(simrec -> GetVldContext()); 
00493   UgliGeomHandle geom(vldc);
00494 
00495   // Fill fStdHepToDigiHitMap with particle associated digihits
00496   BuildStdHepToDigiHit(simstdheparray,simdigihitarray);  
00497 
00498   Int_t nstdhep = simstdheparray->GetLast()+1;
00499   ntpmcsummary.nstdhep = nstdhep;
00500   Int_t mcindex = 0;
00501   for ( Int_t istd = 0; istd < nstdhep; istd++ ) {
00502     NtpMCStdHep* ntpstdhep = new(ntpstdheparray[istd])NtpMCStdHep();
00503     ntpstdhep->index = istd;
00504     TParticle* simstdhep = dynamic_cast<TParticle*>(simstdheparray->At(istd));
00505     if ( simstdhep ) {
00506       ntpstdhep->parent[0] = simstdhep->GetMother(0);
00507       ntpstdhep->parent[1] = simstdhep->GetMother(1);
00508       ntpstdhep->child[0] = simstdhep->GetDaughter(0);
00509       ntpstdhep->child[1] = simstdhep->GetDaughter(1);
00510       ntpstdhep->IdHEP  = simstdhep->GetPdgCode(); 
00511       ntpstdhep->IstHEP = simstdhep->GetStatusCode();
00512       ntpstdhep->mass   = simstdhep->GetCalcMass();
00513       ntpstdhep->p4[0]  = simstdhep->Px(); // GeV
00514       ntpstdhep->p4[1]  = simstdhep->Py(); // GeV
00515       ntpstdhep->p4[2]  = simstdhep->Pz(); // GeV
00516       ntpstdhep->p4[3]  = simstdhep->Energy();  // GeV
00517       ntpstdhep->vtx[0] = simstdhep->Vx(); // Meter 
00518       ntpstdhep->vtx[1] = simstdhep->Vy(); // Meter 
00519       ntpstdhep->vtx[2] = simstdhep->Vz(); // Meter 
00520       ntpstdhep->vtx[3] = simstdhep->T(); // Sec (previously mm/c)
00521       if ( fStdHepRange ) {
00522         if ( istd > fStdHepRange[mcindex*2+1] ) mcindex++;
00523         ntpstdhep->mc = mcindex;
00524       }
00525 
00526       // Add digiscinthit information for first/last hit in the detector
00527       std::map<Int_t,std::vector<DigiScintHit*> >::iterator mapItr 
00528                                          = fStdHepToDigiHitMap.find(istd);
00529       if ( mapItr != fStdHepToDigiHitMap.end() ) {
00530         std::vector<DigiScintHit*>& hitList = mapItr->second;
00531         ntpstdhep->ndethit = hitList.size();
00532         for ( int iend=0; iend < 2; iend++ ) {
00533           const DigiScintHit* simdigihit = 0;
00534           if ( iend == 0 ) simdigihit = hitList[iend];
00535           else simdigihit = hitList[hitList.size()-1];
00536           
00537           NtpMCStdHepHit& ntpstdhephit = ntpstdhep->dethit[iend];
00538 
00539           ntpstdhephit.planeview = simdigihit->StripEndId().GetPlaneView();
00540           ntpstdhephit.plane = simdigihit->Plane();
00541           ntpstdhephit.strip = simdigihit->Strip();
00542 
00543           const UgliStripHandle& uglistp
00544                      = geom.GetStripHandle(simdigihit->StripEndId());
00545           // DigiScintHit stores X1/X2 instead of X0/X1
00546           TVector3 vlocal0(simdigihit->X1(),simdigihit->Y1(),simdigihit->Z1());
00547 
00548           const TVector3& vglobal0 = uglistp.LocalToGlobal(vlocal0);
00549           ntpstdhephit.vtx[0] = vglobal0.X();
00550           ntpstdhephit.vtx[1] = vglobal0.Y();
00551           ntpstdhephit.vtx[2] = vglobal0.Z();
00552           ntpstdhephit.vtx[3] = simdigihit->T1(); // DigiScintHit stores T1/T2
00553           ntpstdhephit.mom[0] = simdigihit->ParticlePX1();
00554           ntpstdhephit.mom[1] = simdigihit->ParticlePY1();
00555           ntpstdhephit.mom[2] = simdigihit->ParticlePZ1();
00556           ntpstdhephit.mom[3] = simdigihit->ParticleEnergy();
00557         }
00558       }
00559     }
00560   }
00561 
00562   Int_t logLevel = MsgService::Instance()->GetStream("NtpMC")->GetLogLevel();
00563   if ( logLevel <= Msg::kDebug ) {
00564     std::string entrystr = " entries:";
00565     if ( nstdhep == 1 ) entrystr = " entry:";
00566     MSG("NtpMC",Msg::kDebug) << "\nPrint stdhep array of NtpMCStdHep w/" 
00567                              << nstdhep << entrystr.c_str() << endl;
00568     for ( Int_t istd = 0; istd < nstdhep; istd++ ) {
00569       const NtpMCStdHep* ntpstdhep 
00570       = dynamic_cast<const NtpMCStdHep*>(ntpstdheparray.At(istd));
00571       if ( ntpstdhep->parent[0] == -1 ) 
00572          ntpstdhep->Print(std::cout,"","",&ntpstdheparray);
00573       
00574     }
00575   }
00576 
00577   fStdHepToDigiHitMap.clear();
00578   
00579   return;
00580 
00581 }
00582 
00583    
00584 bool NtpMCModule::BuildMCToStdHep(const TClonesArray* neukinarray,
00585                                   const TClonesArray* stdheparray) {
00586 //
00587 //  Purpose:  Private method used to build mc to stdhep map
00588 //
00589 //  Return: false if build failed (an error message is also printed), else true
00590 //
00591 
00592    MSG("NtpMC",Msg::kDebug) << "NtpMCModule::BuildMCToStdHep()"
00593                             << endl;
00594  
00595    if ( fStdHepRange ) delete [] fStdHepRange; fStdHepRange = 0;
00596    
00597    Int_t nneukin = neukinarray->GetLast()+1;
00598    if ( nneukin <= 0 ) return true; // nothing to build
00599    
00600    Int_t nstdhep = stdheparray->GetLast()+1;
00601    fStdHepRange = new Int_t[nneukin*2];
00602    for ( int ineu = 0; ineu < nneukin; ineu++ ) {
00603      fStdHepRange[ineu*2+0] = -1;
00604      fStdHepRange[ineu*2+1] = -1;
00605    }
00606    
00607    Int_t mcindex = -1;
00608    Int_t nprim = 0;
00609    bool  prevchild = true;
00610    for ( Int_t istd = 0; istd < nstdhep; istd++ ) {
00611      TParticle* simstdhep = dynamic_cast<TParticle*>(stdheparray->At(istd));
00612      if ( simstdhep->GetMother(0) == -1 && simstdhep->GetMother(1) == -1 ) {
00613        // primary, check to make sure its new
00614        nprim++;
00615        if ( nprim > 2 || prevchild ) { 
00616          mcindex++; 
00617          nprim = 1; 
00618          if ( mcindex < nneukin ) {
00619            fStdHepRange[mcindex*2+0] = istd; // range min
00620          }
00621          else {
00622            MSG("NtpMC",Msg::kError) 
00623            << "FillNtpMCTruth:\nBreakdown in procedure to match stdhep to "
00624            << "associated mc entry.\nmc to stdhep indexing will not be done!"
00625            << endl;
00626            if ( fStdHepRange ) delete [] fStdHepRange; fStdHepRange = 0;
00627            return false;
00628          }
00629        }
00630        prevchild = false; 
00631      }
00632      else {
00633        prevchild = true;
00634        nprim = 0;
00635      }
00636       
00637      fStdHepRange[mcindex*2+1] = istd; // range max
00638      
00639    }   
00640 
00641    // At end, check grand total
00642    if ( mcindex != nneukin - 1  ) {
00643      MSG("NtpMC",Msg::kError) 
00644       << "FillNtpMCTruth:\nBreakdown in procedure to match stdhep to " 
00645       << "associated mc entry.\nFound " << mcindex + 1 << " primaries "
00646       << "in stdhep array, but nneukin = " << nneukin << ".\n"
00647       << "mc to stdhep indexing will not be done!" << endl;
00648      if ( fStdHepRange ) delete [] fStdHepRange; fStdHepRange = 0;
00649      return false;
00650    }
00651 
00652    return true;
00653    
00654 }
00655 
00656 bool NtpMCModule::BuildStdHepToDigiHit(const TClonesArray* simstdheparray,
00657                                        const TClonesArray* simdigihitarray) {
00658 //
00659 //  Purpose:  Private method to fill fStdHepToDigiHitMap with
00660 //            <stdhep particle index, vector of digiscinthits> pairs.
00661 //            Only those digihits directly generated by the stdhep particle
00662 //            are stored in the list of digihits associated with the
00663 //            particle.  Veto shield hits are excluded.
00664 //
00665 //  Return: false if build failed (an error message is also printed), else true
00666 //
00667 
00668    MSG("NtpMC",Msg::kDebug) << "NtpMCModule::BuildStdHepToDigiHit()"
00669                             << endl;
00670  
00671    fStdHepToDigiHitMap.clear(); 
00672    
00673    if ( !simstdheparray ) {
00674      MSG("NtpMC",Msg::kWarning)
00675      << "NtpMCModule::BuildStdHepToDigiHit received null stdheparray." 
00676      << endl;
00677      return false;
00678    }
00679    if ( !simdigihitarray ) {
00680      MSG("NtpMC",Msg::kWarning)
00681      << "NtpMCModule::BuildStdHepToDigiHit received null digihitarray." 
00682      << endl;
00683      return false;
00684    }
00685 
00686    Int_t ndigihit = simdigihitarray->GetLast()+1;
00687    for ( Int_t ihit = 0; ihit < ndigihit; ihit++ ) {
00688      DigiScintHit* simdigihit
00689      = dynamic_cast<DigiScintHit*>(simdigihitarray->At(ihit));
00690      Int_t trkId = simdigihit->TrackId(); //id of trk that produced hit
00691      if ( trkId < 0 ) continue; // track not present in stdhep array
00692      if ( (simdigihit->StripEndId()).IsVetoShield() ) continue; // skip VS hits
00693 
00694      // Because cosmic reroot files place the primary muon in the 0th slot 
00695      // in stdhep array, such that hits off the secondaries produced by
00696      // the muon will have trkId's 0 instead of a negative trkId, check
00697      // to make sure particleId in this slot is that of primary.
00698      const TParticle* stdhep = dynamic_cast<const TParticle*>
00699                                (simstdheparray->At(trkId));
00700      if ( stdhep->GetPdgCode() != simdigihit->ParticleId() ) continue;
00701 
00702      // The following will create an entry in map if not present already
00703      std::vector<DigiScintHit*>& hitlist = fStdHepToDigiHitMap[trkId];
00704      hitlist.push_back(simdigihit);
00705    }
00706 
00707    return true;
00708    
00709 }
00710 
00711 void NtpMCModule::FillNtpMCDigiScintHit(TClonesArray& ntpdigihitarray,
00712                                         NtpMCSummary& ntpmcsummary,
00713                                         const SimSnarlRecord* simrec) {
00714 //
00715 //  Purpose:  Private method used to fill DigiScintHit portion of ntuple
00716 //            record.
00717 //
00718 //  Arguments: TClonesArray of digihits and SimSnarlRecord
00719 //
00720 //  Return: status.
00721 //
00722 
00723    MSG("NtpMC",Msg::kDebug) << "NtpMCModule::FillNtpMCDigiScintHit"
00724                                                              << endl;
00725 
00726    if ( !simrec ) {
00727      MSG("NtpMC",Msg::kWarning)
00728      << "NtpMCModule::FillNtpMCDigiScintHit called with null argument pointer."
00729      << endl;
00730      return;
00731    }
00732 
00733    // Extract vldcontext and create an UgliGeomHandle
00734    const VldContext& vldc = *(simrec -> GetVldContext());
00735    
00736    UgliGeomHandle geom(vldc);
00737 
00738    const TClonesArray* simdigihitarray = dynamic_cast<const TClonesArray*>
00739                     (simrec -> FindComponent("TClonesArray","DigiScintHits"));
00740    if ( !simdigihitarray ) {
00741      MSG("NtpMC",Msg::kWarning)
00742      << "No DigiScintHit array in SimSnarlRecord." << endl;
00743      return;
00744    }
00745 
00746    Int_t ndigihit = simdigihitarray->GetLast()+1;
00747    ntpmcsummary.ndigihit = ndigihit;
00748    for ( Int_t ihit = 0; ihit < ndigihit; ihit++ ) {
00749      NtpMCDigiScintHit* ntpdigihit
00750      = new(ntpdigihitarray[ihit])NtpMCDigiScintHit();
00751      ntpdigihit->index = ihit;
00752      DigiScintHit* simdigihit
00753      = dynamic_cast<DigiScintHit*>(simdigihitarray->At(ihit));
00754      if ( simdigihit ) {
00755        ntpdigihit->planeview = simdigihit->StripEndId().GetPlaneView();
00756        ntpdigihit->strip = simdigihit->Strip();
00757        ntpdigihit->plane = simdigihit->Plane();
00758        ntpdigihit->t0 = simdigihit->T1(); // time at start of segment
00759        ntpdigihit->t1 = simdigihit->T2(); // time at end of segment
00760        ntpdigihit->dS = simdigihit->DS(); // total path length
00761        ntpdigihit->dE = simdigihit->DE(); // total energy deposited
00762        ntpdigihit->pE = simdigihit->ParticleEnergy(); // parent particle energy
00763        ntpdigihit->pId = simdigihit->ParticleId(); // parent particle Id
00764        ntpdigihit->trkId = simdigihit->TrackId(); //id of trk that produced hit
00765        ntpdigihit->failbits = simdigihit->FailBits();
00766 
00767        const UgliStripHandle& uglistp
00768         = geom.GetStripHandle(simdigihit->StripEndId());
00769        TVector3 vlocal0(simdigihit->X1(),simdigihit->Y1(),simdigihit->Z1());
00770        const TVector3& vglobal0 = uglistp.LocalToGlobal(vlocal0);
00771        ntpdigihit->x0 = vglobal0.X();
00772        ntpdigihit->y0 = vglobal0.Y();
00773        ntpdigihit->z0 = vglobal0.Z();
00774        TVector3 vlocal1(simdigihit->X2(),simdigihit->Y2(),simdigihit->Z2());
00775        const TVector3& vglobal1 = uglistp.LocalToGlobal(vlocal1);
00776        ntpdigihit->x1 = vglobal1.X();
00777        ntpdigihit->y1 = vglobal1.Y();
00778        ntpdigihit->z1 = vglobal1.Z();
00779      }
00780      MSG("NtpMC",Msg::kVerbose) << *ntpdigihit << endl;
00781    }
00782 
00783    return;
00784 
00785 }
00786 
00787 void NtpMCModule::FillNtpMCPhotonResult(NtpMCPhotonResult& ntpmcphoton,
00788                                         const SimSnarlRecord* simrec) {
00789 //
00790 //  Purpose:  Private method used to fill photon result portion of ntuple
00791 //            record.
00792 //
00793 //  Arguments: reference to photon result and SimSnarlRecord
00794 //
00795 //  Return: none.
00796 //
00797 
00798    MSG("NtpMC",Msg::kDebug) << "NtpMCModule::FillNtpMCPhotonResult"
00799                             << endl;
00800 
00801    if ( !simrec ) {
00802      MSG("NtpMC",Msg::kWarning)
00803      << "NtpMCModule::FillNtpMCPhotonResult called with null argument pointer."
00804      << endl;
00805      return;
00806    }
00807 
00808    const PhotonEventResult* per = dynamic_cast<const PhotonEventResult*>
00809                               (simrec->FindComponent("PhotonEventResult"));
00810    if ( !per ) {
00811      MAXMSG("NtpMC",Msg::kWarning,1) 
00812       << "No PhotonEventResult component in SimSnarlRecord.\n"
00813       << "NtpMC photon data member will not be filled." << endl;
00814       return;
00815    }
00816  
00817    ntpmcphoton.hitsDiscardedGeom   = per->hitsDiscardedGeom;
00818    ntpmcphoton.hitsDiscardedBad    = per->hitsDiscardedBad;
00819    ntpmcphoton.totalHits           = per->totalHits;
00820    ntpmcphoton.totalStripsHit      = per->totalStripsHit;
00821    ntpmcphoton.bluePhotons         = per->bluePhotons;
00822    ntpmcphoton.greenPhotons        = per->greenPhotons;
00823    ntpmcphoton.bluePhotons_nonprescaled = per->bluePhotons_nonprescaled;
00824    ntpmcphoton.greenPhotons_nonprescaled = per->greenPhotons_nonprescaled;
00825    ntpmcphoton.totalPE             = per->totalPE;
00826    ntpmcphoton.totalPixels         = per->totalPixels;
00827    ntpmcphoton.totalHitEnergy      = per->totalHitEnergy;
00828    ntpmcphoton.energyDiscardedGeom = per->energyDiscardedGeom;
00829    ntpmcphoton.energyDiscardedBad  = per->energyDiscardedBad;
00830 
00831    MSG("NtpMC",Msg::kVerbose) << ntpmcphoton << endl;
00832 
00833    return;
00834 
00835 }
00836 
00837 void NtpMCModule::FillNtpMCDetSimResult(NtpMCDetSimResult& ntpmcdetsim,
00838                                         const SimSnarlRecord* simrec) {
00839 //
00840 //  Purpose:  Private method used to fill detsim result portion of ntuple
00841 //            record.
00842 //
00843 //  Arguments: reference to detsim result and SimSnarlRecord
00844 //
00845 //  Return: none.
00846 //
00847 
00848    MSG("NtpMC",Msg::kDebug) << "NtpMCModule::FillNtpMCDetSimResult"
00849                             << endl;
00850 
00851    if ( !simrec ) {
00852      MSG("NtpMC",Msg::kWarning)
00853      << "NtpMCModule::FillNtpMCDetSimResult called with null argument pointer."
00854      << endl;
00855      return;
00856    }
00857 
00858    const SimEventResult* det = dynamic_cast<const SimEventResult*>
00859                             (simrec->FindComponent("SimEventResult"));
00860    if ( !det ) {
00861      MAXMSG("NtpMC",Msg::kWarning,1) 
00862       << "No SimEventResult component in SimSnarlRecord.\n"
00863       << "NtpMC detsim data member will not be filled." << endl;
00864       return;
00865    }
00866  
00867    ntpmcdetsim.timeShift             = det->timeShift;
00868    ntpmcdetsim.nPE                   = det->npe;
00869    ntpmcdetsim.hitPixels             = det->hitPixels;
00870    ntpmcdetsim.hitPixelsWithXtalk    = det->hitPixelsWithXtalk;
00871    ntpmcdetsim.digitsAfterFETrigger  = det->digitsAfterFETrigger;
00872    ntpmcdetsim.digitsAfterSpars      = det->digitsAfterSpars;
00873    ntpmcdetsim.digitsAfterDaqTrigger = det->digitsAfterDaqTrigger;
00874    ntpmcdetsim.totalPE               = det->totalPe;
00875    ntpmcdetsim.totalCharge           = det->totalCharge;
00876    ntpmcdetsim.adcsAfterFETrigger    = det->adcsAfterFETrigger;
00877    ntpmcdetsim.adcsAfterSpars        = det->adcsAfterSpars;
00878    ntpmcdetsim.adcsAfterDaqTrigger   = det->adcsAfterDaqTrigger;
00879    ntpmcdetsim.bigSnarl              = det->bigSnarl;
00880    ntpmcdetsim.snarls                = det->snarls;
00881    ntpmcdetsim.snarlDigits           = new UInt_t[ntpmcdetsim.snarls];
00882    ntpmcdetsim.snarlTrigger          = new UInt_t[ntpmcdetsim.snarls];
00883    ntpmcdetsim.snarlAdcs             = new Float_t[ntpmcdetsim.snarls];
00884    
00885    for (int is = 0; is < ntpmcdetsim.snarls; is++ ) {
00886      ntpmcdetsim.snarlDigits[is]  = det->snarl_digits[is];
00887      ntpmcdetsim.snarlTrigger[is] = det->snarl_trigger[is];
00888      ntpmcdetsim.snarlAdcs[is]    = det->snarl_adcs[is];
00889    }
00890 
00891    MSG("NtpMC",Msg::kVerbose) << ntpmcdetsim << endl;
00892 
00893    return;
00894 
00895 }
00896 
00897 void NtpMCModule::FillNtpFluxInfo(NtpMCFluxInfo &ntpfinfo,
00898                                   const REROOT_FluxInfo *rrfinfo)
00899 {
00900   MSG("NtpMC",Msg::kDebug) << "NtpMCModule::FillNtpFlux" << endl;
00901 
00902   if ( !rrfinfo ) {
00903     MAXMSG("NtpMC",Msg::kWarning,5) 
00904     << "NtpMCModule::FillNtpFlux called with null argument pointer." 
00905     << endl;
00906     return;
00907   }
00908 
00909   ntpfinfo.index = rrfinfo->ID();
00910   ntpfinfo.fluxrun = rrfinfo->FluxRun();
00911   ntpfinfo.fluxevtno = rrfinfo->FluxEvtNo();
00912   ntpfinfo.ndxdz = rrfinfo->Ndxdz();
00913   ntpfinfo.ndydz = rrfinfo->Ndydz();
00914   ntpfinfo.npz = rrfinfo->Npz();
00915   ntpfinfo.nenergy = rrfinfo->Nenergy();
00916   ntpfinfo.ndxdznear = rrfinfo->NdxdzNear();
00917   ntpfinfo.ndydznear = rrfinfo->NdydzNear();
00918   ntpfinfo.nenergynear = rrfinfo->NenergyN();
00919   ntpfinfo.nwtnear = rrfinfo->NWtNear();
00920   ntpfinfo.ndxdzfar = rrfinfo->NdxdzFar();
00921   ntpfinfo.ndydzfar = rrfinfo->NdydzFar();
00922   ntpfinfo.nenergyfar = rrfinfo->NenergyF();
00923   ntpfinfo.nwtfar = rrfinfo->NWtFar();
00924   ntpfinfo.norig = rrfinfo->Norig();
00925   ntpfinfo.ndecay = rrfinfo->Ndecay();
00926   ntpfinfo.ntype = rrfinfo->Ntype();
00927   ntpfinfo.vx = rrfinfo->Vx();
00928   ntpfinfo.vy = rrfinfo->Vy();
00929   ntpfinfo.vz = rrfinfo->Vz();
00930   ntpfinfo.pdpx = rrfinfo->pdPx();
00931   ntpfinfo.pdpy = rrfinfo->pdPy();
00932   ntpfinfo.pdpz = rrfinfo->pdPz();
00933   ntpfinfo.ppdxdz = rrfinfo->ppdxdz();
00934   ntpfinfo.ppdydz = rrfinfo->ppdydz();
00935   ntpfinfo.pppz = rrfinfo->pppz();
00936   ntpfinfo.ppenergy = rrfinfo->ppenergy();
00937   ntpfinfo.ppmedium = rrfinfo->ppmedium();
00938   ntpfinfo.ptype = rrfinfo->ptype();
00939   ntpfinfo.ppvx = rrfinfo->ppvx();
00940   ntpfinfo.ppvy = rrfinfo->ppvy();
00941   ntpfinfo.ppvz = rrfinfo->ppvz();
00942   ntpfinfo.muparpx = rrfinfo->muparpx();
00943   ntpfinfo.muparpy = rrfinfo->muparpy();
00944   ntpfinfo.muparpz = rrfinfo->muparpz();
00945   ntpfinfo.mupare = rrfinfo->mupare();
00946   ntpfinfo.necm = rrfinfo->Necm();
00947   ntpfinfo.nimpwt = rrfinfo->Nimpwt();
00948   ntpfinfo.xpoint = rrfinfo->xpoint();
00949   ntpfinfo.ypoint = rrfinfo->ypoint();
00950   ntpfinfo.zpoint = rrfinfo->zpoint();
00951   ntpfinfo.tvx = rrfinfo->tvx();
00952   ntpfinfo.tvy = rrfinfo->tvy();
00953   ntpfinfo.tvz = rrfinfo->tvz();
00954   ntpfinfo.tpx = rrfinfo->tpx();
00955   ntpfinfo.tpy = rrfinfo->tpy();
00956   ntpfinfo.tpz = rrfinfo->tpz();
00957   ntpfinfo.tptype = rrfinfo->tptype();
00958   ntpfinfo.tgen = rrfinfo->tgen();
00959   // NUGPINFO data
00960   ntpfinfo.tgptype = rrfinfo->tgptype();
00961   ntpfinfo.tgppx = rrfinfo->tgppx();
00962   ntpfinfo.tgppy = rrfinfo->tgppy();
00963   ntpfinfo.tgppz = rrfinfo->tgppz();
00964   ntpfinfo.tprivx = rrfinfo->tprivx();
00965   ntpfinfo.tprivy = rrfinfo->tprivy();
00966   ntpfinfo.tprivz = rrfinfo->tprivz();
00967   ntpfinfo.beamx = rrfinfo->beamx();
00968   ntpfinfo.beamy = rrfinfo->beamy();
00969   ntpfinfo.beamz = rrfinfo->beamz();
00970   ntpfinfo.beampx = rrfinfo->beampx();
00971   ntpfinfo.beampy = rrfinfo->beampy();
00972   ntpfinfo.beampz = rrfinfo->beampz();
00973 
00974   return;
00975 }
00976 
00977 void NtpMCModule::FillNtpFluxWgt(NtpMCFluxWgt &ntpfwgt,
00978                                  const REROOT_FluxWgt *rrfwgt)
00979 {
00980   MSG("NtpMC",Msg::kDebug) << "NtpMCModule::FillNtpFluxWgt" << endl;
00981 
00982   if ( !rrfwgt ) {
00983     MAXMSG("NtpMC",Msg::kWarning,5) 
00984     << "NtpMCModule::FillNtpFluxWgt called with null argument pointer." 
00985     << endl;
00986     return;
00987   }
00988 
00989   ntpfwgt.index = rrfwgt->ID();
00990   ntpfwgt.version = rrfwgt->Version();
00991   ntpfwgt.weight = rrfwgt->Weight();
00992   ntpfwgt.weighterr = rrfwgt->WeightErr();
00993   strcpy(ntpfwgt.beam,rrfwgt->Beam());  
00994 
00995   return;
00996 }

Generated on Mon Feb 15 11:07:06 2010 for loon by  doxygen 1.3.9.1