//----------------------------------------------------------------------------- // Fill conversion pair block // Author: Michael Gold // Date: Nov 20, 2002 // // running on the output of the conversion finder module: see // SoftElectronMods/ConversionFilterModule.hh // MichaelR here = Riveline (not Gold) //----------------------------------------------------------------------------- #include "evt/Event.hh" #include #include #include "SoftElectronObjects/ConversionColl.hh" #include "SoftElectronObjects/ConversionPartner.hh" #include "Stntuple/mod/StntupleUtilities.hh" #include "Stntuple/obj/TStnEvent.hh" #include "Stntuple/obj/TStnTrackBlock.hh" #include "Stntuple/obj/TStnConversion.hh" #include "Stntuple/obj/TStnConversionBlock.hh" //_____________________________________________________________________________ Int_t StntupleInitConversion(TStnConversion* Conv , const ConversionPartner* MichaelR) { Conv->fAlgorithm = MichaelR->algorithm(); Conv->fVertex.SetXYZ(0.,0.,0); Conv->fFittedVertex.SetXYZ(MichaelR->x_vertex(), MichaelR->y_vertex(), MichaelR->z_vertex()); Conv->fSeparation = -99.; Conv->fDeltaLam = -99.; Conv->fFittedDeltaLam = -99; Conv->fChi2 = -1.; Conv->fProb = -1; Conv->fMassGamma =-99; Conv->fCosGamma =-99; // save nice and simple pointers... Conv->fCdfTrack[0] = MichaelR->PosTrack().operator->(); Conv->fCdfTrack[1] = MichaelR->NegTrack().operator->(); HepLorentzVector ppos(Conv->fCdfTrack[0]->fourMomentum(0.1396)); HepLorentzVector pneg(Conv->fCdfTrack[1]->fourMomentum(0.1396)); Conv->fFittedTrackMomentum[0].SetXYZM(ppos.px(),ppos.py(),ppos.pz(), 0.000511); Conv->fFittedTrackMomentum[1].SetXYZM(pneg.px(),pneg.py(),pneg.pz(), 0.000511); Conv->fMomentum.SetXYZM(ppos.px()+pneg.px(), ppos.py()+pneg.py(), ppos.pz()+pneg.pz(), 0.0); Conv->fRadius = Conv->fVertex.Pt(); if( Conv->fAlgorithm > 1 ) { Conv->fMassGamma = MichaelR->mass_gamma(); Conv->fCosGamma = MichaelR->cos_gamma (); Conv->fProb = MichaelR->prob_fit(); } else { } if ((Conv->fAlgorithm == 1) || (Conv->fAlgorithm > 3)) { Conv->fSeparation = MichaelR->sep (); Conv->fDeltaLam = MichaelR->dcotth(); } return 0; } //--------------------------------------------------------------------------- Int_t StntupleInitConversionBlock(TStnDataBlock* block, AbsEvent* event, int mode) { // check if already initialized for this event int ev_number = AbsEnv::instance()->trigNumber(); int rn_number = AbsEnv::instance()->runNumber(); if (block->Initialized(ev_number,rn_number)) return 0; TStnConversionBlock* data = (TStnConversionBlock*) block; data->Clear(); char process[100], description[100], coll_type[100]; StntupleGetProcessName(data->CollName()->Data(),process,description,coll_type); EventRecord::ConstIterator it(event,"ConversionColl"); if (!it.is_valid()) return -2; ConstHandle hand(it); for(ConversionColl::const_iterator p = hand->contents().begin(); p != hand->contents().end(); ++p) { TStnConversion* c = data->NewConversion(); const ConversionPartner* pp = &(*p); StntupleInitConversion(c,pp); } data->f_RunNumber = rn_number; data->f_EventNumber = ev_number; return 0; } //_____________________________________________________________________________ Int_t StntupleConversionBlockLinks(TStnDataBlock* block, AbsEvent* event, int mode ) { // comment here int ev_number, rn_number; TStnConversionBlock* cb; TStnTrackBlock* tb; TStnConversion* conv; Int_t ipos, ineg; ev_number = AbsEnv::instance()->trigNumber(); rn_number = AbsEnv::instance()->runNumber(); if (! block->Initialized(ev_number,rn_number)) return -1; //----------------------------------------------------------------------------- // do not do initialize links 2nd time //----------------------------------------------------------------------------- if (block->LinksInitialized()) return 0; cb = (TStnConversionBlock*) block; tb = (TStnTrackBlock*) cb->GetEvent()->GetDataBlock("TrackBlock"); int nc = cb->NConversions(); for (int i=0; iConversion(i); ipos = tb->TrackNumber(conv->GetCdfTrack(0)); ineg = tb->TrackNumber(conv->GetCdfTrack(1)); conv->SetTrackNumber(0,ipos); conv->SetTrackNumber(1,ineg); } block->SetLinksInitialized(); return 0; }