27 : fInData1(nullptr), fInData2(nullptr), fInData3(nullptr), fOutData(nullptr), fTelID(0) {
28 RegisterInputCollection(
"InputCollection1",
29 "array of objects inheriting from art::TTimingChargeData",
31 RegisterInputCollection(
"InputCollection2",
32 "array of objects inheriting from art::TTimingChargeData",
34 RegisterInputCollection(
"InputCollection3",
35 "array of objects inheriting from art::TTimingChargeData",
37 RegisterOutputCollection(
"OutputCollection",
"output class will be art::crib::TTelescopeData",
40 RegisterProcessorParameter(
"IsDSSSD",
"Bool, true: first layer is DSSSD, false: first and second layer is SSSSD",
fIsDSSSD,
true);
41 RegisterProcessorParameter(
"UseRandom",
"Bool, true: Uniform distribution in one pixel, false: center of the pixel",
fUseRandom,
false);
43 RegisterOptionalInputInfo(
"DetectorParameter",
"name of detector parameter defined in TUserGeoInitializer",
fDetPrmName,
44 TString(
"prm_detectors"), &
fDetParameters,
"TClonesArray",
"art::crib::TDetectorParameter");
45 RegisterOptionalInputInfo(
"TargetParameter",
"name of target parameter defined in TUserGeoInitializer",
fTargetPrmName,
46 TString(
"prm_targets"), &
fTargetParameters,
"TClonesArray",
"art::crib::TTargetParameter");
60 SetStateError(TString::Format(
"input not found: %s",
fInputColName1.Data()));
67 SetStateError(TString::Format(
"input not found: %s",
fInputColName2.Data()));
74 SetStateError(TString::Format(
"input not found: %s",
fInputColName3.Data()));
83 for (Int_t iDet = 0; iDet < (*fDetParameters)->GetEntriesFast(); iDet++) {
92 Warning(
"Init",
"cannot find %s node, please check TUserGeoInitializer",
fOutputColName.Data());
102 if ((*fTargetParameters)->GetEntriesFast() == 0) {
103 Warning(
"Init",
"cannot find target node. please check TUserGeoInitializer");
110 Info(
"Init",
"use first target %s information (only use the position)", prm->
GetTargetName().Data());
115 Warning(
"Init",
"not initialized by TUserGeoInitializer, not calculate geometry info");
119 const TClass *
const cl1 = (*fInData1)->GetClass();
120 const TClass *
const cl2 = (*fInData2)->GetClass();
121 const TClass *
const cl3 = (*fInData3)->GetClass();
122 fInputHasData = (cl1->InheritsFrom(art::TTimingChargeData::Class())) && (cl2->InheritsFrom(art::TTimingChargeData::Class())) && (cl3->InheritsFrom(art::TTimingChargeData::Class()));
125 SetStateError(
"contents of input array must inherit from art::TTimingChargeData");
129 fOutData =
new TClonesArray(
"art::crib::TTelescopeData");
133 gRandom->SetSeed(time(
nullptr));
139 Int_t nData1 = (*fInData1)->GetEntriesFast();
140 Int_t nData2 = (*fInData2)->GetEntriesFast();
141 Int_t nData3 = (*fInData3)->GetEntriesFast();
144 if (nData1 == 0 && nData2 == 0 && nData3 == 0) {
158 Double_t Etotal = 0.0;
164 Double_t dEX_tmp = 0.0;
165 for (Int_t iData1 = 0; iData1 < nData1; ++iData1) {
167 const TTimingChargeData *
const Data1 =
dynamic_cast<const TTimingChargeData *
>(inData1);
169 if (dEX_tmp < Data1->GetCharge() && Data1->GetCharge() < 50.0) {
171 dEX_tmp = Data1->GetCharge();
176 if (nData1 != 0 && dEXID != -1) {
178 const TTimingChargeData *
const Data1 =
dynamic_cast<const TTimingChargeData *
>(inData1);
179 Double_t energy = Data1->GetCharge();
180 Double_t timing = Data1->GetTiming();
184 if (energy < fDetParameter->GetPedestal(0)) {
189 outData->
SetXID(Data1->GetDetID());
191 outData->
SetdE(energy);
208 Double_t dEY_tmp = 0.0;
209 for (Int_t iData2 = 0; iData2 < nData2; ++iData2) {
211 const TTimingChargeData *
const Data2 =
dynamic_cast<const TTimingChargeData *
>(inData2);
213 if (dEY_tmp < Data2->GetCharge() && Data2->GetCharge() < 50.0) {
215 dEY_tmp = Data2->GetCharge();
220 if (nData2 != 0 && dEYID != -1) {
222 const TTimingChargeData *
const Data2 =
dynamic_cast<const TTimingChargeData *
>(inData2);
223 Double_t energy = Data2->GetCharge();
224 Double_t timing = Data2->GetTiming();
229 if (energy < fDetParameter->GetPedestal(0)) {
233 if (energy < fDetParameter->GetPedestal(1)) {
239 outData->
SetYID(Data2->GetDetID());
262 Int_t xid = outData->
GetXID();
263 Int_t yid = outData->
GetYID();
266 Double_t x = size[0] * (2.0 * (Double_t)xid + 1.0 - (Double_t)stripN[0]) / (2.0 * (Double_t)stripN[0]);
268 x += gRandom->Uniform(-size[0] / (2.0 * (Double_t)stripN[0]), size[0] / (2.0 * (Double_t)stripN[0]));
270 Double_t y = size[1] * (2.0 * (Double_t)yid + 1.0 - (Double_t)stripN[1]) / (2.0 * (Double_t)stripN[1]);
272 y += gRandom->Uniform(-size[1] / (2.0 * (Double_t)stripN[1]), size[1] / (2.0 * (Double_t)stripN[1]));
279 det_pos += center_rot;
282 TVector3 target(0., 0., target_z);
283 TVector3 beam(0., 0., 1.);
284 Double_t theta = beam.Angle(det_pos - target);
285 outData->
SetTheta_L(theta * TMath::RadToDeg());
299 Warning(
"process",
"Thick SSD number is wrong between actual data and define in get/expname.yaml");
302 for (Int_t iE = 0; iE < NE; iE++) {
306 for (Int_t iData3 = 0; iData3 < nData3; ++iData3) {
308 const TTimingChargeData *
const Data3 =
dynamic_cast<const TTimingChargeData *
>(inData3);
309 if (Data3->GetDetID() == iE) {
320 const TTimingChargeData *
const Data3 =
dynamic_cast<const TTimingChargeData *
>(inData3);
321 Double_t energy = Data3->GetCharge();
322 Double_t timing = Data3->GetTiming();
326 if (energy < fDetParameter->GetPedestal(index + iE)) {