Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CamEvd.cxx

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <cassert>
00003 #include <cmath>
00004 
00005 //GUI Classes
00006 #include "TGFrame.h"
00007 #include "TGClient.h"
00008 #include "TGResourcePool.h"
00009 #include "TGNumberEntry.h"
00010 #include "TGDoubleSlider.h"
00011 #include "TGButton.h"
00012 #include "TRootEmbeddedCanvas.h"
00013 #include "TGTab.h"
00014 #include "TGLabel.h"
00015 
00016 #include "TApplication.h"
00017 #include "TCanvas.h"
00018 #include "TArrow.h"
00019 #include "TStyle.h"
00020 #include "TLatex.h"
00021 #include "TChain.h"
00022 #include "TMath.h"
00023 
00024 #include "AtNuEvent/AtmosEvent.h"
00025 #include "AtNuEvent/AtmosStrip.h"
00026 #include "AtNuEvent/AtmosTrack.h"
00027 #include "AtNuEvent/AtmosShower.h"
00028 #include "AtNuEvent/AtmosShieldPlank.h"
00029 #include "AtNuEvent/AtmosDeadChip.h"
00030 #include "AtNuEvent/AtmosScintHit.h"
00031 #include "HistMan/HistMan.h"
00032 #include "MessageService/MsgService.h"
00033 
00034 #include "AtNuUtils/TruthHelp.h"
00035 #include "AtNuUtils/VetoShower.h"
00036 #include "AtNuUtils/VetoTrack.h"
00037 #include "AtNuUtils/UtilMisc.h"
00038 #include "AtNuUtils/UtilCanvas.h"
00039 #include "AtNuUtils/UtilStrip.h"
00040 #include "AtNuUtils/QuickGeom.h"
00041 #include "AtNuUtils/FarLayout.h"
00042 #include "AtNuUtils/CamEvd.h"
00043 
00044 static const double C45 = TMath::Sqrt(2.) / 2.; //Cosine of 45 degrees
00045 static const double SoL = TMath::C();
00046 ClassImp(CamEvd)
00047 CVSID("$Id: CamEvd.cxx,v 1.8 2008/01/15 02:55:25 bspeak Exp $");
00048 
00049 static int ChargeToColor(double charge) {
00050   if(charge<2.0) return 7;
00051   if(charge<4.0) return 4;
00052   if(charge<6.0) return 5;
00053   if(charge<8.0) return 3;
00054   if(charge<10.0) return 6;
00055   return 2;
00056 }
00057 
00058 static const char *IDnuToText(int IDnu) {
00059   if(IDnu ==  12) return "#nu_{e}";
00060   if(IDnu == -12) return "#bar{#nu_{e}}";
00061   if(IDnu ==  14) return "#nu_{#mu}";
00062   if(IDnu == -14) return "#bar{#nu_{#mu}}";
00063   if(IDnu ==  16) return "#nu_{#tau}";
00064   if(IDnu == -16) return "#bar{#nu_{#tau}}";
00065   return "CR";
00066 }
00067 
00068 static const char *IDactToText(int IDact) {
00069   if(IDact == 0) return "NC";
00070   if(IDact == 1) return "CC";
00071   return "WTF";
00072 }
00073 
00074 static const char *IDresToText(int IDres) {
00075   if(IDres == 1001) return "QE";
00076   if(IDres == 1002) return "Res";
00077   if(IDres == 1003) return "DIS";
00078   if(IDres == 1004) return "CPP";
00079   return "CR";
00080 }
00081 
00082 static const Style_t ScintHitIdToStyle(int ScintHitId) {
00083   switch(ScintHitId) {
00084   case 11://e-
00085   case -11://e+
00086     return(kOpenCircle);
00087     break;
00088   case 13://mu-
00089   case -13://mu+
00090     return(kOpenCircle);
00091     break;
00092   case 15://tau-
00093   case -15://tau+
00094     return(kOpenCircle);
00095     break;
00096   case 2212://Proton
00097   case 211://pi+
00098   case -211://pi-
00099   case 321://K+
00100   case -321://K-
00101     return(kOpenTriangleUp);
00102     break;
00103   default:
00104     if (ScintHitId > 1000000000) {//Nucleon
00105       return(kStar);
00106     }
00107     else {
00108       MSG("FarDetEvent",Msg::kInfo) << "Strange hit id: " << ScintHitId << endl;
00109       return(kDot);
00110     }
00111     break;
00112   }
00113 }
00114 
00115 static const Color_t ScintHitIdToColor(int ScintHitId) {
00116   switch (ScintHitId) {
00117   case 11://e-
00118   case -11://e+
00119     return(kGreen);
00120     break;
00121   case 13://mu-
00122   case -13://mu+
00123     return(kRed);
00124     break;
00125   case 15://tau-
00126   case -15://tau+
00127     return(kMagenta);
00128     break;
00129   case 2212://Proton
00130   case 211://pi+
00131   case -211://pi-
00132   case 321://K+
00133   case -321://K-
00134     return(kBlue);
00135     break;
00136   default:
00137     if (ScintHitId > 1000000000) {//Nucleon
00138       return(kBlack);
00139     }
00140     else {
00141       MSG("FarDetEvent",Msg::kInfo) << "Strange hit id: " << ScintHitId << endl;
00142       return(kBlack);
00143     }
00144     break;
00145   }
00146 }
00147 
00148 CamEvd::CamEvd() {
00149   fRun = fSubRun = fSnarl = 0;
00150   
00151   fMakePS = fMakeEPS = fMakeGIF = fMakeROOT = fAutoPrint = false;
00152 
00153   //Set Configurable
00154   fMCTimeWin = 1.5;
00155   fWlsFibreN = 1.77;
00156   fClearFibreN = 1.77;
00157   fDoTimeCorr1 = true;
00158   fDoTimeCorr2 = true;
00159 
00160   fMeanDEHitDT = 0.0;
00161   fRMSDEHitDT = 0.0;
00162 
00163   fMinPlane = 1;
00164   fMaxPlane = 486;
00165 
00166   fMinUStrip = fMinVStrip = 0;
00167 
00168   fMaxUStrip = fMaxVStrip = 191;
00169 
00170   //this->SetStyle();
00171   gStyle->SetOptStat(0);
00172 
00173   fDoShieldPlot = true;
00174   fFakeShieldData = false;
00175   fDoShowerPlot = true;
00176 
00177   fMakeMCTrkIdView = false;
00178 
00179   FakeShieldDataChain = new TChain("ntp");
00180   FakeAtmosEvent = 0;
00181   FakeShieldDataChain->SetBranchAddress("evt", &FakeAtmosEvent);
00182 }
00183 
00184 CamEvd::~CamEvd() {
00185   MSG("FarDetEvent",Msg::kSynopsis) << "CamEvd::~CamEvd" << endl;
00186 }
00187 
00188 void CamEvd::MakeCanvases() {
00189   MSG("FarDetEvent",Msg::kVerbose) << this->GetName() << "::MakeCanvases()" << endl;
00190   HistMan hm(this->GetName());
00191 
00192   //For later use in defining appropriate widget background color
00193   Pixel_t BgClr = gClient->GetResourcePool()->GetFrameBgndColor();
00194 
00195   //Predefine a series of horizontal and vertical frames
00196   TGHorizontalFrame *cgH1, *cgH2;
00197   TGVerticalFrame *cgV1, *cgV2;
00198   TGLabel *cgLabel;
00199 
00200   //A handful of predefined layouts to save space later.
00201   TGLayoutHints *optlay1 = new TGLayoutHints(kLHintsBottom | kLHintsLeft);
00202   TGLayoutHints *optlay2 = new TGLayoutHints(kLHintsTop | kLHintsCenterX);
00203 
00204   /*
00205    * Start the head frame
00206    */
00207   TGTransientFrame *cgHeadFrame = new TGTransientFrame();
00208   cgHeadFrame->Connect("CloseWindow()","CamEvd",this,"CloseWindow()");
00209 
00210   /*
00211    * Start printing horizontal frame
00212    */
00213   //Printing options and switch
00214   cgH1 = new TGHorizontalFrame(cgHeadFrame);
00215 
00216   TGCheckButton *cgButton = new TGCheckButton(cgH1, "ShieldPlot", 2);
00217   if(fDoShieldPlot) cgButton->SetState(kButtonDown);
00218   cgButton->Connect("Pressed()", "CamEvd", this, "DoShieldPlot(=true)");
00219   cgButton->Connect("Released()", "CamEvd", this, "DoShieldPlot(=false)");
00220   cgH1->AddFrame(cgButton, new TGLayoutHints(kLHintsRight));
00221 
00222   cgButton = new TGCheckButton(cgH1, "FakeShieldData", 2);
00223   if(fFakeShieldData) cgButton->SetState(kButtonDown);
00224   cgButton->Connect("Pressed()", "CamEvd", this, "FakeShieldData(=true)");
00225   cgButton->Connect("Released()", "CamEvd", this, "FakeShieldData(=false)");
00226   cgH1->AddFrame(cgButton, new TGLayoutHints(kLHintsRight));
00227 
00228   cgButton = new TGCheckButton(cgH1, "ShowerPlot", 2);
00229   if(fDoShowerPlot) cgButton->SetState(kButtonDown);
00230   cgButton->Connect("Pressed()", "CamEvd", this, "DoShowerPlot(=true)");
00231   cgButton->Connect("Released()", "CamEvd", this, "DoShowerPlot(=false)");
00232   cgH1->AddFrame(cgButton, new TGLayoutHints(kLHintsRight));
00233 
00234   TGCheckButton *cgMakePS = new TGCheckButton(cgH1, "PS", 2);
00235   if(fMakePS) cgMakePS->SetState(kButtonDown);
00236   cgMakePS->Connect("Pressed()", "CamEvd", this, "MakePS(=true)");
00237   cgMakePS->Connect("Released()", "CamEvd", this, "MakePS(=false)");
00238   cgH1->AddFrame(cgMakePS, new TGLayoutHints(kLHintsLeft));
00239 
00240   TGCheckButton *cgMakeEPS = new TGCheckButton(cgH1, "EPS", 2);
00241   if(fMakeEPS) cgMakeEPS->SetState(kButtonDown);
00242   cgMakeEPS->Connect("Pressed()", "CamEvd", this, "MakeEPS(=true)");
00243   cgMakeEPS->Connect("Released()", "CamEvd", this, "MakeEPS(=false)");
00244   cgH1->AddFrame(cgMakeEPS, new TGLayoutHints(kLHintsLeft));
00245 
00246   TGCheckButton *cgMakeGIF = new TGCheckButton(cgH1, "GIF", 2);
00247   if(fMakeGIF) cgMakeGIF->SetState(kButtonDown);
00248   cgMakeGIF->Connect("Pressed()", "CamEvd", this, "MakeGIF(=true)");
00249   cgMakeGIF->Connect("Released()", "CamEvd", this, "MakeGIF(=false)");
00250   cgH1->AddFrame(cgMakeGIF, new TGLayoutHints(kLHintsLeft));
00251 
00252   TGCheckButton *cgMakeROOT = new TGCheckButton(cgH1, "ROOT", 2);
00253   if(fMakeROOT) cgMakeROOT->SetState(kButtonDown);
00254   cgMakeROOT->Connect("Pressed()", "CamEvd", this, "MakeROOT(=true)");
00255   cgMakeROOT->Connect("Released()", "CamEvd", this, "MakeROOT(=false)");
00256   cgH1->AddFrame(cgMakeROOT, new TGLayoutHints(kLHintsLeft));
00257 
00258   TGCheckButton *cgAutoPrint = new TGCheckButton(cgH1, "Auto", 2);
00259   if(fAutoPrint) cgAutoPrint->SetState(kButtonDown);
00260   cgAutoPrint->Connect("Pressed()", "CamEvd", this, "AutoPrint(=true)");
00261   cgAutoPrint->Connect("Released()", "CamEvd", this, "AutoPrint(=false)");
00262   cgH1->AddFrame(cgAutoPrint, new TGLayoutHints(kLHintsLeft));
00263 
00264   TGTextButton *cgDoPrint = new TGTextButton(cgH1, "Print", 2);
00265   cgDoPrint->Connect("Clicked()", "CamEvd", this, "DoPrint()");
00266   cgH1->AddFrame(cgDoPrint, new TGLayoutHints(kLHintsLeft));
00267 
00268   cgHeadFrame->AddFrame(cgH1, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
00269   /*
00270    * End printing horizontal frame
00271    */
00272 
00273   /*
00274    * Start options frame
00275    */
00276   cgH1 = new TGHorizontalFrame(cgHeadFrame);
00277 
00278   cgV1 = new TGVerticalFrame(cgH1);
00279   cgMCTimeWin = new TGNumberEntry(cgV1, fMCTimeWin, 5, 1);
00280   cgMCTimeWin->Connect("ValueSet(Long_t)", "CamEvd", this, "SetNumericOptions()");
00281   cgV1->AddFrame(cgMCTimeWin,optlay1);
00282   cgLabel = new TGLabel(cgV1, "MCTimeWin");
00283   cgV1->AddFrame(cgLabel,optlay2);
00284   cgH1->AddFrame(cgV1, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 1,1,0,0));
00285 
00286   cgV1 = new TGVerticalFrame(cgH1);
00287   cgWlsFibreN = new TGNumberEntry(cgV1, fWlsFibreN, 5, 1);
00288   cgWlsFibreN->Connect("ValueSet(Long_t)", "CamEvd", this, "SetNumericOptions()");
00289   cgV1->AddFrame(cgWlsFibreN,optlay1);
00290   cgLabel = new TGLabel(cgV1, "WlsFibreN");
00291   cgV1->AddFrame(cgLabel,optlay2);
00292   cgH1->AddFrame(cgV1, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 1,1,0,0));
00293 
00294   cgV1 = new TGVerticalFrame(cgH1);
00295   cgClearFibreN = new TGNumberEntry(cgV1, fClearFibreN, 5, 1);
00296   cgClearFibreN->Connect("ValueSet(Long_t)", "CamEvd", this, "SetNumericOptions()");
00297   cgV1->AddFrame(cgClearFibreN,optlay1);
00298   cgLabel = new TGLabel(cgV1, "ClearFibreN");
00299   cgV1->AddFrame(cgLabel,optlay2);
00300   cgH1->AddFrame(cgV1,optlay1);
00301 
00302   cgV1 = new TGVerticalFrame(cgH1);
00303   cgH2 = new TGHorizontalFrame(cgV1);
00304   TGCheckButton *cgDoTimeCorr1 = new TGCheckButton(cgH2, "1", 6);
00305   if(fDoTimeCorr1) cgDoTimeCorr1->SetState(kButtonDown);
00306   cgDoTimeCorr1->Connect("Pressed()", "CamEvd", this, "DoTimeCorr1(=true)");
00307   cgDoTimeCorr1->Connect("Released()", "CamEvd", this, "DoTimeCorr1(=false)");
00308   cgH2->AddFrame(cgDoTimeCorr1, optlay1);
00309   TGCheckButton *cgDoTimeCorr2 = new TGCheckButton(cgH2, "2", 7);
00310   if(fDoTimeCorr2) cgDoTimeCorr2->SetState(kButtonDown);
00311   cgDoTimeCorr2->Connect("Pressed()", "CamEvd", this, "DoTimeCorr2(=true)");
00312   cgDoTimeCorr2->Connect("Released()", "CamEvd", this, "DoTimeCorr2(=false)");
00313   cgH2->AddFrame(cgDoTimeCorr2, optlay1);
00314   cgV1->AddFrame(cgH2, optlay1);
00315   cgLabel = new TGLabel(cgV1, "TimeCorr");
00316   cgV1->AddFrame(cgLabel,optlay2);
00317   cgH1->AddFrame(cgV1,optlay1);
00318 
00319   cgHeadFrame->AddFrame(cgH1, new TGLayoutHints(kLHintsBottom));
00320   /*
00321    * End horizontal frame for options
00322    */
00323 
00324   /*
00325    * Start central horizontal frame for canvases and sliders
00326    */
00327   cgH1 = new TGHorizontalFrame(cgHeadFrame);
00328 
00329   /*
00330    * Start vertical frame for canvases and plane slider
00331    */
00332   cgV1 = new TGVerticalFrame(cgH1);
00333 
00334   cgTab = new TGTab(cgV1, 100, 100);
00335   cgTab->Connect("Selected(Int_t)", "CamEvd", this, "DoTab(Int_t)");
00336 
00337   int XCanv = 1000;
00338   int YCanv = 772;
00339   TRootEmbeddedCanvas *trEmbed = 0;
00340   TGCompositeFrame *cgCFrame = 0;
00341 
00342   cgCFrame = cgTab->AddTab("Main View");
00343   trEmbed = new TRootEmbeddedCanvas("MainView",cgCFrame,XCanv,YCanv);
00344   cMainView = trEmbed->GetCanvas();
00345   cMainView->Divide(3,2);
00346   trEmbed->AdoptCanvas(cMainView);
00347   cgCFrame->AddFrame(trEmbed);
00348   AllCanvases.push_back(cMainView);
00349   fActiveCanvas = cMainView;
00350 
00351   cgCFrame = cgTab->AddTab("Side View");
00352   trEmbed = new TRootEmbeddedCanvas("SideView",cgCFrame, XCanv, YCanv);
00353   cSideView = trEmbed->GetCanvas();
00354   cSideView->Divide(2,2);
00355   cgCFrame->AddFrame(trEmbed);
00356   AllCanvases.push_back(cSideView);
00357 
00358   cgCFrame = cgTab->AddTab("Shield View");
00359   trEmbed = new TRootEmbeddedCanvas("ShieldView",cgCFrame, XCanv, YCanv);
00360   cShieldView = trEmbed->GetCanvas();
00361   cShieldView->Divide(3,2);
00362   cgCFrame->AddFrame(trEmbed);
00363   AllCanvases.push_back(cShieldView);
00364 
00365   cgCFrame = cgTab->AddTab("Shower View");
00366   trEmbed = new TRootEmbeddedCanvas("ShowerView",cgCFrame, XCanv, YCanv);
00367   cShowerView = trEmbed->GetCanvas();
00368   cShowerView->Divide(2,2);
00369   cgCFrame->AddFrame(trEmbed);
00370   AllCanvases.push_back(cShowerView);
00371 
00372   cgCFrame = cgTab->AddTab("LI View");
00373   trEmbed = new TRootEmbeddedCanvas("LIView",cgCFrame, XCanv, YCanv);
00374   cLIView = trEmbed->GetCanvas();
00375   cgCFrame->AddFrame(trEmbed);
00376   AllCanvases.push_back(cLIView);
00377 
00378   cgCFrame = cgTab->AddTab("MC Main View");
00379   trEmbed = new TRootEmbeddedCanvas("MCMainView",cgCFrame, XCanv, YCanv);
00380   cMCMainView = trEmbed->GetCanvas();
00381   cMCMainView->Divide(3,2);
00382   cgCFrame->AddFrame(trEmbed);
00383   AllCanvases.push_back(cMCMainView);
00384 
00385   cgCFrame = cgTab->AddTab("MC Side View");
00386   trEmbed = new TRootEmbeddedCanvas("MCSideView",cgCFrame, XCanv, YCanv);
00387   cMCSideView = trEmbed->GetCanvas();
00388   cMCSideView->Divide(2,2);
00389   cgCFrame->AddFrame(trEmbed);
00390   AllCanvases.push_back(cMCSideView);
00391 
00392   if (fMakeMCTrkIdView) {
00393     cgCFrame = cgTab->AddTab("MC TrkId View");
00394     trEmbed = new TRootEmbeddedCanvas("MCTrkIdView",cgCFrame, XCanv, YCanv);
00395     cMCTrkIdView = trEmbed->GetCanvas();
00396     cMCTrkIdView->Divide(2,1);
00397     cgCFrame->AddFrame(trEmbed);
00398     AllCanvases.push_back(cMCTrkIdView);
00399   }
00400 
00401   cgV1->AddFrame(cgTab);
00402 
00403   cgH2 = new TGHorizontalFrame(cgV1);
00404 
00405   cgLabel = new TGLabel(cgH2, "Plane");
00406   cgH2->AddFrame(cgLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
00407 
00408   cgPlaneRange = new TGDoubleHSlider(cgH2 , 1, kDoubleScaleNo,
00409     -1, kHorizontalFrame, BgClr, false, true);
00410   cgPlaneRange->SetRange(1, 485);
00411   cgPlaneRange->SetPosition(1, 485);
00412   cgPlaneRange->Connect("Released()","CamEvd",this,"PlaneSlider()");
00413   cgH2->AddFrame(cgPlaneRange, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
00414 
00415   cgV1->AddFrame(cgH2, new TGLayoutHints(kLHintsBottom | kLHintsExpandX));
00416 
00417   cgH1->AddFrame(cgV1);
00418   /*
00419    * End vertical frame cgV1 for canvases and plane slider
00420    */
00421 
00422   cgV1 = new TGVerticalFrame(cgH1);
00423 
00424   cgH2 = new TGHorizontalFrame(cgV1);
00425 
00426   cgV2 = new TGVerticalFrame(cgH2);
00427   cgLabel = new TGLabel(cgV2, "U");
00428   cgV2->AddFrame(cgLabel,new TGLayoutHints(kLHintsTop | kLHintsCenterX));
00429   cgUStripRange = new TGDoubleVSlider(cgV2 , 1, kDoubleScaleNo,
00430     -1, kVerticalFrame, BgClr, true, true);
00431   cgUStripRange->SetRange(0, 191);
00432   cgUStripRange->SetPosition(0, 191);
00433   cgUStripRange->Connect("Released()","CamEvd",this,"UStripSlider()");
00434   cgV2->AddFrame(cgUStripRange, new TGLayoutHints(kLHintsExpandY));
00435   cgH2->AddFrame(cgV2, new TGLayoutHints(kLHintsExpandY));
00436 
00437   cgV2 = new TGVerticalFrame(cgH2);
00438   cgLabel = new TGLabel(cgV2, "V");
00439   cgV2->AddFrame(cgLabel,new TGLayoutHints(kLHintsTop | kLHintsCenterX));
00440   cgVStripRange = new TGDoubleVSlider(cgV2 , 1, kDoubleScaleNo,
00441     -1, kVerticalFrame, BgClr, true, true);
00442   cgVStripRange->SetRange(0, 191);
00443   cgVStripRange->SetPosition(0, 191);
00444   cgVStripRange->Connect("Released()","CamEvd",this,"VStripSlider()");
00445   cgV2->AddFrame(cgVStripRange, new TGLayoutHints(kLHintsExpandY));
00446   cgH2->AddFrame(cgV2, new TGLayoutHints(kLHintsExpandY));
00447 
00448   cgV1->AddFrame(cgH2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
00449 
00450   TGTextButton *cgUnZoom = new TGTextButton(cgV1, "UnZoom", 2);
00451   cgUnZoom->Connect("Clicked()", "CamEvd", this, "UnZoom()");
00452   cgV1->AddFrame(cgUnZoom, new TGLayoutHints(kLHintsBottom));
00453 
00454   cgH1->AddFrame(cgV1, new TGLayoutHints(kLHintsExpandY));
00455 
00456   cgHeadFrame->AddFrame(cgH1, new TGLayoutHints(kLHintsCenterY));
00457 
00458   cgHeadFrame->MapSubwindows();
00459   cgHeadFrame->Resize();
00460   cgHeadFrame->SetWindowName("Head Frame");
00461   cgHeadFrame->MapWindow();
00462 
00463   for(unsigned int i=0; i<AllCanvases.size(); i++)
00464     hm.Adopt("Canvases", AllCanvases[i]);
00465 }
00466 
00467 void CamEvd::MakeHistos() {
00468   MSG("FarDetEvent",Msg::kSynopsis) << this->GetName() << "::MakeHistos()" << endl;
00469   HistMan hm(this->GetName());
00470   hUZStpPlnAxis = hm.Book<TH2F>("UZStpPlnAxis", "",
00471     485,1,486, 192,0,192);
00472   hUZStpPlnAxis->GetXaxis()->SetTitle("Plane");
00473   hUZStpPlnAxis->GetYaxis()->SetTitle("U Strip");
00474 
00475   hUZLinearAxis = hm.Book<TH2F>("UZLinearAxis", "",
00476     100,0.,30.0, 100,-4.0,4.0);
00477   hUZLinearAxis->GetXaxis()->SetTitle("Z (m)");
00478   hUZLinearAxis->GetYaxis()->SetTitle("U (m)");
00479 
00480   hVZStpPlnAxis = hm.Book<TH2F>("VZStpPlnAxis", "",
00481     485,1,486, 192,0,192);
00482   hVZStpPlnAxis->GetXaxis()->SetTitle("Plane");
00483   hVZStpPlnAxis->GetYaxis()->SetTitle("V Strip");
00484 
00485   hVZLinearAxis = hm.Book<TH2F>("VZLinearAxis", "",
00486     100,0.,30.0, 100,-4.0,4.0);
00487   hVZLinearAxis->GetXaxis()->SetTitle("Z (m)");
00488   hVZLinearAxis->GetYaxis()->SetTitle("V (m)");
00489 
00490   hXYAxis = hm.Book<TH2F>("XYAxis", "", 100,-7.0,7.0, 100,-8.0,8.0);
00491   hXYAxis->GetXaxis()->SetTitle("X (m)");
00492   hXYAxis->GetYaxis()->SetTitle("Y (m)");
00493 
00494   hUZStpPlnShw = hm.Book<TH2F>("UZStpPlnShw", "U Strip vs Plane",
00495     485,1,486, 192,0,192);
00496   hUZStpPlnShw->GetXaxis()->SetTitle("Plane");
00497   hUZStpPlnShw->GetYaxis()->SetTitle("U Strip");
00498 
00499   hVZStpPlnShw = hm.Book<TH2F>("VZStpPlnShw", "V Strip vs Plane",
00500     485,1,486, 192,0,192);
00501   hVZStpPlnShw->GetXaxis()->SetTitle("Plane");
00502   hVZStpPlnShw->GetYaxis()->SetTitle("V Strip");
00503 
00504   hShwPlnProfile = hm.Book<TH1F>("ShwPlnProfile",
00505     "Shower Energy Profile", 485,1,486);
00506   hShwPlnProfile->GetXaxis()->SetTitle("Plane");
00507   hShwPlnProfile->GetYaxis()->SetTitle("PE");
00508 
00509   hShwPlnCosZProfile = hm.Book<TH1F>("ShwPlnCosZProfile",
00510     "Shower Energy Profile", 485,1,486);
00511   hShwPlnCosZProfile->GetXaxis()->SetTitle("Plane");
00512   hShwPlnCosZProfile->GetYaxis()->SetTitle("PE");
00513 
00514   hTZAxis = hm.Book<TH2F>("TZAxis", "",485, 1, 486, 1000, 0., 1000);
00515   hTZAxis->GetXaxis()->SetTitle("Plane");
00516   hTZAxis->GetYaxis()->SetTitle("T (ns)");
00517 
00518   hMCPlaneDE = hm.Book<TH1F>("MCPlaneDE", "Plane DE", 485, 1, 486);
00519   hMCPlaneDE->GetXaxis()->SetTitle("Plane");
00520   hMCPlaneDE->GetYaxis()->SetTitle("DE(MeV)");
00521   hMCPlaneDE->SetFillColor(5);
00522   hMCPlaneDE->SetLineWidth(2);
00523 
00524   hPulserLedCharge = hm.Book<TH2F>("PulserLEDCharge", "",
00525     17, 0, 17, 21, 0, 21);
00526   hPulserLedCharge->GetXaxis()->SetTitle("PulserBox");
00527   hPulserLedCharge->GetYaxis()->SetTitle("LED");
00528   hPulserLedCharge->GetZaxis()->SetTitle("Summed PE");
00529 
00530   hMCTZAxis = hm.Book<TH2F>("MCTZAxis", "",
00531     485, 1, 486, 1000, 0., 1000);
00532   hMCTZAxis->GetXaxis()->SetTitle("Plane");
00533   hMCTZAxis->GetYaxis()->SetTitle("T (ns)");
00534 
00535   hRawPlaneCharge = hm.Book<TH1F>("RawPlaneCharge", "", 485, 1, 486);
00536   hRawPlaneCharge->GetXaxis()->SetTitle("Plane");
00537   hRawPlaneCharge->GetYaxis()->SetTitle("PE");
00538   hRawPlaneCharge->SetLineStyle(2);
00539 
00540   hCorrPlaneCharge = hm.Book<TH1F>("CorrPlaneCharge", "", 485, 1, 486);
00541   hCorrPlaneCharge->GetXaxis()->SetTitle("Plane");
00542   hCorrPlaneCharge->GetYaxis()->SetTitle("PE");
00543   hCorrPlaneCharge->SetFillColor(kYellow);
00544   hCorrPlaneCharge->SetLineWidth(2);
00545 
00546   for(int i=0; i<4; i++) {
00547     hTrkVeto[i] = hm.Book<TH1F>(Form("TrkVetoSection%d",i+1),
00548       Form("Section %d",i+1), 100, -500, 500);
00549     hTrkVeto[i]->GetXaxis()->SetTitle("T_{shield} - T_{vertex}(ns)");
00550     hTrkVeto[i]->GetYaxis()->SetTitle("Shield PE");
00551     hTrkVeto[i]->SetLineColor(kRed);
00552 
00553     hShwVeto[i] = hm.Book<TH1F>(Form("ShwVetoSection%d",i+1),
00554       Form("Section %d",i+1), 100, -500, 500);
00555     hShwVeto[i]->GetXaxis()->SetTitle("T_{shield} - T_{vertex}(ns)");
00556     hShwVeto[i]->GetYaxis()->SetTitle("Shield PE");
00557     hShwVeto[i]->SetLineColor(kGreen);
00558   }
00559 
00560   hTiming = new TH1F();
00561   hTiming->SetName("Timing");
00562 }
00563 
00564 bool CamEvd::FillEvent(const AtmosEvent* event) {
00565   MSG("FarDetEvent",Msg::kVerbose) << "CamEvd::FillEvent" << endl;
00566 
00567   fRun = event->Run;
00568   fSubRun = event->SubRun;
00569   fSnarl = event->Snarl;
00570   fIsMC = (event->NScintHits > 0);
00571 
00572   this->Reset();
00573 
00574   MakeUVHits(event);
00575   MakeXYHits(event);
00576   MakeChargePlot(event);
00577   MakeTimingPlot(event);
00578 
00579   //Correction to the slope for Strip v Plane plots
00580   for (int i=0; i<(int)event->TrackList->GetEntries(); i++) {
00581     const AtmosTrack* track =
00582       dynamic_cast<const AtmosTrack*>(event->TrackList->At(i));
00583     assert(track);
00584 
00585     double VtxUStrip, VtxVStrip;
00586     VtxUStrip = StripFromT(fIsMC,track->VtxU);
00587     VtxVStrip = StripFromT(fIsMC,track->VtxV);
00588 
00589     TMarker MarkVtx(track->VtxPlane, VtxUStrip, 29);
00590     MarkVtx.SetMarkerColor(kRed);//Red for track vertex marker
00591     MarkVtx.SetMarkerSize(1.2);
00592     fUZStpPlnHits.push_back(MarkVtx);
00593     MarkVtx.SetY(VtxVStrip);
00594     fVZStpPlnHits.push_back(MarkVtx);
00595     MarkVtx.SetX(track->VtxX); MarkVtx.SetY(track->VtxY);
00596     fXYHits.push_back(MarkVtx);
00597     MSG("FarDetEvent",Msg::kDebug) << "Vertex Plane/U/V= " << track->VtxPlane << " - "
00598            << track->VtxU << ":" << VtxUStrip << " - "
00599            << track->VtxV << ":" << VtxVStrip << endl;
00600 
00601     double EndUStrip, EndVStrip;
00602     if (fIsMC) {
00603       EndUStrip = MCStripFromT(track->EndU);
00604       EndVStrip = MCStripFromT(track->EndV);
00605     }
00606     else {
00607       EndUStrip = DataStripFromT(track->EndU);
00608       EndVStrip = DataStripFromT(track->EndV);
00609     }
00610     TMarker MarkEnd(track->EndPlane, EndUStrip, 30);
00611     MarkEnd.SetMarkerColor(kRed);//Red for track vertex marker
00612     MarkEnd.SetMarkerSize(1.2);
00613     fUZStpPlnHits.push_back(MarkEnd);
00614     MarkEnd.SetY(EndVStrip);
00615     fVZStpPlnHits.push_back(MarkEnd);
00616     MarkEnd.SetX(track->EndX); MarkEnd.SetY(track->EndY);
00617     fXYHits.push_back(MarkEnd);
00618 
00619     //Save the divide by zero
00620     if(track->VtxDirCosU==1. || track->VtxDirCosV==1.) continue;
00621 
00622     //WTF kinda case
00623     if(track->VtxPlane==track->EndPlane) continue;
00624 
00625     //Call it forward if the VtxPlane is before the EndPlane
00626     bool IsForward = (track->VtxPlane < track->EndPlane);
00627 
00628     double VtxSlopeLUZ = track->VtxDirCosU / track->VtxDirCosZ;
00629 //unused double VtxSlopeLVZ = track->VtxDirCosV / track->VtxDirCosZ;
00630 //unused double VtxSlopeSPUZ = StpPlnFromTZ(fIsMC, VtxSlopeLUZ);
00631 //unused double VtxSlopeSPVZ = StpPlnFromTZ(fIsMC, VtxSlopeLVZ);
00632 
00633 //unused double EndSlopeLUZ = track->EndDirCosU / track->EndDirCosZ;
00634 //unused double EndSlopeLVZ = track->EndDirCosV / track->EndDirCosZ;
00635 //unused double EndSlopeSPUZ = StpPlnFromTZ(fIsMC, EndSlopeLUZ);
00636 //unused double EndSlopeSPVZ = StpPlnFromTZ(fIsMC, EndSlopeLVZ);
00637 
00638     double DPlane = (track->MaxPlaneNumber-track->MinPlaneNumber);
00639     DPlane = (DPlane > 6) ? DPlane * 0.3 : 3;
00640 
00641     double DZ = DPlane * P2Z;
00642 
00643     TArrow VtxArrow;
00644     VtxArrow.SetArrowSize(0.05);
00645     VtxArrow.SetLineColor(kRed);
00646     if (IsForward) {
00647       VtxArrow.SetX1(track->VtxPlane);
00648       VtxArrow.SetY1(StripFromT(fIsMC,track->VtxU));
00649       VtxArrow.SetX2(track->VtxPlane + DPlane);
00650       VtxArrow.SetY2(StripFromT(fIsMC, track->VtxU+VtxSlopeLUZ*DZ));
00651       fUZStpPlnLines.push_back((TLine)VtxArrow);
00652     }
00653 
00654     MSG("FarDetEvent",Msg::kDebug) << "Min/Max Plane = " << track->MinPlaneNumber << " - "
00655            << track->MaxPlaneNumber << endl;
00656     /*
00657     line.SetLineColor(kRed);
00658 
00659     double slope, Y1, Y2;
00660 
00661     slope = SlopeCorr * (NtpCosU2D / TMath::Sqrt(1.-(NtpCosU2D*NtpCosU2D)));
00662     Y1 = VtxUStrip-(slope*(double)(track->VtxPlane-track->MinPlaneNumber));
00663     Y2 = VtxUStrip+(slope*(double)(track->MaxPlaneNumber-track->VtxPlane));
00664     line.SetY1(Y1); line.SetY2(Y2);
00665     fUZStpPlnLines.push_back(line);
00666     MSG("FarDetEvent",Msg::kDebug) << "U Slope Y1/Y2 = " << slope << " - "
00667            << Y1 << ":" << Y2 << endl;
00668 
00669     slope = SlopeCorr * (NtpCosV2D / TMath::Sqrt(1.-(NtpCosV2D*NtpCosV2D)));
00670     Y1 = VtxVStrip-(slope*(double)(track->VtxPlane-track->MinPlaneNumber));
00671     Y2 = VtxVStrip+(slope*(double)(track->MaxPlaneNumber-track->VtxPlane));
00672     line.SetY1(Y1); line.SetY2(Y2);
00673     fVZStpPlnLines.push_back(line);
00674     MSG("FarDetEvent",Msg::kDebug) << "V Slope Y1/Y2 = " << slope << " - "
00675            << Y1 << ":" << Y2 << endl;
00676     */
00677 
00678     if(track->VtxPlane>fMaxPlane) fMaxPlane = track->VtxPlane;
00679     if(track->EndPlane>fMaxPlane) fMaxPlane = track->EndPlane;
00680     if(track->VtxPlane<fMinPlane) fMinPlane = track->VtxPlane;
00681     if(track->EndPlane<fMinPlane) fMinPlane = track->EndPlane;
00682     if(track->MaxPlaneNumber>fMaxPlane) fMaxPlane = track->MaxPlaneNumber;
00683     if(track->MinPlaneNumber<fMinPlane) fMinPlane = track->MinPlaneNumber;
00684 
00685     if(track->VtxZ>fMaxZ) fMaxZ = track->VtxZ;
00686     if(track->EndZ>fMaxZ) fMaxZ = track->EndZ;
00687     if(track->VtxZ<fMinZ) fMinZ = track->VtxZ;
00688     if(track->EndZ<fMinZ) fMinZ = track->EndZ;
00689   }
00690 
00691   for (int i=0; i<event->ShowerList->GetEntries(); i++) {
00692     const AtmosShower* shower =
00693       dynamic_cast<const AtmosShower*>(event->ShowerList->At(i));
00694     assert(shower);
00695     double ustrip, vstrip;
00696     if (fIsMC) {
00697       ustrip = MCStripFromT(shower->VtxU);
00698       vstrip = MCStripFromT(shower->VtxV);
00699     }
00700     else {
00701       ustrip = DataStripFromT(shower->VtxU);
00702       vstrip = DataStripFromT(shower->VtxV);
00703     }
00704     if(ustrip<0.0) ustrip = 0.0;
00705     if(vstrip<0.0) vstrip = 0.0;
00706     if(ustrip>192.0) ustrip = 192.0;
00707     if(vstrip>192.0) vstrip = 192.0;
00708 
00709     //Shower Vertex marker
00710     TMarker tmp(shower->VtxPlane, ustrip, 29);
00711     tmp.SetMarkerColor(kGreen);//Green for shower vertex markers
00712     tmp.SetMarkerSize(1.2);
00713     fUZStpPlnHits.push_back(tmp);
00714     tmp.SetY(vstrip);
00715     fVZStpPlnHits.push_back(tmp);
00716     tmp.SetX(shower->VtxX); tmp.SetY(shower->VtxY);
00717     fXYHits.push_back(tmp);
00718 
00719     //double NtpCosX = shower->VtxDirCosX;
00720     //double NtpCosY = shower->VtxDirCosY;
00721     double NtpCosZ = shower->VtxDirCosZ;
00722 
00723     double NtpCosU = shower->VtxDirCosU;
00724     double NtpCosV = shower->VtxDirCosV;
00725     MSG("FarDetEvent",Msg::kDebug) << "CosU/V = " << NtpCosU << ":" << NtpCosV << endl;
00726 
00727     double NtpCosU2D = NtpCosU / TMath::Sqrt(1. - NtpCosV*NtpCosV);
00728     double NtpCosV2D = NtpCosV / TMath::Sqrt(1. - NtpCosU*NtpCosU);
00729     NtpCosU2D = (NtpCosZ>0)?NtpCosU2D:-NtpCosU2D;
00730     NtpCosV2D = (NtpCosZ>0)?NtpCosV2D:-NtpCosV2D;
00731 
00732     TLine line(shower->MinPlaneNumber,0.,shower->MaxPlaneNumber,0.);
00733     line.SetLineColor(kGreen);
00734 
00735     double slope, Y1, Y2;
00736 
00737     //Draw the U shower direction line
00738     slope = StpPlnFromTZ(fIsMC, NtpCosU/NtpCosZ);
00739 
00740     Y1 = ustrip-(slope*(double)(shower->VtxPlane-shower->MinPlaneNumber));
00741     Y2 = ustrip+(slope*(double)(shower->MaxPlaneNumber-shower->VtxPlane));
00742     line.SetY1(Y1); line.SetY2(Y2);
00743     fUZStpPlnLines.push_back(line);
00744 
00745     //Draw the V shower direction line
00746     if(fIsMC) slope = MCStpPlnFromTZ(NtpCosV/NtpCosZ);
00747     else slope = DataStpPlnFromTZ(NtpCosV/NtpCosZ);
00748     Y1 = vstrip-(slope*(double)(shower->VtxPlane-shower->MinPlaneNumber));
00749     Y2 = vstrip+(slope*(double)(shower->MaxPlaneNumber-shower->VtxPlane));
00750     line.SetY1(Y1); line.SetY2(Y2);
00751     fVZStpPlnLines.push_back(line);
00752 
00753     if(shower->VtxPlane>fMaxPlane) fMaxPlane = shower->VtxPlane;
00754     if(shower->VtxPlane<fMinPlane) fMinPlane = shower->VtxPlane;
00755     if(shower->MaxPlaneNumber>fMaxPlane) fMaxPlane = shower->MaxPlaneNumber;
00756     if(shower->MinPlaneNumber<fMinPlane) fMinPlane = shower->MinPlaneNumber;
00757 
00758     if(shower->VtxZ>fMaxZ) fMaxZ = shower->VtxZ;
00759     if(shower->VtxZ<fMinZ) fMinZ = shower->VtxZ;
00760   }
00761 
00762   //Make the rest of the plots
00763   MakeMCPlot(event);
00764   MakeShieldPlot(event);
00765   MakeShowerPlot(event);
00766 
00767   cMainView->cd(1);
00768   hUZStpPlnAxis->Draw();
00769   for(UInt_t i=0;i<fUZStpPlnHits.size();i++) fUZStpPlnHits[i].Draw();
00770   for(UInt_t i=0;i<fUZStpPlnLines.size();i++) fUZStpPlnLines[i].Draw();
00771   cMainView->cd(2);
00772   hVZStpPlnAxis->Draw();
00773   for(UInt_t i=0;i<fVZStpPlnHits.size();i++) fVZStpPlnHits[i].Draw();
00774   for(UInt_t i=0;i<fVZStpPlnLines.size();i++) fVZStpPlnLines[i].Draw();
00775   cMainView->cd(3);
00776   hXYAxis->Draw();
00777   FarLayout *farlayout = new FarLayout();
00778   farlayout->Draw();
00779 
00780   for(UInt_t i=0; i<fXYHits.size(); ++i) fXYHits[i].Draw();
00781   for(UInt_t i=0; i<fXYLines.size(); ++i) fXYLines[i].Draw();
00782   cMainView->cd(4);
00783   hCorrPlaneCharge->Draw("hist");
00784   hRawPlaneCharge->Draw("same");
00785   UtilCanvas::FixPad(dynamic_cast<TPad*>(cMainView->cd(4)));
00786 
00787   cMainView->cd(5);
00788   float bound1(2.0), bound2(4.0), bound3(6.0), bound4(8.0), bound5(10.0);
00789   fKeySpots.clear();
00790   char temp[256];
00791   double height(0.96);
00792   static TLatex* latex = new TLatex();
00793   latex->SetTextFont(132);
00794   latex->SetTextSize(0.04);
00795   latex->SetLineWidth(2);
00796   sprintf(temp,"Key");
00797   latex->DrawLatex(0.1,height,temp);
00798   TMarker marker = TMarker(0.2,height+0.025,8);
00799   marker.SetMarkerColor(ChargeToColor(bound1-1.0));
00800   marker.SetMarkerStyle(20);
00801   marker.SetMarkerSize(1.1);
00802   fKeySpots.push_back(marker);
00803   sprintf(temp,"Summed NPEs < %.1f",bound1);
00804   latex->DrawLatex(0.3,height,temp);
00805   height -=0.035;
00806   marker = TMarker(0.2,height+0.025,8);
00807   marker.SetMarkerColor(ChargeToColor(0.5*(bound1+bound2)));
00808   marker.SetMarkerStyle(8);
00809   marker.SetMarkerSize(1.1);
00810   fKeySpots.push_back(marker);
00811   sprintf(temp,"%.1f < Summed NPEs < %.1f",bound1,bound2);
00812   latex->DrawLatex(0.3,height,temp);
00813   height -=0.035;
00814   marker = TMarker(0.2,height+0.025,8);
00815   marker.SetMarkerColor(ChargeToColor(0.5*(bound2+bound3)));
00816   marker.SetMarkerStyle(8);
00817   marker.SetMarkerSize(1.1);
00818   fKeySpots.push_back(marker);
00819   sprintf(temp,"%.1f < Summed NPEs < %.1f",bound2,bound3);
00820   latex->DrawLatex(0.3,height,temp);
00821   height -=0.035;
00822   marker = TMarker(0.2,height+0.025,8);
00823   marker.SetMarkerColor(ChargeToColor(0.5*(bound3+bound4)));
00824   marker.SetMarkerStyle(8);
00825   marker.SetMarkerSize(1.1);
00826   fKeySpots.push_back(marker);
00827   sprintf(temp,"%.1f < Summed NPEs < %.1f",bound3,bound4);
00828   latex->DrawLatex(0.3,height,temp);
00829   height -=0.035;
00830   marker = TMarker(0.2,height+0.025,8);
00831   marker.SetMarkerColor(ChargeToColor(0.5*(bound4+bound5)));
00832   marker.SetMarkerStyle(8);
00833   marker.SetMarkerSize(1.1);
00834   fKeySpots.push_back(marker);
00835   sprintf(temp,"%.1f < Summed NPEs < %.1f",bound4,bound5);
00836   latex->DrawLatex(0.3,height,temp);
00837   height -=0.035;
00838   marker = TMarker(0.2,height+0.025,8);
00839   marker.SetMarkerColor(ChargeToColor(bound5+0.5));
00840   marker.SetMarkerStyle(8);
00841   marker.SetMarkerSize(1.1);
00842   fKeySpots.push_back(marker);
00843   sprintf(temp,"Summed NPEs >= %.1f",bound5);
00844   latex->DrawLatex(0.3,height,temp);
00845   height -=0.035;
00846   marker = TMarker(0.2,height+0.025,28);
00847   marker.SetMarkerColor(1);
00848   marker.SetMarkerSize(1.1);
00849   fKeySpots.push_back(marker);
00850   latex->DrawLatex(0.3,height,"Single-Ended Hit");
00851   height -=0.035;
00852   marker = TMarker(0.2,height+0.025,24);
00853   marker.SetMarkerColor(2);
00854   marker.SetMarkerSize(1.1);
00855   fKeySpots.push_back(marker);
00856   latex->DrawLatex(0.3,height,"Reconstructed Track Hit");
00857   height -=0.035;
00858   marker = TMarker(0.2,height+0.025,25);
00859   marker.SetMarkerColor(4);
00860   marker.SetMarkerSize(1.1);
00861   fKeySpots.push_back(marker);
00862   latex->DrawLatex(0.3,height,"Reconstructed Shower Hit");
00863   height -=0.035;
00864   marker = TMarker(0.2,height+0.025,29);
00865   marker.SetMarkerColor(kRed);
00866   marker.SetMarkerSize(1.1);
00867   fKeySpots.push_back(marker);
00868   latex->DrawLatex(0.3,height,"Reconstructed Track Vertex");
00869   height -=0.035;
00870   marker = TMarker(0.2,height+0.025,29);
00871   marker.SetMarkerColor(kGreen);
00872   marker.SetMarkerSize(1.1);
00873   fKeySpots.push_back(marker);
00874   latex->DrawLatex(0.3,height,"Reconstructed Shower Vertex");
00875   height -=0.05;
00876   for(unsigned int i=0; i<fKeySpots.size(); ++i) fKeySpots[i].Draw();
00877 
00878   static char tmp_line[1024];
00879   static TLatex* latex2 = new TLatex();
00880   snprintf(tmp_line, 1024, "Run : %d-%d   Snarl: %d  Trk: %d Shw: %d",
00881     event->Run, event->SubRun, event->Snarl,
00882     event->NTracks, event->NShowers);
00883   latex2->SetTextSize(0.04);
00884   latex2->DrawLatex(0.1, height, tmp_line);
00885   height-=0.05;
00886   latex2->SetTextSize(0.03);
00887 
00888   double currenty = height;//0.850;
00889 
00890   //Report the tracks
00891   for (int i = 0; i<event->TrackList->GetEntries(); i++) {
00892     const AtmosTrack* track =
00893       dynamic_cast<const AtmosTrack*>(event->TrackList->At(i));
00894     latex2->DrawLatex(0.01, currenty, Form(
00895       "Trk%s NS:%d NP:%d R:%2.1f Dir:{%0.3f,%0.3f,%0.3f} Vtx:{%0.2f,%0.2f,%0.2f}",
00896       "Pri",
00897       track->Nstrips, track->Nplanes, track->Momentum,
00898       track->VtxDirCosX, track->VtxDirCosY, track->VtxDirCosZ,
00899       track->VtxX, track->VtxY, track->VtxZ));
00900     currenty-=0.025;
00901   }
00902   /*
00903   if (event->NTracks==1) {
00904     const AtmosTrack* track = dynamic_cast<const AtmosTrack*>(event->TrackList->At(0));
00905     snprintf(tmp_line, 1024, "P: %2.2f  Sqp: %2.2f",  track->Momentum, track->AtNuQPmean / track->AtNuQPerr);
00906     latex2->DrawLatex(0.1, height, tmp_line);
00907     height-=0.025;
00908     snprintf(tmp_line, 1024, "ChiVtx: %2.2f ChiEnd: %2.2f DChi: %2.2f",  track->AtNuVtxDirTimeFitChisq, track->AtNuEndDirTimeFitChisq,track->AtNuVtxDirTimeFitChisq-track->AtNuEndDirTimeFitChisq);
00909     latex2->DrawLatex(0.1, height, tmp_line);
00910     height-=0.025;
00911     snprintf(tmp_line, 1024, "Dcos:  %2.2f   %2.2f   %2.2f", track->VtxDirCosX,track->VtxDirCosY,track->VtxDirCosZ);
00912     latex2->DrawLatex(0.1, height, tmp_line);
00913     height-=0.025;
00914   }
00915   */
00916     currenty-=0.025;
00917 
00918   //Report the showers
00919   for (int i=0; i<event->ShowerList->GetEntries(); i++) {
00920     const AtmosShower* shower =
00921       dynamic_cast<const AtmosShower*>(event->ShowerList->At(i));
00922     latex2->DrawLatex(0.01, currenty, Form(
00923       "Shw%s NS:%d NP:%d E:%2.1f Dir:{%0.3f,%0.3f,%0.3f} Vtx:{%0.2f,%0.2f,%0.2f}",
00924       "Pri",
00925       shower->Nstrips, shower->Nplanes, shower->Energy,
00926       shower->VtxDirCosX, shower->VtxDirCosY, shower->VtxDirCosZ,
00927       shower->VtxX, shower->VtxY, shower->VtxZ));
00928     currenty-=0.025;
00929   }
00930 
00931   /*
00932   currenty-=0.025;
00933   for (int i=0;i<3;i++) {
00934     sprintf(tmp_line,"EV:%0.3f:(%0.3f,%0.3f,%0.3f)",
00935       SSMap.AllEVal[1][i],    SSMap.AllEVec[1][i][0],
00936       SSMap.AllEVec[1][i][1], SSMap.AllEVec[1][i][2]);
00937     latex2->DrawLatex(0.01, currenty, tmp_line);
00938     currenty-=0.025;
00939   }
00940   */
00941 
00942   currenty-=0.025;
00943   /*
00944   if (event->NShieldPlanks>0) {
00945     VetoShower vshw(event);
00946     VetoTrack vtrk(event);
00947     latex2->DrawLatex(0.01, currenty, 
00948       Form("NPlanks:%d, Trk(SS,SM):%2.0f,%2.0f Shw(SS,SM):%2.0f,%2.0f",
00949        event->NShieldPlanks, vtrk.VetoQCorrSS,
00950        vtrk.SectionQInTime[0] + vtrk.SectionQInTime[1] +
00951        vtrk.SectionQInTime[2] + vtrk.SectionQInTime[3],
00952        vshw.VetoQCorrSS,
00953        vtrk.SectionQInTime[0] + vtrk.SectionQInTime[1] +
00954        vtrk.SectionQInTime[2] + vtrk.SectionQInTime[3]));
00955     currenty-=0.027;
00956 
00957     MSG("FarDetEvent",Msg::kSynopsis) << "VetoQPlank50cm[] =";
00958     for (int i=0; i<5; i++) {
00959       MSG("FarDetEvent",Msg::kSynopsis) << " " << vshw.VetoQPlank50cmZ[i];
00960     }
00961     MSG("FarDetEvent",Msg::kSynopsis) << endl;
00962   }
00963   */
00964 
00965   latex2->DrawLatex(0.01, currenty, 
00966     Form("Nstrips:%d Nplanks:%d Ndeadchips:%d",event->NStrips,event->NShieldPlanks,event->NDeadChips) );
00967   currenty-=0.027;
00968 
00969   currenty-=0.025;
00970 
00971   if (event->FilterInfo.EventId == 0) {
00972     latex2->DrawLatex(0.01, currenty, "Digit Containment: FC");
00973     currenty-=0.027;
00974   }
00975   else if(event->FilterInfo.EventId == 1) {
00976     latex2->DrawLatex(0.01, currenty,
00977        Form("Digit Containment: PC (NonFidPE=%2.2f TotPE=%2.2f)",
00978          event->FilterInfo.TotalCharge - event->FilterInfo.FidCharge,
00979          event->FilterInfo.TotalCharge));
00980     currenty-=0.027;
00981   }
00982   else if(event->FilterInfo.EventId == 2) {
00983     latex2->DrawLatex(0.01, currenty,
00984        Form("Digit Containment: Through-Going (NonFidPE=%2.2f TotPE=%2.2f)",
00985          event->FilterInfo.TotalCharge - event->FilterInfo.FidCharge,
00986          event->FilterInfo.TotalCharge));
00987     currenty-=0.027;
00988   }
00989   else {
00990     latex2->DrawLatex(0.01, currenty, 
00991        Form("Digit Containment: doesn't enter fiducial volume" ) );
00992     currenty-=0.027;
00993   }
00994 
00995   /*
00996   for (int i=0; i<event->NShieldPlanks; ++i) {
00997     const AtmosShieldPlank* plank = dynamic_cast<const AtmosShieldPlank*>(event->ShieldPlankList->At(i));
00998     sprintf(tmp_line, "Q:%2.2f %2.2f TR: %2.2e %2.2e T:%2.2e %2.2e S:%d P:%2.2f %2.2f",
00999             plank->QPE[0], plank->QPE[1],
01000             plank->Tcorr[0]-event->NanoSec, plank->Tcorr[1]-event->NanoSec,
01001             //plank->Tcorr[0]-event->Shield.AbsTime, plank->Tcorr[1]-event->Shield.AbsTime,
01002             999.0, 999.0,
01003             //plank->DTime[0], plank->DTime[1],
01004             plank->Section,  plank->X,  plank->Y);
01005 
01006     latex2->DrawLatex(0.01, currenty, tmp_line);
01007     currenty-=0.027;
01008   }
01009   */
01010   currenty-=0.025;
01011 
01012   MSG("FarDetEvent",Msg::kSynopsis) << "Number of DeadChips = " << event->NDeadChips << endl;
01013   for (int i=0; i<event->NDeadChips; i++) {
01014     const AtmosDeadChip* chip = dynamic_cast<const AtmosDeadChip*>
01015                                 (event->DeadChipList->At(i));
01016 
01017     int BusyDead = -1;
01018     if( ((chip->Status)&(0x08))==(0x08) ) BusyDead = 1;
01019     else if( ((chip->Status)&(0x02))==(0x02) ) BusyDead = 0;
01020 
01021     if( BusyDead==0 || BusyDead==1 ){
01022       sprintf(tmp_line, "%d/%d/%d/%d/%d Plns:%d,%d Status:%c%c%c%c",
01023         chip->Crate, chip->Varc, chip->Vmm,
01024         chip->VaAdc, chip->VaChip, chip->Plane[0], chip->Plane[1],
01025         (BusyDead)?'B':'D',(BusyDead)?'u':'e',(BusyDead)?'s':'a',(BusyDead)?'y':'d');
01026       if ((i%2)==0) {
01027         latex2->DrawLatex(0.01, currenty, tmp_line);
01028       }
01029       else {
01030         latex2->DrawLatex(0.5, currenty, tmp_line);
01031         currenty-=0.025;
01032       }
01033     }
01034 
01035   }
01036 
01037   cMainView->cd(6);
01038 
01039   hTZAxis->Draw();
01040   for(unsigned int i=0; i<fTZHits.size(); i++)  fTZHits[i].Draw();
01041 
01042   TText tt;
01043   tt.SetTextAlign(31);
01044   //tt.SetTextSize(0.06);
01045   tt.SetNDC();
01046   tt.SetTextColor(kRed);
01047   cSideView->cd(1);
01048   hUZLinearAxis->Draw();
01049   tt.DrawText(0.9,0.95, Form("U Transverse Position (%d strips)",
01050                         fUZLinearHitsT.size()));
01051   for(UInt_t i=0;i<fUZLinearHitsT.size();i++) fUZLinearHitsT[i].Draw();
01052   for(UInt_t i=0;i<fUZLinearLinesT.size();i++) fUZLinearLinesT[i].Draw();
01053   cSideView->cd(2);
01054   hVZLinearAxis->Draw();
01055   tt.DrawText(0.9,0.95, Form("V Transverse Position (%d strips)",
01056                         fVZLinearHitsT.size()));
01057   for(UInt_t i=0;i<fVZLinearHitsT.size();i++) fVZLinearHitsT[i].Draw();
01058   for(UInt_t i=0;i<fVZLinearLinesT.size();i++) fVZLinearLinesT[i].Draw();
01059   cSideView->cd(3);
01060   hUZLinearAxis->Draw();
01061   tt.DrawText(0.9,0.95, Form("V Longitudinal Position (%d strips)",
01062                         fVZLinearHitsL.size()));
01063   for(UInt_t i=0;i<fVZLinearHitsL.size();i++) fVZLinearHitsL[i].Draw();
01064   for(UInt_t i=0;i<fUZLinearLinesL.size();i++) fUZLinearLinesL[i].Draw();
01065   cSideView->cd(4);
01066   hVZLinearAxis->Draw();
01067   tt.DrawText(0.9,0.95, Form("U Longitudinal Position (%d strips)",
01068                         fUZLinearHitsL.size()));
01069   for(UInt_t i=0;i<fUZLinearHitsL.size();i++) fUZLinearHitsL[i].Draw();
01070   for(UInt_t i=0;i<fVZLinearLinesL.size();i++) fVZLinearLinesL[i].Draw();
01071 
01072   cLIView->cd();
01073   cLIView->SetTheta(45);
01074   cLIView->SetPhi(225);
01075   hPulserLedCharge->Draw("lego2");
01076 
01077   UnZoom();
01078 
01079   if(fAutoPrint) DoPrint();
01080 
01081   return(true);
01082 }
01083 
01084 void CamEvd::Reset() {
01085   //Fix the min and max values to opposite ranges
01086   fMinUStrip = 191; fMaxUStrip = 0;
01087   fMinVStrip = 191; fMaxVStrip = 0;
01088   fMinPlane = 485; fMaxPlane = 1;
01089   fMinU = 4.0; fMaxU = -4.0;
01090   fMinV = 4.0; fMaxV = -4.0;
01091   fMinZ = 30.0; fMaxZ = 0.;
01092   fMinT = 99e99; fMaxT = 0.;
01093 
01094   //Clear the hit and line vectors
01095   fTZHits.clear();
01096   fUZStpPlnHits.clear();
01097   fUZLinearHitsT.clear();
01098   fUZLinearHitsL.clear();
01099   fUZStpPlnLines.clear();
01100   fVZStpPlnHits.clear();
01101   fVZLinearHitsT.clear();
01102   fVZLinearHitsL.clear();
01103   fVZStpPlnLines.clear();
01104   fXYHits.clear();
01105   fXYLines.clear();
01106 
01107   cMainView->Clear();
01108   cMainView->Divide(3,2);
01109 }
01110 
01111 void CamEvd::MakeXYHits(const AtmosEvent* event) {
01112 
01113   for (int i=0; i<(int)event->StripList->GetEntries(); i++) {
01114     const AtmosStrip* strip =
01115       dynamic_cast<const AtmosStrip*>(event->StripList->At(i));
01116     assert(strip);
01117 
01118     double U = (strip->View == 0) ? strip->T : strip->L;
01119     double V = (strip->View == 1) ? strip->T : strip->L;
01120 
01121     TMarker tmp(C45*(U-V), C45*(U+V), 20);
01122     tmp.SetMarkerSize(0.7);
01123 
01124     tmp.SetMarkerColor(ChargeToColor((strip->QPEcorr[1]+strip->QPEcorr[0])));
01125     fXYHits.push_back(tmp);
01126   }
01127 
01128 
01129   int topplane(-999);
01130   float toptime(0.0);
01131   float topX(0.0),topY(0.0),topZ(-999.9),topZ2(-999.9);
01132   double dircosX(0),dircosY(0),dircosZ(0);
01133 
01134   double dTcorr[2];
01135 
01136   const AtmosTrack* track =
01137     dynamic_cast<const AtmosTrack*>(event->TrackList->At(0));
01138 
01139   const AtmosShower* shower =
01140     dynamic_cast<const AtmosShower*>(event->ShowerList->At(0));
01141 
01142   if ( track ) {
01143     if( track->VtxY<track->EndY ) { 
01144       toptime = track->EndTime;
01145       topplane = track->EndPlane;
01146       topX = track->EndX; 
01147       topY = track->EndY; 
01148       topZ = track->EndZ;; 
01149       dircosX = -track->EndDirCosX; 
01150       dircosY = -track->EndDirCosY; 
01151       dircosZ = -track->EndDirCosZ;
01152     }
01153     else { 
01154       toptime = track->VtxTime; 
01155       topplane = track->VtxPlane;
01156       topX = track->VtxX; 
01157       topY = track->VtxY; 
01158       topZ = track->VtxZ; 
01159       dircosX = track->VtxDirCosX; 
01160       dircosY = track->VtxDirCosY; 
01161       dircosZ = track->VtxDirCosZ;
01162     }
01163   }
01164   else if( shower ) {
01165     toptime = shower->VtxTime; 
01166     topplane = shower->VtxPlane;
01167     topX = shower->VtxX; 
01168     topY = shower->VtxY; 
01169     topZ = shower->VtxZ; 
01170   }
01171 
01172   bool PlankInTime,PlankInTime0;
01173   bool HighestEndBelowShieldSection;
01174   double TravelTimeShield2Vertex;
01175 
01176   for (int i=0; i<event->NShieldPlanks; ++i) {
01177     const AtmosShieldPlank* plank =
01178       dynamic_cast<const AtmosShieldPlank*>(event->ShieldPlankList->At(i));
01179     if(!plank) break;
01180 
01181     PlankInTime0 = 0;
01182     PlankInTime = 0;
01183     HighestEndBelowShieldSection = 0;
01184 
01185     dTcorr[0] = plank->Tcal[0];
01186     dTcorr[1] = plank->Tcal[1];
01187 
01188     if( track || shower ){
01189 
01190       if( topZ<plank->Z[0]+0.5 && topZ>plank->Z[1]-0.5 ){
01191         HighestEndBelowShieldSection = 1;
01192       }
01193 
01194       if( !HighestEndBelowShieldSection && plank->Y>topY-0.1 ){
01195         if( ( topplane>228 && topplane<249 
01196            && topZ<plank->Z[0]+0.5 && topZ>plank->Z[1]-2.5 ) 
01197          || ( topplane>249 && topplane<270 
01198            && topZ<plank->Z[0]+2.5 && topZ>plank->Z[1]-0.5 ) ){
01199           HighestEndBelowShieldSection = 1;
01200         }
01201       }
01202   
01203       if( !HighestEndBelowShieldSection && plank->Y>topY-0.1 && track ){
01204         if( ( topplane>228 && topplane<249 && dircosZ<0.0 ) 
01205          || ( topplane>249 && topplane<270 && dircosZ>0.0 ) ){
01206           if( dircosY!=0 ){
01207             topZ2 = topZ + (dircosZ/dircosY)*(plank->Y-topY);
01208             if( topZ2<plank->Z[0]+0.5 && topZ2>plank->Z[1]-0.5 ){
01209               HighestEndBelowShieldSection = 1;
01210             }
01211           }
01212         }
01213       }
01214 
01215       TravelTimeShield2Vertex = ( 1.0/SoL )*pow( (plank->X - topX)*(plank->X - topX) + (plank->Y - topY)*(plank->Y - topY), 0.5);
01216 
01217       dTcorr[0] = plank->Tcal[0] - ( fWlsFibreN/SoL )*( plank->WlsPigtail[0] + (plank->Z[0] - topZ) ) - ( fClearFibreN/SoL )*( plank->ClearFibre[0] ) + 26.e-9 + TravelTimeShield2Vertex - toptime;
01218 
01219       dTcorr[1] = plank->Tcal[1] - ( fWlsFibreN/SoL )*( plank->WlsPigtail[1] - (plank->Z[1] - topZ) ) - ( fClearFibreN/SoL )*( plank->ClearFibre[1] ) + 26.e-9 + TravelTimeShield2Vertex - toptime;
01220 
01221     }
01222 
01223     if( ( fabs(dTcorr[0])<10000e-9 && plank->QPE[0]>0.0 ) 
01224      || ( fabs(dTcorr[1])<10000e-9 && plank->QPE[1]>0.0 ) ) PlankInTime0 = 1;
01225 
01226     if( ( fabs(dTcorr[0])<100e-9 && plank->QPE[0]>0.0 )
01227      || ( fabs(dTcorr[1])<100e-9 && plank->QPE[1]>0.0 ) ) PlankInTime = 1;
01228     
01229     if( PlankInTime0 ){
01230       TMarker tmp(plank->X, plank->Y, 24);
01231       if( PlankInTime ) tmp.SetMarkerStyle(20);
01232 
01233       if( HighestEndBelowShieldSection ) tmp.SetMarkerColor(2);
01234       else tmp.SetMarkerColor(1);
01235       tmp.SetMarkerSize(0.7);
01236     
01237       fXYHits.push_back(tmp);
01238     }
01239   }
01240 
01241 }
01242 
01243 void CamEvd::MakeUVHits(const AtmosEvent* event) {
01244   for (int i=0; i<event->StripList->GetEntries(); i++) {
01245     const AtmosStrip* strip =
01246       dynamic_cast<const AtmosStrip*>(event->StripList->At(i));
01247     assert(strip);
01248     double stripPEcorr = strip->QPEcorr[0] + strip->QPEcorr[1];
01249     int marker = (strip->Qadc[0]>0.0 && strip->Qadc[1]>0.0)?20:28;
01250 
01251     if(strip->Plane>fMaxPlane) fMaxPlane = strip->Plane;
01252     if(strip->Plane<fMinPlane) fMinPlane = strip->Plane;
01253 
01254     if(strip->Z>fMaxZ) fMaxZ = strip->Z;
01255     if(strip->Z<fMinZ) fMinZ = strip->Z;
01256 
01257     TMarker tMLinearT(strip->Z, strip->T, marker);
01258     TMarker tMLinearL(strip->Z, strip->L, marker);
01259     TMarker tMPlnStp(strip->Plane, strip->Strip, marker);
01260     tMLinearT.SetMarkerColor(ChargeToColor(stripPEcorr));
01261     tMLinearL.SetMarkerColor(ChargeToColor(stripPEcorr));
01262     tMPlnStp.SetMarkerColor(ChargeToColor(stripPEcorr));
01263     if (strip->View==0) {
01264       if(strip->L < fMinV) fMinV = strip->L;
01265       if(strip->L > fMaxV) fMaxV = strip->L;
01266       if(strip->T < fMinU) fMinU = strip->T;
01267       if(strip->T > fMaxU) fMaxU = strip->T;
01268       if(strip->Strip < fMinUStrip) fMinUStrip = strip->Strip;
01269       if(strip->Strip > fMaxUStrip) fMaxUStrip = strip->Strip;
01270       tMPlnStp.SetMarkerSize(0.7);
01271       tMLinearT.SetMarkerSize(0.7);
01272       tMLinearL.SetMarkerSize(0.7);
01273       fUZStpPlnHits.push_back(tMPlnStp);
01274       fUZLinearHitsT.push_back(tMLinearT);
01275       fUZLinearHitsL.push_back(tMLinearL);
01276       if (strip->Trk) {
01277         tMPlnStp.SetMarkerStyle(24);
01278         tMLinearT.SetMarkerStyle(24);
01279         tMLinearL.SetMarkerStyle(24);
01280         tMPlnStp.SetMarkerColor(kRed);
01281         tMLinearT.SetMarkerColor(kRed);
01282         tMLinearL.SetMarkerColor(kRed);
01283         tMPlnStp.SetMarkerSize(1.2);
01284         tMLinearT.SetMarkerSize(1.2);
01285         tMLinearL.SetMarkerSize(1.2);
01286         fUZStpPlnHits.push_back(tMPlnStp);
01287         fUZLinearHitsT.push_back(tMLinearT);
01288         fUZLinearHitsL.push_back(tMLinearL);
01289       }
01290       if (strip->Shw) {
01291         tMPlnStp.SetMarkerStyle(25);
01292         tMLinearT.SetMarkerStyle(25);
01293         tMLinearL.SetMarkerStyle(25);
01294         tMPlnStp.SetMarkerColor(kRed);
01295         tMLinearT.SetMarkerColor(kRed);
01296         tMLinearL.SetMarkerColor(kRed);
01297         tMPlnStp.SetMarkerSize(1.2);
01298         tMLinearT.SetMarkerSize(1.2);
01299         tMLinearL.SetMarkerSize(1.2);
01300         fUZStpPlnHits.push_back(tMPlnStp);
01301         fUZLinearHitsT.push_back(tMLinearT);
01302         fUZLinearHitsL.push_back(tMLinearL);
01303       }
01304     }
01305     if (strip->View==1) {
01306       if(strip->L < fMinU) fMinU = strip->L;
01307       if(strip->L > fMaxU) fMaxU = strip->L;
01308       if(strip->T < fMinV) fMinV = strip->T;
01309       if(strip->T > fMaxV) fMaxV = strip->T;
01310       if(strip->Strip < fMinVStrip) fMinVStrip = strip->Strip;
01311       if(strip->Strip > fMaxVStrip) fMaxVStrip = strip->Strip;
01312       tMPlnStp.SetMarkerSize(0.7);
01313       tMLinearT.SetMarkerSize(0.7);
01314       tMLinearL.SetMarkerSize(0.7);
01315       fVZStpPlnHits.push_back(tMPlnStp);
01316       fVZLinearHitsT.push_back(tMLinearT);
01317       fVZLinearHitsL.push_back(tMLinearL);
01318       if (strip->Trk) {
01319         tMPlnStp.SetMarkerStyle(24);
01320         tMLinearT.SetMarkerStyle(24);
01321         tMLinearL.SetMarkerStyle(24);
01322         tMPlnStp.SetMarkerColor(kRed);
01323         tMLinearT.SetMarkerColor(kRed);
01324         tMLinearL.SetMarkerColor(kRed);
01325         tMPlnStp.SetMarkerSize(1.2);
01326         tMLinearT.SetMarkerSize(1.2);
01327         tMLinearL.SetMarkerSize(1.2);
01328         fVZStpPlnHits.push_back(tMPlnStp);
01329         fVZLinearHitsT.push_back(tMLinearT);
01330         fVZLinearHitsL.push_back(tMLinearL);
01331       }
01332       if (strip->Shw) {
01333         tMPlnStp.SetMarkerStyle(25);
01334         tMLinearT.SetMarkerStyle(25);
01335         tMLinearL.SetMarkerStyle(25);
01336         tMPlnStp.SetMarkerColor(kRed);
01337         tMLinearT.SetMarkerColor(kRed);
01338         tMLinearL.SetMarkerColor(kRed);
01339         tMPlnStp.SetMarkerSize(1.2);
01340         tMLinearT.SetMarkerSize(1.2);
01341         tMLinearL.SetMarkerSize(1.2);
01342         fVZStpPlnHits.push_back(tMPlnStp);
01343         fVZLinearHitsT.push_back(tMLinearT);
01344         fVZLinearHitsL.push_back(tMLinearL);
01345       }
01346     }
01347   }
01348 }
01349 
01350 void CamEvd::MakeChargePlot(const AtmosEvent* event) {
01351   hRawPlaneCharge->Reset();
01352   hCorrPlaneCharge->Reset();
01353   hPulserLedCharge->Reset();
01354   for (int i=0; i<(int)event->StripList->GetEntries(); i++) {
01355     const AtmosStrip* strip =
01356       dynamic_cast<const AtmosStrip*>(event->StripList->At(i));
01357     assert(strip);
01358     hRawPlaneCharge->Fill(strip->Plane,
01359       (strip->QPE[1]+strip->QPE[0]));
01360     hCorrPlaneCharge->Fill(strip->Plane,
01361       (strip->QPEcorr[1]+strip->QPEcorr[0]));
01362     hPulserLedCharge->Fill(2*PlaneBlock(strip->Plane),
01363       StripBlock(strip->Strip), strip->QPEcorr[0]);
01364     hPulserLedCharge->Fill(1 + (2*PlaneBlock(strip->Plane)),
01365       StripBlock(strip->Strip), strip->QPEcorr[1]);
01366   }
01367 
01368   return;
01369 }
01370 
01371 void CamEvd::MakeTimingPlot(const AtmosEvent* event) {
01372   //loop over all the strips
01373   fMeanDEHitDT = fRMSDEHitDT = 0.0;
01374   int NDEHits = 0;
01375   fMinT = 1000.0;
01376   fMaxT = -1000.0;
01377   for (int i=0; i<(int)event->StripList->GetEntries(); i++) {
01378     const AtmosStrip* strip =
01379       dynamic_cast<const AtmosStrip*>(event->StripList->At(i));
01380     assert(strip);
01381 
01382     int MarkerStyle[2] = {kOpenTriangleUp, kOpenSquare};
01383     double Times[2] = {0.0, 0.0};
01384     int NEnds = 0;
01385     for (int iend=0; iend<2; iend++) {
01386       if (strip->Qadc[iend]>0.0) {
01387         NEnds++;
01388         //double ThisTcorr = strip->Tcorr[iend];
01389         double ThisT = strip->Tcal[iend];
01390         if (fDoTimeCorr1) {
01391           ThisT -= (strip->WlsPigtail[iend]) * fWlsFibreN / SoL;
01392           ThisT -= (strip->ClearFibre[iend]) * fClearFibreN / SoL;
01393         }
01394         if (fDoTimeCorr2) {
01395           ThisT -= strip->HalfLength * fWlsFibreN / SoL;
01396           const double ThisL = strip->L;
01397           if(TMath::Abs(ThisL) < strip->HalfLength)
01398             ThisT -= ((strip->View ^ iend) ? ThisL : -ThisL) * fWlsFibreN / SoL;
01399         }
01400         ThisT = ThisT * 1e9;//Convert to nanoseconds
01401         Times[iend] = ThisT;
01402         if(ThisT<fMinT) fMinT = ThisT;
01403         if(ThisT>fMaxT) fMaxT = ThisT;
01404         TMarker tmpm(strip->Plane, ThisT, MarkerStyle[iend]);
01405         tmpm.SetMarkerSize(1.0);
01406         tmpm.SetMarkerColor(ChargeToColor((strip->QPEcorr[1]+
01407                                             strip->QPEcorr[0])));
01408         fTZHits.push_back(tmpm);
01409       }
01410     }
01411     if (NEnds == 2) {
01412       double DT = TMath::Abs(Times[0] - Times[1]);
01413       fMeanDEHitDT += DT;
01414       fRMSDEHitDT += DT * DT;
01415       NDEHits++;
01416     }
01417   }
01418 
01419   if (NDEHits > 0) {
01420     fMeanDEHitDT /= (double)NDEHits;
01421 
01422     fRMSDEHitDT /= (double)NDEHits;
01423   }
01424 
01425   fRMSDEHitDT -= fMeanDEHitDT * fMeanDEHitDT;
01426   if(fRMSDEHitDT<0.0) fRMSDEHitDT = 0.0;
01427   else fRMSDEHitDT = TMath::Sqrt(fRMSDEHitDT);
01428 
01429   MSG("FarDetEvent",Msg::kSynopsis) << "Mean DE Hit DT = " << fMeanDEHitDT << endl;
01430   MSG("FarDetEvent",Msg::kSynopsis) << "RMS DE Hit DT = " << fRMSDEHitDT << endl;
01431 
01432   fMaxT -= fMinT;
01433   for (unsigned int i=0; i<fTZHits.size(); i++) {
01434     fTZHits[i].SetY(fTZHits[i].GetY() - fMinT);
01435   }
01436   fMinT = 0.0;
01437 }
01438 
01439 void CamEvd::MakeShieldPlot(const AtmosEvent* event) {
01440   cShieldView->Clear("D");
01441   if(!fDoShieldPlot) return;
01442   if(event->NScintHits != 0) return;//Only look at data
01443 
01444   for(int i=0; i<4; i++) {
01445     hTrkVeto[i]->Reset("ICE");
01446     hShwVeto[i]->Reset("ICE");
01447   }
01448 
01449   for(int i=0; i<4; ++i) {
01450     hTrkVeto[i]->SetLineColor(1);
01451   }
01452 
01453   static vector<TMarker> ShieldHits; ShieldHits.clear();
01454   
01455   cShieldView->cd(5);
01456   double currenty = 0.96;
01457   static TLatex* latex = new TLatex(); 
01458   latex->SetTextColor(1);
01459   latex->SetTextSize(0.04);
01460   latex->SetLineWidth(2);
01461   char temp[256];
01462   sprintf(temp,"SHIELD HITS");
01463   latex->DrawLatex(0.1,currenty,temp);
01464   latex->SetTextSize(0.03);
01465   static char temp_line[1024];
01466   
01467   int topplane(-999);
01468   float toptime(0.0);
01469   float topX(0.0),topY(0.0),topZ(-999.9),topZ2(-999.9);
01470   double dircosX(0),dircosY(0),dircosZ(0);
01471 
01472   double dTcorr[2];
01473 
01474   const AtmosTrack* track =
01475     dynamic_cast<const AtmosTrack*>(event->TrackList->At(0));
01476 
01477   const AtmosShower* shower =
01478     dynamic_cast<const AtmosShower*>(event->ShowerList->At(0));
01479 
01480   if ( track ) {
01481     if( track->VtxY<track->EndY ) { 
01482       toptime = track->EndTime;
01483       topplane = track->EndPlane;
01484       topX = track->EndX; 
01485       topY = track->EndY; 
01486       topZ = track->EndZ;; 
01487       dircosX = -track->EndDirCosX; 
01488       dircosY = -track->EndDirCosY; 
01489       dircosZ = -track->EndDirCosZ;
01490     }
01491     else { 
01492       toptime = track->VtxTime; 
01493       topplane = track->VtxPlane;
01494       topX = track->VtxX; 
01495       topY = track->VtxY; 
01496       topZ = track->VtxZ; 
01497       dircosX = track->VtxDirCosX; 
01498       dircosY = track->VtxDirCosY; 
01499       dircosZ = track->VtxDirCosZ;
01500     }
01501   }
01502   else if( shower ) {
01503     toptime = shower->VtxTime; 
01504     topplane = shower->VtxPlane;
01505     topX = shower->VtxX; 
01506     topY = shower->VtxY; 
01507     topZ = shower->VtxZ; 
01508   }
01509 
01510   currenty-=0.025;
01511   
01512   bool PlankInTime,PlankInTime0;
01513   bool HighestEndBelowShieldSection;
01514   double TravelTimeShield2Vertex;
01515 
01516   for (int i=0; i<event->ShieldPlankList->GetEntries(); i++) {
01517     const AtmosShieldPlank* plank = dynamic_cast<const AtmosShieldPlank*>(event->ShieldPlankList->At(i));
01518     assert(plank);
01519 
01520     PlankInTime0 = 0;
01521     PlankInTime = 0;
01522     HighestEndBelowShieldSection = 0;
01523 
01524     dTcorr[0] = plank->Tcal[0];
01525     dTcorr[1] = plank->Tcal[1];
01526 
01527     if( track || shower ){
01528 
01529       if( topZ<plank->Z[0]+0.5 && topZ>plank->Z[1]-0.5 ){
01530         HighestEndBelowShieldSection = 1;
01531       }
01532 
01533       if( !HighestEndBelowShieldSection && plank->Y>topY-0.1 ){
01534         if( ( topplane>228 && topplane<249 
01535            && topZ<plank->Z[0]+0.5 && topZ>plank->Z[1]-2.5 ) 
01536          || ( topplane>249 && topplane<270 
01537            && topZ<plank->Z[0]+2.5 && topZ>plank->Z[1]-0.5 ) ){
01538           HighestEndBelowShieldSection = 1;
01539         }
01540       }
01541   
01542       if( !HighestEndBelowShieldSection && plank->Y>topY-0.1 && track ){
01543         if( ( topplane>228 && topplane<249 && dircosZ<0.0 ) 
01544          || ( topplane>249 && topplane<270 && dircosZ>0.0 ) ){
01545           if( dircosY!=0 ){
01546             topZ2 = topZ + (dircosZ/dircosY)*(plank->Y-topY);
01547             if( topZ2<plank->Z[0]+0.5 && topZ2>plank->Z[1]-0.5 ){
01548               HighestEndBelowShieldSection = 1;
01549             }
01550           }
01551         }
01552       }
01553 
01554       TravelTimeShield2Vertex = (1.0/SoL)*pow( (plank->X - topX)*(plank->X - topX) + (plank->Y - topY)*(plank->Y - topY), 0.5);
01555 
01556       dTcorr[0] = plank->Tcal[0] - ( fWlsFibreN/SoL )*( plank->WlsPigtail[0] + (plank->Z[0] - topZ) ) - ( fClearFibreN/SoL )*( plank->ClearFibre[0] ) + 26.e-9 + TravelTimeShield2Vertex - toptime;
01557 
01558       dTcorr[1] = plank->Tcal[1] - ( fWlsFibreN/SoL )*( plank->WlsPigtail[1] - (plank->Z[1] - topZ) ) - ( fClearFibreN/SoL )*( plank->ClearFibre[1] ) + 26.e-9 + TravelTimeShield2Vertex - toptime;
01559 
01560     }
01561 
01562     if( ( fabs(dTcorr[0])<10000e-9 && plank->QPE[0]>0.0 ) 
01563      || ( fabs(dTcorr[1])<10000e-9 && plank->QPE[1]>0.0 ) ) PlankInTime0 = 1;
01564 
01565     if( ( fabs(dTcorr[0])<100e-9 && plank->QPE[0]>0.0 ) 
01566      || ( fabs(dTcorr[1])<100e-9 && plank->QPE[1]>0.0 ) ) PlankInTime = 1;
01567    
01568     if( PlankInTime0 ) {
01569 
01570       if( HighestEndBelowShieldSection ) { 
01571         latex->SetTextColor(2); 
01572         hTrkVeto[plank->Section-1]->SetLineColor(2); 
01573       }
01574       else{
01575         latex->SetTextColor(1);
01576       }
01577 
01578       if(plank->QPE[0]<0.01)
01579         {
01580           sprintf(temp_line, "Sec:%2d Plk:%02d  XY:% 2.2f % 2.2f Q:          % 5.2f TRel: %+8.1f",
01581                   plank->Section, plank->Plank, plank->X, plank->Y, plank->QPE[1],
01582                   (dTcorr[1])*1.0e9);
01583         }
01584       else if(plank->QPE[1]<0.01)
01585         {
01586           sprintf(temp_line, "Sec:%2d Plk:%02d  XY:% 2.2f % 2.2f Q:% 5.2f           TRel: %+8.1f",
01587                   plank->Section, plank->Plank, plank->X, plank->Y, plank->QPE[0],
01588                   (dTcorr[0])*1.0e9);
01589         }
01590       else
01591         {
01592           sprintf(temp_line, "Sec:%2d Plk:%02d  XY:% 2.2f % 2.2f Q:% 5.2f % 5.2f  TRel: %+8.1f %+8.1f",
01593                   plank->Section, plank->Plank, plank->X, plank->Y, plank->QPE[0], plank->QPE[1],
01594                   (dTcorr[0])*1.0e9, (dTcorr[1])*1.0e9);
01595         }
01596     
01597       latex->DrawLatex(0.01, currenty, temp_line); 
01598    
01599       currenty-=0.027;
01600     
01601       for (int iend=0; iend<2; iend++) {
01602         if(plank->QPE[iend] == 0) continue;
01603         hTrkVeto[plank->Section-1]->Fill(dTcorr[iend]*1e9, plank->QPE[iend]);
01604       }
01605 
01606       TMarker tm(plank->X, plank->Y, 24);
01607       if( PlankInTime ) tm.SetMarkerStyle(20);
01608 
01609       if( HighestEndBelowShieldSection==1 ) tm.SetMarkerColor(2);
01610       else tm.SetMarkerColor(1);
01611       //tmp.SetMarkerSize(0.7);
01612       tm.SetMarkerSize(1);
01613       // tm.SetMarkerColor(kRed);
01614       // if(StripInTime) tm.SetMarkerStyle(29);
01615       ShieldHits.push_back(tm);
01616     }
01617 
01618   }
01619   
01620   const int ViewI[4] = {1, 3, 4, 6};
01621   for (int i=0; i<4; i++) 
01622     {
01623       cShieldView->cd(ViewI[i]);
01624       //hShwVeto[i]->Draw();
01625       hTrkVeto[i]->Draw();
01626     }
01627   UtilCanvas::FixPad(cShieldView);
01628 
01629   cShieldView->cd(2);
01630   hXYAxis->Draw();
01631   FarLayout *layout = new FarLayout();
01632   layout->Draw();
01633   for(unsigned int i=0; i<ShieldHits.size(); i++) ShieldHits[i].Draw();
01634 
01635   TMarker tm(0,0, 29);
01636   tm.SetMarkerSize(1.2);
01637 
01638   if( shower ){
01639     tm.SetMarkerColor(kGreen);
01640     tm.DrawMarker(shower->VtxX, shower->VtxY);
01641   }
01642 
01643   if( track ){
01644     tm.SetMarkerColor(kRed);
01645     tm.DrawMarker(track->VtxX, track->VtxY);
01646     tm.SetMarkerStyle(30);
01647     tm.DrawMarker(track->EndX, track->EndY);
01648   }
01649 
01650   double factor(0), factorX(0.0), factorY(0.0);
01651   TArrow trkArrows;
01652 
01653   if( track ){
01654     if( dircosX*dircosX+dircosY*dircosY>0.0 ){
01655 
01656       factor = 16.0/(dircosX*dircosX+dircosY*dircosY);
01657       factor = pow(factor,0.5);
01658       factorX = topX-dircosX*factor;
01659       factorY = topY-dircosY*factor;
01660 
01661       trkArrows.SetLineStyle(2);
01662       trkArrows.SetArrowSize(0.01);
01663       trkArrows.SetFillColor(kGreen);
01664       trkArrows.DrawArrow(factorX, factorY, topX, topY);//, Opt);
01665     }
01666   }
01667 
01668 }
01669 
01670 void CamEvd::MakeShowerPlot(const AtmosEvent* /* event */) {
01671   cShowerView->Clear("D");//"D" keeps sub pads from being removed
01672   if(!fDoShowerPlot) return;
01673 
01674   hUZStpPlnShw->Reset();
01675   hVZStpPlnShw->Reset();
01676 
01677   hShwPlnProfile->Reset();
01678   hShwPlnCosZProfile->Reset();
01679 
01680   /*
01681   for (unsigned int i=0; i<gTheShower.Strips.size(); i++) {
01682     const AtmosStrip* strip =
01683       dynamic_cast<const AtmosStrip*>
01684       (event->StripList->At(gTheShower.Strips[i]));
01685     assert(strip);
01686 
01687     double EThis = strip->QPEcorr[0] + strip->QPEcorr[1];
01688 
01689     if(strip->View==0) {
01690       hUZStpPlnShw->Fill(strip->Plane, strip->Strip, EThis);
01691     }
01692     if(strip->View==1) {
01693       hVZStpPlnShw->Fill(strip->Plane, strip->Strip, EThis);
01694     }
01695     hShwPlnProfile->Fill(strip->Plane, EThis);
01696   }
01697   */
01698 
01699   cShowerView->cd(1);
01700   hUZStpPlnShw->Draw("lego2");
01701   cShowerView->cd(2);
01702   hVZStpPlnShw->Draw("lego2");
01703   cShowerView->cd(3);
01704   hShwPlnProfile->Draw();
01705 }
01706 
01707 void CamEvd::MakeMCPlot(const AtmosEvent* event) {
01708   if(event->NScintHits == 0) return;
01709   hMCPlaneDE->Reset();
01710 
01711   //Individual objects
01712   //AtmosMC mcinfo = event->MCInfo;
01713 
01714   static vector<TMarker> UZMCHits; UZMCHits.clear();
01715   static vector<TText> UZTrkId; UZTrkId.clear();
01716 
01717   static vector<TMarker> VZMCHits; VZMCHits.clear();
01718   static vector<TText> VZTrkId; VZTrkId.clear();
01719 
01720   static vector<TMarker> XYMCHits; XYMCHits.clear();
01721 
01722   static vector<TMarker> TZMCHits; TZMCHits.clear();
01723 
01724   double MaxT = 0.0;
01725 
01726   for (int i=0; i<event->ScintHitList->GetEntries(); i++) {
01727     const AtmosScintHit* hit =
01728       dynamic_cast<const AtmosScintHit*>
01729       (event->ScintHitList->At(i));
01730     assert(hit);
01731 
01732     if(hit->DS == 0.0 || hit->DE == 0.0) continue;
01733 
01734     double TNS = 1e9 * hit->T[0];
01735     double TimeWindow = fMCTimeWin * (fMaxT - fMinT);
01736     if(TNS > TimeWindow) continue;
01737 
01738     if(TNS > MaxT) MaxT = TNS;
01739 
01740     if(hit->Plane>fMaxPlane) fMaxPlane = hit->Plane;
01741     if(hit->Plane<fMinPlane) fMinPlane = hit->Plane;
01742 
01743     hMCPlaneDE->Fill(hit->Plane,hit->DE*1000);
01744 
01745 
01746     TZMCHits.push_back(TMarker(hit->Plane, TNS, kFullCircle));
01747 
01748     if (hit->View==0) {
01749       if(hit->Strip < fMinUStrip) fMinUStrip = hit->Strip;
01750       if(hit->Strip > fMaxUStrip) fMaxUStrip = hit->Strip;
01751     }
01752     else {
01753       if(hit->Strip < fMinVStrip) fMinVStrip = hit->Strip;
01754       if(hit->Strip > fMaxVStrip) fMaxVStrip = hit->Strip;
01755     }
01756 
01757     if(hit->U[0] < fMinU) fMinU = hit->U[0];
01758     if(hit->U[0] > fMaxU) fMaxU = hit->U[0];
01759     if(hit->V[0] < fMinV) fMinV = hit->V[0];
01760     if(hit->V[0] > fMaxV) fMaxV = hit->V[0];
01761 
01762     TMarker tm(hit->X[0], hit->Y[0], 20);
01763     tm.SetMarkerSize(1);
01764     tm.SetMarkerColor(ScintHitIdToColor(hit->Id));
01765     tm.SetMarkerStyle(ScintHitIdToStyle(hit->Id));
01766     XYMCHits.push_back(tm);
01767 
01768     tm.SetX(hit->Plane);
01769     tm.SetY(hit->Strip);
01770     if(hit->View == 0) UZMCHits.push_back(tm);
01771     else VZMCHits.push_back(tm);
01772 
01773     TText tt(hit->Plane, hit->Strip, Form("%d",TMath::Abs(hit->TrkId)));
01774     tt.SetTextAlign(22);
01775     tt.SetTextSize(0.05);
01776 
01777     if (hit->TrkId>0) {
01778       tt.SetTextColor(kRed);
01779       tt.SetTextSize(0.07);
01780       //MSG("FarDetEvent",Msg::kSynopsis) << "Adding Primary Hit TrkId = " << hit->TrkId << endl;
01781       //hit->Dump();
01782       //cout << endl;
01783     }
01784 
01785     if(hit->View == 0) UZTrkId.push_back(tt);
01786     else VZTrkId.push_back(tt);
01787   }
01788 
01789   if(MaxT > fMaxT) fMaxT = MaxT;
01790 
01791   //static vector<TLatex> UZStripsMC; UZStripsMC.clear();
01792   //static vector<TLatex> VZStripsMC; VZStripsMC.clear();
01793 
01794   static vector<TMarker> UZTransMC; UZTransMC.clear();
01795   static vector<TMarker> VZTransMC; VZTransMC.clear();
01796 
01797   TruthHelp thelp(event);
01798   set<SetStrip>::iterator sitr;
01799   MSG("FarDetEvent",Msg::kSynopsis) << "Adding " << thelp.LeptonHits.size() << " Lepton Hits" << endl;
01800   for (sitr  = thelp.LeptonHits.begin();
01801        sitr != thelp.LeptonHits.end(); sitr++) {
01802     const AtmosStrip* strip =
01803       dynamic_cast<const AtmosStrip*>
01804       (event->StripList->At(sitr->TCIndex));
01805     assert(strip);
01806 
01807     TLatex tl(strip->Plane,strip->Strip,"#otimes");
01808     tl.SetTextAlign(22);
01809     if(thelp.DeMuxFailures.find(*sitr) !=
01810        thelp.DeMuxFailures.end()) tl.SetTextColor(kRed);
01811     //if(strip->View==0) UZStripsMC.push_back(tl);
01812     //else VZStripsMC.push_back(tl);
01813   }
01814 
01815   MSG("FarDetEvent",Msg::kSynopsis) << "Adding " << thelp.HadronHits.size() << " Hadron Hits" << endl;
01816   for (sitr  = thelp.HadronHits.begin();
01817        sitr != thelp.HadronHits.end(); sitr++) {
01818     const AtmosStrip* strip =
01819       dynamic_cast<const AtmosStrip*>
01820       (event->StripList->At(sitr->TCIndex));
01821     assert(strip);
01822 
01823     TLatex tl(strip->Plane,strip->Strip,"#oplus");
01824     tl.SetTextAlign(22);
01825     if(thelp.DeMuxFailures.find(*sitr) !=
01826        thelp.DeMuxFailures.end()) tl.SetTextColor(kRed);
01827     //if(strip->View==0) UZStripsMC.push_back(tl);
01828     //else VZStripsMC.push_back(tl);
01829   }
01830 
01831   MSG("FarDetEvent",Msg::kSynopsis) << "Adding " << thelp.NoiseHits.size() << " Noise Hits" << endl;
01832   for (sitr  = thelp.NoiseHits.begin();
01833        sitr != thelp.NoiseHits.end(); sitr++) {
01834     const AtmosStrip* strip =
01835       dynamic_cast<const AtmosStrip*>
01836       (event->StripList->At(sitr->TCIndex));
01837     assert(strip);
01838 
01839     TLatex tl(strip->Plane, strip->Strip, "#oslash");
01840     tl.SetTextAlign(22);
01841     /*
01842     if(thelp.DeMuxFailures.find(*sitr) !=
01843        thelp.DeMuxFailures.end()) tl.SetTextColor(kRed);
01844     */
01845     //if(strip->View==0) UZStripsMC.push_back(tl);
01846     //else VZStripsMC.push_back(tl);
01847   }
01848 
01849   //Latex line to be used later
01850   TLatex tl;
01851   tl.SetNDC(true);
01852   tl.SetTextAlign(31);
01853   tl.SetTextSize(0.04);
01854 
01855   TLatex TLatex_Nat;
01856   TLatex_Nat.SetTextAlign(22);
01857   TLatex_Nat.SetTextSize(0.06);
01858 
01859   TArrow PartArrows;
01860   PartArrows.SetFillColor(kRed);
01861   PartArrows.SetArrowSize(0.01);
01862 
01863   std::string VtxStr;
01864   if (event->MCInfo.IDnu == 0) {//Cosmic Ray
01865     if(event->MCInfo.Emu==0) VtxStr = "WTF";
01866     else if(event->MCInfo.Emu>0) VtxStr = "#mu^{+}";
01867     else if(event->MCInfo.Emu<0) VtxStr = "#mu^{-}";
01868     else MSG("FarDetEvent",Msg::kError) << "WTF" << endl;
01869   }
01870   else {//Neutrino
01871     VtxStr = IDnuToText(event->MCInfo.IDnu);
01872   }
01873 
01874   double PnuU = C45 * (event->MCInfo.PnuY + event->MCInfo.PnuX);
01875   double PnuV = C45 * (event->MCInfo.PnuY - event->MCInfo.PnuX);
01876   double PmuU = C45 * (event->MCInfo.PmuY + event->MCInfo.PmuX);
01877   double PmuV = C45 * (event->MCInfo.PmuY - event->MCInfo.PmuX);
01878   double PelU = C45 * (event->MCInfo.PelY + event->MCInfo.PelX);
01879   double PelV = C45 * (event->MCInfo.PelY - event->MCInfo.PelX);
01880   double PhadU = C45 * (event->MCInfo.PhadY + event->MCInfo.PhadX);
01881   double PhadV = C45 * (event->MCInfo.PhadY - event->MCInfo.PhadX);
01882   double Z0, Z1, T0, T1;
01883   char Opt[5];
01884 
01885   //Draw up U View
01886   cMCMainView->cd(1);
01887   hUZStpPlnAxis->Draw();
01888   for(unsigned int i=0; i<UZMCHits.size(); ++i) UZMCHits[i].Draw();
01889   tl.SetTextAlign(11);
01890   if (event->MCInfo.IDnu != 0) {
01891     tl.DrawLatex(0.1, 0.95, Form("%s - %s - %s(%.3f, %.3f, %.3f, %.3f)",
01892       IDnuToText(event->MCInfo.IDnu),
01893       IDactToText(event->MCInfo.IDact),
01894       IDresToText(event->MCInfo.IDres),
01895       event->MCInfo.Enu, PnuU, PnuV, event->MCInfo.PnuZ));
01896   }
01897 
01898   TLatex_Nat.DrawLatex(MCPlaneFromZ(event->MCInfo.VtxZ),
01899                        MCStripFromT(event->MCInfo.VtxU),
01900                        VtxStr.c_str());
01901 
01902   if (event->MCInfo.IDnu != 0) {
01903     if (event->MCInfo.PnuZ > 0.0) {
01904       Z0 = MCPlaneFromZ(event->MCInfo.VtxZ) - 4;
01905       Z1 = MCPlaneFromZ(event->MCInfo.VtxZ);
01906       T1 = MCStripFromT(event->MCInfo.VtxU);
01907       T0 = T1 - (MCStpPlnFromTZ(PnuU/event->MCInfo.PnuZ)*(Z1-Z0));
01908       sprintf(Opt, "|>");
01909     } else {
01910       Z0 = MCPlaneFromZ(event->MCInfo.VtxZ);
01911       Z1 = MCPlaneFromZ(event->MCInfo.VtxZ) + 4;
01912       T0 = MCStripFromT(event->MCInfo.VtxU);
01913       T1 = T0 + (MCStpPlnFromTZ(PnuU/event->MCInfo.PnuZ)*(Z1-Z0));
01914       sprintf(Opt, "<|");
01915     }
01916     PartArrows.SetLineStyle(2);
01917     PartArrows.SetFillColor(kGreen);
01918     PartArrows.DrawArrow(Z0, T0, Z1, T1, 0, Opt);
01919 
01920     if (TMath::Abs(event->MCInfo.Emu) > 0.0) {
01921       if (event->MCInfo.PmuZ > 0.0) {
01922         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ);
01923         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ) + 6;
01924         T0 = MCStripFromT(event->MCInfo.VtxU);
01925         T1 = T0 + (MCStpPlnFromTZ(PmuU/event->MCInfo.PmuZ)*(Z1-Z0));
01926         sprintf(Opt, "|>");
01927       } else {
01928         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ) - 6;
01929         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ);
01930         T1 = MCStripFromT(event->MCInfo.VtxU);
01931         T0 = T1 - (MCStpPlnFromTZ(PmuU/event->MCInfo.PmuZ)*(Z1-Z0));
01932         sprintf(Opt, "<|");
01933       }
01934 
01935       PartArrows.SetLineColor(kRed);
01936       PartArrows.SetLineStyle(1);
01937       PartArrows.DrawArrow(Z0, T0, Z1, T1, 0, Opt);
01938     }
01939 
01940     if (TMath::Abs(event->MCInfo.Eel) > 0.0) {
01941       if (event->MCInfo.PelZ > 0.0) {
01942         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ);
01943         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ) + 6;
01944         T0 = MCStripFromT(event->MCInfo.VtxU);
01945         T1 = T0 + (MCStpPlnFromTZ(PelU/event->MCInfo.PelZ)*(Z1-Z0));
01946         sprintf(Opt, "|>");
01947       } else {
01948         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ) - 6;
01949         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ);
01950         T1 = MCStripFromT(event->MCInfo.VtxU);
01951         T0 = T1 - (MCStpPlnFromTZ(PelU/event->MCInfo.PelZ)*(Z1-Z0));
01952         sprintf(Opt, "<|");
01953       }
01954 
01955       PartArrows.SetLineColor(kGreen);
01956       PartArrows.SetLineStyle(1);
01957       PartArrows.DrawArrow(Z0, T0, Z1, T1, 0, Opt);
01958     }
01959   }
01960 
01961   //Draw up V View
01962   cMCMainView->cd(2);
01963   hVZStpPlnAxis->Draw();
01964   for(unsigned int i=0; i<VZMCHits.size(); ++i) VZMCHits[i].Draw();
01965 
01966   tl.SetTextAlign(21);
01967   string ThisLine;
01968   if(event->MCInfo.Emu > 0.0)
01969     ThisLine +=  Form("#mu^{+}(%.2f, %.2f, %.2f, %.2f)",
01970       event->MCInfo.Emu, PmuU, PmuV, event->MCInfo.PmuZ);
01971   if(event->MCInfo.Emu < 0.0)
01972     ThisLine +=  Form("#mu^{-}(%.2f, %.2f, %.2f, %.2f)",
01973       event->MCInfo.Emu, PmuU, PmuV, event->MCInfo.PmuZ);
01974   if(event->MCInfo.Eel > 0.0)
01975     ThisLine +=  Form("e^{+}(%.2f, %.2f, %.2f, %.2f)",
01976       event->MCInfo.Eel, PelU, PelV, event->MCInfo.PelZ);
01977   if(event->MCInfo.Eel < 0.0)
01978     ThisLine +=  Form("e^{-}(%.2f, %.2f, %.2f, %.2f)",
01979       event->MCInfo.Eel, PelU, PelV, event->MCInfo.PelZ);
01980   /*
01981   ThisLine += Form(" | Vtx(%.2f, %.2f, %.1f)",
01982     event->MCInfo.VtxX, event->MCInfo.VtxU, event->MCInfo.VtxU);
01983   */
01984   tl.DrawLatex(0.5, 0.95, ThisLine.c_str());
01985 
01986   TLatex_Nat.DrawLatex(MCPlaneFromZ(event->MCInfo.VtxZ),
01987                        MCStripFromT(event->MCInfo.VtxV),
01988                        VtxStr.c_str());
01989 
01990   if (event->MCInfo.IDnu != 0) {
01991     if (event->MCInfo.PnuZ > 0.0) {
01992       Z0 = MCPlaneFromZ(event->MCInfo.VtxZ) - 4;
01993       Z1 = MCPlaneFromZ(event->MCInfo.VtxZ);
01994       T1 = MCStripFromT(event->MCInfo.VtxV);
01995       T0 = T1 - (MCStpPlnFromTZ(PnuV/event->MCInfo.PnuZ)*(Z1-Z0));
01996       sprintf(Opt, "|>");
01997     } else {
01998       Z0 = MCPlaneFromZ(event->MCInfo.VtxZ);
01999       Z1 = MCPlaneFromZ(event->MCInfo.VtxZ) + 4;
02000       T0 = MCStripFromT(event->MCInfo.VtxV);
02001       T1 = T0 + (MCStpPlnFromTZ(PnuV/event->MCInfo.PnuZ)*(Z1-Z0));
02002       sprintf(Opt, "<|");
02003     }
02004     PartArrows.SetLineStyle(2);
02005     PartArrows.DrawArrow(Z0, T0, Z1, T1, 0, Opt);
02006 
02007     if (TMath::Abs(event->MCInfo.Emu) > 0.0) {
02008       if (event->MCInfo.PmuZ > 0.0) {
02009         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ);
02010         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ) + 6;
02011         T0 = MCStripFromT(event->MCInfo.VtxV);
02012         T1 = T0 + (MCStpPlnFromTZ(PmuV/event->MCInfo.PmuZ)*(Z1-Z0));
02013         sprintf(Opt, "|>");
02014       } else {
02015         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ) - 6;
02016         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ);
02017         T1 = MCStripFromT(event->MCInfo.VtxV);
02018         T0 = T1 - (MCStpPlnFromTZ(PmuV/event->MCInfo.PmuZ)*(Z1-Z0));
02019         sprintf(Opt, "<|");
02020       }
02021 
02022       PartArrows.SetLineColor(kRed);
02023       PartArrows.SetLineStyle(1);
02024       PartArrows.DrawArrow(Z0, T0, Z1, T1, 0, Opt);
02025     }
02026 
02027     if (TMath::Abs(event->MCInfo.Eel) > 0.0) {
02028       if (event->MCInfo.PelZ > 0.0) {
02029         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ);
02030         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ) + 6;
02031         T0 = MCStripFromT(event->MCInfo.VtxV);
02032         T1 = T0 + (MCStpPlnFromTZ(PelV/event->MCInfo.PelZ)*(Z1-Z0));
02033         sprintf(Opt, "|>");
02034       } else {
02035         Z0 = MCPlaneFromZ(event->MCInfo.VtxZ) - 6;
02036         Z1 = MCPlaneFromZ(event->MCInfo.VtxZ);
02037         T1 = MCStripFromT(event->MCInfo.VtxV);
02038         T0 = T1 - (MCStpPlnFromTZ(PelV/event->MCInfo.PelZ)*(Z1-Z0));
02039         sprintf(Opt, "<|");
02040       }
02041 
02042       PartArrows.SetLineColor(kGreen);
02043       PartArrows.SetLineStyle(1);
02044       PartArrows.DrawArrow(Z0, T0, Z1, T1, 0, Opt);
02045     }
02046   }
02047 
02048   //Draw up XY View
02049   cMCMainView->cd(3);
02050   hXYAxis->Draw();
02051   FarLayout *layout = new FarLayout();
02052   layout->DrawSteel();
02053   layout->DrawFiducial();
02054   for(unsigned int i=0; i<XYMCHits.size(); i++) XYMCHits[i].Draw();
02055   tl.SetTextAlign(31);
02056   ThisLine = "";
02057   if(event->MCInfo.Ehad > 0.0)
02058     ThisLine +=  Form("Had(%.2f, %.2f, %.2f, %.2f)",
02059       event->MCInfo.Ehad, PhadU, PhadV, event->MCInfo.PhadZ);
02060   if(event->MCInfo.EMfrac > 0.0)
02061     ThisLine +=  Form(" | EMFrac = %.3f", event->MCInfo.EMfrac);
02062   tl.DrawLatex(0.9, 0.95, ThisLine.c_str());
02063 
02064   cMCMainView->cd(4);
02065   hMCPlaneDE->Draw("hist");
02066 
02067   cMCMainView->cd(6);
02068   hMCTZAxis->Draw();
02069   for(unsigned int i=0; i<TZMCHits.size(); i++) TZMCHits[i].Draw();
02070 
02071   cMCSideView->cd(1);
02072   hUZStpPlnAxis->Draw();
02073   //for(unsigned int i=0; i<UZStripsMC.size(); ++i) UZStripsMC[i].Draw();
02074   tl.DrawLatex(0.9,0.95, "#otimes = Lepton, #oplus = Hadron");
02075 
02076   cMCSideView->cd(2);
02077   hVZStpPlnAxis->Draw();
02078   //for(unsigned int i=0; i<VZStripsMC.size(); ++i) VZStripsMC[i].Draw();
02079   tl.DrawLatex(0.9,0.95, "#color[2]{O} = DeMuxFailure, #oslash = Noise");
02080 
02081   cMCSideView->cd(3);
02082   hVZLinearAxis->Draw();
02083   for(unsigned int i=0; i<VZTransMC.size(); ++i) VZTransMC[i].Draw();
02084 
02085   cMCSideView->cd(4);
02086   hUZLinearAxis->Draw();
02087   for(unsigned int i=0; i<UZTransMC.size(); ++i) UZTransMC[i].Draw();
02088 
02089   if (fMakeMCTrkIdView) {
02090     cMCTrkIdView->cd(1);
02091     hUZStpPlnAxis->Draw();
02092     for(unsigned int i=0; i<UZTrkId.size(); ++i) UZTrkId[i].Draw();
02093 
02094     cMCTrkIdView->cd(2);
02095     hVZStpPlnAxis->Draw();
02096     for(unsigned int i=0; i<VZTrkId.size(); ++i) VZTrkId[i].Draw();
02097   }
02098 }
02099 
02100 void CamEvd::SetStyle() {
02101   gStyle->SetOptStat(0);
02102   gStyle->SetPalette(1);
02103   gStyle->SetCanvasColor(10);
02104   gStyle->SetPadColor(10);
02105   gStyle->SetStatColor(1);
02106   gStyle->SetTitleColor(1);
02107   gStyle->SetOptFit();
02108   gStyle->SetFillColor(10);
02109   gStyle->SetFrameLineWidth(2);
02110   gStyle->SetHistLineWidth(2);
02111   gStyle->SetLabelFont(12, "X");
02112   gStyle->SetLabelFont(12, "Y");
02113   gStyle->SetTitleFont(12, "X");
02114   gStyle->SetTitleFont(12, "Y");
02115   gStyle->SetTitleFont(12, "H");
02116   gStyle->SetTitleBorderSize(0);
02117   gStyle->SetTitleFillColor(10);
02118   gStyle->SetPadBottomMargin(1.2);
02119   gStyle->SetPadLeftMargin(1.2);
02120 
02121   gStyle->SetStatBorderSize(0);
02122   gStyle->SetStatFont(40);
02123   gStyle->SetStatX(0.88);
02124   gStyle->SetStatY(0.875);
02125 }
02126 
02127 void CamEvd::CloseWindow() {
02128   MSG("FarDetEvent",Msg::kSynopsis) << "Closing Window" << endl;
02129   delete this;
02130   MSG("FarDetEvent",Msg::kSynopsis) << "Shutting Down" << endl;
02131   if(gApplication) gApplication->Terminate();
02132 }
02133 
02134 void CamEvd::DoTab(int itab) {
02135   fActiveCanvas = AllCanvases[itab];
02136   UtilCanvas::UpdatePad(fActiveCanvas);
02137 }
02138 
02139 void CamEvd::TabUp(bool up) {
02140   if(up) cgTab->SetTab(cgTab->GetCurrent() + 1);
02141   else cgTab->SetTab(cgTab->GetCurrent() - 1);
02142 }
02143 
02144 void CamEvd::DoPrint() {
02145   Emit("DoPrint()");
02146 
02147   const char *EvId = Form("%d_%d_%d", fRun, fSubRun, fSnarl);
02148 
02149   if (fMakePS) {
02150     MSG("FarDetEvent",Msg::kSynopsis) << "Making postscript file" << endl;
02151     AllCanvases[0]->Print(Form("Views_%s.ps[", EvId));
02152     for(unsigned int i=0; i < AllCanvases.size(); i++)
02153       if(UtilCanvas::PadFilled(AllCanvases[i]))
02154         AllCanvases[i]->Print(Form("Views_%s.ps", EvId));
02155     AllCanvases[0]->Print(Form("Views_%s.ps]", EvId));
02156   }
02157 
02158   if (fMakeEPS) {
02159     MSG("FarDetEvent",Msg::kSynopsis) << "Making encapsulated postscript files" << endl;
02160     for(unsigned int i=0; i < AllCanvases.size(); i++)
02161       if(UtilCanvas::PadFilled(AllCanvases[i]))
02162         AllCanvases[i]->Print(Form("%s_%s.eps",
02163          AllCanvases[i]->GetName(), EvId));
02164   }
02165 
02166   if (fMakeGIF) {
02167     MSG("FarDetEvent",Msg::kSynopsis) << "Making gif image files" << endl;
02168     for(unsigned int i=0; i < AllCanvases.size(); i++)
02169       if(UtilCanvas::PadFilled(AllCanvases[i]))
02170         AllCanvases[i]->Print(Form("%s_%s.gif",
02171          AllCanvases[i]->GetName(), EvId));
02172   }
02173 
02174   if (fMakeROOT) {
02175     MSG("FarDetEvent",Msg::kSynopsis) << "Making root file" << endl;
02176     HistMan hm(this->GetName());
02177     hm.WriteOut(Form("Views_%s.root",EvId));
02178   }
02179 }
02180 
02181 void CamEvd::SetNumericOptions() {
02182   MCTimeWin(cgMCTimeWin->GetNumber());
02183   WlsFibreN(cgWlsFibreN->GetNumber());
02184   ClearFibreN(cgClearFibreN->GetNumber());
02185 }
02186 
02187 void CamEvd::SetPlaneRangeUser(int MinPlane, int MaxPlane) {
02188   MSG("FarDetEvent",Msg::kSynopsis) << "CamEvd::SetPlaneRangeUser()" << endl;
02189 
02190   if(MinPlane == 0) MinPlane = fMinPlane;
02191   if(MaxPlane == 0) MaxPlane = fMaxPlane;
02192 
02193   //Fix a few potential range troubles
02194   if(MinPlane > MaxPlane) UtilMisc::Trade(&MinPlane, &MaxPlane);
02195   UtilMisc::RangeIt(&MinPlane, 1, 485);
02196   UtilMisc::RangeIt(&MaxPlane, 1, 485);
02197   if (MinPlane == MaxPlane) {
02198     if(MinPlane > 2) MinPlane -= 2;
02199     if(MaxPlane < 484) MaxPlane += 2;
02200   }
02201 
02202   MSG("FarDetEvent",Msg::kSynopsis) << "Plane Range = " << MinPlane << " / " << MaxPlane << endl;
02203 
02204   //Set all of the axis Z and Plane ranges
02205   hUZStpPlnAxis->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02206   hVZStpPlnAxis->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02207   hUZStpPlnShw->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02208   hVZStpPlnShw->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02209   hShwPlnProfile->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02210   hShwPlnCosZProfile->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02211   hTZAxis->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02212   hRawPlaneCharge->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02213   hCorrPlaneCharge->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02214   hMCPlaneDE->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02215   hMCTZAxis->GetXaxis()->SetRangeUser(MinPlane-2, MaxPlane+2);
02216 
02217   cgPlaneRange->SetPosition((float)MinPlane, (float)MaxPlane);
02218 
02219   //Set the fMinZ and fMaxZ based on Plane Range
02220   double MinZ, MaxZ;
02221   if (fIsMC) {
02222     MinZ = MCZFromPlane(MinPlane);
02223     MaxZ = MCZFromPlane(MaxPlane);
02224   }
02225   else {
02226     MinZ = DataZFromPlane(MinPlane);
02227     MaxZ = DataZFromPlane(MaxPlane);
02228   }
02229 
02230   hUZLinearAxis->GetXaxis()->SetRangeUser(MinZ-0.1, MaxZ+0.1);
02231   hVZLinearAxis->GetXaxis()->SetRangeUser(MinZ-0.1, MaxZ+0.1);
02232 
02233   UtilCanvas::UpdatePad(fActiveCanvas);
02234 }
02235 
02236 void CamEvd::SetUStripRangeUser(int MinStrip, int MaxStrip) {
02237   if(MinStrip == -1 ) MinStrip = fMinUStrip;
02238   if(MaxStrip == -1 ) MaxStrip = fMaxUStrip;
02239 
02240   //Fix a few potential range troubles
02241   if(MinStrip > MaxStrip) UtilMisc::Trade(&MinStrip, &MaxStrip);
02242   UtilMisc::RangeIt(&MinStrip, 0, 191);
02243   UtilMisc::RangeIt(&MaxStrip, 0, 191);
02244   if (MinStrip == MaxStrip) {
02245     if(MinStrip > 1) MinStrip -= 2;
02246     if(MaxStrip < 190) MaxStrip += 2;
02247   }
02248 
02249   MSG("FarDetEvent",Msg::kSynopsis) << "U Range = " << MinStrip << " / " << MaxStrip << endl;
02250 
02251   hUZStpPlnAxis->GetYaxis()->SetRangeUser(MinStrip-2, MaxStrip+2);
02252   hUZStpPlnShw->GetYaxis()->SetRangeUser(MinStrip-2, MaxStrip+2);
02253 
02254   cgUStripRange->SetPosition((float)MinStrip, (float)MaxStrip);
02255 
02256   double MinLin, MaxLin;
02257   if (fIsMC) {
02258     MinLin = MCTFromStrip(MinStrip);
02259     MaxLin = MCTFromStrip(MaxStrip);
02260   }
02261   else {
02262     MinLin = DataTFromStrip(MinStrip);
02263     MaxLin = DataTFromStrip(MaxStrip);
02264   }
02265 
02266   hUZLinearAxis->GetYaxis()->SetRangeUser(MinLin-0.1, MaxLin+0.1);
02267   UtilCanvas::UpdatePad(fActiveCanvas);
02268 }
02269 
02270 void CamEvd::SetVStripRangeUser(int MinStrip, int MaxStrip) {
02271   if(MinStrip == -1 ) MinStrip = fMinVStrip;
02272   if(MaxStrip == -1 ) MaxStrip = fMaxVStrip;
02273 
02274   //Fix a few potential range troubles
02275   if(MinStrip > MaxStrip) UtilMisc::Trade(&MinStrip, &MaxStrip);
02276   UtilMisc::RangeIt(&MinStrip, 0, 191);
02277   UtilMisc::RangeIt(&MaxStrip, 0, 191);
02278   if (MinStrip == MaxStrip) {
02279     if(MinStrip > 1) MinStrip -= 2;
02280     if(MaxStrip < 190) MaxStrip += 2;
02281   }
02282 
02283   MSG("FarDetEvent",Msg::kSynopsis) << "V Range = " << MinStrip << " / " << MaxStrip << endl;
02284 
02285   hVZStpPlnAxis->GetYaxis()->SetRangeUser(MinStrip-2, MaxStrip+2);
02286   hVZStpPlnShw->GetYaxis()->SetRangeUser(MinStrip-2, MaxStrip+2);
02287 
02288   cgVStripRange->SetPosition((float)MinStrip, (float)MaxStrip);
02289 
02290   double MinLin, MaxLin;
02291   if (fIsMC) {
02292     MinLin = MCTFromStrip(MinStrip);
02293     MaxLin = MCTFromStrip(MaxStrip);
02294   }
02295   else {
02296     MinLin = DataTFromStrip(MinStrip);
02297     MaxLin = DataTFromStrip(MaxStrip);
02298   }
02299 
02300   hVZLinearAxis->GetYaxis()->SetRangeUser(MinLin-0.1, MaxLin+0.1);
02301   UtilCanvas::UpdatePad(fActiveCanvas);
02302 }
02303 
02304 void CamEvd::SetTimeRangeUser(double MinT, double MaxT) {
02305   if(MinT == -1.0) MinT = fMinT;
02306   if(MaxT == -1.0) MaxT = fMaxT;
02307 
02308   if(fMinT>fMaxT) UtilMisc::Trade(&MinT, &MaxT);
02309 
02310   MSG("FarDetEvent",Msg::kSynopsis) << "T Range = " << MinT << " / " << MaxT << endl;
02311 
02312   hTZAxis->GetYaxis()->SetRangeUser(0, MaxT * 1.05);
02313   hMCTZAxis->GetYaxis()->SetRangeUser(0, MaxT * 1.05);
02314 }
02315 
02316 void CamEvd::PlaneSlider() {
02317   int MinPlane = (int)cgPlaneRange->GetMinPosition();
02318   int MaxPlane = (int)cgPlaneRange->GetMaxPosition();
02319   SetPlaneRangeUser(MinPlane, MaxPlane);
02320 }
02321 
02322 void CamEvd::UStripSlider() {
02323   int MinStrip = (int)cgUStripRange->GetMinPosition();
02324   int MaxStrip = (int)cgUStripRange->GetMaxPosition();
02325   SetUStripRangeUser(MinStrip, MaxStrip);
02326 }
02327 
02328 void CamEvd::VStripSlider() {
02329   int MinStrip = (int)cgVStripRange->GetMinPosition();
02330   int MaxStrip = (int)cgVStripRange->GetMaxPosition();
02331   SetVStripRangeUser(MinStrip, MaxStrip);
02332 }
02333 
02334 void CamEvd::UnZoom() {
02335   MSG("FarDetEvent",Msg::kSynopsis) << "CamEvd::UnZoom" << endl;
02336   SetPlaneRangeUser();
02337   SetUStripRangeUser();
02338   SetVStripRangeUser();
02339   SetTimeRangeUser();
02340 }
02341 
02342 void CamEvd::AddFakeShieldData(const char* /*File*/)
02343 {
02344   return;
02345 }

Generated on Mon Feb 15 11:06:27 2010 for loon by  doxygen 1.3.9.1