1 |
bendavid |
1.10 |
// $Id: FillerBasicClusters.cc,v 1.9 2009/09/25 08:42:50 loizides Exp $
|
2 |
sixie |
1.1 |
|
3 |
|
|
#include "MitProd/TreeFiller/interface/FillerBasicClusters.h"
|
4 |
bendavid |
1.7 |
#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
|
5 |
|
|
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
|
6 |
loizides |
1.6 |
#include "MitAna/DataTree/interface/BasicClusterCol.h"
|
7 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
8 |
|
|
#include "MitProd/ObjectService/interface/ObjectService.h"
|
9 |
sixie |
1.11 |
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
|
10 |
sixie |
1.1 |
|
11 |
|
|
using namespace std;
|
12 |
|
|
using namespace edm;
|
13 |
|
|
using namespace mithep;
|
14 |
|
|
|
15 |
|
|
//--------------------------------------------------------------------------------------------------
|
16 |
|
|
FillerBasicClusters::FillerBasicClusters(const ParameterSet &cfg, const char *name, bool active) :
|
17 |
|
|
BaseFiller(cfg,name,active),
|
18 |
|
|
edmName_(Conf().getUntrackedParameter<string>("edmName","hybridSuperClusters")),
|
19 |
|
|
mitName_(Conf().getUntrackedParameter<string>("mitName","BasicClusters")),
|
20 |
sixie |
1.11 |
barrelEcalRecHitName_(Conf().getUntrackedParameter<string>("barrelEcalRecHitName","")),
|
21 |
|
|
endcapEcalRecHitName_(Conf().getUntrackedParameter<string>("endcapEcalRecHitName","")),
|
22 |
sixie |
1.1 |
basicClusterMapName_(Conf().getUntrackedParameter<string>("basicClusterMapName",
|
23 |
|
|
"BasicClusterMap")),
|
24 |
|
|
basicClusters_(new mithep::BasicClusterArr(100)),
|
25 |
|
|
basicClusterMap_(new mithep::BasicClusterMap)
|
26 |
|
|
{
|
27 |
|
|
// Constructor.
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
//--------------------------------------------------------------------------------------------------
|
31 |
|
|
FillerBasicClusters::~FillerBasicClusters()
|
32 |
|
|
{
|
33 |
|
|
// Destructor.
|
34 |
|
|
|
35 |
|
|
delete basicClusters_;
|
36 |
|
|
delete basicClusterMap_;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
//--------------------------------------------------------------------------------------------------
|
40 |
bendavid |
1.10 |
void FillerBasicClusters::BookDataBlock(TreeWriter &tws)
|
41 |
sixie |
1.1 |
{
|
42 |
|
|
// Add BasicCluster branch and the BasicClusterMap to tree.
|
43 |
|
|
|
44 |
loizides |
1.5 |
tws.AddBranch(mitName_,&basicClusters_);
|
45 |
|
|
OS()->add<BasicClusterArr>(basicClusters_,mitName_);
|
46 |
sixie |
1.1 |
|
47 |
loizides |
1.5 |
if (!basicClusterMapName_.empty()) {
|
48 |
|
|
basicClusterMap_->SetBrName(mitName_);
|
49 |
|
|
OS()->add<BasicClusterMap>(basicClusterMap_,basicClusterMapName_);
|
50 |
|
|
}
|
51 |
sixie |
1.1 |
}
|
52 |
|
|
|
53 |
|
|
//--------------------------------------------------------------------------------------------------
|
54 |
|
|
void FillerBasicClusters::FillDataBlock(const edm::Event &event,
|
55 |
loizides |
1.2 |
const edm::EventSetup &setup)
|
56 |
sixie |
1.1 |
{
|
57 |
loizides |
1.5 |
// Fill the BasicCluster information into our structures.
|
58 |
sixie |
1.1 |
|
59 |
bendavid |
1.3 |
basicClusters_->Delete();
|
60 |
sixie |
1.1 |
basicClusterMap_->Reset();
|
61 |
|
|
|
62 |
bendavid |
1.7 |
Handle<reco::CaloClusterCollection> hBasicClusterProduct;
|
63 |
sixie |
1.1 |
GetProduct(edmName_, hBasicClusterProduct, event);
|
64 |
|
|
basicClusterMap_->SetEdmProductId(hBasicClusterProduct.id().id());
|
65 |
bendavid |
1.7 |
const reco::CaloClusterCollection inBasicClusters = *(hBasicClusterProduct.product());
|
66 |
sixie |
1.1 |
|
67 |
sixie |
1.11 |
|
68 |
|
|
EcalClusterLazyTools lazyTools(event, setup, edm::InputTag(barrelEcalRecHitName_),
|
69 |
|
|
edm::InputTag(endcapEcalRecHitName_));
|
70 |
|
|
|
71 |
sixie |
1.1 |
// loop through all basic clusters
|
72 |
bendavid |
1.7 |
for (reco::CaloClusterCollection::const_iterator inBC = inBasicClusters.begin();
|
73 |
sixie |
1.1 |
inBC != inBasicClusters.end(); ++inBC) {
|
74 |
|
|
|
75 |
|
|
mithep::BasicCluster *outBasicCluster = basicClusters_->Allocate();
|
76 |
|
|
new (outBasicCluster) mithep::BasicCluster();
|
77 |
|
|
|
78 |
|
|
outBasicCluster->SetXYZ(inBC->x(),inBC->y(),inBC->z());
|
79 |
bendavid |
1.4 |
outBasicCluster->SetEnergy(inBC->energy());
|
80 |
sixie |
1.11 |
outBasicCluster->SetNHits(inBC->size());
|
81 |
|
|
outBasicCluster->SetE1x3(lazyTools.e1x3(*inBC));
|
82 |
|
|
outBasicCluster->SetE3x1(lazyTools.e3x1(*inBC));
|
83 |
|
|
outBasicCluster->SetE1x5(lazyTools.e1x5(*inBC));
|
84 |
|
|
outBasicCluster->SetE2x2(lazyTools.e2x2(*inBC));
|
85 |
|
|
outBasicCluster->SetE3x2(lazyTools.e3x2(*inBC));
|
86 |
|
|
outBasicCluster->SetE3x3(lazyTools.e3x3(*inBC));
|
87 |
|
|
outBasicCluster->SetE4x4(lazyTools.e4x4(*inBC));
|
88 |
|
|
outBasicCluster->SetE5x5(lazyTools.e5x5(*inBC));
|
89 |
|
|
outBasicCluster->SetE2x5Right(lazyTools.e2x5Right(*inBC));
|
90 |
|
|
outBasicCluster->SetE2x5Left(lazyTools.e2x5Left(*inBC));
|
91 |
|
|
outBasicCluster->SetE2x5Top(lazyTools.e2x5Top(*inBC));
|
92 |
|
|
outBasicCluster->SetE2x5Bottom(lazyTools.e2x5Bottom(*inBC));
|
93 |
|
|
outBasicCluster->SetE2x5Max(lazyTools.e2x5Max(*inBC));
|
94 |
|
|
outBasicCluster->SetELeft(lazyTools.eLeft(*inBC));
|
95 |
|
|
outBasicCluster->SetERight(lazyTools.eRight(*inBC));
|
96 |
|
|
outBasicCluster->SetETop(lazyTools.eTop(*inBC));
|
97 |
|
|
outBasicCluster->SetEBottom(lazyTools.eBottom(*inBC));
|
98 |
|
|
outBasicCluster->SetEMax(lazyTools.eMax(*inBC));
|
99 |
|
|
outBasicCluster->SetE2nd(lazyTools.e2nd(*inBC));
|
100 |
|
|
outBasicCluster->SetEtaLat(lazyTools.lat(*inBC)[0]);
|
101 |
|
|
outBasicCluster->SetPhiLat(lazyTools.lat(*inBC)[1]);
|
102 |
|
|
outBasicCluster->SetLat(lazyTools.lat(*inBC)[2]);
|
103 |
|
|
outBasicCluster->SetCovEtaEta(lazyTools.covariances(*inBC)[0]);
|
104 |
|
|
outBasicCluster->SetCovEtaPhi(lazyTools.covariances(*inBC)[1]);
|
105 |
|
|
outBasicCluster->SetCovPhiPhi(lazyTools.covariances(*inBC)[2]);
|
106 |
|
|
outBasicCluster->SetCoviEtaiEta(lazyTools.localCovariances(*inBC)[0]);
|
107 |
|
|
outBasicCluster->SetCoviEtaiPhi(lazyTools.localCovariances(*inBC)[1]);
|
108 |
|
|
outBasicCluster->SetCoviPhiiPhi(lazyTools.localCovariances(*inBC)[2]);
|
109 |
|
|
outBasicCluster->SetZernike20(lazyTools.zernike20(*inBC));
|
110 |
|
|
outBasicCluster->SetZernike42(lazyTools.zernike42(*inBC));
|
111 |
sixie |
1.1 |
|
112 |
loizides |
1.8 |
// add basic clusters to the map
|
113 |
bendavid |
1.7 |
reco::CaloClusterPtr thePtr(hBasicClusterProduct, inBC-inBasicClusters.begin());
|
114 |
|
|
basicClusterMap_->Add(thePtr, outBasicCluster);
|
115 |
sixie |
1.1 |
}
|
116 |
|
|
basicClusters_->Trim();
|
117 |
|
|
}
|