CMS 3D CMS Logo

DTAlbertoBenvenutiTask Class Reference

#include <DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h>

Inheritance diagram for DTAlbertoBenvenutiTask:

edm::EDAnalyzer

List of all members.

Public Member Functions

 DTAlbertoBenvenutiTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~DTAlbertoBenvenutiTask ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (const edm::EventSetup &c)
 BeginJob.
void beginRun (const edm::Run &, const edm::EventSetup &)
void bookHistos (const DTWireId dtWire)
 Book the ME.
void endJob ()
 Endjob.

Private Attributes

bool debug
edm::Handle< LTCDigiCollectionltcdigis
int maxTDCHits
edm::ESHandle< DTGeometrymuonGeom
int nevents
std::string outputFile
edm::ParameterSet parameters
edm::ESHandle< DTT0t0Map
std::map< DTWireId, TH1F * > TBMap
int tMax
 no needs to be precise. Value from PSets will always be used
float tTrig
 tTrig from the DB
edm::ESHandle< DTTtrigtTrigMap
float tTrigRMS


Detailed Description

Definition at line 39 of file DTAlbertoBenvenutiTask.h.


Constructor & Destructor Documentation

DTAlbertoBenvenutiTask::DTAlbertoBenvenutiTask ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 49 of file DTAlbertoBenvenutiTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxTDCHits, outputFile, parameters, and tMax.

00049                                                                        {
00050   
00051   debug = ps.getUntrackedParameter<bool>("debug", "false");
00052   if(debug)
00053     cout<<"[DTAlbertoBenvenutiTask]: Constructor"<<endl;
00054 
00055   outputFile = ps.getUntrackedParameter<string>("outputFile", "DTDigiSources.root");
00056   maxTDCHits = ps.getUntrackedParameter<int>("maxTDCHits",1000);
00057   
00058   // tMax (not yet from the DB)
00059   tMax = parameters.getParameter<int>("defaultTmax");
00060 
00061   parameters = ps; 
00062 
00063 }

DTAlbertoBenvenutiTask::~DTAlbertoBenvenutiTask (  )  [virtual]

Destructor.

Definition at line 66 of file DTAlbertoBenvenutiTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), and nevents.

00066                                                {
00067 
00068   if(debug)
00069     cout << "DTAlbertoBenvenutiTask: analyzed " << nevents << " events" << endl;
00070 
00071 }


Member Function Documentation

void DTAlbertoBenvenutiTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 230 of file DTAlbertoBenvenutiTask.cc.

References bookHistos(), DTSuperLayerId::chamberId(), DTTimeUnits::counts, debug, edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByType(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), int, ltcdigis, maxTDCHits, nevents, parameters, DetId::rawId(), edm::second(), DTSuperLayerId::superlayer(), t0Map, and TBMap.

00230                                                                              {
00231   
00232   nevents++;
00233   if (nevents%1000 == 0 && debug) {}
00234   
00235   edm::Handle<DTDigiCollection> dtdigis;
00236   e.getByLabel("dtunpacker", dtdigis);
00237 
00238   if ( !parameters.getUntrackedParameter<bool>("localrun", true) ) e.getByType(ltcdigis);
00239 
00240   bool checkNoisyChannels = parameters.getUntrackedParameter<bool>("checkNoisyChannels","false");
00241   ESHandle<DTStatusFlag> statusMap;
00242   if(checkNoisyChannels) {
00243     // Get the map of noisy channels
00244     c.get<DTStatusFlagRcd>().get(statusMap);
00245   }
00246 
00247   int tdcCount = 0;
00248   DTDigiCollection::DigiRangeIterator dtLayerId_It;
00249   for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
00250     for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
00251          digiIt!=((*dtLayerId_It).second).second; ++digiIt){
00252       tdcCount++;
00253     }
00254   }
00255 
00256   bool isSyncNoisy = false;
00257   if (tdcCount > maxTDCHits) isSyncNoisy = true;
00258   
00259   for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
00260     for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
00261          digiIt!=((*dtLayerId_It).second).second; ++digiIt){
00262       
00263       bool isNoisy = false;
00264       bool isFEMasked = false;
00265       bool isTDCMasked = false;
00266       bool isTrigMask = false;
00267       bool isDead = false;
00268       bool isNohv = false;
00269       const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
00270       if(checkNoisyChannels) {
00271         statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
00272       }      
00273  
00274       // for clearness..
00275       const  DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId();
00276       uint32_t indexSL = dtSLId.rawId();
00277       const  DTChamberId dtChId = dtSLId.chamberId(); 
00278       uint32_t indexCh = dtChId.rawId();
00279       int layer_number=((*dtLayerId_It).first).layer();
00280       int superlayer_number=dtSLId.superlayer();
00281       const  DTLayerId dtLId = (*dtLayerId_It).first;
00282       uint32_t indexL = dtLId.rawId();
00283       
00284       float t0; float t0RMS;
00285       int tdcTime = (*digiIt).countsTDC();
00286 
00287       if (parameters.getParameter<bool>("performPerWireT0Calibration")) {
00288         const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
00289         t0Map->get(dtWireId, t0, t0RMS, DTTimeUnits::counts) ;
00290         tdcTime += int(round(t0));
00291       }
00292        
00293       // avoid to fill TB with noise
00294       if ((!isNoisy ) && (!isSyncNoisy)) {
00295         // TimeBoxes per wire
00296         if (TBMap.find(wireId) == TBMap.end()){
00297           bookHistos(wireId);
00298           TBMap[wireId]->Fill(tdcTime);
00299         }
00300         else
00301           TBMap[wireId]->Fill(tdcTime);
00302       }
00303     }
00304   }
00305 }

void DTAlbertoBenvenutiTask::beginJob ( const edm::EventSetup c  )  [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file DTAlbertoBenvenutiTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), edm::EventSetup::get(), muonGeom, and nevents.

00131                                                                  {
00132 
00133   if(debug)
00134     cout<<"[DTAlbertoBenvenutiTask]: BeginJob"<<endl;
00135 
00136   nevents = 0;
00137 
00138   // Get the geometry
00139   context.get<MuonGeometryRecord>().get(muonGeom);
00140 }

void DTAlbertoBenvenutiTask::beginRun ( const edm::Run ,
const edm::EventSetup context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file DTAlbertoBenvenutiTask.cc.

References edm::EventSetup::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), parameters, t0Map, and tTrigMap.

00144                                                                                  {
00145   // tTrig 
00146   if (parameters.getUntrackedParameter<bool>("readDB", true)) 
00147     context.get<DTTtrigRcd>().get(tTrigMap);
00148 
00149   // t0s 
00150   if (parameters.getParameter<bool>("performPerWireT0Calibration")) 
00151     context.get<DTT0Rcd>().get(t0Map);
00152 
00153 
00154 }

void DTAlbertoBenvenutiTask::bookHistos ( const DTWireId  dtWire  )  [protected]

Book the ME.

Definition at line 157 of file DTAlbertoBenvenutiTask.cc.

References DTSuperLayerId::chamberId(), DTTimeUnits::counts, GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), DTLayerId::layer(), DTWireId::layerId(), muonGeom, parameters, DTChamberId::sector(), sl, DTChamberId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), TBMap, tMax, tTrig, tTrigMap, tTrigRMS, muonGeometry::wheel, and DTChamberId::wheel().

Referenced by analyze().

00157                                                              {
00158 
00159   if (debug) cout<<"[DTAlbertoBenvenutiTask]: booking"<<endl;
00160 
00161   stringstream wheel; wheel << dtWire.layerId().superlayerId().chamberId().wheel();     
00162   stringstream station; station << dtWire.layerId().superlayerId().chamberId().station();       
00163   stringstream sector; sector << dtWire.layerId().superlayerId().chamberId().sector();  
00164   
00165   // Loop over all the chambers
00166   vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
00167   vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
00168   // Loop over the SLs
00169   for (; ch_it != ch_end; ++ch_it) {
00170     DTChamberId ch = (*ch_it)->id();
00171     if(ch == dtWire.layerId().superlayerId().chamberId()){
00172       vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin(); 
00173       vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
00174       // Loop over the SLs
00175       for(; sl_it != sl_end; ++sl_it) {
00176         DTSuperLayerId sl = (*sl_it)->id();
00177         stringstream superLayer; superLayer << sl.superlayer();
00178         vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00179         vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00180         // Loop over the Ls
00181         for(; l_it != l_end; ++l_it) {
00182           DTLayerId layerId = (*l_it)->id();
00183           stringstream layer; layer << layerId.layer();
00184           const int firstWire = muonGeom->layer(layerId)->specificTopology().firstChannel();
00185           const int lastWire = muonGeom->layer(layerId)->specificTopology().lastChannel();
00186           // Loop overt the wires
00187           for(int wr=firstWire; wr <= lastWire; wr++) {
00188 
00189             stringstream wire; wire << wr;
00190             DTWireId wrId(layerId, wr);
00191 
00192             string histoTag = "TimeBox";
00193             string histoName = histoTag
00194               + "_W" + wheel.str() 
00195               + "_St" + station.str() 
00196               + "_Sec" + sector.str() 
00197               + "_SL" + superLayer.str()
00198               + "_L" + layer.str()
00199               + "_wire" + wire.str();
00200 
00201             if (debug) cout<<"[DTAlbertoBenvenutiTask]: histoName "<<histoName<<endl;
00202 
00203             if ( parameters.getUntrackedParameter<bool>("readDB", false) ) 
00204               // ttrig and rms are TDC counts
00205               tTrigMap->get(dtWire.layerId().superlayerId(), tTrig, tTrigRMS,
00206                             DTTimeUnits::counts); 
00207             else tTrig = parameters.getParameter<int>("defaultTtrig");
00208   
00209             string histoTitle = histoName + " (TDC Counts)";
00210             int timeBoxGranularity = parameters.getUntrackedParameter<int>("timeBoxGranularity",4);
00211   
00212             if (!parameters.getUntrackedParameter<bool>("readDB", true)) {
00213               int maxTDCCounts = 6400 * parameters.getUntrackedParameter<int>("tdcRescale", 1);
00214               TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), maxTDCCounts/timeBoxGranularity, 0, maxTDCCounts);
00215               TBMap[wrId] = TB;
00216             }    
00217             else {
00218               TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), 2*tMax/timeBoxGranularity, tTrig-tMax, tTrig+2*tMax);
00219               TBMap[wrId] = TB;
00220             }
00221 
00222           } // loopover  wires
00223         } // loop over Ls
00224       } // loop over SLs
00225     } // if is the right chamber to book
00226   } // loop over chambers
00227 }

void DTAlbertoBenvenutiTask::endJob ( void   )  [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file DTAlbertoBenvenutiTask.cc.

References c1, counter(), GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), aod_PYTHIA_cfg::fileName, TBMap, and muonGeometry::wheel.

00074                                    {
00075 
00076   if(debug)
00077     cout<<"[DTAlbertoBenvenutiTask] endjob called!"<<endl;
00078 
00079   map< DTChamberId, vector<TH1F*> > TBMap_perChamber;
00080 
00081   for(map<DTWireId, TH1F* >::const_iterator wHisto = TBMap.begin();
00082       wHisto != TBMap.end();
00083       wHisto++) {
00084     DTChamberId chId = (*wHisto).first.layerId().superlayerId().chamberId();
00085     TBMap_perChamber[chId].push_back((*wHisto).second);
00086   }
00087  
00088   
00089   for(map<DTChamberId, vector<TH1F*> >::const_iterator Histo = TBMap_perChamber.begin();
00090       Histo != TBMap_perChamber.end();
00091       Histo++) {
00092     stringstream station; station << (*Histo).first.station();
00093     stringstream sector; sector << (*Histo).first.sector();     
00094     stringstream wheel; wheel << (*Histo).first.wheel();
00095     
00096     string fileTag = "TimeBoxes";
00097     string fileName = fileTag
00098       + "_W" + wheel.str()
00099       + "_Sec" + sector.str()
00100       + "_St" + station.str() 
00101       + ".ps";
00102 
00103     TPostScript psFile(fileName.c_str(),111);
00104     psFile.Range(20,26);
00105     int counter = 0;
00106     TCanvas c1("c1","",600,780);
00107     c1.Divide(4,4);
00108     psFile.NewPage();
00109     
00110     cout<<"[DTAlbertoBenvenutiTask] filling the file: "<<fileName<<endl;
00111     for(vector<TH1F*>::const_iterator tbHisto = (*Histo).second.begin();
00112         tbHisto != (*Histo).second.end();
00113         tbHisto++) {
00114       counter++;
00115       c1.cd(counter);
00116       (*tbHisto)->Draw();      
00117        if(counter%16 == 0 && counter>=16){
00118          c1.Update();
00119          psFile.NewPage();
00120          c1.Clear();
00121          c1.Divide(4,4);
00122          counter=0;
00123        }
00124     } // loop over TB histos (divided per chamber)
00125 
00126   } //loop over the chambers
00127 
00128 }


Member Data Documentation

bool DTAlbertoBenvenutiTask::debug [private]

Definition at line 67 of file DTAlbertoBenvenutiTask.h.

Referenced by analyze(), beginJob(), bookHistos(), DTAlbertoBenvenutiTask(), endJob(), and ~DTAlbertoBenvenutiTask().

edm::Handle<LTCDigiCollection> DTAlbertoBenvenutiTask::ltcdigis [private]

Definition at line 78 of file DTAlbertoBenvenutiTask.h.

Referenced by analyze().

int DTAlbertoBenvenutiTask::maxTDCHits [private]

Definition at line 72 of file DTAlbertoBenvenutiTask.h.

Referenced by analyze(), and DTAlbertoBenvenutiTask().

edm::ESHandle<DTGeometry> DTAlbertoBenvenutiTask::muonGeom [private]

Definition at line 82 of file DTAlbertoBenvenutiTask.h.

Referenced by beginJob(), and bookHistos().

int DTAlbertoBenvenutiTask::nevents [private]

Definition at line 68 of file DTAlbertoBenvenutiTask.h.

Referenced by analyze(), beginJob(), and ~DTAlbertoBenvenutiTask().

std::string DTAlbertoBenvenutiTask::outputFile [private]

Definition at line 87 of file DTAlbertoBenvenutiTask.h.

Referenced by DTAlbertoBenvenutiTask().

edm::ParameterSet DTAlbertoBenvenutiTask::parameters [private]

Definition at line 80 of file DTAlbertoBenvenutiTask.h.

Referenced by analyze(), beginRun(), bookHistos(), and DTAlbertoBenvenutiTask().

edm::ESHandle<DTT0> DTAlbertoBenvenutiTask::t0Map [private]

Definition at line 85 of file DTAlbertoBenvenutiTask.h.

Referenced by analyze(), and beginRun().

std::map<DTWireId, TH1F*> DTAlbertoBenvenutiTask::TBMap [private]

Definition at line 89 of file DTAlbertoBenvenutiTask.h.

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

int DTAlbertoBenvenutiTask::tMax [private]

no needs to be precise. Value from PSets will always be used

Definition at line 71 of file DTAlbertoBenvenutiTask.h.

Referenced by bookHistos(), and DTAlbertoBenvenutiTask().

float DTAlbertoBenvenutiTask::tTrig [private]

tTrig from the DB

Definition at line 75 of file DTAlbertoBenvenutiTask.h.

Referenced by bookHistos().

edm::ESHandle<DTTtrig> DTAlbertoBenvenutiTask::tTrigMap [private]

Definition at line 84 of file DTAlbertoBenvenutiTask.h.

Referenced by beginRun(), and bookHistos().

float DTAlbertoBenvenutiTask::tTrigRMS [private]

Definition at line 76 of file DTAlbertoBenvenutiTask.h.

Referenced by bookHistos().


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