AlcapDAQ  1
DeadTimeGe.cpp
Go to the documentation of this file.
1 //#define USE_PRINT_OUT
2 
3 #include "DeadTimeGe.h"
4 #include <iostream>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string>
8 #include <map>
9 #include <utility>
10 #include <algorithm>
11 #include <cmath>
12 #include <vector>
13 #include "definitions.h"
14 
15 #include "TAnalysedPulse.h"
16 #include "TDetectorPulse.h"
17 
18 using std::string;
19 using std::map;
20 using std::vector;
21 using std::pair;
22 
24 
25 std::map<std::string, TH1F*> timediff_plots;
26 
27 DeadTimeGe::DeadTimeGe(char *HistogramDirectoryName) :
28  FillHistBase(HistogramDirectoryName){
29  dir->cd("/");
30 }
31 
33 }
34 
36  std::string detname = "Ge-S";
37  AnalysedPulseList detA_pulses = gAnalysedPulseMap[detname];
38  AnalysedPulseList::iterator currentDetAPulse = detA_pulses.begin();
39 
40  if (timediff_plots.find(detname) == timediff_plots.end())
41  {
42  std::string histname = "h" + detname + "_" + GetName();
43  std::string histtitle = "Time difference between to consecutive pulses on " + detname;
44  TH1F * htimediff = new TH1F(histname.c_str(), histtitle.c_str(),
45  1e6, 10, 4.2e7);
46  htimediff->GetXaxis()->SetTitle("Time [ns]");
47  htimediff->GetYaxis()->SetTitle("Arbitary unit");
48  timediff_plots[detname] = htimediff;
49  }
50 
51  std::vector<double> detA_times;
52  for (AnalysedPulseList::iterator detAPulseIter = currentDetAPulse;
53  detAPulseIter != detA_pulses.end(); ++detAPulseIter)
54  {
55  double detA_time = (*detAPulseIter)->GetTime();
56  detA_times.push_back(detA_time);
57  }
58 
59  for (unsigned int i = 0; i < detA_times.size()-1; ++i)
60  {
61  //printf("%.2f %.2f %.2f\n", detA_times.at(i+1), detA_times.at(i),
62  //detA_times.at(i+1) - detA_times.at(i));
63  timediff_plots[detname]->Fill(detA_times.at(i+1) - detA_times.at(i));
64  }
65  return 0;
66 }