ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/src/SuperClusterAnalyzer.cc
Revision: 1.1
Committed: Mon May 19 16:12:28 2008 UTC (16 years, 11 months ago) by mlethuil
Content type: text/plain
Branch: MAIN
CVS Tags: cmssw_1_6_12
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 mlethuil 1.1 #include "UserCode/Morgan/interface/SuperClusterAnalyzer.h"
2    
3     using namespace std;
4     using namespace reco;
5     using namespace edm;
6    
7     SuperClusterAnalyzer::SuperClusterAnalyzer():verbosity(0),iClus(0)
8     {
9     }
10     SuperClusterAnalyzer::~SuperClusterAnalyzer()
11     {
12     }
13    
14     void SuperClusterAnalyzer::Process(const edm::Event& iEvent, TRootEvent* rootEvent, TClonesArray* rootSuperClusters, const string moduleLabel, const string instanceName, const int clusterType)
15     {
16    
17     if(verbosity>1) cout << "SuperClusterAnalyzer Collection name: " << moduleLabel << " : " << instanceName << endl;
18    
19     edm::Handle<reco::SuperClusterCollection> superClustersHandle;
20     iEvent.getByLabel(moduleLabel, instanceName, superClustersHandle);
21     const reco::SuperClusterCollection superClusters = *(superClustersHandle.product());
22    
23     if(verbosity>1) std::cout << "Number of SuperClusters of type " << clusterType << " in the event: " << superClusters.size() << std::endl;
24    
25     Int_t iClusType=0;
26    
27     for( reco::SuperClusterCollection::const_iterator aSuperClus = superClusters.begin(); aSuperClus != superClusters.end(); aSuperClus++)
28     {
29     TRootSuperCluster localClus( aSuperClus->energy(), aSuperClus->eta(), aSuperClus->phi(), aSuperClus->x(), aSuperClus->y(), aSuperClus->z(), clusterType);
30     localClus.setNBasicClusters( aSuperClus->clustersSize () );
31     localClus.setNxtals( (aSuperClus->getHitsByDetId()).size() );
32    
33     for( reco::basicCluster_iterator aBasicClus = aSuperClus->clustersBegin(); aBasicClus != aSuperClus->clustersEnd(); aBasicClus++)
34     {
35     localClus.addSubClusterUID( (aBasicClus->get()->getHitsByDetId())[0] );
36     }
37    
38    
39     if(verbosity>2) cout << localClus << endl;
40     new( (*rootSuperClusters)[iClus] ) TRootSuperCluster(localClus);
41    
42     iClus++;
43     iClusType++;
44    
45     /*
46     reco::basicCluster_iterator bcItr;
47     for(bcItr = aSuperClus->clustersBegin(); bcItr != aSuperClus->clustersEnd(); ++bcItr)
48     {
49     reco::BasicClusterShapeAssociationCollection::const_iterator shapeItr = clusterShapeHandle->find(*aBasicClus);
50     assert(shapeItr != clshpMap.end());
51     const reco::ClusterShapeRef& shapeRef = shapeItr->val;
52     }
53     */
54    
55     }
56     rootEvent->setNSuperClusters(clusterType,iClusType);
57    
58     }