49 produces<ValueMap<DeDxData> >();
52 string estimatorName = iConfig.
getParameter<
string>(
"estimator");
62 m_trajTrackAssociationTag = consumes<TrajTrackAssociationCollection>(iConfig.
getParameter<
edm::InputTag>(
"trajectoryTrackAssociation"));
66 MeVperADCPixel = iConfig.
getParameter<
double>(
"MeVperADCPixel");
67 MeVperADCStrip = iConfig.
getParameter<
double>(
"MeVperADCStrip");
70 useCalibration = iConfig.
getParameter<
bool>(
"UseCalibration");
71 m_calibrationPath = iConfig.
getParameter<
string>(
"calibrationPath");
73 if(!usePixel && !useStrip)
74 edm::LogWarning(
"DeDxHitsProducer") <<
"Pixel Hits AND Strip Hits will not be used to estimate dEdx --> BUG, Please Update the config file";
88 if(MODsColl.size()!=0)
return;
94 auto const &
Det = tkGeom->dets();
95 for(
unsigned int i=0;
i<
Det.size();
i++){
102 double Thick=-1, Dist=-1, Norma=-1;
104 Dist = StripDetUnit->position().mag();
105 Thick = StripDetUnit->surface().bounds().thickness();
106 Norma = MeVperADCStrip/Thick;
107 MOD->
Normal = StripDetUnit->surface().normalVector();
108 }
else if(PixelDetUnit){
109 Dist = PixelDetUnit->position().
mag();
110 Thick = PixelDetUnit->surface().bounds().thickness();
111 Norma = MeVperADCPixel/Thick;
112 MOD->
Normal = PixelDetUnit->surface().normalVector();
120 MODsColl[MOD->
DetId] = MOD;
123 MakeCalibrationMap();
140 iEvent.
getByToken(m_trajTrackAssociationTag, trackCollHandle);
143 size_t n = trackColl.size();
144 std::vector<DeDxData> dedxEstimate(n);
147 for(
unsigned int j=0;
j<trackColl.size();
j++){
151 vector<DeDxTools::RawHits> hits;
155 int NClusterSaturating = 0;
156 for(
unsigned int h=0;
h<track->recHitsSize();
h++){
162 if(
const SiPixelRecHit* pixelHit=dynamic_cast<const SiPixelRecHit*>(recHit)){
163 if(!usePixel)
continue;
165 unsigned int detid = pixelHit->geographicalId();
168 double cosine = (track->px()*MOD->
Normal.
x()+track->py()*MOD->
Normal.
y()+track->pz()*MOD->
Normal.
z())/track->p();
179 sort(dedxHits.begin(),dedxHits.end(),less<DeDxHit>());
180 std::pair<float,float> val_and_error = m_estimator->dedx(dedxHits);
184 val_and_error.second = NClusterSaturating;
186 dedxEstimate[
j] =
DeDxData(val_and_error.first, val_and_error.second, dedxHits.size() );
188 filler.
insert(trackCollHandle, dedxEstimate.begin(), dedxEstimate.end());
193 iEvent.
put(trackDeDxEstimateAssociation);
200 if(!useCalibration)
return;
202 TChain* t1 =
new TChain(
"SiStripCalib/APVGain");
203 t1->Add(m_calibrationPath.c_str());
205 unsigned int tree_DetId;
206 unsigned char tree_APVId;
209 t1->SetBranchAddress(
"DetId" ,&tree_DetId );
210 t1->SetBranchAddress(
"APVId" ,&tree_APVId );
211 t1->SetBranchAddress(
"Gain" ,&tree_Gain );
215 for (
unsigned int ientry = 0; ientry < t1->GetEntries(); ientry++) {
216 t1->GetEntry(ientry);
218 MOD->
Gain = tree_Gain;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void MakeCalibrationMap()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void insert(const H &h, I begin, I end)
std::vector< Track > TrackCollection
collection of Tracks
std::vector< DeDxHit > DeDxHitCollection
uint32_t rawId() const
get the raw id
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
DeDxEstimatorProducerPixelTripplet(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
~DeDxEstimatorProducerPixelTripplet()
DEFINE_FWK_MODULE(CosmicTrackingParticleSelector)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
T const * product() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual void beginRun(edm::Run const &run, const edm::EventSetup &) override