ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/FillerBasicClusters.cc
Revision: 1.17
Committed: Mon Oct 10 20:57:28 2011 UTC (13 years, 6 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025
Branch point for: Mit_025c_branch
Changes since 1.16: +10 -29 lines
Log Message:
add crystal tilt axes to basic cluster

File Contents

# Content
1 // $Id: FillerBasicClusters.cc,v 1.16 2011/10/09 23:28:48 bendavid Exp $
2
3 #include "MitProd/TreeFiller/interface/FillerBasicClusters.h"
4 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
5 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
6 #include "MitAna/DataTree/interface/BasicClusterCol.h"
7 #include "MitAna/DataTree/interface/Names.h"
8 #include "MitProd/ObjectService/interface/ObjectService.h"
9 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
10 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
11 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
12 #include "HiggsAnalysis/HiggsToGammaGamma/interface/EcalClusterLocal.h"
13
14 using namespace std;
15 using namespace edm;
16 using namespace mithep;
17
18 //--------------------------------------------------------------------------------------------------
19 FillerBasicClusters::FillerBasicClusters(const ParameterSet &cfg, const char *name, bool active) :
20 BaseFiller(cfg,name,active),
21 edmName_(Conf().getUntrackedParameter<string>("edmName","hybridSuperClusters")),
22 mitName_(Conf().getUntrackedParameter<string>("mitName","BasicClusters")),
23 barrelEcalRecHitName_(Conf().getUntrackedParameter<string>("barrelEcalRecHitName","")),
24 endcapEcalRecHitName_(Conf().getUntrackedParameter<string>("endcapEcalRecHitName","")),
25 basicClusterMapName_(Conf().getUntrackedParameter<string>("basicClusterMapName",
26 "BasicClusterMap")),
27 basicClusters_(new mithep::BasicClusterArr(100)),
28 basicClusterMap_(new mithep::BasicClusterMap)
29 {
30 // Constructor.
31 }
32
33 //--------------------------------------------------------------------------------------------------
34 FillerBasicClusters::~FillerBasicClusters()
35 {
36 // Destructor.
37
38 delete basicClusters_;
39 delete basicClusterMap_;
40 }
41
42 //--------------------------------------------------------------------------------------------------
43 void FillerBasicClusters::BookDataBlock(TreeWriter &tws)
44 {
45 // Add BasicCluster branch and the BasicClusterMap to tree.
46
47 tws.AddBranch(mitName_,&basicClusters_);
48 OS()->add<BasicClusterArr>(basicClusters_,mitName_);
49
50 if (!basicClusterMapName_.empty()) {
51 basicClusterMap_->SetBrName(mitName_);
52 OS()->add<BasicClusterMap>(basicClusterMap_,basicClusterMapName_);
53 }
54 }
55
56 //--------------------------------------------------------------------------------------------------
57 void FillerBasicClusters::FillDataBlock(const edm::Event &event,
58 const edm::EventSetup &setup)
59 {
60 // Fill the BasicCluster information into our structures.
61
62 basicClusters_->Delete();
63 basicClusterMap_->Reset();
64
65 Handle<reco::CaloClusterCollection> hBasicClusterProduct;
66 GetProduct(edmName_, hBasicClusterProduct, event);
67 basicClusterMap_->SetEdmProductId(hBasicClusterProduct.id().id());
68 const reco::CaloClusterCollection inBasicClusters = *(hBasicClusterProduct.product());
69
70 // edm::Handle< EcalRecHitCollection > pEBRecHits;
71 // event.getByLabel(barrelEcalRecHitName_, pEBRecHits );
72 // const EcalRecHitCollection * ebRecHits_ = pEBRecHits.product();
73 // edm::Handle< EcalRecHitCollection > pEERecHits;
74 // event.getByLabel( endcapEcalRecHitName_, pEERecHits );
75 // const EcalRecHitCollection * eeRecHits_ = pEERecHits.product();
76
77 EcalClusterLazyTools lazyTools(event, setup, edm::InputTag(barrelEcalRecHitName_),
78 edm::InputTag(endcapEcalRecHitName_));
79
80 EcalClusterLocal local;
81
82 // loop through all basic clusters
83 for (reco::CaloClusterCollection::const_iterator inBC = inBasicClusters.begin();
84 inBC != inBasicClusters.end(); ++inBC) {
85
86 mithep::BasicCluster *outBasicCluster = basicClusters_->Allocate();
87 new (outBasicCluster) mithep::BasicCluster();
88
89 outBasicCluster->SetXYZ(inBC->x(),inBC->y(),inBC->z());
90 outBasicCluster->SetEnergy(inBC->energy());
91 outBasicCluster->SetNHits(inBC->size());
92 outBasicCluster->SetE1x3(lazyTools.e1x3(*inBC));
93 outBasicCluster->SetE3x1(lazyTools.e3x1(*inBC));
94 outBasicCluster->SetE1x5(lazyTools.e1x5(*inBC));
95 outBasicCluster->SetE2x2(lazyTools.e2x2(*inBC));
96 outBasicCluster->SetE3x2(lazyTools.e3x2(*inBC));
97 outBasicCluster->SetE3x3(lazyTools.e3x3(*inBC));
98 outBasicCluster->SetE4x4(lazyTools.e4x4(*inBC));
99 outBasicCluster->SetE5x5(lazyTools.e5x5(*inBC));
100 outBasicCluster->SetE2x5Right(lazyTools.e2x5Right(*inBC));
101 outBasicCluster->SetE2x5Left(lazyTools.e2x5Left(*inBC));
102 outBasicCluster->SetE2x5Top(lazyTools.e2x5Top(*inBC));
103 outBasicCluster->SetE2x5Bottom(lazyTools.e2x5Bottom(*inBC));
104 outBasicCluster->SetE2x5Max(lazyTools.e2x5Max(*inBC));
105 outBasicCluster->SetELeft(lazyTools.eLeft(*inBC));
106 outBasicCluster->SetERight(lazyTools.eRight(*inBC));
107 outBasicCluster->SetETop(lazyTools.eTop(*inBC));
108 outBasicCluster->SetEBottom(lazyTools.eBottom(*inBC));
109 outBasicCluster->SetEMax(lazyTools.eMax(*inBC));
110 outBasicCluster->SetE2nd(lazyTools.e2nd(*inBC));
111 outBasicCluster->SetEtaLat(lazyTools.lat(*inBC)[0]);
112 outBasicCluster->SetPhiLat(lazyTools.lat(*inBC)[1]);
113 outBasicCluster->SetLat(lazyTools.lat(*inBC)[2]);
114 outBasicCluster->SetCovEtaEta(lazyTools.covariances(*inBC)[0]);
115 outBasicCluster->SetCovEtaPhi(lazyTools.covariances(*inBC)[1]);
116 outBasicCluster->SetCovPhiPhi(lazyTools.covariances(*inBC)[2]);
117 outBasicCluster->SetCoviEtaiEta(lazyTools.localCovariances(*inBC)[0]);
118 outBasicCluster->SetCoviEtaiPhi(lazyTools.localCovariances(*inBC)[1]);
119 outBasicCluster->SetCoviPhiiPhi(lazyTools.localCovariances(*inBC)[2]);
120 outBasicCluster->SetZernike20(lazyTools.zernike20(*inBC));
121 outBasicCluster->SetZernike42(lazyTools.zernike42(*inBC));
122
123 //local coordinates
124 if (std::abs(inBC->eta())<1.48) {
125 float etacry, phicry, thetatilt, phitilt;
126 int ieta, iphi;
127 local.localCoordsEB(*inBC,setup,etacry,phicry,ieta,iphi,thetatilt,phitilt);
128 outBasicCluster->SetEtaCry(etacry);
129 outBasicCluster->SetPhiCry(phicry);
130 outBasicCluster->SetIEta(ieta);
131 outBasicCluster->SetIPhi(iphi);
132 outBasicCluster->SetThetaAxis(thetatilt);
133 outBasicCluster->SetPhiAxis(phitilt);
134 }
135 else {
136 float xcry, ycry, thetatilt, phitilt;
137 int ix, iy;
138 local.localCoordsEE(*inBC,setup,xcry,ycry,ix,iy,thetatilt,phitilt);
139 outBasicCluster->SetXCry(xcry);
140 outBasicCluster->SetYCry(ycry);
141 outBasicCluster->SetIX(ix);
142 outBasicCluster->SetIY(iy);
143 outBasicCluster->SetThetaAxis(thetatilt);
144 outBasicCluster->SetPhiAxis(phitilt);
145 }
146
147 // add basic clusters to the map
148 reco::CaloClusterPtr thePtr(hBasicClusterProduct, inBC-inBasicClusters.begin());
149 basicClusterMap_->Add(thePtr, outBasicCluster);
150
151 }
152 basicClusters_->Trim();
153 }