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

PlotMuonClusterModule Class Reference

#include <PlotMuonClusterModule.h>

Inheritance diagram for PlotMuonClusterModule:

JobCModule JobCModule List of all members.

Public Member Functions

 PlotMuonClusterModule ()
 ~PlotMuonClusterModule ()
JobCResult Ana (const MomNavigator *mom)
void HandleCommand (JobCommand *command)
void Help ()
 PlotMuonClusterModule ()
 ~PlotMuonClusterModule ()
JobCResult Ana (const MomNavigator *mom)
void HandleCommand (JobCommand *command)
void Help ()

Private Member Functions

void PlotClusters (const CandMSTClusterListHandle &cllh, const CandThruMuonListHandle &cmlh)
void RedrawPlot ()
void PlotClusters (const CandMSTClusterListHandle *cllh, const CandThruMuonListHandle *cmlh)
void RedrawPlot ()

Private Attributes

TString fListClust
TString fListMuon
TCanvas * fAnaCanvas
TH2F * fAnaBlanks [4]
TObjArray * fAnaFits [2]
TObjArray * fAnaGraphs [8]
Float_t fAnaTmin [2]
Float_t fAnaTmax [2]
Float_t fAnaZmin
Float_t fAnaZmax
TCanvas * fAnaCanvas
TH2F * fAnaBlanks [4]
TObjArray * fAnaFits [2]
TObjArray * fAnaGraphs [8]

Static Private Attributes

const Float_t fMaxChiSq = 3

Constructor & Destructor Documentation

PlotMuonClusterModule::PlotMuonClusterModule  ) 
 

Definition at line 63 of file Alignment/tobien/PlotMuonClusterModule.cxx.

References fAnaBlanks, fAnaFits, fAnaGraphs, and MSG.

00063                                              :
00064   fListClust(""), fListMuon(""),
00065   fAnaCanvas(0)
00066 {
00067 //
00068 //  Purpose:    Default constructor.
00069 //
00070 //  Arguments:  n/a
00071 //
00072 //  Return:     n/a
00073 //
00074 
00075   MSG("BubJobC", Msg::kDebug)
00076      << "PlotMuonClusterModule::Constructor" << endl;
00077   for (int i=0; i<4; i++) {
00078     fAnaBlanks[i] = 0;
00079     fAnaGraphs[i] = 0;
00080   }
00081   for (int i=0; i<2; i++) {
00082     fAnaFits[i] = 0;
00083   }
00084 }

PlotMuonClusterModule::~PlotMuonClusterModule  ) 
 

Definition at line 88 of file Alignment/tobien/PlotMuonClusterModule.cxx.

References MSG.

00089 {
00090 //
00091 //  Purpose:    Default destructor.
00092 //
00093 //  Arguments:  n/a
00094 //
00095 //  Return:     n/a
00096 //
00097 
00098   MSG("BubJobC", Msg::kDebug)
00099      << "PlotMuonClusterModule::Destructor" << endl;
00100 
00101 /*
00102   delete fAnaCanvas;     fAnaCanvas = 0;
00103   for (int i=0; i<4; i++) {
00104 cout << "loop " << i << endl;
00105     if (fAnaBlanks[i]) {
00106 cout << "Deleting blank" << endl;
00107       delete fAnaBlanks[i];
00108 cout << "Deleted blanks." << endl;
00109       fAnaBlanks[i] = 0;
00110     }
00111     if (fAnaGraphs[i]) {
00112       fAnaGraphs[i]->Delete();
00113 cout << "Deleting cluster" << endl;
00114       delete fAnaGraphs[i];
00115 cout << "Deleted clusters." << endl;
00116       fAnaGraphs[i] = 0;
00117     }
00118   }
00119   for (int i=0; i<2; i++) {
00120     if (fAnaFits[i]) {
00121       fAnaFits[i]->Delete();
00122       delete fAnaFits[i];
00123       fAnaFits[i] = 0;
00124     }
00125 cout << "Deleted fits." << endl;
00126   }
00127 */
00128 }

PlotMuonClusterModule::PlotMuonClusterModule  ) 
 

PlotMuonClusterModule::~PlotMuonClusterModule  ) 
 


Member Function Documentation

JobCResult PlotMuonClusterModule::Ana const MomNavigator mom  )  [virtual]
 

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

JobCResult PlotMuonClusterModule::Ana const MomNavigator mom  )  [virtual]
 

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 132 of file Alignment/tobien/PlotMuonClusterModule.cxx.

References CandRecord::FindCandHandle(), fListClust, fListMuon, MomNavigator::GetFragment(), MSG, and PlotClusters().

00133 {
00134 //
00135 //  Purpose:  Method to plot reconstructed clusters.
00136 //
00137 //  Arguments:
00138 //    mom       in    MomNavigator from which to retrieve fragment.
00139 //
00140 //  Return:   No decision.
00141 //
00142 //  Note:     This is useful for cluster parameter tuning.
00143 //
00144 
00145   MSG("BubJobC", Msg::kDebug) << "PlotMuonClusterModule::Ana" << endl;
00146 
00147 // Find PrimaryCandidateRecord fragment in MOM.
00148   CandRecord *candrec = dynamic_cast<CandRecord *>
00149              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00150   if (candrec == 0) {
00151     MSG("BubJobC", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00152                                                                 << endl;
00153     return JobCResult::kError;                             // Fail event
00154   }
00155 
00156   CandMSTClusterListHandle *cllh=dynamic_cast<CandMSTClusterListHandle*>
00157                     (candrec->FindCandHandle("CandMSTClusterListHandle",
00158                                                     fListClust.Data()));
00159   CandThruMuonListHandle *cmlh = dynamic_cast<CandThruMuonListHandle *>
00160                       (candrec->FindCandHandle("CandThruMuonListHandle",
00161                                                      fListMuon.Data()));
00162 
00163   MSG("BubJobC", Msg::kDebug) << "before plot" << endl;
00164   PlotClusters(*cllh, *cmlh);
00165   MSG("BubJobC", Msg::kDebug) << "after plot" << endl;
00166 
00167   return JobCResult::kAOK;
00168 }

void PlotMuonClusterModule::HandleCommand JobCommand command  )  [virtual]
 

Implement to handle a JobCommand

Reimplemented from JobCModule.

void PlotMuonClusterModule::HandleCommand JobCommand command  )  [virtual]
 

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 172 of file Alignment/tobien/PlotMuonClusterModule.cxx.

References fAnaTmax, fAnaTmin, fAnaZmax, fAnaZmin, fListClust, fListMuon, MSG, JobCommand::PopCmd(), JobCommand::PopFloatOpt(), JobCommand::PopOpt(), and RedrawPlot().

00173 {
00174 //
00175 //  Purpose:  Method to interpret module commands.
00176 //
00177 //  Arguments:
00178 //    command   in    Command to interpret.
00179 //
00180 //  Return:   n/a
00181 //
00182 //  Commands implemented:
00183 //    Set ListClust   Set name of CandMSTClusterList to retrieve.
00184 //    Set ListMuon    Set name of CandThruMuonList to retrieve.
00185 //
00186 //    Plot            Plot clusters.
00187 //    SetPlot Zmin    Set minimum on horizontal axis.
00188 //    SetPlot Zmax    Set maximum on horizontal axis.
00189 //    SetPlot Umin    Set minimum on vertical U-axis.
00190 //    SetPlot Umax    Set maximum on vertical U-axis.
00191 //    SetPlot Vmin    Set minimum on vertical V-axis.
00192 //    SetPlot Vmax    Set maximum on vertical V-axis.
00193 //
00194 
00195    MSG("BubJobC", Msg::kDebug)
00196       << "PlotMuonClusterModule::HandleCommand" <<endl;
00197 
00198    TString cmd = command->PopCmd();
00199 
00200 // Set reconstruction parameters.
00201    if (cmd == "Set") {    // Set cut threshold.
00202       TString opt = command->PopOpt();
00203       if      (opt == "ListClust") fListClust = command->PopOpt();
00204       else if (opt == "ListMuon")  fListMuon  = command->PopOpt();
00205       else {
00206          MSG("BubJobC", Msg::kWarning)
00207             << "PlotMuonClusterModule: Unrecognized option " << opt
00208             << endl;
00209       }
00210    }
00211 
00212 // Plot clusters.
00213    else if (cmd == "Plot") RedrawPlot();
00214 
00215 // Set cluster plot limits.
00216    else if (cmd == "SetPlot") {
00217       TString opt = command->PopOpt();
00218       if      (opt == "Zmin")
00219                       fAnaZmin    = command->PopFloatOpt() * Munits::cm;
00220       else if (opt == "Zmax")
00221                       fAnaZmax    = command->PopFloatOpt() * Munits::cm;
00222       else if (opt == "Umin")
00223                       fAnaTmin[0] = command->PopFloatOpt() * Munits::cm;
00224       else if (opt == "Umax")
00225                       fAnaTmax[0] = command->PopFloatOpt() * Munits::cm;
00226       else if (opt == "Vmin")
00227                       fAnaTmin[1] = command->PopFloatOpt() * Munits::cm;
00228       else if (opt == "Vmax")
00229                       fAnaTmax[1] = command->PopFloatOpt() * Munits::cm;
00230       else {
00231          MSG("BubJobC", Msg::kWarning)
00232             << "PlotMuonClusterModule: Unrecognized option " << opt
00233             << endl;
00234       }
00235    }
00236 
00237 // Invalid command.
00238    else {
00239       MSG("BubJobC", Msg::kWarning)
00240        << "PlotMuonClusterModule: Unrecognized command " << cmd << endl;
00241    }
00242 }

void PlotMuonClusterModule::Help  )  [virtual]
 

Implement to spew some useful help to cout

Reimplemented from JobCModule.

void PlotMuonClusterModule::Help  )  [virtual]
 

Implement to spew some useful help to cout

Reimplemented from JobCModule.

Definition at line 246 of file Alignment/tobien/PlotMuonClusterModule.cxx.

References MSG.

00247 {
00248 //
00249 //  Purpose:    Print help information for PlotMuonClusterModule.
00250 //
00251 //  Arguments:  n/a
00252 //
00253 //  Return:     n/a
00254 //
00255 
00256   MSG("BubJobC", Msg::kInfo)
00257     << "Help for 'PlotMuonClusterModule':" << endl
00258     << " PlotMuonClusterModule is a module for viewing clusters" << endl
00259     << " and fitted muon tracks to allow a visual comparison of" << endl
00260     << " the results of fit rejection. The clusters are" << endl
00261     << " displayed by adding:" << endl
00262     << "     PlotMuonClusterModule::Ana" << endl
00263     << " to the Path to be run. Note that the colours between" << endl
00264     << " the two cluster graphs do not necessarily correspond," << endl
00265     << " but do for the muon tracks." << endl
00266     << endl
00267     << "Commands implemented:" << endl
00268     << " /PlotMuonClusterModule/Set ListClust <listname>" << endl
00269     << "     Set name of CandMSTClusterList to retrieve." << endl
00270     << " /PlotMuonClusterModule/Set ListMuon <listname>" << endl
00271     << "     Set name of CandThruMuonList to retrieve." << endl
00272     << endl
00273     << " /PlotMuonClusterModule/Plot" << endl
00274     << "     Draw cluster plot with current limits." << endl
00275     << " /PlotMuonClusterModule/SetPlot <Zmin/Zmax/Umin/Umax/Vmin/Vmax>"
00276     << " <value>" << endl
00277     << "     Set axis limit value. The command" << endl
00278     << "       /PlotMuonClusterModule/Plot" << endl
00279     << "     must be reissued afterwards to update the plot." << endl
00280     << endl;
00281 }

void PlotMuonClusterModule::PlotClusters const CandMSTClusterListHandle cllh,
const CandThruMuonListHandle cmlh
[private]
 

Definition at line 282 of file BubbleSpeak/PlotMuonClusterModule.cxx.

References fAnaFits, fAnaGraphs, fAnaTmax, fAnaTmin, fAnaZmax, fAnaZmin, CandThruMuonHandle::GetClusterU(), CandThruMuonHandle::GetClusterV(), CandHandle::GetDaughterIterator(), PlexSEIdAltL::GetEnd(), CandThruMuonHandle::GetFitUFromZ(), CandThruMuonHandle::GetFitVFromZ(), CandClusterHandle::GetPlaneView(), CandDigitHandle::GetPlexSEIdAltL(), CandStripHandle::GetTPos(), UgliGeomHandle::GetTransverseExtent(), CandHandle::GetVldContext(), CandThruMuonHandle::GetZBeg(), CandThruMuonHandle::GetZEnd(), UgliGeomHandle::GetZExtent(), CandStripHandle::GetZPos(), MSG, and RedrawPlot().

00285 {
00286 //
00287 //  Purpose:  Prepare clusters for plotting, then call method to draw
00288 //            plot.
00289 //
00290 //  Arguments:
00291 //    cllh    in     Handle to list of clusters to plot.
00292 //    cmlh    in     Handle to list of muons with clusters to plot.
00293 //
00294 //  Return:   n/a
00295 //
00296 
00297 // Clear old graphs and lines and create new ones.
00298   for (Int_t i=0; i<8; i++) {
00299     if (fAnaGraphs[i]) {
00300       fAnaGraphs[i]->Delete();
00301       delete fAnaGraphs[i];
00302     }
00303     fAnaGraphs[i] = new TObjArray();
00304   }
00305   for (Int_t i=0; i<2; i++) {
00306     if (fAnaFits[i]) {
00307       fAnaFits[i]->Delete();
00308       delete fAnaFits[i];
00309     }
00310     fAnaFits[i] = new TObjArray();
00311   }
00312 
00313 // Initialize limits to detector extents.
00314   UgliGeomHandle *ugh = 0;
00315   if (cllh) ugh = new UgliGeomHandle(*cllh->GetVldContext());
00316   else if (cmlh) ugh = new UgliGeomHandle(*cmlh->GetVldContext());
00317   else return;
00318   ugh->GetTransverseExtent(PlaneView::kU, fAnaTmin[0], fAnaTmax[0]);
00319   ugh->GetTransverseExtent(PlaneView::kV, fAnaTmin[1], fAnaTmax[1]);
00320   ugh->GetZExtent(fAnaZmin, fAnaZmax);
00321 
00322 // Iterate over clusters.
00323   if (cllh) {
00324     Int_t npts[2] = { 0,0 };
00325     CandMSTClusterHandleItr clhItr(cllh->GetDaughterIterator());
00326     while (CandMSTClusterHandle *clh = clhItr()) {
00327 
00328 // Determine strip orientation of cluster.
00329       Int_t clusv = -1;    // 0=U, 1=V
00330       switch (clh->GetPlaneView()) {
00331       case PlaneView::kU:
00332         clusv = 0;
00333         break;
00334       case PlaneView::kV:
00335         clusv = 1;
00336         break;
00337       case PlaneView::kA:
00338       case PlaneView::kB:
00339         MSG("BubJobC", Msg::kInfo)
00340           << "Plane views A and B not plotted." << endl;
00341         continue;  // jump to next cluster
00342         break;
00343       default:
00344         MSG("BubJobC", Msg::kWarning)
00345           << "Unrecognized strip orientation." << endl;
00346         continue;  // jump to next cluster
00347       }
00348 
00349 // Fill new graph.
00350       TGraph *clusg[2];
00351       clusg[0] = new TGraph();
00352       clusg[1] = new TGraph();
00353       Int_t cluspts[2] = { 0,0 };    // Number of points in clusg[i].
00354       CandDigiPairHandleItr chhItr(clh->GetDaughterIterator());
00355       while (CandDigiPairHandle *chh = chhItr()) {
00356         CandDigitHandleItr cdhItr(chh->GetDaughterIterator());
00357         while (CandDigitHandle *cdh = cdhItr()) {
00358           Int_t en = cdh->GetPlexSEIdAltL().GetEnd() - 1;
00359           clusg[en]->SetPoint(cluspts[en]++,
00360                               chh->GetZPos(), chh->GetTPos());
00361         }
00362       }
00363       clusg[0]->SetMarkerStyle(4);
00364       clusg[0]->SetMarkerSize(0.5);
00365       clusg[0]->SetMarkerColor(npts[clusv]+2);
00366       clusg[1]->SetMarkerStyle(5);
00367       clusg[1]->SetMarkerSize(0.7);
00368       clusg[1]->SetMarkerColor(npts[clusv]+2);
00369 
00370 // Store graph for future plotting and deletion.
00371       fAnaGraphs[2*clusv]->AddAtAndExpand(clusg[0], npts[clusv]);
00372       fAnaGraphs[2*clusv+4]->AddAtAndExpand(clusg[1], npts[clusv]++);
00373     }
00374   }
00375 
00376 // Iterate over muons.
00377   if (cmlh) {
00378     Int_t nmus = 0;
00379     CandThruMuonHandleItr cmhItr(cmlh->GetDaughterIterator());
00380     while (CandThruMuonHandle *cmh = cmhItr()) {
00381 
00382 // Retrieve U-cluster, fill new graph, and save for future plotting.
00383       const CandStraightClusterHandle *cchU = cmh->GetClusterU();
00384       TGraph *clusg[2];
00385       clusg[0] = new TGraph();
00386       clusg[1] = new TGraph();
00387       Int_t cluspts[2] = { 0,0 };    // Number of points in clusg[i].
00388       CandDigiPairHandleItr chhUItr(cchU->GetDaughterIterator());
00389       while (CandDigiPairHandle *chhU = chhUItr()) {
00390         CandDigitHandleItr cdhItr(chhU->GetDaughterIterator());
00391         while (CandDigitHandle *cdh = cdhItr()) {
00392           Int_t en = cdh->GetPlexSEIdAltL().GetEnd() - 1;
00393           clusg[en]->SetPoint(cluspts[en]++,
00394                               chhU->GetZPos(), chhU->GetTPos());
00395         }
00396       }
00397       clusg[0]->SetMarkerStyle(4);
00398       clusg[0]->SetMarkerSize(0.5);
00399       clusg[0]->SetMarkerColor(nmus+2);
00400       clusg[1]->SetMarkerStyle(5);
00401       clusg[1]->SetMarkerSize(0.7);
00402       clusg[1]->SetMarkerColor(nmus+2);
00403       fAnaGraphs[1]->AddAtAndExpand(clusg[0], nmus);
00404       fAnaGraphs[5]->AddAtAndExpand(clusg[1], nmus);
00405 
00406 // Retrieve V-cluster, fill new graph, and save for future plotting.
00407       const CandStraightClusterHandle *cchV = cmh->GetClusterV();
00408       clusg[0] = new TGraph();
00409       clusg[1] = new TGraph();
00410       cluspts[0] = 0;
00411       cluspts[1] = 0;
00412       CandDigiPairHandleItr chhVItr(cchV->GetDaughterIterator());
00413       while (CandDigiPairHandle *chhV = chhVItr()) {
00414         CandDigitHandleItr cdhItr(chhV->GetDaughterIterator());
00415         while (CandDigitHandle *cdh = cdhItr()) {
00416           Int_t en = cdh->GetPlexSEIdAltL().GetEnd() - 1;
00417           clusg[en]->SetPoint(cluspts[en]++,
00418                               chhV->GetZPos(), chhV->GetTPos());
00419         }
00420       }
00421       clusg[0]->SetMarkerStyle(4);
00422       clusg[0]->SetMarkerSize(0.5);
00423       clusg[0]->SetMarkerColor(nmus+2);
00424       clusg[1]->SetMarkerStyle(5);
00425       clusg[1]->SetMarkerSize(0.7);
00426       clusg[1]->SetMarkerColor(nmus+2);
00427       fAnaGraphs[3]->AddAtAndExpand(clusg[0], nmus);
00428       fAnaGraphs[7]->AddAtAndExpand(clusg[1], nmus);
00429 
00430 // Set fit line endpoints.
00431       Float_t zbeg = cmh->GetZBeg();
00432       Float_t zend = cmh->GetZEnd();
00433       Float_t ubeg = cmh->GetFitUFromZ(zbeg);
00434       Float_t uend = cmh->GetFitUFromZ(zend);
00435       Float_t vbeg = cmh->GetFitVFromZ(zbeg);
00436       Float_t vend = cmh->GetFitVFromZ(zend);
00437 
00438 // Create fit lines for each view.
00439       TLine *fitl = new TLine(zbeg, ubeg, zend, uend);
00440       fitl->SetLineColor(nmus+2);
00441       fAnaFits[0]->AddAtAndExpand(fitl, nmus);
00442       fitl = new TLine(zbeg, vbeg, zend, vend);
00443       fitl->SetLineColor(nmus+2);
00444       fAnaFits[1]->AddAtAndExpand(fitl, nmus++);
00445 
00446 // Update plot limits.
00447       if (zbeg < fAnaZmin) fAnaZmin = zbeg;
00448       if (zend > fAnaZmax) fAnaZmax = zend;
00449       if (ubeg < fAnaTmin[0]) fAnaTmin[0] = ubeg;
00450       if (ubeg > fAnaTmax[0]) fAnaTmax[0] = ubeg;
00451       if (uend < fAnaTmin[0]) fAnaTmin[0] = uend;
00452       if (uend > fAnaTmax[0]) fAnaTmax[0] = uend;
00453       if (vbeg < fAnaTmin[1]) fAnaTmin[1] = vbeg;
00454       if (vbeg > fAnaTmax[1]) fAnaTmax[1] = vbeg;
00455       if (vend < fAnaTmin[1]) fAnaTmin[1] = vend;
00456       if (vend > fAnaTmax[1]) fAnaTmax[1] = vend;
00457     }
00458   }
00459 
00460 // Draw plot.
00461   RedrawPlot();
00462 }

void PlotMuonClusterModule::PlotClusters const CandMSTClusterListHandle cllh,
const CandThruMuonListHandle cmlh
[private]
 

Definition at line 285 of file Alignment/tobien/PlotMuonClusterModule.cxx.

References fAnaFits, fAnaGraphs, fAnaTmax, fAnaTmin, fAnaZmax, fAnaZmin, CandDigiPairHandle::GetCharge(), CandThruMuonHandle::GetClusterU(), CandThruMuonHandle::GetClusterV(), CandHandle::GetDaughterIterator(), CandThruMuonHandle::GetFitUFromZ(), CandThruMuonHandle::GetFitVFromZ(), CandStripHandle::GetPlane(), CandClusterHandle::GetPlaneView(), CandStripHandle::GetTPos(), CandHandle::GetVldContext(), CandThruMuonHandle::GetZBeg(), CandThruMuonHandle::GetZEnd(), CandStripHandle::GetZPos(), MSG, and RedrawPlot().

Referenced by Ana().

00288 {
00289 //
00290 //  Purpose:  Prepare clusters for plotting, then call method to draw
00291 //            plot.
00292 //
00293 //  Arguments:
00294 //    cllh    in     Handle to list of clusters to plot.
00295 //    cmlh    in     Handle to list of muons with clusters to plot.
00296 //
00297 //  Return:   n/a
00298 //
00299 
00300   // NT
00301  
00302   iEvent++;
00303 
00304 // Clear old graphs and lines and create new ones.
00305   for (Int_t i=0; i<4; i++) {
00306     if (fAnaGraphs[i]) {
00307       fAnaGraphs[i]->Delete();
00308       delete fAnaGraphs[i];
00309     }
00310     fAnaGraphs[i] = new TObjArray();
00311   }
00312   for (Int_t i=0; i<2; i++) {
00313     if (fAnaFits[i]) {
00314       fAnaFits[i]->Delete();
00315       delete fAnaFits[i];
00316     }
00317     fAnaFits[i] = new TObjArray();
00318   }
00319 
00320 // Initialize limits to detector extents.
00321   UgliGeomHandle ugh(*cllh.GetVldContext());
00322   ugh.GetTransverseExtent(PlaneView::kU, fAnaTmin[0], fAnaTmax[0]);
00323   ugh.GetTransverseExtent(PlaneView::kV, fAnaTmin[1], fAnaTmax[1]);
00324   ugh.GetZExtent(fAnaZmin, fAnaZmax);
00325 
00326 /*
00327 // Initialize limits for all graphs.
00328   fAnaZmin    =  1e7;
00329   fAnaZmax    = -1e7;
00330   fAnaTmin[0] =  1e7;
00331   fAnaTmin[1] =  1e7;
00332   fAnaTmax[0] = -1e7;
00333   fAnaTmax[1] = -1e7;
00334 */
00335 
00336 // Iterate over clusters.
00337   Int_t npts[2] = { 0,0 };
00338   CandMSTClusterHandleItr clhItr(cllh.GetDaughterIterator());
00339   while (CandMSTClusterHandle *clh = clhItr()) {
00340 
00341   MSG("BubJobC", Msg::kDebug) << "before strip orientation" << endl;
00342 
00343 // Determine strip orientation of cluster.
00344     Int_t clusv = -1;    // 0=U, 1=V
00345     switch (clh->GetPlaneView()) {
00346     case PlaneView::kU:
00347       clusv = 0;
00348       break;
00349     case PlaneView::kV:
00350       clusv = 1;
00351       break;
00352     case PlaneView::kA:
00353     case PlaneView::kB:
00354       MSG("BubJobC", Msg::kInfo)
00355          << "Plane views A and B not plotted." << endl;
00356       continue;  // jump to next cluster
00357       break;
00358     default:
00359       MSG("BubJobC", Msg::kWarning)
00360          << "Unrecognized strip orientation." << endl;
00361       continue;  // jump to next cluster
00362     }
00363 
00364   MSG("BubJobC", Msg::kDebug) << "after strip orientation" << endl;
00365 
00366 // Fill new graph.
00367     MSG("BubJobC", Msg::kDebug) << "start TGraph" << endl;
00368     TGraph *clusg = new TGraph();
00369     Int_t cluspts = 0;    // Number of points in clusg.
00370     CandDigiPairHandleItr chhItr(clh->GetDaughterIterator());
00371     MSG("BubJobC", Msg::kDebug) << "after GetDaughterIterator" << endl;
00372 //    while (CandDigiPairHandle *chh = chhItr()) {
00373 //      MSG("BubJobC", Msg::kDebug) << "Iteration loop" << endl;
00374 //      if(clusg&&chh){
00375 //        clusg->SetPoint(cluspts++, chh->GetZPos(), chh->GetTPos());
00376 //      }
00377 //    }
00378     MSG("BubJobC", Msg::kDebug) << "after Iteration" << endl;
00379     clusg->SetMarkerStyle(8);
00380     clusg->SetMarkerSize(0.5);
00381     clusg->SetMarkerColor(npts[clusv]+2);
00382 
00383 // Update limits.
00384 /*
00385     if (clh->GetZmin() < fAnaZmin) fAnaZmin = clh->GetZmin();
00386     if (clh->GetZmax() > fAnaZmax) fAnaZmax = clh->GetZmax();
00387     if (clh->GetTmin() < fAnaTmin[clusv])
00388                                    fAnaTmin[clusv] = clh->GetTmin();
00389     if (clh->GetTmax() > fAnaTmax[clusv])
00390                                    fAnaTmax[clusv] = clh->GetTmax();
00391 */
00392 
00393 // Store graph for future plotting and deletion.
00394     fAnaGraphs[2*clusv]->AddAtAndExpand(clusg, npts[clusv]++);
00395   }
00396 
00397 // Iterate over muons.
00398 
00399   MSG("BubJobC", Msg::kDebug) << "Iterate over muons." << endl;
00400   Int_t nmus = 0;
00401   CandThruMuonHandleItr cmhItr(cmlh.GetDaughterIterator());
00402   while (CandThruMuonHandle *cmh = cmhItr()) {
00403 
00404 // Retrieve U-cluster, fill new graph, and save for future plotting.
00405     const CandStraightClusterHandle *cchU = cmh->GetClusterU();
00406     TGraph *clusg = new TGraph();
00407     Int_t cluspts = 0;    // Number of points in clusg. 
00408     Int_t clusU=0;  
00409     Float_t chiSqU=0;  
00410     Float_t trueTransU=0;
00411     CandDigiPairHandleItr chhUItr(cchU->GetDaughterIterator());
00412     while (CandDigiPairHandle *chhU = chhUItr()) {
00413       clusg->SetPoint(cluspts++, chhU->GetZPos(), chhU->GetTPos());
00414 // NT
00415       clusU++;  
00416       chiSqU += (chhU->GetTPos() - cmh->GetFitUFromZ(chhU->GetZPos()))*
00417                 (chhU->GetTPos() - cmh->GetFitUFromZ(chhU->GetZPos()));
00418 // NT    
00419     }
00420 
00421     chiSqU /= 0.0001*clusU;
00422     cout << "clusU, chiSqU: " << clusU << " " << chiSqU << endl;
00423     clusU=0;
00424     if(chiSqU < fMaxChiSq){
00425       CandDigiPairHandleItr chhUItr2(cchU->GetDaughterIterator());
00426       while (CandDigiPairHandle *chhU = chhUItr2()) {
00427         clusg->SetPoint(cluspts++, chhU->GetZPos(), chhU->GetTPos());
00428         clusU++;  
00429         ofstream out("./tracks_data.out", ios::app); 
00430         out << iEvent << " " << 0 << " " << clusU << " "
00431             << chhU->GetZPos() << " " << chhU->GetTPos() << " "
00432             << chhU->GetPlane() << " " << chhU->GetCharge() << endl;    
00433       }
00434     }
00435 
00436     clusg->SetMarkerStyle(8);
00437     clusg->SetMarkerSize(0.5);
00438     clusg->SetMarkerColor(nmus+2);
00439     fAnaGraphs[1]->AddAtAndExpand(clusg, nmus);
00440 
00441 // Retrieve V-cluster, fill new graph, and save for future plotting.
00442     const CandStraightClusterHandle *cchV = cmh->GetClusterV();
00443     clusg = new TGraph();
00444     cluspts = 0;
00445     Int_t clusV=0;    
00446     Float_t chiSqV=0;  
00447     Float_t trueTransV=0;
00448     CandDigiPairHandleItr chhVItr(cchV->GetDaughterIterator());
00449     while (CandDigiPairHandle *chhV = chhVItr()) {
00450       clusg->SetPoint(cluspts++, chhV->GetZPos(), chhV->GetTPos()); 
00451 // NT
00452       clusV++;  
00453       chiSqV += (chhV->GetTPos() - cmh->GetFitVFromZ(chhV->GetZPos()))*
00454                 (chhV->GetTPos() - cmh->GetFitVFromZ(chhV->GetZPos()));      
00455 // NT
00456 
00457     }    
00458     chiSqV /= 0.0001*clusV;
00459     cout << "clusV, chiSqV: " << clusV << " " << chiSqV << endl;
00460     clusV=0; 
00461     if(chiSqV < fMaxChiSq){
00462       CandDigiPairHandleItr chhVItr2(cchV->GetDaughterIterator());
00463       while (CandDigiPairHandle *chhV = chhVItr2()) {
00464         clusg->SetPoint(cluspts++, chhV->GetZPos(), chhV->GetTPos());
00465         clusV++;  
00466         ofstream out("./tracks_data.out", ios::app); 
00467         out << iEvent << " " << 1 << " " << clusV << " "
00468             << chhV->GetZPos() << " " << chhV->GetTPos() << " "
00469             << chhV->GetPlane() << " " <<  chhV->GetCharge()<< endl;    
00470       }
00471     }
00472 
00473     clusg->SetMarkerStyle(8);
00474     clusg->SetMarkerSize(0.5);
00475     clusg->SetMarkerColor(nmus+2);
00476     fAnaGraphs[3]->AddAtAndExpand(clusg, nmus);
00477 
00478 // Set fit line endpoints.
00479     Float_t zbeg = cmh->GetZBeg();
00480     Float_t zend = cmh->GetZEnd();
00481     Float_t ubeg = cmh->GetFitUFromZ(zbeg);
00482     Float_t uend = cmh->GetFitUFromZ(zend);
00483     Float_t vbeg = cmh->GetFitVFromZ(zbeg);
00484     Float_t vend = cmh->GetFitVFromZ(zend);
00485 
00486 // Create fit lines for each view.
00487     TLine *fitl = new TLine(zbeg, ubeg, zend, uend);
00488     fitl->SetLineColor(nmus+2);
00489     fAnaFits[0]->AddAtAndExpand(fitl, nmus);
00490     fitl = new TLine(zbeg, vbeg, zend, vend);
00491     fitl->SetLineColor(nmus+2);
00492     fAnaFits[1]->AddAtAndExpand(fitl, nmus++);
00493 
00494 // Update plot limits.
00495     if (zbeg < fAnaZmin) fAnaZmin = zbeg;
00496     if (zend > fAnaZmax) fAnaZmax = zend;
00497     if (ubeg < fAnaTmin[0]) fAnaTmin[0] = ubeg;
00498     if (ubeg > fAnaTmax[0]) fAnaTmax[0] = ubeg;
00499     if (uend < fAnaTmin[0]) fAnaTmin[0] = uend;
00500     if (uend > fAnaTmax[0]) fAnaTmax[0] = uend;
00501     if (vbeg < fAnaTmin[1]) fAnaTmin[1] = vbeg;
00502     if (vbeg > fAnaTmax[1]) fAnaTmax[1] = vbeg;
00503     if (vend < fAnaTmin[1]) fAnaTmin[1] = vend;
00504     if (vend > fAnaTmax[1]) fAnaTmax[1] = vend;
00505   }
00506 
00507 // Draw plot.
00508   MSG("BubJobC", Msg::kDebug) << "Draw plot" << endl;
00509   RedrawPlot();
00510 }

void PlotMuonClusterModule::RedrawPlot  )  [private]
 

void PlotMuonClusterModule::RedrawPlot  )  [private]
 

Definition at line 514 of file Alignment/tobien/PlotMuonClusterModule.cxx.

References fAnaBlanks, fAnaCanvas, fAnaFits, fAnaGraphs, fAnaTmax, fAnaTmin, fAnaZmax, and fAnaZmin.

Referenced by HandleCommand(), and PlotClusters().

00515 {
00516 //
00517 //  Purpose:    Draw plot of clusters.
00518 //
00519 //  Arguments:  n/a
00520 //
00521 //  Return:     n/a
00522 //
00523 
00524 // Turn off statistics.
00525   gStyle->SetOptStat(0);
00526 
00527 // Start with clear canvas.
00528   if (fAnaCanvas) fAnaCanvas->Clear("D");
00529   else {
00530     fAnaCanvas = new TCanvas("PlotMuonCanvas", "Muon Cluster Canvas",
00531                              1200, 700);
00532     fAnaCanvas->SetFillColor(0);
00533     fAnaCanvas->Divide(2, 2);
00534   }
00535 
00536 // Plot clusters.
00537   for (Int_t i=0; i<4; i++) {
00538     fAnaCanvas->cd(i+1);
00539     gPad->SetGrid();
00540 
00541 // Delete old blank and create new one.
00542     delete fAnaBlanks[i];
00543     char blankname[80];
00544     sprintf(blankname, "blank%d", i+1);
00545     fAnaBlanks[i] = new TH2F(blankname, "Clusters",
00546                 2, fAnaZmin, fAnaZmax, 2, fAnaTmin[i/2], fAnaTmax[i/2]);
00547 
00548     TString xtitle("z-value (");
00549     xtitle += Munits::base_length_name;
00550     xtitle += ")";
00551     // const_cast is only necessary until ROOT 3.00 is universal
00552     fAnaBlanks[i]->SetXTitle(const_cast<char*>(xtitle.Data()));
00553 
00554     TString ytitle((i/2 ? "v-value (" : "u-value ("));
00555     ytitle += Munits::base_length_name;
00556     ytitle += ")";
00557     // const_cast is only necessary until ROOT 3.00 is universal
00558     fAnaBlanks[i]->SetYTitle(const_cast<char*>(ytitle.Data()));
00559 
00560     fAnaBlanks[i]->Draw();
00561 
00562 // Plot graphs.
00563     for (Int_t j=0; j<fAnaGraphs[i]->GetEntries(); j++) {
00564       if (TGraph *grj = (TGraph*) fAnaGraphs[i]->At(j)) grj->Draw("P");
00565     }
00566   }
00567 
00568 // Plot fit lines.
00569   for (Int_t i=0; i<2; i++) {
00570     fAnaCanvas->cd(2*i+2);
00571     for (Int_t j=0; j<fAnaFits[i]->GetEntries(); j++) {
00572       if (TLine *fitl = dynamic_cast<TLine *>(fAnaFits[i]->At(j)))
00573          fitl->Draw();
00574     }
00575   }
00576 
00577 // Update.
00578   fAnaCanvas->Update();
00579 }


Member Data Documentation

TH2F* PlotMuonClusterModule::fAnaBlanks[4] [private]
 

Definition at line 54 of file BubbleSpeak/PlotMuonClusterModule.h.

TH2F* PlotMuonClusterModule::fAnaBlanks[4] [private]
 

Definition at line 59 of file Alignment/tobien/PlotMuonClusterModule.h.

Referenced by PlotMuonClusterModule(), and RedrawPlot().

TCanvas* PlotMuonClusterModule::fAnaCanvas [private]
 

Definition at line 53 of file BubbleSpeak/PlotMuonClusterModule.h.

TCanvas* PlotMuonClusterModule::fAnaCanvas [private]
 

Definition at line 58 of file Alignment/tobien/PlotMuonClusterModule.h.

Referenced by RedrawPlot().

TObjArray* PlotMuonClusterModule::fAnaFits[2] [private]
 

Definition at line 55 of file BubbleSpeak/PlotMuonClusterModule.h.

TObjArray* PlotMuonClusterModule::fAnaFits[2] [private]
 

Definition at line 60 of file Alignment/tobien/PlotMuonClusterModule.h.

Referenced by PlotClusters(), PlotMuonClusterModule(), and RedrawPlot().

TObjArray* PlotMuonClusterModule::fAnaGraphs[8] [private]
 

Definition at line 56 of file BubbleSpeak/PlotMuonClusterModule.h.

TObjArray* PlotMuonClusterModule::fAnaGraphs[8] [private]
 

Definition at line 61 of file Alignment/tobien/PlotMuonClusterModule.h.

Referenced by PlotClusters(), PlotMuonClusterModule(), and RedrawPlot().

Float_t PlotMuonClusterModule::fAnaTmax [private]
 

Definition at line 58 of file BubbleSpeak/PlotMuonClusterModule.h.

Referenced by HandleCommand(), PlotClusters(), and RedrawPlot().

Float_t PlotMuonClusterModule::fAnaTmin [private]
 

Definition at line 57 of file BubbleSpeak/PlotMuonClusterModule.h.

Referenced by HandleCommand(), PlotClusters(), and RedrawPlot().

Float_t PlotMuonClusterModule::fAnaZmax [private]
 

Definition at line 60 of file BubbleSpeak/PlotMuonClusterModule.h.

Referenced by HandleCommand(), PlotClusters(), and RedrawPlot().

Float_t PlotMuonClusterModule::fAnaZmin [private]
 

Definition at line 59 of file BubbleSpeak/PlotMuonClusterModule.h.

Referenced by HandleCommand(), PlotClusters(), and RedrawPlot().

TString PlotMuonClusterModule::fListClust [private]
 

Definition at line 49 of file BubbleSpeak/PlotMuonClusterModule.h.

Referenced by Ana(), and HandleCommand().

TString PlotMuonClusterModule::fListMuon [private]
 

Definition at line 50 of file BubbleSpeak/PlotMuonClusterModule.h.

Referenced by Ana(), and HandleCommand().

const Float_t PlotMuonClusterModule::fMaxChiSq = 3 [static, private]
 

Definition at line 35 of file Alignment/tobien/PlotMuonClusterModule.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:57:44 2007 for loon by  doxygen 1.3.9.1