00001 #include <memory>
00002 #include <string>
00003 #include <iostream>
00004 #include <fstream>
00005 #include "CalibTracker/SiStripLorentzAngle/interface/SiStripRandomLorentzAngle.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00008 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00009 #include "CLHEP/Random/RandGauss.h"
00010 using namespace std;
00011
00012
00013
00014 SiStripRandomLorentzAngle::SiStripRandomLorentzAngle(edm::ParameterSet const& conf) : ConditionDBWriter<SiStripLorentzAngle>(conf) , conf_(conf){}
00015
00016
00017 void SiStripRandomLorentzAngle::algoBeginJob(const edm::EventSetup& c){
00018
00019 appliedVoltage_ = conf_.getParameter<double>("AppliedVoltage");
00020 chargeMobility_ = conf_.getParameter<double>("ChargeMobility");
00021 temperature_ = conf_.getParameter<double>("Temperature");
00022 temperatureerror_ = conf_.getParameter<double>("TemperatureError");
00023 rhall_ = conf_.getParameter<double>("HoleRHAllParameter");
00024 holeBeta_ = conf_.getParameter<double>("HoleBeta");
00025 holeSaturationVelocity_ = conf_.getParameter<double>("HoleSaturationVelocity");
00026
00027
00028 edm::ESHandle<TrackerGeometry> pDD;
00029 c.get<TrackerDigiGeometryRecord>().get( pDD );
00030 edm::LogInfo("SiStripLorentzAngle") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
00031
00032 for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
00033
00034 if( dynamic_cast<StripGeomDetUnit*>((*it))!=0){
00035 uint32_t detid=((*it)->geographicalId()).rawId();
00036
00037 double thickness=(*it)->specificSurface().bounds().thickness();
00038 float temperaturernd;
00039 if(temperatureerror_>0)temperaturernd=RandGauss::shoot(temperature_,temperatureerror_);
00040 else temperaturernd=temperature_;
00041 float mulow = chargeMobility_*pow((temperaturernd/300.),-2.5);
00042 float vsat = holeSaturationVelocity_*pow((temperaturernd/300.),0.52);
00043 float beta = holeBeta_*pow((temperaturernd/300.),0.17);
00044 float e = appliedVoltage_/thickness;
00045 float mu = ( mulow/(pow(double((1+pow((mulow*e/vsat),beta))),1./beta)));
00046 float hallMobility = 1.E-4*mu*rhall_;
00047
00048 detid_la.push_back( pair<uint32_t,float>(detid,hallMobility) );
00049 }
00050 }
00051
00052 }
00053
00054
00055 SiStripRandomLorentzAngle::~SiStripRandomLorentzAngle() {
00056 }
00057
00058
00059
00060
00061 SiStripLorentzAngle* SiStripRandomLorentzAngle::getNewObject(){
00062
00063 SiStripLorentzAngle* LorentzAngle = new SiStripLorentzAngle();
00064
00065 for(std::vector<std::pair<uint32_t, float> >::iterator it = detid_la.begin(); it != detid_la.end(); it++){
00066
00067 float langle=it->second;
00068 if ( ! LorentzAngle->putLorentzAngle(it->first,langle) )
00069 edm::LogError("SiStripRandomLorentzAngle")<<"[SiStripRandomLorentzAngle::analyze] detid already exists"<<std::endl;
00070 }
00071
00072 return LorentzAngle;
00073 }