CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/CondTools/Ecal/interface/EcalChannelStatusHandler.h

Go to the documentation of this file.
00001 #ifndef ECAL_CHANNELSTATUS_HANDLER_H
00002 #define ECAL_CHANNELSTATUS_HANDLER_H
00003 
00004 #include <typeinfo>
00005 #include <vector>
00006 #include <string>
00007 #include <map>
00008 #include <sstream>
00009 #include <iostream>
00010 #include <fstream>
00011 #include <math.h>
00012 #include <time.h>
00013 #include "TTree.h"
00014 #include "TFile.h"
00015 
00016 #include "CondCore/PopCon/interface/PopConSourceHandler.h"
00017 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
00018 
00019 
00020 #include "FWCore/ServiceRegistry/interface/Service.h"
00021 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00022 #include "FWCore/Framework/interface/ESHandle.h"
00023 #include "FWCore/Framework/interface/Event.h"
00024 #include "FWCore/Framework/interface/MakerMacros.h"
00025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00027 #include "DataFormats/Common/interface/Handle.h"
00028 #include "FWCore/Framework/interface/EventSetup.h"
00029 #include "FWCore/Framework/interface/EventSetupRecordKey.h"
00030 
00031 #include "CondTools/Ecal/interface/EcalErrorMask.h"
00032 #include "CondTools/Ecal/interface/EcalErrorDictionary.h"
00033 
00034 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
00035 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
00036 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
00037 #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
00038 
00039 #include "OnlineDB/EcalCondDB/interface/MonLaserBlueDat.h"
00040 #include "OnlineDB/EcalCondDB/interface/MonPNBlueDat.h"
00041 #include "OnlineDB/EcalCondDB/interface/MonTimingLaserBlueCrystalDat.h"
00042 #include "OnlineDB/EcalCondDB/interface/RunCrystalErrorsDat.h"
00043 #include "OnlineDB/EcalCondDB/interface/RunTTErrorsDat.h"
00044 #include "OnlineDB/EcalCondDB/interface/all_od_types.h"
00045 #include "OnlineDB/EcalCondDB/interface/all_fe_config_types.h"
00046 #include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h"
00047 
00048 #include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h"
00049 #include "OnlineDB/Oracle/interface/Oracle.h"
00050 #include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"
00051 
00052 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00053 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00054 #include "DataFormats/Provenance/interface/Timestamp.h"
00055 
00056 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
00057 #include "Geometry/EcalMapping/interface/EcalMappingRcd.h"
00058 
00059 
00060 #include "TProfile2D.h"
00061 
00062 namespace edm {
00063   class ParameterSet;
00064   class Event;
00065   class EventSetup;
00066 }
00067 
00068 namespace popcon {
00069   
00070   
00071   class EcalChannelStatusHandler : public popcon::PopConSourceHandler<EcalChannelStatus>
00072     {
00073       
00074     public:
00075       EcalChannelStatusHandler(edm::ParameterSet const &);
00076       ~EcalChannelStatusHandler(); 
00077       
00078       void getNewObjects();
00079       void setElectronicsMap(const EcalElectronicsMapping*);
00080       
00081       std::string id() const { return m_name;}
00082       EcalCondDBInterface* econn;
00083 
00084       
00085       // checks on pedestals
00086       float checkPedestalValueGain12( EcalPedestals::Item* item);
00087       float checkPedestalValueGain6( EcalPedestals::Item* item);
00088       float checkPedestalValueGain1( EcalPedestals::Item* item);
00089       float checkPedestalRMSGain12( EcalPedestals::Item* item );
00090       float checkPedestalRMSGain6( EcalPedestals::Item* item );
00091       float checkPedestalRMSGain1( EcalPedestals::Item* item );
00092       
00093       // check which laser sectors are on
00094       void nBadLaserModules( std::map<EcalLogicID, MonLaserBlueDat> dataset_mon );
00095 
00096       // to mask channels reading from pedestal
00097       void pedOnlineMasking();
00098       void pedMasking();
00099       void laserMasking();
00100       void physicsMasking();
00101 
00102       // to read the daq configuration
00103       void daqOut(RunIOV myRun);
00104 
00105       // real analysis
00106       void pedAnalysis( std::map<EcalLogicID, MonPedestalsDat> dataset_mon, std::map<EcalLogicID, MonCrystalConsistencyDat> wrongGain_mon );
00107       void laserAnalysis( std::map<EcalLogicID, MonLaserBlueDat> dataset_mon );
00108       void cosmicsAnalysis( std::map<EcalLogicID, MonPedestalsOnlineDat> pedestalO_mon, std::map<EcalLogicID, MonCrystalConsistencyDat> wrongGain_mon, std::map<EcalLogicID, MonLaserBlueDat> laser_mon, std::map<EcalLogicID, MonOccupancyDat> occupancy_mon );
00109       
00110     private:
00111       
00112       unsigned int m_firstRun ;
00113       unsigned int m_lastRun ;
00114       
00115       std::string m_location;
00116       std::string m_gentag;
00117       std::string m_runtype;                    
00118       std::string m_sid;
00119       std::string m_user;
00120       std::string m_pass;
00121       std::string m_locationsource;
00122       std::string m_name;
00123 
00124       bool isGoodLaserEBSm[36][2];
00125       bool isGoodLaserEESm[18][2];
00126       bool isEBRef1[36][2];
00127       bool isEBRef2[36][2];
00128       bool isEERef1[18][2];
00129       bool isEERef2[18][2];
00130 
00131       EcalElectronicsMapping ecalElectronicsMap_;
00132 
00133       ofstream *ResFileEB;
00134       ofstream *ResFileEE;
00135       ofstream *ResFileNewEB;
00136       ofstream *ResFileNewEE;
00137       ofstream *daqFile;
00138       ofstream *daqFile2;
00139 
00140       std::map<DetId, float> maskedOnlinePedEB, maskedOnlinePedEE;
00141       std::map<DetId, float> maskedPedEB, maskedPedEE;
00142       std::map<DetId, float> maskedLaserEB, maskedLaserEE;
00143       std::map<DetId, float> maskedPhysicsEB, maskedPhysicsEE;
00144 
00145       TProfile2D *newBadEB_;
00146       TProfile2D *newBadEEP_;
00147       TProfile2D *newBadEEM_;
00148     };
00149 }
00150 #endif
00151