62 virtual void endJob()
override ;
120 produceHFhits_ = iConfig.
getParameter<
bool>(
"produceHFhits");
121 produceHFtowers_ = iConfig.
getParameter<
bool>(
"produceHFtowers");
122 produceEcalhits_ = iConfig.
getParameter<
bool>(
"produceEcalhits");
123 produceZDChits_ = iConfig.
getParameter<
bool>(
"produceZDChits");
124 produceETmidRap_ = iConfig.
getParameter<
bool>(
"produceETmidRapidity");
125 producePixelhits_ = iConfig.
getParameter<
bool>(
"producePixelhits");
126 produceTracks_ = iConfig.
getParameter<
bool>(
"produceTracks");
127 producePixelTracks_ = iConfig.
getParameter<
bool>(
"producePixelTracks");
129 midRapidityRange_ = iConfig.
getParameter<
double>(
"midRapidityRange");
130 trackPtCut_ = iConfig.
getParameter<
double>(
"trackPtCut");
131 trackEtaCut_ = iConfig.
getParameter<
double>(
"trackEtaCut");
136 if(produceHFtowers_ || produceETmidRap_) srcTowers_ = consumes<CaloTowerCollection>(iConfig.
getParameter<
edm::InputTag>(
"srcTowers"));
138 if(produceEcalhits_){
146 if(producePixelhits_){
155 if(producePixelTracks_) srcPixelTracks_ = consumes<TrackCollection>(iConfig.
getParameter<
edm::InputTag>(
"srcPixelTracks"));
157 reuseAny_ = iConfig.
getParameter<
bool>(
"reUseCentrality");
163 produces<Centrality>();
168 CentralityProducer::~CentralityProducer()
189 std::auto_ptr<Centrality> creco(
new Centrality());
192 if(reuseAny_) iEvent.
getByToken(reuseTag_,inputCentrality);
195 creco->etHFhitSumPlus_ = 0;
196 creco->etHFhitSumMinus_ = 0;
200 for(
size_t ihit = 0; ihit<hits->size(); ++ ihit){
201 const HFRecHit & rechit = (*hits)[ ihit ];
202 if(rechit.
id().
ieta() > 0 )
203 creco->etHFhitSumPlus_ += rechit.
energy();
204 if(rechit.
id().
ieta() < 0)
205 creco->etHFhitSumMinus_ += rechit.
energy();
209 creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
210 creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
214 if(produceHFtowers_ || produceETmidRap_){
215 creco->etHFtowerSumPlus_ = 0;
216 creco->etHFtowerSumMinus_ = 0;
217 creco->etMidRapiditySum_ = 0;
223 for(
size_t i = 0;
i<towers->size(); ++
i){
227 if(produceHFtowers_){
229 creco->etHFtowerSumPlus_ += tower.
pt();
230 if(eta > hfEtaCut_) creco->etHFtruncatedPlus_ += tower.
pt();
233 creco->etHFtowerSumMinus_ += tower.
pt();
234 if(eta < -hfEtaCut_) creco->etHFtruncatedMinus_ += tower.
pt();
238 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
239 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
240 creco->etHFtruncatedMinus_ = inputCentrality->EtHFtruncatedMinus();
241 creco->etHFtruncatedPlus_ = inputCentrality->EtHFtruncatedPlus();
244 if(produceETmidRap_){
245 if(
std::abs(eta) < midRapidityRange_) creco->etMidRapiditySum_ += tower.
pt()/(midRapidityRange_*2.);
246 }
else if(reuseAny_) creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
250 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
251 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
252 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
256 if(produceEcalhits_){
257 creco->etEESumPlus_ = 0;
258 creco->etEESumMinus_ = 0;
267 for(
unsigned int i = 0;
i < ebHits->size(); ++
i){
270 double et = hit.
energy()*(pos.perp()/pos.mag());
271 creco->etEBSum_ += et;
274 for(
unsigned int i = 0;
i < eeHits->size(); ++
i){
277 double et = hit.
energy()*(pos.perp()/pos.mag());
279 creco->etEESumPlus_ += et;
281 creco->etEESumMinus_ += et;
286 creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
287 creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
288 creco->etEBSum_ = inputCentrality->EtEBSum();
292 if(producePixelhits_){
293 creco->pixelMultiplicity_ = 0;
306 recHitIterator != recHitRange.
end(); ++recHitIterator) {
313 double abeta =
std::abs(rechitPos.eta());
314 int clusterSize = recHit->
cluster()->size();
315 if ( abeta < 0.5 && clusterSize < 1)
continue;
316 if ( abeta > 0.5 && abeta < 1 && clusterSize < 2)
continue;
317 if ( abeta > 1. && abeta < 1.5 && clusterSize < 3)
continue;
318 if ( abeta > 1.5 && abeta < 2. && clusterSize < 4)
continue;
319 if ( abeta > 2. && abeta < 2.5 && clusterSize < 6)
continue;
320 if ( abeta > 2.5 && abeta < 5 && clusterSize < 9)
continue;
325 creco->pixelMultiplicity_ = nPixel;
328 creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
337 double vxError=-999.;
338 double vyError=-999.;
339 double vzError=-999.;
344 unsigned int daughter = 0;
347 for (
unsigned int i = 0 ;
i< recoVertices->size(); ++
i){
348 daughter = (*recoVertices)[
i].tracksSize();
349 if( daughter > (*recoVertices)[greatestvtx].tracksSize()) greatestvtx =
i;
352 if(recoVertices->size()>0){
353 vx = (*recoVertices)[greatestvtx].position().x();
354 vy = (*recoVertices)[greatestvtx].position().y();
355 vz = (*recoVertices)[greatestvtx].position().z();
356 vxError = (*recoVertices)[greatestvtx].xError();
357 vyError = (*recoVertices)[greatestvtx].yError();
358 vzError = (*recoVertices)[greatestvtx].zError();
367 double trackCounter = 0;
368 double trackCounterEta = 0;
369 double trackCounterEtaPt = 0;
371 for(
unsigned int i = 0 ;
i < tracks->size(); ++
i){
372 const Track& track = (*tracks)[
i];
373 if(useQuality_ && !track.
quality(trackQuality_))
continue;
375 if( track.
pt() > trackPtCut_) trackCounter++;
378 if (track.
pt() > trackPtCut_) trackCounterEtaPt++;
382 double dz= track.
dz(v1);
383 double dzsigma2 = track.
dzError()*track.
dzError()+vzError*vzError;
384 double dxy= track.
dxy(v1);
387 const double pterrcut = 0.1;
388 const double dzrelcut = 3.0;
389 const double dxyrelcut = 3.0;
391 if( track.
quality(trackQuality_) &&
394 dz*dz < dzrelcut*dzrelcut * dzsigma2 &&
395 dxy*dxy < dxyrelcut*dxyrelcut * dxysigma2 ){
400 creco->trackMultiplicity_ = nTracks;
401 creco->ntracksPtCut_ = trackCounter;
402 creco->ntracksEtaCut_ = trackCounterEta;
403 creco->ntracksEtaPtCut_ = trackCounterEtaPt;
407 creco->trackMultiplicity_ = inputCentrality->Ntracks();
408 creco->ntracksPtCut_= inputCentrality->NtracksPtCut();
409 creco->ntracksEtaCut_= inputCentrality->NtracksEtaCut();
410 creco->ntracksEtaPtCut_= inputCentrality->NtracksEtaPtCut();
414 if(producePixelTracks_){
416 iEvent.
getByToken(srcPixelTracks_,pixeltracks);
417 int nPixelTracks = pixeltracks->size();
418 creco->nPixelTracks_ = nPixelTracks;
422 creco->nPixelTracks_ = inputCentrality->NpixelTracks();
427 creco->zdcSumPlus_ = 0;
428 creco->zdcSumMinus_ = 0;
431 bool zdcAvailable = iEvent.
getByToken(srcZDChits_,hits);
433 for(
size_t ihit = 0; ihit<hits->size(); ++ ihit){
434 const ZDCRecHit & rechit = (*hits)[ ihit ];
439 creco->zdcSumPlus_ += rechit.
energy();
446 creco->zdcSumMinus_ += rechit.
energy();
451 creco->zdcSumPlus_ = -9;
452 creco->zdcSumMinus_ = -9;
456 creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
457 creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
473 CentralityProducer::endJob()
reco::TrackBase::TrackQuality trackQuality_
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
edm::EDGetTokenT< EcalRecHitCollection > srcEBhits_
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_
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
edm::EDGetTokenT< CaloTowerCollection > srcTowers_
double eta() const
pseudorapidity of momentum vector
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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)
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
bool isHF(int etabin, int depth)
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
edm::ESHandle< CaloGeometry > cGeo
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...
virtual LocalPoint localPosition() const
const_iterator begin(bool update=false) const