ConcatArrays Namespace Reference

Functions

void ConcatDigiScintHits (TClonesArray *addList, TClonesArray *permList, Int_t permStdHepSz)
void ConcatFluxInfo (TClonesArray *addList, TClonesArray *permList)
void ConcatFluxWgt (TClonesArray *addList, TClonesArray *permList)
void ConcatNuEvtKin (TClonesArray *addList, TClonesArray *permList, TClonesArray *stdhepList)
void ConcatNuKin (TClonesArray *addList, TClonesArray *permList)
void ConcatStdHep (TClonesArray *addList, TClonesArray *permList)
void OffsetTime (TClonesArray *tcarray, Float_t offset=0.)

Function Documentation

void ConcatArrays::ConcatDigiScintHits ( TClonesArray *  addList,
TClonesArray *  permList,
Int_t  permStdHepSz 
)

Definition at line 36 of file ConcatArrays.cxx.

References DigiScintHit::SetTrackId(), and DigiScintHit::TrackId().

Referenced by MCMerge::Get().

00038                                                                     {
00039   // Concatenate (permList += addList)
00040   // --> Call *before* ConcatStdHep
00041 
00042   if (!addList || !permList) return;
00043 
00044   const Int_t oldSize = permList->GetEntriesFast();
00045   const Int_t newSize = oldSize + addList->GetEntriesFast();
00046 
00047   for (Int_t i = oldSize; i < newSize; i++) {
00048     DigiScintHit* tempHit =
00049       dynamic_cast<DigiScintHit*>(addList->At(i-oldSize));
00050 
00051     if (tempHit) {
00052       Int_t oldId = tempHit->TrackId();
00053       Int_t newId = (oldId < 0)? oldId - permStdHepSz : oldId + permStdHepSz ;
00054       tempHit->SetTrackId( newId );
00055 
00056       new( (*permList)[i] ) DigiScintHit( *tempHit );
00057     }
00058   }
00059   
00060 }

void ConcatArrays::ConcatFluxInfo ( TClonesArray *  addList,
TClonesArray *  permList 
)

Definition at line 62 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

00063                                                           {
00064   // Concatenate (permList += addList)
00065 
00066   if (!addList || !permList) return;
00067 
00068   const Int_t oldSize = permList->GetEntriesFast();
00069   const Int_t newSize = oldSize + addList->GetEntriesFast();
00070 
00071   for (Int_t i = oldSize; i < newSize; i++)
00072     new( (*permList)[i] ) REROOT_FluxInfo( *dynamic_cast<REROOT_FluxInfo*>(addList->At(i-oldSize)) );
00073 
00074 }

void ConcatArrays::ConcatFluxWgt ( TClonesArray *  addList,
TClonesArray *  permList 
)

Definition at line 76 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

00077                                                          {
00078   // Concatenate (permList += addList)
00079 
00080   if (!addList || !permList) return;
00081 
00082   const Int_t oldSize = permList->GetEntriesFast();
00083   const Int_t newSize = oldSize + addList->GetEntriesFast();
00084 
00085   for (Int_t i = oldSize; i < newSize; i++)
00086     new( (*permList)[i] ) REROOT_FluxWgt( *dynamic_cast<REROOT_FluxWgt*>(addList->At(i-oldSize)) );
00087 
00088 }

void ConcatArrays::ConcatNuEvtKin ( TClonesArray *  addList,
TClonesArray *  permList,
TClonesArray *  stdhepList 
)

Definition at line 90 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

00092                                                             {
00093   // Concatenate (permList += addList)
00094 
00095   if (!addList || !permList || !stdhepList) return;
00096 
00097 #ifdef EVENT_KINEMATICS_PKGS
00098   const Int_t oldSize = permList->GetEntriesFast();
00099   const Int_t newSize = oldSize + addList->GetEntriesFast();
00100 
00101   for (Int_t i = oldSize; i < newSize; i++)
00102     new( (*permList)[i] ) NuEvtKin( *dynamic_cast<NuEvtKin*>(addList->At(i-oldSize)) );
00103 
00104 #endif  
00105 
00106 }

void ConcatArrays::ConcatNuKin ( TClonesArray *  addList,
TClonesArray *  permList 
)

Definition at line 108 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

00109                                                        {
00110   // Concatenate (permList += addList)
00111 
00112   if (!addList || !permList) return;
00113 
00114   const Int_t oldSize = permList->GetEntriesFast();
00115   const Int_t newSize = oldSize + addList->GetEntriesFast();
00116 
00117   for (Int_t i = oldSize; i < newSize; i++)
00118     new( (*permList)[i] ) REROOT_NeuKin( *dynamic_cast<REROOT_NeuKin*>(addList->At(i-oldSize)) );
00119 
00120 }

void ConcatArrays::ConcatStdHep ( TClonesArray *  addList,
TClonesArray *  permList 
)

Definition at line 122 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

00123                                                           {
00124   // Concatenate (permList += addList) and adjust StdHep contents accordingly
00125   // Call another fn to adjust DigiScintHit.trkId() accordingly
00126   //
00127   // MUST BE CALLED ONLY *AFTER* ConcatDigiScintHits() !!!!
00128   //
00129 
00130   if (!addList || !permList ) return;
00131 
00132   const Int_t oldSize = permList->GetEntriesFast();
00133   const Int_t newSize = oldSize + addList->GetEntriesFast();
00134 
00135   for (Int_t i = oldSize; i < newSize; i++) {
00136     TParticle* thisPart = new( (*permList)[i] ) TParticle( *dynamic_cast<TParticle*>(addList->At(i-oldSize)) );
00137 
00138     if ( thisPart ) {
00139       // Adjust indices of this particle's (1st/last) parents & children
00140       for (Int_t j = 0; j < 2; j++) {
00141         if (thisPart->GetMother(j)   >= 0)
00142           thisPart->SetMother(  j, thisPart->GetMother(j)   + oldSize );
00143         if (thisPart->GetDaughter(j) >= 0)
00144           thisPart->SetDaughter(j, thisPart->GetDaughter(j) + oldSize );
00145       } // end loop over Mother/Daughter arrays
00146     } // end if stdhep TParticle is OK
00147   } // end loop over new TParticles
00148 
00149 }

void ConcatArrays::OffsetTime ( TClonesArray *  tcarray,
Float_t  offset = 0. 
)

Definition at line 153 of file ConcatArrays.cxx.

References DigiScintHit::SetT1(), DigiScintHit::SetT2(), DigiScintHit::T1(), and DigiScintHit::T2().

Referenced by MCMerge::Get().

00153                                                                   {
00154 
00155   if ( !tcarr ) {
00156     return;
00157   }
00158 
00159   // DigiScintHit TClonesArray
00160   if ( tcarr->GetClass()->InheritsFrom("DigiScintHit") ) {
00161 
00162     UInt_t tempSize = tcarr->GetEntriesFast();
00163     
00164     for ( UInt_t i = 0; i < tempSize ; i++) {
00165       DigiScintHit* tempHit = dynamic_cast<DigiScintHit*>(tcarr->At(i));
00166       
00167       Float_t newT1 = tempHit->T1() + offsetns*1.e-9; // time is stored as sec
00168       Float_t newT2 = tempHit->T2() + offsetns*1.e-9; // time is stored as sec
00169 
00170       tempHit->SetT1(newT1);
00171       tempHit->SetT2(newT2);
00172     } // end loop over DigiScintHits
00173 
00174     return;
00175   } // end if DigiScintHit TClonesArray
00176 
00177   // StdHep TClonesArray
00178   if ( tcarr->GetClass()->InheritsFrom("TParticle") ) {
00179     for ( Int_t i = 0; i < tcarr->GetEntriesFast() ; i++) {
00180       TParticle* oldPart = dynamic_cast<TParticle*>(tcarr->At(i));
00181       oldPart->SetProductionVertex(oldPart->Vx(), oldPart->Vy(),
00182                                    oldPart->Vz(), oldPart->T()+offsetns*1.e-9);
00183     } // end loop over StdHep TParticles
00184     return;
00185   } // end if StdHep TClonesArray
00186 
00187   // NeuKin, NuEvtKin, FluxInfo, FluxWgt TClonesArray(s)
00188   if ( ( tcarr->GetClass()->InheritsFrom("REROOT_NeuKin"  ) ||
00189          tcarr->GetClass()->InheritsFrom("NeuKin"         )  ) ||
00190        ( tcarr->GetClass()->InheritsFrom("NuEvtKin"       )  ) ||
00191        ( tcarr->GetClass()->InheritsFrom("REROOT_FluxInfo") ||
00192          tcarr->GetClass()->InheritsFrom("FluxInfo"       )  ) ||
00193        ( tcarr->GetClass()->InheritsFrom("REROOT_FluxWgt" ) ||
00194          tcarr->GetClass()->InheritsFrom("FluxWgt"        )  )  ) {
00195     // Do nothing
00196     return;
00197   } // end if TClonesArray contains no time info
00198 
00199   
00200   
00201   std::cout << "=E= ConcatArrays: "
00202        << std::string(tcarr->At(0)->ClassName())
00203        << " is not a recognized SimSnarlRecord component: "
00204        << "this should really *never ever* happen, so you "
00205        << "probably broke something!"
00206             << std::endl; // really and truly
00207 
00208 }


Generated on 25 Apr 2018 for loon by  doxygen 1.6.1