94 std::cout <<
" Could not read SimTracks!!!!" << std::endl;
108 const std::string subdet(
"g4SimHitsTrackerHitsTECHighTof");
112 std::cout <<
" Could not read SimHits with label " << subdet <<
"!!!!" << std::endl;
114 std::cout <<
"\n\n=================== Starting SimHit access, subdet " << subdet
115 <<
" ===================" << std::endl;
117 std::unique_ptr<MixCollection<PSimHit>>
col(
121 for (cfi =
col->begin(); cfi !=
col->end(); cfi++) {
122 std::cout <<
" Hit " <<
count <<
" has tof " << cfi->timeOfFlight() <<
" trackid " << cfi->trackId()
123 <<
" bunchcr " << cfi.bunch() <<
" trigger " << cfi.getTrigger()
124 <<
", from EncodedEventId: " << cfi->eventId().bunchCrossing() <<
" " << cfi->eventId().event()
125 <<
" bcr from MixCol " << cfi.bunch() << std::endl;
132 const std::string subdetcalo(
"g4SimHitsEcalHitsEB");
136 std::cout <<
" Could not read CaloHits with label " << subdetcalo <<
"!!!!" << std::endl;
138 std::cout <<
"\n\n=================== Starting CaloHit access, subdet " << subdetcalo
139 <<
" ===================" << std::endl;
140 std::unique_ptr<MixCollection<PCaloHit>> colcalo(
142 std::cout << *(colcalo.get()) << std::endl;
145 for (cficalo = colcalo->begin(); cficalo != colcalo->end(); cficalo++) {
146 std::cout <<
" CaloHit " <<
count <<
" has tof " << cficalo->time() <<
" trackid " << cficalo->geantTrackId()
147 <<
" bunchcr " << cficalo.bunch() <<
" trigger " << cficalo.getTrigger()
148 <<
", from EncodedEventId: " << cficalo->eventId().bunchCrossing() <<
" " << cficalo->eventId().event()
157 std::cout <<
"\n=================== Starting SimTrack access ===================" << std::endl;
163 std::cout <<
" \nWe got " << col2->sizeSignal() <<
" signal tracks and " << col2->sizePileup()
164 <<
" pileup tracks, total: " << col2->size() << std::endl;
165 for (cfi2 = col2->begin(); cfi2 != col2->end(); cfi2++) {
166 std::cout <<
" SimTrack " << count2 <<
" has genpart index " << cfi2->genpartIndex() <<
" vertex Index "
167 << cfi2->vertIndex() <<
" bunchcr " << cfi2.
bunch() <<
" trigger " << cfi2.
getTrigger()
168 <<
", from EncodedEventId: " << cfi2->eventId().bunchCrossing() <<
" " << cfi2->eventId().event()
178 std::cout <<
" Could not read Simvertices !!!!" << std::endl;
180 std::cout <<
"\n=================== Starting SimVertex access ===================" << std::endl;
184 std::cout <<
" \nWe got " << col3->sizeSignal() <<
" signal vertices and " << col3->sizePileup()
185 <<
" pileup vertices, total: " << col3->size() << std::endl;
186 for (cfi3 = col3->begin(); cfi3 != col3->end(); cfi3++) {
187 std::cout <<
" SimVertex " << count3 <<
" has parent index " << cfi3->parentIndex() <<
" bunchcr "
189 <<
", from EncodedEventId: " << cfi3->eventId().bunchCrossing() <<
" " << cfi3->eventId().event()
192 std::cout <<
"Same with op*: " << count3 <<
" has parent index " << myvtx.
parentIndex() <<
" bunchcr "
201 bool got1, got2 =
false;
202 std::unique_ptr<MixCollection<PSimHit>> all_trackhits;
203 std::unique_ptr<MixCollection<PSimHit>> all_trackhits2;
204 std::cout <<
"\n=================== Starting test for coll of several ROU-s ===================" << std::endl;
206 std::vector<const CrossingFrame<PSimHit>*> cfvec;
211 std::cout <<
"\n=================== Starting test for coll of several ROU-s ===================" << std::endl;
212 cfvec.push_back(cf_simhit.
product());
214 <<
", Nr pileups " << cf_simhit->getNrPileups() << std::endl;
217 cfvec.push_back(cf_simhit.
product());
219 <<
", Nr pileups " << cf_simhit->getNrPileups() << std::endl;
222 std::cout <<
" \nFor all containers we got " << all_trackhits->sizeSignal() <<
" signal hits and "
223 << all_trackhits->sizePileup() <<
" pileup hits, total: " << all_trackhits->size() << std::endl;
227 for (it = all_trackhits->begin(); it != all_trackhits->end(); it++) {
228 std::cout <<
" Hit " <<
ii <<
" of all hits has tof " << it->timeOfFlight() <<
" trackid " << it->trackId()
230 <<
", from EncodedEventId: " << it->eventId().bunchCrossing() <<
" " << it->eventId().event()
240 std::vector<const CrossingFrame<PSimHit>*> cfvec2;
245 cfvec2.push_back(cf_simhit.
product());
248 cfvec2.push_back(cf_simhit.
product());
250 std::cout <<
" \nSame containers, different order: we got " << all_trackhits2->sizeSignal() <<
" signal hits and "
251 << all_trackhits2->sizePileup() <<
" pileup hits, total: " << all_trackhits2->size() << std::endl;
252 for (it2 = all_trackhits2->begin(); it2 != all_trackhits2->end(); it2++) {
253 std::cout <<
" Hit " << ii2 <<
" of all hits has tof " << it2->timeOfFlight() <<
" trackid " << it2->trackId()
255 <<
", bcr from Id: " << it2->eventId().bunchCrossing() <<
" evtnr in id " << it2->eventId().event()
269 std::cout <<
" Could not read HepMCProducts!!!!" << std::endl;
271 std::unique_ptr<MixCollection<edm::HepMCProduct>> colhepmc(
275 std::cout <<
" \nWe got " << colhepmc->sizeSignal() <<
" signal hepmc products and " << colhepmc->sizePileup()
276 <<
" pileup hepmcs, total: " << colhepmc->size() << std::endl;
277 for (cfihepmc = colhepmc->begin(); cfihepmc != colhepmc->end(); cfihepmc++) {
278 std::cout <<
" edm::HepMCProduct " << counthepmc <<
" has event number " << cfihepmc->GetEvent()->event_number()
279 <<
", " << cfihepmc->GetEvent()->particles_size() <<
" particles and "
280 << cfihepmc->GetEvent()->vertices_size() <<
" vertices, bunchcr= " << cfihepmc.
bunch()
283 std::cout <<
"same with getObject:hepmc product " << counthepmc <<
" has event number "
284 << myprod.
GetEvent()->event_number() <<
", " << myprod.
GetEvent()->particles_size() <<
" particles and "
285 << myprod.
GetEvent()->vertices_size() <<
" vertices" << std::endl;
296 for (it2 = all_trackhits2->begin(); it2 != all_trackhits2->end(); it2++)
299 std::cout <<
" Problem when re-using iterator!!" << std::endl;
301 std::cout <<
" \nNo problem when re-using iterator." << std::endl;
307 std::cout <<
"\n=================== Starting tests for abnormal conditions ===================" << std::endl;
311 std::cout <<
"\n[ Testing abnormal conditions case 0]Should be all ok: registry: " << all_trackhits->inRegistry()
312 <<
" size: " << all_trackhits->size() << std::endl;
315 std::cout <<
"\n[ Testing abnormal conditions case 1] Should throw an exception " << std::endl;