61 virtual void endJob()
override ;
119 produceHFhits_ = iConfig.
getParameter<
bool>(
"produceHFhits");
120 produceHFtowers_ = iConfig.
getParameter<
bool>(
"produceHFtowers");
121 produceEcalhits_ = iConfig.
getParameter<
bool>(
"produceEcalhits");
122 produceZDChits_ = iConfig.
getParameter<
bool>(
"produceZDChits");
123 produceETmidRap_ = iConfig.
getParameter<
bool>(
"produceETmidRapidity");
124 producePixelhits_ = iConfig.
getParameter<
bool>(
"producePixelhits");
125 produceTracks_ = iConfig.
getParameter<
bool>(
"produceTracks");
126 producePixelTracks_ = iConfig.
getParameter<
bool>(
"producePixelTracks");
128 midRapidityRange_ = iConfig.
getParameter<
double>(
"midRapidityRange");
129 trackPtCut_ = iConfig.
getParameter<
double>(
"trackPtCut");
130 trackEtaCut_ = iConfig.
getParameter<
double>(
"trackEtaCut");
135 if(produceHFtowers_ || produceETmidRap_) srcTowers_ = consumes<CaloTowerCollection>(iConfig.
getParameter<
edm::InputTag>(
"srcTowers"));
137 if(produceEcalhits_){
145 if(producePixelhits_){
154 if(producePixelTracks_) srcPixelTracks_ = consumes<TrackCollection>(iConfig.
getParameter<
edm::InputTag>(
"srcPixelTracks"));
156 reuseAny_ = iConfig.
getParameter<
bool>(
"reUseCentrality");
162 produces<Centrality>();
167 CentralityProducer::~CentralityProducer()
188 auto creco = std::make_unique<Centrality>();
191 if(reuseAny_) iEvent.
getByToken(reuseTag_,inputCentrality);
194 creco->etHFhitSumPlus_ = 0;
195 creco->etHFhitSumMinus_ = 0;
199 for(
size_t ihit = 0; ihit<hits->
size(); ++ ihit){
200 const HFRecHit & rechit = (*hits)[ ihit ];
201 if(rechit.
id().
ieta() > 0 )
202 creco->etHFhitSumPlus_ += rechit.
energy();
203 if(rechit.
id().
ieta() < 0)
204 creco->etHFhitSumMinus_ += rechit.
energy();
208 creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
209 creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
213 if(produceHFtowers_ || produceETmidRap_){
214 creco->etHFtowerSumPlus_ = 0;
215 creco->etHFtowerSumMinus_ = 0;
216 creco->etMidRapiditySum_ = 0;
222 for(
size_t i = 0;
i<towers->
size(); ++
i){
226 if(produceHFtowers_){
228 creco->etHFtowerSumPlus_ += tower.
pt();
229 if(eta > hfEtaCut_) creco->etHFtruncatedPlus_ += tower.
pt();
232 creco->etHFtowerSumMinus_ += tower.
pt();
233 if(eta < -hfEtaCut_) creco->etHFtruncatedMinus_ += tower.
pt();
237 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
238 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
239 creco->etHFtruncatedMinus_ = inputCentrality->EtHFtruncatedMinus();
240 creco->etHFtruncatedPlus_ = inputCentrality->EtHFtruncatedPlus();
243 if(produceETmidRap_){
244 if(
std::abs(eta) < midRapidityRange_) creco->etMidRapiditySum_ += tower.
pt()/(midRapidityRange_*2.);
245 }
else if(reuseAny_) creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
249 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
250 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
251 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
255 if(produceEcalhits_){
256 creco->etEESumPlus_ = 0;
257 creco->etEESumMinus_ = 0;
266 for(
unsigned int i = 0;
i < ebHits->
size(); ++
i){
269 double et = hit.
energy()*(pos.perp()/pos.mag());
270 creco->etEBSum_ +=
et;
273 for(
unsigned int i = 0;
i < eeHits->
size(); ++
i){
276 double et = hit.
energy()*(pos.perp()/pos.mag());
278 creco->etEESumPlus_ +=
et;
280 creco->etEESumMinus_ +=
et;
285 creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
286 creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
287 creco->etEBSum_ = inputCentrality->EtEBSum();
291 if(producePixelhits_){
292 creco->pixelMultiplicity_ = 0;
305 recHitIterator != recHitRange.
end(); ++recHitIterator) {
312 double abeta =
std::abs(rechitPos.eta());
313 int clusterSize = recHit->
cluster()->size();
314 if ( abeta < 0.5 && clusterSize < 1)
continue;
315 if ( abeta > 0.5 && abeta < 1 && clusterSize < 2)
continue;
316 if ( abeta > 1. && abeta < 1.5 && clusterSize < 3)
continue;
317 if ( abeta > 1.5 && abeta < 2. && clusterSize < 4)
continue;
318 if ( abeta > 2. && abeta < 2.5 && clusterSize < 6)
continue;
319 if ( abeta > 2.5 && abeta < 5 && clusterSize < 9)
continue;
324 creco->pixelMultiplicity_ = nPixel;
327 creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
336 double vxError=-999.;
337 double vyError=-999.;
338 double vzError=-999.;
343 unsigned int daughter = 0;
346 for (
unsigned int i = 0 ;
i< recoVertices->size(); ++
i){
347 daughter = (*recoVertices)[
i].tracksSize();
348 if( daughter > (*recoVertices)[greatestvtx].tracksSize()) greatestvtx =
i;
351 if(recoVertices->size()>0){
352 vx = (*recoVertices)[greatestvtx].position().x();
353 vy = (*recoVertices)[greatestvtx].position().y();
354 vz = (*recoVertices)[greatestvtx].position().z();
355 vxError = (*recoVertices)[greatestvtx].xError();
356 vyError = (*recoVertices)[greatestvtx].yError();
357 vzError = (*recoVertices)[greatestvtx].zError();
366 double trackCounter = 0;
367 double trackCounterEta = 0;
368 double trackCounterEtaPt = 0;
370 for(
unsigned int i = 0 ;
i < tracks->size(); ++
i){
372 if(useQuality_ && !track.
quality(trackQuality_))
continue;
374 if( track.
pt() > trackPtCut_) trackCounter++;
377 if (track.
pt() > trackPtCut_) trackCounterEtaPt++;
381 double dz= track.
dz(v1);
382 double dzsigma2 = track.
dzError()*track.
dzError()+vzError*vzError;
383 double dxy= track.
dxy(v1);
386 const double pterrcut = 0.1;
387 const double dzrelcut = 3.0;
388 const double dxyrelcut = 3.0;
390 if( track.
quality(trackQuality_) &&
393 dz*dz < dzrelcut*dzrelcut * dzsigma2 &&
394 dxy*dxy < dxyrelcut*dxyrelcut * dxysigma2 ){
399 creco->trackMultiplicity_ =
nTracks;
400 creco->ntracksPtCut_ = trackCounter;
401 creco->ntracksEtaCut_ = trackCounterEta;
402 creco->ntracksEtaPtCut_ = trackCounterEtaPt;
406 creco->trackMultiplicity_ = inputCentrality->Ntracks();
407 creco->ntracksPtCut_= inputCentrality->NtracksPtCut();
408 creco->ntracksEtaCut_= inputCentrality->NtracksEtaCut();
409 creco->ntracksEtaPtCut_= inputCentrality->NtracksEtaPtCut();
413 if(producePixelTracks_){
415 iEvent.
getByToken(srcPixelTracks_,pixeltracks);
416 int nPixelTracks = pixeltracks->size();
417 creco->nPixelTracks_ = nPixelTracks;
421 creco->nPixelTracks_ = inputCentrality->NpixelTracks();
426 creco->zdcSumPlus_ = 0;
427 creco->zdcSumMinus_ = 0;
430 bool zdcAvailable = iEvent.
getByToken(srcZDChits_,hits);
432 for(
size_t ihit = 0; ihit<hits->
size(); ++ ihit){
433 const ZDCRecHit & rechit = (*hits)[ ihit ];
438 creco->zdcSumPlus_ += rechit.
energy();
445 creco->zdcSumMinus_ += rechit.
energy();
450 creco->zdcSumPlus_ = -9;
451 creco->zdcSumMinus_ = -9;
455 creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
456 creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
472 CentralityProducer::endJob()
reco::TrackBase::TrackQuality trackQuality_
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const unsigned int nTracks(const reco::Vertex &sv)
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< Centrality > reuseTag_
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)
edm::EDGetTokenT< VertexCollection > srcVertex_
edm::EDGetTokenT< CaloTowerCollection > srcTowers_
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
int ieta() const
get the cell ieta
edm::EDGetTokenT< HFRecHitCollection > srcHFhits_
Abs< T >::type abs(const T &t)
virtual LocalPoint localPosition() const final
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
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
edm::EDGetTokenT< ZDCRecHitCollection > srcZDChits_
ClusterRef cluster() const
bool isHF(int etabin, int depth)
edm::ESHandle< CaloGeometry > cGeo
et
define resolution functions of each parameter
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
edm::EDGetTokenT< SiPixelRecHitCollection > srcPixelhits_
edm::EDGetTokenT< TrackCollection > srcPixelTracks_
edm::EDGetTokenT< TrackCollection > srcTracks_
HcalZDCDetId id() const
get the id
edm::ESHandle< TrackerGeometry > tGeo
DetId geographicalId() const
edm::EDGetTokenT< EcalRecHitCollection > srcEEhits_
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