62 void endJob()
override;
114 : produceHFhits_(iConfig.getParameter<
bool>(
"produceHFhits")),
115 produceHFtowers_(iConfig.getParameter<
bool>(
"produceHFtowers")),
116 produceEcalhits_(iConfig.getParameter<
bool>(
"produceEcalhits")),
117 produceZDChits_(iConfig.getParameter<
bool>(
"produceZDChits")),
118 lowGainZDC_(iConfig.getParameter<
bool>(
"lowGainZDC")),
119 produceETmidRap_(iConfig.getParameter<
bool>(
"produceETmidRapidity")),
120 producePixelhits_(iConfig.getParameter<
bool>(
"producePixelhits")),
121 doPixelCut_(iConfig.getParameter<
bool>(
"doPixelCut")),
122 produceTracks_(iConfig.getParameter<
bool>(
"produceTracks")),
123 producePixelTracks_(iConfig.getParameter<
bool>(
"producePixelTracks")),
124 midRapidityRange_(iConfig.getParameter<double>(
"midRapidityRange")),
125 trackPtCut_(iConfig.getParameter<double>(
"trackPtCut")),
126 trackEtaCut_(iConfig.getParameter<double>(
"trackEtaCut")),
127 hfEtaCut_(iConfig.getParameter<double>(
"hfEtaCut")),
128 reuseAny_(iConfig.getParameter<
bool>(
"reUseCentrality")),
129 useQuality_(iConfig.getParameter<
bool>(
"useQuality")),
133 srcTowers_((produceHFtowers_ || produceETmidRap_)
142 srcPixelhits_(producePixelhits_
147 srcPixelTracks_(producePixelTracks_
150 srcVertex_((produceTracks_ || producePixelTracks_)
161 produces<Centrality>();
170 auto creco = std::make_unique<Centrality>();
176 creco->etHFhitSumPlus_ = 0;
177 creco->etHFhitSumMinus_ = 0;
180 for (
size_t ihit = 0; ihit <
hits->size(); ++ihit) {
181 const HFRecHit& rechit = (*hits)[ihit];
182 if (rechit.
id().
ieta() > 0)
183 creco->etHFhitSumPlus_ += rechit.
energy();
184 if (rechit.
id().
ieta() < 0)
185 creco->etHFhitSumMinus_ += rechit.
energy();
189 creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
190 creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
195 creco->etHFtowerSumPlus_ = 0;
196 creco->etHFtowerSumMinus_ = 0;
197 creco->etHFtowerSumECutPlus_ = 0;
198 creco->etHFtowerSumECutMinus_ = 0;
199 creco->etMidRapiditySum_ = 0;
204 for (
size_t i = 0;
i <
towers->size(); ++
i) {
210 creco->etHFtowerSumPlus_ +=
tower.pt();
211 if (
tower.energy() > 1.5)
212 creco->etHFtowerSumECutPlus_ +=
tower.pt();
214 creco->etHFtruncatedPlus_ +=
tower.pt();
216 creco->etHFtowerSumMinus_ +=
tower.pt();
217 if (
tower.energy() > 1.5)
218 creco->etHFtowerSumECutMinus_ +=
tower.pt();
220 creco->etHFtruncatedMinus_ +=
tower.pt();
224 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
225 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
226 creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
227 creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
228 creco->etHFtruncatedMinus_ = inputCentrality->EtHFtruncatedMinus();
229 creco->etHFtruncatedPlus_ = inputCentrality->EtHFtruncatedPlus();
236 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
240 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
241 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
242 creco->etHFtowerSumECutMinus_ = inputCentrality->EtHFtowerSumECutMinus();
243 creco->etHFtowerSumECutPlus_ = inputCentrality->EtHFtowerSumECutPlus();
244 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
249 creco->etEESumPlus_ = 0;
250 creco->etEESumMinus_ = 0;
259 for (
unsigned int i = 0;
i < ebHits->
size(); ++
i) {
262 double et =
hit.energy() * (
pos.perp() /
pos.mag());
263 creco->etEBSum_ +=
et;
266 for (
unsigned int i = 0;
i < eeHits->
size(); ++
i) {
269 double et =
hit.energy() * (
pos.perp() /
pos.mag());
271 creco->etEESumPlus_ +=
et;
273 creco->etEESumMinus_ +=
et;
278 creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
279 creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
280 creco->etEBSum_ = inputCentrality->EtEBSum();
287 creco->pixelMultiplicity_ = 0;
294 int nPixel_minus = 0;
301 recHitIterator != recHitRange.
end();
309 double eta = rechitPos.eta();
310 int clusterSize =
recHit->cluster()->size();
311 unsigned layer = topo->
layer(detId);
316 if (18 * abeta - 40 > clusterSize)
318 }
else if (layer == 2) {
319 if (6 * abeta - 7.2 > clusterSize)
321 }
else if (layer == 3 || layer == 4) {
322 if (4 * abeta - 2.4 > clusterSize)
334 creco->pixelMultiplicity_ = nPixel;
335 creco->pixelMultiplicityPlus_ = nPixel_plus;
336 creco->pixelMultiplicityMinus_ = nPixel_minus;
339 creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
340 creco->pixelMultiplicityPlus_ = inputCentrality->multiplicityPixelPlus();
341 creco->pixelMultiplicityMinus_ = inputCentrality->multiplicityPixelMinus();
349 double vxError = -999.;
350 double vyError = -999.;
351 double vzError = -999.;
356 unsigned int daughter = 0;
359 for (
unsigned int i = 0;
i < recoVertices->size(); ++
i) {
360 daughter = (*recoVertices)[
i].tracksSize();
361 if (daughter > (*recoVertices)[greatestvtx].tracksSize())
365 if (!recoVertices->empty()) {
366 vx = (*recoVertices)[greatestvtx].position().x();
367 vy = (*recoVertices)[greatestvtx].position().y();
368 vz = (*recoVertices)[greatestvtx].position().z();
369 vxError = (*recoVertices)[greatestvtx].xError();
370 vyError = (*recoVertices)[greatestvtx].yError();
371 vzError = (*recoVertices)[greatestvtx].zError();
380 double trackCounter = 0;
381 double trackCounterEta = 0;
382 double trackCounterEtaPt = 0;
384 for (
unsigned int i = 0;
i <
tracks->size(); ++
i) {
399 double dzsigma2 =
track.dzError() *
track.dzError() + vzError * vzError;
401 double dxysigma2 =
track.dxyError() *
track.dxyError() + vxError * vyError;
403 const double pterrcut = 0.1;
404 const double dzrelcut = 3.0;
405 const double dxyrelcut = 3.0;
408 track.ptError() /
track.pt() < pterrcut &&
dz *
dz < dzrelcut * dzrelcut * dzsigma2 &&
409 dxy *
dxy < dxyrelcut * dxyrelcut * dxysigma2) {
414 creco->trackMultiplicity_ =
nTracks;
415 creco->ntracksPtCut_ = trackCounter;
416 creco->ntracksEtaCut_ = trackCounterEta;
417 creco->ntracksEtaPtCut_ = trackCounterEtaPt;
421 creco->trackMultiplicity_ = inputCentrality->Ntracks();
422 creco->ntracksPtCut_ = inputCentrality->NtracksPtCut();
423 creco->ntracksEtaCut_ = inputCentrality->NtracksEtaCut();
424 creco->ntracksEtaPtCut_ = inputCentrality->NtracksEtaPtCut();
431 int nPixelTracks = pixeltracks->size();
432 int nPixelTracksPlus = 0;
433 int nPixelTracksMinus = 0;
435 for (
auto const&
track : *pixeltracks) {
441 creco->nPixelTracks_ = nPixelTracks;
442 creco->nPixelTracksPlus_ = nPixelTracksPlus;
443 creco->nPixelTracksMinus_ = nPixelTracksMinus;
446 creco->nPixelTracks_ = inputCentrality->NpixelTracks();
447 creco->nPixelTracksPlus_ = inputCentrality->NpixelTracksPlus();
448 creco->nPixelTracksMinus_ = inputCentrality->NpixelTracksMinus();
453 creco->zdcSumPlus_ = 0;
454 creco->zdcSumMinus_ = 0;
459 for (
size_t ihit = 0; ihit <
hits->size(); ++ihit) {
465 creco->zdcSumPlus_ += rechit.
energy();
472 creco->zdcSumMinus_ += rechit.
energy();
477 creco->zdcSumPlus_ = -9;
478 creco->zdcSumMinus_ = -9;
482 creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
483 creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
492 desc.add<
bool>(
"produceHFhits",
true);
493 desc.add<
bool>(
"produceHFtowers",
true);
494 desc.add<
bool>(
"produceEcalhits",
true);
495 desc.add<
bool>(
"produceZDChits",
true);
496 desc.add<
bool>(
"produceETmidRapidity",
true);
497 desc.add<
bool>(
"producePixelhits",
true);
498 desc.add<
bool>(
"produceTracks",
true);
499 desc.add<
bool>(
"producePixelTracks",
true);
500 desc.add<
bool>(
"reUseCentrality",
false);
511 desc.add<
bool>(
"doPixelCut",
true);
512 desc.add<
bool>(
"useQuality",
true);
513 desc.add<
string>(
"trackQuality",
"highPurity");
514 desc.add<
double>(
"trackEtaCut", 2);
515 desc.add<
double>(
"trackPtCut", 1);
516 desc.add<
double>(
"hfEtaCut", 4)->setComment(
"hf above the absolute value of this cut is used");
517 desc.add<
double>(
"midRapidityRange", 1);
518 desc.add<
bool>(
"lowGainZDC",
true);
const bool producePixelTracks_
const edm::EDGetTokenT< EcalRecHitCollection > srcEEhits_
const bool producePixelhits_
const bool produceTracks_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeom_
const edm::EDGetTokenT< TrackCollection > srcTracks_
Quality qualityByName(std::string const &name)
const edm::EDGetTokenT< SiPixelRecHitCollection > srcPixelhits_
TrackQuality
track quality
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
const edm::EDGetTokenT< CaloTowerCollection > srcTowers_
const reco::TrackBase::TrackQuality trackQuality_
const edm::EDGetTokenT< VertexCollection > srcVertex_
constexpr Detector det() const
get the detector field from this detid
unsigned int layer(const DetId &id) const
constexpr float energy() const
const bool produceZDChits_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const bool produceEcalhits_
void addDefault(ParameterSetDescription const &psetDescription)
constexpr HcalDetId id() const
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
const bool produceETmidRap_
float lowGainEnergy() const
constexpr int ieta() const
get the cell ieta
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopo_
const edm::EDGetTokenT< ZDCRecHitCollection > srcZDChits_
const edm::EDGetTokenT< TrackCollection > srcPixelTracks_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeom_
const edm::EDGetTokenT< HFRecHitCollection > srcHFhits_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const TrackerGeomDet * idToDet(DetId) const override
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
auto const & tracks
cannot be loose
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
const bool produceHFtowers_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< Centrality > reuseTag_
bool isHF(int etabin, int depth)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
HcalZDCDetId id() const
get the id
const double trackEtaCut_
const edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
const double midRapidityRange_
int zside() const
get the z-side of the cell (1/-1)
const bool produceHFhits_