93 std::cout <<
" Could not read SimTracks!!!!" << std::endl;
107 const std::string subdet(
"g4SimHitsTrackerHitsTECHighTof");
111 std::cout <<
" Could not read SimHits with label " << subdet <<
"!!!!" << std::endl;
113 std::cout <<
"\n\n=================== Starting SimHit access, subdet " << subdet
114 <<
" ===================" << std::endl;
116 std::unique_ptr<MixCollection<PSimHit>>
col(
120 for (cfi =
col->begin(); cfi !=
col->end(); cfi++) {
121 std::cout <<
" Hit " <<
count <<
" has tof " << cfi->timeOfFlight() <<
" trackid " << cfi->trackId()
122 <<
" bunchcr " << cfi.bunch() <<
" trigger " << cfi.getTrigger()
123 <<
", from EncodedEventId: " << cfi->eventId().bunchCrossing() <<
" " << cfi->eventId().event()
124 <<
" bcr from MixCol " << cfi.bunch() << std::endl;
131 const std::string subdetcalo(
"g4SimHitsEcalHitsEB");
135 std::cout <<
" Could not read CaloHits with label " << subdetcalo <<
"!!!!" << std::endl;
137 std::cout <<
"\n\n=================== Starting CaloHit access, subdet " << subdetcalo
138 <<
" ===================" << std::endl;
139 std::unique_ptr<MixCollection<PCaloHit>> colcalo(
141 std::cout << *(colcalo.get()) << std::endl;
144 for (cficalo = colcalo->begin(); cficalo != colcalo->end(); cficalo++) {
145 std::cout <<
" CaloHit " <<
count <<
" has tof " << cficalo->time() <<
" trackid " << cficalo->geantTrackId()
146 <<
" bunchcr " << cficalo.bunch() <<
" trigger " << cficalo.getTrigger()
147 <<
", from EncodedEventId: " << cficalo->eventId().bunchCrossing() <<
" " << cficalo->eventId().event()
156 std::cout <<
"\n=================== Starting SimTrack access ===================" << std::endl;
162 std::cout <<
" \nWe got " << col2->sizeSignal() <<
" signal tracks and " << col2->sizePileup()
163 <<
" pileup tracks, total: " << col2->size() << std::endl;
164 for (cfi2 = col2->begin(); cfi2 != col2->end(); cfi2++) {
165 std::cout <<
" SimTrack " << count2 <<
" has genpart index " << cfi2->genpartIndex() <<
" vertex Index " 166 << cfi2->vertIndex() <<
" bunchcr " << cfi2.
bunch() <<
" trigger " << cfi2.
getTrigger()
167 <<
", from EncodedEventId: " << cfi2->eventId().bunchCrossing() <<
" " << cfi2->eventId().event()
177 std::cout <<
" Could not read Simvertices !!!!" << std::endl;
179 std::cout <<
"\n=================== Starting SimVertex access ===================" << std::endl;
183 std::cout <<
" \nWe got " << col3->sizeSignal() <<
" signal vertices and " << col3->sizePileup()
184 <<
" pileup vertices, total: " << col3->size() << std::endl;
185 for (cfi3 = col3->begin(); cfi3 != col3->end(); cfi3++) {
186 std::cout <<
" SimVertex " << count3 <<
" has parent index " << cfi3->parentIndex() <<
" bunchcr " 188 <<
", from EncodedEventId: " << cfi3->eventId().bunchCrossing() <<
" " << cfi3->eventId().event()
191 std::cout <<
"Same with op*: " << count3 <<
" has parent index " << myvtx.
parentIndex() <<
" bunchcr " 200 bool got1, got2 =
false;
201 std::unique_ptr<MixCollection<PSimHit>> all_trackhits;
202 std::unique_ptr<MixCollection<PSimHit>> all_trackhits2;
203 std::cout <<
"\n=================== Starting test for coll of several ROU-s ===================" << std::endl;
205 std::vector<const CrossingFrame<PSimHit>*> cfvec;
210 std::cout <<
"\n=================== Starting test for coll of several ROU-s ===================" << std::endl;
211 cfvec.push_back(cf_simhit.
product());
213 <<
", Nr pileups " << cf_simhit->getNrPileups() << std::endl;
216 cfvec.push_back(cf_simhit.
product());
218 <<
", Nr pileups " << cf_simhit->getNrPileups() << std::endl;
219 all_trackhits = std::make_unique<MixCollection<PSimHit>>(cfvec);
221 std::cout <<
" \nFor all containers we got " << all_trackhits->sizeSignal() <<
" signal hits and " 222 << all_trackhits->sizePileup() <<
" pileup hits, total: " << all_trackhits->size() << std::endl;
226 for (it = all_trackhits->begin(); it != all_trackhits->end(); it++) {
227 std::cout <<
" Hit " <<
ii <<
" of all hits has tof " << it->timeOfFlight() <<
" trackid " << it->trackId()
229 <<
", from EncodedEventId: " << it->eventId().bunchCrossing() <<
" " << it->eventId().event()
239 std::vector<const CrossingFrame<PSimHit>*> cfvec2;
244 cfvec2.push_back(cf_simhit.
product());
247 cfvec2.push_back(cf_simhit.
product());
248 all_trackhits2 = std::make_unique<MixCollection<PSimHit>>(cfvec2);
249 std::cout <<
" \nSame containers, different order: we got " << all_trackhits2->sizeSignal() <<
" signal hits and " 250 << all_trackhits2->sizePileup() <<
" pileup hits, total: " << all_trackhits2->size() << std::endl;
251 for (it2 = all_trackhits2->begin(); it2 != all_trackhits2->end(); it2++) {
252 std::cout <<
" Hit " << ii2 <<
" of all hits has tof " << it2->timeOfFlight() <<
" trackid " << it2->trackId()
254 <<
", bcr from Id: " << it2->eventId().bunchCrossing() <<
" evtnr in id " << it2->eventId().event()
268 std::cout <<
" Could not read HepMCProducts!!!!" << std::endl;
270 std::unique_ptr<MixCollection<edm::HepMCProduct>> colhepmc(
274 std::cout <<
" \nWe got " << colhepmc->sizeSignal() <<
" signal hepmc products and " << colhepmc->sizePileup()
275 <<
" pileup hepmcs, total: " << colhepmc->size() << std::endl;
276 for (cfihepmc = colhepmc->begin(); cfihepmc != colhepmc->end(); cfihepmc++) {
277 std::cout <<
" edm::HepMCProduct " << counthepmc <<
" has event number " << cfihepmc->GetEvent()->event_number()
278 <<
", " << cfihepmc->GetEvent()->particles_size() <<
" particles and " 279 << cfihepmc->GetEvent()->vertices_size() <<
" vertices, bunchcr= " << cfihepmc.
bunch()
282 std::cout <<
"same with getObject:hepmc product " << counthepmc <<
" has event number " 283 << myprod.
GetEvent()->event_number() <<
", " << myprod.
GetEvent()->particles_size() <<
" particles and " 284 << myprod.
GetEvent()->vertices_size() <<
" vertices" << std::endl;
295 for (it2 = all_trackhits2->begin(); it2 != all_trackhits2->end(); it2++)
298 std::cout <<
" Problem when re-using iterator!!" << std::endl;
300 std::cout <<
" \nNo problem when re-using iterator." << std::endl;
306 std::cout <<
"\n=================== Starting tests for abnormal conditions ===================" << std::endl;
310 std::cout <<
"\n[ Testing abnormal conditions case 0]Should be all ok: registry: " << all_trackhits->inRegistry()
311 <<
" size: " << all_trackhits->size() << std::endl;
314 std::cout <<
"\n[ Testing abnormal conditions case 1] Should throw an exception " << std::endl;
edm::EDGetTokenT< CrossingFrame< PSimHit > > TrackerToken3_
edm::EDGetTokenT< CrossingFrame< HepMCProduct > > HepMCToken_
edm::EDGetTokenT< CrossingFrame< PSimHit > > TrackerToken4_
int event() const
get the contents of the subdetector field (should be protected?)
edm::EDGetTokenT< CrossingFrame< PSimHit > > TrackerToken2_
int getSourceType() const
T const * product() const
std::vector< std::string > track_containers2_
int bunchCrossing() const
get the detector field from this detid
const HepMC::GenEvent * GetEvent() const
edm::EDGetTokenT< CrossingFrame< SimTrack > > SimTrackToken_
std::vector< std::string > track_containers_
edm::EDGetTokenT< CrossingFrame< SimVertex > > SimVertexToken_
EncodedEventId eventId() const
edm::EDGetTokenT< CrossingFrame< PSimHit > > TrackerToken1_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > CaloToken1_
edm::EDGetTokenT< CrossingFrame< PSimHit > > TrackerToken0_