/[PAMELA software]/PamCut/CollectionActions/RigFillAction/RigFillAction.cpp
ViewVC logotype

Diff of /PamCut/CollectionActions/RigFillAction/RigFillAction.cpp

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

revision 1.4 by pam-fi, Wed Aug 26 16:34:15 2009 UTC revision 1.5 by pam-fi, Tue Oct 27 10:18:21 2009 UTC
# Line 15  void RigFillAction::_InitHistos(vector<f Line 15  void RigFillAction::_InitHistos(vector<f
15    
16    // Initializing histograms    // Initializing histograms
17    _rootHisto.SetName("rfHisto");    _rootHisto.SetName("rfHisto");
18    _rootHisto.SetTitle(Form("Rc Vs R (thr.: %.2f)", _thresholdCoeff));    _rootHisto.SetTitle(Form("R Vs Rc (thr.: %.2f)", _thresholdCoeff));
19    _rootHisto.GetXaxis()->SetTitle("R (GV)");    _rootHisto.GetXaxis()->SetTitle("Rc (GV)");
20    _rootHisto.GetYaxis()->SetTitle("Rc (GV)");    _rootHisto.GetYaxis()->SetTitle("R (GV)");
21    
22    Double_t *auxArray = new Double_t[_bins.size()];    Double_t *auxArray = new Double_t[_bins.size()];
23    
# Line 71  void RigFillAction::OnGood(PamLevel2 *ev Line 71  void RigFillAction::OnGood(PamLevel2 *ev
71    _rootHisto.Fill(rigThreshold, rig); // X,Y in the ROOT histogram    _rootHisto.Fill(rigThreshold, rig); // X,Y in the ROOT histogram
72    
73    // Event rigidity bin identification.    // Event rigidity bin identification.
74      
 //  cout << rig << endl;  
75    if (rig < _bins[0] || rig >= _bins[(int) _textHisto.GetNRows()]) {    if (rig < _bins[0] || rig >= _bins[(int) _textHisto.GetNRows()]) {
 //    cout << "found!" << endl;  
76      return;      return;
77    }    }
78    
# Line 85  void RigFillAction::OnGood(PamLevel2 *ev Line 83  void RigFillAction::OnGood(PamLevel2 *ev
83    i--;    i--;
84    
85    // Threshold rigidity bin identification.    // Threshold rigidity bin identification.
86      
87    if (rigThreshold < 0 || rigThreshold >= _bins[(int) _textHisto.GetNRows()]) return;    if (rigThreshold < 0 || rigThreshold >= _bins[(int) _textHisto.GetNRows()]) {
88          return;
89      }
90    
91    if (0 <= rigThreshold && rigThreshold < _bins[0])    if (0 <= rigThreshold && rigThreshold < _bins[0])
92      _zeroCutoffBins[i]++;      _zeroCutoffBins[i]++;
93    else {    else {
# Line 99  void RigFillAction::OnGood(PamLevel2 *ev Line 99  void RigFillAction::OnGood(PamLevel2 *ev
99    
100      _textHisto[i][j]++;      _textHisto[i][j]++;
101      _totalTextHisto[i]++;      _totalTextHisto[i]++;
102        
103    }    }
104  }  }
105    
# Line 108  void RigFillAction::Finalize() { Line 108  void RigFillAction::Finalize() {
108    // Write the text file    // Write the text file
109    if (_outFileBase != "") {    if (_outFileBase != "") {
110    
111      ofstream outTextFile((_outFileBase + ".txt").Data(), ios_base::out);      ofstream outTextFile((_outFileBase + "-" + GetName() + ".txt").Data(), ios_base::out);
112      for (unsigned int i = 0; i < _textHisto.GetNRows(); i++) {      for (unsigned int i = 0; i < _textHisto.GetNRows(); i++) {
113        for (unsigned int j = 0; j < _textHisto.GetNCols(); j++) {        for (unsigned int j = 0; j < _textHisto.GetNCols(); j++) {
114          outTextFile << setw(7) << _textHisto[i][j] << "  ";          outTextFile << setw(7) << _textHisto[i][j] << "  ";
# Line 118  void RigFillAction::Finalize() { Line 118  void RigFillAction::Finalize() {
118      outTextFile.close();      outTextFile.close();
119    
120      // Write the report file, where zero bins are recorded      // Write the report file, where zero bins are recorded
121      outTextFile.open((_outFileBase + "-report.txt").Data(), ios_base::out);      outTextFile.open((_outFileBase + "-" + GetName() + "-InfBins.txt").Data(), ios_base::out);
     outTextFile << "Zero bins for cutoff rigidity: \n";  
122      for (unsigned int i = 0; i < _zeroCutoffBins.size(); i++)      for (unsigned int i = 0; i < _zeroCutoffBins.size(); i++)
123        outTextFile << GetHistoThreshInfBin()[i] << "\n";        outTextFile << GetHistoThreshInfBin()[i] << "\n";
124      outTextFile.close();      outTextFile.close();
125    
126      // Write the ROOT file      // Write the ROOT file
127      TFile outRootFile((_outFileBase + ".root"), "RECREATE");      TFile outRootFile((_outFileBase + "-" + GetName() + ".root"), "RECREATE");
128      outRootFile.cd();      outRootFile.cd();
129      _rootHisto.Write();      _rootHisto.Write();
130      outRootFile.Close();      outRootFile.Close();

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

  ViewVC Help
Powered by ViewVC 1.1.23