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