1 |
mrudolph |
1.5 |
// $Id: FillerDecayParts.cc,v 1.4 2008/07/31 12:34:04 loizides Exp $
|
2 |
paus |
1.1 |
|
3 |
loizides |
1.4 |
#include "MitAna/DataTree/interface/DecayParticle.h"
|
4 |
paus |
1.1 |
#include "FWCore/MessageLogger/interface/MessageLogger.h"
|
5 |
|
|
#include "DataFormats/Common/interface/Handle.h"
|
6 |
|
|
#include "DataFormats/TrackReco/interface/Track.h"
|
7 |
|
|
#include "DataFormats/TrackReco/interface/TrackFwd.h"
|
8 |
|
|
#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
|
9 |
|
|
#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
|
10 |
|
|
#include "DataFormats/RecoCandidate/interface/TrackAssociation.h"
|
11 |
bendavid |
1.2 |
#include "MitEdm/DataFormats/interface/CollectionsEdm.h"
|
12 |
|
|
#include "MitEdm/DataFormats/interface/DecayPart.h"
|
13 |
|
|
#include "MitEdm/DataFormats/interface/BasePart.h"
|
14 |
|
|
#include "MitEdm/DataFormats/interface/BasePartFwd.h"
|
15 |
paus |
1.1 |
#include "MitProd/TreeFiller/interface/FillerDecayParts.h"
|
16 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
17 |
|
|
|
18 |
|
|
using namespace std;
|
19 |
|
|
using namespace edm;
|
20 |
|
|
using namespace mithep;
|
21 |
|
|
|
22 |
|
|
//--------------------------------------------------------------------------------------------------
|
23 |
loizides |
1.4 |
FillerDecayParts::FillerDecayParts(const ParameterSet &cfg, const char *name, bool active) :
|
24 |
paus |
1.1 |
BaseFiller(cfg,name,active),
|
25 |
loizides |
1.4 |
edmName_(Conf().getUntrackedParameter<string>("edmName","")),
|
26 |
|
|
mitName_(Conf().getUntrackedParameter<string>("mitName","")),
|
27 |
|
|
basePartMapName_(Conf().getUntrackedParameter<string>("basePartMap","")),
|
28 |
|
|
basePartMap_(0),
|
29 |
|
|
decays_(new mithep::DecayParticleArr(250))
|
30 |
paus |
1.1 |
{
|
31 |
loizides |
1.4 |
// Constructor.
|
32 |
paus |
1.1 |
}
|
33 |
|
|
|
34 |
|
|
//--------------------------------------------------------------------------------------------------
|
35 |
|
|
FillerDecayParts::~FillerDecayParts()
|
36 |
|
|
{
|
37 |
loizides |
1.4 |
// Destructor.
|
38 |
|
|
|
39 |
paus |
1.1 |
delete decays_;
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
//--------------------------------------------------------------------------------------------------
|
43 |
|
|
void FillerDecayParts::BookDataBlock(TreeWriter &tws)
|
44 |
|
|
{
|
45 |
loizides |
1.4 |
// Add tracks branch to tree and get our map.
|
46 |
|
|
|
47 |
paus |
1.1 |
tws.AddBranch(mitName_.c_str(),&decays_);
|
48 |
loizides |
1.4 |
|
49 |
|
|
if (!basePartMapName_.empty())
|
50 |
|
|
basePartMap_ = OS()->get<BasePartMap>(basePartMapName_.c_str());
|
51 |
paus |
1.1 |
}
|
52 |
|
|
|
53 |
|
|
//--------------------------------------------------------------------------------------------------
|
54 |
|
|
void FillerDecayParts::FillDataBlock(const edm::Event &evt,
|
55 |
|
|
const edm::EventSetup &setup)
|
56 |
|
|
{
|
57 |
loizides |
1.4 |
// Fill our EDM DecayPart collection into the MIT DecayParticle collection.
|
58 |
mrudolph |
1.5 |
cout << "Decay part block" << endl;
|
59 |
paus |
1.1 |
decays_->Reset();
|
60 |
loizides |
1.4 |
|
61 |
bendavid |
1.2 |
Handle<mitedm::DecayPartCol> hParts;
|
62 |
paus |
1.1 |
GetProduct(edmName_, hParts, evt);
|
63 |
bendavid |
1.2 |
const mitedm::DecayPartCol *iParts = hParts.product();
|
64 |
paus |
1.1 |
|
65 |
|
|
// loop through all decayParts and fill the information
|
66 |
bendavid |
1.2 |
for (UInt_t i=0; i<iParts->size(); ++i) {
|
67 |
|
|
const mitedm::DecayPart &p =iParts->at(i); // for convenience
|
68 |
paus |
1.1 |
//cout << "MITEDM...\n";p->print();
|
69 |
bendavid |
1.2 |
mithep::DecayParticle *d = decays_->Allocate();
|
70 |
|
|
new (d) mithep::DecayParticle(p.pid(),(mithep::DecayParticle::DecayType)p.decayType());
|
71 |
|
|
|
72 |
|
|
d->SetFittedMass(p.fittedMass());
|
73 |
|
|
d->SetFittedMassError(p.fittedMassError());
|
74 |
|
|
d->SetLxy(p.lxy());
|
75 |
|
|
d->SetLxyError(p.lxyError());
|
76 |
|
|
d->SetLxyToPv(p.lxyToPv());
|
77 |
|
|
d->SetLxyToPvError(p.lxyToPvError());
|
78 |
|
|
d->SetDxy(p.dxy());
|
79 |
|
|
d->SetDxyError(p.dxyError());
|
80 |
|
|
d->SetDxyToPv(p.dxyToPv());
|
81 |
|
|
d->SetDxyToPvError(p.dxyToPvError());
|
82 |
|
|
d->SetLz(p.lz());
|
83 |
|
|
d->SetLzError(p.lzError());
|
84 |
|
|
d->SetLzToPv(p.lzToPv());
|
85 |
|
|
d->SetLzToPvError(p.lzToPvError());
|
86 |
|
|
d->SetCTau(p.cTau());
|
87 |
|
|
d->SetCTauError(p.cTauError());
|
88 |
|
|
d->SetPt(p.pt());
|
89 |
|
|
d->SetPtError(p.ptError());
|
90 |
|
|
d->SetMom(p.fourMomentum());
|
91 |
|
|
d->SetPosition(p.position());
|
92 |
|
|
d->SetError(p.error());
|
93 |
|
|
d->SetBigError(p.bigError());
|
94 |
|
|
|
95 |
mrudolph |
1.5 |
d->SetChi2(p.chi2());
|
96 |
|
|
d->SetNdof(p.ndof());
|
97 |
|
|
|
98 |
bendavid |
1.2 |
//loop through and add daughters
|
99 |
loizides |
1.4 |
if (basePartMap_) {
|
100 |
bendavid |
1.2 |
for (Int_t j=0; j<p.nChild();j++) {
|
101 |
|
|
mitedm::BasePartBaseRef theRef = p.getChildRef(j);
|
102 |
loizides |
1.3 |
mithep::PairIntKey theKey(theRef.id().id(),theRef.key());
|
103 |
loizides |
1.4 |
mithep::Particle *daughter = basePartMap_->GetMit(theKey);
|
104 |
bendavid |
1.2 |
d->AddDaughter(daughter);
|
105 |
|
|
}
|
106 |
|
|
}
|
107 |
paus |
1.1 |
//cout << "MITHEP...\n";d->print();
|
108 |
|
|
}
|
109 |
|
|
decays_->Trim();
|
110 |
|
|
}
|