23 : recoConditions_(nullptr), calcped_(nullptr), ganged_(
false) {
25 bool useStaticPedestals = ps.
getParameter<
bool>(
"CSCUseStaticPedestals");
26 int noOfTimeBinsForDynamicPed = ps.
getParameter<
int>(
"CSCNoOfTimeBinsForDynamicPedestal");
31 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly] CSCUseStaticPedestals = " << useStaticPedestals;
32 if (!useStaticPedestals)
33 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly] CSCNoOfTimeBinsForDynamicPedestal = " << noOfTimeBinsForDynamicPed;
35 if (useStaticPedestals) {
38 if (noOfTimeBinsForDynamicPed == 1) {
57 std::vector<CSCStripHit> hitsInLayer;
68 LogTrace(
"CSCHitFromStripOnly") <<
"[CSCHitFromStripOnly::runStrip] id= " <<
id_ <<
" nstrips= " <<
nstrips_ 69 <<
" ganged strips? " <<
ganged();
97 for (
size_t imax = 0; imax !=
theMaxima.size(); ++imax) {
118 int maximum_to_left = 99;
119 int maximum_to_right = 99;
136 short int aDeadStrip = 0;
137 if (!deadStripL && !deadStripR) {
139 }
else if (deadStripL && deadStripR) {
151 std::vector<int> theL1AStrips;
153 bool stripMatchCounter =
false;
154 for (
auto itl1 = rstripd.first; itl1 != rstripd.second; ++itl1) {
155 int stripNproto = (*itl1).getStrip();
158 stripMatchCounter =
true;
159 auto sz = (*itl1).getOverlappedSample().size();
160 int L1AbitOnPlace = 0;
161 for (
auto iBit = 0UL; iBit < sz; iBit++) {
162 L1AbitOnPlace |= ((*itl1).getL1APhase(iBit) << (15 - iBit));
164 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
167 for (
int tripl = 0; tripl < 3; ++tripl) {
168 if (
theStrips[ila] == (stripNproto + tripl * 16)) {
169 stripMatchCounter =
true;
170 auto sz = (*itl1).getOverlappedSample().size();
171 int L1AbitOnPlace = 0;
172 for (
auto iBit = 0UL; iBit < sz; iBit++) {
173 L1AbitOnPlace |= ((*itl1).getL1APhase(iBit) << (15 - iBit));
175 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
180 if (!stripMatchCounter) {
195 hitsInLayer.push_back(striphit);
212 float strippos = -1.;
214 std::vector<CSCStripHitData> stripDataV;
220 if (centerStrip - i < 1 || centerStrip + i >
int(
nstrips_)) {
227 stripDataV.push_back(
data);
232 LogTrace(
"CSCHitFromStripOnly") <<
"[CSCHitFromStripOnly::makeCluster] centerStrip= " << centerStrip
233 <<
" strippos=" << strippos;
243 int thisStrip = centerStrip +
offset;
248 std::vector<float>
adc(4);
249 std::vector<float> adcRaw(4);
253 int istart =
tmax - 1;
258 int ibin = thisStrip - 1;
273 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly::makeStripData] Tmax out of range: contact CSC expert!";
284 int testStrip = thisStrip +
sign *
i;
292 std::vector<float> adc1(4);
293 std::vector<float> adcRaw1(4);
294 std::vector<float> adc2(4);
295 std::vector<float> adcRaw2(4);
304 int ibin = testStrip - 1;
305 int jbin = centerStrip - 1;
334 for (
size_t k = 0;
k < 4; ++
k) {
335 if (adc1[
k] > 0 && adc2[
k] > 0)
337 if (adcRaw1[
k] > 0 && adcRaw2[
k] > 0)
338 adcRaw[
k] = adcRaw[
k] * adcRaw2[
k] / (adcRaw1[
k] + adcRaw2[
k]);
359 int thisChannel = (*it).getStrip();
361 auto& scaRaw = stripData.phRaw_;
362 auto& sca = stripData.ph_;
364 auto const& scaOri = (*it).getADCCounts();
365 assert(scaOri.size() == 8);
367 std::copy(scaOri.begin(), scaOri.end(), scaRaw.begin());
368 std::copy(scaRaw.begin(), scaRaw.end(), sca.begin());
371 int tmax = std::max_element(sca.begin(), sca.end()) - sca.begin();
385 stripData.phmax_ = phmax;
386 stripData.tmax_ =
tmax;
398 for (
int j = 1;
j < 3; ++
j) {
417 float heightCluster = 0.;
419 bool maximumFound =
false;
448 int numberOfConsecutiveStrips = 1;
449 float testThreshold = 10.;
452 for (
int l = 0;
l < 8; ++
l) {
455 <<
"This should never occur!!! Contact CSC expert!";
457 bool signalPresent =
false;
458 for (
int k = 0;
k < 2; ++
k) {
460 int anotherConsecutiveStrip =
i +
j;
461 if (anotherConsecutiveStrip >= 0 && anotherConsecutiveStrip <
int(
thePulseHeightMap.size())) {
463 ++numberOfConsecutiveStrips;
464 signalPresent =
true;
468 if (!signalPresent) {
473 bool additional_maxima_found =
false;
491 additional_maxima_found =
true;
511 additional_maxima_found =
true;
522 if (!additional_maxima_found) {
547 float strippos = -1.;
555 int biggestStrip = max_element(
data.begin(),
data.end()) -
data.begin();
556 strippos =
data[biggestStrip].strip() * 1.;
566 for (
size_t i = 0;
i !=
data.size(); ++
i) {
567 auto const&
w =
data[
i].ph();
568 auto const& wRaw =
data[
i].phRaw();
583 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly::findHitOnStripPosition] problem in indexing of strip, strip= " 587 sum +=
w[1] *
data[
i].strip();
591 strippos = sum / sum_w;
CSCPedestalChoice * calcped_
bool isNearDeadStrip(const CSCDetId &id, int centralStrip, int nstrips)
Is either neighbour 'bad'?
const CSCChamber * chamber() const
void findMaxima(const CSCDetId &id)
Find local maxima.
T getParameter(std::string const &) const
std::vector< int > theConsecutiveStrips
bool isDeadStrip(const CSCDetId &id, int centralStrip, int nstrips)
Is the strip 'bad'?
std::vector< CSCStripHit > runStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripDigiCollection::Range &rstripd)
std::vector< int > theStrips
std::vector< int > theClosestMaximum
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
float theThresholdForCluster
float findHitOnStripPosition(const std::vector< CSCStripHitData > &data, const int ¢erStrip)
Find position of hit in strip cluster in terms of strip #.
CSCHitFromStripOnly(const edm::ParameterSet &ps)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static const int theClusterSize
PulseHeightMap thePulseHeightMap
bool nearBadStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is a neighbour bad?
const CSCRecoConditions * recoConditions_
float theThresholdForAPeak
Abs< T >::type abs(const T &t)
float makeCluster(int centerStrip)
Make clusters using local maxima.
static const double tmax[3]
bool badStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is the strip bad?
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
std::vector< float > strips_adcRaw
std::vector< int > theMaxima
bool isPeakOK(int iStrip, float heightCluster)
char data[epos_bytes_allocation]
std::vector< float > strips_adc
void stripWeights(const CSCDetId &id, short int nstrips, float *weights) const
bool gangedStrips() const
Log< level::Warning, false > LogWarning
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=nullptr, const CSCDetId id=0, int ichan=0)=0
void fillPulseHeights(const CSCStripDigiCollection::Range &rstripd)
Store SCA pulseheight information from strips in digis of one layer.
const CSCChamberSpecs * specs() const
CSCStripHitData makeStripData(int centerStrip, int offset)
uint16_t *__restrict__ uint16_t const *__restrict__ adc