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_)
153 reuseTag_(reuseAny_ ? consumes<
Centrality>(iConfig.getParameter<edm::
InputTag>(
"srcReUse"))
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) {
209 if (isHF && eta > 0) {
210 creco->etHFtowerSumPlus_ += tower.
pt();
212 creco->etHFtowerSumECutPlus_ += tower.
pt();
214 creco->etHFtruncatedPlus_ += tower.
pt();
215 }
else if (isHF && eta < 0) {
216 creco->etHFtowerSumMinus_ += tower.
pt();
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) {
398 double dz = track.
dz(v1);
399 double dzsigma2 = track.
dzError() * track.
dzError() + vzError * vzError;
400 double dxy = track.
dxy(v1);
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);
constexpr float energy() const
const bool producePixelTracks_
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::EDGetTokenT< EcalRecHitCollection > srcEEhits_
const bool producePixelhits_
double pt() const final
transverse momentum
const bool produceTracks_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeom_
const edm::EDGetTokenT< TrackCollection > srcTracks_
Quality qualityByName(std::string const &name)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< SiPixelRecHitCollection > srcPixelhits_
TrackQuality
track quality
double dxyError() const
error on dxy
#define DEFINE_FWK_MODULE(type)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
int zside() const
get the z-side of the cell (1/-1)
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
auto const & tracks
cannot be loose
const edm::EDGetTokenT< CaloTowerCollection > srcTowers_
const reco::TrackBase::TrackQuality trackQuality_
const edm::EDGetTokenT< VertexCollection > srcVertex_
const bool produceZDChits_
constexpr std::array< uint8_t, layerIndexSize > layer
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const bool produceEcalhits_
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
const bool produceETmidRap_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopo_
double pt() const
track transverse momentum
const edm::EDGetTokenT< ZDCRecHitCollection > srcZDChits_
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
const edm::EDGetTokenT< TrackCollection > srcPixelTracks_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
constexpr int ieta() const
get the cell ieta
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeom_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< HFRecHitCollection > srcHFhits_
float lowGainEnergy() const
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
DetId id() const
get the id
T const * product() const
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)
ClusterRef cluster() const
const edm::EDGetTokenT< Centrality > reuseTag_
bool isHF(int etabin, int depth)
bool quality(const TrackQuality) const
Track quality.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
const_iterator find(id_type i, bool update=false) const
LocalPoint localPosition() const override
const double trackEtaCut_
HcalZDCDetId id() const
get the id
constexpr HcalDetId id() const
DetId geographicalId() const
const edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const double midRapidityRange_
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
const_iterator begin(bool update=false) const
constexpr Detector det() const
get the detector field from this detid
const bool produceHFhits_
double energy() const final
energy
double eta() const final
momentum pseudorapidity