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 if (hitMatched2D->monoHit ()->cluster_regional ().isNonnull ())
00323 {
00324 if (hitMatched2D->monoHit ()->cluster_regional ().isAvailable ())
00325 {
00326 detID = hitMatched2D->monoHit ()->cluster_regional ()->geographicalId ();
00327 }
00328 }
00329 int layer = tkdetmap_->FindLayer (detID);
00330 std::string label = tkdetmap_->getLayerName (layer);
00331 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00332 if (theGeomDet != 0)
00333 {
00334 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00335 if (topol != 0)
00336 {
00337
00338 LocalPoint clustlp = topol->localPosition (hitMatched2D->monoHit ()->cluster_regional ()->barycenter ());
00339 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00340
00341 float etaWeight = 1.;
00342 float phiWeight = 1.;
00343 if (normalize_){
00344 etaWeight = GetEtaWeight(label, clustgp);
00345 phiWeight = GetPhiWeight(label,clustgp);
00346 }
00347 if(!isL3MuTrack){
00348 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00349 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00350 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00351 tkmapOnTrackClusters->add(detID,1.);
00352 }
00353 else{
00354 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00355 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00356 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00357 tkmapL3MuTrackClusters->add(detID,1.);
00358 }
00359 }
00360 }
00361
00362
00363 if (hitMatched2D->stereoHit ()->cluster_regional ().isNonnull ())
00364 {
00365 if (hitMatched2D->stereoHit ()->cluster_regional ().isAvailable ())
00366 {
00367 detID = hitMatched2D->stereoHit ()->cluster_regional ()->geographicalId ();
00368 }
00369 }
00370 layer = tkdetmap_->FindLayer (detID);
00371 label = tkdetmap_->getLayerName (layer);
00372 const StripGeomDetUnit *theGeomDet2 = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00373 if (theGeomDet2 != 0)
00374 {
00375 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet2->specificTopology ()));
00376 if (topol != 0)
00377 {
00378
00379 LocalPoint clustlp = topol->localPosition (hitMatched2D->stereoHit ()->cluster_regional ()->barycenter ());
00380 GlobalPoint clustgp = theGeomDet2->surface ().toGlobal (clustlp);
00381
00382 float etaWeight = 1.;
00383 float phiWeight = 1.;
00384 if (normalize_){
00385 etaWeight = GetEtaWeight(label, clustgp);
00386 phiWeight = GetPhiWeight(label,clustgp);
00387 }
00388 if(!isL3MuTrack){
00389 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00390 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00391 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00392 tkmapOnTrackClusters->add(detID,1.);
00393 }
00394 else{
00395 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00396 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00397 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00398 tkmapL3MuTrackClusters->add(detID,1.);
00399 }
00400 }
00401 }
00402
00403 }
00404
00405
00406 if (hitProj2D != 0)
00407 {
00408 if (hitProj2D->originalHit ().cluster_regional ().isNonnull ())
00409 {
00410 if (hitProj2D->originalHit ().cluster_regional ().isAvailable ())
00411 {
00412 detID = hitProj2D->originalHit ().cluster_regional ()->geographicalId ();
00413 }
00414 }
00415 int layer = tkdetmap_->FindLayer (detID);
00416 std::string label = tkdetmap_->getLayerName (layer);
00417 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detID));
00418 if (theGeomDet != 0)
00419 {
00420 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00421 if (topol != 0)
00422 {
00423
00424 LocalPoint clustlp = topol->localPosition (hitProj2D->originalHit ().cluster_regional ()->barycenter ());
00425 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00426
00427 float etaWeight = 1.;
00428 float phiWeight = 1.;
00429 if (normalize_){
00430 etaWeight = GetEtaWeight(label, clustgp);
00431 phiWeight = GetPhiWeight(label,clustgp);
00432 }
00433 if(!isL3MuTrack){
00434 LayerMEMap[label.c_str ()].EtaDistribOnTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00435 LayerMEMap[label.c_str ()].PhiDistribOnTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00436 LayerMEMap[label.c_str ()].EtaPhiOnTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00437 tkmapOnTrackClusters->add(detID,1.);
00438 }
00439 else{
00440 LayerMEMap[label.c_str ()].EtaDistribL3MuTrackClustersMap->Fill (clustgp.eta (),etaWeight);
00441 LayerMEMap[label.c_str ()].PhiDistribL3MuTrackClustersMap->Fill (clustgp.phi (),phiWeight);
00442 LayerMEMap[label.c_str ()].EtaPhiL3MuTrackClustersMap->Fill (clustgp.eta (), clustgp.phi ());
00443 tkmapL3MuTrackClusters->add(detID,1.);
00444 }
00445 }
00446 }
00447 }
00448
00449 }
00450 }
00451 }
00452
00453 void
00454 SiStripMonitorMuonHLT::createMEs (const edm::EventSetup & es)
00455 {
00456
00457
00458 std::vector <float *> tgraphEta;
00459 std::vector <float *> tgraphPhi;
00460 std::vector <int> tgraphSize;
00461
00462 std::vector <std::vector<float> > binningEta;
00463 std::vector <std::vector<float> > binningPhi;
00464
00465 for (int p = 0; p < 34; p++){
00466 tgraphEta.push_back (new float[1000]);
00467 tgraphPhi.push_back (new float[1000]);
00468 }
00469
00470
00471 std::map< std::string,std::vector<float> > m_BinEta_Prel ;
00472 std::map< std::string,std::vector<float> > m_PhiStripMod_Eta;
00473 std::map< std::string,std::vector<float> > m_PhiStripMod_Nb;
00474
00475
00476
00477
00478 edm::ESHandle < TrackerGeometry > TG;
00479 es.get < TrackerDigiGeometryRecord > ().get (TG);
00480 const TrackerGeometry *theTrackerGeometry = TG.product ();
00481 const TrackerGeometry & theTracker (*theTrackerGeometry);
00482
00483 std::vector<DetId> Dets = theTracker.detUnitIds();
00484
00485
00486
00487 GeometryFromTrackGeom(Dets,theTracker,m_PhiStripMod_Eta,m_PhiStripMod_Nb);
00488
00489
00494
00495 std::string fullName, folder;
00496
00497
00498 int p =0;
00499
00500
00501 for (int layer = 1; layer < HistoNumber; ++layer)
00502 {
00503 SiStripFolderOrganizer folderOrg;
00504 std::stringstream ss;
00505 SiStripDetId::SubDetector subDet;
00506 uint32_t subdetlayer, side;
00507 tkdetmap_->getSubDetLayerSide (layer, subDet, subdetlayer, side);
00508 folderOrg.getSubDetLayerFolderName (ss, subDet, subdetlayer, side);
00509 folder = ss.str ();
00510 dbe_->setCurrentFolder (monitorName_ + folder);
00511
00512 LayerMEs layerMEs;
00513 layerMEs.EtaPhiAllClustersMap = 0;
00514 layerMEs.EtaDistribAllClustersMap = 0;
00515 layerMEs.PhiDistribAllClustersMap = 0;
00516 layerMEs.EtaPhiOnTrackClustersMap = 0;
00517 layerMEs.EtaDistribOnTrackClustersMap = 0;
00518 layerMEs.PhiDistribOnTrackClustersMap = 0;
00519 layerMEs.EtaPhiL3MuTrackClustersMap = 0;
00520 layerMEs.EtaDistribL3MuTrackClustersMap = 0;
00521 layerMEs.PhiDistribL3MuTrackClustersMap = 0;
00522
00523 std::string histoname;
00524 std::string title;
00525 std::string labelHisto = tkdetmap_->getLayerName (layer);
00526
00527 std::string labelHisto_ID = labelHisto;
00528 labelHisto_ID.erase(3);
00529
00530
00531 unsigned int sizePhi = 0;
00532 unsigned int sizeEta = 0;
00533 float * xbinsPhi = new float[100];
00534 float * xbinsEta = new float[100];
00535
00536
00537 if (labelHisto_ID == "TEC" || labelHisto_ID == "TID" || labelHisto_ID == "TOB" || labelHisto_ID == "TIB"){
00538
00539
00540
00541 m_BinPhi[labelHisto].push_back(-M_PI);
00542 m_BinPhi[labelHisto].push_back(M_PI);
00543
00544
00545 sort(m_BinPhi[labelHisto].begin(),m_BinPhi[labelHisto].end());
00546
00547 sizePhi = m_BinPhi[labelHisto].size();
00548
00549 for (unsigned int i = 0; i < sizePhi; i++){
00550 xbinsPhi[i] = m_BinPhi[labelHisto][i];
00551 }
00552
00553
00554 std::vector <float > v_BinEta_Prel;
00555
00556 for (unsigned int i = 0; i < 12; i++){
00557
00558 if (m_PhiStripMod_Nb[labelHisto][i] != 0 && fabs(m_PhiStripMod_Eta[labelHisto][i]) > 0.05){
00559 float EtaBarycenter = m_PhiStripMod_Eta[labelHisto][i]/m_PhiStripMod_Nb[labelHisto][i];
00560 v_BinEta_Prel.push_back(EtaBarycenter);
00561 }
00562 }
00563
00564
00565 sort(v_BinEta_Prel.begin(),v_BinEta_Prel.end());
00566
00567
00568 for (unsigned int i = 0; i < v_BinEta_Prel.size(); i++){
00569 if (i == 0) m_BinEta[labelHisto].push_back(v_BinEta_Prel[i] - 0.15);
00570 if (i != 0) {
00571 float shift = v_BinEta_Prel[i] - v_BinEta_Prel[i-1];
00572 m_BinEta[labelHisto].push_back(v_BinEta_Prel[i] - shift/2.);
00573 }
00574 if (i == v_BinEta_Prel.size()-1) m_BinEta[labelHisto].push_back(v_BinEta_Prel[i] + 0.15);
00575 }
00576
00577 sort(m_BinEta[labelHisto].begin(),m_BinEta[labelHisto].end());
00578
00579
00580 sizeEta = m_BinEta[labelHisto].size();
00581
00582 for (unsigned int i = 0; i < sizeEta; i++){
00583 xbinsEta[i] = m_BinEta[labelHisto][i];
00584 }
00585
00586 }
00587
00588
00589 if(runOnClusters_){
00590 histoname = "EtaAllClustersDistrib_" + labelHisto;
00591 title = "#eta(All Clusters) in " + labelHisto;
00592 layerMEs.EtaDistribAllClustersMap = dbe_->book1D (histoname, title, sizeEta - 1, xbinsEta);
00593 histoname = "PhiAllClustersDistrib_" + labelHisto;
00594 title = "#phi(All Clusters) in " + labelHisto;
00595 layerMEs.PhiDistribAllClustersMap = dbe_->book1D (histoname, title, sizePhi - 1, xbinsPhi);
00596 histoname = "EtaPhiAllClustersMap_" + labelHisto;
00597 title = "#eta-#phi All Clusters map in " + labelHisto;
00598 layerMEs.EtaPhiAllClustersMap = dbe_->book2D (histoname, title, sizeEta - 1, xbinsEta, sizePhi - 1, xbinsPhi);
00599 }
00600
00601 if(runOnTracks_){
00602 histoname = "EtaOnTrackClustersDistrib_" + labelHisto;
00603 title = "#eta(OnTrack Clusters) in " + labelHisto;
00604 layerMEs.EtaDistribOnTrackClustersMap = dbe_->book1D (histoname, title, sizeEta - 1, xbinsEta);
00605 histoname = "PhiOnTrackClustersDistrib_" + labelHisto;
00606 title = "#phi(OnTrack Clusters) in " + labelHisto;
00607 layerMEs.PhiDistribOnTrackClustersMap = dbe_->book1D (histoname, title, sizePhi - 1, xbinsPhi);
00608 histoname = "EtaPhiOnTrackClustersMap_" + labelHisto;
00609 title = "#eta-#phi OnTrack Clusters map in " + labelHisto;
00610 layerMEs.EtaPhiOnTrackClustersMap = dbe_->book2D (histoname, title, sizeEta - 1, xbinsEta, sizePhi - 1, xbinsPhi);
00611 }
00612 if(runOnMuonCandidates_){
00613
00614 histoname = "EtaL3MuTrackClustersDistrib_" + labelHisto;
00615 title = "#eta(L3MuTrack Clusters) in " + labelHisto;
00616 layerMEs.EtaDistribL3MuTrackClustersMap = dbe_->book1D (histoname, title, sizeEta - 1, xbinsEta);
00617 histoname = "PhiL3MuTrackClustersDistrib_" + labelHisto;
00618 title = "#phi(L3MuTrack Clusters) in " + labelHisto;
00619 layerMEs.PhiDistribL3MuTrackClustersMap = dbe_->book1D (histoname, title, sizePhi - 1, xbinsPhi);
00620 histoname = "EtaPhiL3MuTrackClustersMap_" + labelHisto;
00621 title = "#eta-#phi L3MuTrack Clusters map in " + labelHisto;
00622 layerMEs.EtaPhiL3MuTrackClustersMap = dbe_->book2D (histoname, title, sizeEta - 1, xbinsEta, sizePhi - 1, xbinsPhi);
00623 }
00624 LayerMEMap[labelHisto] = layerMEs;
00625
00626
00627 if(runOnClusters_){
00628 LayerMEMap[labelHisto].EtaDistribAllClustersMap->getTH1F()->Sumw2();
00629 LayerMEMap[labelHisto].PhiDistribAllClustersMap->getTH1F()->Sumw2();
00630 LayerMEMap[labelHisto].EtaPhiAllClustersMap->getTH2F()->Sumw2();
00631 }
00632 if(runOnTracks_){
00633 LayerMEMap[labelHisto].EtaDistribOnTrackClustersMap->getTH1F()->Sumw2();
00634 LayerMEMap[labelHisto].PhiDistribOnTrackClustersMap->getTH1F()->Sumw2();
00635 LayerMEMap[labelHisto].EtaPhiOnTrackClustersMap->getTH2F()->Sumw2();
00636 }
00637 if(runOnMuonCandidates_){
00638 LayerMEMap[labelHisto].EtaDistribL3MuTrackClustersMap->getTH1F()->Sumw2();
00639 LayerMEMap[labelHisto].PhiDistribL3MuTrackClustersMap->getTH1F()->Sumw2();
00640 LayerMEMap[labelHisto].EtaPhiL3MuTrackClustersMap->getTH2F()->Sumw2();
00641 }
00642
00643 p++;
00644 }
00645
00646
00647
00648 Normalizer(Dets,theTracker);
00649
00650 }
00651
00652
00653 void
00654 SiStripMonitorMuonHLT::GeometryFromTrackGeom (std::vector<DetId> Dets,const TrackerGeometry & theTracker,
00655 std::map< std::string,std::vector<float> > & m_PhiStripMod_Eta,std::map< std::string,std::vector<float> > & m_PhiStripMod_Nb){
00656
00657
00658 std::vector<std::string> v_LabelHisto;
00659
00660
00661
00662 for(std::vector<DetId>::iterator detid_iterator = Dets.begin(); detid_iterator!=Dets.end(); detid_iterator++){
00663 uint32_t detid = (*detid_iterator)();
00664
00665 if ( (*detid_iterator).null() == true) break;
00666 if (detid == 0) break;
00667
00668
00669 const GeomDetUnit * GeomDet = theTracker.idToDetUnit(detid);
00670 const GeomDet::SubDetector detector = GeomDet->subDetector();
00671
00672 int mylayer;
00673 std::string mylabelHisto;
00674
00675
00676 if (detector == GeomDetEnumerators::TEC
00677 || detector == GeomDetEnumerators::TID
00678 || detector == GeomDetEnumerators::TOB
00679 || detector == GeomDetEnumerators::TIB
00680 ){
00681
00682 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detid));
00683 const StripTopology *topol = dynamic_cast < const StripTopology * >(&(theGeomDet->specificTopology ()));
00684
00685
00686 LocalPoint clustlp = topol->localPosition (1.);
00687 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00688
00689
00690 mylayer = tkdetmap_->FindLayer (detid);
00691 mylabelHisto = tkdetmap_->getLayerName (mylayer);
00692
00693
00694
00695
00696
00697
00698 unsigned int count = 0;
00699 while (count < v_LabelHisto.size()){
00700 if (mylabelHisto == v_LabelHisto[count]) break;
00701 count++;
00702 }
00703 if (count == v_LabelHisto.size()){
00704
00705
00706 v_LabelHisto.push_back(mylabelHisto);
00707
00708
00709
00710
00711 for (int i = 0; i < 12; i++){
00712 m_PhiStripMod_Eta[mylabelHisto].push_back(0.);
00713 m_PhiStripMod_Nb[mylabelHisto].push_back(0.);
00714 }
00715 }
00716
00717
00718 if (detector == GeomDetEnumerators::TEC ){
00719
00720 TECDetId id = TECDetId(detid);
00721
00722
00723
00724 if (id.ringNumber() == 7){
00725
00726 if (id.moduleNumber() == 1 && id.isFrontPetal() == true) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00727
00728 if (id.moduleNumber() == 1 && id.isBackPetal() == true) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00729 }
00730
00731
00732
00733 if (id.petalNumber() == 1 ){
00734 m_PhiStripMod_Eta[mylabelHisto][id.ringNumber()-1] = m_PhiStripMod_Eta[mylabelHisto][id.ringNumber()-1] + clustgp.eta();
00735 m_PhiStripMod_Nb[mylabelHisto][id.ringNumber()-1]++;
00736 }
00737
00738 }
00739
00740
00741 if (detector == GeomDetEnumerators::TID ){
00742
00743 TIDDetId id = TIDDetId(detid);
00744
00745
00746
00747 if (id.ringNumber() == 1){
00748
00749 if (id.isFrontRing() == true && id.isStereo() == false) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00750
00751 if (id.isFrontRing() == true && id.isStereo() == true) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00752 }
00753
00754
00755
00756 if (id.moduleNumber() == 1){
00757 m_PhiStripMod_Eta[mylabelHisto][id.ringNumber()-1] = m_PhiStripMod_Eta[mylabelHisto][id.ringNumber()-1] + clustgp.eta();
00758 m_PhiStripMod_Nb[mylabelHisto][id.ringNumber()-1]++;
00759 }
00760
00761 }
00762
00763
00764 if (detector == GeomDetEnumerators::TOB ){
00765
00766 TOBDetId id = TOBDetId(detid);
00767
00768
00769 if (id.moduleNumber() == 1 && id.isZMinusSide() == true){
00770
00771 if (id.isStereo() == false) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00772 }
00773
00774
00775
00776 if ( (id.rodNumber() == 2 && id.isStereo() == false)
00777 || (id.rodNumber() == 1 && id.isStereo() == true)
00778 ){
00779 if (id.isZMinusSide() == true){
00780 m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()-1] = m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()-1] + clustgp.eta();
00781 m_PhiStripMod_Nb[mylabelHisto][id.moduleNumber()-1]++;
00782 }
00783 if (id.isZMinusSide() == false){
00784 m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+5] = m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+5] + clustgp.eta();
00785 m_PhiStripMod_Nb[mylabelHisto][id.moduleNumber()+5]++;
00786 }
00787 }
00788
00789 }
00790
00791
00792 if (detector == GeomDetEnumerators::TIB ){
00793
00794 TIBDetId id = TIBDetId(detid);
00795
00796
00797
00798 if (id.moduleNumber() == 1 && id.isZMinusSide() == true){
00799
00800 if (id.isInternalString() == true && id.isStereo() == false) m_BinPhi[mylabelHisto].push_back(clustgp.phi());
00801 }
00802
00803
00804
00805 if ( (id.stringNumber() == 2 && id.isStereo() == false)
00806 || (id.stringNumber() == 1 && id.isStereo() == true)
00807 ){
00808 if (id.isZMinusSide() == true){
00809 if (id.isInternalString() == true){
00810 m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()-1] = m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()-1] + clustgp.eta();
00811 m_PhiStripMod_Nb[mylabelHisto][id.moduleNumber()-1]++;
00812 }
00813 if (id.isInternalString() == false){
00814 m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+2] = m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+2] + clustgp.eta();
00815 m_PhiStripMod_Nb[mylabelHisto][id.moduleNumber()+2]++;
00816 }
00817 }
00818 if (id.isZMinusSide() == false){
00819 if (id.isInternalString() == true){
00820 m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+5] = m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+5] + clustgp.eta();
00821 m_PhiStripMod_Nb[mylabelHisto][id.moduleNumber()+5]++;
00822 }
00823 if (id.isInternalString() == false){
00824 m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+8] = m_PhiStripMod_Eta[mylabelHisto][id.moduleNumber()+8] + clustgp.eta();
00825 m_PhiStripMod_Nb[mylabelHisto][id.moduleNumber()+8]++;
00826 }
00827 }
00828 }
00829
00830 }
00831
00832 }
00833 }
00834
00835 }
00836
00837
00838
00839 void
00840 SiStripMonitorMuonHLT::Normalizer (std::vector<DetId> Dets,const TrackerGeometry & theTracker){
00841
00842
00843 std::vector<std::string> v_LabelHisto;
00844
00845
00846
00847 for(std::vector<DetId>::iterator detid_iterator = Dets.begin(); detid_iterator!=Dets.end(); detid_iterator++){
00848 uint32_t detid = (*detid_iterator)();
00849
00850 if ( (*detid_iterator).null() == true) break;
00851 if (detid == 0) break;
00852
00853
00854 const GeomDetUnit * GeomDet = theTracker.idToDetUnit(detid);
00855 const GeomDet::SubDetector detector = GeomDet->subDetector();
00856
00857 int mylayer;
00858 std::string mylabelHisto;
00859
00860
00861 if (detector == GeomDetEnumerators::TEC
00862 || detector == GeomDetEnumerators::TID
00863 || detector == GeomDetEnumerators::TOB
00864 || detector == GeomDetEnumerators::TIB
00865 ){
00866
00867 const StripGeomDetUnit *theGeomDet = dynamic_cast < const StripGeomDetUnit * >(theTracker.idToDet (detid));
00868
00869
00870
00871 mylayer = tkdetmap_->FindLayer (detid);
00872 mylabelHisto = tkdetmap_->getLayerName (mylayer);
00873
00874
00875
00876
00877
00878
00879 unsigned int count = 0;
00880
00881 while (count < v_LabelHisto.size()){
00882 if (mylabelHisto == v_LabelHisto[count]) break;
00883 count++;
00884 }
00885
00886 if (count == v_LabelHisto.size()){
00887
00888 v_LabelHisto.push_back(mylabelHisto);
00889
00890
00891
00892 for (unsigned int i = 0; i < m_BinEta[mylabelHisto].size() -1; i++){
00893 m_ModNormEta[mylabelHisto].push_back(0.);
00894 }
00895
00896
00897 for (unsigned int i = 0; i < m_BinPhi[mylabelHisto].size() -1; i++){
00898 m_ModNormPhi[mylabelHisto].push_back(0.);
00899 }
00900 }
00901
00902
00903
00904
00905
00906
00907 LocalPoint clustlp(0.,0.);
00908 GlobalPoint clustgp = theGeomDet->surface ().toGlobal (clustlp);
00909
00910
00911
00912
00913
00914
00915 const BoundPlane& GeomDetSurface = GeomDet->surface();
00916 const Bounds& bound = GeomDetSurface.bounds();
00917
00918 std::string labelHisto_ID = mylabelHisto;
00919 labelHisto_ID.erase(3);
00920
00921 float length = 0.;
00922 float width = 0.;
00923
00924 std::vector <GlobalPoint> v_Edge_G;
00925
00926 float ratio = 0.;
00927 float factor = 1.;
00928
00929
00930 if (labelHisto_ID == "TOB" || labelHisto_ID == "TIB"){
00931 const RectangularPlaneBounds *rectangularBound = dynamic_cast < const RectangularPlaneBounds * >(& bound);
00932 length = rectangularBound->length();
00933 width = rectangularBound->width();
00934 ratio = width/length;
00935
00936
00937 LocalPoint topleft(-width/2., length/2.);
00938 LocalPoint topright(width/2., length/2.); LocalPoint botleft(-width/2., -length/2.);
00939 LocalPoint botright(width/2., -length/2.);
00940 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topleft));
00941 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topright));
00942 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botleft)); v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botright));
00943 }
00944
00945 if (labelHisto_ID == "TEC" || labelHisto_ID == "TID"){
00946 const TrapezoidalPlaneBounds *trapezoidalBound = dynamic_cast < const TrapezoidalPlaneBounds * >(& bound);
00947
00948 length = trapezoidalBound->length();
00949 width = trapezoidalBound->widthAtHalfLength();
00950
00951 ratio = width/length;
00952
00953
00954 LocalPoint topleft(-width/2., length/2.);
00955 LocalPoint topright(width/2., length/2.);
00956 LocalPoint botleft(-width/2., -length/2.);
00957 LocalPoint botright(width/2., -length/2.);
00958
00959 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topleft));
00960 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (topright));
00961 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botleft));
00962 v_Edge_G.push_back(theGeomDet->surface ().toGlobal (botright));
00963 }
00964
00965
00966 GlobalPoint top_left_G;
00967 GlobalPoint top_rightG;
00968 GlobalPoint bot_left_G;
00969 GlobalPoint bot_rightG;
00970
00971 std::vector <bool> v_Fill;
00972 v_Fill.push_back(false);
00973 v_Fill.push_back(false);
00974 v_Fill.push_back(false);
00975 v_Fill.push_back(false);
00976
00977 for (unsigned int i =0 ; i< v_Edge_G.size() ; i++){
00978 if (v_Edge_G[i].eta() < clustgp.eta()){
00979 if (v_Edge_G[i].phi() < clustgp.phi()) {
00980 bot_left_G = v_Edge_G[i];
00981 v_Fill[0] = true;
00982 }
00983 if (v_Edge_G[i].phi() > clustgp.phi()){
00984 top_left_G = v_Edge_G[i];
00985 v_Fill[1] = true;
00986 }
00987 }
00988 if (v_Edge_G[i].eta() > clustgp.eta()){
00989 if (v_Edge_G[i].phi() < clustgp.phi()){
00990 bot_rightG = v_Edge_G[i];
00991 v_Fill[2] = true;
00992 }
00993 if (v_Edge_G[i].phi() > clustgp.phi()){
00994 top_rightG = v_Edge_G[i];
00995 v_Fill[3] = true;
00996 }
00997 }
00998 }
00999
01000
01001
01002 float G_length = 0.;
01003 float G_width = 0.;
01004
01005 bool flag_border = false;
01006
01007 if (v_Fill[0] == true
01008 && v_Fill[1] == true
01009 && v_Fill[2] == true
01010 && v_Fill[3] == true){
01011
01012
01013 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()) );
01014
01015
01016 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()) );
01017
01018 }
01019 else {
01020
01021
01022 flag_border = true;
01023
01024
01025 for (unsigned int i =0 ; i< v_Edge_G.size() ; i++){
01026
01027 if (v_Edge_G[i].phi() > 0. ){
01028 if (v_Edge_G[i].eta() < clustgp.eta()){
01029 bot_left_G = v_Edge_G[i];
01030 }
01031 if (v_Edge_G[i].eta() > clustgp.eta()){
01032 bot_rightG = v_Edge_G[i];
01033 }
01034 }
01035 if (v_Edge_G[i].phi() < 0. ){
01036 if (v_Edge_G[i].eta() < clustgp.eta()){
01037 top_left_G = v_Edge_G[i];
01038 }
01039 if (v_Edge_G[i].eta() > clustgp.eta()){
01040 top_rightG = v_Edge_G[i];
01041 }
01042 }
01043 }
01044
01045
01046 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()) );
01047 G_width = G_length*ratio;
01048 }
01049
01050
01051
01052
01053 for (unsigned int i = 0; i < m_BinEta[mylabelHisto].size() - 1; i++){
01054 if (m_BinEta[mylabelHisto][i] <= clustgp.eta() && clustgp.eta() < m_BinEta[mylabelHisto][i+1]){
01055
01056
01057 m_ModNormEta[mylabelHisto][i] = m_ModNormEta[mylabelHisto][i] + factor*G_length*G_width;
01058
01059 }
01060 }
01061
01062
01063 unsigned int LastBinPhi = m_BinPhi[mylabelHisto].size() - 2;
01064 for (unsigned int i = 0; i < m_BinPhi[mylabelHisto].size() - 1; i++){
01065 if (m_BinPhi[mylabelHisto][i] <= clustgp.phi() && clustgp.phi() < m_BinPhi[mylabelHisto][i+1]){
01066
01067
01068
01069 float phiMin = std::min(bot_left_G.phi(),bot_rightG.phi());
01070 float phiMax = std::max(top_left_G.phi(),top_rightG.phi());
01071
01072 bool offlimit_prev = false;
01073 bool offlimit_foll = false;
01074
01075 if (phiMin < m_BinPhi[mylabelHisto][i]) offlimit_prev = true;
01076 if (i != LastBinPhi){
01077 if (phiMax > m_BinPhi[mylabelHisto][i+1]) offlimit_foll = true;
01078 }
01079
01080
01081 float MidPoint_X_prev;
01082 float MidPoint_Y_prev;
01083 float MidPoint_Z_prev;
01084 float MidPoint_X_foll;
01085 float MidPoint_Y_foll;
01086 float MidPoint_Z_foll;
01087
01088
01089 if (offlimit_prev){
01090
01091
01092 float tStar1 = (m_BinPhi[mylabelHisto][i]-bot_left_G.phi())/(top_left_G.phi()-bot_left_G.phi());
01093
01094
01095 float tStar2 = (m_BinPhi[mylabelHisto][i]-bot_rightG.phi())/(top_rightG.phi()-bot_rightG.phi());
01096
01097 if (tStar1 < 0.) tStar1 = 0.;
01098 if (tStar2 < 0.) tStar2 = 0.;
01099
01100
01101 float xStar1 = bot_left_G.x() + (tStar1*1.)*(top_left_G.x()-bot_left_G.x());
01102 float xStar2 = bot_rightG.x() + (tStar2*1.)*(top_rightG.x()-bot_rightG.x());
01103
01104 float yStar1 = bot_left_G.y() + (tStar1*1.)*(top_left_G.y()-bot_left_G.y());
01105 float yStar2 = bot_rightG.y() + (tStar2*1.)*(top_rightG.y()-bot_rightG.y());
01106
01107 float zStar1 = bot_left_G.z() + (tStar1*1.)*(top_left_G.z()-bot_left_G.z());
01108 float zStar2 = bot_rightG.z() + (tStar2*1.)*(top_rightG.z()-bot_rightG.z());
01109
01110
01111 MidPoint_X_prev = (xStar1 + xStar2)/2.;
01112 MidPoint_Y_prev = (yStar1 + yStar2)/2.;
01113 MidPoint_Z_prev = (zStar1 + zStar2)/2.;
01114 }
01115
01116 if (offlimit_prev == false){
01117 MidPoint_X_prev = (bot_left_G.x() + bot_rightG.x())/2.;
01118 MidPoint_Y_prev = (bot_left_G.y() + bot_rightG.y())/2.;
01119 MidPoint_Z_prev = (bot_left_G.z() + bot_rightG.z())/2.;
01120 }
01121
01122
01123 if (offlimit_foll){
01124
01125
01126 float tStar1 = (m_BinPhi[mylabelHisto][i+1]-bot_left_G.phi())/(top_left_G.phi()-bot_left_G.phi());
01127
01128
01129 float tStar2 = (m_BinPhi[mylabelHisto][i+1]-bot_rightG.phi())/(top_rightG.phi()-bot_rightG.phi());
01130
01131 if (tStar1 > 1.) tStar1 = 1.;
01132 if (tStar2 > 1.) tStar2 = 1.;
01133
01134
01135 float xStar1 = bot_left_G.x() + (tStar1*1.)*(top_left_G.x()-bot_left_G.x());
01136 float xStar2 = bot_rightG.x() + (tStar2*1.)*(top_rightG.x()-bot_rightG.x());
01137
01138 float yStar1 = bot_left_G.y() + (tStar1*1.)*(top_left_G.y()-bot_left_G.y());
01139 float yStar2 = bot_rightG.y() + (tStar2*1.)*(top_rightG.y()-bot_rightG.y());
01140
01141 float zStar1 = bot_left_G.z() + (tStar1*1.)*(top_left_G.z()-bot_left_G.z());
01142 float zStar2 = bot_rightG.z() + (tStar2*1.)*(top_rightG.z()-bot_rightG.z());
01143
01144
01145 MidPoint_X_foll = (xStar1 + xStar2)/2.;
01146 MidPoint_Y_foll = (yStar1 + yStar2)/2.;
01147 MidPoint_Z_foll = (zStar1 + zStar2)/2.;
01148 }
01149
01150 if (offlimit_foll == false){
01151 MidPoint_X_foll = (top_left_G.x() + top_rightG.x())/2.;
01152 MidPoint_Y_foll = (top_left_G.y() + top_rightG.y())/2.;
01153 MidPoint_Z_foll = (top_left_G.z() + top_rightG.z())/2.;
01154 }
01155
01156
01157 float EdgePoint_X_B = (bot_left_G.x() + bot_rightG.x())/2.;
01158 float EdgePoint_Y_B = (bot_left_G.y() + bot_rightG.y())/2.;
01159 float EdgePoint_Z_B = (bot_left_G.z() + bot_rightG.z())/2.;
01160
01161 float EdgePoint_X_T = (top_left_G.x() + top_rightG.x())/2.;
01162 float EdgePoint_Y_T = (top_left_G.y() + top_rightG.y())/2.;
01163 float EdgePoint_Z_T = (top_left_G.z() + top_rightG.z())/2.;
01164
01165 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) );
01166
01167
01168 if (flag_border){
01169
01170
01171 if (i != 0 && i != LastBinPhi){
01172 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_length*G_width;
01173 }
01174
01175
01176 if (i == 0 || i == LastBinPhi){
01177 float PhiBalance = 0.;
01178 if (clustgp.phi() > 0.) PhiBalance = clustgp.phi() - M_PI ;
01179 if (clustgp.phi() < 0.) PhiBalance = clustgp.phi() + M_PI ;
01180
01181
01182 float Phi_Width = m_BinPhi[mylabelHisto][3] - m_BinPhi[mylabelHisto][2];
01183
01184 float weight_FirstBin = (1.+ (PhiBalance/(Phi_Width/2.)))/2. ;
01185 float weight_LastBin = fabs(1. - weight_FirstBin);
01186
01187 m_ModNormPhi[mylabelHisto][0] = m_ModNormPhi[mylabelHisto][0] + weight_FirstBin*(factor*G_length*G_width);
01188 m_ModNormPhi[mylabelHisto][LastBinPhi] = m_ModNormPhi[mylabelHisto][LastBinPhi] + weight_LastBin*(factor*G_length*G_width);
01189 }
01190 }
01191
01192 if (flag_border == false){
01193
01194
01195 if (offlimit_prev == false && offlimit_foll == false){
01196 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_length*G_width;
01197 }
01198
01199
01200 if ((offlimit_prev == true && offlimit_foll == false)
01201 ||(offlimit_prev == false && offlimit_foll == true) ){
01202 float G_width_Out = fabs(G_width - G_width_Ins);
01203
01204
01205 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_width_Ins*G_length;
01206
01207
01208 if (offlimit_prev && i != 0) m_ModNormPhi[mylabelHisto][i-1] = m_ModNormPhi[mylabelHisto][i-1] + factor*G_width_Out*G_length;
01209 if (offlimit_foll && i != LastBinPhi) m_ModNormPhi[mylabelHisto][i+1] = m_ModNormPhi[mylabelHisto][i+1] + factor*G_width_Out*G_length;
01210 }
01211
01212
01213 if (offlimit_prev == true && offlimit_foll == true){
01214
01215
01216 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) );
01217 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) );
01218
01219
01220 if (i != 0 && i != LastBinPhi){
01221
01222 m_ModNormPhi[mylabelHisto][i] = m_ModNormPhi[mylabelHisto][i] + factor*G_width_Ins*G_length;
01223
01224
01225 if (i != 0) m_ModNormPhi[mylabelHisto][i-1] = m_ModNormPhi[mylabelHisto][i-1] + factor*G_width_B*G_length;
01226 if (i != LastBinPhi) m_ModNormPhi[mylabelHisto][i+1] = m_ModNormPhi[mylabelHisto][i+1] + factor*G_width_T*G_length;
01227 }
01228
01229 }
01230 }
01231 }
01232 }
01233
01234 }
01235
01236 }
01237
01238
01239 if (printNormalize_) {
01240 TFile output("MuonHLTDQMNormalization.root","recreate");
01241 output.cd();
01242 PrintNormalization(v_LabelHisto);
01243 output.Close();
01244 }
01245
01246 }
01247
01248
01249
01250 void
01251 SiStripMonitorMuonHLT::PrintNormalization (std::vector<std::string> v_LabelHisto)
01252 {
01253 std::vector <TH1F *> h_ModNorm_Eta;
01254 std::vector <TH1F *> h_ModNorm_Phi;
01255
01256 for (unsigned int p = 0; p < v_LabelHisto.size(); p++){
01257
01258 std::string titleHistoEta = v_LabelHisto[p] + "_eta" ;
01259 std::string titleHistoPhi = v_LabelHisto[p] + "_phi" ;
01260
01261 std::string labelHisto = v_LabelHisto[p];
01262
01263 float * xbinsPhi = new float[100];
01264 float * xbinsEta = new float[100];
01265
01266
01267 unsigned int sizePhi = m_BinPhi[labelHisto].size();
01268 for (unsigned int i = 0; i < sizePhi; i++){
01269 xbinsPhi[i] = m_BinPhi[labelHisto][i];
01270 }
01271
01272 unsigned int sizeEta = m_BinEta[labelHisto].size();
01273 for (unsigned int i = 0; i < sizeEta; i++){
01274 xbinsEta[i] = m_BinEta[labelHisto][i];
01275 }
01276
01277 h_ModNorm_Eta.push_back(new TH1F (titleHistoEta.c_str(),titleHistoEta.c_str(),sizeEta - 1,xbinsEta));
01278 h_ModNorm_Phi.push_back(new TH1F (titleHistoPhi.c_str(),titleHistoPhi.c_str(),sizePhi - 1,xbinsPhi));
01279
01280 for (unsigned int i = 0; i < m_ModNormEta[labelHisto].size(); i++){
01281 (*h_ModNorm_Eta[p]).SetBinContent(i+1,m_ModNormEta[labelHisto][i]);
01282 }
01283 for (unsigned int i = 0; i < m_ModNormPhi[labelHisto].size(); i++){
01284 (*h_ModNorm_Phi[p]).SetBinContent(i+1,m_ModNormPhi[labelHisto][i]);
01285 }
01286
01287 (*h_ModNorm_Eta[p]).Write();
01288 (*h_ModNorm_Phi[p]).Write();
01289 }
01290
01291 }
01292
01293
01294
01295 void
01296 SiStripMonitorMuonHLT::beginRun (const edm::Run& run, const edm::EventSetup & es)
01297 {
01298 if (dbe_)
01299 {
01300 if (monitorName_ != "")
01301 monitorName_ = monitorName_ + "/";
01302 edm::LogInfo ("HLTMuonDQMSource") << "===>DQM event prescale = " << prescaleEvt_ << " events " << std::endl;
01303 createMEs (es);
01304
01305 if(runOnClusters_)
01306 tkmapAllClusters = new TkHistoMap("HLT/HLTMonMuon/SiStrip" ,"TkHMap_AllClusters",0.0,0);
01307 if(runOnTracks_)
01308 tkmapOnTrackClusters = new TkHistoMap("HLT/HLTMonMuon/SiStrip" ,"TkHMap_OnTrackClusters",0.0,0);
01309 if(runOnMuonCandidates_)
01310 tkmapL3MuTrackClusters = new TkHistoMap("HLT/HLTMonMuon/SiStrip" ,"TkHMap_L3MuTrackClusters",0.0,0);
01311 }
01312 }
01313
01314
01315 void
01316 SiStripMonitorMuonHLT::endJob ()
01317 {
01318 edm::LogInfo ("SiStripMonitorHLTMuon") << "analyzed " << counterEvt_ << " events";
01319 return;
01320 }
01321
01322 DEFINE_FWK_MODULE(SiStripMonitorMuonHLT);