/[PAMELA software]/quicklook/trigger/src/TriggerScanBasic.cpp
ViewVC logotype

Diff of /quicklook/trigger/src/TriggerScanBasic.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by campana, Thu Sep 21 08:51:05 2006 UTC revision 1.4 by pam-rm2, Wed Jan 10 17:18:34 2007 UTC
# Line 25  Line 25 
25  #include <TGraph.h>  #include <TGraph.h>
26  #include <TStyle.h>  #include <TStyle.h>
27  #include <TH1.h>  #include <TH1.h>
28    #include <TH1F.h>
29  #include <TH2S.h>  #include <TH2S.h>
30  #include <TPaveText.h>  #include <TPaveText.h>
31  #include <TCanvas.h>  #include <TCanvas.h>
# Line 43  char bit(int decimal, char pos) Line 44  char bit(int decimal, char pos)
44  }  }
45    
46  void TriggerScanBasic(TString base, TString outDirectory = "", TString format = ""){  void TriggerScanBasic(TString base, TString outDirectory = "", TString format = ""){
47        
48      Long_t lastime, firstime;
49      double obmin=0.;
50      double obmax=0.;
51      stringstream oss, oss1, oss2, oss3, noentries, stringa;  
52    std::stringstream sst;    std::stringstream sst;
53    if (outDirectory == "") outDirectory = base.Data();    if (outDirectory == "") outDirectory = base.Data();
54    TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();    TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();
# Line 72  void TriggerScanBasic(TString base, TStr Line 77  void TriggerScanBasic(TString base, TStr
77      file->Close();      file->Close();
78      return;      return;
79    }    }
80      
81       //-------------- to know the max and min OBT ----------------------------//
82       HeadBr->GetEntry(0);
83       ph = eh->GetPscuHeader();
84       firstime = ph->GetOrbitalTime();
85       HeadBr->GetEntry(nevents);
86       ph = eh->GetPscuHeader();
87       lastime = ph->GetOrbitalTime();
88       int i =0;
89       while(i < nevents){
90         HeadBr->GetEntry(i);
91         ph = eh->GetPscuHeader();
92         if((ph->GetOrbitalTime()) <= firstime) firstime=ph->GetOrbitalTime();
93         if((ph->GetOrbitalTime()) >= lastime) lastime=ph->GetOrbitalTime();
94         i++;
95         }
96      
97      //------------------------ First histogram -----------------------------------//
98      obmin=firstime;
99      obmax=lastime;
100      Int_t  nbin   = (lastime-firstime)/60000; // on 1 ms
101      gStyle->SetOptStat(0);
102      TH1F *h1 = new TH1F ("histo1", "" , nbin, obmin, obmax);
103      TH1F *h2 = new TH1F ("histo2", "" , nbin, obmin, obmax);
104      TH1F *h5 = new TH1F ("histo5", "" , nbin, obmin, obmax);
105      TH1F *LiveTimeMean      = new TH1F("LiveTimeMean", sst.str().c_str(),nbin, obmin, obmax);
106      TH1F *DeadTimeMean      = new TH1F("DeadTimeMean", sst.str().c_str(),nbin, obmin, obmax);
107      //==============================================================
108    
109    /* Histo DEF */    /* Histo DEF */
110    
# Line 88  void TriggerScanBasic(TString base, TStr Line 121  void TriggerScanBasic(TString base, TStr
121    sst << "Calorimeter Rate Counters based on " << base.Data();    sst << "Calorimeter Rate Counters based on " << base.Data();
122    TH1F *S4Cal2Histo      = new TH1F("S4Cal2Histo", sst.str().c_str(), 20, 0, 20);    TH1F *S4Cal2Histo      = new TH1F("S4Cal2Histo", sst.str().c_str(), 20, 0, 20);
123    
124    int i  = 0;    // int i  = 0;
125      i = 0;
126    Int_t size  = nevents;    Int_t size  = nevents;
127    
128    Double_t *time = new Double_t[size];    Double_t *time = new Double_t[size];
# Line 175  void TriggerScanBasic(TString base, TStr Line 209  void TriggerScanBasic(TString base, TStr
209        /* live time vector fill*/        /* live time vector fill*/
210        liveTime[i] = 0.16 * triggerEvent->dltime[0];        liveTime[i] = 0.16 * triggerEvent->dltime[0];
211                
212    
213          if (liveTime[i]<600) h1->Fill(ph->GetOrbitalTime(),liveTime[i]);
214          if (liveTime[i]<600) h2->Fill(ph->GetOrbitalTime());
215    
216        /* dead time vector fill*/        /* dead time vector fill*/
217        deadTime[i] = 0.01 * triggerEvent->dltime[1];        deadTime[i] = 0.01 * triggerEvent->dltime[1];
218                
219          if (deadTime[i]<600) h5->Fill(ph->GetOrbitalTime(),deadTime[i]);
220      }      }
221    
222      gStyle->SetStatY(0.85);      gStyle->SetStatY(0.85);
223        
       
224      /* PMT Plane Counters */      /* PMT Plane Counters */
225            
226      pmt1[i] = 1.*triggerEvent->pmtpl[0];      pmt1[i] = 1.*triggerEvent->pmtpl[0];
# Line 313  void TriggerScanBasic(TString base, TStr Line 351  void TriggerScanBasic(TString base, TStr
351    LiveTimeGraph->GetYaxis()->CenterTitle();    LiveTimeGraph->GetYaxis()->CenterTitle();
352    LiveTimeGraph->Draw("AP");    LiveTimeGraph->Draw("AP");
353    
354      /*
355       * Average Dead and Live time graphs
356       */
357      TCanvas *MeanLiveDeadCanvas = new TCanvas("MeanLiveDeadCanvas","MeanLiveDeadCanvas", 1280, 1024);
358      MeanLiveDeadCanvas->Divide(1,2);
359      
360      MeanLiveDeadCanvas->cd(1);
361      DeadTimeMean->Divide(h5,h2);
362      sst.str("");
363      sst << "Average Dead Time";
364      DeadTimeMean->GetXaxis()->SetTitle("OnBoardTime");
365      DeadTimeMean->GetXaxis()->CenterTitle();
366      DeadTimeMean->GetYaxis()->SetTitle("Average Dead Time (over 1min)");
367      DeadTimeMean->GetYaxis()->CenterTitle();
368      DeadTimeMean->Draw();
369      MeanLiveDeadCanvas->cd(2);
370      LiveTimeMean->Divide(h1,h2);
371      sst.str("");
372      sst << "Average Live Time";
373      LiveTimeMean->GetXaxis()->SetTitle("OnBoardTime");
374      LiveTimeMean->GetXaxis()->CenterTitle();
375      LiveTimeMean->GetYaxis()->SetTitle("Average Live Time (over 1min)");
376      LiveTimeMean->GetYaxis()->CenterTitle();
377      LiveTimeMean->Draw();
378    
379    /*        /*    
380     * PMT Plane Counters Graph     * PMT Plane Counters Graph
381     */     */
# Line 330  void TriggerScanBasic(TString base, TStr Line 393  void TriggerScanBasic(TString base, TStr
393    PMT1Graph->SetFillColor(2);    PMT1Graph->SetFillColor(2);
394    PMT1Graph->GetXaxis()->SetTitle("OnBoardTime");    PMT1Graph->GetXaxis()->SetTitle("OnBoardTime");
395    PMT1Graph->GetXaxis()->CenterTitle();    PMT1Graph->GetXaxis()->CenterTitle();
396    PMT1Graph->GetYaxis()->SetTitle("PMT Plane Counters");    PMT1Graph->GetYaxis()->SetTitle("PMT Plane Counters (over 60 ms)");
397    PMT1Graph->GetYaxis()->CenterTitle();    PMT1Graph->GetYaxis()->CenterTitle();
398    PMT1Graph->Draw("AP");    PMT1Graph->Draw("AP");
399    //----------    //----------
# Line 344  void TriggerScanBasic(TString base, TStr Line 407  void TriggerScanBasic(TString base, TStr
407    PMT2Graph->SetFillColor(2);    PMT2Graph->SetFillColor(2);
408    PMT2Graph->GetXaxis()->SetTitle("OnBoardTime");    PMT2Graph->GetXaxis()->SetTitle("OnBoardTime");
409    PMT2Graph->GetXaxis()->CenterTitle();    PMT2Graph->GetXaxis()->CenterTitle();
410    PMT2Graph->GetYaxis()->SetTitle("PMT Plane Counters");    PMT2Graph->GetYaxis()->SetTitle("PMT Plane Counters (over 60 ms)");
411    PMT2Graph->GetYaxis()->CenterTitle();    PMT2Graph->GetYaxis()->CenterTitle();
412    PMT2Graph->Draw("AP");    PMT2Graph->Draw("AP");
413    //----------    //----------
# Line 358  void TriggerScanBasic(TString base, TStr Line 421  void TriggerScanBasic(TString base, TStr
421    PMT3Graph->SetFillColor(2);    PMT3Graph->SetFillColor(2);
422    PMT3Graph->GetXaxis()->SetTitle("OnBoardTime");    PMT3Graph->GetXaxis()->SetTitle("OnBoardTime");
423    PMT3Graph->GetXaxis()->CenterTitle();    PMT3Graph->GetXaxis()->CenterTitle();
424    PMT3Graph->GetYaxis()->SetTitle("PMT Plane Rate Counters");    PMT3Graph->GetYaxis()->SetTitle("PMT Plane Rate Counters (over 60 ms)");
425    PMT3Graph->GetYaxis()->CenterTitle();    PMT3Graph->GetYaxis()->CenterTitle();
426    PMT3Graph->Draw("AP");    PMT3Graph->Draw("AP");
427    //    //
# Line 1214  void TriggerScanBasic(TString base, TStr Line 1277  void TriggerScanBasic(TString base, TStr
1277      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic." << saveas  << "(";      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic." << saveas  << "(";
1278      EvCounterCanvas->Print(sst.str().c_str());      EvCounterCanvas->Print(sst.str().c_str());
1279      DeadLiveCanvas->Print(sst.str().c_str());      DeadLiveCanvas->Print(sst.str().c_str());
1280        MeanLiveDeadCanvas->Print(sst.str().c_str());
1281      PMTCanvas->Print(sst.str().c_str());      PMTCanvas->Print(sst.str().c_str());
1282      TrigRate1Canvas->Print(sst.str().c_str());      TrigRate1Canvas->Print(sst.str().c_str());
1283      TrigRate2Canvas->Print(sst.str().c_str());      TrigRate2Canvas->Print(sst.str().c_str());
# Line 1245  void TriggerScanBasic(TString base, TStr Line 1309  void TriggerScanBasic(TString base, TStr
1309    
1310      sst.str("");      sst.str("");
1311      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic3." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic3." << saveas;
1312        MeanLiveDeadCanvas->SaveAs(sst.str().c_str());
1313        sst.str("");
1314        sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic4." << saveas;
1315      PMTCanvas->SaveAs(sst.str().c_str());      PMTCanvas->SaveAs(sst.str().c_str());
1316            
1317      sst.str("");      sst.str("");
1318      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic4." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic5." << saveas;
1319      TrigRate1Canvas->SaveAs(sst.str().c_str());      TrigRate1Canvas->SaveAs(sst.str().c_str());
1320    
1321      sst.str("");      sst.str("");
1322      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic5." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic6." << saveas;
1323      TrigRate2Canvas->SaveAs(sst.str().c_str());      TrigRate2Canvas->SaveAs(sst.str().c_str());
1324            
1325      sst.str("");      sst.str("");
1326      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic6." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic7." << saveas;
1327      S4CalCanvas->SaveAs(sst.str().c_str());      S4CalCanvas->SaveAs(sst.str().c_str());
1328    
1329      gStyle->SetOptStat("mr");      gStyle->SetOptStat("mr");
1330    
1331      sst.str("");      sst.str("");
1332      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic7." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic8." << saveas;
1333      RatePMT1->SaveAs(sst.str().c_str());      RatePMT1->SaveAs(sst.str().c_str());
1334    
1335      sst.str("");      sst.str("");
1336      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic8." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic9." << saveas;
1337      RatePMT2->SaveAs(sst.str().c_str());      RatePMT2->SaveAs(sst.str().c_str());
1338    
1339      sst.str("");      sst.str("");
1340      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic9." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic10." << saveas;
1341      RatePMT3->SaveAs(sst.str().c_str());      RatePMT3->SaveAs(sst.str().c_str());
1342    
1343      sst.str("");      sst.str("");
1344      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic10." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic11." << saveas;
1345      RatePMT4->SaveAs(sst.str().c_str());      RatePMT4->SaveAs(sst.str().c_str());
1346            
1347      gStyle->SetOptStat("mr");      gStyle->SetOptStat("mr");
1348    
1349      sst.str("");      sst.str("");
1350      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic11." << saveas;      sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic12." << saveas;
1351      RatePMT5->SaveAs(sst.str().c_str());      RatePMT5->SaveAs(sst.str().c_str());
1352            
1353    }    }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23