18 std::map<std::pair<int,unsigned int>,std::vector<digitWrapper> >&
entries,
19 std::map<std::pair<int,unsigned int>,std::vector<hitData_entry> >& Hits_Data_Set_Time,
20 std::map<std::pair<int,unsigned int>,
evInf_entry>& Event_Info,
23 std::vector<ROOT::Math::PtEtaPhiEVector> truthParticles, truthParticles_ent, truthParticles_pos;
25 std::vector<ROOT::Math::XYZVector>
vertex;
26 float phiEntry_tmp = 0;
27 float phiPosition_tmp = 0;
28 float etaEntry_tmp = 0;
29 float etaPosition_tmp = 0;
31 ROOT::Math::XYZVector vertex_tmp(0.,0.,0.);
33 ROOT::Math::PtEtaPhiEVector thePart, theInfo;
34 auto MuEntry_Particle_n = (trackRecordCollection!=
nullptr)?trackRecordCollection->
size():0;
36 if( truthContainer !=
nullptr ){
37 for(
const auto it : *truthContainer) {
38 const HepMC::GenEvent *subEvent =
it;
39 for(
const auto&
particle : *subEvent){
43 if(trackRecordCollection!=
nullptr){
44 for(
const auto & mit : *trackRecordCollection ) {
45 const CLHEP::Hep3Vector mumomentum = mit.GetMomentum();
46 const CLHEP::Hep3Vector muposition = mit.GetPosition();
49 phiEntry_tmp = mumomentum.getPhi();
50 etaEntry_tmp = mumomentum.getEta();
51 phiPosition_tmp = muposition.getPhi();
52 etaPosition_tmp = muposition.getEta();
57 vertex_tmp = subEvent->vertices().front()->position();
60 for(
const auto vit : subEvent->vertex_range())
64 const HepMC::GenVertex *vertex1 = vit;
65 const HepMC::FourVector& position = vertex1->position();
66 vertex_tmp.SetXYZ(position.x(),position.y(),position.z());
74 for(
unsigned int ipart=0; ipart < truthParticles.size(); ipart++){
75 if( std::abs(thePart.Pt()-truthParticles[ipart].Pt()) < 0.001 ||
76 std::abs(thePart.Eta()-truthParticles[ipart].Eta()) < 0.001 ||
78 std::abs(thePart.E()-truthParticles[ipart].E()) < 0.001 ) addIt =
false;
81 truthParticles.push_back(thePart);
83 vertex.push_back(vertex_tmp);
84 pdg.push_back(pdg_tmp);
85 truthParticles_ent.push_back(ROOT::Math::PtEtaPhiEVector(
momentum.perp(),etaEntry_tmp ,phiEntry_tmp ,
momentum.e()));
86 truthParticles_pos.push_back(ROOT::Math::PtEtaPhiEVector(
momentum.perp(),etaPosition_tmp,phiPosition_tmp,
momentum.e()));
94 int event = ctx.eventID().event_number();
95 int TruthParticle_n = j;
96 unsigned int digit_particles = 0;
97 for(
auto digitCollectionIter : *nsw_MmDigitContainer) {
101 std::vector<digitWrapper> entries_tmp;
103 for (
const auto item:*digitCollection) {
119 std::vector<float>
time{
digit->stripResponseTime()};
120 std::vector<float>
charge{
digit->stripResponseCharge()};
121 std::vector<int> stripPosition{
channel};
122 std::vector<int> MMFE_VMM{
channel};
133 std::vector<double> localPosX;
134 std::vector<double> localPosY;
135 std::vector<double> globalPosX;
136 std::vector<double> globalPosY;
137 std::vector<double> globalPosZ;
140 for (
const auto &
i: stripPosition) {
145 localPosX.push_back (0.);
146 localPosY.push_back (0.);
147 globalPosX.push_back(0.);
148 globalPosY.push_back(0.);
149 globalPosZ.push_back(0.);
154 ATH_MSG_WARNING(
"MicroMegas digitization: failed to create a valid ID for (chip response) strip n. " << cr_strip
155 <<
"; associated positions will be set to 0.0.");
160 ATH_MSG_WARNING(
"MicroMegas digitization: failed to associate a valid local position for (chip response) strip n. " << cr_strip
161 <<
"; associated positions will be set to 0.0.");
163 localPosX[nstrip-1] = cr_strip_pos.x();
164 localPosY[nstrip-1] = cr_strip_pos.y();
170 globalPosX[nstrip-1] = cr_strip_gpos[0];
171 globalPosY[nstrip-1] = cr_strip_gpos[1];
172 globalPosZ[nstrip-1] = cr_strip_gpos[2];
185 if(globalPosY.empty())
continue;
187 if (!
time.empty()) entries_tmp.push_back(
189 ROOT::Math::XYZVector(-999, -999, -999),
190 ROOT::Math::XYZVector(localPosX[0], localPosY[0], -999),
191 ROOT::Math::XYZVector(globalPosX[0], globalPosY[0], globalPosZ[0] )
195 if (!entries_tmp.empty()) {
196 std::vector<std::string> stNames;
197 for(
const auto &dW : entries_tmp) stNames.push_back(dW.stName);
198 if(std::all_of(stNames.begin(), stNames.end(), [&] (
const std::string &
name) { return name == stNames[0]; })) {
199 entries[std::make_pair(
event,digit_particles)]=entries_tmp;
202 ATH_MSG_WARNING(
"Digits belonging to different stations, skipping items");
208 for(
unsigned int i=0;
i<truthParticles.size();
i++) {
210 truthParticles[
i].
E(), truthParticles[
i].
Pt(),
211 truthParticles[
i].
Eta(), truthParticles_pos[
i].
Eta(), truthParticles_ent[
i].
Eta(),
212 truthParticles[
i].
Phi(), truthParticles_pos[
i].
Phi(), truthParticles_ent[
i].
Phi(),
213 truthParticles[
i].Theta(), truthParticles_pos[
i].Theta(), truthParticles_ent[
i].Theta(), truthParticles_ent[
i].Theta()-truthParticles_pos[
i].Theta(),
214 TruthParticle_n,MuEntry_Particle_n,
vertex[
i]);
215 Event_Info[std::make_pair(
event,
i)] = particle_info;
225 double tru_phi = -999, tru_theta = -999;
226 std::pair<int, unsigned int> pair (
event,ient);
227 auto tru_it = Event_Info.find(pair);
228 if (tru_it != Event_Info.end()) {
229 tru_phi = tru_it->second.phi_pos;
230 tru_theta = tru_it->second.theta_pos;
233 std::string station =
it->second[0].stName;
234 std::vector<hitData_entry> hit_info;
235 hit_info.reserve(
it->second.size());
238 for (
const auto &dW :
it->second) {
242 int thisTime = dW.digit->stripResponseTime();
245 double thisLocalPosX = dW.strip_lpos.X();
247 int thisMMFE_VMM = thisVMM;
250 int thisPlane = (thisMultiplet-1)*4+thisGasGap-1;
251 int BC_id = std::ceil( thisTime / 25. );
252 ROOT::Math::XYZVector mazin_check(
277 hit_info.push_back(hit_entry);
281 Hits_Data_Set_Time[std::make_pair(
event,ient)] = hit_info;
284 return StatusCode::SUCCESS;