22 #include "DAQChannelMap/DAQChannelMap.h" 30 #include "Utilities/AssociationUtil.h" 64 fFirstDaqCollection (pset.
get<
std::
string >(
"FirstDaqCollection")),
65 fSecondCollection (pset.
get<
std::
string >(
"SecondCollection")),
66 fFirstCollectionIsMC (pset.
get< bool >(
"FirstCollectionIsMC")),
67 fSecondCollectionIsMC (pset.
get< bool >(
"SecondCollectionIsMC")),
68 fUseSecondaryTrigger (pset.
get< bool >(
"UseSecondaryTrigger")),
69 fRemoveFirstCollectionNoise (pset.
get< bool >(
"RemoveFirstCollectionNoise")),
70 fRemoveSecondCollectionNoise(pset.
get< bool >(
"RemoveSecondCollectionNoise")),
71 fOverlayWithTDCCut(pset.
get< bool >(
"OverlayWithTDCCut")),
72 fTDCExtendValue(pset.
get<
int >(
"TDCExtendValue")),
73 fInstanceLabel (pset.
get<
std::
string >(
"InstanceLabel"))
75 produces< std::vector<rawdata::RawDigit> >(fInstanceLabel);
76 produces< std::vector<rawdata::RawTrigger> >(fInstanceLabel);
80 MergeDaqCollections::~MergeDaqCollections()
91 if(fSecondCollectionIsMC) bt->
Rebuild(evt);
93 std::unique_ptr< std::vector<rawdata::RawDigit> > digitcol (
new std::vector<rawdata::RawDigit>);
94 std::unique_ptr< std::vector<rawdata::RawTrigger> > triggercol (
new std::vector<rawdata::RawTrigger>);
97 evt.
getByLabel(fFirstDaqCollection, digit1list);
100 evt.
getByLabel(fSecondCollection, digit2list);
106 for(
unsigned int i = 0;
i < digit1list->size(); ++
i){
108 digit.
SetMC(fFirstCollectionIsMC);
109 if(fFirstCollectionIsMC && fRemoveFirstCollectionNoise){
113 digitcol->push_back(digit);
116 digitcol->push_back(digit);
119 if (fOverlayWithTDCCut){
120 for(
auto digit: *digitcol){
121 min_TDC =
std::min(min_TDC, digit.TDC());
122 max_TDC =
std::max(max_TDC, digit.TDC());
127 min_TDC =
std::max(min_TDC-fTDCExtendValue, -3200);
128 max_TDC = max_TDC+fTDCExtendValue;
131 for(
unsigned int i = 0;
i < digit2list->size(); ++
i){
133 if (fOverlayWithTDCCut){
134 if (digit.
TDC()>max_TDC || digit.
TDC()<min_TDC)
137 digit.
SetMC(fSecondCollectionIsMC);
138 if(fSecondCollectionIsMC && fRemoveSecondCollectionNoise){
142 digitcol->push_back(digit);
145 digitcol->push_back(digit);
152 if(fUseSecondaryTrigger){
153 evt.
getByLabel(fSecondCollection, triggerlist);
155 for (
unsigned int i = 0;
i < triggerlist->size(); ++
i) {
157 triggercol->push_back(trigger);
160 evt.
getByLabel(fFirstDaqCollection, triggerlist);
162 for (
unsigned int i = 0;
i < triggerlist->size(); ++
i) {
164 triggercol->push_back(trigger);
169 evt.
put(std::move(digitcol), fInstanceLabel);
170 evt.
put(std::move(triggercol), fInstanceLabel);
T max(const caf::Proxy< T > &a, T b)
back track the reconstruction to the simulation
int32_t TDC() const
The time of the last baseline sample.
bool fUseSecondaryTrigger
Second collection is MC.
bool fOverlayWithTDCCut
Don't mix in noise hits from second collection, if it is MC.
DEFINE_ART_MODULE(TestTMapFile)
rb::CellHit MakeCellHit(const rawdata::RawDigit *rawdigit)
bool IsNoise(const art::Ptr< rb::CellHit > &hit) const
Is this hit not associated with any particles?
ProductID put(std::unique_ptr< PROD > &&product)
std::string fInstanceLabel
bool fRemoveSecondCollectionNoise
Don't mix in noise hits from first collection, if it is MC.
std::string fFirstDaqCollection
bool fFirstCollectionIsMC
Label on the main collection.
std::string fSecondCollection
Label on the main collection.
bool fSecondCollectionIsMC
First collection is MC.
bool fRemoveFirstCollectionNoise
Want trigger from 2nd collection rather than 1st.
void Rebuild(const art::Event &evt)
void SetMC(bool isMC=true)
static float min(const float a, const float b, const float c)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
int fTDCExtendValue
Only overlay secondary hits within a TDC range of the main event hits. Since we are using the seconda...
group hits according to time and space
T min(const caf::Proxy< T > &a, T b)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)