38 std::pair<typename T::DetSet::const_iterator, typename T::DetSet::const_iterator>
40 typedef std::pair<typename T::DetSet::const_iterator, typename T::DetSet::const_iterator> return_type;
41 typename T::const_iterator
match = detset.find(
id);
42 if (match == detset.end())
return return_type();
43 typename T::DetSet hits = *
match;
44 return return_type(hits.begin(), hits.end());
85 switchNumrphi = ParametersNumrphi.getParameter<
bool>(
"switchon");
97 switchAdcrphi = ParametersAdcrphi.getParameter<
bool>(
"switchon");
100 switchPosxrphi = ParametersPosxrphi.getParameter<
bool>(
"switchon");
106 switchResrphi = ParametersResrphi.getParameter<
bool>(
"switchon");
115 switchChi2rphi = ParametersChi2rphi.getParameter<
bool>(
"switchon");
173 edm::LogInfo(
"SiStripRecHitsValid") <<
"SiStripRecHitsValid::beginRun: "
174 <<
" Creating MEs for new Cabling ";
208 int numrechitrphi =0;
209 int numrechitstereo =0;
210 int numrechitmatched=0;
213 std::map<std::string, std::vector<int> > totnumrechitrphi;
214 std::map<std::string, std::vector<int> > totnumrechitstereo;
215 std::map<std::string, std::vector<int> > totnumrechitmatched;
216 totnumrechitrphi.clear();
217 totnumrechitstereo.clear();
218 totnumrechitmatched.clear();
219 int totrechitrphi =0;
220 int totrechitstereo =0;
221 int totrechitmatched =0;
229 std::vector<DetId> IDs;
230 IDs.reserve(rechitsrphi->size() + rechitsmatched->size() + rechitsstereo->size());
236 for(std::vector<DetId>::const_iterator it = IDs.begin(); it != IDs.end(); ++it ){
237 uint32_t myid=((*it).rawId());
246 std::pair<SiStripRecHit2DCollection::DetSet::const_iterator,SiStripRecHit2DCollection::DetSet::const_iterator> rechitrphiRange =
helper::getRange(*rechitsrphi, detid);
251 numrechitrphi = rechitrphiRangeIteratorEnd - rechitrphiRangeIteratorBegin;
253 if(numrechitrphi > 0 ){
254 totrechitrphi+=numrechitrphi;
255 for(iterrphi=rechitrphiRangeIteratorBegin; iterrphi!=rechitrphiRangeIteratorEnd;++iterrphi){
269 std::pair<SiStripRecHit2DCollection::DetSet::const_iterator,SiStripRecHit2DCollection::DetSet::const_iterator> rechitstereoRange =
helper::getRange(*rechitsstereo, detid);
273 numrechitstereo = rechitstereoRangeIteratorEnd - rechitstereoRangeIteratorBegin;
274 if(numrechitstereo > 0){
275 totrechitstereo+=numrechitstereo;
276 for(iterstereo=rechitstereoRangeIteratorBegin; iterstereo!=rechitstereoRangeIteratorEnd;++iterstereo){
290 std::pair<SiStripMatchedRecHit2DCollection::DetSet::const_iterator,SiStripMatchedRecHit2DCollection::DetSet::const_iterator> rechitmatchedRange =
helper::getRange(*rechitsmatched, detid);
294 numrechitmatched = rechitmatchedRangeIteratorEnd - rechitmatchedRangeIteratorBegin;
295 if(numrechitmatched > 0){
296 totrechitmatched +=numrechitmatched;
298 for(itermatched=rechitmatchedRangeIteratorBegin; itermatched!=rechitmatchedRangeIteratorEnd;++itermatched){
309 std::map<std::string, LayerMEs>::iterator iLayerME =
LayerMEsMap.find(label);
310 std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME =
StereoAndMatchedMEsMap.find(label);
313 std::pair<std::string,int32_t> det_lay_pair = fold_organ.
GetSubDetAndLayer(myid,tTopo,
true);
315 if(numrechitrphi>0 || numrechitstereo>0 || numrechitmatched){
317 totnumrechitrphi[det_lay_pair.first].push_back(numrechitrphi);
318 totnumrechitstereo[det_lay_pair.first].push_back(numrechitstereo);
319 totnumrechitmatched[det_lay_pair.first].push_back(numrechitmatched);
321 for (std::vector<RecHitProperties>::iterator irh=
rechitrphi.begin(); irh!=
rechitrphi.end(); ++irh) {
323 fillME(iLayerME->second.meWclusrphi,(*irh).clusiz);
324 fillME(iLayerME->second.meAdcrphi,(*irh).cluchg);
325 fillME(iLayerME->second.mePosxrphi,(*irh).x);
326 fillME(iLayerME->second.meResolxrphi,(*irh).resolxx);
327 if ( (*irh).resx != -999999. || (*irh).pullMF != -999999. || (*irh).chi2 != -999999. ){
328 fillME(iLayerME->second.meResrphi,(*irh).resx);
329 fillME(iLayerME->second.mePullLFrphi,(*irh).resx/
sqrt((*irh).resolxx));
330 fillME(iLayerME->second.mePullMFrphi,(*irh).pullMF);
331 fillME(iLayerME->second.meChi2rphi,(*irh).chi2);
339 fillME(iStereoAndMatchedME->second.meWclusStereo,(*irh).clusiz);
340 fillME(iStereoAndMatchedME->second.meAdcStereo,(*irh).cluchg);
341 fillME(iStereoAndMatchedME->second.mePosxStereo,(*irh).x);
342 fillME(iStereoAndMatchedME->second.meResolxStereo,
sqrt((*irh).resolxx));
343 if ( (*irh).resx != -999999. || (*irh).pullMF != -999999. || (*irh).chi2 != -999999. ){
344 fillME(iStereoAndMatchedME->second.meResStereo,(*irh).resx);
345 fillME(iStereoAndMatchedME->second.mePullLFStereo,(*irh).resx/
sqrt((*irh).resolxx));
346 fillME(iStereoAndMatchedME->second.mePullMFStereo,(*irh).pullMF);
347 fillME(iStereoAndMatchedME->second.meChi2Stereo,(*irh).chi2);
354 fillME(iStereoAndMatchedME->second.mePosxMatched,(*irh).x);
355 fillME(iStereoAndMatchedME->second.mePosyMatched,(*irh).y);
356 fillME(iStereoAndMatchedME->second.meResolxMatched,
sqrt((*irh).resolxx));
357 fillME(iStereoAndMatchedME->second.meResolyMatched,
sqrt((*irh).resolyy));
358 if ( (*irh).resx != -999999. || (*irh).resy != -999999. || (*irh).chi2 != -999999. ){
359 fillME(iStereoAndMatchedME->second.meResxMatched,(*irh).resx);
360 fillME(iStereoAndMatchedME->second.meResyMatched,(*irh).resy);
361 fillME(iStereoAndMatchedME->second.meChi2Matched,(*irh).chi2);
373 for (std::vector<std::string>::iterator iSubdet = SubDetList_.begin(); iSubdet != SubDetList_.end(); iSubdet++){
374 std::map<std::string, SubDetMEs>::iterator iSubDetME =
SubDetMEsMap.find((*iSubdet));
375 fillME(iSubDetME->second.meNumrphi,std::accumulate(totnumrechitrphi[(*iSubdet)].rbegin(), totnumrechitrphi[(*iSubdet)].rend(), 0));
376 fillME(iSubDetME->second.meNumStereo,std::accumulate(totnumrechitstereo[(*iSubdet)].rbegin(), totnumrechitstereo[(*iSubdet)].rend(), 0));
377 fillME(iSubDetME->second.meNumMatched,std::accumulate(totnumrechitmatched[(*iSubdet)].rbegin(), totnumrechitmatched[(*iSubdet)].rend(), 0));
396 LocalPoint localHit = plane.toLocal(globalpos);
403 double scale = -localHit.
z() / dir.
z();
415 return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
433 clusiz = clust->amplitudes().size();
434 const std::vector<uint8_t> amplitudes=clust->amplitudes();
435 for(
size_t ia=0; ia<amplitudes.size();ia++){
436 totcharge+=amplitudes[ia];
451 double mindist = 999999;
452 double dist = 999999;
458 dist = fabs(
rechitpro.
x - (*m).localPosition().x());
470 rhparameters[0] = position.
x();
471 rhparameters[1] = position.
y();
477 R[0][0] = error.
xx();
478 R[0][1] = error.
xy();
479 R[1][1] = error.
yy();
482 double est = R.similarity(r);
515 double mindist = 999999;
516 double dist = 999999;
517 double distx = 999999;
518 double disty = 999999;
519 std::pair<LocalPoint,LocalVector> closestPair;
524 std::pair<LocalPoint,LocalVector> hitPair;
530 distx = fabs(
rechitpro.
x - hitPair.first.x());
531 disty = fabs(
rechitpro.
y - hitPair.first.y());
532 dist =
sqrt(distx*distx+disty*disty);
537 closestPair = hitPair;
548 rhparameters[0] = position.
x();
549 rhparameters[1] = position.
y();
552 shparameters[0] = sh.
x();
553 shparameters[1] = sh.
y();
556 R[0][0] = error.
xx();
557 R[0][1] = error.
xy();
558 R[1][1] = error.
yy();
561 double est = R.similarity(r);
586 std::vector<uint32_t> activeDets;
602 edm::LogInfo(
"SiStripTkRecHits|SiStripRecHitsValid")<<
"nr. of activeDets: "<<activeDets.size();
603 for(std::vector<uint32_t>::iterator detid_iterator = activeDets.begin(); detid_iterator!=activeDets.end(); detid_iterator++){
604 uint32_t
detid = (*detid_iterator);
607 activeDets.erase(detid_iterator);
612 std::pair<std::string,int32_t> det_layer_pair = folder_organizer.
GetSubDetAndLayer(detid,tTopo,
true);
617 std::map<std::string, LayerMEs>::iterator iLayerME =
LayerMEsMap.find(label);
622 int32_t lnumber = det_layer_pair.second;
623 std::vector<uint32_t> layerDetIds;
624 if (det_layer_pair.first ==
"TIB") {
626 }
else if (det_layer_pair.first ==
"TOB") {
628 }
else if (det_layer_pair.first ==
"TID" && lnumber > 0) {
630 }
else if (det_layer_pair.first ==
"TID" && lnumber < 0) {
632 }
else if (det_layer_pair.first ==
"TEC" && lnumber > 0) {
634 }
else if (det_layer_pair.first ==
"TEC" && lnumber < 0) {
640 folder_organizer.
setLayerFolder(detid,tTopo,det_layer_pair.second,
true);
654 std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME =
StereoAndMatchedMEsMap.find(label);
658 bool isStereo =
false;
660 int32_t stereolnumber = det_layer_pair.second;
661 std::vector<uint32_t> stereoandmatchedDetIds;
662 if ( (det_layer_pair.first ==
"TIB") && (
TIBDetId(detid).
stereo()== 1) ) {
663 substructure.
getTIBDetectors(activeDets,stereoandmatchedDetIds,stereolnumber,0,0,0);
665 }
else if ( (det_layer_pair.first ==
"TOB") && (
TOBDetId(detid).stereo()== 1) ) {
666 substructure.
getTOBDetectors(activeDets,stereoandmatchedDetIds,stereolnumber,0,0);
668 }
else if ( (det_layer_pair.first ==
"TID") && (stereolnumber > 0) && (
TIDDetId(detid).stereo()== 1) ) {
669 substructure.
getTIDDetectors(activeDets,stereoandmatchedDetIds,2,0,
abs(stereolnumber),1);
671 }
else if ( (det_layer_pair.first ==
"TID") && (stereolnumber < 0) && (
TIDDetId(detid).stereo()== 1) ) {
672 substructure.
getTIDDetectors(activeDets,stereoandmatchedDetIds,1,0,
abs(stereolnumber),1);
674 }
else if ( (det_layer_pair.first ==
"TEC") && (stereolnumber > 0) && (
TECDetId(detid).stereo()== 1) ) {
675 substructure.
getTECDetectors(activeDets,stereoandmatchedDetIds,2,0,0,0,
abs(stereolnumber),1);
677 }
else if ( (det_layer_pair.first ==
"TEC") && (stereolnumber < 0) && (
TECDetId(detid).stereo()== 1) ) {
678 substructure.
getTECDetectors(activeDets,stereoandmatchedDetIds,1,0,0,0,
abs(stereolnumber),1);
685 folder_organizer.
setLayerFolder(detid,tTopo,det_layer_pair.second,
true);
738 layerMEs.
meWclusrphi =
bookME1D(ibooker,
"TH1Wclusrphi", hidmanager.
createHistoLayer(
"Wclus_rphi",
"layer",label,
"").c_str() ,
"Cluster Width - Number of strips that belong to the RecHit cluster");
804 stereoandmatchedMEs.
meWclusStereo =
bookME1D(ibooker,
"TH1WclusStereo", hidmanager.
createHistoLayer(
"Wclus_stereo",
"layer",label,
"").c_str() ,
"Cluster Width - Number of strips that belong to the RecHit cluster");
815 stereoandmatchedMEs.
mePosxStereo->
setAxisTitle((
"x RecHit coord. (local frame) in stereo modules in " + label).c_str());
820 stereoandmatchedMEs.
meResolxStereo->
setAxisTitle((
"resol(x) RecHit coord. (local frame) in stereo modules in " + label).c_str());
824 stereoandmatchedMEs.
meResStereo =
bookME1D(ibooker,
"TH1ResStereo", hidmanager.
createHistoLayer(
"Res_stereo",
"layer",label,
"").c_str() ,
"Residuals of the hit x coordinate");
835 stereoandmatchedMEs.
mePullMFStereo->
setAxisTitle((
"Pull distribution (measurement frame) in stereo modules in " + label).c_str());
892 HistoName =
"TH1Numrphi__" +
label;
893 subdetMEs.
meNumrphi =
bookME1D(ibooker,
"TH1Numrphi",HistoName.c_str(),
"Num of RecHits");
898 HistoName =
"TH1NumStereo__" +
label;
899 subdetMEs.
meNumStereo =
bookME1D(ibooker,
"TH1NumStereo",HistoName.c_str(),
"Num of RecHits in stereo modules");
904 HistoName =
"TH1NumMatched__" +
label;
905 subdetMEs.
meNumMatched =
bookME1D(ibooker,
"TH1NumMatched",HistoName.c_str(),
"Num of matched RecHits" );
915 return ibooker.
book1D(HistoName,HistoTitle,
RecHitProperties rechitpro
MonitorElement * meAdcStereo
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
EventNumber_t event() const
std::vector< std::string > SubDetList_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
void rechitanalysis_matched(SiStripMatchedRecHit2D const rechit, const GluedGeomDet *gluedDet, TrackerHitAssociator &associate)
edm::ParameterSet Parameters
void createStereoAndMatchedMEs(DQMStore::IBooker &ibooker, std::string label)
void setSiStripFolderName(std::string name)
MonitorElement * meNumMatched
virtual float stripAngle(float strip) const =0
std::map< std::string, std::vector< uint32_t > > LayerDetMap
std::string outputFileName
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void createSubDetMEs(DQMStore::IBooker &ibooker, std::string label)
#define DEFINE_FWK_MODULE(type)
std::vector< PSimHit > matched
MonitorElement * meNumTotStereo
std::map< std::string, SubDetMEs > SubDetMEsMap
void rechitanalysis(SiStripRecHit2D const rechit, const StripTopology &topol, TrackerHitAssociator &associate)
Sin< T >::type sin(const T &t)
MonitorElement * mePullLFStereo
std::map< std::string, StereoAndMatchedMEs > StereoAndMatchedMEsMap
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=0)
std::vector< RecHitProperties > rechitstereo
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
MonitorElement * mePullLFrphi
const Plane & surface() const
The nominal surface of the GeomDet.
MonitorElement * meResolxMatched
MonitorElement * mePullMFStereo
virtual float strip(const LocalPoint &) const =0
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitsToken_
MonitorElement * mePosxStereo
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
virtual LocalError localPositionError() const
MonitorElement * meChi2Stereo
std::vector< RecHitProperties > rechitmatched
MonitorElement * meResxMatched
MonitorElement * meResolxrphi
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0) const
Local3DPoint localPosition() const
MonitorElement * meWclusrphi
Cos< T >::type cos(const T &t)
std::string topFolderName_
virtual const Topology & topology() const
Returns a reference to the strip proxy topology.
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
MonitorElement * mePosyMatched
ClusterRef cluster() const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
void createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es)
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitsToken_
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
MonitorElement * meChi2rphi
MonitorElement * mePosxMatched
std::pair< typename T::DetSet::const_iterator, typename T::DetSet::const_iterator > getRange(const T &detset, const DetId &id)
virtual const GeomDet * idToDet(DetId) const
MonitorElement * meNumTotMatched
MonitorElement * bookME1D(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName, const char *HistoTitle)
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
SiStripRecHitsValid(const edm::ParameterSet &conf)
std::map< std::string, LayerMEs > LayerMEsMap
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
CLHEP::HepVector AlgebraicVector
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=0)
MonitorElement * meChi2Matched
void setCurrentFolder(const std::string &fullpath)
std::map< std::string, std::vector< uint32_t > > StereoAndMatchedDetMap
T const * product() const
MonitorElement * meAdcrphi
MonitorElement * meWclusStereo
MonitorElement * meResyMatched
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
MonitorElement * meResolyMatched
std::pair< std::string, std::string > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
MonitorElement * meResolxStereo
MonitorElement * meResStereo
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0) const
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void createTotalMEs(DQMStore::IBooker &ibooker)
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedRecHitsToken_
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
static int position[264][3]
void beginJob(const edm::EventSetup &es)
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
void createLayerMEs(DQMStore::IBooker &ibooker, std::string label)
void fillME(MonitorElement *ME, float value1)
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
MonitorElement * meNumStereo
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0) const
DetId geographicalId() const
unsigned long long m_cacheID_
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
MonitorElement * mePosxrphi
MonitorElement * meResrphi
virtual LocalPoint localPosition() const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
DetId operator()(const X &x)
MonitorElement * mePullMFrphi
MonitorElement * meNumrphi
const GeomDetUnit * stereoDet() const
MonitorElement * meNumTotrphi
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es)
std::vector< RecHitProperties > rechitrphi