62 virtual void endJob() ;
121 produceHFhits_ = iConfig.
getParameter<
bool>(
"produceHFhits");
122 produceHFtowers_ = iConfig.
getParameter<
bool>(
"produceHFtowers");
123 produceEcalhits_ = iConfig.
getParameter<
bool>(
"produceEcalhits");
124 produceZDChits_ = iConfig.
getParameter<
bool>(
"produceZDChits");
125 produceETmidRap_ = iConfig.
getParameter<
bool>(
"produceETmidRapidity");
126 producePixelhits_ = iConfig.
getParameter<
bool>(
"producePixelhits");
127 produceTracks_ = iConfig.
getParameter<
bool>(
"produceTracks");
128 producePixelTracks_ = iConfig.
getParameter<
bool>(
"producePixelTracks");
130 midRapidityRange_ = iConfig.
getParameter<
double>(
"midRapidityRange");
131 trackPtCut_ = iConfig.
getParameter<
double>(
"trackPtCut");
132 trackEtaCut_ = iConfig.
getParameter<
double>(
"trackEtaCut");
139 if(produceEcalhits_){
147 if(producePixelhits_){
158 reuseAny_ = iConfig.
getParameter<
bool>(
"reUseCentrality");
162 trackQuality_ = TrackBase::qualityByName(iConfig.
getParameter<std::string>(
"TrackQuality"));
164 produces<reco::Centrality>();
169 CentralityProducer::~CentralityProducer()
190 std::auto_ptr<Centrality> creco(
new Centrality());
193 if(reuseAny_) iEvent.
getByLabel(reuseTag_,inputCentrality);
196 creco->etHFhitSumPlus_ = 0;
197 creco->etHFhitSumMinus_ = 0;
201 for(
size_t ihit = 0; ihit<hits->size(); ++ ihit){
202 const HFRecHit & rechit = (*hits)[ ihit ];
203 if(rechit.
id().
ieta() > 0 )
204 creco->etHFhitSumPlus_ += rechit.
energy();
205 if(rechit.
id().
ieta() < 0)
206 creco->etHFhitSumMinus_ += rechit.
energy();
210 creco->etHFhitSumMinus_ = inputCentrality->EtHFhitSumMinus();
211 creco->etHFhitSumPlus_ = inputCentrality->EtHFhitSumPlus();
215 if(produceHFtowers_ || produceETmidRap_){
216 creco->etHFtowerSumPlus_ = 0;
217 creco->etHFtowerSumMinus_ = 0;
218 creco->etMidRapiditySum_ = 0;
224 for(
size_t i = 0;
i<towers->size(); ++
i){
228 if(produceHFtowers_){
230 creco->etHFtowerSumPlus_ += tower.
pt();
231 if(eta > hfEtaCut_) creco->etHFtruncatedPlus_ += tower.
pt();
234 creco->etHFtowerSumMinus_ += tower.
pt();
235 if(eta < -hfEtaCut_) creco->etHFtruncatedMinus_ += tower.
pt();
239 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
240 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
241 creco->etHFtruncatedMinus_ = inputCentrality->EtHFtruncatedMinus();
242 creco->etHFtruncatedPlus_ = inputCentrality->EtHFtruncatedPlus();
245 if(produceETmidRap_){
246 if(fabs(eta) < midRapidityRange_) creco->etMidRapiditySum_ += tower.
pt()/(midRapidityRange_*2.);
247 }
else if(reuseAny_) creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
251 creco->etHFtowerSumMinus_ = inputCentrality->EtHFtowerSumMinus();
252 creco->etHFtowerSumPlus_ = inputCentrality->EtHFtowerSumPlus();
253 creco->etMidRapiditySum_ = inputCentrality->EtMidRapiditySum();
257 if(produceEcalhits_){
258 creco->etEESumPlus_ = 0;
259 creco->etEESumMinus_ = 0;
268 for(
unsigned int i = 0;
i < ebHits->size(); ++
i){
271 double et = hit.
energy()*
sin(pos.theta());
272 creco->etEBSum_ += et;
275 for(
unsigned int i = 0;
i < eeHits->size(); ++
i){
278 double et = hit.
energy()*
sin(pos.theta());
279 double eta = pos.eta();
281 creco->etEESumPlus_ += et;
283 creco->etEESumMinus_ += et;
288 creco->etEESumMinus_ = inputCentrality->EtEESumMinus();
289 creco->etEESumPlus_ = inputCentrality->EtEESumPlus();
290 creco->etEBSum_ = inputCentrality->EtEBSum();
294 if(producePixelhits_){
295 creco->pixelMultiplicity_ = 0;
308 recHitIterator != recHitRange.
end(); ++recHitIterator) {
315 double abeta = fabs(rechitPos.eta());
316 int clusterSize = recHit->cluster()->size();
317 if ( abeta < 0.5 && clusterSize < 1)
continue;
318 if ( abeta > 0.5 && abeta < 1 && clusterSize < 2)
continue;
319 if ( abeta > 1. && abeta < 1.5 && clusterSize < 3)
continue;
320 if ( abeta > 1.5 && abeta < 2. && clusterSize < 4)
continue;
321 if ( abeta > 2. && abeta < 2.5 && clusterSize < 6)
continue;
322 if ( abeta > 2.5 && abeta < 5 && clusterSize < 9)
continue;
327 creco->pixelMultiplicity_ = nPixel;
330 creco->pixelMultiplicity_ = inputCentrality->multiplicityPixel();
339 double vxError=-999.;
340 double vyError=-999.;
341 double vzError=-999.;
346 unsigned int daughter = 0;
349 for (
unsigned int i = 0 ;
i< recoVertices->size(); ++
i){
350 daughter = (*recoVertices)[
i].tracksSize();
351 if( daughter > (*recoVertices)[greatestvtx].tracksSize()) greatestvtx =
i;
354 if(recoVertices->size()>0){
355 vx = (*recoVertices)[greatestvtx].position().x();
356 vy = (*recoVertices)[greatestvtx].position().y();
357 vz = (*recoVertices)[greatestvtx].position().z();
358 vxError = (*recoVertices)[greatestvtx].xError();
359 vyError = (*recoVertices)[greatestvtx].yError();
360 vzError = (*recoVertices)[greatestvtx].zError();
369 double trackCounter = 0;
370 double trackCounterEta = 0;
371 double trackCounterEtaPt = 0;
373 for(
unsigned int i = 0 ;
i < tracks->size(); ++
i){
374 const Track& track = (*tracks)[
i];
375 if(useQuality_ && !track.
quality(trackQuality_))
continue;
377 if( track.
pt() > trackPtCut_) trackCounter++;
378 if(fabs(track.
eta())<trackEtaCut_) {
380 if (track.
pt() > trackPtCut_) trackCounterEtaPt++;
384 double dz= track.
dz(v1);
386 double dxy= track.
dxy(v1);
388 if( track.
quality(trackQuality_) && track.
pt()>0.4 && fabs(track.
eta())<2.4 && track.
ptError()/track.
pt()<0.1 && fabs(dz/dzsigma)<3.0 && fabs(dxy/dxysigma)<3.0) nTracks++;
392 creco->trackMultiplicity_ = nTracks;
393 creco->ntracksPtCut_ = trackCounter;
394 creco->ntracksEtaCut_ = trackCounterEta;
395 creco->ntracksEtaPtCut_ = trackCounterEtaPt;
399 creco->trackMultiplicity_ = inputCentrality->Ntracks();
400 creco->ntracksPtCut_= inputCentrality->NtracksPtCut();
401 creco->ntracksEtaCut_= inputCentrality->NtracksEtaCut();
402 creco->ntracksEtaPtCut_= inputCentrality->NtracksEtaPtCut();
406 if(producePixelTracks_){
408 iEvent.
getByLabel(srcPixelTracks_,pixeltracks);
409 int nPixelTracks = pixeltracks->size();
410 creco->nPixelTracks_ = nPixelTracks;
414 creco->nPixelTracks_ = inputCentrality->NpixelTracks();
419 creco->zdcSumPlus_ = 0;
420 creco->zdcSumMinus_ = 0;
423 bool zdcAvailable = iEvent.
getByLabel(srcZDChits_,hits);
425 for(
size_t ihit = 0; ihit<hits->size(); ++ ihit){
426 const ZDCRecHit & rechit = (*hits)[ ihit ];
431 creco->zdcSumPlus_ += rechit.
energy();
438 creco->zdcSumMinus_ += rechit.
energy();
443 creco->zdcSumPlus_ = -9;
444 creco->zdcSumMinus_ = -9;
448 creco->zdcSumMinus_ = inputCentrality->zdcSumMinus();
449 creco->zdcSumPlus_ = inputCentrality->zdcSumPlus();
465 CentralityProducer::endJob()
reco::TrackBase::TrackQuality trackQuality_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
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.
Sin< T >::type sin(const T &t)
int zside() const
get the z-side of the cell (1/-1)
const_iterator find(id_type i) const
virtual double eta() const
momentum pseudorapidity
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
const_iterator end() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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
XYZVectorD XYZVector
spatial vector with cartesian internal representation
virtual double pt() const
transverse momentum
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() 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
edm::InputTag srcZDChits_
HcalZDCDetId id() const
get the id
edm::ESHandle< TrackerGeometry > tGeo
HcalDetId id() const
get the id
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
edm::InputTag srcPixelhits_
edm::InputTag srcPixelTracks_