CbmRoot
CbmMuchReadoutBuffer.cxx
Go to the documentation of this file.
1 /*
2  * CbmMuchReadoutBuffer.cxx
3  *
4  * Modified on: 19.04.2018 // Removed fSignalShape from CbmMuchSignal
5  * Created on: 11.05.2016
6  * Author: vikas@vecc.gov.in
7  */
8 
9 
10 #include "CbmMuchReadoutBuffer.h"
11 
12 // ----- Initialisation of static variables ------------------------------
14 // ---------------------------------------------------------------------------
15 
16 //This Modify Function will be called from CbmReadoutBuffer::Fill().
17 //2 CbmMuchSignal has to be merged and create one, as both hit on the same Detector or Pad within detector deadtime window.
18 //SignalStart time and SignalEnd time is already modified.
19 //ADC has to be summed up
20 //Matches of two also be joined.
22  CbmMuchSignal* oldData2,
23  std::vector<CbmMuchSignal*>& newDataList) {
24 
25  //std::cout << "Modify: old data 1 at t = " << oldData1->GetTimeStart()
26  // << " to " << oldData1->GetTimeStop();
27  //std::cout << "Modify: old data 2 at t = " << oldData2->GetTimeStart()
28  // << " to " << oldData2->GetTimeStop();
29  LOG(debug4) << "Modify: old data 1 at t = " << oldData1->GetTimeStart()
30  << " to " << oldData1->GetTimeStop();
31  LOG(debug4) << "Modify: old data 2 at t = " << oldData2->GetTimeStart()
32  << " to " << oldData2->GetTimeStop();
33 
34  CbmMuchSignal* firstData = oldData1;
35  CbmMuchSignal* secondData = oldData2;
36  if (oldData1->GetTimeStart() > oldData2->GetTimeStart()) {
37  firstData = oldData2;
38  secondData = oldData1;
39  }
40 
41  /* Create a new signal from the first signal and then correspondingly modify the Match of that signal.
42  * For this add secondData information to the newdata
43  */
44  // Create new signal object same as firstData
45  CbmMuchSignal* newData = new CbmMuchSignal(firstData->GetAddress());
46  newData->SetTimeStart(firstData->GetTimeStart());
47  newData->SetTimeStop(firstData->GetTimeStop());
48  //newData->SetSignalShape(firstData->GetSignalShape()); // Only storing Charge value not the entire fSignalShape
49  newData->SetCharge(firstData->GetCharge());
50  // Set the parameters of the new signal,
51  // it contains Address=which will be same,
52  // fSignalShape will be modified according to Real Behavier
53  // StartTime = Time of the first digi,
54  // StopTime = Max stop time of both digis.
55 
56  //Addup charges according to fSignalShape of both signal's.
57  //Implemented pile up accordingly, not add up of ADCs
58  //Weight of match object contains pure total added charge, can be use if needed.
59  //newData->MergeSignal(firstData);
60  newData->MergeSignal(secondData);
61 
62  Double_t stopTime =
63  std::max(oldData1->GetTimeStop(), oldData2->GetTimeStop());
64  newData->SetTimeStop(stopTime);
65 
66  //Merge matches of both data, created signal is new therefore contain nothing in the fMatch variable.
67  //adding links of firstData->Match to NewMatch
68  (newData->GetMatch())->AddLinks(*(firstData->GetMatch()));
69  //adding links of SecondData->Match to NewMatch
70  (newData->GetMatch())->AddLinks(*(secondData->GetMatch()));
71 
72 
73  LOG(debug4) << "Modify: new data at t = " << newData->GetTimeStart() << " to "
74  << newData->GetTimeStop();
75  //Add new data object to the result list
76  newDataList.push_back(newData);
77 
78  return 1; // Number of return data objects
79 }
80 
81 // ----- Instance --------------------------------------------------------
84  return fgInstance;
85 }
86 // ---------------------------------------------------------------------------
87 
CbmMuchSignal::MergeSignal
void MergeSignal(CbmMuchSignal *)
Definition: CbmMuchSignal.cxx:89
CbmMuchReadoutBuffer::fgInstance
static CbmMuchReadoutBuffer * fgInstance
Definition: CbmMuchReadoutBuffer.h:71
CbmMuchSignal::SetTimeStart
void SetTimeStart(Long_t starttime)
Definition: CbmMuchSignal.h:99
CbmMuchSignal::GetAddress
Int_t GetAddress() const
Definition: CbmMuchSignal.h:96
CbmMuchReadoutBuffer::Instance
static CbmMuchReadoutBuffer * Instance()
Definition: CbmMuchReadoutBuffer.cxx:82
CbmMuchSignal::GetCharge
UInt_t GetCharge() const
Definition: CbmMuchSignal.h:91
CbmMuchReadoutBuffer::Merge
virtual Int_t Merge(CbmMuchSignal *, CbmMuchSignal *, std::vector< CbmMuchSignal * > &)
Definition: CbmMuchReadoutBuffer.cxx:21
CbmMuchSignal::GetMatch
CbmMatch * GetMatch() const
Definition: CbmMuchSignal.h:95
CbmMuchReadoutBuffer.h
CbmMuchSignal
Data class for an analog signal in the MUCH Simple data class used in the digitisation process of the...
Definition: CbmMuchSignal.h:31
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMuchReadoutBuffer
Definition: CbmMuchReadoutBuffer.h:23
CbmMuchSignal::SetCharge
void SetCharge(UInt_t charge)
Definition: CbmMuchSignal.h:104
CbmMuchSignal::GetTimeStart
Long_t GetTimeStart() const
Definition: CbmMuchSignal.h:86
CbmMuchSignal::GetTimeStop
Long64_t GetTimeStop() const
Definition: CbmMuchSignal.h:89
CbmMuchSignal::SetTimeStop
void SetTimeStop(Long_t stoptime)
Definition: CbmMuchSignal.h:100
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
CbmMuchReadoutBuffer::CbmMuchReadoutBuffer
CbmMuchReadoutBuffer()
Definition: CbmMuchReadoutBuffer.h:27