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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDGetTokenT
< DTRecSegment4DCollection
dt4DSegmentsToken_
 
edm::ESHandle< DTGeometrydtGeom
 
double maxAnglePhiSegm
 
edm::ESHandle< DTMtimemTime
 
const DTMtimemTimeMap_
 
int nMinHitsPhi
 
DQMStoretheDbe
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description:

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

Modification:

Definition at line 43 of file DTRunConditionVar.h.

Constructor & Destructor Documentation

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

Definition at line 45 of file DTRunConditionVar.cc.

References cppFunctionSkipper::operator, and theDbe.

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

Definition at line 61 of file DTRunConditionVar.cc.

References LogTrace.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 116 of file DTRunConditionVar.cc.

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

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

References bookChamberHistos(), DTChamberId, and LogTrace.

71  {
72 
73  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
74  << "DTRunConditionVar: beginOfJob";
75 
76  for(int wheel=-2;wheel<=2;wheel++){
77  for(int sec=1; sec<=14; sec++) {
78  for(int stat=1; stat<=4; stat++) {
79 
80  bookChamberHistos(DTChamberId(wheel,stat,sec),"VDrift_FromSegm",100,0.0043,0.0065);
81  bookChamberHistos(DTChamberId(wheel,stat,sec),"T0_FromSegm",100,-25.,25.);
82 
83  }
84  }
85  }
86 
87 
88  return;
89 }
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 95 of file DTRunConditionVar.cc.

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

96 {
97  // Get the DT Geometry
98  setup.get<MuonGeometryRecord>().get(dtGeom);
99 
100  return;
101 }
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 200 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().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 106 of file DTRunConditionVar.cc.

References LogTrace.

107 {
108  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
109  << "DTRunConditionVar: endOfJob";
110 
111  return;
112 }
#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
edm::EDGetTokenT<DTRecSegment4DCollection> DTRunConditionVar::dt4DSegmentsToken_
private

Definition at line 67 of file DTRunConditionVar.h.

Referenced by analyze().

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().