Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:24

0001 #!/bin/csh
0002 
0003 #This script can be used to generate a web page to compare histograms from 
0004 #two input root files produced using the EDAnalyzers in RecoEgamma/Examples,
0005 #by running one of:
0006 #
0007 #  
0008 #  
0009 #  "Validation/RecoEgamma/test/PhotonValidator_cfg.py
0010 #
0011 # The default list of histograms (configurable) is based on version VXX-XX-XX
0012 # of Validation/RecoEgamma
0013 #
0014 #Two files are created by this script: validation.C and validation.html.
0015 #validation.C should be run inside root to greate a set of gif images
0016 #which can then be viewed in a web browser using validation.html.
0017 
0018 #=============BEGIN CONFIGURATION=================
0019 
0020 #Input root trees for the two cases to be compared 
0021 setenv OLDFILE /data/test/CMSSW_2_2_3/src/DQMOffline/EGamma/test/Summer08Validation_PYTHIA8PhotonJetPt20to25.root
0022 setenv NEWFILE /data/test/CMSSW_2_2_3/src/DQMOffline/EGamma/test/Summer08Validation_PYTHIA8PhotonJetPt20to25_223Reprocessing.root
0023 
0024 
0025 
0026 
0027 setenv OLDRELEASE Summer08
0028 setenv NEWRELEASE Summer08Rreprocessing
0029 #Name of sample (affects output directory name and htmldescription only) 
0030 setenv SAMPLE PYTHIA8PhotonJetPt20to25
0031 #setenv SAMPLE H130GGgluonfusion
0032 #TYPE must be one ofPixelMatchGsfElectron, Photon 
0033 setenv TYPE Photon
0034 
0035 
0036 #==============END BASIC CONFIGURATION==================
0037 
0038 #Location of output.  The default will put your output in:
0039 #http://cmsdoc.cern.ch/Physics/egamma/www/validation/
0040 
0041 setenv CURRENTDIR $PWD
0042 setenv OUTPATH /afs/cern.ch/cms/Physics/egamma/www/validation
0043 cd $OUTPATH
0044 if (! -d $NEWRELEASE) then
0045   mkdir $NEWRELEASE
0046 endif
0047 setenv OUTPATH $OUTPATH/$NEWRELEASE
0048 
0049 setenv OUTDIR $OUTPATH/${SAMPLE}_${NEWRELEASE}_${OLDRELEASE}
0050 if (! -d $OUTDIR) then
0051   cd $OUTPATH
0052   mkdir $OUTDIR
0053   cd $OUTDIR
0054   mkdir gifs
0055 endif
0056 cd $OUTDIR
0057 
0058 #The list of histograms to be compared for each TYPE can be configured below:
0059 
0060 
0061 
0062 
0063 cat > scaledhistosForAllPhotons <<EOF
0064  nPhoAllEcal
0065  phoEAllEcal
0066  phoEtAllEcal
0067  phoEta
0068  phoPhi
0069  r9AllEcal
0070  r9Barrel
0071  r9Endcaps
0072  hOverEAllEcal
0073 
0074 EOF
0075 
0076 
0077 cat > unscaledhistosForAllPhotons <<EOF
0078 
0079  r9VsEt
0080 
0081 EOF
0082 
0083 
0084 cat > scaledhistosForIsolatedPhotons <<EOF
0085  nPhoAllEcal
0086  phoEAllEcal
0087  phoEtAllEcal
0088  phoEta
0089  phoPhi
0090  r9AllEcal
0091  r9Barrel
0092  r9Endcaps
0093  hOverEAllEcal
0094 EOF
0095 
0096 
0097 cat > unscaledhistosForIsolatedPhotons <<EOF
0098 
0099  r9VsEt
0100 
0101 EOF
0102 
0103 cat > eff <<EOF
0104 EfficiencyVsEt
0105 EfficiencyVsEta
0106 EOF
0107 
0108 cat > isolationVariables <<EOF
0109 
0110 
0111 ecalSum
0112 hcalSum
0113 isoPtSumHollow
0114 isoPtSumSolid
0115 nIsoTracksHollow
0116 nIsoTracksSolid
0117 
0118 EOF
0119 
0120 
0121 
0122 
0123 
0124 
0125 #=================END CONFIGURATION=====================
0126 
0127 if (-e validation.C) rm validation.C
0128 touch validation.C
0129 cat > begin.C <<EOF
0130 {
0131 TFile *file_old = TFile::Open("$OLDFILE");
0132 TFile *file_new = TFile::Open("$NEWFILE");
0133 
0134 EOF
0135 cat begin.C >>& validation.C
0136 rm begin.C
0137 
0138 
0139 setenv N 1
0140 foreach i (`cat unscaledhistosForAllPhotons`)
0141   cat > temp$N.C <<EOF
0142 TCanvas *c$i = new TCanvas("c$i");
0143 c$i->SetFillColor(10);
0144 file_old->cd("DQMData/Egamma/PhotonAnalyzer/AllPhotons/Et above 0 GeV");
0145 $i->SetStats(0);
0146 $i->SetMinimum(0.);
0147 $i->SetLineColor(4);
0148 $i->SetLineWidth(3);
0149 $i->Draw();
0150 Double_t nold=$i->GetEntries();
0151 file_new->cd("DQMData/Egamma/PhotonAnalyzer/AllPhotons/Et above 0 GeV");
0152 Double_t nnew=$i->GetEntries();
0153 $i->SetStats(0);
0154 $i->SetLineColor(2);
0155 $i->SetLineWidth(3);
0156 $i->Draw("same");
0157 c$i->SaveAs("gifs/$i.gif");
0158 
0159 EOF
0160   setenv N `expr $N + 1`
0161 end
0162 
0163 
0164 
0165 
0166 foreach i (`cat scaledhistosForAllPhotons`)
0167   cat > temp$N.C <<EOF
0168 TCanvas *c$i = new TCanvas("c$i");
0169 c$i->SetFillColor(10);
0170 file_old->cd("DQMData/Egamma/PhotonAnalyzer/AllPhotons/Et above 0 GeV");
0171 $i->SetStats(0);
0172 $i->SetMinimum(0.);
0173 $i->SetLineColor(4);
0174 $i->SetLineWidth(3);
0175 $i->Draw();
0176 Double_t nold=$i->GetEntries();
0177 file_new->cd("DQMData/Egamma/PhotonAnalyzer/AllPhotons/Et above 0 GeV");
0178 Double_t nnew=$i->GetEntries();
0179 $i->SetStats(0);
0180 $i->SetLineColor(2);
0181 $i->SetLineWidth(3);
0182 $i->Scale(nold/nnew);
0183 $i->Draw("same");
0184 c$i->SaveAs("gifs/$i.gif");
0185 
0186 EOF
0187   setenv N `expr $N + 1`
0188 end
0189 
0190 
0191 
0192 
0193 foreach i (`cat unscaledhistosForIsolatedPhotons`)
0194   cat > temp$N.C <<EOF
0195 TCanvas *c$i = new TCanvas("c$i");
0196 c$i->SetFillColor(10);
0197 file_old->cd("DQMData/Egamma/PhotonAnalyzer/IsolatedPhotons/Et above 0 GeV");
0198 $i->SetStats(0);
0199 $i->SetMinimum(0.);
0200 $i->SetLineColor(4);
0201 $i->SetLineWidth(3);
0202 $i->Draw();
0203 Double_t nold=$i->GetEntries();
0204 file_new->cd("DQMData/Egamma/PhotonAnalyzer/IsolatedPhotons/Et above 0 GeV");
0205 Double_t nnew=$i->GetEntries();
0206 $i->SetStats(0);
0207 $i->SetLineColor(2);
0208 $i->SetLineWidth(3);
0209 $i->Draw("same");
0210 c$i->SaveAs("gifs/${i}_isolated.gif");
0211 
0212 EOF
0213   setenv N `expr $N + 1`
0214 end
0215 
0216 
0217 
0218 
0219 foreach i (`cat scaledhistosForIsolatedPhotons`)
0220   cat > temp$N.C <<EOF
0221 TCanvas *c$i = new TCanvas("c$i");
0222 c$i->SetFillColor(10);
0223 file_old->cd("DQMData/Egamma/PhotonAnalyzer/IsolatedPhotons/Et above 0 GeV");
0224 $i->SetStats(0);
0225 $i->SetMinimum(0.);
0226 $i->SetLineColor(4);
0227 $i->SetLineWidth(3);
0228 $i->Draw();
0229 Double_t nold=$i->GetEntries();
0230 file_new->cd("DQMData/Egamma/PhotonAnalyzer/IsolatedPhotons/Et above 0 GeV");
0231 Double_t nnew=$i->GetEntries();
0232 $i->SetStats(0);
0233 $i->SetLineColor(2);
0234 $i->SetLineWidth(3);
0235 $i->Scale(nold/nnew);
0236 $i->Draw("same");
0237 c$i->SaveAs("gifs/${i}_isolated.gif");
0238 
0239 EOF
0240   setenv N `expr $N + 1`
0241 end
0242 
0243 
0244 
0245 foreach i (`cat eff`)
0246   cat > temp$N.C <<EOF
0247 TCanvas *c$i = new TCanvas("c$i");
0248 c$i->SetFillColor(10);
0249 file_old->cd("DQMData/Egamma/PhotonAnalyzer/IsolationVariables/Et above 0 GeV");
0250 $i->SetStats(0);
0251 $i->SetMinimum(0.);
0252 $i->SetLineColor(4);
0253 $i->SetLineWidth(3);
0254 $i->Draw();
0255 Double_t nold=$i->GetEntries();
0256 file_new->cd("DQMData/Egamma/PhotonAnalyzer/IsolationVariables/Et above 0 GeV");
0257 Double_t nnew=$i->GetEntries();
0258 $i->SetStats(0);
0259 $i->SetLineColor(2);
0260 $i->SetLineWidth(3);
0261 $i->Draw("same");
0262 c$i->SaveAs("gifs/$i.gif");
0263 
0264 EOF
0265   setenv N `expr $N + 1`
0266 end
0267 
0268 
0269 
0270 foreach i (`cat isolationVariables`)
0271   cat > temp$N.C <<EOF
0272 TCanvas *c$i = new TCanvas("c$i");
0273 c$i->SetFillColor(10);
0274 file_old->cd("DQMData/Egamma/PhotonAnalyzer/IsolationVariables/Et above 0 GeV");
0275 $i->SetStats(0);
0276 $i->SetMinimum(0.);
0277 $i->SetMaximum(20.);
0278 $i->SetLineColor(4);
0279 $i->SetLineWidth(3);
0280 $i->Draw();
0281 Double_t nold=$i->GetEntries();
0282 file_new->cd("DQMData/Egamma/PhotonAnalyzer/IsolationVariables/Et above 0 GeV");
0283 Double_t nnew=$i->GetEntries();
0284 $i->SetStats(0);
0285 $i->SetLineColor(2);
0286 $i->SetLineWidth(3);
0287 $i->Draw("same");
0288 c$i->SaveAs("gifs/$i.gif");
0289 
0290 EOF
0291   setenv N `expr $N + 1`
0292 end
0293 
0294 
0295 
0296 
0297 
0298 setenv NTOT `expr $N - 1`
0299 setenv N 1
0300 while ( $N <= $NTOT )
0301   cat temp$N.C >>& validation.C
0302   rm temp$N.C
0303   setenv N `expr $N + 1`
0304 end
0305 
0306 cat > end.C <<EOF
0307 }
0308 EOF
0309 cat end.C >>& validation.C
0310 rm end.C
0311 
0312 
0313 if ( $TYPE == PixelMatchGsfElectron ) then
0314   setenv ANALYZER PixelMatchGsfElectronAnalyzer
0315   setenv CFG read_gsfElectrons
0316 else if ( $TYPE == Photon ) then
0317   setenv ANALYZER PhotonAnalyzer
0318   setenv CFG EgammaDQMOffline_cfg
0319 endif
0320 
0321 if (-e validation.html) rm validation.html
0322 touch validation.html
0323 cat > begin.html <<EOF
0324 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0325 <html>
0326 <head>
0327 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
0328 <title>$NEWRELEASE vs $OLDRELEASE $TYPE validation</title>
0329 </head>
0330 
0331 <h1>$NEWRELEASE vs $OLDRELEASE $TYPE validation</h1>
0332 
0333 <p>The following plots were made using <a href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/DQMOffline/EGgamma/src/$ANALYZER.cc">DQMOffline/EGamma/src/$ANALYZER</a>, 
0334 using <a href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/Validation/RecoEgamma/test/$CFG.py">DQMOffline/EGamma/test/$CFG.py</a>, using $SAMPLE as input.
0335 <p>The script used to make the plots is <a href="validation.C">here</a>.
0336 
0337 <p>In all plots below, $OLDRELEASE is in blue, $NEWRELEASE in red.
0338 
0339 
0340 EOF
0341 cat begin.html >>& validation.html
0342 rm begin.html
0343 
0344 setenv N 1
0345 foreach i (`cat scaledhistosForAllPhotons unscaledhistosForAllPhotons`)
0346   cat > temp$N.html <<EOF
0347 <br>
0348 <p><img class="image" width="500" src="gifs/$i.gif">
0349 EOF
0350   setenv N `expr $N + 1`
0351 end
0352 
0353 
0354 
0355 foreach i (`cat scaledhistosForIsolatedPhotons unscaledhistosForIsolatedPhotons`)
0356   cat > temp$N.html <<EOF
0357 <br>
0358 <p><img class="image" width="500" src="gifs/${i}_isolated.gif">
0359 EOF
0360   setenv N `expr $N + 1`
0361 end
0362 
0363 foreach i (`cat eff isolationVariables`)
0364   cat > temp$N.html <<EOF
0365 <br>
0366 <p><img class="image" width="500" src="gifs/$i.gif">
0367 EOF
0368   setenv N `expr $N + 1`
0369 end
0370 
0371 
0372 
0373 
0374 
0375 setenv N 1
0376 while ( $N <= $NTOT )
0377   cat temp$N.html >>& validation.html
0378   rm temp$N.html
0379   setenv N `expr $N + 1`
0380 end
0381 
0382 cat > end.html <<EOF
0383 
0384 </html>
0385 EOF
0386 cat end.html >>& validation.html
0387 rm end.html
0388 
0389 rm scaledhistosForAllPhotons
0390 rm unscaledhistosForAllPhotons
0391 rm scaledhistosForIsolatedPhotons
0392 rm unscaledhistosForIsolatedPhotons
0393 rm isolationVariables
0394 rm eff
0395 
0396 echo "Now paste the following into your terminal window:"
0397 echo ""
0398 echo "cd $OUTDIR"
0399 echo " root -b"
0400 echo ".x validation.C"
0401 echo ".q"
0402 echo "cd $CURRENTDIR"
0403 echo ""
0404 echo "Then you can view your valdation plots here:"
0405 echo "http://cmsdoc.cern.ch/Physics/egamma/www/validation/${NEWRELEASE}/${SAMPLE}_${NEWRELEASE}_${OLDRELEASE}/validation.html"