CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Fireworks/Calo/src/makeEveJetCone.cc

Go to the documentation of this file.
00001 #include "TEveJetCone.h"
00002 #include "DataFormats/JetReco/interface/Jet.h"
00003 #include "Fireworks/Core/interface/Context.h"
00004 
00005 namespace fireworks 
00006 {
00007 TEveJetCone* makeEveJetCone(const reco::Jet& iData, const fireworks::Context& context)
00008 {
00009    TEveJetCone* jet = new TEveJetCone();
00010    jet->SetApex(TEveVector(iData.vertex().x(),iData.vertex().y(),iData.vertex().z()));
00011 
00012    reco::Jet::Constituents c = iData.getJetConstituents();
00013    bool haveData = true;
00014    for ( reco::Jet::Constituents::const_iterator itr = c.begin(); itr != c.end(); ++itr )
00015    {
00016       if ( !itr->isAvailable() ) {
00017          haveData = false;
00018          break;
00019       }
00020    }
00021 
00022    double eta_size = 0.2;
00023    double phi_size = 0.2;
00024    if ( haveData ){
00025       eta_size = sqrt(iData.etaetaMoment());
00026       phi_size = sqrt(iData.phiphiMoment());
00027    }
00028 
00029    static const float offr = 5;
00030    static const float offz = offr/tan(context.caloTransAngle());
00031    if (iData.eta() < context.caloMaxEta())
00032       jet->SetCylinder(context.caloR1(false) -offr, context.caloZ1(false)-offz);
00033    else
00034       jet->SetCylinder(context.caloR2(false) -offr, context.caloZ2(false)-offz);
00035 
00036 
00037    jet-> AddEllipticCone(iData.eta(), iData.phi(), eta_size, phi_size);
00038    jet->SetPickable(kTRUE);
00039    return jet;
00040 }
00041 }