00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "HadMuMonModule.h"
00013 #include "StripHist.h"
00014
00015 #include <JobControl/JobCModuleRegistry.h>
00016 #include <JobControl/JobCResult.h>
00017 #include <MessageService/MsgService.h>
00018
00019 #include <RawData/RawRecord.h>
00020 #include <RawData/RawBeamMonBlock.h>
00021 #include <RawData/RawBeamMonHeaderBlock.h>
00022 #include <RawData/RawBeamData.h>
00023
00024 #include <BeamDataUtil/BDSwicCalibrator.h>
00025 #include <BeamDataUtil/BDHadMuMon.h>
00026 #include <BeamDataUtil/BDDevices.h>
00027 #include <BeamDataUtil/BDSwicDevice.h>
00028
00029 #include <DataUtil/GetRawBlock.h>
00030 #include <Conventions/Munits.h>
00031
00032 #include <TPad.h>
00033 #include <TH2F.h>
00034 #include <TGraph.h>
00035 #include <TMultiGraph.h>
00036 #include <TCanvas.h>
00037 #include <TStyle.h>
00038 #include <TPaletteAxis.h>
00039
00040
00041
00042 #define minimum(a,b) ((a) > (b) ? (b) : (a))
00043 #define maximum(a,b) ((a) > (b) ? (a) : (b))
00044
00045 using namespace std;
00046 using namespace DataUtil;
00047
00048 CVSID("$Id: HadMuMonModule.cxx,v 1.9 2005/06/09 15:26:43 thosieck Exp $");
00049 JOBMODULE(HadMuMonModule,"HadMuMon","HadMuMon quantities related for Monitoring");
00050
00051 HadMuMonModule::HadMuMonModule()
00052 {
00053
00054 StripHist *sh1 = new StripHist("Beam Intensity Alcove 1 (mV)","Muon Monitor Beam Intensity Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00055 StripHist *sh2 = new StripHist("Beam Intensity Alcove 2 (mV)","Muon Monitor Beam Intensity Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00056 StripHist *sh3 = new StripHist("Beam Intensity Alcove 3 (mV)","Muon Monitor Beam Intensity Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00057 StripHist *sh4 = new StripHist("Beam X Centroid Alcove 1","Beam X Centroid Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00058 StripHist *sh5 = new StripHist("Beam X Centroid Alcove 2","Beam X Centroid Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00059 StripHist *sh6 = new StripHist("Beam X Centroid Alcove 3","Beam X Centroid Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00060 StripHist *sh7 = new StripHist("Beam Y Centroid Alcove 1","Beam Y Centroid Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00061 StripHist *sh8 = new StripHist("Beam Y Centroid Alcove 2","Beam Y Centroid Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00062 StripHist *sh9 = new StripHist("Beam Y Centroid Alcove 3","Beam Y Centroid Red=Alcove 1 Blue=Alcove 2 Black=Alcove 3");
00063 StripHist *sh10 = new StripHist("Beam Intensity HadMon (mV)","Hadron Monitor Beam Intensity");
00064 StripHist *sh11 = new StripHist("Beam X HadMon","Hadron Monitor Beam Position Red=X Blue=Y");
00065 StripHist *sh12 = new StripHist("Beam Y HadMon","Hadron Monitor Beam Position Red=X Blue=Y");
00066 StripHist *sh13 = new StripHist("Beam X RMS HadMon","Hadron Monitor Beam RMS Red=X Blue=Y");
00067 StripHist *sh14 = new StripHist("Beam Y RMS HadMon","Hadron Monitor Beam RMS Red=X Blue=Y");
00068
00069 TH2F *MuonMonitor1 = new TH2F("MuonMonitor1","Alcove 1 Muon Monitor Intensity",9,-45,45,9,-45,45);
00070 TH2F *MuonMonitor2 = new TH2F("MuonMonitor2","Alcove 2 Muon Monitor Intensity",9,-45,45,9,-45,45);
00071 TH2F *MuonMonitor3 = new TH2F("MuonMonitor3","Alcove 3 Muon Monitor Intensity",9,-45,45,9,-45,45);
00072 TH2F *HadronMonitor = new TH2F("HadronMonitor","Hadron Monitor Intensity",7,-15.75,15.75,7,-15.75,15.75);
00073
00074 TH1F *HadronMonitorX = new TH1F("HadronMonitorX","Hadron Monitor Intensity in X Position",7,-15.75,15.75);
00075 TH1F *HadronMonitorY = new TH1F("HadronMonitorY","Hadron Monitor Intensity in Y Position",7,-15.75,15.75);
00076
00077 sh1 -> SetLineColor(2);
00078 sh2 -> SetLineColor(4);
00079 sh4 -> SetLineColor(2);
00080 sh5 -> SetLineColor(4);
00081 sh7 -> SetLineColor(2);
00082 sh8 -> SetLineColor(4);
00083 sh11 -> SetLineColor(2);
00084 sh12 -> SetLineColor(4);
00085 sh13 -> SetLineColor(2);
00086 sh14 -> SetLineColor(4);
00087
00088 sh1 -> SetStripRange(1*Munits::day);
00089 sh2 -> SetStripRange(1*Munits::day);
00090 sh3 -> SetStripRange(1*Munits::day);
00091 sh4 -> SetStripRange(1*Munits::day);
00092 sh5 -> SetStripRange(1*Munits::day);
00093 sh6 -> SetStripRange(1*Munits::day);
00094 sh7 -> SetStripRange(1*Munits::day);
00095 sh8 -> SetStripRange(1*Munits::day);
00096 sh9 -> SetStripRange(1*Munits::day);
00097 sh10 -> SetStripRange(1*Munits::day);
00098 sh11 -> SetStripRange(1*Munits::day);
00099 sh12 -> SetStripRange(1*Munits::day);
00100 sh13 -> SetStripRange(1*Munits::day);
00101 sh14 -> SetStripRange(1*Munits::day);
00102
00103 HadronMonitorX->GetXaxis()->SetTitle("Horizontal Position (inches)");
00104 HadronMonitorY->GetXaxis()->SetTitle("Vertical Position (inches)");
00105
00106 HadronMonitorX->GetYaxis()->SetTitle("Beam Intensity (mV)");
00107 HadronMonitorY->GetYaxis()->SetTitle("Beam Intensity (mV)");
00108
00109 HadronMonitor->GetXaxis()->SetTitle("Horizontal Position (inches)");
00110 HadronMonitor->GetYaxis()->SetTitle("Vertical Position (inches)");
00111
00112 MuonMonitor1->GetXaxis()->SetTitle("Horizontal Position (inches)");
00113 MuonMonitor1->GetYaxis()->SetTitle("Vertical Position (inches)");
00114
00115 MuonMonitor2->GetXaxis()->SetTitle("Horizontal Position (inches)");
00116 MuonMonitor2->GetYaxis()->SetTitle("Vertical Position (inches)");
00117
00118 MuonMonitor3->GetXaxis()->SetTitle("Horizontal Position (inches)");
00119 MuonMonitor3->GetYaxis()->SetTitle("Vertical Position (inches)");
00120
00121 HadronMonitor->GetXaxis()->CenterTitle();
00122 HadronMonitor->GetYaxis()->CenterTitle();
00123
00124 MuonMonitor1->GetXaxis()->CenterTitle();
00125 MuonMonitor1->GetYaxis()->CenterTitle();
00126
00127 MuonMonitor2->GetXaxis()->CenterTitle();
00128 MuonMonitor2->GetYaxis()->CenterTitle();
00129
00130 MuonMonitor3->GetXaxis()->CenterTitle();
00131 MuonMonitor3->GetYaxis()->CenterTitle();
00132
00133 HadronMonitorX->GetXaxis()->CenterTitle();
00134 HadronMonitorY->GetXaxis()->CenterTitle();
00135
00136 HadronMonitorX->GetYaxis()->CenterTitle();
00137 HadronMonitorY->GetYaxis()->CenterTitle();
00138
00139 MuonMonitor1->SetStats(0);
00140 MuonMonitor2->SetStats(0);
00141 MuonMonitor3->SetStats(0);
00142 HadronMonitor->SetStats(0);
00143
00144 sh1->SetGraphYTitle("Beam Intensity (mV)");
00145 sh2->SetGraphYTitle("Beam Intensity (mV)");
00146 sh3->SetGraphYTitle("Beam Intensity (mV)");
00147
00148 sh4->SetGraphYTitle("Beam X Centroid (mm)");
00149 sh5->SetGraphYTitle("Beam X Centroid (mm)");
00150 sh6->SetGraphYTitle("Beam X Centroid (mm)");
00151
00152 sh7->SetGraphYTitle("Beam Y Centroid (mm)");
00153 sh8->SetGraphYTitle("Beam Y Centroid (mm)");
00154 sh9->SetGraphYTitle("Beam Y Centroid (mm)");
00155
00156 sh10->SetGraphYTitle("Beam Intensity (mV)");
00157 sh11->SetGraphYTitle("Beam Position (mm)");
00158 sh12->SetGraphYTitle("Beam Position (mm)");
00159 sh13->SetGraphYTitle("Beam RMS (mm)");
00160 sh14->SetGraphYTitle("Beam RMS (mm)");
00161
00162 fStripHist["Beam Intensity Alcove 1"] = sh1;
00163 fStripHist["Beam Intensity Alcove 2"] = sh2;
00164 fStripHist["Beam Intensity Alcove 3"] = sh3;
00165 fStripHist["Beam X Centroid Alcove 1"] = sh4;
00166 fStripHist["Beam X Centroid Alcove 2"] = sh5;
00167 fStripHist["Beam X Centroid Alcove 3"] = sh6;
00168 fStripHist["Beam Y Centroid Alcove 1"] = sh7;
00169 fStripHist["Beam Y Centroid Alcove 2"] = sh8;
00170 fStripHist["Beam Y Centroid Alcove 3"] = sh9;
00171 fStripHist["Beam Intensity HadMon"] = sh10;
00172 fStripHist["Beam X HadMon"] = sh11;
00173 fStripHist["Beam Y HadMon"] = sh12;
00174 fStripHist["Beam X RMS HadMon"] = sh13;
00175 fStripHist["Beam Y RMS HadMon"] = sh14;
00176
00177 fTH2F["MuonMonitor1"] = MuonMonitor1;
00178 fTH2F["MuonMonitor2"] = MuonMonitor2;
00179 fTH2F["MuonMonitor3"] = MuonMonitor3;
00180 fTH2F["HadronMonitor"] = HadronMonitor;
00181
00182 fTH1F["HadronMonitorX"] = HadronMonitorX;
00183 fTH1F["HadronMonitorY"] = HadronMonitorY;
00184 }
00185
00186 HadMuMonModule::~HadMuMonModule()
00187 {
00188
00189 }
00190
00191 typedef std::map<std::string, TH2F*> TH2FMap;
00192 typedef std::map<std::string, TH1F*> TH1FMap;
00193
00194 void HadMuMonModule::BeginJob()
00195 {
00196 MSG("BD",Msg::kDebug) << "Adding Histograms!" << endl;
00197
00198 HistMan hm = this->GetHistMan();
00199
00200 StripHist *sh1 = fStripHist["Beam Intensity Alcove 1"];
00201 StripHist *sh2 = fStripHist["Beam Intensity Alcove 2"];
00202 StripHist *sh3 = fStripHist["Beam Intensity Alcove 3"];
00203
00204 TCanvas *canvas = new TCanvas("Beam Intensity from Muon Monitors","Muon Monitor Intensity",500,400);
00205
00206 sh1->DrawStrip("AL");
00207 sh2->DrawStrip("LP");
00208 sh3->DrawStrip("L");
00209
00210 hm.Adopt("HadMuMon",canvas);
00211
00212 StripHist *sh4 = fStripHist["Beam X Centroid Alcove 1"];
00213 StripHist *sh5 = fStripHist["Beam X Centroid Alcove 2"];
00214 StripHist *sh6 = fStripHist["Beam X Centroid Alcove 3"];
00215
00216 TCanvas *canvas2 = new TCanvas("Beam X Centroid from Muon Monitors","X Centroid",500,400);
00217
00218 sh4->DrawStrip("AL");
00219 sh5->DrawStrip("LP");
00220 sh6->DrawStrip("L");
00221
00222 hm.Adopt("HadMuMon",canvas2);
00223
00224 StripHist *sh7 = fStripHist["Beam Y Centroid Alcove 1"];
00225 StripHist *sh8 = fStripHist["Beam Y Centroid Alcove 2"];
00226 StripHist *sh9 = fStripHist["Beam Y Centroid Alcove 3"];
00227
00228 TCanvas *canvas3 = new TCanvas("Beam Y Centroid from Muon Monitors","Y Centroid",500,400);
00229
00230 sh7->DrawStrip("AL");
00231 sh8->DrawStrip("LP");
00232 sh9->DrawStrip("L");
00233
00234 hm.Adopt("HadMuMon",canvas3);
00235
00236 StripHist *sh10 = fStripHist["Beam Intensity HadMon"];
00237
00238 TCanvas *canvas4 = new TCanvas("Beam Intensity from Hadron Monitor","Hadron Monitor Intensity",500,400);
00239
00240 sh10->DrawStrip("AL");
00241
00242 hm.Adopt("HadMuMon",canvas4);
00243
00244 StripHist *sh11 = fStripHist["Beam X HadMon"];
00245 StripHist *sh12 = fStripHist["Beam Y HadMon"];
00246
00247 TCanvas *canvas5 = new TCanvas("Hadron Monitor Beam Location","Beam Location",500,400);
00248
00249 sh11->DrawStrip("AL");
00250 sh12->DrawStrip("LP");
00251
00252 hm.Adopt("HadMuMon",canvas5);
00253
00254 StripHist *sh13 = fStripHist["Beam X RMS HadMon"];
00255 StripHist *sh14 = fStripHist["Beam Y RMS HadMon"];
00256
00257 TCanvas *canvas6 = new TCanvas("Hadron Monitor Beam Size","Beam Size",500,400);
00258
00259 sh13->DrawStrip("AL");
00260 sh14->DrawStrip("LP");
00261
00262 hm.Adopt("HadMuMon",canvas6);
00263
00264 TH2FMap::iterator uchicago, done2 = fTH2F.end();
00265 for( uchicago = fTH2F.begin(); uchicago != done2; ++ uchicago) {
00266 TH2F *hist = uchicago->second;
00267 TCanvas* canvas = new TCanvas(hist->GetTitle(),hist->GetTitle(),500,400);
00268 hist->Draw("colz");
00269 hm.Adopt("HadMuMon",canvas);
00270 }
00271
00272 TH1FMap::iterator caltech, done3 = fTH1F.end();
00273 for( caltech = fTH1F.begin(); caltech != done3; ++caltech) {
00274 TH1F *hist = caltech->second;
00275 TCanvas* canvas8 = new TCanvas(hist->GetTitle(),hist->GetTitle(),500,400);
00276 hist->Draw();
00277 hm.Adopt("HadMuMon",canvas8);
00278 }
00279
00280 TH2F *th1 = fTH2F["MuonMonitor1"];
00281 TH2F *th2 = fTH2F["MuonMonitor2"];
00282 TH2F *th3 = fTH2F["MuonMonitor3"];
00283 TH2F *th4 = fTH2F["HadronMonitor"];
00284 TH1F *th5 = fTH1F["HadronMonitorX"];
00285 TH1F *th6 = fTH1F["HadronMonitorY"];
00286
00287 TCanvas *MuMonSumCan = new TCanvas("Muon Monitor Summary Canvas","Muon Monitor Summary Canvas",800,800);
00288 MuMonSumCan -> Divide(2,3);
00289 MuMonSumCan -> cd(1);
00290 th1 -> Draw("colz");
00291 MuMonSumCan -> cd(2);
00292 sh1 -> DrawStrip("AL");
00293 sh2 -> DrawStrip("LP");
00294 sh3 -> DrawStrip("L");
00295 MuMonSumCan -> cd(3);
00296 th2 -> Draw("colz");
00297 MuMonSumCan -> cd(4);
00298 sh4 -> DrawStrip("AL");
00299 sh5 -> DrawStrip("LP");
00300 sh6 -> DrawStrip("L");
00301 MuMonSumCan -> cd(5);
00302 th3 -> Draw("colz");
00303 MuMonSumCan -> cd(6);
00304 sh7 -> DrawStrip("AL");
00305 sh8 -> DrawStrip("LP");
00306 sh9 -> DrawStrip("L");
00307
00308 hm.Adopt("Summary Canvases",MuMonSumCan);
00309
00310 TCanvas *HadMonSumCan = new TCanvas("Hadron Monitor Summary Canvas","Hadron Monitor Summary Canvas",800,800);
00311 HadMonSumCan -> Divide(2,3);
00312 HadMonSumCan -> cd(1);
00313 th4->Draw("colz");
00314 HadMonSumCan -> cd(2);
00315 sh10->DrawStrip("AL");
00316 HadMonSumCan -> cd(3);
00317 th5->Draw();
00318 HadMonSumCan -> cd(4);
00319 sh11->DrawStrip("AL");
00320 sh12->DrawStrip("L");
00321 HadMonSumCan -> cd(5);
00322 th6->Draw();
00323 HadMonSumCan -> cd(6);
00324 sh13->DrawStrip("AL");
00325 sh14->DrawStrip("L");
00326
00327 hm.Adopt("Summary Canvases",HadMonSumCan);
00328
00329 }
00330
00331 void HadMuMonModule::Fill(const RawBeamMonHeaderBlock& head, const RawBeamMonBlock& block)
00332 {
00333 MSG("BD",Msg::kDebug) << "Starting HadMuMonModule::Fill" << endl;
00334
00335 const RawBeamData *mma1ds = block["E:MMA1DS"];
00336 const RawBeamData *mma2ds = block["E:MMA2DS"];
00337 const RawBeamData *mma3ds = block["E:MMA3DS"];
00338 const RawBeamData *hadmds = block["E:HADMDS"];
00339 const RawBeamData *Etrtgtd = block["E:TRTGTD"];
00340
00341 if(Etrtgtd && Etrtgtd->GetDataLength()) {
00342 double P2tgt = Etrtgtd->GetData()[0];
00343 if(P2tgt < 0.1) {
00344
00345 return;
00346 }
00347 }
00348
00349 if(!(mma1ds && mma2ds && mma3ds)) {
00350 MSG("BD",Msg::kDebug) << "Do not have Muon Monitor Data!" << endl;
00351 if(!mma1ds) MSG("BD",Msg::kDebug) << " No MMA1DS" << endl;
00352 if(!mma2ds) MSG("BD",Msg::kDebug) << " No MMA2DS" << endl;
00353 if(!mma3ds) MSG("BD",Msg::kDebug) << " No MMA3DS" << endl;
00354 return;
00355 }
00356
00357 if(!(mma1ds->GetDataLength() &&
00358 mma2ds->GetDataLength() &&
00359 mma3ds->GetDataLength())) {
00360 MSG("BD",Msg::kDebug) << " Muon Monitor device but no data!" << endl;
00361 return;
00362 }
00363
00364 if(!hadmds || !hadmds->GetDataLength()) {
00365 MSG("BD",Msg::kDebug) << " No Hadron Monitor Data!" << endl;
00366 return;
00367 }
00368
00369 MSG("BD",Msg::kDebug) << mma1ds->GetName() << ", len = " << mma1ds->GetDataLength() << endl;
00370 BDHadMuMon hmm1(*mma1ds);
00371 MSG("BD",Msg::kDebug) << mma1ds->GetName() << ", len = " << mma1ds->GetDataLength() << endl;
00372 MSG("BD",Msg::kDebug) << mma1ds->GetName() << ", tot = " << hmm1.GetTotalVoltage() << endl;
00373 BDHadMuMon hmm2(*mma2ds);
00374 MSG("BD",Msg::kDebug) << mma2ds->GetName() << ", tot = " << hmm2.GetTotalVoltage() << endl;
00375 BDHadMuMon hmm3(*mma3ds);
00376 MSG("BD",Msg::kDebug) << mma3ds->GetName() << ", tot = " << hmm3.GetTotalVoltage() << endl;
00377 BDHadMuMon hmm4(*hadmds);
00378 MSG("BD",Msg::kDebug) << hadmds->GetName() << ", tot = " << hmm4.GetTotalVoltage() << endl;
00379
00380 BDSwicCalibrator::Get().Calibrate(head,block);
00381
00382 TH2F *h1 = fTH2F["MuonMonitor1"];
00383 TH2F *h2 = fTH2F["MuonMonitor2"];
00384 TH2F *h3 = fTH2F["MuonMonitor3"];
00385 TH2F *h4 = fTH2F["HadronMonitor"];
00386
00387 h1->Reset(); h2->Reset(); h3->Reset(); h4->Reset();
00388
00389 TH1F *h5 = fTH1F["HadronMonitorX"];
00390 TH1F *h6 = fTH1F["HadronMonitorY"];
00391
00392 h5->Reset(); h6->Reset();
00393
00394 StripHist* sh1 = fStripHist["Beam Intensity Alcove 1"];
00395 StripHist* sh2 = fStripHist["Beam Intensity Alcove 2"];
00396 StripHist* sh3 = fStripHist["Beam Intensity Alcove 3"];
00397 StripHist* sh4 = fStripHist["Beam X Centroid Alcove 1"];
00398 StripHist* sh5 = fStripHist["Beam X Centroid Alcove 2"];
00399 StripHist* sh6 = fStripHist["Beam X Centroid Alcove 3"];
00400 StripHist* sh7 = fStripHist["Beam Y Centroid Alcove 1"];
00401 StripHist* sh8 = fStripHist["Beam Y Centroid Alcove 2"];
00402 StripHist* sh9 = fStripHist["Beam Y Centroid Alcove 3"];
00403 StripHist* sh10 = fStripHist["Beam Intensity HadMon"];
00404 StripHist* sh11 = fStripHist["Beam X HadMon"];
00405 StripHist* sh12 = fStripHist["Beam Y HadMon"];
00406 StripHist* sh13 = fStripHist["Beam X RMS HadMon"];
00407 StripHist* sh14 = fStripHist["Beam Y RMS HadMon"];
00408
00409 for(int row = 1; row <= hmm1.GetNrowcol(); row++) {
00410 for(int col = 1; col <= hmm1.GetNrowcol(); col++) {
00411
00412 int index = hmm1.Index(hmm1.Channel(row,col));
00413 h1->Fill(hmm1.PixelPosition(col) / Munits::inch,
00414 hmm1.PixelPosition(row) / Munits::inch,
00415 hmm1.GetVoltage(index)/Munits::millivolt);
00416
00417 h2->Fill(hmm2.PixelPosition(col) / Munits::inch,
00418 hmm2.PixelPosition(row) / Munits::inch,
00419 hmm2.GetVoltage(index)/Munits::millivolt);
00420
00421 h3->Fill(hmm3.PixelPosition(col) / Munits::inch,
00422 hmm3.PixelPosition(row) / Munits::inch,
00423 hmm3.GetVoltage(index)/Munits::millivolt);
00424 }
00425 }
00426
00427 for(int row = 1; row <= hmm4.GetNrowcol(); row++) {
00428 for(int col = 1; col <= hmm4.GetNrowcol(); col++) {
00429 double v = hmm4.GetVoltage(hmm4.Index(hmm4.Channel(row, col)));
00430 v /= Munits::millivolt;
00431 h4->Fill(hmm4.PixelPosition(col) / Munits::inch,
00432 hmm4.PixelPosition(row) / Munits::inch, v);
00433 h5->Fill(hmm4.PixelPosition(col) / Munits::inch, v);
00434 h6->Fill(hmm4.PixelPosition(row) / Munits::inch, v);
00435 }
00436 }
00437
00438 h5->GetYaxis()->SetTitleOffset(1.2);
00439 h6->GetYaxis()->SetTitleOffset(1.2);
00440
00441 double q1 = hmm1.GetTotalVoltage() / Munits::millivolt;
00442 double q2 = hmm2.GetTotalVoltage() / Munits::millivolt;
00443 double q3 = hmm3.GetTotalVoltage() / Munits::millivolt;
00444 double q4 = hmm4.GetTotalVoltage() / Munits::millivolt;
00445 double dae1 = mma1ds->GetSeconds() + 1.0e-6*mma1ds->GetMsecs();
00446 double dae2 = mma2ds->GetSeconds() + 1.0e-6*mma2ds->GetMsecs();
00447 double dae3 = mma3ds->GetSeconds() + 1.0e-6*mma3ds->GetMsecs();
00448 double dae4 = hadmds->GetSeconds() + 1.0e-6*hadmds->GetMsecs();
00449
00450 sh1 -> Fill(dae1, q1);
00451 sh2 -> Fill(dae2, q2);
00452 sh3 -> Fill(dae3, q3);
00453 sh10 -> Fill(dae4, q4);
00454
00455 double min1 = 0.0, max1 = 1.0;
00456
00457 RangeFinder(sh1, sh2, sh3, min1, max1);
00458
00459 sh1->GetStrip().GetYaxis()->SetRangeUser(min1, max1);
00460 sh2->GetStrip().GetYaxis()->SetRangeUser(min1, max1);
00461 sh3->GetStrip().GetYaxis()->SetRangeUser(min1, max1);
00462
00463 double xmean1 = 0.0, ymean1 = 0.0, xrms1 = 0.0, yrms1 = 0.0;
00464 double xmean2 = 0.0, ymean2 = 0.0, xrms2 = 0.0, yrms2 = 0.0;
00465 double xmean3 = 0.0, ymean3 = 0.0, xrms3 = 0.0, yrms3 = 0.0;
00466 double xmean4 = 0.0, ymean4 = 0.0, xrms4 = 0.0, yrms4 = 0.0;
00467
00468 hmm1.GetStats(xmean1, ymean1, xrms1, yrms1);
00469 hmm2.GetStats(xmean2, ymean2, xrms2, yrms2);
00470 hmm3.GetStats(xmean3, ymean3, xrms3, yrms3);
00471 hmm4.GetStats(xmean4, ymean4, xrms4, yrms4);
00472
00473 sh4 -> Fill(dae1, xmean1 / Munits::mm);
00474 sh5 -> Fill(dae2, xmean2 / Munits::mm);
00475 sh6 -> Fill(dae3, xmean3 / Munits::mm);
00476
00477 double min2 = 0.0, max2 = 1.0;
00478
00479 RangeFinder(sh4, sh5, sh6, min2, max2);
00480
00481 sh4->GetStrip().GetYaxis()->SetRangeUser(min2, max2);
00482 sh5->GetStrip().GetYaxis()->SetRangeUser(min2, max2);
00483 sh6->GetStrip().GetYaxis()->SetRangeUser(min2, max2);
00484
00485 sh7 -> Fill(dae1, ymean1 / Munits::mm);
00486 sh8 -> Fill(dae2, ymean2 / Munits::mm);
00487 sh9 -> Fill(dae3, ymean3 / Munits::mm);
00488
00489 double min3 = 0.0, max3 = 1.0;
00490
00491 RangeFinder(sh7, sh8, sh9, min3, max3);
00492
00493 sh7->GetStrip().GetYaxis()->SetRangeUser(min3, max3);
00494 sh8->GetStrip().GetYaxis()->SetRangeUser(min3, max3);
00495 sh9->GetStrip().GetYaxis()->SetRangeUser(min3, max3);
00496
00497 sh11 -> Fill(dae4, xmean4 / Munits::mm);
00498 sh12 -> Fill(dae4, ymean4 / Munits::mm);
00499
00500 double min4 = 0.0, max4 = 1.0;
00501
00502 RangeFinder(sh11, sh12, min4, max4);
00503
00504 sh11->GetStrip().GetYaxis()->SetRangeUser(min4, max4);
00505 sh12->GetStrip().GetYaxis()->SetRangeUser(min4, max4);
00506
00507 sh13 -> Fill(dae4, xrms4 / Munits::mm);
00508 sh14 -> Fill(dae4, yrms4 / Munits::mm);
00509
00510 double min5 = 0.0, max5 = 1.0;
00511
00512 RangeFinder(sh13, sh14, min5, max5);
00513
00514 sh13->GetStrip().GetYaxis()->SetRangeUser(min5, max5);
00515 sh14->GetStrip().GetYaxis()->SetRangeUser(min5, max5);
00516
00517 }
00518
00519 void HadMuMonModule::RangeFinder(StripHist *sh1, StripHist *sh2, StripHist *sh3, double &min, double &max)
00520 {
00521 double max1 = sh1->GetMax(), max2 = sh2->GetMax(), max3 = sh3->GetMax();
00522 double min1 = sh1->GetMin(), min2 = sh2->GetMin(), min3 = sh3->GetMin();
00523
00524 if(min1 < min2) {
00525 if(min1 < min3) {
00526 min = min1;
00527 } else {
00528 min = min3;
00529 }
00530 } else {
00531 if(min2 < min3) {
00532 min = min2;
00533 } else {
00534 min = min3;
00535 }
00536 }
00537
00538 if(max1 > max2) {
00539 if(max1 > max3) {
00540 max = max1;
00541 } else {
00542 max = max3;
00543 }
00544 } else {
00545 if(max2 > max3) {
00546 max = max2;
00547 } else {
00548 max = max3;
00549 }
00550 }
00551
00552 if(min != 0.0) {
00553 if(min < 0) {
00554 min *= 1.5;
00555 } else {
00556 min *= 0.5;
00557 }
00558 } else {
00559 min = -0.5;
00560 }
00561
00562 if(max != 0.0) {
00563 if(max < 0) {
00564 max *= 0.5;
00565 } else {
00566 max *= 1.5;
00567 }
00568 } else {
00569 max = 0.5;
00570 }
00571
00572 }
00573
00574 void HadMuMonModule::RangeFinder(StripHist *sh1, StripHist *sh2, double &min, double &max)
00575 {
00576 double max1 = sh1->GetMax(), max2 = sh2->GetMax();
00577 double min1 = sh1->GetMin(), min2 = sh2->GetMin();
00578
00579 min = minimum(min1, min2);
00580 max = maximum(max1, max2);
00581
00582 if(min != 0.0) {
00583 if(min < 0) {
00584 min *= 1.5;
00585 } else {
00586 min *= 0.5;
00587 }
00588 } else {
00589 min = -0.5;
00590 }
00591
00592 if(max != 0.0) {
00593 if(max < 0) {
00594 max *= 0.5;
00595 } else {
00596 max *= 1.5;
00597 }
00598 } else {
00599 max = 0.5;
00600 }
00601
00602 }