CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Typedefs | Functions
DeDxTools Namespace Reference

Typedefs

using ESGetTokenH3DDVariant = std::variant< edm::ESGetToken< H3DD, SiStripDeDxMip_3D_Rcd >, edm::ESGetToken< H3DD, SiStripDeDxPion_3D_Rcd >, edm::ESGetToken< H3DD, SiStripDeDxKaon_3D_Rcd >, edm::ESGetToken< H3DD, SiStripDeDxProton_3D_Rcd >, edm::ESGetToken< H3DD, SiStripDeDxElectron_3D_Rcd >>
 
using H3DD = PhysicsTools::Calibration::HistogramD3D
 

Functions

void buildDiscrimMap (PhysicsTools::Calibration::HistogramD3D const &, std::string const &ProbabilityMode, TH3F *&Prob_ChargePath)
 
ESGetTokenH3DDVariant esConsumes (std::string const &Reccord, edm::ConsumesCollector &)
 
int getCharge (const SiStripCluster *cluster, int &nSatStrip, const GeomDetUnit &detUnit, const std::vector< std::vector< float >> &calibGains, const unsigned int &m_off)
 
int getCharge (const SiStripCluster *cluster, int &nSatStrip, const GeomDetUnit &detUnit, const std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
 
PhysicsTools::Calibration::HistogramD3D
const & 
getHistogramD3D (edm::EventSetup const &, ESGetTokenH3DDVariant const &)
 
bool IsFarFromBorder (const TrajectoryStateOnSurface &trajState, const GeomDetUnit *it)
 
bool IsSpanningOver2APV (unsigned int FirstStrip, unsigned int ClusterSize)
 
void makeCalibrationMap (const std::string &m_calibrationPath, const TrackerGeometry &tkGeom, std::vector< std::vector< float >> &calibGains, const unsigned int &m_off)
 
void makeCalibrationMap (const std::string &m_calibrationPath, const TrackerGeometry &tkGeom, std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
 
bool shapeSelection (const SiStripCluster &ampls)
 

Typedef Documentation

Definition at line 58 of file DeDxTools.h.

Definition at line 53 of file DeDxTools.h.

Function Documentation

void DeDxTools::buildDiscrimMap ( PhysicsTools::Calibration::HistogramD3D const &  deDxMap,
std::string const &  ProbabilityMode,
TH3F *&  Prob_ChargePath 
)

Definition at line 319 of file DeDxTools.cc.

References PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::binContent(), Exception, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, cmsLHEtoEOSManager::l, PhysicsTools::Calibration::Range< Axis_t >::max, PhysicsTools::Calibration::Range< Axis_t >::min, PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::numberOfBinsX(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::numberOfBinsY(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::numberOfBinsZ(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::rangeX(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::rangeY(), PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::rangeZ(), createJobs::tmp, hlt_dqm_clientPB-live_cfg::xmax, hlt_dqm_clientPB-live_cfg::xmin, SiStrip_OfflineMonitoring_cff::ymax, and SiStrip_OfflineMonitoring_cff::ymin.

Referenced by ASmirnovDeDxDiscriminator::beginRun(), SmirnovDeDxDiscriminator::beginRun(), ProductDeDxDiscriminator::beginRun(), and BTagLikeDeDxDiscriminator::beginRun().

321  {
322  float xmin = deDxMap.rangeX().min;
323  float xmax = deDxMap.rangeX().max;
324  float ymin = deDxMap.rangeY().min;
325  float ymax = deDxMap.rangeY().max;
326  float zmin = deDxMap.rangeZ().min;
327  float zmax = deDxMap.rangeZ().max;
328 
329  if (Prob_ChargePath)
330  delete Prob_ChargePath;
331  Prob_ChargePath = new TH3F("Prob_ChargePath",
332  "Prob_ChargePath",
333  deDxMap.numberOfBinsX(),
334  xmin,
335  xmax,
336  deDxMap.numberOfBinsY(),
337  ymin,
338  ymax,
339  deDxMap.numberOfBinsZ(),
340  zmin,
341  zmax);
342 
343  if (strcmp(ProbabilityMode.c_str(), "Accumulation") == 0) {
344  for (int i = 0; i <= Prob_ChargePath->GetXaxis()->GetNbins() + 1; i++) {
345  for (int j = 0; j <= Prob_ChargePath->GetYaxis()->GetNbins() + 1; j++) {
346  float Ni = 0;
347  for (int k = 0; k <= Prob_ChargePath->GetZaxis()->GetNbins() + 1; k++) {
348  Ni += deDxMap.binContent(i, j, k);
349  }
350  for (int k = 0; k <= Prob_ChargePath->GetZaxis()->GetNbins() + 1; k++) {
351  float tmp = 0;
352  for (int l = 0; l <= k; l++) {
353  tmp += deDxMap.binContent(i, j, l);
354  }
355  if (Ni > 0) {
356  Prob_ChargePath->SetBinContent(i, j, k, tmp / Ni);
357  } else {
358  Prob_ChargePath->SetBinContent(i, j, k, 0);
359  }
360  }
361  }
362  }
363  } else if (strcmp(ProbabilityMode.c_str(), "Integral") == 0) {
364  for (int i = 0; i <= Prob_ChargePath->GetXaxis()->GetNbins() + 1; i++) {
365  for (int j = 0; j <= Prob_ChargePath->GetYaxis()->GetNbins() + 1; j++) {
366  float Ni = 0;
367  for (int k = 0; k <= Prob_ChargePath->GetZaxis()->GetNbins() + 1; k++) {
368  Ni += deDxMap.binContent(i, j, k);
369  }
370  for (int k = 0; k <= Prob_ChargePath->GetZaxis()->GetNbins() + 1; k++) {
371  float tmp = deDxMap.binContent(i, j, k);
372  if (Ni > 0) {
373  Prob_ChargePath->SetBinContent(i, j, k, tmp / Ni);
374  } else {
375  Prob_ChargePath->SetBinContent(i, j, k, 0);
376  }
377  }
378  }
379  }
380  } else {
381  throw cms::Exception("WrongConfig for dEdx") << "The ProbabilityMode: " << ProbabilityMode << "is unknown\n";
382  }
383  }
tmp
align.sh
Definition: createJobs.py:716
tuple ProbabilityMode
ESGetTokenH3DDVariant DeDxTools::esConsumes ( std::string const &  Reccord,
edm::ConsumesCollector iCC 
)

Definition at line 283 of file DeDxTools.cc.

References edm::BeginRun, edm::ConsumesCollector::esConsumes(), and Exception.

Referenced by _detCablingToken(), BDHadronTrackMonitoringAnalyzer::BDHadronTrackMonitoringAnalyzer(), BeamHaloAnalyzer::BeamHaloAnalyzer(), CalibratedElectronProducerRun2T< T >::CalibratedElectronProducerRun2T(), cms::ClusterMTCCFilter::ClusterMTCCFilter(), ConversionTrackProducer::ConversionTrackProducer(), CTPPSDirectProtonSimulation::CTPPSDirectProtonSimulation(), DQMSourcePi0::DQMSourcePi0(), DTRunConditionVar::DTRunConditionVar(), DTTTrigCalibration::DTTTrigCalibration(), EgammaHLTNxNClusterProducer::EgammaHLTNxNClusterProducer(), EgammaSCCorrectionMaker::EgammaSCCorrectionMaker(), ElectronHEEPIDValueMapProducer::ElectronHEEPIDValueMapProducer(), ESTimingTask::ESTimingTask(), EvtPlaneProducer::EvtPlaneProducer(), ExoticaDQM::ExoticaDQM(), FastSimProducer::FastSimProducer(), FixedGridRhoProducerFastjetFromRecHit::FixedGridRhoProducerFastjetFromRecHit(), GEDPhotonProducer::GEDPhotonProducer(), GlobalDigisAnalyzer::GlobalDigisAnalyzer(), HBHEIsolatedNoiseReflagger::HBHEIsolatedNoiseReflagger(), HcalRawToDigiGPU::HcalRawToDigiGPU(), HFEMClusterProducer::HFEMClusterProducer(), HiEvtPlaneFlatProducer::HiEvtPlaneFlatProducer(), HIMultiTrackSelector::HIMultiTrackSelector(), HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::HLTCaloObjInRegionsProducer(), HLTRecHitInAllL1RegionsProducer< RecHitType >::HLTRecHitInAllL1RegionsProducer(), HLTRechitInRegionsProducer< T1 >::HLTRechitInRegionsProducer(), cms::JetCorrectionProducer< T >::JetCorrectionProducer(), pat::JetCorrFactorsProducer::JetCorrFactorsProducer(), L1TRPCTPG::L1TRPCTPG(), L1TTauOffline::L1TTauOffline(), MeasurementTrackerEventProducer::MeasurementTrackerEventProducer(), cms::METSignificanceProducer::METSignificanceProducer(), MuonIdProducer::MuonIdProducer(), pat::PATMETProducer::PATMETProducer(), pat::PATMuonProducer::PATMuonProducer(), reco::tau::PATTauDiscriminationByMVAIsolationRun2::PATTauDiscriminationByMVAIsolationRun2(), pat::PATTriggerEventProducer::PATTriggerEventProducer(), pat::PATTriggerProducer::PATTriggerProducer(), cms::PFMETProducer::PFMETProducer(), PFRecoTauDiscriminationByIsolationMVA2::PFRecoTauDiscriminationByIsolationMVA2(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::PFRecoTauDiscriminationByMVAIsolationRun2(), PFSimParticleProducer::PFSimParticleProducer(), PhysicsObjectsMonitor::PhysicsObjectsMonitor(), PileupJetIdProducer::PileupJetIdProducer(), PiZeroAnalyzer::PiZeroAnalyzer(), RegressionEnergyPatElectronProducer::RegressionEnergyPatElectronProducer(), RPCChamberMasker::RPCChamberMasker(), RPCDigiValid::RPCDigiValid(), RPCPointVsRecHit::RPCPointVsRecHit(), RPCRecHitValid::RPCRecHitValid(), ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT(), ShiftedPFCandidateProducerForNoPileUpPFMEt::ShiftedPFCandidateProducerForNoPileUpPFMEt(), ShiftedPFCandidateProducerForPFNoPUMEt::ShiftedPFCandidateProducerForPFNoPUMEt(), SiStripClusterToDigiProducer::SiStripClusterToDigiProducer(), SmearedJetProducerT< T >::SmearedJetProducerT(), TauDiscriminantCutMultiplexerT< TauType, TauTypeRef, ParentClass >::TauDiscriminantCutMultiplexerT(), pat::TauJetCorrFactorsProducer::TauJetCorrFactorsProducer(), TSGFromL2Muon::TSGFromL2Muon(), TTClusterAssociator< T >::TTClusterAssociator(), TTClusterBuilder< T >::TTClusterBuilder(), TTStubAssociator< T >::TTStubAssociator(), and VirtualJetProducer::VirtualJetProducer().

283  {
284  if (Reccord == "SiStripDeDxMip_3D_Rcd") {
286  }
287  if (Reccord == "SiStripDeDxPion_3D_Rcd") {
289  }
290  if (Reccord == "SiStripDeDxKaon_3D_Rcd") {
292  }
293  if (Reccord == "SiStripDeDxProton_3D_Rcd") {
295  }
296  if (Reccord == "SiStripDeDxElectron_3D_Rcd") {
298  }
299  throw cms::Exception("WrongReccord for dEdx") << "The reccord : " << Reccord << "is unknown\n";
300  }
PhysicsTools::Calibration::HistogramD3D H3DD
Definition: DeDxTools.h:53
int DeDxTools::getCharge ( const SiStripCluster cluster,
int &  nSatStrip,
const GeomDetUnit detUnit,
const std::vector< std::vector< float >> &  calibGains,
const unsigned int &  m_off 
)
int DeDxTools::getCharge ( const SiStripCluster cluster,
int &  nSatStrip,
const GeomDetUnit detUnit,
const std::vector< std::vector< float > > &  calibGains,
const unsigned int &  m_off 
)

Definition at line 217 of file DeDxTools.cc.

References SiStripCluster::amplitudes(), RecoTauCleanerPlugins::charge, SiStripCluster::firstStrip(), mps_fire::i, and GeomDet::index().

221  {
222  const auto& Ampls = cluster->amplitudes();
223 
224  nSatStrip = 0;
225  int charge = 0;
226 
227  if (calibGains.empty()) {
228  for (unsigned int i = 0; i < Ampls.size(); i++) {
229  int calibratedCharge = Ampls[i];
230  charge += calibratedCharge;
231  if (calibratedCharge >= 254)
232  nSatStrip++;
233  }
234  } else {
235  for (unsigned int i = 0; i < Ampls.size(); i++) {
236  int calibratedCharge = Ampls[i];
237 
238  auto& gains = calibGains[detUnit.index() - m_off];
239  calibratedCharge = (int)(calibratedCharge / gains[(cluster->firstStrip() + i) / 128]);
240  if (calibratedCharge >= 255) {
241  if (calibratedCharge >= 1025)
242  calibratedCharge = 255;
243  else
244  calibratedCharge = 254;
245  }
246 
247  charge += calibratedCharge;
248  if (calibratedCharge >= 254)
249  nSatStrip++;
250  }
251  }
252  return charge;
253  }
SiStripCluster const & amplitudes() const
uint16_t firstStrip() const
int index() const
Definition: GeomDet.h:83
PhysicsTools::Calibration::HistogramD3D const & DeDxTools::getHistogramD3D ( edm::EventSetup const &  iES,
ESGetTokenH3DDVariant const &  iToken 
)

Definition at line 302 of file DeDxTools.cc.

References Exception, and edm::EventSetup::getData().

Referenced by ASmirnovDeDxDiscriminator::beginRun(), SmirnovDeDxDiscriminator::beginRun(), ProductDeDxDiscriminator::beginRun(), and BTagLikeDeDxDiscriminator::beginRun().

303  {
304  switch (iToken.index()) {
305  case 0:
306  return iES.getData(std::get<0>(iToken));
307  case 1:
308  return iES.getData(std::get<1>(iToken));
309  case 2:
310  return iES.getData(std::get<2>(iToken));
311  case 3:
312  return iES.getData(std::get<3>(iToken));
313  case 4:
314  return iES.getData(std::get<4>(iToken));
315  }
316  throw cms::Exception("HistogramD3DTokenUnset");
317  }
bool DeDxTools::IsFarFromBorder ( const TrajectoryStateOnSurface trajState,
const GeomDetUnit it 
)

Definition at line 426 of file DeDxTools.cc.

References Surface::bounds(), Bounds::length(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), LocalTrajectoryError::positionError(), GeomDet::surface(), and LocalError::yy().

Referenced by DeDxDiscriminatorLearner::processHit().

426  {
427  if (dynamic_cast<const StripGeomDetUnit*>(it) == nullptr && dynamic_cast<const PixelGeomDetUnit*>(it) == nullptr) {
428  edm::LogInfo("DeDxTools::IsFarFromBorder") << "this detID doesn't seem to belong to the Tracker" << std::endl;
429  return false;
430  }
431 
432  LocalPoint HitLocalPos = trajState.localPosition();
433  LocalError HitLocalError = trajState.localError().positionError();
434 
435  const BoundPlane plane = it->surface();
436  const TrapezoidalPlaneBounds* trapezoidalBounds(dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
437  const RectangularPlaneBounds* rectangularBounds(dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
438 
439  if (!trapezoidalBounds && !rectangularBounds)
440  return false;
441 
442  double DistFromBorder = 1.0;
443  //double HalfWidth = it->surface().bounds().width() /2.0;
444  double HalfLength =
445  trapezoidalBounds ? (*trapezoidalBounds).parameters()[3] : it->surface().bounds().length() / 2.0;
446 
447  // if (fabs(HitLocalPos.x())+HitLocalError.xx() >= (HalfWidth - DistFromBorder) ) return false;//Don't think is really necessary
448  if (fabs(HitLocalPos.y()) + HitLocalError.yy() >= (HalfLength - DistFromBorder))
449  return false;
450 
451  return true;
452  }
virtual float length() const =0
T y() const
Definition: PV3DBase.h:60
const Bounds & bounds() const
Definition: Surface.h:87
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
LocalError positionError() const
float yy() const
Definition: LocalError.h:24
const LocalTrajectoryError & localError() const
Log< level::Info, false > LogInfo
bool DeDxTools::IsSpanningOver2APV ( unsigned int  FirstStrip,
unsigned int  ClusterSize 
)

Definition at line 385 of file DeDxTools.cc.

Referenced by DeDxDiscriminatorLearner::processHit().

385  {
386  if (FirstStrip == 0)
387  return true;
388  if (FirstStrip == 128)
389  return true;
390  if (FirstStrip == 256)
391  return true;
392  if (FirstStrip == 384)
393  return true;
394  if (FirstStrip == 512)
395  return true;
396  if (FirstStrip == 640)
397  return true;
398 
399  if (FirstStrip <= 127 && FirstStrip + ClusterSize > 127)
400  return true;
401  if (FirstStrip <= 255 && FirstStrip + ClusterSize > 255)
402  return true;
403  if (FirstStrip <= 383 && FirstStrip + ClusterSize > 383)
404  return true;
405  if (FirstStrip <= 511 && FirstStrip + ClusterSize > 511)
406  return true;
407  if (FirstStrip <= 639 && FirstStrip + ClusterSize > 639)
408  return true;
409 
410  if (FirstStrip + ClusterSize == 127)
411  return true;
412  if (FirstStrip + ClusterSize == 255)
413  return true;
414  if (FirstStrip + ClusterSize == 383)
415  return true;
416  if (FirstStrip + ClusterSize == 511)
417  return true;
418  if (FirstStrip + ClusterSize == 639)
419  return true;
420  if (FirstStrip + ClusterSize == 767)
421  return true;
422 
423  return false;
424  }
void DeDxTools::makeCalibrationMap ( const std::string &  m_calibrationPath,
const TrackerGeometry tkGeom,
std::vector< std::vector< float >> &  calibGains,
const unsigned int &  m_off 
)
void DeDxTools::makeCalibrationMap ( const std::string &  m_calibrationPath,
const TrackerGeometry tkGeom,
std::vector< std::vector< float > > &  calibGains,
const unsigned int &  m_off 
)

Definition at line 255 of file DeDxTools.cc.

References TrackerGeometry::detUnits(), TrackerGeometry::idToDetUnit(), and GeomDet::index().

258  {
259  auto const& dus = tkGeom.detUnits();
260  calibGains.resize(dus.size() - m_off);
261 
262  TChain* t1 = new TChain("SiStripCalib/APVGain");
263  t1->Add(m_calibrationPath.c_str());
264 
265  unsigned int tree_DetId;
266  unsigned char tree_APVId;
267  double tree_Gain;
268  t1->SetBranchAddress("DetId", &tree_DetId);
269  t1->SetBranchAddress("APVId", &tree_APVId);
270  t1->SetBranchAddress("Gain", &tree_Gain);
271 
272  for (unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) {
273  t1->GetEntry(ientry);
274  auto& gains = calibGains[tkGeom.idToDetUnit(DetId(tree_DetId))->index() - m_off];
275  if (gains.size() < (size_t)(tree_APVId + 1)) {
276  gains.resize(tree_APVId + 1);
277  }
278  gains[tree_APVId] = tree_Gain;
279  }
280  t1->Delete();
281  }
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
int index() const
Definition: GeomDet.h:83
Definition: DetId.h:17
bool DeDxTools::shapeSelection ( const SiStripCluster ampls)

Definition at line 12 of file DeDxTools.cc.

References SiStripCluster::amplitudes(), mps_fire::i, and gpuVertexFinder::noise.

Referenced by pat::PATIsolatedTrackProducer::getDeDx(), DeDxDiscriminatorLearner::processHit(), DeDxEstimatorProducer::processHit(), and DeDxHitInfoProducer::produce().

12  {
13  // ---------------- COMPTAGE DU NOMBRE DE MAXIMA --------------------------
14  //----------------------------------------------------------------------------
15  // printf("ShapeTest \n");
16  auto const& ampls = clus.amplitudes();
17  Int_t NofMax = 0;
18  Int_t recur255 = 1;
19  Int_t recur254 = 1;
20  bool MaxOnStart = false;
21  bool MaxInMiddle = false, MaxOnEnd = false;
22  Int_t MaxPos = 0;
23  // Début avec max
24  if (ampls.size() != 1 &&
25  ((ampls[0] > ampls[1]) ||
26  (ampls.size() > 2 && ampls[0] == ampls[1] && ampls[1] > ampls[2] && ampls[0] != 254 && ampls[0] != 255) ||
27  (ampls.size() == 2 && ampls[0] == ampls[1] && ampls[0] != 254 && ampls[0] != 255))) {
28  NofMax = NofMax + 1;
29  MaxOnStart = true;
30  }
31 
32  // Maximum entouré
33  if (ampls.size() > 2) {
34  for (unsigned int i = 1; i < ampls.size() - 1U; i++) {
35  if ((ampls[i] > ampls[i - 1] && ampls[i] > ampls[i + 1]) ||
36  (ampls.size() > 3 && i > 0 && i < ampls.size() - 2U && ampls[i] == ampls[i + 1] &&
37  ampls[i] > ampls[i - 1] && ampls[i] > ampls[i + 2] && ampls[i] != 254 && ampls[i] != 255)) {
38  NofMax = NofMax + 1;
39  MaxInMiddle = true;
40  MaxPos = i;
41  }
42  if (ampls[i] == 255 && ampls[i] == ampls[i - 1]) {
43  recur255 = recur255 + 1;
44  MaxPos = i - (recur255 / 2);
45  if (ampls[i] > ampls[i + 1]) {
46  NofMax = NofMax + 1;
47  MaxInMiddle = true;
48  }
49  }
50  if (ampls[i] == 254 && ampls[i] == ampls[i - 1]) {
51  recur254 = recur254 + 1;
52  MaxPos = i - (recur254 / 2);
53  if (ampls[i] > ampls[i + 1]) {
54  NofMax = NofMax + 1;
55  MaxInMiddle = true;
56  }
57  }
58  }
59  }
60  // Fin avec un max
61  if (ampls.size() > 1) {
62  if (ampls[ampls.size() - 1] > ampls[ampls.size() - 2] ||
63  (ampls.size() > 2 && ampls[ampls.size() - 1] == ampls[ampls.size() - 2] &&
64  ampls[ampls.size() - 2] > ampls[ampls.size() - 3]) ||
65  ampls[ampls.size() - 1] == 255) {
66  NofMax = NofMax + 1;
67  MaxOnEnd = true;
68  }
69  }
70  // Si une seule strip touchée
71  if (ampls.size() == 1) {
72  NofMax = 1;
73  }
74 
75  // --- SELECTION EN FONCTION DE LA FORME POUR LES MAXIMA UNIQUES ---------
76  //------------------------------------------------------------------------
77  /*
78  ____
79  | |____
80  ____| | |
81  | | | |____
82  ____| | | | |
83  | | | | | |____
84  __|____|____|____|____|____|____|__
85  C_Mnn C_Mn C_M C_D C_Dn C_Dnn
86  */
87  // bool shapetest=true;
88  bool shapecdtn = false;
89 
90  // Float_t C_M; Float_t C_D; Float_t C_Mn; Float_t C_Dn; Float_t C_Mnn; Float_t C_Dnn;
91  Float_t C_M = 0.0;
92  Float_t C_D = 0.0;
93  Float_t C_Mn = 10000;
94  Float_t C_Dn = 10000;
95  Float_t C_Mnn = 10000;
96  Float_t C_Dnn = 10000;
97  Int_t CDPos;
98  Float_t coeff1 = 1.7;
99  Float_t coeff2 = 2.0;
100  Float_t coeffn = 0.10;
101  Float_t coeffnn = 0.02;
102  Float_t noise = 4.0;
103 
104  if (NofMax == 1) {
105  if (MaxOnStart == true) {
106  C_M = (Float_t)ampls[0];
107  C_D = (Float_t)ampls[1];
108  if (ampls.size() < 3)
109  shapecdtn = true;
110  else if (ampls.size() == 3) {
111  C_Dn = (Float_t)ampls[2];
112  if (C_Dn <= coeff1 * coeffn * C_D + coeff2 * coeffnn * C_M + 2 * noise || C_D == 255)
113  shapecdtn = true;
114  } else if (ampls.size() > 3) {
115  C_Dn = (Float_t)ampls[2];
116  C_Dnn = (Float_t)ampls[3];
117  if ((C_Dn <= coeff1 * coeffn * C_D + coeff2 * coeffnn * C_M + 2 * noise || C_D == 255) &&
118  C_Dnn <= coeff1 * coeffn * C_Dn + coeff2 * coeffnn * C_D + 2 * noise) {
119  shapecdtn = true;
120  }
121  }
122  }
123 
124  if (MaxOnEnd == true) {
125  C_M = (Float_t)ampls[ampls.size() - 1];
126  C_D = (Float_t)ampls[ampls.size() - 2];
127  if (ampls.size() < 3)
128  shapecdtn = true;
129  else if (ampls.size() == 3) {
130  C_Dn = (Float_t)ampls[0];
131  if (C_Dn <= coeff1 * coeffn * C_D + coeff2 * coeffnn * C_M + 2 * noise || C_D == 255)
132  shapecdtn = true;
133  } else if (ampls.size() > 3) {
134  C_Dn = (Float_t)ampls[ampls.size() - 3];
135  C_Dnn = (Float_t)ampls[ampls.size() - 4];
136  if ((C_Dn <= coeff1 * coeffn * C_D + coeff2 * coeffnn * C_M + 2 * noise || C_D == 255) &&
137  C_Dnn <= coeff1 * coeffn * C_Dn + coeff2 * coeffnn * C_D + 2 * noise) {
138  shapecdtn = true;
139  }
140  }
141  }
142 
143  if (MaxInMiddle == true) {
144  C_M = (Float_t)ampls[MaxPos];
145  int LeftOfMaxPos = MaxPos - 1;
146  if (LeftOfMaxPos <= 0)
147  LeftOfMaxPos = 0;
148  int RightOfMaxPos = MaxPos + 1;
149  if (RightOfMaxPos >= (int)ampls.size())
150  RightOfMaxPos = ampls.size() - 1;
151  //int after = RightOfMaxPos; int before = LeftOfMaxPos; if (after>=(int)ampls.size() || before<0) std::cout<<"invalid read MaxPos:"<<MaxPos <<"size:"<<ampls.size() <<std::endl;
152  if (ampls[LeftOfMaxPos] < ampls[RightOfMaxPos]) {
153  C_D = (Float_t)ampls[RightOfMaxPos];
154  C_Mn = (Float_t)ampls[LeftOfMaxPos];
155  CDPos = RightOfMaxPos;
156  } else {
157  C_D = (Float_t)ampls[LeftOfMaxPos];
158  C_Mn = (Float_t)ampls[RightOfMaxPos];
159  CDPos = LeftOfMaxPos;
160  }
161  if (C_Mn < coeff1 * coeffn * C_M + coeff2 * coeffnn * C_D + 2 * noise || C_M == 255) {
162  if (ampls.size() == 3)
163  shapecdtn = true;
164  else if (ampls.size() > 3) {
165  if (CDPos > MaxPos) {
166  if (ampls.size() - CDPos - 1 == 0) {
167  C_Dn = 0;
168  C_Dnn = 0;
169  }
170  if (ampls.size() - CDPos - 1 == 1) {
171  C_Dn = (Float_t)ampls[CDPos + 1];
172  C_Dnn = 0;
173  }
174  if (ampls.size() - CDPos - 1 > 1) {
175  C_Dn = (Float_t)ampls[CDPos + 1];
176  C_Dnn = (Float_t)ampls[CDPos + 2];
177  }
178  if (MaxPos >= 2) {
179  C_Mnn = (Float_t)ampls[MaxPos - 2];
180  } else if (MaxPos < 2)
181  C_Mnn = 0;
182  }
183  if (CDPos < MaxPos) {
184  if (CDPos == 0) {
185  C_Dn = 0;
186  C_Dnn = 0;
187  }
188  if (CDPos == 1) {
189  C_Dn = (Float_t)ampls[0];
190  C_Dnn = 0;
191  }
192  if (CDPos > 1) {
193  C_Dn = (Float_t)ampls[CDPos - 1];
194  C_Dnn = (Float_t)ampls[CDPos - 2];
195  }
196  if (ampls.size() - LeftOfMaxPos > 1 && MaxPos + 2 < (int)(ampls.size()) - 1) {
197  C_Mnn = (Float_t)ampls[MaxPos + 2];
198  } else
199  C_Mnn = 0;
200  }
201  if ((C_Dn <= coeff1 * coeffn * C_D + coeff2 * coeffnn * C_M + 2 * noise || C_D == 255) &&
202  C_Mnn <= coeff1 * coeffn * C_Mn + coeff2 * coeffnn * C_M + 2 * noise &&
203  C_Dnn <= coeff1 * coeffn * C_Dn + coeff2 * coeffnn * C_D + 2 * noise) {
204  shapecdtn = true;
205  }
206  }
207  }
208  }
209  }
210  if (ampls.size() == 1) {
211  shapecdtn = true;
212  }
213 
214  return shapecdtn;
215  }
SiStripCluster const & amplitudes() const
auto size() const
__shared__ int noise