CMS 3D CMS Logo

DTt0DBValidation Class Reference

Plot the t0 from the DB. More...

#include <DQMOffline/CalibMuon/interface/DTt0DBValidation.h>

Inheritance diagram for DTt0DBValidation:

edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
void beginJob (const edm::EventSetup &setup)
 Operations.
void bookHistos (DTLayerId lId, int firstWire, int lastWire)
 DTt0DBValidation (const edm::ParameterSet &pset)
 Constructor.
void endJob ()
virtual ~DTt0DBValidation ()
 Destructor.

Private Attributes

DQMStoredbe
edm::ESHandle< DTGeometrydtGeom
std::string labelDB
std::string labelDBRef
std::string metname
std::string outputFileName
edm::ParameterSet parameters
std::map< DTLayerId,
MonitorElement * > 
t0DiffHistos
std::map< DTWireId,
std::vector< float > > 
t0Map
std::map< DTWireId,
std::vector< float > > 
t0RefMap
const DTT0tZeroMap
const DTT0tZeroRefMap


Detailed Description

Plot the t0 from the DB.

Date
2008/04/18 12:28:37
Revision
1.1
Author:
G. Mila - INFN Torino

Definition at line 33 of file DTt0DBValidation.h.


Constructor & Destructor Documentation

DTt0DBValidation::DTt0DBValidation ( const edm::ParameterSet pset  ) 

Constructor.

Definition at line 43 of file DTt0DBValidation.cc.

References GenMuonPlsPt100GeV_cfg::cout, dbe, lat::endl(), edm::ParameterSet::getUntrackedParameter(), labelDB, labelDBRef, parameters, and DQMStore::setCurrentFolder().

00043                                                            {
00044 
00045   cout << "[DTt0DBValidation] Constructor called!" << endl;
00046 
00047   // Get the DQM needed services
00048   dbe = edm::Service<DQMStore>().operator->();
00049   dbe->setCurrentFolder("DT/DTDBValidation");
00050 
00051   // Get dataBase label
00052   labelDBRef = pset.getUntrackedParameter<string>("labelDBRef");
00053   labelDB = pset.getUntrackedParameter<string>("labelDB");
00054 
00055   parameters = pset;
00056 }

DTt0DBValidation::~DTt0DBValidation (  )  [virtual]

Destructor.

Definition at line 59 of file DTt0DBValidation.cc.

00059 {}


Member Function Documentation

void DTt0DBValidation::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [inline, virtual]

Implements edm::EDAnalyzer.

Definition at line 44 of file DTt0DBValidation.h.

00044 {}

void DTt0DBValidation::beginJob ( const edm::EventSetup setup  )  [virtual]

Operations.

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file DTt0DBValidation.cc.

References DTT0::begin(), bookHistos(), GenMuonPlsPt100GeV_cfg::cout, dtGeom, DTT0::end(), lat::endl(), DTTopology::firstChannel(), edm::EventSetup::get(), edm::ParameterSet::getUntrackedParameter(), labelDB, labelDBRef, DTTopology::lastChannel(), LogTrace, metname, outputFileName, parameters, t0DiffHistos, t0Map, t0RefMap, tzero, tZeroMap, and tZeroRefMap.

00062                                                        {
00063 
00064 
00065   metname = "t0dbValidation";
00066   LogTrace(metname)<<"[DTt0DBValidation] Parameters initialization";
00067  
00068   outputFileName = parameters.getUntrackedParameter<std::string>("OutputFileName");
00069 
00070   ESHandle<DTT0> t0_Ref;
00071   setup.get<DTT0Rcd>().get(labelDBRef, t0_Ref);
00072   tZeroRefMap = &*t0_Ref;
00073   LogTrace(metname)<<"[DTt0DBValidation] reference T0 version: " << t0_Ref->version();
00074 
00075   ESHandle<DTT0> t0;
00076   setup.get<DTT0Rcd>().get(labelDB, t0);
00077   tZeroMap = &*t0;
00078   LogTrace(metname)<<"[DTt0DBValidation] T0 to validate version: " << t0->version();
00079 
00080   // Get the geometry
00081   setup.get<MuonGeometryRecord>().get(dtGeom);
00082 
00083   // Loop over Ref DB entries
00084   for(DTT0::const_iterator tzero = tZeroRefMap->begin();
00085       tzero != tZeroRefMap->end(); tzero++) {
00086     DTWireId wireId((*tzero).first.wheelId,
00087                     (*tzero).first.stationId,
00088                     (*tzero).first.sectorId,
00089                     (*tzero).first.slId,
00090                     (*tzero).first.layerId,
00091                     (*tzero).first.cellId);
00092     float t0mean = (*tzero).second.t0mean;
00093     float t0rms = (*tzero).second.t0rms;
00094     LogTrace(metname)<< "Ref Wire: " <<  wireId <<endl
00095                      << " T0 mean (TDC counts): " << t0mean
00096                      << " T0_rms (TDC counts): " << t0rms;
00097 
00098     t0RefMap[wireId].push_back(t0mean);
00099     t0RefMap[wireId].push_back(t0rms);
00100   }
00101 
00102   // Loop over Ref DB entries
00103   for(DTT0::const_iterator tzero = tZeroMap->begin();
00104       tzero != tZeroMap->end(); tzero++) {
00105     DTWireId wireId((*tzero).first.wheelId,
00106                     (*tzero).first.stationId,
00107                     (*tzero).first.sectorId,
00108                     (*tzero).first.slId,
00109                     (*tzero).first.layerId,
00110                     (*tzero).first.cellId);
00111     float t0mean = (*tzero).second.t0mean;
00112     float t0rms = (*tzero).second.t0rms;
00113     LogTrace(metname)<< "Wire: " <<  wireId <<endl
00114                      << " T0 mean (TDC counts): " << t0mean
00115                      << " T0_rms (TDC counts): " << t0rms;
00116 
00117     t0Map[wireId].push_back(t0mean);
00118     t0Map[wireId].push_back(t0rms);
00119   }
00120 
00121   double difference=0;
00122   for(map<DTWireId, vector<float> >::const_iterator theMap = t0RefMap.begin();
00123       theMap != t0RefMap.end();
00124       theMap++) {  
00125     if(t0Map.find((*theMap).first) != t0Map.end()) {
00126 
00127       // compute the difference
00128       difference = t0Map[(*theMap).first][0]-(*theMap).second[0];
00129 
00130       //book histo
00131       DTLayerId layerId = (*theMap).first.layerId();
00132       if(t0DiffHistos.find(layerId) == t0DiffHistos.end()) {
00133         const DTTopology& dtTopo = dtGeom->layer(layerId)->specificTopology();
00134         const int firstWire = dtTopo.firstChannel();
00135         const int lastWire = dtTopo.lastChannel();
00136         bookHistos(layerId, firstWire, lastWire);
00137       }
00138 
00139       cout<< "Filling the histo for wire: "<<(*theMap).first
00140           <<"  difference: "<<difference<<endl;
00141       t0DiffHistos[layerId]->Fill((*theMap).first.wire(),difference);
00142 
00143     }
00144   } // Loop over the t0 map reference
00145   
00146   
00147 }

void DTt0DBValidation::bookHistos ( DTLayerId  lId,
int  firstWire,
int  lastWire 
)

Definition at line 174 of file DTt0DBValidation.cc.

References DQMStore::book1D(), DTSuperLayerId::chamberId(), dbe, DTLayerId::layer(), LogTrace, metname, DTChamberId::sector(), DQMStore::setCurrentFolder(), DTChamberId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), t0DiffHistos, muonGeometry::wheel, and DTChamberId::wheel().

Referenced by beginJob().

00174                                                                             {
00175   
00176   LogTrace(metname)<< "   Booking histos for L: " << lId;
00177 
00178   // Compose the chamber name
00179   stringstream wheel; wheel << lId.superlayerId().chamberId().wheel();  
00180   stringstream station; station << lId.superlayerId().chamberId().station();    
00181   stringstream sector; sector << lId.superlayerId().chamberId().sector();       
00182   stringstream superLayer; superLayer << lId.superlayerId().superlayer();       
00183   stringstream layer; layer << lId.layer();
00184 
00185   string lHistoName =
00186     "_W" + wheel.str() +
00187     "_St" + station.str() +
00188     "_Sec" + sector.str() +
00189     "_SL" + superLayer.str()+
00190     "_L" + layer.str();
00191   
00192   dbe->setCurrentFolder("DT/t0Validation/Wheel" + wheel.str() +
00193                            "/Station" + station.str() +
00194                            "/Sector" + sector.str() +
00195                            "/SuperLayer" +superLayer.str());
00196   // Create the monitor elements
00197   MonitorElement * hDifference;
00198   hDifference = dbe->book1D("hDifference"+lHistoName, "difference between the two t0 values",lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
00199   
00200   t0DiffHistos[lId] = hDifference;
00201 }

void DTt0DBValidation::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 150 of file DTt0DBValidation.cc.

References GenMuonPlsPt100GeV_cfg::cout, dbe, lat::endl(), QReport::getBadChannels(), QReport::getMessage(), QReport::getStatus(), edm::ParameterSet::getUntrackedParameter(), outputFileName, parameters, DQMStore::save(), and t0DiffHistos.

00150                               {
00151 
00152   //check the histos
00153   string testCriterionName = parameters.getUntrackedParameter<string>("t0TestName","t0DifferenceInRange"); 
00154   for(map<DTLayerId, MonitorElement*>::const_iterator hDiff = t0DiffHistos.begin();
00155       hDiff != t0DiffHistos.end();
00156       hDiff++) {
00157     const QReport * theDiffQReport = (*hDiff).second->getQReport(testCriterionName);
00158     if(theDiffQReport) {
00159       vector<dqm::me_util::Channel> badChannels = theDiffQReport->getBadChannels();
00160       for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 
00161            channel != badChannels.end(); channel++) {
00162         cout << "layer:"<<(*hDiff).first<<" Bad mean channels: "<<(*channel).getBin()<<"  Contents : "<<(*channel).getContents()<<endl;
00163       }
00164       cout << "-------- layer: "<<(*hDiff).first<<"  "<<theDiffQReport->getMessage()<<" ------- "<<theDiffQReport->getStatus()<<endl; 
00165     }
00166   }
00167 
00168   // write the histos on a file
00169   dbe->save(outputFileName);
00170 
00171 }


Member Data Documentation

DQMStore* DTt0DBValidation::dbe [private]

Definition at line 53 of file DTt0DBValidation.h.

Referenced by bookHistos(), DTt0DBValidation(), and endJob().

edm::ESHandle<DTGeometry> DTt0DBValidation::dtGeom [private]

Definition at line 64 of file DTt0DBValidation.h.

Referenced by beginJob().

std::string DTt0DBValidation::labelDB [private]

Definition at line 59 of file DTt0DBValidation.h.

Referenced by beginJob(), and DTt0DBValidation().

std::string DTt0DBValidation::labelDBRef [private]

Definition at line 58 of file DTt0DBValidation.h.

Referenced by beginJob(), and DTt0DBValidation().

std::string DTt0DBValidation::metname [private]

Definition at line 56 of file DTt0DBValidation.h.

Referenced by beginJob(), and bookHistos().

std::string DTt0DBValidation::outputFileName [private]

Definition at line 61 of file DTt0DBValidation.h.

Referenced by beginJob(), and endJob().

edm::ParameterSet DTt0DBValidation::parameters [private]

Definition at line 54 of file DTt0DBValidation.h.

Referenced by beginJob(), DTt0DBValidation(), and endJob().

std::map<DTLayerId, MonitorElement* > DTt0DBValidation::t0DiffHistos [private]

Definition at line 75 of file DTt0DBValidation.h.

Referenced by beginJob(), bookHistos(), and endJob().

std::map<DTWireId, std::vector<float> > DTt0DBValidation::t0Map [private]

Definition at line 72 of file DTt0DBValidation.h.

Referenced by beginJob().

std::map<DTWireId, std::vector<float> > DTt0DBValidation::t0RefMap [private]

Definition at line 71 of file DTt0DBValidation.h.

Referenced by beginJob().

const DTT0* DTt0DBValidation::tZeroMap [private]

Definition at line 67 of file DTt0DBValidation.h.

Referenced by beginJob().

const DTT0* DTt0DBValidation::tZeroRefMap [private]

Definition at line 68 of file DTt0DBValidation.h.

Referenced by beginJob().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:07 2009 for CMSSW by  doxygen 1.5.4