Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:28

0001 #ifndef DTVDriftCalibration_H
0002 #define DTVDriftCalibration_H
0003 
0004 /** \class DTVDriftCalibration
0005  *  No description available.
0006  *
0007  *  \author M. Giunta
0008  */
0009 
0010 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0011 #include "FWCore/Utilities/interface/InputTag.h"
0012 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0013 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0014 
0015 #include "CalibMuon/DTCalibration/interface/vDriftHistos.h"
0016 #include "CalibMuon/DTCalibration/interface/DTTMax.h"
0017 #include "CalibMuon/DTCalibration/interface/DTSegmentSelector.h"
0018 
0019 #include "DTCalibrationMap.h"
0020 
0021 #include <string>
0022 #include <vector>
0023 
0024 namespace edm {
0025   class ParameterSet;
0026   class Event;
0027   class EventSetup;
0028 }  // namespace edm
0029 
0030 class TFile;
0031 class DTMeanTimerFitter;
0032 class DTGeometry;
0033 class MuonGeometryRecord;
0034 
0035 class DTVDriftCalibration : public edm::one::EDAnalyzer<> {
0036 public:
0037   /// Constructor
0038   DTVDriftCalibration(const edm::ParameterSet& pset);
0039 
0040   /// Destructor
0041   ~DTVDriftCalibration() override;
0042 
0043   // Operations
0044 
0045   void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override;
0046 
0047   void endJob() override;
0048 
0049 protected:
0050 private:
0051   std::unique_ptr<DTSegmentSelector> select_;
0052 
0053   // The class containing TMax information
0054   typedef DTTMax::TMax TMax;
0055 
0056   dtcalibration::Histograms histograms_;
0057 
0058   // class to create/manage histos for each partition (SL)
0059   class cellInfo {
0060   public:
0061     cellInfo(const TString& name) { histos = new hTMaxCell(name); }
0062 
0063     ~cellInfo() { delete histos; }
0064 
0065     void add(const std::vector<const TMax*>& tMaxes);
0066     void update() { addedCells.clear(); }
0067     hTMaxCell* getHists() { return histos; }
0068 
0069   private:
0070     cellInfo(){};
0071     cellInfo(const cellInfo&){};
0072 
0073     std::vector<dttmaxenums::TMaxCells> addedCells;
0074     hTMaxCell* histos;
0075   };
0076 
0077   TH1F* hChi2;
0078   h2DSegm* h2DSegmRZ;
0079   h2DSegm* h2DSegmRPhi;
0080   h4DSegm* h4DSegmAllCh;
0081 
0082   // Divide cellInfo by given granularity (to be implemented)
0083   // DTVDriftCalibration::cellInfo* partition(const DTWireId& wireId);
0084 
0085   // Specify the granularity for the TMax histograms
0086   enum TMaxGranularity { byChamber, bySL, byPartition };
0087   TMaxGranularity theGranularity;
0088 
0089   // The label used to retrieve 4D segments from the event
0090   edm::EDGetTokenT<DTRecSegment4DCollection> theRecHits4DToken;
0091 
0092   const edm::ESGetToken<DTGeometry, MuonGeometryRecord> theDTGeomToken;
0093 
0094   // Debug flag
0095   bool debug;
0096 
0097   // The label used to retrieve digis from the event
0098   std::string digiLabel;
0099 
0100   // The file which will contain the tMax histograms
0101   TFile* theFile;
0102 
0103   // The fitter
0104   std::unique_ptr<DTMeanTimerFitter> theFitter;
0105 
0106   // Perform the vDrift and t0 evaluation or just fill the
0107   //  tMaxHists (if you read the dataset in different jobs)
0108   bool findVDriftAndT0;
0109 
0110   // The name of the output text file
0111   std::string theVDriftOutputFile;
0112 
0113   // Map of wires and cellInfo with coarse granularity
0114   std::map<DTWireId, cellInfo*> theWireIdAndCellMap;
0115 
0116   // Switch for checking of noisy channels
0117   //bool checkNoisyChannels;
0118 
0119   // The module for t0 subtraction
0120   std::unique_ptr<DTTTrigBaseSync> theSync;  //FIXME: should be const
0121 
0122   // parameter set for DTCalibrationMap constructor
0123   edm::ParameterSet theCalibFilePar;
0124 
0125   // Maximum value for the 4D Segment chi2
0126   //double theMaxChi2;
0127 
0128   // Maximum incident angle for Phi Seg
0129   //double theMaxPhiAngle;
0130 
0131   // Maximum incident angle for Theta Seg
0132   //double theMaxZAngle;
0133 
0134   // Choose the chamber you want to calibrate
0135   std::string theCalibChamber;
0136 
0137   // which format to be created
0138   bool writeLegacyVDriftDB;
0139 };
0140 #endif