er  dev
ERRawToAnalyzeConverter.cxx
1 #include "ERRawToAnalyzeConverter.h"
2 
3 #include<iostream>
4 using namespace std;
5 
6 
7 #include "FairRootManager.h"
8 #include "FairRunAna.h"
9 #include "FairRuntimeDb.h"
10 
11 // ----------------------------------------------------------------------------
13  : FairTask("Convert Raw event to analyse event"),
14  fNChanels(2),
15  fNPoints(1000),
16  fRawEvents(NULL),
17  fAEvents(NULL),
18  fRatio(0.3),
19  fTD(1.5), //in ns
20  fNoiseMin(5),
21  fNoiseMax(25),
22  fEvent(0),
23  fSmoothPar(kFALSE),
24  fNumSmoothP(10)
25 {
26 }
27 // ----------------------------------------------------------------------------
28 
29 // ----------------------------------------------------------------------------
31  : FairTask("Convert Raw event to analyse event", verbose),
32  fNChanels(2),
33  fNPoints(1000),
34  fRawEvents(NULL),
35  fAEvents(NULL),
36  fRatio(0.3),
37  fTD(1.5), //in ns
38  fNoiseMin(5),
39  fNoiseMax(25),
40  fEvent(0),
41  fSmoothPar(kFALSE),
42  fNumSmoothP(10)
43 {
44 }
45 // ----------------------------------------------------------------------------
46 
47 // ----------------------------------------------------------------------------
49 {
50 }
51 // ----------------------------------------------------------------------------
52 
53 // ----------------------------------------------------------------------------
54 void ERRawToAnalyzeConverter::SetParContainers()
55 {
56  // Get run and runtime database
57  FairRunAna* run = FairRunAna::Instance();
58  if ( ! run ) Fatal("SetParContainers", "No analysis run");
59 
60  FairRuntimeDb* rtdb = run->GetRuntimeDb();
61  if ( ! rtdb ) Fatal("SetParContainers", "No runtime database");
62 }
63 // ----------------------------------------------------------------------------
64 
65 // ----------------------------------------------------------------------------
67 {
68  // Get input array
69  FairRootManager* ioman = FairRootManager::Instance();
70  if ( ! ioman ) Fatal("Init", "No FairRootManager");
71 
72  //Get input objects
73  fRawEvents = new ERNeuRadRawEvent*[fNChanels];
74  for (Int_t iChanel = 0; iChanel < fNChanels; iChanel++){
75  TString bName;
76  bName.Form("ch%d.", iChanel+1);
77  fRawEvents[iChanel] = (ERNeuRadRawEvent*) ioman->GetObject(bName);
78  if (!fRawEvents[iChanel])
79  Fatal("Init", "Can`t find branch in input file!");
80  }
81 
82  //Register output objects
83  fAEvents = new ERNeuRadAEvent*[fNChanels];
84  for (Int_t iChanel = 0; iChanel < fNChanels; iChanel++){
85  fAEvents[iChanel] = new ERNeuRadAEvent(fNPoints);
86  TString bName;
87  bName.Form("Ach%d.",iChanel+1);
88  ioman->Register(bName,"Analyze", fAEvents[iChanel], kTRUE);
89  }
90  if (fSmoothPar == kTRUE ) { std::cout << std::endl << "SIGNALS WILL BE SMOOTHED!" << std::endl; }
91  else std::cout << std::endl << "SIGNALS WILL NOT BE SMOOTHED!" << std::endl;
92  return kSUCCESS;
93 }
94 // -------------------------------------------------------------------------
95 
96 // ----- Public method Exec --------------------------------------------
97 void ERRawToAnalyzeConverter::Exec(Option_t* opt)
98 {
99  fEvent++;
100  if ( !(fEvent%500) ) { std::cout << "####### EVENT " << fEvent << " #####" << std::endl; }
101 
102 /*std::cout << std::endl;
103  std::cout << "####### EVENT " << fEvent++ << " #####" << std::endl;
104  std::cout << std::endl;*/
105 
106  for (Int_t iChanel = 0; iChanel < fNChanels; iChanel++){
107  fAEvents[iChanel]->SetInputEvent(&fRawEvents[iChanel]); //takes raw event from RawEvent
108  fAEvents[iChanel]->SetCFratio(fRatio);
109  fAEvents[iChanel]->SetCFtimeDelay(fTD);
110  fAEvents[iChanel]->SetNoiseRange(fNoiseMin, fNoiseMax);
111  fAEvents[iChanel]->SetSmoothPoints(fNumSmoothP);
112  fAEvents[iChanel]->ProcessEvent(fSmoothPar);
113  }
114 }
115 //----------------------------------------------------------------------------
116 
117 //----------------------------------------------------------------------------
119 {
120  for (Int_t iChanel = 0; iChanel < fNChanels; iChanel++){
121  fAEvents[iChanel]->Reset();
122  }
123 }
124 // ----------------------------------------------------------------------------
125 
126 // ----------------------------------------------------------------------------
128 {
129 
130 }
131 // ----------------------------------------------------------------------------
132 //-----------------------------------------------------------------------------
133 ClassImp(ERRawToAnalyzeConverter)
class for processing raw data and getting amp and time properties of signal
task for analyzing raw data
virtual void Exec(Option_t *opt)
class for raw data obtained from measurements or simulations