25 bool useStaticPedestals = ps.
getParameter<
bool>(
"CSCUseStaticPedestals");
26 int noOfTimeBinsForDynamicPed = ps.
getParameter<
int>(
"CSCNoOfTimeBinsForDynamicPedestal");
31 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly] CSCUseStaticPedestals = " << useStaticPedestals;
32 if ( !useStaticPedestals )
LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly] CSCNoOfTimeBinsForDynamicPedestal = "
33 << noOfTimeBinsForDynamicPed;
35 if ( useStaticPedestals ) {
39 if ( noOfTimeBinsForDynamicPed == 1 ) {
65 std::vector<CSCStripHit> hitsInLayer;
75 LogTrace(
"CSCHitFromStripOnly") <<
"[CSCHitFromStripOnly::runStrip] id= " <<
id_ <<
105 for (
size_t imax = 0; imax !=
theMaxima.size(); ++imax ) {
127 int maximum_to_left = 99;
128 int maximum_to_right = 99;
135 if(fabs(maximum_to_right) < fabs(maximum_to_left)){
146 short int aDeadStrip = 0;
147 if(!deadStripL && !deadStripR){
150 else if(deadStripL && deadStripR){
164 std::vector<int> theL1AStrips;
165 for(
int ila=0; ila<(int)
theStrips.size(); ila++){
166 bool stripMatchCounter=
false;
167 for (
auto itl1 = rstripd.first; itl1 != rstripd.second; ++itl1 ) {
168 int stripNproto = (*itl1).getStrip();
171 stripMatchCounter=
true;
172 auto sz = (*itl1).getOverlappedSample().size();
174 for(
auto iBit=0UL; iBit<sz; iBit++){
175 L1AbitOnPlace |= ( (*itl1).getL1APhase(iBit) << (15-iBit));
177 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
180 for(
int tripl=0; tripl<3; ++tripl){
181 if(
theStrips[ila]==(stripNproto+tripl*16)){
182 stripMatchCounter=
true;
183 auto sz = (*itl1).getOverlappedSample().size();
185 for(
auto iBit=0UL; iBit<sz; iBit++){
186 L1AbitOnPlace |= ( (*itl1).getL1APhase(iBit) << (15-iBit));
188 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
193 if(!stripMatchCounter){
201 hitsInLayer.push_back( striphit );
220 float strippos = -1.;
222 std::vector<CSCStripHitData> stripDataV;
229 if ( centerStrip - i < 1 || centerStrip + i >
int(
nstrips_) ) {
237 stripDataV.push_back( data );
242 LogTrace(
"CSCHitFromStripOnly") <<
"[CSCHitFromStripOnly::makeCluster] centerStrip= " << centerStrip <<
243 " strippos=" << strippos;
255 int thisStrip = centerStrip+
offset;
260 std::vector<float>
adc(4);
261 std::vector<float> adcRaw(4);
269 if ( tmax > 2 && tmax < 7 ) {
270 int ibin = thisStrip-1;
285 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly::makeStripData] Tmax out of range: contact CSC expert!";
291 int sign = offset>0 ? 1 : -1;
297 int testStrip = thisStrip + sign*
i;
306 std::vector<float> adc1(4);
307 std::vector<float> adcRaw1(4);
308 std::vector<float> adc2(4);
309 std::vector<float> adcRaw2(4);
317 if ( tmax > 2 && tmax < 7 ) {
318 int ibin = testStrip-1;
319 int jbin = centerStrip-1;
345 for (
size_t k = 0;
k < 4; ++
k){
346 if(adc1[
k]>0 && adc2[
k]>0) adc[
k] = adc[
k] * adc2[
k] / ( adc1[
k]+adc2[
k] );
347 if(adcRaw1[
k]>0 && adcRaw2[
k]>0) adcRaw[
k] = adcRaw[
k] * adcRaw2[
k] / ( adcRaw1[
k]+adcRaw2[
k] );
370 int thisChannel = (*it).getStrip();
371 auto & stripData = thePulseHeightMap[thisChannel-1];
372 auto & scaRaw = stripData.phRaw_;
373 auto & sca = stripData.ph_;
375 auto const & scaOri = (*it).getADCCounts();
376 assert(scaOri.size()==8);
378 std::copy( scaOri.begin(), scaOri.end(), scaRaw.begin());
379 std::copy( scaRaw.begin(), scaRaw.end(), sca.begin());
382 int tmax = std::max_element( sca.begin(), sca.end() ) - sca.begin();
393 if ( tmax > 2 && tmax < 7 ) {
396 stripData.phmax_ = phmax;
397 stripData.tmax_ =
tmax;
409 for (
int j = 1;
j < 3; ++
j ) {
410 thePulseHeightMap[thisChannel-1+16*
j] = stripData;
432 float heightCluster = 0.;
434 bool maximumFound =
false;
468 int numberOfConsecutiveStrips = 1;
469 float testThreshold = 10.;
472 for(
int l = 0;
l<8; ++
l){
473 if(j<0)
edm::LogWarning(
"FailedStripCountingWrongConsecutiveStripNumber") <<
"This should never occur!!! Contact CSC expert!";
475 bool signalPresent =
false;
476 for(
int k = 0;
k<2; ++
k){
478 int anotherConsecutiveStrip =
i+
j;
479 if(anotherConsecutiveStrip>=0 && anotherConsecutiveStrip<
int(
thePulseHeightMap.size() )){
481 ++numberOfConsecutiveStrips;
482 signalPresent =
true;
512 float strippos = -1.;
514 if ( data.size() < 1 )
return strippos;
519 int biggestStrip = max_element(data.begin(), data.end()) - data.begin();
520 strippos = data[biggestStrip].strip() * 1.;
530 for (
size_t i = 0;
i != data.size(); ++
i ) {
531 auto const &
w = data[
i].ph();
532 auto const & wRaw = data[
i].phRaw();
547 if ( data[
i].strip() < 1 ){
548 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly::findHitOnStripPosition] problem in indexing of strip, strip= "
552 sum +=
w[1] * data[
i].strip();
555 if ( sum_w > 0.) strippos = sum / sum_w;
int adc(sample_type sample)
get the ADC sample (12 bits)
CSCPedestalChoice * calcped_
T getParameter(std::string const &) const
void findMaxima(const CSCDetId &id)
Find local maxima.
std::vector< int > theConsecutiveStrips
std::vector< CSCStripHit > runStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripDigiCollection::Range &rstripd)
std::vector< int > theStrips
bool isDeadStrip(const CSCDetId &id, int centralStrip)
Is the strip 'bad'?
bool nearBadStrip(const CSCDetId &id, int geomStrip) const
Is a neighbour bad?
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)
static const int theClusterSize
PulseHeightMap thePulseHeightMap
const CSCChamberSpecs * specs() const
const CSCRecoConditions * recoConditions_
float theThresholdForAPeak
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=0, const CSCDetId id=0, int ichan=0)=0
bool gangedStrips() const
bool badStrip(const CSCDetId &id, int geomStrip) const
Is the strip bad?
unsigned int offset(bool)
float makeCluster(int centerStrip)
Make clusters using local maxima.
bool isNearDeadStrip(const CSCDetId &id, int centralStrip)
Is either neighbour 'bad'?
static const double tmax[3]
std::vector< CSCStripDigi >::const_iterator const_iterator
std::vector< float > strips_adcRaw
std::vector< int > theMaxima
void stripWeights(const CSCDetId &id, short int nstrips, float *weights) const
bool isPeakOK(int iStrip, float heightCluster)
char data[epos_bytes_allocation]
std::vector< float > strips_adc
std::pair< const_iterator, const_iterator > Range
void fillPulseHeights(const CSCStripDigiCollection::Range &rstripd)
Store SCA pulseheight information from strips in digis of one layer.
CSCStripHitData makeStripData(int centerStrip, int offset)
const CSCChamber * chamber() const