pulse_viewer.cc

Go to the documentation of this file.
00001 #ifndef PULSE_VIEWER_CC
00002 #define PULSE_VIEWER_CC
00003 
00004 #include "pulse_viewer.hh"
00005 
00006 pulse_viewer::pulse_viewer() { 
00007   _name="pulse_viewer"; 
00008   _cWF=0;
00009   _hWF=0;
00010   _lStart=0;
00011   _lEnd=0;
00012   _lBase=0;
00013   _lRMSTop=0;
00014   _lRMSBottom=0;
00015   _lTop=0;
00016   
00017   clear_viewer();
00018   reset_cuts();
00019 
00020 }
00021 
00022 void pulse_viewer::reset_cuts() {
00023 
00024   _cut_tstart_reco = std::make_pair(-1,2000);
00025   _cut_tstart   = std::make_pair(-1,2000);
00026   _cut_tend     = std::make_pair(-1,2000);
00027   _cut_amp      = std::make_pair(-1,4096);
00028   _cut_charge   = std::make_pair(-1,4096*2000);
00029   _cut_pedbase  = std::make_pair(-1,4096);
00030   _cut_pedrms   = std::make_pair(0,4096);
00031   _cut_channels = std::make_pair(0,PMT::INVALID_CH);
00032   _cut_event_id = std::make_pair(0,0xffffffff);
00033   _cut_npulse   = std::make_pair(0,0xffffffff);
00034   _cut_sum_charge = std::make_pair(0,4096*2000*PMT::NUM_PMT_CHANNEL);
00035   _cut_sum_peak = std::make_pair(0,4096*PMT::NUM_PMT_CHANNEL);
00036   
00037 }
00038 
00039 void pulse_viewer::clear_viewer() {
00040   
00041   if(_hWF) delete _hWF;
00042   if(_lStart) delete _lStart;
00043   if(_lEnd) delete _lEnd;
00044   if(_lBase) delete _lBase;
00045   if(_lRMSTop) delete _lRMSTop;
00046   if(_lRMSBottom) delete _lRMSBottom;
00047   if(_lTop) delete _lTop;
00048 }
00049 
00050 bool pulse_viewer::initialize() {
00051 
00052   if(_verbosity_level==MSG::DEBUG)
00053 
00054     Message::send(MSG::DEBUG,__PRETTY_FUNCTION__,"called...");
00055 
00056   set_style();
00057 
00058   if(!_cWF){
00059 
00060     _cWF    = new TCanvas("_cWF","",1200,800);
00061     _cWF->SetLeftMargin(0.02);
00062     _cWF->SetBottomMargin(0.02);
00063     _cWF->SetRightMargin(0.02);
00064 
00065     _cWF->cd();
00066     //_pTitle = new TPad("_pTitle", "Title",      0.05, 0.92, 0.95, 0.99);
00067     //_pTitle->Draw();
00068 
00069     _cWF->cd();
00070     _pData  = new TPad("_pWF",    "Data",       0.01, 0.01, 0.99, 0.99);
00071     _pData->Draw();
00072 
00073     _pData->cd();
00074     _pNote  = new TPad("_pNote",  "Parameters", 0.80, 0.02, 0.98, 0.99);
00075     _pWF    = new TPad("_pWF",    "Waveform",   0.02, 0.02, 0.80, 0.99);
00076     _pWF->SetRightMargin(0.01);
00077     _pWF->SetLeftMargin(0.12);
00078     _pNote->Draw();
00079     _pWF->Draw();
00080 
00081     _fNote = new TPaveText(0.1,0.1,0.99,0.99);
00082     
00083   }
00084 
00085   clear_map();
00086   clear_viewer();
00087   return true;
00088 }
00089 
00090 void pulse_viewer::clear_map(){
00091 
00092   _pulse_frame_id.clear();
00093   _pulse_sample_number.clear();
00094   _pulse_tstart.clear();
00095   _pulse_tstart_reco.clear();
00096   _pulse_tend.clear();
00097   _pulse_amp.clear();
00098   _pulse_charge.clear();
00099   _pulse_pedbase.clear();
00100   _pulse_pedrms.clear();
00101   _waveforms.clear();
00102   _pulse_count.clear();
00103   _channels.clear();
00104 
00105 }
00106 
00107 void pulse_viewer::add_channel_entry(PMT::ch_number_t ch){
00108 
00109   _channels.insert(ch);
00110   _pulse_frame_id[ch]=std::vector<PMT::word_t>();
00111   _pulse_sample_number[ch]=std::vector<PMT::word_t>();
00112   _pulse_tstart[ch]=std::vector<double>();
00113   _pulse_tstart_reco[ch]=std::vector<double>();
00114   _pulse_tend[ch]=std::vector<double>();
00115   _pulse_amp[ch]=std::vector<double>();
00116   _pulse_charge[ch]=std::vector<double>();
00117   _pulse_pedbase[ch]=std::vector<double>();
00118   _pulse_pedrms[ch]=std::vector<double>();
00119   _pulse_count[ch]=std::make_pair(0,0);
00120 
00121   _waveforms[ch]=std::map<PMT::word_t,std::map<PMT::word_t,std::vector<PMT::ch_adc_t> > >();
00122 
00123 }
00124 
00125 bool pulse_viewer::analyze(storage_manager* storage) {
00126 
00127   if(_verbosity_level==MSG::DEBUG)
00128 
00129     Message::send(MSG::DEBUG,__PRETTY_FUNCTION__,"called...");
00130   
00131   pulse_collection *pulses = (pulse_collection*)(storage->get_data(DATA_STRUCT::PULSE_COLLECTION));
00132   pmt_wf_collection   *wfs    = (pmt_wf_collection*)(storage->get_data(DATA_STRUCT::PMT_WF_COLLECTION));
00133   _ch_iter     = _channels.begin();
00134 
00135 
00136   if(!pulses)
00137     pulses = (pulse_collection*)(storage->get_data(DATA_STRUCT::FIXED_WIN_PULSE_COLLECTION));
00138 
00139   if(!pulses)
00140     pulses = (pulse_collection*)(storage->get_data(DATA_STRUCT::THRES_WIN_PULSE_COLLECTION));
00141 
00142   if(pulses->size()==0) {
00143     Message::send(MSG::ERROR,__FUNCTION__,"No Pulse Found!");
00144     return false;
00145   }
00146   if(wfs->size()==0) {
00147     Message::send(MSG::ERROR,__FUNCTION__,"No Waveforms Found!");
00148     return false;
00149   }
00150 
00151   _event_id    = wfs->event_id();
00152   _sum_charge  = pulses->sum_charge();
00153   _sum_peak    = pulses->sum_peak();
00154   _npulse      = pulses->npulse();
00155 
00156   // Check if this event is in the range of users' interest
00157   if(_event_id < _cut_event_id.first || _cut_event_id.second < _event_id)
00158     return true;
00159   else if(_sum_charge < _cut_sum_charge.first || _cut_sum_charge.second < _sum_charge)
00160     return true;
00161   else if(_sum_peak < _cut_sum_peak.first || _cut_sum_peak.second < _sum_peak)
00162     return true;
00163   else if(_npulse < _cut_npulse.first || _cut_npulse.second < _npulse)
00164     return true;
00165 
00166   // Clear map
00167   clear_map();
00168 
00169   // Fill map for this event
00170   for(pulse_collection::const_iterator iter(pulses->begin());
00171       iter!=pulses->end();
00172       ++iter){
00173 
00174     PMT::ch_number_t ch((*iter).channel_number());
00175     PMT::word_t sample   = (*iter).timeslice();
00176     PMT::word_t frame    = (*iter).frame_id();
00177     double      t_start  = (*iter).start_time();
00178     double      t_end    = (*iter).end_time();
00179     double      charge   = (*iter).charge();
00180     double      amp      = (*iter).pulse_peak();
00181     double      ped_base = (*iter).ped_mean();
00182     double      ped_rms  = (*iter).ped_rms();
00183     double      t_start_reco = (*iter).start_time_reco();
00184 
00185     // Check if this pulse passes the criteria
00186     if(ch < _cut_channels.first || _cut_channels.second < ch)
00187       continue;
00188     if(t_start_reco < _cut_tstart_reco.first || _cut_tstart_reco.second < t_start_reco)
00189       continue;
00190     if(t_start < _cut_tstart.first || _cut_tstart.second < t_start)
00191       continue;
00192     if(t_end < _cut_tend.first || _cut_tend.second < t_end)
00193       continue;
00194     if(charge < _cut_charge.first || _cut_charge.second < charge)
00195       continue;
00196     if(amp < _cut_amp.first || _cut_amp.second < amp)
00197       continue;
00198     if(ped_base < _cut_pedbase.first || _cut_pedbase.second < ped_base)
00199       continue;
00200     if(ped_rms < _cut_pedrms.first || _cut_pedrms.second < ped_rms)
00201       continue;    
00202 
00203     if(_channels.find(ch)==_channels.end())
00204       add_channel_entry(ch);
00205 
00206     _pulse_frame_id[ch].push_back(frame);
00207     _pulse_sample_number[ch].push_back(sample);
00208     _pulse_tstart[ch].push_back(t_start);
00209     _pulse_tstart_reco[ch].push_back(t_start_reco);
00210     _pulse_tend[ch].push_back(t_end);
00211     _pulse_amp[ch].push_back(amp);
00212     _pulse_charge[ch].push_back(charge);
00213     _pulse_pedbase[ch].push_back(ped_base);
00214     _pulse_pedrms[ch].push_back(ped_rms);
00215     
00216     if(_waveforms[ch].find(frame)==_waveforms[ch].end())
00217       _waveforms[ch][frame]=std::map<PMT::word_t,std::vector<PMT::ch_adc_t> >();
00218 
00219     if(_waveforms[ch][frame].find(sample) == _waveforms[ch][frame].end())
00220       _waveforms[ch][frame][sample]=std::vector<PMT::ch_adc_t>();
00221 
00222     _pulse_count[ch].first+=1;
00223   }
00224 
00225 
00226 
00227   for(pmt_wf_collection::const_iterator ch_iter(wfs->begin());
00228       ch_iter!=wfs->end();
00229       ++ch_iter){
00230     PMT::ch_number_t ch        = (*ch_iter).channel_number();
00231     PMT::word_t this_timeslice = (*ch_iter).timeslice();
00232     PMT::word_t this_frame_id  = (*ch_iter).channel_frame_id();
00233 
00234     if(_waveforms.find(ch) == _waveforms.end())
00235       continue;
00236     if(_waveforms[ch].find(this_frame_id)==_waveforms[ch].end())
00237       continue;
00238     if(_waveforms[ch][this_frame_id].find(this_timeslice) == _waveforms[ch][this_frame_id].end())
00239       continue;
00240 
00241     if(_waveforms[ch][this_frame_id][this_timeslice].size()) {
00242       sprintf(_buf,"Found already filled waveform (ch=%d, frame=%d, sample=%d)",
00243           ch,this_frame_id,this_timeslice);
00244       Message::send(MSG::ERROR,__FUNCTION__,_buf);
00245       continue;
00246     }
00247     
00248     // Fill the waveform vector
00249     for(pmt_waveform::const_iterator adc_iter((*ch_iter).begin());
00250     adc_iter!=(*ch_iter).end();
00251     ++adc_iter){      
00252       _waveforms[ch][this_frame_id][this_timeslice].push_back((*adc_iter));
00253     }
00254         
00255   } // Finieh processing for this channel.
00256 
00257   _ch_iter=_channels.begin();
00258   std::cout<<_channels.size()<<std::endl;
00259 
00260   return true;
00261 }
00262 
00263 short pulse_viewer::get_npulse(PMT::ch_number_t ch){
00264   
00265   if(_channels.find(ch)==_channels.end())
00266     return 0;
00267 
00268   return _pulse_count[ch].first;
00269 
00270 }
00271 
00272 PMT::ch_number_t pulse_viewer::next_channel(){
00273 
00274   PMT::ch_number_t ch=PMT::INVALID_CH;
00275 
00276   if(_ch_iter==_channels.end())
00277     return ch;
00278 
00279   else
00280     ch=(*_ch_iter);
00281   
00282   _ch_iter++;
00283 
00284   return ch;
00285 }
00286 
00287 TH1D* pulse_viewer::next_pulse(PMT::ch_number_t ch){
00288 
00289   if(_channels.find(ch)==_channels.end()){
00290     sprintf(_buf,"No pulse found for channel %d!",ch);
00291     Message::send(MSG::ERROR,__FUNCTION__,_buf);
00292     return 0;
00293   }
00294 
00295   //  short this_index = _pulse_count[ch].second;
00296 
00297   // Check event cut criteria
00298   if( (_event_id < _cut_event_id.first || _cut_event_id.second < _event_id) ||
00299       (_sum_charge < _cut_sum_charge.first || _cut_sum_charge.second < _sum_charge) ||
00300       (_sum_peak < _cut_sum_peak.first || _cut_sum_peak.second < _sum_peak) ||
00301       (_npulse < _cut_npulse.first || _cut_npulse.second < _npulse) )
00302     {
00303       // event cut criteria changed and this event is not qualified anymore!
00304       _pulse_count[ch].second=_pulse_count[ch].first;
00305       return 0;
00306     }
00307 
00308   // Check pulse cut criteria
00309   short index=0;
00310   for(index = _pulse_count[ch].second;
00311       index < _pulse_count[ch].first;
00312       index++){
00313 
00314     if(index<0) index=0;
00315 
00316     if(ch < _cut_channels.first || _cut_channels.second < ch)
00317       continue;
00318     if(_pulse_tstart_reco[ch][index] < _cut_tstart_reco.first || _cut_tstart_reco.second < _pulse_tstart_reco[ch][index])
00319       continue;
00320     if(_pulse_tstart[ch][index] < _cut_tstart.first || _cut_tstart.second < _pulse_tstart[ch][index])
00321       continue;
00322     if(_pulse_tend[ch][index] < _cut_tend.first || _cut_tend.second < _pulse_tend[ch][index])
00323       continue;
00324     if(_pulse_charge[ch][index] < _cut_charge.first || _cut_charge.second < _pulse_charge[ch][index])
00325       continue;
00326     if(_pulse_amp[ch][index] < _cut_amp.first || _cut_amp.second < _pulse_amp[ch][index])
00327       continue;
00328     if(_pulse_pedbase[ch][index] < _cut_pedbase.first || _cut_pedbase.second < _pulse_pedbase[ch][index])
00329       continue;
00330     if(_pulse_pedrms[ch][index] < _cut_pedrms.first || _cut_pedrms.second < _pulse_pedrms[ch][index])
00331       continue;
00332     break;
00333   }
00334   
00335   if(index==_pulse_count[ch].first){
00336     _pulse_count[ch].second=_pulse_count[ch].first;
00337     return 0;
00338   }else{
00339     _pulse_count[ch].second=index+1;
00340     sprintf(_buf,"Pulse index %d for ch. %d",index,ch);
00341     Message::send(MSG::NORMAL,__FUNCTION__,_buf);
00342     return get_waveform(ch,(size_t)index);
00343   }
00344 
00345 }
00346 
00347 
00348 TH1D* pulse_viewer::previous_pulse(PMT::ch_number_t ch){
00349 
00350   if(_channels.find(ch)==_channels.end()){
00351     sprintf(_buf,"No pulse found for channel %d!",ch);
00352     Message::send(MSG::ERROR,__FUNCTION__,_buf);
00353     return 0;
00354   }
00355 
00356   short this_index = _pulse_count[ch].second;
00357 
00358   if(this_index < 0){
00359     sprintf(_buf,"No more pulse found on ch %d... (%d/%d)",ch,this_index,_pulse_count[ch].first);
00360     Message::send(MSG::NORMAL,__FUNCTION__,_buf);
00361     return 0;
00362   }
00363   else if(this_index >= _pulse_count[ch].first) {
00364     sprintf(_buf,"Last pulse on Ch: %d",ch);
00365     Message::send(MSG::INFO,__FUNCTION__,_buf);
00366     this_index=_pulse_count[ch].first-1;
00367     _pulse_count[ch].second=this_index-1;
00368   }else{
00369     sprintf(_buf,"Pulse index %d for ch. %d",this_index,ch);
00370     Message::send(MSG::NORMAL,__FUNCTION__,_buf);
00371     _pulse_count[ch].second-=1;
00372   }
00373 
00374   return get_waveform(ch,(size_t)this_index);
00375   
00376 }
00377 
00378 
00379 TH1D* pulse_viewer::get_waveform(PMT::ch_number_t ch, size_t index) {
00380 
00381   clear_viewer();
00382   gStyle->SetOptStat(0);
00383   
00384   bool is_wf_stored=true;
00385   PMT::word_t sample=_pulse_sample_number[ch][index];
00386   PMT::word_t frame =_pulse_frame_id[ch][index];
00387 
00388   if(_waveforms.find(ch)==_waveforms.end())
00389     is_wf_stored=false;
00390   else if(_waveforms[ch].find(frame)==_waveforms[ch].end())
00391     is_wf_stored=false;
00392   else if(_waveforms[ch][frame].find(sample)==_waveforms[ch][frame].end())
00393     is_wf_stored=false;
00394 
00395   if(!is_wf_stored){
00396     sprintf(_buf,"Waveform not stored for ch=%d, frame=%d, sample=%d!",
00397         ch,frame,sample);
00398     Message::send(MSG::ERROR,__FUNCTION__,_buf);
00399     return 0;
00400   }
00401 
00402   if(_waveforms[ch][frame][sample].size()<1){
00403     sprintf(_buf,"Waveform has 0-length! ch=%d, frame=%d, sample=%d!",
00404         ch,frame,sample);
00405     Message::send(MSG::ERROR,__FUNCTION__,_buf);
00406     return 0;
00407   }
00408 
00409   _hWF = new TH1D("hWF",
00410           Form("Channel %d Reconstructed Pulse; Time-Slice; Amplitude",ch),
00411           _waveforms[ch][frame][sample].size(),
00412           -0.5,
00413           (double)(_waveforms[ch][frame][sample].size())-0.5);
00414 
00415   for(size_t adc_index=0; adc_index<_waveforms[ch][frame][sample].size(); ++adc_index)
00416     _hWF->SetBinContent(adc_index+1,_waveforms[ch][frame][sample][adc_index]);
00417 
00418   //double x_min=_pulse_tend[ch][index]-20;
00419   //double x_max=_pulse_tend[ch][index]+20;
00420   double y_min=_pulse_pedbase[ch][index] - _pulse_pedrms[ch][index]*5 - 20;
00421   double y_max=_pulse_pedbase[ch][index] + _pulse_amp[ch][index]*1.1;
00422   
00423   _hWF->SetFillColor(kGray);
00424   _hWF->SetFillStyle(3004);
00425   _hWF->SetLineWidth(2);
00426   _hWF->SetMinimum(y_min);
00427   _hWF->SetMaximum(y_max);
00428   //_hWF->GetXaxis()->SetRangeUser(x_min,x_max);
00429 
00430   //
00431   // Canvas title
00432   //
00433   //_fTitle->SetText(0.5,0.5,Form("Reconstructed Waveform @ Event = %d ... Channel %d", _event_id,ch));
00434 
00435   //
00436   // Report parameters to stdout stream
00437   // 
00438   sprintf(_buf,"\n\n");
00439   sprintf(_buf,"%s Event ID       : %d\n",_buf,_event_id);
00440   sprintf(_buf,"%s Channel        : %d\n",_buf,ch);
00441   sprintf(_buf,"%s Start T        : %g\n",_buf,_pulse_tstart[ch][index]);
00442   sprintf(_buf,"%s Start T (RECO) : %g\n",_buf,_pulse_tstart_reco[ch][index]);
00443   sprintf(_buf,"%s End T          : %g\n",_buf,_pulse_tend[ch][index]);
00444   sprintf(_buf,"%s Ped. Mean      : %g\n",_buf,_pulse_pedbase[ch][index]);
00445   sprintf(_buf,"%s Ped. RMS       : %g\n",_buf,_pulse_pedrms[ch][index]);
00446   sprintf(_buf,"%s Peak Amp.      : %g\n",_buf,_pulse_amp[ch][index]);
00447   sprintf(_buf,"%s Charge         : %g\n",_buf,_pulse_charge[ch][index]);
00448   Message::send(MSG::NORMAL,__FUNCTION__,_buf);
00449 
00450   //
00451   // Report parameters to a canvas
00452   //
00453   _fNote->Clear();
00454   _fNote->AddText(Form("Event ID       : %d",_event_id));
00455   _fNote->AddText(Form("Frame  Number  : %d",_pulse_frame_id[ch][index]));
00456   _fNote->AddText(Form("Sample Number  : %d\n",_pulse_sample_number[ch][index]));
00457   _fNote->AddText(Form("Start T        : %g",_pulse_tstart[ch][index]));
00458   _fNote->AddText(Form("Start T (RECO) : %g",_pulse_tstart_reco[ch][index]));
00459   _fNote->AddText(Form("End T          : %g",_pulse_tend[ch][index]));
00460   _fNote->AddText(Form("Ped. Mean      : %g",_pulse_pedbase[ch][index]));
00461   _fNote->AddText(Form("Ped. RMS       : %g",_pulse_pedrms[ch][index]));
00462   _fNote->AddText(Form("Peak Amp.      : %g",_pulse_amp[ch][index]));
00463   _fNote->AddText(Form("Charge         : %g",_pulse_charge[ch][index]));
00464 
00465   //
00466   // Make waveform related  objects to be drawn
00467   //  
00468   _lBase = new TLine(_hWF->GetXaxis()->GetXmin(), _pulse_pedbase[ch][index], 
00469              _hWF->GetXaxis()->GetXmax(), _pulse_pedbase[ch][index]);
00470   _lBase->SetLineWidth(2);
00471   _lBase->SetLineStyle(2);
00472   _lBase->SetLineColor(kBlack);
00473 
00474   _lRMSTop = new TLine(_hWF->GetXaxis()->GetXmin(), _pulse_pedbase[ch][index] + _pulse_pedrms[ch][index],
00475                _hWF->GetXaxis()->GetXmax(), _pulse_pedbase[ch][index] + _pulse_pedrms[ch][index]);
00476   _lRMSTop->SetLineWidth(2);
00477   _lRMSTop->SetLineStyle(2);
00478   _lRMSTop->SetLineColor(kGray);
00479 
00480   _lRMSBottom = new TLine(_hWF->GetXaxis()->GetXmin(), _pulse_pedbase[ch][index] - _pulse_pedrms[ch][index],
00481               _hWF->GetXaxis()->GetXmax(), _pulse_pedbase[ch][index] - _pulse_pedrms[ch][index]);
00482   _lRMSBottom->SetLineWidth(2);
00483   _lRMSBottom->SetLineStyle(2);
00484   _lRMSBottom->SetLineColor(kGray);
00485 
00486   _lStart = new TLine(_pulse_tstart[ch][index]-0.5, _pulse_pedbase[ch][index],
00487               _pulse_tstart[ch][index]-0.5, _pulse_pedbase[ch][index]+_pulse_amp[ch][index]);
00488   _lStart->SetLineWidth(2);
00489   _lStart->SetLineStyle(2);
00490   _lStart->SetLineColor(kBlue);
00491 
00492   _lEnd = new TLine(_pulse_tend[ch][index]+0.5, _pulse_pedbase[ch][index],
00493             _pulse_tend[ch][index]+0.5, _pulse_pedbase[ch][index]+_pulse_amp[ch][index]);
00494   _lEnd->SetLineWidth(2);
00495   _lEnd->SetLineStyle(2);
00496   _lEnd->SetLineColor(kRed);
00497 
00498   _lTop = new TLine(_pulse_tstart[ch][index]-0.5, _pulse_pedbase[ch][index] + _pulse_amp[ch][index],
00499             _pulse_tend[ch][index]+0.5,   _pulse_pedbase[ch][index] + _pulse_amp[ch][index]);
00500   _lTop->SetLineWidth(2);
00501   _lTop->SetLineStyle(2);
00502   _lTop->SetLineColor(kMagenta-7);
00503 
00504   // Draw
00505   _cWF->cd();
00506 
00507   // Waveform
00508   _pWF->cd();
00509   _hWF->Draw();
00510   _lBase->Draw();
00511   _lStart->Draw();
00512   _lEnd->Draw();
00513   _lRMSTop->Draw();
00514   _lRMSBottom->Draw();
00515   _lTop->Draw();
00516   _pWF->Modified();
00517   _pWF->Update();
00518 
00519   // Title
00520   //_pTitle->cd();
00521   //_fTitle->Draw();
00522   //_pTitle->Update();
00523 
00524   // Pulse parameters
00525   _pNote->cd();
00526   _fNote->Draw();
00527   _pNote->Update();
00528   _pData->Update();
00529 
00530   _cWF->Update();
00531 
00532   return _hWF;
00533 }
00534 
00535 bool pulse_viewer::finalize() {
00536 
00537   // This function is called at the end of event loop.
00538   // Do all variable finalization you wish to do here.
00539   // If you need, you can store your ROOT class instance in the output
00540   // file. You have an access to the output file through "_fout" pointer.
00541   delete _cWF;
00542   clear_viewer();
00543   return true;
00544 }
00545 
00546 void pulse_viewer::display_cut_ranges(){
00547 
00548   std::string msg("Displaying the currently set values for cuts...\n");
00549 
00550   msg = "\n";
00551   msg += Form(" Event-wise parameters...\n");
00552   msg += Form("    Event ID            : %d -> %d\n",_cut_event_id.first,_cut_event_id.second);
00553   msg += Form("    Summed Charge       : %g -> %g\n",_cut_sum_charge.first,_cut_sum_charge.second);
00554   msg += Form("    Summed Peak         : %g -> %g\n",_cut_sum_peak.first,_cut_sum_peak.second);
00555   msg += Form("    Num. Pulses         : %d -> %d\n",_cut_npulse.first,_cut_npulse.second);
00556   msg += "\n";
00557   msg += Form(" Pulse-wise parameters...\n");
00558   msg += Form("    Channel Number      : %d -> %d\n",_cut_channels.first,_cut_channels.second);
00559   msg += Form("    Pulse Charge        : %g -> %g\n",_cut_charge.first,_cut_charge.second);
00560   msg += Form("    Pulse Peak          : %g -> %g\n",_cut_amp.first,_cut_amp.second);
00561   msg += Form("    Pulse Start T       : %g -> %g\n",_cut_tstart.first,_cut_tstart.second);
00562   msg += Form("    Pulse Start T (RECO): %g -> %g\n",_cut_tstart_reco.first,_cut_tstart_reco.second);
00563   msg += Form("    Pulse End T         : %g -> %g\n",_cut_tend.first,_cut_tend.second);
00564   msg += Form("    Pedestal Mean       : %g -> %g\n",_cut_pedbase.first,_cut_pedbase.second);
00565   msg += Form("    Pedestal RMS        : %g -> %g\n",_cut_pedrms.first,_cut_pedrms.second);
00566 
00567   Message::send(MSG::NORMAL,__FUNCTION__,msg.c_str());
00568 
00569 }
00570 
00571 void pulse_viewer::set_style(){
00572 
00573   TGaxis::SetMaxDigits(10);
00574   //TGaxis::SetNoExponent();
00575   gROOT->SetStyle("Plain");
00576   gStyle->SetEndErrorSize(0);
00577   gStyle->SetStatX(0.88);
00578   gStyle->SetOptFit(1);
00579   gStyle->SetOptDate(0);
00580 
00581   // Canvas
00582   gStyle->SetCanvasDefW(600);
00583   gStyle->SetCanvasDefH(500);
00584   gStyle->SetCanvasColor(0);
00585   gStyle->SetStatColor(0);
00586   gStyle->SetStatBorderSize(1);
00587   gStyle->SetFrameFillColor(10);
00588   gStyle->SetPadColor(23);
00589   gStyle->SetPadTickX(1);
00590   gStyle->SetPadTickY(1);
00591   gStyle->SetTitleColor(0, "");
00592   gStyle->SetPadTopMargin(0.11);
00593   gStyle->SetPadRightMargin(0.08);
00594   gStyle->SetPadLeftMargin(0.13);
00595   gStyle->SetPadBottomMargin(0.10);
00596   
00597   // Font ... use large Times-Roman fonts
00598   gStyle->SetTextFont(42);
00599   gStyle->SetTextSize(0.01);
00600   gStyle->SetLabelFont(22,"xyz");
00601   gStyle->SetLabelSize(0.04,"xy");
00602   gStyle->SetLabelOffset(0.01,"xy");
00603   gStyle->SetTitleFont(22,"xyz");
00604   gStyle->SetTitleSize(0.04,"xy");
00605   gStyle->SetTitleOffset(1.2,"x");
00606   gStyle->SetTitleOffset(1.5,"y");
00607   
00608   
00609   // Gradient Color
00610   const Int_t NRGBs = 5;  
00611   const Int_t NCont = 99;
00612   Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00};
00613   Double_t red[NRGBs] =   { 0.00, 0.00, 0.87, 1.00, 0.51};
00614   Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00};
00615   Double_t blue[NRGBs] =  { 0.51, 1.00, 0.12, 0.00, 0.00};
00616   TColor::CreateGradientColorTable(NRGBs,stops,red,green,blue,NCont);
00617   gStyle->SetNumberContours(NCont);
00618 
00619 }
00620 
00621 #endif

Generated on Mon Apr 7 15:35:12 2014 for MyProject by  doxygen 1.4.7