00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020 #include <memory>
00021
00022
00023 #include "FWCore/Framework/interface/ModuleFactory.h"
00024 #include "FWCore/Framework/interface/ESProducer.h"
00025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00026
00027
00028
00029
00030 #include "CondFormats/Alignment/interface/Alignments.h"
00031 #include "CondFormats/Alignment/interface/AlignmentErrors.h"
00032 #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
00033 #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
00034 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
00035 #include "DataFormats/EcalDetId/interface/ESDetId.h"
00036 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00037 #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"
00038 #include "CondFormats/AlignmentRecord/interface/EBAlignmentRcd.h"
00039 #include "CondFormats/AlignmentRecord/interface/EBAlignmentErrorRcd.h"
00040 #include "CondFormats/AlignmentRecord/interface/EEAlignmentRcd.h"
00041 #include "CondFormats/AlignmentRecord/interface/EEAlignmentErrorRcd.h"
00042 #include "CondFormats/AlignmentRecord/interface/ESAlignmentRcd.h"
00043 #include "CondFormats/AlignmentRecord/interface/ESAlignmentErrorRcd.h"
00044 #include "CondFormats/AlignmentRecord/interface/HBAlignmentRcd.h"
00045 #include "CondFormats/AlignmentRecord/interface/HBAlignmentErrorRcd.h"
00046 #include "CondFormats/AlignmentRecord/interface/HEAlignmentRcd.h"
00047 #include "CondFormats/AlignmentRecord/interface/HEAlignmentErrorRcd.h"
00048 #include "CondFormats/AlignmentRecord/interface/HOAlignmentRcd.h"
00049 #include "CondFormats/AlignmentRecord/interface/HOAlignmentErrorRcd.h"
00050 #include "CondFormats/AlignmentRecord/interface/HFAlignmentRcd.h"
00051 #include "CondFormats/AlignmentRecord/interface/HFAlignmentErrorRcd.h"
00052 #include "CondFormats/AlignmentRecord/interface/ZDCAlignmentRcd.h"
00053 #include "CondFormats/AlignmentRecord/interface/ZDCAlignmentErrorRcd.h"
00054
00055 class FakeCaloAlignmentEP : public edm::ESProducer
00056 {
00057 public:
00058
00059 typedef boost::shared_ptr<Alignments> ReturnAli ;
00060 typedef boost::shared_ptr<AlignmentErrors> ReturnAliErr ;
00061
00062 typedef AlignTransform::Translation Trl ;
00063 typedef AlignTransform::Rotation Rot ;
00064
00065 FakeCaloAlignmentEP(const edm::ParameterSet&)
00066 {
00067 setWhatProduced( this, &FakeCaloAlignmentEP::produceEBAli ) ;
00068 setWhatProduced( this, &FakeCaloAlignmentEP::produceEBAliErr ) ;
00069 setWhatProduced( this, &FakeCaloAlignmentEP::produceEEAli ) ;
00070 setWhatProduced( this, &FakeCaloAlignmentEP::produceEEAliErr ) ;
00071 setWhatProduced( this, &FakeCaloAlignmentEP::produceESAli ) ;
00072 setWhatProduced( this, &FakeCaloAlignmentEP::produceESAliErr ) ;
00073 setWhatProduced( this, &FakeCaloAlignmentEP::produceHBAli ) ;
00074 setWhatProduced( this, &FakeCaloAlignmentEP::produceHBAliErr ) ;
00075 setWhatProduced( this, &FakeCaloAlignmentEP::produceHEAli ) ;
00076 setWhatProduced( this, &FakeCaloAlignmentEP::produceHEAliErr ) ;
00077 setWhatProduced( this, &FakeCaloAlignmentEP::produceHOAli ) ;
00078 setWhatProduced( this, &FakeCaloAlignmentEP::produceHOAliErr ) ;
00079 setWhatProduced( this, &FakeCaloAlignmentEP::produceHFAli ) ;
00080 setWhatProduced( this, &FakeCaloAlignmentEP::produceHFAliErr ) ;
00081 }
00082
00083 ~FakeCaloAlignmentEP() {}
00084
00085
00086
00087 ReturnAli produceEBAli( const EBAlignmentRcd& iRecord )
00088 {
00089 ReturnAli ali ( new Alignments ) ;
00090 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00091 const unsigned int nA ( EcalBarrelGeometry::numberOfAlignments() ) ;
00092 vtr.reserve( nA ) ;
00093 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00094 {
00095 const EBDetId id ( i+1, 1, EBDetId::SMCRYSTALMODE ) ;
00096 vtr.push_back( AlignTransform( ( 1==id.ism() ? Trl( 0, 0, 0 ) :
00097 Trl(0,0,0) ) ,
00098 Rot(),
00099 id ) ) ;
00100 }
00101 return ali ;
00102 }
00103
00104 ReturnAliErr produceEBAliErr( const EBAlignmentErrorRcd& iRecord )
00105 {
00106 ReturnAliErr aliErr ( new AlignmentErrors );
00107 return aliErr ;
00108 }
00109
00110
00111 ReturnAli produceEEAli( const EEAlignmentRcd& iRecord )
00112 {
00113 ReturnAli ali ( new Alignments ) ;
00114 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00115 const unsigned int nA ( EcalEndcapGeometry::numberOfAlignments() ) ;
00116 vtr.reserve( nA ) ;
00117 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00118 {
00119 const EEDetId id ( (i%2)==0 ? 1 : 100, 50, (i<2?-1:1) ) ;
00120 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00121 Rot(),
00122 id ) ) ;
00123 }
00124 return ali ;
00125 }
00126
00127 ReturnAliErr produceEEAliErr( const EEAlignmentErrorRcd& iRecord )
00128 {
00129 ReturnAliErr aliErr ( new AlignmentErrors );
00130 return aliErr ;
00131 }
00132
00133
00134 ReturnAli produceESAli( const ESAlignmentRcd& iRecord )
00135 {
00136 ReturnAli ali ( new Alignments ) ;
00137 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00138 const unsigned int nA ( EcalPreshowerGeometry::numberOfAlignments() ) ;
00139 vtr.reserve( nA ) ;
00140 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00141 {
00142 const ESDetId id ;
00143 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00144 Rot(),
00145 id ) ) ;
00146 }
00147 return ali ;
00148 }
00149
00150 ReturnAliErr produceESAliErr( const ESAlignmentErrorRcd& iRecord )
00151 {
00152 ReturnAliErr aliErr ( new AlignmentErrors );
00153 return aliErr ;
00154 }
00155
00156
00157 ReturnAli produceHBAli( const HBAlignmentRcd& iRecord )
00158 {
00159 ReturnAli ali ( new Alignments ) ;
00160 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00161 const unsigned int nA ( 10 ) ;
00162 vtr.reserve( nA ) ;
00163 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00164 {
00165 const HcalDetId id ;
00166 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00167 Rot(),
00168 id ) ) ;
00169 }
00170 return ali ;
00171 }
00172
00173 ReturnAliErr produceHBAliErr( const HBAlignmentErrorRcd& iRecord )
00174 {
00175 ReturnAliErr aliErr ( new AlignmentErrors );
00176 return aliErr ;
00177 }
00178
00179
00180 ReturnAli produceHEAli( const HEAlignmentRcd& iRecord )
00181 {
00182 ReturnAli ali ( new Alignments ) ;
00183 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00184 const unsigned int nA ( 10 ) ;
00185 vtr.reserve( nA ) ;
00186 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00187 {
00188 const HcalDetId id ;
00189 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00190 Rot(),
00191 id ) ) ;
00192 }
00193 return ali ;
00194 }
00195
00196 ReturnAliErr produceHEAliErr( const HEAlignmentErrorRcd& iRecord )
00197 {
00198 ReturnAliErr aliErr ( new AlignmentErrors );
00199 return aliErr ;
00200 }
00201
00202
00203 ReturnAli produceHOAli( const HOAlignmentRcd& iRecord )
00204 {
00205 ReturnAli ali ( new Alignments ) ;
00206 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00207 const unsigned int nA ( 10 ) ;
00208 vtr.reserve( nA ) ;
00209 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00210 {
00211 const HcalDetId id ;
00212 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00213 Rot(),
00214 id ) ) ;
00215 }
00216 return ali ;
00217 }
00218
00219 ReturnAliErr produceHOAliErr( const HOAlignmentErrorRcd& iRecord )
00220 {
00221 ReturnAliErr aliErr ( new AlignmentErrors );
00222 return aliErr ;
00223 }
00224
00225
00226 ReturnAli produceHFAli( const HFAlignmentRcd& iRecord )
00227 {
00228 ReturnAli ali ( new Alignments ) ;
00229 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00230 const unsigned int nA ( 10 ) ;
00231 vtr.reserve( nA ) ;
00232 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00233 {
00234 const HcalDetId id ;
00235 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00236 Rot(),
00237 id ) ) ;
00238 }
00239 return ali ;
00240 }
00241
00242 ReturnAliErr produceHFAliErr( const HFAlignmentErrorRcd& iRecord )
00243 {
00244 ReturnAliErr aliErr ( new AlignmentErrors );
00245 return aliErr ;
00246 }
00247
00248
00249 ReturnAli produceZDCAli( const ZDCAlignmentRcd& iRecord )
00250 {
00251 ReturnAli ali ( new Alignments ) ;
00252 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00253 const unsigned int nA ( 10 ) ;
00254 vtr.reserve( nA ) ;
00255 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00256 {
00257 const HcalZDCDetId id ;
00258 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00259 Rot(),
00260 id ) ) ;
00261 }
00262 return ali ;
00263 }
00264
00265 ReturnAliErr produceZDCAliErr( const ZDCAlignmentErrorRcd& iRecord )
00266 {
00267 ReturnAliErr aliErr ( new AlignmentErrors );
00268 return aliErr ;
00269 }
00270 };
00271
00272
00273
00274 DEFINE_FWK_EVENTSETUP_MODULE(FakeCaloAlignmentEP);