00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019 #include "DQM/SiStripMonitorTrack/interface/SiStripMonitorMuonHLT.h"
00020
00021
00022
00023
00024
00025 SiStripMonitorMuonHLT::SiStripMonitorMuonHLT (const edm::ParameterSet & iConfig)
00026 {
00027
00028 parameters_ = iConfig;
00029 verbose_ = parameters_.getUntrackedParameter<bool>("verbose",false);
00030 normalize_ = parameters_.getUntrackedParameter<bool>("normalize",true);
00031 printNormalize_ = parameters_.getUntrackedParameter<bool>("printNormalize",false);
00032 monitorName_ = parameters_.getUntrackedParameter<std::string>("monitorName","HLT/HLTMonMuon");
00033 prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt",-1);
00034
00035
00036 runOnClusters_ = parameters_.getUntrackedParameter<bool>("runOnClusters",true);
00037 runOnMuonCandidates_ = parameters_.getUntrackedParameter<bool>("runOnMuonCandidates",true);
00038 runOnTracks_ = parameters_.getUntrackedParameter<bool>("runOnTracks",true);
00039
00040
00041 clusterCollectionTag_ = parameters_.getUntrackedParameter < edm::InputTag > ("clusterCollectionTag",edm::InputTag("hltSiStripRawToClustersFacility"));
00042 l3collectionTag_ = parameters_.getUntrackedParameter < edm::InputTag > ("l3MuonTag",edm::InputTag("hltL3MuonCandidates"));
00043 TrackCollectionTag_ = parameters_.getUntrackedParameter < edm::InputTag > ("trackCollectionTag",edm::InputTag("hltL3TkTracksFromL2"));
00045
00046 HistoNumber = 35;
00047
00048
00049 dbe_ = 0;
00050 if (!edm::Service < DQMStore > ().isAvailable ())
00051 {
00052 edm::LogError ("TkHistoMap") <<
00053 "\n------------------------------------------"
00054 "\nUnAvailable Service DQMStore: please insert in the configuration file an instance like" "\n\tprocess.load(\"DQMServices.Core.DQMStore_cfg\")" "\n------------------------------------------";
00055 }
00056 dbe_ = edm::Service < DQMStore > ().operator-> ();
00057 dbe_->setVerbose (0);
00058
00059 tkdetmap_ = 0;
00060 if (!edm::Service < TkDetMap > ().isAvailable ())
00061 {
00062 edm::LogError ("TkHistoMap") <<
00063 "\n------------------------------------------"
00064 "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like" "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")" "\n------------------------------------------";
00065 }
00066 tkdetmap_ = edm::Service < TkDetMap > ().operator-> ();
00068
00069 outputFile_ = parameters_.getUntrackedParameter < std::string > ("outputFile","");
00070 if (outputFile_.size () != 0) edm::LogWarning ("HLTMuonDQMSource") << "Muon HLT Monitoring histograms will be saved to " << outputFile_ << std::endl;
00071 else outputFile_ = "MuonHLTDQM.root";
00072
00073 bool disable = parameters_.getUntrackedParameter < bool > ("disableROOToutput",false);
00074 if (disable) outputFile_ = "";
00075 if (dbe_ != NULL) dbe_->setCurrentFolder (monitorName_);
00076
00077 }
00078
00079
00080 SiStripMonitorMuonHLT::~SiStripMonitorMuonHLT ()
00081 {
00082
00083
00084
00085
00086 }
00087
00088
00089
00090
00091
00092
00093 float SiStripMonitorMuonHLT::GetEtaWeight(std::string label, GlobalPoint clustgp){
00094 float etaWeight = 1.;
00095 for (unsigned int i = 0; i < m_BinEta[label].size() - 1; i++){
00096 if (m_BinEta[label][i] < clustgp.eta() && clustgp.eta() < m_BinEta[label][i+1]){
00097 if (m_ModNormEta[label][i] > 0.1) etaWeight = 1./m_ModNormEta[label][i];
00098 else etaWeight = 1.;
00099 }
00100 }
00101 return etaWeight;
00102 }
00103
00104 float SiStripMonitorMuonHLT::GetPhiWeight(std::string label, GlobalPoint clustgp){
00105 float phiWeight = 1.;
00106 for (unsigned int i = 0; i < m_BinPhi[label].size() - 1; i++){
00107 if (m_BinPhi[label][i] < clustgp.phi() && clustgp.phi() < m_BinPhi[label][i+1]){
00108 if (m_ModNormPhi[label][i] > 0.1) phiWeight = 1./m_ModNormPhi[label][i];
00109 else phiWeight = 1.;
00110 }
00111 }
00112 return phiWeight;
00113 }
00114
00115
00116 void
00117 SiStripMonitorMuonHLT::analyze (const edm::Event & iEvent, const edm::EventSetup & iSetup)
00118 {
00119
00120
00121 #ifdef THIS_IS_AN_EVENT_EXAMPLE
00122 Handle < ExampleData > pIn;
00123 iEvent.getByLabel ("example", pIn);
00124 #endif
00125
00126 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
00127 ESHandle < SetupData > pSetup;
00128 iSetup.get < SetupRecord > ().get (pSetup);
00129 #endif
00130
00131 if (!dbe_)
00132 return;
00133 counterEvt_++;
00134 if (prescaleEvt_ > 0 && counterEvt_ % prescaleEvt_ != 0)
00135 return;
00136 LogDebug ("SiStripMonitorHLTMuon") << " processing conterEvt_: " << counterEvt_ << std::endl;
00137
00138
00139 edm::ESHandle < TrackerGeometry > TG;
00140 iSetup.get < TrackerDigiGeometryRecord > ().get (TG);
00141 const TrackerGeometry *theTrackerGeometry = TG.product ();
00142 const TrackerGeometry & theTracker (*theTrackerGeometry);
00143
00144
00146
00147
00148 edm::Handle < reco::RecoChargedCandidateCollection > l3mucands;
00149 bool accessToL3Muons = true;
00150 iEvent.getByLabel (l3collectionTag_, l3mucands);
00151 reco::RecoChargedCandidateCollection::const_iterator cand;
00152
00153
00154 edm::Handle < edm::LazyGetter < SiStripCluster > >clusters;
00155 bool accessToClusters = true;
00156 iEvent.getByLabel (clusterCollectionTag_, clusters);
00157 edm::LazyGetter < SiStripCluster >::record_iterator clust;
00158
00159
00160 edm::Handle<reco::TrackCollection > trackCollection;
00161 bool accessToTracks = true;
00162 iEvent.getByLabel (TrackCollectionTag_, trackCollection);
00163 reco::TrackCollection::const_iterator track;
00165
00166
00167 if (runOnClusters_ && accessToClusters && !clusters.failedToGet () && clusters.isValid())
00168 {
00169 for (clust = clusters->begin_record (); clust != clusters->end_record (); ++clust)
00170 {
00171
00172 uint detID = clust->geographicalId ();
00173 std::stringstream ss;
00174 int layer = tkdetmap_->FindLayer (detID);
00175 std::string label = tkdetmap_->getLayerName (layer);
00176 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00177 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00178
00179 LocalPoint clustlp = topol->localPosition (clust->barycenter ());
00180 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00181
00182
00183 float etaWeight = 1.;
00184 float phiWeight = 1.;
00185 if (normalize_){
00186 etaWeight = GetEtaWeight(label, clustgp);
00187 phiWeight = GetPhiWeight(label,clustgp);
00188 }
00189 LayerMEMap[label.c_str ()].EtaDistribAllClustersMap->Fill (clustgp.eta (),etaWeight);
00190 LayerMEMap[label.c_str ()].PhiDistribAllClustersMap->Fill (clustgp.phi (),phiWeight);
00191 LayerMEMap[label.c_str ()].EtaPhiAllClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00192 tkmapAllClusters->add(detID,1.);
00193 }
00194 }
00195
00196 if (runOnMuonCandidates_ && accessToL3Muons && !l3mucands.failedToGet () && l3mucands.isValid())
00197 {
00198 for (cand = l3mucands->begin (); cand != l3mucands->end (); ++cand)
00199 {
00200
00201 const reco::Track* l3tk = cand->get < reco::TrackRef > ().get();
00202 analyzeOnTrackClusters(l3tk, theTracker, true);
00203 }
00204 }
00205
00206 if (runOnTracks_ && accessToTracks && !trackCollection.failedToGet() && trackCollection.isValid()){
00207 for (track = trackCollection->begin (); track != trackCollection->end() ; ++ track)
00208 {
00209 const reco::Track* tk = &(*track);
00210 analyzeOnTrackClusters(tk, theTracker, false);
00211 }
00212 }
00213
00214 }
00215
00216 void SiStripMonitorMuonHLT::analyzeOnTrackClusters( const reco::Track* l3tk, const TrackerGeometry & theTracker, bool isL3MuTrack ){
00217
00218 for (size_t hit = 0; hit < l3tk->recHitsSize (); hit++)
00219 {
00220
00221 if (l3tk->recHit (hit)->isValid () == true && l3tk->recHit (hit)->geographicalId ().det () == DetId::Tracker)
00222 {
00223 uint detID = l3tk->recHit (hit)->geographicalId ()();
00224
00225 const SiStripRecHit1D *hit1D = dynamic_cast < const SiStripRecHit1D * >(l3tk->recHit (hit).get ());
00226 const SiStripRecHit2D *hit2D = dynamic_cast < const SiStripRecHit2D * >(l3tk->recHit (hit).get ());
00227 const SiStripMatchedRecHit2D *hitMatched2D = dynamic_cast < const SiStripMatchedRecHit2D * >(l3tk->recHit (hit).get ());
00228 const ProjectedSiStripRecHit2D *hitProj2D = dynamic_cast < const ProjectedSiStripRecHit2D * >(l3tk->recHit (hit).get ());
00229
00230
00231
00232 if (hit1D != 0)
00233 {
00234 if (hit1D->cluster_regional ().isNonnull ())
00235 {
00236 if (hit1D->cluster_regional ().isAvailable ())
00237 {
00238 detID = hit1D->cluster_regional ()->geographicalId ();
00239 }
00240 }
00241 int layer = tkdetmap_->FindLayer (detID);
00242 std::string label = tkdetmap_->getLayerName (layer);
00243 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00244 if (theGeomDet != 0)
00245 {
00246 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00247 if (topol != 0)
00248 {
00249
00250 LocalPoint clustlp = topol->localPosition (hit1D->cluster_regional ()->barycenter ());
00251 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00252
00253 float etaWeight = 1.;
00254 float phiWeight = 1.;
00255 if (normalize_){
00256 etaWeight = GetEtaWeight(label, clustgp);
00257 phiWeight = GetPhiWeight(label,clustgp);
00258 }
00259 if(!isL3MuTrack){
00260 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00261 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00262 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00263 tkmapOnTrackClusters->add(detID,1.);
00264 }
00265 else{
00266 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00267 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00268 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00269 tkmapL3MuTrackClusters->add(detID,1.);
00270 }
00271 }
00272 }
00273 }
00274
00275 if (hit2D != 0)
00276 {
00277 if (hit2D->cluster_regional ().isNonnull ())
00278 {
00279 if (hit2D->cluster_regional ().isAvailable ())
00280 {
00281 detID = hit2D->cluster_regional ()->geographicalId ();
00282 }
00283 }
00284 int layer = tkdetmap_->FindLayer (detID);
00285 std::string label = tkdetmap_->getLayerName (layer);
00286 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00287 if (theGeomDet != 0)
00288 {
00289 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00290 if (topol != 0)
00291 {
00292
00293 LocalPoint clustlp = topol->localPosition (hit2D->cluster_regional ()->barycenter ());
00294 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00295
00296
00297 float etaWeight = 1.;
00298 float phiWeight = 1.;
00299 if (normalize_){
00300 etaWeight = GetEtaWeight(label, clustgp);
00301 phiWeight = GetPhiWeight(label,clustgp);
00302 }
00303 if(!isL3MuTrack){
00304 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00305 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00306 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00307 tkmapOnTrackClusters->add(detID,1.);
00308 }
00309 else{
00310 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00311 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00312 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00313 tkmapL3MuTrackClusters->add(detID,1.);
00314 }
00315 }
00316 }
00317 }
00318
00319 if (hitMatched2D != 0)
00320 {
00321
00322 detID = hitMatched2D->monoCluster().geographicalId ();
00323 int layer = tkdetmap_->FindLayer (detID);
00324 std::string label = tkdetmap_->getLayerName (layer);
00325 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00326 if (theGeomDet != 0)
00327 {
00328 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00329 if (topol != 0)
00330 {
00331
00332 LocalPoint clustlp = topol->localPosition (hitMatched2D->monoCluster().barycenter ());
00333 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00334
00335 float etaWeight = 1.;
00336 float phiWeight = 1.;
00337 if (normalize_){
00338 etaWeight = GetEtaWeight(label, clustgp);
00339 phiWeight = GetPhiWeight(label,clustgp);
00340 }
00341 if(!isL3MuTrack){
00342 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00343 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00344 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00345 tkmapOnTrackClusters->add(detID,1.);
00346 }
00347 else{
00348 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00349 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00350 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00351 tkmapL3MuTrackClusters->add(detID,1.);
00352 }
00353 }
00354 }
00355
00356
00357 detID = hitMatched2D->stereoCluster().geographicalId ();
00358 layer = tkdetmap_->FindLayer (detID);
00359 label = tkdetmap_->getLayerName (layer);
00360 const StripGeomDetUnit *theGeomDet2 = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00361 if (theGeomDet2 != 0)
00362 {
00363 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet2->specificTopology ()));
00364 if (topol != 0)
00365 {
00366
00367 LocalPoint clustlp = topol->localPosition (hitMatched2D->stereoCluster().barycenter ());
00368 GlobalPoint clustgp = theGeomDet2->surface ().toGlobal (clustlp);
00369
00370 float etaWeight = 1.;
00371 float phiWeight = 1.;
00372 if (normalize_){
00373 etaWeight = GetEtaWeight(label, clustgp);
00374 phiWeight = GetPhiWeight(label,clustgp);
00375 }
00376 if(!isL3MuTrack){
00377 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00378 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00379 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00380 tkmapOnTrackClusters->add(detID,1.);
00381 }
00382 else{
00383 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00384 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00385 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00386 tkmapL3MuTrackClusters->add(detID,1.);
00387 }
00388 }
00389 }
00390
00391 }
00392
00393
00394 if (hitProj2D != 0)
00395 {
00396 if (hitProj2D->originalHit ().cluster_regional ().isNonnull ())
00397 {
00398 if (hitProj2D->originalHit ().cluster_regional ().isAvailable ())
00399 {
00400 detID = hitProj2D->originalHit ().cluster_regional ()->geographicalId ();
00401 }
00402 }
00403 int layer = tkdetmap_->FindLayer (detID);
00404 std::string label = tkdetmap_->getLayerName (layer);
00405 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00406 if (theGeomDet != 0)
00407 {
00408 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00409 if (topol != 0)
00410 {
00411
00412 LocalPoint clustlp = topol->localPosition (hitProj2D->originalHit ().cluster_regional ()->barycenter ());
00413 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00414
00415 float etaWeight = 1.;
00416 float phiWeight = 1.;
00417 if (normalize_){
00418 etaWeight = GetEtaWeight(label, clustgp);
00419 phiWeight = GetPhiWeight(label,clustgp);
00420 }
00421 if(!isL3MuTrack){
00422 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00423 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00424 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00425 tkmapOnTrackClusters->add(detID,1.);
00426 }
00427 else{
00428 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00429 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00430 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00431 tkmapL3MuTrackClusters->add(detID,1.);
00432 }
00433 }
00434 }
00435 }
00436
00437 }
00438 }
00439 }
00440
00441 void
00442 SiStripMonitorMuonHLT::createMEs (const edm::EventSetup & es)
00443 {
00444
00445
00446 std::vector <float *> tgraphEta;
00447 std::vector <float *> tgraphPhi;
00448 std::vector <int> tgraphSize;
00449
00450 std::vector <std::vector<float> > binningEta;
00451 std::vector <std::vector<float> > binningPhi;
00452
00453 for (int p = 0; p < 34; p++){
00454 tgraphEta.push_back (new float[1000]);
00455 tgraphPhi.push_back (new float[1000]);
00456 }
00457
00458
00459 std::map< std::string,std::vector<float> > m_BinEta_Prel ;
00460 std::map< std::string,std::vector<float> > m_PhiStripMod_Eta;
00461 std::map< std::string,std::vector<float> > m_PhiStripMod_Nb;
00462
00463
00464
00465
00466 edm::ESHandle < TrackerGeometry > TG;
00467 es.get < TrackerDigiGeometryRecord > ().get (TG);
00468 const TrackerGeometry *theTrackerGeometry = TG.product ();
00469 const TrackerGeometry & theTracker (*theTrackerGeometry);
00470
00471 std::vector<DetId> Dets = theTracker.detUnitIds();
00472
00473
00474
00475 GeometryFromTrackGeom(Dets,theTracker,es,m_PhiStripMod_Eta,m_PhiStripMod_Nb);
00476
00477
00482
00483 std::string fullName, folder;
00484
00485
00486 int p =0;
00487
00488
00489 for (int layer = 1; layer < HistoNumber; ++layer)
00490 {
00491 SiStripFolderOrganizer folderOrg;
00492 std::stringstream ss;
00493 SiStripDetId::SubDetector subDet;
00494 uint32_t subdetlayer, side;
00495 tkdetmap_->getSubDetLayerSide (layer, subDet, subdetlayer, side);
00496 folderOrg.getSubDetLayerFolderName (ss, subDet, subdetlayer, side);
00497 folder = ss.str ();
00498 dbe_->setCurrentFolder (monitorName_ + folder);
00499
00500 LayerMEs layerMEs;
00501 layerMEs.EtaPhiAllClustersMap = 0;
00502 layerMEs.EtaDistribAllClustersMap = 0;
00503 layerMEs.PhiDistribAllClustersMap = 0;
00504 layerMEs.EtaPhiOnTrackClustersMap = 0;
00505 layerMEs.EtaDistribOnTrackClustersMap = 0;
00506 layerMEs.PhiDistribOnTrackClustersMap = 0;
00507 layerMEs.EtaPhiL3MuTrackClustersMap = 0;
00508 layerMEs.EtaDistribL3MuTrackClustersMap = 0;
00509 layerMEs.PhiDistribL3MuTrackClustersMap = 0;
00510
00511 std::string histoname;
00512 std::string title;
00513 std::string labelHisto = tkdetmap_->getLayerName (layer);
00514
00515 std::string labelHisto_ID = labelHisto;
00516 labelHisto_ID.erase(3);
00517
00518
00519 unsigned int sizePhi = 0;
00520 unsigned int sizeEta = 0;
00521 float * xbinsPhi = new float[100];
00522 float * xbinsEta = new float[100];
00523
00524
00525 if (labelHisto_ID == "TEC" || labelHisto_ID == "TID" || labelHisto_ID == "TOB" || labelHisto_ID == "TIB"){
00526
00527
00528
00529 m_BinPhi[labelHisto].push_back(-M_PI);
00530 m_BinPhi[labelHisto].push_back(M_PI);
00531
00532
00533 sort(m_BinPhi[labelHisto].begin(),m_BinPhi[labelHisto].end());
00534
00535 sizePhi = m_BinPhi[labelHisto].size();
00536
00537 for (unsigned int i = 0; i < sizePhi; i++){
00538 xbinsPhi[i] = m_BinPhi[labelHisto][i];
00539 }
00540
00541
00542 std::vector <float > v_BinEta_Prel;
00543
00544 for (unsigned int i = 0; i < 12; i++){
00545
00546 if (m_PhiStripMod_Nb[labelHisto][i] != 0 && fabs(m_PhiStripMod_Eta[labelHisto][i]) > 0.05){
00547 float EtaBarycenter = m_PhiStripMod_Eta[labelHisto][i]/m_PhiStripMod_Nb[labelHisto][i];
00548 v_BinEta_Prel.push_back(EtaBarycenter);
00549 }
00550 }
00551
00552
00553 sort(v_BinEta_Prel.begin(),v_BinEta_Prel.end());
00554
00555
00556 for (unsigned int i = 0; i < v_BinEta_Prel.size(); i++){
00557 if (i == 0) m_BinEta[labelHisto].push_back(v_BinEta_Prel[i] - 0.15);
00558 if (i != 0) {
00559 float shift = v_BinEta_Prel[i] - v_BinEta_Prel[i-1];
00560 m_BinEta[labelHisto].push_back(v_BinEta_Prel[i] - shift/2.);
00561 }
00562 if (i == v_BinEta_Prel.size()-1) m_BinEta[labelHisto].push_back(v_BinEta_Prel[i] + 0.15);
00563 }
00564
00565 sort(m_BinEta[labelHisto].begin(),m_BinEta[labelHisto].end());
00566
00567
00568 sizeEta = m_BinEta[labelHisto].size();
00569
00570 for (unsigned int i = 0; i < sizeEta; i++){
00571 xbinsEta[i] = m_BinEta[labelHisto][i];
00572 }
00573
00574 }
00575
00576
00577 if(runOnClusters_){
00578 histoname = "EtaAllClustersDistrib_" + labelHisto;
00579 title = "#eta(All Clusters) in " + labelHisto;
00580 layerMEs.EtaDistribAllClustersMap = dbe_->book1D (histoname, title, sizeEta - 1, xbinsEta);
00581 histoname = "PhiAllClustersDistrib_" + labelHisto;
00582 title = "#phi(All Clusters) in " + labelHisto;
00583 layerMEs.PhiDistribAllClustersMap = dbe_->book1D (histoname, title, sizePhi - 1, xbinsPhi);
00584 histoname = "EtaPhiAllClustersMap_" + labelHisto;
00585 title = "#eta-#phi All Clusters map in " + labelHisto;
00586 layerMEs.EtaPhiAllClustersMap = dbe_->book2D (histoname, title, sizeEta - 1, xbinsEta, sizePhi - 1, xbinsPhi);
00587 }
00588
00589 if(runOnTracks_){
00590 histoname = "EtaOnTrackClustersDistrib_" + labelHisto;
00591 title = "#eta(OnTrack Clusters) in " + labelHisto;
00592 layerMEs.EtaDistribOnTrackClustersMap = dbe_->book1D (histoname, title, sizeEta - 1, xbinsEta);
00593 histoname = "PhiOnTrackClustersDistrib_" + labelHisto;
00594 title = "#phi(OnTrack Clusters) in " + labelHisto;
00595 layerMEs.PhiDistribOnTrackClustersMap = dbe_->book1D (histoname, title, sizePhi - 1, xbinsPhi);
00596 histoname = "EtaPhiOnTrackClustersMap_" + labelHisto;
00597 title = "#eta-#phi OnTrack Clusters map in " + labelHisto;
00598 layerMEs.EtaPhiOnTrackClustersMap = dbe_->book2D (histoname, title, sizeEta - 1, xbinsEta, sizePhi - 1, xbinsPhi);
00599 }
00600 if(runOnMuonCandidates_){
00601
00602 histoname = "EtaL3MuTrackClustersDistrib_" + labelHisto;
00603 title = "#eta(L3MuTrack Clusters) in " + labelHisto;
00604 layerMEs.EtaDistribL3MuTrackClustersMap = dbe_->book1D (histoname, title, sizeEta - 1, xbinsEta);
00605 histoname = "PhiL3MuTrackClustersDistrib_" + labelHisto;
00606 title = "#phi(L3MuTrack Clusters) in " + labelHisto;
00607 layerMEs.PhiDistribL3MuTrackClustersMap = dbe_->book1D (histoname, title, sizePhi - 1, xbinsPhi);
00608 histoname = "EtaPhiL3MuTrackClustersMap_" + labelHisto;
00609 title = "#eta-#phi L3MuTrack Clusters map in " + labelHisto;
00610 layerMEs.EtaPhiL3MuTrackClustersMap = dbe_->book2D (histoname, title, sizeEta - 1, xbinsEta, sizePhi - 1, xbinsPhi);
00611 }
00612 LayerMEMap[labelHisto] = layerMEs;
00613
00614
00615 if(runOnClusters_){
00616 LayerMEMap[labelHisto].EtaDistribAllClustersMap->getTH1F()->Sumw2();
00617 LayerMEMap[labelHisto].PhiDistribAllClustersMap->getTH1F()->Sumw2();
00618 LayerMEMap[labelHisto].EtaPhiAllClustersMap->getTH2F()->Sumw2();
00619 }
00620 if(runOnTracks_){
00621 LayerMEMap[labelHisto].EtaDistribOnTrackClustersMap->getTH1F()->Sumw2();
00622 LayerMEMap[labelHisto].PhiDistribOnTrackClustersMap->getTH1F()->Sumw2();
00623 LayerMEMap[labelHisto].EtaPhiOnTrackClustersMap->getTH2F()->Sumw2();
00624 }
00625 if(runOnMuonCandidates_){
00626 LayerMEMap[labelHisto].EtaDistribL3MuTrackClustersMap->getTH1F()->Sumw2();
00627 LayerMEMap[labelHisto].PhiDistribL3MuTrackClustersMap->getTH1F()->Sumw2();
00628 LayerMEMap[labelHisto].EtaPhiL3MuTrackClustersMap->getTH2F()->Sumw2();
00629 }
00630
00631 p++;
00632 }
00633
00634
00635
00636 Normalizer(Dets,theTracker);
00637
00638 }
00639
00640
00641 void
00642 SiStripMonitorMuonHLT::GeometryFromTrackGeom (std::vector<DetId> Dets,const TrackerGeometry & theTracker, const edm::EventSetup& es,
00643 std::map< std::string,std::vector<float> > & m_PhiStripMod_Eta,std::map< std::string,std::vector<float> > & m_PhiStripMod_Nb){
00644
00645
00646 edm::ESHandle<TrackerTopology> tTopoHandle;
00647 es.get<IdealGeometryRecord>().get(tTopoHandle);
00648 const TrackerTopology* const tTopo = tTopoHandle.product();
00649
00650 std::vector<std::string> v_LabelHisto;
00651
00652
00653
00654 for(std::vector<DetId>::iterator detid_iterator = Dets.begin(); detid_iterator!=Dets.end(); ++detid_iterator){
00655 uint32_t detid = (*detid_iterator)();
00656
00657 if ( (*detid_iterator).null() == true) break;
00658 if (detid == 0) break;
00659
00660
00661 const GeomDetUnit * GeomDet = theTracker.idToDetUnit(detid);
00662 const GeomDet::SubDetector detector = GeomDet->subDetector();
00663
00664 int mylayer;
00665 std::string mylabelHisto;
00666
00667
00668 if (detector == GeomDetEnumerators::TEC
00669 || detector == GeomDetEnumerators::TID
00670 || detector == GeomDetEnumerators::TOB
00671 || detector == GeomDetEnumerators::TIB
00672 ){
00673
00674 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detid));
00675 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00676
00677
00678 LocalPoint clustlp = topol->localPosition (1.);
00679 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00680
00681
00682 mylayer = tkdetmap_->FindLayer (detid);
00683 mylabelHisto = tkdetmap_->getLayerName (mylayer);
00684
00685
00686
00687
00688
00689
00690 unsigned int count = 0;
00691 while (count < v_LabelHisto.size()){
00692 if (mylabelHisto == v_LabelHisto[count]) break;
00693 count++;
00694 }
00695 if (count == v_LabelHisto.size()){
00696
00697
00698 v_LabelHisto.push_back(mylabelHisto);
00699
00700
00701
00702
00703 for (int i = 0; i < 12; i++){
00704 m_PhiStripMod_Eta[mylabelHisto].push_back(0.);
00705 m_PhiStripMod_Nb[mylabelHisto].push_back(0.);
00706 }
00707 }
00708
00709
00710 if (detector == GeomDetEnumerators::TEC ){
00711
00712
00713
00714
00715
00716 if (tTopo->tecRing(detid) == 7){
00717
00718 if (tTopo->tecModule(detid) == 1 && tTopo->tecIsFrontPetal(detid) == true) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00719
00720 if (tTopo->tecModule(detid) == 1 && tTopo->tecIsBackPetal(detid) == true) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00721 }
00722
00723
00724
00725 if (tTopo->tecPetalNumber(detid) == 1 ){
00726 m_PhiStripMod_Eta[mylabelHisto][tTopo->tecRing(detid)-1] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tecRing(detid)-1] + clustgp.eta();
00727 m_PhiStripMod_Nb[mylabelHisto][tTopo->tecRing(detid)-1]++;
00728 }
00729
00730 }
00731
00732
00733 if (detector == GeomDetEnumerators::TID ){
00734
00735
00736
00737
00738
00739 if (tTopo->tecRing(detid) == 1){
00740
00741 if (tTopo->tecIsFrontPetal(detid) == true && tTopo->tecIsStereo(detid) == false) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00742
00743 if (tTopo->tecIsFrontPetal(detid) == true && tTopo->tecIsStereo(detid) == true) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00744 }
00745
00746
00747
00748 if (tTopo->tecModule(detid) == 1){
00749 m_PhiStripMod_Eta[mylabelHisto][tTopo->tecRing(detid)-1] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tecRing(detid)-1] + clustgp.eta();
00750 m_PhiStripMod_Nb[mylabelHisto][tTopo->tecRing(detid)-1]++;
00751 }
00752
00753 }
00754
00755
00756 if (detector == GeomDetEnumerators::TOB ){
00757
00758
00759
00760
00761 if (tTopo->tecModule(detid) == 1 && tTopo->tecIsZMinusSide(detid) == true){
00762
00763 if (tTopo->tecIsStereo(detid) == false) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00764 }
00765
00766
00767
00768 if ( (tTopo->tobRod(detid) == 2 && tTopo->tobIsStereo(detid) == false)
00769 || (tTopo->tobRod(detid) == 1 && tTopo->tobIsStereo(detid) == true)
00770 ){
00771 if (tTopo->tobIsZMinusSide(detid) == true){
00772 m_PhiStripMod_Eta[mylabelHisto][tTopo->tobModule(detid)-1] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tobModule(detid)-1] + clustgp.eta();
00773 m_PhiStripMod_Nb[mylabelHisto][tTopo->tobModule(detid)-1]++;
00774 }
00775 if (tTopo->tobIsZMinusSide(detid) == false){
00776 m_PhiStripMod_Eta[mylabelHisto][tTopo->tobModule(detid)+5] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tobModule(detid)+5] + clustgp.eta();
00777 m_PhiStripMod_Nb[mylabelHisto][tTopo->tobModule(detid)+5]++;
00778 }
00779 }
00780
00781 }
00782
00783
00784 if (detector == GeomDetEnumerators::TIB ){
00785
00786
00787
00788
00789
00790 if (tTopo->tibModule(detid) == 1 && tTopo->tibIsZMinusSide(detid) == true){
00791
00792 if (tTopo->tibIsInternalString(detid) == true && tTopo->tibIsStereo(detid) == false) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00793 }
00794
00795
00796
00797 if ( (tTopo->tibString(detid) == 2 && tTopo->tibIsStereo(detid) == false)
00798 || (tTopo->tibString(detid) == 1 && tTopo->tibIsStereo(detid) == true)
00799 ){
00800 if (tTopo->tibIsZMinusSide(detid) == true){
00801 if (tTopo->tibIsInternalString(detid) == true){
00802 m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)-1] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)-1] + clustgp.eta();
00803 m_PhiStripMod_Nb[mylabelHisto][tTopo->tibModule(detid)-1]++;
00804 }
00805 if (tTopo->tibIsInternalString(detid) == false){
00806 m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)+2] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)+2] + clustgp.eta();
00807 m_PhiStripMod_Nb[mylabelHisto][tTopo->tibModule(detid)+2]++;
00808 }
00809 }
00810 if (tTopo->tibIsZMinusSide(detid) == false){
00811 if (tTopo->tibIsInternalString(detid) == true){
00812 m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)+5] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)+5] + clustgp.eta();
00813 m_PhiStripMod_Nb[mylabelHisto][tTopo->tibModule(detid)+5]++;
00814 }
00815 if (tTopo->tibIsInternalString(detid) == false){
00816 m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)+8] = m_PhiStripMod_Eta[mylabelHisto][tTopo->tibModule(detid)+8] + clustgp.eta();
00817 m_PhiStripMod_Nb[mylabelHisto][tTopo->tibModule(detid)+8]++;
00818 }
00819 }
00820 }
00821
00822 }
00823
00824 }
00825 }
00826
00827 }
00828
00829
00830
00831 void
00832 SiStripMonitorMuonHLT::Normalizer (std::vector<DetId> Dets,const TrackerGeometry & theTracker){
00833
00834
00835 std::vector<std::string> v_LabelHisto;
00836
00837
00838
00839 for(std::vector<DetId>::iterator detid_iterator = Dets.begin(); detid_iterator!=Dets.end(); detid_iterator++){
00840 uint32_t detid = (*detid_iterator)();
00841
00842 if ( (*detid_iterator).null() == true) break;
00843 if (detid == 0) break;
00844
00845
00846 const GeomDetUnit * GeomDet = theTracker.idToDetUnit(detid);
00847 const GeomDet::SubDetector detector = GeomDet->subDetector();
00848
00849 int mylayer;
00850 std::string mylabelHisto;
00851
00852
00853 if (detector == GeomDetEnumerators::TEC
00854 || detector == GeomDetEnumerators::TID
00855 || detector == GeomDetEnumerators::TOB
00856 || detector == GeomDetEnumerators::TIB
00857 ){
00858
00859 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detid));
00860
00861
00862
00863 mylayer = tkdetmap_->FindLayer (detid);
00864 mylabelHisto = tkdetmap_->getLayerName (mylayer);
00865
00866
00867
00868
00869
00870
00871 unsigned int count = 0;
00872
00873 while (count < v_LabelHisto.size()){
00874 if (mylabelHisto == v_LabelHisto[count]) break;
00875 count++;
00876 }
00877
00878 if (count == v_LabelHisto.size()){
00879
00880 v_LabelHisto.push_back(mylabelHisto);
00881
00882
00883
00884 for (unsigned int i = 0; i < m_BinEta[mylabelHisto].size() -1; i++){
00885 m_ModNormEta[mylabelHisto].push_back(0.);
00886 }
00887
00888
00889 for (unsigned int i = 0; i < m_BinPhi[mylabelHisto].size() -1; i++){
00890 m_ModNormPhi[mylabelHisto].push_back(0.);
00891 }
00892 }
00893
00894
00895
00896
00897
00898
00899 LocalPoint clustlp(0.,0.);
00900 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00901
00902
00903
00904
00905
00906
00907 const BoundPlane& GeomDetSurface = GeomDet->surface();
00908 const Bounds& bound = GeomDetSurface.bounds();
00909
00910 std::string labelHisto_ID = mylabelHisto;
00911 labelHisto_ID.erase(3);
00912
00913 float length = 0.;
00914 float width = 0.;
00915
00916 std::vector <GlobalPoint> v_Edge_G;
00917
00918 float ratio = 0.;
00919 float factor = 1.;
00920
00921
00922 if (labelHisto_ID == "TOB" || labelHisto_ID == "TIB"){
00923 const RectangularPlaneBounds *rectangularBound = dynamic_cast < const RectangularPlaneBounds * >(& bound);
00924 length = rectangularBound->length();
00925 width = rectangularBound->width();
00926 ratio = width/length;
00927
00928
00929 LocalPoint topleft(-width/2., length/2.);
00930 LocalPoint topright(width/2., length/2.); LocalPoint botleft(-width/2., -length/2.);
00931 LocalPoint botright(width/2., -length/2.);
00932 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topleft));
00933 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topright));
00934 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botleft)); v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botright));
00935 }
00936
00937 if (labelHisto_ID == "TEC" || labelHisto_ID == "TID"){
00938 const TrapezoidalPlaneBounds *trapezoidalBound = dynamic_cast < const TrapezoidalPlaneBounds * >(& bound);
00939
00940 length = trapezoidalBound->length();
00941 width = trapezoidalBound->widthAtHalfLength();
00942
00943 ratio = width/length;
00944
00945
00946 LocalPoint topleft(-width/2., length/2.);
00947 LocalPoint topright(width/2., length/2.);
00948 LocalPoint botleft(-width/2., -length/2.);
00949 LocalPoint botright(width/2., -length/2.);
00950
00951 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topleft));
00952 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topright));
00953 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botleft));
00954 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botright));
00955 }
00956
00957
00958 GlobalPoint top_left_G;
00959 GlobalPoint top_rightG;
00960 GlobalPoint bot_left_G;
00961 GlobalPoint bot_rightG;
00962
00963 std::vector <bool> v_Fill;
00964 v_Fill.push_back(false);
00965 v_Fill.push_back(false);
00966 v_Fill.push_back(false);
00967 v_Fill.push_back(false);
00968
00969 for (unsigned int i =0 ; i< v_Edge_G.size() ; i++){
00970 if (v_Edge_G[i].eta() < clustgp.eta()){
00971 if (v_Edge_G[i].phi() < clustgp.phi()) {
00972 bot_left_G = v_Edge_G[i];
00973 v_Fill[0] = true;
00974 }
00975 if (v_Edge_G[i].phi() > clustgp.phi()){
00976 top_left_G = v_Edge_G[i];
00977 v_Fill[1] = true;
00978 }
00979 }
00980 if (v_Edge_G[i].eta() > clustgp.eta()){
00981 if (v_Edge_G[i].phi() < clustgp.phi()){
00982 bot_rightG = v_Edge_G[i];
00983 v_Fill[2] = true;
00984 }
00985 if (v_Edge_G[i].phi() > clustgp.phi()){
00986 top_rightG = v_Edge_G[i];
00987 v_Fill[3] = true;
00988 }
00989 }
00990 }
00991
00992
00993
00994 float G_length = 0.;
00995 float G_width = 0.;
00996
00997 bool flag_border = false;
00998
00999 if (v_Fill[0] == true
01000 && v_Fill[1] == true
01001 && v_Fill[2] == true
01002 && v_Fill[3] == true){
01003
01004
01005 G_length = sqrt( (top_left_G.x()-top_rightG.x())*(top_left_G.x()-top_rightG.x()) + (top_left_G.y()-top_rightG.y())*(top_left_G.y()-top_rightG.y()) + (top_left_G.z()-top_rightG.z())*(top_left_G.z()-top_rightG.z()) );
01006
01007
01008 G_width = sqrt( (bot_left_G.x()-top_left_G.x())*(bot_left_G.x()-top_left_G.x()) + (bot_left_G.y()-top_left_G.y())*(bot_left_G.y()-top_left_G.y()) + (bot_left_G.z()-top_left_G.z())*(bot_left_G.z()-top_left_G.z()) );
01009
01010 }
01011 else {
01012
01013
01014 flag_border = true;
01015
01016
01017 for (unsigned int i =0 ; i< v_Edge_G.size() ; i++){
01018
01019 if (v_Edge_G[i].phi() > 0. ){
01020 if (v_Edge_G[i].eta() < clustgp.eta()){
01021 bot_left_G = v_Edge_G[i];
01022 }
01023 if (v_Edge_G[i].eta() > clustgp.eta()){
01024 bot_rightG = v_Edge_G[i];
01025 }
01026 }
01027 if (v_Edge_G[i].phi() < 0. ){
01028 if (v_Edge_G[i].eta() < clustgp.eta()){
01029 top_left_G = v_Edge_G[i];
01030 }
01031 if (v_Edge_G[i].eta() > clustgp.eta()){
01032 top_rightG = v_Edge_G[i];
01033 }
01034 }
01035 }
01036
01037
01038 G_length = sqrt( (top_left_G.x()-top_rightG.x())*(top_left_G.x()-top_rightG.x()) + (top_left_G.y()-top_rightG.y())*(top_left_G.y()-top_rightG.y()) + (top_left_G.z()-top_rightG.z())*(top_left_G.z()-top_rightG.z()) );
01039 G_width = G_length*ratio;
01040 }
01041
01042
01043
01044
01045 for (unsigned int i = 0; i < m_BinEta[mylabelHisto].size() - 1; i++){
01046 if (m_BinEta[mylabelHisto][i] <= clustgp.eta() && clustgp.eta() < m_BinEta[mylabelHisto][i+1]){
01047
01048
01049 m_ModNormEta[mylabelHisto][i] = m_ModNormEta[mylabelHisto][i] + factor*G_length*G_width;
01050
01051 }
01052 }
01053
01054
01055 unsigned int LastBinPhi = m_BinPhi[mylabelHisto].size() - 2;
01056 for (unsigned int i = 0; i < m_BinPhi[mylabelHisto].size() - 1; i++){
01057 if (m_BinPhi[mylabelHisto][i] <= clustgp.phi() && clustgp.phi() < m_BinPhi[mylabelHisto][i+1]){
01058
01059
01060
01061 float phiMin = std::min(bot_left_G.phi(),bot_rightG.phi());
01062 float phiMax = std::max(top_left_G.phi(),top_rightG.phi());
01063
01064 bool offlimit_prev = false;
01065 bool offlimit_foll = false;
01066
01067 if (phiMin < m_BinPhi[mylabelHisto][i]) offlimit_prev = true;
01068 if (i != LastBinPhi){
01069 if (phiMax > m_BinPhi[mylabelHisto][i+1]) offlimit_foll = true;
01070 }
01071
01072
01073 float MidPoint_X_prev;
01074 float MidPoint_Y_prev;
01075 float MidPoint_Z_prev;
01076 float MidPoint_X_foll;
01077 float MidPoint_Y_foll;
01078 float MidPoint_Z_foll;
01079
01080
01081 if (offlimit_prev){
01082
01083
01084 float tStar1 = (m_BinPhi[mylabelHisto][i]-bot_left_G.phi())/(top_left_G.phi()-bot_left_G.phi());
01085
01086
01087 float tStar2 = (m_BinPhi[mylabelHisto][i]-bot_rightG.phi())/(top_rightG.phi()-bot_rightG.phi());
01088
01089 if (tStar1 < 0.) tStar1 = 0.;
01090 if (tStar2 < 0.) tStar2 = 0.;
01091
01092
01093 float xStar1 = bot_left_G.x() + (tStar1*1.)*(top_left_G.x()-bot_left_G.x());
01094 float xStar2 = bot_rightG.x() + (tStar2*1.)*(top_rightG.x()-bot_rightG.x());
01095
01096 float yStar1 = bot_left_G.y() + (tStar1*1.)*(top_left_G.y()-bot_left_G.y());
01097 float yStar2 = bot_rightG.y() + (tStar2*1.)*(top_rightG.y()-bot_rightG.y());
01098
01099 float zStar1 = bot_left_G.z() + (tStar1*1.)*(top_left_G.z()-bot_left_G.z());
01100 float zStar2 = bot_rightG.z() + (tStar2*1.)*(top_rightG.z()-bot_rightG.z());
01101
01102
01103 MidPoint_X_prev = (xStar1 + xStar2)/2.;
01104 MidPoint_Y_prev = (yStar1 + yStar2)/2.;
01105 MidPoint_Z_prev = (zStar1 + zStar2)/2.;
01106 }
01107
01108 if (offlimit_prev == false){
01109 MidPoint_X_prev = (bot_left_G.x() + bot_rightG.x())/2.;
01110 MidPoint_Y_prev = (bot_left_G.y() + bot_rightG.y())/2.;
01111 MidPoint_Z_prev = (bot_left_G.z() + bot_rightG.z())/2.;
01112 }
01113
01114
01115 if (offlimit_foll){
01116
01117
01118 float tStar1 = (m_BinPhi[mylabelHisto][i+1]-bot_left_G.phi())/(top_left_G.phi()-bot_left_G.phi());
01119
01120
01121 float tStar2 = (m_BinPhi[mylabelHisto][i+1]-bot_rightG.phi())/(top_rightG.phi()-bot_rightG.phi());
01122
01123 if (tStar1 > 1.) tStar1 = 1.;
01124 if (tStar2 > 1.) tStar2 = 1.;
01125
01126
01127 float xStar1 = bot_left_G.x() + (tStar1*1.)*(top_left_G.x()-bot_left_G.x());
01128 float xStar2 = bot_rightG.x() + (tStar2*1.)*(top_rightG.x()-bot_rightG.x());
01129
01130 float yStar1 = bot_left_G.y() + (tStar1*1.)*(top_left_G.y()-bot_left_G.y());
01131 float yStar2 = bot_rightG.y() + (tStar2*1.)*(top_rightG.y()-bot_rightG.y());
01132
01133 float zStar1 = bot_left_G.z() + (tStar1*1.)*(top_left_G.z()-bot_left_G.z());
01134 float zStar2 = bot_rightG.z() + (tStar2*1.)*(top_rightG.z()-bot_rightG.z());
01135
01136
01137 MidPoint_X_foll = (xStar1 + xStar2)/2.;
01138 MidPoint_Y_foll = (yStar1 + yStar2)/2.;
01139 MidPoint_Z_foll = (zStar1 + zStar2)/2.;
01140 }
01141
01142 if (offlimit_foll == false){
01143 MidPoint_X_foll = (top_left_G.x() + top_rightG.x())/2.;
01144 MidPoint_Y_foll = (top_left_G.y() + top_rightG.y())/2.;
01145 MidPoint_Z_foll = (top_left_G.z() + top_rightG.z())/2.;
01146 }
01147
01148
01149 float EdgePoint_X_B = (bot_left_G.x() + bot_rightG.x())/2.;
01150 float EdgePoint_Y_B = (bot_left_G.y() + bot_rightG.y())/2.;
01151 float EdgePoint_Z_B = (bot_left_G.z() + bot_rightG.z())/2.;
01152
01153 float EdgePoint_X_T = (top_left_G.x() + top_rightG.x())/2.;
01154 float EdgePoint_Y_T = (top_left_G.y() + top_rightG.y())/2.;
01155 float EdgePoint_Z_T = (top_left_G.z() + top_rightG.z())/2.;
01156
01157 float G_width_Ins = sqrt( (MidPoint_X_foll-MidPoint_X_prev)*(MidPoint_X_foll-MidPoint_X_prev) + (MidPoint_Y_foll-MidPoint_Y_prev)*(MidPoint_Y_foll-MidPoint_Y_prev) + (MidPoint_Z_foll-MidPoint_Z_prev)*(MidPoint_Z_foll-MidPoint_Z_prev) );
01158
01159
01160 if (flag_border){
01161
01162
01163 if (i != 0 && i != LastBinPhi){
01164 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_length*G_width;
01165 }
01166
01167
01168 if (i == 0 || i == LastBinPhi){
01169 float PhiBalance = 0.;
01170 if (clustgp.phi() > 0.) PhiBalance = clustgp.phi() - M_PI ;
01171 if (clustgp.phi() < 0.) PhiBalance = clustgp.phi() + M_PI ;
01172
01173
01174 float Phi_Width = m_BinPhi[mylabelHisto][3] - m_BinPhi[mylabelHisto][2];
01175
01176 float weight_FirstBin = (1.+ (PhiBalance/(Phi_Width/2.)))/2. ;
01177 float weight_LastBin = fabs(1. - weight_FirstBin);
01178
01179 m_ModNormPhi[mylabelHisto][0] = m_ModNormPhi[mylabelHisto][0] + weight_FirstBin*(factor*G_length*G_width);
01180 m_ModNormPhi[mylabelHisto][LastBinPhi] = m_ModNormPhi[mylabelHisto][LastBinPhi] + weight_LastBin*(factor*G_length*G_width);
01181 }
01182 }
01183
01184 if (flag_border == false){
01185
01186
01187 if (offlimit_prev == false && offlimit_foll == false){
01188 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_length*G_width;
01189 }
01190
01191
01192 if ((offlimit_prev == true && offlimit_foll == false)
01193 ||(offlimit_prev == false && offlimit_foll == true) ){
01194 float G_width_Out = fabs(G_width - G_width_Ins);
01195
01196
01197 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_width_Ins*G_length;
01198
01199
01200 if (offlimit_prev && i != 0) m_ModNormPhi[mylabelHisto][i-1] = m_ModNormPhi[mylabelHisto][i-1] + factor*G_width_Out*G_length;
01201 if (offlimit_foll && i != LastBinPhi) m_ModNormPhi[mylabelHisto][i+1] = m_ModNormPhi[mylabelHisto][i+1] + factor*G_width_Out*G_length;
01202 }
01203
01204
01205 if (offlimit_prev == true && offlimit_foll == true){
01206
01207
01208 float G_width_T = sqrt( (MidPoint_X_foll-EdgePoint_X_T)*(MidPoint_X_foll-EdgePoint_X_T) + (MidPoint_Y_foll-EdgePoint_Y_T)*(MidPoint_Y_foll-EdgePoint_Y_T) + (MidPoint_Z_foll-EdgePoint_Z_T)*(MidPoint_Z_foll-EdgePoint_Z_T) );
01209 float G_width_B = sqrt( (MidPoint_X_prev-EdgePoint_X_B)*(MidPoint_X_prev-EdgePoint_X_B) + (MidPoint_Y_prev-EdgePoint_Y_B)*(MidPoint_Y_prev-EdgePoint_Y_B) + (MidPoint_Z_prev-EdgePoint_Z_B)*(MidPoint_Z_prev-EdgePoint_Z_B) );
01210
01211
01212 if (i != 0 && i != LastBinPhi){
01213
01214 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_width_Ins*G_length;
01215
01216
01217 if (i != 0) m_ModNormPhi[mylabelHisto][i-1] = m_ModNormPhi[mylabelHisto][i-1] + factor*G_width_B*G_length;
01218 if (i != LastBinPhi) m_ModNormPhi[mylabelHisto][i+1] = m_ModNormPhi[mylabelHisto][i+1] + factor*G_width_T*G_length;
01219 }
01220
01221 }
01222 }
01223 }
01224 }
01225
01226 }
01227
01228 }
01229
01230
01231 if (printNormalize_) {
01232 TFile output("MuonHLTDQMNormalization.root","recreate");
01233 output.cd();
01234 PrintNormalization(v_LabelHisto);
01235 output.Close();
01236 }
01237
01238 }
01239
01240
01241
01242 void
01243 SiStripMonitorMuonHLT::PrintNormalization (std::vector<std::string> v_LabelHisto)
01244 {
01245 std::vector <TH1F *> h_ModNorm_Eta;
01246 std::vector <TH1F *> h_ModNorm_Phi;
01247
01248 for (unsigned int p = 0; p < v_LabelHisto.size(); p++){
01249
01250 std::string titleHistoEta = v_LabelHisto[p] + "_eta" ;
01251 std::string titleHistoPhi = v_LabelHisto[p] + "_phi" ;
01252
01253 std::string labelHisto = v_LabelHisto[p];
01254
01255 float * xbinsPhi = new float[100];
01256 float * xbinsEta = new float[100];
01257
01258
01259 unsigned int sizePhi = m_BinPhi[labelHisto].size();
01260 for (unsigned int i = 0; i < sizePhi; i++){
01261 xbinsPhi[i] = m_BinPhi[labelHisto][i];
01262 }
01263
01264 unsigned int sizeEta = m_BinEta[labelHisto].size();
01265 for (unsigned int i = 0; i < sizeEta; i++){
01266 xbinsEta[i] = m_BinEta[labelHisto][i];
01267 }
01268
01269 h_ModNorm_Eta.push_back(new TH1F (titleHistoEta.c_str(),titleHistoEta.c_str(),sizeEta - 1,xbinsEta));
01270 h_ModNorm_Phi.push_back(new TH1F (titleHistoPhi.c_str(),titleHistoPhi.c_str(),sizePhi - 1,xbinsPhi));
01271
01272 for (unsigned int i = 0; i < m_ModNormEta[labelHisto].size(); i++){
01273 (*h_ModNorm_Eta[p]).SetBinContent(i+1,m_ModNormEta[labelHisto][i]);
01274 }
01275 for (unsigned int i = 0; i < m_ModNormPhi[labelHisto].size(); i++){
01276 (*h_ModNorm_Phi[p]).SetBinContent(i+1,m_ModNormPhi[labelHisto][i]);
01277 }
01278
01279 (*h_ModNorm_Eta[p]).Write();
01280 (*h_ModNorm_Phi[p]).Write();
01281 }
01282
01283 }
01284
01285
01286
01287 void
01288 SiStripMonitorMuonHLT::beginRun (const edm::Run& run, const edm::EventSetup & es)
01289 {
01290 if (dbe_)
01291 {
01292 if (monitorName_ != "")
01293 monitorName_ = monitorName_ + "/";
01294 edm::LogInfo ("HLTMuonDQMSource") << "===>DQM event prescale = " << prescaleEvt_ << " events " << std::endl;
01295 createMEs (es);
01296
01297 if(runOnClusters_)
01298 tkmapAllClusters = new TkHistoMap("HLT/HLTMonMuon/SiStrip" ,"TkHMap_AllClusters",0.0,0);
01299 if(runOnTracks_)
01300 tkmapOnTrackClusters = new TkHistoMap("HLT/HLTMonMuon/SiStrip" ,"TkHMap_OnTrackClusters",0.0,0);
01301 if(runOnMuonCandidates_)
01302 tkmapL3MuTrackClusters = new TkHistoMap("HLT/HLTMonMuon/SiStrip" ,"TkHMap_L3MuTrackClusters",0.0,0);
01303 }
01304 }
01305
01306
01307 void
01308 SiStripMonitorMuonHLT::endJob ()
01309 {
01310 edm::LogInfo ("SiStripMonitorHLTMuon") << "analyzed " << counterEvt_ << " events";
01311 return;
01312 }
01313
01314 DEFINE_FWK_MODULE(SiStripMonitorMuonHLT);