Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-05 22:48:39

0001 // system include files
0002 #include <vector>
0003 #include <string>
0004 
0005 // user include files
0006 #include "FWCore/Framework/interface/Frameworkfwd.h"
0007 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0008 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0009 #include "FWCore/Utilities/interface/EDGetToken.h"
0010 #include "DataFormats/Common/interface/Handle.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 
0016 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0017 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0018 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0019 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0020 
0021 class SimHitCaloHitDumper : public edm::one::EDAnalyzer<> {
0022 public:
0023   SimHitCaloHitDumper(const edm::ParameterSet&);
0024   ~SimHitCaloHitDumper() override{};
0025 
0026   void analyze(const edm::Event&, const edm::EventSetup&) override;
0027   void beginJob() override{};
0028   void endJob() override{};
0029 
0030   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0031 
0032 private:
0033   std::string moduleName;
0034 
0035   edm::EDGetTokenT<edm::PSimHitContainer> PixelBarrelLowTofToken_;
0036   edm::EDGetTokenT<edm::PSimHitContainer> PixelBarrelHighTofToken_;
0037   edm::EDGetTokenT<edm::PSimHitContainer> PixelEndcapLowTofToken_;
0038   edm::EDGetTokenT<edm::PSimHitContainer> PixelEndcapHighTofToken_;
0039   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTIBLowTofToken_;
0040   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTIBHighTofToken_;
0041   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTIDLowTofToken_;
0042   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTIDHighTofToken_;
0043   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTOBLowTofToken_;
0044   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTOBHighTofToken_;
0045   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTECLowTofToken_;
0046   edm::EDGetTokenT<edm::PSimHitContainer> TrackerTECHighTofToken_;
0047 
0048   edm::EDGetTokenT<edm::PSimHitContainer> MuonDTToken_;
0049   edm::EDGetTokenT<edm::PSimHitContainer> MuonCSCToken_;
0050   edm::EDGetTokenT<edm::PSimHitContainer> MuonRPCToken_;
0051 
0052   edm::EDGetTokenT<edm::PSimHitContainer> FastTimerBTLToken_;
0053   edm::EDGetTokenT<edm::PSimHitContainer> FastTimerETLToken_;
0054 
0055   edm::EDGetTokenT<edm::PCaloHitContainer> EcalEBToken_;
0056   edm::EDGetTokenT<edm::PCaloHitContainer> EcalEEToken_;
0057   edm::EDGetTokenT<edm::PCaloHitContainer> EcalESToken_;
0058   edm::EDGetTokenT<edm::PCaloHitContainer> HcalToken_;
0059   edm::EDGetTokenT<edm::PCaloHitContainer> CaloTkToken_;
0060   edm::EDGetTokenT<edm::PCaloHitContainer> ZDCToken_;
0061   edm::EDGetTokenT<edm::PCaloHitContainer> CastorTUToken_;
0062   edm::EDGetTokenT<edm::PCaloHitContainer> CastorPLToken_;
0063   edm::EDGetTokenT<edm::PCaloHitContainer> CastorFIToken_;
0064   edm::EDGetTokenT<edm::PCaloHitContainer> CastorBUToken_;
0065 };
0066 
0067 SimHitCaloHitDumper::SimHitCaloHitDumper(const edm::ParameterSet& iConfig) {
0068   PixelBarrelLowTofToken_ =
0069       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsPixelBarrelLowTof"));
0070   PixelBarrelHighTofToken_ =
0071       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsPixelBarrelHighTof"));
0072   PixelEndcapLowTofToken_ =
0073       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsPixelEndcapLowTof"));
0074   PixelEndcapHighTofToken_ =
0075       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsPixelEndcapHighTof"));
0076   TrackerTIBLowTofToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTIBLowTof"));
0077   TrackerTIBHighTofToken_ =
0078       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTIBHighTof"));
0079   TrackerTIDLowTofToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTIDLowTof"));
0080   TrackerTIDHighTofToken_ =
0081       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTIDHighTof"));
0082   TrackerTOBLowTofToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTOBLowTof"));
0083   TrackerTOBHighTofToken_ =
0084       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTOBHighTof"));
0085   TrackerTECLowTofToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTECLowTof"));
0086   TrackerTECHighTofToken_ =
0087       consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("TrackerHitsTECHighTof"));
0088 
0089   MuonDTToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("MuonDTHits"));
0090   MuonCSCToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("MuonCSCHits"));
0091   MuonRPCToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("MuonRPCHits"));
0092 
0093   FastTimerBTLToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("FastTimerHitsBarrel"));
0094   FastTimerETLToken_ = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("FastTimerHitsEndcap"));
0095 
0096   EcalEBToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("EcalHitsEB"));
0097   EcalEEToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("EcalHitsEE"));
0098   EcalESToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("EcalHitsES"));
0099   HcalToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("HcalHits"));
0100   CaloTkToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("CaloHitsTk"));
0101   ZDCToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("ZDCHITS"));
0102   CastorTUToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("CastorTU"));
0103   CastorPLToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("CastorPL"));
0104   CastorFIToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("CastorFI"));
0105   CastorBUToken_ = consumes<edm::PCaloHitContainer>(iConfig.getParameter<edm::InputTag>("CastorBU"));
0106 }
0107 
0108 void SimHitCaloHitDumper::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0109   std::vector<PSimHit> theTrackerHits;
0110   std::vector<PSimHit> theMuonHits;
0111   std::vector<PSimHit> theMTDHits;
0112   std::vector<PCaloHit> theCaloHits;
0113 
0114   std::vector<std::pair<int, std::string> > theTrackerComposition;
0115   std::vector<std::pair<int, std::string> > theMuonComposition;
0116   std::vector<std::pair<int, std::string> > theMTDComposition;
0117   std::vector<std::pair<int, std::string> > theCaloComposition;
0118 
0119   auto PixelBarrelHitsLowTof = iEvent.getHandle(PixelBarrelLowTofToken_);
0120   auto PixelBarrelHitsHighTof = iEvent.getHandle(PixelBarrelHighTofToken_);
0121   auto PixelEndcapHitsLowTof = iEvent.getHandle(PixelEndcapLowTofToken_);
0122   auto PixelEndcapHitsHighTof = iEvent.getHandle(PixelEndcapHighTofToken_);
0123   auto TIBHitsLowTof = iEvent.getHandle(TrackerTIBLowTofToken_);
0124   auto TIBHitsHighTof = iEvent.getHandle(TrackerTIBHighTofToken_);
0125   auto TIDHitsLowTof = iEvent.getHandle(TrackerTIDLowTofToken_);
0126   auto TIDHitsHighTof = iEvent.getHandle(TrackerTIDHighTofToken_);
0127   auto TOBHitsLowTof = iEvent.getHandle(TrackerTOBLowTofToken_);
0128   auto TOBHitsHighTof = iEvent.getHandle(TrackerTOBHighTofToken_);
0129   auto TECHitsLowTof = iEvent.getHandle(TrackerTECLowTofToken_);
0130   auto TECHitsHighTof = iEvent.getHandle(TrackerTECHighTofToken_);
0131 
0132   auto DTHits = iEvent.getHandle(MuonDTToken_);
0133   auto CSCHits = iEvent.getHandle(MuonCSCToken_);
0134   auto RPCHits = iEvent.getHandle(MuonRPCToken_);
0135 
0136   auto EBHits = iEvent.getHandle(EcalEBToken_);
0137   auto EEHits = iEvent.getHandle(EcalEEToken_);
0138   auto ESHits = iEvent.getHandle(EcalESToken_);
0139   auto HcalHits = iEvent.getHandle(HcalToken_);
0140   auto CaloTkHits = iEvent.getHandle(CaloTkToken_);
0141   auto ZDCHits = iEvent.getHandle(ZDCToken_);
0142   auto CastorTUHits = iEvent.getHandle(CastorTUToken_);
0143   auto CastorPLHits = iEvent.getHandle(CastorPLToken_);
0144   auto CastorFIHits = iEvent.getHandle(CastorFIToken_);
0145   auto CastorBUHits = iEvent.getHandle(CastorBUToken_);
0146 
0147   auto BTLHits = iEvent.getHandle(FastTimerBTLToken_);
0148   auto ETLHits = iEvent.getHandle(FastTimerETLToken_);
0149 
0150   int oldsize = 0;
0151 
0152   if (PixelBarrelHitsLowTof.isValid()) {
0153     theTrackerHits.insert(theTrackerHits.end(), PixelBarrelHitsLowTof->begin(), PixelBarrelHitsLowTof->end());
0154     std::pair<int, std::string> label1(theTrackerHits.size(), "PixelBarrelHitsLowTof");
0155     oldsize = theTrackerHits.size();
0156     theTrackerComposition.push_back(label1);
0157   }
0158   if (PixelBarrelHitsHighTof.isValid()) {
0159     theTrackerHits.insert(theTrackerHits.end(), PixelBarrelHitsHighTof->begin(), PixelBarrelHitsHighTof->end());
0160     std::pair<int, std::string> label2(theTrackerHits.size() - oldsize, "PixelBarrelHitsHighTof");
0161     oldsize = theTrackerHits.size();
0162     theTrackerComposition.push_back(label2);
0163   }
0164   if (PixelEndcapHitsLowTof.isValid()) {
0165     theTrackerHits.insert(theTrackerHits.end(), PixelEndcapHitsLowTof->begin(), PixelEndcapHitsLowTof->end());
0166     std::pair<int, std::string> label3(theTrackerHits.size() - oldsize, "PixelEndcapHitsLowTof");
0167     oldsize = theTrackerHits.size();
0168     theTrackerComposition.push_back(label3);
0169   }
0170   if (PixelEndcapHitsHighTof.isValid()) {
0171     theTrackerHits.insert(theTrackerHits.end(), PixelEndcapHitsHighTof->begin(), PixelEndcapHitsHighTof->end());
0172     std::pair<int, std::string> label4(theTrackerHits.size() - oldsize, "PixelEndcapHitsHighTof");
0173     oldsize = theTrackerHits.size();
0174     theTrackerComposition.push_back(label4);
0175   }
0176   if (TIBHitsLowTof.isValid()) {
0177     theTrackerHits.insert(theTrackerHits.end(), TIBHitsLowTof->begin(), TIBHitsLowTof->end());
0178     std::pair<int, std::string> label5(theTrackerHits.size() - oldsize, "TIBHitsLowTof");
0179     oldsize = theTrackerHits.size();
0180     theTrackerComposition.push_back(label5);
0181   }
0182   if (TIBHitsHighTof.isValid()) {
0183     theTrackerHits.insert(theTrackerHits.end(), TIBHitsHighTof->begin(), TIBHitsHighTof->end());
0184     std::pair<int, std::string> label6(theTrackerHits.size() - oldsize, "TIBHitsHighTof");
0185     oldsize = theTrackerHits.size();
0186     theTrackerComposition.push_back(label6);
0187   }
0188   if (TIDHitsLowTof.isValid()) {
0189     theTrackerHits.insert(theTrackerHits.end(), TIDHitsLowTof->begin(), TIDHitsLowTof->end());
0190     std::pair<int, std::string> label7(theTrackerHits.size() - oldsize, "TIDHitsLowTof");
0191     oldsize = theTrackerHits.size();
0192     theTrackerComposition.push_back(label7);
0193   }
0194   if (TIDHitsHighTof.isValid()) {
0195     theTrackerHits.insert(theTrackerHits.end(), TIDHitsHighTof->begin(), TIDHitsHighTof->end());
0196     std::pair<int, std::string> label8(theTrackerHits.size() - oldsize, "TIDHitsHighTof");
0197     oldsize = theTrackerHits.size();
0198     theTrackerComposition.push_back(label8);
0199   }
0200   if (TOBHitsLowTof.isValid()) {
0201     theTrackerHits.insert(theTrackerHits.end(), TOBHitsLowTof->begin(), TOBHitsLowTof->end());
0202     std::pair<int, std::string> label9(theTrackerHits.size() - oldsize, "TOBHitsLowTof");
0203     oldsize = theTrackerHits.size();
0204     theTrackerComposition.push_back(label9);
0205   }
0206   if (TOBHitsHighTof.isValid()) {
0207     theTrackerHits.insert(theTrackerHits.end(), TOBHitsHighTof->begin(), TOBHitsHighTof->end());
0208     std::pair<int, std::string> label10(theTrackerHits.size() - oldsize, "TOBHitsHighTof");
0209     oldsize = theTrackerHits.size();
0210     theTrackerComposition.push_back(label10);
0211   }
0212   if (TECHitsLowTof.isValid()) {
0213     theTrackerHits.insert(theTrackerHits.end(), TECHitsLowTof->begin(), TECHitsLowTof->end());
0214     std::pair<int, std::string> label11(theTrackerHits.size() - oldsize, "TECHitsLowTof");
0215     oldsize = theTrackerHits.size();
0216     theTrackerComposition.push_back(label11);
0217   }
0218   if (TECHitsHighTof.isValid()) {
0219     theTrackerHits.insert(theTrackerHits.end(), TECHitsHighTof->begin(), TECHitsHighTof->end());
0220     std::pair<int, std::string> label12(theTrackerHits.size() - oldsize, "TECHitsHighTof");
0221     oldsize = theTrackerHits.size();
0222     theTrackerComposition.push_back(label12);
0223   }
0224 
0225   oldsize = 0;
0226   if (DTHits.isValid()) {
0227     theMuonHits.insert(theMuonHits.end(), DTHits->begin(), DTHits->end());
0228     std::pair<int, std::string> label13(theMuonHits.size() - oldsize, "DTHits");
0229     oldsize = theMuonHits.size();
0230     theMuonComposition.push_back(label13);
0231   }
0232   if (CSCHits.isValid()) {
0233     theMuonHits.insert(theMuonHits.end(), CSCHits->begin(), CSCHits->end());
0234     std::pair<int, std::string> label14(theMuonHits.size() - oldsize, "CSCHits");
0235     oldsize = theMuonHits.size();
0236     theMuonComposition.push_back(label14);
0237   }
0238   if (RPCHits.isValid()) {
0239     theMuonHits.insert(theMuonHits.end(), RPCHits->begin(), RPCHits->end());
0240     std::pair<int, std::string> label15(theMuonHits.size() - oldsize, "RPCHits");
0241     oldsize = theMuonHits.size();
0242     theMuonComposition.push_back(label15);
0243   }
0244 
0245   oldsize = 0;
0246   if (EBHits.isValid()) {
0247     theCaloHits.insert(theCaloHits.end(), EBHits->begin(), EBHits->end());
0248     std::pair<int, std::string> label16(theCaloHits.size() - oldsize, "EBHits");
0249     oldsize = theCaloHits.size();
0250     theCaloComposition.push_back(label16);
0251   }
0252   if (EEHits.isValid()) {
0253     theCaloHits.insert(theCaloHits.end(), EEHits->begin(), EEHits->end());
0254     std::pair<int, std::string> label17(theCaloHits.size() - oldsize, "EEHits");
0255     oldsize = theCaloHits.size();
0256     theCaloComposition.push_back(label17);
0257   }
0258   if (ESHits.isValid()) {
0259     theCaloHits.insert(theCaloHits.end(), ESHits->begin(), ESHits->end());
0260     std::pair<int, std::string> label18(theCaloHits.size() - oldsize, "ESHits");
0261     oldsize = theCaloHits.size();
0262     theCaloComposition.push_back(label18);
0263   }
0264   if (HcalHits.isValid()) {
0265     theCaloHits.insert(theCaloHits.end(), HcalHits->begin(), HcalHits->end());
0266     std::pair<int, std::string> label19(theCaloHits.size() - oldsize, "HcalHits");
0267     oldsize = theCaloHits.size();
0268     theCaloComposition.push_back(label19);
0269   }
0270   if (CaloTkHits.isValid()) {
0271     theCaloHits.insert(theCaloHits.end(), CaloTkHits->begin(), CaloTkHits->end());
0272     std::pair<int, std::string> label20(theCaloHits.size() - oldsize, "CaloTkHits");
0273     oldsize = theCaloHits.size();
0274     theCaloComposition.push_back(label20);
0275   }
0276   if (ZDCHits.isValid()) {
0277     theCaloHits.insert(theCaloHits.end(), ZDCHits->begin(), ZDCHits->end());
0278     std::pair<int, std::string> label21(theCaloHits.size() - oldsize, "ZDCHITS");
0279     oldsize = theCaloHits.size();
0280     theCaloComposition.push_back(label21);
0281   }
0282   if (CastorTUHits.isValid()) {
0283     theCaloHits.insert(theCaloHits.end(), CastorTUHits->begin(), CastorTUHits->end());
0284     std::pair<int, std::string> label22(theCaloHits.size() - oldsize, "CastorTU");
0285     oldsize = theCaloHits.size();
0286     theCaloComposition.push_back(label22);
0287   }
0288   if (CastorPLHits.isValid()) {
0289     theCaloHits.insert(theCaloHits.end(), CastorPLHits->begin(), CastorPLHits->end());
0290     std::pair<int, std::string> label23(theCaloHits.size() - oldsize, "CastorPL");
0291     oldsize = theCaloHits.size();
0292     theCaloComposition.push_back(label23);
0293   }
0294   if (CastorFIHits.isValid()) {
0295     theCaloHits.insert(theCaloHits.end(), CastorFIHits->begin(), CastorFIHits->end());
0296     std::pair<int, std::string> label24(theCaloHits.size() - oldsize, "CastorFI");
0297     oldsize = theCaloHits.size();
0298     theCaloComposition.push_back(label24);
0299   }
0300   if (CastorBUHits.isValid()) {
0301     theCaloHits.insert(theCaloHits.end(), CastorBUHits->begin(), CastorBUHits->end());
0302     std::pair<int, std::string> label25(theCaloHits.size() - oldsize, "CastorBU");
0303     oldsize = theCaloHits.size();
0304     theCaloComposition.push_back(label25);
0305   }
0306 
0307   oldsize = 0;
0308   if (BTLHits.isValid()) {
0309     theMTDHits.insert(theMTDHits.end(), BTLHits->begin(), BTLHits->end());
0310     std::pair<int, std::string> label26(theMTDHits.size() - oldsize, "BTLHits");
0311     oldsize = theMTDHits.size();
0312     theMTDComposition.push_back(label26);
0313   }
0314   if (ETLHits.isValid()) {
0315     theMTDHits.insert(theMTDHits.end(), ETLHits->begin(), ETLHits->end());
0316     std::pair<int, std::string> label27(theMTDHits.size() - oldsize, "ETLHits");
0317     oldsize = theMTDHits.size();
0318     theMTDComposition.push_back(label27);
0319   }
0320 
0321   edm::LogPrint("SimHitCaloHitDumper") << "\n SimHit / CaloHit structure dump \n";
0322   edm::LogPrint("SimHitCaloHitDumper") << " Tracker Hits in the event = " << theTrackerHits.size();
0323   edm::LogPrint("SimHitCaloHitDumper") << "\n";
0324   //   for (std::vector<PSimHit>::iterator isim = theTrackerHits.begin();
0325   //      isim != theTrackerHits.end(); ++isim){
0326   //     edm::LogPrint("SimHitCaloHitDumper") << (*isim) << " Track Id = " << isim->trackId() ;
0327   //   }
0328   int nhit = 0;
0329   for (std::vector<std::pair<int, std::string> >::iterator icoll = theTrackerComposition.begin();
0330        icoll != theTrackerComposition.end();
0331        ++icoll) {
0332     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0333     edm::LogPrint("SimHitCaloHitDumper") << (*icoll).second << " hits in the event = " << (*icoll).first;
0334     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0335     for (int ihit = 0; ihit < (*icoll).first; ++ihit) {
0336       edm::LogPrint("SimHitCaloHitDumper") << theTrackerHits[nhit] << " Track Id = " << theTrackerHits[nhit].trackId();
0337       nhit++;
0338     }
0339   }
0340 
0341   edm::LogPrint("SimHitCaloHitDumper") << "\n Muon Hits in the event = " << theMuonHits.size();
0342   edm::LogPrint("SimHitCaloHitDumper") << "\n";
0343   //   for (std::vector<PSimHit>::iterator isim = theMuonHits.begin();
0344   //        isim != theMuonHits.end(); ++isim){
0345   //     edm::LogPrint("SimHitCaloHitDumper") << (*isim) << " Track Id = " << isim->trackId() ;
0346   //   }
0347   nhit = 0;
0348   for (std::vector<std::pair<int, std::string> >::iterator icoll = theMuonComposition.begin();
0349        icoll != theMuonComposition.end();
0350        ++icoll) {
0351     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0352     edm::LogPrint("SimHitCaloHitDumper") << (*icoll).second << " hits in the event = " << (*icoll).first;
0353     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0354     for (int ihit = 0; ihit < (*icoll).first; ++ihit) {
0355       edm::LogPrint("SimHitCaloHitDumper") << theMuonHits[nhit] << " Track Id = " << theMuonHits[nhit].trackId();
0356       nhit++;
0357     }
0358   }
0359 
0360   edm::LogPrint("SimHitCaloHitDumper") << "\n MTD Hits in the event = " << theMTDHits.size();
0361   edm::LogPrint("SimHitCaloHitDumper") << "\n";
0362   //   for (std::vector<PSimHit>::iterator isim = theMTDHits.begin();
0363   //        isim != theMTDHits.end(); ++isim){
0364   //     edm::LogPrint("SimHitCaloHitDumper") << (*isim) << " Track Id = " << isim->trackId() ;
0365   //   }
0366   nhit = 0;
0367   for (std::vector<std::pair<int, std::string> >::iterator icoll = theMTDComposition.begin();
0368        icoll != theMTDComposition.end();
0369        ++icoll) {
0370     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0371     edm::LogPrint("SimHitCaloHitDumper") << (*icoll).second << " hits in the event = " << (*icoll).first;
0372     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0373     for (int ihit = 0; ihit < (*icoll).first; ++ihit) {
0374       edm::LogPrint("SimHitCaloHitDumper") << theMTDHits[nhit] << " Track Id = " << theMTDHits[nhit].trackId();
0375       nhit++;
0376     }
0377   }
0378 
0379   edm::LogPrint("SimHitCaloHitDumper") << "\n Calorimeter Hits in the event = " << theCaloHits.size();
0380   edm::LogPrint("SimHitCaloHitDumper") << "\n";
0381   //   for (std::vector<PCaloHit>::iterator isim = theCaloHits.begin();
0382   //        isim != theCaloHits.end(); ++isim){
0383   //     edm::LogPrint("SimHitCaloHitDumper") << (*isim) ;
0384   //   }
0385   nhit = 0;
0386   for (std::vector<std::pair<int, std::string> >::iterator icoll = theCaloComposition.begin();
0387        icoll != theCaloComposition.end();
0388        ++icoll) {
0389     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0390     edm::LogPrint("SimHitCaloHitDumper") << (*icoll).second << " hits in the event = " << (*icoll).first;
0391     edm::LogPrint("SimHitCaloHitDumper") << "\n";
0392     for (int ihit = 0; ihit < (*icoll).first; ++ihit) {
0393       edm::LogPrint("SimHitCaloHitDumper") << theCaloHits[nhit];
0394       nhit++;
0395     }
0396   }
0397 
0398   return;
0399 }
0400 
0401 void SimHitCaloHitDumper::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0402   edm::ParameterSetDescription desc;
0403   desc.add<edm::InputTag>("TrackerHitsPixelBarrelLowTof", edm::InputTag("g4SimHits", "TrackerHitsPixelBarrelLowTof"));
0404   desc.add<edm::InputTag>("TrackerHitsPixelBarrelHighTof", edm::InputTag("g4SimHits", "TrackerHitsPixelBarrelHighTof"));
0405   desc.add<edm::InputTag>("TrackerHitsPixelEndcapLowTof", edm::InputTag("g4SimHits", "TrackerHitsPixelEndcapLowTof"));
0406   desc.add<edm::InputTag>("TrackerHitsPixelEndcapHighTof", edm::InputTag("g4SimHits", "TrackerHitsPixelEndcapHighTof"));
0407   desc.add<edm::InputTag>("TrackerHitsTIBLowTof", edm::InputTag("g4SimHits", "TrackerHitsTIBLowTof"));
0408   desc.add<edm::InputTag>("TrackerHitsTIBHighTof", edm::InputTag("g4SimHits", "TrackerHitsTIBHighTof"));
0409   desc.add<edm::InputTag>("TrackerHitsTIDLowTof", edm::InputTag("g4SimHits", "TrackerHitsTIDLowTof"));
0410   desc.add<edm::InputTag>("TrackerHitsTIDHighTof", edm::InputTag("g4SimHits", "TrackerHitsTIDHighTof"));
0411   desc.add<edm::InputTag>("TrackerHitsTOBLowTof", edm::InputTag("g4SimHits", "TrackerHitsTOBLowTof"));
0412   desc.add<edm::InputTag>("TrackerHitsTOBHighTof", edm::InputTag("g4SimHits", "TrackerHitsTOBHighTof"));
0413   desc.add<edm::InputTag>("TrackerHitsTECLowTof", edm::InputTag("g4SimHits", "TrackerHitsTECLowTof"));
0414   desc.add<edm::InputTag>("TrackerHitsTECHighTof", edm::InputTag("g4SimHits", "TrackerHitsTECHighTof"));
0415   desc.add<edm::InputTag>("MuonDTHits", edm::InputTag("g4SimHits", "MuonDTHits"));
0416   desc.add<edm::InputTag>("MuonCSCHits", edm::InputTag("g4SimHits", "MuonCSCHits"));
0417   desc.add<edm::InputTag>("MuonRPCHits", edm::InputTag("g4SimHits", "MuonRPCHits"));
0418   desc.add<edm::InputTag>("FastTimerHitsBarrel", edm::InputTag("g4SimHits", "FastTimerHitsBarrel"));
0419   desc.add<edm::InputTag>("FastTimerHitsEndcap", edm::InputTag("g4SimHits", "FastTimerHitsEndcap"));
0420   desc.add<edm::InputTag>("EcalHitsEB", edm::InputTag("g4SimHits", "EcalHitsEB"));
0421   desc.add<edm::InputTag>("EcalHitsEE", edm::InputTag("g4SimHits", "EcalHitsEE"));
0422   desc.add<edm::InputTag>("EcalHitsES", edm::InputTag("g4SimHits", "EcalHitsES"));
0423   desc.add<edm::InputTag>("HcalHits", edm::InputTag("g4SimHits", "HcalHits"));
0424   desc.add<edm::InputTag>("CaloHitsTk", edm::InputTag("g4SimHits", "CaloHitsTk"));
0425   desc.add<edm::InputTag>("ZDCHITS", edm::InputTag("g4SimHits", "ZDCHITS"));
0426   desc.add<edm::InputTag>("CastorTU", edm::InputTag("g4SimHits", "CastorTU"));
0427   desc.add<edm::InputTag>("CastorPL", edm::InputTag("g4SimHits", "CastorPL"));
0428   desc.add<edm::InputTag>("CastorFI", edm::InputTag("g4SimHits", "CastorFI"));
0429   desc.add<edm::InputTag>("CastorBU", edm::InputTag("g4SimHits", "CastorBU"));
0430   descriptions.add("simHitCaloHitDumper", desc);
0431 }
0432 
0433 #include "FWCore/Framework/interface/MakerMacros.h"
0434 
0435 //define this as a plug-in
0436 DEFINE_FWK_MODULE(SimHitCaloHitDumper);