CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
CSCOverlapsAlignmentAlgorithm Class Reference

#include <Alignment/CSCOverlapsAlignmentAlgorithm/interface/CSCOverlapsAlignmentAlgorithm.h>

Inheritance diagram for CSCOverlapsAlignmentAlgorithm:
AlignmentAlgorithmBase

Public Member Functions

 CSCOverlapsAlignmentAlgorithm (const edm::ParameterSet &iConfig)
 
void initialize (const edm::EventSetup &iSetup, AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, AlignableExtras *alignableExtras, AlignmentParameterStore *alignmentParameterStore)
 Call at beginning of job (must be implemented in derived class) More...
 
void run (const edm::EventSetup &iSetup, const EventInfo &eventInfo)
 Run the algorithm (must be implemented in derived class) More...
 
void terminate (const edm::EventSetup &iSetup)
 Call at end of each loop (must be implemented in derived class) More...
 
 ~CSCOverlapsAlignmentAlgorithm ()
 
- Public Member Functions inherited from AlignmentAlgorithmBase
virtual bool addCalibrations (const Calibrations &)
 
 AlignmentAlgorithmBase (const edm::ParameterSet &)
 Constructor. More...
 
virtual void beginLuminosityBlock (const edm::EventSetup &setup)
 called at begin of luminosity block (no lumi block info passed yet) More...
 
virtual void beginRun (const edm::EventSetup &setup)
 called at begin of run More...
 
virtual void endLuminosityBlock (const edm::EventSetup &setup)
 called at end of luminosity block (no lumi block info passed yet) More...
 
virtual void endRun (const EndRunInfo &runInfo, const edm::EventSetup &setup)
 called at end of run - order of arguments like in EDProducer etc. More...
 
virtual bool processesEvents ()
 Returns whether algorithm proccesses events in current configuration. More...
 
virtual bool setParametersForRunRange (const RunRange &rr)
 
virtual void startNewLoop ()
 
virtual bool supportsCalibrations ()
 
virtual void terminate ()
 Called at end of job (must be implemented in derived class) More...
 
virtual ~AlignmentAlgorithmBase ()
 Destructor. More...
 

Public Attributes

bool m_combineME11
 
TH1F * m_drdz
 
bool m_errorFromRMS
 
bool m_fiducial
 
TProfile * m_fiducial_ME11
 
TProfile * m_fiducial_ME12
 
TProfile * m_fiducial_MEx1
 
TProfile * m_fiducial_MEx2
 
TH1F * m_hitsPerChamber
 
bool m_makeHistograms
 
double m_maxdrdz
 
int m_minHitsPerChamber
 
int m_minStationsInTrackRefits
 
int m_minTracksPerOverlap
 
int m_mode
 
TH2F * m_occupancy
 
TH1F * m_offsetResiduals
 
TH1F * m_offsetResiduals_normalized
 
TH1F * m_offsetResiduals_weighted
 
TH2F * m_RPhipos_mem1
 
TH2F * m_RPhipos_mem2
 
TH2F * m_RPhipos_mem3
 
TH2F * m_RPhipos_mem4
 
TH2F * m_RPhipos_mep1
 
TH2F * m_RPhipos_mep2
 
TH2F * m_RPhipos_mep3
 
TH2F * m_RPhipos_mep4
 
TH1F * m_slope
 
TH1F * m_slope_MEm1
 
TH1F * m_slope_MEm2
 
TH1F * m_slope_MEm3
 
TH1F * m_slope_MEm4
 
TH1F * m_slope_MEp1
 
TH1F * m_slope_MEp2
 
TH1F * m_slope_MEp3
 
TH1F * m_slope_MEp4
 
bool m_slopeFromTrackRefit
 
TH1F * m_slopeResiduals
 
TH1F * m_slopeResiduals_normalized
 
TH1F * m_slopeResiduals_weighted
 
double m_truncateOffsetResid
 
double m_truncateSlopeResid
 
bool m_useHitWeights
 
bool m_useTrackWeights
 
TH2F * m_XYpos_mem1
 
TH2F * m_XYpos_mem2
 
TH2F * m_XYpos_mem3
 
TH2F * m_XYpos_mem4
 
TH2F * m_XYpos_mep1
 
TH2F * m_XYpos_mep2
 
TH2F * m_XYpos_mep3
 
TH2F * m_XYpos_mep4
 

Private Attributes

AlignableNavigatorm_alignableNavigator
 
std::vector< Alignable * > m_alignables
 
AlignmentParameterStorem_alignmentParameterStore
 
bool m_doAlignment
 
std::vector< CSCChamberFitterm_fitters
 
TH1F * m_histP10
 
TH1F * m_histP100
 
TH1F * m_histP1000
 
double m_maxRedChi2
 
double m_minP
 
std::string m_mode_string
 
std::string m_propagatorName
 
const Propagatorm_propagatorPointer
 
std::map< std::pair< CSCDetId,
CSCDetId >
, CSCPairResidualsConstraint * > 
m_quickChamberLookup
 
std::vector< std::string > m_readTemporaryFiles
 
std::string m_reportFileName
 
std::vector
< CSCPairResidualsConstraint * > 
m_residualsConstraints
 
TrackTransformerm_trackTransformer
 
std::string m_writeTemporaryFile
 

Additional Inherited Members

- Public Types inherited from AlignmentAlgorithmBase
typedef std::pair< const
Trajectory *, const
reco::Track * > 
ConstTrajTrackPair
 
typedef std::vector
< ConstTrajTrackPair
ConstTrajTrackPairCollection
 
typedef cond::RealTimeType
< cond::runnumber >::type 
RunNumber
 
typedef std::pair< RunNumber,
RunNumber
RunRange
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 61 of file CSCOverlapsAlignmentAlgorithm.h.

Constructor & Destructor Documentation

CSCOverlapsAlignmentAlgorithm::CSCOverlapsAlignmentAlgorithm ( const edm::ParameterSet iConfig)

Definition at line 3 of file CSCOverlapsAlignmentAlgorithm.cc.

References Exception, CSCOverlapsAlignmentAlgorithm_diskfitters_cff::fitters, edm::ParameterSet::getParameter(), i, CSCPairResidualsConstraint::kModePhiPos, CSCPairResidualsConstraint::kModePhiy, CSCPairResidualsConstraint::kModePhiz, CSCPairResidualsConstraint::kModeRadius, m_combineME11, m_drdz, m_fiducial_ME11, m_fiducial_ME12, m_fiducial_MEx1, m_fiducial_MEx2, m_fitters, m_histP10, m_histP100, m_histP1000, m_hitsPerChamber, m_makeHistograms, m_mode, m_mode_string, m_occupancy, m_offsetResiduals, m_offsetResiduals_normalized, m_offsetResiduals_weighted, M_PI, m_propagatorName, m_propagatorPointer, m_quickChamberLookup, m_residualsConstraints, m_RPhipos_mem1, m_RPhipos_mem2, m_RPhipos_mem3, m_RPhipos_mem4, m_RPhipos_mep1, m_RPhipos_mep2, m_RPhipos_mep3, m_RPhipos_mep4, m_slope, m_slope_MEm1, m_slope_MEm2, m_slope_MEm3, m_slope_MEm4, m_slope_MEp1, m_slope_MEp2, m_slope_MEp3, m_slope_MEp4, m_slopeFromTrackRefit, m_slopeResiduals, m_slopeResiduals_normalized, m_slopeResiduals_weighted, m_trackTransformer, m_XYpos_mem1, m_XYpos_mem2, m_XYpos_mem3, m_XYpos_mem4, m_XYpos_mep1, m_XYpos_mep2, m_XYpos_mep3, m_XYpos_mep4, TFileService::make(), NULL, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_25ns14e33_v1_cff::TrackTransformer.

4  : AlignmentAlgorithmBase(iConfig)
5  , m_minHitsPerChamber(iConfig.getParameter<int>("minHitsPerChamber"))
6  , m_maxdrdz(iConfig.getParameter<double>("maxdrdz"))
7  , m_fiducial(iConfig.getParameter<bool>("fiducial"))
8  , m_useHitWeights(iConfig.getParameter<bool>("useHitWeights"))
9  , m_slopeFromTrackRefit(iConfig.getParameter<bool>("slopeFromTrackRefit"))
10  , m_minStationsInTrackRefits(iConfig.getParameter<int>("minStationsInTrackRefits"))
11  , m_truncateSlopeResid(iConfig.getParameter<double>("truncateSlopeResid"))
12  , m_truncateOffsetResid(iConfig.getParameter<double>("truncateOffsetResid"))
13  , m_combineME11(iConfig.getParameter<bool>("combineME11"))
14  , m_useTrackWeights(iConfig.getParameter<bool>("useTrackWeights"))
15  , m_errorFromRMS(iConfig.getParameter<bool>("errorFromRMS"))
16  , m_minTracksPerOverlap(iConfig.getParameter<int>("minTracksPerOverlap"))
17  , m_makeHistograms(iConfig.getParameter<bool>("makeHistograms"))
18  , m_mode_string(iConfig.getParameter<std::string>("mode"))
19  , m_reportFileName(iConfig.getParameter<std::string>("reportFileName"))
20  , m_minP(iConfig.getParameter<double>("minP"))
21  , m_maxRedChi2(iConfig.getParameter<double>("maxRedChi2"))
22  , m_writeTemporaryFile(iConfig.getParameter<std::string>("writeTemporaryFile"))
23  , m_readTemporaryFiles(iConfig.getParameter<std::vector<std::string> >("readTemporaryFiles"))
24  , m_doAlignment(iConfig.getParameter<bool>("doAlignment"))
25 {
30  else throw cms::Exception("BadConfig") << "mode must be one of \"phiy\", \"phipos\", \"phiz\", \"radius\"" << std::endl;
31 
32  std::vector<edm::ParameterSet> fitters = iConfig.getParameter<std::vector<edm::ParameterSet> >("fitters");
33  for (std::vector<edm::ParameterSet>::const_iterator fitter = fitters.begin(); fitter != fitters.end(); ++fitter) {
35  }
36 
37  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin(); residualsConstraint != m_residualsConstraints.end(); ++residualsConstraint) {
38  (*residualsConstraint)->configure(this);
39  m_quickChamberLookup[std::pair<CSCDetId,CSCDetId>((*residualsConstraint)->id_i(), (*residualsConstraint)->id_j())] = *residualsConstraint;
40  }
41 
43  m_trackTransformer = new TrackTransformer(iConfig.getParameter<edm::ParameterSet>("TrackTransformer"));
44  m_propagatorName = iConfig.getParameter<edm::ParameterSet>("TrackTransformer").getParameter<std::string>("Propagator");
45  }
46  else {
49  }
50 
52 
53  if (m_makeHistograms) {
54  edm::Service<TFileService> tFileService;
55  m_histP10 = tFileService->make<TH1F>("P10", "", 100, 0, 10);
56  m_histP100 = tFileService->make<TH1F>("P100", "", 100, 0, 100);
57  m_histP1000 = tFileService->make<TH1F>("P1000", "", 100, 0, 1000);
58 
59  m_hitsPerChamber = tFileService->make<TH1F>("hitsPerChamber", "", 10, -0.5, 9.5);
60 
61  m_fiducial_ME11 = tFileService->make<TProfile>("fiducial_ME11", "", 100, 0.075, 0.100);
62  m_fiducial_ME12 = tFileService->make<TProfile>("fiducial_ME12", "", 100, 0.080, 0.105);
63  m_fiducial_MEx1 = tFileService->make<TProfile>("fiducial_MEx1", "", 100, 0.160, 0.210);
64  m_fiducial_MEx2 = tFileService->make<TProfile>("fiducial_MEx2", "", 100, 0.080, 0.105);
65 
66  m_slope = tFileService->make<TH1F>("slope", "", 100, -0.5, 0.5);
67  m_slope_MEp4 = tFileService->make<TH1F>("slope_MEp4", "", 100, -0.5, 0.5);
68  m_slope_MEp3 = tFileService->make<TH1F>("slope_MEp3", "", 100, -0.5, 0.5);
69  m_slope_MEp2 = tFileService->make<TH1F>("slope_MEp2", "", 100, -0.5, 0.5);
70  m_slope_MEp1 = tFileService->make<TH1F>("slope_MEp1", "", 100, -0.5, 0.5);
71  m_slope_MEm1 = tFileService->make<TH1F>("slope_MEm1", "", 100, -0.5, 0.5);
72  m_slope_MEm2 = tFileService->make<TH1F>("slope_MEm2", "", 100, -0.5, 0.5);
73  m_slope_MEm3 = tFileService->make<TH1F>("slope_MEm3", "", 100, -0.5, 0.5);
74  m_slope_MEm4 = tFileService->make<TH1F>("slope_MEm4", "", 100, -0.5, 0.5);
75 
76  m_slopeResiduals = tFileService->make<TH1F>("slopeResiduals", "mrad", 300, -30., 30.);
77  m_slopeResiduals_weighted = tFileService->make<TH1F>("slopeResiduals_weighted", "mrad", 300, -30., 30.);
78  m_slopeResiduals_normalized = tFileService->make<TH1F>("slopeResiduals_normalized", "", 200, -20., 20.);
79  m_offsetResiduals = tFileService->make<TH1F>("offsetResiduals", "mm", 300, -30., 30.);
80  m_offsetResiduals_weighted = tFileService->make<TH1F>("offsetResiduals_weighted", "mm", 300, -30., 30.);
81  m_offsetResiduals_normalized = tFileService->make<TH1F>("offsetResiduals_normalized", "", 200, -20., 20.);
82 
83  m_drdz = tFileService->make<TH1F>("drdz", "", 100, -0.5, 0.5);
84 
85  m_occupancy = tFileService->make<TH2F>("occupancy", "", 36, 1, 37, 20, 1, 21);
86  for (int i = 1; i <= 36; i++) {
87  std::stringstream pairname;
88  pairname << i << "-";
89  if (i+1 == 37) pairname << 1;
90  else pairname << (i+1);
91  m_occupancy->GetXaxis()->SetBinLabel(i, pairname.str().c_str());
92  }
93  m_occupancy->GetYaxis()->SetBinLabel(1, "ME-4/2");
94  m_occupancy->GetYaxis()->SetBinLabel(2, "ME-4/1");
95  m_occupancy->GetYaxis()->SetBinLabel(3, "ME-3/2");
96  m_occupancy->GetYaxis()->SetBinLabel(4, "ME-3/1");
97  m_occupancy->GetYaxis()->SetBinLabel(5, "ME-2/2");
98  m_occupancy->GetYaxis()->SetBinLabel(6, "ME-2/1");
99  m_occupancy->GetYaxis()->SetBinLabel(7, "ME-1/3");
100  m_occupancy->GetYaxis()->SetBinLabel(8, "ME-1/2");
101  if (!m_combineME11) {
102  m_occupancy->GetYaxis()->SetBinLabel(9, "ME-1/1b");
103  m_occupancy->GetYaxis()->SetBinLabel(10, "ME-1/1a");
104  m_occupancy->GetYaxis()->SetBinLabel(11, "ME+1/1a");
105  m_occupancy->GetYaxis()->SetBinLabel(12, "ME+1/1b");
106  }
107  else {
108  m_occupancy->GetYaxis()->SetBinLabel(9, "ME-1/1");
109  m_occupancy->GetYaxis()->SetBinLabel(10, "");
110  m_occupancy->GetYaxis()->SetBinLabel(11, "");
111  m_occupancy->GetYaxis()->SetBinLabel(12, "ME+1/1");
112  }
113  m_occupancy->GetYaxis()->SetBinLabel(13, "ME+1/2");
114  m_occupancy->GetYaxis()->SetBinLabel(14, "ME+1/3");
115  m_occupancy->GetYaxis()->SetBinLabel(15, "ME+2/1");
116  m_occupancy->GetYaxis()->SetBinLabel(16, "ME+2/2");
117  m_occupancy->GetYaxis()->SetBinLabel(17, "ME+3/1");
118  m_occupancy->GetYaxis()->SetBinLabel(18, "ME+3/2");
119  m_occupancy->GetYaxis()->SetBinLabel(19, "ME+4/1");
120  m_occupancy->GetYaxis()->SetBinLabel(20, "ME+4/2");
121 
122  m_XYpos_mep1 = tFileService->make<TH2F>("XYpos_mep1", "Positions: ME+1", 140, -700., 700., 140, -700., 700.);
123  m_XYpos_mep2 = tFileService->make<TH2F>("XYpos_mep2", "Positions: ME+2", 140, -700., 700., 140, -700., 700.);
124  m_XYpos_mep3 = tFileService->make<TH2F>("XYpos_mep3", "Positions: ME+3", 140, -700., 700., 140, -700., 700.);
125  m_XYpos_mep4 = tFileService->make<TH2F>("XYpos_mep4", "Positions: ME+4", 140, -700., 700., 140, -700., 700.);
126  m_XYpos_mem1 = tFileService->make<TH2F>("XYpos_mem1", "Positions: ME-1", 140, -700., 700., 140, -700., 700.);
127  m_XYpos_mem2 = tFileService->make<TH2F>("XYpos_mem2", "Positions: ME-2", 140, -700., 700., 140, -700., 700.);
128  m_XYpos_mem3 = tFileService->make<TH2F>("XYpos_mem3", "Positions: ME-3", 140, -700., 700., 140, -700., 700.);
129  m_XYpos_mem4 = tFileService->make<TH2F>("XYpos_mem4", "Positions: ME-4", 140, -700., 700., 140, -700., 700.);
130  m_RPhipos_mep1 = tFileService->make<TH2F>("RPhipos_mep1", "Positions: ME+1", 144, -M_PI, M_PI, 21, 0., 700.);
131  m_RPhipos_mep2 = tFileService->make<TH2F>("RPhipos_mep2", "Positions: ME+2", 144, -M_PI, M_PI, 21, 0., 700.);
132  m_RPhipos_mep3 = tFileService->make<TH2F>("RPhipos_mep3", "Positions: ME+3", 144, -M_PI, M_PI, 21, 0., 700.);
133  m_RPhipos_mep4 = tFileService->make<TH2F>("RPhipos_mep4", "Positions: ME+4", 144, -M_PI, M_PI, 21, 0., 700.);
134  m_RPhipos_mem1 = tFileService->make<TH2F>("RPhipos_mem1", "Positions: ME-1", 144, -M_PI, M_PI, 21, 0., 700.);
135  m_RPhipos_mem2 = tFileService->make<TH2F>("RPhipos_mem2", "Positions: ME-2", 144, -M_PI, M_PI, 21, 0., 700.);
136  m_RPhipos_mem3 = tFileService->make<TH2F>("RPhipos_mem3", "Positions: ME-3", 144, -M_PI, M_PI, 21, 0., 700.);
137  m_RPhipos_mem4 = tFileService->make<TH2F>("RPhipos_mem4", "Positions: ME-4", 144, -M_PI, M_PI, 21, 0., 700.);
138  }
139  else {
140  m_histP10 = NULL;
141  m_histP100 = NULL;
142  m_histP1000 = NULL;
148  m_slope = NULL;
149  m_slope_MEp4 = NULL;
150  m_slope_MEp3 = NULL;
151  m_slope_MEp2 = NULL;
152  m_slope_MEp1 = NULL;
153  m_slope_MEm1 = NULL;
154  m_slope_MEm2 = NULL;
155  m_slope_MEm3 = NULL;
156  m_slope_MEm4 = NULL;
163  m_drdz = NULL;
164  m_occupancy = NULL;
165  m_XYpos_mep1 = NULL;
166  m_XYpos_mep2 = NULL;
167  m_XYpos_mep3 = NULL;
168  m_XYpos_mep4 = NULL;
169  m_XYpos_mem1 = NULL;
170  m_XYpos_mem2 = NULL;
171  m_XYpos_mem3 = NULL;
172  m_XYpos_mem4 = NULL;
181  }
182 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< CSCChamberFitter > m_fitters
std::vector< std::string > m_readTemporaryFiles
#define NULL
Definition: scimark2.h:8
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
AlignmentAlgorithmBase(const edm::ParameterSet &)
Constructor.
#define M_PI
std::vector< CSCPairResidualsConstraint * > m_residualsConstraints
std::map< std::pair< CSCDetId, CSCDetId >, CSCPairResidualsConstraint * > m_quickChamberLookup
CSCOverlapsAlignmentAlgorithm::~CSCOverlapsAlignmentAlgorithm ( )

Definition at line 184 of file CSCOverlapsAlignmentAlgorithm.cc.

184 {}

Member Function Documentation

void CSCOverlapsAlignmentAlgorithm::initialize ( const edm::EventSetup setup,
AlignableTracker tracker,
AlignableMuon muon,
AlignableExtras extras,
AlignmentParameterStore store 
)
virtual

Call at beginning of job (must be implemented in derived class)

Implements AlignmentAlgorithmBase.

Definition at line 186 of file CSCOverlapsAlignmentAlgorithm.cc.

References AlignmentParameterStore::alignables(), MuonSubdetId::CSC, CSCDetId, Exception, mergeVDriftHistosByStation::file, MillePedeFileConverter_cfg::fileName, edm::EventSetup::get(), i, input, m_alignableNavigator, m_alignables, m_alignmentParameterStore, m_readTemporaryFiles, m_residualsConstraints, DetId::Muon, and NULL.

186  {
187  m_alignmentParameterStore = alignmentParameterStore;
189 
190  if (alignableTracker == NULL) m_alignableNavigator = new AlignableNavigator(alignableMuon);
191  else m_alignableNavigator = new AlignableNavigator(alignableTracker, alignableMuon);
192 
193  for (std::vector<Alignable*>::const_iterator alignable = m_alignables.begin(); alignable != m_alignables.end(); ++alignable) {
194  DetId id = (*alignable)->geomDetId();
195  if (id.det() != DetId::Muon || id.subdetId() != MuonSubdetId::CSC || CSCDetId(id.rawId()).layer() != 0) {
196  throw cms::Exception("BadConfig") << "Only CSC chambers may be alignable" << std::endl;
197  }
198 
199  std::vector<bool> selector = (*alignable)->alignmentParameters()->selector();
200  for (std::vector<bool>::const_iterator i = selector.begin(); i != selector.end(); ++i) {
201  if (!(*i)) throw cms::Exception("BadConfig") << "All selector strings should be \"111111\"" << std::endl;
202  }
203  }
204 
205  edm::ESHandle<CSCGeometry> cscGeometry;
206  iSetup.get<MuonGeometryRecord>().get(cscGeometry);
207 
208  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin(); residualsConstraint != m_residualsConstraints.end(); ++residualsConstraint) {
209  (*residualsConstraint)->setZplane(&*cscGeometry);
210  }
211 
212  if (m_readTemporaryFiles.size() != 0) {
213  std::vector<std::ifstream*> input;
214  for (std::vector<std::string>::const_iterator fileName = m_readTemporaryFiles.begin(); fileName != m_readTemporaryFiles.end(); ++fileName) {
215  input.push_back(new std::ifstream(fileName->c_str()));
216  }
217 
218  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin(); residualsConstraint != m_residualsConstraints.end(); ++residualsConstraint) {
219  (*residualsConstraint)->read(input, m_readTemporaryFiles);
220  }
221 
222  for (std::vector<std::ifstream*>::const_iterator file = input.begin(); file != input.end(); ++file) {
223  delete (*file);
224  }
225  }
226 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > m_readTemporaryFiles
#define NULL
Definition: scimark2.h:8
AlignmentParameterStore * m_alignmentParameterStore
static std::string const input
Definition: EdmProvDump.cc:43
static const int CSC
Definition: MuonSubdetId.h:13
std::vector< CSCPairResidualsConstraint * > m_residualsConstraints
Definition: DetId.h:18
const align::Alignables & alignables(void) const
get all alignables
void CSCOverlapsAlignmentAlgorithm::run ( const edm::EventSetup setup,
const EventInfo eventInfo 
)
virtual

Run the algorithm (must be implemented in derived class)

Implements AlignmentAlgorithmBase.

Definition at line 228 of file CSCOverlapsAlignmentAlgorithm.cc.

References CSCDetId::chamber(), MuonSubdetId::CSC, CSCDetId, CSCDetId::endcap(), edm::EventSetup::get(), m_combineME11, m_histP10, m_histP100, m_histP1000, m_makeHistograms, m_minP, m_propagatorName, m_propagatorPointer, m_quickChamberLookup, m_residualsConstraints, m_RPhipos_mem1, m_RPhipos_mem2, m_RPhipos_mem3, m_RPhipos_mem4, m_RPhipos_mep1, m_RPhipos_mep2, m_RPhipos_mep3, m_RPhipos_mep4, m_slopeFromTrackRefit, m_trackTransformer, m_XYpos_mem1, m_XYpos_mem2, m_XYpos_mem3, m_XYpos_mem4, m_XYpos_mep1, m_XYpos_mep2, m_XYpos_mep3, m_XYpos_mep4, python.multivaluedict::map(), Trajectory::measurements(), DetId::Muon, NULL, reco::TrackBase::p(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), HLT_25ns14e33_v1_cff::propagator, CSCDetId::ring(), TrackTransformer::setServices(), relativeConstraints::station, CSCDetId::station(), AlignmentAlgorithmBase::EventInfo::trajTrackPairs(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

228  {
230  if (m_slopeFromTrackRefit) {
231  iSetup.get<TrackingComponentsRecord>().get(m_propagatorName, propagator);
232  if (m_propagatorPointer != &*propagator) {
234 
235  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin(); residualsConstraint != m_residualsConstraints.end(); ++residualsConstraint) {
236  (*residualsConstraint)->setPropagator(m_propagatorPointer);
237  }
238  }
239  }
240 
241  edm::ESHandle<TransientTrackBuilder> transientTrackBuilder;
242  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", transientTrackBuilder);
243 
245 
246  const ConstTrajTrackPairCollection &trajtracks = eventInfo.trajTrackPairs();
247  for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end(); ++trajtrack) {
248  const Trajectory* traj = (*trajtrack).first;
249  const reco::Track* track = (*trajtrack).second;
250 
251  if (m_makeHistograms) {
252  m_histP10->Fill(track->p());
253  m_histP100->Fill(track->p());
254  m_histP1000->Fill(track->p());
255  }
256  if (track->p() >= m_minP) {
257  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
258  reco::TransientTrack transientTrack = transientTrackBuilder->build(track);
259 
260  std::map<int,std::map<CSCDetId,bool> > stationsToChambers;
261  for (std::vector<TrajectoryMeasurement>::const_iterator measurement = measurements.begin(); measurement != measurements.end(); ++measurement) {
262  DetId id = measurement->recHit()->geographicalId();
263  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
264  CSCDetId cscid(id.rawId());
265  CSCDetId chamberId(cscid.endcap(), cscid.station(), cscid.ring(), cscid.chamber(), 0);
266  if (m_combineME11 && cscid.station() == 1 && cscid.ring() == 4) chamberId = CSCDetId(cscid.endcap(), 1, 1, cscid.chamber(), 0);
267  int station = (cscid.endcap() == 1 ? 1 : -1)*cscid.station();
268 
269  if (stationsToChambers.find(station) == stationsToChambers.end()) stationsToChambers[station] = std::map<CSCDetId,bool>();
270  stationsToChambers[station][chamberId] = true;
271 
272  if (m_makeHistograms) {
273  GlobalPoint pos = measurement->recHit()->globalPosition();
274  if (cscid.endcap() == 1 && cscid.station() == 1) { m_XYpos_mep1->Fill(pos.x(), pos.y()); m_RPhipos_mep1->Fill(pos.phi(), pos.perp()); }
275  if (cscid.endcap() == 1 && cscid.station() == 2) { m_XYpos_mep2->Fill(pos.x(), pos.y()); m_RPhipos_mep2->Fill(pos.phi(), pos.perp()); }
276  if (cscid.endcap() == 1 && cscid.station() == 3) { m_XYpos_mep3->Fill(pos.x(), pos.y()); m_RPhipos_mep3->Fill(pos.phi(), pos.perp()); }
277  if (cscid.endcap() == 1 && cscid.station() == 4) { m_XYpos_mep4->Fill(pos.x(), pos.y()); m_RPhipos_mep4->Fill(pos.phi(), pos.perp()); }
278  if (cscid.endcap() == 2 && cscid.station() == 1) { m_XYpos_mem1->Fill(pos.x(), pos.y()); m_RPhipos_mem1->Fill(pos.phi(), pos.perp()); }
279  if (cscid.endcap() == 2 && cscid.station() == 2) { m_XYpos_mem2->Fill(pos.x(), pos.y()); m_RPhipos_mem2->Fill(pos.phi(), pos.perp()); }
280  if (cscid.endcap() == 2 && cscid.station() == 3) { m_XYpos_mem3->Fill(pos.x(), pos.y()); m_RPhipos_mem3->Fill(pos.phi(), pos.perp()); }
281  if (cscid.endcap() == 2 && cscid.station() == 4) { m_XYpos_mem4->Fill(pos.x(), pos.y()); m_RPhipos_mem4->Fill(pos.phi(), pos.perp()); }
282  }
283  }
284  }
285 
286  std::map<CSCPairResidualsConstraint*,bool> residualsConstraints;
287  for (std::map<int,std::map<CSCDetId,bool> >::const_iterator iter = stationsToChambers.begin(); iter != stationsToChambers.end(); ++iter) {
288  for (std::map<CSCDetId,bool>::const_iterator one = iter->second.begin(); one != iter->second.end(); ++one) {
289  for (std::map<CSCDetId,bool>::const_iterator two = one; two != iter->second.end(); ++two) {
290  if (one != two) {
291  std::map<std::pair<CSCDetId,CSCDetId>,CSCPairResidualsConstraint*>::const_iterator quick;
292 
293  quick = m_quickChamberLookup.find(std::pair<CSCDetId,CSCDetId>(one->first, two->first));
294  if (quick != m_quickChamberLookup.end()) residualsConstraints[quick->second] = true;
295 
296  quick = m_quickChamberLookup.find(std::pair<CSCDetId,CSCDetId>(two->first, one->first));
297  if (quick != m_quickChamberLookup.end()) residualsConstraints[quick->second] = true;
298  }
299  }
300  }
301  }
302 
303  for (std::map<CSCPairResidualsConstraint*,bool>::const_iterator residualsConstraint = residualsConstraints.begin(); residualsConstraint != residualsConstraints.end(); ++residualsConstraint) {
304  residualsConstraint->first->addTrack(measurements, transientTrack, m_trackTransformer);
305  }
306  }
307  }
308 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:578
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
#define NULL
Definition: scimark2.h:8
const ConstTrajTrackPairCollection & trajTrackPairs() const
DataContainer const & measurements() const
Definition: Trajectory.h:203
static const int CSC
Definition: MuonSubdetId.h:13
virtual void setServices(const edm::EventSetup &)
set the services needed by the TrackTransformer
std::vector< CSCPairResidualsConstraint * > m_residualsConstraints
Definition: DetId.h:18
std::map< std::pair< CSCDetId, CSCDetId >, CSCPairResidualsConstraint * > m_quickChamberLookup
T x() const
Definition: PV3DBase.h:62
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
void CSCOverlapsAlignmentAlgorithm::terminate ( const edm::EventSetup iSetup)
virtual

Call at end of each loop (must be implemented in derived class)

Implements AlignmentAlgorithmBase.

Definition at line 310 of file CSCOverlapsAlignmentAlgorithm.cc.

References CSCPairResidualsConstraint::kModeRadius, m_alignableNavigator, m_alignmentParameterStore, m_combineME11, m_doAlignment, m_fitters, m_makeHistograms, m_mode, m_reportFileName, m_residualsConstraints, m_writeTemporaryFile, convertSQLitetoXML_cfg::output, zeeHLT_cff::report, and AlCaHLTBitMon_QueryRunRegistry::string.

310  {
311  // write residuals partial fits to temporary files for collection
312  if (m_writeTemporaryFile != std::string("")) {
313  std::ofstream output(m_writeTemporaryFile.c_str());
314  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin(); residualsConstraint != m_residualsConstraints.end(); ++residualsConstraint) {
315  (*residualsConstraint)->write(output);
316  }
317  }
318 
319  // write report for alignment results
320  if (m_doAlignment) {
321  std::ofstream report;
322  bool writeReport = (m_reportFileName != std::string(""));
323  if (writeReport) {
324  report.open(m_reportFileName.c_str());
325  report << "cscReports = []" << std::endl << std::endl
326  << "class CSCChamberCorrection:" << std::endl
327  << " def __init__(self, name, detid, value):" << std::endl
328  << " self.name, self.detid, self.value = name, detid, value" << std::endl << std::endl
329  << "class CSCErrorMode:" << std::endl
330  << " def __init__(self, error):" << std::endl
331  << " self.error = error" << std::endl
332  << " self.terms = {}" << std::endl
333  << " self.detids = {}" << std::endl
334  << " def addTerm(self, name, detid, coefficient):" << std::endl
335  << " self.terms[name] = coefficient" << std::endl
336  << " self.detids[name] = detid" << std::endl << std::endl
337  << "class CSCConstraintResidual:" << std::endl
338  << " def __init__(self, i, j, before, uncert, residual, pull):" << std::endl
339  << " self.i, self.j, self.before, self.error, self.residual, self.pull = i, j, before, uncert, residual, pull" << std::endl << std::endl
340  << "class CSCFitterReport:" << std::endl
341  << " def __init__(self, name, oldchi2, newchi2):" << std::endl
342  << " self.name, self.oldchi2, self.newchi2 = name, oldchi2, newchi2" << std::endl
343  << " self.chamberCorrections = []" << std::endl
344  << " self.errorModes = []" << std::endl
345  << " self.constraintResiduals = []" << std::endl << std::endl
346  << " def addChamberCorrection(self, name, detid, value):" << std::endl
347  << " self.chamberCorrections.append(CSCChamberCorrection(name, detid, value))" << std::endl << std::endl
348  << " def addErrorMode(self, error):" << std::endl
349  << " self.errorModes.append(CSCErrorMode(error))" << std::endl << std::endl
350  << " def addErrorModeTerm(self, name, detid, coefficient):" << std::endl
351  << " self.errorModes[-1].addTerm(name, detid, coefficient)" << std::endl << std::endl
352  << " def addCSCConstraintResidual(self, i, j, before, uncert, residual, pull):" << std::endl
353  << " self.constraintResiduals.append(CSCConstraintResidual(i, j, before, uncert, residual, pull))" << std::endl << std::endl
354  << "import re" << std::endl
355  << "def nameToKey(name):" << std::endl
356  << " match = re.match(\"ME([\\+\\-])([1-4])/([1-4])/([0-9]{2})\", name)" << std::endl
357  << " if match is None: return None" << std::endl
358  << " endcap, station, ring, chamber = match.groups()" << std::endl
359  << " if endcap == \"+\": endcap = 1" << std::endl
360  << " else: endcap = 2" << std::endl
361  << " station = int(station)" << std::endl
362  << " ring = int(ring)" << std::endl
363  << " chamber = int(chamber)" << std::endl
364  << " return endcap, station, ring, chamber" << std::endl << std::endl;
365  }
366 
367  for (std::vector<CSCChamberFitter>::const_iterator fitter = m_fitters.begin(); fitter != m_fitters.end(); ++fitter) {
370 
371 
372 
373  }
374  else {
375  std::vector<CSCAlignmentCorrections*> corrections;
376  fitter->fit(corrections);
377 
378  // corrections only exist if the fit was successful
379  for (std::vector<CSCAlignmentCorrections*>::iterator correction = corrections.begin(); correction != corrections.end(); ++correction) {
380 
381  (*correction)->applyAlignment(m_alignableNavigator, m_alignmentParameterStore, m_mode, m_combineME11);
382  if (m_makeHistograms) (*correction)->plot();
383  if (writeReport) (*correction)->report(report);
384  }
385  }
386  }
387  }
388 }
std::vector< CSCChamberFitter > m_fitters
AlignmentParameterStore * m_alignmentParameterStore
tuple report
Definition: zeeHLT_cff.py:9
std::vector< CSCPairResidualsConstraint * > m_residualsConstraints

Member Data Documentation

AlignableNavigator* CSCOverlapsAlignmentAlgorithm::m_alignableNavigator
private

Definition at line 143 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by initialize(), and terminate().

std::vector<Alignable*> CSCOverlapsAlignmentAlgorithm::m_alignables
private

Definition at line 142 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by initialize().

AlignmentParameterStore* CSCOverlapsAlignmentAlgorithm::m_alignmentParameterStore
private

Definition at line 141 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by initialize(), and terminate().

bool CSCOverlapsAlignmentAlgorithm::m_combineME11
bool CSCOverlapsAlignmentAlgorithm::m_doAlignment
private

Definition at line 139 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by terminate().

TH1F* CSCOverlapsAlignmentAlgorithm::m_drdz
bool CSCOverlapsAlignmentAlgorithm::m_errorFromRMS

Definition at line 128 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCPairResidualsConstraint::error().

bool CSCOverlapsAlignmentAlgorithm::m_fiducial
TProfile* CSCOverlapsAlignmentAlgorithm::m_fiducial_ME11
TProfile* CSCOverlapsAlignmentAlgorithm::m_fiducial_ME12
TProfile* CSCOverlapsAlignmentAlgorithm::m_fiducial_MEx1
TProfile* CSCOverlapsAlignmentAlgorithm::m_fiducial_MEx2
std::vector<CSCChamberFitter> CSCOverlapsAlignmentAlgorithm::m_fitters
private

Definition at line 144 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and terminate().

TH1F* CSCOverlapsAlignmentAlgorithm::m_histP10
private

Definition at line 152 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH1F* CSCOverlapsAlignmentAlgorithm::m_histP100
private

Definition at line 153 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH1F* CSCOverlapsAlignmentAlgorithm::m_histP1000
private

Definition at line 154 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH1F* CSCOverlapsAlignmentAlgorithm::m_hitsPerChamber
bool CSCOverlapsAlignmentAlgorithm::m_makeHistograms
double CSCOverlapsAlignmentAlgorithm::m_maxdrdz
double CSCOverlapsAlignmentAlgorithm::m_maxRedChi2
private

Definition at line 136 of file CSCOverlapsAlignmentAlgorithm.h.

int CSCOverlapsAlignmentAlgorithm::m_minHitsPerChamber
double CSCOverlapsAlignmentAlgorithm::m_minP
private

Definition at line 135 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by run().

int CSCOverlapsAlignmentAlgorithm::m_minStationsInTrackRefits
int CSCOverlapsAlignmentAlgorithm::m_minTracksPerOverlap

Definition at line 129 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCPairResidualsConstraint::valid().

int CSCOverlapsAlignmentAlgorithm::m_mode
std::string CSCOverlapsAlignmentAlgorithm::m_mode_string
private

Definition at line 133 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm().

TH2F* CSCOverlapsAlignmentAlgorithm::m_occupancy
TH1F* CSCOverlapsAlignmentAlgorithm::m_offsetResiduals
TH1F* CSCOverlapsAlignmentAlgorithm::m_offsetResiduals_normalized
TH1F* CSCOverlapsAlignmentAlgorithm::m_offsetResiduals_weighted
std::string CSCOverlapsAlignmentAlgorithm::m_propagatorName
private

Definition at line 149 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

const Propagator* CSCOverlapsAlignmentAlgorithm::m_propagatorPointer
private

Definition at line 150 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

std::map<std::pair<CSCDetId,CSCDetId>,CSCPairResidualsConstraint*> CSCOverlapsAlignmentAlgorithm::m_quickChamberLookup
private

Definition at line 146 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

std::vector<std::string> CSCOverlapsAlignmentAlgorithm::m_readTemporaryFiles
private

Definition at line 138 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by initialize().

std::string CSCOverlapsAlignmentAlgorithm::m_reportFileName
private

Definition at line 134 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by terminate().

std::vector<CSCPairResidualsConstraint*> CSCOverlapsAlignmentAlgorithm::m_residualsConstraints
private
TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mem1

Definition at line 112 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mem2

Definition at line 113 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mem3

Definition at line 114 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mem4

Definition at line 115 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mep1

Definition at line 108 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mep2

Definition at line 109 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mep3

Definition at line 110 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_RPhipos_mep4

Definition at line 111 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH1F* CSCOverlapsAlignmentAlgorithm::m_slope
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEm1
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEm2
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEm3
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEm4
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEp1
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEp2
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEp3
TH1F* CSCOverlapsAlignmentAlgorithm::m_slope_MEp4
bool CSCOverlapsAlignmentAlgorithm::m_slopeFromTrackRefit
TH1F* CSCOverlapsAlignmentAlgorithm::m_slopeResiduals
TH1F* CSCOverlapsAlignmentAlgorithm::m_slopeResiduals_normalized
TH1F* CSCOverlapsAlignmentAlgorithm::m_slopeResiduals_weighted
TrackTransformer* CSCOverlapsAlignmentAlgorithm::m_trackTransformer
private

Definition at line 148 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

double CSCOverlapsAlignmentAlgorithm::m_truncateOffsetResid
double CSCOverlapsAlignmentAlgorithm::m_truncateSlopeResid
bool CSCOverlapsAlignmentAlgorithm::m_useHitWeights
bool CSCOverlapsAlignmentAlgorithm::m_useTrackWeights
std::string CSCOverlapsAlignmentAlgorithm::m_writeTemporaryFile
private

Definition at line 137 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by terminate().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mem1

Definition at line 104 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mem2

Definition at line 105 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mem3

Definition at line 106 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mem4

Definition at line 107 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mep1

Definition at line 100 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mep2

Definition at line 101 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mep3

Definition at line 102 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().

TH2F* CSCOverlapsAlignmentAlgorithm::m_XYpos_mep4

Definition at line 103 of file CSCOverlapsAlignmentAlgorithm.h.

Referenced by CSCOverlapsAlignmentAlgorithm(), and run().