CMS 3D CMS Logo

SiStripGainsPCLWorker.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/SiStripChannelGain
4 // Class: SiStripGainsPCLWorker
5 //
10 //
11 // Original Author: L. Quertermont (calibration algorithm)
12 // Contributors: M. Verzetti (data access)
13 // A. Di Mattia (PCL multi stream processing and monitoring)
14 // M. Delcourt (monitoring)
15 // M. Musich (migration to thread-safe DQMStore access)
16 //
17 // Created: Wed, 12 Apr 2017 14:46:48 GMT
18 //
19 
20 // CMSSW includes
63 
67 
68 // System includes
69 #include <unordered_map>
70 
71 //
72 // class declaration
73 //
74 
76 public:
78 
79  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
80 
81 private:
82  virtual void beginJob() ;
83  virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &);
84  virtual void dqmBeginRun(edm::Run const&, edm::EventSetup const&);
85  virtual void analyze(const edm::Event&, const edm::EventSetup&);
86  virtual void endJob() ;
87 
88  void processEvent(const TrackerTopology* topo); //what really does the job
89  virtual void checkBookAPVColls(const edm::EventSetup& setup);
90 
91  std::vector<std::string> dqm_tag_;
92 
93  int statCollectionFromMode(const char* tag) const;
94 
95  std::vector<MonitorElement*> Charge_Vs_Index;
96  std::array< std::vector<APVGain::APVmon>,7 > Charge_1;
97  std::array< std::vector<APVGain::APVmon>,7 > Charge_2;
98  std::array< std::vector<APVGain::APVmon>,7 > Charge_3;
99  std::array< std::vector<APVGain::APVmon>,7 > Charge_4;
101  std::vector<MonitorElement*> Charge_Vs_PathlengthTIB;
102  std::vector<MonitorElement*> Charge_Vs_PathlengthTOB;
103  std::vector<MonitorElement*> Charge_Vs_PathlengthTIDP;
104  std::vector<MonitorElement*> Charge_Vs_PathlengthTIDM;
105  std::vector<MonitorElement*> Charge_Vs_PathlengthTECP1;
106  std::vector<MonitorElement*> Charge_Vs_PathlengthTECP2;
107  std::vector<MonitorElement*> Charge_Vs_PathlengthTECM1;
108  std::vector<MonitorElement*> Charge_Vs_PathlengthTECM2;
112  unsigned int NEvent;
113  unsigned int NTrack;
114  unsigned int NClusterStrip;
115  unsigned int NClusterPixel;
118  unsigned int SRun;
119  unsigned int ERun;
120 
123  double MinTrackEta;
124  double MaxTrackEta;
125  unsigned int MaxNrStrips;
126  unsigned int MinTrackHits;
138  std::vector<std::string> VChargeHisto;
141  const TrackerGeometry *bareTkGeomPtr_; // ugly hack to fill APV colls only once, but checks
142 
143  //Data members for processing
144 
145  //Event data
146  unsigned int eventnumber =0;
147  unsigned int runnumber =0;
149 
150  // Track data
158 
159  // CalibTree data
161  const std::vector<unsigned int>* rawid =0; edm::EDGetTokenT<std::vector<unsigned int> > rawid_token_;
166  const std::vector<unsigned short>* nstrips =0; edm::EDGetTokenT<std::vector<unsigned short> > nstrips_token_;
170  const std::vector<unsigned int>* charge =0; edm::EDGetTokenT<std::vector<unsigned int> > charge_token_;
171  const std::vector<double>* path =0; edm::EDGetTokenT<std::vector<double> > path_token_;
176 
179  std::string TrackPrefix_; //("track");
181  std::string CalibPrefix_; //("GainCalibration");
183 
184  std::vector<std::shared_ptr<stAPVGain> > APVsCollOrdered;
185  std::unordered_map<unsigned int, std::shared_ptr<stAPVGain> > APVsColl;
186 
187 };
188 
189 inline int
191 {
192  std::vector<std::string>::const_iterator it=dqm_tag_.begin();
193  while(it!=dqm_tag_.end()) {
194  if(*it==std::string(tag)) return it-dqm_tag_.begin();
195  it++;
196  }
197 
198  if (std::string(tag)=="") return 0; // return StdBunch calibration mode for backward compatibility
199 
200  return None;
201 }
202 
203 template<typename T>
204 inline edm::Handle<T> connect(const T* &ptr, edm::EDGetTokenT<T> token, const edm::Event &evt) {
206  evt.getByToken(token, handle);
207  ptr = handle.product();
208  return handle; //return handle to keep alive pointer (safety first)
209 }
std::vector< MonitorElement * > Charge_Vs_PathlengthTOB
const std::vector< double > * chargeoverpath
edm::EDGetTokenT< std::vector< double > > gainused_token_
const std::vector< int > * trackalgo
edm::EDGetTokenT< std::vector< double > > localdirz_token_
edm::EDGetTokenT< std::vector< bool > > saturation_token_
std::array< std::vector< APVGain::APVmon >, 7 > Charge_1
edm::EDGetTokenT< std::vector< double > > trackchi2ndof_token_
edm::EDGetTokenT< std::vector< double > > gainusedTick_token_
virtual void checkBookAPVColls(const edm::EventSetup &setup)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< std::vector< float > > trackp_token_
SiStripGainsPCLWorker(const edm::ParameterSet &)
const TrackerGeometry * bareTkGeomPtr_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
const std::vector< bool > * TrigTech
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &)
const std::vector< int > * trackindex
const std::vector< float > * trackpt
const std::vector< unsigned int > * rawid
std::vector< std::shared_ptr< stAPVGain > > APVsCollOrdered
const std::vector< unsigned int > * charge
const std::vector< double > * path
const std::vector< bool > * farfromedge
edm::EDGetTokenT< std::vector< unsigned int > > trackhitsvalid_token_
edm::EDGetTokenT< std::vector< unsigned short > > firststrip_token_
edm::EDGetTokenT< std::vector< bool > > farfromedge_token_
edm::EDGetTokenT< std::vector< bool > > overlapping_token_
const std::vector< double > * gainusedTick
std::vector< std::string > dqm_tag_
edm::EDGetTokenT< std::vector< unsigned short > > nstrips_token_
const std::vector< double > * tracketa
edm::EDGetTokenT< std::vector< double > > tracketa_token_
const std::vector< double > * localdiry
const std::vector< float > * trackp
const std::vector< bool > * saturation
edm::ESHandle< TrackerGeometry > tkGeom_
std::unordered_map< unsigned int, std::shared_ptr< stAPVGain > > APVsColl
const std::vector< double > * localdirz
const std::vector< double > * trackphi
std::vector< MonitorElement * > Charge_Vs_PathlengthTIB
std::array< std::vector< APVGain::APVmon >, 7 > Charge_4
const std::vector< bool > * overlapping
edm::EDGetTokenT< std::vector< int > > trackindex_token_
const std::vector< double > * localdirx
edm::EDGetTokenT< std::vector< double > > localdirx_token_
edm::EDGetTokenT< std::vector< unsigned int > > charge_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP1
edm::EDGetTokenT< std::vector< double > > trackphi_token_
const std::vector< unsigned short > * firststrip
const std::vector< unsigned int > * trackhitsvalid
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM2
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< std::vector< float > > trackpt_token_
std::array< std::vector< APVGain::APVmon >, 7 > Charge_2
edm::Handle< T > connect(const T *&ptr, edm::EDGetTokenT< T > token, const edm::Event &evt)
std::vector< std::string > VChargeHisto
edm::EDGetTokenT< std::vector< double > > path_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTECM1
const std::vector< unsigned char > * amplitude
std::array< std::vector< APVGain::APVmon >, 7 > Charge_3
void processEvent(const TrackerTopology *topo)
int statCollectionFromMode(const char *tag) const
edm::EDGetTokenT< std::vector< double > > chargeoverpath_token_
const std::vector< double > * trackchi2ndof
edm::EDGetTokenT< std::vector< int > > trackalgo_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTECP2
edm::EDGetTokenT< std::vector< double > > localdiry_token_
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDP
long double T
edm::EDGetTokenT< std::vector< unsigned char > > amplitude_token_
const std::vector< unsigned short > * nstrips
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
std::vector< MonitorElement * > Charge_Vs_PathlengthTIDM
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: Run.h:42
const std::vector< double > * gainused
edm::EDGetTokenT< std::vector< unsigned int > > rawid_token_
std::vector< MonitorElement * > Charge_Vs_Index
edm::EDGetTokenT< std::vector< bool > > TrigTech_token_