00001
00002
00003
00006
00007
00008
00009 #include <vector>
00010 #include <numeric>
00011 #include <fstream>
00012 #include <math.h>
00013 #include "TNamed.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015 #include "FWCore/ServiceRegistry/interface/Service.h"
00016
00017 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00018 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00019 #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
00020 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00021 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
00022 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00023 #include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
00024 #include "DataFormats/Common/interface/DetSetVector.h"
00025 #include "DataFormats/Common/interface/DetSetVectorNew.h"
00026 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00027 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
00028 #include "DQM/SiStripCommon/interface/SiStripHistoId.h"
00029 #include "DQM/SiStripMonitorCluster/interface/SiStripMonitorCluster.h"
00030 #include "DQMServices/Core/interface/DQMStore.h"
00031 #include "DQMServices/Core/interface/MonitorElement.h"
00032 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00033 #include "DataFormats/SiStripDetId/interface/SiStripSubStructure.h"
00034 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00035 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00036 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00037 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00038 #include "CalibTracker/SiStripCommon/interface/SiStripDCSStatus.h"
00039 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
00040
00041 #include "DPGAnalysis/SiStripTools/interface/APVCyclePhaseCollection.h"
00042 #include "DPGAnalysis/SiStripTools/interface/EventWithHistory.h"
00043
00044
00045 #include "TMath.h"
00046 #include <iostream>
00047
00048
00049 SiStripMonitorCluster::SiStripMonitorCluster(const edm::ParameterSet& iConfig) : dqmStore_(edm::Service<DQMStore>().operator->()), conf_(iConfig), show_mechanical_structure_view(true), show_readout_view(false), show_control_view(false), select_all_detectors(false), reset_each_run(false), m_cacheID_(0)
00050 {
00051
00052 firstEvent = -1;
00053 eventNb = 0;
00054
00055
00056 SubDetPhasePartMap["TIB"] = "TI";
00057 SubDetPhasePartMap["TID__side__1"] = "TI";
00058 SubDetPhasePartMap["TID__side__2"] = "TI";
00059 SubDetPhasePartMap["TOB"] = "TO";
00060 SubDetPhasePartMap["TEC__side__1"] = "TM";
00061 SubDetPhasePartMap["TEC__side__2"] = "TP";
00062
00063
00064 edm::ParameterSet ParametersnClusters = conf_.getParameter<edm::ParameterSet>("TH1nClusters");
00065 layerswitchncluson = ParametersnClusters.getParameter<bool>("layerswitchon");
00066 moduleswitchncluson = ParametersnClusters.getParameter<bool>("moduleswitchon");
00067
00068 edm::ParameterSet ParametersClusterCharge = conf_.getParameter<edm::ParameterSet>("TH1ClusterCharge");
00069 layerswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("layerswitchon");
00070 moduleswitchcluschargeon = ParametersClusterCharge.getParameter<bool>("moduleswitchon");
00071
00072 edm::ParameterSet ParametersClusterStoN = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoN");
00073 layerswitchclusstonon = ParametersClusterStoN.getParameter<bool>("layerswitchon");
00074 moduleswitchclusstonon = ParametersClusterStoN.getParameter<bool>("moduleswitchon");
00075
00076 edm::ParameterSet ParametersClusterStoNVsPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoNVsPos");
00077 layerswitchclusstonVsposon = ParametersClusterStoNVsPos.getParameter<bool>("layerswitchon");
00078 moduleswitchclusstonVsposon = ParametersClusterStoNVsPos.getParameter<bool>("moduleswitchon");
00079
00080 edm::ParameterSet ParametersClusterPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterPos");
00081 layerswitchclusposon = ParametersClusterPos.getParameter<bool>("layerswitchon");
00082 moduleswitchclusposon = ParametersClusterPos.getParameter<bool>("moduleswitchon");
00083
00084 edm::ParameterSet ParametersClusterDigiPos = conf_.getParameter<edm::ParameterSet>("TH1ClusterDigiPos");
00085 layerswitchclusdigiposon = ParametersClusterDigiPos.getParameter<bool>("layerswitchon");
00086 moduleswitchclusdigiposon = ParametersClusterDigiPos.getParameter<bool>("moduleswitchon");
00087
00088 edm::ParameterSet ParametersClusterNoise = conf_.getParameter<edm::ParameterSet>("TH1ClusterNoise");
00089 layerswitchclusnoiseon = ParametersClusterNoise.getParameter<bool>("layerswitchon");
00090 moduleswitchclusnoiseon = ParametersClusterNoise.getParameter<bool>("moduleswitchon");
00091
00092 edm::ParameterSet ParametersClusterWidth = conf_.getParameter<edm::ParameterSet>("TH1ClusterWidth");
00093 layerswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("layerswitchon");
00094 moduleswitchcluswidthon = ParametersClusterWidth.getParameter<bool>("moduleswitchon");
00095
00096 edm::ParameterSet ParametersModuleLocalOccupancy = conf_.getParameter<edm::ParameterSet>("TH1ModuleLocalOccupancy");
00097 layerswitchlocaloccupancy = ParametersModuleLocalOccupancy.getParameter<bool>("layerswitchon");
00098 moduleswitchlocaloccupancy = ParametersModuleLocalOccupancy.getParameter<bool>("moduleswitchon");
00099
00100 edm::ParameterSet ParametersNrOfClusterizedStrips = conf_.getParameter<edm::ParameterSet>("TH1NrOfClusterizedStrips");
00101 layerswitchnrclusterizedstrip = ParametersNrOfClusterizedStrips.getParameter<bool>("layerswitchon");
00102 moduleswitchnrclusterizedstrip = ParametersNrOfClusterizedStrips.getParameter<bool>("moduleswitchon");
00103
00104 edm::ParameterSet ParametersClusterProf = conf_.getParameter<edm::ParameterSet>("TProfNumberOfCluster");
00105 layerswitchnumclusterprofon = ParametersClusterProf.getParameter<bool>("layerswitchon");
00106
00107 edm::ParameterSet ParametersClusterWidthProf = conf_.getParameter<edm::ParameterSet>("TProfClusterWidth");
00108 layerswitchclusterwidthprofon = ParametersClusterWidthProf.getParameter<bool>("layerswitchon");
00109
00110 edm::ParameterSet ParametersTotClusterProf = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfClusters");
00111 subdetswitchtotclusprofon = ParametersTotClusterProf.getParameter<bool>("subdetswitchon");
00112
00113 edm::ParameterSet ParametersTotClusterTH1 = conf_.getParameter<edm::ParameterSet>("TH1TotalNumberOfClusters");
00114 subdetswitchtotclusth1on = ParametersTotClusterTH1.getParameter<bool>("subdetswitchon");
00115
00116 edm::ParameterSet ParametersClusterApvProf = conf_.getParameter<edm::ParameterSet>("TProfClustersApvCycle");
00117 subdetswitchapvcycleprofon = ParametersClusterApvProf.getParameter<bool>("subdetswitchon");
00118
00119 edm::ParameterSet ParametersClustersApvTH2 = conf_.getParameter<edm::ParameterSet>("TH2ClustersApvCycle");
00120 subdetswitchapvcycleth2on = ParametersClustersApvTH2.getParameter<bool>("subdetswitchon");
00121
00122 edm::ParameterSet ParametersApvCycleDBxProf2 = conf_.getParameter<edm::ParameterSet>("TProf2ApvCycleVsDBx");
00123 subdetswitchapvcycledbxprof2on = ParametersApvCycleDBxProf2.getParameter<bool>("subdetswitchon");
00124
00125 edm::ParameterSet ParametersDBxCycleProf = conf_.getParameter<edm::ParameterSet>("TProfClustersVsDBxCycle");
00126 subdetswitchdbxcycleprofon = ParametersDBxCycleProf.getParameter<bool>("subdetswitchon");
00127
00128 edm::ParameterSet ParametersCStripVsCPix = conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
00129 globalswitchcstripvscpix = ParametersCStripVsCPix.getParameter<bool>("globalswitchon");
00130
00131 edm::ParameterSet ParametersMultiplicityRegionsTH1 = conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
00132 globalswitchMultiRegions = ParametersMultiplicityRegionsTH1.getParameter<bool>("globalswitchon");
00133
00134 edm::ParameterSet ParametersApvCycleVsDBxGlobalTH2 = conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
00135 globalswitchapvcycledbxth2on = ParametersApvCycleVsDBxGlobalTH2.getParameter<bool>("globalswitchon");
00136
00137 edm::ParameterSet ParametersNoiseStrip2ApvCycle = conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
00138 globalswitchstripnoise2apvcycle = ParametersNoiseStrip2ApvCycle.getParameter<bool>("globalswitchon");
00139
00140 edm::ParameterSet ParametersNoiseStrip3ApvCycle = conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
00141 globalswitchstripnoise3apvcycle = ParametersNoiseStrip3ApvCycle.getParameter<bool>("globalswitchon");
00142
00143 edm::ParameterSet ParametersMainDiagonalPosition = conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
00144 globalswitchmaindiagonalposition= ParametersMainDiagonalPosition.getParameter<bool>("globalswitchon");
00145
00146 edm::ParameterSet ClusterMultiplicityRegions = conf_.getParameter<edm::ParameterSet>("MultiplicityRegions");
00147 k0 = ClusterMultiplicityRegions.getParameter<double>("k0");
00148 q0 = ClusterMultiplicityRegions.getParameter<double>("q0");
00149 dk0 = ClusterMultiplicityRegions.getParameter<double>("dk0");
00150 maxClus = ClusterMultiplicityRegions.getParameter<double>("MaxClus");
00151 minPix = ClusterMultiplicityRegions.getParameter<double>("MinPix");
00152
00153 clustertkhistomapon = conf_.getParameter<bool>("TkHistoMap_On");
00154 createTrendMEs = conf_.getParameter<bool>("CreateTrendMEs");
00155 Mod_On_ = conf_.getParameter<bool>("Mod_On");
00156
00157 topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
00158
00159
00160
00161 clusterProducerStrip_ = conf_.getParameter<edm::InputTag>("ClusterProducerStrip");
00162 clusterProducerPix_ = conf_.getParameter<edm::InputTag>("ClusterProducerPix");
00163
00164 qualityLabel_ = conf_.getParameter<std::string>("StripQualityLabel");
00165
00166 edm::ParameterSet cluster_condition = conf_.getParameter<edm::ParameterSet>("ClusterConditions");
00167 applyClusterQuality_ = cluster_condition.getParameter<bool>("On");
00168 sToNLowerLimit_ = cluster_condition.getParameter<double>("minStoN");
00169 sToNUpperLimit_ = cluster_condition.getParameter<double>("maxStoN");
00170 widthLowerLimit_ = cluster_condition.getParameter<double>("minWidth");
00171 widthUpperLimit_ = cluster_condition.getParameter<double>("maxWidth");
00172
00173
00174 historyProducer_ = conf_.getParameter<edm::InputTag>("HistoryProducer");
00175
00176 apvPhaseProducer_ = conf_.getParameter<edm::InputTag>("ApvPhaseProducer");
00177
00178
00179 bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
00180 if (checkDCS) dcsStatus_ = new SiStripDCSStatus();
00181 else dcsStatus_ = 0;
00182
00183 }
00184
00185 SiStripMonitorCluster::~SiStripMonitorCluster() {
00186 if (dcsStatus_) delete dcsStatus_;
00187 }
00188
00189
00190 void SiStripMonitorCluster::beginRun(const edm::Run& run, const edm::EventSetup& es){
00191
00192 if (show_mechanical_structure_view) {
00193 unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
00194 if (m_cacheID_ != cacheID) {
00195 m_cacheID_ = cacheID;
00196 edm::LogInfo("SiStripMonitorCluster") <<"SiStripMonitorCluster::beginRun: "
00197 << " Creating MEs for new Cabling ";
00198
00199 createMEs(es);
00200 }
00201 } else if (reset_each_run) {
00202 edm::LogInfo("SiStripMonitorCluster") <<"SiStripMonitorCluster::beginRun: "
00203 << " Resetting MEs ";
00204 for (std::map<uint32_t, ModMEs >::const_iterator idet = ModuleMEsMap.begin() ; idet!=ModuleMEsMap.end() ; idet++) {
00205 ResetModuleMEs(idet->first);
00206 }
00207 }
00208 }
00209
00210
00211 void SiStripMonitorCluster::createMEs(const edm::EventSetup& es){
00212
00213 if ( show_mechanical_structure_view ){
00214
00215 es.get<SiStripDetCablingRcd>().get(SiStripDetCabling_);
00216
00217
00218 std::vector<uint32_t> activeDets;
00219 SiStripDetCabling_->addActiveDetectorsRawIds(activeDets);
00220
00221 SiStripSubStructure substructure;
00222
00223 SiStripFolderOrganizer folder_organizer;
00224 folder_organizer.setSiStripFolderName(topFolderName_);
00225 folder_organizer.setSiStripFolder();
00226
00227
00228
00229 if (clustertkhistomapon) {
00230 if (topFolderName_ == "SiStrip") tkmapcluster = new TkHistoMap("SiStrip/TkHistoMap","TkHMap_NumberOfCluster",0.,1);
00231 else tkmapcluster = new TkHistoMap(topFolderName_+"/TkHistoMap","TkHMap_NumberOfCluster",0.,0);
00232 }
00233
00234
00235 edm::LogInfo("SiStripTkDQM|SiStripMonitorCluster")<<"nr. of activeDets: "<<activeDets.size();
00236 for(std::vector<uint32_t>::iterator detid_iterator = activeDets.begin(); detid_iterator!=activeDets.end(); detid_iterator++){
00237 uint32_t detid = (*detid_iterator);
00238
00239 if(detid == 0) {
00240 activeDets.erase(detid_iterator);
00241 continue;
00242 }
00243
00244 if (Mod_On_) {
00245 ModMEs mod_single;
00246 mod_single.NumberOfClusters = 0;
00247 mod_single.ClusterPosition = 0;
00248 mod_single.ClusterDigiPosition = 0;
00249 mod_single.ClusterWidth = 0;
00250 mod_single.ClusterCharge = 0;
00251 mod_single.ClusterNoise = 0;
00252 mod_single.ClusterSignalOverNoise = 0;
00253 mod_single.ClusterSignalOverNoiseVsPos = 0;
00254 mod_single.ModuleLocalOccupancy = 0;
00255 mod_single.NrOfClusterizedStrips = 0;
00256
00257
00258 folder_organizer.setDetectorFolder(detid);
00259 if (reset_each_run) ResetModuleMEs(detid);
00260 createModuleMEs(mod_single, detid);
00261
00262 ModuleMEsMap.insert( std::make_pair(detid, mod_single));
00263 }
00264
00265
00266 std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid);
00267 SiStripHistoId hidmanager;
00268 std::string label = hidmanager.getSubdetid(detid,false);
00269
00270 std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
00271 if(iLayerME==LayerMEsMap.end()) {
00272
00273
00274 int32_t lnumber = det_layer_pair.second;
00275 std::vector<uint32_t> layerDetIds;
00276 if (det_layer_pair.first == "TIB") {
00277 substructure.getTIBDetectors(activeDets,layerDetIds,lnumber,0,0,0);
00278 } else if (det_layer_pair.first == "TOB") {
00279 substructure.getTOBDetectors(activeDets,layerDetIds,lnumber,0,0);
00280 } else if (det_layer_pair.first == "TID" && lnumber > 0) {
00281 substructure.getTIDDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0);
00282 } else if (det_layer_pair.first == "TID" && lnumber < 0) {
00283 substructure.getTIDDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0);
00284 } else if (det_layer_pair.first == "TEC" && lnumber > 0) {
00285 substructure.getTECDetectors(activeDets,layerDetIds,2,abs(lnumber),0,0,0,0);
00286 } else if (det_layer_pair.first == "TEC" && lnumber < 0) {
00287 substructure.getTECDetectors(activeDets,layerDetIds,1,abs(lnumber),0,0,0,0);
00288 }
00289 LayerDetMap[label] = layerDetIds;
00290
00291
00292 folder_organizer.setLayerFolder(detid,det_layer_pair.second);
00293 createLayerMEs(label, layerDetIds.size());
00294 }
00295
00296 std::pair<std::string,std::string> sdet_pair = folder_organizer.getSubDetFolderAndTag(detid);
00297 if (SubDetMEsMap.find(sdet_pair.second) == SubDetMEsMap.end()){
00298 dqmStore_->setCurrentFolder(sdet_pair.first);
00299 createSubDetMEs(sdet_pair.second);
00300 }
00301 }
00302
00303
00304 if (globalswitchapvcycledbxth2on) {
00305 dqmStore_->setCurrentFolder(topFolderName_+"/MechanicalView/");
00306 edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2ApvCycleVsDBxGlobal");
00307 std::string HistoName = "DeltaBx_vs_ApvCycle";
00308 GlobalApvCycleDBxTH2 = dqmStore_->book2D(HistoName,HistoName,
00309 GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
00310 GlobalTH2Parameters.getParameter<double>("xmin"),
00311 GlobalTH2Parameters.getParameter<double>("xmax"),
00312 GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
00313 GlobalTH2Parameters.getParameter<double>("ymin"),
00314 GlobalTH2Parameters.getParameter<double>("ymax"));
00315 GlobalApvCycleDBxTH2->setAxisTitle("APV Cycle (Corrected Absolute Bx % 70)",1);
00316 GlobalApvCycleDBxTH2->setAxisTitle("Delta Bunch Crossing Cycle",2);
00317 }
00318
00319 if (globalswitchcstripvscpix) {
00320 dqmStore_->setCurrentFolder(topFolderName_+"/MechanicalView/");
00321 edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH2CStripVsCpixel");
00322 std::string HistoName = "StripClusVsPixClus";
00323 GlobalCStripVsCpix = dqmStore_->book2D(HistoName,HistoName,
00324 GlobalTH2Parameters.getParameter<int32_t>("Nbinsx"),
00325 GlobalTH2Parameters.getParameter<double>("xmin"),
00326 GlobalTH2Parameters.getParameter<double>("xmax"),
00327 GlobalTH2Parameters.getParameter<int32_t>("Nbinsy"),
00328 GlobalTH2Parameters.getParameter<double>("ymin"),
00329 GlobalTH2Parameters.getParameter<double>("ymax"));
00330 GlobalCStripVsCpix->setAxisTitle("Strip Clusters",1);
00331 GlobalCStripVsCpix->setAxisTitle("Pix Clusters",2);
00332 }
00333
00334 if (globalswitchMultiRegions){
00335 dqmStore_->setCurrentFolder(topFolderName_+"/MechanicalView/");
00336 edm::ParameterSet GlobalTH2Parameters = conf_.getParameter<edm::ParameterSet>("TH1MultiplicityRegions");
00337 std::string HistoName = "ClusterMultiplicityRegions";
00338 PixVsStripMultiplicityRegions = dqmStore_->book1D(HistoName,HistoName,
00339 GlobalTH2Parameters.getParameter<int32_t>("Nbinx"),
00340 GlobalTH2Parameters.getParameter<double>("xmin"),
00341 GlobalTH2Parameters.getParameter<double>("xmax"));
00342 PixVsStripMultiplicityRegions->setAxisTitle("");
00343 PixVsStripMultiplicityRegions->setBinLabel(1,"Main Diagonal");
00344 PixVsStripMultiplicityRegions->setBinLabel(2,"Strip Noise");
00345 PixVsStripMultiplicityRegions->setBinLabel(3,"High Strip Noise");
00346 PixVsStripMultiplicityRegions->setBinLabel(4,"Beam Background");
00347 PixVsStripMultiplicityRegions->setBinLabel(5,"No Strip Clusters");
00348 }
00349
00350 if (globalswitchmaindiagonalposition){
00351 dqmStore_->setCurrentFolder(topFolderName_+"/MechanicalView/");
00352 edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1MainDiagonalPosition");
00353 std::string HistoName = "MainDiagonal Position";
00354 GlobalMainDiagonalPosition = dqmStore_->book1D(HistoName,HistoName,
00355 GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
00356 GlobalTH1Parameters.getParameter<double>("xmin"),
00357 GlobalTH1Parameters.getParameter<double>("xmax"));
00358 GlobalMainDiagonalPosition->setAxisTitle("atan(NPix/(k*NStrip))");
00359 }
00360
00361
00362 if (globalswitchstripnoise2apvcycle){
00363 dqmStore_->setCurrentFolder(topFolderName_+"/MechanicalView/");
00364 edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1StripNoise2ApvCycle");
00365 std::string HistoName = "StripNoise_ApvCycle";
00366 StripNoise2Cycle = dqmStore_->book1D(HistoName,HistoName,
00367 GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
00368 GlobalTH1Parameters.getParameter<double>("xmin"),
00369 GlobalTH1Parameters.getParameter<double>("xmax"));
00370 StripNoise2Cycle->setAxisTitle("APV Cycle");
00371 }
00372
00373 if (globalswitchstripnoise3apvcycle){
00374 dqmStore_->setCurrentFolder(topFolderName_+"/MechanicalView/");
00375 edm::ParameterSet GlobalTH1Parameters = conf_.getParameter<edm::ParameterSet>("TH1StripNoise3ApvCycle");
00376 std::string HistoName = "HighStripNoise_ApvCycle";
00377 StripNoise3Cycle = dqmStore_->book1D(HistoName,HistoName,
00378 GlobalTH1Parameters.getParameter<int32_t>("Nbinsx"),
00379 GlobalTH1Parameters.getParameter<double>("xmin"),
00380 GlobalTH1Parameters.getParameter<double>("xmax"));
00381 StripNoise3Cycle->setAxisTitle("APV Cycle");
00382 }
00383
00384
00385 }
00386 }
00387
00388
00389 void SiStripMonitorCluster::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00390 {
00391
00392 if (dcsStatus_ && !dcsStatus_->getStatus(iEvent,iSetup)) return;
00393
00394 runNb = iEvent.id().run();
00395 eventNb++;
00396 float iOrbitSec = iEvent.orbitNumber()/11223.0;
00397
00398 int NPixClusters=0, NStripClusters=0, MultiplicityRegion=0;
00399 bool isPixValid=false;
00400
00401 edm::ESHandle<SiStripNoises> noiseHandle;
00402 iSetup.get<SiStripNoisesRcd>().get(noiseHandle);
00403
00404 edm::ESHandle<SiStripGain> gainHandle;
00405 iSetup.get<SiStripGainRcd>().get(gainHandle);
00406
00407 edm::ESHandle<SiStripQuality> qualityHandle;
00408 iSetup.get<SiStripQualityRcd>().get(qualityLabel_,qualityHandle);
00409
00410 iSetup.get<SiStripDetCablingRcd>().get(SiStripDetCabling_);
00411
00412
00413 edm::Handle< edmNew::DetSetVector<SiStripCluster> > cluster_detsetvektor;
00414 iEvent.getByLabel(clusterProducerStrip_, cluster_detsetvektor);
00415
00416
00417 edm::Handle< edmNew::DetSetVector<SiPixelCluster> > cluster_detsetvektor_pix;
00418 iEvent.getByLabel(clusterProducerPix_, cluster_detsetvektor_pix);
00419
00420 if (!cluster_detsetvektor.isValid()) return;
00421
00422 const edmNew::DetSetVector<SiStripCluster> * StrC= cluster_detsetvektor.product();
00423 NStripClusters= StrC->data().size();
00424
00425
00426 if (cluster_detsetvektor_pix.isValid()){
00427 const edmNew::DetSetVector<SiPixelCluster> * PixC= cluster_detsetvektor_pix.product();
00428 NPixClusters= PixC->data().size();
00429 isPixValid=true;
00430 MultiplicityRegion=FindRegion(NStripClusters,NPixClusters);
00431 if (globalswitchcstripvscpix) GlobalCStripVsCpix->Fill(NStripClusters,NPixClusters);
00432 if (globalswitchmaindiagonalposition) GlobalMainDiagonalPosition->Fill(atan(NPixClusters/(k0*NStripClusters)));
00433 if (globalswitchMultiRegions) PixVsStripMultiplicityRegions->Fill(MultiplicityRegion);
00434
00435 }
00436
00437
00438 for (std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.begin();
00439 iSubdet != SubDetMEsMap.end(); iSubdet++) {
00440 iSubdet->second.totNClusters = 0;
00441 }
00442
00443 SiStripFolderOrganizer folder_organizer;
00444 bool found_layer_me = false;
00445 for (std::map<std::string, std::vector< uint32_t > >::const_iterator iterLayer = LayerDetMap.begin();
00446 iterLayer != LayerDetMap.end(); iterLayer++) {
00447
00448 std::string layer_label = iterLayer->first;
00449
00450 int ncluster_layer = 0;
00451 std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(layer_label);
00452
00453
00454 LayerMEs layer_single;
00455 if(iLayerME != LayerMEsMap.end()) {
00456 layer_single = iLayerME->second;
00457 found_layer_me = true;
00458 }
00459
00460 bool found_module_me = false;
00461 uint16_t iDet = 0;
00462 std::string subdet_label = "";
00463
00464 for (std::vector< uint32_t >::const_iterator iterDets = iterLayer->second.begin() ;
00465 iterDets != iterLayer->second.end() ; iterDets++) {
00466 iDet++;
00467
00468 uint32_t detid = (*iterDets);
00469
00470
00471 if (subdet_label.size() == 0) subdet_label = folder_organizer.getSubDetFolderAndTag(detid).second;
00472
00473
00474 ModMEs mod_single;
00475 if (Mod_On_) {
00476 std::map<uint32_t, ModMEs >::iterator imodME = ModuleMEsMap.find(detid);
00477 if (imodME != ModuleMEsMap.end()) {
00478 mod_single = imodME->second;
00479 found_module_me = true;
00480 }
00481 } else found_module_me = false;
00482
00483 edmNew::DetSetVector<SiStripCluster>::const_iterator isearch = cluster_detsetvektor->find(detid);
00484
00485 if(isearch==cluster_detsetvektor->end()){
00486 if(found_module_me && moduleswitchncluson && (mod_single.NumberOfClusters)){
00487 (mod_single.NumberOfClusters)->Fill(0.);
00488 }
00489 if(clustertkhistomapon) tkmapcluster->fill(detid,0.);
00490 if (found_layer_me && layerswitchnumclusterprofon) layer_single.LayerNumberOfClusterProfile->Fill(iDet, 0.0);
00491 continue;
00492 }
00493
00494
00495 edmNew::DetSet<SiStripCluster> cluster_detset = (*cluster_detsetvektor)[detid];
00496
00497
00498 if(clustertkhistomapon) {
00499 tkmapcluster->fill(detid,static_cast<float>(cluster_detset.size()));
00500 }
00501
00502 if(moduleswitchncluson && found_module_me && (mod_single.NumberOfClusters != NULL)){
00503 (mod_single.NumberOfClusters)->Fill(static_cast<float>(cluster_detset.size()));
00504 }
00505
00506 if (found_layer_me && layerswitchnumclusterprofon)
00507 layer_single.LayerNumberOfClusterProfile->Fill(iDet, static_cast<float>(cluster_detset.size()));
00508 ncluster_layer += cluster_detset.size();
00509
00510 short total_clusterized_strips = 0;
00511
00512 SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detid);
00513 SiStripApvGain::Range detGainRange = gainHandle->getRange(detid);
00514 SiStripQuality::Range qualityRange = qualityHandle->getRange(detid);
00515
00516 for(edmNew::DetSet<SiStripCluster>::const_iterator clusterIter = cluster_detset.begin(); clusterIter!= cluster_detset.end(); clusterIter++){
00517
00518 const std::vector<uint8_t>& ampls = clusterIter->amplitudes();
00519
00520 float cluster_position = clusterIter->barycenter();
00521
00522 short cluster_start = clusterIter->firstStrip();
00523
00524 short cluster_width = ampls.size();
00525
00526 total_clusterized_strips = total_clusterized_strips + cluster_width;
00527
00528
00529 float cluster_signal = 0.0;
00530 float cluster_noise = 0.0;
00531 int nrnonzeroamplitudes = 0;
00532 float noise2 = 0.0;
00533 float noise = 0.0;
00534 for(uint iamp=0; iamp<ampls.size(); iamp++){
00535 if(ampls[iamp]>0){
00536 cluster_signal += ampls[iamp];
00537 if(!qualityHandle->IsStripBad(qualityRange, clusterIter->firstStrip()+iamp)){
00538 noise = noiseHandle->getNoise(clusterIter->firstStrip()+iamp,detNoiseRange)/gainHandle->getStripGain(clusterIter->firstStrip()+iamp, detGainRange);
00539 }
00540 noise2 += noise*noise;
00541 nrnonzeroamplitudes++;
00542 }
00543 }
00544
00545 if (nrnonzeroamplitudes > 0) cluster_noise = sqrt(noise2/nrnonzeroamplitudes);
00546
00547 if( applyClusterQuality_ &&
00548 (cluster_signal/cluster_noise < sToNLowerLimit_ ||
00549 cluster_signal/cluster_noise > sToNUpperLimit_ ||
00550 cluster_width < widthLowerLimit_ ||
00551 cluster_width > widthUpperLimit_) ) continue;
00552
00553 ClusterProperties cluster_properties;
00554 cluster_properties.charge = cluster_signal;
00555 cluster_properties.position = cluster_position;
00556 cluster_properties.start = cluster_start;
00557 cluster_properties.width = cluster_width;
00558 cluster_properties.noise = cluster_noise;
00559
00560
00561 if (found_module_me) fillModuleMEs(mod_single, cluster_properties);
00562
00563
00564 if (found_layer_me) {
00565 fillLayerMEs(layer_single, cluster_properties, iOrbitSec);
00566 if (layerswitchclusterwidthprofon)
00567 layer_single.LayerClusterWidthProfile->Fill(iDet, cluster_width);
00568 }
00569 }
00570
00571 short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
00572 float local_occupancy = static_cast<float>(total_clusterized_strips)/static_cast<float>(total_nr_strips);
00573 if (found_module_me) {
00574 if(moduleswitchnrclusterizedstrip && mod_single.NrOfClusterizedStrips ){
00575 mod_single.NrOfClusterizedStrips->Fill(static_cast<float>(total_clusterized_strips));
00576 }
00577
00578 if(moduleswitchlocaloccupancy && mod_single.ModuleLocalOccupancy ){
00579 mod_single.ModuleLocalOccupancy->Fill(local_occupancy);
00580 }
00581 }
00582 if (layerswitchlocaloccupancy && found_layer_me && layer_single.LayerLocalOccupancy) {
00583 fillME(layer_single.LayerLocalOccupancy,local_occupancy);
00584 if (createTrendMEs) fillME(layer_single.LayerLocalOccupancyTrend,iOrbitSec,local_occupancy);
00585 }
00586 }
00587 std::map<std::string, SubDetMEs>::iterator iSubdet = SubDetMEsMap.find(subdet_label);
00588 if(iSubdet != SubDetMEsMap.end()) iSubdet->second.totNClusters += ncluster_layer;
00589 }
00590
00591
00592 edm::Handle<EventWithHistory> event_history;
00593 iEvent.getByLabel(historyProducer_,event_history);
00594
00595
00596 edm::Handle<APVCyclePhaseCollection> apv_phase_collection;
00597 iEvent.getByLabel(apvPhaseProducer_,apv_phase_collection);
00598
00599 if (event_history.isValid()
00600 && !event_history.failedToGet()
00601 && apv_phase_collection.isValid()
00602 && !apv_phase_collection.failedToGet()) {
00603
00604
00605 long long dbx = event_history->deltaBX();
00606 long long tbx = event_history->absoluteBX();
00607
00608 bool global_histo_filled = false;
00609 bool MultiplicityRegion_Vs_APVcycle_filled=false;
00610
00611 for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin();
00612 it != SubDetMEsMap.end(); it++) {
00613 std::string sdet = it->first;
00614
00615 SubDetMEs sdetmes = it->second;
00616
00617 int the_phase = APVCyclePhaseCollection::invalid;
00618 long long tbx_corr = tbx;
00619
00620 if (SubDetPhasePartMap.find(sdet) != SubDetPhasePartMap.end()) the_phase = apv_phase_collection->getPhase(SubDetPhasePartMap[sdet]);
00621 if(the_phase==APVCyclePhaseCollection::nopartition ||
00622 the_phase==APVCyclePhaseCollection::multiphase ||
00623 the_phase==APVCyclePhaseCollection::invalid) {
00624 the_phase=30;
00625
00626 }
00627 tbx_corr -= the_phase;
00628 long long dbxincycle = event_history->deltaBXinCycle(the_phase);
00629 if (globalswitchapvcycledbxth2on && !global_histo_filled) {
00630 GlobalApvCycleDBxTH2->Fill(tbx_corr%70,dbx);
00631 global_histo_filled = true;
00632 }
00633
00634 if (isPixValid && !MultiplicityRegion_Vs_APVcycle_filled){
00635 if (globalswitchstripnoise2apvcycle && MultiplicityRegion==2) {StripNoise2Cycle->Fill(tbx_corr%70);}
00636 if (globalswitchstripnoise3apvcycle && MultiplicityRegion==3) {StripNoise3Cycle->Fill(tbx_corr%70);}
00637 MultiplicityRegion_Vs_APVcycle_filled=true;
00638 }
00639
00640 if (subdetswitchtotclusth1on) sdetmes.SubDetTotClusterTH1->Fill(sdetmes.totNClusters);
00641 if (subdetswitchtotclusprofon) sdetmes.SubDetTotClusterProf->Fill(iOrbitSec,sdetmes.totNClusters);
00642 if (subdetswitchapvcycleprofon) sdetmes.SubDetClusterApvProf->Fill(tbx_corr%70,sdetmes.totNClusters);
00643 if (subdetswitchapvcycleth2on) sdetmes.SubDetClusterApvTH2->Fill(tbx_corr%70,sdetmes.totNClusters);
00644 if (subdetswitchdbxcycleprofon) sdetmes.SubDetClusterDBxCycleProf->Fill(dbxincycle,sdetmes.totNClusters);
00645 if (subdetswitchapvcycledbxprof2on) sdetmes.SubDetApvDBxProf2->Fill(tbx_corr%70,dbx,sdetmes.totNClusters);
00646 }
00647 }
00648 }
00649
00650
00651
00652 void SiStripMonitorCluster::endJob(void){
00653 bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
00654 std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
00655
00656
00657 if(outputMEsInRootFile) dqmStore_->save(outputFileName);
00658 }
00659
00660
00661
00662 void SiStripMonitorCluster::ResetModuleMEs(uint32_t idet){
00663 std::map<uint32_t, ModMEs >::iterator pos = ModuleMEsMap.find(idet);
00664 ModMEs mod_me = pos->second;
00665
00666 if (moduleswitchncluson) mod_me.NumberOfClusters->Reset();
00667 if (moduleswitchclusposon) mod_me.ClusterPosition->Reset();
00668 if (moduleswitchclusdigiposon) mod_me.ClusterDigiPosition->Reset();
00669 if (moduleswitchclusstonVsposon) mod_me.ClusterSignalOverNoiseVsPos->Reset();
00670 if (moduleswitchcluswidthon) mod_me.ClusterWidth->Reset();
00671 if (moduleswitchcluschargeon) mod_me.ClusterCharge->Reset();
00672 if (moduleswitchclusnoiseon) mod_me.ClusterNoise->Reset();
00673 if (moduleswitchclusstonon) mod_me.ClusterSignalOverNoise->Reset();
00674 if (moduleswitchlocaloccupancy) mod_me.ModuleLocalOccupancy->Reset();
00675 if (moduleswitchnrclusterizedstrip) mod_me.NrOfClusterizedStrips->Reset();
00676 }
00677
00678
00679
00680 void SiStripMonitorCluster::createModuleMEs(ModMEs& mod_single, uint32_t detid) {
00681
00682
00683 SiStripHistoId hidmanager;
00684 std::string hid;
00685
00686
00687 if(moduleswitchncluson) {
00688 hid = hidmanager.createHistoId("NumberOfClusters","det",detid);
00689 mod_single.NumberOfClusters = bookME1D("TH1nClusters", hid.c_str());
00690 dqmStore_->tag(mod_single.NumberOfClusters, detid);
00691 mod_single.NumberOfClusters->setAxisTitle("number of clusters in one detector module");
00692 mod_single.NumberOfClusters->getTH1()->StatOverflows(kTRUE);
00693 }
00694
00695
00696 if(moduleswitchclusposon) {
00697 short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
00698 hid = hidmanager.createHistoId("ClusterPosition","det",detid);
00699 mod_single.ClusterPosition = dqmStore_->book1D(hid, hid, total_nr_strips, 0.5, total_nr_strips+0.5);
00700 dqmStore_->tag(mod_single.ClusterPosition, detid);
00701 mod_single.ClusterPosition->setAxisTitle("cluster position [strip number +0.5]");
00702 }
00703
00704
00705 if(moduleswitchclusdigiposon) {
00706 short total_nr_strips = SiStripDetCabling_->nApvPairs(detid) * 2 * 128;
00707 hid = hidmanager.createHistoId("ClusterDigiPosition","det",detid);
00708 mod_single.ClusterDigiPosition = dqmStore_->book1D(hid, hid, total_nr_strips, 0.5, total_nr_strips+0.5);
00709 dqmStore_->tag(mod_single.ClusterDigiPosition, detid);
00710 mod_single.ClusterDigiPosition->setAxisTitle("digi in cluster position [strip number +0.5]");
00711 }
00712
00713
00714 if(moduleswitchcluswidthon) {
00715 hid = hidmanager.createHistoId("ClusterWidth","det",detid);
00716 mod_single.ClusterWidth = bookME1D("TH1ClusterWidth", hid.c_str());
00717 dqmStore_->tag(mod_single.ClusterWidth, detid);
00718 mod_single.ClusterWidth->setAxisTitle("cluster width [nr strips]");
00719 }
00720
00721
00722 if(moduleswitchcluschargeon) {
00723 hid = hidmanager.createHistoId("ClusterCharge","det",detid);
00724 mod_single.ClusterCharge = bookME1D("TH1ClusterCharge", hid.c_str());
00725 dqmStore_->tag(mod_single.ClusterCharge, detid);
00726 mod_single.ClusterCharge->setAxisTitle("cluster charge [ADC]");
00727 }
00728
00729
00730 if(moduleswitchclusnoiseon) {
00731 hid = hidmanager.createHistoId("ClusterNoise","det",detid);
00732 mod_single.ClusterNoise = bookME1D("TH1ClusterNoise", hid.c_str());
00733 dqmStore_->tag(mod_single.ClusterNoise, detid);
00734 mod_single.ClusterNoise->setAxisTitle("cluster noise");
00735 }
00736
00737
00738 if(moduleswitchclusstonon) {
00739 hid = hidmanager.createHistoId("ClusterSignalOverNoise","det",detid);
00740 mod_single.ClusterSignalOverNoise = bookME1D("TH1ClusterStoN", hid.c_str());
00741 dqmStore_->tag(mod_single.ClusterSignalOverNoise, detid);
00742 mod_single.ClusterSignalOverNoise->setAxisTitle("ratio of signal to noise for each cluster");
00743 }
00744
00745
00746 if(moduleswitchclusstonVsposon) {
00747 hid = hidmanager.createHistoId("ClusterSignalOverNoiseVsPos","det",detid);
00748 Parameters = conf_.getParameter<edm::ParameterSet>("TH1ClusterStoNVsPos");
00749 mod_single.ClusterSignalOverNoiseVsPos= dqmStore_->bookProfile(hid.c_str(),hid.c_str(),
00750 Parameters.getParameter<int32_t>("Nbinx"),
00751 Parameters.getParameter<double>("xmin"),
00752 Parameters.getParameter<double>("xmax"),
00753 Parameters.getParameter<int32_t>("Nbiny"),
00754 Parameters.getParameter<double>("ymin"),
00755 Parameters.getParameter<double>("ymax")
00756 );
00757 dqmStore_->tag(mod_single.ClusterSignalOverNoiseVsPos, detid);
00758 mod_single.ClusterSignalOverNoiseVsPos->setAxisTitle("pos");
00759 }
00760
00761
00762 if (moduleswitchlocaloccupancy) {
00763 hid = hidmanager.createHistoId("ClusterLocalOccupancy","det",detid);
00764 mod_single.ModuleLocalOccupancy = bookME1D("TH1ModuleLocalOccupancy", hid.c_str());
00765 dqmStore_->tag(mod_single.ModuleLocalOccupancy, detid);
00766 mod_single.ModuleLocalOccupancy->setAxisTitle("module local occupancy [% of clusterized strips]");
00767 }
00768
00769
00770 if (moduleswitchnrclusterizedstrip) {
00771 hid = hidmanager.createHistoId("NrOfClusterizedStrips","det",detid);
00772 mod_single.NrOfClusterizedStrips = bookME1D("TH1NrOfClusterizedStrips", hid.c_str());
00773 dqmStore_->tag(mod_single.NrOfClusterizedStrips, detid);
00774 mod_single.NrOfClusterizedStrips->setAxisTitle("number of clusterized strips");
00775 }
00776 }
00777
00778
00779
00780 void SiStripMonitorCluster::createLayerMEs(std::string label, int ndets) {
00781
00782 SiStripHistoId hidmanager;
00783
00784 LayerMEs layerMEs;
00785 layerMEs.LayerClusterStoN = 0;
00786 layerMEs.LayerClusterStoNTrend = 0;
00787 layerMEs.LayerClusterCharge = 0;
00788 layerMEs.LayerClusterChargeTrend = 0;
00789 layerMEs.LayerClusterNoise = 0;
00790 layerMEs.LayerClusterNoiseTrend = 0;
00791 layerMEs.LayerClusterWidth = 0;
00792 layerMEs.LayerClusterWidthTrend = 0;
00793 layerMEs.LayerLocalOccupancy = 0;
00794 layerMEs.LayerLocalOccupancyTrend = 0;
00795 layerMEs.LayerNumberOfClusterProfile = 0;
00796 layerMEs.LayerClusterWidthProfile = 0;
00797
00798
00799 if(layerswitchcluswidthon) {
00800 layerMEs.LayerClusterWidth=bookME1D("TH1ClusterWidth", hidmanager.createHistoLayer("Summary_ClusterWidth","layer",label,"").c_str());
00801 if (createTrendMEs) layerMEs.LayerClusterWidthTrend=bookMETrend("TH1ClusterWidth", hidmanager.createHistoLayer("Trend_ClusterWidth","layer",label,"").c_str());
00802 }
00803
00804
00805 if(layerswitchclusnoiseon) {
00806 layerMEs.LayerClusterNoise=bookME1D("TH1ClusterNoise", hidmanager.createHistoLayer("Summary_ClusterNoise","layer",label,"").c_str());
00807 if (createTrendMEs) layerMEs.LayerClusterNoiseTrend=bookMETrend("TH1ClusterNoise", hidmanager.createHistoLayer("Trend_ClusterNoise","layer",label,"").c_str());
00808 }
00809
00810
00811 if(layerswitchcluschargeon) {
00812 layerMEs.LayerClusterCharge=bookME1D("TH1ClusterCharge", hidmanager.createHistoLayer("Summary_ClusterCharge","layer",label,"").c_str());
00813 if (createTrendMEs) layerMEs.LayerClusterChargeTrend=bookMETrend("TH1ClusterCharge", hidmanager.createHistoLayer("Trend_ClusterCharge","layer",label,"").c_str());
00814 }
00815
00816
00817 if(layerswitchclusstonon) {
00818 layerMEs.LayerClusterStoN=bookME1D("TH1ClusterStoN", hidmanager.createHistoLayer("Summary_ClusterSignalOverNoise","layer",label,"").c_str());
00819 if (createTrendMEs) layerMEs.LayerClusterStoNTrend=bookMETrend("TH1ClusterStoN", hidmanager.createHistoLayer("Trend_ClusterSignalOverNoise","layer",label,"").c_str());
00820 }
00821
00822
00823 if(layerswitchlocaloccupancy) {
00824 layerMEs.LayerLocalOccupancy=bookME1D("TH1ModuleLocalOccupancy", hidmanager.createHistoLayer("Summary_ClusterLocalOccupancy","layer",label,"").c_str());
00825 if (createTrendMEs) layerMEs.LayerLocalOccupancyTrend=bookMETrend("TH1ModuleLocalOccupancy", hidmanager.createHistoLayer("Trend_ClusterLocalOccupancy","layer",label,"").c_str());
00826
00827 }
00828
00829
00830 if(layerswitchnumclusterprofon) {
00831 std::string hid = hidmanager.createHistoLayer("NumberOfClusterProfile","layer",label,"");
00832 layerMEs.LayerNumberOfClusterProfile = dqmStore_->bookProfile(hid, hid, ndets, 0.5, ndets+0.5,21, -0.5, 20.5);
00833 }
00834
00835
00836 if(layerswitchclusterwidthprofon) {
00837 std::string hid = hidmanager.createHistoLayer("ClusterWidthProfile","layer",label,"");
00838 layerMEs.LayerClusterWidthProfile = dqmStore_->bookProfile(hid, hid, ndets, 0.5, ndets+0.5, 20, -0.5, 19.5);
00839 }
00840
00841 LayerMEsMap[label]=layerMEs;
00842 }
00843
00844
00845
00846 void SiStripMonitorCluster::createSubDetMEs(std::string label) {
00847
00848 SubDetMEs subdetMEs;
00849 subdetMEs.totNClusters = 0;
00850 subdetMEs.SubDetTotClusterTH1 = 0;
00851 subdetMEs.SubDetTotClusterProf = 0;
00852 subdetMEs.SubDetClusterApvProf = 0;
00853 subdetMEs.SubDetClusterApvTH2 = 0;
00854 subdetMEs.SubDetClusterDBxCycleProf = 0;
00855 subdetMEs.SubDetApvDBxProf2 = 0;
00856
00857 std::string HistoName;
00858
00859 if (subdetswitchtotclusth1on){
00860 HistoName = "TotalNumberOfCluster__" + label;
00861 subdetMEs.SubDetTotClusterTH1 = bookME1D("TH1TotalNumberOfClusters",HistoName.c_str());
00862 subdetMEs.SubDetTotClusterTH1->setAxisTitle("Total number of clusters in subdetector");
00863 subdetMEs.SubDetTotClusterTH1->getTH1()->StatOverflows(kTRUE);
00864 }
00865
00866 if (subdetswitchtotclusprofon){
00867 edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfTotalNumberOfClusters");
00868 HistoName = "TotalNumberOfClusterProfile__" + label;
00869 subdetMEs.SubDetTotClusterProf = dqmStore_->bookProfile(HistoName,HistoName,
00870 Parameters.getParameter<int32_t>("Nbins"),
00871 Parameters.getParameter<double>("xmin"),
00872 Parameters.getParameter<double>("xmax"),
00873 100,
00874 Parameters.getParameter<double>("ymin"),
00875 Parameters.getParameter<double>("ymax"),
00876 "" );
00877 subdetMEs.SubDetTotClusterProf->setAxisTitle("Event Time (Seconds)",1);
00878 if (subdetMEs.SubDetTotClusterProf->kind() == MonitorElement::DQM_KIND_TPROFILE) subdetMEs.SubDetTotClusterProf->getTH1()->SetBit(TH1::kCanRebin);
00879 }
00880
00881 if(subdetswitchapvcycleprofon){
00882 edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfClustersApvCycle");
00883 HistoName = "Cluster_vs_ApvCycle__" + label;
00884 subdetMEs.SubDetClusterApvProf=dqmStore_->bookProfile(HistoName,HistoName,
00885 Parameters.getParameter<int32_t>("Nbins"),
00886 Parameters.getParameter<double>("xmin"),
00887 Parameters.getParameter<double>("xmax"),
00888 200,
00889 Parameters.getParameter<double>("ymin"),
00890 Parameters.getParameter<double>("ymax"),
00891 "" );
00892 subdetMEs.SubDetClusterApvProf->setAxisTitle("Apv Cycle (Corrected Absolute Bx % 70)",1);
00893 }
00894
00895
00896 if(subdetswitchapvcycleth2on){
00897 edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TH2ClustersApvCycle");
00898 HistoName = "Cluster_vs_ApvCycle_2D__" + label;
00899
00900 double h2ymax = 9999.0;
00901 double yfact = Parameters.getParameter<double>("yfactor");
00902 if(label.find("TIB") != std::string::npos) h2ymax = (6984.*256.)*yfact;
00903 else if (label.find("TID") != std::string::npos) h2ymax = (2208.*256.)*yfact;
00904 else if (label.find("TOB") != std::string::npos) h2ymax = (12906.*256.)*yfact;
00905 else if (label.find("TEC") != std::string::npos) h2ymax = (7552.*2.*256.)*yfact;
00906
00907 subdetMEs.SubDetClusterApvTH2=dqmStore_->book2D(HistoName,HistoName,
00908 Parameters.getParameter<int32_t>("Nbinsx"),
00909 Parameters.getParameter<double>("xmin"),
00910 Parameters.getParameter<double>("xmax"),
00911 Parameters.getParameter<int32_t>("Nbinsy"),
00912 Parameters.getParameter<double>("ymin"),
00913 h2ymax);
00914 subdetMEs.SubDetClusterApvTH2->setAxisTitle("Apv Cycle (Corrected Absolute Bx % 70))",1);
00915 subdetMEs.SubDetClusterApvTH2->setAxisTitle("Total # of Clusters",2);
00916
00917 }
00918
00919 if(subdetswitchdbxcycleprofon){
00920 edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProfClustersVsDBxCycle");
00921 HistoName = "Cluster_vs_DeltaBxCycle__" + label;
00922 subdetMEs.SubDetClusterDBxCycleProf = dqmStore_->bookProfile(HistoName,HistoName,
00923 Parameters.getParameter<int32_t>("Nbins"),
00924 Parameters.getParameter<double>("xmin"),
00925 Parameters.getParameter<double>("xmax"),
00926 200,
00927 Parameters.getParameter<double>("ymin"),
00928 Parameters.getParameter<double>("ymax"),
00929 "" );
00930 subdetMEs.SubDetClusterDBxCycleProf->setAxisTitle("Delta Bunch Crossing Cycle",1);
00931 }
00932
00933 if(subdetswitchapvcycledbxprof2on){
00934 edm::ParameterSet Parameters = conf_.getParameter<edm::ParameterSet>("TProf2ApvCycleVsDBx");
00935 HistoName = "DeltaBx_vs_ApvCycle__" + label;
00936 subdetMEs.SubDetApvDBxProf2 = dqmStore_->bookProfile2D(HistoName,HistoName,
00937 Parameters.getParameter<int32_t>("Nbinsx"),
00938 Parameters.getParameter<double>("xmin"),
00939 Parameters.getParameter<double>("xmax"),
00940 Parameters.getParameter<int32_t>("Nbinsy"),
00941 Parameters.getParameter<double>("ymin"),
00942 Parameters.getParameter<double>("ymax"),
00943 Parameters.getParameter<double>("zmin"),
00944 Parameters.getParameter<double>("zmax"),
00945 "" );
00946 subdetMEs.SubDetApvDBxProf2->setAxisTitle("APV Cycle (Corrected Absolute Bx % 70)",1);
00947 subdetMEs.SubDetApvDBxProf2->setAxisTitle("Delta Bunch Crossing Cycle",2);
00948 }
00949 SubDetMEsMap[label]=subdetMEs;
00950 }
00951
00952
00953
00954
00955 void SiStripMonitorCluster::fillModuleMEs(ModMEs& mod_mes, ClusterProperties& cluster) {
00956
00957 if(moduleswitchclusposon && (mod_mes.ClusterPosition))
00958 (mod_mes.ClusterPosition)->Fill(cluster.position);
00959
00960
00961 if(moduleswitchclusdigiposon && (mod_mes.ClusterDigiPosition)) {
00962 for(int ipos=cluster.start+1; ipos<=cluster.start+cluster.width; ipos++){
00963 (mod_mes.ClusterDigiPosition)->Fill(ipos);
00964 }
00965 }
00966
00967 if(moduleswitchcluswidthon && (mod_mes.ClusterWidth))
00968 (mod_mes.ClusterWidth)->Fill(static_cast<float>(cluster.width));
00969
00970 if(moduleswitchclusstonon && (mod_mes.ClusterSignalOverNoise)) {
00971 if (cluster.noise > 0)
00972 (mod_mes.ClusterSignalOverNoise)->Fill(cluster.charge/cluster.noise);
00973 }
00974
00975 if(moduleswitchclusstonVsposon && (mod_mes.ClusterSignalOverNoiseVsPos)) {
00976 if (cluster.noise > 0)
00977 (mod_mes.ClusterSignalOverNoiseVsPos)->Fill(cluster.position,cluster.charge/cluster.noise);
00978 }
00979
00980 if(moduleswitchclusnoiseon && (mod_mes.ClusterNoise))
00981 (mod_mes.ClusterNoise)->Fill(cluster.noise);
00982
00983 if(moduleswitchcluschargeon && (mod_mes.ClusterCharge))
00984 (mod_mes.ClusterCharge)->Fill(cluster.charge);
00985
00986 }
00987
00988
00989
00990 void SiStripMonitorCluster::fillLayerMEs(LayerMEs& layerMEs, ClusterProperties& cluster, float timeinorbit) {
00991 if(layerswitchclusstonon) {
00992 fillME(layerMEs.LayerClusterStoN ,cluster.charge/cluster.noise);
00993 if (createTrendMEs) fillME(layerMEs.LayerClusterStoNTrend,timeinorbit,cluster.charge/cluster.noise);
00994 }
00995
00996 if(layerswitchcluschargeon) {
00997 fillME(layerMEs.LayerClusterCharge,cluster.charge);
00998 if (createTrendMEs) fillME(layerMEs.LayerClusterChargeTrend,timeinorbit,cluster.charge);
00999 }
01000
01001 if(layerswitchclusnoiseon) {
01002 fillME(layerMEs.LayerClusterNoise ,cluster.noise);
01003 if (createTrendMEs) fillME(layerMEs.LayerClusterNoiseTrend,timeinorbit,cluster.noise);
01004 }
01005
01006 if(layerswitchcluswidthon) {
01007 fillME(layerMEs.LayerClusterWidth ,cluster.width);
01008 if (createTrendMEs) fillME(layerMEs.LayerClusterWidthTrend,timeinorbit,cluster.width);
01009 }
01010
01011 }
01012
01013 MonitorElement* SiStripMonitorCluster::bookMETrend(const char* ParameterSetLabel, const char* HistoName)
01014 {
01015 Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
01016 edm::ParameterSet ParametersTrend = conf_.getParameter<edm::ParameterSet>("Trending");
01017 MonitorElement* me = dqmStore_->bookProfile(HistoName,HistoName,
01018 ParametersTrend.getParameter<int32_t>("Nbins"),
01019
01020 ParametersTrend.getParameter<double>("xmin"),
01021 ParametersTrend.getParameter<double>("xmax"),
01022
01023 100,
01024 ParametersTrend.getParameter<double>("ymin"),
01025 ParametersTrend.getParameter<double>("ymax"),
01026 "" );
01027 if(!me) return me;
01028 me->setAxisTitle("Event Time in Seconds",1);
01029 if (me->kind() == MonitorElement::DQM_KIND_TPROFILE) me->getTH1()->SetBit(TH1::kCanRebin);
01030 return me;
01031 }
01032
01033
01034 MonitorElement* SiStripMonitorCluster::bookME1D(const char* ParameterSetLabel, const char* HistoName)
01035 {
01036 Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
01037 return dqmStore_->book1D(HistoName,HistoName,
01038 Parameters.getParameter<int32_t>("Nbinx"),
01039 Parameters.getParameter<double>("xmin"),
01040 Parameters.getParameter<double>("xmax")
01041 );
01042 }
01043
01044 int SiStripMonitorCluster::FindRegion(int nstrip,int npix){
01045
01046 double kplus= k0*(1+dk0/100);
01047 double kminus=k0*(1-dk0/100);
01048 int region=0;
01049
01050 if (nstrip!=0 && npix >= (nstrip*kminus-q0) && npix <=(nstrip*kplus+q0)) region=1;
01051 else if (nstrip!=0 && npix < (nstrip*kminus-q0) && nstrip <= maxClus) region=2;
01052 else if (nstrip!=0 && npix < (nstrip*kminus-q0) && nstrip > maxClus) region=3;
01053 else if (nstrip!=0 && npix > (nstrip*kplus+q0)) region=4;
01054 else if (npix > minPix && nstrip==0) region=5;
01055 return region;
01056
01057 }
01058
01059
01060