CMS 3D CMS Logo

ASmirnovDeDxDiscriminator.h
Go to the documentation of this file.
1 #ifndef RecoTrackerDeDx_ASmirnovDeDxDiscriminator_h
2 #define RecoTrackerDeDx_ASmirnovDeDxDiscriminator_h
3 
6 
8 {
9 public:
11  meVperADCStrip = iConfig.getParameter<double>("MeVperADCStrip"); //currently needed until the map on the database are redone
12  Reccord = iConfig.getParameter<std::string> ("Reccord");
13  ProbabilityMode = iConfig.getParameter<std::string> ("ProbabilityMode");
15  }
16 
17  virtual void beginRun(edm::Run const& run, const edm::EventSetup& iSetup){
19  }
20 
21  virtual std::pair<float,float> dedx(const reco::DeDxHitCollection& Hits){
22  std::vector<float> vect_probs;
23  for(size_t i = 0; i< Hits.size(); i ++){
24  float path = Hits[i].pathLength() * 10.0; //x10 in order to be compatible with the map content
25  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
26 
27  int BinX = Prob_ChargePath->GetXaxis()->FindBin(Hits[i].momentum());
28  int BinY = Prob_ChargePath->GetYaxis()->FindBin(path);
29  int BinZ = Prob_ChargePath->GetZaxis()->FindBin(charge);
30  float prob = Prob_ChargePath->GetBinContent(BinX,BinY,BinZ);
31  if(prob>=0)vect_probs.push_back(prob);
32  }
33 
34  size_t size = vect_probs.size();
35  if(size<=0) return std::make_pair( -1 , -1);
36  std::sort(vect_probs.begin(), vect_probs.end(), std::less<float>() );
37  float TotalProb = 1.0/(12*size);
38  for(size_t i=1;i<=size;i++){
39  TotalProb += vect_probs[i-1] * pow(vect_probs[i-1] - ((2.0*i-1.0)/(2.0*size)),2);
40  }
41  TotalProb *= (3.0/size);
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:56
virtual std::pair< float, float > dedx(const reco::DeDxHitCollection &Hits)
#define NULL
Definition: scimark2.h:8
virtual void beginRun(edm::Run const &run, const edm::EventSetup &iSetup)
ASmirnovDeDxDiscriminator(const edm::ParameterSet &iConfig)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Definition: Run.h:42