33 desc.
add<
string>(
"estimator",
"generic");
35 desc.
add<
bool>(
"UsePixel",
false);
36 desc.
add<
bool>(
"UseStrip",
true);
37 desc.
add<
double>(
"MeVperADCPixel",3.61e-06);
38 desc.
add<
double>(
"MeVperADCStrip",3.61e-06*265);
39 desc.
add<
bool>(
"ShapeTest",
true);
40 desc.
add<
bool>(
"UseCalibration",
false);
41 desc.
add<
string>(
"calibrationPath",
"");
42 desc.
add<
string>(
"Reccord",
"SiStripDeDxMip_3D_Rcd");
43 desc.
add<
string>(
"ProbabilityMode",
"Accumulation");
44 desc.
add<
double>(
"fraction", 0.4);
45 desc.
add<
double>(
"exponent",-2.0);
47 descriptions.
add(
"DeDxEstimatorProducer",desc);
54 produces<ValueMap<DeDxData> >();
56 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
74 meVperADCPixel = iConfig.
getParameter<
double>(
"MeVperADCPixel");
75 meVperADCStrip = iConfig.
getParameter<
double>(
"MeVperADCStrip");
79 m_calibrationPath = iConfig.
getParameter<
string>(
"calibrationPath");
82 edm::LogWarning(
"DeDxHitsProducer") <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
102 m_estimator->beginRun(run, iSetup);
109 auto trackDeDxEstimateAssociation = std::make_unique<ValueMap<DeDxData>>();
113 iEvent.
getByToken(m_tracksTag,trackCollectionHandle);
116 std::vector<DeDxData> dedxEstimate( trackCollectionHandle->size() );
118 for(
unsigned int j=0;j<trackCollectionHandle->size();j++){
121 int NClusterSaturating = 0;
124 auto const & trajParams = track->extra()->trajParams();
125 assert(trajParams.size()==track->recHitsSize());
126 auto hb = track->recHitsBegin();
127 dedxHits.reserve(track->recHitsSize()/2);
128 for(
unsigned int h=0;
h<track->recHitsSize();
h++){
130 if(!
recHit->isValid())
continue;
132 auto trackDirection = trajParams[
h].direction();
133 float cosine = trackDirection.z()/trackDirection.mag();
134 processHit(
recHit, track->p(), cosine, dedxHits, NClusterSaturating);
137 sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>());
138 std::pair<float,float> val_and_error = m_estimator->dedx(dedxHits);
142 val_and_error.second = NClusterSaturating;
143 dedxEstimate[j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() );
147 filler.insert(trackCollectionHandle, dedxEstimate.begin(), dedxEstimate.end());
157 if(!thit.isValid())
return;
160 if(!clus.isValid())
return;
165 const auto * detUnit = recHit->
detUnit();
166 if (detUnit ==
nullptr) detUnit = tkGeom->idToDet(thit.geographicalId());
168 float chargeAbs = clus.pixelCluster().charge();
169 float charge = meVperADCPixel*chargeAbs/pathLen;
170 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
171 }
else if(clus.isStrip() && !thit.isMatched()){
174 const auto * detUnit = recHit->
detUnit();
175 if (detUnit ==
nullptr) detUnit = tkGeom->idToDet(thit.geographicalId());
178 float chargeAbs =
DeDxTools::getCharge(&(clus.stripCluster()),NSaturating, *detUnit, calibGains, m_off);
179 float charge = meVperADCStrip*chargeAbs/pathLen;
181 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, thit.geographicalId()) );
182 if(NSaturating>0)NClusterSaturating++;
184 }
else if(clus.isStrip() && thit.isMatched()){
187 if(!matchedHit)
return;
189 if (gdet ==
nullptr) gdet =
static_cast<const GluedGeomDet*
>(tkGeom->idToDet(thit.geographicalId()));
191 auto& detUnitM = *(gdet->
monoDet());
195 float charge = meVperADCStrip*chargeAbs/pathLen;
197 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->
monoId()) );
198 if(NSaturating>0)NClusterSaturating++;
203 pathLen = detUnitS.surface().bounds().thickness()/fabs(cosine);
205 charge = meVperADCStrip*chargeAbs/pathLen;
207 dedxHits.push_back(
DeDxHit( charge, trackMomentum, pathLen, matchedHit->
stereoId()) );
208 if(NSaturating>0)NClusterSaturating++;
T getParameter(std::string const &) const
DeDxEstimatorProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
unsigned int stereoId() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const GeomDetUnit * monoDet() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
SiStripCluster const & monoCluster() const
std::vector< DeDxHit > DeDxHitCollection
const Bounds & bounds() const
const Plane & surface() const
The nominal surface of the GeomDet.
void beginRun(edm::Run const &run, const edm::EventSetup &) override
const GeomDet * det() const
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, reco::DeDxHitCollection &dedxHits, int &NClusterSaturating)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const * product() const
virtual float thickness() const =0
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
SiStripCluster const & stereoCluster() const
virtual const GeomDetUnit * detUnit() const
void produce(edm::Event &, const edm::EventSetup &) override
virtual OmniClusterRef const & firstClusterRef() const =0
unsigned int monoId() const
~DeDxEstimatorProducer() override
const GeomDetUnit * stereoDet() const