00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #include "DQM/L1TMonitor/interface/L1THCALTPG.h"
00063 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00064 #include "DQMServices/Core/interface/DQMStore.h"
00065
00066 using namespace edm;
00067
00068
00069
00070 const unsigned int RTPBINS = 101;
00071 const float RTPMIN = -0.5;
00072 const float RTPMAX = 100.5;
00073
00074 const unsigned int TPPHIBINS = 72;
00075 const float TPPHIMIN = 0.5;
00076 const float TPPHIMAX = 72.5;
00077
00078 const unsigned int TPETABINS = 65;
00079 const float TPETAMIN = -32.5;
00080 const float TPETAMAX = 32.5;
00081
00082
00083 L1THCALTPG::L1THCALTPG(const ParameterSet& ps)
00084 : hcaltpgSource_( ps.getParameter< InputTag >("hcaltpgSource") )
00085 {
00086
00087
00088 verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00089
00090 if(verbose_) std::cout << "L1THCALTPG: constructor...." << std::endl;
00091
00092
00093 dbe = NULL;
00094 if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
00095 {
00096 dbe = Service<DQMStore>().operator->();
00097 dbe->setVerbose(0);
00098 }
00099
00100 outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
00101 if ( outputFile_.size() != 0 ) {
00102 std::cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << std::endl;
00103 }
00104
00105 bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
00106 if(disable){
00107 outputFile_="";
00108 }
00109
00110
00111 if ( dbe !=NULL ) {
00112 dbe->setCurrentFolder("L1T/L1THCALTPG");
00113 }
00114
00115
00116 }
00117
00118 L1THCALTPG::~L1THCALTPG()
00119 {
00120 }
00121
00122 void L1THCALTPG::beginJob(const EventSetup& c)
00123 {
00124
00125 nev_ = 0;
00126
00127
00128 DQMStore* dbe = 0;
00129 dbe = Service<DQMStore>().operator->();
00130
00131 if ( dbe ) {
00132 dbe->setCurrentFolder("L1T/L1THCALTPG");
00133 dbe->rmdir("L1T/L1THCALTPG");
00134 }
00135
00136
00137 if ( dbe )
00138 {
00139 dbe->setCurrentFolder("L1T/L1THCALTPG");
00140 hcalTpEtEtaPhi_ =
00141 dbe->book2D("HcalTpEtEtaPhi", "HCAL TP E_{T}", TPPHIBINS, TPPHIMIN,
00142 TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00143 hcalTpOccEtaPhi_ =
00144 dbe->book2D("HcalTpOccEtaPhi", "HCAL TP OCCUPANCY", TPPHIBINS,
00145 TPPHIMIN, TPPHIMAX, TPETABINS, TPETAMIN, TPETAMAX);
00146 hcalTpRank_ =
00147 dbe->book1D("HcalTpRank", "HCAL TP RANK", RTPBINS, RTPMIN, RTPMAX);
00148
00149 }
00150 }
00151
00152
00153 void L1THCALTPG::endJob(void)
00154 {
00155 if(verbose_) std::cout << "L1THCALTPG: end job...." << std::endl;
00156 LogInfo("EndJob") << "analyzed " << nev_ << " events";
00157
00158 if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
00159
00160 return;
00161 }
00162
00163 void L1THCALTPG::analyze(const Event& e, const EventSetup& c)
00164 {
00165 nev_++;
00166 if(verbose_) std::cout << "L1THCALTPG: analyze...." << std::endl;
00167
00168 edm::Handle<HcalTrigPrimDigiCollection> hcalTpgs;
00169 e.getByLabel(hcaltpgSource_, hcalTpgs);
00170
00171 if (!hcalTpgs.isValid()) {
00172 edm::LogInfo("DataNotFound") << "can't find HCAL TPG's with label "
00173 << hcaltpgSource_.label() ;
00174 return;
00175 }
00176
00177
00178
00179 for ( HcalTrigPrimDigiCollection::const_iterator i = hcalTpgs->begin();
00180 i != hcalTpgs->end(); ++i ) {
00181
00182 if (verbose_)
00183 {
00184 std::cout << "size " << i->size() << std::endl;
00185 std::cout << "iphi " << i->id().iphi() << std::endl;
00186 std::cout << "ieta " << i->id().ieta() << std::endl;
00187 std::cout << "compressed Et " << i->SOI_compressedEt() << std::endl;
00188 std::cout << "FG bit " << i->SOI_fineGrain() << std::endl;
00189 std::cout << "raw " << i->t0().raw() << std::endl;
00190 std::cout << "raw Et " << i->t0().compressedEt() << std::endl;
00191 std::cout << "raw FG " << i->t0().fineGrain() << std::endl;
00192
00193
00194
00195 }
00196
00197 int e = i->SOI_compressedEt();
00198 if ( e != 0 ) {
00199
00200 hcalTpOccEtaPhi_->Fill(i->id().iphi(), i->id().ieta());
00201 hcalTpEtEtaPhi_ ->Fill(i->id().iphi(), i->id().ieta(),
00202 i->SOI_compressedEt());
00203
00204 hcalTpRank_->Fill(i->SOI_compressedEt());
00205
00206 }
00207 }
00208
00209 }
00210