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 "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
00036 #include "Geometry/ForwardGeometry/interface/ZdcGeometry.h"
00037 #include "Geometry/ForwardGeometry/interface/CastorGeometry.h"
00038 #include "DataFormats/EcalDetId/interface/ESDetId.h"
00039 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00040 #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"
00041 #include "CondFormats/AlignmentRecord/interface/EBAlignmentRcd.h"
00042 #include "CondFormats/AlignmentRecord/interface/EBAlignmentErrorRcd.h"
00043 #include "CondFormats/AlignmentRecord/interface/EEAlignmentRcd.h"
00044 #include "CondFormats/AlignmentRecord/interface/EEAlignmentErrorRcd.h"
00045 #include "CondFormats/AlignmentRecord/interface/ESAlignmentRcd.h"
00046 #include "CondFormats/AlignmentRecord/interface/ESAlignmentErrorRcd.h"
00047 #include "CondFormats/AlignmentRecord/interface/HBAlignmentRcd.h"
00048 #include "CondFormats/AlignmentRecord/interface/HBAlignmentErrorRcd.h"
00049 #include "CondFormats/AlignmentRecord/interface/HEAlignmentRcd.h"
00050 #include "CondFormats/AlignmentRecord/interface/HEAlignmentErrorRcd.h"
00051 #include "CondFormats/AlignmentRecord/interface/HOAlignmentRcd.h"
00052 #include "CondFormats/AlignmentRecord/interface/HOAlignmentErrorRcd.h"
00053 #include "CondFormats/AlignmentRecord/interface/HFAlignmentRcd.h"
00054 #include "CondFormats/AlignmentRecord/interface/HFAlignmentErrorRcd.h"
00055 #include "CondFormats/AlignmentRecord/interface/ZDCAlignmentRcd.h"
00056 #include "CondFormats/AlignmentRecord/interface/ZDCAlignmentErrorRcd.h"
00057 #include "CondFormats/AlignmentRecord/interface/CastorAlignmentRcd.h"
00058 #include "CondFormats/AlignmentRecord/interface/CastorAlignmentErrorRcd.h"
00059
00060 class FakeCaloAlignmentEP : public edm::ESProducer
00061 {
00062 public:
00063
00064 typedef boost::shared_ptr<Alignments> ReturnAli ;
00065 typedef boost::shared_ptr<AlignmentErrors> ReturnAliErr ;
00066
00067 typedef AlignTransform::Translation Trl ;
00068 typedef AlignTransform::Rotation Rot ;
00069
00070 FakeCaloAlignmentEP(const edm::ParameterSet&)
00071 {
00072 setWhatProduced( this, &FakeCaloAlignmentEP::produceEBAli ) ;
00073 setWhatProduced( this, &FakeCaloAlignmentEP::produceEBAliErr ) ;
00074 setWhatProduced( this, &FakeCaloAlignmentEP::produceEEAli ) ;
00075 setWhatProduced( this, &FakeCaloAlignmentEP::produceEEAliErr ) ;
00076 setWhatProduced( this, &FakeCaloAlignmentEP::produceESAli ) ;
00077 setWhatProduced( this, &FakeCaloAlignmentEP::produceESAliErr ) ;
00078 setWhatProduced( this, &FakeCaloAlignmentEP::produceHBAli ) ;
00079 setWhatProduced( this, &FakeCaloAlignmentEP::produceHBAliErr ) ;
00080 setWhatProduced( this, &FakeCaloAlignmentEP::produceHEAli ) ;
00081 setWhatProduced( this, &FakeCaloAlignmentEP::produceHEAliErr ) ;
00082 setWhatProduced( this, &FakeCaloAlignmentEP::produceHOAli ) ;
00083 setWhatProduced( this, &FakeCaloAlignmentEP::produceHOAliErr ) ;
00084 setWhatProduced( this, &FakeCaloAlignmentEP::produceHFAli ) ;
00085 setWhatProduced( this, &FakeCaloAlignmentEP::produceHFAliErr ) ;
00086 setWhatProduced( this, &FakeCaloAlignmentEP::produceZdcAli ) ;
00087 setWhatProduced( this, &FakeCaloAlignmentEP::produceZdcAliErr ) ;
00088 setWhatProduced( this, &FakeCaloAlignmentEP::produceCastorAli ) ;
00089 setWhatProduced( this, &FakeCaloAlignmentEP::produceCastorAliErr ) ;
00090 }
00091
00092 ~FakeCaloAlignmentEP() {}
00093
00094
00095
00096 ReturnAli produceEBAli( const EBAlignmentRcd& )
00097 {
00098 ReturnAli ali ( new Alignments ) ;
00099 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00100 const unsigned int nA ( EcalBarrelGeometry::numberOfAlignments() ) ;
00101 vtr.reserve( nA ) ;
00102 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00103 {
00104 const EBDetId id ( EcalBarrelGeometry::detIdFromLocalAlignmentIndex( i ) ) ;
00105 vtr.push_back( AlignTransform( ( 1==id.ism() ? Trl( 0, 0, 0 ) :
00106 Trl(0,0,0) ) ,
00107 Rot(),
00108 id ) ) ;
00109 }
00110 return ali ;
00111 }
00112
00113 ReturnAliErr produceEBAliErr( const EBAlignmentErrorRcd& )
00114 {
00115 ReturnAliErr aliErr ( new AlignmentErrors );
00116 return aliErr ;
00117 }
00118
00119
00120 ReturnAli produceEEAli( const EEAlignmentRcd& )
00121 {
00122 ReturnAli ali ( new Alignments ) ;
00123 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00124 const unsigned int nA ( EcalEndcapGeometry::numberOfAlignments() ) ;
00125 vtr.reserve( nA ) ;
00126 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00127 {
00128 const EEDetId id ( EcalEndcapGeometry::detIdFromLocalAlignmentIndex( i ) ) ;
00129 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00130 Rot(),
00131 id ) ) ;
00132 }
00133 return ali ;
00134 }
00135
00136 ReturnAliErr produceEEAliErr( const EEAlignmentErrorRcd& )
00137 {
00138 ReturnAliErr aliErr ( new AlignmentErrors );
00139 return aliErr ;
00140 }
00141
00142
00143 ReturnAli produceESAli( const ESAlignmentRcd& )
00144 {
00145 ReturnAli ali ( new Alignments ) ;
00146 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00147 const unsigned int nA ( EcalPreshowerGeometry::numberOfAlignments() ) ;
00148 vtr.reserve( nA ) ;
00149 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00150 {
00151 const ESDetId id ( EcalPreshowerGeometry::detIdFromLocalAlignmentIndex( i ) ) ;
00152 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00153 Rot(),
00154 id ) ) ;
00155 }
00156 return ali ;
00157 }
00158
00159 ReturnAliErr produceESAliErr( const ESAlignmentErrorRcd& )
00160 {
00161 ReturnAliErr aliErr ( new AlignmentErrors );
00162 return aliErr ;
00163 }
00164
00165
00166 ReturnAli produceHBAli( const HBAlignmentRcd& )
00167 {
00168 ReturnAli ali ( new Alignments ) ;
00169 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00170 const unsigned int nA ( HcalGeometry::numberOfBarrelAlignments() ) ;
00171 vtr.reserve( nA ) ;
00172 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00173 {
00174 const HcalDetId id ( HcalBarrel, 1, 1, 1 ) ;
00175 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00176 Rot(),
00177 id ) ) ;
00178 }
00179 return ali ;
00180 }
00181
00182 ReturnAliErr produceHBAliErr( const HBAlignmentErrorRcd& )
00183 {
00184 ReturnAliErr aliErr ( new AlignmentErrors );
00185 return aliErr ;
00186 }
00187
00188
00189 ReturnAli produceHEAli( const HEAlignmentRcd& )
00190 {
00191 ReturnAli ali ( new Alignments ) ;
00192 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00193 const unsigned int nA ( HcalGeometry::numberOfEndcapAlignments() ) ;
00194 vtr.reserve( nA ) ;
00195 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00196 {
00197 const HcalDetId id ( HcalEndcap, 21, 1, 1 ) ;
00198 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00199 Rot(),
00200 id ) ) ;
00201 }
00202 return ali ;
00203 }
00204
00205 ReturnAliErr produceHEAliErr( const HEAlignmentErrorRcd& )
00206 {
00207 ReturnAliErr aliErr ( new AlignmentErrors );
00208 return aliErr ;
00209 }
00210
00211
00212 ReturnAli produceHOAli( const HOAlignmentRcd& )
00213 {
00214 ReturnAli ali ( new Alignments ) ;
00215 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00216 const unsigned int nA ( HcalGeometry::numberOfOuterAlignments() ) ;
00217 vtr.reserve( nA ) ;
00218 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00219 {
00220 const HcalDetId id ( HcalOuter, 1, 1, 4 ) ;
00221 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00222 Rot(),
00223 id ) ) ;
00224 }
00225 return ali ;
00226 }
00227
00228 ReturnAliErr produceHOAliErr( const HOAlignmentErrorRcd& )
00229 {
00230 ReturnAliErr aliErr ( new AlignmentErrors );
00231 return aliErr ;
00232 }
00233
00234
00235 ReturnAli produceHFAli( const HFAlignmentRcd& )
00236 {
00237 ReturnAli ali ( new Alignments ) ;
00238 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00239 const unsigned int nA ( HcalGeometry::numberOfForwardAlignments() ) ;
00240 vtr.reserve( nA ) ;
00241 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00242 {
00243 const HcalDetId id ( HcalForward, 29, 1, 1 ) ;
00244 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00245 Rot(),
00246 id ) ) ;
00247 }
00248 return ali ;
00249 }
00250
00251 ReturnAliErr produceHFAliErr( const HFAlignmentErrorRcd& )
00252 {
00253 ReturnAliErr aliErr ( new AlignmentErrors );
00254 return aliErr ;
00255 }
00256
00257
00258 ReturnAli produceZdcAli( const ZDCAlignmentRcd& )
00259 {
00260 ReturnAli ali ( new Alignments ) ;
00261 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00262 const unsigned int nA ( ZdcGeometry::numberOfAlignments() ) ;
00263 vtr.reserve( nA ) ;
00264 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00265 {
00266 const HcalZDCDetId id ( HcalZDCDetId::EM, false, 1 ) ;
00267 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00268 Rot(),
00269 id ) ) ;
00270 }
00271 return ali ;
00272 }
00273
00274 ReturnAliErr produceZdcAliErr( const ZDCAlignmentErrorRcd& )
00275 {
00276 ReturnAliErr aliErr ( new AlignmentErrors );
00277 return aliErr ;
00278 }
00279
00280
00281 ReturnAli produceCastorAli( const CastorAlignmentRcd& )
00282 {
00283 ReturnAli ali ( new Alignments ) ;
00284 std::vector<AlignTransform>& vtr ( ali->m_align ) ;
00285 const unsigned int nA ( CastorGeometry::numberOfAlignments() ) ;
00286 vtr.reserve( nA ) ;
00287 for( unsigned int i ( 0 ) ; i != nA ; ++i )
00288 {
00289 const HcalCastorDetId id ( HcalCastorDetId::EM, false, 1, 1 ) ;
00290 vtr.push_back( AlignTransform( Trl( 0, 0, 0 ),
00291 Rot(),
00292 id ) ) ;
00293 }
00294 return ali ;
00295 }
00296
00297 ReturnAliErr produceCastorAliErr( const CastorAlignmentErrorRcd& )
00298 {
00299 ReturnAliErr aliErr ( new AlignmentErrors );
00300 return aliErr ;
00301 }
00302 };
00303
00304
00305
00306 DEFINE_FWK_EVENTSETUP_MODULE(FakeCaloAlignmentEP);