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

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 34 of file ConcatArrays.cxx.

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

Referenced by MCMerge::Get().

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

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

Definition at line 60 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

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

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

Definition at line 74 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

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

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

Definition at line 88 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

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

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

Definition at line 106 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

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

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

Definition at line 120 of file ConcatArrays.cxx.

Referenced by MCMerge::Get().

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

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

Definition at line 151 of file ConcatArrays.cxx.

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

Referenced by MCMerge::Get().

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


Generated on Mon Feb 15 11:10:36 2010 for loon by  doxygen 1.3.9.1