![]() |
![]() |
#include <DQM/DTMonitorModule/src/DTChamberEfficiency.h>
This class provides the histograms for the calculation of the efficiency of muons reconstruction in the DTs. It is applicable both in presence or absence of a magnetic field. Histos are 2D Sector vs Chamber plots for each wheel
Modification:
Definition at line 54 of file DTChamberEfficiency.h.
DTChamberEfficiency::DTChamberEfficiency | ( | const edm::ParameterSet & | pset | ) |
Definition at line 42 of file DTChamberEfficiency.cc.
References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), labelRPCRecHits, MuonServiceProxy_cff::MuonServiceProxy, DQMStore::setCurrentFolder(), thecscSegments, theDbe, thedt4DSegments, theEstimator, theMaxChi2, theMeasurementExtractor, theMinNrec, theNavigationType, theNSigma, theService, and theTracksLabel.
00043 { 00044 00045 // Get the debug parameter for verbose output 00046 debug = pSet.getUntrackedParameter<bool>("debug","false"); 00047 00048 if(debug) LogVerbatim("DTDQM|DTMonitorModule|DTChamberEfficiency") 00049 << "DTChamberEfficiency: constructor called"; 00050 00051 // Get the DQM needed services 00052 theDbe = Service<DQMStore>().operator->(); 00053 theDbe->setCurrentFolder("DT/05-ChamberEff/Task"); 00054 00055 // service parameters 00056 ParameterSet serviceParameters = pSet.getParameter<ParameterSet>("ServiceParameters"); 00057 theService = new MuonServiceProxy(serviceParameters); 00058 00059 theTracksLabel = pSet.getParameter<InputTag>("TrackCollection"); 00060 00061 theMaxChi2 = static_cast<unsigned int>(pSet.getParameter<double>("theMaxChi2")); 00062 theNSigma = pSet.getParameter<double>("theNSigma"); 00063 theMinNrec = static_cast<int>(pSet.getParameter<double>("theMinNrec")); 00064 00065 labelRPCRecHits = pSet.getParameter<InputTag>("theRPCRecHits"); 00066 00067 thedt4DSegments = pSet.getParameter<InputTag>("dt4DSegments"); 00068 thecscSegments = pSet.getParameter<InputTag>("cscSegments"); 00069 00070 theMeasurementExtractor = new MuonDetLayerMeasurements(thedt4DSegments,thecscSegments, 00071 labelRPCRecHits,true,false,false); 00072 00073 theNavigationType = pSet.getParameter<string>("NavigationType"); 00074 00075 theEstimator = new Chi2MeasurementEstimator(theMaxChi2,theNSigma); 00076 }
DTChamberEfficiency::~DTChamberEfficiency | ( | ) |
Definition at line 79 of file DTChamberEfficiency.cc.
References debug.
00080 { 00081 if(debug) LogVerbatim("DTDQM|DTMonitorModule|DTChamberEfficiency") 00082 << "DTChamberEfficiency: destructor called"; 00083 }
void DTChamberEfficiency::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 145 of file DTChamberEfficiency.cc.
References alongMomentum, chamberSelection(), compatibleLayers(), debug, lat::endl(), combine::histos, histosPerW, i, int, edm::Handle< T >::isValid(), TrajectoryStateOnSurface::isValid(), magfield, MuonDetLayerMeasurements::measurements(), edm::ESHandle< T >::product(), propagator(), DTChamberId::sector(), segQualityCut(), MuonDetLayerMeasurements::setEvent(), DTChamberId::station(), TrajectoryStateOnSurface::surface(), theEstimator, theMeasurementExtractor, theMinNrec, theService, theTrackingGeometry, theTracksLabel, track, tracks, and DTChamberId::wheel().
00147 { 00148 00149 if (debug) LogVerbatim("DTDQM|DTMonitorModule|DTChamberEfficiency") << 00150 "--- [DTChamberEfficiency] Event analysed #Run: " << 00151 event.id().run() << " #Event: " << event.id().event() << endl; 00152 00153 theService->update(eventSetup); 00154 theMeasurementExtractor->setEvent(event); 00155 00156 //Read tracks from event 00157 Handle<reco::TrackCollection> tracks; 00158 event.getByLabel(theTracksLabel, tracks); 00159 00160 if(tracks.isValid()) { // check the validity of the collection 00161 00162 //loop over the muons 00163 for(reco::TrackCollection::const_iterator track = tracks->begin(); track!=tracks->end(); ++track) { 00164 00165 reco::TransientTrack trans_track(*track,magfield.product(),theTrackingGeometry); 00166 const int recHitsize = (int)trans_track.recHitsSize(); 00167 if(recHitsize < theMinNrec) continue; 00168 00169 // Get the layer on which the seed relies 00170 DetId id = trans_track.recHit(recHitsize-1)->geographicalId(); 00171 const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer(id); 00172 00173 TrajectoryStateOnSurface init_fs = trans_track.innermostMeasurementState(); 00174 FreeTrajectoryState *init_fs_free = trans_track.innermostMeasurementState().freeState(); 00175 00176 //get the list of compatible layers 00177 vector<const DetLayer*> layer_list = compatibleLayers(initialLayer,*init_fs_free,alongMomentum); 00178 00179 //loop over the list of compatible layers 00180 for(int i=0;i< (int)layer_list.size();i++){ 00181 00182 //propagate the track to the i-th layer 00183 TrajectoryStateOnSurface tsos = propagator()->propagate(init_fs,layer_list.at(i)->surface()); 00184 if(!tsos.isValid()) continue; 00185 00186 //determine the chambers kinematically compatible with the track on the i-th layer 00187 vector<DetWithState> dss = layer_list.at(i)->compatibleDets(tsos, *propagator(), *theEstimator); 00188 00189 for(vector<DetWithState>::const_iterator detWithStateItr = dss.begin(); 00190 detWithStateItr != dss.end(); ++detWithStateItr){ 00191 00192 const DetId idDetLay = detWithStateItr->first->geographicalId(); 00193 00194 if(!chamberSelection(idDetLay,trans_track)) continue; 00195 00196 DTChamberId DTid = (DTChamberId) idDetLay; 00197 00198 MeasurementContainer detMeasurements_initial = theMeasurementExtractor->measurements(layer_list.at(i), 00199 detWithStateItr->first, 00200 detWithStateItr->second, 00201 *theEstimator, event); 00202 00203 //we want to be more picky about the quality of the segments: 00204 //exclude the segments with less than 12 hits 00205 MeasurementContainer detMeasurements = segQualityCut(detMeasurements_initial); 00206 00207 vector<MonitorElement *> histos = histosPerW[DTid.wheel()+2]; 00208 00209 if (detMeasurements_initial.size() != 0) histos[0]->Fill(DTid.sector(),DTid.station(),1.); 00210 if (detMeasurements.size() != 0) histos[1]->Fill(DTid.sector(),DTid.station(),1.); 00211 histos[2]->Fill(DTid.sector(),DTid.station(),1.); 00212 } 00213 00214 } 00215 } 00216 } else { 00217 LogInfo("DTDQM|DTMonitorModule|DTChamberEfficiency") << "[DTChamberEfficiency] Collection: " << theTracksLabel 00218 << " is not valid!" << endl; 00219 } 00220 return; 00221 }
void DTChamberEfficiency::beginJob | ( | const edm::EventSetup & | eventSetup | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 85 of file DTChamberEfficiency.cc.
References bookHistos(), and debug.
00085 { 00086 00087 if(debug) LogVerbatim("DTDQM|DTMonitorModule|DTChamberEfficiency") 00088 << "DTChamberEfficiency: beginOfJob"; 00089 00090 bookHistos(); 00091 00092 return; 00093 }
void DTChamberEfficiency::beginRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | setup | |||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 95 of file DTChamberEfficiency.cc.
References dtGeom, edm::EventSetup::get(), magfield, and theTrackingGeometry.
00096 { 00097 // Get the DT Geometry 00098 setup.get<MuonGeometryRecord>().get(dtGeom); 00099 00100 setup.get<IdealMagneticFieldRecord>().get(magfield); 00101 setup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry); 00102 00103 return; 00104 }
void DTChamberEfficiency::bookHistos | ( | ) | [private] |
Definition at line 115 of file DTChamberEfficiency.cc.
References DQMStore::book2D(), debug, combine::histos, histosPerW, DQMStore::setCurrentFolder(), theDbe, and muonGeometry::wheel.
Referenced by beginJob().
00116 { 00117 if(debug) LogVerbatim("DTDQM|DTMonitorModule|DTChamberEfficiency") 00118 << "DTChamberEfficiency: booking histos"; 00119 00120 // Create the monitor elements 00121 theDbe->setCurrentFolder("DT/05-ChamberEff/Task"); 00122 00123 for(int wheel=-2;wheel<=2;wheel++){ 00124 00125 vector<MonitorElement *> histos; 00126 00127 stringstream wheel_str; wheel_str << wheel; 00128 00129 histos.push_back(theDbe->book2D("hCountSectVsChamb_All_W"+ wheel_str.str(), 00130 "Countings for wheel " + wheel_str.str(),14,1.,15.,4,1.,5.)); 00131 00132 histos.push_back(theDbe->book2D("hCountSectVsChamb_Qual_W"+ wheel_str.str(), 00133 "Countings for wheel " + wheel_str.str(),14,1.,15.,4,1.,5.)); 00134 00135 00136 histos.push_back(theDbe->book2D("hExtrapSectVsChamb_W"+ wheel_str.str(), 00137 "Extrapolations for wheel " + wheel_str.str(),14,1.,15.,4,1.,5.)); 00138 00139 histosPerW.push_back(histos); 00140 } 00141 00142 return; 00143 }
bool DTChamberEfficiency::chamberSelection | ( | const DetId & | idDetLay, | |
reco::TransientTrack & | trans_track | |||
) | const [private] |
Definition at line 223 of file DTChamberEfficiency.cc.
References DetId::det(), MuonSubdetId::DT, DetId::Muon, reco::TransientTrack::recHit(), reco::TransientTrack::recHitsSize(), and DetId::subdetId().
Referenced by analyze().
00224 { 00225 //check that we have a muon and that is a DT detector 00226 if(!(idDetLay.det() == DetId::Muon && idDetLay.subdetId() == MuonSubdetId::DT)) return false; 00227 00228 if(trans_track.recHitsSize() == 2) 00229 if(trans_track.recHit(0)->geographicalId() == idDetLay || 00230 trans_track.recHit(1)->geographicalId() == idDetLay) return false; 00231 00232 return true; 00233 }
vector< const DetLayer * > DTChamberEfficiency::compatibleLayers | ( | const DetLayer * | initialLayer, | |
const FreeTrajectoryState & | fts, | |||
PropagationDirection | propDir | |||
) | [private] |
Definition at line 265 of file DTChamberEfficiency.cc.
References DetLayer::compatibleLayers(), lat::endl(), theNavigationType, and theService.
Referenced by analyze().
00267 { 00268 00269 vector<const DetLayer*> detLayers; 00270 00271 if(theNavigationType == "Standard"){ 00272 // ask for compatible layers 00273 detLayers = initialLayer->compatibleLayers(fts,propDir); 00274 // I have to fit by hand the first layer until the seedTSOS is defined on the first rechit layer 00275 // In fact the first layer is not returned by initialLayer->compatibleLayers. 00276 detLayers.insert(detLayers.begin(),initialLayer); 00277 } 00278 else if (theNavigationType == "Direct"){ 00279 00280 DirectMuonNavigation navigation(&*theService->detLayerGeometry()); 00281 detLayers = navigation.compatibleLayers(fts,propDir); 00282 } 00283 else 00284 LogError("Muon|RecoMuon|StandAloneMuonFilter") << "No Properly Navigation Selected!!"<<endl; 00285 00286 return detLayers; 00287 }
Reimplemented from edm::EDAnalyzer.
Definition at line 106 of file DTChamberEfficiency.cc.
References debug.
00107 { 00108 if(debug) LogVerbatim("DTDQM|DTMonitorModule|DTChamberEfficiency") 00109 << "DTChamberEfficiency: endOfJob"; 00110 00111 return; 00112 }
ESHandle< Propagator > DTChamberEfficiency::propagator | ( | void | ) | const [inline, private] |
Definition at line 289 of file DTChamberEfficiency.cc.
References theService.
Referenced by analyze().
00289 { 00290 return theService->propagator("SteppingHelixPropagatorAny"); 00291 }
MeasurementContainer DTChamberEfficiency::segQualityCut | ( | const MeasurementContainer | seg_list | ) | const [private] |
Definition at line 237 of file DTChamberEfficiency.cc.
References int, HLT_VtxMuL3::result, and DTChamberId::station().
Referenced by analyze().
00238 { 00239 00240 MeasurementContainer result; 00241 00242 for(MeasurementContainer::const_iterator mescont_Itr = seg_list.begin(); 00243 mescont_Itr != seg_list.end(); ++mescont_Itr){ 00244 00245 //get the rechits of the segment 00246 TransientTrackingRecHit::ConstRecHitContainer recHit_list = mescont_Itr->recHit()->transientHits(); 00247 00248 //loop over the rechits and get the number of hits 00249 int nhit_seg(0); 00250 for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator recList_Itr = recHit_list.begin(); 00251 recList_Itr != recHit_list.end(); ++recList_Itr){ 00252 00253 nhit_seg += (int)(*recList_Itr)->transientHits().size(); 00254 } 00255 00256 DTChamberId tmpId = (DTChamberId)mescont_Itr->recHit()->hit()->geographicalId(); 00257 00258 if(tmpId.station() < 4 && nhit_seg >= 12) result.push_back(*mescont_Itr); 00259 if(tmpId.station() == 4 && nhit_seg >= 8) result.push_back(*mescont_Itr); 00260 } 00261 00262 return result; 00263 }
bool DTChamberEfficiency::debug [private] |
Definition at line 83 of file DTChamberEfficiency.h.
Referenced by analyze(), beginJob(), bookHistos(), DTChamberEfficiency(), endJob(), and ~DTChamberEfficiency().
edm::ESHandle<DTGeometry> DTChamberEfficiency::dtGeom [private] |
std::vector<std::vector<MonitorElement*> > DTChamberEfficiency::histosPerW [private] |
DQMStore* DTChamberEfficiency::theDbe [private] |
Definition at line 99 of file DTChamberEfficiency.h.
Referenced by bookHistos(), and DTChamberEfficiency().
Definition at line 103 of file DTChamberEfficiency.h.
Referenced by analyze(), and DTChamberEfficiency().
double DTChamberEfficiency::theMaxChi2 [private] |
Definition at line 102 of file DTChamberEfficiency.h.
Referenced by analyze(), and DTChamberEfficiency().
int DTChamberEfficiency::theMinNrec [private] |
Definition at line 93 of file DTChamberEfficiency.h.
Referenced by analyze(), and DTChamberEfficiency().
std::string DTChamberEfficiency::theNavigationType [private] |
Definition at line 95 of file DTChamberEfficiency.h.
Referenced by compatibleLayers(), and DTChamberEfficiency().
double DTChamberEfficiency::theNSigma [private] |
MuonServiceProxy* DTChamberEfficiency::theService [private] |
Definition at line 101 of file DTChamberEfficiency.h.
Referenced by analyze(), compatibleLayers(), DTChamberEfficiency(), and propagator().
Definition at line 85 of file DTChamberEfficiency.h.
Referenced by analyze(), and DTChamberEfficiency().