CMS 3D CMS Logo

SiStripCalibLorentzAngle Class Reference

#include <CalibTracker/SiStripLorentzAngle/interface/SiStripCalibLorentzAngle.h>

Inheritance diagram for SiStripCalibLorentzAngle:

ConditionDBWriter< SiStripLorentzAngle > edm::EDAnalyzer

List of all members.

Public Member Functions

void algoBeginJob (const edm::EventSetup &)
SiStripLorentzAnglegetNewObject ()
 SiStripCalibLorentzAngle (const edm::ParameterSet &conf)
virtual ~SiStripCalibLorentzAngle ()

Private Types

typedef std::map< unsigned int,
MonitorElement * > 
histomap

Private Attributes

edm::ParameterSet conf_
std::map< uint32_t, float > detid_la
edm::ESHandle< TrackerGeometryestracker
double geta
double gphi
const GlobalPoint gposition
histomap histos
edm::ESHandle< MagneticFieldmagfield_


Detailed Description

Definition at line 27 of file SiStripCalibLorentzAngle.h.


Member Typedef Documentation

typedef std::map<unsigned int, MonitorElement*> SiStripCalibLorentzAngle::histomap [private]

Definition at line 42 of file SiStripCalibLorentzAngle.h.


Constructor & Destructor Documentation

SiStripCalibLorentzAngle::SiStripCalibLorentzAngle ( const edm::ParameterSet conf  )  [explicit]

Definition at line 25 of file SiStripCalibLorentzAngle.cc.

SiStripCalibLorentzAngle::~SiStripCalibLorentzAngle (  )  [virtual]

Definition at line 248 of file SiStripCalibLorentzAngle.cc.

00248                                                     {  
00249 }  


Member Function Documentation

void SiStripCalibLorentzAngle::algoBeginJob ( const edm::EventSetup c  )  [virtual]

Reimplemented from ConditionDBWriter< SiStripLorentzAngle >.

Definition at line 28 of file SiStripCalibLorentzAngle.cc.

References DQMStore::book1D(), DQMStore::bookProfile(), BoundSurface::bounds(), conf_, dbe_, detid_la, lat::endl(), estracker, PV3DBase< T, PVType, FrameType >::eta(), extract(), edm::EventSetup::get(), geta, DQMStore::getAllContents(), SiStripHistoId::getComponentId(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), gphi, gposition, histo, histos, TrackerGeometry::idToDetUnit(), int, TIBDetId::layer(), TOBDetId::layer(), StripTopology::localPitch(), PV3DBase< T, PVType, FrameType >::mag(), magfield_, DQMStore::open(), p, PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), TOBDetId::rod(), DQMStore::save(), DQMStore::setCurrentFolder(), GeomDet::specificSurface(), StripSubdetector::stereo(), TIBDetId::string(), DetId::subdetId(), GeomDet::surface(), Bounds::thickness(), StripSubdetector::TIB, StripSubdetector::TOB, toLocal(), and GeomDetUnit::topology().

00028                                                                  {
00029 
00030   //  edm::ESHandle<TrackerGeometry> estracker;
00031   c.get<TrackerDigiGeometryRecord>().get(estracker);
00032   const TrackerGeometry *tracker=&(*estracker); 
00033   
00034   c.get<IdealMagneticFieldRecord>().get(magfield_);
00035 
00036   edm::ESHandle<SiStripLorentzAngle> SiStripLorentzAngle_;
00037   c.get<SiStripLorentzAngleRcd>().get(SiStripLorentzAngle_);
00038   detid_la= SiStripLorentzAngle_->getLorentzAngles();
00039 
00040   DQMStore* dbe_ = edm::Service<DQMStore>().operator->();
00041   std::string inputFile_ =conf_.getUntrackedParameter<std::string>("fileName", "LorentzAngle.root");
00042   dbe_->open(inputFile_);
00043   // use SistripHistoId for producing histogram id (and title)
00044   SiStripHistoId hidmanager;
00045    
00046   TF1 *fitfunc=0;
00047   double ModuleRangeMin=conf_.getParameter<double>("ModuleFitXMin");
00048   double ModuleRangeMax=conf_.getParameter<double>("ModuleFitXMax");
00049 
00050   fitfunc= new TF1("fitfunc","([4]/[3])*[1]*(TMath::Abs(x-[0]))+[2]",-1,1);
00051 
00052   std::vector<MonitorElement*> histolist= dbe_->getAllContents("/");
00053   std::vector<MonitorElement*>::iterator histo;
00054   LocalPoint p =LocalPoint(0,0,0);
00055   
00056   dbe_->setCurrentFolder("LorentzAngle_Plots");
00057   
00058   MonitorElement * LA_plot=dbe_->book1D("TanLAPerTesla","TanLAPerTesla",2000,-0.5,0.5); 
00059   MonitorElement * LA_err_plot=dbe_->book1D("TanLAPerTesla Error","TanLAPerTesla Error",1000,0,0.2);
00060   MonitorElement * LA_chi2norm_plot=dbe_->book1D("TanLAPerTesla Chi2norm","TanLAPerTesla Chi2norm",2000,0,20);
00061   MonitorElement * LA_phi_plot=dbe_->bookProfile("TanLAPerTesla_vs_Phi","TanLAPerTesla_vs_Phi",200,-3.5,3.5,1000,-0.5,0.5,"");
00062   MonitorElement * LA_eta_plot=dbe_->bookProfile("TanLAPerTesla_vs_Eta","TanLAPerTesla_vs_Eta",200,-2.6,2.6,1000,-0.5,0.5,"");
00063   
00064   MonitorElement * LA_plot_TIB=dbe_->book1D("TanLAPerTesla_TIB","TanLAPerTesla_TIB",2000,-0.5,0.5);
00065   MonitorElement * LA_plot_TIB_1_mono=dbe_->book1D("TanLAPerTesla_TIB_1_MONO","TanLAPerTesla_TIB_1_MONO",2000,-0.5,0.5);
00066   MonitorElement * LA_plot_TIB_1_stereo=dbe_->book1D("TanLAPerTesla_TIB_1_STEREO","TanLAPerTesla_TIB_1_STEREO",2000,-0.5,0.5);
00067   MonitorElement * LA_plot_TIB_2_mono=dbe_->book1D("TanLAPerTesla_TIB_2_MONO","TanLAPerTesla_TIB_2_MONO",2000,-0.5,0.5);
00068   MonitorElement * LA_plot_TIB_2_stereo=dbe_->book1D("TanLAPerTesla_TIB_2_STEREO","TanLAPerTesla_TIB_2_STEREO",2000,-0.5,0.5);
00069   MonitorElement * LA_plot_TIB_3=dbe_->book1D("TanLAPerTesla_TIB_3","TanLAPerTesla_TIB_3",2000,-0.5,0.5);
00070   MonitorElement * LA_plot_TIB_4=dbe_->book1D("TanLAPerTesla_TIB_4","TanLAPerTesla_TIB_4",2000,-0.5,0.5);
00071   
00072   MonitorElement * LA_plot_TOB=dbe_->book1D("TanLAPerTesla_TOB","TanLAPerTesla_TOB",2000,-0.5,0.5);
00073   MonitorElement * LA_plot_TOB_1_mono=dbe_->book1D("TanLAPerTesla_TOB_1_MONO","TanLAPerTesla_TOB_1_MONO",2000,-0.5,0.5);
00074   MonitorElement * LA_plot_TOB_1_stereo=dbe_->book1D("TanLAPerTesla_TOB_1_STEREO","TanLAPerTesla_TOB_1_STEREO",2000,-0.5,0.5);
00075   MonitorElement * LA_plot_TOB_2_mono=dbe_->book1D("TanLAPerTesla_TOB_2_MONO","TanLAPerTesla_TOB_2_MONO",2000,-0.5,0.5);
00076   MonitorElement * LA_plot_TOB_2_stereo=dbe_->book1D("TanLAPerTesla_TOB_2_STEREO","TanLAPerTesla_TOB_2_STEREO",2000,-0.5,0.5);
00077   MonitorElement * LA_plot_TOB_3=dbe_->book1D("TanLAPerTesla_TOB_3","TanLAPerTesla_TOB_3",2000,-0.5,0.5);
00078   MonitorElement * LA_plot_TOB_4=dbe_->book1D("TanLAPerTesla_TOB_4","TanLAPerTesla_TOB_4",2000,-0.5,0.5);
00079   MonitorElement * LA_plot_TOB_5=dbe_->book1D("TanLAPerTesla_TOB_5","TanLAPerTesla_TOB_5",2000,-0.5,0.5);
00080   MonitorElement * LA_plot_TOB_6=dbe_->book1D("TanLAPerTesla_TOB_6","TanLAPerTesla_TOB_6",2000,-0.5,0.5);
00081   
00082   
00083   histos[1] = LA_plot;
00084   histos[2] = LA_err_plot;
00085   histos[3] = LA_chi2norm_plot;
00086   histos[4] = LA_phi_plot;
00087   histos[5] = LA_eta_plot;
00088   
00089   histos[6] = LA_plot_TIB;
00090   histos[7] = LA_plot_TIB_1_mono;
00091   histos[8] = LA_plot_TIB_1_stereo;
00092   histos[9] = LA_plot_TIB_2_mono;
00093   histos[10] = LA_plot_TIB_2_stereo;
00094   histos[11] = LA_plot_TIB_3;
00095   histos[12] = LA_plot_TIB_4;
00096     
00097   histos[13] = LA_plot_TOB;
00098   histos[14] = LA_plot_TOB_1_mono;
00099   histos[15] = LA_plot_TOB_1_stereo;
00100   histos[16] = LA_plot_TOB_2_mono;
00101   histos[17] = LA_plot_TOB_2_stereo;
00102   histos[18] = LA_plot_TOB_3;
00103   histos[19] = LA_plot_TOB_4;
00104   histos[20] = LA_plot_TOB_5;
00105   histos[21] = LA_plot_TOB_6;
00106   
00107   gphi=-99;
00108   geta=-99;
00109   
00110   int fitcounter = 0;
00111   int histocounter = 0;
00112   int badfit = 0;
00113   int no_mod_histo = 0;
00114   int Layer = 0;
00115   
00116   ofstream LA_neg;
00117   LA_neg.open("Negative_LA.txt");
00118   
00119   for(histo=histolist.begin();histo!=histolist.end();++histo){
00120   
00121   if((*histo)->getEntries()==0){
00122   uint32_t id0=hidmanager.getComponentId((*histo)->getName());
00123   DetId detid0(id0);
00124   StripSubdetector subid0(id0);
00125   edm::LogInfo("SiStripCalibLorentzAngle")<<"### HISTOGRAM WITH 0 ENTRIES => TYPE:"<<subid0.subdetId();}
00126   
00127     if((*histo)->getEntries()>100){
00128       histocounter++;
00129       
00130       uint32_t id=hidmanager.getComponentId((*histo)->getName());
00131       DetId detid(id);
00132       StripSubdetector subid(id);
00133       
00134       const GeomDetUnit * stripdet;
00135       if(!(stripdet=tracker->idToDetUnit(subid))){
00136       no_mod_histo++;
00137       edm::LogInfo("SiStripCalibLorentzAngle")<<"### NO MODULE HISTOGRAM";}
00138       
00139       if(subid.subdetId() == int (StripSubdetector::TIB)){
00140       TIBDetId TIBid=TIBDetId(subid);
00141       Layer = TIBid.layer();
00142       edm::LogInfo("SiStripCalibLorentzAngle")<<"TIB layer = "<<Layer;}
00143       
00144       if(subid.subdetId() == int (StripSubdetector::TOB)){
00145       TOBDetId TOBid=TIBDetId(subid);
00146       Layer = TOBid.layer();
00147       edm::LogInfo("SiStripCalibLorentzAngle")<<"TOB layer = "<<Layer;}
00148       
00149       edm::LogInfo("SiStripCalibLorentzAngle")<<"id: "<<id;    
00150             
00151       if(stripdet!=0){
00152       const GlobalPoint gposition = (stripdet->surface()).toGlobal(p);
00153       gphi = gposition.phi();
00154       geta = gposition.eta();}
00155       if(stripdet==0)continue;
00156             
00157       float thickness=stripdet->specificSurface().bounds().thickness();
00158       const StripTopology& topol=(StripTopology&)stripdet->topology();
00159       float pitch = topol.localPitch(p);
00160       
00161       TProfile* theProfile=ExtractTObject<TProfile>().extract(*histo);
00162       
00163       fitfunc->SetParameter(0, 0);
00164       fitfunc->SetParameter(1, 0);
00165       fitfunc->SetParameter(2, 1);
00166       fitfunc->FixParameter(3, pitch);
00167       fitfunc->FixParameter(4, thickness);
00168       int fitresult=theProfile->Fit(fitfunc,"N","",ModuleRangeMin, ModuleRangeMax);
00169       
00170       if(fitfunc->GetParameter(0)>0){
00171       LA_neg<<"Type = "<<subid.subdetId()<<" Layer = "<<Layer;
00172       if(subid.subdetId() == int (StripSubdetector::TIB)){
00173       TIBDetId TIBid=TIBDetId(subid);
00174       if(TIBid.string()[0]==1){LA_neg<<" Backward, ";}else{LA_neg<<" Forward, ";}
00175       if(TIBid.string()[1]==1){LA_neg<<" Int String, ";}else{LA_neg<<" Ext String, ";}
00176       LA_neg<<" Nr. String = "<<TIBid.string()[2];}
00177       if(subid.subdetId() == int (StripSubdetector::TOB)){
00178       TOBDetId TOBid=TOBDetId(subid);
00179       if(TOBid.rod()[0]==1){LA_neg<<" Backward, ";}else{LA_neg<<" Forward, ";}
00180       LA_neg<<" Nr. Rod = "<<TOBid.rod()[1];}    
00181       LA_neg<<" MonoStereo = "<<subid.stereo()<<" Id = "<<id<<" => Fit_Par0 = "<<fitfunc->GetParameter(0)<<" Fit_Par1 = "<<fitfunc->GetParameter(1)<<" Fit_Par2 = "<<fitfunc->GetParameter(2)<<" Chi2/NDF = "<<fitfunc->GetChisquare()/fitfunc->GetNDF()<<std::endl<<std::endl;
00182       }      
00183                 
00184       
00185       if(fitfunc->GetParameter(0)<0&&fitfunc->GetParameter(1)>0&&fitfunc->GetParameter(2)>0){
00186         edm::LogInfo("SiStripCalibLorentzAngle")<<fitfunc->GetParameter(0);
00187         fitcounter++;
00188         
00189         // get magnetic field
00190         const StripGeomDetUnit* det = dynamic_cast<const StripGeomDetUnit*>(estracker->idToDetUnit(detid));
00191         if (det==0){
00192           edm::LogError("SiStripCalibLorentzAngle") << "[SiStripCalibLorentzAngle::getNewObject] the detID " << id << " doesn't seem to belong to Tracker" << std::endl;        
00193           continue;
00194         }
00195         LocalVector lbfield=(det->surface()).toLocal(magfield_->inTesla(det->surface().position()));
00196         float theBfield = lbfield.mag();
00197         theBfield = (theBfield > 0) ? theBfield : 0.00001; 
00198         
00199         float muH = -(fitfunc->GetParameter(0))/theBfield; 
00200 
00201         detid_la[id]= muH;
00202         
00203         histos[1]->Fill(muH);
00204         histos[2]->Fill(fitfunc->GetParError(0)/theBfield);
00205         histos[3]->Fill(fitfunc->GetChisquare()/fitfunc->GetNDF());
00206         histos[4]->Fill(gphi,muH);
00207         histos[5]->Fill(geta,muH);
00208         
00209         if(subid.subdetId() == int (StripSubdetector::TIB)){
00210         histos[6]->Fill(muH);
00211         if((Layer==1)&&(subid.stereo()==0))histos[7]->Fill(muH);
00212         if((Layer==1)&&(subid.stereo()==1))histos[8]->Fill(muH);
00213         if((Layer==2)&&(subid.stereo()==0))histos[9]->Fill(muH);
00214         if((Layer==2)&&(subid.stereo()==1))histos[10]->Fill(muH);
00215         if(Layer==3)histos[11]->Fill(muH);
00216         if(Layer==4)histos[12]->Fill(muH);      
00217         }
00218         
00219         if(subid.subdetId() == int (StripSubdetector::TOB)){
00220         histos[13]->Fill(muH);
00221         if((Layer==1)&&(subid.stereo()==0))histos[14]->Fill(muH);
00222         if((Layer==1)&&(subid.stereo()==1))histos[15]->Fill(muH);
00223         if((Layer==2)&&(subid.stereo()==0))histos[16]->Fill(muH);
00224         if((Layer==2)&&(subid.stereo()==1))histos[17]->Fill(muH);
00225         if(Layer==3)histos[18]->Fill(muH);
00226         if(Layer==4)histos[19]->Fill(muH);
00227         if(Layer==5)histos[20]->Fill(muH);
00228         if(Layer==6)histos[21]->Fill(muH);
00229         }
00230         
00231        }else{
00232        badfit++;}
00233     } 
00234   }
00235   
00236   edm::LogInfo("SiStripCalibLorentzAngle")<<"### NR.OF TIB AND TOB MODULES = 7932";
00237   edm::LogInfo("SiStripCalibLorentzAngle")<<"### NR.OF HISTOS WITH ENTRIES > 100 = "<<histocounter;
00238   edm::LogInfo("SiStripCalibLorentzAngle")<<"### NO MODULE HISTOS = "<<no_mod_histo;
00239   edm::LogInfo("SiStripCalibLorentzAngle")<<"### NR.OF GOOD FIT = "<<fitcounter;
00240   edm::LogInfo("SiStripCalibLorentzAngle")<<"### NR.OF BAD FIT = "<<badfit;
00241     
00242   LA_neg.close();  
00243     
00244   dbe_->save("LA_plots.root","LorentzAngle_Plots");
00245 }

SiStripLorentzAngle * SiStripCalibLorentzAngle::getNewObject (  )  [virtual]

Implements ConditionDBWriter< SiStripLorentzAngle >.

Definition at line 254 of file SiStripCalibLorentzAngle.cc.

References detid_la, lat::endl(), it, and SiStripLorentzAngle::putLorentzAngle().

00254                                                            {
00255 
00256   SiStripLorentzAngle* LorentzAngle = new SiStripLorentzAngle();
00257   
00258   for(std::map<uint32_t, float>::iterator it = detid_la.begin(); it != detid_la.end(); it++){
00259     
00260     float langle=it->second;
00261     if ( ! LorentzAngle->putLorentzAngle(it->first,langle) )
00262       edm::LogError("SiStripCalibLorentzAngle")<<"[SiStripCalibLorentzAngle::analyze] detid already exists"<<std::endl;
00263   }
00264   
00265   return LorentzAngle;
00266 }


Member Data Documentation

edm::ParameterSet SiStripCalibLorentzAngle::conf_ [private]

Definition at line 48 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob().

std::map< uint32_t, float> SiStripCalibLorentzAngle::detid_la [private]

Definition at line 47 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob(), and getNewObject().

edm::ESHandle<TrackerGeometry> SiStripCalibLorentzAngle::estracker [private]

Definition at line 40 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob().

double SiStripCalibLorentzAngle::geta [private]

Definition at line 44 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob().

double SiStripCalibLorentzAngle::gphi [private]

Definition at line 44 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob().

const GlobalPoint SiStripCalibLorentzAngle::gposition [private]

Definition at line 45 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob().

histomap SiStripCalibLorentzAngle::histos [private]

Definition at line 43 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob().

edm::ESHandle<MagneticField> SiStripCalibLorentzAngle::magfield_ [private]

Definition at line 41 of file SiStripCalibLorentzAngle.h.

Referenced by algoBeginJob().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:13 2009 for CMSSW by  doxygen 1.5.4