Skip to content
Snippets Groups Projects

'fix RestoreCaloRecoChain'

Closed Olivier Deschamps requested to merge FixRestoreCaloRecoChain into master
2 unresolved threads
1 file
+ 41
33
Compare changes
  • Side-by-side
  • Inline
@@ -22,8 +22,9 @@ DECLARE_ALGORITHM_FACTORY( RestoreCaloRecoChain )
//=============================================================================
RestoreCaloRecoChain::RestoreCaloRecoChain( const std::string& name,
ISvcLocator* pSvcLocator )
: DaVinciAlgorithm ( name , pSvcLocator )
{
: DaVinciAlgorithm ( name , pSvcLocator ),
m_rndmSvc( 0 )
Please register or sign in to reply
,m_useRaw(false){
Please register or sign in to reply
declareProperty("TESprefix" ,m_prefix="");
declareProperty("Verbose" ,m_verb=false); // activate verbose printing
declareProperty("UpdateLevel" ,m_update=5 );
@@ -494,6 +495,7 @@ bool RestoreCaloRecoChain::resumTree(const LHCb::Particle* p,bool head){
LHCb::Particle* part = (LHCb::Particle*) p;
part->setMomentum( mom );
part->setMomCovMatrix( cov );
part->setMeasuredMass( part->momentum().M() ); // set the measured mass
std::string type = ppSvc()->find(p->particleID())->name();
if(head && counterStat->isQuiet())counter("Resum "+type+" tree") += 1;
return true;
@@ -524,36 +526,42 @@ bool RestoreCaloRecoChain::refitTree(const LHCb::Particle* p){
// =================================== //
bool RestoreCaloRecoChain::copyTree(const LHCb::Particle* p, LHCb::DecayTree refit){
const LHCb::Particle* rhs = refit.findClone( *p );
if( ! rhs ) return true;
LHCb::Particle* part=(LHCb::Particle*) p;
part->setMeasuredMass (rhs->measuredMass() );
part->setMeasuredMassErr (rhs->measuredMassErr() );
part->setMomentum (rhs->momentum() );
part->setReferencePoint (rhs->referencePoint() );
part->setMomCovMatrix (rhs->momCovMatrix() );
part->setPosCovMatrix (rhs->posCovMatrix() );
part->setPosMomCovMatrix (rhs->posMomCovMatrix() );
part->setWeight (rhs->weight() );
LHCb::Vertex* v = (LHCb::Vertex*) part->endVertex();
if( v && rhs->endVertex() ){
v->setTechnique ( rhs->endVertex()->technique() );
v->setChi2AndDoF (rhs->endVertex()->chi2(),rhs->endVertex()->nDoF() );
v->setPosition (rhs->endVertex()->position() );
v->setCovMatrix (rhs->endVertex()->covMatrix() );}
else if( ! v && rhs->endVertex() ){
if(counterStat->isQuiet())counter("Refit tree has a different vtx structure")+=1;
if ( msgLevel(MSG::DEBUG) )debug() << p->particleID().pid() << " no vertex but rhs has" <<endmsg;
return true;
}
else if( v && ! rhs->endVertex() ){
if(counterStat->isQuiet())counter("Original tree has a different vtx structure")+=1;
if ( msgLevel(MSG::DEBUG) )debug() << p->particleID().pid() << " has vertex but rhs don't" <<endmsg;
return false;
}
// reset the daughters
std::string type = ppSvc()->find(p->particleID())->name();
//info() << "Copy Tree " << type << " find clone : rhs = "<< rhs << " #daughters " << (p->daughters()).size() << endmsg;
bool ok=true;
for ( const LHCb::Particle* d : part->daughters() ){
ok=ok&&copyTree(d,refit);
if( rhs ){
LHCb::Particle* part=(LHCb::Particle*) p;
part->setMeasuredMass (rhs->measuredMass() );
part->setMeasuredMassErr (rhs->measuredMassErr() );
part->setMomentum (rhs->momentum() );
part->setReferencePoint (rhs->referencePoint() );
part->setMomCovMatrix (rhs->momCovMatrix() );
part->setPosCovMatrix (rhs->posCovMatrix() );
part->setPosMomCovMatrix (rhs->posMomCovMatrix() );
part->setWeight (rhs->weight() );
LHCb::Vertex* v = (LHCb::Vertex*) part->endVertex();
if( v && rhs->endVertex() ){
v->setTechnique (rhs->endVertex()->technique() );
v->setChi2AndDoF (rhs->endVertex()->chi2(),rhs->endVertex()->nDoF() );
v->setPosition (rhs->endVertex()->position() );
v->setCovMatrix (rhs->endVertex()->covMatrix() );}
else if( ! v && rhs->endVertex() ){
if(counterStat->isQuiet())counter("Refit tree has a different vtx structure")+=1;
if ( msgLevel(MSG::DEBUG) )debug() << p->particleID().pid() << " no vertex but rhs has" <<endmsg;
}
else if( v && ! rhs->endVertex() ){
if(counterStat->isQuiet())counter("Original tree has a different vtx structure")+=1;
if ( msgLevel(MSG::DEBUG) )debug() << p->particleID().pid() << " has vertex but rhs don't" <<endmsg;
ok=false;
}
}else
ok=false;
// reset the daughters
for ( const LHCb::Particle* d : p->daughters() ){
//info() << " - DAUGHTER " << ppSvc()->find(d->particleID())->name() << endmsg;
bool dok=copyTree(d,refit);
ok= dok && ok;
}
return ok;
}
@@ -738,8 +746,8 @@ bool RestoreCaloRecoChain::updateProtoInfo( LHCb::ProtoParticle* proto ){
double hcal2ecal = ( ecal ) ? hcal/ecal : 0.;
resetProtoInfo(proto, LHCb::ProtoParticle::CaloNeutralHcal2Ecal , hcal2ecal ); // rebuild Hcal/Ecal
resetProtoInfo(proto, LHCb::ProtoParticle::CaloNeutralPrs , HypoPrsE );
resetProtoInfo(proto, LHCb::ProtoParticle::ShowerShape , Spread ); // ** input to neutralID && isPhoton (as Fr2)
resetProtoInfo(proto, LHCb::ProtoParticle::CaloNeutralSpd , HypoSpdM ); // ** input to neutralID
//resetProtoInfo(proto, LHCb::ProtoParticle::ShowerShape , Spread ); // ** input to neutralID && isPhoton (as Fr2)
//resetProtoInfo(proto, LHCb::ProtoParticle::CaloNeutralSpd , HypoSpdM ); // ** input to neutralID
resetProtoInfo(proto, LHCb::ProtoParticle::CaloClusterCode, ClusterCode );
resetProtoInfo(proto, LHCb::ProtoParticle::CaloClusterFrac, ClusterFrac, 1. );
resetProtoInfo(proto, LHCb::ProtoParticle::Saturation , Saturation , 0 );
Loading