31 trackerHitAssociatorConfig_(ps, consumesCollector()),
57 switchNumrphi = ParametersNumrphi.getParameter<
bool>(
"switchon");
87 switchAdcrphi = ParametersAdcrphi.getParameter<
bool>(
"switchon");
90 switchPosxrphi = ParametersPosxrphi.getParameter<
bool>(
"switchon");
96 switchResrphi = ParametersResrphi.getParameter<
bool>(
"switchon");
105 switchChi2rphi = ParametersChi2rphi.getParameter<
bool>(
"switchon");
171 edm::LogInfo(
"SiStripRecHitsValid") <<
"SiStripRecHitsValid::beginRun: "
172 <<
" Creating MEs for new Cabling ";
200 std::map<std::string, int > totnumrechitrphi;
201 std::map<std::string, int > totnumrechitstereo;
202 std::map<std::string, int > totnumrechitmatched;
203 int totrechitrphi =0;
204 int totrechitstereo =0;
205 int totrechitmatched =0;
216 for (
auto it = rechitsrphi->begin(), itEnd = rechitsrphi->end(); it != itEnd; ++it) {
217 DetId detid = (*it).detId();
218 uint32_t myid = detid.
rawId();
219 auto detsetIter = rechitsrphi->find(detid);
220 totrechitrphi += detsetIter->size();
223 std::map<std::string, LayerMEs>::iterator iLayerME =
LayerMEsMap.find(label);
224 std::pair<std::string,int32_t> det_lay_pair = fold_organ.
GetSubDetAndLayer(myid,tTopo,
true);
226 totnumrechitrphi[det_lay_pair.first] = totnumrechitrphi[det_lay_pair.first] + detsetIter->size();
229 for(
auto iterrphi= detsetIter->begin(), iterEnd = detsetIter->end(); iterrphi != iterEnd; ++iterrphi){
243 std::map<std::string, SubDetMEs>::iterator iSubDetME =
SubDetMEsMap.find(det_lay_pair.first);
258 for (
auto it = rechitsstereo->begin(), itEnd = rechitsstereo->end(); it != itEnd; ++it) {
259 DetId detid = (*it).detId();
260 uint32_t myid= detid.
rawId();
261 auto detsetIter = rechitsstereo->find(detid);
262 totrechitstereo += detsetIter->size();
265 std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME =
StereoAndMatchedMEsMap.find(label);
266 std::pair<std::string,int32_t> det_lay_pair = fold_organ.
GetSubDetAndLayer(myid,tTopo,
true);
268 totnumrechitstereo[det_lay_pair.first] = totnumrechitstereo[det_lay_pair.first] + detsetIter->size();
271 for(
auto iterstereo=detsetIter->begin(), iterEnd = detsetIter->end(); iterstereo!=iterEnd; ++iterstereo){
285 std::map<std::string, SubDetMEs>::iterator iSubDetME =
SubDetMEsMap.find(det_lay_pair.first);
300 for (
auto it = rechitsmatched->begin(), itEnd = rechitsmatched->end(); it != itEnd; ++it) {
301 DetId detid = (*it).detId();
302 uint32_t myid = detid.
rawId();
303 auto detsetIter = rechitsmatched->find(detid);
304 totrechitmatched += detsetIter->size();
307 std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME =
StereoAndMatchedMEsMap.find(label);
308 std::pair<std::string,int32_t> det_lay_pair = fold_organ.
GetSubDetAndLayer(myid,tTopo,
true);
310 totnumrechitmatched[det_lay_pair.first] = totnumrechitmatched[det_lay_pair.first] + detsetIter->size();
313 for(
auto itermatched=detsetIter->begin(), iterEnd = detsetIter->end(); itermatched!=iterEnd; ++itermatched){
325 std::map<std::string, SubDetMEs>::iterator iSubDetME =
SubDetMEsMap.find(det_lay_pair.first);
339 for (std::vector<std::string>::iterator iSubdet =
SubDetList_.begin(); iSubdet !=
SubDetList_.end(); ++iSubdet){
340 std::map<std::string, SubDetMEs>::iterator iSubDetME =
SubDetMEsMap.find((*iSubdet));
341 fillME(iSubDetME->second.meNumrphi,totnumrechitrphi[(*iSubdet)]);
342 fillME(iSubDetME->second.meNumStereo,totnumrechitstereo[(*iSubdet)]);
343 fillME(iSubDetME->second.meNumMatched,totnumrechitmatched[(*iSubdet)]);
361 LocalPoint localHit = plane.toLocal(globalpos);
368 double scale = -localHit.
z() / dir.
z();
380 return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
392 const auto & amplitudes=(rechit.
cluster())->amplitudes();
394 for(
size_t ia=0; ia<amplitudes.size();++ia){
395 totcharge+=amplitudes[ia];
409 if(!matched.empty()){
415 for(
auto const &
m : matched){
430 rhparameters[0] = position.
x();
431 rhparameters[1] = position.
y();
437 R[0][0] = error.
xx();
438 R[0][1] = error.
xy();
439 R[1][1] = error.
yy();
442 float est = R.similarity(r);
475 if(matched.empty())
return;
481 PSimHit const * closest =
nullptr;
482 std::pair<LocalPoint,LocalVector> closestPair;
485 std::pair<LocalPoint,LocalVector> hitPair;
487 for(
auto const &
m : matched){
489 if (hitDetId.stereo()) {
494 dist2 = distx*distx+disty*disty;
500 closestPair = hitPair;
505 if (!closest)
return;
516 rhparameters[0] = position.
x();
517 rhparameters[1] = position.
y();
520 shparameters[0] = sh.
x();
521 shparameters[1] = sh.
y();
524 R[0][0] = error.
xx();
525 R[0][1] = error.
xy();
526 R[1][1] = error.
yy();
529 float est = R.similarity(r);
554 std::vector<uint32_t> activeDets;
569 edm::LogInfo(
"SiStripTkRecHits|SiStripRecHitsValid")<<
"nr. of activeDets: "<<activeDets.size();
570 const std::string& tec =
"TEC", tid =
"TID", tob =
"TOB", tib =
"TIB";
571 for(std::vector<uint32_t>::iterator detid_iterator=activeDets.begin(), detid_end=activeDets.end(); detid_iterator!=detid_end; ++detid_iterator){
572 uint32_t detid = (*detid_iterator);
575 activeDets.erase(detid_iterator);
580 std::pair<std::string,int32_t> det_layer_pair = folder_organizer.
GetSubDetAndLayer(detid,tTopo,
true);
589 int32_t lnumber = det_layer_pair.second;
591 std::vector<uint32_t> layerDetIds;
592 if (lname.compare(tec) == 0) {
595 }
else if (lnumber < 0) {
598 }
else if (lname.compare(tid) == 0) {
601 }
else if (lnumber < 0) {
604 }
else if (lname.compare(tob) == 0) {
606 }
else if (lname.compare(tib) == 0) {
612 folder_organizer.
setLayerFolder(detid,tTopo,det_layer_pair.second,
true);
629 bool isStereo =
false;
631 std::vector<uint32_t> stereoandmatchedDetIds;
632 int32_t stereolnumber = det_layer_pair.second;
633 const std::string& stereolname = det_layer_pair.first;
634 if ( stereolname.compare(tec) == 0 && (tTopo->
tecIsStereo(detid)) ) {
635 if ( stereolnumber > 0 ) {
636 substructure.
getTECDetectors(activeDets,stereoandmatchedDetIds,2,0,0,0,
abs(stereolnumber),1);
638 }
else if ( stereolnumber < 0 ) {
639 substructure.
getTECDetectors(activeDets,stereoandmatchedDetIds,1,0,0,0,
abs(stereolnumber),1);
642 }
else if ( stereolname.compare(tid) == 0 && (tTopo->
tidIsStereo(detid)) ) {
643 if ( stereolnumber > 0 ) {
644 substructure.
getTIDDetectors(activeDets,stereoandmatchedDetIds,2,0,
abs(stereolnumber),1);
646 }
else if ( stereolnumber < 0 ) {
647 substructure.
getTIDDetectors(activeDets,stereoandmatchedDetIds,1,0,
abs(stereolnumber),1);
650 }
else if ( stereolname.compare(tob) == 0 && (tTopo->
tobIsStereo(detid)) ) {
651 substructure.
getTOBDetectors(activeDets,stereoandmatchedDetIds,stereolnumber,0,0);
653 }
else if ( stereolname.compare(tib) == 0 && (tTopo->
tibIsStereo(detid)) ) {
654 substructure.
getTIBDetectors(activeDets,stereoandmatchedDetIds,stereolnumber,0,0,0);
662 folder_organizer.
setLayerFolder(detid,tTopo,det_layer_pair.second,
true);
714 layerMEs.
meWclusrphi =
bookME1D(ibooker,
"TH1Wclusrphi", hidmanager.
createHistoLayer(
"Wclus_rphi",
"layer",label,
"").c_str() ,
"Cluster Width - Number of strips that belong to the RecHit cluster");
787 stereoandmatchedMEs.
meWclusStereo =
bookME1D(ibooker,
"TH1WclusStereo", hidmanager.
createHistoLayer(
"Wclus_stereo",
"layer",label,
"").c_str() ,
"Cluster Width - Number of strips that belong to the RecHit cluster");
798 stereoandmatchedMEs.
mePosxStereo->
setAxisTitle((
"x RecHit coord. (local frame) in stereo modules in " + label).c_str());
803 stereoandmatchedMEs.
meResolxStereo->
setAxisTitle((
"resol(x) RecHit coord. (local frame) in stereo modules in " + label).c_str());
807 stereoandmatchedMEs.
meResStereo =
bookME1D(ibooker,
"TH1ResStereo", hidmanager.
createHistoLayer(
"Res_stereo",
"layer",label,
"").c_str() ,
"Residuals of the hit x coordinate");
818 stereoandmatchedMEs.
mePullMFStereo->
setAxisTitle((
"Pull distribution (measurement frame) in stereo modules in " + label).c_str());
891 HistoName =
"TH1Numrphi__" +
label;
892 subdetMEs.
meNumrphi =
bookME1D(ibooker,
"TH1Numrphi",HistoName.c_str(),
"Num of RecHits");
897 HistoName =
"TH1Bunchrphi__" +
label;
898 subdetMEs.
meBunchrphi =
bookME1D(ibooker,
"TH1Bunchrphi",HistoName.c_str(),
"Bunch Crossing");
903 HistoName =
"TH1Eventrphi__" +
label;
904 subdetMEs.
meEventrphi =
bookME1D(ibooker,
"TH1Eventrphi",HistoName.c_str(),
"Event (in-time bunch)");
909 HistoName =
"TH1NumStereo__" +
label;
910 subdetMEs.
meNumStereo =
bookME1D(ibooker,
"TH1NumStereo",HistoName.c_str(),
"Num of RecHits in stereo modules");
915 HistoName =
"TH1BunchStereo__" +
label;
921 HistoName =
"TH1EventStereo__" +
label;
922 subdetMEs.
meEventStereo =
bookME1D(ibooker,
"TH1EventStereo",HistoName.c_str(),
"Event (in-time bunch)");
927 HistoName =
"TH1NumMatched__" +
label;
928 subdetMEs.
meNumMatched =
bookME1D(ibooker,
"TH1NumMatched",HistoName.c_str(),
"Num of matched RecHits" );
933 HistoName =
"TH1BunchMatched__" +
label;
939 HistoName =
"TH1EventMatched__" +
label;
950 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
MonitorElement * meEventMatched
std::vector< std::string > SubDetList_
virtual const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
MonitorElement * meEventStereo
void rechitanalysis_matched(SiStripMatchedRecHit2D const rechit, const GluedGeomDet *gluedDet, TrackerHitAssociator &associate)
void createStereoAndMatchedMEs(DQMStore::IBooker &ibooker, std::string label)
int event() const
get the contents of the subdetector field (should be protected?)
void setSiStripFolderName(std::string name)
MonitorElement * meNumMatched
virtual float stripAngle(float strip) const =0
std::pair< const std::string, const char * > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
bool tobIsStereo(const DetId &id) const
std::map< std::string, std::vector< uint32_t > > LayerDetMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void createSubDetMEs(DQMStore::IBooker &ibooker, std::string label)
TrackerHitAssociator::Config trackerHitAssociatorConfig_
#define DEFINE_FWK_MODULE(type)
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)
MonitorElement * meNsimHitrphi
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
bool tidIsStereo(const DetId &id) const
virtual float strip(const LocalPoint &) const =0
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitsToken_
uint32_t rawId() const
get the raw id
MonitorElement * mePosxStereo
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
bool tecIsStereo(const DetId &id) const
MonitorElement * meChi2Stereo
MonitorElement * meResxMatched
MonitorElement * meResolxrphi
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
MonitorElement * meBunchStereo
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 * meBunchrphi
int bunchCrossing() const
get the detector field from this detid
MonitorElement * meWclusrphi
Cos< T >::type cos(const T &t)
std::string topFolderName_
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
virtual const Topology & topology() const override
Returns a reference to the strip proxy topology.
MonitorElement * mePosyMatched
ClusterRef cluster() const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
void createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es)
EncodedEventId eventId() const
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitsToken_
MonitorElement * meNsimHitStereo
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
MonitorElement * meChi2rphi
MonitorElement * mePosxMatched
bool switchNsimHitMatched
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)
Detector identifier class for the strip tracker.
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
bool tibIsStereo(const DetId &id) const
T const * product() const
MonitorElement * meBunchMatched
MonitorElement * meAdcrphi
MonitorElement * meWclusStereo
MonitorElement * meResyMatched
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
MonitorElement * meResolyMatched
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
void createTotalMEs(DQMStore::IBooker &ibooker)
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedRecHitsToken_
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
MonitorElement * meNsimHitMatched
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
MonitorElement * meEventrphi
DetId geographicalId() const
unsigned long long m_cacheID_
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
virtual LocalError localPositionError() const final
MonitorElement * mePosxrphi
MonitorElement * meResrphi
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * mePullMFrphi
virtual LocalPoint localPosition() const final
MonitorElement * meNumrphi
const GeomDetUnit * stereoDet() const
MonitorElement * meNumTotrphi
virtual const TrackerGeomDet * idToDet(DetId) const
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es)