Page MenuHomeHEPForge

Frog_Analyzer.cc
No OneTemporary

Frog_Analyzer.cc

// -*- C++ -*-
//
// Package: Frog_Analyzer
// Class: Frog_Analyzer
//
/**\class Frog_Analyzer Frog_Analyzer.cc Visualisation/Frog/src/Frog_Analyzer.cc
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Loic QUERTENMONT
// Created: Fri Oct 26 07:22:12 CEST 2007
// $Id: Frog_Analyzer.cc,v 1.53 2009-03-11 15:19:27 querten Exp $
//
//
// system include files
#include <memory>
// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
#include "Geometry/CommonTopologies/interface/PixelTopology.h"
#include "Geometry/CommonTopologies/interface/StripTopology.h"
#include "Geometry/TrackerTopology/interface/RectangularPixelTopology.h"
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetType.h"
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
#include "DataFormats/GeometrySurface/interface/BoundSurface.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
//#include "Geometry/EcalBarrelAlgo/interface/EcalBarrelGeometry.h"
//#include "Geometry/EcalEndcapAlgo/interface/EcalEndcapGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
#include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/Common/interface/DetSetVectorNew.h"
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
#include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
#include "SimDataFormats/TrackingHit/interface/PSimHit.h"
#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
#include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
#include "SimDataFormats/CaloHit/interface/PCaloHit.h"
#include "SimDataFormats/Track/interface/SimTrack.h"
#include "SimDataFormats/Vertex/interface/SimVertex.h"
#include "DataFormats/Provenance/interface/BranchDescription.h"
#include "DataFormats/Provenance/interface/Provenance.h"
#include "DataFormats/Candidate/interface/Candidate.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "TrackingTools/PatternTools/interface/Trajectory.h"
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
#include "DataFormats/TrackReco/interface/DeDxData.h"
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
#include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
#include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
#include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
#include "DataFormats/Math/interface/Point3D.h"
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
#include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
#include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
#include "DataFormats/SiStripDetId/interface/TECDetId.h"
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/ESDetId.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/VertexReco/interface/NuclearInteraction.h"
#include "DataFormats/JetReco/interface/Jet.h"
#include "DataFormats/JetReco/interface/BasicJetCollection.h"
#include "DataFormats/JetReco/interface/GenJetCollection.h"
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
#include "DataFormats/JetReco/interface/PFJetCollection.h"
#include "DataFormats/METReco/interface/GenMET.h"
#include "DataFormats/METReco/interface/GenMETCollection.h"
#include "DataFormats/METReco/interface/CaloMET.h"
#include "DataFormats/METReco/interface/CaloMETCollection.h"
#define FROG_ZLIB
//#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Base_With_DetId_And_Name.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Event_Track.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_DetId.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_ReadCards.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Coord.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Coord.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_ZLib.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_ZLib.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Path.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Path.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Net_Tools.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Net_Tools.cpp"
#include "Visualisation/Frog/soft/Includes/FROG/FROG.h"
#include "Visualisation/Frog/soft/Includes/FROG/FROG.cpp"
using namespace edm;
using namespace std;
using namespace reco;
//
// class decleration
//
class Frog_Analyzer : public edm::EDAnalyzer {
public:
explicit Frog_Analyzer(const edm::ParameterSet&);
~Frog_Analyzer();
private:
virtual void beginJob(const edm::EventSetup& iSetup);
virtual void analyze (const edm::Event&, const edm::EventSetup&);
virtual void endJob ();
FROG_Events* events;
std::string OutputFile;
std::vector<string> GenParticlesProducers;
std::vector<string> GenJetsProducers;
std::vector<string> GenMETProducers;
std::vector<string> SimTrackProducers;
std::vector<string> SimVertexProducers;
std::vector<string> SimHitProducers;
std::vector<string> SimCaloHitProducers;
std::vector<string> NIProducers;
std::vector<string> TrackProducers;
std::vector<string> TrajectoryProducers;
std::vector<string> dEdXProducers;
std::vector<string> SiStripClusterProducers;
std::vector<string> SiPixelClusterProducers;
std::vector<string> EcalRecHitProducers;
std::vector<string> HcalHBHERecHitProducers;
std::vector<string> HcalHORecHitProducers;
std::vector<string> HcalHFRecHitProducers;
std::vector<string> DTSegmentProducers;
std::vector<string> CSCSegmentProducers;
std::vector<string> RPCHitsProducers;
std::vector<string> CaloTowersProducers;
bool CaloTowersProducersBasedOnCaloHits;
std::vector<string> BasicJetsProducers;
std::vector<string> CaloJetsProducers;
bool CaloJetsProducersBasedOnCaloTowers;
std::vector<string> RecoCandidateProducers;
std::vector<string> CaloMETProducers;
// ----------member data ---------------------------
bool CompressFiles;
bool AddRunInfoInName;
bool FixedOutputName;
bool ProduceGeom;
int NEventsInVisFile;
int NEvents;
unsigned int FileIndex;
unsigned int SRun;
unsigned int SEvent;
bool WarningOnMissingProduct;
edm::ESHandle<TrackerGeometry> tkGeom;
edm::ESHandle<DTGeometry> DtGeom;
edm::ESHandle<CSCGeometry> CscGeom;
edm::ESHandle<RPCGeometry> RpcGeom;
edm::ESHandle<CaloGeometry> CaloGeom;
};
//
// constructors and destructor
//
Frog_Analyzer::Frog_Analyzer(const edm::ParameterSet& iConfig)
{
OutputFile = iConfig.getParameter<std::string >("OutputFile");
GenParticlesProducers = iConfig.getParameter<std::vector<string> >("GenParticlesProducers");
GenJetsProducers = iConfig.getParameter<std::vector<string> >("GenJetsProducers");
GenMETProducers = iConfig.getParameter<std::vector<string> >("GenMETProducers");
SimTrackProducers = iConfig.getParameter<std::vector<string> >("SimTrackProducers");
SimVertexProducers = iConfig.getParameter<std::vector<string> >("SimVertexProducers");
SimHitProducers = iConfig.getParameter<std::vector<string> >("SimHitProducers");
SimCaloHitProducers = iConfig.getParameter<std::vector<string> >("SimCaloHitProducers");
TrackProducers = iConfig.getParameter<std::vector<string> >("TrackProducers");
TrajectoryProducers = iConfig.getParameter<std::vector<string> >("TrajectoryProducers");
dEdXProducers = iConfig.getParameter<std::vector<string> >("dEdXProducers");
SiStripClusterProducers = iConfig.getParameter<std::vector<string> >("SiStripClusterProducers");
SiPixelClusterProducers = iConfig.getParameter<std::vector<string> >("SiPixelClusterProducers");
EcalRecHitProducers = iConfig.getParameter<std::vector<string> >("EcalRecHitProducers");
HcalHBHERecHitProducers = iConfig.getParameter<std::vector<string> >("HcalHBHERecHitProducers");
HcalHORecHitProducers = iConfig.getParameter<std::vector<string> >("HcalHORecHitProducers");
HcalHFRecHitProducers = iConfig.getParameter<std::vector<string> >("HcalHFRecHitProducers");
NIProducers = iConfig.getParameter<std::vector<string> >("NIProducers");
DTSegmentProducers = iConfig.getParameter<std::vector<string> >("DTSegmentProducers");
CSCSegmentProducers = iConfig.getParameter<std::vector<string> >("CSCSegmentProducers");
RPCHitsProducers = iConfig.getParameter<std::vector<string> >("RPCHitsProducers");
CaloTowersProducers = iConfig.getParameter<std::vector<string> >("CaloTowersProducers");
CaloTowersProducersBasedOnCaloHits = iConfig.getParameter<bool>("CaloTowersProducersBasedOnCaloHits");
BasicJetsProducers = iConfig.getParameter<std::vector<string> >("BasicJetsProducers");
CaloJetsProducers = iConfig.getParameter<std::vector<string> >("CaloJetsProducers");
CaloJetsProducersBasedOnCaloTowers = iConfig.getParameter<bool>("CaloJetsProducersBasedOnCaloTowers");
RecoCandidateProducers = iConfig.getParameter<std::vector<string> >("RecoCandidateProducers");
CaloMETProducers = iConfig.getParameter<std::vector<string> >("CaloMETProducers");
ProduceGeom = iConfig.getParameter<bool >("ProduceGeom" );
NEventsInVisFile = iConfig.getParameter<int >("NEventsInVisFile" );
CompressFiles = iConfig.getParameter<bool >("CompressFiles" );
AddRunInfoInName = iConfig.getParameter<bool >("AddRunInfoInName" );
FixedOutputName = iConfig.getParameter<bool >("FixedOutputName" );
WarningOnMissingProduct = iConfig.getParameter<bool >("WarningOnMissingProduct" );
NEvents = 0;
FileIndex = 0;
}
Frog_Analyzer::~Frog_Analyzer()
{
}
// ------------ method called once each job just before starting event loop ------------
void
Frog_Analyzer::beginJob(const edm::EventSetup& iSetup)
{
// Load the Geometry needed to store FROG Geom AND to save FROG Events
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
iSetup.get<MuonGeometryRecord>().get( DtGeom );
iSetup.get<MuonGeometryRecord>().get( CscGeom );
iSetup.get<MuonGeometryRecord>().get( RpcGeom );
iSetup.get<CaloGeometryRecord>().get( CaloGeom );
if(ProduceGeom){
DetId Detid;
unsigned int SubDet;
unsigned int Frog_DetId;
FROG_Element_Base* FEB = NULL;
FROG_Element_Base_With_DetId_And_Name* FEB_Temp = NULL;
FROG_Element_Base* prim = new FROG_Element_Base(C_PRIMARY);
FROG_Element_Base* geom = new FROG_Element_Base(C_GEOMETRY); prim->addDaughter(geom);
FROG_Element_Base_With_DetId_And_Name* tracker = new FROG_Element_Base_With_DetId_And_Name( DETID_TRK , "Tracker"); geom->addDaughter(tracker);
FROG_Element_Base_With_DetId_And_Name* muon = new FROG_Element_Base_With_DetId_And_Name( DETID_MUON , "Muon"); geom->addDaughter(muon);
FROG_Element_Base_With_DetId_And_Name* ecal = new FROG_Element_Base_With_DetId_And_Name( DETID_ECAL , "ECAL"); geom->addDaughter(ecal);
FROG_Element_Base_With_DetId_And_Name* hcal = new FROG_Element_Base_With_DetId_And_Name( DETID_HCAL , "HCAL"); geom->addDaughter(hcal);
FROG_Element_Base_With_DetId_And_Name* calo = new FROG_Element_Base_With_DetId_And_Name( DETID_CALO , "Calo"); geom->addDaughter(calo);
// ### TRACKER GEOMETRY ###
vector<GeomDet*> TrackerDets = tkGeom->dets();
for(unsigned int i=0;i<TrackerDets.size();i++){
Detid = TrackerDets[i]->geographicalId();
SubDet = Detid.subdetId();
if(SubDet<1 || SubDet>6) continue;
GeomDet* DetUnit = TrackerDets[i];
if(!DetUnit)continue;
const BoundPlane plane = DetUnit->surface();
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
float width = 0;
float length = 0;
float thickness = 0;
float TrapezoidalParam = 0;
if(trapezoidalBounds){
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
width = parameters[0]*2;
length = parameters[3]*2;
thickness = (*trapezoidalBounds).thickness();
TrapezoidalParam = parameters[1]/parameters[0];
}else if(rectangularBounds){
width = DetUnit->surface().bounds().width();
length = DetUnit->surface().bounds().length();
thickness = DetUnit->surface().bounds().thickness();
TrapezoidalParam = 1;
}
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
Detid.rawId(), TrapezoidalParam,
Pos.x(), Pos.y(), Pos.z(),
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
Frog_DetId = DETID_TRK;
FEB = tracker;
Frog_DetId += SubDet*100000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
// if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId); FEB_Temp->addDaughter(FEB);}
if(SubDet==PixelSubdetector::PixelBarrel){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "PIB"); FEB_Temp->addDaughter(FEB);}
PXBDetId detid = PXBDetId(Detid);
Frog_DetId += detid.layer()*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Layer%i", detid.layer() ); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.ladder()*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ladder%i", detid.ladder() ); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==PixelSubdetector::PixelEndcap){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "PIE"); FEB_Temp->addDaughter(FEB);}
PXFDetId detid = PXFDetId(Detid);
Frog_DetId += detid.side()*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%i",detid.side()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.disk()*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Disk%i", detid.disk()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.blade()*10;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Blade%i", detid.blade()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.panel()*1;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Panel%i", detid.panel()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==StripSubdetector::TIB){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TIB"); FEB_Temp->addDaughter(FEB);}
TIBDetId detid = TIBDetId(Detid);
Frog_DetId += detid.layer()*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Layer%i", detid.layer()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.stringNumber()*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "String%i", detid.stringNumber()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==StripSubdetector::TID){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TID"); FEB_Temp->addDaughter(FEB);}
TIDDetId detid = TIDDetId(Detid);
Frog_DetId += detid.side()*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Slide%i", detid.side()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.wheel()*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Wheel%i", detid.wheel()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.ring()*10;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==StripSubdetector::TOB){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TOB"); FEB_Temp->addDaughter(FEB);}
TOBDetId detid = TOBDetId(Detid);
Frog_DetId += detid.layer()*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Layer%i", detid.layer()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.rodNumber()*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Rod%i", detid.rodNumber()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==StripSubdetector::TEC){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TEC"); FEB_Temp->addDaughter(FEB);}
TECDetId detid = TECDetId(Detid);
Frog_DetId += detid.side()*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%i",detid.side()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.wheel()*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Wheel%i", detid.wheel() ); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.ring()*10;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.petalNumber();
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Petal%i", detid.petalNumber()); FEB_Temp->addDaughter(FEB);}
}else{
if(mod)delete mod;
continue;
}
FEB->addDaughter(mod);
}
// ### MUON GEOMETRY ###
const vector<GeomDet*> DtDets = DtGeom ->dets();
const vector<GeomDet*> CscDets = CscGeom->dets();
const vector<GeomDet*> RpcDets = RpcGeom->dets();
vector<GeomDet*> MuonDets;
for(unsigned int i=0;i<DtDets.size() ;i++){MuonDets.push_back(DtDets [i]);}
for(unsigned int i=0;i<CscDets.size();i++){MuonDets.push_back(CscDets[i]);}
for(unsigned int i=0;i<RpcDets.size();i++){MuonDets.push_back(RpcDets[i]);}
for(unsigned int i=0;i<MuonDets.size();i++)
{
Detid = DetId(MuonDets[i]->geographicalId());
SubDet = Detid.subdetId();
GeomDet* DetUnit = MuonDets[i];
if(!DetUnit)continue;
const BoundPlane plane = DetUnit->surface();
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
float width = 0;
float length = 0;
float thickness = 0;
float TrapezoidalParam = 0;
if(trapezoidalBounds)
{
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
width = parameters[0]*2;
length = parameters[3]*2;
thickness = (*trapezoidalBounds).thickness();
TrapezoidalParam = parameters[1]/parameters[0];
}else if(rectangularBounds){
width = DetUnit->surface().bounds().width();
length = DetUnit->surface().bounds().length();
thickness = DetUnit->surface().bounds().thickness();
TrapezoidalParam = 1;
}
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
Detid.rawId(), TrapezoidalParam,
Pos.x(), Pos.y(), Pos.z(),
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
Frog_DetId = DETID_MUON;
FEB = muon;
Frog_DetId += SubDet*100000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
// if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId); FEB_Temp->addDaughter(FEB);}
if(SubDet==1){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "DT"); FEB_Temp->addDaughter(FEB);}
DTChamberId detid = DTChamberId(Detid);
Frog_DetId += (detid.wheel()+3)*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Wheel%+i", detid.wheel()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.station()*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Station%i", detid.station()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.sector()*1;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Sector%i", detid.sector()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==2){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "CSC"); FEB_Temp->addDaughter(FEB);}
CSCDetId detid = CSCDetId(Detid);
Frog_DetId += detid.endcap()*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%i", detid.endcap()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.station()*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Station%i", detid.station()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.ring()*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.chamber()*1;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Chamber%i", detid.chamber()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==3){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "RPC"); FEB_Temp->addDaughter(FEB);}
RPCDetId detid = RPCDetId(Detid);
Frog_DetId += (detid.region()+2)*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Region+%i", detid.region()); FEB_Temp->addDaughter(FEB);}
// Barrel
if(detid.region()==0){
Frog_DetId += (detid.ring()+3)*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring+%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
// Endcap
}else{
Frog_DetId += detid.ring()*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring+%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
}
Frog_DetId += detid.station()*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Station%i", detid.station()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.sector()*1;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Sector%i", detid.sector()); FEB_Temp->addDaughter(FEB);}
}
FEB->addDaughter(mod);
}
// ### CALO GEOMETRY ###
const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
for(unsigned int i=0;i<CaloDets.size();i++)
{
Detid = CaloDets[i];
SubDet = Detid.subdetId();
if(Detid.det()==DetId::Ecal){
if(SubDet<1 || SubDet>3) continue;
Frog_DetId = DETID_ECAL;
FEB = ecal;
Frog_DetId += SubDet*100000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
// if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId); FEB_Temp->addDaughter(FEB);}
if(SubDet==1){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "EB"); FEB_Temp->addDaughter(FEB);}
EBDetId detid = EBDetId(Detid);
Frog_DetId += ((detid.zside()==1)+1)*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += (detid.tower_ieta()*detid.zside())*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TowerIEta%+i", detid.tower_ieta()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.tower_iphi()*1;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TowerIPhi%i", detid.tower_iphi()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==2){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "EE"); FEB_Temp->addDaughter(FEB);}
EEDetId detid = EEDetId(Detid);
Frog_DetId += ((detid.zside()==1)+1)*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.iquadrant()*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Quadran%i", detid.iquadrant()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.isc();
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "ISC%i", detid.isc()); FEB_Temp->addDaughter(FEB);}
}else if(SubDet==3){
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "ES"); FEB_Temp->addDaughter(FEB);}
ESDetId detid = ESDetId(Detid);
Frog_DetId += ((detid.zside()==1)+1)*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.plane()*1000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Plane%i", detid.plane()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.six()*50;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Six%i", detid.six()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.siy();
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Siy%i", detid.siy()); FEB_Temp->addDaughter(FEB);}
}
}else if(Detid.det()==DetId::Hcal){
if(SubDet<1 || SubDet>4) continue;
Frog_DetId = DETID_HCAL;
FEB = hcal;
Frog_DetId += SubDet*100000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){
if(SubDet==1){ FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HB"); FEB_Temp->addDaughter(FEB);}
if(SubDet==2){ FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HE"); FEB_Temp->addDaughter(FEB);}
if(SubDet==3){ FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HO"); FEB_Temp->addDaughter(FEB);}
if(SubDet==4){ FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HF"); FEB_Temp->addDaughter(FEB);}
}
HcalDetId detid = HcalDetId(Detid);
Frog_DetId += ((detid.zside()==1)+1)*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.ietaAbs()*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IEta%+i", detid.ieta()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.iphi()*1;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IPhi%i", detid.iphi()); FEB_Temp->addDaughter(FEB);}
}else if(Detid.det() == DetId::Calo){
Frog_DetId = DETID_CALO;
FEB = calo;
if(SubDet!=(unsigned int)CaloTowerDetId::SubdetId)continue;
Frog_DetId += SubDet*100000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "CaloTowers"); FEB_Temp->addDaughter(FEB);}
if(SubDet==(unsigned int)CaloTowerDetId::SubdetId){
CaloTowerDetId detid = CaloTowerDetId(Detid);
Frog_DetId += ((detid.zside()==1)+1)*10000;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += (detid.ieta()*detid.zside())*100;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IEta%+i", detid.ieta()); FEB_Temp->addDaughter(FEB);}
Frog_DetId += detid.iphi()*1;
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IPhi%i", detid.iphi()); FEB_Temp->addDaughter(FEB);}
}
}
const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
GlobalPoint CellPos = CellGeom->getPosition();
const CaloCellGeometry::CornersVec CellCorners = CellGeom->getCorners();
float cX = (CellCorners[0].x() + CellCorners[2].x())/2;
float cY = (CellCorners[0].y() + CellCorners[2].y())/2;
float cZ = (CellCorners[0].z() + CellCorners[2].z())/2;
float wX = (CellCorners[1].x() - CellCorners[0].x())/2;
float wY = (CellCorners[1].y() - CellCorners[0].y())/2;
float wZ = (CellCorners[1].z() - CellCorners[0].z())/2;
float hX = (CellCorners[3].x() - CellCorners[0].x())/2;
float hY = (CellCorners[3].y() - CellCorners[0].y())/2;
float hZ = (CellCorners[3].z() - CellCorners[0].z())/2;
float F = sqrt( pow(CellCorners[4].x()+CellCorners[6].x(),2) + pow(CellCorners[4].y()+CellCorners[6].y(),2) + pow(CellCorners[4].z()+CellCorners[6].z(),2) );
F /= sqrt( pow(CellCorners[0].x()+CellCorners[2].x(),2) + pow(CellCorners[0].y()+CellCorners[2].y(),2) + pow(CellCorners[0].z()+CellCorners[2].z(),2) );
FROG_Element_Geom_CaloMod* mod = new FROG_Element_Geom_CaloMod(
Detid.rawId(), F,
cX , cY , cZ ,
wX , wY , wZ ,
hX , hY , hZ );
FEB->addDaughter(mod);
}
// ### Save .geom ###
FROG_Geometry* CMS_Geom = new FROG_Geometry(prim);
CMS_Geom->Save("CMS.geom", CompressFiles);
delete CMS_Geom;
}
events = new FROG_Events();
}
// ------------ method called once each job just after ending the event loop ------------
void
Frog_Analyzer::endJob()
{
if(NEvents>0){
char OutputFileName[1024];
sprintf(OutputFileName,"%s",OutputFile.substr(0,OutputFile.size()-4).c_str());
if(NEventsInVisFile>=0 && !FixedOutputName){
sprintf(OutputFileName,"%s_%i",OutputFileName,FileIndex);
if(AddRunInfoInName)sprintf(OutputFileName,"%s_Run%i_1stEvent%08i",OutputFileName,SRun,SEvent);
}
sprintf(OutputFileName,"%s.vis",OutputFileName);
events->SaveInLive((char*) OutputFileName, true, CompressFiles);
delete events;
NEvents=0;
}
}
//
// member functions
//
// ------------ method called to for each event ------------
void
Frog_Analyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
iSetup.get<MuonGeometryRecord>().get( DtGeom );
iSetup.get<MuonGeometryRecord>().get( CscGeom );
iSetup.get<MuonGeometryRecord>().get( RpcGeom );
iSetup.get<CaloGeometryRecord>().get( CaloGeom );
if(NEvents == 0){
SRun = iEvent.id().run();
SEvent = iEvent.id().event();
}
FROG_Element_Event* event = new FROG_Element_Event(iEvent.id().run(), iEvent.id().event(), iEvent.time().value() );
events->AddEvent(event);
// ### GEN OBJECTS CONTAINER ###
FROG_Element_Base_With_DetId_And_Name* frogGen = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN, "GEN");
event->addDaughter(frogGen);
// ### GENPARTICLES ###
FROG_Element_Base_With_DetId_And_Name* frogGenPartColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN_CAND, "GenParticles");
frogGen->addDaughter(frogGenPartColl);
for(unsigned int i=0;i<GenParticlesProducers.size();i++){
edm::Handle<GenParticleCollection> h_gen_Particles;
iEvent.getByLabel(InputTag(GenParticlesProducers[i]), h_gen_Particles);
if(!h_gen_Particles.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << GenParticlesProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
GenParticleCollection gen_Particles = *h_gen_Particles.product();
FROG_Element_Base_With_DetId_And_Name* frogGenPartCollb = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN_CAND + i + 1, GenParticlesProducers[i].c_str());
frogGenPartColl->addDaughter(frogGenPartCollb);
for(unsigned int h=0;h<gen_Particles.size();h++){
if(gen_Particles[h].status()!=1)continue;
FROG_Element_Event_Candidate* frogGenPart = new FROG_Element_Event_Candidate(gen_Particles[h].pdgId(), gen_Particles[h].p(), gen_Particles[h].eta(), gen_Particles[h].phi());
frogGenPartCollb->addDaughter(frogGenPart);
}
}
// ### GEN Jets ###
FROG_Element_Base_With_DetId_And_Name* frogGenJet = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_GEN, "GenJets");
frogGen->addDaughter(frogGenJet);
for(unsigned int i=0;i<GenJetsProducers.size();i++){
edm::Handle<GenJetCollection> h_Gen_Jets;
iEvent.getByLabel(InputTag(GenJetsProducers[i]), h_Gen_Jets);
if(!h_Gen_Jets.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << GenJetsProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
GenJetCollection Gen_Jets = *h_Gen_Jets.product();
FROG_Element_Base_With_DetId_And_Name* frogGenJetColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_GEN + i + 1, GenJetsProducers[i].c_str());
frogGenJet->addDaughter(frogGenJetColl);
for(unsigned int h=0;h<Gen_Jets.size();h++){
FROG_Element_Event_Jet* frogGenJet = new FROG_Element_Event_Jet(Gen_Jets[h].p(), Gen_Jets[h].eta(),Gen_Jets[h].phi());
frogGenJetColl->addDaughter(frogGenJet);
}
}
// ### GEN MET ###
FROG_Element_Base_With_DetId_And_Name* frogGenMET = new FROG_Element_Base_With_DetId_And_Name( EVTID_MET_GEN, "GenMET");
frogGen->addDaughter(frogGenMET);
for(unsigned int i=0;i<GenMETProducers.size();i++){
edm::Handle<GenMETCollection> h_Genmet;
iEvent.getByLabel(InputTag(GenMETProducers[i]), h_Genmet);
if(!h_Genmet.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << GenMETProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
GenMETCollection gen_met = *h_Genmet.product();
FROG_Element_Base_With_DetId_And_Name* frogGenMETColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MET_GEN + i + 1, GenMETProducers[i].c_str());
frogGenMET->addDaughter(frogGenMETColl);
for(unsigned int h=0;h<gen_met.size();h++){
FROG_Element_Event_MET* frogGenMETevt = new FROG_Element_Event_MET(i, gen_met[h].p(), gen_met[h].eta(),gen_met[h].phi(), gen_met[h].sumEt());
frogGenMETColl->addDaughter(frogGenMETevt);
}
}
// ### SIM OBJECTS CONTAINER ###
FROG_Element_Base_With_DetId_And_Name* frogSim = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIM, "SIM");
event->addDaughter(frogSim);
// ### SIMTRACK ###
FROG_Element_Base_With_DetId_And_Name* frogSimTrkColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMTRK, "SimTracks");
frogSim->addDaughter(frogSimTrkColl);
for(unsigned int i=0;i<SimTrackProducers.size();i++){
edm::Handle<std::vector< SimTrack > > h_SimTracks;
iEvent.getByLabel(InputTag(SimTrackProducers[i]), h_SimTracks);
if(!h_SimTracks.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << SimTrackProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
SimTrack simTrack =SimTrackColl[a];
FROG_Element_Event_Sim_Track* frogSimTrk = new FROG_Element_Event_Sim_Track(simTrack.trackId(),
simTrack.momentum().x(), simTrack.momentum().y(), simTrack.momentum().z(),
simTrack.momentum().e(), simTrack.type(), simTrack.vertIndex(),
simTrack.charge() );
frogSimTrkColl->addDaughter(frogSimTrk);
}
}
// ### SIMVERTEX ###
FROG_Element_Base_With_DetId_And_Name* frogSimVtx = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMVTX, "SimVertex");
frogSim->addDaughter(frogSimVtx);
for(unsigned int i=0;i<SimVertexProducers.size();i++){
edm::Handle<std::vector< SimVertex > > h_Vertex;
iEvent.getByLabel(InputTag(SimVertexProducers[i]), h_Vertex);
if(!h_Vertex.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << SimVertexProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
std::vector< SimVertex > VertexColl = *h_Vertex.product();
for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
SimVertex Vertex = VertexColl[b];
FROG_Element_Event_Sim_Vertex* frogSimVertex = new FROG_Element_Event_Sim_Vertex(
Vertex.position().x(), Vertex.position().y(), Vertex.position().z(),
Vertex.parentIndex());
frogSimVtx->addDaughter(frogSimVertex);
}
}
// ### SIMHIT ###
FROG_Element_Base_With_DetId_And_Name* frogSimHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMHIT, "SimHits");
frogSim->addDaughter(frogSimHit);
for(unsigned int i=0;i<SimHitProducers.size();i++){
edm::Handle<std::vector< PSimHit > > h_Hits;
iEvent.getByLabel(InputTag(SimHitProducers[i]), h_Hits);
if(!h_Hits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << SimHitProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
std::vector< PSimHit > Hits = *h_Hits.product();
FROG_Element_Base_With_DetId_And_Name* frogSimHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMHIT + i + 1, SimHitProducers[i].c_str() );
frogSimHit->addDaughter(frogSimHitColl);
for(unsigned int h=0; h<Hits.size(); h++)
{
DetId theDetUnitId(Hits[h].detUnitId());
const GeomDet* theDet = NULL;
if(theDetUnitId.det() == DetId::Tracker)theDet = tkGeom->idToDet(theDetUnitId);
if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::DT) theDet = DtGeom->idToDet(theDetUnitId);
if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::CSC)theDet = CscGeom->idToDet(theDetUnitId);
if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::RPC)theDet = RpcGeom->idToDet(theDetUnitId);
FROG_Element_Event_Sim_Hit* frogSimHit = new FROG_Element_Event_Sim_Hit(
theDet->surface().toGlobal(Hits[h].localPosition()).x(),theDet->surface().toGlobal(Hits[h].localPosition()).y(),theDet->surface().toGlobal(Hits[h].localPosition()).z(),
Hits[h].energyLoss(), Hits[h].processType() );
frogSimHitColl->addDaughter(frogSimHit);
}
}
// ### SIMCALOHIT ###
for(unsigned int i=0;i<SimCaloHitProducers.size();i++){
edm::Handle<std::vector< PCaloHit > > h_CaloHits;
iEvent.getByLabel(InputTag(SimCaloHitProducers[i]), h_CaloHits);
if(!h_CaloHits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << SimCaloHitProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
std::vector< PCaloHit > CaloHits = *h_CaloHits.product();
FROG_Element_Base_With_DetId_And_Name* frogSimHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMHIT + SimHitProducers.size() + i + 1, SimCaloHitProducers[i].c_str());
frogSimHit->addDaughter(frogSimHitColl);
for(unsigned int h=0; h<CaloHits.size(); h++)
{
DetId theDetUnitId(CaloHits[h].id());
const CaloCellGeometry* CellGeom = NULL;
if(theDetUnitId.det() == DetId::Ecal || theDetUnitId.det() == DetId::Hcal)CellGeom = CaloGeom->getGeometry(theDetUnitId);
if(CellGeom==NULL)continue;
FROG_Element_Event_Sim_Hit* frogSimCaloHit = new FROG_Element_Event_Sim_Hit(
CellGeom->getPosition().x(),CellGeom->getPosition().y(),CellGeom->getPosition().z(),
CaloHits[h].energy(), CaloHits[h].depth() );
frogSimHitColl->addDaughter(frogSimCaloHit);
}
}
// ### LOW RECO OBJECTS CONTAINER ###
FROG_Element_Base_With_DetId_And_Name* frogLowReco = new FROG_Element_Base_With_DetId_And_Name( EVTID_LOWRECO, "RECO LOW");
event->addDaughter(frogLowReco);
// ### Pixels Clusters ###
FROG_Element_Base_With_DetId_And_Name* frogPXHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_PIXELCLUSTER, "Pixels Clusters");
frogLowReco->addDaughter(frogPXHit);
for(unsigned int i=0;i<SiPixelClusterProducers.size();i++){
edm::Handle<edmNew::DetSetVector<SiPixelCluster> > h_Px_Hits;
iEvent.getByLabel(InputTag(SiPixelClusterProducers[i]), h_Px_Hits);
if(!h_Px_Hits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << SiPixelClusterProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
const edmNew::DetSetVector<SiPixelCluster>& Px_Hits = *h_Px_Hits.product();
FROG_Element_Base_With_DetId_And_Name* frogPxHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_PIXELCLUSTER + i + 1, SiPixelClusterProducers[i].c_str());
frogPXHit->addDaughter(frogPxHitColl);
for (edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter = Px_Hits.begin(); DSViter != Px_Hits.end(); ++DSViter) {
edmNew::DetSet<SiPixelCluster>::const_iterator begin=DSViter->begin();
edmNew::DetSet<SiPixelCluster>::const_iterator end =DSViter->end();
DetId detIdObject(DSViter->detId());
const GeomDetUnit* genericDet = tkGeom->idToDetUnit( detIdObject );
if(!genericDet)continue;
const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(genericDet);
if(!pixDet)continue;
const RectangularPixelTopology* pixelTopo = dynamic_cast<const RectangularPixelTopology*>(&(pixDet->specificTopology()));
for(edmNew::DetSet<SiPixelCluster>::const_iterator iCluster=begin;iCluster!=end;++iCluster){
float Charge = iCluster->charge();
Surface::GlobalPoint Pos = pixDet->surface().toGlobal( pixelTopo->localPosition( MeasurementPoint(iCluster->x(), iCluster->y()) ) ) ;
FROG_Element_Event_Hit* frogPixelClust = new FROG_Element_Event_Hit(DSViter->detId(), Pos.x(), Pos.y(), Pos.z(), Charge);
frogPxHitColl->addDaughter(frogPixelClust);
}}
}
// ### SiStrip Clusters ###
FROG_Element_Base_With_DetId_And_Name* frogSSTHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_SISTRIPCLUSTER, "SiStrip Clusters");
frogLowReco->addDaughter(frogSSTHit);
for(unsigned int i=0;i<SiStripClusterProducers.size();i++){
edm::Handle<edmNew::DetSetVector<SiStripCluster> > h_Sst_Hits;
iEvent.getByLabel(InputTag(SiStripClusterProducers[i]), h_Sst_Hits);
if(!h_Sst_Hits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << SiStripClusterProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
// const edmNew::DetSetVector<SiStripCluster>& Sst_Hits = *h_Sst_Hits.product();
FROG_Element_Base_With_DetId_And_Name* frogSstHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SISTRIPCLUSTER + i + 1, SiStripClusterProducers[i].c_str());
frogSSTHit->addDaughter(frogSstHitColl);
// for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = Sst_Hits.begin(); DSViter != Sst_Hits.end(); ++DSViter) {
for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = h_Sst_Hits->begin(); DSViter != h_Sst_Hits->end(); ++DSViter) {
edmNew::DetSet<SiStripCluster>::const_iterator begin=DSViter->begin();
edmNew::DetSet<SiStripCluster>::const_iterator end =DSViter->end();
for(edmNew::DetSet<SiStripCluster>::const_iterator iCluster=begin;iCluster!=end;++iCluster){
const GeomDetUnit* detUnit = tkGeom->idToDetUnit (DetId( iCluster->geographicalId() ) );
if(!detUnit)continue;
const StripGeomDetUnit* DetUnit = dynamic_cast<const StripGeomDetUnit*> ( detUnit );
if(!DetUnit)continue;
const StripTopology& Topo = DetUnit->specificTopology();
unsigned int Charge = 0;
for(unsigned int i=0;i<iCluster->amplitudes().size();i++){Charge+=iCluster->amplitudes()[i];}
unsigned int MiddleStrip = iCluster->firstStrip() + iCluster->amplitudes().size()/2;
float Pitch = DetUnit->surface().bounds().width() / Topo.nstrips();
float XPos = (MiddleStrip * Pitch) - DetUnit->surface().bounds().width()/2;
//float YPos = DetUnit->surface().bounds().thickness()/2;
//float ZPos = DetUnit->surface().bounds().length()/2;
Surface::GlobalPoint Pos = DetUnit->surface().toGlobal( LocalPoint(XPos, 0, 0) );
FROG_Element_Event_Cluster_SiStrip* frogStripClust = new FROG_Element_Event_Cluster_SiStrip(iCluster->geographicalId(), iCluster->firstStrip(), Pitch);
for(unsigned int i=0;i<iCluster->amplitudes().size();i++){frogStripClust->Ampl_.push_back(iCluster->amplitudes()[i]);}
frogSstHitColl->addDaughter(frogStripClust);
}}
}
// ### CALORecHits ###
FROG_Element_Base_With_DetId_And_Name* frogCaloHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_CALOHIT, "CALO Hits");
frogLowReco->addDaughter(frogCaloHit);
// ### ECALRecHits ###
FROG_Element_Base_With_DetId_And_Name* frogEcalHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_ECALHIT, "ECAL RecHits");
frogCaloHit->addDaughter(frogEcalHit);
for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
iEvent.getByLabel(InputTag(EcalRecHitProducers[i]), h_Ecal_RecHits);
if(!h_Ecal_RecHits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### NoXXX Label = "<< InputTag(EcalRecHitProducers[i]).label().c_str() << " instance = " << InputTag(EcalRecHitProducers[i]).instance().c_str()<< " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;}
if(!h_Ecal_RecHits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << EcalRecHitProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_ECALHIT + i + 1, EcalRecHitProducers[i].c_str());
frogEcalHit->addDaughter(frogHitColl);
for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((Ecal_RecHits[eh].detid()).rawId(),
Ecal_RecHits[eh].energy(), Ecal_RecHits[eh].time());
frogHitColl->addDaughter(frogCaloHit);
}
}
// ### HCALRecHits ###
FROG_Element_Base_With_DetId_And_Name* frogHcalHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT, "HCAL RecHits");
frogCaloHit->addDaughter(frogHcalHit);
for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){
edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
iEvent.getByLabel(InputTag(HcalHBHERecHitProducers[i]), h_HcalHBHE_RecHits);
if(!h_HcalHBHE_RecHits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << HcalHBHERecHitProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT + i + 1, HcalHBHERecHitProducers[i].c_str());
frogHcalHit->addDaughter(frogHitColl);
for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHBHE_RecHits[hh].detid()).rawId(),
HcalHBHE_RecHits[hh].energy(), HcalHBHE_RecHits[hh].time());
frogHitColl->addDaughter(frogCaloHit);
}
}
for(unsigned int i=0;i<HcalHORecHitProducers.size();i++){
edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
iEvent.getByLabel(InputTag(HcalHORecHitProducers[i]), h_HcalHO_RecHits);
if(!h_HcalHO_RecHits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << HcalHORecHitProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT + HcalHBHERecHitProducers.size() + i + 1, HcalHORecHitProducers[i].c_str());
frogHcalHit->addDaughter(frogHitColl);
for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHO_RecHits[hh].detid()).rawId(),
HcalHO_RecHits[hh].energy(), HcalHO_RecHits[hh].time());
frogHitColl->addDaughter(frogCaloHit);
}
}
for(unsigned int i=0;i<HcalHFRecHitProducers.size();i++){
edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
iEvent.getByLabel(InputTag(HcalHFRecHitProducers[i]), h_HcalHF_RecHits);
if(!h_HcalHF_RecHits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << HcalHFRecHitProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT + HcalHBHERecHitProducers.size() + HcalHORecHitProducers.size() + i + 1, HcalHFRecHitProducers[i].c_str());
frogHcalHit->addDaughter(frogHitColl);
for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHF_RecHits[hh].detid()).rawId(),
HcalHF_RecHits[hh].energy(), HcalHF_RecHits[hh].time());
frogHitColl->addDaughter(frogCaloHit);
}
}
// ### Muon Segments ###
FROG_Element_Base_With_DetId_And_Name* frogMuonSeg = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONSEG, "MuonSegments");
frogLowReco->addDaughter(frogMuonSeg);
for(unsigned int i=0;i<CSCSegmentProducers.size();i++){
edm::Handle<CSCSegmentCollection > h_CSC_Segments;
iEvent.getByLabel(InputTag(CSCSegmentProducers[i]), h_CSC_Segments);
if(!h_CSC_Segments.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << CSCSegmentProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
CSCSegmentCollection CSC_Segments = *h_CSC_Segments.product();
FROG_Element_Base_With_DetId_And_Name* frogSegColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONSEG + i + 1, CSCSegmentProducers[i].c_str());
frogMuonSeg->addDaughter(frogSegColl);
for(unsigned int s=0;s<CSC_Segments.size();s++){
DetId theDetUnitId = CSC_Segments[s].geographicalId();
const GeomDet* theDet = CscGeom->idToDet(theDetUnitId);
FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
theDet->surface().toGlobal(CSC_Segments[s].localPosition()).x() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).y() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).z() ,
theDet->surface().toGlobal(CSC_Segments[s].localDirection()).x(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).y(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).z() );
frogSegColl->addDaughter(frogSeg);
}
}
for(unsigned int i=0;i<DTSegmentProducers.size();i++){
edm::Handle<DTRecSegment4DCollection > h_DT_Segments;
iEvent.getByLabel(InputTag(DTSegmentProducers[i]), h_DT_Segments);
if(!h_DT_Segments.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << DTSegmentProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
DTRecSegment4DCollection DT_Segments = *h_DT_Segments.product();
FROG_Element_Base_With_DetId_And_Name* frogSegColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONSEG + CSCSegmentProducers.size() + i + 1, DTSegmentProducers[i].c_str());
frogMuonSeg->addDaughter(frogSegColl);
for(unsigned int s=0;s<DT_Segments.size();s++){
DetId theDetUnitId = DT_Segments[s].geographicalId();
const GeomDet* theDet = DtGeom->idToDet(theDetUnitId);
FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
theDet->surface().toGlobal(DT_Segments[s].localPosition()).x() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).y() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).z() ,
theDet->surface().toGlobal(DT_Segments[s].localDirection()).x(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).y(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).z() );
frogSegColl->addDaughter(frogSeg);
}
}
// ### Muon Hits ###
FROG_Element_Base_With_DetId_And_Name* frogMuonHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONHIT, "MuonHits");
frogLowReco->addDaughter(frogMuonHit);
for(unsigned int i=0;i<RPCHitsProducers.size();i++){
edm::Handle<RPCRecHitCollection > h_RPC_Hits;
iEvent.getByLabel(InputTag(RPCHitsProducers[i]), h_RPC_Hits);
if(!h_RPC_Hits.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << RPCHitsProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
RPCRecHitCollection RPC_Hits = *h_RPC_Hits.product();
FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONHIT + i + 1, RPCHitsProducers[i].c_str());
frogMuonHit->addDaughter(frogHitColl);
for(unsigned int h=0;h<RPC_Hits.size();h++){
DetId theDetUnitId = RPC_Hits[h].geographicalId();
const GeomDet* theDet = RpcGeom->idToDet(theDetUnitId);
FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(theDetUnitId.rawId(),
theDet->surface().toGlobal(RPC_Hits[h].localPosition()).x() , theDet->surface().toGlobal(RPC_Hits[h].localPosition()).y() , theDet->surface().toGlobal(RPC_Hits[h].localPosition()).z(), -1 );
frogHitColl->addDaughter(frogHit);
}
}
// ### Calo Towers ###
FROG_Element_Base_With_DetId_And_Name* frogCaloTower = new FROG_Element_Base_With_DetId_And_Name( EVTID_CALOTOWER, "CaloTowers");
frogLowReco->addDaughter(frogCaloTower);
for(unsigned int i=0;i<CaloTowersProducers.size();i++){
edm::Handle<CaloTowerCollection> h_Calo_Towers;
iEvent.getByLabel(InputTag(CaloTowersProducers[i]), h_Calo_Towers);
if(!h_Calo_Towers.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << CaloTowersProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
CaloTowerCollection Calo_Towers = *h_Calo_Towers.product();
FROG_Element_Base_With_DetId_And_Name* frogCaloTowerColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_CALOTOWER + i + 1, CaloTowersProducers[i].c_str());
frogCaloTower->addDaughter(frogCaloTowerColl);
for(unsigned int h=0;h<Calo_Towers.size();h++){
FROG_Element_Event_CaloTower* frogTower = new FROG_Element_Event_CaloTower(Calo_Towers[h].id().rawId(), Calo_Towers[h].emEnergy(),Calo_Towers[h].hadEnergy());
frogCaloTowerColl->addDaughter(frogTower);
if(i==0 && CaloTowersProducersBasedOnCaloHits){
frogTower->Components_CollEvtId_ = EVTID_CALOHIT;
for(unsigned int D=0;D<Calo_Towers[h].constituentsSize();D++){frogTower->Components_Vector_.push_back(Calo_Towers[h].constituent(D));}
// std::vector<DetId> TowersDetIds = Calo_Towers[h].constituents();
// for(unsigned int D=0;D<TowersDetIds.size();D++){frogTower->Components_Vector_.push_back(TowersDetIds[D]);}
}
}
}
// ### MED RECO OBJECTS CONTAINER ###
FROG_Element_Base_With_DetId_And_Name* frogMedReco = new FROG_Element_Base_With_DetId_And_Name( EVTID_MEDRECO, "RECO MED");
event->addDaughter(frogMedReco);
/*
FROG_Element_Base_With_DetId_And_Name* frogNIVertex = new FROG_Element_Base_With_DetId_And_Name( EVTID_NUCLINT, "Vertex from NI");
frogMedReco->addDaughter(frogNIVertex);
// NUCLEAR INTERACTIONS
for(unsigned int i=0;i<NIProducers.size();i++) {
edm::Handle<std::vector<reco::NuclearInteraction> > h_NIs;
iEvent.getByLabel(InputTag(NIProducers[i]), h_NIs);
if(!h_NIs.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << NIProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
std::vector<reco::NuclearInteraction> NIs = *h_NIs.product();
FROG_Element_Base_With_DetId_And_Name* frogNIColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_NUCLINT + i + 1, NIProducers[i].c_str());
frogNIVertex->addDaughter(frogNIColl);
for(unsigned int h=0; h<NIs.size();h++){
reco::NuclearInteraction ni = NIs[i];
float vtx_x = ni.vertex().x();
float vtx_y = ni.vertex().y();
float vtx_z = ni.vertex().z();
float like = ni.likelihood();
FROG_Element_Event_NuclInt* frogNI = new FROG_Element_Event_NuclInt(vtx_x, vtx_y, vtx_z, like );
frogNIColl->addDaughter(frogNI);
}
}
*/
// ### TRAJECTORY ###
FROG_Element_Base_With_DetId_And_Name* frogTrk = new FROG_Element_Base_With_DetId_And_Name( EVTID_TRK, "Tracks & Trajectories");
frogMedReco->addDaughter(frogTrk);
for(unsigned int i=0;i<TrajectoryProducers.size();i++){
Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
iEvent.getByLabel(InputTag(TrajectoryProducers[i]), trajTrackAssociationHandle);
if(!trajTrackAssociationHandle.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << TrajectoryProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product();
FROG_Element_Base_With_DetId_And_Name* frogTrkColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_TRK + i + 1, "Traj | %s", TrajectoryProducers[i].c_str());
frogTrk->addDaughter(frogTrkColl);
for(TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it!=TrajToTrackMap.end(); ++it) {
Trajectory recoTraj = *it->key;
reco::TrackRef recoTrack = it->val;
FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(i,it->val->p(),it->val->pt(),it->key->chiSquared());
frogTrkColl->addDaughter(frogTrk);
for(unsigned int d=0;d<dEdXProducers.size();d++){
Handle<ValueMap<DeDxData> > dEdxTrackHandle;
iEvent.getByLabel(dEdXProducers[d], dEdxTrackHandle);
if(!dEdxTrackHandle.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << dEdXProducers[d].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
const ValueMap<DeDxData> dEdxTrack = *dEdxTrackHandle.product();
FROG_Element_Event_dEdX* frogdEdX = new FROG_Element_Event_dEdX(dEdxTrack[recoTrack].dEdx());
frogTrk->addDaughter(frogdEdX);
}
std::vector<TrajectoryMeasurement> measurements = recoTraj.measurements();
for(unsigned int h=0;h<measurements.size();h++){
TrajectoryMeasurement::ConstRecHitPointer h_it = measurements[h].recHit();
if(!h_it->isValid() )continue;
DetId detId = h_it->geographicalId();
GlobalPoint globalPos = measurements[h].updatedState().globalPosition();
FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(detId.rawId(), globalPos.x(),globalPos.y(), globalPos.z(), -1);
frogTrk->addDaughter(frogHit);
}
// printf("Add a Trajectory\n");
}
}
/*
for(unsigned int j=0;j<m_dEdxDiscrimTag.size();j++){
Handle<ValueMap<DeDxData> > dEdxTrackHandle;
try { iEvent.getByLabel(m_dEdxDiscrimTag[j], dEdxTrackHandle); } catch (...) {;}
const ValueMap<DeDxData> dEdxTrack = *dEdxTrackHandle.product();
(estimator[j])[NTracks] = dEdxTrack[track].dEdx();
(NOM [j])[NTracks] = dEdxTrack[track].numberOfMeasurements();
}
*/
// ### TRACK ###
for(unsigned int i=0;i<TrackProducers.size();i++){
edm::Handle<std::vector< reco::Track > > h_Tracks;
iEvent.getByLabel(InputTag(TrackProducers[i]), h_Tracks);
if(!h_Tracks.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << TrackProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
std::vector< reco::Track > TrackColl = *h_Tracks.product();
FROG_Element_Base_With_DetId_And_Name* frogTrkColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_TRK + TrajectoryProducers.size() + i + 1, "Track | %s", TrackProducers[i].c_str());
frogTrk->addDaughter(frogTrkColl);
//printf("Size of the TrackCOllection : %i = %i\n",i,TrackColl.size());
for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
reco::Track recoTrack =TrackColl[t];
FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(TrajectoryProducers.size()+i,recoTrack.p(),recoTrack.pt(), recoTrack.chi2());
frogTrkColl->addDaughter(frogTrk);
for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
TrackingRecHitRef h_it = recoTrack.recHit(h);
if(!h_it->isValid() )continue;
DetId detId = h_it->geographicalId();
const GeomDet * theDet = NULL;
if(detId.det()==DetId::Tracker) theDet = tkGeom->idToDet(detId);
if(detId.det()==DetId::Muon && detId.subdetId() == 1) theDet = DtGeom->idToDet(detId);
if(detId.det()==DetId::Muon && detId.subdetId() == 2) theDet = CscGeom->idToDet(detId);
if(detId.det()==DetId::Muon && detId.subdetId() == 3) theDet = RpcGeom->idToDet(detId);
LocalPoint localPos = h_it->localPosition();
FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(
detId.rawId(),
theDet->surface().toGlobal(localPos).x(),
theDet->surface().toGlobal(localPos).y(),
theDet->surface().toGlobal(localPos).z(),
-1);
frogTrk->addDaughter(frogHit);
}
//printf("Add a Track\n");
}
}
// ### HIGH RECO OBJECTS CONTAINER ###
FROG_Element_Base_With_DetId_And_Name* frogHighReco = new FROG_Element_Base_With_DetId_And_Name( EVTID_HIGHRECO, "RECO HIGH");
event->addDaughter(frogHighReco);
FROG_Element_Base_With_DetId_And_Name* frogJet = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET, "Jets");
frogHighReco->addDaughter(frogJet);
// ### Basic Jets ###
FROG_Element_Base_With_DetId_And_Name* frogBasicJet = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_BASIC, "BasicJets");
frogJet->addDaughter(frogBasicJet);
for(unsigned int i=0;i<BasicJetsProducers.size();i++){
edm::Handle<BasicJetCollection> h_Basic_Jets;
iEvent.getByLabel(InputTag(BasicJetsProducers[i]), h_Basic_Jets);
if(!h_Basic_Jets.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << BasicJetsProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
BasicJetCollection Basic_Jets = *h_Basic_Jets.product();
FROG_Element_Base_With_DetId_And_Name* frogBasicJetColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_BASIC + i + 1, BasicJetsProducers[i].c_str());
frogBasicJet->addDaughter(frogBasicJetColl);
for(unsigned int h=0;h<Basic_Jets.size();h++){
FROG_Element_Event_Jet* frogJet = new FROG_Element_Event_Jet(Basic_Jets[h].p(), Basic_Jets[h].eta(),Basic_Jets[h].phi());
frogBasicJetColl->addDaughter(frogJet);
}
}
// ### Calo Jets ###
FROG_Element_Base_With_DetId_And_Name* frogCaloJet = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_CALO, "CaloJets");
frogJet->addDaughter(frogCaloJet);
for(unsigned int i=0;i<CaloJetsProducers.size();i++){
edm::Handle<CaloJetCollection> h_Calo_Jets;
iEvent.getByLabel(InputTag(CaloJetsProducers[i]), h_Calo_Jets);
if(!h_Calo_Jets.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << CaloJetsProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
CaloJetCollection Calo_Jets = *h_Calo_Jets.product();
FROG_Element_Base_With_DetId_And_Name* frogCaloJetColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_CALO + i + 1, CaloJetsProducers[i].c_str());
frogCaloJet->addDaughter(frogCaloJetColl);
for(unsigned int h=0;h<Calo_Jets.size();h++){
FROG_Element_Event_Jet* frogJet = new FROG_Element_Event_Jet(Calo_Jets[h].p(), Calo_Jets[h].eta(),Calo_Jets[h].phi());
frogCaloJetColl->addDaughter(frogJet);
if(CaloJetsProducersBasedOnCaloTowers){
std::vector<CaloTowerPtr> CaloTowers = Calo_Jets[h].getCaloConstituents();
frogJet->Components_CollEvtId_ = EVTID_CALOTOWER + 1;
for(unsigned int t=0;t<CaloTowers.size();t++){ frogJet->Components_Vector_.push_back(CaloTowers[t]->id().rawId());}
}
}
}
// ### MET ###
FROG_Element_Base_With_DetId_And_Name* frogMET = new FROG_Element_Base_With_DetId_And_Name( EVTID_MET_CALO, "MET");
frogHighReco->addDaughter(frogMET);
for(unsigned int i=0;i<CaloMETProducers.size();i++){
edm::Handle<CaloMETCollection> h_met;
iEvent.getByLabel(InputTag(CaloMETProducers[i]), h_met);
if(!h_met.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << CaloMETProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
CaloMETCollection reco_met = *h_met.product();
FROG_Element_Base_With_DetId_And_Name* frogMETColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MET_CALO + i + 1, CaloMETProducers[i].c_str());
frogMET->addDaughter(frogMETColl);
for(unsigned int h=0;h<reco_met.size();h++){
FROG_Element_Event_MET* frogMETevt = new FROG_Element_Event_MET(i, reco_met[h].p(), reco_met[h].eta(),reco_met[h].phi(), reco_met[h].sumEt());
frogMETColl->addDaughter(frogMETevt);
}
}
// ### RecoCandidates ###
FROG_Element_Base_With_DetId_And_Name* frogRecoCand = new FROG_Element_Base_With_DetId_And_Name( EVTID_RECOCAND, "RecoCandidates");
frogHighReco->addDaughter(frogRecoCand);
for(unsigned int i=0;i<RecoCandidateProducers.size();i++){
edm::Handle<CandidateCollection> h_reco_Candidates;
iEvent.getByLabel(InputTag(RecoCandidateProducers[i]), h_reco_Candidates);
if(!h_reco_Candidates.isValid()){if(WarningOnMissingProduct)edm::LogWarning("FROG")<<"### No " << RecoCandidateProducers[i].c_str() << " collection is present in the EVENT\nIf you want to remove this warning, update your _cfg.py card, to tell FROG to store only available module\nOr switch off the WarningOnMissingProduct Flag in the Frog Parameter card." << endl;continue;}
CandidateCollection reco_Candidates = *h_reco_Candidates.product();
FROG_Element_Base_With_DetId_And_Name* frogRecoCandColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_RECOCAND + i + 1, RecoCandidateProducers[i].c_str());
frogRecoCand->addDaughter(frogRecoCandColl);
for(unsigned int h=0;h<reco_Candidates.size();h++){
FROG_Element_Event_Candidate* frogCandidate = new FROG_Element_Event_Candidate(reco_Candidates[h].pdgId(), reco_Candidates[h].p(), reco_Candidates[h].eta(),reco_Candidates[h].phi());
frogRecoCandColl->addDaughter(frogCandidate);
}
}
NEvents++;
char OutputFileName[1024];
sprintf(OutputFileName,"%s",OutputFile.substr(0,OutputFile.size()-4).c_str());
if(NEventsInVisFile>=0 && !FixedOutputName){
// if(NEventsInVisFile>=0){
sprintf(OutputFileName,"%s_%i",OutputFileName,FileIndex);
if(AddRunInfoInName)sprintf(OutputFileName,"%s_Run%i_1stEvent%08i",OutputFileName,SRun,SEvent);
}
sprintf(OutputFileName,"%s.vis",OutputFileName);
events->SaveInLive((char*) OutputFileName, false, CompressFiles, (unsigned int)-1);
if(NEvents == NEventsInVisFile){
events->SaveInLive((char*) OutputFileName, true, CompressFiles, (unsigned int)-1);
FileIndex++;
delete events;
events = new FROG_Events();
NEvents=0;
}
}
//define this as a plug-in
DEFINE_FWK_MODULE(Frog_Analyzer);

File Metadata

Mime Type
text/x-c++
Expires
Sat, Dec 21, 2:01 PM (15 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4022225
Default Alt Text
Frog_Analyzer.cc (86 KB)

Event Timeline