CbmRoot
Loading...
Searching...
No Matches
CbmMuchReadoutBuffer.cxx
Go to the documentation of this file.
1/* Copyright (C) 2016-2019 Variable Energy Cyclotron Centre, Kolkata
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Vikas Singhal [committer], Volker Friese */
4
5/*
6 * CbmMuchReadoutBuffer.cxx
7 *
8 * Modified on: 19.04.2018 // Removed fSignalShape from CbmMuchSignal
9 * Created on: 11.05.2016
10 * Author: vikas@vecc.gov.in
11 */
12
13
15
16// ----- Initialisation of static variables ------------------------------
18// ---------------------------------------------------------------------------
19
20//This Modify Function will be called from CbmReadoutBuffer::Fill().
21//2 CbmMuchSignal has to be merged and create one, as both hit on the same Detector or Pad within detector deadtime window.
22//SignalStart time and SignalEnd time is already modified.
23//ADC has to be summed up
24//Matches of two also be joined.
26 std::vector<CbmMuchSignal*>& newDataList)
27{
28
29 //std::cout << "Modify: old data 1 at t = " << oldData1->GetTimeStart()
30 // << " to " << oldData1->GetTimeStop();
31 //std::cout << "Modify: old data 2 at t = " << oldData2->GetTimeStart()
32 // << " to " << oldData2->GetTimeStop();
33 LOG(debug4) << "Modify: old data 1 at t = " << oldData1->GetTimeStart() << " to " << oldData1->GetTimeStop();
34 LOG(debug4) << "Modify: old data 2 at t = " << oldData2->GetTimeStart() << " to " << oldData2->GetTimeStop();
35
36 CbmMuchSignal* firstData = oldData1;
37 CbmMuchSignal* secondData = oldData2;
38 if (oldData1->GetTimeStart() > oldData2->GetTimeStart()) {
39 firstData = oldData2;
40 secondData = oldData1;
41 }
42
43 /* Create a new signal from the first signal and then correspondingly modify the Match of that signal.
44 * For this add secondData information to the newdata
45 */
46 // Create new signal object same as firstData
47 CbmMuchSignal* newData = new CbmMuchSignal(firstData->GetAddress());
48 newData->SetTimeStart(firstData->GetTimeStart());
49 newData->SetTimeStop(firstData->GetTimeStop());
50 //newData->SetSignalShape(firstData->GetSignalShape()); // Only storing Charge value not the entire fSignalShape
51 newData->SetCharge(firstData->GetCharge());
52 // Set the parameters of the new signal,
53 // it contains Address=which will be same,
54 // fSignalShape will be modified according to Real Behavier
55 // StartTime = Time of the first digi,
56 // StopTime = Max stop time of both digis.
57
58 //Addup charges according to fSignalShape of both signal's.
59 //Implemented pile up accordingly, not add up of ADCs
60 //Weight of match object contains pure total added charge, can be use if needed.
61 //newData->MergeSignal(firstData);
62 newData->MergeSignal(secondData);
63
64 Double_t stopTime = std::max(oldData1->GetTimeStop(), oldData2->GetTimeStop());
65 newData->SetTimeStop(stopTime);
66
67 //Merge matches of both data, created signal is new therefore contain nothing in the fMatch variable.
68 //adding links of firstData->Match to NewMatch
69 (newData->GetMatch())->AddLinks(*(firstData->GetMatch()));
70 //adding links of SecondData->Match to NewMatch
71 (newData->GetMatch())->AddLinks(*(secondData->GetMatch()));
72
73
74 LOG(debug4) << "Modify: new data at t = " << newData->GetTimeStart() << " to " << 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 --------------------------------------------------------
87// ---------------------------------------------------------------------------
88
ClassImp(CbmConverterManager)
static CbmMuchReadoutBuffer * Instance()
static CbmMuchReadoutBuffer * fgInstance
virtual Int_t Merge(CbmMuchSignal *, CbmMuchSignal *, std::vector< CbmMuchSignal * > &)
Data class for an analog signal in the MUCH Simple data class used in the digitisation process of the...
UInt_t GetCharge() const
void SetTimeStop(Long_t stoptime)
void MergeSignal(CbmMuchSignal *)
CbmMatch * GetMatch() const
Int_t GetAddress() const
void SetCharge(UInt_t charge)
Long64_t GetTimeStop() const
void SetTimeStart(Long_t starttime)
Long_t GetTimeStart() const