CMS 3D CMS Logo

BeamSpotFakeConditions.cc

Go to the documentation of this file.
00001 //
00002 
00003 #include <iostream>
00004 #include <fstream>
00005 #include <sstream>
00006 #include <cstring>
00007 #include <string>
00008 #include <vector>
00009 #include <memory>
00010 
00011 #include <boost/shared_ptr.hpp>
00012 
00013 #include <TClass.h>
00014 
00015 #include "FWCore/Utilities/interface/Exception.h"
00016 #include "FWCore/Framework/interface/ESProducer.h"
00017 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00018 #include "FWCore/Framework/interface/MakerMacros.h"
00019 #include "FWCore/Framework/interface/SourceFactory.h"
00020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00021 #include "FWCore/ParameterSet/interface/FileInPath.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023 
00024 #include "CondFormats/DataRecord/interface/BeamSpotObjectsRcd.h"
00025 #include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
00026 
00027 class BeamSpotFakeConditions : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
00028 public:
00029         typedef boost::shared_ptr<BeamSpotObjects> ReturnType;
00030         BeamSpotFakeConditions(const edm::ParameterSet &params);
00031         virtual ~BeamSpotFakeConditions();
00032         ReturnType produce(const BeamSpotObjectsRcd &record);
00033 private:
00034         void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key,const edm::IOVSyncValue &syncValue,edm::ValidityInterval &oValidity);
00035         edm::FileInPath xmlCalibration;
00036         bool usedummy;
00037         std::string BeamType;
00038         
00039 };
00040 
00041 BeamSpotFakeConditions::BeamSpotFakeConditions(const edm::ParameterSet &params) :
00042         
00043         //xmlCalibration(params.getParameter<edm::FileInPath>("xmlCalibration") ), //disable until xml writer is fixed
00044         usedummy(params.getParameter<bool>("UseDummy") ),
00045         BeamType(params.getParameter<std::string>("BeamType") ) {
00046                 
00047                 setWhatProduced(this);
00048                 findingRecord<BeamSpotObjectsRcd>();
00049 }
00050 
00051 BeamSpotFakeConditions::~BeamSpotFakeConditions(){}
00052 
00053 BeamSpotFakeConditions::ReturnType
00054 BeamSpotFakeConditions::produce(const BeamSpotObjectsRcd &record){
00055 
00056 
00057         if ( ! usedummy ) {
00058           //TBufferXML code removed from here...                
00059         }
00060         else {
00061 
00062                 BeamSpotObjects *adummy = new BeamSpotObjects();
00063 
00064                 // we are going to use the truth values defined at the generator stage,
00065                 // see IOMC/EventVertexGenerators/data
00066 
00068                 // FOR THE MOMENT, FAKE CONDITIONS ARE A HARD WIRED COPY OF THE DB CONDITIONS
00070                 
00071                 if ( BeamType == "SimpleGaussian" || BeamType == "DummySigmaZ_5p3cm") {
00072                         adummy->SetPosition(0.,0.,0.);
00073                         adummy->SetSigmaZ(5.3);
00074                         adummy->Setdxdz(0.);
00075                         adummy->Setdydz(0.);
00076                         adummy->SetBeamWidth(15.e-4);
00077                 }
00078 
00079                 else if ( BeamType == "Early10TeVCollision" ) {
00080                         adummy->SetPosition(0.0325127,0.000505765,0.0795808);
00081                         adummy->SetSigmaZ(3.79659);
00082                         adummy->Setdxdz(4.58986e-05);
00083                         adummy->Setdydz(-0.000112271);
00084                         adummy->SetBeamWidth(46.0e-4);
00085                         adummy->SetCovariance(0,0,pow(5.17247e-05,2));
00086                         adummy->SetCovariance(1,1,pow(5.01696e-05,2));
00087                         adummy->SetCovariance(2,2,pow(0.467712,2));
00088                         adummy->SetCovariance(3,3,pow(0.400947,2));
00089                         adummy->SetCovariance(4,4,pow(1.39248e-05,2));
00090                         adummy->SetCovariance(5,5,pow(1.31797e-05,2));
00091                         adummy->SetCovariance(6,6,pow(2.0e-4,2));
00092                 }
00093 
00094                 else if ( BeamType == "EarlyCollision" ) {
00095                         adummy->SetPosition(0.032206,-1.97386e-05,-0.282702);
00096                         adummy->SetSigmaZ(5.3); // temporal
00097                         adummy->Setdxdz(1.76367e-06);
00098                         adummy->Setdydz(-2.58129e-05);
00099                         adummy->SetBeamWidth(31.7e-4);
00100                         adummy->SetCovariance(0,0,pow(6.96e-05,2));
00101                         adummy->SetCovariance(1,1,pow(6.74e-5,2));
00102                         adummy->SetCovariance(2,2,pow(0.70,2));
00103                         adummy->SetCovariance(3,3,pow(0.1,2));// temporal
00104                         adummy->SetCovariance(4,4,pow(9.74e-6,2));
00105                         adummy->SetCovariance(5,5,pow(9.64e-6,2));
00106                         adummy->SetCovariance(6,6,pow(2.0e-4,2));
00107                 }
00108 
00109                 else if ( BeamType == "NominalCollision" ) {
00110                         adummy->SetPosition(0.05,0.,0.);
00111                         adummy->SetSigmaZ(5.3);
00112                         adummy->Setdxdz(140.e-6);
00113                         adummy->Setdydz(0.);
00114                         adummy->SetBeamWidth(16.6e-4);
00115                 }
00116                 // extreme cases
00117                 else if ( BeamType == "NominalCollision1" ) {
00118                         adummy->SetPosition(0.05,0.025,0.);
00119                         adummy->SetSigmaZ(5.3);
00120                         adummy->Setdxdz(0.);
00121                         adummy->Setdydz(0.);
00122                         adummy->SetBeamWidth(16.6e-4);
00123                 }
00124                 
00125                 else if ( BeamType == "NominalCollision2" ) {
00126                         adummy->SetPosition(0.05,0.025,0.);
00127                         adummy->SetSigmaZ(5.3);
00128                         adummy->Setdxdz(140.e-6);
00129                         adummy->Setdydz(0.);
00130                         adummy->SetBeamWidth(16.6e-4);
00131                 }
00132 
00133                 else if ( BeamType == "NominalCollision3" ) {
00134                         adummy->SetPosition(0.1,0.025,0.);
00135                         adummy->SetSigmaZ(5.3);
00136                         adummy->Setdxdz(0.);
00137                         adummy->Setdydz(0.);
00138                         adummy->SetBeamWidth(16.6e-4);
00139                 }
00140 
00141                 else if ( BeamType == "NominalCollision4" ) {
00142                         adummy->SetPosition(0.2,0.025,0.);
00143                         adummy->SetSigmaZ(5.3);
00144                         adummy->Setdxdz(0.);
00145                         adummy->Setdydz(0.);
00146                         adummy->SetBeamWidth(16.6e-4);
00147                 }
00148 
00149                 
00150                 return ReturnType(adummy);
00151         }
00152   
00153         
00154 }
00155 
00156 void BeamSpotFakeConditions::setIntervalFor(const edm::eventsetup::EventSetupRecordKey &key,
00157                                                   const edm::IOVSyncValue &syncValue,
00158                                                   edm::ValidityInterval &oValidity){
00159   oValidity = edm::ValidityInterval(edm::IOVSyncValue::beginOfTime(),
00160                                     edm::IOVSyncValue::endOfTime());
00161 }
00162 
00163 DEFINE_ANOTHER_FWK_EVENTSETUP_SOURCE(BeamSpotFakeConditions);

Generated on Tue Jun 9 17:46:02 2009 for CMSSW by  doxygen 1.5.4