CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DeDxDiscriminatorLearner Class Reference

#include <RecoTracker/DeDxDiscriminatorLearner/src/DeDxDiscriminatorLearner.cc>

Inheritance diagram for DeDxDiscriminatorLearner:
ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D > edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DeDxDiscriminatorLearner (const edm::ParameterSet &)
 
 ~DeDxDiscriminatorLearner () override
 
- Public Member Functions inherited from ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
 ~ConditionDBWriter () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void algoAnalyze (const edm::Event &, const edm::EventSetup &) override
 
void algoAnalyzeTheTree (const edm::EventSetup &iSetup)
 
void algoBeginJob (const edm::EventSetup &) override
 
void algoEndJob () override
 
std::unique_ptr< PhysicsTools::Calibration::HistogramD3DgetNewObject () override
 
void processHit (const TrackingRecHit *recHit, float trackMomentum, float &cosine, const TrajectoryStateOnSurface &trajState)
 

Private Attributes

std::string algoMode
 
std::vector< std::vector< float > > calibGains
 
float Charge_Max
 
float Charge_Min
 
int Charge_NBins
 
TH3F * Charge_Vs_Path
 
std::string HistoFile
 
std::string m_calibrationPath
 
unsigned int m_off
 
edm::EDGetTokenT< reco::TrackCollectionm_tracksTag
 
edm::EDGetTokenT< TrajTrackAssociationCollectionm_trajTrackAssociationTag
 
unsigned int MaxNrStrips
 
float MaxTrackChiOverNdf
 
float MaxTrackEta
 
float MaxTrackMomentum
 
float MinTrackEta
 
unsigned int MinTrackHits
 
float MinTrackMomentum
 
float P_Max
 
float P_Min
 
int P_NBins
 
float Path_Max
 
float Path_Min
 
int Path_NBins
 
bool shapetest
 
bool useCalibration
 
std::vector< std::string > VInputFiles
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 23 of file DeDxDiscriminatorLearner.h.

Constructor & Destructor Documentation

◆ DeDxDiscriminatorLearner()

DeDxDiscriminatorLearner::DeDxDiscriminatorLearner ( const edm::ParameterSet iConfig)
explicit

Definition at line 35 of file DeDxDiscriminatorLearner.cc.

37  m_tracksTag = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"));
39  consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("trajectoryTrackAssociation"));
40 
41  P_Min = iConfig.getParameter<double>("P_Min");
42  P_Max = iConfig.getParameter<double>("P_Max");
43  P_NBins = iConfig.getParameter<int>("P_NBins");
44  Path_Min = iConfig.getParameter<double>("Path_Min");
45  Path_Max = iConfig.getParameter<double>("Path_Max");
46  Path_NBins = iConfig.getParameter<int>("Path_NBins");
47  Charge_Min = iConfig.getParameter<double>("Charge_Min");
48  Charge_Max = iConfig.getParameter<double>("Charge_Max");
49  Charge_NBins = iConfig.getParameter<int>("Charge_NBins");
50 
51  MinTrackMomentum = iConfig.getUntrackedParameter<double>("minTrackMomentum", 5.0);
52  MaxTrackMomentum = iConfig.getUntrackedParameter<double>("maxTrackMomentum", 99999.0);
53  MinTrackEta = iConfig.getUntrackedParameter<double>("minTrackEta", -5.0);
54  MaxTrackEta = iConfig.getUntrackedParameter<double>("maxTrackEta", 5.0);
55  MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips", 255);
56  MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits", 4);
57 
58  algoMode = iConfig.getUntrackedParameter<string>("AlgoMode", "SingleJob");
59  HistoFile = iConfig.getUntrackedParameter<string>("HistoFile", "out.root");
60  VInputFiles = iConfig.getUntrackedParameter<vector<string> >("InputFiles");
61 
62  shapetest = iConfig.getParameter<bool>("ShapeTest");
63  useCalibration = iConfig.getUntrackedParameter<bool>("UseCalibration");
64  m_calibrationPath = iConfig.getUntrackedParameter<string>("calibrationPath");
65 }

References algoMode, Charge_Max, Charge_Min, Charge_NBins, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HistoFile, m_calibrationPath, m_tracksTag, m_trajTrackAssociationTag, MaxNrStrips, MaxTrackEta, MaxTrackMomentum, MinTrackEta, MinTrackHits, MinTrackMomentum, P_Max, P_Min, P_NBins, Path_Max, Path_Min, Path_NBins, shapetest, useCalibration, and VInputFiles.

◆ ~DeDxDiscriminatorLearner()

DeDxDiscriminatorLearner::~DeDxDiscriminatorLearner ( )
override

Definition at line 67 of file DeDxDiscriminatorLearner.cc.

67 {}

Member Function Documentation

◆ algoAnalyze()

void DeDxDiscriminatorLearner::algoAnalyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >.

Definition at line 120 of file DeDxDiscriminatorLearner.cc.

120  {
121  Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
122  iEvent.getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle);
123 
124  edm::Handle<reco::TrackCollection> trackCollectionHandle;
125  iEvent.getByToken(m_tracksTag, trackCollectionHandle);
126 
127  unsigned track_index = 0;
128  for (TrajTrackAssociationCollection::const_iterator it = trajTrackAssociationHandle->begin();
129  it != trajTrackAssociationHandle->end();
130  ++it, track_index++) {
131  const Track& track = *it->val;
132  const Trajectory& traj = *it->key;
133 
134  if (track.eta() < MinTrackEta || track.eta() > MaxTrackEta) {
135  continue;
136  }
137  if (track.pt() < MinTrackMomentum || track.pt() > MaxTrackMomentum) {
138  continue;
139  }
140  if (track.found() < MinTrackHits) {
141  continue;
142  }
143 
144  const vector<TrajectoryMeasurement>& measurements = traj.measurements();
145  for (vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it != measurements.end(); it++) {
146  TrajectoryStateOnSurface trajState = it->updatedState();
147  if (!trajState.isValid())
148  continue;
149 
150  const TrackingRecHit* recHit = (*it->recHit()).hit();
151  if (!recHit || !recHit->isValid())
152  continue;
153  LocalVector trackDirection = trajState.localDirection();
154  float cosine = trackDirection.z() / trackDirection.mag();
155 
156  processHit(recHit, trajState.localMomentum().mag(), cosine, trajState);
157  }
158  }
159 }

References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::AssociationMap< Tag >::end(), iEvent, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), TrajectoryStateOnSurface::localMomentum(), m_tracksTag, m_trajTrackAssociationTag, PV3DBase< T, PVType, FrameType >::mag(), MaxTrackEta, MaxTrackMomentum, Trajectory::measurements(), MinTrackEta, MinTrackHits, MinTrackMomentum, processHit(), rpcPointValidation_cfi::recHit, HLT_2018_cff::track, and PV3DBase< T, PVType, FrameType >::z().

◆ algoAnalyzeTheTree()

void DeDxDiscriminatorLearner::algoAnalyzeTheTree ( const edm::EventSetup iSetup)
private

Definition at line 239 of file DeDxDiscriminatorLearner.cc.

239  {
241  iSetup.get<TrackerDigiGeometryRecord>().get(tkGeom);
242 
243  unsigned int NEvent = 0;
244  for (unsigned int i = 0; i < VInputFiles.size(); i++) {
245  printf("Openning file %3i/%3i --> %s\n", i + 1, (int)VInputFiles.size(), (char*)(VInputFiles[i].c_str()));
246  fflush(stdout);
247  TChain* tree = new TChain("gainCalibrationTree/tree");
248  tree->Add(VInputFiles[i].c_str());
249 
250  TString EventPrefix("");
251  TString EventSuffix("");
252 
253  TString TrackPrefix("track");
254  TString TrackSuffix("");
255 
256  TString CalibPrefix("GainCalibration");
257  TString CalibSuffix("");
258 
259  unsigned int eventnumber = 0;
260  tree->SetBranchAddress(EventPrefix + "event" + EventSuffix, &eventnumber, nullptr);
261  unsigned int runnumber = 0;
262  tree->SetBranchAddress(EventPrefix + "run" + EventSuffix, &runnumber, nullptr);
263  std::vector<bool>* TrigTech = nullptr;
264  tree->SetBranchAddress(EventPrefix + "TrigTech" + EventSuffix, &TrigTech, nullptr);
265 
266  std::vector<double>* trackchi2ndof = nullptr;
267  tree->SetBranchAddress(TrackPrefix + "chi2ndof" + TrackSuffix, &trackchi2ndof, nullptr);
268  std::vector<float>* trackp = nullptr;
269  tree->SetBranchAddress(TrackPrefix + "momentum" + TrackSuffix, &trackp, nullptr);
270  std::vector<float>* trackpt = nullptr;
271  tree->SetBranchAddress(TrackPrefix + "pt" + TrackSuffix, &trackpt, nullptr);
272  std::vector<double>* tracketa = nullptr;
273  tree->SetBranchAddress(TrackPrefix + "eta" + TrackSuffix, &tracketa, nullptr);
274  std::vector<double>* trackphi = nullptr;
275  tree->SetBranchAddress(TrackPrefix + "phi" + TrackSuffix, &trackphi, nullptr);
276  std::vector<unsigned int>* trackhitsvalid = nullptr;
277  tree->SetBranchAddress(TrackPrefix + "hitsvalid" + TrackSuffix, &trackhitsvalid, nullptr);
278 
279  std::vector<int>* trackindex = nullptr;
280  tree->SetBranchAddress(CalibPrefix + "trackindex" + CalibSuffix, &trackindex, nullptr);
281  std::vector<unsigned int>* rawid = nullptr;
282  tree->SetBranchAddress(CalibPrefix + "rawid" + CalibSuffix, &rawid, nullptr);
283  std::vector<unsigned short>* firststrip = nullptr;
284  tree->SetBranchAddress(CalibPrefix + "firststrip" + CalibSuffix, &firststrip, nullptr);
285  std::vector<unsigned short>* nstrips = nullptr;
286  tree->SetBranchAddress(CalibPrefix + "nstrips" + CalibSuffix, &nstrips, nullptr);
287  std::vector<unsigned int>* charge = nullptr;
288  tree->SetBranchAddress(CalibPrefix + "charge" + CalibSuffix, &charge, nullptr);
289  std::vector<float>* path = nullptr;
290  tree->SetBranchAddress(CalibPrefix + "path" + CalibSuffix, &path, nullptr);
291  std::vector<unsigned char>* amplitude = nullptr;
292  tree->SetBranchAddress(CalibPrefix + "amplitude" + CalibSuffix, &amplitude, nullptr);
293  std::vector<double>* gainused = nullptr;
294  tree->SetBranchAddress(CalibPrefix + "gainused" + CalibSuffix, &gainused, nullptr);
295 
296  printf("Number of Events = %i + %i = %i\n",
297  NEvent,
298  (unsigned int)tree->GetEntries(),
299  (unsigned int)(NEvent + tree->GetEntries()));
300  NEvent += tree->GetEntries();
301  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
302  printf("Looping on the Tree :");
303  int TreeStep = tree->GetEntries() / 50;
304  if (TreeStep <= 1)
305  TreeStep = 1;
306  for (unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
307  if (ientry % TreeStep == 0) {
308  printf(".");
309  fflush(stdout);
310  }
311  tree->GetEntry(ientry);
312 
313  int FirstAmplitude = 0;
314  for (unsigned int c = 0; c < (*path).size(); c++) {
315  FirstAmplitude += (*nstrips)[c];
316  int t = (*trackindex)[c];
317  if ((*trackpt)[t] < 5)
318  continue;
319  if ((*trackhitsvalid)[t] < 5)
320  continue;
321 
322  int Charge = 0;
323  if (useCalibration) {
324  auto& gains = calibGains[tkGeom->idToDetUnit(DetId((*rawid)[c]))->index() - m_off];
325  auto& gain = gains[(*firststrip)[c] / 128];
326  for (unsigned int s = 0; s < (*nstrips)[c]; s++) {
327  int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[c] + s];
328  if (StripCharge < 254) {
329  StripCharge = (int)(StripCharge / gain);
330  if (StripCharge >= 1024) {
331  StripCharge = 255;
332  } else if (StripCharge >= 254) {
333  StripCharge = 254;
334  }
335  }
336  Charge += StripCharge;
337  }
338  } else {
339  Charge = (*charge)[c];
340  }
341 
342  // printf("ChargeDifference = %i Vs %i with Gain = %f\n",(*charge)[c],Charge,Gains[(*rawid)[c]]);
343  double ClusterChargeOverPath = ((double)Charge) / (*path)[c];
344  Charge_Vs_Path->Fill((*trackp)[t], (*path)[c], ClusterChargeOverPath);
345  }
346  }
347  printf("\n");
348  }
349 }

References CustomPhysics_cfi::amplitude, HltBtagPostValidation_cff::c, calibGains, ALCARECOTkAlJpsiMuMu_cff::charge, PixelTestBeamValidation_cfi::Charge, Charge_Vs_Path, PedestalClient_cfi::gain, edm::EventSetup::get(), get, mps_fire::i, TrackerGeometry::idToDetUnit(), GeomDet::index(), createfilelist::int, m_off, castor_dqm_sourceclient_file_cfg::path, cond::runnumber, alignCSCRings::s, mps_setup::stdout, OrderedSet::t, useCalibration, and VInputFiles.

Referenced by algoBeginJob().

◆ algoBeginJob()

void DeDxDiscriminatorLearner::algoBeginJob ( const edm::EventSetup iSetup)
overrideprivatevirtual

Reimplemented from ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >.

Definition at line 71 of file DeDxDiscriminatorLearner.cc.

71  {
72  Charge_Vs_Path = new TH3F("Charge_Vs_Path",
73  "Charge_Vs_Path",
74  P_NBins,
75  P_Min,
76  P_Max,
77  Path_NBins,
78  Path_Min,
79  Path_Max,
81  Charge_Min,
82  Charge_Max);
83 
84  if (useCalibration && calibGains.empty()) {
86  iSetup.get<TrackerDigiGeometryRecord>().get(tkGeom);
87  m_off = tkGeom->offsetDU(GeomDetEnumerators::PixelBarrel); //index start at the first pixel
88 
90  }
91 
92  //Read the calibTree if in calibTree mode
93  if (strcmp(algoMode.c_str(), "CalibTree") == 0)
94  algoAnalyzeTheTree(iSetup);
95 }

References algoAnalyzeTheTree(), algoMode, calibGains, Charge_Max, Charge_Min, Charge_NBins, Charge_Vs_Path, edm::EventSetup::get(), get, m_calibrationPath, m_off, DeDxTools::makeCalibrationMap(), TrackerGeometry::offsetDU(), P_Max, P_Min, P_NBins, Path_Max, Path_Min, Path_NBins, GeomDetEnumerators::PixelBarrel, and useCalibration.

◆ algoEndJob()

void DeDxDiscriminatorLearner::algoEndJob ( )
overrideprivatevirtual

Reimplemented from ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >.

Definition at line 99 of file DeDxDiscriminatorLearner.cc.

99  {
100  if (strcmp(algoMode.c_str(), "MultiJob") == 0) {
101  TFile* Output = new TFile(HistoFile.c_str(), "RECREATE");
102  Charge_Vs_Path->Write();
103  Output->Write();
104  Output->Close();
105  } else if (strcmp(algoMode.c_str(), "WriteOnDB") == 0) {
106  TFile* Input = new TFile(HistoFile.c_str());
107  Charge_Vs_Path = (TH3F*)(Input->FindObjectAny("Charge_Vs_Path"))->Clone();
108  Input->Close();
109  } else if (strcmp(algoMode.c_str(), "CalibTree") == 0) {
110  TFile* Output = new TFile(HistoFile.c_str(), "RECREATE");
111  Charge_Vs_Path->Write();
112  Output->Write();
113  Output->Close();
114  TFile* Input = new TFile(HistoFile.c_str());
115  Charge_Vs_Path = (TH3F*)(Input->FindObjectAny("Charge_Vs_Path"))->Clone();
116  Input->Close();
117  }
118 }

References algoMode, Charge_Vs_Path, HistoFile, Input, and Output.

◆ getNewObject()

std::unique_ptr< PhysicsTools::Calibration::HistogramD3D > DeDxDiscriminatorLearner::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >.

Definition at line 351 of file DeDxDiscriminatorLearner.cc.

351  {
352  auto obj = std::make_unique<PhysicsTools::Calibration::HistogramD3D>(Charge_Vs_Path->GetNbinsX(),
353  Charge_Vs_Path->GetXaxis()->GetXmin(),
354  Charge_Vs_Path->GetXaxis()->GetXmax(),
355  Charge_Vs_Path->GetNbinsY(),
356  Charge_Vs_Path->GetYaxis()->GetXmin(),
357  Charge_Vs_Path->GetYaxis()->GetXmax(),
358  Charge_Vs_Path->GetNbinsZ(),
359  Charge_Vs_Path->GetZaxis()->GetXmin(),
360  Charge_Vs_Path->GetZaxis()->GetXmax());
361 
362  for (int ix = 0; ix <= Charge_Vs_Path->GetNbinsX() + 1; ix++) {
363  for (int iy = 0; iy <= Charge_Vs_Path->GetNbinsY() + 1; iy++) {
364  for (int iz = 0; iz <= Charge_Vs_Path->GetNbinsZ() + 1; iz++) {
365  obj->setBinContent(ix, iy, iz, Charge_Vs_Path->GetBinContent(ix, iy, iz));
366  // if(Charge_Vs_Path->GetBinContent(ix,iy)!=0)printf("%i %i %i --> %f\n",ix,iy, iz, Charge_Vs_Path->GetBinContent(ix,iy,iz));
367  }
368  }
369  }
370 
371  return obj;
372 }

References Charge_Vs_Path, and getGTfromDQMFile::obj.

◆ processHit()

void DeDxDiscriminatorLearner::processHit ( const TrackingRecHit recHit,
float  trackMomentum,
float &  cosine,
const TrajectoryStateOnSurface trajState 
)
private

Definition at line 161 of file DeDxDiscriminatorLearner.cc.

164  {
165  auto const& thit = static_cast<BaseTrackerRecHit const&>(*recHit);
166  if (!thit.isValid())
167  return;
168 
169  auto const& clus = thit.firstClusterRef();
170  if (!clus.isValid())
171  return;
172 
173  int NSaturating = 0;
174  if (clus.isPixel()) {
175  return;
176  } else if (clus.isStrip() && !thit.isMatched()) {
177  auto& detUnit = *(recHit->detUnit());
178  auto& cluster = clus.stripCluster();
179  if (cluster.amplitudes().size() > MaxNrStrips) {
180  return;
181  }
182  if (DeDxTools::IsSpanningOver2APV(cluster.firstStrip(), cluster.amplitudes().size())) {
183  return;
184  }
185  if (!DeDxTools::IsFarFromBorder(trajState, &detUnit)) {
186  return;
187  }
188  float pathLen = 10.0 * detUnit.surface().bounds().thickness() / fabs(cosine);
189  float chargeAbs = DeDxTools::getCharge(&cluster, NSaturating, detUnit, calibGains, m_off);
190  float charge = chargeAbs / pathLen;
191  if (!shapetest || (shapetest && DeDxTools::shapeSelection(cluster))) {
192  Charge_Vs_Path->Fill(trackMomentum, pathLen, charge);
193  }
194  } else if (clus.isStrip() && thit.isMatched()) {
195  const SiStripMatchedRecHit2D* matchedHit = dynamic_cast<const SiStripMatchedRecHit2D*>(recHit);
196  if (!matchedHit)
197  return;
198  const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(matchedHit->det());
199 
200  auto& detUnitM = *(gdet->monoDet());
201  auto& clusterM = matchedHit->monoCluster();
202  if (clusterM.amplitudes().size() > MaxNrStrips) {
203  return;
204  }
205  if (DeDxTools::IsSpanningOver2APV(clusterM.firstStrip(), clusterM.amplitudes().size())) {
206  return;
207  }
208  if (!DeDxTools::IsFarFromBorder(trajState, &detUnitM)) {
209  return;
210  }
211  float pathLen = 10.0 * detUnitM.surface().bounds().thickness() / fabs(cosine);
212  float chargeAbs = DeDxTools::getCharge(&clusterM, NSaturating, detUnitM, calibGains, m_off);
213  float charge = chargeAbs / pathLen;
214  if (!shapetest || (shapetest && DeDxTools::shapeSelection(clusterM))) {
215  Charge_Vs_Path->Fill(trackMomentum, pathLen, charge);
216  }
217 
218  auto& detUnitS = *(gdet->stereoDet());
219  auto& clusterS = matchedHit->stereoCluster();
220  if (clusterS.amplitudes().size() > MaxNrStrips) {
221  return;
222  }
223  if (DeDxTools::IsSpanningOver2APV(clusterS.firstStrip(), clusterS.amplitudes().size())) {
224  return;
225  }
226  if (!DeDxTools::IsFarFromBorder(trajState, &detUnitS)) {
227  return;
228  }
229  pathLen = 10.0 * detUnitS.surface().bounds().thickness() / fabs(cosine);
230  chargeAbs = DeDxTools::getCharge(&clusterS, NSaturating, detUnitS, calibGains, m_off);
231  charge = chargeAbs / pathLen;
232  if (!shapetest || (shapetest && DeDxTools::shapeSelection(clusterS))) {
233  Charge_Vs_Path->Fill(trackMomentum, pathLen, charge);
234  }
235  }
236 }

References calibGains, ALCARECOTkAlJpsiMuMu_cff::charge, Charge_Vs_Path, TrackingRecHit::det(), DeDxTools::getCharge(), DeDxTools::IsFarFromBorder(), DeDxTools::IsSpanningOver2APV(), m_off, MaxNrStrips, SiStripMatchedRecHit2D::monoCluster(), GluedGeomDet::monoDet(), rpcPointValidation_cfi::recHit, DeDxTools::shapeSelection(), shapetest, SiStripMatchedRecHit2D::stereoCluster(), GluedGeomDet::stereoDet(), and reco::btau::trackMomentum.

Referenced by algoAnalyze().

Member Data Documentation

◆ algoMode

std::string DeDxDiscriminatorLearner::algoMode
private

Definition at line 64 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), algoEndJob(), and DeDxDiscriminatorLearner().

◆ calibGains

std::vector<std::vector<float> > DeDxDiscriminatorLearner::calibGains
private

Definition at line 73 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyzeTheTree(), algoBeginJob(), and processHit().

◆ Charge_Max

float DeDxDiscriminatorLearner::Charge_Max
private

Definition at line 60 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ Charge_Min

float DeDxDiscriminatorLearner::Charge_Min
private

Definition at line 59 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ Charge_NBins

int DeDxDiscriminatorLearner::Charge_NBins
private

Definition at line 61 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ Charge_Vs_Path

TH3F* DeDxDiscriminatorLearner::Charge_Vs_Path
private

◆ HistoFile

std::string DeDxDiscriminatorLearner::HistoFile
private

Definition at line 65 of file DeDxDiscriminatorLearner.h.

Referenced by algoEndJob(), and DeDxDiscriminatorLearner().

◆ m_calibrationPath

std::string DeDxDiscriminatorLearner::m_calibrationPath
private

Definition at line 69 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ m_off

unsigned int DeDxDiscriminatorLearner::m_off
private

Definition at line 74 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyzeTheTree(), algoBeginJob(), and processHit().

◆ m_tracksTag

edm::EDGetTokenT<reco::TrackCollection> DeDxDiscriminatorLearner::m_tracksTag
private

Definition at line 43 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

◆ m_trajTrackAssociationTag

edm::EDGetTokenT<TrajTrackAssociationCollection> DeDxDiscriminatorLearner::m_trajTrackAssociationTag
private

Definition at line 42 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

◆ MaxNrStrips

unsigned int DeDxDiscriminatorLearner::MaxNrStrips
private

Definition at line 49 of file DeDxDiscriminatorLearner.h.

Referenced by DeDxDiscriminatorLearner(), and processHit().

◆ MaxTrackChiOverNdf

float DeDxDiscriminatorLearner::MaxTrackChiOverNdf
private

Definition at line 51 of file DeDxDiscriminatorLearner.h.

◆ MaxTrackEta

float DeDxDiscriminatorLearner::MaxTrackEta
private

Definition at line 48 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

◆ MaxTrackMomentum

float DeDxDiscriminatorLearner::MaxTrackMomentum
private

Definition at line 46 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

◆ MinTrackEta

float DeDxDiscriminatorLearner::MinTrackEta
private

Definition at line 47 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

◆ MinTrackHits

unsigned int DeDxDiscriminatorLearner::MinTrackHits
private

Definition at line 50 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

◆ MinTrackMomentum

float DeDxDiscriminatorLearner::MinTrackMomentum
private

Definition at line 45 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

◆ P_Max

float DeDxDiscriminatorLearner::P_Max
private

Definition at line 54 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ P_Min

float DeDxDiscriminatorLearner::P_Min
private

Definition at line 53 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ P_NBins

int DeDxDiscriminatorLearner::P_NBins
private

Definition at line 55 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ Path_Max

float DeDxDiscriminatorLearner::Path_Max
private

Definition at line 57 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ Path_Min

float DeDxDiscriminatorLearner::Path_Min
private

Definition at line 56 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ Path_NBins

int DeDxDiscriminatorLearner::Path_NBins
private

Definition at line 58 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

◆ shapetest

bool DeDxDiscriminatorLearner::shapetest
private

Definition at line 71 of file DeDxDiscriminatorLearner.h.

Referenced by DeDxDiscriminatorLearner(), and processHit().

◆ useCalibration

bool DeDxDiscriminatorLearner::useCalibration
private

◆ VInputFiles

std::vector<std::string> DeDxDiscriminatorLearner::VInputFiles
private

Definition at line 63 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyzeTheTree(), and DeDxDiscriminatorLearner().

Vector3DBase< float, LocalTag >
DeDxDiscriminatorLearner::algoMode
std::string algoMode
Definition: DeDxDiscriminatorLearner.h:64
DeDxDiscriminatorLearner::Charge_NBins
int Charge_NBins
Definition: DeDxDiscriminatorLearner.h:61
TrajectoryStateOnSurface::localMomentum
LocalVector localMomentum() const
Definition: TrajectoryStateOnSurface.h:75
mps_fire.i
i
Definition: mps_fire.py:355
CustomPhysics_cfi.amplitude
amplitude
Definition: CustomPhysics_cfi.py:12
DeDxDiscriminatorLearner::m_calibrationPath
std::string m_calibrationPath
Definition: DeDxDiscriminatorLearner.h:69
SiStripMatchedRecHit2D::stereoCluster
SiStripCluster const & stereoCluster() const
Definition: SiStripMatchedRecHit2D.h:40
DeDxTools::makeCalibrationMap
void makeCalibrationMap(const std::string &m_calibrationPath, const TrackerGeometry &tkGeom, std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
Definition: DeDxTools.cc:252
DeDxDiscriminatorLearner::shapetest
bool shapetest
Definition: DeDxDiscriminatorLearner.h:71
DeDxDiscriminatorLearner::VInputFiles
std::vector< std::string > VInputFiles
Definition: DeDxDiscriminatorLearner.h:63
DeDxDiscriminatorLearner::MinTrackMomentum
float MinTrackMomentum
Definition: DeDxDiscriminatorLearner.h:45
tree
Definition: tree.py:1
TrackingRecHit::det
const GeomDet * det() const
Definition: TrackingRecHit.h:122
DeDxTools::IsSpanningOver2APV
bool IsSpanningOver2APV(unsigned int FirstStrip, unsigned int ClusterSize)
Definition: DeDxTools.cc:363
DeDxDiscriminatorLearner::Path_Max
float Path_Max
Definition: DeDxDiscriminatorLearner.h:57
DeDxDiscriminatorLearner::Charge_Min
float Charge_Min
Definition: DeDxDiscriminatorLearner.h:59
GluedGeomDet::monoDet
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
GeomDet::index
int index() const
Definition: GeomDet.h:83
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DeDxDiscriminatorLearner::Charge_Vs_Path
TH3F * Charge_Vs_Path
Definition: DeDxDiscriminatorLearner.h:67
edm::Handle
Definition: AssociativeIterator.h:50
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
DeDxDiscriminatorLearner::Path_Min
float Path_Min
Definition: DeDxDiscriminatorLearner.h:56
DeDxTools::IsFarFromBorder
bool IsFarFromBorder(const TrajectoryStateOnSurface &trajState, const GeomDetUnit *it)
Definition: DeDxTools.cc:404
DeDxTools::getCharge
int getCharge(const SiStripCluster *cluster, int &nSatStrip, const GeomDetUnit &detUnit, const std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
Definition: DeDxTools.cc:214
Input
#define Input(cl)
Definition: vmac.h:190
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
GeomDetEnumerators::PixelBarrel
Definition: GeomDetEnumerators.h:11
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DeDxDiscriminatorLearner::m_trajTrackAssociationTag
edm::EDGetTokenT< TrajTrackAssociationCollection > m_trajTrackAssociationTag
Definition: DeDxDiscriminatorLearner.h:42
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
DeDxDiscriminatorLearner::m_off
unsigned int m_off
Definition: DeDxDiscriminatorLearner.h:74
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
DeDxDiscriminatorLearner::MinTrackEta
float MinTrackEta
Definition: DeDxDiscriminatorLearner.h:47
reco::Track
Definition: Track.h:27
edm::ESHandle< TrackerGeometry >
reco::btau::trackMomentum
Definition: TaggingVariable.h:41
OrderedSet.t
t
Definition: OrderedSet.py:90
DeDxDiscriminatorLearner::MaxTrackMomentum
float MaxTrackMomentum
Definition: DeDxDiscriminatorLearner.h:46
GluedGeomDet
Definition: GluedGeomDet.h:7
DeDxTools::shapeSelection
bool shapeSelection(const SiStripCluster &ampls)
Definition: DeDxTools.cc:9
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator
friend struct const_iterator
Definition: AssociationMap.h:274
DeDxDiscriminatorLearner::useCalibration
bool useCalibration
Definition: DeDxDiscriminatorLearner.h:70
DeDxDiscriminatorLearner::Path_NBins
int Path_NBins
Definition: DeDxDiscriminatorLearner.h:58
mps_setup.stdout
stdout
Definition: mps_setup.py:250
DeDxDiscriminatorLearner::P_NBins
int P_NBins
Definition: DeDxDiscriminatorLearner.h:55
DeDxDiscriminatorLearner::MaxNrStrips
unsigned int MaxNrStrips
Definition: DeDxDiscriminatorLearner.h:49
cond::runnumber
Definition: Time.h:19
DeDxDiscriminatorLearner::algoAnalyzeTheTree
void algoAnalyzeTheTree(const edm::EventSetup &iSetup)
Definition: DeDxDiscriminatorLearner.cc:239
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
DeDxDiscriminatorLearner::P_Min
float P_Min
Definition: DeDxDiscriminatorLearner.h:53
get
#define get
DeDxDiscriminatorLearner::processHit
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, const TrajectoryStateOnSurface &trajState)
Definition: DeDxDiscriminatorLearner.cc:161
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
TrackingRecHit
Definition: TrackingRecHit.h:21
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
GluedGeomDet::stereoDet
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
DeDxDiscriminatorLearner::HistoFile
std::string HistoFile
Definition: DeDxDiscriminatorLearner.h:65
DeDxDiscriminatorLearner::m_tracksTag
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
Definition: DeDxDiscriminatorLearner.h:43
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
Trajectory
Definition: Trajectory.h:38
DeDxDiscriminatorLearner::MaxTrackEta
float MaxTrackEta
Definition: DeDxDiscriminatorLearner.h:48
SiStripMatchedRecHit2D::monoCluster
SiStripCluster const & monoCluster() const
Definition: SiStripMatchedRecHit2D.h:41
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
DeDxDiscriminatorLearner::Charge_Max
float Charge_Max
Definition: DeDxDiscriminatorLearner.h:60
PixelTestBeamValidation_cfi.Charge
Charge
Definition: PixelTestBeamValidation_cfi.py:78
DeDxDiscriminatorLearner::P_Max
float P_Max
Definition: DeDxDiscriminatorLearner.h:54
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
DeDxDiscriminatorLearner::calibGains
std::vector< std::vector< float > > calibGains
Definition: DeDxDiscriminatorLearner.h:73
TrackerGeometry::offsetDU
unsigned int offsetDU(SubDetector sid) const
Definition: TrackerGeometry.h:72
DeDxDiscriminatorLearner::MinTrackHits
unsigned int MinTrackHits
Definition: DeDxDiscriminatorLearner.h:50
edm::InputTag
Definition: InputTag.h:15
Output
#define Output(cl)
Definition: vmac.h:194
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88