#include <RecoTracker/DeDxEstimatorProducerPixelTripplet/src/DeDxEstimatorProducerPixelTripplet.cc>
Classes | |
class | isEqual |
struct | stModInfo |
Public Member Functions | |
DeDxEstimatorProducerPixelTripplet (const edm::ParameterSet &) | |
~DeDxEstimatorProducerPixelTripplet () | |
Private Member Functions | |
virtual void | beginRun (edm::Run const &run, const edm::EventSetup &) override |
virtual void | endJob () |
void | MakeCalibrationMap () |
virtual void | produce (edm::Event &, const edm::EventSetup &) override |
Private Attributes | |
std::string | m_calibrationPath |
BaseDeDxEstimator * | m_estimator |
edm::InputTag | m_tracksTag |
edm::InputTag | m_trajTrackAssociationTag |
unsigned int | MaxNrStrips |
double | MeVperADCPixel |
double | MeVperADCStrip |
unsigned int | MinTrackHits |
__gnu_cxx::hash_map< unsigned int, stModInfo *, __gnu_cxx::hash< unsigned int >, isEqual > | MODsColl |
bool | shapetest |
bool | useCalibration |
bool | usePixel |
bool | useStrip |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 33 of file DeDxEstimatorProducerPixelTripplet.h.
DeDxEstimatorProducerPixelTripplet::DeDxEstimatorProducerPixelTripplet | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 46 of file DeDxEstimatorProducerPixelTripplet.cc.
References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().
{ produces<ValueMap<DeDxData> >(); string estimatorName = iConfig.getParameter<string>("estimator"); if(estimatorName == "median") m_estimator = new MedianDeDxEstimator(-2.); if(estimatorName == "generic") m_estimator = new GenericAverageDeDxEstimator (iConfig.getParameter<double>("exponent")); if(estimatorName == "truncated") m_estimator = new TruncatedAverageDeDxEstimator(iConfig.getParameter<double>("fraction")); if(estimatorName == "unbinnedFit") m_estimator = new UnbinnedFitDeDxEstimator(); MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips" , 255); MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits" , 4); m_tracksTag = iConfig.getParameter<edm::InputTag>("tracks"); m_trajTrackAssociationTag = iConfig.getParameter<edm::InputTag>("trajectoryTrackAssociation"); usePixel = iConfig.getParameter<bool>("UsePixel"); useStrip = iConfig.getParameter<bool>("UseStrip"); MeVperADCPixel = iConfig.getParameter<double>("MeVperADCPixel"); MeVperADCStrip = iConfig.getParameter<double>("MeVperADCStrip"); shapetest = iConfig.getParameter<bool>("ShapeTest"); useCalibration = iConfig.getParameter<bool>("UseCalibration"); m_calibrationPath = iConfig.getParameter<string>("calibrationPath"); if(!usePixel && !useStrip) edm::LogWarning("DeDxHitsProducer") << "Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file"; }
DeDxEstimatorProducerPixelTripplet::~DeDxEstimatorProducerPixelTripplet | ( | ) |
Definition at line 78 of file DeDxEstimatorProducerPixelTripplet.cc.
{ delete m_estimator; }
void DeDxEstimatorProducerPixelTripplet::beginRun | ( | edm::Run const & | run, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 86 of file DeDxEstimatorProducerPixelTripplet.cc.
References Surface::bounds(), DeDxEstimatorProducerPixelTripplet::stModInfo::DetId, DeDxEstimatorProducerPixelTripplet::stModInfo::Distance, DeDxEstimatorProducerPixelTripplet::stModInfo::Gain, edm::EventSetup::get(), i, PV3DBase< T, PVType, FrameType >::mag(), DeDxEstimatorProducerPixelTripplet::stModInfo::Normal, DeDxEstimatorProducerPixelTripplet::stModInfo::Normalization, Plane::normalVector(), GeomDet::position(), DetId::rawId(), GeomDet::surface(), DeDxEstimatorProducerPixelTripplet::stModInfo::Thickness, and Bounds::thickness().
{ if(MODsColl.size()!=0)return; edm::ESHandle<TrackerGeometry> tkGeom; iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom ); vector<GeomDet*> Det = tkGeom->dets(); for(unsigned int i=0;i<Det.size();i++){ DetId Detid = Det[i]->geographicalId(); StripGeomDetUnit* StripDetUnit = dynamic_cast<StripGeomDetUnit*> (Det[i]); PixelGeomDetUnit* PixelDetUnit = dynamic_cast<PixelGeomDetUnit*> (Det[i]); stModInfo* MOD = new stModInfo; double Thick=-1, Dist=-1, Norma=-1; if(StripDetUnit){ Dist = StripDetUnit->position().mag(); Thick = StripDetUnit->surface().bounds().thickness(); Norma = MeVperADCStrip/Thick; MOD->Normal = StripDetUnit->surface().normalVector(); }else if(PixelDetUnit){ Dist = PixelDetUnit->position().mag(); Thick = PixelDetUnit->surface().bounds().thickness(); Norma = MeVperADCPixel/Thick; MOD->Normal = PixelDetUnit->surface().normalVector(); } MOD->DetId = Detid.rawId(); MOD->Thickness = Thick; MOD->Distance = Dist; MOD->Normalization = Norma; MOD->Gain = 1; MODsColl[MOD->DetId] = MOD; } MakeCalibrationMap(); }
void DeDxEstimatorProducerPixelTripplet::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 127 of file DeDxEstimatorProducerPixelTripplet.cc.
{ MODsColl.clear(); }
void DeDxEstimatorProducerPixelTripplet::MakeCalibrationMap | ( | ) | [private] |
Definition at line 198 of file DeDxEstimatorProducerPixelTripplet.cc.
References DeDxEstimatorProducerPixelTripplet::stModInfo::Gain.
{ if(!useCalibration)return; TChain* t1 = new TChain("SiStripCalib/APVGain"); t1->Add(m_calibrationPath.c_str()); unsigned int tree_DetId; unsigned char tree_APVId; double tree_Gain; t1->SetBranchAddress("DetId" ,&tree_DetId ); t1->SetBranchAddress("APVId" ,&tree_APVId ); t1->SetBranchAddress("Gain" ,&tree_Gain ); for (unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) { t1->GetEntry(ientry); stModInfo* MOD = MODsColl[tree_DetId]; MOD->Gain = tree_Gain; } delete t1; }
void DeDxEstimatorProducerPixelTripplet::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Implements edm::EDProducer.
Definition at line 134 of file DeDxEstimatorProducerPixelTripplet.cc.
References abs, DeDxDiscriminatorTools::charge(), clone(), cond::rpcobgas::detid, DeDxEstimatorProducerPixelTripplet::stModInfo::Distance, edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), h, edm::helper::Filler< Map >::insert(), j, n, DeDxEstimatorProducerPixelTripplet::stModInfo::Normal, DeDxEstimatorProducerPixelTripplet::stModInfo::Normalization, edm::Handle< T >::product(), edm::Event::put(), python::multivaluedict::sort(), DeDxEstimatorProducerPixelTripplet::stModInfo::Thickness, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ auto_ptr<ValueMap<DeDxData> > trackDeDxEstimateAssociation(new ValueMap<DeDxData> ); ValueMap<DeDxData>::Filler filler(*trackDeDxEstimateAssociation); Handle<TrackCollection> trackCollHandle; iEvent.getByLabel(m_trajTrackAssociationTag, trackCollHandle); const TrackCollection trackColl = *trackCollHandle.product(); size_t n = trackColl.size(); std::vector<DeDxData> dedxEstimate(n); //assume trajectory collection size is equal to track collection size and that order is kept for(unsigned int j=0;j<trackColl.size();j++){ const reco::TrackRef track = reco::TrackRef( trackCollHandle.product(), j ); DeDxHitCollection dedxHits; vector<DeDxTools::RawHits> hits; // DeDxTools::trajectoryRawHits(traj, hits, usePixel, useStrip); int NClusterSaturating = 0; for(unsigned int h=0;h<track->recHitsSize();h++){ //SiStripDetId detid = SiStripDetId((track->recHit(h))->geographicalId()); //TrackingRecHit* recHit = (track->recHit(h))->clone(); TrackingRecHit* recHit= (track->recHit(h))->clone(); if(const SiPixelRecHit* pixelHit=dynamic_cast<const SiPixelRecHit*>(recHit)){ if(!usePixel) continue; unsigned int detid = pixelHit->geographicalId(); stModInfo* MOD = MODsColl[detid]; double cosine = (track->px()*MOD->Normal.x()+track->py()*MOD->Normal.y()+track->pz()*MOD->Normal.z())/track->p(); float pathLen = MOD->Thickness/std::abs(cosine); float charge = MOD->Normalization*pixelHit->cluster()->charge()*std::abs(cosine); dedxHits.push_back( DeDxHit( charge, MOD->Distance, pathLen, detid) ); } delete recHit; } sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>()); std::pair<float,float> val_and_error = m_estimator->dedx(dedxHits); //WARNING: Since the dEdX Error is not properly computed for the moment //It was decided to store the number of saturating cluster in that dataformat val_and_error.second = NClusterSaturating; dedxEstimate[j] = DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() ); } filler.insert(trackCollHandle, dedxEstimate.begin(), dedxEstimate.end()); // really fill the association map filler.fill(); // put into the event iEvent.put(trackDeDxEstimateAssociation); }
std::string DeDxEstimatorProducerPixelTripplet::m_calibrationPath [private] |
Definition at line 62 of file DeDxEstimatorProducerPixelTripplet.h.
Definition at line 49 of file DeDxEstimatorProducerPixelTripplet.h.
Definition at line 52 of file DeDxEstimatorProducerPixelTripplet.h.
Definition at line 51 of file DeDxEstimatorProducerPixelTripplet.h.
unsigned int DeDxEstimatorProducerPixelTripplet::MaxNrStrips [private] |
Definition at line 59 of file DeDxEstimatorProducerPixelTripplet.h.
double DeDxEstimatorProducerPixelTripplet::MeVperADCPixel [private] |
Definition at line 56 of file DeDxEstimatorProducerPixelTripplet.h.
double DeDxEstimatorProducerPixelTripplet::MeVperADCStrip [private] |
Definition at line 57 of file DeDxEstimatorProducerPixelTripplet.h.
unsigned int DeDxEstimatorProducerPixelTripplet::MinTrackHits [private] |
Definition at line 60 of file DeDxEstimatorProducerPixelTripplet.h.
__gnu_cxx::hash_map<unsigned int, stModInfo*, __gnu_cxx::hash<unsigned int>, isEqual > DeDxEstimatorProducerPixelTripplet::MODsColl [private] |
Definition at line 74 of file DeDxEstimatorProducerPixelTripplet.h.
bool DeDxEstimatorProducerPixelTripplet::shapetest [private] |
Definition at line 64 of file DeDxEstimatorProducerPixelTripplet.h.
bool DeDxEstimatorProducerPixelTripplet::useCalibration [private] |
Definition at line 63 of file DeDxEstimatorProducerPixelTripplet.h.
bool DeDxEstimatorProducerPixelTripplet::usePixel [private] |
Definition at line 54 of file DeDxEstimatorProducerPixelTripplet.h.
bool DeDxEstimatorProducerPixelTripplet::useStrip [private] |
Definition at line 55 of file DeDxEstimatorProducerPixelTripplet.h.