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
DTRunConditionVar Class Reference

#include <DTRunConditionVar.h>

Inheritance diagram for DTRunConditionVar:
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 &)
 
 DTRunConditionVar (const edm::ParameterSet &pset)
 
void endJob ()
 
 ~DTRunConditionVar ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void bookChamberHistos (const DTChamberId &dtCh, std::string histoType, int, float, float)
 

Private Attributes

std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
chamberHistos
 
bool debug
 
edm::ESHandle< DTGeometrydtGeom
 
double maxAnglePhiSegm
 
edm::ESHandle< DTMtimemTime
 
const DTMtimemTimeMap_
 
int nMinHitsPhi
 
DQMStoretheDbe
 
edm::InputTag thedt4DSegments_
 

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:

Author
: Paolo Bellan, Antonio Branca $date : 23/09/2011 15:42:04 CET $
Revision:
1.2

Modification:

Definition at line 43 of file DTRunConditionVar.h.

Constructor & Destructor Documentation

DTRunConditionVar::DTRunConditionVar ( const edm::ParameterSet pset)

Definition at line 47 of file DTRunConditionVar.cc.

References cppFunctionSkipper::operator, and theDbe.

47  :
48  // Get the debug parameter for verbose output
49  debug(pSet.getUntrackedParameter<bool>("debug",false)),
50  nMinHitsPhi(pSet.getUntrackedParameter<int>("nMinHitsPhi")),
51  maxAnglePhiSegm(pSet.getUntrackedParameter<double>("maxAnglePhiSegm")),
52  thedt4DSegments_(pSet.getParameter<InputTag>("recoSegments"))
53 {
54  // LogVerbatim("DTDQM|DTRunConditionVar|DTRunConditionVar")
55  // << "DTRunConditionVar: constructor called";
56 
57  // Get the DQM needed services
59 
60 }
edm::InputTag thedt4DSegments_
DTRunConditionVar::~DTRunConditionVar ( )

Definition at line 62 of file DTRunConditionVar.cc.

References LogTrace.

63 {
64  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
65  << "DTRunConditionVar: destructor called";
66 
67  // free memory
68 }
#define LogTrace(id)

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 117 of file DTRunConditionVar.cc.

References chamberHistos, DTVelocityUnits::cm_per_ns, DTChamberId, dtGeom, edm::hlt::Exception, HcalObjRepresent::Fill(), edm::EventSetup::get(), DTMtime::get(), LogTrace, maxAnglePhiSegm, mTime, mTimeMap_, nMinHitsPhi, Pi, DetId::rawId(), thedt4DSegments_, and xdir.

119 {
120 
121  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar") <<
122  "--- [DTRunConditionVar] Event analysed #Run: " <<
123  event.id().run() << " #Event: " << event.id().event() << endl;
124 
125  // Get the DT Geometry
127  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
128 
129  // Get the map of vdrift from the setup
130  eventSetup.get<DTMtimeRcd>().get(mTime);
131  mTimeMap_ = &*mTime;
132 
133  // Get the segment collection from the event
134  Handle<DTRecSegment4DCollection> all4DSegments;
135  event.getByLabel(thedt4DSegments_, all4DSegments);
136 
137  // Loop over the segments
138  for(DTRecSegment4DCollection::const_iterator segment = all4DSegments->begin();
139  segment != all4DSegments->end(); ++segment){
140 
141  // Get the chamber from the setup
142  DTChamberId DTid = (DTChamberId) segment->chamberId();
143  uint32_t indexCh = DTid.rawId();
144 
145  // Fill v-drift values
146  if( (*segment).hasPhi() ) {
147 
148  int nHitsPhi = (*segment).phiSegment()->degreesOfFreedom()+2;
149  double xdir = (*segment).phiSegment()->localDirection().x();
150  double zdir = (*segment).phiSegment()->localDirection().z();
151 
152  double anglePhiSegm = fabs(atan(xdir/zdir))*180./TMath::Pi();
153 
154  if( nHitsPhi >= nMinHitsPhi && anglePhiSegm <= maxAnglePhiSegm ) {
155 
156  double segmentVDrift = segment->phiSegment()->vDrift();
157 
158 
159  DTSuperLayerId indexSLPhi1(DTid,1);
160  DTSuperLayerId indexSLPhi2(DTid,3);
161 
162  float vDriftPhi1(0.), vDriftPhi2(0.);
163  float ResPhi1(0.), ResPhi2(0.);
164  int status1 = mTimeMap_->get(indexSLPhi1,vDriftPhi1,ResPhi1,DTVelocityUnits::cm_per_ns);
165  int status2 = mTimeMap_->get(indexSLPhi2,vDriftPhi2,ResPhi2,DTVelocityUnits::cm_per_ns);
166 
167  if(status1 != 0 || status2 != 0) {
168  DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2;
169  throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for"
170  << sl << endl;
171  }
172 
173  float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.;
174 
175  segmentVDrift = vDriftMed*(1. - segmentVDrift);
176 
177  double segmentT0 = segment->phiSegment()->t0();
178 
179  if( segment->phiSegment()->ist0Valid() ) (chamberHistos[indexCh])["T0_FromSegm"]->Fill(segmentT0);
180  if( segmentVDrift != vDriftMed ) (chamberHistos[indexCh])["VDrift_FromSegm"]->Fill(segmentVDrift);
181 
182  }
183  }
184 
185  // if( (*segment).hasZed() ){
186  // double segmentVDrift = segment->zSegment()->vDrift();
187  // double segmentT0 = segment->zSegment()->t0();
188  //
189  //
190  // if(segmentT0 != -999 ) ht0[sector-1]->Fill(segmentT0);
191  // if( segmentVDrift > 0.00 ) hvd[sector-1]->Fill(segmentVDrift);
192  //
193  // }
194  } //end loop on segment
195 
196 } //end analyze
const double Pi
edm::ESHandle< DTMtime > mTime
const DTMtime * mTimeMap_
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
edm::InputTag thedt4DSegments_
#define LogTrace(id)
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
const T & get() const
Definition: EventSetup.h:55
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
Definition: DTMtime.cc:86
edm::ESHandle< DTGeometry > dtGeom
void DTRunConditionVar::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file DTRunConditionVar.cc.

References bookChamberHistos(), DTChamberId, and LogTrace.

72  {
73 
74  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
75  << "DTRunConditionVar: beginOfJob";
76 
77  for(int wheel=-2;wheel<=2;wheel++){
78  for(int sec=1; sec<=14; sec++) {
79  for(int stat=1; stat<=4; stat++) {
80 
81  bookChamberHistos(DTChamberId(wheel,stat,sec),"VDrift_FromSegm",100,0.0043,0.0065);
82  bookChamberHistos(DTChamberId(wheel,stat,sec),"T0_FromSegm",100,-25.,25.);
83 
84  }
85  }
86  }
87 
88 
89  return;
90 }
void bookChamberHistos(const DTChamberId &dtCh, std::string histoType, int, float, float)
#define LogTrace(id)
void DTRunConditionVar::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 96 of file DTRunConditionVar.cc.

References dtGeom, and edm::EventSetup::get().

97 {
98  // Get the DT Geometry
99  setup.get<MuonGeometryRecord>().get(dtGeom);
100 
101  return;
102 }
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< DTGeometry > dtGeom
void DTRunConditionVar::bookChamberHistos ( const DTChamberId dtCh,
std::string  histoType,
int  ,
float  ,
float   
)
private

Definition at line 201 of file DTRunConditionVar.cc.

References DQMStore::book1D(), chamberHistos, LogTrace, DetId::rawId(), DTChamberId::sector(), DQMStore::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, theDbe, and DTChamberId::wheel().

Referenced by beginJob().

201  {
202 
203  int wh = dtCh.wheel();
204  int sc = dtCh.sector();
205  int st = dtCh.station();
206  stringstream wheel; wheel << wh;
207  stringstream station; station << st;
208  stringstream sector; sector << sc;
209 
210  string bookingFolder = "DT/02-Segments/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str();
211  string histoTag = "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
212 
213  theDbe->setCurrentFolder(bookingFolder);
214 
215  LogTrace ("DTDQM|DTMonitorModule|DTRunConditionVar")
216  << "[DTRunConditionVar]: booking histos in " << bookingFolder << endl;
217 
218  string histoName = histoType + histoTag;
219  string histoLabel = histoType;
220 
221  (chamberHistos[dtCh.rawId()])[histoType] =
222  theDbe->book1D(histoName,histoLabel,nbins,min,max);
223 
224 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
#define min(a, b)
Definition: mlp_lapack.h:161
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
const T & max(const T &a, const T &b)
#define LogTrace(id)
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void DTRunConditionVar::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file DTRunConditionVar.cc.

References LogTrace.

108 {
109  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
110  << "DTRunConditionVar: endOfJob";
111 
112  return;
113 }
#define LogTrace(id)

Member Data Documentation

std::map<uint32_t, std::map<std::string, MonitorElement*> > DTRunConditionVar::chamberHistos
private

Definition at line 76 of file DTRunConditionVar.h.

Referenced by analyze(), and bookChamberHistos().

bool DTRunConditionVar::debug
private

Definition at line 63 of file DTRunConditionVar.h.

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

Definition at line 69 of file DTRunConditionVar.h.

Referenced by analyze(), and beginRun().

double DTRunConditionVar::maxAnglePhiSegm
private

Definition at line 65 of file DTRunConditionVar.h.

Referenced by analyze().

edm::ESHandle<DTMtime> DTRunConditionVar::mTime
private

Definition at line 71 of file DTRunConditionVar.h.

Referenced by analyze().

const DTMtime* DTRunConditionVar::mTimeMap_
private

Definition at line 72 of file DTRunConditionVar.h.

Referenced by analyze().

int DTRunConditionVar::nMinHitsPhi
private

Definition at line 64 of file DTRunConditionVar.h.

Referenced by analyze().

DQMStore* DTRunConditionVar::theDbe
private

Definition at line 74 of file DTRunConditionVar.h.

Referenced by bookChamberHistos(), and DTRunConditionVar().

edm::InputTag DTRunConditionVar::thedt4DSegments_
private

Definition at line 67 of file DTRunConditionVar.h.

Referenced by analyze().