1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* FWPSimHitProxyBuilder.cc
* FWorks
*
* Created by Ianna Osborne on 9/9/10.
*
*/
#include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
#include "Fireworks/Core/interface/FWEventItem.h"
#include "Fireworks/Core/interface/FWGeometry.h"
#include "Fireworks/Core/interface/fwLog.h"
#include "SimDataFormats/TrackingHit/interface/PSimHit.h"
#include <DataFormats/MuonDetId/interface/DTWireId.h>
#include "TEvePointSet.h"
class FWPSimHitProxyBuilder : public FWSimpleProxyBuilderTemplate<PSimHit> {
public:
FWPSimHitProxyBuilder(void) {}
~FWPSimHitProxyBuilder(void) override {}
bool haveSingleProduct() const override { return false; }
REGISTER_PROXYBUILDER_METHODS();
// Disable default copy constructor
FWPSimHitProxyBuilder(const FWPSimHitProxyBuilder&) = delete;
// Disable default assignment operator
const FWPSimHitProxyBuilder& operator=(const FWPSimHitProxyBuilder&) = delete;
private:
using FWSimpleProxyBuilderTemplate<PSimHit>::buildViewType;
void buildViewType(const PSimHit& iData,
unsigned int iIndex,
TEveElement& oItemHolder,
FWViewType::EType type,
const FWViewContext*) override;
};
void FWPSimHitProxyBuilder::buildViewType(
const PSimHit& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext*) {
TEvePointSet* pointSet = new TEvePointSet;
setupAddElement(pointSet, &oItemHolder);
const FWGeometry* geom = item()->getGeom();
unsigned int rawid = iData.detUnitId();
if (!geom->contains(rawid)) {
fwLog(fwlog::kError) << "failed to get geometry of detid: " << rawid << std::endl;
return;
}
float local[3] = {iData.localPosition().x(), iData.localPosition().y(), iData.localPosition().z()};
float global[3];
// Specialized for DT simhits
DetId id(rawid);
if (id.det() == DetId::Muon && id.subdetId() == 1) {
DTWireId wId(rawid);
rawid = wId.layerId().rawId(); // DT simhits are in the RF of the DTLayer, but their ID is the id of the wire!
if (abs(iData.particleType()) != 13) {
pointSet->SetMarkerStyle(26); // Draw non-muon simhits (e.g. delta rays) with a different marker
}
if (type == FWViewType::kRhoZ) { //
// In RhoZ view, draw hits at the middle of the layer in the global Z coordinate,
// otherwise they won't align with 1D rechits, for which only one coordinate is known.
if (wId.superLayer() == 2) {
local[1] = 0;
} else {
local[0] = 0;
}
}
}
geom->localToGlobal(rawid, local, global);
pointSet->SetNextPoint(global[0], global[1], global[2]);
}
REGISTER_FWPROXYBUILDER(FWPSimHitProxyBuilder, PSimHit, "PSimHits", FWViewType::kAll3DBits | FWViewType::kAllRPZBits);
|