CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CalibTracker/SiStripQuality/interface/SiStripHotStripAlgorithmFromClusterOccupancy.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    SiStripQuality
00004 // Class:      SiStripHotStripAlgorithmFromClusterOccupancy
00005 // 
00013 //
00014 // Original Author:  Domenico GIORDANO
00015 //         Created:  Wed Oct  3 12:11:10 CEST 2007
00016 // $Id: SiStripHotStripAlgorithmFromClusterOccupancy.h,v 1.9 2010/11/04 14:12:13 muzaffar Exp $
00017 //
00018 //
00019 
00020 #ifndef CalibTracker_SiStripQuality_SiStripHotStripAlgorithmFromClusterOccupancy_H
00021 #define CalibTracker_SiStripQuality_SiStripHotStripAlgorithmFromClusterOccupancy_H
00022 
00023 // system include files
00024 #include <memory>
00025 #include <vector>
00026 #include <sstream>
00027 #include <iostream>
00028 
00029 #include "TMath.h"
00030 #include "TTree.h"
00031 #include "TFile.h"
00032 
00033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00034 #include "DataFormats/DetId/interface/DetId.h"
00035 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00036 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00037 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00038 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00039 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00040 #include "Geometry/CommonTopologies/interface/StripTopology.h"
00041 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
00042 
00043 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00044 #include "CalibTracker/SiStripQuality/interface/SiStripQualityHistos.h"
00045 #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
00046 #include "FWCore/ParameterSet/interface/FileInPath.h"
00047 #include "FWCore/Framework/interface/EventSetup.h"
00048 #include "FWCore/Framework/interface/ESHandle.h"
00049 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
00050 #include "FWCore/ServiceRegistry/interface/Service.h"
00051 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00052 #include "CommonTools/TrackerMap/interface/TrackerMap.h"
00053 
00054 class SiStripQuality;
00055 
00056 class SiStripHotStripAlgorithmFromClusterOccupancy{
00057 
00058 public:
00059   typedef SiStrip::QualityHistosMap HistoMap;  
00060   
00061 
00062   SiStripHotStripAlgorithmFromClusterOccupancy(const edm::ParameterSet&);
00063 
00064   virtual ~SiStripHotStripAlgorithmFromClusterOccupancy();
00065 
00066   void setProbabilityThreshold(long double prob){prob_=prob;}
00067   void setMinNumEntries(unsigned short m){MinNumEntries_=m;}
00068   void setMinNumEntriesPerStrip(unsigned short m){MinNumEntriesPerStrip_=m;}
00069   void setOccupancyThreshold(long double occupancy){occupancy_=occupancy;minNevents_=occupancy_*Nevents_;}
00070   void setNumberOfEvents(double Nevents);
00071   void setOutputFileName(std::string OutputFileName, bool WriteOutputFile){OutFileName_=OutputFileName; WriteOutputFile_=WriteOutputFile;}
00072   void setTrackerGeometry(const TrackerGeometry* tkgeom){TkGeom = tkgeom;}
00073   void extractBadStrips(SiStripQuality*,HistoMap&,  edm::ESHandle<SiStripQuality>&);
00074 
00075  private:
00076 
00077   // unsigned long long m_cacheID_;
00078   //std::string dataLabel_;
00079   //edm::FileInPath fp_;
00080   //SiStripDetInfoFileReader* reader;
00081 
00082   struct pHisto{   
00083 
00084     pHisto():_NEntries(0),_NEmptyBins(0),_SubdetId(0){};
00085     TH1F* _th1f;
00086     int _NEntries;
00087     int _NEmptyBins;
00088     int _SubdetId;
00089   };
00090 
00091   void iterativeSearch(pHisto&,std::vector<unsigned int>&,int);
00092   void evaluatePoissonian(std::vector<long double>& , long double& meanVal);
00093 
00094   long double prob_;
00095   unsigned short MinNumEntries_;
00096   unsigned short MinNumEntriesPerStrip_;
00097   double Nevents_;
00098   double minNevents_;
00099   long double occupancy_;
00100   std::string OutFileName_;
00101   bool WriteOutputFile_;
00102   const TrackerGeometry* TkGeom;
00103 
00104   SiStripQuality *pQuality;
00105 
00106   TFile* f;
00107   TTree* striptree;
00108   bool UseInputDB_;
00109   int detrawid;
00110   int subdetid;
00111   int layer_ring;
00112   int disc;
00113   int isback;
00114   int isexternalstring;
00115   int iszminusside;
00116   int rodstringpetal;
00117   int isstereo;
00118   int module_position;
00119   int number_strips;
00120   int strip_number;
00121   int apv_channel;
00122 
00123   float global_position_x;
00124   float global_position_y;
00125   float global_position_z;
00126 
00127   int isHot;
00128   int hotStripsPerAPV;
00129   int hotStripsPerModule;
00130   double stripOccupancy;
00131   int stripHits;
00132   double poissonProb;
00133 
00134   int ishot[768];
00135   int hotstripsperapv[6];
00136   int hotstripspermodule;
00137   double stripoccupancy[768];
00138   int striphits[768];
00139   double poissonprob[768];
00140 
00141 
00142   std::stringstream ss;   
00143 };
00144 #endif
00145