CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from ConditionDBWriter< PhysicsTools::Calibration::HistogramD3D >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
virtual ~ConditionDBWriter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void algoAnalyze (const edm::Event &, const edm::EventSetup &)
 
void algoAnalyzeTheTree (const edm::EventSetup &iSetup)
 
virtual void algoBeginJob (const edm::EventSetup &)
 
virtual void algoEndJob ()
 
PhysicsTools::Calibration::HistogramD3DgetNewObject ()
 
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::TrackCollection
m_tracksTag
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
m_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 &)
 
- 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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

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

Definition at line 22 of file DeDxDiscriminatorLearner.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file DeDxDiscriminatorLearner.cc.

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.

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

Definition at line 67 of file DeDxDiscriminatorLearner.cc.

67 {}

Member Function Documentation

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

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

Definition at line 111 of file DeDxDiscriminatorLearner.cc.

References edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, reco::TrackBase::eta(), reco::Track::found(), edm::Event::getByToken(), TrajectoryStateOnSurface::isValid(), TrackingRecHit::isValid(), TrajectoryStateOnSurface::localDirection(), TrajectoryStateOnSurface::localMomentum(), m_tracksTag, m_trajTrackAssociationTag, PV3DBase< T, PVType, FrameType >::mag(), MaxTrackEta, MaxTrackMomentum, Trajectory::measurements(), MinTrackEta, MinTrackHits, MinTrackMomentum, processHit(), reco::TrackBase::pt(), and PV3DBase< T, PVType, FrameType >::z().

112 {
113  Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
114  iEvent.getByToken(m_trajTrackAssociationTag, trajTrackAssociationHandle);
115 
116  edm::Handle<reco::TrackCollection> trackCollectionHandle;
117  iEvent.getByToken(m_tracksTag,trackCollectionHandle);
118 
119  unsigned track_index = 0;
120  for(TrajTrackAssociationCollection::const_iterator it = trajTrackAssociationHandle->begin(); it!=trajTrackAssociationHandle->end(); ++it, track_index++) {
121  const Track& track = *it->val;
122  const Trajectory& traj = *it->key;
123 
124  if(track.eta() <MinTrackEta || track.eta()>MaxTrackEta ){continue;}
125  if(track.pt() <MinTrackMomentum || track.pt() >MaxTrackMomentum){continue;}
126  if(track.found()<MinTrackHits ){continue;}
127 
128  const vector<TrajectoryMeasurement> & measurements = traj.measurements();
129  for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
130  TrajectoryStateOnSurface trajState=it->updatedState();
131  if( !trajState.isValid()) continue;
132 
133 
134  const TrackingRecHit * recHit=(*it->recHit()).hit();
135  if(!recHit || !recHit->isValid())continue;
136  LocalVector trackDirection = trajState.localDirection();
137  float cosine = trackDirection.z()/trackDirection.mag();
138 
139  processHit(recHit, trajState.localMomentum().mag(), cosine, trajState);
140  }
141  }
142 
143 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
LocalVector localDirection() const
LocalVector localMomentum() const
DataContainer const & measurements() const
Definition: Trajectory.h:203
T mag() const
Definition: PV3DBase.h:67
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:638
double pt() const
track transverse momentum
Definition: TrackBase.h:608
T z() const
Definition: PV3DBase.h:64
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, const TrajectoryStateOnSurface &trajState)
bool isValid() const
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:194
edm::EDGetTokenT< TrajTrackAssociationCollection > m_trajTrackAssociationTag
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
void DeDxDiscriminatorLearner::algoAnalyzeTheTree ( const edm::EventSetup iSetup)
private

Definition at line 201 of file DeDxDiscriminatorLearner.cc.

References EnergyCorrector::c, calibGains, RecoTauCleanerPlugins::charge, Charge_Vs_Path, edm::EventSetup::get(), i, m_off, NULL, fed_dqm_sourceclient-live_cfg::path, cond::runnumber, alignCSCRings::s, tree::t, MainPageGenerator::tree, useCalibration, and VInputFiles.

Referenced by algoBeginJob().

202 {
204  iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
205 
206  unsigned int NEvent = 0;
207  for(unsigned int i=0;i<VInputFiles.size();i++){
208  printf("Openning file %3i/%3i --> %s\n",i+1, (int)VInputFiles.size(), (char*)(VInputFiles[i].c_str())); fflush(stdout);
209  TChain* tree = new TChain("gainCalibrationTree/tree");
210  tree->Add(VInputFiles[i].c_str());
211 
212  TString EventPrefix("");
213  TString EventSuffix("");
214 
215  TString TrackPrefix("track");
216  TString TrackSuffix("");
217 
218  TString CalibPrefix("GainCalibration");
219  TString CalibSuffix("");
220 
221  unsigned int eventnumber = 0; tree->SetBranchAddress(EventPrefix + "event" + EventSuffix, &eventnumber , NULL);
222  unsigned int runnumber = 0; tree->SetBranchAddress(EventPrefix + "run" + EventSuffix, &runnumber , NULL);
223  std::vector<bool>* TrigTech = 0; tree->SetBranchAddress(EventPrefix + "TrigTech" + EventSuffix, &TrigTech , NULL);
224 
225  std::vector<double>* trackchi2ndof = 0; tree->SetBranchAddress(TrackPrefix + "chi2ndof" + TrackSuffix, &trackchi2ndof , NULL);
226  std::vector<float>* trackp = 0; tree->SetBranchAddress(TrackPrefix + "momentum" + TrackSuffix, &trackp , NULL);
227  std::vector<float>* trackpt = 0; tree->SetBranchAddress(TrackPrefix + "pt" + TrackSuffix, &trackpt , NULL);
228  std::vector<double>* tracketa = 0; tree->SetBranchAddress(TrackPrefix + "eta" + TrackSuffix, &tracketa , NULL);
229  std::vector<double>* trackphi = 0; tree->SetBranchAddress(TrackPrefix + "phi" + TrackSuffix, &trackphi , NULL);
230  std::vector<unsigned int>* trackhitsvalid = 0; tree->SetBranchAddress(TrackPrefix + "hitsvalid" + TrackSuffix, &trackhitsvalid, NULL);
231 
232  std::vector<int>* trackindex = 0; tree->SetBranchAddress(CalibPrefix + "trackindex" + CalibSuffix, &trackindex , NULL);
233  std::vector<unsigned int>* rawid = 0; tree->SetBranchAddress(CalibPrefix + "rawid" + CalibSuffix, &rawid , NULL);
234  std::vector<unsigned short>* firststrip = 0; tree->SetBranchAddress(CalibPrefix + "firststrip" + CalibSuffix, &firststrip , NULL);
235  std::vector<unsigned short>* nstrips = 0; tree->SetBranchAddress(CalibPrefix + "nstrips" + CalibSuffix, &nstrips , NULL);
236  std::vector<unsigned int>* charge = 0; tree->SetBranchAddress(CalibPrefix + "charge" + CalibSuffix, &charge , NULL);
237  std::vector<float>* path = 0; tree->SetBranchAddress(CalibPrefix + "path" + CalibSuffix, &path , NULL);
238  std::vector<unsigned char>* amplitude = 0; tree->SetBranchAddress(CalibPrefix + "amplitude" + CalibSuffix, &amplitude , NULL);
239  std::vector<double>* gainused = 0; tree->SetBranchAddress(CalibPrefix + "gainused" + CalibSuffix, &gainused , NULL);
240 
241  printf("Number of Events = %i + %i = %i\n",NEvent,(unsigned int)tree->GetEntries(),(unsigned int)(NEvent+tree->GetEntries()));NEvent+=tree->GetEntries();
242  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
243  printf("Looping on the Tree :");
244  int TreeStep = tree->GetEntries()/50;if(TreeStep<=1)TreeStep=1;
245  for (unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
246  if(ientry%TreeStep==0){printf(".");fflush(stdout);}
247  tree->GetEntry(ientry);
248 
249  int FirstAmplitude = 0;
250  for(unsigned int c=0;c<(*path).size();c++){
251  FirstAmplitude+=(*nstrips)[c];
252  int t = (*trackindex)[c];
253  if((*trackpt)[t]<5)continue;
254  if((*trackhitsvalid)[t]<5)continue;
255 
256  int Charge = 0;
257  if(useCalibration){
258  auto & gains = calibGains[tkGeom->idToDetUnit(DetId((*rawid)[c]))->index()-m_off];
259  auto & gain = gains[(*firststrip)[c]/128];
260  for(unsigned int s=0;s<(*nstrips)[c];s++){
261  int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[c]+s];
262  if(StripCharge<254){
263  StripCharge=(int)(StripCharge/gain);
264  if(StripCharge>=1024){
265  StripCharge = 255;
266  }else if(StripCharge>=254){
267  StripCharge = 254;
268  }
269  }
270  Charge += StripCharge;
271  }
272  }else{
273  Charge = (*charge)[c];
274  }
275 
276 // printf("ChargeDifference = %i Vs %i with Gain = %f\n",(*charge)[c],Charge,Gains[(*rawid)[c]]);
277  double ClusterChargeOverPath = ( (double) Charge )/(*path)[c] ;
278  Charge_Vs_Path->Fill((*trackp)[t],(*path)[c],ClusterChargeOverPath);
279  }
280  }printf("\n");
281  }
282 }
tuple t
Definition: tree.py:139
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
std::vector< std::string > VInputFiles
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56
std::vector< std::vector< float > > calibGains
void DeDxDiscriminatorLearner::algoBeginJob ( const edm::EventSetup iSetup)
privatevirtual

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

Definition at line 71 of file DeDxDiscriminatorLearner.cc.

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

72 {
73  Charge_Vs_Path = new TH3F ("Charge_Vs_Path" , "Charge_Vs_Path" , P_NBins, P_Min, P_Max, Path_NBins, Path_Min, Path_Max, Charge_NBins, Charge_Min, Charge_Max);
74 
75  if(useCalibration && calibGains.size()==0){
77  iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
78  m_off = tkGeom->offsetDU(GeomDetEnumerators::PixelBarrel); //index start at the first pixel
79 
81  }
82 
83  //Read the calibTree if in calibTree mode
84  if(strcmp(algoMode.c_str(),"CalibTree")==0)algoAnalyzeTheTree(iSetup);
85 }
void makeCalibrationMap(const std::string &m_calibrationPath, const TrackerGeometry &tkGeom, std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
Definition: DeDxTools.cc:196
void algoAnalyzeTheTree(const edm::EventSetup &iSetup)
const T & get() const
Definition: EventSetup.h:56
std::vector< std::vector< float > > calibGains
void DeDxDiscriminatorLearner::algoEndJob ( )
privatevirtual

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

Definition at line 89 of file DeDxDiscriminatorLearner.cc.

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

90 {
91  if( strcmp(algoMode.c_str(),"MultiJob")==0){
92  TFile* Output = new TFile(HistoFile.c_str(), "RECREATE");
93  Charge_Vs_Path->Write();
94  Output->Write();
95  Output->Close();
96  }else if( strcmp(algoMode.c_str(),"WriteOnDB")==0){
97  TFile* Input = new TFile(HistoFile.c_str() );
98  Charge_Vs_Path = (TH3F*)(Input->FindObjectAny("Charge_Vs_Path"))->Clone();
99  Input->Close();
100  }else if(strcmp(algoMode.c_str(),"CalibTree")==0){
101  TFile* Output = new TFile(HistoFile.c_str(), "RECREATE");
102  Charge_Vs_Path->Write();
103  Output->Write();
104  Output->Close();
105  TFile* Input = new TFile(HistoFile.c_str() );
106  Charge_Vs_Path = (TH3F*)(Input->FindObjectAny("Charge_Vs_Path"))->Clone();
107  Input->Close();
108  }
109 }
#define Input(cl)
Definition: vmac.h:188
#define Output(cl)
Definition: vmac.h:192
PhysicsTools::Calibration::HistogramD3D * DeDxDiscriminatorLearner::getNewObject ( )
privatevirtual

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

Definition at line 285 of file DeDxDiscriminatorLearner.cc.

References Charge_Vs_Path, getGTfromDQMFile::obj, and PhysicsTools::Calibration::Histogram3D< Value_t, AxisX_t, AxisY_t, AxisZ_t >::setBinContent().

286 {
289  Charge_Vs_Path->GetNbinsX(), Charge_Vs_Path->GetXaxis()->GetXmin(), Charge_Vs_Path->GetXaxis()->GetXmax(),
290  Charge_Vs_Path->GetNbinsY(), Charge_Vs_Path->GetYaxis()->GetXmin(), Charge_Vs_Path->GetYaxis()->GetXmax(),
291  Charge_Vs_Path->GetNbinsZ(), Charge_Vs_Path->GetZaxis()->GetXmin(), Charge_Vs_Path->GetZaxis()->GetXmax());
292 
293  for(int ix=0; ix<=Charge_Vs_Path->GetNbinsX()+1; ix++){
294  for(int iy=0; iy<=Charge_Vs_Path->GetNbinsY()+1; iy++){
295  for(int iz=0; iz<=Charge_Vs_Path->GetNbinsZ()+1; iz++){
296  obj->setBinContent(ix, iy, iz, Charge_Vs_Path->GetBinContent(ix,iy, iz) );
297 // if(Charge_Vs_Path->GetBinContent(ix,iy)!=0)printf("%i %i %i --> %f\n",ix,iy, iz, Charge_Vs_Path->GetBinContent(ix,iy,iz));
298  }
299  }
300  }
301 
302  return obj;
303 }
Histogram3D< double > HistogramD3D
Definition: Histogram3D.h:187
void setBinContent(int bin, Value_t value)
void DeDxDiscriminatorLearner::processHit ( const TrackingRecHit recHit,
float  trackMomentum,
float &  cosine,
const TrajectoryStateOnSurface trajState 
)
private

Definition at line 146 of file DeDxDiscriminatorLearner.cc.

References calibGains, RecoTauCleanerPlugins::charge, Charge_Vs_Path, compareJSON::const, TrackingRecHit::det(), TrackingRecHit::detUnit(), DeDxTools::getCharge(), DeDxTools::IsFarFromBorder(), DeDxTools::IsSpanningOver2APV(), m_off, MaxNrStrips, SiStripMatchedRecHit2D::monoCluster(), GluedGeomDet::monoDet(), DeDxTools::shapeSelection(), shapetest, SiStripMatchedRecHit2D::stereoCluster(), and GluedGeomDet::stereoDet().

Referenced by algoAnalyze().

146  {
147  auto const & thit = static_cast<BaseTrackerRecHit const&>(*recHit);
148  if(!thit.isValid())return;
149 
150  auto const & clus = thit.firstClusterRef();
151  if(!clus.isValid())return;
152 
153  int NSaturating = 0;
154  if(clus.isPixel()){
155  return;
156  }else if(clus.isStrip() && !thit.isMatched()){
157  auto& detUnit = *(recHit->detUnit());
158  auto& cluster = clus.stripCluster();
159  if( cluster.amplitudes().size()>MaxNrStrips) { return; }
160  if( DeDxTools::IsSpanningOver2APV (cluster.firstStrip(), cluster.amplitudes().size())) { return; }
161  if(!DeDxTools::IsFarFromBorder (trajState, &detUnit )) { return; }
162  float pathLen = 10.0*detUnit.surface().bounds().thickness()/fabs(cosine);
163  float chargeAbs = DeDxTools::getCharge(&cluster,NSaturating, detUnit, calibGains, m_off);
164  float charge = chargeAbs/pathLen;
165  if(!shapetest || (shapetest && DeDxTools::shapeSelection(cluster))){
166  Charge_Vs_Path->Fill(trackMomentum, pathLen, charge);
167  }
168  }else if(clus.isStrip() && thit.isMatched()){
169  const SiStripMatchedRecHit2D* matchedHit=dynamic_cast<const SiStripMatchedRecHit2D*>(recHit);
170  if(!matchedHit)return;
171  const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(matchedHit->det());
172 
173  auto& detUnitM = *(gdet->monoDet());
174  auto& clusterM = matchedHit->monoCluster();
175  if( clusterM.amplitudes().size()>MaxNrStrips) { return; }
176  if( DeDxTools::IsSpanningOver2APV (clusterM.firstStrip(), clusterM.amplitudes().size())) { return; }
177  if(!DeDxTools::IsFarFromBorder (trajState, &detUnitM )) { return; }
178  float pathLen = 10.0*detUnitM.surface().bounds().thickness()/fabs(cosine);
179  float chargeAbs = DeDxTools::getCharge(&clusterM,NSaturating, detUnitM, calibGains, m_off);
180  float charge = chargeAbs/pathLen;
181  if(!shapetest || (shapetest && DeDxTools::shapeSelection(clusterM))){
182  Charge_Vs_Path->Fill(trackMomentum, pathLen, charge);
183  }
184 
185  auto& detUnitS = *(gdet->stereoDet());
186  auto& clusterS = matchedHit->stereoCluster();
187  if( clusterS.amplitudes().size()>MaxNrStrips) { return; }
188  if( DeDxTools::IsSpanningOver2APV (clusterS.firstStrip(), clusterS.amplitudes().size())) { return; }
189  if(!DeDxTools::IsFarFromBorder (trajState, &detUnitS )) { return; }
190  pathLen = 10.0*detUnitS.surface().bounds().thickness()/fabs(cosine);
191  chargeAbs = DeDxTools::getCharge(&clusterS,NSaturating, detUnitS, calibGains, m_off);
192  charge = chargeAbs/pathLen;
193  if(!shapetest || (shapetest && DeDxTools::shapeSelection(clusterS))){
194  Charge_Vs_Path->Fill(trackMomentum, pathLen, charge);
195  }
196  }
197 }
bool IsFarFromBorder(const TrajectoryStateOnSurface &trajState, const GeomDetUnit *it)
Definition: DeDxTools.cc:311
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:161
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
SiStripCluster const & monoCluster() const
const GeomDet * det() const
bool shapeSelection(const SiStripCluster &ampls)
Definition: DeDxTools.cc:10
string const
Definition: compareJSON.py:14
SiStripCluster const & stereoCluster() const
virtual const GeomDetUnit * detUnit() const
bool IsSpanningOver2APV(unsigned int FirstStrip, unsigned int ClusterSize)
Definition: DeDxTools.cc:286
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
std::vector< std::vector< float > > calibGains

Member Data Documentation

std::string DeDxDiscriminatorLearner::algoMode
private

Definition at line 62 of file DeDxDiscriminatorLearner.h.

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

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

Definition at line 72 of file DeDxDiscriminatorLearner.h.

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

float DeDxDiscriminatorLearner::Charge_Max
private

Definition at line 58 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::Charge_Min
private

Definition at line 57 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

int DeDxDiscriminatorLearner::Charge_NBins
private

Definition at line 59 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

TH3F* DeDxDiscriminatorLearner::Charge_Vs_Path
private
std::string DeDxDiscriminatorLearner::HistoFile
private

Definition at line 63 of file DeDxDiscriminatorLearner.h.

Referenced by algoEndJob(), and DeDxDiscriminatorLearner().

std::string DeDxDiscriminatorLearner::m_calibrationPath
private

Definition at line 68 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

unsigned int DeDxDiscriminatorLearner::m_off
private

Definition at line 73 of file DeDxDiscriminatorLearner.h.

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

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

Definition at line 41 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

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

Definition at line 40 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

unsigned int DeDxDiscriminatorLearner::MaxNrStrips
private

Definition at line 47 of file DeDxDiscriminatorLearner.h.

Referenced by DeDxDiscriminatorLearner(), and processHit().

float DeDxDiscriminatorLearner::MaxTrackChiOverNdf
private

Definition at line 49 of file DeDxDiscriminatorLearner.h.

float DeDxDiscriminatorLearner::MaxTrackEta
private

Definition at line 46 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::MaxTrackMomentum
private

Definition at line 44 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::MinTrackEta
private

Definition at line 45 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

unsigned int DeDxDiscriminatorLearner::MinTrackHits
private

Definition at line 48 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::MinTrackMomentum
private

Definition at line 43 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyze(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::P_Max
private

Definition at line 52 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::P_Min
private

Definition at line 51 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

int DeDxDiscriminatorLearner::P_NBins
private

Definition at line 53 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::Path_Max
private

Definition at line 55 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

float DeDxDiscriminatorLearner::Path_Min
private

Definition at line 54 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

int DeDxDiscriminatorLearner::Path_NBins
private

Definition at line 56 of file DeDxDiscriminatorLearner.h.

Referenced by algoBeginJob(), and DeDxDiscriminatorLearner().

bool DeDxDiscriminatorLearner::shapetest
private

Definition at line 70 of file DeDxDiscriminatorLearner.h.

Referenced by DeDxDiscriminatorLearner(), and processHit().

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

Definition at line 61 of file DeDxDiscriminatorLearner.h.

Referenced by algoAnalyzeTheTree(), and DeDxDiscriminatorLearner().