CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/SimRomanPot/SimFP420/plugins/DigitizerFP420.cc

Go to the documentation of this file.
00001 
00002 // File: DigitizerFP420.cc
00003 // Date: 12.2006
00004 // Description: DigitizerFP420 for FP420
00005 // Modifications: 
00007 //
00008 // system include files
00009 #include <memory>
00010 
00011 #include "DataFormats/Common/interface/DetSetVector.h"
00012 //#include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00013 //#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
00014 //#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h"
00015 
00016 // user include files
00017 #include "FWCore/Framework/interface/Frameworkfwd.h"
00018 #include "FWCore/Framework/interface/EDProducer.h"
00019 
00020 #include "FWCore/Framework/interface/Event.h"
00021 #include "FWCore/Framework/interface/MakerMacros.h"
00022 
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00025 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
00026 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
00027 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
00029 #include "SimRomanPot/SimFP420/interface/DigitizerFP420.h"
00030 
00031 //#include "SimRomanPot/SimFP420/interface/SimRPUtil.h"
00032 //#include "SimG4CMS/FP420/interface/FP420NumberingScheme.h"
00033 
00034 #include "DataFormats/FP420Digi/interface/DigiCollectionFP420.h"
00035 #include "DataFormats/FP420Digi/interface/HDigiFP420.h"
00036 //#include "SimRomanPot/SimFP420/interface/DigiCollectionFP420.h"
00037 //#include "SimG4CMS/FP420/interface/FP420G4HitCollection.h"
00038 //#include "SimG4CMS/FP420/interface/FP420G4Hit.h"
00039 
00040 //needed for the geometry:
00041 #include "FWCore/Framework/interface/EventSetup.h"
00042 #include "FWCore/Framework/interface/ESHandle.h"
00043 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00044 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00045 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00046 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
00047 //#include "Geometry/CommonTopologies/interface/StripTopology.h"
00048 //#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
00049 //#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00050 //needed for the magnetic field:
00051 //#include "MagneticField/Engine/interface/MagneticField.h"
00052 //#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00053 //#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00054 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
00055 
00056 //Data Base infromations
00057 //#include "CondFormats/DataRecord/interface/SiStripLorentzAngleRcd.h"
00058 //#include "CalibTracker/Records/interface/SiStripGainRcd.h"
00059 //#include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
00060 //#include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h"
00061 //#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
00062 //#include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00063 //#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
00064 //#include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
00065 //#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
00066 //#include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
00067 
00068 //Random Number
00069 #include "FWCore/ServiceRegistry/interface/Service.h"
00070 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00071 #include "FWCore/Utilities/interface/Exception.h"
00072 #include "CLHEP/Random/RandomEngine.h"
00073 
00074 // G4 stuff
00075 #include "G4SDManager.hh"
00076 #include "G4Step.hh"
00077 #include "G4Track.hh"
00078 #include "G4VProcess.hh"
00079 #include "G4HCofThisEvent.hh"
00080 #include "G4UserEventAction.hh"
00081 #include "G4TransportationManager.hh"
00082 #include "G4ProcessManager.hh"
00083 
00084 #include <cstdlib> 
00085 #include <vector>
00086 
00087 using namespace std;
00088 
00089 //#include <iostream>
00090 
00091 
00092 
00093 
00094 namespace cms
00095 {
00096   DigitizerFP420::DigitizerFP420(const edm::ParameterSet& conf):conf_(conf),stripDigitizer_(new FP420DigiMain(conf)) {
00097     
00098     
00099     std::string alias ( conf.getParameter<std::string>("@module_label") );
00100     
00101     //  produces<edm::DetSetVector<HDigiFP420> >().setBranchAlias( alias );
00102     //  produces<edm::DetSetVector<HDigiFP420SimLink> >().setBranchAlias ( alias + "hDigiFP420SimLink");
00103     produces<DigiCollectionFP420>().setBranchAlias( alias );
00104     
00105     trackerContainers.clear();
00106     trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList");
00107     
00108     verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
00109     dn0   = conf_.getParameter<int>("NumberFP420Detectors");
00110     sn0   = conf_.getParameter<int>("NumberFP420Stations");
00111     pn0 = conf_.getParameter<int>("NumberFP420SPlanes");
00112       rn0 = 7;
00113     //rn0 = 3;
00114       theFP420NumberingScheme = new FP420NumberingScheme();
00115     
00116     //  produces<DigiCollectionFP420>();
00117     
00118     //  produces<StripDigiCollection>();
00119     //   produces<HDigiFP420>();
00120     //  produces<edm::DetSetVector<HDigiFP420> >().setBranchAlias( alias );  
00121     
00122     //  produces<DigiCollectionFP420>();
00123     // produces<DigiCollectionFP420>("HDigiFP420");
00124     
00125     //  produces<edm::DigiCollectionFP420>();
00126     
00127     //   produces<edm::DetSetVector<DigiCollectionFP420> >();
00128     
00129     if(verbosity>0) {
00130       std::cout << "Creating a DigitizerFP420" << std::endl;
00131       std::cout << "DigitizerFP420: dn0=" << dn0 << " sn0=" << sn0 << " pn0=" << pn0 <<  " rn0=" << rn0 << std::endl;
00132       std::cout << "DigitizerFP420:trackerContainers.size()=" << trackerContainers.size() << std::endl;
00133       
00134     }
00135   }
00136   
00137   // Virtual destructor needed.
00138   DigitizerFP420::~DigitizerFP420() { 
00139     if(verbosity>0) {
00140       std::cout << "Destroying a DigitizerFP420" << std::endl;
00141     }
00142     delete stripDigitizer_;
00143     
00144   }  
00145   
00146   
00147   
00148   //  void DigitizerFP420::produce(PSimHitCollection *   theCAFI, DigiCollectionFP420 & output) {
00149   void DigitizerFP420::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)  {
00150     // be lazy and include the appropriate namespaces
00151     using namespace edm; 
00152     using namespace std;   
00153     
00154     if(verbosity>0) {
00155       std::cout <<" ===" << std::endl;
00156       std::cout <<" ============== DigitizerFP420: start   produce= " << std::endl;
00157       std::cout <<" ===" << std::endl;
00158     }
00159     // Get input
00160     //    std::cout << "DigitizerFP420 start produce" << std::endl;
00161     //  edm::ESHandle < ParticleDataTable > pdt;
00162     //  iSetup.getData( pdt );
00163     
00164     // Step A: Get Inputs for allTrackerHits
00165     
00166     
00167     edm::Handle<CrossingFrame<PSimHit> > cf_simhit;
00168     std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec;
00169     for(uint32_t i = 0; i< trackerContainers.size();i++){
00170       iEvent.getByLabel("mix",trackerContainers[i],cf_simhit);
00171       cf_simhitvec.push_back(cf_simhit.product());   }
00172     std::auto_ptr<MixCollection<PSimHit> > allTrackerHits(new MixCollection<PSimHit>(cf_simhitvec));
00173     
00174     // use instead of the previous
00175     /*    
00176           std::cout <<" ============== DigitizerFP420: start loop           1   " << std::endl;
00177           edm::Handle<CrossingFrame<PSimHit> > xFrame;
00178           std::cout <<" ============== DigitizerFP420: start loop           2   " << std::endl;
00179           iEvent.getByLabel("mix","FP420SI",xFrame);
00180           std::cout <<" ============== DigitizerFP420: start loop           3   " << std::endl;
00181           std::auto_ptr<MixCollection<PSimHit> > allTrackerHits( new MixCollection<PSimHit>(xFrame.product()) );
00182           std::cout <<" ============== DigitizerFP420: start loop           4   " << std::endl;
00183     */
00184     
00185     // use instead of the previous
00186     /*           
00187                  edm::Handle<CrossingFrame<PSimHit> > crossingFrame;
00188                  const std::string FP420HitsName("FP420SI");
00189                  bool isHit = true;
00190                  iEvent.getByLabel("mix",FP420HitsName,crossingFrame);
00191                  MixCollection<PSimHit> * FP420Hits = 0 ;
00192                  std::cout <<" ============== DigitizerFP420: start loop           1   " << std::endl;
00193                  //    std::auto_ptr<MixCollection<PSimHit> > allTrackerHits(new MixCollection<PSimHit>(crossingFrame.product()));
00194                  FP420Hits = new MixCollection<PSimHit>(crossingFrame.product());
00195                  std::cout <<" ============== DigitizerFP420: start loop           2   " << std::endl;
00196                  //  if ( ! FP420Hits->inRegistry()  ) isHit = false;
00197                  //  if ( isHit ) {
00198                  std::auto_ptr<MixCollection<PSimHit> >  allTrackerHits( FP420Hits );
00199                  std::cout <<" ============== DigitizerFP420: start loop           3   " << std::endl;
00200                  //  }  
00201                  */
00202     
00203     //    std::cout << "DigitizerFP420 Step A done" << std::endl;
00204     
00205     //Loop on PSimHit
00206     
00207     
00209       // Step C: create empty output collection
00210       std::auto_ptr<DigiCollectionFP420> output(new DigiCollectionFP420);
00211       //  std::auto_ptr<edm::DetSetVector<HDigiFP420> > outputfinal(new edm::DetSetVector<HDigiFP420>(output) );
00212       //  std::auto_ptr<edm::DetSetVector<HDigiFP420> > outputfinal(new edm::DetSetVector<HDigiFP420>(output) );
00213       //  std::auto_ptr<edm::DetSetVector<HDigiFP420SimLink> > outputlink(new edm::DetSetVector<HDigiFP420SimLink>(output) );
00214       
00215       SimHitMap.clear();
00216       
00217       // ==================================
00218       if(verbosity>0) {
00219         std::cout <<" ===" << std::endl;
00220         std::cout <<" ============== DigitizerFP420: MixCollection treatment= " << std::endl;
00221         std::cout <<" ===" << std::endl;
00222       }
00223       
00224       MixCollection<PSimHit>::iterator isim;
00225       for (isim=allTrackerHits->begin(); isim!= allTrackerHits->end();isim++) {
00226         unsigned int unitID = (*isim).detUnitId();
00227         int det, zside, sector, zmodule; 
00228         FP420NumberingScheme::unpackFP420Index(unitID, det, zside, sector, zmodule);
00229         // below, the continues plane index should be (for even different sensor index zside)
00230         //      unsigned int intindex = packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
00231         unsigned int intindex = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
00232         //      int zScale=(rn0-1), sScale = (rn0-1)*(pn0-1), dScale = (rn0-1)*(pn0-1)*(sn0-1);
00233         //      unsigned int intindex = dScale*(det - 1)+sScale*(sector - 1)+zScale*(zmodule - 1)+zside;
00234 
00235         if(verbosity>0) {
00236           double  losenergy = (*isim).energyLoss();
00237           std::cout <<" ===" << std::endl;
00238           std::cout <<" ============== DigitizerFP420:  losenergy= " << losenergy << std::endl;
00239           std::cout <<" === for intindex = " << intindex << std::endl;
00240         }
00241         // does not matter which index is used: intindex or unitID - mainly to collect hits under every index   
00242         SimHitMap[intindex].push_back((*isim));
00243         // for development later one( cal be used another index):
00244         //      SimHitMap[unitID].push_back((*isim));
00245       }
00246       //============================================================================================================================
00247       
00248       if(verbosity>0) {
00249         std::cout <<" ===" << std::endl;
00250         std::cout <<" ============== DigitizerFP420: put zero to container " << std::endl;
00251         std::cout <<" ===" << std::endl;
00252       }
00253       //    put zero to container info from the beginning (important! because not any detID is updated with coming of new event     !!!!!!   
00254       // clean info of container from previous event
00255       for (int det=1; det<dn0; det++) {
00256         for (int sector=1; sector<sn0; sector++) {
00257           for (int zmodule=1; zmodule<pn0; zmodule++) {
00258             for (int zside=1; zside<rn0; zside++) {
00259               // intindex is a continues numbering of FP420
00260               unsigned int detID = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
00261               // int zScale=(rn0-1), sScale = (rn0-1)*(pn0-1), dScale = (rn0-1)*(pn0-1)*(sn0-1);
00262               // unsigned int detID = dScale*(det - 1)+sScale*(sector - 1)+zScale*(zmodule - 1)+zside;
00263               std::vector<HDigiFP420> collector;
00264               collector.clear();
00265               DigiCollectionFP420::Range inputRange;
00266               inputRange.first = collector.begin();
00267               inputRange.second = collector.end();
00268               output->putclear(inputRange,detID);
00269             }//for
00270           }//for
00271         }//for
00272       }//for
00273       //                                                                                                                      !!!!!!   
00274       // if we want to keep Digi container/Collection for one event uncomment the line below and vice versa
00275       output->clear();   //container_.clear() --> start from the beginning of the container
00276       
00277       //============================================================================================================================================
00278       
00279       
00280       if(verbosity>0) {
00281         std::cout <<" ===" << std::endl;
00282         std::cout <<" ============== DigitizerFP420: start loop over det iu " << std::endl;
00283         std::cout <<" ============== DigitizerFP420: SimHitMap.size()= " << SimHitMap.size() << std::endl;
00284         std::cout <<" ===" << std::endl;
00285       }
00286       bool first = true;
00287 
00289       /*      
00290       if(verbosity>0) std::cout <<"=======  DigitizerFP420:  SimHitMap size = " << SimHitMap.size() << std::endl;
00291       for(unsigned int i = 0; i < SimHitMap.size(); i++ ) {
00292         //        std::cout <<" ====== DigitizerFP420:                                                      i= " << i << std::endl;
00293         vector<PSimHit>::const_iterator simHitIter = SimHitMap[i].begin();
00294         vector<PSimHit>::const_iterator simHitIterEnd = SimHitMap[i].end();
00295         for (;simHitIter != simHitIterEnd; ++simHitIter) {
00296           const PSimHit ihit = *simHitIter;
00297           unsigned int unitID = ihit.detUnitId();
00298           if(verbosity>0) std::cout <<" ====== DigitizerFP420: unitID= " << unitID << " i=  " << i << std::endl;
00299           int det, zside, sector, zmodule; 
00300           FP420NumberingScheme::unpackFP420Index(unitID, det, zside, sector, zmodule);
00301           int zScale=(rn0-1), sScale = (rn0-1)*(pn0-1), dScale = (rn0-1)*(pn0-1)*(sn0-1);
00302           unsigned int iu = dScale*(det - 1)+sScale*(sector - 1)+zScale*(zmodule - 1)+zside;
00303         }
00304       }
00305 */
00307       //============================================================================================================================================
00308       // new:   <------
00309       for(unsigned int i = 0; i < SimHitMap.size(); i++ ) {
00310         vector<PSimHit>::const_iterator simHitIter = SimHitMap[i].begin();
00311         vector<PSimHit>::const_iterator simHitIterEnd = SimHitMap[i].end();
00312         for (;simHitIter != simHitIterEnd; ++simHitIter) {
00313           const PSimHit ihit = *simHitIter;
00314           unsigned int unitID = ihit.detUnitId();
00315           if(verbosity>0 || verbosity==-50) std::cout <<" ====== DigitizerFP420: unitID= " << unitID << "Hit number i=  " << i << std::endl;
00316           int det, zside, sector, zmodule; 
00317           FP420NumberingScheme::unpackFP420Index(unitID, det, zside, sector, zmodule);
00318           // <------
00319           // old: <------
00320           //     for (int det=1; det<dn0; det++) {
00321           //    for (int sector=1; sector<sn0; sector++) {
00322           // for (int zmodule=1; zmodule<pn0; zmodule++) {
00323           //  for (int zside=1; zside<rn0; zside++) {
00324           // <------
00325           
00326           
00327           
00328           
00329           
00330           unsigned int iu = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
00331           if(verbosity>0 || verbosity==-50) std::cout <<"for Hits iu = " << iu <<" sector = " << sector <<" zmodule = " << zmodule <<" zside = " << zside << "  det=" << det << std::endl;
00332           //   int zScale=(rn0-1), sScale = (rn0-1)*(pn0-1), dScale = (rn0-1)*(pn0-1)*(sn0-1);
00333           //  unsigned int iu = dScale*(det - 1)+sScale*(sector - 1)+zScale*(zmodule - 1)+zside;
00334 
00335           if(verbosity>0) {
00336             unsigned int index = theFP420NumberingScheme->FP420NumberingScheme::packFP420Index(det, zside, sector, zmodule);
00337             std::cout << " DigitizerFP420:       index = " <<  index <<  " iu = " << iu  << std::endl;
00338           }
00339           
00340           //    GlobalVector bfield=pSetup->inTesla((*iu)->surface().position());
00341           //      CLHEP::Hep3Vector Bfieldloc=bfield();
00342           G4ThreeVector bfield(  0.,  0.,  0.0  );
00343           //    G4ThreeVector bfield(  0.5,  0.5,  1.0  );
00344           
00345           
00346           if(verbosity>0) {
00347             std::cout <<" ===" << std::endl;
00348             std::cout <<" ============== DigitizerFP420:  call run for iu= " << iu << std::endl;
00349             std::cout <<" ===" << std::endl;
00350           }
00351           collector.clear();
00352           
00353           collector= stripDigitizer_->run( SimHitMap[iu],
00354                                            bfield,
00355                                            iu
00356                                            ); // stripDigitizer_.run...  return 
00357           //                                             ,sScale
00358           
00359           
00360           
00361           if(verbosity>0) {
00362             std::cout <<" ===" << std::endl;
00363             std::cout <<" ===" << std::endl;
00364             std::cout <<"=======  DigitizerFP420:  collector size = " << collector.size() << std::endl;
00365             std::cout <<" ===" << std::endl;
00366             std::cout <<" ===" << std::endl;
00367           }           
00368           /*            
00369             
00370           std::vector<HDigiFP420> collector;
00371           collector.clear();
00372           DigiCollectionFP420::Range inputRange;
00373           inputRange.first = collector.begin();
00374           inputRange.second = collector.end();
00375           output->putclear(inputRange,detID);
00376           */
00377           if (collector.size()>0){
00378             if(verbosity>0) {
00379               std::cout <<"         ============= DigitizerFP420:collector start!!!!!!!!!!!!!!" << std::endl;
00380             }
00381             DigiCollectionFP420::Range outputRange;
00382             outputRange.first = collector.begin();
00383             outputRange.second = collector.end();
00384             
00385             if ( first ) {
00386               // use it only if ClusterCollectionFP420 is the ClusterCollection of one event, otherwise, do not use (loose 1st cl. of 1st event only)
00387               first = false;
00388               unsigned int  detID0= 0;
00389               output->put(outputRange,detID0); // !!! put into adress 0 for detID which will not be used never
00390             } //if ( first ) 
00391             
00392             // put !!!
00393             output->put(outputRange,iu);
00394             
00395           } // if(collector.size()>0
00396           
00397           //   }   // for
00398           // }   // for
00399           //    }   // for
00400           // }   // for
00401           
00402         }//for
00403       }//for
00404       
00405       // END
00406       
00407       /*      
00408       if(verbosity>0) {
00409         std::vector<HDigiFP420> theAllDigis;
00410         theAllDigis.clear();
00411         DigiCollectionFP420::Range outputRange;
00412         DigiCollectionFP420::ContainerIterator sort_begin = outputRange.first;
00413         DigiCollectionFP420::ContainerIterator sort_end = outputRange.second;
00414         theAllDigis.insert(theAllDigis.end(), sort_begin, sort_end);
00415         std::cout <<"======  theAllDigis size = " << theAllDigis.size() << std::endl;
00416         for (std::vector<HDigiFP420>::iterator isim = theAllDigis.begin();
00417              isim != theAllDigis.end(); ++isim){
00418           const HDigiFP420 istrip = *isim;
00419           std::cout << "*******************************************DigitizerFP420:check1" << std::endl;
00420           std::cout << " strip number=" << istrip.strip() << "  adc=" << istrip.adc() << std::endl;
00421           std::cout <<" channel =" << istrip.channel() <<" V " << istrip.stripV() <<" VW " << istrip.stripVW() << std::endl;
00422           std::cout <<" ===" << std::endl;
00423           std::cout <<" ===" << std::endl;
00424           std::cout <<" =======================" << std::endl;
00425         }// for
00426       }
00427 */
00428       if(verbosity==-50) {
00429         //     check of access to the collector:
00430         for (int det=1; det<dn0; det++) {
00431           for (int sector=1; sector<sn0; sector++) {
00432             for (int zmodule=1; zmodule<pn0; zmodule++) {
00433               for (int zside=1; zside<rn0; zside++) {
00434                 unsigned int iu = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
00435                 int layer = theFP420NumberingScheme->FP420NumberingScheme::unpackLayerIndex(rn0,zside);
00436                 int orient = theFP420NumberingScheme->FP420NumberingScheme::unpackOrientation(rn0,zside);
00437                 std::cout << "****DigitizerFP420:check2" << std::endl;
00438                 //      std::cout <<" iu = " << iu <<" sector = " << sector <<" zmodule = " << zmodule <<" zside = " << zside << "  det=" << det << std::endl;
00439                 //      std::cout <<" layer = " << layer <<" orient = " << orient << std::endl;
00440                 int newdet, newzside, newsector, newzmodule;
00441                 theFP420NumberingScheme->FP420NumberingScheme::unpackMYIndex(iu, rn0, pn0, sn0, newdet, newzside, newsector, newzmodule);
00442                 std::cout <<" newdet = " << newdet <<" newsector = " << newsector <<" newzmodule = " << newzmodule <<" newzside = " << newzside << std::endl;
00443                 
00444                 collector.clear();
00445                 DigiCollectionFP420::Range outputRange;
00446                 //      outputRange = output->get(iu);
00447                 outputRange = output->get(iu);
00448                 
00449                 // fill output in collector vector (for may be sorting? or other checks)
00450                 std::vector<HDigiFP420> collector;
00451                 //  collector.clear();
00452                 DigiCollectionFP420::ContainerIterator sort_begin = outputRange.first;
00453                 DigiCollectionFP420::ContainerIterator sort_end = outputRange.second;
00454                 for ( ;sort_begin != sort_end; ++sort_begin ) {
00455                   collector.push_back(*sort_begin);
00456                 } // for
00457                   //  std::sort(collector.begin(),collector.end());
00458                 std::cout <<" ===" << std::endl;
00459                 std::cout <<"======  collector size = " << collector.size() << std::endl;
00460                 if(collector.size()>0) {
00461                   std::cout <<" iu = " << iu <<" sector = " << sector <<" zmodule = " << zmodule <<" zside = " << zside << "  det=" << det <<" layer = " << layer <<" orient = " << orient << std::endl;
00462                   std::cout <<" ===" << std::endl;
00463                 }
00464                 vector<HDigiFP420>::const_iterator simHitIter = collector.begin();
00465                 vector<HDigiFP420>::const_iterator simHitIterEnd = collector.end();
00466                 for (;simHitIter != simHitIterEnd; ++simHitIter) {
00467                   const HDigiFP420 istrip = *simHitIter;
00468                   std::cout << " strip number=" << istrip.strip() << "  adc=" << istrip.adc() << std::endl;
00469                   std::cout <<" channel =" << istrip.channel() <<" V " << istrip.stripV() <<" VW " << istrip.stripVW() << std::endl;
00470                   std::cout <<" ===" << std::endl;
00471                   std::cout <<" ===" << std::endl;
00472                   std::cout <<" ===================================================" << std::endl;
00473                 }
00474                 
00475                 //==================================
00476                 
00477               }   // for
00478             }   // for
00479           }   // for
00480         }   // for
00481         
00482         //     end of check of access to the strip collection
00483         
00484       }// if(verbosity  
00485       //     
00486       
00487       
00488       // Step D: write output to file
00489       //    iEvent.put(output);
00490       
00491       if(verbosity>0) {
00492         std::cout << "DigitizerFP420 recoutput" << std::endl;
00493       }
00494       // Step D: write output to file
00495       iEvent.put(output);
00496       // iEvent.put(outputlink);
00497       //          iEvent.put(pDigis);
00498       
00499       // Step D: write output to file 
00500       //  iEvent.put(output);
00501       //  iEvent.put(outputlink);
00502       //-------------------------------------------------------------------
00503       //    std::cout << "DigitizerFP420 recoutput" << std::endl;
00504       //          iEvent.put(pDigis);
00505       
00506       
00507       
00508       
00509   }//produce
00510   
00511 } // namespace cms
00512 
00513 //}
00514 //define this as a plug-in
00515 
00516 //DEFINE_FWK_MODULE(DigitizerFP420);