Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:39

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 setenv TYPE AllConversions
0020 setenv RUNTYPE Central
0021 setenv STARTUP True
0022 setenv UPGRADE False
0023 
0024 setenv CMSSWver1 7_0_0
0025 setenv CMSSWver2 7_0_0
0026 setenv OLDRELEASE 7_0_0
0027 setenv NEWRELEASE 7_0_0
0028 setenv OLDPRERELEASE pre6
0029 setenv NEWPRERELEASE pre8
0030 setenv UPGRADEVER  UPG2017
0031 setenv LHCENERGY   14
0032 
0033 
0034 
0035 if ( $STARTUP == True) then
0036 setenv OLDGLOBALTAG PU_PRE_ST62_V8-v1
0037 setenv NEWGLOBALTAG PU_START70_V2_amend-v4
0038 else 
0039 setenv OLDGLOBALTAG START50_V8-v3
0040 setenv NEWGLOBALTAG START50_V8-v3
0041 endif
0042 
0043 
0044 
0045 
0046 setenv OLDRELEASE ${OLDRELEASE}_${OLDPRERELEASE}
0047 #setenv OLDRELEASE ${OLDRELEASE}
0048 setenv NEWRELEASE ${NEWRELEASE}_${NEWPRERELEASE}
0049 #setenv NEWRELEASE ${NEWRELEASE}
0050 
0051 #setenv WorkDir1   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver1}/src/Validation/RecoEgamma/test
0052 #setenv WorkDir2   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver2}_${NEWPRERELEASE}/src/Validation/RecoEgamma/test
0053 
0054 #setenv WorkDir1   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver1}_${OLDPRERELEASE}/src/Validation/RecoEgamma/test
0055 #setenv WorkDir2   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver2}/src/Validation/RecoEgamma/test
0056 
0057 setenv WorkDir1   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver1}_${OLDPRERELEASE}/src/Validation/RecoEgamma/test
0058 setenv WorkDir2   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver2}_${NEWPRERELEASE}/src/Validation/RecoEgamma/test
0059 
0060 
0061 #setenv WorkDir1   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver1}/src/Validation/RecoEgamma/test
0062 #setenv WorkDir2   /afs/cern.ch/user/n/nancy/scratch0/CMSSW/test/CMSSW_${CMSSWver2}/src/Validation/RecoEgamma/test
0063 
0064 
0065 #Name of sample (affects output directory name and htmlde
0066 
0067 
0068 setenv PU True
0069 #setenv SAMPLE SingleGammaPt10
0070 #setenv SAMPLE SingleGammaPt35
0071 #setenv SAMPLE QCD_Pt_80_120
0072 #setenv SAMPLE QCD_Pt_20_30
0073 setenv SAMPLE H130GGgluonfusion
0074 
0075 if ( $RUNTYPE == Central ) then
0076 setenv HISTOPATHNAME_Efficiencies DQMData/Run\ 1/EgammaV/Run\ summary/ConversionValidator/EfficienciesAndFakeRate
0077 setenv HISTOPATHNAME_tkConversions DQMData/Run\ 1/EgammaV/Run\ summary/ConversionValidator/ConversionInfo
0078 endif
0079 
0080 if ( $RUNTYPE == Local ) then
0081 setenv HISTOPATHNAME_Efficiencies DQMData/EgammaV/ConversionValidator/EfficienciesAndFakeRate
0082 setenv HISTOPATHNAME_tkConversions DQMData/EgammaV/ConversionValidator/ConversionInfo
0083 endif
0084 
0085 #==============END BASIC CONFIGURATION==================
0086 #Input root trees for the two cases to be compared 
0087 
0088 if ($SAMPLE == SingleGammaPt10) then
0089 
0090 if ( $RUNTYPE == Local ) then
0091 setenv OLDFILE ${WorkDir1}/PhotonValidationRelVal${OLDRELEASE}_SingleGammaPt10.root
0092 setenv NEWFILE ${WorkDir2}/PhotonValidationRelVal${NEWRELEASE}_SingleGammaPt10.root
0093 else if ( $RUNTYPE == Central ) then
0094 setenv OLDFILE ${WorkDir1}/DQM_V0001_R000000001__RelValSingleGammaPt10__CMSSW_${OLDRELEASE}-${OLDGLOBALTAG}__DQM.root
0095 if ( $UPGRADE == True ) then
0096 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValSingleGammaPt10_${UPGRADEVER}__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0097 else 
0098 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValSingleGammaPt10__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0099 endif
0100 endif
0101 
0102 
0103 else if ($SAMPLE == SingleGammaPt35) then 
0104 
0105 if ( $RUNTYPE == Local ) then
0106 setenv OLDFILE ${WorkDir1}/PhotonValidationRelVal${OLDRELEASE}_SingleGammaPt35.root
0107 setenv NEWFILE ${WorkDir2}/PhotonValidationRelVal${NEWRELEASE}_SingleGammaPt35.root
0108 else if ( $RUNTYPE == Central ) then
0109 setenv OLDFILE ${WorkDir1}/DQM_V0001_R000000001__RelValSingleGammaPt35__CMSSW_${OLDRELEASE}-${OLDGLOBALTAG}__DQM.root
0110 if ( $UPGRADE == True ) then
0111 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValSingleGammaPt35_${UPGRADEVER}__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0112 else 
0113 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValSingleGammaPt35__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0114 endif 
0115 endif
0116 
0117 
0118 else if ($SAMPLE == SingleGammaFlatPt10_100) then 
0119 
0120 
0121 if ( $RUNTYPE == Local ) then
0122 setenv OLDFILE ${WorkDir1}/PhotonValidationRelVal${OLDRELEASE}_SingleGammaFlatPt10To100.root
0123 setenv NEWFILE ${WorkDir2}/PhotonValidationRelVal${NEWRELEASE}_SingleGammaFlatPt10To100.root
0124 endif 
0125 
0126 
0127 else if ($SAMPLE == H130GGgluonfusion) then 
0128 
0129 
0130 if ( $RUNTYPE == Local ) then
0131 setenv OLDFILE ${WorkDir1}/PhotonValidationRelVal${OLDRELEASE}_H130GGgluonfusion.root
0132 setenv NEWFILE ${WorkDir2}/PhotonValidationRelVal${NEWRELEASE}_H130GGgluonfusion.root
0133 else if ( $RUNTYPE == Central ) then
0134 setenv OLDFILE ${WorkDir1}/DQM_V0001_R000000001__RelValH130GGgluonfusion__CMSSW_${OLDRELEASE}-${OLDGLOBALTAG}__DQM.root
0135 if ( $UPGRADE == True ) then
0136 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValH130GGgluonfusion_${UPGRADEVER}_${LHCENERGY}__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0137 else
0138 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValH130GGgluonfusion__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0139 endif
0140 
0141 endif
0142 
0143 
0144 
0145 else if ($SAMPLE == PhotonJets_Pt_10) then
0146 
0147 if ( $RUNTYPE == Local ) then
0148 setenv OLDFILE ${WorkDir1}/PhotonValidationRelVal${OLDRELEASE}_PhotonJets_Pt_10.root
0149 setenv NEWFILE ${WorkDir2}/PhotonValidationRelVal${NEWRELEASE}_PhotonJets_Pt_10.root
0150 else if ( $RUNTYPE == Central ) then
0151 setenv OLDFILE ${WorkDir1}/DQM_V0001_R000000001__RelValPhotonJets_Pt_10__CMSSW_${OLDRELEASE}-${OLDGLOBALTAG}__DQM.root
0152 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValPhotonJets_Pt_10__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0153 endif
0154 
0155 else if ($SAMPLE ==  GammaJets_Pt_80_120) then 
0156 
0157 if ( $RUNTYPE == Local ) then
0158 setenv OLDFILE ${WorkDir1}/PhotonValidationRelVal${OLDRELEASE}_GammaJets_Pt_80_120.root
0159 setenv NEWFILE ${WorkDir2}/PhotonValidationRelVal${NEWRELEASE}_GammaJets_Pt_80_120.root
0160 else if ( $RUNTYPE == Central ) then
0161 endif
0162 
0163 else if ($SAMPLE == QCD_Pt_80_120) then 
0164 
0165 if ( $RUNTYPE == Local ) then
0166 setenv OLDFILE ${WorkDir1}/PhotonValidationRelVal${OLDRELEASE}_QCD_Pt_80_120.root
0167 setenv NEWFILE ${WorkDir2}/PhotonValidationRelVal${NEWRELEASE}_QCD_Pt_80_120.root
0168 else if ( $RUNTYPE == Central ) then
0169 setenv OLDFILE ${WorkDir1}/DQM_V0001_R000000001__RelValQCD_Pt_80_120__CMSSW_${OLDRELEASE}-${OLDGLOBALTAG}__DQM.root
0170 if ( $UPGRADE == True ) then
0171 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValQCD_Pt_80_120_${UPGRADEVER}_${LHCENERGY}__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0172 else
0173 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValQCD_Pt_80_120__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0174 endif
0175 endif
0176 
0177 else if ($SAMPLE == QCD_Pt_20_30STARTUP) then 
0178 
0179 if ( $RUNTYPE == Local ) then
0180 setenv OLDFILE ${WorkDir1}/ConversionValidationRelVal${OLDRELEASE}_QCD_Pt_20_30.root
0181 setenv NEWFILE ${WorkDir2}/ConversionValidationRelVal${NEWRELEASE}_QCD_Pt_20_30.root
0182 else if ( $RUNTYPE == Central ) then
0183 setenv OLDFILE ${WorkDir1}/DQM_V0003_R000000001__RelValQCD_Pt_20_30__CMSSW_${OLDRELEASE}-${OLDGLOBALTAG}__DQM.root
0184 setenv NEWFILE ${WorkDir2}/DQM_V0001_R000000001__RelValQCD_Pt_20_30__CMSSW_${NEWRELEASE}-${NEWGLOBALTAG}__DQM.root
0185 endif
0186  
0187 endif
0188 
0189 #Location of output.  The default will put your output in:
0190 #http://cmsdoc.cern.ch/Physics/egamma/www/validation/
0191 
0192 setenv CURRENTDIR $PWD
0193 setenv OUTPATH /afs/cern.ch/cms/Physics/egamma/www/validation
0194 cd $OUTPATH
0195 if (! -d $NEWRELEASE) then
0196   mkdir $NEWRELEASE
0197 endif
0198 setenv OUTPATH $OUTPATH/$NEWRELEASE
0199 cd $OUTPATH
0200 
0201 if (! -d ${TYPE}) then
0202   mkdir ${TYPE}
0203 endif
0204 setenv OUTPATH $OUTPATH/${TYPE}
0205 cd  $OUTPATH
0206 
0207 if (! -d vs${OLDRELEASE}) then
0208   mkdir vs${OLDRELEASE}
0209 endif
0210 setenv OUTPATH $OUTPATH/vs${OLDRELEASE}
0211 
0212 if ( $PU == True) then
0213 setenv OUTDIR $OUTPATH/${SAMPLE}PU
0214 else if ( $PU == False && $UPGRADE == False) then
0215 setenv OUTDIR $OUTPATH/${SAMPLE}
0216 else if ( $SAMPLE == H130GGgluonfusion && $UPGRADE == True ) then
0217 setenv OUTDIR $OUTPATH/${SAMPLE}_${LHCENERGY}TeV
0218 else if ( $SAMPLE == QCD_Pt_80_120 && $UPGRADE == True ) then
0219 setenv OUTDIR $OUTPATH/${SAMPLE}_${LHCENERGY}TeV
0220 else if ( $SAMPLE ==  SingleGammaPt10  && $UPGRADE == True ) then
0221 setenv OUTDIR $OUTPATH/${SAMPLE}
0222 else if ( $SAMPLE ==  SingleGammaPt35  && $UPGRADE == True ) then
0223 setenv OUTDIR $OUTPATH/${SAMPLE}
0224 endif
0225 
0226 
0227 
0228 if (! -d $OUTDIR) then
0229   cd $OUTPATH
0230   mkdir $OUTDIR
0231   cd $OUTDIR
0232   mkdir gifs
0233 endif
0234 cd $OUTDIR
0235 echo "cd $OUTDIR"
0236 
0237 #The list of histograms to be compared for each TYPE can be configured below:
0238 
0239 
0240 if ( $TYPE == AllConversions ) then
0241 
0242 cat > efficiency <<EOF
0243   convEffVsEtaTwoTracks
0244   convEffVsPhiTwoTracks
0245   convEffVsRTwoTracks
0246   convEffVsZTwoTracks
0247   convEffVsEtTwoTracks
0248   convFakeRateVsEtaTwoTracks
0249   convFakeRateVsPhiTwoTracks
0250   convFakeRateVsRTwoTracks
0251   convFakeRateVsZTwoTracks
0252   convFakeRateVsEtTwoTracks
0253 EOF
0254 
0255 
0256 
0257 cat > scaledhistos <<EOF
0258 convEta
0259 convPhi
0260 convZ
0261 convVtxdEta
0262 convVtxdPhi
0263 convVtxdR
0264 convVtxdZ
0265 convVtxdX
0266 convVtxdY
0267 convVtxdR_barrel
0268 convVtxdZ_barrel
0269 convVtxdX_barrel
0270 convVtxdY_barrel
0271 convVtxdR_endcap
0272 convVtxdZ_endcap
0273 convVtxdX_endcap
0274 convVtxdY_endcap
0275 hDCotTracksAll
0276 hDCotTracksBarrel
0277 hDCotTracksEndcap
0278 convPtResAll
0279 convPtResBarrel
0280 convPtResEndcap
0281 hDPhiTracksAtVtxAll
0282 hDPhiTracksAtVtxBarrel
0283 hDPhiTracksAtVtxEndcap
0284 hInvMassAll_AllTracks
0285 hInvMassBarrel_AllTracks
0286 hInvMassEndcap_AllTracks
0287 
0288 hTkPtPullAll
0289 hTkPtPullBarrel
0290 hTkPtPullEndcap
0291 
0292 nSharedHitsBarrel
0293 nSharedHitsEndcap
0294 nHitsBeforeVtxBarrel
0295 nHitsBeforeVtxEndcap
0296 maxNHitsBeforeVtxBarrel
0297 maxNHitsBeforeVtxEndcap
0298 maxDlClosestHitToVtxBarrel
0299 maxDlClosestHitToVtxEndcap
0300 
0301 EOF
0302 
0303 cat > logYScaledHistos <<EOF
0304 convRplot
0305 convPt
0306 hTkD0All
0307 hDistMinAppTracksAll
0308 hDistMinAppTracksBarrel
0309 hDistMinAppTracksEndcap
0310 vtxChi2ProbAll
0311 vtxChi2ProbBarrel
0312 vtxChi2ProbEndcap
0313 
0314 EOF
0315 
0316 cat > projections <<EOF
0317 nHitsVsEtaAllTracks
0318 
0319 EOF
0320 
0321 
0322 cat > profiles <<EOF
0323 pConvVtxdRVsR
0324 pConvVtxdRVsEta
0325 pConvVtxdXVsX
0326 pConvVtxdYVsY
0327 pConvVtxdZVsZ
0328 
0329 EOF
0330 
0331 
0332 endif
0333 
0334 #=================END CONFIGURATION=====================
0335 
0336 if (-e validation.C) rm validation.C
0337 touch validation.C
0338 cat > begin.C <<EOF
0339 {
0340 TFile *file_old = TFile::Open("$OLDFILE");
0341 TFile *file_new = TFile::Open("$NEWFILE");
0342 
0343 EOF
0344 cat begin.C >>& validation.C
0345 rm begin.C
0346 
0347 setenv N 1
0348 
0349 
0350 
0351 
0352 
0353 
0354 foreach i (`cat scaledhistos`)
0355   cat > temp$N.C <<EOF
0356 TCanvas *c$i = new TCanvas("c$i","c$i",430, 10, 700, 500);
0357 c$i->SetFillColor(10);
0358 //file_new->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0359 file_new->cd("$HISTOPATHNAME_tkConversions");
0360 Double_t mnew=$i->GetMaximum();
0361 Double_t nnew=$i->GetEntries();
0362 //file_old->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0363 file_old->cd("$HISTOPATHNAME_tkConversions");
0364 Double_t mold=$i->GetMaximum();
0365 Double_t nold=$i->GetEntries();
0366 $i->SetStats(0);
0367 $i->SetMinimum(0.);
0368 if ( $i==convVtxdR || $i==convVtxdX  ||$i==convVtxdY  ) {
0369 $i->SetMaximum (2000);
0370 } else if ( $i==convVtxdR_barrel ||  $i==convVtxdX_barrel ||  $i==convVtxdY_barrel ) {
0371 $i->SetMaximum (1200);
0372 } else if ( $i==convVtxdR_endcap  ||  $i==convVtxdX_endcap ||  $i==convVtxdY_endcap ) {
0373 $i->SetMaximum (1000);
0374 } else if ( $i==convVtxdZ_endcap ) {
0375 $i->SetMaximum (500);
0376 } else if ( $i==hDPhiTracksAtVtxAll ) {
0377 $i->SetMaximum (2000);
0378 } else if ( $i==hDPhiTracksAtVtxBarrel ||  $i==hDPhiTracksAtVtxEndcap ) {
0379 $i->SetMaximum (1000);
0380 } else if ( $i==hTkPtPullAll ) {
0381 $i->SetMaximum (2*250);
0382 } else if ( $i==hTkPtPullBarrel ) {
0383 $i->SetMaximum (2*150);
0384 }  else if ( $i==hTkPtPullEndcap ) {
0385 $i->SetMaximum (2*200);
0386 } else if ( $i==nSharedHitsBarrel ) {
0387 $i->SetTitle(" Number of shared hits: barrel");
0388 $i->SetMaximum(3000);
0389 $i->GetXaxis()->SetRangeUser(-0.5,10.);
0390 } else if ( $i==nSharedHitsEndcap ) {
0391 $i->SetTitle(" Number of shared hits: endcap");
0392 $i->SetMaximum(3200);
0393 $i->GetXaxis()->SetRangeUser(-0.5,10.);
0394 } else if ( $i==nHitsBeforeVtxBarrel ) {
0395 $i->SetTitle(" Number of hits before the vtx: barrel");
0396 $i->GetXaxis()->SetRangeUser(-0.5,10.);
0397 } else if ( $i==nHitsBeforeVtxEndcap ) {
0398 $i->SetTitle(" Number of hits before the vtx: endcap");
0399 $i->GetXaxis()->SetRangeUser(-0.5,10.);
0400 } else if ( $i==maxNHitsBeforeVtxBarrel ) {
0401 $i->SetTitle(" Max number of hits before the vtx: barrel");
0402 $i->GetXaxis()->SetRangeUser(-0.5,10.);
0403 } else if ( $i==maxNHitsBeforeVtxEndcap ) {
0404 $i->SetTitle(" Max number of hits before the vtx: endcap");
0405 $i->GetXaxis()->SetRangeUser(-0.5,10.);
0406 } else if ( $i==maxDlClosestHitToVtxBarrel ) {
0407 $i->SetTitle(" Max Dl closest hit  to vtx: barrel");
0408 } else if ( $i==maxDlClosestHitToVtxEndcap ) {
0409 $i->SetTitle(" Max Dl closest hit  to vtx: endcap");
0410 
0411 
0412 }
0413 
0414 $i->SetLineColor(kPink+8);
0415 $i->SetFillColor(kPink+8);
0416 //$i->SetLineWidth(3);
0417 $i->Draw();
0418 //file_new->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0419 file_new->cd("$HISTOPATHNAME_tkConversions");
0420 Double_t nnew=$i->GetEntries();
0421 $i->SetStats(0);
0422 $i->SetLineColor(kBlack);
0423 $i->SetMarkerColor(kBlack);
0424 $i->SetMarkerStyle(20);
0425 $i->SetMarkerSize(1);
0426 //$i->SetLineWidth(1);
0427 $i->Scale(nold/nnew);
0428 $i->Draw("e1same");
0429 c$i->SaveAs("gifs/$i.gif");
0430 
0431 EOF
0432   setenv N `expr $N + 1`
0433 end
0434 
0435 
0436 
0437 
0438 foreach i (`cat logYScaledHistos`)
0439   cat > temp$N.C <<EOF
0440 TCanvas *c$i = new TCanvas("c$i","c$i",430, 10, 700, 500);
0441 c$i->SetFillColor(10);
0442 c$i->SetLogy(1);
0443 //file_new->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0444 file_new->cd("$HISTOPATHNAME_tkConversions");
0445 Double_t mnew=$i->GetMaximum();
0446 Double_t nnew=$i->GetEntries();
0447 //file_old->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0448 file_old->cd("$HISTOPATHNAME_tkConversions");
0449 Double_t mold=$i->GetMaximum();
0450 Double_t nold=$i->GetEntries();
0451 $i->SetStats(0);
0452 $i->SetMinimum(3.);
0453 //$i->GetXaxis()->SetRangeUser(0.,60.);
0454 $i->SetLineColor(kPink+8);
0455 $i->SetFillColor(kPink+8);
0456 $i->Draw();
0457 //file_new->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0458 file_new->cd("$HISTOPATHNAME_tkConversions");
0459 Double_t nnew=$i->GetEntries();
0460 $i->SetStats(0);
0461 $i->SetLineColor(kBlack);
0462 $i->SetMarkerColor(kBlack);
0463 $i->SetMarkerStyle(20);
0464 $i->SetMarkerSize(1);
0465 if ( $i==convRplot) {
0466 $i->SetMarkerSize(0.08);
0467 }
0468 $i->Scale(nold/nnew);
0469 $i->Draw("e1same");
0470 c$i->SaveAs("gifs/$i.gif");
0471 
0472 EOF
0473   setenv N `expr $N + 1`
0474 end
0475 
0476 
0477 foreach i (`cat efficiency`)
0478   cat > temp$N.C <<EOF
0479 
0480 TCanvas *c$i = new TCanvas("c$i","c$i",430, 10, 700, 500);
0481 c$i->SetFillColor(10);
0482 //file_old->cd("DQMData/EgammaV/ConversionValidator/EfficienciesAndFakeRate");
0483 file_old->cd("$HISTOPATHNAME_Efficiencies");
0484 $i->SetStats(0);
0485 if ( $i==convFakeRateVsRTwoTracks ) {
0486 $i->GetYaxis()->SetRangeUser(0.,1.);
0487 } else {
0488 $i->GetYaxis()->SetRangeUser(0.,0.5);
0489 }
0490 $i->SetLineColor(kPink+8);
0491 $i->SetMarkerColor(kPink+8);
0492 $i->SetMarkerStyle(20);
0493 $i->SetMarkerSize(1);
0494 $i->SetLineWidth(1);
0495 $i->Draw("e1");
0496 //file_new->cd("DQMData/EgammaV/ConversionValidator/EfficienciesAndFakeRate");
0497 file_new->cd("$HISTOPATHNAME_Efficiencies");
0498 $i->SetStats(0);
0499 $i->SetMinimum(0.);
0500 $i->SetMaximum(1.1);
0501 $i->SetLineColor(kBlack);
0502 $i->SetMarkerColor(kBlack);
0503 $i->SetMarkerStyle(20);
0504 $i->SetMarkerSize(1);
0505 $i->SetLineWidth(1);
0506 $i->Draw("e1same");
0507 c$i->SaveAs("gifs/$i.gif");
0508 
0509 EOF
0510   setenv N `expr $N + 1`
0511 end
0512 
0513 
0514 foreach i (`cat projections`)
0515   cat > temp$N.C <<EOF
0516 
0517 TCanvas *c$i = new TCanvas("c$i","c$i",430, 10, 700, 500);
0518 c$i->SetFillColor(10);
0519 //file_old->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0520 file_old->cd("$HISTOPATHNAME_tkConversions");
0521 TH1D *tmp1$i= $i->ProjectionY();
0522 Double_t nold=tmp1$i->GetEntries();
0523 Double_t mold=tmp1$i->GetMaximum();
0524 //file_new->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0525 file_new->cd("$HISTOPATHNAME_tkConversions");
0526 TH1D *tmp2$i= $i->ProjectionY();
0527 Double_t nnew=tmp2$i->GetEntries();
0528 Double_t mnew=tmp2$i->GetMaximum();
0529 tmp1$i->SetStats(0);
0530 tmp1$i->SetMinimum(0.);
0531 tmp1$i->SetLineColor(kPink+8);
0532 tmp1$i->SetFillColor(kPink+8);
0533 tmp1$i->SetLineWidth(3);
0534 tmp1$i->Draw();
0535 tmp2$i->SetStats(0);
0536 tmp2$i->SetLineColor(kBlack);
0537 tmp2$i->SetMarkerColor(kBlack);
0538 tmp2$i->SetMarkerStyle(20);
0539 tmp2$i->SetMarkerSize(1);
0540 tmp2$i->SetLineWidth(1);
0541 tmp2$i->Scale(nold/nnew);
0542 tmp2$i->Draw("e1same");
0543 c$i->SaveAs("gifs/$i.gif");
0544 
0545 
0546 EOF
0547   setenv N `expr $N + 1`
0548 end
0549 
0550 
0551 foreach i (`cat profiles`)
0552   cat > temp$N.C <<EOF
0553 TCanvas *c$i = new TCanvas("c$i","c$i",430, 10, 700, 500);
0554 c$i->SetFillColor(10);
0555 //file_old->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0556 file_old->cd("$HISTOPATHNAME_tkConversions");
0557 $i->SetStats(0);
0558 if (  $i == pConvVtxdRVsR || $i == pConvVtxdXVsX ||  $i ==  pConvVtxdYVsY ) {
0559 $i->GetYaxis()->SetRangeUser(-2.,2);
0560 } else if ( $i == pConvVtxdZVsZ ) {
0561 $i->GetYaxis()->SetRangeUser(-10.,10);
0562 } else {
0563 $i->GetYaxis()->SetRangeUser(-1.,1);
0564 }
0565 $i->SetLineColor(kPink+8);
0566 $i->SetMarkerColor(kPink+8);
0567 $i->SetMarkerStyle(20);
0568 $i->SetMarkerSize(1);
0569 $i->SetLineWidth(1);
0570 $i->Draw();
0571 //file_new->cd("DQMData/EgammaV/ConversionValidator/ConversionInfo");
0572 file_new->cd("$HISTOPATHNAME_tkConversions");
0573 $i->SetStats(0);
0574 $i->SetLineColor(kBlack);
0575 $i->SetMarkerColor(kBlack);
0576 $i->SetMarkerStyle(20);
0577 $i->SetMarkerSize(1);
0578 $i->SetLineWidth(1);
0579 $i->Draw("e1same");
0580 c$i->SaveAs("gifs/$i.gif");
0581 
0582 EOF
0583   setenv N `expr $N + 1`
0584 end
0585 
0586 
0587 
0588 
0589 setenv NTOT `expr $N - 1`
0590 setenv N 1
0591 while ( $N <= $NTOT )
0592   cat temp$N.C >>& validation.C
0593   rm temp$N.C
0594   setenv N `expr $N + 1`
0595 end
0596 
0597 cat > end.C <<EOF
0598 }
0599 EOF
0600 cat end.C >>& validation.C
0601 rm end.C
0602 
0603 
0604 if ( $TYPE == PixelMatchGsfElectron ) then
0605   setenv ANALYZER PixelMatchGsfElectronAnalyzer
0606   setenv CFG read_gsfElectrons
0607 else if ( $TYPE == AllConversions ) then
0608   setenv ANALYZER ConversionValidator
0609   setenv CFG ConversionValidator_cfg
0610 endif
0611 
0612 
0613 if (  $PU == False && $SAMPLE == H130GGgluonfusion && $UPGRADE == True ) then
0614 setenv SAMPLE ${SAMPLE}_${LHCENERGY}TeV
0615 endif
0616 
0617 
0618 
0619 
0620 if (-e validation.html) rm validation.html
0621 if (-e tkConvValidationPlotsTemplate.html) rm tkConvValidationPlotsTemplate.html
0622 cp ${CURRENTDIR}/tkConvValidationPlotsTemplate.html tkConvValidationPlotsTemplate.html
0623 touch validation.html
0624 cat > begin.html <<EOF
0625 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0626 <html>
0627 <head>
0628 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
0629 <title>$NEWRELEASE vs $OLDRELEASE $TYPE validation</title>
0630 </head>
0631 
0632 <h1>$NEWRELEASE vs $OLDRELEASE $TYPE validation
0633 <br>
0634  $SAMPLE 
0635 </h1>
0636 
0637 <p>The following plots were made using <a href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/Validation/RecoEgamma/src/$ANALYZER.cc">Validation/RecoEgamma/src/$ANALYZER</a>, 
0638 using <a href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/Validation/RecoEgamma/test/$CFG.py">Validation/RecoEgamma/test/$CFG.py</a>
0639 <p>The script used to make the plots is <a href="validation.C">here</a>.
0640 <br>
0641 In all plots below, $OLDRELEASE is in purple , $NEWRELEASE in black. 
0642 <br>
0643 Click on the plots to see them enlarged.
0644 <br>
0645 Responsible: N. Marinelli
0646 <br>
0647 <br>
0648 
0649 
0650 
0651 EOF
0652 cat begin.html >>& validation.html
0653 rm begin.html
0654 cat  tkConvValidationPlotsTemplate.html >>& validation.html
0655 rm   tkConvValidationPlotsTemplate.html 
0656 
0657 rm efficiency
0658 rm scaledhistos
0659 rm profiles
0660 rm logYScaledHistos
0661 rm projections
0662 
0663 root -b -l -q validation.C
0664 cd $CURRENTDIR
0665 
0666 python makeWebpage.py ${OUTDIR}/gifs  ${OLDRELEASE}  ${NEWRELEASE} ${SAMPLE}
0667 echo "Then you can view your validation plots here:"
0668 echo "http://cmsdoc.cern.ch/Physics/egamma/www/$OUTPATH/validation.html"