27 tracksCollection_in_EventTree(
true),
72 LogDebug(
"SiStripMonitorTrack") <<
"[SiStripMonitorTrack::beginRun] There are "<<
tkgeom_->detUnits().size() <<
" detectors instantiated in the geometry" << std::endl;
86 book(ibooker , tTopo);
108 LogDebug(
"SiStripMonitorTrack") <<
"[SiStripMonitorTrack::analyse] " <<
"Run " << e.
id().
run() <<
" Event " << e.
id().
event() << std::endl;
117 for (std::map<std::string, SubDetMEs>::iterator iSubDet =
SubDetMEsMap.begin();
119 iSubDet->second.totNClustersOnTrack = 0;
120 iSubDet->second.totNClustersOffTrack = 0;
131 std::map<std::string, MonitorElement*>::iterator iME;
132 std::map<std::string, LayerMEs>::iterator iLayerME;
134 for (std::map<std::string, SubDetMEs>::iterator iSubDet =
SubDetMEsMap.begin();
162 std::vector<uint32_t> vdetId_;
165 for (std::vector<uint32_t>::const_iterator detid_iter=vdetId_.begin();detid_iter!=vdetId_.end();detid_iter++){
166 uint32_t
detid = *detid_iter;
169 edm::LogError(
"SiStripMonitorTrack")<<
"[" <<__PRETTY_FUNCTION__ <<
"] invalid detid " << detid<< std::endl;
181 std::map<std::string, LayerMEs>::iterator iLayerME =
LayerMEsMap.find(layer_id);
206 std::map<std::string, ModMEs>::iterator iModME =
ModMEsMap.find(hid);
230 theModMEs.
ClusterPos=ibooker.
book1D(hidmanager.
createHistoId(
"ClusterPosition_OnTrack",name,
id).c_str(),hidmanager.
createHistoId(
"ClusterPosition_OnTrack",name,
id).c_str(),total_nr_strips,0.5,total_nr_strips+0.5);
261 hname = hidmanager.
createHistoLayer(
"Summary_ClusterStoNCorr",name,layer_id,
"OnTrack");
265 hname = hidmanager.
createHistoLayer(
"Summary_ClusterChargeCorr",name,layer_id,
"OnTrack");
269 hname = hidmanager.
createHistoLayer(
"Summary_ClusterCharge",name,layer_id,
"OnTrack");
272 hname = hidmanager.
createHistoLayer(
"Summary_ClusterCharge",name,layer_id,
"OffTrack");
276 hname = hidmanager.
createHistoLayer(
"Summary_ClusterNoise",name,layer_id,
"OnTrack");
279 hname = hidmanager.
createHistoLayer(
"Summary_ClusterNoise",name,layer_id,
"OffTrack");
283 hname = hidmanager.
createHistoLayer(
"Summary_ClusterWidth",name,layer_id,
"OnTrack");
286 hname = hidmanager.
createHistoLayer(
"Summary_ClusterWidth",name,layer_id,
"OffTrack");
291 if (layer_id.find(
"TEC") != std::string::npos && !
flag_ring) total_nr_strips = 3 * 2 * 128;
293 hname = hidmanager.
createHistoLayer(
"Summary_ClusterPosition",name,layer_id,
"OnTrack");
296 hname = hidmanager.
createHistoLayer(
"Summary_ClusterPosition",name,layer_id,
"OffTrack");
308 subdet_tag =
"__" +
name;
324 completeName =
"Summary_TotalNumberOfClusters_OnTrack" +
subdet_tag;
329 completeName =
"Summary_TotalNumberOfClusters_OffTrack" +
subdet_tag;
334 completeName =
"Summary_ClusterStoNCorr_OnTrack" +
subdet_tag;
338 completeName =
"Summary_ClusterCharge_OnTrack" +
subdet_tag;
342 completeName =
"Summary_ClusterCharge_OffTrack" +
subdet_tag;
346 completeName =
"Summary_ClusterStoN_OffTrack" +
subdet_tag;
351 completeName =
"Trend_TotalNumberOfClusters_OnTrack" +
subdet_tag;
353 completeName =
"Trend_TotalNumberOfClusters_OffTrack" +
subdet_tag;
366 return ibooker.
book1D(HistoName,HistoName,
377 return ibooker.
book2D(HistoName,HistoName,
391 return ibooker.
book3D(HistoName,HistoName,
424 ParametersTrend.getParameter<int32_t>(
"Nbins"),
426 ParametersTrend.getParameter<int32_t>(
"Nbins"),
434 me->setAxisTitle(
"Event Time in Seconds",1);
443 const std::vector<TrajectoryMeasurement> & measurements = traj->measurements();
444 std::vector<TrajectoryMeasurement>::const_iterator traj_mes_iterator;
445 for(std::vector<TrajectoryMeasurement>::const_iterator traj_mes_iterator= measurements.begin(), traj_mes_end=measurements.end();
446 traj_mes_iterator!=traj_mes_end;traj_mes_iterator++){
453 if (!ttrh->isValid())
continue;
455 const ProjectedSiStripRecHit2D* projhit =
dynamic_cast<const ProjectedSiStripRecHit2D*
>( ttrh->hit() );
456 const SiStripMatchedRecHit2D* matchedhit =
dynamic_cast<const SiStripMatchedRecHit2D*
>( ttrh->hit() );
457 const SiStripRecHit2D* hit2D =
dynamic_cast<const SiStripRecHit2D*
>( ttrh->hit() );
458 const SiStripRecHit1D* hit1D =
dynamic_cast<const SiStripRecHit1D*
>( ttrh->hit() );
464 LogTrace(
"SiStripMonitorTrack")<<
"\nMatched recHit found"<< std::endl;
471 statedirection=monodet->
toLocal(gtrkdirup);
472 SiStripRecHit2D
m = matchedhit->monoHit();
474 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&m,statedirection,es);
477 statedirection=stereodet->
toLocal(gtrkdirup);
478 SiStripRecHit2D
s = matchedhit->stereoHit();
480 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&s,statedirection,es);
483 LogTrace(
"SiStripMonitorTrack")<<
"\nProjected recHit found"<< std::endl;
488 const SiStripRecHit2D originalhit=projhit->originalHit();
492 LogTrace(
"SiStripMonitorTrack")<<
"\nProjected recHit found MONO"<< std::endl;
494 statedirection=det->
toLocal(gtrkdirup);
495 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
498 LogTrace(
"SiStripMonitorTrack")<<
"\nProjected recHit found STEREO"<< std::endl;
501 statedirection=det->
toLocal(gtrkdirup);
502 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
506 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(hit2D,statedirection,es);
509 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit1D>(hit1D,statedirection,es);
512 <<
" LocalMomentum: "<<statedirection
513 <<
"\nLocal x-z plane angle: "<<atan2(statedirection.
x(),statedirection.
z());
521 const ProjectedSiStripRecHit2D* projhit,
522 const SiStripMatchedRecHit2D* matchedhit,
523 const SiStripRecHit2D* hit2D,
524 const SiStripRecHit1D* hit1D,
529 LogTrace(
"SiStripMonitorTrack")<<
"\nMatched recHit found"<< std::endl;
537 statedirection=monodet->
toLocal(gtrkdirup);
538 SiStripRecHit2D
m = matchedhit->monoHit();
539 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&m,statedirection,es);
543 statedirection=stereodet->
toLocal(gtrkdirup);
544 SiStripRecHit2D
s = matchedhit->stereoHit();
545 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&s,statedirection,es);
548 LogTrace(
"SiStripMonitorTrack")<<
"\nProjected recHit found"<< std::endl;
553 const SiStripRecHit2D originalhit=projhit->originalHit();
558 LogTrace(
"SiStripMonitorTrack")<<
"\nProjected recHit found MONO"<< std::endl;
560 statedirection=det->
toLocal(gtrkdirup);
561 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
564 LogTrace(
"SiStripMonitorTrack")<<
"\nProjected recHit found STEREO"<< std::endl;
567 statedirection=det->
toLocal(gtrkdirup);
568 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(&(originalhit),statedirection,es);
571 statedirection=localMomentum;
572 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit2D>(hit2D,statedirection,es);
574 statedirection=localMomentum;
575 if(statedirection.
mag() != 0) RecHitInfo<SiStripRecHit1D>(hit1D,statedirection,es);
578 <<
" LocalMomentum: "<<statedirection
579 <<
"\nLocal x-z plane angle: "<<atan2(statedirection.
x(),statedirection.
z());
588 using namespace reco;
593 if( TItkAssociatorCollection.isValid()){
596 edm::LogError(
"SiStripMonitorTrack")<<
"Association not found ... try w/ track collection"<<std::endl;
606 if (!trackCollectionHandle.
isValid()){
623 for (reco::TrackCollection::const_iterator track = trackCollection.begin(), etrack = trackCollection.end();
624 track!=etrack; ++track) {
631 if (!(*hit)->isValid())
continue;
632 DetId detID = (*hit)->geographicalId();
635 const ProjectedSiStripRecHit2D* projhit =
dynamic_cast<const ProjectedSiStripRecHit2D*
>( (theHit) );
636 const SiStripMatchedRecHit2D* matchedhit =
dynamic_cast<const SiStripMatchedRecHit2D*
> ( (theHit) );
637 const SiStripRecHit2D* hit2D =
dynamic_cast<const SiStripRecHit2D*
> ( (theHit) );
638 const SiStripRecHit1D* hit1D =
dynamic_cast<const SiStripRecHit1D*
> ( (theHit) );
645 hitStudy(es,projhit,matchedhit,hit2D,hit1D,localMomentum);
695 <<
"Track number "<< i+1 << std::endl;
716 if(!tkrecHit->isValid()){
717 LogTrace(
"SiStripMonitorTrack") <<
"\t\t Invalid Hit " << std::endl;
721 const uint32_t&
detid = tkrecHit->geographicalId().rawId();
724 <<
"\n\t\tRecHit on det "<<tkrecHit->geographicalId().rawId()
725 <<
"\n\t\tRecHit in LP "<<tkrecHit->localPosition()
726 <<
"\n\t\tRecHit in GP "<<
tkgeom_->idToDet(tkrecHit->geographicalId())->surface().toGlobal(tkrecHit->localPosition())
727 <<
"\n\t\tRecHit trackLocal vector "<<LV.
x() <<
" " << LV.
y() <<
" " << LV.
z() <<std::endl;
736 if ( tkrecHit !=
NULL ){
749 edm::LogError(
"SiStripMonitorTrack") <<
"NULL hit" << std::endl;
766 if (!siStripClusterHandle.
isValid()){
767 edm::LogError(
"SiStripMonitorTrack")<<
"ClusterCollection is not valid!!" << std::endl;
776 DSViter!=siStripClusterHandle->end();
779 uint32_t
detid=DSViter->id();
781 LogDebug(
"SiStripMonitorTrack") <<
"on detid "<< detid <<
" N Cluster= " << DSViter->size();
804 if (cluster==
NULL)
return false;
817 std::map<std::string, SubDetMEs>::iterator iSubdet =
SubDetMEsMap.find(sdet_pair.second);
821 if (flag ==
OnTrack) iSubdet->second.totNClustersOnTrack++;
822 else if (flag ==
OffTrack) iSubdet->second.totNClustersOffTrack++;
829 LogDebug(
"SiStripMonitorTrack")<<
"\n\tLV " << LV.
x() <<
" " << LV.
y() <<
" " << LV.
z() <<
" " << LV.
mag() << std::endl;
831 cosRZ= fabs(LV.
z())/LV.
mag();
832 LogDebug(
"SiStripMonitorTrack")<<
"\n\t cosRZ " << cosRZ << std::endl;
837 fillMEs(cluster,detid,tTopo,cosRZ,flag);
842 uint32_t adet=cluster->
detId();
848 LogDebug(
"SiStripMonitorTrack") <<
"Module " << detid <<
" in Event " <<
eventNb <<
" noise " << noise << std::endl;
852 if(cluster->
charge() > 250){
853 LogDebug(
"SiStripMonitorTrack") <<
"Module firing " << detid <<
" in Event " <<
eventNb << std::endl;
872 std::map<std::string, ModMEs>::iterator iModME =
ModMEsMap.find(name);
876 uint16_t charge = cluster->
charge();
881 if(noise > 0.0)
fillME(iModME->second.ClusterStoNCorr ,StoN*cos);
882 if(noise == 0.0)
LogDebug(
"SiStripMonitorTrack") <<
"Module " << name <<
" in Event " <<
eventNb <<
" noise " << noise << std::endl;
883 fillME(iModME->second.ClusterCharge,charge);
885 fillME(iModME->second.ClusterChargeCorr,charge*cos);
887 fillME(iModME->second.ClusterWidth ,width);
888 fillME(iModME->second.ClusterPos ,position);
892 int PGVposCounter = cluster->
maxIndex();
894 fillME(iModME->second.ClusterPGV,
i,0.);
895 for (std::vector<uint8_t>::const_iterator it=cluster->
stripCharges().begin();it<cluster->
stripCharges().end();++it) {
896 fillME(iModME->second.ClusterPGV, PGVposCounter++,(*it)/PGVmax);
899 fillME(iModME->second.ClusterPGV,
i,0.);
914 uint16_t charge = cluster->
charge();
918 std::map<std::string, LayerMEs>::iterator iLayer =
LayerMEsMap.find(layer_id);
922 if(noise > 0.0)
fillME(iLayer->second.ClusterStoNCorrOnTrack, StoN*cos);
924 fillME(iLayer->second.ClusterChargeCorrOnTrack, charge*cos);
925 fillME(iLayer->second.ClusterChargeOnTrack, charge);
926 fillME(iLayer->second.ClusterNoiseOnTrack, noise);
927 fillME(iLayer->second.ClusterWidthOnTrack, width);
928 fillME(iLayer->second.ClusterPosOnTrack, position);
931 fillME(iLayer->second.ClusterChargeOffTrack, charge);
932 fillME(iLayer->second.ClusterNoiseOffTrack, noise);
933 fillME(iLayer->second.ClusterWidthOffTrack, width);
934 fillME(iLayer->second.ClusterPosOffTrack, position);
937 std::map<std::string, SubDetMEs>::iterator iSubdet =
SubDetMEsMap.find(sdet_pair.second);
940 fillME(iSubdet->second.ClusterChargeOnTrack,charge);
941 if(noise > 0.0)
fillME(iSubdet->second.ClusterStoNCorrOnTrack,StoN*cos);
943 fillME(iSubdet->second.ClusterChargeOffTrack,charge);
944 if(noise > 0.0)
fillME(iSubdet->second.ClusterStoNOffTrack,StoN);
954 tag = folder_name.substr(folder_name.find(
"MechanicalView")+15);
955 if (tag.find(
"side_") != std::string::npos) {
956 tag.replace(tag.find_last_of(
"/"),1,
"_");
MonitorElement * ClusterStoNCorr
MonitorElement * bookMETrend(DQMStore::IBooker &, const char *, const char *)
uint8_t maxCharge() const
MonitorElement * ClusterNoiseOnTrack
T getParameter(std::string const &) const
EventNumber_t event() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
TkHistoMap * tkhisto_NumOffTrack
SiStripMonitorTrack(const edm::ParameterSet &)
void setSiStripFolderName(std::string name)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void trackStudy(const edm::Event &ev, const edm::EventSetup &es)
void trackStudyFromTrack(edm::Handle< reco::TrackCollection > trackCollectionHandle, const edm::EventSetup &es)
edm::EDGetTokenT< reco::TrackCollection > trackToken_
void trackStudyFromTrajectory(edm::Handle< TrajTrackAssociationCollection > TItkAssociatorCollection, const edm::EventSetup &es)
const GeomDetUnit * monoDet() const
void fillME(MonitorElement *ME, float value1)
SiStripDCSStatus * dcsStatus_
friend struct const_iterator
MonitorElement * nClustersTrendOnTrack
MonitorElement * bookProfile(Args &&...args)
MonitorElement * ClusterPosOffTrack
void hitStudy(const edm::EventSetup &es, const ProjectedSiStripRecHit2D *projhit, const SiStripMatchedRecHit2D *matchedhit, const SiStripRecHit2D *hit2D, const SiStripRecHit1D *hit1D, LocalVector localMomentum)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
float noiseRescaledByGain() const
void book(DQMStore::IBooker &, const TrackerTopology *tTopo)
MonitorElement * ClusterStoNCorrOnTrack
void AllClusters(const edm::Event &ev, const edm::EventSetup &es)
MonitorElement * ClusterStoNOffTrack
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::string topFolderName_
std::vector< Track > TrackCollection
collection of Tracks
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=0)
MonitorElement * bookME1D(DQMStore::IBooker &, const char *, const char *)
void bookLayerMEs(DQMStore::IBooker &, const uint32_t &, std::string &)
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
data_type const * const_iterator
std::string TrackProducer_
key_type key() const
Accessor for product key.
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
MonitorElement * ClusterChargeCorr
uint16_t maxIndex() const
void trajectoryStudy(const edm::Ref< std::vector< Trajectory > > traj, const edm::EventSetup &es)
static bool pixelBarrelHitFilter(uint16_t pattern)
static int position[TOTALCHAMBERS][3]
MonitorElement * ClusterPGV
MonitorElement * nClustersTrendOffTrack
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
static bool validHitFilter(uint16_t pattern)
LocalVector localMomentum() const
edm::ESHandle< TrackerGeometry > tkgeom_
MonitorElement * ClusterCharge
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
edmNew::DetSet< SiStripCluster >::const_iterator ClusIter
math::XYZTLorentzVectorD LV
float signalOverNoise() const
void fillMEs(SiStripClusterInfo *, uint32_t detid, const TrackerTopology *tTopo, float, enum ClusterFlags)
vector< ParameterSet > Parameters
uint16_t hitPattern[ARRAY_LENGTH]
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
std::unordered_set< const SiStripCluster * > vPSiStripCluster
std::map< std::string, SubDetMEs > SubDetMEsMap
void fillModMEs(SiStripClusterInfo *, std::string, float)
MonitorElement * ClusterChargeOffTrack
MonitorElement * nClustersOnTrack
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void fill(uint32_t &detid, float value)
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
const std::string subdet_tag("SubDet")
Cos< T >::type cos(const T &t)
MonitorElement * ClusterStoNCorrOnTrack
MonitorElement * bookME2D(DQMStore::IBooker &, const char *, const char *)
MonitorElement * book1D(Args &&...args)
void tag(MonitorElement *, unsigned int)
void bookSubDetMEs(DQMStore::IBooker &, std::string &name)
MonitorElement * bookME3D(DQMStore::IBooker &, const char *, const char *)
SiStripFolderOrganizer folderOrganizer_
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
MonitorElement * ClusterChargeOnTrack
MonitorElement * ClusterNoiseOffTrack
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void getSubDetTag(std::string &folder_name, std::string &tag)
edm::EDGetTokenT< TrajTrackAssociationCollection > trackTrajToken_
MonitorElement * ClusterWidth
MonitorElement * ClusterChargeOnTrack
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=0)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
MonitorElement * ClusterWidthOffTrack
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
MonitorElement * ClusterPosOnTrack
void bookModMEs(DQMStore::IBooker &, const uint32_t &)
T const * product() const
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &es)
MonitorElement * ClusterChargeOffTrack
std::map< std::string, ModMEs > ModMEsMap
MonitorElement * ClusterPos
MonitorElement * ClusterChargeCorrOnTrack
std::pair< std::string, std::string > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
TkHistoMap * tkhisto_NumOnTrack
bool clusterInfos(SiStripClusterInfo *cluster, const uint32_t &detid, const TrackerTopology *tTopo, enum ClusterFlags flags, LocalVector LV)
GenericTriggerEventFlag * genTriggerEventFlag_
const std::vector< uint8_t > & stripCharges() const
void RecHitInfo(const T *tkrecHit, LocalVector LV, const edm::EventSetup &)
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)
MonitorElement * ClusterWidthOnTrack
MonitorElement * bookMEProfile(DQMStore::IBooker &, const char *, const char *)
TkHistoMap * tkhisto_StoNCorrOnTrack
virtual void endJob(void)
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
uint16_t getHitPattern(HitCategory category, int position) const
Detector det() const
get the detector field from this detid
MonitorElement * book3D(Args &&...args)
MonitorElement * nClustersOffTrack
void add(uint32_t &detid, float value)
bool applyClusterQuality_
edm::InputTag Cluster_src_
const GeomDetUnit * stereoDet() const
int numberOfHits(HitCategory category) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusterToken_
std::map< std::string, LayerMEs > LayerMEsMap