CMS 3D CMS Logo

HcalLEDMonitor.cc

Go to the documentation of this file.
00001 #include "DQM/HcalMonitorTasks/interface/HcalLEDMonitor.h"
00002 #include "DQMServices/Core/interface/DQMStore.h"
00003 #include "DQMServices/Core/interface/MonitorElement.h"
00004 
00005 HcalLEDMonitor::HcalLEDMonitor() {
00006   doPerChannel_ = false;
00007   sigS0_=0;
00008   sigS1_=9;
00009 }
00010 
00011 HcalLEDMonitor::~HcalLEDMonitor() {}
00012 
00013 void HcalLEDMonitor::setup(const edm::ParameterSet& ps, DQMStore* dbe){
00014   HcalBaseMonitor::setup(ps,dbe);
00015 
00016   baseFolder_ = rootFolder_+"LEDMonitor";
00017 
00018   if ( ps.getUntrackedParameter<bool>("LEDPerChannel", false) ) {
00019     doPerChannel_ = true;
00020   }
00021   if (fVerbosity>0)
00022     cout << "LED Monitor eta min/max set to " << etaMin_ << "/" << etaMax_ << endl;
00023   if (fVerbosity>0)
00024     cout << "LED Monitor phi min/max set to " << phiMin_ << "/" << phiMax_ << endl;
00025 
00026   sigS0_ = ps.getUntrackedParameter<int>("FirstSignalBin", 0);
00027   sigS1_ = ps.getUntrackedParameter<int>("LastSignalBin", 9);
00028   
00029   adcThresh_ = ps.getUntrackedParameter<double>("LED_ADC_Thresh", 0);
00030   if (fVerbosity>0) cout << "LED Monitor threshold set to " << adcThresh_ << endl;
00031   if (fVerbosity>0) cout << "LED Monitor signal window set to " << sigS0_ <<"-"<< sigS1_ << endl;  
00032 
00033   if(sigS0_<0){
00034     if (fVerbosity>0) cout<<"HcalLEDMonitor::setup, illegal range for first sample: "<<sigS0_<<endl;
00035     sigS0_=0;
00036   }
00037   if(sigS1_>9){
00038     if (fVerbosity>0) cout <<"HcalLEDMonitor::setup, illegal range for last sample: "<<sigS1_<<endl;
00039     sigS1_=9;
00040   }
00041 
00042   if(sigS0_>sigS1_){ 
00043     if (fVerbosity>0) cout <<"HcalLEDMonitor::setup, illegal range for first/last sample: "<<sigS0_<<"/"<<sigS1_<<endl;
00044     sigS0_=0; sigS1_=9;
00045   }
00046 
00047   ievt_=0;
00048 
00049   if ( m_dbe ) {
00050 
00051     m_dbe->setCurrentFolder(baseFolder_);
00052     meEVT_ = m_dbe->bookInt("LED Task Event Number");    
00053     meEVT_->Fill(ievt_);
00054 
00055     MEAN_MAP_TIME_L1= m_dbe->book2D("LED Mean Time Depth 1","LED Mean Time Depth 1",etaBins_,etaMin_,etaMax_,
00056                                phiBins_,phiMin_,phiMax_);
00057     RMS_MAP_TIME_L1= m_dbe->book2D("LED RMS Time Depth 1","LED RMS Time Depth 1",etaBins_,etaMin_,etaMax_,
00058                               phiBins_,phiMin_,phiMax_);
00059     
00060     MEAN_MAP_TIME_L2= m_dbe->book2D("LED Mean Time Depth 2","LED Mean Time Depth 2",etaBins_,etaMin_,etaMax_,
00061                                phiBins_,phiMin_,phiMax_);
00062     RMS_MAP_TIME_L2= m_dbe->book2D("LED RMS Time Depth 2","LED RMS Time Depth 2",etaBins_,etaMin_,etaMax_,
00063                               phiBins_,phiMin_,phiMax_);
00064     
00065     MEAN_MAP_TIME_L3= m_dbe->book2D("LED Mean Time Depth 3","LED Mean Time Depth 3",etaBins_,etaMin_,etaMax_,
00066                                phiBins_,phiMin_,phiMax_);
00067     RMS_MAP_TIME_L3= m_dbe->book2D("LED RMS Time Depth 3","LED RMS Time Depth 3",etaBins_,etaMin_,etaMax_,
00068                               phiBins_,phiMin_,phiMax_);
00069     
00070     MEAN_MAP_TIME_L4= m_dbe->book2D("LED Mean Time Depth 4","LED Mean Time Depth 4",etaBins_,etaMin_,etaMax_,
00071                                phiBins_,phiMin_,phiMax_);
00072     RMS_MAP_TIME_L4= m_dbe->book2D("LED RMS Time Depth 4","LED RMS Time Depth 4",etaBins_,etaMin_,etaMax_,
00073                               phiBins_,phiMin_,phiMax_);
00074 
00075 
00076     MEAN_MAP_SHAPE_L1= m_dbe->book2D("LED Mean Shape Depth 1","LED Mean Shape Depth 1",etaBins_,etaMin_,etaMax_,
00077                                phiBins_,phiMin_,phiMax_);
00078     RMS_MAP_SHAPE_L1= m_dbe->book2D("LED RMS Shape Depth 1","LED RMS Shape Depth 1",etaBins_,etaMin_,etaMax_,
00079                               phiBins_,phiMin_,phiMax_);
00080     
00081     MEAN_MAP_SHAPE_L2= m_dbe->book2D("LED Mean Shape Depth 2","LED Mean Shape Depth 2",etaBins_,etaMin_,etaMax_,
00082                                phiBins_,phiMin_,phiMax_);
00083     RMS_MAP_SHAPE_L2= m_dbe->book2D("LED RMS Shape Depth 2","LED RMS Shape Depth 2",etaBins_,etaMin_,etaMax_,
00084                               phiBins_,phiMin_,phiMax_);
00085     
00086     MEAN_MAP_SHAPE_L3= m_dbe->book2D("LED Mean Shape Depth 3","LED Mean Shape Depth 3",etaBins_,etaMin_,etaMax_,
00087                                phiBins_,phiMin_,phiMax_);
00088     RMS_MAP_SHAPE_L3= m_dbe->book2D("LED RMS Shape Depth 3","LED RMS Shape Depth 3",etaBins_,etaMin_,etaMax_,
00089                               phiBins_,phiMin_,phiMax_);
00090     
00091     MEAN_MAP_SHAPE_L4= m_dbe->book2D("LED Mean Shape Depth 4","LED Mean Shape Depth 4",etaBins_,etaMin_,etaMax_,
00092                                phiBins_,phiMin_,phiMax_);
00093     RMS_MAP_SHAPE_L4= m_dbe->book2D("LED RMS Shape Depth 4","LED RMS Shape Depth 4",etaBins_,etaMin_,etaMax_,
00094                               phiBins_,phiMin_,phiMax_);
00095 
00096     MEAN_MAP_ENERGY_L1= m_dbe->book2D("LED Mean Energy Depth 1","LED Mean Energy Depth 1",etaBins_,etaMin_,etaMax_,
00097                                phiBins_,phiMin_,phiMax_);
00098     RMS_MAP_ENERGY_L1= m_dbe->book2D("LED RMS Energy Depth 1","LED RMS Energy Depth 1",etaBins_,etaMin_,etaMax_,
00099                               phiBins_,phiMin_,phiMax_);
00100     
00101     MEAN_MAP_ENERGY_L2= m_dbe->book2D("LED Mean Energy Depth 2","LED Mean Energy Depth 2",etaBins_,etaMin_,etaMax_,
00102                                phiBins_,phiMin_,phiMax_);
00103     RMS_MAP_ENERGY_L2= m_dbe->book2D("LED RMS Energy Depth 2","LED RMS Energy Depth 2",etaBins_,etaMin_,etaMax_,
00104                               phiBins_,phiMin_,phiMax_);
00105     
00106     MEAN_MAP_ENERGY_L3= m_dbe->book2D("LED Mean Energy Depth 3","LED Mean Energy Depth 3",etaBins_,etaMin_,etaMax_,
00107                                phiBins_,phiMin_,phiMax_);
00108     RMS_MAP_ENERGY_L3= m_dbe->book2D("LED RMS Energy Depth 3","LED RMS Energy Depth 3",etaBins_,etaMin_,etaMax_,
00109                               phiBins_,phiMin_,phiMax_);
00110     
00111     MEAN_MAP_ENERGY_L4= m_dbe->book2D("LED Mean Energy Depth 4","LED Mean Energy Depth 4",etaBins_,etaMin_,etaMax_,
00112                                phiBins_,phiMin_,phiMax_);
00113     RMS_MAP_ENERGY_L4= m_dbe->book2D("LED RMS Energy Depth 4","LED RMS Energy Depth 4",etaBins_,etaMin_,etaMax_,
00114                               phiBins_,phiMin_,phiMax_);
00115 
00116     m_dbe->setCurrentFolder(baseFolder_+"/HB");
00117     hbHists.shapePED =  m_dbe->book1D("HB Ped Subtracted Pulse Shape","HB Ped Subtracted Pulse Shape",10,-0.5,9.5);
00118     hbHists.shapeALL =  m_dbe->book1D("HB Average Pulse Shape","HB Average Pulse Shape",10,-0.5,9.5);
00119     hbHists.rms_shape =  m_dbe->book1D("HB LED Shape RMS Values","HB LED Shape RMS Values",100,0,5);
00120     hbHists.mean_shape =  m_dbe->book1D("HB LED Shape Mean Values","HB LED Shape Mean Values",100,-0.5,9.5);
00121 
00122     hbHists.timeALL =  m_dbe->book1D("HB Average Pulse Time","HB Average Pulse Time",200,-0.5,9.5);
00123     hbHists.rms_time =  m_dbe->book1D("HB LED Time RMS Values","HB LED Time RMS Values",100,0,5);
00124     hbHists.mean_time =  m_dbe->book1D("HB LED Time Mean Values","HB LED Time Mean Values",100,-0.5,9.5);
00125 
00126     hbHists.energyALL =  m_dbe->book1D("HB Average Pulse Energy","HB Average Pulse Energy",500,0,5000);
00127     hbHists.rms_energy =  m_dbe->book1D("HB LED Energy RMS Values","HB LED Energy RMS Values",200,0,1000);
00128     hbHists.mean_energy =  m_dbe->book1D("HB LED Energy Mean Values","HB LED Energy Mean Values",100,0,1000);
00129 
00130     hbHists.err_map_geo =  m_dbe->book2D("HB LED Geo Error Map","HB LED Geo Error Map",etaBins_,etaMin_,etaMax_,phiBins_,phiMin_,phiMax_);
00131     hbHists.err_map_elec =  m_dbe->book2D("HB LED Elec Error Map","HB LED Elec Error Map",21,-0.5,20.5,21,-0.5,20.5);
00132 
00133     m_dbe->setCurrentFolder(baseFolder_+"/HE");
00134     heHists.shapePED =  m_dbe->book1D("HE Ped Subtracted Pulse Shape","HE Ped Subtracted Pulse Shape",10,-0.5,9.5);
00135     heHists.shapeALL =  m_dbe->book1D("HE Average Pulse Shape","HE Average Pulse Shape",10,-0.5,9.5);
00136     heHists.timeALL =  m_dbe->book1D("HE Average Pulse Time","HE Average Pulse Time",200,-1,10);
00137     heHists.rms_shape =  m_dbe->book1D("HE LED Shape RMS Values","HE LED Shape RMS Values",100,0,5);
00138     heHists.mean_shape =  m_dbe->book1D("HE LED Shape Mean Values","HE LED Shape Mean Values",100,-0.5,9.5);
00139     heHists.rms_time =  m_dbe->book1D("HE LED Time RMS Values","HE LED Time RMS Values",100,0,5);
00140     heHists.mean_time =  m_dbe->book1D("HE LED Time Mean Values","HE LED Time Mean Values",100,-1,10);
00141     heHists.energyALL =  m_dbe->book1D("HE Average Pulse Energy","HE Average Pulse Energy",500,0,5000);
00142     heHists.rms_energy =  m_dbe->book1D("HE LED Energy RMS Values","HE LED Energy RMS Values",100,0,500);
00143     heHists.mean_energy =  m_dbe->book1D("HE LED Energy Mean Values","HE LED Energy Mean Values",100,0,1000);
00144     heHists.err_map_geo =  m_dbe->book2D("HE LED Geo Error Map","HE LED Geo Error Map",etaBins_,etaMin_,etaMax_,phiBins_,phiMin_,phiMax_);
00145     heHists.err_map_elec =  m_dbe->book2D("HE LED Elec Error Map","HE LED Elec Error Map",21,-0.5,20.5,21,-0.5,20.5);
00146 
00147     m_dbe->setCurrentFolder(baseFolder_+"/HF");
00148     hfHists.shapePED =  m_dbe->book1D("HF Ped Subtracted Pulse Shape","HF Ped Subtracted Pulse Shape",10,-0.5,9.5);
00149     hfHists.shapeALL =  m_dbe->book1D("HF Average Pulse Shape","HF Average Pulse Shape",10,-0.5,9.5);
00150     hfHists.timeALL =  m_dbe->book1D("HF Average Pulse Time","HF Average Pulse Time",200,-0.5,9.5);
00151     hfHists.rms_shape =  m_dbe->book1D("HF LED Shape RMS Values","HF LED Shape RMS Values",100,0,5);
00152 
00153     hfHists.mean_shape =  m_dbe->book1D("HF LED Shape Mean Values","HF LED Shape Mean Values",100,-0.5,9.5);
00154     hfHists.rms_time =  m_dbe->book1D("HF LED Time RMS Values","HF LED Time RMS Values",100,0,5);
00155     hfHists.mean_time =  m_dbe->book1D("HF LED Time Mean Values","HF LED Time Mean Values",100,-0.5,9.5);
00156 
00157     hfHists.energyALL =  m_dbe->book1D("HF Average Pulse Energy","HF Average Pulse Energy",1000,-50,5000);
00158     hfHists.rms_energy =  m_dbe->book1D("HF LED Energy RMS Values","HF LED Energy RMS Values",100,0,300);
00159     hfHists.mean_energy =  m_dbe->book1D("HF LED Energy Mean Values","HF LED Energy Mean Values",100,0,500);
00160 
00161     hfHists.err_map_geo =  m_dbe->book2D("HF LED Geo Error Map","HF LED Geo Error Map",etaBins_,etaMin_,etaMax_,phiBins_,phiMin_,phiMax_);
00162     hfHists.err_map_elec =  m_dbe->book2D("HF LED Elec Error Map","HF LED Elec Error Map",21,-0.5,20.5,21,-0.5,20.5);
00163 
00164 
00165     //HFlumi plots
00166     HFlumi_ETsum_perwedge =  m_dbe->book1D("HF lumi ET-sum per wedge","HF lumi ET-sum per wedge",36,1,37);
00167 
00168     HFlumi_Occupancy_above_thr_r1 =  m_dbe->book1D("HF lumi Occupancy above threshold ring1","HF lumi Occupancy above threshold ring1",36,1,37);
00169     HFlumi_Occupancy_between_thrs_r1 = m_dbe->book1D("HF lumi Occupancy between thresholds ring1","HF lumi Occupancy between thresholds ring1",36,1,37);
00170     HFlumi_Occupancy_below_thr_r1 = m_dbe->book1D("HF lumi Occupancy below threshold ring1","HF lumi Occupancy below threshold ring1",36,1,37);
00171     HFlumi_Occupancy_above_thr_r2 = m_dbe->book1D("HF lumi Occupancy above threshold ring2","HF lumi Occupancy above threshold ring2",36,1,37);
00172     HFlumi_Occupancy_between_thrs_r2 = m_dbe->book1D("HF lumi Occupancy between thresholds ring2","HF lumi Occupancy between thresholds ring2",36,1,37);
00173     HFlumi_Occupancy_below_thr_r2 = m_dbe->book1D("HF lumi Occupancy below threshold ring2","HF lumi Occupancy below threshold ring2",36,1,37);
00174 
00175     m_dbe->setCurrentFolder(baseFolder_+"/HO");
00176     hoHists.shapePED =  m_dbe->book1D("HO Ped Subtracted Pulse Shape","HO Ped Subtracted Pulse Shape",10,-0.5,9.5);
00177     hoHists.shapeALL =  m_dbe->book1D("HO Average Pulse Shape","HO Average Pulse Shape",10,-0.5,9.5);
00178     hoHists.timeALL =  m_dbe->book1D("HO Average Pulse Time","HO Average Pulse Time",200,-1,10);
00179     hoHists.rms_shape =  m_dbe->book1D("HO LED Shape RMS Values","HO LED Shape RMS Values",100,0,5);
00180     hoHists.mean_shape =  m_dbe->book1D("HO LED Shape Mean Values","HO LED Shape Mean Values",100,-0.5,9.5);
00181     hoHists.rms_time =  m_dbe->book1D("HO LED Time RMS Values","HO LED Time RMS Values",100,0,5);
00182     hoHists.mean_time =  m_dbe->book1D("HO LED Time Mean Values","HO LED Time Mean Values",100,-1,10);
00183     hoHists.energyALL =  m_dbe->book1D("HO Average Pulse Energy","HO Average Pulse Energy",500,0,5000);
00184     hoHists.rms_energy =  m_dbe->book1D("HO LED Energy RMS Values","HO LED Energy RMS Values",100,0,500);
00185     hoHists.mean_energy =  m_dbe->book1D("HO LED Energy Mean Values","HO LED Energy Mean Values",100,0,1000);
00186     hoHists.err_map_geo =  m_dbe->book2D("HO LED Geo Error Map","HO LED Geo Error Map",etaBins_,etaMin_,etaMax_,phiBins_,phiMin_,phiMax_);
00187     hoHists.err_map_elec =  m_dbe->book2D("HO LED Elec Error Map","HO LED Elec Error Map",21,-0.5,20.5,21,-0.5,20.5);
00188   }
00189 
00190   return;
00191 }
00192 
00193 void HcalLEDMonitor::createFEDmap(unsigned int fed){
00194   _fedIter = MEAN_MAP_SHAPE_DCC.find(fed);
00195   
00196   if(_fedIter==MEAN_MAP_SHAPE_DCC.end()){
00197     m_dbe->setCurrentFolder(baseFolder_);
00198     char name[256];
00199 
00200     sprintf(name,"DCC %d Mean Shape Map",fed);
00201     MonitorElement* mean_shape = m_dbe->book2D(name,name,24,0.5,24.5,15,0.5,15.5);
00202     sprintf(name,"DCC %d RMS Shape Map",fed);
00203     MonitorElement* rms_shape = m_dbe->book2D(name,name,24,0.5,24.5,15,0.5,15.5);
00204 
00205     MEAN_MAP_SHAPE_DCC[fed] = mean_shape;
00206     RMS_MAP_SHAPE_DCC[fed] = rms_shape;
00207 
00208     sprintf(name,"DCC %d Mean Time Map",fed);
00209     MonitorElement* mean_time = m_dbe->book2D(name,name,24,0.5,24.5,15,0.5,15.5);
00210     sprintf(name,"DCC %d RMS Time Map",fed);
00211     MonitorElement* rms_time = m_dbe->book2D(name,name,24,0.5,24.5,15,0.5,15.5);
00212     MEAN_MAP_TIME_DCC[fed] = mean_time;
00213     RMS_MAP_TIME_DCC[fed] = rms_time;
00214     
00215     sprintf(name,"DCC %d Mean Energy Map",fed);
00216     MonitorElement* mean_energy = m_dbe->book2D(name,name,24,0.5,24.5,15,0.5,15.5);
00217     sprintf(name,"DCC %d RMS Energy Map",fed);
00218     MonitorElement* rms_energy = m_dbe->book2D(name,name,24,0.5,24.5,15,0.5,15.5);
00219     MEAN_MAP_ENERGY_DCC[fed] = mean_energy;
00220     RMS_MAP_ENERGY_DCC[fed] = rms_energy;
00221   }   
00222 }
00223 
00224 void HcalLEDMonitor::reset(){
00225   
00226   MonitorElement* unpackedFEDS = m_dbe->get("Hcal/FEDs Unpacked");
00227   if(unpackedFEDS){
00228     for(int b=1; b<=unpackedFEDS->getNbinsX(); b++){
00229       if(unpackedFEDS->getBinContent(b)>0){
00230         createFEDmap(700+(b-1));  
00231       }
00232     }
00233   }
00234 }
00235 
00236 void HcalLEDMonitor::processEvent(const HBHEDigiCollection& hbhe,
00237                                   const HODigiCollection& ho,
00238                                   const HFDigiCollection& hf,
00239                                   const HcalDbService& cond){
00240 
00241   ievt_++;
00242   meEVT_->Fill(ievt_);
00243 
00244   if(!m_dbe) { 
00245     if(fVerbosity) cout <<"HcalLEDMonitor::processEvent   DQMStore not instantiated!!!"<<endl;  
00246     return; }
00247   float vals[10];
00248 
00249 
00250   for (HBHEDigiCollection::const_iterator j=hbhe.begin(); j!=hbhe.end(); j++)
00251     {
00252       const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
00253       
00254       calibs_= cond.getHcalCalibrations(digi.id());  // Old method was made private. 
00255       float en=0;
00256       float ts =0; float bs=0;
00257       int maxi=0; float maxa=0;
00258       for(int i=sigS0_; i<=sigS1_; i++){
00259         if(digi.sample(i).adc()>maxa){maxa=digi.sample(i).adc(); maxi=i;}
00260       }
00261       for(int i=sigS0_; i<=sigS1_; i++){          
00262         float tmp1 =0;   
00263         int j1=digi.sample(i).adc();
00264         tmp1 = (LedMonAdc2fc[j1]+0.5);            
00265         en += tmp1-calibs_.pedestal(digi.sample(i).capid());
00266         if(i>=(maxi-1) && i<=maxi+1){
00267           ts += i*(tmp1-calibs_.pedestal(digi.sample(i).capid()));
00268           bs += tmp1-calibs_.pedestal(digi.sample(i).capid());
00269         }
00270       }
00271       if(en<adcThresh_) continue;
00272       if(digi.id().subdet()==HcalBarrel){
00273         hbHists.energyALL->Fill(en);
00274         if(bs!=0) hbHists.timeALL->Fill(ts/bs);
00275         for (int i=0; i<digi.size(); i++) {
00276           float tmp =0;
00277           int j=digi.sample(i).adc();
00278           tmp = (LedMonAdc2fc[j]+0.5);
00279           hbHists.shapeALL->Fill(i,tmp);
00280           hbHists.shapePED->Fill(i,tmp-calibs_.pedestal(digi.sample(i).capid()));
00281           vals[i] = tmp-calibs_.pedestal(digi.sample(i).capid());
00282         }
00283         if(doPerChannel_) perChanHists(0,digi.id(),vals,hbHists.shape, hbHists.time, hbHists.energy, baseFolder_);
00284       }
00285       else if(digi.id().subdet()==HcalEndcap){
00286         heHists.energyALL->Fill(en);
00287         if(bs!=0) heHists.timeALL->Fill(ts/bs);
00288         for (int i=0; i<digi.size(); i++) {
00289           float tmp =0;
00290           int j=digi.sample(i).adc();
00291           tmp = (LedMonAdc2fc[j]+0.5);
00292           heHists.shapeALL->Fill(i,tmp);
00293           heHists.shapePED->Fill(i,tmp-calibs_.pedestal(digi.sample(i).capid()));
00294           vals[i] = tmp-calibs_.pedestal(digi.sample(i).capid());
00295         }
00296         if(doPerChannel_) perChanHists(1,digi.id(),vals,heHists.shape, heHists.time, heHists.energy, baseFolder_);
00297       }
00298     } // for (HBHEDigiCollection...)
00299 
00300   
00301   for (HODigiCollection::const_iterator j=ho.begin(); j!=ho.end(); j++)
00302     {
00303       const HODataFrame digi = (const HODataFrame)(*j); 
00304       calibs_= cond.getHcalCalibrations(digi.id());  // Old method was made private. 
00305       float en=0;
00306       float ts =0; float bs=0;
00307       int maxi=0; float maxa=0;
00308       for(int i=sigS0_; i<=sigS1_; i++){
00309         if(digi.sample(i).adc()>maxa){maxa=digi.sample(i).adc(); maxi=i;}
00310       }
00311       for(int i=sigS0_; i<=sigS1_; i++){          
00312         float tmp1 =0;   
00313         int j1=digi.sample(i).adc();
00314         tmp1 = (LedMonAdc2fc[j1]+0.5);            
00315         en += tmp1-calibs_.pedestal(digi.sample(i).capid());
00316         if(i>=(maxi-1) && i<=maxi+1){
00317           ts += i*(tmp1-calibs_.pedestal(digi.sample(i).capid()));
00318           bs += tmp1-calibs_.pedestal(digi.sample(i).capid());
00319         }
00320       }
00321       if(en<adcThresh_) continue;
00322       hoHists.energyALL->Fill(en);
00323       if(bs!=0) hoHists.timeALL->Fill(ts/bs);
00324       for (int i=0; i<digi.size(); i++) {
00325         float tmp =0;
00326         int j=digi.sample(i).adc();
00327         tmp = (LedMonAdc2fc[j]+0.5);
00328         hoHists.shapeALL->Fill(i,tmp);
00329         hoHists.shapePED->Fill(i,tmp-calibs_.pedestal(digi.sample(i).capid()));
00330         vals[i] = tmp-calibs_.pedestal(digi.sample(i).capid());
00331       }
00332       if(doPerChannel_) perChanHists(2,digi.id(),vals,hoHists.shape, hoHists.time, hoHists.energy, baseFolder_);
00333     } // for (HODigiCollection...)       
00334   
00335   for (HFDigiCollection::const_iterator j=hf.begin(); j!=hf.end(); j++)
00336     {
00337       const HFDataFrame digi = (const HFDataFrame)(*j);
00338       calibs_= cond.getHcalCalibrations(digi.id());  // Old method was made private. 
00339       float en=0;
00340       float ts =0; float bs=0;
00341       int maxi=0; float maxa=0;
00342       for(int i=sigS0_; i<=sigS1_; i++){
00343         if(digi.sample(i).adc()>maxa){maxa=digi.sample(i).adc(); maxi=i;}
00344       }
00345       for(int i=sigS0_; i<=sigS1_; i++){          
00346         float tmp1 =0;   
00347         int j1=digi.sample(i).adc();
00348         tmp1 = (LedMonAdc2fc[j1]+0.5);            
00349         en += tmp1-calibs_.pedestal(digi.sample(i).capid());
00350         if(i>=(maxi-1) && i<=maxi+1){
00351           ts += i*(tmp1-calibs_.pedestal(digi.sample(i).capid()));
00352           bs += tmp1-calibs_.pedestal(digi.sample(i).capid());
00353         }
00354       }
00355 
00356       //---HFlumiplots
00357       int theTStobeused = 6;
00358       // will have masking later:
00359       int mask=1; 
00360       if(mask!=1) continue;
00361       //if we want to sum the 10 TS instead of just taking one:
00362       for (int i=0; i<digi.size(); i++) {
00363         if (i==theTStobeused) {
00364           float tmpET =0;
00365           int jadc=digi.sample(i).adc();
00366           //NOW LUT used in HLX are only identy LUTs, so Et filled
00367           //with unlinearised adc, ie tmpET = jadc
00368           //      tmpET = (adc2fc[jadc]+0.5);
00369           tmpET = jadc;
00370 
00371           //-find which wedge we are in
00372           //  ETsum and Occupancy will be summed for both L and S
00373           if(digi.id().ieta()>28){
00374             if((digi.id().iphi()==1)||(digi.id().iphi()==71)){
00375               HFlumi_ETsum_perwedge->Fill(1,tmpET);
00376               if((digi.id().ieta()==33)||(digi.id().ieta()==34)) {
00377                 if(jadc>100) HFlumi_Occupancy_above_thr_r1->Fill(1,1);
00378                 if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r1->Fill(1,1);
00379                 if(jadc<10) HFlumi_Occupancy_below_thr_r1->Fill(1,1);
00380               }
00381               else if((digi.id().ieta()==35)||(digi.id().ieta()==36)) {
00382                 if(jadc>100) HFlumi_Occupancy_above_thr_r2->Fill(1,1);
00383                 if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r2->Fill(1,1);
00384                 if(jadc<10) HFlumi_Occupancy_below_thr_r2->Fill(1,1);
00385               }
00386             }
00387             else {
00388               for (int iwedge=2; iwedge<19; iwedge++) {
00389                 int itmp=4*(iwedge-1);
00390                 if( (digi.id().iphi()==(itmp+1)) || (digi.id().iphi()==(itmp-1))) {
00391                   HFlumi_ETsum_perwedge->Fill(iwedge,tmpET);
00392                   if((digi.id().ieta()==33)||(digi.id().ieta()==34)) {
00393                     if(jadc>100) HFlumi_Occupancy_above_thr_r1->Fill(iwedge,1);
00394                     if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r1->Fill(iwedge,1);
00395                     if(jadc<10) HFlumi_Occupancy_below_thr_r1->Fill(iwedge,1);
00396                   }
00397                   else if((digi.id().ieta()==35)||(digi.id().ieta()==36)) {
00398                     if(jadc>100) HFlumi_Occupancy_above_thr_r2->Fill(iwedge,1);
00399                     if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r2->Fill(iwedge,1);
00400                     if(jadc<10) HFlumi_Occupancy_below_thr_r2->Fill(iwedge,1);
00401                   }
00402                   iwedge=99;
00403                 }
00404               }
00405             }
00406           }  //--endif ieta in HF+
00407           else if(digi.id().ieta()<-28){
00408             if((digi.id().iphi()==1)||(digi.id().iphi()==71)){
00409               HFlumi_ETsum_perwedge->Fill(19,tmpET);
00410               if((digi.id().ieta()==-33)||(digi.id().ieta()==-34)) {
00411                 if(jadc>100) HFlumi_Occupancy_above_thr_r1->Fill(19,1);
00412                 if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r1->Fill(19,1);
00413                 if(jadc<10) HFlumi_Occupancy_below_thr_r1->Fill(19,1);
00414               }
00415               else if((digi.id().ieta()==-35)||(digi.id().ieta()==-36)) {
00416                 if(jadc>100) HFlumi_Occupancy_above_thr_r2->Fill(19,1);
00417                 if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r2->Fill(19,1);
00418                 if(jadc<10) HFlumi_Occupancy_below_thr_r2->Fill(19,1);
00419               }
00420             }
00421             else {
00422               for (int iw=2; iw<19; iw++) {
00423                 int itemp=4*(iw-1);
00424                 if( (digi.id().iphi()==(itemp+1)) || (digi.id().iphi()==(itemp-1))) {
00425                   HFlumi_ETsum_perwedge->Fill(iw+18,tmpET);
00426                   if((digi.id().ieta()==-33)||(digi.id().ieta()==-34)) {
00427                     if(jadc>100) HFlumi_Occupancy_above_thr_r1->Fill(iw+18,1);
00428                     if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r1->Fill(iw+18,1);
00429                     if(jadc<10) HFlumi_Occupancy_below_thr_r1->Fill(iw+18,1);
00430                   }
00431                   else if((digi.id().ieta()==-35)||(digi.id().ieta()==-36)) {
00432                     if(jadc>100) HFlumi_Occupancy_above_thr_r2->Fill(iw+18,1);
00433                     if((jadc>=10)&&(jadc<=100)) HFlumi_Occupancy_between_thrs_r2->Fill(iw+18,1);
00434                     if(jadc<10) HFlumi_Occupancy_below_thr_r2->Fill(iw+18,1);
00435                   }
00436                   iw=99;
00437                 }
00438               }
00439             }
00440           }//---endif ieta inHF-
00441         }//---endif TS=nr6
00442       } //------end loop over TS for lumi
00443  
00444       if(en<adcThresh_) continue;
00445       hfHists.energyALL->Fill(en);
00446       if(bs!=0) hfHists.timeALL->Fill(ts/bs);
00447       for (int i=0; i<digi.size(); i++) {
00448         float tmp =0;
00449         int j=digi.sample(i).adc();
00450         tmp = (LedMonAdc2fc[j]+0.5);
00451         hfHists.shapeALL->Fill(i,tmp);
00452         hfHists.shapePED->Fill(i,tmp-calibs_.pedestal(digi.sample(i).capid()));
00453         vals[i] = tmp-calibs_.pedestal(digi.sample(i).capid());
00454       }
00455       if(doPerChannel_) perChanHists(3,digi.id(),vals,hfHists.shape, hfHists.time, hfHists.energy, baseFolder_);
00456     }
00457   return;
00458 
00459 }
00460 
00461 void HcalLEDMonitor::done(){
00462   return;
00463 }
00464 
00465 void HcalLEDMonitor::perChanHists(int id, const HcalDetId detid, float* vals, 
00466                                   map<HcalDetId, MonitorElement*> &tShape, 
00467                                   map<HcalDetId, MonitorElement*> &tTime,
00468                                   map<HcalDetId, MonitorElement*> &tEnergy,
00469                                   string baseFolder){
00470   
00471   MonitorElement* _me;
00472   if(m_dbe==NULL) return;
00473   _meIter=tShape.begin();
00474 
00475   string type = "HB";
00476   if(id==1) type = "HE"; 
00477   else if(id==2) type = "HO"; 
00478   else if(id==3) type = "HF"; 
00479   
00480   if(m_dbe) m_dbe->setCurrentFolder(baseFolder+"/"+type);
00481 
00482   
00483   _meIter = tShape.find(detid);
00484   if (_meIter!=tShape.end()){
00485     _me= _meIter->second;
00486     if(_me==NULL && fVerbosity>0) cout <<"HcalLEDAnalysis::perChanHists  This histo is NULL!!??"<<endl;
00487     else{
00488       float en=0;
00489       float ts =0; float bs=0;
00490       int maxi=0; float maxa=0;
00491       for(int i=sigS0_; i<=sigS1_; i++){
00492         if(vals[i]>maxa){maxa=vals[i]; maxi=i;}
00493       }
00494       for(int i=sigS0_; i<=sigS1_; i++){          
00495         en += vals[i];
00496         if(i>=(maxi-1) && i<=maxi+1){
00497           ts += i*vals[i];
00498           bs += vals[i];
00499         }
00500         _me->Fill(i,vals[i]);
00501       }
00502       _me = tTime[detid];      
00503       if(bs!=0) _me->Fill(ts/bs);
00504       _me = tEnergy[detid];  
00505       _me->Fill(en); 
00506     }
00507   }
00508   else{
00509     char name[1024];
00510     sprintf(name,"%s LED Shape ieta=%d iphi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());      
00511     MonitorElement* insert1;
00512     insert1 =  m_dbe->book1D(name,name,10,-0.5,9.5);
00513     float en=0;
00514     float ts =0; float bs=0;
00515     int maxi=0; float maxa=0;
00516     for(int i=sigS0_; i<=sigS1_; i++){
00517       if(vals[i]>maxa){maxa=vals[i]; maxi=i;}
00518       insert1->Fill(i,vals[i]); 
00519     }
00520     for(int i=sigS0_; i<=sigS1_; i++){    
00521       en += vals[i];
00522       if(i>=(maxi-1) && i<=maxi+1){
00523         ts += i*vals[i];
00524         bs += vals[i];
00525       }
00526     }
00527     tShape[detid] = insert1;
00528     
00529     sprintf(name,"%s LED Time ieta=%d iphi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());      
00530     MonitorElement* insert2 =  m_dbe->book1D(name,name,100,0,10);
00531     if(bs!=0) insert2->Fill(ts/bs); 
00532     tTime[detid] = insert2;     
00533 
00534     sprintf(name,"%s LED Energy ieta=%d iphi=%d depth=%d",type.c_str(),detid.ieta(),detid.iphi(),detid.depth());      
00535     MonitorElement* insert3 =  m_dbe->book1D(name,name,250,0,5000);
00536     insert3->Fill(en); 
00537     tEnergy[detid] = insert3;   
00538     
00539   } 
00540 
00541   return;
00542 
00543 }  

Generated on Tue Jun 9 17:33:02 2009 for CMSSW by  doxygen 1.5.4