CMS 3D CMS Logo

HcalLaserClient.cc

Go to the documentation of this file.
00001 #include <DQM/HcalMonitorClient/interface/HcalLaserClient.h>
00002 #include <DQM/HcalMonitorClient/interface/HcalClientUtils.h>
00003 #include "DQMServices/Core/interface/DQMStore.h"
00004 #include "DQMServices/Core/interface/MonitorElement.h"
00005 
00006 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00007 HcalLaserClient::HcalLaserClient(){}
00008 HcalLaserClient::~HcalLaserClient() { this->cleanup(); }
00009 void HcalLaserClient::setup(void) {}
00010 void HcalLaserClient::createTests() {}
00011 
00012 
00013 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00014 void HcalLaserClient::init( const ParameterSet& ps, DQMStore* dbe, const string clientName){
00015   HcalBaseClient::init( ps, dbe, clientName );
00016   
00017   TDCNumChannels_ = 0;
00018   TDCTrigger_ = 0;
00019   TDCRawOptosync_ = 0;
00020   TDCClockOptosync_ = 0;
00021   TDCRawOptosync_Trigger_ = 0;
00022 
00023   for( int i = 0; i < 32; i ++ ) {
00024     QADC_[i] = 0;
00025   }
00026 
00027   for( int i = 0; i < 4; i++ ) {    
00028     rms_shape_[i] = 0;
00029     mean_shape_[i] = 0;
00030     rms_time_[i] = 0;
00031     mean_time_[i] = 0;
00032     rms_energy_[i] = 0;
00033     mean_energy_[i] = 0;
00034 
00035     rms_shapeDep_[i] = 0;
00036     mean_shapeDep_[i] = 0;
00037     rms_timeDep_[i] = 0;
00038     mean_timeDep_[i] = 0;
00039     rms_energyDep_[i] = 0;
00040     mean_energyDep_[i] = 0;
00041 
00042     avg_shape_[i] = 0;
00043     avg_time_[i] = 0;
00044     avg_energy_[i] = 0;
00045   }
00046 }
00047 
00048 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00049 void HcalLaserClient::beginJob( const EventSetup& eventSetup ) {
00050   if ( debug_ ) cout << "HcalLaserClient: beginJob" << endl;
00051   ievt_ = jevt_ = 0;
00052   this->resetAllME();
00053 }
00054 
00055 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00056 void HcalLaserClient::beginRun(void){
00057   if ( debug_ ) cout << "HcalLaserClient: beginRun" << endl;
00058   jevt_ = 0;
00059   this->resetAllME();
00060 }
00061 
00062 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00063 void HcalLaserClient::analyze(void) {  
00064   jevt_++;
00065   getHistograms();
00066 }
00067 
00068 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00069 void HcalLaserClient::endRun(void) {
00070   if ( debug_ ) cout << "HcalLaserClient: endRun, jevt = " << jevt_ << endl;
00071   this->cleanup();
00072 }
00073 
00074 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00075 void HcalLaserClient::endJob(void) {
00076   if ( debug_ ) cout << "HcalLaserClient: endJob, ievt = " << ievt_ << endl;
00077   this->cleanup();
00078 }
00079 
00080 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00081 void HcalLaserClient::cleanup(void) {
00082   if( cloneME_ ){
00083     if( TDCNumChannels_ )         delete TDCNumChannels_;
00084     if( TDCTrigger_ )             delete TDCTrigger_;
00085     if( TDCRawOptosync_ )         delete TDCRawOptosync_;
00086     if( TDCClockOptosync_ )       delete TDCClockOptosync_;
00087     if( TDCRawOptosync_Trigger_ ) delete TDCRawOptosync_Trigger_;
00088 
00089     for( int i = 0; i < 32; i ++ ) {
00090       if( QADC_[i] ) delete QADC_[i];
00091     }
00092  
00093     for( int i = 0; i < 4; i++ ) {
00094       if( rms_shape_[i] )      delete rms_shape_[i];
00095       if( mean_shape_[i] )     delete mean_shape_[i];
00096       if( rms_time_[i] )       delete rms_time_[i];
00097       if( mean_time_[i] )      delete mean_time_[i];
00098       if( rms_energy_[i] )     delete rms_energy_[i];
00099       if( mean_energy_[i] )    delete mean_energy_[i];
00100 
00101       if( rms_shapeDep_[i] )   delete rms_shapeDep_[i];
00102       if( mean_shapeDep_[i] )  delete mean_shapeDep_[i];
00103       if( rms_timeDep_[i] )    delete rms_timeDep_[i];
00104       if( mean_timeDep_[i] )   delete mean_timeDep_[i];
00105       if( rms_energyDep_[i] )  delete rms_energyDep_[i];
00106       if( mean_energyDep_[i] ) delete mean_energyDep_[i];
00107 
00108       if( avg_shape_[i] )      delete avg_shape_[i];
00109       if( avg_time_[i] )       delete avg_time_[i];
00110       if( avg_energy_[i] )     delete avg_energy_[i];
00111     }
00112   }
00113 
00114   TDCNumChannels_ = 0;
00115   TDCTrigger_ = 0;
00116   TDCRawOptosync_ = 0;
00117   TDCClockOptosync_ = 0;
00118   TDCRawOptosync_Trigger_ = 0;
00119 
00120   for( int i = 0; i < 32; i ++ ) {
00121     QADC_[i] = 0;
00122   }
00123   
00124   for( int i = 0; i < 4; i++ ) {    
00125     rms_shape_[i] = 0;
00126     mean_shape_[i] = 0;
00127     rms_time_[i] = 0;
00128     mean_time_[i] = 0;
00129     rms_energy_[i] = 0;
00130     mean_energy_[i] = 0;
00131 
00132     rms_shapeDep_[i] = 0;
00133     mean_shapeDep_[i] = 0;
00134     rms_timeDep_[i] = 0;
00135     mean_timeDep_[i] = 0;
00136     rms_energyDep_[i] = 0;
00137     mean_energyDep_[i] = 0;
00138 
00139     avg_shape_[i] = 0;
00140     avg_time_[i] = 0;
00141     avg_energy_[i] = 0;
00142   }
00143 
00144   dqmReportMapErr_.clear(); dqmReportMapWarn_.clear(); dqmReportMapOther_.clear();
00145   dqmQtests_.clear();
00146 }
00147 
00148 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00149 void HcalLaserClient::report() {
00150   if( !dbe_ ) return;
00151   if( debug_ ) cout << "HcalLaserClient: report" << endl;
00152   
00153   char name[256];
00154   sprintf( name, "%sHcal/LaserMonitor/Laser Task Event Number", process_.c_str() );
00155   MonitorElement* me = dbe_->get(name);
00156   if( me ) {
00157     string s = me->valueString();
00158     ievt_ = -1;
00159     sscanf( (s.substr( 2, s.length()-2 )).c_str(), "%d", &ievt_ );
00160     if( debug_ ) cout << "Found '" << name << "'" << endl;
00161   }
00162   getHistograms();
00163 }
00164 
00165 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00166 void HcalLaserClient::getHistograms() {
00167   if( !dbe_ ) return;
00168   char name[256];
00169 
00170   //Get mean/rms maps by Geometry
00171   MonitorElement* meDepTimeMean[4];
00172   MonitorElement* meDepTimeRMS[4];
00173   MonitorElement* meDepShapeMean[4];
00174   MonitorElement* meDepShapeRMS[4];
00175   MonitorElement* meDepEnergyMean[4];
00176   MonitorElement* meDepEnergyRMS[4];
00177 
00178   for( int i = 0; i < 4; i++ ) {
00179     sprintf( name, "%sHcal/LaserMonitor/Laser Mean Time Depth %d", process_.c_str(), i+1 );
00180     meDepTimeMean[i] = dbe_->get(name);
00181     sprintf( name, "%sHcal/LaserMonitor/Laser RMS Time Depth %d", process_.c_str(), i+1 );
00182     meDepTimeRMS[i] = dbe_->get(name);
00183     sprintf( name, "%sHcal/LaserMonitor/2DShape/Laser Mean Shape Depth %d", process_.c_str(), i+1 );
00184     meDepShapeMean[i] = dbe_->get(name);
00185     sprintf( name, "%sHcal/LaserMonitor/2DShape/Laser RMS Shape Depth %d", process_.c_str(), i+1 );
00186     meDepShapeRMS[i] = dbe_->get(name);
00187     sprintf( name, "%sHcal/LaserMonitor/Laser Mean Energy Depth %d", process_.c_str(), i+1 );
00188     meDepEnergyMean[i] = dbe_->get(name);
00189     sprintf( name, "%sHcal/LaserMonitor/Laser RMS Energy Depth %d", process_.c_str(), i+1 );
00190     meDepEnergyRMS[i] = dbe_->get(name);
00191 
00192     if(meDepTimeMean[i])   dbe_->softReset( meDepTimeMean[i] );
00193     if(meDepTimeRMS[i])    dbe_->softReset( meDepTimeRMS[i] );
00194     if(meDepEnergyMean[i]) dbe_->softReset( meDepEnergyMean[i] );
00195     if(meDepEnergyRMS[i])  dbe_->softReset( meDepEnergyRMS[i] );
00196     if(meDepShapeMean[i])  dbe_->softReset( meDepShapeMean[i] );
00197     if(meDepShapeRMS[i])   dbe_->softReset( meDepShapeRMS[i] );
00198   }
00199 
00200   // Fill Histos
00201   // TDC
00202   sprintf( name, "LaserMonitor/QADCTDC/TDC Number of Channels" );
00203   TDCNumChannels_ = getHisto( name, process_, dbe_, debug_, cloneME_ );
00204   sprintf( name, "LaserMonitor/QADCTDC/TDC Trigger" );
00205   TDCTrigger_ = getHisto( name, process_, dbe_, debug_, cloneME_ );
00206   sprintf( name, "LaserMonitor/QADCTDC/TDC Raw Optosync" );
00207   TDCRawOptosync_ = getHisto( name, process_, dbe_, debug_, cloneME_ );
00208   sprintf( name, "LaserMonitor/QADCTDC/TDC Clock Optosync" );
00209   TDCClockOptosync_ = getHisto( name, process_, dbe_, debug_, cloneME_ );
00210   sprintf( name, "LaserMonitor/QADCTDC/TDC Raw Optosync Minus Trigger" );
00211   TDCRawOptosync_Trigger_ = getHisto( name, process_, dbe_, debug_, cloneME_ );
00212 
00213   for( int i = 0; i < 32; i ++ ) {
00214     sprintf( name, "LaserMonitor/QADCTDC/QDC %02d", i );
00215     QADC_[i] = getHisto( name, process_, dbe_, debug_, cloneME_ );
00216   }
00217 
00218   // Subdetectors
00219   for( int i = 0; i < 4; i++ ) {
00220     if( !subDetsOn_[i] ) continue;
00221     string type = "HB";
00222     if( i==1 ) type = "HE"; 
00223     else if( i==2 ) type = "HF";
00224     else if( i==3 ) type = "HO";
00225 
00226     sprintf( name, "LaserMonitor/%s/%s Ped Subtracted Pulse Shape", type.c_str(), type.c_str() );
00227     avg_shape_[i] = getHisto( name, process_, dbe_, debug_, cloneME_ );
00228     sprintf( name, "LaserMonitor/%s/%s Average Pulse Time", type.c_str(), type.c_str() );
00229     avg_time_[i] = getHisto( name, process_, dbe_, debug_, cloneME_ );
00230     sprintf( name, "LaserMonitor/%s/%s Average Pulse Energy", type.c_str(), type.c_str() );
00231     avg_energy_[i] = getHisto( name, process_, dbe_, debug_, cloneME_ );
00232     
00233     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Shape RMS Values", process_.c_str(), type.c_str(), type.c_str() );
00234     MonitorElement* meShapeRMS = dbe_->get(name);
00235     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Shape Mean Values", process_.c_str(), type.c_str(), type.c_str() );
00236     MonitorElement* meShapeMean = dbe_->get(name);
00237     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Time RMS Values", process_.c_str(), type.c_str(), type.c_str() );
00238     MonitorElement* meTimeRMS = dbe_->get(name);
00239     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Time Mean Values", process_.c_str(), type.c_str(), type.c_str() );
00240     MonitorElement* meTimeMean = dbe_->get(name);
00241     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Energy RMS Values", process_.c_str(), type.c_str(), type.c_str() );
00242     MonitorElement* meEnergyRMS = dbe_->get(name);
00243     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Energy Mean Values", process_.c_str(), type.c_str(), type.c_str() );
00244     MonitorElement* meEnergyMean = dbe_->get(name);
00245 
00246     if( !meShapeRMS || !meShapeMean ) continue;
00247     if( !meTimeRMS || !meTimeMean ) continue;
00248     if( !meEnergyRMS || !meEnergyMean ) continue;
00249     dbe_->softReset( meShapeRMS );  dbe_->softReset( meShapeMean );
00250     dbe_->softReset( meTimeRMS );   dbe_->softReset( meTimeMean );
00251     dbe_->softReset( meEnergyRMS ); dbe_->softReset( meEnergyMean );
00252    
00253     for( int ieta = -42; ieta <= 42; ieta++ ) {
00254       if( ieta == 0 ) continue;
00255       for( int iphi = 1; iphi <= 73; iphi++ ) {
00256         for( int depth = 1; depth <= 4; depth++ ) {
00257           if( !isValidGeom(i, ieta, iphi,depth) ) continue;
00258           HcalSubdetector subdet = HcalBarrel;
00259           if( i == 1 ) subdet = HcalEndcap;       
00260           else if( i == 2 ) subdet = HcalForward;
00261           else if( i == 3 ) subdet = HcalOuter;
00262           
00263           sprintf( name, "%sHcal/LaserMonitor/%s/Expert/%s Laser Shape ieta=%+03d iphi=%02d depth=%d",
00264                    process_.c_str(), type.c_str(), type.c_str(), ieta, iphi, depth );  
00265           MonitorElement* me = dbe_->get(name);
00266           
00267           if( me ) {
00268             meShapeRMS->Fill( me->getRMS() );
00269             meShapeMean->Fill( me->getMean() );
00270             meDepShapeRMS[depth-1]->Fill( ieta, iphi, me->getRMS() );
00271             meDepShapeMean[depth-1]->Fill( ieta, iphi, me->getMean() );
00272           }
00273 
00274           float timeMeanVal = -1; float enMeanVal = -1;
00275           float timeRMSVal = -1; float enRMSVal = -1;
00276 
00277           sprintf( name, "%sHcal/LaserMonitor/%s/Expert/%s Laser Time ieta=%+03d iphi=%02d depth=%d",
00278                    process_.c_str(), type.c_str(), type.c_str(), ieta, iphi, depth );  
00279           me = dbe_->get(name);
00280 
00281           if( me ) {
00282             timeMeanVal = me->getMean();
00283             timeRMSVal = me->getRMS();
00284             meTimeRMS->Fill( timeRMSVal );
00285             meTimeMean->Fill( timeMeanVal );    
00286             meDepTimeRMS[depth-1]->Fill( ieta, iphi, timeRMSVal );
00287             meDepTimeMean[depth-1]->Fill( ieta, iphi, timeMeanVal );
00288           }
00289           
00290           sprintf( name, "%sHcal/LaserMonitor/%s/Expert/%s Laser Energy ieta=%+03d iphi=%02d depth=%d",
00291                    process_.c_str(), type.c_str(), type.c_str(), ieta, iphi, depth );  
00292           me = dbe_->get(name);
00293           
00294           if( me ) {
00295             enMeanVal = me->getMean();
00296             enRMSVal = me->getRMS();
00297             meEnergyRMS->Fill( enRMSVal );
00298             meEnergyMean->Fill( enMeanVal );
00299             meDepEnergyRMS[depth-1]->Fill( ieta, iphi, enRMSVal );
00300             meDepEnergyMean[depth-1]->Fill( ieta, iphi, enMeanVal );
00301           } // end of if me
00302         } // end of for depth
00303       } // end of for iphi
00304     } // end of ieta
00305     
00306     rms_shape_[i] = getHisto( meShapeRMS, debug_, cloneME_ );
00307     mean_shape_[i] = getHisto( meShapeMean, debug_, cloneME_ );
00308     rms_time_[i] = getHisto( meTimeRMS, debug_, cloneME_ );
00309     mean_time_[i] = getHisto( meTimeMean, debug_, cloneME_ );
00310     rms_energy_[i] = getHisto( meEnergyRMS, debug_, cloneME_ );
00311     mean_energy_[i] = getHisto( meEnergyMean, debug_, cloneME_ );
00312   
00313   }
00314 
00315   for( int i = 0; i < 4; i++ ) {
00316     rms_shapeDep_[i] = getHisto2( meDepShapeRMS[i], debug_, cloneME_ );
00317     mean_shapeDep_[i] = getHisto2( meDepShapeMean[i], debug_, cloneME_ );
00318     rms_timeDep_[i] = getHisto2( meDepTimeRMS[i], debug_, cloneME_ );
00319     mean_timeDep_[i] = getHisto2( meDepTimeMean[i], debug_, cloneME_ );
00320     rms_energyDep_[i] = getHisto2( meDepEnergyRMS[i], debug_, cloneME_ );
00321     mean_energyDep_[i] = getHisto2( meDepEnergyMean[i], debug_, cloneME_ );
00322   } 
00323 }
00324 
00325 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00326 void HcalLaserClient::resetAllME() {
00327   if( !dbe_ ) return;
00328   Char_t name[150];    
00329 
00330   sprintf( name, "%sHcal/LaserMonitor/QADCTDC/TDC Number of Channels", process_.c_str() );
00331   resetME( name, dbe_ );
00332   sprintf( name, "%sHcal/LaserMonitor/QADCTDC/TDC Trigger", process_.c_str() );
00333   resetME( name, dbe_ );
00334   sprintf( name, "%sHcal/LaserMonitor/QADCTDC/TDC Raw Optosync", process_.c_str() );
00335   resetME( name, dbe_ );
00336   sprintf( name, "%sHcal/LaserMonitor/QADCTDC/TDC Clock Optosync", process_.c_str() );
00337   resetME( name, dbe_ );
00338   sprintf( name, "%sHcal/LaserMonitor/QADCTDC/TDC Raw Optosync Minus Trigger", process_.c_str() );
00339   resetME( name, dbe_ );
00340 
00341   for( int i = 0; i < 32; i ++ ) {
00342     sprintf( name, "%sHcal/LaserMonitor/QADCTDC/QDC %02d", process_.c_str(), i );
00343     resetME( name, dbe_ );
00344   }  
00345 
00346   for( int i = 1; i <= 4; i++ ) {
00347     sprintf( name, "%sHcal/LaserMonitor/Laser Mean Time Depth %d", process_.c_str(), i );
00348     resetME( name, dbe_ );
00349     sprintf( name, "%sHcal/LaserMonitor/Laser RMS Time Depth %d", process_.c_str(), i );
00350     resetME( name, dbe_ );
00351     sprintf( name, "%sHcal/LaserMonitor/2DShape/Laser Mean Shape Depth %d", process_.c_str(), i );
00352     resetME( name, dbe_ );
00353     sprintf( name, "%sHcal/LaserMonitor/2DShape/Laser RMS Shape Depth %d", process_.c_str(), i );
00354     resetME( name, dbe_ );
00355     sprintf( name, "%sHcal/LaserMonitor/Laser Mean Energy Depth %d", process_.c_str(), i );
00356     resetME( name, dbe_ );
00357     sprintf( name, "%sHcal/LaserMonitor/Laser RMS Energy Depth %d", process_.c_str(), i );
00358     resetME( name, dbe_ );
00359   }
00360 
00361   for( int i = 0; i < 4; i++ ) {
00362     if( !subDetsOn_[i] ) continue;
00363     string type = "HB";
00364     if( i == 1 ) type = "HE"; 
00365     else if( i == 2 ) type = "HF"; 
00366     else if( i == 3 ) type = "HO"; 
00367 
00368     sprintf( name, "%sHcal/LaserMonitor/%s/%s Ped Subtracted Pulse Shape", process_.c_str(), type.c_str(), type.c_str() );
00369     resetME( name, dbe_ );
00370     sprintf( name, "%sHcal/LaserMonitor/%s/%s Ped Subtracted Pulse Shape", process_.c_str(), type.c_str(), type.c_str() );
00371     resetME( name, dbe_ );
00372     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Shape RMS Values", process_.c_str(), type.c_str(), type.c_str() );
00373     resetME( name, dbe_ );
00374     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Shape Mean Values", process_.c_str(), type.c_str(), type.c_str() );
00375     resetME( name, dbe_ );
00376     sprintf( name, "%sHcal/LaserMonitor/%s/%s Average Pulse Time", process_.c_str(), type.c_str(), type.c_str() );
00377     resetME( name, dbe_ );
00378     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Time RMS Values", process_.c_str(), type.c_str(), type.c_str() );
00379     resetME( name, dbe_ );
00380     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Time Mean Values", process_.c_str(), type.c_str(), type.c_str() );
00381     resetME( name, dbe_ );
00382     sprintf( name, "%sHcal/LaserMonitor/%s/%s Average Pulse Energy", process_.c_str(), type.c_str(), type.c_str() );
00383     resetME( name, dbe_ );
00384     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Energy RMS Values", process_.c_str(), type.c_str(), type.c_str() );
00385     resetME( name, dbe_ );
00386     sprintf( name, "%sHcal/LaserMonitor/%s/%s Laser Energy Mean Values", process_.c_str(), type.c_str(), type.c_str() );
00387     resetME( name, dbe_ );
00388     
00389     for( int ieta = -42; ieta < 42; ieta++ ) {
00390       if( ieta == 0 ) continue;
00391       for( int iphi = 0; iphi < 73; iphi++ ) {
00392         for( int depth = 1; depth < 4; depth++ ) {
00393           if( !isValidGeom(i, ieta, iphi, depth) ) continue;
00394           sprintf( name, "%sHcal/LaserMonitor/%s/Expert/%s Laser Shape ieta=%+03d iphi=%02d depth=%d",
00395                    process_.c_str(), type.c_str(), type.c_str(), ieta, iphi, depth );  
00396           resetME( name, dbe_ );
00397           sprintf( name, "%sHcal/LaserMonitor/%s/Expert/%s Laser Time ieta=%+03d iphi=%02d depth=%d",
00398                    process_.c_str(), type.c_str(), type.c_str(), ieta, iphi, depth );  
00399           resetME( name, dbe_ );
00400           sprintf( name, "%sHcal/LaserMonitor/%s/Expert/%s Laser Energy ieta=%+03d iphi=%02d depth=%d",
00401                    process_.c_str(), type.c_str(), type.c_str(), ieta, iphi, depth );  
00402           resetME( name, dbe_ );
00403         } // end of for depth
00404       } // end of for iphi
00405     } // end of for ieta
00406   } // end of for i (subdet)
00407 }
00408 
00409 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00410 void HcalLaserClient::htmlOutput( int runNo, string htmlDir, string htmlName ) {
00411   
00412   cout << "Preparing HcalLaserClient html output ..." << endl;
00413   string client = "LaserMonitor";
00414   htmlErrors( runNo, htmlDir, client, process_, dbe_, dqmReportMapErr_, dqmReportMapWarn_, dqmReportMapOther_ );
00415 
00416   ofstream htmlFile;
00417   htmlFile.open( (htmlDir + htmlName).c_str() );
00418 
00419   // html page header
00420   htmlFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
00421   htmlFile << "<html>  " << endl;
00422   htmlFile << "<head>  " << endl;
00423   htmlFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
00424   htmlFile << " https-equiv=\"content-type\">  " << endl;
00425   htmlFile << "  <title>Monitor: Hcal Laser Task output</title> " << endl;
00426   htmlFile << "</head>  " << endl;
00427   htmlFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00428   htmlFile << "<body>  " << endl;
00429   htmlFile << "<br>  " << endl;
00430   htmlFile << "<h2>Run:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << endl;
00431   htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
00432   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << runNo << "</span></h2>" << endl;
00433   htmlFile << "<h2>Monitoring task:&nbsp;&nbsp;&nbsp;&nbsp; <span " << endl;
00434   htmlFile << " style=\"color: rgb(0, 0, 153);\">Hcal Laser</span></h2> " << endl;
00435 
00436   htmlFile << "<h2>Events processed:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << endl;
00437   htmlFile << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span " << endl;
00438   htmlFile << " style=\"color: rgb(0, 0, 153);\">" << ievt_ << "</span></h2>" << endl;
00439 
00440   htmlFile << "<hr>" << endl;
00441   htmlFile << "<table  width=100% border=1><tr>" << endl;
00442   if( hasErrors() ) htmlFile << "<td bgcolor=red><a href=\"LaserMonitorErrors.html\">Errors in this task</a></td>" << endl;
00443   else htmlFile << "<td bgcolor=lime>No Errors</td>" << endl;
00444   if( hasWarnings() ) htmlFile << "<td bgcolor=yellow><a href=\"LaserMonitorWarnings.html\">Warnings in this task</a></td>" << endl;
00445   else htmlFile << "<td bgcolor=lime>No Warnings</td>" << endl;
00446   if( hasOther() ) htmlFile << "<td bgcolor=aqua><a href=\"LaserMonitorMessages.html\">Messages in this task</a></td>" << endl;
00447   else htmlFile << "<td bgcolor=lime>No Messages</td>" << endl;
00448   htmlFile << "</tr></table>" << endl;
00449   htmlFile << "<hr>" << endl;
00450   
00451   htmlFile << "<h2><strong>Hcal Laser Histograms</strong></h2>" << endl;
00452   htmlFile << "<h3>" << endl;
00453   htmlFile << "<a href=\"#QADCTDC_Plots\">QADCTDC Plots </a></br>" << endl;
00454   htmlFile << "<a href=\"#GEO_Plots\">Geometry Plots </a></br>" << endl;
00455   if( subDetsOn_[0] ) htmlFile << "<a href=\"#HB_Plots\">HB Plots </a></br>" << endl;
00456   if( subDetsOn_[1] ) htmlFile << "<a href=\"#HE_Plots\">HE Plots </a></br>" << endl;
00457   if( subDetsOn_[2] ) htmlFile << "<a href=\"#HF_Plots\">HF Plots </a></br>" << endl;
00458   if( subDetsOn_[3] ) htmlFile << "<a href=\"#HO_Plots\">HO Plots </a></br>" << endl;
00459   htmlFile << "</h3>" << endl;
00460   htmlFile << "<hr>" << endl;
00461 
00462   htmlFile << "<table border=\"0\" cellspacing=\"0\" " << endl;
00463   htmlFile << "cellpadding=\"10\"> " << endl;
00464   
00465   htmlFile << "<tr align=\"left\">" << endl;
00466   htmlFile << "<td>&nbsp;&nbsp;&nbsp;<a name=\"QADCTDC_Plots\"><h3>QADCTDC Histograms</h3></td></tr>" << endl;
00467   histoHTML( runNo, TDCNumChannels_, "Number of Channels", "Events",  92, htmlFile, htmlDir );
00468   htmlFile << "</tr>" << endl;
00469   histoHTML( runNo, TDCTrigger_, "Time (ns)", "Events",  92, htmlFile, htmlDir );
00470   histoHTML( runNo, TDCRawOptosync_Trigger_, "Time (ns)", "Events", 100, htmlFile, htmlDir );
00471   htmlFile << "</tr>" << endl;
00472   histoHTML( runNo, TDCRawOptosync_, "Time (ns)", "Events",  92, htmlFile, htmlDir );
00473   histoHTML( runNo, TDCClockOptosync_, "Time (ns)", "Events", 100, htmlFile, htmlDir );
00474   htmlFile << "</tr>" << endl;
00475   histoHTML( runNo, QADC_[3], "ADC Counts", "Events",  92, htmlFile, htmlDir );
00476   histoHTML( runNo, QADC_[0], "ADC Counts", "Events", 100, htmlFile, htmlDir );
00477   htmlFile << "</tr>" << endl;
00478   histoHTML( runNo, QADC_[4], "ADC Counts", "Events",  92, htmlFile, htmlDir );
00479   histoHTML( runNo, QADC_[1], "ADC Counts", "Events", 100, htmlFile, htmlDir );
00480   htmlFile << "</tr>" << endl;
00481   histoHTML( runNo, QADC_[5], "ADC Counts", "Events",  92, htmlFile, htmlDir );
00482   histoHTML( runNo, QADC_[2], "ADC Counts", "Events", 100, htmlFile, htmlDir );
00483   htmlFile << "</tr>" << endl;
00484 
00485   htmlFile << "<tr align=\"left\">" << endl;
00486   htmlFile << "<td>&nbsp;&nbsp;&nbsp;<a name=\"GEO_Plots\"><h3>Geometry Histograms</h3></td></tr>" << endl;
00487   histoHTML2( runNo, mean_energyDep_[0], "iEta", "iPhi", 92, htmlFile, htmlDir );
00488   histoHTML2( runNo, rms_energyDep_[0], "iEta", "iPhi", 100, htmlFile, htmlDir );
00489   htmlFile << "</tr>" << endl;
00490   htmlFile << "<tr align=\"left\">" << endl;
00491   histoHTML2( runNo, mean_energyDep_[1], "iEta", "iPhi", 92, htmlFile, htmlDir );
00492   histoHTML2( runNo, rms_energyDep_[1], "iEta", "iPhi", 100, htmlFile, htmlDir );
00493   htmlFile << "</tr>" << endl;
00494   htmlFile << "<tr align=\"left\">" << endl;
00495   histoHTML2( runNo, mean_energyDep_[2], "iEta", "iPhi", 92, htmlFile, htmlDir );
00496   histoHTML2( runNo, rms_energyDep_[2], "iEta", "iPhi", 100, htmlFile, htmlDir );
00497   htmlFile << "</tr>" << endl;
00498   htmlFile << "<tr align=\"left\">" << endl;
00499   histoHTML2( runNo, mean_energyDep_[3], "iEta", "iPhi", 92, htmlFile, htmlDir );
00500   histoHTML2( runNo, rms_energyDep_[3], "iEta", "iPhi", 100, htmlFile, htmlDir );
00501   htmlFile << "</tr>" << endl;
00502 
00503   htmlFile << "<tr align=\"left\">" << endl;
00504   histoHTML2( runNo, mean_timeDep_[0], "iEta", "iPhi", 92, htmlFile, htmlDir );
00505   histoHTML2( runNo, rms_timeDep_[0], "iEta", "iPhi", 100, htmlFile, htmlDir );
00506   htmlFile << "</tr>" << endl;
00507   htmlFile << "<tr align=\"left\">" << endl;
00508   histoHTML2( runNo, mean_timeDep_[1], "iEta", "iPhi", 92, htmlFile, htmlDir );
00509   histoHTML2( runNo, rms_timeDep_[1], "iEta", "iPhi", 100, htmlFile, htmlDir );
00510   htmlFile << "</tr>" << endl;
00511   htmlFile << "<tr align=\"left\">" << endl;
00512   histoHTML2( runNo, mean_timeDep_[2], "iEta", "iPhi", 92, htmlFile, htmlDir );
00513   histoHTML2( runNo, rms_timeDep_[2], "iEta", "iPhi", 100, htmlFile, htmlDir );
00514   htmlFile << "</tr>" << endl;
00515   htmlFile << "<tr align=\"left\">" << endl;
00516   histoHTML2( runNo, mean_timeDep_[3], "iEta", "iPhi", 92, htmlFile, htmlDir );
00517   histoHTML2( runNo, rms_timeDep_[3], "iEta", "iPhi", 100, htmlFile, htmlDir );
00518   htmlFile << "</tr>" << endl;
00519 
00520   htmlFile << "<tr align=\"left\">" << endl;
00521   histoHTML2( runNo, mean_shapeDep_[0], "iEta", "iPhi", 92, htmlFile, htmlDir );
00522   histoHTML2( runNo, rms_shapeDep_[0], "iEta", "iPhi", 100, htmlFile, htmlDir );
00523   htmlFile << "</tr>" << endl;
00524   htmlFile << "<tr align=\"left\">" << endl;
00525   histoHTML2( runNo, mean_shapeDep_[1], "iEta", "iPhi", 92, htmlFile, htmlDir );
00526   histoHTML2( runNo, rms_shapeDep_[1], "iEta", "iPhi", 100, htmlFile, htmlDir );
00527   htmlFile << "</tr>" << endl;
00528   htmlFile << "<tr align=\"left\">" << endl;
00529   histoHTML2( runNo, mean_shapeDep_[2], "iEta", "iPhi", 92, htmlFile, htmlDir );
00530   histoHTML2( runNo, rms_shapeDep_[2], "iEta", "iPhi", 100, htmlFile, htmlDir );
00531   htmlFile << "</tr>" << endl;
00532   htmlFile << "<tr align=\"left\">" << endl;
00533   histoHTML2( runNo, mean_shapeDep_[3], "iEta", "iPhi", 92, htmlFile, htmlDir );
00534   histoHTML2( runNo, rms_shapeDep_[3], "iEta", "iPhi", 100, htmlFile, htmlDir );
00535   htmlFile << "</tr>" << endl;
00536 
00537   for( int i = 0; i < 4; i++ ) {
00538     if( !subDetsOn_[i] ) continue; 
00539     string type = "HB";
00540     if( i == 1 ) type = "HE"; 
00541     else if( i == 2 ) type = "HF"; 
00542     else if( i == 3 ) type = "HO"; 
00543      
00544     htmlFile << "<tr align=\"left\">" << endl;  
00545     htmlFile << "<td>&nbsp;&nbsp;&nbsp;<a name=\""<<type<<"_Plots\"><h3>" << type << " Histograms</h3></td></tr>" << endl;
00546      
00547     htmlFile << "<tr align=\"left\">" << endl;
00548     histoHTML( runNo, avg_shape_[i], "Timeslice (25ns)", "Events", 92, htmlFile, htmlDir );
00549     histoHTML( runNo, avg_time_[i], "Timeslice (25ns)", "Events", 100, htmlFile, htmlDir );
00550     htmlFile << "</tr>" << endl;
00551      
00552     htmlFile << "<tr align=\"left\">" << endl;
00553     histoHTML( runNo, avg_energy_[i], "ADC Sum", "Events", 92, htmlFile, htmlDir );
00554     htmlFile << "</tr>" << endl;
00555 
00556     htmlFile << "<tr align=\"left\">" << endl;
00557     histoHTML( runNo, mean_shape_[i], "Timeslice (25ns)", "Channels", 100, htmlFile, htmlDir );
00558     histoHTML( runNo, rms_shape_[i], "Timeslice (25ns)", "Channels", 92, htmlFile, htmlDir );
00559     htmlFile << "</tr>" << endl;
00560 
00561     htmlFile << "<tr align=\"left\">" << endl;
00562     histoHTML( runNo, mean_time_[i], "Timeslice (25ns)", "Channels", 100, htmlFile, htmlDir );
00563     histoHTML( runNo, rms_time_[i], "Timeslice (25ns)", "Channels", 92, htmlFile, htmlDir );
00564     htmlFile << "</tr>" << endl;
00565 
00566     htmlFile << "<tr align=\"left\">" << endl;
00567     histoHTML( runNo, mean_energy_[i], "ADC Sum", "Channels", 100, htmlFile, htmlDir );
00568     histoHTML( runNo, rms_energy_[i], "ADC Sum", "Channels", 92, htmlFile, htmlDir );
00569     htmlFile << "</tr>" << endl;
00570   }
00571   htmlFile << "</table>" << endl;
00572   htmlFile << "<br>" << endl;
00573 
00574   // html page footer
00575   htmlFile << "</body> " << endl;
00576   htmlFile << "</html> " << endl;
00577 
00578   htmlFile.close();
00579 }
00580 
00581 
00582 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
00583 void HcalLaserClient::loadHistograms( TFile* infile ) {
00584 
00585   TNamed* tnd = (TNamed*)infile->Get( "DQMData/Hcal/LaserMonitor/Laser Task Event Number" );
00586   if(tnd) {
00587     string s = tnd->GetTitle();
00588     ievt_ = -1;
00589     sscanf( (s.substr(2, s.length()-2)).c_str(), "%d", &ievt_ );
00590   }
00591   char name[256];
00592 
00593   sprintf( name, "DQMData/Hcal/LaserMonitor/QADCTDC/TDC Number of Channels" );
00594   TDCNumChannels_ = (TH1F*)infile->Get(name);
00595   sprintf( name, "DQMData/Hcal/LaserMonitor/QADCTDC/TDC Trigger" );
00596   TDCTrigger_ = (TH1F*)infile->Get(name);
00597   sprintf( name, "DQMData/Hcal/LaserMonitor/QADCTDC/TDC Raw Optosync" );
00598   TDCRawOptosync_ = (TH1F*)infile->Get(name);
00599   sprintf( name, "DQMData/Hcal/LaserMonitor/QADCTDC/TDC Clock Optosync" );
00600   TDCClockOptosync_ = (TH1F*)infile->Get(name);
00601   sprintf( name, "DQMData/Hcal/LaserMonitor/QADCTDC/TDC Raw Optosync Minus Trigger" );
00602   TDCRawOptosync_Trigger_ = (TH1F*)infile->Get(name);
00603 
00604   for( int i = 0; i < 4; i++ ) {
00605     sprintf( name, "%sHcal/LaserMonitor/Laser Mean Time Depth %d", process_.c_str(), i+1 );
00606     mean_timeDep_[i] = (TH2F*)infile->Get(name);
00607     sprintf( name, "%sHcal/LaserMonitor/Laser RMS Time Depth %d", process_.c_str(), i+1 );
00608     rms_timeDep_[i] = (TH2F*)infile->Get(name);
00609     sprintf( name, "%sHcal/LaserMonitor/2DShape/Laser Mean Shape Depth %d", process_.c_str(), i+1 );
00610     mean_shapeDep_[i] = (TH2F*)infile->Get(name);
00611     sprintf( name, "%sHcal/LaserMonitor/2DShape/Laser RMS Shape Depth %d", process_.c_str(), i+1 );
00612     rms_shapeDep_[i] = (TH2F*)infile->Get(name);
00613     sprintf( name, "%sHcal/LaserMonitor/Laser Mean Energy Depth %d", process_.c_str(), i+1 );
00614     mean_energyDep_[i] = (TH2F*)infile->Get(name);
00615     sprintf( name, "%sHcal/LaserMonitor/Laser RMS Energy Depth %d", process_.c_str(), i+1 );
00616     rms_energyDep_[i] = (TH2F*)infile->Get(name);
00617   }
00618 
00619   for( int i = 0; i < 4; i++ ) {
00620     if( !subDetsOn_[i] ) continue; 
00621     string type = "HB";
00622     if( i == 1 ) type = "HE"; 
00623     else if( i == 2 ) type = "HF"; 
00624     else if( i == 3 ) type = "HO";
00625 
00626     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Ped Subtracted Pulse Shape", type.c_str(), type.c_str() );      
00627     avg_shape_[i] = (TH1F*)infile->Get(name);
00628     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Average Pulse Time", type.c_str(), type.c_str() );      
00629     avg_time_[i] = (TH1F*)infile->Get(name);
00630     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Average Pulse Energy", type.c_str(), type.c_str() );      
00631     avg_energy_[i] = (TH1F*)infile->Get(name);
00632     
00633     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Laser Shape RMS Values", type.c_str(), type.c_str() );
00634     rms_shape_[i] = (TH1F*)infile->Get(name);
00635     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Laser Shape Mean Values", type.c_str(), type.c_str() );
00636     mean_shape_[i] = (TH1F*)infile->Get(name);
00637 
00638     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Laser Time RMS Values", type.c_str(), type.c_str() );
00639     rms_time_[i] = (TH1F*)infile->Get(name);
00640     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Laser Time Mean Values", type.c_str(), type.c_str() );
00641     mean_time_[i] = (TH1F*)infile->Get(name);
00642 
00643     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Laser Energy RMS Values", type.c_str(), type.c_str() );
00644     rms_energy_[i] = (TH1F*)infile->Get(name);
00645     sprintf( name, "DQMData/Hcal/LaserMonitor/%s/%s Laser Energy Mean Values", type.c_str(), type.c_str() );
00646     mean_energy_[i] = (TH1F*)infile->Get(name);
00647 
00648     for( int ieta = -42; ieta <= 42; ieta++ ) {
00649       if( ieta == 0 ) continue;
00650       for( int iphi = 1; iphi <= 73; iphi++ ) {
00651         for( int depth = 1; depth <= 4; depth++ ) {
00652           if( !isValidGeom(i, ieta, iphi, depth) ) continue;
00653           sprintf( name, "DQMData/Hcal/LaserMonitor/%s/Expert/%s Laser Shape ieta=%+03d iphi=%02d depth=%d",
00654                    type.c_str(), type.c_str(), ieta, iphi, depth );  
00655           TH1F* h = (TH1F*)infile->Get(name);
00656           if( h ) {
00657             rms_shape_[i]->Fill( h->GetRMS() );
00658             mean_shape_[i]->Fill( h->GetMean() );
00659           }
00660           
00661           sprintf( name, "DQMData/Hcal/LaserMonitor/%s/Expert/%s Laser Time ieta=%+03d iphi=%02d depth=%d",
00662                    type.c_str(), type.c_str(), ieta, iphi, depth );  
00663           h = (TH1F*)infile->Get(name);
00664           if( h ) {
00665             rms_time_[i]->Fill( h->GetRMS() );
00666             mean_time_[i]->Fill( h->GetMean() );
00667           }       
00668 
00669           sprintf( name, "DQMData/Hcal/LaserMonitor/%s/Expert/%s Laser Energy ieta=%+03d iphi=%02d depth=%d",
00670                    type.c_str(), type.c_str(), ieta, iphi, depth );  
00671           h = (TH1F*)infile->Get(name);
00672           if( h ) {
00673             rms_energy_[i]->Fill( h->GetRMS() );
00674             mean_energy_[i]->Fill( h->GetMean() );
00675           } // end of if h        
00676         } // end of for depth
00677       } // end of for iphi
00678     } // end of for ieta
00679   } // end of for i (subdet)
00680 }

Generated on Tue Jun 9 17:32:56 2009 for CMSSW by  doxygen 1.5.4