CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTChamberEfficiency Class Reference

#include <DTChamberEfficiency.h>

Inheritance diagram for DTChamberEfficiency:
edm::EDAnalyzer

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
void beginJob ()
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
 DTChamberEfficiency (const edm::ParameterSet &pset)
 
void endJob ()
 
 ~DTChamberEfficiency ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void bookHistos ()
 
bool chamberSelection (const DetId &idDetLay, reco::TransientTrack &trans_track) const
 
std::vector< const DetLayer * > compatibleLayers (const DetLayer *initialLayer, const FreeTrajectoryState &fts, PropagationDirection propDir)
 
edm::ESHandle< Propagatorpropagator () const
 
MeasurementContainer segQualityCut (const MeasurementContainer seg_list) const
 

Private Attributes

bool debug
 
edm::ESHandle< DTGeometrydtGeom
 
std::vector< std::vector
< MonitorElement * > > 
histosPerW
 
edm::InputTag labelRPCRecHits
 
edm::ESHandle< MagneticFieldmagfield
 
edm::InputTag thecscSegments
 
DQMStoretheDbe
 
edm::InputTag thedt4DSegments
 
Chi2MeasurementEstimatortheEstimator
 
double theMaxChi2
 
MuonDetLayerMeasurementstheMeasurementExtractor
 
int theMinNrec
 
std::string theNavigationType
 
double theNSigma
 
MuonServiceProxytheService
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 
edm::InputTag theTracksLabel
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description:

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

Author
: Mario Pelliccioni - INFN Torino pelli.nosp@m.cci@.nosp@m.cern..nosp@m.ch $date : 05/12/2008 16:51:04 CET $

Modification:

Definition at line 54 of file DTChamberEfficiency.h.

Constructor & Destructor Documentation

DTChamberEfficiency::DTChamberEfficiency ( const edm::ParameterSet pset)

Definition at line 57 of file DTChamberEfficiency.cc.

References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuonServiceProxy_cff::MuonServiceProxy, cppFunctionSkipper::operator, and createJobs::theNSigma.

58 {
59  // Get the debug parameter for verbose output
60  debug = pSet.getUntrackedParameter<bool>("debug",false);
61 
62  LogVerbatim("DTDQM|DTMonitorModule|DTChamberEfficiency")
63  << "DTChamberEfficiency: constructor called";
64 
65  // Get the DQM needed services
67  theDbe->setCurrentFolder("DT/05-ChamberEff/Task");
68 
69  // service parameters
70  ParameterSet serviceParameters = pSet.getParameter<ParameterSet>("ServiceParameters");
71  theService = new MuonServiceProxy(serviceParameters);
72 
73  theTracksLabel = pSet.getParameter<InputTag>("TrackCollection");
74 
75  theMaxChi2 = static_cast<unsigned int>(pSet.getParameter<double>("theMaxChi2"));
76  theNSigma = pSet.getParameter<double>("theNSigma");
77  theMinNrec = static_cast<int>(pSet.getParameter<double>("theMinNrec"));
78 
79  labelRPCRecHits = pSet.getParameter<InputTag>("theRPCRecHits");
80 
81  thedt4DSegments = pSet.getParameter<InputTag>("dt4DSegments");
82  thecscSegments = pSet.getParameter<InputTag>("cscSegments");
83 
84  theMeasurementExtractor = new MuonDetLayerMeasurements(thedt4DSegments,thecscSegments,
85  labelRPCRecHits,true,false,false);
86 
87  theNavigationType = pSet.getParameter<string>("NavigationType");
88 
90 }
MuonDetLayerMeasurements * theMeasurementExtractor
T getParameter(std::string const &) const
MuonServiceProxy * theService
edm::InputTag thecscSegments
edm::InputTag labelRPCRecHits
edm::InputTag thedt4DSegments
edm::InputTag theTracksLabel
Chi2MeasurementEstimator * theEstimator
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
DTChamberEfficiency::~DTChamberEfficiency ( )

Definition at line 93 of file DTChamberEfficiency.cc.

References LogTrace.

94 {
95  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency")
96  << "DTChamberEfficiency: destructor called";
97 
98  // free memory
99  delete theService;
101  delete theEstimator;
102 }
MuonDetLayerMeasurements * theMeasurementExtractor
MuonServiceProxy * theService
#define LogTrace(id)
Chi2MeasurementEstimator * theEstimator

Member Function Documentation

void DTChamberEfficiency::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 164 of file DTChamberEfficiency.cc.

References alongMomentum, debug, DetId::det(), MuonSubdetId::DT, DTChamberId, event(), HcalObjRepresent::Fill(), TrajectoryStateOnSurface::freeState(), mergeVDriftHistosByStation::histos, i, TrajectoryStateOnSurface::isValid(), LogTrace, HLT_ES_cff::magfield, DetId::Muon, oppositeToMomentum, LargeD0_PixelPairStep_cff::propagator, DetId::rawId(), reco::TransientTrack::recHitsSize(), DTChamberId::sector(), DTChamberId::station(), DetId::subdetId(), TrajectoryStateOnSurface::surface(), testEve_cfg::tracks, and DTChamberId::wheel().

166 {
167 
168  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency") <<
169  "--- [DTChamberEfficiency] Event analysed #Run: " <<
170  event.id().run() << " #Event: " << event.id().event() << endl;
171 
172  theService->update(eventSetup);
174  // set navigation school
175  NavigationSetter setter(*theService->muonNavigationSchool());
176 
177  //Read tracks from event
179  event.getByLabel(theTracksLabel, tracks);
180 
181  if(tracks.isValid()) { // check the validity of the collection
182 
183  //loop over the muons
184  for(reco::TrackCollection::const_iterator track = tracks->begin(); track!=tracks->end(); ++track) {
185 
186 
188  const int recHitsize = (int)trans_track.recHitsSize();
189  if(recHitsize < theMinNrec) continue;
190 
191  // printout the DT rechits used by the track
192  if (debug) {
193  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency") << "--- New track" << endl;
194  set<DTChamberId> chAlrUsed;
195  for(trackingRecHit_iterator rHit = trans_track.recHitsBegin();
196  rHit != trans_track.recHitsEnd(); ++rHit) {
197  DetId rHitid = (*rHit)->geographicalId();
198  if(!(rHitid.det() == DetId::Muon && rHitid.subdetId() == MuonSubdetId::DT)) continue;
199  DTChamberId wId(rHitid.rawId());
200  if(chAlrUsed.find(wId) != chAlrUsed.end()) continue;
201  chAlrUsed.insert(wId);
202  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency") << " " << wId << endl;
203  }
204  }
205 
206  // Get the layer on which the seed relies
207  DetId id = trans_track.track().innerDetId();
208  const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer(id);
209 
210  TrajectoryStateOnSurface init_fs = trans_track.innermostMeasurementState();
211  FreeTrajectoryState *init_fs_free = init_fs.freeState();
212 
213  //get the list of compatible layers
214  vector<const DetLayer*> layer_list = compatibleLayers(initialLayer,*init_fs_free,alongMomentum);
215  vector<const DetLayer*> layer_list_2 = compatibleLayers(initialLayer,*init_fs_free,oppositeToMomentum);
216 
217  layer_list.insert(layer_list.end(),layer_list_2.begin(),layer_list_2.end());
218 
219  set<DTChamberId> alreadyCheckedCh;
220 
221  //loop over the list of compatible layers
222  for(int i=0;i< (int)layer_list.size();i++) {
223 
224  //propagate the track to the i-th layer
225  TrajectoryStateOnSurface tsos = propagator()->propagate(init_fs,layer_list.at(i)->surface());
226  if(!tsos.isValid()) continue;
227 
228  //determine the chambers kinematically compatible with the track on the i-th layer
229  vector<DetWithState> dss = layer_list.at(i)->compatibleDets(tsos, *propagator(), *theEstimator);
230 
231  if(dss.size() == 0) continue;
232 
233  // get the first det (it's the most compatible)
234  const DetWithState detWithState = dss.front();
235  const DetId idDetLay = detWithState.first->geographicalId();
236 
237  // check if this is a DT and the track has the needed quality
238  if(!chamberSelection(idDetLay,trans_track)) continue;
239 
240  DTChamberId DTid = (DTChamberId) idDetLay;
241 
242  // check if the chamber has already been counted
243  if(alreadyCheckedCh.find(DTid) != alreadyCheckedCh.end()) continue;
244  alreadyCheckedCh.insert(DTid);
245 
246  // get the compatible measurements
247  MeasurementContainer detMeasurements_initial = theMeasurementExtractor->measurements(layer_list.at(i),
248  detWithState.first,
249  detWithState.second,
250  *theEstimator, event);
251  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency") << " chamber: " << DTid
252  << " has: " << detMeasurements_initial.size() << " comp. meas." << endl;
253 
254 
255  //we want to be more picky about the quality of the segments:
256  //exclude the segments with less than 12 hits
257  MeasurementContainer detMeasurements = segQualityCut(detMeasurements_initial);
258 
259  // get the histos for this chamber
260  vector<MonitorElement *> histos = histosPerW[DTid.wheel()+2];
261  // fill them
262  if (detMeasurements_initial.size() != 0) histos[0]->Fill(DTid.sector(),DTid.station(),1.);
263  if (detMeasurements.size() != 0) histos[1]->Fill(DTid.sector(),DTid.station(),1.);
264  histos[2]->Fill(DTid.sector(),DTid.station(),1.);
265 
266 
267  }
268  }
269  } else {
270  LogInfo("DTDQM|DTMonitorModule|DTChamberEfficiency") << "[DTChamberEfficiency] Collection: " << theTracksLabel
271  << " is not valid!" << endl;
272  }
273  return;
274 }
MuonDetLayerMeasurements * theMeasurementExtractor
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
int i
Definition: DBlmapReader.cc:9
MuonServiceProxy * theService
std::vector< std::vector< MonitorElement * > > histosPerW
size_t recHitsSize() const
number of RecHits
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::vector< const DetLayer * > compatibleLayers(const DetLayer *initialLayer, const FreeTrajectoryState &fts, PropagationDirection propDir)
bool chamberSelection(const DetId &idDetLay, reco::TransientTrack &trans_track) const
edm::ESHandle< Propagator > propagator() const
FreeTrajectoryState * freeState(bool withErrors=true) const
edm::InputTag theTracksLabel
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
MeasurementContainer measurements(const DetLayer *layer, const GeomDet *det, const TrajectoryStateOnSurface &stateOnDet, const MeasurementEstimator &est, const edm::Event &iEvent)
edm::ESHandle< MagneticField > magfield
#define LogTrace(id)
MeasurementContainer segQualityCut(const MeasurementContainer seg_list) const
Definition: DetId.h:20
tuple tracks
Definition: testEve_cfg.py:39
std::vector< TrajectoryMeasurement > MeasurementContainer
T const * product() const
Definition: ESHandle.h:62
void setEvent(const edm::Event &)
set event
int sector() const
Definition: DTChamberId.h:63
const Surface & surface() const
Chi2MeasurementEstimator * theEstimator
static const int DT
Definition: MuonSubdetId.h:14
int station() const
Return the station number.
Definition: DTChamberId.h:53
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
void DTChamberEfficiency::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 104 of file DTChamberEfficiency.cc.

References bookHistos(), and LogTrace.

104  {
105 
106  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency")
107  << "DTChamberEfficiency: beginOfJob";
108 
109  bookHistos();
110 
111  return;
112 }
#define LogTrace(id)
void DTChamberEfficiency::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 114 of file DTChamberEfficiency.cc.

References edm::EventSetup::get(), and HLT_ES_cff::magfield.

115 {
116  // Get the DT Geometry
117  setup.get<MuonGeometryRecord>().get(dtGeom);
118 
119  setup.get<IdealMagneticFieldRecord>().get(magfield);
121 
122  return;
123 }
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
edm::ESHandle< DTGeometry > dtGeom
edm::ESHandle< MagneticField > magfield
const T & get() const
Definition: EventSetup.h:55
void DTChamberEfficiency::bookHistos ( )
private

Definition at line 134 of file DTChamberEfficiency.cc.

References mergeVDriftHistosByStation::histos, and LogTrace.

135 {
136  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency")
137  << "DTChamberEfficiency: booking histos";
138 
139  // Create the monitor elements
140  theDbe->setCurrentFolder("DT/05-ChamberEff/Task");
141 
142  for(int wheel=-2;wheel<=2;wheel++){
143 
144  vector<MonitorElement *> histos;
145 
146  stringstream wheel_str; wheel_str << wheel;
147 
148  histos.push_back(theDbe->book2D("hCountSectVsChamb_All_W"+ wheel_str.str(),
149  "Countings for wheel " + wheel_str.str(),14,1.,15.,4,1.,5.));
150 
151  histos.push_back(theDbe->book2D("hCountSectVsChamb_Qual_W"+ wheel_str.str(),
152  "Countings for wheel " + wheel_str.str(),14,1.,15.,4,1.,5.));
153 
154 
155  histos.push_back(theDbe->book2D("hExtrapSectVsChamb_W"+ wheel_str.str(),
156  "Extrapolations for wheel " + wheel_str.str(),14,1.,15.,4,1.,5.));
157 
158  histosPerW.push_back(histos);
159  }
160 
161  return;
162 }
std::vector< std::vector< MonitorElement * > > histosPerW
#define LogTrace(id)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
bool DTChamberEfficiency::chamberSelection ( const DetId idDetLay,
reco::TransientTrack trans_track 
) const
private

Definition at line 276 of file DTChamberEfficiency.cc.

References DetId::det(), MuonSubdetId::DT, DetId::Muon, reco::TransientTrack::recHit(), reco::TransientTrack::recHitsSize(), and DetId::subdetId().

277 {
278  //check that we have a muon and that is a DT detector
279  if(!(idDetLay.det() == DetId::Muon && idDetLay.subdetId() == MuonSubdetId::DT)) return false;
280 
281  if(trans_track.recHitsSize() == 2)
282  if(trans_track.recHit(0)->geographicalId() == idDetLay ||
283  trans_track.recHit(1)->geographicalId() == idDetLay) return false;
284 
285  return true;
286 }
size_t recHitsSize() const
number of RecHits
TrackingRecHitRef recHit(size_t i) const
get n-th recHit
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
static const int DT
Definition: MuonSubdetId.h:14
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
vector< const DetLayer * > DTChamberEfficiency::compatibleLayers ( const DetLayer initialLayer,
const FreeTrajectoryState fts,
PropagationDirection  propDir 
)
private

Definition at line 318 of file DTChamberEfficiency.cc.

References DirectMuonNavigation::compatibleLayers(), and DetLayer::compatibleLayers().

320 {
321 
322 vector<const DetLayer*> detLayers;
323 
324 if(theNavigationType == "Standard"){
325  // ask for compatible layers
326  detLayers = initialLayer->compatibleLayers(fts,propDir);
327  // I have to fit by hand the first layer until the seedTSOS is defined on the first rechit layer
328  // In fact the first layer is not returned by initialLayer->compatibleLayers.
329 
330  detLayers.insert(detLayers.begin(),initialLayer);
331 
332  }
333  else if (theNavigationType == "Direct"){
334 
335  DirectMuonNavigation navigation(ESHandle<MuonDetLayerGeometry>(&*theService->detLayerGeometry()));
336  detLayers = navigation.compatibleLayers(fts,propDir);
337  }
338  else
339  LogError("DTDQM|DTMonitorModule|DTChamberEfficiency") << "No Properly Navigation Selected!!"<<endl;
340 
341  return detLayers;
342 }
MuonServiceProxy * theService
std::vector< const DetLayer * > compatibleLayers(NavigationDirection direction) const
Definition: DetLayer.cc:60
void DTChamberEfficiency::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file DTChamberEfficiency.cc.

References LogTrace.

126 {
127  LogTrace("DTDQM|DTMonitorModule|DTChamberEfficiency")
128  << "DTChamberEfficiency: endOfJob";
129 
130  return;
131 }
#define LogTrace(id)
ESHandle< Propagator > DTChamberEfficiency::propagator ( void  ) const
inlineprivate

Definition at line 344 of file DTChamberEfficiency.cc.

344  {
345  return theService->propagator("SteppingHelixPropagatorAny");
346 }
MuonServiceProxy * theService
MeasurementContainer DTChamberEfficiency::segQualityCut ( const MeasurementContainer  seg_list) const
private

Definition at line 290 of file DTChamberEfficiency.cc.

References DTChamberId, query::result, and DTChamberId::station().

291 {
292 
294 
295  for(MeasurementContainer::const_iterator mescont_Itr = seg_list.begin();
296  mescont_Itr != seg_list.end(); ++mescont_Itr){
297 
298  //get the rechits of the segment
299  TransientTrackingRecHit::ConstRecHitContainer recHit_list = mescont_Itr->recHit()->transientHits();
300 
301  //loop over the rechits and get the number of hits
302  int nhit_seg(0);
303  for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator recList_Itr = recHit_list.begin();
304  recList_Itr != recHit_list.end(); ++recList_Itr){
305 
306  nhit_seg += (int)(*recList_Itr)->transientHits().size();
307  }
308 
309  DTChamberId tmpId = (DTChamberId)mescont_Itr->recHit()->hit()->geographicalId();
310 
311  if(tmpId.station() < 4 && nhit_seg >= 12) result.push_back(*mescont_Itr);
312  if(tmpId.station() == 4 && nhit_seg >= 8) result.push_back(*mescont_Itr);
313  }
314 
315  return result;
316 }
tuple result
Definition: query.py:137
std::vector< ConstRecHitPointer > ConstRecHitContainer
std::vector< TrajectoryMeasurement > MeasurementContainer
int station() const
Return the station number.
Definition: DTChamberId.h:53

Member Data Documentation

bool DTChamberEfficiency::debug
private

Definition at line 83 of file DTChamberEfficiency.h.

edm::ESHandle<DTGeometry> DTChamberEfficiency::dtGeom
private

Definition at line 97 of file DTChamberEfficiency.h.

std::vector<std::vector<MonitorElement*> > DTChamberEfficiency::histosPerW
private

Definition at line 110 of file DTChamberEfficiency.h.

edm::InputTag DTChamberEfficiency::labelRPCRecHits
private

Definition at line 87 of file DTChamberEfficiency.h.

edm::ESHandle<MagneticField> DTChamberEfficiency::magfield
private

Definition at line 105 of file DTChamberEfficiency.h.

edm::InputTag DTChamberEfficiency::thecscSegments
private

Definition at line 89 of file DTChamberEfficiency.h.

DQMStore* DTChamberEfficiency::theDbe
private

Definition at line 99 of file DTChamberEfficiency.h.

edm::InputTag DTChamberEfficiency::thedt4DSegments
private

Definition at line 88 of file DTChamberEfficiency.h.

Chi2MeasurementEstimator* DTChamberEfficiency::theEstimator
private

Definition at line 103 of file DTChamberEfficiency.h.

double DTChamberEfficiency::theMaxChi2
private

Definition at line 91 of file DTChamberEfficiency.h.

MuonDetLayerMeasurements* DTChamberEfficiency::theMeasurementExtractor
private

Definition at line 102 of file DTChamberEfficiency.h.

int DTChamberEfficiency::theMinNrec
private

Definition at line 93 of file DTChamberEfficiency.h.

std::string DTChamberEfficiency::theNavigationType
private

Definition at line 95 of file DTChamberEfficiency.h.

double DTChamberEfficiency::theNSigma
private

Definition at line 92 of file DTChamberEfficiency.h.

MuonServiceProxy* DTChamberEfficiency::theService
private

Definition at line 101 of file DTChamberEfficiency.h.

edm::ESHandle<GlobalTrackingGeometry> DTChamberEfficiency::theTrackingGeometry
private

Definition at line 106 of file DTChamberEfficiency.h.

edm::InputTag DTChamberEfficiency::theTracksLabel
private

Definition at line 85 of file DTChamberEfficiency.h.