CMS 3D CMS Logo

ProductDeDxDiscriminator.h
Go to the documentation of this file.
1 #ifndef RecoTrackerDeDx_ProductDeDxDiscriminator_h
2 #define RecoTrackerDeDx_ProductDeDxDiscriminator_h
3 
7 
9 {
10 public:
12  meVperADCStrip = iConfig.getParameter<double>("MeVperADCStrip"); //currently needed until the map on the database are redone
13  Reccord = iConfig.getParameter<std::string> ("Reccord");
14  ProbabilityMode = iConfig.getParameter<std::string> ("ProbabilityMode");
15  Prob_ChargePath = nullptr;
16  }
17 
18  void beginRun(edm::Run const& run, const edm::EventSetup& iSetup) override{
20  }
21 
22  std::pair<float,float> dedx(const reco::DeDxHitCollection& Hits) override{
23  std::vector<float> vect_probs;
24  for(size_t i = 0; i< Hits.size(); i ++){
25  float path = Hits[i].pathLength() * 10.0; //x10 in order to be compatible with the map content
26  float charge = Hits[i].charge() / (10.0*meVperADCStrip); // 10/meVperADCStrip in order to be compatible with the map content in ADC/mm instead of MeV/cm
27 
28  int BinX = Prob_ChargePath->GetXaxis()->FindBin(Hits[i].momentum());
29  int BinY = Prob_ChargePath->GetYaxis()->FindBin(path);
30  int BinZ = Prob_ChargePath->GetZaxis()->FindBin(charge);
31  float prob = Prob_ChargePath->GetBinContent(BinX,BinY,BinZ);
32  if(prob>=0)vect_probs.push_back(prob);
33  }
34 
35  size_t size = vect_probs.size();
36  if(size<=0) return std::make_pair( -1 , -1);
37  float TotalProb = 1;
38  for(size_t i=0;i<size;i++){
39  if(vect_probs[i]<=0.0001){TotalProb *= pow(0.0001 , 1.0/size);}
40  else {TotalProb *= pow(vect_probs[i], 1.0/size);}
41  }
42  return std::make_pair( TotalProb , -1);
43  }
44 
45 private:
50 };
51 
52 #endif
size
Write out results.
T getParameter(std::string const &) const
void buildDiscrimMap(edm::Run const &run, const edm::EventSetup &iSetup, std::string Reccord, std::string ProbabilityMode, TH3F *&Prob_ChargePath)
Definition: DeDxTools.cc:221
std::vector< DeDxHit > DeDxHitCollection
Definition: DeDxHit.h:58
ProductDeDxDiscriminator(const edm::ParameterSet &iConfig)
void beginRun(edm::Run const &run, const edm::EventSetup &iSetup) override
std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits) override
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Definition: Run.h:45