Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:52

0001 #include <vector>
0002 
0003 void PlotGraphs( TH1F* full, TH1F* fast) {
0004 
0005   full->SetMarkerColor(4);                      
0006   full->SetLineColor(4);                          
0007   full->SetLineWidth(2);                          
0008   full->SetLineStyle(3);
0009   //  full->SetMaximum(0.11);
0010   full->Draw();
0011 
0012 
0013   fast->SetMarkerStyle(25);                     
0014   fast->SetMarkerColor(2);                      
0015   fast->SetLineColor(2);                          
0016   fast->SetLineWidth(2);                          
0017   fast->Draw("same");
0018   
0019 }
0020 
0021 void Efficiency(unsigned int iter) {
0022   
0023   gROOT->Reset();
0024   TFile *f = new TFile("testGeneralTracks.root");
0025   if(f->IsZombie() ) return;
0026   f->cd("DQMData"); 
0027 
0028   std::vector<char *> titleFull;
0029   std::vector<char *> titleFast;
0030   std::vector<char *> titleGen;
0031   titleFull.push_back("eff1Full_p_0_1");
0032   titleFull.push_back("eff1Full_p_1_2");
0033   titleFull.push_back("eff1Full_p_2_3");
0034   titleFull.push_back("eff1Full_p_3_4");
0035   titleFull.push_back("eff1Full_p_4_5");
0036   titleFull.push_back("eff1Full_p_5_6");
0037   titleFull.push_back("eff1Full_p_6_7");
0038   titleFull.push_back("eff1Full_p_7_8");
0039   titleFull.push_back("eff1Full_p_8_9");
0040   titleFull.push_back("eff1Full_p_9_10");
0041   titleFast.push_back("eff1Fast_p_0_1");
0042   titleFast.push_back("eff1Fast_p_1_2");
0043   titleFast.push_back("eff1Fast_p_2_3");
0044   titleFast.push_back("eff1Fast_p_3_4");
0045   titleFast.push_back("eff1Fast_p_4_5");
0046   titleFast.push_back("eff1Fast_p_5_6");
0047   titleFast.push_back("eff1Fast_p_6_7");
0048   titleFast.push_back("eff1Fast_p_7_8");
0049   titleFast.push_back("eff1Fast_p_8_9");
0050   titleFast.push_back("eff1Fast_p_9_10");
0051   titleGen.push_back("eff1Gen_p_0_1");
0052   titleGen.push_back("eff1Gen_p_1_2");
0053   titleGen.push_back("eff1Gen_p_2_3");
0054   titleGen.push_back("eff1Gen_p_3_4");
0055   titleGen.push_back("eff1Gen_p_4_5");
0056   titleGen.push_back("eff1Gen_p_5_6");
0057   titleGen.push_back("eff1Gen_p_6_7");
0058   titleGen.push_back("eff1Gen_p_7_8");
0059   titleGen.push_back("eff1Gen_p_8_9");
0060   titleGen.push_back("eff1Gen_p_9_10");
0061 
0062   TCanvas *c = new TCanvas("c","",1000, 600);
0063   c->Divide(3,4);
0064   TH2F* effFull;
0065   TH2F* effFast;
0066   TH2F* genPlot;
0067   genPlot = (TH2F*) gDirectory->Get("genEtaP");
0068   if ( iter == 0 ) { 
0069     effFull = (TH2F*) gDirectory->Get("eff0Full");
0070     effFast = (TH2F*) gDirectory->Get("eff0Fast");
0071   } else if ( iter == 1 ) { 
0072     effFull = (TH2F*) gDirectory->Get("eff1Full");
0073     effFast = (TH2F*) gDirectory->Get("eff1Fast");
0074   } else if ( iter == 2 ) { 
0075     effFull = (TH2F*) gDirectory->Get("eff2Full");
0076     effFast = (TH2F*) gDirectory->Get("eff2Fast");
0077   } else if ( iter == 3 ) { 
0078     effFull = (TH2F*) gDirectory->Get("eff3Full");
0079     effFast = (TH2F*) gDirectory->Get("eff3Fast");
0080   } else if ( iter == 4 ) { 
0081     effFull = (TH2F*) gDirectory->Get("eff4Full");
0082     effFast = (TH2F*) gDirectory->Get("eff4Fast");
0083   } else if ( iter == 5 ) { 
0084     effFull = (TH2F*) gDirectory->Get("eff5Full");
0085     effFast = (TH2F*) gDirectory->Get("eff5Fast");
0086   } else if ( iter == 11 ) { 
0087     effFull = (TH2F*) gDirectory->Get("eff1Full1");
0088     effFast = (TH2F*) gDirectory->Get("eff1Fast1");
0089   } else if ( iter == 12 ) { 
0090     effFull = (TH2F*) gDirectory->Get("eff1Full2");
0091     effFast = (TH2F*) gDirectory->Get("eff1Fast2");
0092   }
0093   for (unsigned imom=1;imom<11;++imom) {  
0094     genPlot->ProjectionX(titleGen[imom-1],10*(imom-1)+1,10*imom+1);
0095     effFull->ProjectionX(titleFull[imom-1],10*(imom-1)+1,10*imom+1);
0096     effFast->ProjectionX(titleFast[imom-1],10*(imom-1)+1,10*imom+1);
0097     TH1F* fast = (TH1F*) gDirectory->Get(titleFast[imom-1]);
0098     TH1F* full = (TH1F*) gDirectory->Get(titleFull[imom-1]);
0099     TH1F* gen = (TH1F*) gDirectory->Get(titleGen[imom-1]);
0100     fast->Divide(gen);
0101     full->Divide(gen);
0102     c->cd(imom);
0103     PlotGraphs(full,fast);
0104   }  
0105 
0106   
0107   TH1F* fast;
0108   TH1F* full;
0109   TH1F* gen;
0110   TH1F* fastp;
0111   TH1F* fullp;
0112   TH1F* genp;
0113   genPlot->ProjectionX();
0114   effFull->ProjectionX();
0115   effFast->ProjectionX();
0116   genPlot->ProjectionY();
0117   effFull->ProjectionY();
0118   effFast->ProjectionY();
0119   if ( iter == 0 ) { 
0120     fast = (TH1F*) gDirectory->Get("eff0Fast_px");
0121     full = (TH1F*) gDirectory->Get("eff0Full_px");
0122     fastp = (TH1F*) gDirectory->Get("eff0Fast_py");
0123     fullp = (TH1F*) gDirectory->Get("eff0Full_py");
0124   }else if ( iter == 1 ) { 
0125     fast = (TH1F*) gDirectory->Get("eff1Fast_px");
0126     full = (TH1F*) gDirectory->Get("eff1Full_px");
0127     fastp = (TH1F*) gDirectory->Get("eff1Fast_py");
0128     fullp = (TH1F*) gDirectory->Get("eff1Full_py");
0129   } else if ( iter == 2 ) { 
0130     fast = (TH1F*) gDirectory->Get("eff2Fast_px");
0131     full = (TH1F*) gDirectory->Get("eff2Full_px");
0132     fastp = (TH1F*) gDirectory->Get("eff2Fast_py");
0133     fullp = (TH1F*) gDirectory->Get("eff2Full_py");
0134   } else if ( iter == 3 ) { 
0135     fast = (TH1F*) gDirectory->Get("eff3Fast_px");
0136     full = (TH1F*) gDirectory->Get("eff3Full_px");
0137     fastp = (TH1F*) gDirectory->Get("eff3Fast_py");
0138     fullp = (TH1F*) gDirectory->Get("eff3Full_py");
0139   } else if ( iter == 4 ) { 
0140     fast = (TH1F*) gDirectory->Get("eff4Fast_px");
0141     full = (TH1F*) gDirectory->Get("eff4Full_px");
0142     fastp = (TH1F*) gDirectory->Get("eff4Fast_py");
0143     fullp = (TH1F*) gDirectory->Get("eff4Full_py");
0144   } else if ( iter == 5 ) { 
0145     fast = (TH1F*) gDirectory->Get("eff5Fast_px");
0146     full = (TH1F*) gDirectory->Get("eff5Full_px");
0147     fastp = (TH1F*) gDirectory->Get("eff5Fast_py");
0148     fullp = (TH1F*) gDirectory->Get("eff5Full_py");
0149   } else if ( iter == 11 ) { 
0150     fast = (TH1F*) gDirectory->Get("eff1Fast1_px");
0151     full = (TH1F*) gDirectory->Get("eff1Full1_px");
0152     fastp = (TH1F*) gDirectory->Get("eff1Fast1_py");
0153     fullp = (TH1F*) gDirectory->Get("eff1Full1_py");
0154   } else if ( iter == 12 ) { 
0155     fast = (TH1F*) gDirectory->Get("eff1Fast2_px");
0156     full = (TH1F*) gDirectory->Get("eff1Full2_px");
0157     fastp = (TH1F*) gDirectory->Get("eff1Fast2_py");
0158     fullp = (TH1F*) gDirectory->Get("eff1Full2_py");
0159   }
0160   gen = (TH1F*) gDirectory->Get("genEtaP_px");
0161   fast->Divide(gen);
0162   full->Divide(gen);
0163   c->cd(11);
0164   PlotGraphs(full,fast);
0165 
0166   genp = (TH1F*) gDirectory->Get("genEtaP_py");
0167   fastp->Divide(genp);
0168   fullp->Divide(genp);
0169   c->cd(12);
0170   PlotGraphs(fullp,fastp);
0171 
0172 }
0173 
0174 void Hits(unsigned int iter) {
0175   
0176   gROOT->Reset();
0177     TFile *f = new TFile("testGeneralTracks.root");
0178     //TFile *f = new TFile("testTrackingIterations_fullstat.root");
0179   if(f->IsZombie() ) return;
0180   f->cd("DQMData"); 
0181 
0182   std::vector<char *> titleFull;
0183   std::vector<char *> titleFast;
0184   titleFull.push_back("HitsFull_p_0_2");
0185   titleFull.push_back("HitsFull_p_2_4");
0186   titleFull.push_back("HitsFull_p_4_6");
0187   titleFull.push_back("HitsFull_p_6_8");
0188   titleFull.push_back("HitsFull_p_8_10");
0189   titleFull.push_back("HitsFull_Eta_0.0_0.5");
0190   titleFull.push_back("HitsFull_Eta_0.5_1.0");
0191   titleFull.push_back("HitsFull_Eta_1.0_1.5");
0192   titleFull.push_back("HitsFull_Eta_1.5_2.0");
0193   titleFull.push_back("HitsFull_Eta_2.0_2.8");
0194   titleFast.push_back("HitsFast_p_0_2");
0195   titleFast.push_back("HitsFast_p_2_4");
0196   titleFast.push_back("HitsFast_p_4_6");
0197   titleFast.push_back("HitsFast_p_6_8");
0198   titleFast.push_back("HitsFast_p_8_10");
0199   titleFast.push_back("HitsFast_Eta_0.0_0.6");
0200   titleFast.push_back("HitsFast_Eta_0.6_1.2");
0201   titleFast.push_back("HitsFast_Eta_1.2_1.8");
0202   titleFast.push_back("HitsFast_Eta_1.8_2.4");
0203   titleFast.push_back("HitsFast_Eta_2.4_3.0");
0204 
0205   TCanvas *c = new TCanvas("c","",1000, 600);
0206   c->Divide(3,4);
0207   TH2F* hitsFullP;
0208   TH2F* hitsFastP;
0209   TH2F* hitsFullEta;
0210   TH2F* hitsFastEta;
0211   if ( iter == 0 ) { 
0212     hitsFullP = (TH2F*) gDirectory->Get("Hits0PFull");
0213     hitsFastP = (TH2F*) gDirectory->Get("Hits0PFast");
0214     hitsFullEta = (TH2F*) gDirectory->Get("Hits0EtaFull");
0215     hitsFastEta = (TH2F*) gDirectory->Get("Hits0EtaFast");
0216   }else if ( iter == 1 ) { 
0217     hitsFullP = (TH2F*) gDirectory->Get("Hits1PFull");
0218     hitsFastP = (TH2F*) gDirectory->Get("Hits1PFast");
0219     hitsFullEta = (TH2F*) gDirectory->Get("Hits1EtaFull");
0220     hitsFastEta = (TH2F*) gDirectory->Get("Hits1EtaFast");
0221   } else if ( iter == 2 ) { 
0222     hitsFullP = (TH2F*) gDirectory->Get("Hits2PFull");
0223     hitsFastP = (TH2F*) gDirectory->Get("Hits2PFast");
0224     hitsFullEta = (TH2F*) gDirectory->Get("Hits2EtaFull");
0225     hitsFastEta = (TH2F*) gDirectory->Get("Hits2EtaFast");
0226   } else if ( iter == 3 ) { 
0227     hitsFullP = (TH2F*) gDirectory->Get("Hits3PFull");
0228     hitsFastP = (TH2F*) gDirectory->Get("Hits3PFast");
0229     hitsFullEta = (TH2F*) gDirectory->Get("Hits3EtaFull");
0230     hitsFastEta = (TH2F*) gDirectory->Get("Hits3EtaFast");
0231   } else if ( iter == 4 ) { 
0232     hitsFullP = (TH2F*) gDirectory->Get("Hits4PFull");
0233     hitsFastP = (TH2F*) gDirectory->Get("Hits4PFast");
0234     hitsFullEta = (TH2F*) gDirectory->Get("Hits4EtaFull");
0235     hitsFastEta = (TH2F*) gDirectory->Get("Hits4EtaFast");
0236   } else if ( iter == 5 ) { 
0237     hitsFullP = (TH2F*) gDirectory->Get("Hits5PFull");
0238     hitsFastP = (TH2F*) gDirectory->Get("Hits5PFast");
0239     hitsFullEta = (TH2F*) gDirectory->Get("Hits5EtaFull");
0240     hitsFastEta = (TH2F*) gDirectory->Get("Hits5EtaFast");
0241   }
0242   for (unsigned imom=1;imom<6;++imom) {  
0243     hitsFullP->ProjectionY(titleFull[imom-1],20*(imom-1)+1,20*imom+1);
0244     hitsFastP->ProjectionY(titleFast[imom-1],20*(imom-1)+1,20*imom+1);
0245     hitsFullEta->ProjectionY(titleFull[10-imom],3*(imom-1),max((unsigned int)28,30-3*(imom-1)));
0246     hitsFastEta->ProjectionY(titleFast[10-imom],3*(imom-1),max((unsigned int)28,30-3*(imom-1)));
0247     hitsFullEta->ProjectionY("cacaFull",3*imom,30-3*imom);
0248     hitsFastEta->ProjectionY("cacaFast",3*imom,30-3*imom);
0249 
0250     TH1F* fastP = (TH1F*) gDirectory->Get(titleFast[imom-1]);
0251     TH1F* fullP = (TH1F*) gDirectory->Get(titleFull[imom-1]);
0252     TH1F* fastEta = (TH1F*) gDirectory->Get(titleFast[10-imom]);
0253     TH1F* fullEta = (TH1F*) gDirectory->Get(titleFull[10-imom]);
0254     TH1F* fastEta2 = (TH1F*) gDirectory->Get("cacaFast");
0255     TH1F* fullEta2 = (TH1F*) gDirectory->Get("cacaFull");
0256     fastEta->Add(fastEta2,-1);
0257     fullEta->Add(fullEta2,-1);
0258     
0259     c->cd(imom);
0260     PlotGraphs(fullP,fastP);
0261     c->cd(12-imom);
0262     PlotGraphs(fullEta,fastEta);
0263   }  
0264   
0265 }
0266 
0267 void Layers(unsigned int iter) {
0268   
0269   gROOT->Reset();
0270     TFile *f = new TFile("testGeneralTracks.root");
0271   //TFile *f = new TFile("testTrackingIterations_fullstat.root");
0272   if(f->IsZombie() ) return;
0273   f->cd("DQMData"); 
0274 
0275   std::vector<char *> titleFull;
0276   std::vector<char *> titleFast;
0277   titleFull.push_back("LayersFull_p_0_2");
0278   titleFull.push_back("LayersFull_p_2_4");
0279   titleFull.push_back("LayersFull_p_4_6");
0280   titleFull.push_back("LayersFull_p_6_8");
0281   titleFull.push_back("LayersFull_p_8_10");
0282   titleFull.push_back("LayersFull_Eta_0.0_0.5");
0283   titleFull.push_back("LayersFull_Eta_0.5_1.0");
0284   titleFull.push_back("LayersFull_Eta_1.0_1.5");
0285   titleFull.push_back("LayersFull_Eta_1.5_2.0");
0286   titleFull.push_back("LayersFull_Eta_2.0_2.8");
0287   titleFast.push_back("LayersFast_p_0_2");
0288   titleFast.push_back("LayersFast_p_2_4");
0289   titleFast.push_back("LayersFast_p_4_6");
0290   titleFast.push_back("LayersFast_p_6_8");
0291   titleFast.push_back("LayersFast_p_8_10");
0292   titleFast.push_back("LayersFast_Eta_0.0_0.6");
0293   titleFast.push_back("LayersFast_Eta_0.6_1.2");
0294   titleFast.push_back("LayersFast_Eta_1.2_1.8");
0295   titleFast.push_back("LayersFast_Eta_1.8_2.4");
0296   titleFast.push_back("LayersFast_Eta_2.4_3.0");
0297 
0298   TCanvas *c = new TCanvas("c","",1000, 600);
0299   c->Divide(3,4);
0300   TH2F* layersFullP;
0301   TH2F* layersFastP;
0302   TH2F* layersFullEta;
0303   TH2F* layersFastEta;
0304   if ( iter == 0 ) { 
0305     layersFullP = (TH2F*) gDirectory->Get("Layers0PFull");
0306     layersFastP = (TH2F*) gDirectory->Get("Layers0PFast");
0307     layersFullEta = (TH2F*) gDirectory->Get("Layers0EtaFull");
0308     layersFastEta = (TH2F*) gDirectory->Get("Layers0EtaFast");
0309   } else if ( iter == 1 ) { 
0310     layersFullP = (TH2F*) gDirectory->Get("Layers1PFull");
0311     layersFastP = (TH2F*) gDirectory->Get("Layers1PFast");
0312     layersFullEta = (TH2F*) gDirectory->Get("Layers1EtaFull");
0313     layersFastEta = (TH2F*) gDirectory->Get("Layers1EtaFast");
0314   } else if ( iter == 2 ) { 
0315     layersFullP = (TH2F*) gDirectory->Get("Layers2PFull");
0316     layersFastP = (TH2F*) gDirectory->Get("Layers2PFast");
0317     layersFullEta = (TH2F*) gDirectory->Get("Layers2EtaFull");
0318     layersFastEta = (TH2F*) gDirectory->Get("Layers2EtaFast");
0319   } else if ( iter == 3 ) { 
0320     layersFullP = (TH2F*) gDirectory->Get("Layers3PFull");
0321     layersFastP = (TH2F*) gDirectory->Get("Layers3PFast");
0322     layersFullEta = (TH2F*) gDirectory->Get("Layers3EtaFull");
0323     layersFastEta = (TH2F*) gDirectory->Get("Layers3EtaFast");
0324   } else if ( iter == 4 ) { 
0325     layersFullP = (TH2F*) gDirectory->Get("Layers4PFull");
0326     layersFastP = (TH2F*) gDirectory->Get("Layers4PFast");
0327     layersFullEta = (TH2F*) gDirectory->Get("Layers4EtaFull");
0328     layersFastEta = (TH2F*) gDirectory->Get("Layers4EtaFast");
0329   } else if ( iter == 5 ) { 
0330     layersFullP = (TH2F*) gDirectory->Get("Layers5PFull");
0331     layersFastP = (TH2F*) gDirectory->Get("Layers5PFast");
0332     layersFullEta = (TH2F*) gDirectory->Get("Layers5EtaFull");
0333     layersFastEta = (TH2F*) gDirectory->Get("Layers5EtaFast");
0334   }
0335   for (unsigned imom=1;imom<6;++imom) {  
0336     layersFullP->ProjectionY(titleFull[imom-1],20*(imom-1)+1,20*imom+1);
0337     layersFastP->ProjectionY(titleFast[imom-1],20*(imom-1)+1,20*imom+1);
0338     layersFullEta->ProjectionY(titleFull[10-imom],3*(imom-1),max((unsigned int)28,30-3*(imom-1)));
0339     layersFastEta->ProjectionY(titleFast[10-imom],3*(imom-1),max((unsigned int)28,30-3*(imom-1)));
0340     layersFullEta->ProjectionY("cacaFull",3*imom,30-3*imom);
0341     layersFastEta->ProjectionY("cacaFast",3*imom,30-3*imom);
0342     TH1F* fastP = (TH1F*) gDirectory->Get(titleFast[imom-1]);
0343     TH1F* fullP = (TH1F*) gDirectory->Get(titleFull[imom-1]);
0344     TH1F* fastEta = (TH1F*) gDirectory->Get(titleFast[10-imom]);
0345     TH1F* fullEta = (TH1F*) gDirectory->Get(titleFull[10-imom]);
0346     TH1F* fastEta2 = (TH1F*) gDirectory->Get("cacaFast");
0347     TH1F* fullEta2 = (TH1F*) gDirectory->Get("cacaFull");
0348     fastEta->Add(fastEta2,-1);
0349     fullEta->Add(fullEta2,-1);
0350     
0351     c->cd(imom);
0352     PlotGraphs(fullP,fastP);
0353     c->cd(12-imom);
0354     PlotGraphs(fullEta,fastEta);
0355   }  
0356   
0357 }
0358 
0359 void totalEfficiency(unsigned int iter) {
0360   
0361   gROOT->Reset();
0362 
0363     TFile *f = new TFile("testGeneralTracks.root");
0364   //TFile *f = new TFile("testTrackingIterations_fullstat.root");
0365   if(f->IsZombie() ) return;
0366   f->cd("DQMData"); 
0367 
0368   TCanvas *c = new TCanvas("c","",1000, 600);
0369   c->Divide(1,2);
0370   TH2F* iter0Fast;
0371   TH2F* iter0Full;
0372   TH2F* genPlot;
0373   genPlot = (TH2F*) gDirectory->Get("genEtaP");
0374   iter0Full = (TH2F*) gDirectory->Get("eff0Full");
0375   iter0Fast = (TH2F*) gDirectory->Get("eff0Fast");
0376 
0377   TH1F* fast0;
0378   TH1F* full0;
0379   TH1F* gen;
0380   TH1F* fastp0;
0381   TH1F* fullp0;
0382   TH1F* genp;
0383   genPlot->ProjectionX();
0384   iter0Full->ProjectionX("iter0Full_px");
0385   iter0Fast->ProjectionX("iter0Fast_px");
0386   genPlot->ProjectionY();
0387   iter0Full->ProjectionY("iter0Full_py");
0388   iter0Fast->ProjectionY("iter0Fast_py");
0389   fast0  = (TH1F*) gDirectory->Get("iter0Fast_px");
0390   full0  = (TH1F*) gDirectory->Get("iter0Full_px");
0391   fastp0 = (TH1F*) gDirectory->Get("iter0Fast_py");
0392   fullp0 = (TH1F*) gDirectory->Get("iter0Full_py");
0393   gen = (TH1F*) gDirectory->Get("genEtaP_px");
0394   genp = (TH1F*) gDirectory->Get("genEtaP_py");
0395 
0396 
0397   fast0->Divide(gen);
0398   full0->Divide(gen);
0399   c->cd(1);
0400   PlotGraphs(full0,fast0);
0401 
0402   fastp0->Divide(genp);
0403   fullp0->Divide(genp);
0404   c->cd(2);
0405   PlotGraphs(fullp0,fastp0);
0406 
0407 }
0408