Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:51

0001 #include "FWPFPatJetLegoProxyBuilder.h"
0002 #include "Fireworks/Candidates/interface/FWLegoCandidate.h"
0003 
0004 //______________________________________________________________________________
0005 template <class T>
0006 FWPFPatJetLegoProxyBuilder<T>::FWPFPatJetLegoProxyBuilder() {}
0007 template <class T>
0008 FWPFPatJetLegoProxyBuilder<T>::~FWPFPatJetLegoProxyBuilder() {}
0009 
0010 //______________________________________________________________________________
0011 template <class T>
0012 void FWPFPatJetLegoProxyBuilder<T>::build(const T& iData,
0013                                           unsigned int iIndex,
0014                                           TEveElement& oItemHolder,
0015                                           const FWViewContext* vc) {
0016   std::vector<reco::PFCandidatePtr> consts = iData.getPFConstituents();
0017 
0018   typedef std::vector<reco::PFCandidatePtr>::const_iterator IC;
0019 
0020   for (IC ic = consts.begin(); ic != consts.end(); ++ic) {
0021     const reco::PFCandidatePtr& pfCandPtr = *ic;
0022 
0023     FWLegoCandidate* candidate = new FWLegoCandidate(vc,
0024                                                      FWProxyBuilderBase::context(),
0025                                                      pfCandPtr->energy(),
0026                                                      pfCandPtr->et(),
0027                                                      pfCandPtr->pt(),
0028                                                      pfCandPtr->eta(),
0029                                                      pfCandPtr->phi());
0030     candidate->SetMarkerColor(FWProxyBuilderBase::item()->defaultDisplayProperties().color());
0031     fireworks::setTrackTypePF((*pfCandPtr), candidate);
0032     FWProxyBuilderBase::setupAddElement(candidate, &oItemHolder);
0033 
0034     FWProxyBuilderBase::context().voteMaxEtAndEnergy(pfCandPtr->et(), pfCandPtr->energy());
0035   }
0036 }
0037 
0038 //______________________________________________________________________________
0039 template <class T>
0040 void FWPFPatJetLegoProxyBuilder<T>::scaleProduct(TEveElementList* parent,
0041                                                  FWViewType::EType type,
0042                                                  const FWViewContext* vc) {
0043   // loop items in product
0044   for (TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i) {
0045     if ((*i)->HasChildren()) {
0046       // loop elements for the reco::PFJet item
0047       for (TEveElement::List_i j = (*i)->BeginChildren(); j != (*i)->EndChildren(); ++j) {
0048         FWLegoCandidate* cand = dynamic_cast<FWLegoCandidate*>(*j);
0049         cand->updateScale(vc, FWProxyBuilderBase::context());
0050       }
0051     }
0052   }
0053 }
0054 
0055 //______________________________________________________________________________
0056 template <class T>
0057 void FWPFPatJetLegoProxyBuilder<T>::localModelChanges(const FWModelId& iId,
0058                                                       TEveElement* parent,
0059                                                       FWViewType::EType viewType,
0060                                                       const FWViewContext* vc) {
0061   // line set marker is not same color as line, have to fix it here
0062   if ((parent)->HasChildren()) {
0063     for (TEveElement::List_i j = parent->BeginChildren(); j != parent->EndChildren(); ++j) {
0064       FWLegoCandidate* cand = dynamic_cast<FWLegoCandidate*>(*j);
0065       cand->SetMarkerColor(FWProxyBuilderBase::item()->modelInfo(iId.index()).displayProperties().color());
0066       cand->ElementChanged();
0067     }
0068   }
0069 }
0070 
0071 //____________________________PAT_______________________________________________
0072 class FWPatJetLegoProxyBuilder : public FWPFPatJetLegoProxyBuilder<pat::Jet> {
0073 public:
0074   FWPatJetLegoProxyBuilder() {}
0075   ~FWPatJetLegoProxyBuilder() override {}
0076 
0077   REGISTER_PROXYBUILDER_METHODS();
0078 };
0079 
0080 //____________________________PF________________________________________________
0081 class FWPFJetLegoProxyBuilder : public FWPFPatJetLegoProxyBuilder<reco::PFJet> {
0082 public:
0083   FWPFJetLegoProxyBuilder() {}
0084   ~FWPFJetLegoProxyBuilder() override {}
0085 
0086   REGISTER_PROXYBUILDER_METHODS();
0087 };
0088 
0089 //______________________________________________________________________________
0090 template class FWPFPatJetLegoProxyBuilder<reco::PFJet>;
0091 template class FWPFPatJetLegoProxyBuilder<pat::Jet>;
0092 
0093 //______________________________________________________________________________
0094 REGISTER_FWPROXYBUILDER(FWPFJetLegoProxyBuilder,
0095                         reco::PFJet,
0096                         "PF Jet",
0097                         FWViewType::kLegoPFECALBit | FWViewType::kLegoBit);
0098 REGISTER_FWPROXYBUILDER(FWPatJetLegoProxyBuilder,
0099                         pat::Jet,
0100                         "PF PatJet",
0101                         FWViewType::kLegoPFECALBit | FWViewType::kLegoBit);